useNotification.d.ts 1.4 KB

123456789101112131415161718192021222324252627282930313233
  1. import type { CSSProperties } from 'vue';
  2. import type { OpenConfig, Placement } from './Notification';
  3. import type { CSSMotionProps } from '../_util/transition';
  4. import type { Key, VueNode } from '../_util/type';
  5. type OptionalConfig = Partial<OpenConfig>;
  6. export interface NotificationConfig {
  7. prefixCls?: string;
  8. /** Customize container. It will repeat call which means you should return same container element. */
  9. getContainer?: () => HTMLElement;
  10. motion?: CSSMotionProps | ((placement?: Placement) => CSSMotionProps);
  11. closeIcon?: VueNode;
  12. closable?: boolean;
  13. maxCount?: number;
  14. duration?: number;
  15. /** @private. Config for notification holder style. Safe to remove if refactor */
  16. getClassName?: (placement?: Placement) => string;
  17. /** @private. Config for notification holder style. Safe to remove if refactor */
  18. getStyles?: (placement?: Placement) => CSSProperties;
  19. /** @private Trigger when all the notification closed. */
  20. onAllRemoved?: VoidFunction;
  21. hashId?: string;
  22. }
  23. export interface NotificationAPI {
  24. open: (config: OptionalConfig) => void;
  25. close: (key: Key) => void;
  26. destroy: () => void;
  27. }
  28. export default function useNotification(rootConfig?: NotificationConfig): readonly [{
  29. open: (config: OpenConfig) => void;
  30. close: (key: any) => void;
  31. destroy: () => void;
  32. }, () => import("vue/jsx-runtime").JSX.Element];
  33. export {};