interface.d.ts 2.1 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. import type * as React from 'react';
  2. import type { ClosableType } from '../_util/hooks/useClosable';
  3. interface DivProps extends React.HTMLProps<HTMLDivElement> {
  4. 'data-testid'?: string;
  5. }
  6. export declare const NotificationPlacements: readonly ["top", "topLeft", "topRight", "bottom", "bottomLeft", "bottomRight"];
  7. export type NotificationPlacement = (typeof NotificationPlacements)[number];
  8. export type IconType = 'success' | 'info' | 'error' | 'warning';
  9. export interface ArgsProps {
  10. message: React.ReactNode;
  11. description?: React.ReactNode;
  12. /** @deprecated Please use `actions` instead */
  13. btn?: React.ReactNode;
  14. actions?: React.ReactNode;
  15. key?: React.Key;
  16. onClose?: () => void;
  17. duration?: number | null;
  18. showProgress?: boolean;
  19. pauseOnHover?: boolean;
  20. icon?: React.ReactNode;
  21. placement?: NotificationPlacement;
  22. style?: React.CSSProperties;
  23. className?: string;
  24. readonly type?: IconType;
  25. onClick?: () => void;
  26. closeIcon?: React.ReactNode;
  27. closable?: ClosableType;
  28. props?: DivProps;
  29. role?: 'alert' | 'status';
  30. }
  31. type StaticFn = (args: ArgsProps) => void;
  32. export interface NotificationInstance {
  33. success: StaticFn;
  34. error: StaticFn;
  35. info: StaticFn;
  36. warning: StaticFn;
  37. open: StaticFn;
  38. destroy(key?: React.Key): void;
  39. }
  40. export interface GlobalConfigProps {
  41. top?: number;
  42. bottom?: number;
  43. duration?: number;
  44. showProgress?: boolean;
  45. pauseOnHover?: boolean;
  46. prefixCls?: string;
  47. getContainer?: () => HTMLElement | ShadowRoot;
  48. placement?: NotificationPlacement;
  49. closeIcon?: React.ReactNode;
  50. closable?: ClosableType;
  51. rtl?: boolean;
  52. maxCount?: number;
  53. props?: DivProps;
  54. }
  55. export interface NotificationConfig {
  56. top?: number;
  57. bottom?: number;
  58. prefixCls?: string;
  59. getContainer?: () => HTMLElement | ShadowRoot;
  60. placement?: NotificationPlacement;
  61. maxCount?: number;
  62. rtl?: boolean;
  63. stack?: boolean | {
  64. threshold?: number;
  65. };
  66. duration?: number;
  67. showProgress?: boolean;
  68. pauseOnHover?: boolean;
  69. closeIcon?: React.ReactNode;
  70. }
  71. export {};