infinity-ui-elements 1.8.64 → 1.9.1
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/dist/components/Toast/Toast.d.ts +74 -0
- package/dist/components/Toast/Toast.d.ts.map +1 -0
- package/dist/components/Toast/Toast.stories.d.ts +16 -0
- package/dist/components/Toast/Toast.stories.d.ts.map +1 -0
- package/dist/components/Toast/ToastProvider.d.ts +79 -0
- package/dist/components/Toast/ToastProvider.d.ts.map +1 -0
- package/dist/components/Toast/index.d.ts +5 -0
- package/dist/components/Toast/index.d.ts.map +1 -0
- package/dist/index.css +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.esm.js +336 -3
- package/dist/index.esm.js.map +1 -1
- package/dist/index.js +338 -2
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
export interface ToastProps extends Omit<React.HTMLAttributes<HTMLDivElement>, "title" | "id"> {
|
|
3
|
+
/**
|
|
4
|
+
* Unique identifier for the toast
|
|
5
|
+
*/
|
|
6
|
+
id?: string;
|
|
7
|
+
/**
|
|
8
|
+
* Type of toast - determines behavior and styling
|
|
9
|
+
* - information: Auto-dismisses after duration, colored background (default position: bottom-center)
|
|
10
|
+
* - promotional: Stays until user dismisses, white background with more content (default position: bottom-right)
|
|
11
|
+
*/
|
|
12
|
+
type?: "information" | "promotional";
|
|
13
|
+
/**
|
|
14
|
+
* Intent/theme of the toast (only applicable for information type)
|
|
15
|
+
*/
|
|
16
|
+
intent?: "neutral" | "positive" | "negative" | "notice" | "info";
|
|
17
|
+
/**
|
|
18
|
+
* Position of the toast
|
|
19
|
+
* - information type default: bottom-center
|
|
20
|
+
* - promotional type default: bottom-right
|
|
21
|
+
*/
|
|
22
|
+
position?: "top-left" | "top-center" | "top-right" | "bottom-left" | "bottom-center" | "bottom-right";
|
|
23
|
+
/**
|
|
24
|
+
* Icon to display. If not provided, an icon will be automatically selected based on intent
|
|
25
|
+
*/
|
|
26
|
+
icon?: React.ReactNode;
|
|
27
|
+
/**
|
|
28
|
+
* Main message content (required for information type)
|
|
29
|
+
*/
|
|
30
|
+
message?: string;
|
|
31
|
+
/**
|
|
32
|
+
* Optional heading (primarily for promotional type)
|
|
33
|
+
*/
|
|
34
|
+
heading?: string;
|
|
35
|
+
/**
|
|
36
|
+
* Optional description (primarily for promotional type)
|
|
37
|
+
*/
|
|
38
|
+
description?: string;
|
|
39
|
+
/**
|
|
40
|
+
* Link text to display on the right
|
|
41
|
+
*/
|
|
42
|
+
linkText?: string;
|
|
43
|
+
/**
|
|
44
|
+
* Callback fired when the link is clicked
|
|
45
|
+
*/
|
|
46
|
+
onLinkClick?: () => void;
|
|
47
|
+
/**
|
|
48
|
+
* Button text (for promotional type)
|
|
49
|
+
*/
|
|
50
|
+
buttonText?: string;
|
|
51
|
+
/**
|
|
52
|
+
* Callback fired when the button is clicked
|
|
53
|
+
*/
|
|
54
|
+
onButtonClick?: () => void;
|
|
55
|
+
/**
|
|
56
|
+
* Callback fired when the close button is clicked
|
|
57
|
+
*/
|
|
58
|
+
onClose?: () => void;
|
|
59
|
+
/**
|
|
60
|
+
* Duration in milliseconds before auto-dismiss (only for information type)
|
|
61
|
+
* @default 5000
|
|
62
|
+
*/
|
|
63
|
+
duration?: number;
|
|
64
|
+
/**
|
|
65
|
+
* Whether to show the toast
|
|
66
|
+
*/
|
|
67
|
+
isVisible?: boolean;
|
|
68
|
+
/**
|
|
69
|
+
* Custom class name
|
|
70
|
+
*/
|
|
71
|
+
className?: string;
|
|
72
|
+
}
|
|
73
|
+
export declare const Toast: React.ForwardRefExoticComponent<ToastProps & React.RefAttributes<HTMLDivElement>>;
|
|
74
|
+
//# sourceMappingURL=Toast.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.ts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"./index";
|
|
3
|
+
declare const meta: Meta<typeof Toast>;
|
|
4
|
+
export default meta;
|
|
5
|
+
type Story = StoryObj<typeof Toast>;
|
|
6
|
+
export declare const InformationNeutral: Story;
|
|
7
|
+
export declare const InformationPositive: Story;
|
|
8
|
+
export declare const InformationNegative: Story;
|
|
9
|
+
export declare const InformationNotice: Story;
|
|
10
|
+
export declare const InformationInfo: Story;
|
|
11
|
+
export declare const Promotional: Story;
|
|
12
|
+
export declare const ProgrammaticUsage: Story;
|
|
13
|
+
export declare const CustomPositions: Story;
|
|
14
|
+
export declare const AutoDismiss: Story;
|
|
15
|
+
export declare const AdvancedUsage: Story;
|
|
16
|
+
//# sourceMappingURL=Toast.stories.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Toast.stories.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/Toast.stories.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,IAAI,EAAE,QAAQ,EAAE,MAAM,kBAAkB,CAAC;AACvD,OAAO,EAAE,KAAK,EAA2B,MAAM,SAAS,CAAC;AAGzD,QAAA,MAAM,IAAI,EAAE,IAAI,CAAC,OAAO,KAAK,CAO5B,CAAC;AAEF,eAAe,IAAI,CAAC;AACpB,KAAK,KAAK,GAAG,QAAQ,CAAC,OAAO,KAAK,CAAC,CAAC;AAGpC,eAAO,MAAM,kBAAkB,EAAE,KAUhC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAUjC,CAAC;AAEF,eAAO,MAAM,mBAAmB,EAAE,KAUjC,CAAC;AAEF,eAAO,MAAM,iBAAiB,EAAE,KAU/B,CAAC;AAEF,eAAO,MAAM,eAAe,EAAE,KAU7B,CAAC;AAEF,eAAO,MAAM,WAAW,EAAE,KAUzB,CAAC;AAuIF,eAAO,MAAM,iBAAiB,EAAE,KAM/B,CAAC;AAoEF,eAAO,MAAM,eAAe,EAAE,KAM7B,CAAC;AAqEF,eAAO,MAAM,WAAW,EAAE,KAMzB,CAAC;AAoEF,eAAO,MAAM,aAAa,EAAE,KAM3B,CAAC"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import { ToastProps } from "./Toast";
|
|
3
|
+
export interface ToastOptions extends Omit<ToastProps, "isVisible" | "id"> {
|
|
4
|
+
/**
|
|
5
|
+
* Unique identifier for the toast (auto-generated if not provided)
|
|
6
|
+
*/
|
|
7
|
+
id?: string;
|
|
8
|
+
}
|
|
9
|
+
export interface ToastInstance extends ToastOptions {
|
|
10
|
+
id: string;
|
|
11
|
+
isVisible: boolean;
|
|
12
|
+
}
|
|
13
|
+
interface ToastContextType {
|
|
14
|
+
/**
|
|
15
|
+
* Show an information toast
|
|
16
|
+
*/
|
|
17
|
+
showToast: (options: ToastOptions) => string;
|
|
18
|
+
/**
|
|
19
|
+
* Show a success toast (shorthand for positive intent)
|
|
20
|
+
*/
|
|
21
|
+
success: (message: string, options?: Partial<ToastOptions>) => string;
|
|
22
|
+
/**
|
|
23
|
+
* Show an error toast (shorthand for negative intent)
|
|
24
|
+
*/
|
|
25
|
+
error: (message: string, options?: Partial<ToastOptions>) => string;
|
|
26
|
+
/**
|
|
27
|
+
* Show a warning toast (shorthand for notice intent)
|
|
28
|
+
*/
|
|
29
|
+
warning: (message: string, options?: Partial<ToastOptions>) => string;
|
|
30
|
+
/**
|
|
31
|
+
* Show an info toast (shorthand for info intent)
|
|
32
|
+
*/
|
|
33
|
+
info: (message: string, options?: Partial<ToastOptions>) => string;
|
|
34
|
+
/**
|
|
35
|
+
* Show a promotional toast
|
|
36
|
+
*/
|
|
37
|
+
promotional: (heading: string, description: string, options?: Partial<ToastOptions>) => string;
|
|
38
|
+
/**
|
|
39
|
+
* Dismiss a specific toast by ID
|
|
40
|
+
*/
|
|
41
|
+
dismiss: (id: string) => void;
|
|
42
|
+
/**
|
|
43
|
+
* Dismiss all toasts
|
|
44
|
+
*/
|
|
45
|
+
dismissAll: () => void;
|
|
46
|
+
}
|
|
47
|
+
export interface ToastProviderProps {
|
|
48
|
+
children: React.ReactNode;
|
|
49
|
+
/**
|
|
50
|
+
* Maximum number of toasts to display at once
|
|
51
|
+
* @default 5
|
|
52
|
+
*/
|
|
53
|
+
maxToasts?: number;
|
|
54
|
+
/**
|
|
55
|
+
* Default duration for information toasts in milliseconds
|
|
56
|
+
* @default 5000
|
|
57
|
+
*/
|
|
58
|
+
defaultDuration?: number;
|
|
59
|
+
}
|
|
60
|
+
export declare const ToastProvider: React.FC<ToastProviderProps>;
|
|
61
|
+
/**
|
|
62
|
+
* Hook to access toast functionality
|
|
63
|
+
*
|
|
64
|
+
* @example
|
|
65
|
+
* ```tsx
|
|
66
|
+
* function MyComponent() {
|
|
67
|
+
* const toast = useToast();
|
|
68
|
+
*
|
|
69
|
+
* return (
|
|
70
|
+
* <button onClick={() => toast.success("Saved successfully!")}>
|
|
71
|
+
* Save
|
|
72
|
+
* </button>
|
|
73
|
+
* );
|
|
74
|
+
* }
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
export declare const useToast: () => ToastContextType;
|
|
78
|
+
export {};
|
|
79
|
+
//# sourceMappingURL=ToastProvider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ToastProvider.d.ts","sourceRoot":"","sources":["../../../src/components/Toast/ToastProvider.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAS,UAAU,EAAE,MAAM,SAAS,CAAC;AAG5C,MAAM,WAAW,YAAa,SAAQ,IAAI,CAAC,UAAU,EAAE,WAAW,GAAG,IAAI,CAAC;IACxE;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;CACb;AAED,MAAM,WAAW,aAAc,SAAQ,YAAY;IACjD,EAAE,EAAE,MAAM,CAAC;IACX,SAAS,EAAE,OAAO,CAAC;CACpB;AAED,UAAU,gBAAgB;IACxB;;OAEG;IACH,SAAS,EAAE,CAAC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