@mehdashti/ui 0.1.0
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/README.md +228 -0
- package/dist/components/__tests__/button.test.d.ts +2 -0
- package/dist/components/__tests__/button.test.d.ts.map +1 -0
- package/dist/components/__tests__/button.test.js +105 -0
- package/dist/components/__tests__/button.test.js.map +1 -0
- package/dist/components/__tests__/input.test.d.ts +2 -0
- package/dist/components/__tests__/input.test.d.ts.map +1 -0
- package/dist/components/__tests__/input.test.js +270 -0
- package/dist/components/__tests__/input.test.js.map +1 -0
- package/dist/components/__tests__/label.test.d.ts +2 -0
- package/dist/components/__tests__/label.test.d.ts.map +1 -0
- package/dist/components/__tests__/label.test.js +181 -0
- package/dist/components/__tests__/label.test.js.map +1 -0
- package/dist/components/button.d.ts +28 -0
- package/dist/components/button.d.ts.map +1 -0
- package/dist/components/button.js +45 -0
- package/dist/components/button.js.map +1 -0
- package/dist/components/button.stories.js +103 -0
- package/dist/components/button.stories.js.map +1 -0
- package/dist/components/dialog.d.ts +20 -0
- package/dist/components/dialog.d.ts.map +1 -0
- package/dist/components/dialog.js +22 -0
- package/dist/components/dialog.js.map +1 -0
- package/dist/components/dialog.stories.d.ts +44 -0
- package/dist/components/dialog.stories.d.ts.map +1 -0
- package/dist/components/dialog.stories.js +64 -0
- package/dist/components/dialog.stories.js.map +1 -0
- package/dist/components/input.d.ts +14 -0
- package/dist/components/input.d.ts.map +1 -0
- package/dist/components/input.js +17 -0
- package/dist/components/input.js.map +1 -0
- package/dist/components/input.stories.d.ts +80 -0
- package/dist/components/input.stories.d.ts.map +1 -0
- package/dist/components/input.stories.js +142 -0
- package/dist/components/input.stories.js.map +1 -0
- package/dist/components/label.d.ts +6 -0
- package/dist/components/label.d.ts.map +1 -0
- package/dist/components/label.js +10 -0
- package/dist/components/label.js.map +1 -0
- package/dist/components/label.stories.d.ts +52 -0
- package/dist/components/label.stories.d.ts.map +1 -0
- package/dist/components/label.stories.js +74 -0
- package/dist/components/label.stories.js.map +1 -0
- package/dist/components/select.d.ts +14 -0
- package/dist/components/select.d.ts.map +1 -0
- package/dist/components/select.js +26 -0
- package/dist/components/select.js.map +1 -0
- package/dist/components/select.stories.d.ts +48 -0
- package/dist/components/select.stories.d.ts.map +1 -0
- package/dist/components/select.stories.js +67 -0
- package/dist/components/select.stories.js.map +1 -0
- package/dist/components/table.d.ts +11 -0
- package/dist/components/table.d.ts.map +1 -0
- package/dist/components/table.js +21 -0
- package/dist/components/table.js.map +1 -0
- package/dist/components/tabs.d.ts +8 -0
- package/dist/components/tabs.d.ts.map +1 -0
- package/dist/components/tabs.js +13 -0
- package/dist/components/tabs.js.map +1 -0
- package/dist/components/tabs.stories.d.ts +40 -0
- package/dist/components/tabs.stories.d.ts.map +1 -0
- package/dist/components/tabs.stories.js +100 -0
- package/dist/components/tabs.stories.js.map +1 -0
- package/dist/components/toast.d.ts +16 -0
- package/dist/components/toast.d.ts.map +1 -0
- package/dist/components/toast.js +34 -0
- package/dist/components/toast.js.map +1 -0
- package/dist/components/toast.stories.d.ts +371 -0
- package/dist/components/toast.stories.d.ts.map +1 -0
- package/dist/components/toast.stories.js +228 -0
- package/dist/components/toast.stories.js.map +1 -0
- package/dist/hooks/use-toast.d.ts +45 -0
- package/dist/hooks/use-toast.d.ts.map +1 -0
- package/dist/hooks/use-toast.js +125 -0
- package/dist/hooks/use-toast.js.map +1 -0
- package/dist/index.d.ts +16 -0
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +19 -0
- package/dist/index.js.map +1 -0
- package/dist/lib/utils.d.ts +7 -0
- package/dist/lib/utils.d.ts.map +1 -0
- package/dist/lib/utils.js +10 -0
- package/dist/lib/utils.js.map +1 -0
- package/package.json +115 -0
|
@@ -0,0 +1,371 @@
|
|
|
1
|
+
import type { StoryObj } from '@storybook/react';
|
|
2
|
+
declare const meta: {
|
|
3
|
+
title: string;
|
|
4
|
+
component: import("react").ForwardRefExoticComponent<Omit<import("@radix-ui/react-toast").ToastProps & import("react").RefAttributes<HTMLLIElement>, "ref"> & import("class-variance-authority").VariantProps<(props?: ({
|
|
5
|
+
variant?: "default" | "destructive" | "success" | null | undefined;
|
|
6
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string> & import("react").RefAttributes<HTMLLIElement>>;
|
|
7
|
+
parameters: {
|
|
8
|
+
layout: string;
|
|
9
|
+
};
|
|
10
|
+
tags: string[];
|
|
11
|
+
decorators: ((Story: import("@storybook/core/csf").PartialStoryFn<import("@storybook/react").ReactRenderer, {
|
|
12
|
+
className?: string | undefined | undefined;
|
|
13
|
+
asChild?: boolean | undefined;
|
|
14
|
+
type?: "foreground" | "background" | undefined;
|
|
15
|
+
value?: string | number | readonly string[] | undefined;
|
|
16
|
+
defaultChecked?: boolean | undefined | undefined;
|
|
17
|
+
defaultValue?: string | number | readonly string[] | undefined;
|
|
18
|
+
suppressContentEditableWarning?: boolean | undefined | undefined;
|
|
19
|
+
suppressHydrationWarning?: boolean | undefined | undefined;
|
|
20
|
+
accessKey?: string | undefined | undefined;
|
|
21
|
+
autoCapitalize?: "off" | "none" | "on" | "sentences" | "words" | "characters" | undefined | (string & {}) | undefined;
|
|
22
|
+
autoFocus?: boolean | undefined | undefined;
|
|
23
|
+
contentEditable?: (boolean | "true" | "false") | "inherit" | "plaintext-only" | undefined;
|
|
24
|
+
contextMenu?: string | undefined | undefined;
|
|
25
|
+
dir?: string | undefined | undefined;
|
|
26
|
+
draggable?: (boolean | "true" | "false") | undefined;
|
|
27
|
+
enterKeyHint?: "enter" | "done" | "go" | "next" | "previous" | "search" | "send" | undefined | undefined;
|
|
28
|
+
hidden?: boolean | undefined | undefined;
|
|
29
|
+
id?: string | undefined | undefined;
|
|
30
|
+
lang?: string | undefined | undefined;
|
|
31
|
+
nonce?: string | undefined | undefined;
|
|
32
|
+
slot?: string | undefined | undefined;
|
|
33
|
+
spellCheck?: (boolean | "true" | "false") | undefined;
|
|
34
|
+
style?: import("react").CSSProperties | undefined;
|
|
35
|
+
tabIndex?: number | undefined | undefined;
|
|
36
|
+
title?: string | undefined | undefined;
|
|
37
|
+
translate?: "yes" | "no" | undefined | undefined;
|
|
38
|
+
radioGroup?: string | undefined | undefined;
|
|
39
|
+
role?: import("react").AriaRole | undefined;
|
|
40
|
+
about?: string | undefined | undefined;
|
|
41
|
+
content?: string | undefined | undefined;
|
|
42
|
+
datatype?: string | undefined | undefined;
|
|
43
|
+
inlist?: any;
|
|
44
|
+
prefix?: string | undefined | undefined;
|
|
45
|
+
property?: string | undefined | undefined;
|
|
46
|
+
rel?: string | undefined | undefined;
|
|
47
|
+
resource?: string | undefined | undefined;
|
|
48
|
+
rev?: string | undefined | undefined;
|
|
49
|
+
typeof?: string | undefined | undefined;
|
|
50
|
+
vocab?: string | undefined | undefined;
|
|
51
|
+
autoCorrect?: string | undefined | undefined;
|
|
52
|
+
autoSave?: string | undefined | undefined;
|
|
53
|
+
color?: string | undefined | undefined;
|
|
54
|
+
itemProp?: string | undefined | undefined;
|
|
55
|
+
itemScope?: boolean | undefined | undefined;
|
|
56
|
+
itemType?: string | undefined | undefined;
|
|
57
|
+
itemID?: string | undefined | undefined;
|
|
58
|
+
itemRef?: string | undefined | undefined;
|
|
59
|
+
results?: number | undefined | undefined;
|
|
60
|
+
security?: string | undefined | undefined;
|
|
61
|
+
unselectable?: "on" | "off" | undefined | undefined;
|
|
62
|
+
inputMode?: "none" | "text" | "tel" | "url" | "email" | "numeric" | "decimal" | "search" | undefined | undefined;
|
|
63
|
+
is?: string | undefined | undefined;
|
|
64
|
+
exportparts?: string | undefined | undefined;
|
|
65
|
+
part?: string | undefined | undefined;
|
|
66
|
+
"aria-activedescendant"?: string | undefined | undefined;
|
|
67
|
+
"aria-atomic"?: (boolean | "true" | "false") | undefined;
|
|
68
|
+
"aria-autocomplete"?: "none" | "inline" | "list" | "both" | undefined | undefined;
|
|
69
|
+
"aria-braillelabel"?: string | undefined | undefined;
|
|
70
|
+
"aria-brailleroledescription"?: string | undefined | undefined;
|
|
71
|
+
"aria-busy"?: (boolean | "true" | "false") | undefined;
|
|
72
|
+
"aria-checked"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
73
|
+
"aria-colcount"?: number | undefined | undefined;
|
|
74
|
+
"aria-colindex"?: number | undefined | undefined;
|
|
75
|
+
"aria-colindextext"?: string | undefined | undefined;
|
|
76
|
+
"aria-colspan"?: number | undefined | undefined;
|
|
77
|
+
"aria-controls"?: string | undefined | undefined;
|
|
78
|
+
"aria-current"?: boolean | "false" | "true" | "page" | "step" | "location" | "date" | "time" | undefined | undefined;
|
|
79
|
+
"aria-describedby"?: string | undefined | undefined;
|
|
80
|
+
"aria-description"?: string | undefined | undefined;
|
|
81
|
+
"aria-details"?: string | undefined | undefined;
|
|
82
|
+
"aria-disabled"?: (boolean | "true" | "false") | undefined;
|
|
83
|
+
"aria-dropeffect"?: "none" | "copy" | "execute" | "link" | "move" | "popup" | undefined | undefined;
|
|
84
|
+
"aria-errormessage"?: string | undefined | undefined;
|
|
85
|
+
"aria-expanded"?: (boolean | "true" | "false") | undefined;
|
|
86
|
+
"aria-flowto"?: string | undefined | undefined;
|
|
87
|
+
"aria-grabbed"?: (boolean | "true" | "false") | undefined;
|
|
88
|
+
"aria-haspopup"?: boolean | "false" | "true" | "menu" | "listbox" | "tree" | "grid" | "dialog" | undefined | undefined;
|
|
89
|
+
"aria-hidden"?: (boolean | "true" | "false") | undefined;
|
|
90
|
+
"aria-invalid"?: boolean | "false" | "true" | "grammar" | "spelling" | undefined | undefined;
|
|
91
|
+
"aria-keyshortcuts"?: string | undefined | undefined;
|
|
92
|
+
"aria-label"?: string | undefined | undefined;
|
|
93
|
+
"aria-labelledby"?: string | undefined | undefined;
|
|
94
|
+
"aria-level"?: number | undefined | undefined;
|
|
95
|
+
"aria-live"?: "off" | "assertive" | "polite" | undefined | undefined;
|
|
96
|
+
"aria-modal"?: (boolean | "true" | "false") | undefined;
|
|
97
|
+
"aria-multiline"?: (boolean | "true" | "false") | undefined;
|
|
98
|
+
"aria-multiselectable"?: (boolean | "true" | "false") | undefined;
|
|
99
|
+
"aria-orientation"?: "horizontal" | "vertical" | undefined | undefined;
|
|
100
|
+
"aria-owns"?: string | undefined | undefined;
|
|
101
|
+
"aria-placeholder"?: string | undefined | undefined;
|
|
102
|
+
"aria-posinset"?: number | undefined | undefined;
|
|
103
|
+
"aria-pressed"?: boolean | "false" | "mixed" | "true" | undefined | undefined;
|
|
104
|
+
"aria-readonly"?: (boolean | "true" | "false") | undefined;
|
|
105
|
+
"aria-relevant"?: "additions" | "additions removals" | "additions text" | "all" | "removals" | "removals additions" | "removals text" | "text" | "text additions" | "text removals" | undefined | undefined;
|
|
106
|
+
"aria-required"?: (boolean | "true" | "false") | undefined;
|
|
107
|
+
"aria-roledescription"?: string | undefined | undefined;
|
|
108
|
+
"aria-rowcount"?: number | undefined | undefined;
|
|
109
|
+
"aria-rowindex"?: number | undefined | undefined;
|
|
110
|
+
"aria-rowindextext"?: string | undefined | undefined;
|
|
111
|
+
"aria-rowspan"?: number | undefined | undefined;
|
|
112
|
+
"aria-selected"?: (boolean | "true" | "false") | undefined;
|
|
113
|
+
"aria-setsize"?: number | undefined | undefined;
|
|
114
|
+
"aria-sort"?: "none" | "ascending" | "descending" | "other" | undefined | undefined;
|
|
115
|
+
"aria-valuemax"?: number | undefined | undefined;
|
|
116
|
+
"aria-valuemin"?: number | undefined | undefined;
|
|
117
|
+
"aria-valuenow"?: number | undefined | undefined;
|
|
118
|
+
"aria-valuetext"?: string | undefined | undefined;
|
|
119
|
+
children?: import("react").ReactNode;
|
|
120
|
+
dangerouslySetInnerHTML?: {
|
|
121
|
+
__html: string | TrustedHTML;
|
|
122
|
+
} | undefined | undefined;
|
|
123
|
+
onCopy?: import("react").ClipboardEventHandler<HTMLLIElement> | undefined;
|
|
124
|
+
onCopyCapture?: import("react").ClipboardEventHandler<HTMLLIElement> | undefined;
|
|
125
|
+
onCut?: import("react").ClipboardEventHandler<HTMLLIElement> | undefined;
|
|
126
|
+
onCutCapture?: import("react").ClipboardEventHandler<HTMLLIElement> | undefined;
|
|
127
|
+
onPaste?: import("react").ClipboardEventHandler<HTMLLIElement> | undefined;
|
|
128
|
+
onPasteCapture?: import("react").ClipboardEventHandler<HTMLLIElement> | undefined;
|
|
129
|
+
onCompositionEnd?: import("react").CompositionEventHandler<HTMLLIElement> | undefined;
|
|
130
|
+
onCompositionEndCapture?: import("react").CompositionEventHandler<HTMLLIElement> | undefined;
|
|
131
|
+
onCompositionStart?: import("react").CompositionEventHandler<HTMLLIElement> | undefined;
|
|
132
|
+
onCompositionStartCapture?: import("react").CompositionEventHandler<HTMLLIElement> | undefined;
|
|
133
|
+
onCompositionUpdate?: import("react").CompositionEventHandler<HTMLLIElement> | undefined;
|
|
134
|
+
onCompositionUpdateCapture?: import("react").CompositionEventHandler<HTMLLIElement> | undefined;
|
|
135
|
+
onFocus?: import("react").FocusEventHandler<HTMLLIElement> | undefined;
|
|
136
|
+
onFocusCapture?: import("react").FocusEventHandler<HTMLLIElement> | undefined;
|
|
137
|
+
onBlur?: import("react").FocusEventHandler<HTMLLIElement> | undefined;
|
|
138
|
+
onBlurCapture?: import("react").FocusEventHandler<HTMLLIElement> | undefined;
|
|
139
|
+
onChange?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
140
|
+
onChangeCapture?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
141
|
+
onBeforeInput?: import("react").InputEventHandler<HTMLLIElement> | undefined;
|
|
142
|
+
onBeforeInputCapture?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
143
|
+
onInput?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
144
|
+
onInputCapture?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
145
|
+
onReset?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
146
|
+
onResetCapture?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
147
|
+
onSubmit?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
148
|
+
onSubmitCapture?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
149
|
+
onInvalid?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
150
|
+
onInvalidCapture?: import("react").FormEventHandler<HTMLLIElement> | undefined;
|
|
151
|
+
onLoad?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
152
|
+
onLoadCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
153
|
+
onError?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
154
|
+
onErrorCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
155
|
+
onKeyDown?: import("react").KeyboardEventHandler<HTMLLIElement> | undefined;
|
|
156
|
+
onKeyDownCapture?: import("react").KeyboardEventHandler<HTMLLIElement> | undefined;
|
|
157
|
+
onKeyPress?: import("react").KeyboardEventHandler<HTMLLIElement> | undefined;
|
|
158
|
+
onKeyPressCapture?: import("react").KeyboardEventHandler<HTMLLIElement> | undefined;
|
|
159
|
+
onKeyUp?: import("react").KeyboardEventHandler<HTMLLIElement> | undefined;
|
|
160
|
+
onKeyUpCapture?: import("react").KeyboardEventHandler<HTMLLIElement> | undefined;
|
|
161
|
+
onAbort?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
162
|
+
onAbortCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
163
|
+
onCanPlay?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
164
|
+
onCanPlayCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
165
|
+
onCanPlayThrough?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
166
|
+
onCanPlayThroughCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
167
|
+
onDurationChange?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
168
|
+
onDurationChangeCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
169
|
+
onEmptied?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
170
|
+
onEmptiedCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
171
|
+
onEncrypted?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
172
|
+
onEncryptedCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
173
|
+
onEnded?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
174
|
+
onEndedCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
175
|
+
onLoadedData?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
176
|
+
onLoadedDataCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
177
|
+
onLoadedMetadata?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
178
|
+
onLoadedMetadataCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
179
|
+
onLoadStart?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
180
|
+
onLoadStartCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
181
|
+
onPause?: (() => void) | undefined;
|
|
182
|
+
onPauseCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
183
|
+
onPlay?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
184
|
+
onPlayCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
185
|
+
onPlaying?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
186
|
+
onPlayingCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
187
|
+
onProgress?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
188
|
+
onProgressCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
189
|
+
onRateChange?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
190
|
+
onRateChangeCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
191
|
+
onSeeked?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
192
|
+
onSeekedCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
193
|
+
onSeeking?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
194
|
+
onSeekingCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
195
|
+
onStalled?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
196
|
+
onStalledCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
197
|
+
onSuspend?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
198
|
+
onSuspendCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
199
|
+
onTimeUpdate?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
200
|
+
onTimeUpdateCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
201
|
+
onVolumeChange?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
202
|
+
onVolumeChangeCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
203
|
+
onWaiting?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
204
|
+
onWaitingCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
205
|
+
onAuxClick?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
206
|
+
onAuxClickCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
207
|
+
onClick?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
208
|
+
onClickCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
209
|
+
onContextMenu?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
210
|
+
onContextMenuCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
211
|
+
onDoubleClick?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
212
|
+
onDoubleClickCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
213
|
+
onDrag?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
214
|
+
onDragCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
215
|
+
onDragEnd?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
216
|
+
onDragEndCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
217
|
+
onDragEnter?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
218
|
+
onDragEnterCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
219
|
+
onDragExit?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
220
|
+
onDragExitCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
221
|
+
onDragLeave?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
222
|
+
onDragLeaveCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
223
|
+
onDragOver?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
224
|
+
onDragOverCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
225
|
+
onDragStart?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
226
|
+
onDragStartCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
227
|
+
onDrop?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
228
|
+
onDropCapture?: import("react").DragEventHandler<HTMLLIElement> | undefined;
|
|
229
|
+
onMouseDown?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
230
|
+
onMouseDownCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
231
|
+
onMouseEnter?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
232
|
+
onMouseLeave?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
233
|
+
onMouseMove?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
234
|
+
onMouseMoveCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
235
|
+
onMouseOut?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
236
|
+
onMouseOutCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
237
|
+
onMouseOver?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
238
|
+
onMouseOverCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
239
|
+
onMouseUp?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
240
|
+
onMouseUpCapture?: import("react").MouseEventHandler<HTMLLIElement> | undefined;
|
|
241
|
+
onSelect?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
242
|
+
onSelectCapture?: import("react").ReactEventHandler<HTMLLIElement> | undefined;
|
|
243
|
+
onTouchCancel?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
244
|
+
onTouchCancelCapture?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
245
|
+
onTouchEnd?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
246
|
+
onTouchEndCapture?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
247
|
+
onTouchMove?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
248
|
+
onTouchMoveCapture?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
249
|
+
onTouchStart?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
250
|
+
onTouchStartCapture?: import("react").TouchEventHandler<HTMLLIElement> | undefined;
|
|
251
|
+
onPointerDown?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
252
|
+
onPointerDownCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
253
|
+
onPointerMove?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
254
|
+
onPointerMoveCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
255
|
+
onPointerUp?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
256
|
+
onPointerUpCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
257
|
+
onPointerCancel?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
258
|
+
onPointerCancelCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
259
|
+
onPointerEnter?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
260
|
+
onPointerLeave?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
261
|
+
onPointerOver?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
262
|
+
onPointerOverCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
263
|
+
onPointerOut?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
264
|
+
onPointerOutCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
265
|
+
onGotPointerCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
266
|
+
onGotPointerCaptureCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
267
|
+
onLostPointerCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
268
|
+
onLostPointerCaptureCapture?: import("react").PointerEventHandler<HTMLLIElement> | undefined;
|
|
269
|
+
onScroll?: import("react").UIEventHandler<HTMLLIElement> | undefined;
|
|
270
|
+
onScrollCapture?: import("react").UIEventHandler<HTMLLIElement> | undefined;
|
|
271
|
+
onWheel?: import("react").WheelEventHandler<HTMLLIElement> | undefined;
|
|
272
|
+
onWheelCapture?: import("react").WheelEventHandler<HTMLLIElement> | undefined;
|
|
273
|
+
onAnimationStart?: import("react").AnimationEventHandler<HTMLLIElement> | undefined;
|
|
274
|
+
onAnimationStartCapture?: import("react").AnimationEventHandler<HTMLLIElement> | undefined;
|
|
275
|
+
onAnimationEnd?: import("react").AnimationEventHandler<HTMLLIElement> | undefined;
|
|
276
|
+
onAnimationEndCapture?: import("react").AnimationEventHandler<HTMLLIElement> | undefined;
|
|
277
|
+
onAnimationIteration?: import("react").AnimationEventHandler<HTMLLIElement> | undefined;
|
|
278
|
+
onAnimationIterationCapture?: import("react").AnimationEventHandler<HTMLLIElement> | undefined;
|
|
279
|
+
onTransitionEnd?: import("react").TransitionEventHandler<HTMLLIElement> | undefined;
|
|
280
|
+
onTransitionEndCapture?: import("react").TransitionEventHandler<HTMLLIElement> | undefined;
|
|
281
|
+
key?: import("react").Key | null | undefined;
|
|
282
|
+
open?: boolean | undefined;
|
|
283
|
+
onEscapeKeyDown?: ((event: KeyboardEvent) => void) | undefined;
|
|
284
|
+
forceMount?: true | undefined;
|
|
285
|
+
duration?: number | undefined;
|
|
286
|
+
onResume?: (() => void) | undefined;
|
|
287
|
+
onSwipeStart?: ((event: {
|
|
288
|
+
currentTarget: EventTarget & HTMLLIElement;
|
|
289
|
+
} & Omit<CustomEvent<{
|
|
290
|
+
originalEvent: React.PointerEvent;
|
|
291
|
+
delta: {
|
|
292
|
+
x: number;
|
|
293
|
+
y: number;
|
|
294
|
+
};
|
|
295
|
+
}>, "currentTarget">) => void) | undefined;
|
|
296
|
+
onSwipeMove?: ((event: {
|
|
297
|
+
currentTarget: EventTarget & HTMLLIElement;
|
|
298
|
+
} & Omit<CustomEvent<{
|
|
299
|
+
originalEvent: React.PointerEvent;
|
|
300
|
+
delta: {
|
|
301
|
+
x: number;
|
|
302
|
+
y: number;
|
|
303
|
+
};
|
|
304
|
+
}>, "currentTarget">) => void) | undefined;
|
|
305
|
+
onSwipeCancel?: ((event: {
|
|
306
|
+
currentTarget: EventTarget & HTMLLIElement;
|
|
307
|
+
} & Omit<CustomEvent<{
|
|
308
|
+
originalEvent: React.PointerEvent;
|
|
309
|
+
delta: {
|
|
310
|
+
x: number;
|
|
311
|
+
y: number;
|
|
312
|
+
};
|
|
313
|
+
}>, "currentTarget">) => void) | undefined;
|
|
314
|
+
onSwipeEnd?: ((event: {
|
|
315
|
+
currentTarget: EventTarget & HTMLLIElement;
|
|
316
|
+
} & Omit<CustomEvent<{
|
|
317
|
+
originalEvent: React.PointerEvent;
|
|
318
|
+
delta: {
|
|
319
|
+
x: number;
|
|
320
|
+
y: number;
|
|
321
|
+
};
|
|
322
|
+
}>, "currentTarget">) => void) | undefined;
|
|
323
|
+
defaultOpen?: boolean | undefined;
|
|
324
|
+
onOpenChange?: ((open: boolean) => void) | undefined;
|
|
325
|
+
variant?: "default" | "destructive" | "success" | null | undefined;
|
|
326
|
+
ref?: import("react").LegacyRef<HTMLLIElement> | undefined;
|
|
327
|
+
}>) => import("react/jsx-runtime").JSX.Element)[];
|
|
328
|
+
};
|
|
329
|
+
export default meta;
|
|
330
|
+
type Story = StoryObj<typeof meta>;
|
|
331
|
+
/**
|
|
332
|
+
* Simple toast with just a title
|
|
333
|
+
*/
|
|
334
|
+
export declare const Simple: Story;
|
|
335
|
+
/**
|
|
336
|
+
* Toast with title and description
|
|
337
|
+
*/
|
|
338
|
+
export declare const WithDescription: Story;
|
|
339
|
+
/**
|
|
340
|
+
* Destructive variant (for errors or warnings)
|
|
341
|
+
*/
|
|
342
|
+
export declare const Destructive: Story;
|
|
343
|
+
/**
|
|
344
|
+
* Success variant (for success messages)
|
|
345
|
+
*/
|
|
346
|
+
export declare const Success: Story;
|
|
347
|
+
/**
|
|
348
|
+
* Toast with action button
|
|
349
|
+
*/
|
|
350
|
+
export declare const WithAction: Story;
|
|
351
|
+
/**
|
|
352
|
+
* Destructive toast with action
|
|
353
|
+
*/
|
|
354
|
+
export declare const DestructiveWithAction: Story;
|
|
355
|
+
/**
|
|
356
|
+
* Multiple toasts
|
|
357
|
+
*/
|
|
358
|
+
export declare const Multiple: Story;
|
|
359
|
+
/**
|
|
360
|
+
* Form submission example
|
|
361
|
+
*/
|
|
362
|
+
export declare const FormSubmission: Story;
|
|
363
|
+
/**
|
|
364
|
+
* All toast variants showcase
|
|
365
|
+
*/
|
|
366
|
+
export declare const Showcase: Story;
|
|
367
|
+
/**
|
|
368
|
+
* Real-world examples
|
|
369
|
+
*/
|
|
370
|
+
export declare const RealWorldExamples: Story;
|
|
371
|
+
//# sourceMappingURL=toast.stories.d.ts.map
|
|
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sE/B,CAAA"}
|
|
@@ -0,0 +1,228 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { fn } from '@storybook/test';
|
|
3
|
+
import { Toast, ToastAction, ToastClose, ToastDescription, ToastProvider, ToastTitle, ToastViewport, } from './toast';
|
|
4
|
+
import { useToast } from '../hooks/use-toast';
|
|
5
|
+
import { Button } from './button';
|
|
6
|
+
// Toaster component that renders all active toasts
|
|
7
|
+
function Toaster() {
|
|
8
|
+
const { toasts } = useToast();
|
|
9
|
+
return (_jsxs(ToastProvider, { children: [toasts.map(function ({ id, title, description, action, ...props }) {
|
|
10
|
+
return (_jsxs(Toast, { ...props, children: [_jsxs("div", { className: "grid gap-1", children: [title && _jsx(ToastTitle, { children: title }), description && _jsx(ToastDescription, { children: description })] }), action, _jsx(ToastClose, {})] }, id));
|
|
11
|
+
}), _jsx(ToastViewport, {})] }));
|
|
12
|
+
}
|
|
13
|
+
const meta = {
|
|
14
|
+
title: 'Components/Toast',
|
|
15
|
+
component: Toast,
|
|
16
|
+
parameters: {
|
|
17
|
+
layout: 'centered',
|
|
18
|
+
},
|
|
19
|
+
tags: ['autodocs'],
|
|
20
|
+
decorators: [
|
|
21
|
+
(Story) => (_jsxs(_Fragment, { children: [_jsx(Story, {}), _jsx(Toaster, {})] })),
|
|
22
|
+
],
|
|
23
|
+
};
|
|
24
|
+
export default meta;
|
|
25
|
+
/**
|
|
26
|
+
* Simple toast with just a title
|
|
27
|
+
*/
|
|
28
|
+
export const Simple = {
|
|
29
|
+
render: () => {
|
|
30
|
+
const { toast } = useToast();
|
|
31
|
+
return (_jsx(Button, { onClick: () => {
|
|
32
|
+
toast({
|
|
33
|
+
title: 'Message sent',
|
|
34
|
+
});
|
|
35
|
+
}, children: "Show Toast" }));
|
|
36
|
+
},
|
|
37
|
+
};
|
|
38
|
+
/**
|
|
39
|
+
* Toast with title and description
|
|
40
|
+
*/
|
|
41
|
+
export const WithDescription = {
|
|
42
|
+
render: () => {
|
|
43
|
+
const { toast } = useToast();
|
|
44
|
+
return (_jsx(Button, { onClick: () => {
|
|
45
|
+
toast({
|
|
46
|
+
title: 'Scheduled: Catch up',
|
|
47
|
+
description: 'Friday, February 10, 2023 at 5:57 PM',
|
|
48
|
+
});
|
|
49
|
+
}, children: "Show Toast" }));
|
|
50
|
+
},
|
|
51
|
+
};
|
|
52
|
+
/**
|
|
53
|
+
* Destructive variant (for errors or warnings)
|
|
54
|
+
*/
|
|
55
|
+
export const Destructive = {
|
|
56
|
+
render: () => {
|
|
57
|
+
const { toast } = useToast();
|
|
58
|
+
return (_jsx(Button, { variant: "destructive", onClick: () => {
|
|
59
|
+
toast({
|
|
60
|
+
variant: 'destructive',
|
|
61
|
+
title: 'Uh oh! Something went wrong',
|
|
62
|
+
description: 'There was a problem with your request.',
|
|
63
|
+
});
|
|
64
|
+
}, children: "Show Error" }));
|
|
65
|
+
},
|
|
66
|
+
};
|
|
67
|
+
/**
|
|
68
|
+
* Success variant (for success messages)
|
|
69
|
+
*/
|
|
70
|
+
export const Success = {
|
|
71
|
+
render: () => {
|
|
72
|
+
const { toast } = useToast();
|
|
73
|
+
return (_jsx(Button, { onClick: () => {
|
|
74
|
+
toast({
|
|
75
|
+
variant: 'success',
|
|
76
|
+
title: 'Success!',
|
|
77
|
+
description: 'Your changes have been saved.',
|
|
78
|
+
});
|
|
79
|
+
}, children: "Show Success" }));
|
|
80
|
+
},
|
|
81
|
+
};
|
|
82
|
+
/**
|
|
83
|
+
* Toast with action button
|
|
84
|
+
*/
|
|
85
|
+
export const WithAction = {
|
|
86
|
+
render: () => {
|
|
87
|
+
const { toast } = useToast();
|
|
88
|
+
return (_jsx(Button, { onClick: () => {
|
|
89
|
+
toast({
|
|
90
|
+
title: 'Update available',
|
|
91
|
+
description: 'A new version of the app is ready to install.',
|
|
92
|
+
action: _jsx(ToastAction, { altText: "Install now", onClick: fn(), children: "Install" }),
|
|
93
|
+
});
|
|
94
|
+
}, children: "Show Toast with Action" }));
|
|
95
|
+
},
|
|
96
|
+
};
|
|
97
|
+
/**
|
|
98
|
+
* Destructive toast with action
|
|
99
|
+
*/
|
|
100
|
+
export const DestructiveWithAction = {
|
|
101
|
+
render: () => {
|
|
102
|
+
const { toast } = useToast();
|
|
103
|
+
return (_jsx(Button, { variant: "destructive", onClick: () => {
|
|
104
|
+
toast({
|
|
105
|
+
variant: 'destructive',
|
|
106
|
+
title: 'Account deleted',
|
|
107
|
+
description: 'Your account has been permanently deleted.',
|
|
108
|
+
action: _jsx(ToastAction, { altText: "Undo", onClick: fn(), children: "Undo" }),
|
|
109
|
+
});
|
|
110
|
+
}, children: "Delete Account" }));
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
/**
|
|
114
|
+
* Multiple toasts
|
|
115
|
+
*/
|
|
116
|
+
export const Multiple = {
|
|
117
|
+
render: () => {
|
|
118
|
+
const { toast } = useToast();
|
|
119
|
+
return (_jsxs("div", { style: { display: 'flex', gap: '0.5rem', flexWrap: 'wrap' }, children: [_jsx(Button, { onClick: () => {
|
|
120
|
+
toast({
|
|
121
|
+
title: 'First notification',
|
|
122
|
+
description: 'This is the first toast',
|
|
123
|
+
});
|
|
124
|
+
}, children: "Toast 1" }), _jsx(Button, { onClick: () => {
|
|
125
|
+
toast({
|
|
126
|
+
variant: 'success',
|
|
127
|
+
title: 'Second notification',
|
|
128
|
+
description: 'This is the second toast',
|
|
129
|
+
});
|
|
130
|
+
}, children: "Toast 2" }), _jsx(Button, { variant: "destructive", onClick: () => {
|
|
131
|
+
toast({
|
|
132
|
+
variant: 'destructive',
|
|
133
|
+
title: 'Third notification',
|
|
134
|
+
description: 'This is the third toast',
|
|
135
|
+
});
|
|
136
|
+
}, children: "Toast 3" })] }));
|
|
137
|
+
},
|
|
138
|
+
};
|
|
139
|
+
/**
|
|
140
|
+
* Form submission example
|
|
141
|
+
*/
|
|
142
|
+
export const FormSubmission = {
|
|
143
|
+
render: () => {
|
|
144
|
+
const { toast } = useToast();
|
|
145
|
+
const handleSubmit = (e) => {
|
|
146
|
+
e.preventDefault();
|
|
147
|
+
toast({
|
|
148
|
+
variant: 'success',
|
|
149
|
+
title: 'Form submitted',
|
|
150
|
+
description: 'Your information has been saved successfully.',
|
|
151
|
+
});
|
|
152
|
+
};
|
|
153
|
+
return (_jsxs("form", { onSubmit: handleSubmit, style: { display: 'flex', flexDirection: 'column', gap: '1rem', width: '300px' }, children: [_jsx("input", { type: "email", placeholder: "Email", className: "h-9 w-full border border-input bg-transparent px-3 py-1 text-sm", style: { borderRadius: 'var(--radius-md)' } }), _jsx(Button, { type: "submit", children: "Submit" })] }));
|
|
154
|
+
},
|
|
155
|
+
};
|
|
156
|
+
/**
|
|
157
|
+
* All toast variants showcase
|
|
158
|
+
*/
|
|
159
|
+
export const Showcase = {
|
|
160
|
+
render: () => {
|
|
161
|
+
const { toast } = useToast();
|
|
162
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Default" }), _jsx(Button, { variant: "outline", onClick: () => {
|
|
163
|
+
toast({
|
|
164
|
+
title: 'Default toast',
|
|
165
|
+
description: 'This is a default notification.',
|
|
166
|
+
});
|
|
167
|
+
}, children: "Show Default" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Success" }), _jsx(Button, { onClick: () => {
|
|
168
|
+
toast({
|
|
169
|
+
variant: 'success',
|
|
170
|
+
title: 'Success!',
|
|
171
|
+
description: 'Operation completed successfully.',
|
|
172
|
+
});
|
|
173
|
+
}, children: "Show Success" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "Destructive" }), _jsx(Button, { variant: "destructive", onClick: () => {
|
|
174
|
+
toast({
|
|
175
|
+
variant: 'destructive',
|
|
176
|
+
title: 'Error',
|
|
177
|
+
description: 'Something went wrong.',
|
|
178
|
+
});
|
|
179
|
+
}, children: "Show Error" })] }), _jsxs("div", { children: [_jsx("p", { style: { fontSize: '0.875rem', fontWeight: '500', marginBottom: '0.5rem' }, children: "With Action" }), _jsx(Button, { variant: "outline", onClick: () => {
|
|
180
|
+
toast({
|
|
181
|
+
title: 'Confirmation needed',
|
|
182
|
+
description: 'Are you sure you want to continue?',
|
|
183
|
+
action: _jsx(ToastAction, { altText: "Confirm", onClick: fn(), children: "Confirm" }),
|
|
184
|
+
});
|
|
185
|
+
}, children: "Show with Action" })] })] }));
|
|
186
|
+
},
|
|
187
|
+
};
|
|
188
|
+
/**
|
|
189
|
+
* Real-world examples
|
|
190
|
+
*/
|
|
191
|
+
export const RealWorldExamples = {
|
|
192
|
+
render: () => {
|
|
193
|
+
const { toast } = useToast();
|
|
194
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', gap: '1rem' }, children: [_jsx(Button, { onClick: () => {
|
|
195
|
+
toast({
|
|
196
|
+
variant: 'success',
|
|
197
|
+
title: 'File uploaded',
|
|
198
|
+
description: 'document.pdf has been uploaded successfully.',
|
|
199
|
+
});
|
|
200
|
+
}, children: "File Upload" }), _jsx(Button, { onClick: () => {
|
|
201
|
+
toast({
|
|
202
|
+
title: 'New message',
|
|
203
|
+
description: 'You have a new message from John Doe.',
|
|
204
|
+
action: _jsx(ToastAction, { altText: "View", onClick: fn(), children: "View" }),
|
|
205
|
+
});
|
|
206
|
+
}, children: "New Message" }), _jsx(Button, { variant: "destructive", onClick: () => {
|
|
207
|
+
toast({
|
|
208
|
+
variant: 'destructive',
|
|
209
|
+
title: 'Connection lost',
|
|
210
|
+
description: 'Unable to connect to the server. Retrying...',
|
|
211
|
+
action: _jsx(ToastAction, { altText: "Retry", onClick: fn(), children: "Retry" }),
|
|
212
|
+
});
|
|
213
|
+
}, children: "Connection Error" }), _jsx(Button, { onClick: () => {
|
|
214
|
+
toast({
|
|
215
|
+
variant: 'success',
|
|
216
|
+
title: 'Settings saved',
|
|
217
|
+
description: 'Your preferences have been updated.',
|
|
218
|
+
});
|
|
219
|
+
}, children: "Save Settings" }), _jsx(Button, { onClick: () => {
|
|
220
|
+
toast({
|
|
221
|
+
title: 'Update available',
|
|
222
|
+
description: 'Version 2.0 is ready to install.',
|
|
223
|
+
action: _jsx(ToastAction, { altText: "Update now", onClick: fn(), children: "Update" }),
|
|
224
|
+
});
|
|
225
|
+
}, children: "Update Available" })] }));
|
|
226
|
+
},
|
|
227
|
+
};
|
|
228
|
+
//# sourceMappingURL=toast.stories.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"toast.stories.js","sourceRoot":"","sources":["../../src/components/toast.stories.tsx"],"names":[],"mappings":";AACA,OAAO,EAAE,EAAE,EAAE,MAAM,iBAAiB,CAAA;AACpC,OAAO,EACL,KAAK,EACL,WAAW,EACX,UAAU,EACV,gBAAgB,EAChB,aAAa,EACb,UAAU,EACV,aAAa,GACd,MAAM,SAAS,CAAA;AAChB,OAAO,EAAE,QAAQ,EAAE,MAAM,oBAAoB,CAAA;AAC7C,OAAO,EAAE,MAAM,EAAE,MAAM,UAAU,CAAA;AAEjC,mDAAmD;AACnD,SAAS,OAAO;IACd,MAAM,EAAE,MAAM,EAAE,GAAG,QAAQ,EAAE,CAAA;IAE7B,OAAO,CACL,MAAC,aAAa,eACX,MAAM,CAAC,GAAG,CAAC,UAAU,EAAE,EAAE,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,GAAG,KAAK,EAAE;gBAChE,OAAO,CACL,MAAC,KAAK,OAAc,KAAK,aACvB,eAAK,SAAS,EAAC,YAAY,aACxB,KAAK,IAAI,KAAC,UAAU,cAAE,KAAK,GAAc,EACzC,WAAW,IAAI,KAAC,gBAAgB,cAAE,WAAW,GAAoB,IAC9D,EACL,MAAM,EACP,KAAC,UAAU,KAAG,KANJ,EAAE,CAON,CACT,CAAA;YACH,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