interface.ts 1.9 KB

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