interface.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. export type TagColor =
  2. | 'amber'
  3. | 'blue'
  4. | 'cyan'
  5. | 'green'
  6. | 'grey'
  7. | 'indigo'
  8. | 'light-blue'
  9. | 'light-green'
  10. | 'lime'
  11. | 'orange'
  12. | 'pink'
  13. | 'purple'
  14. | 'red'
  15. | 'teal'
  16. | 'violet'
  17. | 'yellow'
  18. | 'white';
  19. export type TagType = 'ghost' | 'solid' | 'light';
  20. export type TagSize = 'default' | 'small' | 'large';
  21. export type AvatarShape = 'circle' | 'square';
  22. export interface TagProps {
  23. children?: React.ReactNode;
  24. tagKey?: string | number;
  25. size?: TagSize;
  26. color?: TagColor;
  27. type?: TagType;
  28. closable?: boolean;
  29. visible?: boolean;
  30. onClose?: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
  31. onClick?: React.MouseEventHandler<HTMLDivElement>;
  32. style?: React.CSSProperties;
  33. className?: string;
  34. avatarSrc?: string;
  35. avatarShape?: AvatarShape;
  36. onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
  37. 'aria-label'?: React.AriaAttributes['aria-label'];
  38. tabIndex?: number; // use internal, when tag in taInput, we want to use left arrow and right arrow to control the tag focus, so the tabIndex need to be -1.
  39. }
  40. export interface TagGroupProps {
  41. style?: React.CSSProperties;
  42. className?: string;
  43. maxTagCount?: number;
  44. tagList?: (TagProps | React.ReactNode)[];
  45. size?: 'small' | 'large';
  46. showPopover?: boolean;
  47. popoverProps?: any; // TODO: 替换成PopoverProps
  48. avatarShape?: AvatarShape;
  49. mode?: string; // TODO: check 文档里没有这个api
  50. }