sonner 1.4.3 → 1.4.32

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sonner",
3
- "version": "1.4.3",
3
+ "version": "1.4.32",
4
4
  "description": "An opinionated toast component for React.",
5
5
  "exports": {
6
6
  "types": "./dist/index.d.ts",
@@ -38,8 +38,10 @@
38
38
  },
39
39
  "devDependencies": {
40
40
  "@playwright/test": "^1.30.0",
41
+ "@types/dompurify": "^3.0.5",
41
42
  "@types/node": "^18.11.13",
42
43
  "@types/react": "^18.0.26",
44
+ "dompurify": "^3.0.9",
43
45
  "prettier": "^2.8.4",
44
46
  "react": "^18.2.0",
45
47
  "react-dom": "^18.2.0",
@@ -51,5 +53,5 @@
51
53
  "react": "^18.0.0",
52
54
  "react-dom": "^18.0.0"
53
55
  },
54
- "packageManager": "pnpm@6.32.11"
56
+ "packageManager": "pnpm@8.12.1"
55
57
  }
package/dist/index.d.mts DELETED
@@ -1,111 +0,0 @@
1
- import React from 'react';
2
-
3
- type ToastTypes = 'normal' | 'action' | 'success' | 'info' | 'warning' | 'error' | 'loading' | 'default';
4
- type PromiseT<Data = any> = Promise<Data> | (() => Promise<Data>);
5
- type PromiseExternalToast = Omit<ExternalToast, 'description'>;
6
- type PromiseData<ToastData = any> = PromiseExternalToast & {
7
- loading?: string | React.ReactNode;
8
- success?: string | React.ReactNode | ((data: ToastData) => React.ReactNode | string);
9
- error?: string | React.ReactNode | ((error: any) => React.ReactNode | string);
10
- description?: string | React.ReactNode | ((data: any) => React.ReactNode | string);
11
- finally?: () => void | Promise<void>;
12
- };
13
- interface ToastClassnames {
14
- toast?: string;
15
- title?: string;
16
- description?: string;
17
- loader?: string;
18
- closeButton?: string;
19
- cancelButton?: string;
20
- actionButton?: string;
21
- success?: string;
22
- error?: string;
23
- info?: string;
24
- warning?: string;
25
- loading?: string;
26
- default?: string;
27
- }
28
- interface ToastT {
29
- id: number | string;
30
- title?: string | React.ReactNode;
31
- type?: ToastTypes;
32
- icon?: React.ReactNode;
33
- jsx?: React.ReactNode;
34
- invert?: boolean;
35
- closeButton?: boolean;
36
- dismissible?: boolean;
37
- description?: React.ReactNode;
38
- duration?: number;
39
- delete?: boolean;
40
- important?: boolean;
41
- action?: {
42
- label: React.ReactNode;
43
- onClick: (event: React.MouseEvent<HTMLButtonElement>) => void;
44
- };
45
- cancel?: {
46
- label: React.ReactNode;
47
- onClick?: (event: React.MouseEvent<HTMLButtonElement>) => void;
48
- };
49
- onDismiss?: (toast: ToastT) => void;
50
- onAutoClose?: (toast: ToastT) => void;
51
- promise?: PromiseT;
52
- cancelButtonStyle?: React.CSSProperties;
53
- actionButtonStyle?: React.CSSProperties;
54
- style?: React.CSSProperties;
55
- unstyled?: boolean;
56
- className?: string;
57
- classNames?: ToastClassnames;
58
- descriptionClassName?: string;
59
- position?: Position;
60
- }
61
- type Position = 'top-left' | 'top-right' | 'bottom-left' | 'bottom-right' | 'top-center' | 'bottom-center';
62
- interface ToastOptions {
63
- className?: string;
64
- closeButton?: boolean;
65
- descriptionClassName?: string;
66
- style?: React.CSSProperties;
67
- cancelButtonStyle?: React.CSSProperties;
68
- actionButtonStyle?: React.CSSProperties;
69
- duration?: number;
70
- unstyled?: boolean;
71
- classNames?: ToastClassnames;
72
- }
73
- interface ToasterProps {
74
- invert?: boolean;
75
- theme?: 'light' | 'dark' | 'system';
76
- position?: Position;
77
- hotkey?: string[];
78
- richColors?: boolean;
79
- expand?: boolean;
80
- duration?: number;
81
- gap?: number;
82
- visibleToasts?: number;
83
- closeButton?: boolean;
84
- toastOptions?: ToastOptions;
85
- className?: string;
86
- style?: React.CSSProperties;
87
- offset?: string | number;
88
- dir?: 'rtl' | 'ltr' | 'auto';
89
- loadingIcon?: React.ReactNode;
90
- containerAriaLabel?: string;
91
- pauseWhenPageIsHidden?: boolean;
92
- }
93
- type ExternalToast = Omit<ToastT, 'id' | 'type' | 'title' | 'jsx' | 'delete' | 'promise'> & {
94
- id?: number | string;
95
- };
96
-
97
- declare const toast: ((message: string | React.ReactNode, data?: ExternalToast) => string | number) & {
98
- success: (message: string | React.ReactNode, data?: ExternalToast) => string | number;
99
- info: (message: string | React.ReactNode, data?: ExternalToast) => string | number;
100
- warning: (message: string | React.ReactNode, data?: ExternalToast) => string | number;
101
- error: (message: string | React.ReactNode, data?: ExternalToast) => string | number;
102
- custom: (jsx: (id: number | string) => React.ReactElement, data?: ExternalToast) => string | number;
103
- message: (message: string | React.ReactNode, data?: ExternalToast) => string | number;
104
- promise: <ToastData>(promise: PromiseT<ToastData>, data?: PromiseData<ToastData>) => string | number;
105
- dismiss: (id?: number | string) => string | number;
106
- loading: (message: string | React.ReactNode, data?: ExternalToast) => string | number;
107
- };
108
-
109
- declare const Toaster: (props: ToasterProps) => React.JSX.Element;
110
-
111
- export { type ExternalToast, type ToastT, Toaster, toast };