@yamada-ui/modal 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/dialog.js ADDED
@@ -0,0 +1,611 @@
1
+ "use strict";
2
+ var __defProp = Object.defineProperty;
3
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
4
+ var __getOwnPropNames = Object.getOwnPropertyNames;
5
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
6
+ var __export = (target, all) => {
7
+ for (var name in all)
8
+ __defProp(target, name, { get: all[name], enumerable: true });
9
+ };
10
+ var __copyProps = (to, from, except, desc) => {
11
+ if (from && typeof from === "object" || typeof from === "function") {
12
+ for (let key of __getOwnPropNames(from))
13
+ if (!__hasOwnProp.call(to, key) && key !== except)
14
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
15
+ }
16
+ return to;
17
+ };
18
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
19
+
20
+ // src/dialog.tsx
21
+ var dialog_exports = {};
22
+ __export(dialog_exports, {
23
+ Dialog: () => Dialog,
24
+ DialogBody: () => DialogBody,
25
+ DialogCloseButton: () => DialogCloseButton,
26
+ DialogFooter: () => DialogFooter,
27
+ DialogHeader: () => DialogHeader,
28
+ DialogOverlay: () => DialogOverlay
29
+ });
30
+ module.exports = __toCommonJS(dialog_exports);
31
+ var import_button = require("@yamada-ui/button");
32
+ var import_core8 = require("@yamada-ui/core");
33
+ var import_utils8 = require("@yamada-ui/utils");
34
+
35
+ // src/modal.tsx
36
+ var import_core = require("@yamada-ui/core");
37
+ var import_focus_lock = require("@yamada-ui/focus-lock");
38
+ var import_motion = require("@yamada-ui/motion");
39
+ var import_portal = require("@yamada-ui/portal");
40
+ var import_transitions = require("@yamada-ui/transitions");
41
+ var import_use_value = require("@yamada-ui/use-value");
42
+ var import_utils = require("@yamada-ui/utils");
43
+ var import_react = require("react");
44
+ var import_react_remove_scroll = require("react-remove-scroll");
45
+ var import_jsx_runtime = require("react/jsx-runtime");
46
+ var [ModalProvider, useModal] = (0, import_utils.createContext)({
47
+ name: `ModalContext`,
48
+ errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
49
+ });
50
+ var Modal = (0, import_core.forwardRef)(({ size, ...props }, ref) => {
51
+ const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Modal", { size, ...props });
52
+ const {
53
+ className,
54
+ children,
55
+ isOpen,
56
+ onClose,
57
+ onOverlayClick,
58
+ onEsc,
59
+ onCloseComplete,
60
+ placement: _placement = "center",
61
+ outside = "md",
62
+ withCloseButton = true,
63
+ withOverlay = true,
64
+ allowPinchZoom = false,
65
+ scrollBehavior = "inside",
66
+ autoFocus,
67
+ restoreFocus,
68
+ initialFocusRef,
69
+ finalFocusRef,
70
+ blockScrollOnMount = true,
71
+ closeOnOverlay = true,
72
+ closeOnEsc = true,
73
+ lockFocusAcrossFrames = true,
74
+ animation = "scale",
75
+ duration,
76
+ ...rest
77
+ } = (0, import_core.omitThemeProps)(mergedProps);
78
+ const onKeyDown = (0, import_react.useCallback)(
79
+ (event) => {
80
+ if (event.key !== "Escape")
81
+ return;
82
+ event.stopPropagation();
83
+ if (closeOnEsc)
84
+ onClose == null ? void 0 : onClose();
85
+ onEsc == null ? void 0 : onEsc();
86
+ },
87
+ [closeOnEsc, onClose, onEsc]
88
+ );
89
+ const validChildren = (0, import_utils.getValidChildren)(children);
90
+ const [customModalOverlay, ...cloneChildren] = (0, import_utils.findChildren)(
91
+ validChildren,
92
+ ModalOverlay,
93
+ DialogOverlay,
94
+ DrawerOverlay
95
+ );
96
+ let [drawerContent] = (0, import_utils.findChildren)(validChildren, DrawerContent);
97
+ if (drawerContent)
98
+ drawerContent = (0, import_react.cloneElement)(drawerContent, { onKeyDown });
99
+ const placement = (0, import_use_value.useValue)(_placement);
100
+ const css = {
101
+ position: "fixed",
102
+ top: 0,
103
+ left: 0,
104
+ w: "100vw",
105
+ h: "100vh",
106
+ p: size !== "full" ? outside : void 0,
107
+ display: "flex",
108
+ justifyContent: placement.includes("right") ? "flex-start" : placement.includes("left") ? "flex-end" : "center",
109
+ alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
110
+ };
111
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
112
+ ModalProvider,
113
+ {
114
+ value: {
115
+ isOpen,
116
+ onClose,
117
+ onOverlayClick,
118
+ withCloseButton,
119
+ scrollBehavior,
120
+ closeOnOverlay,
121
+ animation,
122
+ duration,
123
+ styles
124
+ },
125
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_motion.AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_portal.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
126
+ import_focus_lock.FocusLock,
127
+ {
128
+ autoFocus,
129
+ initialFocusRef,
130
+ finalFocusRef,
131
+ restoreFocus,
132
+ lockFocusAcrossFrames,
133
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
134
+ import_react_remove_scroll.RemoveScroll,
135
+ {
136
+ allowPinchZoom,
137
+ enabled: blockScrollOnMount,
138
+ forwardProps: true,
139
+ children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(import_core.ui.div, { __css: css, children: [
140
+ customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalOverlay, {}) : null,
141
+ drawerContent != null ? drawerContent : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalContent, { ref, className, onKeyDown, ...rest, children: cloneChildren })
142
+ ] })
143
+ }
144
+ )
145
+ }
146
+ ) }) : null })
147
+ }
148
+ );
149
+ });
150
+ var getModalContentProps = (animation = "scale", duration) => {
151
+ switch (animation) {
152
+ case "scale":
153
+ return {
154
+ ...import_transitions.scaleFadeProps,
155
+ custom: { scale: 0.95, reverse: true, duration }
156
+ };
157
+ case "top":
158
+ return {
159
+ ...import_transitions.slideFadeProps,
160
+ custom: { offsetY: -16, reverse: true, duration }
161
+ };
162
+ case "right":
163
+ return {
164
+ ...import_transitions.slideFadeProps,
165
+ custom: { offsetX: 16, reverse: true, duration }
166
+ };
167
+ case "left":
168
+ return {
169
+ ...import_transitions.slideFadeProps,
170
+ custom: { offsetX: -16, reverse: true, duration }
171
+ };
172
+ case "bottom":
173
+ return {
174
+ ...import_transitions.slideFadeProps,
175
+ custom: { offsetY: 16, reverse: true, duration }
176
+ };
177
+ }
178
+ };
179
+ var ModalContent = (0, import_core.forwardRef)(
180
+ ({ className, children, __css, ...rest }, ref) => {
181
+ const { styles, scrollBehavior, withCloseButton, onClose, animation, duration } = useModal();
182
+ const validChildren = (0, import_utils.getValidChildren)(children);
183
+ const [customModalCloseButton, ...cloneChildren] = (0, import_utils.findChildren)(
184
+ validChildren,
185
+ ModalCloseButton,
186
+ DialogCloseButton
187
+ );
188
+ const props = animation !== "none" ? getModalContentProps(animation, duration) : {};
189
+ const css = {
190
+ position: "relative",
191
+ maxH: "100%",
192
+ display: "flex",
193
+ flexDirection: "column",
194
+ overflow: scrollBehavior === "inside" ? "hidden" : "auto",
195
+ outline: 0,
196
+ ...__css ? __css : styles.container
197
+ };
198
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
199
+ import_core.ui.section,
200
+ {
201
+ as: import_motion.motion.section,
202
+ ref,
203
+ className: (0, import_utils.cx)("ui-modal", className),
204
+ tabIndex: -1,
205
+ __css: css,
206
+ ...props,
207
+ ...rest,
208
+ children: [
209
+ customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(ModalCloseButton, {}) : null,
210
+ cloneChildren
211
+ ]
212
+ }
213
+ );
214
+ }
215
+ );
216
+
217
+ // src/modal-overlay.tsx
218
+ var import_core2 = require("@yamada-ui/core");
219
+ var import_motion2 = require("@yamada-ui/motion");
220
+ var import_transitions2 = require("@yamada-ui/transitions");
221
+ var import_utils2 = require("@yamada-ui/utils");
222
+ var import_jsx_runtime2 = require("react/jsx-runtime");
223
+ var ModalOverlay = (0, import_core2.forwardRef)(
224
+ ({ className, __css, onClick, ...rest }, ref) => {
225
+ const { styles, closeOnOverlay, onOverlayClick, onClose, animation, duration } = useModal();
226
+ const css = {
227
+ position: "fixed",
228
+ top: 0,
229
+ left: 0,
230
+ w: "100vw",
231
+ h: "100vh",
232
+ ...__css ? __css : styles.overlay
233
+ };
234
+ const props = animation !== "none" ? import_transitions2.fadeProps : {};
235
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
236
+ import_core2.ui.div,
237
+ {
238
+ as: import_motion2.motion.div,
239
+ ref,
240
+ className: (0, import_utils2.cx)("ui-modal-overlay", className),
241
+ custom: { duration },
242
+ __css: css,
243
+ onClick: (0, import_utils2.handlerAll)(onClick, onOverlayClick, (event) => {
244
+ event.stopPropagation();
245
+ if (closeOnOverlay)
246
+ onClose == null ? void 0 : onClose();
247
+ }),
248
+ ...props,
249
+ ...rest
250
+ }
251
+ );
252
+ }
253
+ );
254
+
255
+ // src/modal-close-button.tsx
256
+ var import_close_button = require("@yamada-ui/close-button");
257
+ var import_core3 = require("@yamada-ui/core");
258
+ var import_utils3 = require("@yamada-ui/utils");
259
+ var import_jsx_runtime3 = require("react/jsx-runtime");
260
+ var ModalCloseButton = (0, import_core3.forwardRef)(
261
+ ({ onClick, __css, ...rest }, ref) => {
262
+ const { styles, onClose } = useModal();
263
+ const css = {
264
+ position: "absolute",
265
+ ...__css ? __css : styles.closeButton
266
+ };
267
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
268
+ import_close_button.CloseButton,
269
+ {
270
+ ref,
271
+ className: (0, import_utils3.cx)("ui-modal-close-button"),
272
+ __css: css,
273
+ onClick: (0, import_utils3.handlerAll)(onClick, (event) => {
274
+ event.stopPropagation();
275
+ onClose == null ? void 0 : onClose();
276
+ }),
277
+ ...rest
278
+ }
279
+ );
280
+ }
281
+ );
282
+
283
+ // src/modal-header.tsx
284
+ var import_core4 = require("@yamada-ui/core");
285
+ var import_utils4 = require("@yamada-ui/utils");
286
+ var import_jsx_runtime4 = require("react/jsx-runtime");
287
+ var ModalHeader = (0, import_core4.forwardRef)(
288
+ ({ className, __css, ...rest }, ref) => {
289
+ const { styles } = useModal();
290
+ const css = {
291
+ display: "flex",
292
+ alignItems: "center",
293
+ justifyContent: "flex-start",
294
+ ...__css ? __css : styles.header
295
+ };
296
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.ui.header, { ref, className: (0, import_utils4.cx)("ui-modal-header", className), __css: css, ...rest });
297
+ }
298
+ );
299
+
300
+ // src/modal-body.tsx
301
+ var import_core5 = require("@yamada-ui/core");
302
+ var import_utils5 = require("@yamada-ui/utils");
303
+ var import_jsx_runtime5 = require("react/jsx-runtime");
304
+ var ModalBody = (0, import_core5.forwardRef)(
305
+ ({ className, __css, ...rest }, ref) => {
306
+ const { styles, scrollBehavior } = useModal();
307
+ const css = {
308
+ display: "flex",
309
+ flexDirection: "column",
310
+ alignItems: "flex-start",
311
+ overflow: scrollBehavior === "inside" ? "auto" : void 0,
312
+ ...__css ? __css : styles.body
313
+ };
314
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core5.ui.main, { ref, className: (0, import_utils5.cx)("ui-modal-body", className), __css: css, ...rest });
315
+ }
316
+ );
317
+
318
+ // src/modal-footer.tsx
319
+ var import_core6 = require("@yamada-ui/core");
320
+ var import_utils6 = require("@yamada-ui/utils");
321
+ var import_jsx_runtime6 = require("react/jsx-runtime");
322
+ var ModalFooter = (0, import_core6.forwardRef)(
323
+ ({ className, __css, ...rest }, ref) => {
324
+ const { styles } = useModal();
325
+ const css = {
326
+ display: "flex",
327
+ alignItems: "center",
328
+ justifyContent: "flex-end",
329
+ ...__css ? __css : styles.footer
330
+ };
331
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_core6.ui.footer, { ref, className: (0, import_utils6.cx)("ui-modal-footer", className), __css: css, ...rest });
332
+ }
333
+ );
334
+
335
+ // src/drawer.tsx
336
+ var import_core7 = require("@yamada-ui/core");
337
+ var import_transitions3 = require("@yamada-ui/transitions");
338
+ var import_utils7 = require("@yamada-ui/utils");
339
+ var import_jsx_runtime7 = require("react/jsx-runtime");
340
+ var [DrawerProvider, useDrawer] = (0, import_utils7.createContext)({
341
+ name: `DrawerContext`,
342
+ errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
343
+ });
344
+ var Drawer = (0, import_core7.forwardRef)(({ size, ...props }, ref) => {
345
+ const [styles, mergedProps] = (0, import_core7.useMultiComponentStyle)("Drawer", { size, ...props });
346
+ const {
347
+ className,
348
+ children,
349
+ isOpen,
350
+ placement = "right",
351
+ onClose,
352
+ onOverlayClick,
353
+ onEsc,
354
+ onCloseComplete,
355
+ withCloseButton = true,
356
+ withOverlay = true,
357
+ allowPinchZoom,
358
+ autoFocus,
359
+ restoreFocus,
360
+ initialFocusRef,
361
+ finalFocusRef,
362
+ blockScrollOnMount,
363
+ closeOnOverlay,
364
+ closeOnEsc,
365
+ lockFocusAcrossFrames,
366
+ duration = { enter: 0.4, exit: 0.3 },
367
+ ...rest
368
+ } = (0, import_core7.omitThemeProps)(mergedProps);
369
+ const validChildren = (0, import_utils7.getValidChildren)(children);
370
+ const [customDrawerOverlay, ...cloneChildren] = (0, import_utils7.findChildren)(validChildren, DrawerOverlay);
371
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawerProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
372
+ Modal,
373
+ {
374
+ ref,
375
+ ...{
376
+ isOpen,
377
+ onClose,
378
+ onOverlayClick,
379
+ onEsc,
380
+ onCloseComplete,
381
+ withCloseButton: false,
382
+ withOverlay: false,
383
+ allowPinchZoom,
384
+ autoFocus,
385
+ restoreFocus,
386
+ initialFocusRef,
387
+ finalFocusRef,
388
+ blockScrollOnMount,
389
+ closeOnOverlay,
390
+ closeOnEsc,
391
+ lockFocusAcrossFrames,
392
+ duration
393
+ },
394
+ children: [
395
+ customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawerOverlay, {}) : null,
396
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawerContent, { ...{ placement, withCloseButton, ...rest }, children: cloneChildren })
397
+ ]
398
+ }
399
+ ) });
400
+ });
401
+ var DrawerContent = (0, import_core7.forwardRef)(
402
+ ({ className, children, placement, withCloseButton, ...rest }, ref) => {
403
+ const { isOpen, onClose, duration } = useModal();
404
+ const styles = useDrawer();
405
+ const validChildren = (0, import_utils7.getValidChildren)(children);
406
+ const [customDrawerCloseButton, ...cloneChildren] = (0, import_utils7.findChildren)(
407
+ validChildren,
408
+ DrawerCloseButton
409
+ );
410
+ const css = {
411
+ display: "flex",
412
+ flexDirection: "column",
413
+ width: "100%",
414
+ outline: 0,
415
+ ...styles.container
416
+ };
417
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
418
+ import_transitions3.Slide,
419
+ {
420
+ ref,
421
+ className: (0, import_utils7.cx)("ui-drawer", className),
422
+ tabIndex: -1,
423
+ isOpen,
424
+ placement,
425
+ duration,
426
+ __css: css,
427
+ ...rest,
428
+ children: [
429
+ customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawerCloseButton, {}) : null,
430
+ cloneChildren
431
+ ]
432
+ }
433
+ );
434
+ }
435
+ );
436
+ var DrawerOverlay = (0, import_core7.forwardRef)(
437
+ ({ className, ...rest }, ref) => {
438
+ const styles = useDrawer();
439
+ const css = { ...styles.overlay };
440
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
441
+ ModalOverlay,
442
+ {
443
+ ref,
444
+ className: (0, import_utils7.cx)("ui-drawer-overlay", className),
445
+ __css: css,
446
+ ...rest
447
+ }
448
+ );
449
+ }
450
+ );
451
+ var DrawerCloseButton = (0, import_core7.forwardRef)(
452
+ ({ className, ...rest }, ref) => {
453
+ const styles = useDrawer();
454
+ const css = { ...styles.closeButton };
455
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
456
+ ModalCloseButton,
457
+ {
458
+ ref,
459
+ className: (0, import_utils7.cx)("ui-drawer-close-button", className),
460
+ __css: css,
461
+ ...rest
462
+ }
463
+ );
464
+ }
465
+ );
466
+ var DrawerHeader = (0, import_core7.forwardRef)(
467
+ ({ className, ...rest }, ref) => {
468
+ const styles = useDrawer();
469
+ const css = { ...styles.header };
470
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModalHeader, { ref, className: (0, import_utils7.cx)("ui-drawer-header", className), __css: css, ...rest });
471
+ }
472
+ );
473
+ var DrawerBody = (0, import_core7.forwardRef)(({ className, ...rest }, ref) => {
474
+ const styles = useDrawer();
475
+ const css = { ...styles.body };
476
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModalBody, { ref, className: (0, import_utils7.cx)("ui-drawer-body", className), __css: css, ...rest });
477
+ });
478
+ var DrawerFooter = (0, import_core7.forwardRef)(
479
+ ({ className, ...rest }, ref) => {
480
+ const styles = useDrawer();
481
+ const css = { ...styles.footer };
482
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModalFooter, { ref, className: (0, import_utils7.cx)("ui-drawer-footer", className), __css: css, ...rest });
483
+ }
484
+ );
485
+
486
+ // src/dialog.tsx
487
+ var import_jsx_runtime8 = require("react/jsx-runtime");
488
+ var [DialogProvider, useDialog] = (0, import_utils8.createContext)({
489
+ name: `DialogContext`,
490
+ errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
491
+ });
492
+ var Dialog = (0, import_core8.forwardRef)(({ size, ...props }, ref) => {
493
+ const [styles, mergedProps] = (0, import_core8.useMultiComponentStyle)("Dialog", { size, ...props });
494
+ const {
495
+ className,
496
+ children,
497
+ withOverlay = true,
498
+ withCloseButton = true,
499
+ header,
500
+ footer,
501
+ cancel,
502
+ other,
503
+ success,
504
+ onClose,
505
+ onCancel,
506
+ onOther,
507
+ onSuccess,
508
+ ...rest
509
+ } = (0, import_core8.omitThemeProps)(mergedProps);
510
+ const validChildren = (0, import_utils8.getValidChildren)(children);
511
+ const [customDialogOverlay] = (0, import_utils8.findChildren)(validChildren, DialogOverlay);
512
+ const [customDialogCloseButton] = (0, import_utils8.findChildren)(validChildren, DialogCloseButton);
513
+ const [customDialogHeader] = (0, import_utils8.findChildren)(validChildren, DialogHeader);
514
+ const [customDialogBody] = (0, import_utils8.findChildren)(validChildren, DialogBody);
515
+ const [customDialogFooter] = (0, import_utils8.findChildren)(validChildren, DialogFooter);
516
+ const cloneChildren = !(0, import_utils8.isEmpty)(validChildren) ? (0, import_utils8.omitChildren)(
517
+ validChildren,
518
+ DialogOverlay,
519
+ DialogCloseButton,
520
+ DialogHeader,
521
+ DialogBody,
522
+ DialogFooter
523
+ ) : children;
524
+ const css = { ...styles.container };
525
+ const cancelButtonProps = (0, import_utils8.isValidElement)(cancel) ? { children: cancel } : cancel;
526
+ const otherButtonProps = (0, import_utils8.isValidElement)(other) ? { children: other } : other;
527
+ const successButtonProps = (0, import_utils8.isValidElement)(success) ? { children: success } : success;
528
+ if (cancelButtonProps && !cancelButtonProps.variant)
529
+ cancelButtonProps.variant = "ghost";
530
+ if (otherButtonProps && !otherButtonProps.colorScheme)
531
+ otherButtonProps.colorScheme = "secondary";
532
+ if (successButtonProps && !successButtonProps.colorScheme)
533
+ successButtonProps.colorScheme = "primary";
534
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
535
+ Modal,
536
+ {
537
+ ref,
538
+ __css: css,
539
+ ...{ size, onClose, withOverlay: false, withCloseButton: false, ...rest },
540
+ children: [
541
+ customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogOverlay, {}) : null,
542
+ customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogCloseButton, {}) : null,
543
+ customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogHeader, { children: header }) : null,
544
+ customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogBody, { children: cloneChildren }) : null,
545
+ 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: [
546
+ cancelButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_button.Button, { onClick: () => onCancel == null ? void 0 : onCancel(onClose), ...cancelButtonProps }) : null,
547
+ otherButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_button.Button, { onClick: () => onOther == null ? void 0 : onOther(onClose), ...otherButtonProps }) : null,
548
+ successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(import_button.Button, { onClick: () => onSuccess == null ? void 0 : onSuccess(onClose), ...successButtonProps }) : null
549
+ ] }) }) : null
550
+ ]
551
+ }
552
+ ) });
553
+ });
554
+ var DialogOverlay = (0, import_core8.forwardRef)(
555
+ ({ className, ...rest }, ref) => {
556
+ const styles = useDialog();
557
+ const css = { ...styles.overlay };
558
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
559
+ ModalOverlay,
560
+ {
561
+ ref,
562
+ className: (0, import_utils8.cx)("ui-dialog-overlay", className),
563
+ __css: css,
564
+ ...rest
565
+ }
566
+ );
567
+ }
568
+ );
569
+ var DialogCloseButton = (0, import_core8.forwardRef)(
570
+ ({ className, ...rest }, ref) => {
571
+ const styles = useDialog();
572
+ const css = { ...styles.closeButton };
573
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
574
+ ModalCloseButton,
575
+ {
576
+ ref,
577
+ className: (0, import_utils8.cx)("ui-dialog-close-button", className),
578
+ __css: css,
579
+ ...rest
580
+ }
581
+ );
582
+ }
583
+ );
584
+ var DialogHeader = (0, import_core8.forwardRef)(
585
+ ({ className, ...rest }, ref) => {
586
+ const styles = useDialog();
587
+ const css = { ...styles.header };
588
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalHeader, { ref, className: (0, import_utils8.cx)("ui-dialog-header", className), __css: css, ...rest });
589
+ }
590
+ );
591
+ var DialogBody = (0, import_core8.forwardRef)(({ className, ...rest }, ref) => {
592
+ const styles = useDialog();
593
+ const css = { ...styles.body };
594
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalBody, { ref, className: (0, import_utils8.cx)("ui-dialog-body", className), __css: css, ...rest });
595
+ });
596
+ var DialogFooter = (0, import_core8.forwardRef)(
597
+ ({ className, ...rest }, ref) => {
598
+ const styles = useDialog();
599
+ const css = { ...styles.footer };
600
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalFooter, { ref, className: (0, import_utils8.cx)("ui-dialog-footer", className), __css: css, ...rest });
601
+ }
602
+ );
603
+ // Annotate the CommonJS export names for ESM import in node:
604
+ 0 && (module.exports = {
605
+ Dialog,
606
+ DialogBody,
607
+ DialogCloseButton,
608
+ DialogFooter,
609
+ DialogHeader,
610
+ DialogOverlay
611
+ });
@@ -0,0 +1,16 @@
1
+ import {
2
+ Dialog,
3
+ DialogBody,
4
+ DialogCloseButton,
5
+ DialogFooter,
6
+ DialogHeader,
7
+ DialogOverlay
8
+ } from "./chunk-5E5WMNCI.mjs";
9
+ export {
10
+ Dialog,
11
+ DialogBody,
12
+ DialogCloseButton,
13
+ DialogFooter,
14
+ DialogHeader,
15
+ DialogOverlay
16
+ };
@@ -0,0 +1,33 @@
1
+ import * as _yamada_ui_close_button from '@yamada-ui/close-button';
2
+ import * as _yamada_ui_core from '@yamada-ui/core';
3
+ import { ThemeProps } from '@yamada-ui/core';
4
+ import { SlideProps } from '@yamada-ui/transitions';
5
+ import { ModalProps } from './modal.js';
6
+ import { ModalOverlayProps } from './modal-overlay.js';
7
+ import { ModalCloseButtonProps } from './modal-close-button.js';
8
+ import { ModalHeaderProps } from './modal-header.js';
9
+ import { ModalBodyProps } from './modal-body.js';
10
+ import { ModalFooterProps } from './modal-footer.js';
11
+ import '@yamada-ui/focus-lock';
12
+ import '@yamada-ui/motion';
13
+
14
+ type DrawerOptions = {
15
+ placement?: SlideProps['placement'];
16
+ isFullHeight?: boolean;
17
+ };
18
+ type DrawerProps = Omit<ModalProps, 'scrollBehavior' | 'animation' | 'outside' | keyof ThemeProps> & ThemeProps<'Drawer'> & DrawerOptions;
19
+ declare const Drawer: _yamada_ui_core.Component<"div", DrawerProps>;
20
+ type DrawerContentProps = Omit<DrawerProps, 'color' | 'transition' | 'isOpen' | keyof ThemeProps>;
21
+ declare const DrawerContent: _yamada_ui_core.Component<"div", DrawerContentProps>;
22
+ type DrawerOverlayProps = ModalOverlayProps;
23
+ declare const DrawerOverlay: _yamada_ui_core.Component<"div", ModalOverlayProps>;
24
+ type DrawerCloseButtonProps = ModalCloseButtonProps;
25
+ declare const DrawerCloseButton: _yamada_ui_core.Component<"button", _yamada_ui_close_button.CloseButtonProps>;
26
+ type DrawerHeaderProps = ModalHeaderProps;
27
+ declare const DrawerHeader: _yamada_ui_core.Component<"header", ModalHeaderProps>;
28
+ type DrawerBodyProps = ModalBodyProps;
29
+ declare const DrawerBody: _yamada_ui_core.Component<"main", ModalBodyProps>;
30
+ type DrawerFooterProps = ModalFooterProps;
31
+ declare const DrawerFooter: _yamada_ui_core.Component<"footer", ModalFooterProps>;
32
+
33
+ export { Drawer, DrawerBody, DrawerBodyProps, DrawerCloseButton, DrawerCloseButtonProps, DrawerContent, DrawerFooter, DrawerFooterProps, DrawerHeader, DrawerHeaderProps, DrawerOverlay, DrawerOverlayProps, DrawerProps };