@yamada-ui/modal 1.3.12-next-20241005220055 → 1.3.12-next-20241008193728
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/{chunk-KNCDANWW.mjs → chunk-37MTMX5B.mjs} +3 -3
- package/dist/{chunk-KNCDANWW.mjs.map → chunk-37MTMX5B.mjs.map} +1 -1
- package/dist/{chunk-SHVXETTC.mjs → chunk-6XAWCUQQ.mjs} +3 -3
- package/dist/{chunk-SHVXETTC.mjs.map → chunk-6XAWCUQQ.mjs.map} +1 -1
- package/dist/{chunk-3K5JY6KM.mjs → chunk-7EVREJIH.mjs} +19 -19
- package/dist/chunk-7EVREJIH.mjs.map +1 -0
- package/dist/{chunk-IIKFZB3M.mjs → chunk-7I5LX3VI.mjs} +43 -43
- package/dist/chunk-7I5LX3VI.mjs.map +1 -0
- package/dist/{chunk-3BTHYYAS.mjs → chunk-7THNENCM.mjs} +36 -32
- package/dist/chunk-7THNENCM.mjs.map +1 -0
- package/dist/{chunk-4J4ISPN7.mjs → chunk-A7WOQJCA.mjs} +1 -1
- package/dist/chunk-A7WOQJCA.mjs.map +1 -0
- package/dist/{chunk-2LLDUYTG.mjs → chunk-BNRFPNWF.mjs} +3 -3
- package/dist/{chunk-2LLDUYTG.mjs.map → chunk-BNRFPNWF.mjs.map} +1 -1
- package/dist/{chunk-HUI5FLPV.mjs → chunk-EDCPPJBS.mjs} +3 -3
- package/dist/{chunk-HUI5FLPV.mjs.map → chunk-EDCPPJBS.mjs.map} +1 -1
- package/dist/{chunk-XKKFTAXR.mjs → chunk-G7R3GU24.mjs} +3 -3
- package/dist/{chunk-XKKFTAXR.mjs.map → chunk-G7R3GU24.mjs.map} +1 -1
- package/dist/{chunk-LG73B7RP.mjs → chunk-L353QQ6S.mjs} +4 -4
- package/dist/{chunk-LG73B7RP.mjs.map → chunk-L353QQ6S.mjs.map} +1 -1
- package/dist/{chunk-BQAR3Q4F.mjs → chunk-LUSTM3GA.mjs} +3 -3
- package/dist/{chunk-SIKHBBVB.mjs → chunk-LYMMHCHF.mjs} +4 -4
- package/dist/{chunk-SIKHBBVB.mjs.map → chunk-LYMMHCHF.mjs.map} +1 -1
- package/dist/{chunk-K4MJNSAV.mjs → chunk-OAECULYV.mjs} +2 -2
- package/dist/{chunk-LK36SQZ5.mjs → chunk-P5SCGBP7.mjs} +19 -19
- package/dist/{chunk-LK36SQZ5.mjs.map → chunk-P5SCGBP7.mjs.map} +1 -1
- package/dist/{chunk-VSX32COP.mjs → chunk-PDW7A62B.mjs} +3 -3
- package/dist/{chunk-VSX32COP.mjs.map → chunk-PDW7A62B.mjs.map} +1 -1
- package/dist/{chunk-LD26U4D3.mjs → chunk-TXXRGDQR.mjs} +3 -3
- package/dist/{chunk-LD26U4D3.mjs.map → chunk-TXXRGDQR.mjs.map} +1 -1
- package/dist/{chunk-LTFXOP3I.mjs → chunk-VB44U6WY.mjs} +10 -10
- package/dist/{chunk-LTFXOP3I.mjs.map → chunk-VB44U6WY.mjs.map} +1 -1
- package/dist/{chunk-XFLVRTWU.mjs → chunk-VMTMWWII.mjs} +3 -3
- package/dist/{chunk-XFLVRTWU.mjs.map → chunk-VMTMWWII.mjs.map} +1 -1
- package/dist/{chunk-6NMJJILM.mjs → chunk-VNQHFTL2.mjs} +3 -3
- package/dist/{chunk-6NMJJILM.mjs.map → chunk-VNQHFTL2.mjs.map} +1 -1
- package/dist/{chunk-WK6DQSTW.mjs → chunk-W7WF42SC.mjs} +3 -3
- package/dist/{chunk-WK6DQSTW.mjs.map → chunk-W7WF42SC.mjs.map} +1 -1
- package/dist/{chunk-TLLVKBMP.mjs → chunk-ZDEVCYYC.mjs} +5 -5
- package/dist/{chunk-TLLVKBMP.mjs.map → chunk-ZDEVCYYC.mjs.map} +1 -1
- package/dist/{chunk-ZRQKYX2B.mjs → chunk-ZVXKXIPM.mjs} +40 -40
- package/dist/chunk-ZVXKXIPM.mjs.map +1 -0
- package/dist/dialog-body.js +2 -2
- package/dist/dialog-body.js.map +1 -1
- package/dist/dialog-body.mjs +3 -3
- package/dist/dialog-close-button.js +1 -1
- package/dist/dialog-close-button.js.map +1 -1
- package/dist/dialog-close-button.mjs +3 -3
- package/dist/dialog-footer.js +1 -1
- package/dist/dialog-footer.js.map +1 -1
- package/dist/dialog-footer.mjs +3 -3
- package/dist/dialog-header.js +1 -1
- package/dist/dialog-header.js.map +1 -1
- package/dist/dialog-header.mjs +3 -3
- package/dist/dialog-overlay.js +8 -8
- package/dist/dialog-overlay.js.map +1 -1
- package/dist/dialog-overlay.mjs +3 -3
- package/dist/dialog.d.mts +6 -6
- package/dist/dialog.d.ts +6 -6
- package/dist/dialog.js +97 -94
- package/dist/dialog.js.map +1 -1
- package/dist/dialog.mjs +18 -18
- package/dist/drawer-body.js +2 -2
- package/dist/drawer-body.js.map +1 -1
- package/dist/drawer-body.mjs +3 -3
- package/dist/drawer-close-button.js +1 -1
- package/dist/drawer-close-button.js.map +1 -1
- package/dist/drawer-close-button.mjs +3 -3
- package/dist/drawer-content.d.mts +1 -1
- package/dist/drawer-content.d.ts +1 -1
- package/dist/drawer-content.js +15 -15
- package/dist/drawer-content.js.map +1 -1
- package/dist/drawer-content.mjs +5 -5
- package/dist/drawer-drag-bar.js.map +1 -1
- package/dist/drawer-drag-bar.mjs +2 -2
- package/dist/drawer-footer.js +1 -1
- package/dist/drawer-footer.js.map +1 -1
- package/dist/drawer-footer.mjs +3 -3
- package/dist/drawer-header.js +1 -1
- package/dist/drawer-header.js.map +1 -1
- package/dist/drawer-header.mjs +3 -3
- package/dist/drawer-overlay.js +8 -8
- package/dist/drawer-overlay.js.map +1 -1
- package/dist/drawer-overlay.mjs +3 -3
- package/dist/drawer.d.mts +17 -17
- package/dist/drawer.d.ts +17 -17
- package/dist/drawer.js +104 -104
- package/dist/drawer.js.map +1 -1
- package/dist/drawer.mjs +12 -12
- package/dist/index.d.mts +16 -16
- package/dist/index.d.ts +16 -16
- package/dist/index.js +428 -419
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +22 -22
- package/dist/modal-body.js +2 -2
- package/dist/modal-body.js.map +1 -1
- package/dist/modal-body.mjs +2 -2
- package/dist/modal-close-button.js +1 -1
- package/dist/modal-close-button.js.map +1 -1
- package/dist/modal-close-button.mjs +2 -2
- package/dist/modal-content.d.mts +1 -1
- package/dist/modal-content.d.ts +1 -1
- package/dist/modal-content.js +15 -15
- package/dist/modal-content.js.map +1 -1
- package/dist/modal-content.mjs +4 -4
- package/dist/modal-context.d.mts +3 -3
- package/dist/modal-context.d.ts +3 -3
- package/dist/modal-context.js.map +1 -1
- package/dist/modal-context.mjs +1 -1
- package/dist/modal-footer.js +1 -1
- package/dist/modal-footer.js.map +1 -1
- package/dist/modal-footer.mjs +2 -2
- package/dist/modal-header.js +1 -1
- package/dist/modal-header.js.map +1 -1
- package/dist/modal-header.mjs +2 -2
- package/dist/modal-overlay.js +8 -8
- package/dist/modal-overlay.js.map +1 -1
- package/dist/modal-overlay.mjs +2 -2
- package/dist/modal.d.mts +46 -46
- package/dist/modal.d.ts +46 -46
- package/dist/modal.js +71 -71
- package/dist/modal.js.map +1 -1
- package/dist/modal.mjs +11 -11
- package/package.json +10 -10
- package/dist/chunk-3BTHYYAS.mjs.map +0 -1
- package/dist/chunk-3K5JY6KM.mjs.map +0 -1
- package/dist/chunk-4J4ISPN7.mjs.map +0 -1
- package/dist/chunk-IIKFZB3M.mjs.map +0 -1
- package/dist/chunk-ZRQKYX2B.mjs.map +0 -1
- /package/dist/{chunk-BQAR3Q4F.mjs.map → chunk-LUSTM3GA.mjs.map} +0 -0
- /package/dist/{chunk-K4MJNSAV.mjs.map → chunk-OAECULYV.mjs.map} +0 -0
package/dist/dialog.js
CHANGED
@@ -56,11 +56,11 @@ var [DrawerProvider, useDrawer] = (0, import_utils.createContext)({
|
|
56
56
|
var import_jsx_runtime = require("react/jsx-runtime");
|
57
57
|
var ModalBody = (0, import_core.forwardRef)(
|
58
58
|
({ className, __css, ...rest }, ref) => {
|
59
|
-
const {
|
59
|
+
const { scrollBehavior, styles } = useModal();
|
60
60
|
const css = {
|
61
|
+
alignItems: "flex-start",
|
61
62
|
display: "flex",
|
62
63
|
flexDirection: "column",
|
63
|
-
alignItems: "flex-start",
|
64
64
|
overflow: scrollBehavior === "inside" ? "auto" : void 0,
|
65
65
|
...__css ? __css : styles.body
|
66
66
|
};
|
@@ -119,11 +119,11 @@ var ModalCloseButton = (0, import_core3.forwardRef)(
|
|
119
119
|
{
|
120
120
|
ref,
|
121
121
|
className: (0, import_utils4.cx)("ui-modal__close-button"),
|
122
|
-
__css: css,
|
123
122
|
onClick: (0, import_utils4.handlerAll)(onClick, (ev) => {
|
124
123
|
ev.stopPropagation();
|
125
124
|
onClose == null ? void 0 : onClose();
|
126
125
|
}),
|
126
|
+
__css: css,
|
127
127
|
...rest
|
128
128
|
}
|
129
129
|
);
|
@@ -164,8 +164,8 @@ var ModalFooter = (0, import_core5.forwardRef)(
|
|
164
164
|
({ className, __css, ...rest }, ref) => {
|
165
165
|
const { styles } = useModal();
|
166
166
|
const css = {
|
167
|
-
display: "flex",
|
168
167
|
alignItems: "center",
|
168
|
+
display: "flex",
|
169
169
|
justifyContent: "flex-end",
|
170
170
|
...__css ? __css : styles.footer
|
171
171
|
};
|
@@ -215,8 +215,8 @@ var ModalHeader = (0, import_core7.forwardRef)(
|
|
215
215
|
({ className, __css, ...rest }, ref) => {
|
216
216
|
const { styles } = useModal();
|
217
217
|
const css = {
|
218
|
-
display: "flex",
|
219
218
|
alignItems: "center",
|
219
|
+
display: "flex",
|
220
220
|
justifyContent: "flex-start",
|
221
221
|
...__css ? __css : styles.header
|
222
222
|
};
|
@@ -264,21 +264,21 @@ var import_transitions = require("@yamada-ui/transitions");
|
|
264
264
|
var import_utils10 = require("@yamada-ui/utils");
|
265
265
|
var import_jsx_runtime9 = require("react/jsx-runtime");
|
266
266
|
var ModalOverlay = (0, import_motion.motionForwardRef)(
|
267
|
-
({ className,
|
267
|
+
({ className, onClick, __css, ...rest }, ref) => {
|
268
268
|
const {
|
269
|
-
|
269
|
+
animation,
|
270
270
|
closeOnOverlay,
|
271
|
-
|
271
|
+
duration,
|
272
|
+
styles,
|
272
273
|
onClose,
|
273
|
-
|
274
|
-
duration
|
274
|
+
onOverlayClick
|
275
275
|
} = useModal();
|
276
276
|
const css = {
|
277
|
+
h: "100dvh",
|
278
|
+
left: 0,
|
277
279
|
position: "fixed",
|
278
280
|
top: 0,
|
279
|
-
left: 0,
|
280
281
|
w: "100vw",
|
281
|
-
h: "100dvh",
|
282
282
|
...__css ? __css : styles.overlay
|
283
283
|
};
|
284
284
|
const props = animation !== "none" ? import_transitions.fadeProps : {};
|
@@ -288,11 +288,11 @@ var ModalOverlay = (0, import_motion.motionForwardRef)(
|
|
288
288
|
ref,
|
289
289
|
className: (0, import_utils10.cx)("ui-modal__overlay", className),
|
290
290
|
custom: { duration },
|
291
|
-
__css: css,
|
292
291
|
onClick: (0, import_utils10.handlerAll)(onClick, onOverlayClick, (ev) => {
|
293
292
|
ev.stopPropagation();
|
294
293
|
if (closeOnOverlay) onClose == null ? void 0 : onClose();
|
295
294
|
}),
|
295
|
+
__css: css,
|
296
296
|
...props,
|
297
297
|
...rest
|
298
298
|
}
|
@@ -390,18 +390,18 @@ var DrawerContent = (0, import_motion3.motionForwardRef)(
|
|
390
390
|
({
|
391
391
|
className,
|
392
392
|
children,
|
393
|
-
placement: _placement,
|
394
|
-
withCloseButton,
|
395
|
-
withDragBar,
|
396
393
|
closeOnDrag,
|
397
394
|
dragConstraints,
|
398
395
|
dragElastic,
|
399
396
|
dragOffset,
|
400
397
|
dragVelocity,
|
398
|
+
placement: _placement,
|
399
|
+
withCloseButton,
|
400
|
+
withDragBar,
|
401
401
|
blankForDragProps,
|
402
402
|
...rest
|
403
403
|
}, ref) => {
|
404
|
-
const { isOpen, onClose
|
404
|
+
const { duration, isOpen, onClose } = useModal();
|
405
405
|
const styles = useDrawer();
|
406
406
|
const placement = (0, import_use_value.useValue)(_placement);
|
407
407
|
const validChildren = (0, import_utils14.getValidChildren)(children);
|
@@ -420,27 +420,27 @@ var DrawerContent = (0, import_motion3.motionForwardRef)(
|
|
420
420
|
let position = {};
|
421
421
|
switch (placement) {
|
422
422
|
case "top":
|
423
|
-
position = { top: "calc(-100dvh + 1px)"
|
423
|
+
position = { left: 0, right: 0, top: "calc(-100dvh + 1px)" };
|
424
424
|
break;
|
425
425
|
case "bottom":
|
426
426
|
position = { bottom: "calc(-100dvh + 1px)", left: 0, right: 0 };
|
427
427
|
break;
|
428
428
|
case "left":
|
429
|
-
position = { left: "calc(-100% + 1px)", top: 0
|
429
|
+
position = { bottom: 0, left: "calc(-100% + 1px)", top: 0 };
|
430
430
|
break;
|
431
431
|
case "right":
|
432
|
-
position = { right: "calc(-100% + 1px)", top: 0
|
432
|
+
position = { bottom: 0, right: "calc(-100% + 1px)", top: 0 };
|
433
433
|
break;
|
434
434
|
}
|
435
435
|
const [lightBg, darkBg] = blankForDragBg;
|
436
436
|
return {
|
437
437
|
_after: {
|
438
|
+
bg: lightBg,
|
438
439
|
content: '""',
|
439
440
|
display: "block",
|
440
|
-
w: "100%",
|
441
441
|
h: "100dvh",
|
442
|
-
bg: lightBg,
|
443
442
|
position: "absolute",
|
443
|
+
w: "100%",
|
444
444
|
...position,
|
445
445
|
...blankForDragProps
|
446
446
|
},
|
@@ -506,18 +506,18 @@ var DrawerContent = (0, import_motion3.motionForwardRef)(
|
|
506
506
|
{
|
507
507
|
ref,
|
508
508
|
className: (0, import_utils14.cx)("ui-drawer", className),
|
509
|
-
isOpen,
|
510
|
-
placement,
|
511
|
-
duration,
|
512
509
|
drag: closeOnDrag ? getDragDirection() : false,
|
513
510
|
dragConstraints: getDragDirectionRestriction(dragConstraints),
|
514
511
|
dragElastic: getDragDirectionRestriction(dragElastic),
|
515
|
-
dragSnapToOrigin: true,
|
516
512
|
dragMomentum: false,
|
513
|
+
dragSnapToOrigin: true,
|
514
|
+
duration,
|
515
|
+
isOpen,
|
516
|
+
placement,
|
517
|
+
tabIndex: -1,
|
517
518
|
onDragEnd: (_, info) => {
|
518
519
|
if (isCloseByDragInfo(info)) onClose == null ? void 0 : onClose();
|
519
520
|
},
|
520
|
-
tabIndex: -1,
|
521
521
|
__css: css,
|
522
522
|
...rest,
|
523
523
|
children: [
|
@@ -577,39 +577,39 @@ var getModalContentProps = (animation = "scale", duration) => {
|
|
577
577
|
case "scale":
|
578
578
|
return {
|
579
579
|
...import_transitions3.scaleFadeProps,
|
580
|
-
custom: {
|
580
|
+
custom: { duration, reverse: true, scale: 0.95 }
|
581
581
|
};
|
582
582
|
case "top":
|
583
583
|
return {
|
584
584
|
...import_transitions3.slideFadeProps,
|
585
|
-
custom: { offsetY: -16, reverse: true
|
585
|
+
custom: { duration, offsetY: -16, reverse: true }
|
586
586
|
};
|
587
587
|
case "right":
|
588
588
|
return {
|
589
589
|
...import_transitions3.slideFadeProps,
|
590
|
-
custom: { offsetX: 16, reverse: true
|
590
|
+
custom: { duration, offsetX: 16, reverse: true }
|
591
591
|
};
|
592
592
|
case "left":
|
593
593
|
return {
|
594
594
|
...import_transitions3.slideFadeProps,
|
595
|
-
custom: { offsetX: -16, reverse: true
|
595
|
+
custom: { duration, offsetX: -16, reverse: true }
|
596
596
|
};
|
597
597
|
case "bottom":
|
598
598
|
return {
|
599
599
|
...import_transitions3.slideFadeProps,
|
600
|
-
custom: { offsetY: 16, reverse: true
|
600
|
+
custom: { duration, offsetY: 16, reverse: true }
|
601
601
|
};
|
602
602
|
}
|
603
603
|
};
|
604
604
|
var ModalContent = (0, import_motion5.motionForwardRef)(
|
605
605
|
({ className, children, __css, ...rest }, ref) => {
|
606
606
|
const {
|
607
|
-
|
607
|
+
animation,
|
608
|
+
duration,
|
608
609
|
scrollBehavior,
|
610
|
+
styles,
|
609
611
|
withCloseButton,
|
610
|
-
onClose
|
611
|
-
animation,
|
612
|
-
duration
|
612
|
+
onClose
|
613
613
|
} = useModal();
|
614
614
|
const validChildren = (0, import_utils16.getValidChildren)(children);
|
615
615
|
const [customModalCloseButton, ...cloneChildren] = (0, import_utils16.findChildren)(
|
@@ -619,21 +619,21 @@ var ModalContent = (0, import_motion5.motionForwardRef)(
|
|
619
619
|
);
|
620
620
|
const props = animation !== "none" ? getModalContentProps(animation, duration) : {};
|
621
621
|
const css = {
|
622
|
-
position: "relative",
|
623
|
-
maxH: "100%",
|
624
622
|
display: "flex",
|
625
623
|
flexDirection: "column",
|
626
|
-
|
624
|
+
maxH: "100%",
|
627
625
|
outline: 0,
|
626
|
+
overflow: scrollBehavior === "inside" ? "hidden" : "auto",
|
627
|
+
position: "relative",
|
628
628
|
...__css ? __css : styles.container
|
629
629
|
};
|
630
630
|
return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(
|
631
631
|
import_motion5.motion.section,
|
632
632
|
{
|
633
|
-
role: "dialog",
|
634
|
-
"aria-modal": "true",
|
635
633
|
ref,
|
636
634
|
className: (0, import_utils16.cx)("ui-modal", className),
|
635
|
+
"aria-modal": "true",
|
636
|
+
role: "dialog",
|
637
637
|
tabIndex: -1,
|
638
638
|
__css: css,
|
639
639
|
...props,
|
@@ -659,30 +659,30 @@ var Modal = (0, import_motion6.motionForwardRef)(
|
|
659
659
|
});
|
660
660
|
const {
|
661
661
|
className,
|
662
|
-
children,
|
663
|
-
isOpen,
|
664
|
-
onClose,
|
665
|
-
onOverlayClick,
|
666
|
-
onEsc,
|
667
|
-
onCloseComplete,
|
668
|
-
placement: _placement = "center",
|
669
|
-
outside = "fallback(4, 1rem)",
|
670
|
-
withCloseButton = true,
|
671
|
-
withOverlay = true,
|
672
662
|
allowPinchZoom = false,
|
673
|
-
|
663
|
+
animation = "scale",
|
674
664
|
autoFocus,
|
675
|
-
restoreFocus,
|
676
|
-
initialFocusRef,
|
677
|
-
finalFocusRef,
|
678
665
|
blockScrollOnMount = true,
|
679
|
-
|
666
|
+
children,
|
680
667
|
closeOnEsc = true,
|
681
|
-
|
682
|
-
animation = "scale",
|
668
|
+
closeOnOverlay = true,
|
683
669
|
duration,
|
684
|
-
|
670
|
+
finalFocusRef,
|
671
|
+
initialFocusRef,
|
672
|
+
isOpen,
|
673
|
+
lockFocusAcrossFrames = true,
|
674
|
+
outside = "fallback(4, 1rem)",
|
675
|
+
placement: _placement = "center",
|
676
|
+
restoreFocus,
|
677
|
+
scrollBehavior = "inside",
|
678
|
+
withCloseButton = true,
|
679
|
+
withOverlay = true,
|
685
680
|
containerProps,
|
681
|
+
portalProps,
|
682
|
+
onClose,
|
683
|
+
onCloseComplete,
|
684
|
+
onEsc,
|
685
|
+
onOverlayClick,
|
686
686
|
...rest
|
687
687
|
} = (0, import_core12.omitThemeProps)(mergedProps);
|
688
688
|
const onKeyDown = (0, import_react2.useCallback)(
|
@@ -706,39 +706,39 @@ var Modal = (0, import_motion6.motionForwardRef)(
|
|
706
706
|
drawerContent = (0, import_react2.cloneElement)(drawerContent, { onKeyDown });
|
707
707
|
const placement = (0, import_use_value2.useValue)(_placement);
|
708
708
|
const css = {
|
709
|
+
alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center",
|
710
|
+
display: "flex",
|
711
|
+
h: "100dvh",
|
712
|
+
justifyContent: placement.includes("left") ? "flex-start" : placement.includes("right") ? "flex-end" : "center",
|
713
|
+
left: 0,
|
714
|
+
p: size !== "full" ? outside : void 0,
|
709
715
|
position: "fixed",
|
710
716
|
top: 0,
|
711
|
-
left: 0,
|
712
|
-
zIndex: "fallback(jeice, 110)",
|
713
717
|
w: "100vw",
|
714
|
-
|
715
|
-
p: size !== "full" ? outside : void 0,
|
716
|
-
display: "flex",
|
717
|
-
justifyContent: placement.includes("left") ? "flex-start" : placement.includes("right") ? "flex-end" : "center",
|
718
|
-
alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
|
718
|
+
zIndex: "fallback(jeice, 110)"
|
719
719
|
};
|
720
720
|
return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
721
721
|
ModalProvider,
|
722
722
|
{
|
723
723
|
value: {
|
724
|
-
isOpen,
|
725
|
-
onClose,
|
726
|
-
onOverlayClick,
|
727
|
-
withCloseButton,
|
728
|
-
scrollBehavior,
|
729
|
-
closeOnOverlay,
|
730
724
|
animation,
|
725
|
+
closeOnOverlay,
|
731
726
|
duration,
|
732
|
-
|
727
|
+
isOpen,
|
728
|
+
scrollBehavior,
|
729
|
+
styles,
|
730
|
+
withCloseButton,
|
731
|
+
onClose,
|
732
|
+
onOverlayClick
|
733
733
|
},
|
734
734
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_motion6.AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
735
735
|
import_focus_lock.FocusLock,
|
736
736
|
{
|
737
737
|
autoFocus,
|
738
|
-
initialFocusRef,
|
739
738
|
finalFocusRef,
|
740
|
-
|
739
|
+
initialFocusRef,
|
741
740
|
lockFocusAcrossFrames,
|
741
|
+
restoreFocus,
|
742
742
|
children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
|
743
743
|
import_react_remove_scroll.RemoveScroll,
|
744
744
|
{
|
@@ -777,19 +777,19 @@ var Dialog = (0, import_motion7.motionForwardRef)(
|
|
777
777
|
});
|
778
778
|
const {
|
779
779
|
className,
|
780
|
+
cancel,
|
780
781
|
children,
|
781
|
-
withOverlay = true,
|
782
|
-
withCloseButton = true,
|
783
|
-
header,
|
784
782
|
footer,
|
785
|
-
|
783
|
+
header,
|
786
784
|
other,
|
787
785
|
success,
|
788
|
-
|
786
|
+
withCloseButton = true,
|
787
|
+
withOverlay = true,
|
788
|
+
containerProps,
|
789
789
|
onCancel,
|
790
|
+
onClose,
|
790
791
|
onOther,
|
791
792
|
onSuccess,
|
792
|
-
containerProps,
|
793
793
|
...rest
|
794
794
|
} = (0, import_core13.omitThemeProps)(mergedProps);
|
795
795
|
const validChildren = (0, import_utils18.getValidChildren)(children);
|
@@ -807,15 +807,18 @@ var Dialog = (0, import_motion7.motionForwardRef)(
|
|
807
807
|
DialogFooter
|
808
808
|
) : children;
|
809
809
|
const css = { ...styles.container };
|
810
|
-
const cancelButtonProps = (0, import_utils18.isValidElement)(cancel) ? { children: cancel } : cancel;
|
811
|
-
const otherButtonProps = (0, import_utils18.isValidElement)(other) ? { children: other } : other;
|
812
|
-
const successButtonProps = (0, import_utils18.isValidElement)(success) ? { children: success } : success;
|
813
|
-
if (cancelButtonProps
|
814
|
-
|
815
|
-
if (otherButtonProps && !otherButtonProps.colorScheme)
|
810
|
+
const cancelButtonProps = (0, import_utils18.isValidElement)(cancel) || (0, import_utils18.isUndefined)(cancel) ? { children: cancel } : cancel;
|
811
|
+
const otherButtonProps = (0, import_utils18.isValidElement)(other) || (0, import_utils18.isUndefined)(other) ? { children: other } : other;
|
812
|
+
const successButtonProps = (0, import_utils18.isValidElement)(success) || (0, import_utils18.isUndefined)(success) ? { children: success } : success;
|
813
|
+
if (!cancelButtonProps.variant) cancelButtonProps.variant = "ghost";
|
814
|
+
if (!otherButtonProps.colorScheme)
|
816
815
|
otherButtonProps.colorScheme = "secondary";
|
817
|
-
if (
|
816
|
+
if (!successButtonProps.colorScheme)
|
818
817
|
successButtonProps.colorScheme = "primary";
|
818
|
+
const hasCancelButton = !!cancelButtonProps.children;
|
819
|
+
const hasOtherButton = !!otherButtonProps.children;
|
820
|
+
const hasSuccessButton = !!successButtonProps.children;
|
821
|
+
const hasFooter = hasCancelButton || hasOtherButton || hasSuccessButton;
|
819
822
|
return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
|
820
823
|
Modal,
|
821
824
|
{
|
@@ -823,10 +826,10 @@ var Dialog = (0, import_motion7.motionForwardRef)(
|
|
823
826
|
className: (0, import_utils18.cx)("ui-dialog", className),
|
824
827
|
__css: css,
|
825
828
|
...{
|
826
|
-
onClose,
|
827
|
-
withOverlay: false,
|
828
829
|
withCloseButton: false,
|
830
|
+
withOverlay: false,
|
829
831
|
containerProps,
|
832
|
+
onClose,
|
830
833
|
...rest,
|
831
834
|
size
|
832
835
|
},
|
@@ -835,22 +838,22 @@ var Dialog = (0, import_motion7.motionForwardRef)(
|
|
835
838
|
customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogCloseButton, {}) : null,
|
836
839
|
customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogHeader, { children: header }) : null,
|
837
840
|
customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogBody, { children: cloneChildren }) : null,
|
838
|
-
customDialogFooter != null ? customDialogFooter : footer ||
|
839
|
-
|
841
|
+
customDialogFooter != null ? customDialogFooter : footer || hasFooter ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogFooter, { children: footer != null ? footer : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
|
842
|
+
hasCancelButton ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
840
843
|
import_button.Button,
|
841
844
|
{
|
842
845
|
onClick: () => onCancel == null ? void 0 : onCancel(onClose),
|
843
846
|
...cancelButtonProps
|
844
847
|
}
|
845
848
|
) : null,
|
846
|
-
|
849
|
+
hasOtherButton ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
847
850
|
import_button.Button,
|
848
851
|
{
|
849
852
|
onClick: () => onOther == null ? void 0 : onOther(onClose),
|
850
853
|
...otherButtonProps
|
851
854
|
}
|
852
855
|
) : null,
|
853
|
-
|
856
|
+
hasSuccessButton ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
|
854
857
|
import_button.Button,
|
855
858
|
{
|
856
859
|
onClick: () => onSuccess == null ? void 0 : onSuccess(onClose),
|