@ngrok/mantle 0.23.2 → 0.24.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/accordion.d.ts +1 -1
- package/dist/accordion.js +1 -1
- package/dist/alert-dialog.d.ts +373 -14
- package/dist/alert-dialog.js +1 -1
- package/dist/alert-dialog.js.map +1 -1
- package/dist/alert.d.ts +1 -1
- package/dist/anchor.d.ts +32 -5
- package/dist/anchor.js +1 -1
- package/dist/anchor.js.map +1 -1
- package/dist/{as-child-Cvu56SuO.d.ts → as-child-DJ7x3JFV.d.ts} +3 -4
- package/dist/badge.d.ts +14 -4
- package/dist/badge.js +1 -1
- package/dist/badge.js.map +1 -1
- package/dist/button.d.ts +5 -2
- package/dist/button.js +1 -1
- package/dist/calendar.js +1 -1
- package/dist/card.d.ts +112 -11
- package/dist/card.js +1 -1
- package/dist/card.js.map +1 -1
- package/dist/{chunk-DJGIRPRQ.js → chunk-7O36LG52.js} +1 -1
- package/dist/chunk-7O36LG52.js.map +1 -0
- package/dist/{chunk-5WFRLY2G.js → chunk-ATNIDU3M.js} +2 -2
- package/dist/{chunk-PJLA4NRO.js → chunk-J3NVDJIE.js} +2 -2
- package/dist/chunk-J3NVDJIE.js.map +1 -0
- package/dist/{chunk-ESJ3HLYJ.js → chunk-XBVAQ3DV.js} +2 -2
- package/dist/code-block.js +1 -1
- package/dist/combobox.d.ts +5 -5
- package/dist/combobox.js.map +1 -1
- package/dist/dialog.d.ts +2 -2
- package/dist/dialog.js +1 -1
- package/dist/dropdown-menu.d.ts +1 -1
- package/dist/flag.d.ts +4 -0
- package/dist/flag.js.map +1 -1
- package/dist/{icon-D6P9AESZ.d.ts → icon-CS9xptlK.d.ts} +9 -0
- package/dist/{icon-button-CZzW1XWB.d.ts → icon-button-D41yiI7H.d.ts} +1 -1
- package/dist/icon.d.ts +1 -1
- package/dist/icon.js +1 -1
- package/dist/label.d.ts +23 -0
- package/dist/label.js.map +1 -1
- package/dist/media-object.d.ts +50 -5
- package/dist/media-object.js +1 -1
- package/dist/media-object.js.map +1 -1
- package/dist/pagination.d.ts +1 -1
- package/dist/pagination.js +1 -1
- package/dist/radio-group.d.ts +1 -1
- package/dist/sandboxed-on-click.d.ts +1 -1
- package/dist/select.d.ts +1 -1
- package/dist/separator.d.ts +1 -1
- package/dist/sheet.d.ts +2 -2
- package/dist/sheet.js +1 -1
- package/dist/skeleton.d.ts +19 -4
- package/dist/skeleton.js +1 -1
- package/dist/skeleton.js.map +1 -1
- package/dist/toast.d.ts +1 -1
- package/dist/toast.js +1 -1
- package/dist/types.d.ts +1 -1
- package/package.json +1 -1
- package/dist/chunk-DJGIRPRQ.js.map +0 -1
- package/dist/chunk-PJLA4NRO.js.map +0 -1
- /package/dist/{chunk-5WFRLY2G.js.map → chunk-ATNIDU3M.js.map} +0 -0
- /package/dist/{chunk-ESJ3HLYJ.js.map → chunk-XBVAQ3DV.js.map} +0 -0
package/dist/accordion.d.ts
CHANGED
|
@@ -2,7 +2,7 @@ import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
|
2
2
|
import * as react from 'react';
|
|
3
3
|
import { ComponentPropsWithoutRef } from 'react';
|
|
4
4
|
import * as AccordionPrimitive from '@radix-ui/react-accordion';
|
|
5
|
-
import { a as IconProps } from './icon-
|
|
5
|
+
import { a as IconProps } from './icon-CS9xptlK.js';
|
|
6
6
|
import './types-BuKAGhC-.js';
|
|
7
7
|
|
|
8
8
|
declare const Accordion: react.ForwardRefExoticComponent<ComponentPropsWithoutRef<react.ForwardRefExoticComponent<(AccordionPrimitive.AccordionSingleProps | AccordionPrimitive.AccordionMultipleProps) & react.RefAttributes<HTMLDivElement>>> & react.RefAttributes<HTMLDivElement>>;
|
package/dist/accordion.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as m}from"./chunk-
|
|
1
|
+
import{a as m}from"./chunk-7O36LG52.js";import"./chunk-HDPLH5HC.js";import{a as r}from"./chunk-AZ56JGNY.js";import{CaretDown as g}from"@phosphor-icons/react/CaretDown";import*as o from"@radix-ui/react-accordion";import{forwardRef as c}from"react";import{jsx as n}from"react/jsx-runtime";var a=c(({className:e,...i},t)=>n(o.Root,{ref:t,className:r("w-full space-y-2.5",e),...i}));a.displayName="Accordion";var p=o.Item;p.displayName="AccordionItem";var s=c(({className:e,...i},t)=>n(o.Header,{ref:t,className:r("flex items-center gap-2",e),...i}));s.displayName="AccordionHeading";var f=c(({className:e,children:i,...t},d)=>n(o.Trigger,{ref:d,className:r("group flex items-center gap-1.5",e),...t,children:i}));f.displayName="AccordionTrigger";var l=({className:e,...i})=>n(m,{...i,svg:n(g,{weight:"fill"}),className:r("group-data-state-open:rotate-0 -rotate-90",e)}),A=c(({className:e,children:i,...t},d)=>n(o.Content,{ref:d,className:r("data-state-closed:animate-accordion-up data-state-open:animate-accordion-down overflow-hidden pt-4",e),...t,children:i}));A.displayName="AccordionContent";export{a as Accordion,A as AccordionContent,s as AccordionHeading,p as AccordionItem,f as AccordionTrigger,l as AccordionTriggerIcon};
|
|
2
2
|
//# sourceMappingURL=accordion.js.map
|
package/dist/alert-dialog.d.ts
CHANGED
|
@@ -5,6 +5,7 @@ import * as react from 'react';
|
|
|
5
5
|
import { ComponentProps, ReactNode } from 'react';
|
|
6
6
|
import * as _radix_ui_react_dialog from '@radix-ui/react-dialog';
|
|
7
7
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
8
|
+
import { W as WithAsChild } from './as-child-DJ7x3JFV.js';
|
|
8
9
|
import { R as Root } from './primitive-hud69IM9.js';
|
|
9
10
|
import { S as SvgAttributes } from './types-BuKAGhC-.js';
|
|
10
11
|
|
|
@@ -18,7 +19,41 @@ type AlertDialogProps = ComponentProps<typeof Root> & {
|
|
|
18
19
|
priority: Priority;
|
|
19
20
|
};
|
|
20
21
|
/**
|
|
21
|
-
*
|
|
22
|
+
* A modal dialog that interrupts the user with important content and expects a
|
|
23
|
+
* response.
|
|
24
|
+
* The root stateful component for the Alert Dialog.
|
|
25
|
+
*
|
|
26
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog
|
|
27
|
+
*
|
|
28
|
+
* @example
|
|
29
|
+
* ```tsx
|
|
30
|
+
* <AlertDialog priority="danger">
|
|
31
|
+
* <AlertDialogTrigger asChild>
|
|
32
|
+
* <Button type="button" appearance="outlined">
|
|
33
|
+
* Show Danger Alert Dialog
|
|
34
|
+
* </Button>
|
|
35
|
+
* </AlertDialogTrigger>
|
|
36
|
+
* <AlertDialogContent>
|
|
37
|
+
* <AlertDialogIcon />
|
|
38
|
+
* <AlertDialogBody>
|
|
39
|
+
* <AlertDialogHeader>
|
|
40
|
+
* <AlertDialogTitle>
|
|
41
|
+
* Are you absolutely sure?
|
|
42
|
+
* </AlertDialogTitle>
|
|
43
|
+
* <AlertDialogDescription>
|
|
44
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
45
|
+
* </AlertDialogDescription>
|
|
46
|
+
* </AlertDialogHeader>
|
|
47
|
+
* <AlertDialogFooter>
|
|
48
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
49
|
+
* <AlertDialogAction type="button">
|
|
50
|
+
* Continue
|
|
51
|
+
* </AlertDialogAction>
|
|
52
|
+
* </AlertDialogFooter>
|
|
53
|
+
* </AlertDialogBody>
|
|
54
|
+
* </AlertDialogContent>
|
|
55
|
+
* </AlertDialog>
|
|
56
|
+
* ```
|
|
22
57
|
*/
|
|
23
58
|
declare function AlertDialog({ priority, ...props }: AlertDialogProps): react_jsx_runtime.JSX.Element;
|
|
24
59
|
declare namespace AlertDialog {
|
|
@@ -26,40 +61,223 @@ declare namespace AlertDialog {
|
|
|
26
61
|
}
|
|
27
62
|
/**
|
|
28
63
|
* A button that opens the Alert Dialog.
|
|
64
|
+
*
|
|
65
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-trigger
|
|
66
|
+
*
|
|
67
|
+
* @example
|
|
68
|
+
* ```tsx
|
|
69
|
+
* <AlertDialog priority="danger">
|
|
70
|
+
* <AlertDialogTrigger asChild>
|
|
71
|
+
* <Button type="button" appearance="outlined">
|
|
72
|
+
* Show Danger Alert Dialog
|
|
73
|
+
* </Button>
|
|
74
|
+
* </AlertDialogTrigger>
|
|
75
|
+
* <AlertDialogContent>
|
|
76
|
+
* <AlertDialogIcon />
|
|
77
|
+
* <AlertDialogBody>
|
|
78
|
+
* <AlertDialogHeader>
|
|
79
|
+
* <AlertDialogTitle>
|
|
80
|
+
* Are you absolutely sure?
|
|
81
|
+
* </AlertDialogTitle>
|
|
82
|
+
* <AlertDialogDescription>
|
|
83
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
84
|
+
* </AlertDialogDescription>
|
|
85
|
+
* </AlertDialogHeader>
|
|
86
|
+
* <AlertDialogFooter>
|
|
87
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
88
|
+
* <AlertDialogAction type="button">
|
|
89
|
+
* Continue
|
|
90
|
+
* </AlertDialogAction>
|
|
91
|
+
* </AlertDialogFooter>
|
|
92
|
+
* </AlertDialogBody>
|
|
93
|
+
* </AlertDialogContent>
|
|
94
|
+
* </AlertDialog>
|
|
95
|
+
* ```
|
|
29
96
|
*/
|
|
30
97
|
declare const AlertDialogTrigger: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogTriggerProps & react.RefAttributes<HTMLButtonElement>>;
|
|
31
98
|
/**
|
|
32
99
|
* The popover alert dialog container.
|
|
33
100
|
*
|
|
34
101
|
* Renders on top of the overlay and is centered in the viewport.
|
|
102
|
+
*
|
|
103
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-content
|
|
104
|
+
*
|
|
105
|
+
* @example
|
|
106
|
+
* ```tsx
|
|
107
|
+
* <AlertDialog priority="danger">
|
|
108
|
+
* <AlertDialogTrigger asChild>
|
|
109
|
+
* <Button type="button" appearance="outlined">
|
|
110
|
+
* Show Danger Alert Dialog
|
|
111
|
+
* </Button>
|
|
112
|
+
* </AlertDialogTrigger>
|
|
113
|
+
* <AlertDialogContent>
|
|
114
|
+
* <AlertDialogIcon />
|
|
115
|
+
* <AlertDialogBody>
|
|
116
|
+
* <AlertDialogHeader>
|
|
117
|
+
* <AlertDialogTitle>
|
|
118
|
+
* Are you absolutely sure?
|
|
119
|
+
* </AlertDialogTitle>
|
|
120
|
+
* <AlertDialogDescription>
|
|
121
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
122
|
+
* </AlertDialogDescription>
|
|
123
|
+
* </AlertDialogHeader>
|
|
124
|
+
* <AlertDialogFooter>
|
|
125
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
126
|
+
* <AlertDialogAction type="button">
|
|
127
|
+
* Continue
|
|
128
|
+
* </AlertDialogAction>
|
|
129
|
+
* </AlertDialogFooter>
|
|
130
|
+
* </AlertDialogBody>
|
|
131
|
+
* </AlertDialogContent>
|
|
132
|
+
* </AlertDialog>
|
|
133
|
+
* ```
|
|
35
134
|
*/
|
|
36
135
|
declare const AlertDialogContent: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogContentProps & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
37
136
|
/**
|
|
38
|
-
* Contains the main content of the dialog.
|
|
137
|
+
* Contains the main content of the alert dialog.
|
|
138
|
+
*
|
|
139
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-body
|
|
140
|
+
*
|
|
141
|
+
* @example
|
|
142
|
+
* ```tsx
|
|
143
|
+
* <AlertDialog priority="danger">
|
|
144
|
+
* <AlertDialogTrigger asChild>
|
|
145
|
+
* <Button type="button" appearance="outlined">
|
|
146
|
+
* Show Danger Alert Dialog
|
|
147
|
+
* </Button>
|
|
148
|
+
* </AlertDialogTrigger>
|
|
149
|
+
* <AlertDialogContent>
|
|
150
|
+
* <AlertDialogIcon />
|
|
151
|
+
* <AlertDialogBody>
|
|
152
|
+
* <AlertDialogHeader>
|
|
153
|
+
* <AlertDialogTitle>
|
|
154
|
+
* Are you absolutely sure?
|
|
155
|
+
* </AlertDialogTitle>
|
|
156
|
+
* <AlertDialogDescription>
|
|
157
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
158
|
+
* </AlertDialogDescription>
|
|
159
|
+
* </AlertDialogHeader>
|
|
160
|
+
* <AlertDialogFooter>
|
|
161
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
162
|
+
* <AlertDialogAction type="button">
|
|
163
|
+
* Continue
|
|
164
|
+
* </AlertDialogAction>
|
|
165
|
+
* </AlertDialogFooter>
|
|
166
|
+
* </AlertDialogBody>
|
|
167
|
+
* </AlertDialogContent>
|
|
168
|
+
* </AlertDialog>
|
|
169
|
+
* ```
|
|
39
170
|
*/
|
|
40
|
-
declare const AlertDialogBody:
|
|
41
|
-
({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
42
|
-
displayName: string;
|
|
43
|
-
};
|
|
171
|
+
declare const AlertDialogBody: react.ForwardRefExoticComponent<Omit<react.ClassAttributes<HTMLDivElement> & react.HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
44
172
|
/**
|
|
45
173
|
* Contains the header content of the dialog, including the title and description.
|
|
174
|
+
*
|
|
175
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-header
|
|
176
|
+
*
|
|
177
|
+
* @example
|
|
178
|
+
* ```tsx
|
|
179
|
+
* <AlertDialog priority="danger">
|
|
180
|
+
* <AlertDialogTrigger asChild>
|
|
181
|
+
* <Button type="button" appearance="outlined">
|
|
182
|
+
* Show Danger Alert Dialog
|
|
183
|
+
* </Button>
|
|
184
|
+
* </AlertDialogTrigger>
|
|
185
|
+
* <AlertDialogContent>
|
|
186
|
+
* <AlertDialogIcon />
|
|
187
|
+
* <AlertDialogBody>
|
|
188
|
+
* <AlertDialogHeader>
|
|
189
|
+
* <AlertDialogTitle>
|
|
190
|
+
* Are you absolutely sure?
|
|
191
|
+
* </AlertDialogTitle>
|
|
192
|
+
* <AlertDialogDescription>
|
|
193
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
194
|
+
* </AlertDialogDescription>
|
|
195
|
+
* </AlertDialogHeader>
|
|
196
|
+
* <AlertDialogFooter>
|
|
197
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
198
|
+
* <AlertDialogAction type="button">
|
|
199
|
+
* Continue
|
|
200
|
+
* </AlertDialogAction>
|
|
201
|
+
* </AlertDialogFooter>
|
|
202
|
+
* </AlertDialogBody>
|
|
203
|
+
* </AlertDialogContent>
|
|
204
|
+
* </AlertDialog>
|
|
205
|
+
* ```
|
|
46
206
|
*/
|
|
47
|
-
declare const AlertDialogHeader:
|
|
48
|
-
({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
49
|
-
displayName: string;
|
|
50
|
-
};
|
|
207
|
+
declare const AlertDialogHeader: react.ForwardRefExoticComponent<Omit<react.ClassAttributes<HTMLDivElement> & react.HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
51
208
|
/**
|
|
52
209
|
* Contains the footer content of the dialog, including the action and cancel buttons.
|
|
210
|
+
*
|
|
211
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-footer
|
|
212
|
+
*
|
|
213
|
+
* @example
|
|
214
|
+
* ```tsx
|
|
215
|
+
* <AlertDialog priority="danger">
|
|
216
|
+
* <AlertDialogTrigger asChild>
|
|
217
|
+
* <Button type="button" appearance="outlined">
|
|
218
|
+
* Show Danger Alert Dialog
|
|
219
|
+
* </Button>
|
|
220
|
+
* </AlertDialogTrigger>
|
|
221
|
+
* <AlertDialogContent>
|
|
222
|
+
* <AlertDialogIcon />
|
|
223
|
+
* <AlertDialogBody>
|
|
224
|
+
* <AlertDialogHeader>
|
|
225
|
+
* <AlertDialogTitle>
|
|
226
|
+
* Are you absolutely sure?
|
|
227
|
+
* </AlertDialogTitle>
|
|
228
|
+
* <AlertDialogDescription>
|
|
229
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
230
|
+
* </AlertDialogDescription>
|
|
231
|
+
* </AlertDialogHeader>
|
|
232
|
+
* <AlertDialogFooter>
|
|
233
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
234
|
+
* <AlertDialogAction type="button">
|
|
235
|
+
* Continue
|
|
236
|
+
* </AlertDialogAction>
|
|
237
|
+
* </AlertDialogFooter>
|
|
238
|
+
* </AlertDialogBody>
|
|
239
|
+
* </AlertDialogContent>
|
|
240
|
+
* </AlertDialog>
|
|
241
|
+
* ```
|
|
53
242
|
*/
|
|
54
|
-
declare const AlertDialogFooter:
|
|
55
|
-
({ className, ...props }: ComponentProps<"div">): react_jsx_runtime.JSX.Element;
|
|
56
|
-
displayName: string;
|
|
57
|
-
};
|
|
243
|
+
declare const AlertDialogFooter: react.ForwardRefExoticComponent<Omit<react.ClassAttributes<HTMLDivElement> & react.HTMLAttributes<HTMLDivElement> & WithAsChild, "ref"> & react.RefAttributes<HTMLDivElement>>;
|
|
58
244
|
/**
|
|
59
245
|
* An accessible name to be announced when the dialog is opened.
|
|
60
246
|
*
|
|
61
247
|
* Alternatively, you can provide `aria-label` or `aria-labelledby` to
|
|
62
248
|
* `AlertDialogContent` and exclude this component.
|
|
249
|
+
*
|
|
250
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-title
|
|
251
|
+
*
|
|
252
|
+
* @example
|
|
253
|
+
* ```tsx
|
|
254
|
+
* <AlertDialog priority="danger">
|
|
255
|
+
* <AlertDialogTrigger asChild>
|
|
256
|
+
* <Button type="button" appearance="outlined">
|
|
257
|
+
* Show Danger Alert Dialog
|
|
258
|
+
* </Button>
|
|
259
|
+
* </AlertDialogTrigger>
|
|
260
|
+
* <AlertDialogContent>
|
|
261
|
+
* <AlertDialogIcon />
|
|
262
|
+
* <AlertDialogBody>
|
|
263
|
+
* <AlertDialogHeader>
|
|
264
|
+
* <AlertDialogTitle>
|
|
265
|
+
* Are you absolutely sure?
|
|
266
|
+
* </AlertDialogTitle>
|
|
267
|
+
* <AlertDialogDescription>
|
|
268
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
269
|
+
* </AlertDialogDescription>
|
|
270
|
+
* </AlertDialogHeader>
|
|
271
|
+
* <AlertDialogFooter>
|
|
272
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
273
|
+
* <AlertDialogAction type="button">
|
|
274
|
+
* Continue
|
|
275
|
+
* </AlertDialogAction>
|
|
276
|
+
* </AlertDialogFooter>
|
|
277
|
+
* </AlertDialogBody>
|
|
278
|
+
* </AlertDialogContent>
|
|
279
|
+
* </AlertDialog>
|
|
280
|
+
* ```
|
|
63
281
|
*/
|
|
64
282
|
declare const AlertDialogTitle: react.ForwardRefExoticComponent<Omit<_radix_ui_react_dialog.DialogTitleProps & react.RefAttributes<HTMLHeadingElement>, "ref"> & react.RefAttributes<HTMLHeadingElement>>;
|
|
65
283
|
/**
|
|
@@ -67,6 +285,38 @@ declare const AlertDialogTitle: react.ForwardRefExoticComponent<Omit<_radix_ui_r
|
|
|
67
285
|
*
|
|
68
286
|
* Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and
|
|
69
287
|
* exclude this component.
|
|
288
|
+
*
|
|
289
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-description
|
|
290
|
+
*
|
|
291
|
+
* @example
|
|
292
|
+
* ```tsx
|
|
293
|
+
* <AlertDialog priority="danger">
|
|
294
|
+
* <AlertDialogTrigger asChild>
|
|
295
|
+
* <Button type="button" appearance="outlined">
|
|
296
|
+
* Show Danger Alert Dialog
|
|
297
|
+
* </Button>
|
|
298
|
+
* </AlertDialogTrigger>
|
|
299
|
+
* <AlertDialogContent>
|
|
300
|
+
* <AlertDialogIcon />
|
|
301
|
+
* <AlertDialogBody>
|
|
302
|
+
* <AlertDialogHeader>
|
|
303
|
+
* <AlertDialogTitle>
|
|
304
|
+
* Are you absolutely sure?
|
|
305
|
+
* </AlertDialogTitle>
|
|
306
|
+
* <AlertDialogDescription>
|
|
307
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
308
|
+
* </AlertDialogDescription>
|
|
309
|
+
* </AlertDialogHeader>
|
|
310
|
+
* <AlertDialogFooter>
|
|
311
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
312
|
+
* <AlertDialogAction type="button">
|
|
313
|
+
* Continue
|
|
314
|
+
* </AlertDialogAction>
|
|
315
|
+
* </AlertDialogFooter>
|
|
316
|
+
* </AlertDialogBody>
|
|
317
|
+
* </AlertDialogContent>
|
|
318
|
+
* </AlertDialog>
|
|
319
|
+
* ```
|
|
70
320
|
*/
|
|
71
321
|
declare const AlertDialogDescription: react.ForwardRefExoticComponent<Omit<Omit<_radix_ui_react_dialog.DialogDescriptionProps & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>, "ref"> & react.RefAttributes<HTMLParagraphElement>>;
|
|
72
322
|
/**
|
|
@@ -77,6 +327,38 @@ declare const AlertDialogDescription: react.ForwardRefExoticComponent<Omit<Omit<
|
|
|
77
327
|
* These buttons should be distinguished visually from the AlertDialogCancel button.
|
|
78
328
|
*
|
|
79
329
|
* Composes around the mantle Button component.
|
|
330
|
+
*
|
|
331
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-action
|
|
332
|
+
*
|
|
333
|
+
* @example
|
|
334
|
+
* ```tsx
|
|
335
|
+
* <AlertDialog priority="danger">
|
|
336
|
+
* <AlertDialogTrigger asChild>
|
|
337
|
+
* <Button type="button" appearance="outlined">
|
|
338
|
+
* Show Danger Alert Dialog
|
|
339
|
+
* </Button>
|
|
340
|
+
* </AlertDialogTrigger>
|
|
341
|
+
* <AlertDialogContent>
|
|
342
|
+
* <AlertDialogIcon />
|
|
343
|
+
* <AlertDialogBody>
|
|
344
|
+
* <AlertDialogHeader>
|
|
345
|
+
* <AlertDialogTitle>
|
|
346
|
+
* Are you absolutely sure?
|
|
347
|
+
* </AlertDialogTitle>
|
|
348
|
+
* <AlertDialogDescription>
|
|
349
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
350
|
+
* </AlertDialogDescription>
|
|
351
|
+
* </AlertDialogHeader>
|
|
352
|
+
* <AlertDialogFooter>
|
|
353
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
354
|
+
* <AlertDialogAction type="button">
|
|
355
|
+
* Continue
|
|
356
|
+
* </AlertDialogAction>
|
|
357
|
+
* </AlertDialogFooter>
|
|
358
|
+
* </AlertDialogBody>
|
|
359
|
+
* </AlertDialogContent>
|
|
360
|
+
* </AlertDialog>
|
|
361
|
+
* ```
|
|
80
362
|
*/
|
|
81
363
|
declare const AlertDialogAction: react.ForwardRefExoticComponent<(Omit<react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<class_variance_authority.VariantProps<(props?: ({
|
|
82
364
|
appearance?: "link" | "filled" | "ghost" | "outlined" | null | undefined;
|
|
@@ -106,6 +388,38 @@ declare const AlertDialogAction: react.ForwardRefExoticComponent<(Omit<react.Cla
|
|
|
106
388
|
* This button should be distinguished visually from AlertDialogAction buttons.
|
|
107
389
|
*
|
|
108
390
|
* Composes around the mantle Button component.
|
|
391
|
+
*
|
|
392
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-cancel
|
|
393
|
+
*
|
|
394
|
+
* @example
|
|
395
|
+
* ```tsx
|
|
396
|
+
* <AlertDialog priority="danger">
|
|
397
|
+
* <AlertDialogTrigger asChild>
|
|
398
|
+
* <Button type="button" appearance="outlined">
|
|
399
|
+
* Show Danger Alert Dialog
|
|
400
|
+
* </Button>
|
|
401
|
+
* </AlertDialogTrigger>
|
|
402
|
+
* <AlertDialogContent>
|
|
403
|
+
* <AlertDialogIcon />
|
|
404
|
+
* <AlertDialogBody>
|
|
405
|
+
* <AlertDialogHeader>
|
|
406
|
+
* <AlertDialogTitle>
|
|
407
|
+
* Are you absolutely sure?
|
|
408
|
+
* </AlertDialogTitle>
|
|
409
|
+
* <AlertDialogDescription>
|
|
410
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
411
|
+
* </AlertDialogDescription>
|
|
412
|
+
* </AlertDialogHeader>
|
|
413
|
+
* <AlertDialogFooter>
|
|
414
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
415
|
+
* <AlertDialogAction type="button">
|
|
416
|
+
* Continue
|
|
417
|
+
* </AlertDialogAction>
|
|
418
|
+
* </AlertDialogFooter>
|
|
419
|
+
* </AlertDialogBody>
|
|
420
|
+
* </AlertDialogContent>
|
|
421
|
+
* </AlertDialog>
|
|
422
|
+
* ```
|
|
109
423
|
*/
|
|
110
424
|
declare const AlertDialogCancel: react.ForwardRefExoticComponent<(Omit<react.ClassAttributes<HTMLButtonElement> & react.ButtonHTMLAttributes<HTMLButtonElement> & Partial<DeepNonNullable<class_variance_authority.VariantProps<(props?: ({
|
|
111
425
|
appearance?: "link" | "filled" | "ghost" | "outlined" | null | undefined;
|
|
@@ -138,10 +452,55 @@ type AlertDialogIconProps = Omit<SvgAttributes, "children"> & {
|
|
|
138
452
|
* priority with the appropriate color.
|
|
139
453
|
*
|
|
140
454
|
* Can be overridden with a custom icon using the `svg` prop.
|
|
455
|
+
*
|
|
456
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-icon
|
|
457
|
+
*
|
|
458
|
+
* @example
|
|
459
|
+
* ```tsx
|
|
460
|
+
* <AlertDialog priority="danger">
|
|
461
|
+
* <AlertDialogTrigger asChild>
|
|
462
|
+
* <Button type="button" appearance="outlined">
|
|
463
|
+
* Show Danger Alert Dialog
|
|
464
|
+
* </Button>
|
|
465
|
+
* </AlertDialogTrigger>
|
|
466
|
+
* <AlertDialogContent>
|
|
467
|
+
* <AlertDialogIcon />
|
|
468
|
+
* <AlertDialogBody>
|
|
469
|
+
* <AlertDialogHeader>
|
|
470
|
+
* <AlertDialogTitle>
|
|
471
|
+
* Are you absolutely sure?
|
|
472
|
+
* </AlertDialogTitle>
|
|
473
|
+
* <AlertDialogDescription>
|
|
474
|
+
* Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.
|
|
475
|
+
* </AlertDialogDescription>
|
|
476
|
+
* </AlertDialogHeader>
|
|
477
|
+
* <AlertDialogFooter>
|
|
478
|
+
* <AlertDialogCancel type="button">Cancel</AlertDialogCancel>
|
|
479
|
+
* <AlertDialogAction type="button">
|
|
480
|
+
* Continue
|
|
481
|
+
* </AlertDialogAction>
|
|
482
|
+
* </AlertDialogFooter>
|
|
483
|
+
* </AlertDialogBody>
|
|
484
|
+
* </AlertDialogContent>
|
|
485
|
+
* </AlertDialog>
|
|
486
|
+
* ```
|
|
141
487
|
*/
|
|
142
488
|
declare const AlertDialogIcon: react.ForwardRefExoticComponent<Omit<AlertDialogIconProps, "ref"> & react.RefAttributes<SVGSVGElement>>;
|
|
143
489
|
/**
|
|
144
490
|
* A button that closes the Alert Dialog. (Unstyled)
|
|
491
|
+
*
|
|
492
|
+
* @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-close
|
|
493
|
+
*
|
|
494
|
+
* @example
|
|
495
|
+
* ```tsx
|
|
496
|
+
* <AlertDialogClose asChild>
|
|
497
|
+
* <AlertDialogAction
|
|
498
|
+
* type="button"
|
|
499
|
+
* onClick={() => doThing()}
|
|
500
|
+
* >
|
|
501
|
+
* Do thing and close
|
|
502
|
+
* </AlertDialogAction>
|
|
503
|
+
* </AlertDialogClose>
|
|
145
504
|
*/
|
|
146
505
|
declare const AlertDialogClose: react.ForwardRefExoticComponent<_radix_ui_react_dialog.DialogCloseProps & react.RefAttributes<HTMLButtonElement>>;
|
|
147
506
|
|
package/dist/alert-dialog.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import{a as
|
|
1
|
+
import{a as f,b as A,c as D,d as p,e as y,f as u,g as C,h as P}from"./chunk-PBARMKNJ.js";import{g}from"./chunk-ATNIDU3M.js";import"./chunk-DOTYPWKO.js";import"./chunk-D3XF6J5A.js";import{b as m}from"./chunk-J3NVDJIE.js";import"./chunk-4LSFAAZW.js";import"./chunk-3C5O3AQA.js";import"./chunk-72TJUKMV.js";import"./chunk-7O36LG52.js";import{a as d}from"./chunk-HDPLH5HC.js";import{a}from"./chunk-AZ56JGNY.js";import{Info as j}from"@phosphor-icons/react/Info";import{Warning as F}from"@phosphor-icons/react/Warning";import{Slot as c}from"@radix-ui/react-slot";import{createContext as H,forwardRef as n,useContext as V,useMemo as k}from"react";import M from"tiny-invariant";import{jsx as i,jsxs as J}from"react/jsx-runtime";var v=H(null);function x(){let t=V(v);return M(t,"AlertDialog child component used outside of AlertDialog parent!"),t}function N({priority:t,...e}){let o=k(()=>({priority:t}),[t]);return i(v.Provider,{value:o,children:i(f,{...e})})}N.displayName="AlertDialog";var q=A,E=D,R=n(({className:t,...e},o)=>i(y,{className:a("data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm",t),...e,ref:o}));R.displayName="AlertDialogOverlay";var h=n(({className:t,onInteractOutside:e,onPointerDownOutside:o,...l},r)=>J(E,{children:[i(R,{}),i("div",{className:"fixed inset-4 z-50 flex items-center justify-center",children:i(u,{ref:r,className:a("flex w-full max-w-md flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start","outline-none focus-within:outline-none","p-6","border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200","data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95",t),onInteractOutside:s=>{g(s),e?.(s)},onPointerDownOutside:s=>{g(s),o?.(s)},...l})})]}));h.displayName="AlertDialogContent";var b=n(({asChild:t=!1,className:e,...o},l)=>i(t?c:"div",{className:a("flex-1 space-y-4",e),ref:l,...o}));b.displayName="AlertDialogBody";var O=n(({asChild:t=!1,className:e,...o},l)=>i(t?c:"div",{className:a("flex flex-col space-y-2 text-center sm:text-start",e),...o}));O.displayName="AlertDialogHeader";var W=n(({asChild:t=!1,className:e,...o},l)=>i(t?c:"div",{className:a("flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2",e),...o}));W.displayName="AlertDialogFooter";var B=n(({className:t,...e},o)=>i(C,{ref:o,className:a("text-strong text-center text-lg font-medium sm:text-start",t),...e}));B.displayName="AlertDialogTitle";var I=n(({className:t,...e},o)=>i(P,{ref:o,className:a("text-body text-center text-sm font-normal sm:text-start",t),...e}));I.displayName="AlertDialogDescription";var T=n(({appearance:t="filled",...e},o)=>{let l=x(),r="default";return l.priority==="danger"&&(r="danger"),i(m,{appearance:t,priority:r,ref:o,...e})});T.displayName="AlertDialogAction";var w=n(({appearance:t="outlined",className:e,priority:o="neutral",...l},r)=>i(p,{asChild:!0,children:i(m,{appearance:t,className:a("mt-2 sm:mt-0",e),priority:o,ref:r,...l})}));w.displayName="AlertDialogCancel";var z=n(({className:t,svg:e,...o},l)=>{let r=x(),s=r.priority==="danger"?"text-danger-600":"text-accent-600",S=r.priority==="danger"?i(F,{}):i(j,{});return i(d,{ref:l,className:a("size-12 sm:size-7",s,t),svg:e??S,...o})});z.displayName="AlertDialogIcon";var G=p;export{N as AlertDialog,T as AlertDialogAction,b as AlertDialogBody,w as AlertDialogCancel,G as AlertDialogClose,h as AlertDialogContent,I as AlertDialogDescription,W as AlertDialogFooter,O as AlertDialogHeader,z as AlertDialogIcon,B as AlertDialogTitle,q as AlertDialogTrigger};
|
|
2
2
|
//# sourceMappingURL=alert-dialog.js.map
|
package/dist/alert-dialog.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Info } from \"@phosphor-icons/react/Info\";\nimport { Warning } from \"@phosphor-icons/react/Warning\";\nimport {\n\ttype ComponentProps,\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\ttype ReactNode,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n\tuseMemo,\n} from \"react\";\nimport invariant from \"tiny-invariant\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport {\n\tButton,\n\ttype ButtonPriority,\n\ttype ButtonProps,\n} from \"../button/button.js\";\nimport * as AlertDialogPrimitive from \"../dialog/primitive.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { preventCloseOnPromptInteraction } from \"../toast/toast.js\";\n\nconst priorities = [\"info\", \"danger\"] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertDialogContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertDialogContext = createContext<AlertDialogContextValue | null>(null);\n\nfunction useAlertDialogContext() {\n\tconst context = useContext(AlertDialogContext);\n\tinvariant(\n\t\tcontext,\n\t\t\"AlertDialog child component used outside of AlertDialog parent!\",\n\t);\n\treturn context;\n}\n\ntype AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive.Root> & {\n\t/**\n\t * Indicates the importance or impact level of the AlertDialog, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * The root component for the Alert Dialog\n */\nfunction AlertDialog({ priority, ...props }: AlertDialogProps) {\n\tconst context: AlertDialogContextValue = useMemo(\n\t\t() => ({ priority }),\n\t\t[priority],\n\t);\n\n\treturn (\n\t\t<AlertDialogContext.Provider value={context}>\n\t\t\t<AlertDialogPrimitive.Root {...props} />\n\t\t</AlertDialogContext.Provider>\n\t);\n}\nAlertDialog.displayName = \"AlertDialog\";\n\n/**\n * A button that opens the Alert Dialog.\n */\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\n/**\n * A layer that covers the inert portion of the view when the dialog is open.\n */\nconst AlertDialogOverlay = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nAlertDialogOverlay.displayName = \"AlertDialogOverlay\";\n\n/**\n * The popover alert dialog container.\n *\n * Renders on top of the overlay and is centered in the viewport.\n */\nconst AlertDialogContent = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>(({ className, onInteractOutside, onPointerDownOutside, ...props }, ref) => (\n\t<AlertDialogPortal>\n\t\t<AlertDialogOverlay />\n\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t<AlertDialogPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full max-w-md flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start\",\n\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\"p-6\",\n\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t}}\n\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t</AlertDialogPortal>\n));\nAlertDialogContent.displayName = \"AlertDialogContent\";\n\n/**\n * Contains the main content of the dialog.\n */\nconst AlertDialogBody = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div className={cx(\"flex-1 space-y-4\", className)} {...props} />\n);\nAlertDialogBody.displayName = \"AlertDialogBody\";\n\n/**\n * Contains the header content of the dialog, including the title and description.\n */\nconst AlertDialogHeader = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"flex flex-col space-y-2 text-center sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\n/**\n * Contains the footer content of the dialog, including the action and cancel buttons.\n */\nconst AlertDialogFooter = ({ className, ...props }: ComponentProps<\"div\">) => (\n\t<div\n\t\tclassName={cx(\n\t\t\t\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n);\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\n/**\n * An accessible name to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-label` or `aria-labelledby` to\n * `AlertDialogContent` and exclude this component.\n */\nconst AlertDialogTitle = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-strong text-center text-lg font-medium sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogTitle.displayName = \"AlertDialogTitle\";\n\n/**\n * An accessible description to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and\n * exclude this component.\n */\nconst AlertDialogDescription = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Description\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-body text-center text-sm font-normal sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogDescription.displayName = \"AlertDialogDescription\";\n\n/**\n * A button that confirms the Alert Dialog action.\n * Will default to appearance=\"filled\", as well as the priority color from the `AlertDialog`.\n * Does not close the alert dialog by default.\n *\n * These buttons should be distinguished visually from the AlertDialogCancel button.\n *\n * Composes around the mantle Button component.\n */\nconst AlertDialogAction = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"filled\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tlet buttonPriority: NonNullable<ButtonPriority> = \"default\";\n\t\tif (ctx.priority === \"danger\") {\n\t\t\tbuttonPriority = \"danger\";\n\t\t}\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t//\n\t\t\t\tappearance={appearance}\n\t\t\t\tpriority={buttonPriority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogAction.displayName = \"AlertDialogAction\";\n\n/**\n * A button that closes the dialog and cancels the action.\n * Will default to appearance=\"outlined\" and priority=\"neutral\".\n *\n * This button should be distinguished visually from AlertDialogAction buttons.\n *\n * Composes around the mantle Button component.\n */\nconst AlertDialogCancel = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"outlined\",\n\t\t\tclassName,\n\t\t\tpriority = \"neutral\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPrimitive.Close asChild>\n\t\t\t<Button\n\t\t\t\tappearance={appearance}\n\t\t\t\tclassName={cx(\"mt-2 sm:mt-0\", className)}\n\t\t\t\tpriority={priority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPrimitive.Close>\n\t),\n);\nAlertDialogCancel.displayName = \"AlertDialogCancel\";\n\ntype AlertDialogIconProps = Omit<SvgAttributes, \"children\"> & {\n\tsvg?: ReactNode;\n};\n\n/**\n * An icon that visually represents the priority of the AlertDialog.\n *\n * Defaults to a warning icon for danger priority and an info icon for info\n * priority with the appropriate color.\n *\n * Can be overridden with a custom icon using the `svg` prop.\n */\nconst AlertDialogIcon = forwardRef<ComponentRef<\"svg\">, AlertDialogIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tconst defaultColor =\n\t\t\tctx.priority === \"danger\" ? \"text-danger-600\" : \"text-accent-600\";\n\t\tconst defaultIcon = ctx.priority === \"danger\" ? <Warning /> : <Info />;\n\n\t\treturn (\n\t\t\t<SvgOnly\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"size-12 sm:size-7\", defaultColor, className)}\n\t\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogIcon.displayName = \"AlertDialogIcon\";\n\n/**\n * A button that closes the Alert Dialog. (Unstyled)\n */\nconst AlertDialogClose = AlertDialogPrimitive.Close;\n\nexport {\n\t//,\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogBody,\n\tAlertDialogCancel,\n\tAlertDialogClose,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\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ACC,CAEC,WAAAoB,EAAa,WACb,UAAAnB,EACA,SAAAX,EAAW,UACX,GAAGC,CACJ,EACAW,IAEAT,EAAsBgC,EAArB,CAA2B,QAAO,GAClC,SAAAhC,EAAC8B,EAAA,CACA,WAAYH,EACZ,UAAWhB,EAAG,eAAgBH,CAAS,EACvC,SAAUX,EACV,IAAKY,EACJ,GAAGX,EACL,EACD,CAEF,EACAiC,EAAkB,YAAc,oBAchC,IAAME,EAAkB1B,EACvB,CAAC,CAAE,UAAAC,EAAW,IAAA0B,EAAK,GAAGpC,CAAM,EAAGW,IAAQ,CACtC,IAAMmB,EAAMpC,EAAsB,EAC5B2C,EACLP,EAAI,WAAa,SAAW,kBAAoB,kBAC3CQ,EAAcR,EAAI,WAAa,SAAW5B,EAACqC,EAAA,EAAQ,EAAKrC,EAACsC,EAAA,EAAK,EAEpE,OACCtC,EAACuC,EAAA,CACA,IAAK9B,EACL,UAAWE,EAAG,oBAAqBwB,EAAc3B,CAAS,EAC1D,IAAK0B,GAAOE,EACX,GAAGtC,EACL,CAEF,CACD,EACAmC,EAAgB,YAAc,kBAK9B,IAAMO,EAAwCR","names":["Info","Warning","createContext","forwardRef","useContext","useMemo","invariant","jsx","jsxs","AlertDialogContext","createContext","useAlertDialogContext","context","useContext","invariant","AlertDialog","priority","props","useMemo","jsx","Root","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","AlertDialogOverlay","forwardRef","className","ref","Overlay","cx","AlertDialogContent","onInteractOutside","onPointerDownOutside","jsxs","Content","event","preventCloseOnPromptInteraction","AlertDialogBody","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","appearance","ctx","buttonPriority","Button","AlertDialogCancel","Close","AlertDialogIcon","svg","defaultColor","defaultIcon","Warning","Info","SvgOnly","AlertDialogClose"]}
|
|
1
|
+
{"version":3,"sources":["../src/components/alert-dialog/alert-dialog.tsx"],"sourcesContent":["\"use client\";\n\nimport { Info } from \"@phosphor-icons/react/Info\";\nimport { Warning } from \"@phosphor-icons/react/Warning\";\nimport { Slot } from \"@radix-ui/react-slot\";\nimport {\n\ttype ComponentProps,\n\ttype ComponentPropsWithoutRef,\n\ttype ComponentRef,\n\ttype ReactNode,\n\tcreateContext,\n\tforwardRef,\n\tuseContext,\n\tuseMemo,\n} from \"react\";\nimport invariant from \"tiny-invariant\";\nimport type { WithAsChild } from \"../../types/as-child.js\";\nimport { cx } from \"../../utils/cx/cx.js\";\nimport {\n\tButton,\n\ttype ButtonPriority,\n\ttype ButtonProps,\n} from \"../button/button.js\";\nimport * as AlertDialogPrimitive from \"../dialog/primitive.js\";\nimport { SvgOnly } from \"../icon/svg-only.js\";\nimport type { SvgAttributes } from \"../icon/types.js\";\nimport { preventCloseOnPromptInteraction } from \"../toast/toast.js\";\n\nconst priorities = [\"info\", \"danger\"] as const;\ntype Priority = (typeof priorities)[number];\n\ntype AlertDialogContextValue = {\n\tpriority: Priority;\n};\n\nconst AlertDialogContext = createContext<AlertDialogContextValue | null>(null);\n\nfunction useAlertDialogContext() {\n\tconst context = useContext(AlertDialogContext);\n\tinvariant(\n\t\tcontext,\n\t\t\"AlertDialog child component used outside of AlertDialog parent!\",\n\t);\n\treturn context;\n}\n\ntype AlertDialogProps = ComponentProps<typeof AlertDialogPrimitive.Root> & {\n\t/**\n\t * Indicates the importance or impact level of the AlertDialog, affecting its\n\t * color and styling to communicate its purpose to the user.\n\t */\n\tpriority: Priority;\n};\n\n/**\n * A modal dialog that interrupts the user with important content and expects a\n * response.\n * The root stateful component for the Alert Dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nfunction AlertDialog({ priority, ...props }: AlertDialogProps) {\n\tconst context: AlertDialogContextValue = useMemo(\n\t\t() => ({ priority }),\n\t\t[priority],\n\t);\n\n\treturn (\n\t\t<AlertDialogContext.Provider value={context}>\n\t\t\t<AlertDialogPrimitive.Root {...props} />\n\t\t</AlertDialogContext.Provider>\n\t);\n}\nAlertDialog.displayName = \"AlertDialog\";\n\n/**\n * A button that opens the Alert Dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-trigger\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogTrigger = AlertDialogPrimitive.Trigger;\n\n/**\n * The portal for the Alert Dialog.\n *\n * @private\n */\nconst AlertDialogPortal = AlertDialogPrimitive.Portal;\n\n/**\n * A layer that covers the inert portion of the view when the dialog is open.\n *\n * @private\n */\nconst AlertDialogOverlay = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Overlay>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Overlay>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Overlay\n\t\tclassName={cx(\n\t\t\t\"data-state-open:animate-in data-state-closed:animate-out data-state-closed:fade-out-0 data-state-open:fade-in-0 bg-overlay fixed inset-0 z-50 backdrop-blur-sm\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t\tref={ref}\n\t/>\n));\nAlertDialogOverlay.displayName = \"AlertDialogOverlay\";\n\n/**\n * The popover alert dialog container.\n *\n * Renders on top of the overlay and is centered in the viewport.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-content\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogContent = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Content>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Content>\n>(({ className, onInteractOutside, onPointerDownOutside, ...props }, ref) => (\n\t<AlertDialogPortal>\n\t\t<AlertDialogOverlay />\n\t\t<div className=\"fixed inset-4 z-50 flex items-center justify-center\">\n\t\t\t<AlertDialogPrimitive.Content\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\n\t\t\t\t\t\"flex w-full max-w-md flex-1 flex-col items-center gap-4 sm:flex-row sm:items-start\",\n\t\t\t\t\t\"outline-none focus-within:outline-none\",\n\t\t\t\t\t\"p-6\",\n\t\t\t\t\t\"border-dialog bg-dialog rounded-xl border shadow-lg transition-transform duration-200\",\n\t\t\t\t\t\"data-state-closed:animate-out data-state-closed:fade-out-0 data-state-closed:zoom-out-95 data-state-open:animate-in data-state-open:fade-in-0 data-state-open:zoom-in-95\",\n\t\t\t\t\tclassName,\n\t\t\t\t)}\n\t\t\t\tonInteractOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonInteractOutside?.(event);\n\t\t\t\t}}\n\t\t\t\tonPointerDownOutside={(event) => {\n\t\t\t\t\tpreventCloseOnPromptInteraction(event);\n\t\t\t\t\tonPointerDownOutside?.(event);\n\t\t\t\t}}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</div>\n\t</AlertDialogPortal>\n));\nAlertDialogContent.displayName = \"AlertDialogContent\";\n\n/**\n * Contains the main content of the alert dialog.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-body\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogBody = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\"flex-1 space-y-4\", className)}\n\t\t\tref={ref}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogBody.displayName = \"AlertDialogBody\";\n\n/**\n * Contains the header content of the dialog, including the title and description.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-header\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogHeader = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\n\t\t\t\t\"flex flex-col space-y-2 text-center sm:text-start\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogHeader.displayName = \"AlertDialogHeader\";\n\n/**\n * Contains the footer content of the dialog, including the action and cancel buttons.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-footer\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogFooter = forwardRef<\n\tComponentRef<\"div\">,\n\tComponentProps<\"div\"> & WithAsChild\n>(({ asChild = false, className, ...props }, ref) => {\n\tconst Component = asChild ? Slot : \"div\";\n\n\treturn (\n\t\t<Component\n\t\t\tclassName={cx(\n\t\t\t\t\"flex flex-col-reverse sm:flex-row sm:justify-end sm:space-x-2\",\n\t\t\t\tclassName,\n\t\t\t)}\n\t\t\t{...props}\n\t\t/>\n\t);\n});\nAlertDialogFooter.displayName = \"AlertDialogFooter\";\n\n/**\n * An accessible name to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-label` or `aria-labelledby` to\n * `AlertDialogContent` and exclude this component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-title\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogTitle = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Title>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Title>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Title\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-strong text-center text-lg font-medium sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogTitle.displayName = \"AlertDialogTitle\";\n\n/**\n * An accessible description to be announced when the dialog is opened.\n *\n * Alternatively, you can provide `aria-describedby` to `AlertDialogContent` and\n * exclude this component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-description\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogDescription = forwardRef<\n\tComponentRef<typeof AlertDialogPrimitive.Description>,\n\tComponentPropsWithoutRef<typeof AlertDialogPrimitive.Description>\n>(({ className, ...props }, ref) => (\n\t<AlertDialogPrimitive.Description\n\t\tref={ref}\n\t\tclassName={cx(\n\t\t\t\"text-body text-center text-sm font-normal sm:text-start\",\n\t\t\tclassName,\n\t\t)}\n\t\t{...props}\n\t/>\n));\nAlertDialogDescription.displayName = \"AlertDialogDescription\";\n\n/**\n * A button that confirms the Alert Dialog action.\n * Will default to appearance=\"filled\", as well as the priority color from the `AlertDialog`.\n * Does not close the alert dialog by default.\n *\n * These buttons should be distinguished visually from the AlertDialogCancel button.\n *\n * Composes around the mantle Button component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-action\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogAction = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"filled\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tlet buttonPriority: NonNullable<ButtonPriority> = \"default\";\n\t\tif (ctx.priority === \"danger\") {\n\t\t\tbuttonPriority = \"danger\";\n\t\t}\n\n\t\treturn (\n\t\t\t<Button\n\t\t\t\t//\n\t\t\t\tappearance={appearance}\n\t\t\t\tpriority={buttonPriority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogAction.displayName = \"AlertDialogAction\";\n\n/**\n * A button that closes the dialog and cancels the action.\n * Will default to appearance=\"outlined\" and priority=\"neutral\".\n *\n * This button should be distinguished visually from AlertDialogAction buttons.\n *\n * Composes around the mantle Button component.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-cancel\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogCancel = forwardRef<ComponentRef<\"button\">, ButtonProps>(\n\t(\n\t\t{\n\t\t\t//,\n\t\t\tappearance = \"outlined\",\n\t\t\tclassName,\n\t\t\tpriority = \"neutral\",\n\t\t\t...props\n\t\t},\n\t\tref,\n\t) => (\n\t\t<AlertDialogPrimitive.Close asChild>\n\t\t\t<Button\n\t\t\t\tappearance={appearance}\n\t\t\t\tclassName={cx(\"mt-2 sm:mt-0\", className)}\n\t\t\t\tpriority={priority}\n\t\t\t\tref={ref}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t</AlertDialogPrimitive.Close>\n\t),\n);\nAlertDialogCancel.displayName = \"AlertDialogCancel\";\n\ntype AlertDialogIconProps = Omit<SvgAttributes, \"children\"> & {\n\tsvg?: ReactNode;\n};\n\n/**\n * An icon that visually represents the priority of the AlertDialog.\n *\n * Defaults to a warning icon for danger priority and an info icon for info\n * priority with the appropriate color.\n *\n * Can be overridden with a custom icon using the `svg` prop.\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-icon\n *\n * @example\n * ```tsx\n * <AlertDialog priority=\"danger\">\n * <AlertDialogTrigger asChild>\n * <Button type=\"button\" appearance=\"outlined\">\n * Show Danger Alert Dialog\n * </Button>\n * </AlertDialogTrigger>\n * <AlertDialogContent>\n * <AlertDialogIcon />\n * <AlertDialogBody>\n * <AlertDialogHeader>\n * <AlertDialogTitle>\n * Are you absolutely sure?\n * </AlertDialogTitle>\n * <AlertDialogDescription>\n * Proident quis nisi tempor irure sunt ut minim occaecat mollit sunt.\n * </AlertDialogDescription>\n * </AlertDialogHeader>\n * <AlertDialogFooter>\n * <AlertDialogCancel type=\"button\">Cancel</AlertDialogCancel>\n * <AlertDialogAction type=\"button\">\n * Continue\n * </AlertDialogAction>\n * </AlertDialogFooter>\n * \t</AlertDialogBody>\n * </AlertDialogContent>\n * </AlertDialog>\n * ```\n */\nconst AlertDialogIcon = forwardRef<ComponentRef<\"svg\">, AlertDialogIconProps>(\n\t({ className, svg, ...props }, ref) => {\n\t\tconst ctx = useAlertDialogContext();\n\t\tconst defaultColor =\n\t\t\tctx.priority === \"danger\" ? \"text-danger-600\" : \"text-accent-600\";\n\t\tconst defaultIcon = ctx.priority === \"danger\" ? <Warning /> : <Info />;\n\n\t\treturn (\n\t\t\t<SvgOnly\n\t\t\t\tref={ref}\n\t\t\t\tclassName={cx(\"size-12 sm:size-7\", defaultColor, className)}\n\t\t\t\tsvg={svg ?? defaultIcon}\n\t\t\t\t{...props}\n\t\t\t/>\n\t\t);\n\t},\n);\nAlertDialogIcon.displayName = \"AlertDialogIcon\";\n\n/**\n * A button that closes the Alert Dialog. (Unstyled)\n *\n * @see https://mantle.ngrok.com/components/alert-dialog#api-alert-dialog-close\n *\n * @example\n * ```tsx\n * <AlertDialogClose asChild>\n * <AlertDialogAction\n * \ttype=\"button\"\n * \tonClick={() => doThing()}\n * >\n * \tDo thing and close\n * </AlertDialogAction>\n * </AlertDialogClose>\n */\nconst AlertDialogClose = AlertDialogPrimitive.Close;\n\nexport {\n\t//,\n\tAlertDialog,\n\tAlertDialogAction,\n\tAlertDialogBody,\n\tAlertDialogCancel,\n\tAlertDialogClose,\n\tAlertDialogContent,\n\tAlertDialogDescription,\n\tAlertDialogFooter,\n\tAlertDialogHeader,\n\tAlertDialogIcon,\n\tAlertDialogTitle,\n\tAlertDialogTrigger,\n};\n"],"mappings":"uZAEA,OAAS,QAAAA,MAAY,6BACrB,OAAS,WAAAC,MAAe,gCACxB,OAAS,QAAAC,MAAY,uBACrB,OAKC,iBAAAC,EACA,cAAAC,EACA,cAAAC,EACA,WAAAC,MACM,QACP,OAAOC,MAAe,iBAoFnB,cAAAC,EA+GF,QAAAC,MA/GE,oBAhEH,IAAMC,EAAqBC,EAA8C,IAAI,EAE7E,SAASC,GAAwB,CAChC,IAAMC,EAAUC,EAAWJ,CAAkB,EAC7C,OAAAK,EACCF,EACA,iEACD,EACOA,CACR,CA+CA,SAASG,EAAY,CAAE,SAAAC,EAAU,GAAGC,CAAM,EAAqB,CAC9D,IAAML,EAAmCM,EACxC,KAAO,CAAE,SAAAF,CAAS,GAClB,CAACA,CAAQ,CACV,EAEA,OACCG,EAACV,EAAmB,SAAnB,CAA4B,MAAOG,EAC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Q,CACtC,IAAMqB,EAAMtC,EAAsB,EAC5B6C,EACLP,EAAI,WAAa,SAAW,kBAAoB,kBAC3CQ,EAAcR,EAAI,WAAa,SAAW9B,EAACuC,EAAA,EAAQ,EAAKvC,EAACwC,EAAA,EAAK,EAEpE,OACCxC,EAACyC,EAAA,CACA,IAAKhC,EACL,UAAWE,EAAG,oBAAqB0B,EAAc7B,CAAS,EAC1D,IAAK4B,GAAOE,EACX,GAAGxC,EACL,CAEF,CACD,EACAqC,EAAgB,YAAc,kBAkB9B,IAAMO,EAAwCR","names":["Info","Warning","Slot","createContext","forwardRef","useContext","useMemo","invariant","jsx","jsxs","AlertDialogContext","createContext","useAlertDialogContext","context","useContext","invariant","AlertDialog","priority","props","useMemo","jsx","Root","AlertDialogTrigger","Trigger","AlertDialogPortal","Portal","AlertDialogOverlay","forwardRef","className","ref","Overlay","cx","AlertDialogContent","onInteractOutside","onPointerDownOutside","jsxs","Content","event","preventCloseOnPromptInteraction","AlertDialogBody","asChild","Slot","AlertDialogHeader","AlertDialogFooter","AlertDialogTitle","Title","AlertDialogDescription","Description","AlertDialogAction","appearance","ctx","buttonPriority","Button","AlertDialogCancel","Close","AlertDialogIcon","svg","defaultColor","defaultIcon","Warning","Info","SvgOnly","AlertDialogClose"]}
|
package/dist/alert.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
2
|
import { ComponentProps, HTMLAttributes, ReactNode } from 'react';
|
|
3
|
-
import { W as WithAsChild } from './as-child-
|
|
3
|
+
import { W as WithAsChild } from './as-child-DJ7x3JFV.js';
|
|
4
4
|
import { S as SvgAttributes } from './types-BuKAGhC-.js';
|
|
5
5
|
|
|
6
6
|
declare const priorities: readonly ["danger", "info", "success", "warning"];
|