interface.ts 1.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. import { PopoverProps } from '../popover/index';
  2. export type TagColor =
  3. | 'amber'
  4. | 'blue'
  5. | 'cyan'
  6. | 'green'
  7. | 'grey'
  8. | 'indigo'
  9. | 'light-blue'
  10. | 'light-green'
  11. | 'lime'
  12. | 'orange'
  13. | 'pink'
  14. | 'purple'
  15. | 'red'
  16. | 'teal'
  17. | 'violet'
  18. | 'yellow'
  19. | 'white';
  20. export type TagType = 'ghost' | 'solid' | 'light';
  21. export type TagSize = 'default' | 'small' | 'large';
  22. export type AvatarShape = 'circle' | 'square';
  23. export type TagShape = 'circle' | 'square';
  24. export interface TagProps {
  25. children?: React.ReactNode;
  26. tagKey?: string | number;
  27. size?: TagSize;
  28. color?: TagColor;
  29. type?: TagType;
  30. closable?: boolean;
  31. visible?: boolean;
  32. onClose?: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
  33. onClick?: React.MouseEventHandler<HTMLDivElement>;
  34. style?: React.CSSProperties;
  35. className?: string;
  36. avatarSrc?: string;
  37. avatarShape?: AvatarShape;
  38. shape?: TagShape;
  39. onKeyDown?: React.KeyboardEventHandler<HTMLDivElement>;
  40. 'aria-label'?: React.AriaAttributes['aria-label'];
  41. 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.
  42. }
  43. export interface TagGroupProps<T> {
  44. style?: React.CSSProperties;
  45. className?: string;
  46. maxTagCount?: number;
  47. restCount?: number;
  48. tagList?: (T extends 'custom' ? React.ReactNode : TagProps)[];
  49. size?: 'small' | 'large';
  50. showPopover?: boolean;
  51. popoverProps?: PopoverProps;
  52. avatarShape?: AvatarShape;
  53. mode?: string;
  54. onTagClose: (tagChildren: React.ReactNode, event: React.MouseEvent<HTMLElement>, tagKey: string | number) => void;
  55. }