@yamada-ui/modal 0.1.12 → 0.2.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/{chunk-IFQ6QPEJ.mjs → chunk-MCXUVWUW.mjs} +188 -186
- package/dist/dialog.d.ts +24 -0
- package/dist/dialog.js +213 -211
- package/dist/dialog.mjs +1 -1
- package/dist/drawer.d.ts +8 -0
- package/dist/drawer.js +250 -248
- package/dist/drawer.mjs +1 -1
- package/dist/index.d.ts +2 -2
- package/dist/index.js +253 -255
- package/dist/index.mjs +3 -7
- package/dist/modal-body.js +279 -275
- package/dist/modal-body.mjs +1 -1
- package/dist/modal-close-button.js +277 -273
- package/dist/modal-close-button.mjs +1 -1
- package/dist/modal-footer.js +279 -275
- package/dist/modal-footer.mjs +1 -1
- package/dist/modal-header.js +279 -275
- package/dist/modal-header.mjs +1 -1
- package/dist/modal-overlay.js +271 -267
- package/dist/modal-overlay.mjs +1 -1
- package/dist/modal.d.ts +72 -6
- package/dist/modal.js +5 -3
- package/dist/modal.mjs +1 -1
- package/package.json +10 -10
|
@@ -1,9 +1,18 @@
|
|
|
1
|
+
// src/drawer.tsx
|
|
2
|
+
import {
|
|
3
|
+
forwardRef as forwardRef8,
|
|
4
|
+
useMultiComponentStyle as useMultiComponentStyle3,
|
|
5
|
+
omitThemeProps as omitThemeProps3
|
|
6
|
+
} from "@yamada-ui/core";
|
|
7
|
+
import { Slide } from "@yamada-ui/transitions";
|
|
8
|
+
import { createContext as createContext3, getValidChildren as getValidChildren3, findChildren as findChildren3, cx as cx8 } from "@yamada-ui/utils";
|
|
9
|
+
|
|
1
10
|
// src/modal.tsx
|
|
2
11
|
import {
|
|
3
12
|
ui as ui5,
|
|
4
|
-
forwardRef as
|
|
5
|
-
omitThemeProps as
|
|
6
|
-
useMultiComponentStyle as
|
|
13
|
+
forwardRef as forwardRef7,
|
|
14
|
+
omitThemeProps as omitThemeProps2,
|
|
15
|
+
useMultiComponentStyle as useMultiComponentStyle2
|
|
7
16
|
} from "@yamada-ui/core";
|
|
8
17
|
import { FocusLock } from "@yamada-ui/focus-lock";
|
|
9
18
|
import {
|
|
@@ -13,7 +22,7 @@ import {
|
|
|
13
22
|
import { Portal } from "@yamada-ui/portal";
|
|
14
23
|
import { scaleFadeProps, slideFadeProps } from "@yamada-ui/transitions";
|
|
15
24
|
import { useValue } from "@yamada-ui/use-value";
|
|
16
|
-
import { cx as
|
|
25
|
+
import { cx as cx7, createContext as createContext2, getValidChildren as getValidChildren2, findChildren as findChildren2 } from "@yamada-ui/utils";
|
|
17
26
|
import { cloneElement, useCallback } from "react";
|
|
18
27
|
import { RemoveScroll } from "react-remove-scroll";
|
|
19
28
|
|
|
@@ -268,169 +277,14 @@ var DialogFooter = forwardRef6(
|
|
|
268
277
|
}
|
|
269
278
|
);
|
|
270
279
|
|
|
271
|
-
// src/drawer.tsx
|
|
272
|
-
import {
|
|
273
|
-
forwardRef as forwardRef7,
|
|
274
|
-
useMultiComponentStyle as useMultiComponentStyle2,
|
|
275
|
-
omitThemeProps as omitThemeProps2
|
|
276
|
-
} from "@yamada-ui/core";
|
|
277
|
-
import { Slide } from "@yamada-ui/transitions";
|
|
278
|
-
import { createContext as createContext2, getValidChildren as getValidChildren2, findChildren as findChildren2, cx as cx7 } from "@yamada-ui/utils";
|
|
279
|
-
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
280
|
-
var [DrawerProvider, useDrawer] = createContext2({
|
|
281
|
-
name: `DrawerContext`,
|
|
282
|
-
errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
|
|
283
|
-
});
|
|
284
|
-
var Drawer = forwardRef7(({ size, ...props }, ref) => {
|
|
285
|
-
const [styles, mergedProps] = useMultiComponentStyle2("Drawer", { size, ...props });
|
|
286
|
-
const {
|
|
287
|
-
className,
|
|
288
|
-
children,
|
|
289
|
-
isOpen,
|
|
290
|
-
placement = "right",
|
|
291
|
-
onClose,
|
|
292
|
-
onOverlayClick,
|
|
293
|
-
onEsc,
|
|
294
|
-
onCloseComplete,
|
|
295
|
-
withCloseButton = true,
|
|
296
|
-
withOverlay = true,
|
|
297
|
-
allowPinchZoom,
|
|
298
|
-
autoFocus,
|
|
299
|
-
restoreFocus,
|
|
300
|
-
initialFocusRef,
|
|
301
|
-
finalFocusRef,
|
|
302
|
-
blockScrollOnMount,
|
|
303
|
-
closeOnOverlay,
|
|
304
|
-
closeOnEsc,
|
|
305
|
-
lockFocusAcrossFrames,
|
|
306
|
-
duration = { enter: 0.4, exit: 0.3 },
|
|
307
|
-
...rest
|
|
308
|
-
} = omitThemeProps2(mergedProps);
|
|
309
|
-
const validChildren = getValidChildren2(children);
|
|
310
|
-
const [customDrawerOverlay, ...cloneChildren] = findChildren2(validChildren, DrawerOverlay);
|
|
311
|
-
return /* @__PURE__ */ jsx7(DrawerProvider, { value: styles, children: /* @__PURE__ */ jsxs2(
|
|
312
|
-
Modal,
|
|
313
|
-
{
|
|
314
|
-
ref,
|
|
315
|
-
...{
|
|
316
|
-
isOpen,
|
|
317
|
-
onClose,
|
|
318
|
-
onOverlayClick,
|
|
319
|
-
onEsc,
|
|
320
|
-
onCloseComplete,
|
|
321
|
-
withCloseButton: false,
|
|
322
|
-
withOverlay: false,
|
|
323
|
-
allowPinchZoom,
|
|
324
|
-
autoFocus,
|
|
325
|
-
restoreFocus,
|
|
326
|
-
initialFocusRef,
|
|
327
|
-
finalFocusRef,
|
|
328
|
-
blockScrollOnMount,
|
|
329
|
-
closeOnOverlay,
|
|
330
|
-
closeOnEsc,
|
|
331
|
-
lockFocusAcrossFrames,
|
|
332
|
-
duration
|
|
333
|
-
},
|
|
334
|
-
children: [
|
|
335
|
-
customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ jsx7(DrawerOverlay, {}) : null,
|
|
336
|
-
/* @__PURE__ */ jsx7(DrawerContent, { ...{ placement, withCloseButton, ...rest }, children: cloneChildren })
|
|
337
|
-
]
|
|
338
|
-
}
|
|
339
|
-
) });
|
|
340
|
-
});
|
|
341
|
-
var DrawerContent = forwardRef7(
|
|
342
|
-
({ className, children, placement, withCloseButton, ...rest }, ref) => {
|
|
343
|
-
const { isOpen, onClose, duration } = useModal();
|
|
344
|
-
const styles = useDrawer();
|
|
345
|
-
const validChildren = getValidChildren2(children);
|
|
346
|
-
const [customDrawerCloseButton, ...cloneChildren] = findChildren2(
|
|
347
|
-
validChildren,
|
|
348
|
-
DrawerCloseButton
|
|
349
|
-
);
|
|
350
|
-
const css = {
|
|
351
|
-
display: "flex",
|
|
352
|
-
flexDirection: "column",
|
|
353
|
-
width: "100%",
|
|
354
|
-
outline: 0,
|
|
355
|
-
...styles.container
|
|
356
|
-
};
|
|
357
|
-
return /* @__PURE__ */ jsxs2(
|
|
358
|
-
Slide,
|
|
359
|
-
{
|
|
360
|
-
ref,
|
|
361
|
-
className: cx7("ui-drawer", className),
|
|
362
|
-
tabIndex: -1,
|
|
363
|
-
isOpen,
|
|
364
|
-
placement,
|
|
365
|
-
duration,
|
|
366
|
-
__css: css,
|
|
367
|
-
...rest,
|
|
368
|
-
children: [
|
|
369
|
-
customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ jsx7(DrawerCloseButton, {}) : null,
|
|
370
|
-
cloneChildren
|
|
371
|
-
]
|
|
372
|
-
}
|
|
373
|
-
);
|
|
374
|
-
}
|
|
375
|
-
);
|
|
376
|
-
var DrawerOverlay = forwardRef7(
|
|
377
|
-
({ className, ...rest }, ref) => {
|
|
378
|
-
const styles = useDrawer();
|
|
379
|
-
const css = { ...styles.overlay };
|
|
380
|
-
return /* @__PURE__ */ jsx7(
|
|
381
|
-
ModalOverlay,
|
|
382
|
-
{
|
|
383
|
-
ref,
|
|
384
|
-
className: cx7("ui-drawer-overlay", className),
|
|
385
|
-
__css: css,
|
|
386
|
-
...rest
|
|
387
|
-
}
|
|
388
|
-
);
|
|
389
|
-
}
|
|
390
|
-
);
|
|
391
|
-
var DrawerCloseButton = forwardRef7(
|
|
392
|
-
({ className, ...rest }, ref) => {
|
|
393
|
-
const styles = useDrawer();
|
|
394
|
-
const css = { ...styles.closeButton };
|
|
395
|
-
return /* @__PURE__ */ jsx7(
|
|
396
|
-
ModalCloseButton,
|
|
397
|
-
{
|
|
398
|
-
ref,
|
|
399
|
-
className: cx7("ui-drawer-close-button", className),
|
|
400
|
-
__css: css,
|
|
401
|
-
...rest
|
|
402
|
-
}
|
|
403
|
-
);
|
|
404
|
-
}
|
|
405
|
-
);
|
|
406
|
-
var DrawerHeader = forwardRef7(
|
|
407
|
-
({ className, ...rest }, ref) => {
|
|
408
|
-
const styles = useDrawer();
|
|
409
|
-
const css = { ...styles.header };
|
|
410
|
-
return /* @__PURE__ */ jsx7(ModalHeader, { ref, className: cx7("ui-drawer-header", className), __css: css, ...rest });
|
|
411
|
-
}
|
|
412
|
-
);
|
|
413
|
-
var DrawerBody = forwardRef7(({ className, ...rest }, ref) => {
|
|
414
|
-
const styles = useDrawer();
|
|
415
|
-
const css = { ...styles.body };
|
|
416
|
-
return /* @__PURE__ */ jsx7(ModalBody, { ref, className: cx7("ui-drawer-body", className), __css: css, ...rest });
|
|
417
|
-
});
|
|
418
|
-
var DrawerFooter = forwardRef7(
|
|
419
|
-
({ className, ...rest }, ref) => {
|
|
420
|
-
const styles = useDrawer();
|
|
421
|
-
const css = { ...styles.footer };
|
|
422
|
-
return /* @__PURE__ */ jsx7(ModalFooter, { ref, className: cx7("ui-drawer-footer", className), __css: css, ...rest });
|
|
423
|
-
}
|
|
424
|
-
);
|
|
425
|
-
|
|
426
280
|
// src/modal.tsx
|
|
427
|
-
import { jsx as
|
|
428
|
-
var [ModalProvider, useModal] =
|
|
281
|
+
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
282
|
+
var [ModalProvider, useModal] = createContext2({
|
|
429
283
|
name: `ModalContext`,
|
|
430
284
|
errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
|
|
431
285
|
});
|
|
432
|
-
var Modal =
|
|
433
|
-
const [styles, mergedProps] =
|
|
286
|
+
var Modal = forwardRef7(({ size, ...props }, ref) => {
|
|
287
|
+
const [styles, mergedProps] = useMultiComponentStyle2("Modal", { size, ...props });
|
|
434
288
|
const {
|
|
435
289
|
className,
|
|
436
290
|
children,
|
|
@@ -456,7 +310,7 @@ var Modal = forwardRef8(({ size, ...props }, ref) => {
|
|
|
456
310
|
animation = "scale",
|
|
457
311
|
duration,
|
|
458
312
|
...rest
|
|
459
|
-
} =
|
|
313
|
+
} = omitThemeProps2(mergedProps);
|
|
460
314
|
const onKeyDown = useCallback(
|
|
461
315
|
(event) => {
|
|
462
316
|
if (event.key !== "Escape")
|
|
@@ -468,14 +322,14 @@ var Modal = forwardRef8(({ size, ...props }, ref) => {
|
|
|
468
322
|
},
|
|
469
323
|
[closeOnEsc, onClose, onEsc]
|
|
470
324
|
);
|
|
471
|
-
const validChildren =
|
|
472
|
-
const [customModalOverlay, ...cloneChildren] =
|
|
325
|
+
const validChildren = getValidChildren2(children);
|
|
326
|
+
const [customModalOverlay, ...cloneChildren] = findChildren2(
|
|
473
327
|
validChildren,
|
|
474
328
|
ModalOverlay,
|
|
475
329
|
DialogOverlay,
|
|
476
330
|
DrawerOverlay
|
|
477
331
|
);
|
|
478
|
-
let [drawerContent] =
|
|
332
|
+
let [drawerContent] = findChildren2(validChildren, DrawerContent);
|
|
479
333
|
if (drawerContent)
|
|
480
334
|
drawerContent = cloneElement(drawerContent, { onKeyDown });
|
|
481
335
|
const placement = useValue(_placement);
|
|
@@ -491,7 +345,7 @@ var Modal = forwardRef8(({ size, ...props }, ref) => {
|
|
|
491
345
|
justifyContent: placement.includes("right") ? "flex-start" : placement.includes("left") ? "flex-end" : "center",
|
|
492
346
|
alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
|
|
493
347
|
};
|
|
494
|
-
return /* @__PURE__ */
|
|
348
|
+
return /* @__PURE__ */ jsx7(
|
|
495
349
|
ModalProvider,
|
|
496
350
|
{
|
|
497
351
|
value: {
|
|
@@ -505,7 +359,7 @@ var Modal = forwardRef8(({ size, ...props }, ref) => {
|
|
|
505
359
|
duration,
|
|
506
360
|
styles
|
|
507
361
|
},
|
|
508
|
-
children: /* @__PURE__ */
|
|
362
|
+
children: /* @__PURE__ */ jsx7(AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ jsx7(Portal, { children: /* @__PURE__ */ jsx7(
|
|
509
363
|
FocusLock,
|
|
510
364
|
{
|
|
511
365
|
autoFocus,
|
|
@@ -513,15 +367,15 @@ var Modal = forwardRef8(({ size, ...props }, ref) => {
|
|
|
513
367
|
finalFocusRef,
|
|
514
368
|
restoreFocus,
|
|
515
369
|
lockFocusAcrossFrames,
|
|
516
|
-
children: /* @__PURE__ */
|
|
370
|
+
children: /* @__PURE__ */ jsx7(
|
|
517
371
|
RemoveScroll,
|
|
518
372
|
{
|
|
519
373
|
allowPinchZoom,
|
|
520
374
|
enabled: blockScrollOnMount,
|
|
521
375
|
forwardProps: true,
|
|
522
|
-
children: /* @__PURE__ */
|
|
523
|
-
customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */
|
|
524
|
-
drawerContent != null ? drawerContent : /* @__PURE__ */
|
|
376
|
+
children: /* @__PURE__ */ jsxs2(ui5.div, { __css: css, children: [
|
|
377
|
+
customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ jsx7(ModalOverlay, {}) : null,
|
|
378
|
+
drawerContent != null ? drawerContent : /* @__PURE__ */ jsx7(ModalContent, { ref, className, onKeyDown, ...rest, children: cloneChildren })
|
|
525
379
|
] })
|
|
526
380
|
}
|
|
527
381
|
)
|
|
@@ -559,11 +413,11 @@ var getModalContentProps = (animation = "scale", duration) => {
|
|
|
559
413
|
};
|
|
560
414
|
}
|
|
561
415
|
};
|
|
562
|
-
var ModalContent =
|
|
416
|
+
var ModalContent = forwardRef7(
|
|
563
417
|
({ className, children, __css, ...rest }, ref) => {
|
|
564
418
|
const { styles, scrollBehavior, withCloseButton, onClose, animation, duration } = useModal();
|
|
565
|
-
const validChildren =
|
|
566
|
-
const [customModalCloseButton, ...cloneChildren] =
|
|
419
|
+
const validChildren = getValidChildren2(children);
|
|
420
|
+
const [customModalCloseButton, ...cloneChildren] = findChildren2(
|
|
567
421
|
validChildren,
|
|
568
422
|
ModalCloseButton,
|
|
569
423
|
DialogCloseButton
|
|
@@ -578,18 +432,18 @@ var ModalContent = forwardRef8(
|
|
|
578
432
|
outline: 0,
|
|
579
433
|
...__css ? __css : styles.container
|
|
580
434
|
};
|
|
581
|
-
return /* @__PURE__ */
|
|
435
|
+
return /* @__PURE__ */ jsxs2(
|
|
582
436
|
ui5.section,
|
|
583
437
|
{
|
|
584
438
|
as: motion2.section,
|
|
585
439
|
ref,
|
|
586
|
-
className:
|
|
440
|
+
className: cx7("ui-modal", className),
|
|
587
441
|
tabIndex: -1,
|
|
588
442
|
__css: css,
|
|
589
443
|
...props,
|
|
590
444
|
...rest,
|
|
591
445
|
children: [
|
|
592
|
-
customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */
|
|
446
|
+
customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */ jsx7(ModalCloseButton, {}) : null,
|
|
593
447
|
cloneChildren
|
|
594
448
|
]
|
|
595
449
|
}
|
|
@@ -597,14 +451,155 @@ var ModalContent = forwardRef8(
|
|
|
597
451
|
}
|
|
598
452
|
);
|
|
599
453
|
|
|
454
|
+
// src/drawer.tsx
|
|
455
|
+
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
456
|
+
var [DrawerProvider, useDrawer] = createContext3({
|
|
457
|
+
name: `DrawerContext`,
|
|
458
|
+
errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
|
|
459
|
+
});
|
|
460
|
+
var Drawer = forwardRef8(({ size, ...props }, ref) => {
|
|
461
|
+
const [styles, mergedProps] = useMultiComponentStyle3("Drawer", { size, ...props });
|
|
462
|
+
const {
|
|
463
|
+
className,
|
|
464
|
+
children,
|
|
465
|
+
isOpen,
|
|
466
|
+
placement = "right",
|
|
467
|
+
onClose,
|
|
468
|
+
onOverlayClick,
|
|
469
|
+
onEsc,
|
|
470
|
+
onCloseComplete,
|
|
471
|
+
withCloseButton = true,
|
|
472
|
+
withOverlay = true,
|
|
473
|
+
allowPinchZoom,
|
|
474
|
+
autoFocus,
|
|
475
|
+
restoreFocus,
|
|
476
|
+
initialFocusRef,
|
|
477
|
+
finalFocusRef,
|
|
478
|
+
blockScrollOnMount,
|
|
479
|
+
closeOnOverlay,
|
|
480
|
+
closeOnEsc,
|
|
481
|
+
lockFocusAcrossFrames,
|
|
482
|
+
duration = { enter: 0.4, exit: 0.3 },
|
|
483
|
+
...rest
|
|
484
|
+
} = omitThemeProps3(mergedProps);
|
|
485
|
+
const validChildren = getValidChildren3(children);
|
|
486
|
+
const [customDrawerOverlay, ...cloneChildren] = findChildren3(validChildren, DrawerOverlay);
|
|
487
|
+
return /* @__PURE__ */ jsx8(DrawerProvider, { value: styles, children: /* @__PURE__ */ jsxs3(
|
|
488
|
+
Modal,
|
|
489
|
+
{
|
|
490
|
+
ref,
|
|
491
|
+
...{
|
|
492
|
+
isOpen,
|
|
493
|
+
onClose,
|
|
494
|
+
onOverlayClick,
|
|
495
|
+
onEsc,
|
|
496
|
+
onCloseComplete,
|
|
497
|
+
withCloseButton: false,
|
|
498
|
+
withOverlay: false,
|
|
499
|
+
allowPinchZoom,
|
|
500
|
+
autoFocus,
|
|
501
|
+
restoreFocus,
|
|
502
|
+
initialFocusRef,
|
|
503
|
+
finalFocusRef,
|
|
504
|
+
blockScrollOnMount,
|
|
505
|
+
closeOnOverlay,
|
|
506
|
+
closeOnEsc,
|
|
507
|
+
lockFocusAcrossFrames,
|
|
508
|
+
duration
|
|
509
|
+
},
|
|
510
|
+
children: [
|
|
511
|
+
customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ jsx8(DrawerOverlay, {}) : null,
|
|
512
|
+
/* @__PURE__ */ jsx8(DrawerContent, { ...{ placement, withCloseButton, ...rest }, children: cloneChildren })
|
|
513
|
+
]
|
|
514
|
+
}
|
|
515
|
+
) });
|
|
516
|
+
});
|
|
517
|
+
var DrawerContent = forwardRef8(
|
|
518
|
+
({ className, children, placement, withCloseButton, ...rest }, ref) => {
|
|
519
|
+
const { isOpen, onClose, duration } = useModal();
|
|
520
|
+
const styles = useDrawer();
|
|
521
|
+
const validChildren = getValidChildren3(children);
|
|
522
|
+
const [customDrawerCloseButton, ...cloneChildren] = findChildren3(
|
|
523
|
+
validChildren,
|
|
524
|
+
DrawerCloseButton
|
|
525
|
+
);
|
|
526
|
+
const css = {
|
|
527
|
+
display: "flex",
|
|
528
|
+
flexDirection: "column",
|
|
529
|
+
width: "100%",
|
|
530
|
+
outline: 0,
|
|
531
|
+
...styles.container
|
|
532
|
+
};
|
|
533
|
+
return /* @__PURE__ */ jsxs3(
|
|
534
|
+
Slide,
|
|
535
|
+
{
|
|
536
|
+
ref,
|
|
537
|
+
className: cx8("ui-drawer", className),
|
|
538
|
+
tabIndex: -1,
|
|
539
|
+
isOpen,
|
|
540
|
+
placement,
|
|
541
|
+
duration,
|
|
542
|
+
__css: css,
|
|
543
|
+
...rest,
|
|
544
|
+
children: [
|
|
545
|
+
customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ jsx8(DrawerCloseButton, {}) : null,
|
|
546
|
+
cloneChildren
|
|
547
|
+
]
|
|
548
|
+
}
|
|
549
|
+
);
|
|
550
|
+
}
|
|
551
|
+
);
|
|
552
|
+
var DrawerOverlay = forwardRef8(
|
|
553
|
+
({ className, ...rest }, ref) => {
|
|
554
|
+
const styles = useDrawer();
|
|
555
|
+
const css = { ...styles.overlay };
|
|
556
|
+
return /* @__PURE__ */ jsx8(
|
|
557
|
+
ModalOverlay,
|
|
558
|
+
{
|
|
559
|
+
ref,
|
|
560
|
+
className: cx8("ui-drawer-overlay", className),
|
|
561
|
+
__css: css,
|
|
562
|
+
...rest
|
|
563
|
+
}
|
|
564
|
+
);
|
|
565
|
+
}
|
|
566
|
+
);
|
|
567
|
+
var DrawerCloseButton = forwardRef8(
|
|
568
|
+
({ className, ...rest }, ref) => {
|
|
569
|
+
const styles = useDrawer();
|
|
570
|
+
const css = { ...styles.closeButton };
|
|
571
|
+
return /* @__PURE__ */ jsx8(
|
|
572
|
+
ModalCloseButton,
|
|
573
|
+
{
|
|
574
|
+
ref,
|
|
575
|
+
className: cx8("ui-drawer-close-button", className),
|
|
576
|
+
__css: css,
|
|
577
|
+
...rest
|
|
578
|
+
}
|
|
579
|
+
);
|
|
580
|
+
}
|
|
581
|
+
);
|
|
582
|
+
var DrawerHeader = forwardRef8(
|
|
583
|
+
({ className, ...rest }, ref) => {
|
|
584
|
+
const styles = useDrawer();
|
|
585
|
+
const css = { ...styles.header };
|
|
586
|
+
return /* @__PURE__ */ jsx8(ModalHeader, { ref, className: cx8("ui-drawer-header", className), __css: css, ...rest });
|
|
587
|
+
}
|
|
588
|
+
);
|
|
589
|
+
var DrawerBody = forwardRef8(({ className, ...rest }, ref) => {
|
|
590
|
+
const styles = useDrawer();
|
|
591
|
+
const css = { ...styles.body };
|
|
592
|
+
return /* @__PURE__ */ jsx8(ModalBody, { ref, className: cx8("ui-drawer-body", className), __css: css, ...rest });
|
|
593
|
+
});
|
|
594
|
+
var DrawerFooter = forwardRef8(
|
|
595
|
+
({ className, ...rest }, ref) => {
|
|
596
|
+
const styles = useDrawer();
|
|
597
|
+
const css = { ...styles.footer };
|
|
598
|
+
return /* @__PURE__ */ jsx8(ModalFooter, { ref, className: cx8("ui-drawer-footer", className), __css: css, ...rest });
|
|
599
|
+
}
|
|
600
|
+
);
|
|
601
|
+
|
|
600
602
|
export {
|
|
601
|
-
useModal,
|
|
602
|
-
Modal,
|
|
603
|
-
ModalOverlay,
|
|
604
|
-
ModalCloseButton,
|
|
605
|
-
ModalHeader,
|
|
606
|
-
ModalBody,
|
|
607
|
-
ModalFooter,
|
|
608
603
|
Drawer,
|
|
609
604
|
DrawerContent,
|
|
610
605
|
DrawerOverlay,
|
|
@@ -612,6 +607,13 @@ export {
|
|
|
612
607
|
DrawerHeader,
|
|
613
608
|
DrawerBody,
|
|
614
609
|
DrawerFooter,
|
|
610
|
+
useModal,
|
|
611
|
+
Modal,
|
|
612
|
+
ModalOverlay,
|
|
613
|
+
ModalCloseButton,
|
|
614
|
+
ModalHeader,
|
|
615
|
+
ModalBody,
|
|
616
|
+
ModalFooter,
|
|
615
617
|
Dialog,
|
|
616
618
|
DialogOverlay,
|
|
617
619
|
DialogCloseButton,
|
package/dist/dialog.d.ts
CHANGED
|
@@ -12,13 +12,37 @@ import '@yamada-ui/focus-lock';
|
|
|
12
12
|
import '@yamada-ui/motion';
|
|
13
13
|
|
|
14
14
|
type DialogOptions = {
|
|
15
|
+
/**
|
|
16
|
+
* The dialog header to use.
|
|
17
|
+
*/
|
|
15
18
|
header?: ReactNode;
|
|
19
|
+
/**
|
|
20
|
+
* The dialog footer to use.
|
|
21
|
+
*/
|
|
16
22
|
footer?: ReactNode;
|
|
23
|
+
/**
|
|
24
|
+
* The dialog cancel to use.
|
|
25
|
+
*/
|
|
17
26
|
cancel?: ReactNode | ButtonProps;
|
|
27
|
+
/**
|
|
28
|
+
* The dialog other to use.
|
|
29
|
+
*/
|
|
18
30
|
other?: ReactNode | ButtonProps;
|
|
31
|
+
/**
|
|
32
|
+
* The dialog success to use.
|
|
33
|
+
*/
|
|
19
34
|
success?: ReactNode | ButtonProps;
|
|
35
|
+
/**
|
|
36
|
+
* The callback invoked when cancel button clicked.
|
|
37
|
+
*/
|
|
20
38
|
onCancel?: (onClose: (() => void) | undefined) => void;
|
|
39
|
+
/**
|
|
40
|
+
* The callback invoked when other button clicked.
|
|
41
|
+
*/
|
|
21
42
|
onOther?: (onClose: (() => void) | undefined) => void;
|
|
43
|
+
/**
|
|
44
|
+
* The callback invoked when success button clicked.
|
|
45
|
+
*/
|
|
22
46
|
onSuccess?: (onClose: (() => void) | undefined) => void;
|
|
23
47
|
};
|
|
24
48
|
type DialogProps = Omit<ModalProps, keyof ThemeProps> & ThemeProps<'Dialog'> & DialogOptions;
|