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