@yamada-ui/modal 0.2.7 → 0.2.9

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/drawer.js CHANGED
@@ -52,7 +52,14 @@ var import_utils = require("@yamada-ui/utils");
52
52
  var import_jsx_runtime = require("react/jsx-runtime");
53
53
  var ModalOverlay = (0, import_core.forwardRef)(
54
54
  ({ className, __css, onClick, ...rest }, ref) => {
55
- const { styles, closeOnOverlay, onOverlayClick, onClose, animation, duration } = useModal();
55
+ const {
56
+ styles,
57
+ closeOnOverlay,
58
+ onOverlayClick,
59
+ onClose,
60
+ animation,
61
+ duration
62
+ } = useModal();
56
63
  const css = {
57
64
  position: "fixed",
58
65
  top: 0,
@@ -123,7 +130,15 @@ var ModalHeader = (0, import_core3.forwardRef)(
123
130
  justifyContent: "flex-start",
124
131
  ...__css ? __css : styles.header
125
132
  };
126
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_core3.ui.header, { ref, className: (0, import_utils3.cx)("ui-modal-header", className), __css: css, ...rest });
133
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
134
+ import_core3.ui.header,
135
+ {
136
+ ref,
137
+ className: (0, import_utils3.cx)("ui-modal-header", className),
138
+ __css: css,
139
+ ...rest
140
+ }
141
+ );
127
142
  }
128
143
  );
129
144
 
@@ -141,7 +156,15 @@ var ModalBody = (0, import_core4.forwardRef)(
141
156
  overflow: scrollBehavior === "inside" ? "auto" : void 0,
142
157
  ...__css ? __css : styles.body
143
158
  };
144
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_core4.ui.main, { ref, className: (0, import_utils4.cx)("ui-modal-body", className), __css: css, ...rest });
159
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
160
+ import_core4.ui.main,
161
+ {
162
+ ref,
163
+ className: (0, import_utils4.cx)("ui-modal-body", className),
164
+ __css: css,
165
+ ...rest
166
+ }
167
+ );
145
168
  }
146
169
  );
147
170
 
@@ -158,7 +181,15 @@ var ModalFooter = (0, import_core5.forwardRef)(
158
181
  justifyContent: "flex-end",
159
182
  ...__css ? __css : styles.footer
160
183
  };
161
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_core5.ui.footer, { ref, className: (0, import_utils5.cx)("ui-modal-footer", className), __css: css, ...rest });
184
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
185
+ import_core5.ui.footer,
186
+ {
187
+ ref,
188
+ className: (0, import_utils5.cx)("ui-modal-footer", className),
189
+ __css: css,
190
+ ...rest
191
+ }
192
+ );
162
193
  }
163
194
  );
164
195
 
@@ -171,69 +202,101 @@ var [DialogProvider, useDialog] = (0, import_utils6.createContext)({
171
202
  name: `DialogContext`,
172
203
  errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
173
204
  });
174
- var Dialog = (0, import_core6.forwardRef)(({ size, ...props }, ref) => {
175
- const [styles, mergedProps] = (0, import_core6.useMultiComponentStyle)("Dialog", { size, ...props });
176
- const {
177
- className,
178
- children,
179
- withOverlay = true,
180
- withCloseButton = true,
181
- header,
182
- footer,
183
- cancel,
184
- other,
185
- success,
186
- onClose,
187
- onCancel,
188
- onOther,
189
- onSuccess,
190
- ...rest
191
- } = (0, import_core6.omitThemeProps)(mergedProps);
192
- const validChildren = (0, import_utils6.getValidChildren)(children);
193
- const [customDialogOverlay] = (0, import_utils6.findChildren)(validChildren, DialogOverlay);
194
- const [customDialogCloseButton] = (0, import_utils6.findChildren)(validChildren, DialogCloseButton);
195
- const [customDialogHeader] = (0, import_utils6.findChildren)(validChildren, DialogHeader);
196
- const [customDialogBody] = (0, import_utils6.findChildren)(validChildren, DialogBody);
197
- const [customDialogFooter] = (0, import_utils6.findChildren)(validChildren, DialogFooter);
198
- const cloneChildren = !(0, import_utils6.isEmpty)(validChildren) ? (0, import_utils6.omitChildren)(
199
- validChildren,
200
- DialogOverlay,
201
- DialogCloseButton,
202
- DialogHeader,
203
- DialogBody,
204
- DialogFooter
205
- ) : children;
206
- const css = { ...styles.container };
207
- const cancelButtonProps = (0, import_utils6.isValidElement)(cancel) ? { children: cancel } : cancel;
208
- const otherButtonProps = (0, import_utils6.isValidElement)(other) ? { children: other } : other;
209
- const successButtonProps = (0, import_utils6.isValidElement)(success) ? { children: success } : success;
210
- if (cancelButtonProps && !cancelButtonProps.variant)
211
- cancelButtonProps.variant = "ghost";
212
- if (otherButtonProps && !otherButtonProps.colorScheme)
213
- otherButtonProps.colorScheme = "secondary";
214
- if (successButtonProps && !successButtonProps.colorScheme)
215
- successButtonProps.colorScheme = "primary";
216
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
217
- Modal,
218
- {
219
- ref,
220
- className: (0, import_utils6.cx)("ui-dialog", className),
221
- __css: css,
222
- ...{ size, onClose, withOverlay: false, withCloseButton: false, ...rest },
223
- children: [
224
- customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogOverlay, {}) : null,
225
- customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogCloseButton, {}) : null,
226
- customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogHeader, { children: header }) : null,
227
- customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogBody, { children: cloneChildren }) : null,
228
- 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: [
229
- cancelButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button.Button, { onClick: () => onCancel == null ? void 0 : onCancel(onClose), ...cancelButtonProps }) : null,
230
- otherButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button.Button, { onClick: () => onOther == null ? void 0 : onOther(onClose), ...otherButtonProps }) : null,
231
- successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(import_button.Button, { onClick: () => onSuccess == null ? void 0 : onSuccess(onClose), ...successButtonProps }) : null
232
- ] }) }) : null
233
- ]
234
- }
235
- ) });
236
- });
205
+ var Dialog = (0, import_core6.forwardRef)(
206
+ ({ size, ...props }, ref) => {
207
+ const [styles, mergedProps] = (0, import_core6.useMultiComponentStyle)("Dialog", {
208
+ size,
209
+ ...props
210
+ });
211
+ const {
212
+ className,
213
+ children,
214
+ withOverlay = true,
215
+ withCloseButton = true,
216
+ header,
217
+ footer,
218
+ cancel,
219
+ other,
220
+ success,
221
+ onClose,
222
+ onCancel,
223
+ onOther,
224
+ onSuccess,
225
+ ...rest
226
+ } = (0, import_core6.omitThemeProps)(mergedProps);
227
+ const validChildren = (0, import_utils6.getValidChildren)(children);
228
+ const [customDialogOverlay] = (0, import_utils6.findChildren)(validChildren, DialogOverlay);
229
+ const [customDialogCloseButton] = (0, import_utils6.findChildren)(
230
+ validChildren,
231
+ DialogCloseButton
232
+ );
233
+ const [customDialogHeader] = (0, import_utils6.findChildren)(validChildren, DialogHeader);
234
+ const [customDialogBody] = (0, import_utils6.findChildren)(validChildren, DialogBody);
235
+ const [customDialogFooter] = (0, import_utils6.findChildren)(validChildren, DialogFooter);
236
+ const cloneChildren = !(0, import_utils6.isEmpty)(validChildren) ? (0, import_utils6.omitChildren)(
237
+ validChildren,
238
+ DialogOverlay,
239
+ DialogCloseButton,
240
+ DialogHeader,
241
+ DialogBody,
242
+ DialogFooter
243
+ ) : children;
244
+ const css = { ...styles.container };
245
+ const cancelButtonProps = (0, import_utils6.isValidElement)(cancel) ? { children: cancel } : cancel;
246
+ const otherButtonProps = (0, import_utils6.isValidElement)(other) ? { children: other } : other;
247
+ const successButtonProps = (0, import_utils6.isValidElement)(success) ? { children: success } : success;
248
+ if (cancelButtonProps && !cancelButtonProps.variant)
249
+ cancelButtonProps.variant = "ghost";
250
+ if (otherButtonProps && !otherButtonProps.colorScheme)
251
+ otherButtonProps.colorScheme = "secondary";
252
+ if (successButtonProps && !successButtonProps.colorScheme)
253
+ successButtonProps.colorScheme = "primary";
254
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
255
+ Modal,
256
+ {
257
+ ref,
258
+ className: (0, import_utils6.cx)("ui-dialog", className),
259
+ __css: css,
260
+ ...{
261
+ size,
262
+ onClose,
263
+ withOverlay: false,
264
+ withCloseButton: false,
265
+ ...rest
266
+ },
267
+ children: [
268
+ customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogOverlay, {}) : null,
269
+ customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogCloseButton, {}) : null,
270
+ customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogHeader, { children: header }) : null,
271
+ customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogBody, { children: cloneChildren }) : null,
272
+ 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: [
273
+ cancelButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
274
+ import_button.Button,
275
+ {
276
+ onClick: () => onCancel == null ? void 0 : onCancel(onClose),
277
+ ...cancelButtonProps
278
+ }
279
+ ) : null,
280
+ otherButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
281
+ import_button.Button,
282
+ {
283
+ onClick: () => onOther == null ? void 0 : onOther(onClose),
284
+ ...otherButtonProps
285
+ }
286
+ ) : null,
287
+ successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
288
+ import_button.Button,
289
+ {
290
+ onClick: () => onSuccess == null ? void 0 : onSuccess(onClose),
291
+ ...successButtonProps
292
+ }
293
+ ) : null
294
+ ] }) }) : null
295
+ ]
296
+ }
297
+ ) });
298
+ }
299
+ );
237
300
  var DialogOverlay = (0, import_core6.forwardRef)(
238
301
  ({ className, ...rest }, ref) => {
239
302
  const styles = useDialog();
@@ -268,19 +331,45 @@ var DialogHeader = (0, import_core6.forwardRef)(
268
331
  ({ className, ...rest }, ref) => {
269
332
  const styles = useDialog();
270
333
  const css = { ...styles.header };
271
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalHeader, { ref, className: (0, import_utils6.cx)("ui-dialog-header", className), __css: css, ...rest });
334
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
335
+ ModalHeader,
336
+ {
337
+ ref,
338
+ className: (0, import_utils6.cx)("ui-dialog-header", className),
339
+ __css: css,
340
+ ...rest
341
+ }
342
+ );
343
+ }
344
+ );
345
+ var DialogBody = (0, import_core6.forwardRef)(
346
+ ({ className, ...rest }, ref) => {
347
+ const styles = useDialog();
348
+ const css = { ...styles.body };
349
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
350
+ ModalBody,
351
+ {
352
+ ref,
353
+ className: (0, import_utils6.cx)("ui-dialog-body", className),
354
+ __css: css,
355
+ ...rest
356
+ }
357
+ );
272
358
  }
273
359
  );
274
- var DialogBody = (0, import_core6.forwardRef)(({ className, ...rest }, ref) => {
275
- const styles = useDialog();
276
- const css = { ...styles.body };
277
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalBody, { ref, className: (0, import_utils6.cx)("ui-dialog-body", className), __css: css, ...rest });
278
- });
279
360
  var DialogFooter = (0, import_core6.forwardRef)(
280
361
  ({ className, ...rest }, ref) => {
281
362
  const styles = useDialog();
282
363
  const css = { ...styles.footer };
283
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(ModalFooter, { ref, className: (0, import_utils6.cx)("ui-dialog-footer", className), __css: css, ...rest });
364
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
365
+ ModalFooter,
366
+ {
367
+ ref,
368
+ className: (0, import_utils6.cx)("ui-dialog-footer", className),
369
+ __css: css,
370
+ ...rest
371
+ }
372
+ );
284
373
  }
285
374
  );
286
375
 
@@ -290,107 +379,121 @@ var [ModalProvider, useModal] = (0, import_utils7.createContext)({
290
379
  name: `ModalContext`,
291
380
  errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
292
381
  });
293
- var Modal = (0, import_core7.forwardRef)(({ size, ...props }, ref) => {
294
- const [styles, mergedProps] = (0, import_core7.useMultiComponentStyle)("Modal", { size, ...props });
295
- const {
296
- className,
297
- children,
298
- isOpen,
299
- onClose,
300
- onOverlayClick,
301
- onEsc,
302
- onCloseComplete,
303
- placement: _placement = "center",
304
- outside = "md",
305
- withCloseButton = true,
306
- withOverlay = true,
307
- allowPinchZoom = false,
308
- scrollBehavior = "inside",
309
- autoFocus,
310
- restoreFocus,
311
- initialFocusRef,
312
- finalFocusRef,
313
- blockScrollOnMount = true,
314
- closeOnOverlay = true,
315
- closeOnEsc = true,
316
- lockFocusAcrossFrames = true,
317
- animation = "scale",
318
- duration,
319
- ...rest
320
- } = (0, import_core7.omitThemeProps)(mergedProps);
321
- const onKeyDown = (0, import_react.useCallback)(
322
- (event) => {
323
- if (event.key !== "Escape")
324
- return;
325
- event.stopPropagation();
326
- if (closeOnEsc)
327
- onClose == null ? void 0 : onClose();
328
- onEsc == null ? void 0 : onEsc();
329
- },
330
- [closeOnEsc, onClose, onEsc]
331
- );
332
- const validChildren = (0, import_utils7.getValidChildren)(children);
333
- const [customModalOverlay, ...cloneChildren] = (0, import_utils7.findChildren)(
334
- validChildren,
335
- ModalOverlay,
336
- DialogOverlay,
337
- DrawerOverlay
338
- );
339
- let [drawerContent] = (0, import_utils7.findChildren)(validChildren, DrawerContent);
340
- if (drawerContent)
341
- drawerContent = (0, import_react.cloneElement)(drawerContent, { onKeyDown });
342
- const placement = (0, import_use_value.useValue)(_placement);
343
- const css = {
344
- position: "fixed",
345
- top: 0,
346
- left: 0,
347
- zIndex: "beerus",
348
- w: "100vw",
349
- h: "100vh",
350
- p: size !== "full" ? outside : void 0,
351
- display: "flex",
352
- justifyContent: placement.includes("right") ? "flex-start" : placement.includes("left") ? "flex-end" : "center",
353
- alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
354
- };
355
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
356
- ModalProvider,
357
- {
358
- value: {
359
- isOpen,
360
- onClose,
361
- onOverlayClick,
362
- withCloseButton,
363
- scrollBehavior,
364
- closeOnOverlay,
365
- animation,
366
- duration,
367
- styles
382
+ var Modal = (0, import_core7.forwardRef)(
383
+ ({ size, ...props }, ref) => {
384
+ const [styles, mergedProps] = (0, import_core7.useMultiComponentStyle)("Modal", {
385
+ size,
386
+ ...props
387
+ });
388
+ const {
389
+ className,
390
+ children,
391
+ isOpen,
392
+ onClose,
393
+ onOverlayClick,
394
+ onEsc,
395
+ onCloseComplete,
396
+ placement: _placement = "center",
397
+ outside = "md",
398
+ withCloseButton = true,
399
+ withOverlay = true,
400
+ allowPinchZoom = false,
401
+ scrollBehavior = "inside",
402
+ autoFocus,
403
+ restoreFocus,
404
+ initialFocusRef,
405
+ finalFocusRef,
406
+ blockScrollOnMount = true,
407
+ closeOnOverlay = true,
408
+ closeOnEsc = true,
409
+ lockFocusAcrossFrames = true,
410
+ animation = "scale",
411
+ duration,
412
+ ...rest
413
+ } = (0, import_core7.omitThemeProps)(mergedProps);
414
+ const onKeyDown = (0, import_react.useCallback)(
415
+ (event) => {
416
+ if (event.key !== "Escape")
417
+ return;
418
+ event.stopPropagation();
419
+ if (closeOnEsc)
420
+ onClose == null ? void 0 : onClose();
421
+ onEsc == null ? void 0 : onEsc();
368
422
  },
369
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_motion2.AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_portal.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
370
- import_focus_lock.FocusLock,
371
- {
372
- autoFocus,
373
- initialFocusRef,
374
- finalFocusRef,
375
- restoreFocus,
376
- lockFocusAcrossFrames,
377
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
378
- import_react_remove_scroll.RemoveScroll,
379
- {
380
- allowPinchZoom,
381
- enabled: blockScrollOnMount,
382
- forwardProps: true,
383
- children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core7.ui.div, { __css: css, children: [
384
- customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModalOverlay, {}) : null,
385
- drawerContent != null ? drawerContent : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModalContent, { ref, className, onKeyDown, ...rest, children: cloneChildren })
386
- ] })
387
- }
388
- )
389
- }
390
- ) }) : null })
391
- }
392
- );
393
- });
423
+ [closeOnEsc, onClose, onEsc]
424
+ );
425
+ const validChildren = (0, import_utils7.getValidChildren)(children);
426
+ const [customModalOverlay, ...cloneChildren] = (0, import_utils7.findChildren)(
427
+ validChildren,
428
+ ModalOverlay,
429
+ DialogOverlay,
430
+ DrawerOverlay
431
+ );
432
+ let [drawerContent] = (0, import_utils7.findChildren)(validChildren, DrawerContent);
433
+ if (drawerContent)
434
+ drawerContent = (0, import_react.cloneElement)(drawerContent, { onKeyDown });
435
+ const placement = (0, import_use_value.useValue)(_placement);
436
+ const css = {
437
+ position: "fixed",
438
+ top: 0,
439
+ left: 0,
440
+ zIndex: "beerus",
441
+ w: "100vw",
442
+ h: "100vh",
443
+ p: size !== "full" ? outside : void 0,
444
+ display: "flex",
445
+ justifyContent: placement.includes("right") ? "flex-start" : placement.includes("left") ? "flex-end" : "center",
446
+ alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
447
+ };
448
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
449
+ ModalProvider,
450
+ {
451
+ value: {
452
+ isOpen,
453
+ onClose,
454
+ onOverlayClick,
455
+ withCloseButton,
456
+ scrollBehavior,
457
+ closeOnOverlay,
458
+ animation,
459
+ duration,
460
+ styles
461
+ },
462
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_motion2.AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_portal.Portal, { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
463
+ import_focus_lock.FocusLock,
464
+ {
465
+ autoFocus,
466
+ initialFocusRef,
467
+ finalFocusRef,
468
+ restoreFocus,
469
+ lockFocusAcrossFrames,
470
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
471
+ import_react_remove_scroll.RemoveScroll,
472
+ {
473
+ allowPinchZoom,
474
+ enabled: blockScrollOnMount,
475
+ forwardProps: true,
476
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(import_core7.ui.div, { __css: css, children: [
477
+ customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(ModalOverlay, {}) : null,
478
+ drawerContent != null ? drawerContent : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
479
+ ModalContent,
480
+ {
481
+ ref,
482
+ className,
483
+ onKeyDown,
484
+ ...rest,
485
+ children: cloneChildren
486
+ }
487
+ )
488
+ ] })
489
+ }
490
+ )
491
+ }
492
+ ) }) : null })
493
+ }
494
+ );
495
+ }
496
+ );
394
497
  var getModalContentProps = (animation = "scale", duration) => {
395
498
  switch (animation) {
396
499
  case "scale":
@@ -422,7 +525,14 @@ var getModalContentProps = (animation = "scale", duration) => {
422
525
  };
423
526
  var ModalContent = (0, import_core7.forwardRef)(
424
527
  ({ className, children, __css, ...rest }, ref) => {
425
- const { styles, scrollBehavior, withCloseButton, onClose, animation, duration } = useModal();
528
+ const {
529
+ styles,
530
+ scrollBehavior,
531
+ withCloseButton,
532
+ onClose,
533
+ animation,
534
+ duration
535
+ } = useModal();
426
536
  const validChildren = (0, import_utils7.getValidChildren)(children);
427
537
  const [customModalCloseButton, ...cloneChildren] = (0, import_utils7.findChildren)(
428
538
  validChildren,
@@ -464,62 +574,70 @@ var [DrawerProvider, useDrawer] = (0, import_utils8.createContext)({
464
574
  name: `DrawerContext`,
465
575
  errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
466
576
  });
467
- var Drawer = (0, import_core8.forwardRef)(({ size, ...props }, ref) => {
468
- const [styles, mergedProps] = (0, import_core8.useMultiComponentStyle)("Drawer", { size, ...props });
469
- const {
470
- children,
471
- isOpen,
472
- placement = "right",
473
- onClose,
474
- onOverlayClick,
475
- onEsc,
476
- onCloseComplete,
477
- withCloseButton = true,
478
- withOverlay = true,
479
- allowPinchZoom,
480
- autoFocus,
481
- restoreFocus,
482
- initialFocusRef,
483
- finalFocusRef,
484
- blockScrollOnMount,
485
- closeOnOverlay,
486
- closeOnEsc,
487
- lockFocusAcrossFrames,
488
- duration = { enter: 0.4, exit: 0.3 },
489
- ...rest
490
- } = (0, import_core8.omitThemeProps)(mergedProps);
491
- const validChildren = (0, import_utils8.getValidChildren)(children);
492
- const [customDrawerOverlay, ...cloneChildren] = (0, import_utils8.findChildren)(validChildren, DrawerOverlay);
493
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DrawerProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
494
- Modal,
495
- {
496
- ref,
497
- ...{
498
- isOpen,
499
- onClose,
500
- onOverlayClick,
501
- onEsc,
502
- onCloseComplete,
503
- withCloseButton: false,
504
- withOverlay: false,
505
- allowPinchZoom,
506
- autoFocus,
507
- restoreFocus,
508
- initialFocusRef,
509
- finalFocusRef,
510
- blockScrollOnMount,
511
- closeOnOverlay,
512
- closeOnEsc,
513
- lockFocusAcrossFrames,
514
- duration
515
- },
516
- children: [
517
- customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DrawerOverlay, {}) : null,
518
- /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DrawerContent, { ...{ placement, withCloseButton, ...rest }, children: cloneChildren })
519
- ]
520
- }
521
- ) });
522
- });
577
+ var Drawer = (0, import_core8.forwardRef)(
578
+ ({ size, ...props }, ref) => {
579
+ const [styles, mergedProps] = (0, import_core8.useMultiComponentStyle)("Drawer", {
580
+ size,
581
+ ...props
582
+ });
583
+ const {
584
+ children,
585
+ isOpen,
586
+ placement = "right",
587
+ onClose,
588
+ onOverlayClick,
589
+ onEsc,
590
+ onCloseComplete,
591
+ withCloseButton = true,
592
+ withOverlay = true,
593
+ allowPinchZoom,
594
+ autoFocus,
595
+ restoreFocus,
596
+ initialFocusRef,
597
+ finalFocusRef,
598
+ blockScrollOnMount,
599
+ closeOnOverlay,
600
+ closeOnEsc,
601
+ lockFocusAcrossFrames,
602
+ duration = { enter: 0.4, exit: 0.3 },
603
+ ...rest
604
+ } = (0, import_core8.omitThemeProps)(mergedProps);
605
+ const validChildren = (0, import_utils8.getValidChildren)(children);
606
+ const [customDrawerOverlay, ...cloneChildren] = (0, import_utils8.findChildren)(
607
+ validChildren,
608
+ DrawerOverlay
609
+ );
610
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DrawerProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
611
+ Modal,
612
+ {
613
+ ref,
614
+ ...{
615
+ isOpen,
616
+ onClose,
617
+ onOverlayClick,
618
+ onEsc,
619
+ onCloseComplete,
620
+ withCloseButton: false,
621
+ withOverlay: false,
622
+ allowPinchZoom,
623
+ autoFocus,
624
+ restoreFocus,
625
+ initialFocusRef,
626
+ finalFocusRef,
627
+ blockScrollOnMount,
628
+ closeOnOverlay,
629
+ closeOnEsc,
630
+ lockFocusAcrossFrames,
631
+ duration
632
+ },
633
+ children: [
634
+ customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DrawerOverlay, {}) : null,
635
+ /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DrawerContent, { ...{ placement, withCloseButton, ...rest }, children: cloneChildren })
636
+ ]
637
+ }
638
+ ) });
639
+ }
640
+ );
523
641
  var DrawerContent = (0, import_core8.forwardRef)(
524
642
  ({ className, children, placement, withCloseButton, ...rest }, ref) => {
525
643
  const { isOpen, onClose, duration } = useModal();
@@ -589,19 +707,45 @@ var DrawerHeader = (0, import_core8.forwardRef)(
589
707
  ({ className, ...rest }, ref) => {
590
708
  const styles = useDrawer();
591
709
  const css = { ...styles.header };
592
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalHeader, { ref, className: (0, import_utils8.cx)("ui-drawer-header", className), __css: css, ...rest });
710
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
711
+ ModalHeader,
712
+ {
713
+ ref,
714
+ className: (0, import_utils8.cx)("ui-drawer-header", className),
715
+ __css: css,
716
+ ...rest
717
+ }
718
+ );
719
+ }
720
+ );
721
+ var DrawerBody = (0, import_core8.forwardRef)(
722
+ ({ className, ...rest }, ref) => {
723
+ const styles = useDrawer();
724
+ const css = { ...styles.body };
725
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
726
+ ModalBody,
727
+ {
728
+ ref,
729
+ className: (0, import_utils8.cx)("ui-drawer-body", className),
730
+ __css: css,
731
+ ...rest
732
+ }
733
+ );
593
734
  }
594
735
  );
595
- var DrawerBody = (0, import_core8.forwardRef)(({ className, ...rest }, ref) => {
596
- const styles = useDrawer();
597
- const css = { ...styles.body };
598
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalBody, { ref, className: (0, import_utils8.cx)("ui-drawer-body", className), __css: css, ...rest });
599
- });
600
736
  var DrawerFooter = (0, import_core8.forwardRef)(
601
737
  ({ className, ...rest }, ref) => {
602
738
  const styles = useDrawer();
603
739
  const css = { ...styles.footer };
604
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalFooter, { ref, className: (0, import_utils8.cx)("ui-drawer-footer", className), __css: css, ...rest });
740
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
741
+ ModalFooter,
742
+ {
743
+ ref,
744
+ className: (0, import_utils8.cx)("ui-drawer-footer", className),
745
+ __css: css,
746
+ ...rest
747
+ }
748
+ );
605
749
  }
606
750
  );
607
751
  // Annotate the CommonJS export names for ESM import in node: