@yamada-ui/modal 0.2.6 → 0.2.8
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/chunk-VHMYEQE4.mjs +777 -0
- package/dist/dialog.js +382 -238
- package/dist/dialog.mjs +1 -1
- package/dist/drawer.js +382 -238
- package/dist/drawer.mjs +1 -1
- package/dist/index.js +382 -238
- package/dist/index.mjs +1 -1
- package/dist/modal-body.js +382 -238
- package/dist/modal-body.mjs +1 -1
- package/dist/modal-close-button.js +382 -238
- package/dist/modal-close-button.mjs +1 -1
- package/dist/modal-footer.js +382 -238
- package/dist/modal-footer.mjs +1 -1
- package/dist/modal-header.js +382 -238
- package/dist/modal-header.mjs +1 -1
- package/dist/modal-overlay.js +382 -238
- package/dist/modal-overlay.mjs +1 -1
- package/dist/modal.js +382 -238
- package/dist/modal.mjs +1 -1
- package/package.json +10 -10
- package/dist/chunk-OUW3Q5QN.mjs +0 -623
package/dist/dialog.js
CHANGED
|
@@ -52,62 +52,70 @@ var [DrawerProvider, useDrawer] = (0, import_utils.createContext)({
|
|
|
52
52
|
name: `DrawerContext`,
|
|
53
53
|
errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
|
|
54
54
|
});
|
|
55
|
-
var Drawer = (0, import_core.forwardRef)(
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
55
|
+
var Drawer = (0, import_core.forwardRef)(
|
|
56
|
+
({ size, ...props }, ref) => {
|
|
57
|
+
const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Drawer", {
|
|
58
|
+
size,
|
|
59
|
+
...props
|
|
60
|
+
});
|
|
61
|
+
const {
|
|
62
|
+
children,
|
|
63
|
+
isOpen,
|
|
64
|
+
placement = "right",
|
|
65
|
+
onClose,
|
|
66
|
+
onOverlayClick,
|
|
67
|
+
onEsc,
|
|
68
|
+
onCloseComplete,
|
|
69
|
+
withCloseButton = true,
|
|
70
|
+
withOverlay = true,
|
|
71
|
+
allowPinchZoom,
|
|
72
|
+
autoFocus,
|
|
73
|
+
restoreFocus,
|
|
74
|
+
initialFocusRef,
|
|
75
|
+
finalFocusRef,
|
|
76
|
+
blockScrollOnMount,
|
|
77
|
+
closeOnOverlay,
|
|
78
|
+
closeOnEsc,
|
|
79
|
+
lockFocusAcrossFrames,
|
|
80
|
+
duration = { enter: 0.4, exit: 0.3 },
|
|
81
|
+
...rest
|
|
82
|
+
} = (0, import_core.omitThemeProps)(mergedProps);
|
|
83
|
+
const validChildren = (0, import_utils.getValidChildren)(children);
|
|
84
|
+
const [customDrawerOverlay, ...cloneChildren] = (0, import_utils.findChildren)(
|
|
85
|
+
validChildren,
|
|
86
|
+
DrawerOverlay
|
|
87
|
+
);
|
|
88
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
|
|
89
|
+
Modal,
|
|
90
|
+
{
|
|
91
|
+
ref,
|
|
92
|
+
...{
|
|
93
|
+
isOpen,
|
|
94
|
+
onClose,
|
|
95
|
+
onOverlayClick,
|
|
96
|
+
onEsc,
|
|
97
|
+
onCloseComplete,
|
|
98
|
+
withCloseButton: false,
|
|
99
|
+
withOverlay: false,
|
|
100
|
+
allowPinchZoom,
|
|
101
|
+
autoFocus,
|
|
102
|
+
restoreFocus,
|
|
103
|
+
initialFocusRef,
|
|
104
|
+
finalFocusRef,
|
|
105
|
+
blockScrollOnMount,
|
|
106
|
+
closeOnOverlay,
|
|
107
|
+
closeOnEsc,
|
|
108
|
+
lockFocusAcrossFrames,
|
|
109
|
+
duration
|
|
110
|
+
},
|
|
111
|
+
children: [
|
|
112
|
+
customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerOverlay, {}) : null,
|
|
113
|
+
/* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerContent, { ...{ placement, withCloseButton, ...rest }, children: cloneChildren })
|
|
114
|
+
]
|
|
115
|
+
}
|
|
116
|
+
) });
|
|
117
|
+
}
|
|
118
|
+
);
|
|
111
119
|
var DrawerContent = (0, import_core.forwardRef)(
|
|
112
120
|
({ className, children, placement, withCloseButton, ...rest }, ref) => {
|
|
113
121
|
const { isOpen, onClose, duration } = useModal();
|
|
@@ -177,19 +185,45 @@ var DrawerHeader = (0, import_core.forwardRef)(
|
|
|
177
185
|
({ className, ...rest }, ref) => {
|
|
178
186
|
const styles = useDrawer();
|
|
179
187
|
const css = { ...styles.header };
|
|
180
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
188
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
189
|
+
ModalHeader,
|
|
190
|
+
{
|
|
191
|
+
ref,
|
|
192
|
+
className: (0, import_utils.cx)("ui-drawer-header", className),
|
|
193
|
+
__css: css,
|
|
194
|
+
...rest
|
|
195
|
+
}
|
|
196
|
+
);
|
|
197
|
+
}
|
|
198
|
+
);
|
|
199
|
+
var DrawerBody = (0, import_core.forwardRef)(
|
|
200
|
+
({ className, ...rest }, ref) => {
|
|
201
|
+
const styles = useDrawer();
|
|
202
|
+
const css = { ...styles.body };
|
|
203
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
204
|
+
ModalBody,
|
|
205
|
+
{
|
|
206
|
+
ref,
|
|
207
|
+
className: (0, import_utils.cx)("ui-drawer-body", className),
|
|
208
|
+
__css: css,
|
|
209
|
+
...rest
|
|
210
|
+
}
|
|
211
|
+
);
|
|
181
212
|
}
|
|
182
213
|
);
|
|
183
|
-
var DrawerBody = (0, import_core.forwardRef)(({ className, ...rest }, ref) => {
|
|
184
|
-
const styles = useDrawer();
|
|
185
|
-
const css = { ...styles.body };
|
|
186
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalBody, { ref, className: (0, import_utils.cx)("ui-drawer-body", className), __css: css, ...rest });
|
|
187
|
-
});
|
|
188
214
|
var DrawerFooter = (0, import_core.forwardRef)(
|
|
189
215
|
({ className, ...rest }, ref) => {
|
|
190
216
|
const styles = useDrawer();
|
|
191
217
|
const css = { ...styles.footer };
|
|
192
|
-
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
218
|
+
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
219
|
+
ModalFooter,
|
|
220
|
+
{
|
|
221
|
+
ref,
|
|
222
|
+
className: (0, import_utils.cx)("ui-drawer-footer", className),
|
|
223
|
+
__css: css,
|
|
224
|
+
...rest
|
|
225
|
+
}
|
|
226
|
+
);
|
|
193
227
|
}
|
|
194
228
|
);
|
|
195
229
|
|
|
@@ -199,107 +233,121 @@ var [ModalProvider, useModal] = (0, import_utils2.createContext)({
|
|
|
199
233
|
name: `ModalContext`,
|
|
200
234
|
errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
|
|
201
235
|
});
|
|
202
|
-
var Modal = (0, import_core2.forwardRef)(
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
239
|
-
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
const [customModalOverlay, ...cloneChildren] = (0, import_utils2.findChildren)(
|
|
243
|
-
validChildren,
|
|
244
|
-
ModalOverlay,
|
|
245
|
-
DialogOverlay,
|
|
246
|
-
DrawerOverlay
|
|
247
|
-
);
|
|
248
|
-
let [drawerContent] = (0, import_utils2.findChildren)(validChildren, DrawerContent);
|
|
249
|
-
if (drawerContent)
|
|
250
|
-
drawerContent = (0, import_react.cloneElement)(drawerContent, { onKeyDown });
|
|
251
|
-
const placement = (0, import_use_value.useValue)(_placement);
|
|
252
|
-
const css = {
|
|
253
|
-
position: "fixed",
|
|
254
|
-
top: 0,
|
|
255
|
-
left: 0,
|
|
256
|
-
zIndex: "beerus",
|
|
257
|
-
w: "100vw",
|
|
258
|
-
h: "100vh",
|
|
259
|
-
p: size !== "full" ? outside : void 0,
|
|
260
|
-
display: "flex",
|
|
261
|
-
justifyContent: placement.includes("right") ? "flex-start" : placement.includes("left") ? "flex-end" : "center",
|
|
262
|
-
alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
|
|
263
|
-
};
|
|
264
|
-
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
265
|
-
ModalProvider,
|
|
266
|
-
{
|
|
267
|
-
value: {
|
|
268
|
-
isOpen,
|
|
269
|
-
onClose,
|
|
270
|
-
onOverlayClick,
|
|
271
|
-
withCloseButton,
|
|
272
|
-
scrollBehavior,
|
|
273
|
-
closeOnOverlay,
|
|
274
|
-
animation,
|
|
275
|
-
duration,
|
|
276
|
-
styles
|
|
236
|
+
var Modal = (0, import_core2.forwardRef)(
|
|
237
|
+
({ size, ...props }, ref) => {
|
|
238
|
+
const [styles, mergedProps] = (0, import_core2.useMultiComponentStyle)("Modal", {
|
|
239
|
+
size,
|
|
240
|
+
...props
|
|
241
|
+
});
|
|
242
|
+
const {
|
|
243
|
+
className,
|
|
244
|
+
children,
|
|
245
|
+
isOpen,
|
|
246
|
+
onClose,
|
|
247
|
+
onOverlayClick,
|
|
248
|
+
onEsc,
|
|
249
|
+
onCloseComplete,
|
|
250
|
+
placement: _placement = "center",
|
|
251
|
+
outside = "md",
|
|
252
|
+
withCloseButton = true,
|
|
253
|
+
withOverlay = true,
|
|
254
|
+
allowPinchZoom = false,
|
|
255
|
+
scrollBehavior = "inside",
|
|
256
|
+
autoFocus,
|
|
257
|
+
restoreFocus,
|
|
258
|
+
initialFocusRef,
|
|
259
|
+
finalFocusRef,
|
|
260
|
+
blockScrollOnMount = true,
|
|
261
|
+
closeOnOverlay = true,
|
|
262
|
+
closeOnEsc = true,
|
|
263
|
+
lockFocusAcrossFrames = true,
|
|
264
|
+
animation = "scale",
|
|
265
|
+
duration,
|
|
266
|
+
...rest
|
|
267
|
+
} = (0, import_core2.omitThemeProps)(mergedProps);
|
|
268
|
+
const onKeyDown = (0, import_react.useCallback)(
|
|
269
|
+
(event) => {
|
|
270
|
+
if (event.key !== "Escape")
|
|
271
|
+
return;
|
|
272
|
+
event.stopPropagation();
|
|
273
|
+
if (closeOnEsc)
|
|
274
|
+
onClose == null ? void 0 : onClose();
|
|
275
|
+
onEsc == null ? void 0 : onEsc();
|
|
277
276
|
},
|
|
278
|
-
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
}
|
|
277
|
+
[closeOnEsc, onClose, onEsc]
|
|
278
|
+
);
|
|
279
|
+
const validChildren = (0, import_utils2.getValidChildren)(children);
|
|
280
|
+
const [customModalOverlay, ...cloneChildren] = (0, import_utils2.findChildren)(
|
|
281
|
+
validChildren,
|
|
282
|
+
ModalOverlay,
|
|
283
|
+
DialogOverlay,
|
|
284
|
+
DrawerOverlay
|
|
285
|
+
);
|
|
286
|
+
let [drawerContent] = (0, import_utils2.findChildren)(validChildren, DrawerContent);
|
|
287
|
+
if (drawerContent)
|
|
288
|
+
drawerContent = (0, import_react.cloneElement)(drawerContent, { onKeyDown });
|
|
289
|
+
const placement = (0, import_use_value.useValue)(_placement);
|
|
290
|
+
const css = {
|
|
291
|
+
position: "fixed",
|
|
292
|
+
top: 0,
|
|
293
|
+
left: 0,
|
|
294
|
+
zIndex: "beerus",
|
|
295
|
+
w: "100vw",
|
|
296
|
+
h: "100vh",
|
|
297
|
+
p: size !== "full" ? outside : void 0,
|
|
298
|
+
display: "flex",
|
|
299
|
+
justifyContent: placement.includes("right") ? "flex-start" : placement.includes("left") ? "flex-end" : "center",
|
|
300
|
+
alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
|
|
301
|
+
};
|
|
302
|
+
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
303
|
+
ModalProvider,
|
|
304
|
+
{
|
|
305
|
+
value: {
|
|
306
|
+
isOpen,
|
|
307
|
+
onClose,
|
|
308
|
+
onOverlayClick,
|
|
309
|
+
withCloseButton,
|
|
310
|
+
scrollBehavior,
|
|
311
|
+
closeOnOverlay,
|
|
312
|
+
animation,
|
|
313
|
+
duration,
|
|
314
|
+
styles
|
|
315
|
+
},
|
|
316
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_motion.AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_portal.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
317
|
+
import_focus_lock.FocusLock,
|
|
318
|
+
{
|
|
319
|
+
autoFocus,
|
|
320
|
+
initialFocusRef,
|
|
321
|
+
finalFocusRef,
|
|
322
|
+
restoreFocus,
|
|
323
|
+
lockFocusAcrossFrames,
|
|
324
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
325
|
+
import_react_remove_scroll.RemoveScroll,
|
|
326
|
+
{
|
|
327
|
+
allowPinchZoom,
|
|
328
|
+
enabled: blockScrollOnMount,
|
|
329
|
+
forwardProps: true,
|
|
330
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.ui.div, { __css: css, children: [
|
|
331
|
+
customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ModalOverlay, {}) : null,
|
|
332
|
+
drawerContent != null ? drawerContent : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
333
|
+
ModalContent,
|
|
334
|
+
{
|
|
335
|
+
ref,
|
|
336
|
+
className,
|
|
337
|
+
onKeyDown,
|
|
338
|
+
...rest,
|
|
339
|
+
children: cloneChildren
|
|
340
|
+
}
|
|
341
|
+
)
|
|
342
|
+
] })
|
|
343
|
+
}
|
|
344
|
+
)
|
|
345
|
+
}
|
|
346
|
+
) }) : null })
|
|
347
|
+
}
|
|
348
|
+
);
|
|
349
|
+
}
|
|
350
|
+
);
|
|
303
351
|
var getModalContentProps = (animation = "scale", duration) => {
|
|
304
352
|
switch (animation) {
|
|
305
353
|
case "scale":
|
|
@@ -331,7 +379,14 @@ var getModalContentProps = (animation = "scale", duration) => {
|
|
|
331
379
|
};
|
|
332
380
|
var ModalContent = (0, import_core2.forwardRef)(
|
|
333
381
|
({ className, children, __css, ...rest }, ref) => {
|
|
334
|
-
const {
|
|
382
|
+
const {
|
|
383
|
+
styles,
|
|
384
|
+
scrollBehavior,
|
|
385
|
+
withCloseButton,
|
|
386
|
+
onClose,
|
|
387
|
+
animation,
|
|
388
|
+
duration
|
|
389
|
+
} = useModal();
|
|
335
390
|
const validChildren = (0, import_utils2.getValidChildren)(children);
|
|
336
391
|
const [customModalCloseButton, ...cloneChildren] = (0, import_utils2.findChildren)(
|
|
337
392
|
validChildren,
|
|
@@ -375,7 +430,14 @@ var import_utils3 = require("@yamada-ui/utils");
|
|
|
375
430
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
376
431
|
var ModalOverlay = (0, import_core3.forwardRef)(
|
|
377
432
|
({ className, __css, onClick, ...rest }, ref) => {
|
|
378
|
-
const {
|
|
433
|
+
const {
|
|
434
|
+
styles,
|
|
435
|
+
closeOnOverlay,
|
|
436
|
+
onOverlayClick,
|
|
437
|
+
onClose,
|
|
438
|
+
animation,
|
|
439
|
+
duration
|
|
440
|
+
} = useModal();
|
|
379
441
|
const css = {
|
|
380
442
|
position: "fixed",
|
|
381
443
|
top: 0,
|
|
@@ -446,7 +508,15 @@ var ModalHeader = (0, import_core5.forwardRef)(
|
|
|
446
508
|
justifyContent: "flex-start",
|
|
447
509
|
...__css ? __css : styles.header
|
|
448
510
|
};
|
|
449
|
-
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
511
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
512
|
+
import_core5.ui.header,
|
|
513
|
+
{
|
|
514
|
+
ref,
|
|
515
|
+
className: (0, import_utils5.cx)("ui-modal-header", className),
|
|
516
|
+
__css: css,
|
|
517
|
+
...rest
|
|
518
|
+
}
|
|
519
|
+
);
|
|
450
520
|
}
|
|
451
521
|
);
|
|
452
522
|
|
|
@@ -464,7 +534,15 @@ var ModalBody = (0, import_core6.forwardRef)(
|
|
|
464
534
|
overflow: scrollBehavior === "inside" ? "auto" : void 0,
|
|
465
535
|
...__css ? __css : styles.body
|
|
466
536
|
};
|
|
467
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
538
|
+
import_core6.ui.main,
|
|
539
|
+
{
|
|
540
|
+
ref,
|
|
541
|
+
className: (0, import_utils6.cx)("ui-modal-body", className),
|
|
542
|
+
__css: css,
|
|
543
|
+
...rest
|
|
544
|
+
}
|
|
545
|
+
);
|
|
468
546
|
}
|
|
469
547
|
);
|
|
470
548
|
|
|
@@ -481,7 +559,15 @@ var ModalFooter = (0, import_core7.forwardRef)(
|
|
|
481
559
|
justifyContent: "flex-end",
|
|
482
560
|
...__css ? __css : styles.footer
|
|
483
561
|
};
|
|
484
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
562
|
+
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
563
|
+
import_core7.ui.footer,
|
|
564
|
+
{
|
|
565
|
+
ref,
|
|
566
|
+
className: (0, import_utils7.cx)("ui-modal-footer", className),
|
|
567
|
+
__css: css,
|
|
568
|
+
...rest
|
|
569
|
+
}
|
|
570
|
+
);
|
|
485
571
|
}
|
|
486
572
|
);
|
|
487
573
|
|
|
@@ -491,69 +577,101 @@ var [DialogProvider, useDialog] = (0, import_utils8.createContext)({
|
|
|
491
577
|
name: `DialogContext`,
|
|
492
578
|
errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
|
|
493
579
|
});
|
|
494
|
-
var Dialog = (0, import_core8.forwardRef)(
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
519
|
-
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
DialogHeader
|
|
523
|
-
DialogBody
|
|
524
|
-
DialogFooter
|
|
525
|
-
|
|
526
|
-
|
|
527
|
-
|
|
528
|
-
|
|
529
|
-
|
|
530
|
-
|
|
531
|
-
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
538
|
-
|
|
539
|
-
|
|
540
|
-
|
|
541
|
-
|
|
542
|
-
|
|
543
|
-
|
|
544
|
-
|
|
545
|
-
|
|
546
|
-
|
|
547
|
-
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
|
|
552
|
-
|
|
553
|
-
|
|
554
|
-
|
|
555
|
-
|
|
556
|
-
|
|
580
|
+
var Dialog = (0, import_core8.forwardRef)(
|
|
581
|
+
({ size, ...props }, ref) => {
|
|
582
|
+
const [styles, mergedProps] = (0, import_core8.useMultiComponentStyle)("Dialog", {
|
|
583
|
+
size,
|
|
584
|
+
...props
|
|
585
|
+
});
|
|
586
|
+
const {
|
|
587
|
+
className,
|
|
588
|
+
children,
|
|
589
|
+
withOverlay = true,
|
|
590
|
+
withCloseButton = true,
|
|
591
|
+
header,
|
|
592
|
+
footer,
|
|
593
|
+
cancel,
|
|
594
|
+
other,
|
|
595
|
+
success,
|
|
596
|
+
onClose,
|
|
597
|
+
onCancel,
|
|
598
|
+
onOther,
|
|
599
|
+
onSuccess,
|
|
600
|
+
...rest
|
|
601
|
+
} = (0, import_core8.omitThemeProps)(mergedProps);
|
|
602
|
+
const validChildren = (0, import_utils8.getValidChildren)(children);
|
|
603
|
+
const [customDialogOverlay] = (0, import_utils8.findChildren)(validChildren, DialogOverlay);
|
|
604
|
+
const [customDialogCloseButton] = (0, import_utils8.findChildren)(
|
|
605
|
+
validChildren,
|
|
606
|
+
DialogCloseButton
|
|
607
|
+
);
|
|
608
|
+
const [customDialogHeader] = (0, import_utils8.findChildren)(validChildren, DialogHeader);
|
|
609
|
+
const [customDialogBody] = (0, import_utils8.findChildren)(validChildren, DialogBody);
|
|
610
|
+
const [customDialogFooter] = (0, import_utils8.findChildren)(validChildren, DialogFooter);
|
|
611
|
+
const cloneChildren = !(0, import_utils8.isEmpty)(validChildren) ? (0, import_utils8.omitChildren)(
|
|
612
|
+
validChildren,
|
|
613
|
+
DialogOverlay,
|
|
614
|
+
DialogCloseButton,
|
|
615
|
+
DialogHeader,
|
|
616
|
+
DialogBody,
|
|
617
|
+
DialogFooter
|
|
618
|
+
) : children;
|
|
619
|
+
const css = { ...styles.container };
|
|
620
|
+
const cancelButtonProps = (0, import_utils8.isValidElement)(cancel) ? { children: cancel } : cancel;
|
|
621
|
+
const otherButtonProps = (0, import_utils8.isValidElement)(other) ? { children: other } : other;
|
|
622
|
+
const successButtonProps = (0, import_utils8.isValidElement)(success) ? { children: success } : success;
|
|
623
|
+
if (cancelButtonProps && !cancelButtonProps.variant)
|
|
624
|
+
cancelButtonProps.variant = "ghost";
|
|
625
|
+
if (otherButtonProps && !otherButtonProps.colorScheme)
|
|
626
|
+
otherButtonProps.colorScheme = "secondary";
|
|
627
|
+
if (successButtonProps && !successButtonProps.colorScheme)
|
|
628
|
+
successButtonProps.colorScheme = "primary";
|
|
629
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
630
|
+
Modal,
|
|
631
|
+
{
|
|
632
|
+
ref,
|
|
633
|
+
className: (0, import_utils8.cx)("ui-dialog", className),
|
|
634
|
+
__css: css,
|
|
635
|
+
...{
|
|
636
|
+
size,
|
|
637
|
+
onClose,
|
|
638
|
+
withOverlay: false,
|
|
639
|
+
withCloseButton: false,
|
|
640
|
+
...rest
|
|
641
|
+
},
|
|
642
|
+
children: [
|
|
643
|
+
customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogOverlay, {}) : null,
|
|
644
|
+
customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogCloseButton, {}) : null,
|
|
645
|
+
customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogHeader, { children: header }) : null,
|
|
646
|
+
customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogBody, { children: cloneChildren }) : null,
|
|
647
|
+
customDialogFooter != null ? customDialogFooter : footer || cancelButtonProps || otherButtonProps || successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogFooter, { children: footer != null ? footer : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
|
|
648
|
+
cancelButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
649
|
+
import_button.Button,
|
|
650
|
+
{
|
|
651
|
+
onClick: () => onCancel == null ? void 0 : onCancel(onClose),
|
|
652
|
+
...cancelButtonProps
|
|
653
|
+
}
|
|
654
|
+
) : null,
|
|
655
|
+
otherButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
656
|
+
import_button.Button,
|
|
657
|
+
{
|
|
658
|
+
onClick: () => onOther == null ? void 0 : onOther(onClose),
|
|
659
|
+
...otherButtonProps
|
|
660
|
+
}
|
|
661
|
+
) : null,
|
|
662
|
+
successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
663
|
+
import_button.Button,
|
|
664
|
+
{
|
|
665
|
+
onClick: () => onSuccess == null ? void 0 : onSuccess(onClose),
|
|
666
|
+
...successButtonProps
|
|
667
|
+
}
|
|
668
|
+
) : null
|
|
669
|
+
] }) }) : null
|
|
670
|
+
]
|
|
671
|
+
}
|
|
672
|
+
) });
|
|
673
|
+
}
|
|
674
|
+
);
|
|
557
675
|
var DialogOverlay = (0, import_core8.forwardRef)(
|
|
558
676
|
({ className, ...rest }, ref) => {
|
|
559
677
|
const styles = useDialog();
|
|
@@ -588,19 +706,45 @@ var DialogHeader = (0, import_core8.forwardRef)(
|
|
|
588
706
|
({ className, ...rest }, ref) => {
|
|
589
707
|
const styles = useDialog();
|
|
590
708
|
const css = { ...styles.header };
|
|
591
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
709
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
710
|
+
ModalHeader,
|
|
711
|
+
{
|
|
712
|
+
ref,
|
|
713
|
+
className: (0, import_utils8.cx)("ui-dialog-header", className),
|
|
714
|
+
__css: css,
|
|
715
|
+
...rest
|
|
716
|
+
}
|
|
717
|
+
);
|
|
718
|
+
}
|
|
719
|
+
);
|
|
720
|
+
var DialogBody = (0, import_core8.forwardRef)(
|
|
721
|
+
({ className, ...rest }, ref) => {
|
|
722
|
+
const styles = useDialog();
|
|
723
|
+
const css = { ...styles.body };
|
|
724
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
725
|
+
ModalBody,
|
|
726
|
+
{
|
|
727
|
+
ref,
|
|
728
|
+
className: (0, import_utils8.cx)("ui-dialog-body", className),
|
|
729
|
+
__css: css,
|
|
730
|
+
...rest
|
|
731
|
+
}
|
|
732
|
+
);
|
|
592
733
|
}
|
|
593
734
|
);
|
|
594
|
-
var DialogBody = (0, import_core8.forwardRef)(({ className, ...rest }, ref) => {
|
|
595
|
-
const styles = useDialog();
|
|
596
|
-
const css = { ...styles.body };
|
|
597
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalBody, { ref, className: (0, import_utils8.cx)("ui-dialog-body", className), __css: css, ...rest });
|
|
598
|
-
});
|
|
599
735
|
var DialogFooter = (0, import_core8.forwardRef)(
|
|
600
736
|
({ className, ...rest }, ref) => {
|
|
601
737
|
const styles = useDialog();
|
|
602
738
|
const css = { ...styles.footer };
|
|
603
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
739
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
740
|
+
ModalFooter,
|
|
741
|
+
{
|
|
742
|
+
ref,
|
|
743
|
+
className: (0, import_utils8.cx)("ui-dialog-footer", className),
|
|
744
|
+
__css: css,
|
|
745
|
+
...rest
|
|
746
|
+
}
|
|
747
|
+
);
|
|
604
748
|
}
|
|
605
749
|
);
|
|
606
750
|
// Annotate the CommonJS export names for ESM import in node:
|