interface.d.ts 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152
  1. import type React from 'react';
  2. export type Placement = 'top' | 'topLeft' | 'topRight' | 'bottom' | 'bottomLeft' | 'bottomRight';
  3. type NoticeSemanticProps = 'wrapper';
  4. export interface NoticeConfig {
  5. content?: React.ReactNode;
  6. duration?: number | null;
  7. showProgress?: boolean;
  8. pauseOnHover?: boolean;
  9. closeIcon?: React.ReactNode;
  10. closable?: boolean | ({
  11. closeIcon?: React.ReactNode;
  12. } & React.AriaAttributes);
  13. className?: string;
  14. style?: React.CSSProperties;
  15. classNames?: {
  16. [key in NoticeSemanticProps]?: string;
  17. };
  18. styles?: {
  19. [key in NoticeSemanticProps]?: React.CSSProperties;
  20. };
  21. /** @private Internal usage. Do not override in your code */
  22. props?: React.HTMLAttributes<HTMLDivElement> & Record<string, any>;
  23. onClose?: VoidFunction;
  24. onClick?: React.MouseEventHandler<HTMLDivElement>;
  25. }
  26. export interface OpenConfig extends NoticeConfig {
  27. key: React.Key;
  28. placement?: Placement;
  29. content?: React.ReactNode;
  30. duration?: number | null;
  31. }
  32. export type InnerOpenConfig = OpenConfig & {
  33. times?: number;
  34. };
  35. export type Placements = Partial<Record<Placement, OpenConfig[]>>;
  36. export type StackConfig = boolean | {
  37. /**
  38. * When number is greater than threshold, notifications will be stacked together.
  39. * @default 3
  40. */
  41. threshold?: number;
  42. /**
  43. * Offset when notifications are stacked together.
  44. * @default 8
  45. */
  46. offset?: number;
  47. /**
  48. * Spacing between each notification when expanded.
  49. */
  50. gap?: number;
  51. };
  52. export {};