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