@yamada-ui/modal 1.3.9 → 1.3.10-dev-20240917033401

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.
Files changed (176) hide show
  1. package/dist/chunk-2EF6C34T.mjs +35 -0
  2. package/dist/chunk-2EF6C34T.mjs.map +1 -0
  3. package/dist/chunk-2GGZOTUT.mjs +32 -0
  4. package/dist/chunk-2GGZOTUT.mjs.map +1 -0
  5. package/dist/chunk-2UHL64SV.mjs +150 -0
  6. package/dist/chunk-2UHL64SV.mjs.map +1 -0
  7. package/dist/chunk-2XQPQIQG.mjs +32 -0
  8. package/dist/chunk-2XQPQIQG.mjs.map +1 -0
  9. package/dist/chunk-3CPIBNSS.mjs +32 -0
  10. package/dist/chunk-3CPIBNSS.mjs.map +1 -0
  11. package/dist/chunk-3S4JQQU3.mjs +32 -0
  12. package/dist/chunk-3S4JQQU3.mjs.map +1 -0
  13. package/dist/chunk-4G6PCQ4G.mjs +51 -0
  14. package/dist/chunk-4G6PCQ4G.mjs.map +1 -0
  15. package/dist/chunk-4J4ISPN7.mjs +26 -0
  16. package/dist/chunk-4J4ISPN7.mjs.map +1 -0
  17. package/dist/chunk-5OKOSAXO.mjs +37 -0
  18. package/dist/chunk-5OKOSAXO.mjs.map +1 -0
  19. package/dist/chunk-B2LUOR6L.mjs +32 -0
  20. package/dist/chunk-B2LUOR6L.mjs.map +1 -0
  21. package/dist/chunk-B436JYPR.mjs +34 -0
  22. package/dist/chunk-B436JYPR.mjs.map +1 -0
  23. package/dist/chunk-CW5ZZAAV.mjs +34 -0
  24. package/dist/chunk-CW5ZZAAV.mjs.map +1 -0
  25. package/dist/chunk-DV6BTDBZ.mjs +32 -0
  26. package/dist/chunk-DV6BTDBZ.mjs.map +1 -0
  27. package/dist/chunk-G646NVHY.mjs +176 -0
  28. package/dist/chunk-G646NVHY.mjs.map +1 -0
  29. package/dist/chunk-HM447TIY.mjs +32 -0
  30. package/dist/chunk-HM447TIY.mjs.map +1 -0
  31. package/dist/chunk-I6LPF3F6.mjs +95 -0
  32. package/dist/chunk-I6LPF3F6.mjs.map +1 -0
  33. package/dist/chunk-OFDDT2JT.mjs +32 -0
  34. package/dist/chunk-OFDDT2JT.mjs.map +1 -0
  35. package/dist/chunk-RSAJUBWR.mjs +32 -0
  36. package/dist/chunk-RSAJUBWR.mjs.map +1 -0
  37. package/dist/chunk-WEDZHILB.mjs +29 -0
  38. package/dist/chunk-WEDZHILB.mjs.map +1 -0
  39. package/dist/chunk-Y2QXIJZA.mjs +138 -0
  40. package/dist/chunk-Y2QXIJZA.mjs.map +1 -0
  41. package/dist/chunk-Y5NCRCDU.mjs +32 -0
  42. package/dist/chunk-Y5NCRCDU.mjs.map +1 -0
  43. package/dist/chunk-ZR2AEIGZ.mjs +116 -0
  44. package/dist/chunk-ZR2AEIGZ.mjs.map +1 -0
  45. package/dist/dialog-body.d.mts +8 -0
  46. package/dist/dialog-body.d.ts +8 -0
  47. package/dist/dialog-body.js +94 -0
  48. package/dist/dialog-body.js.map +1 -0
  49. package/dist/dialog-body.mjs +10 -0
  50. package/dist/dialog-body.mjs.map +1 -0
  51. package/dist/dialog-close-button.d.mts +8 -0
  52. package/dist/dialog-close-button.d.ts +8 -0
  53. package/dist/dialog-close-button.js +96 -0
  54. package/dist/dialog-close-button.js.map +1 -0
  55. package/dist/dialog-close-button.mjs +10 -0
  56. package/dist/dialog-close-button.mjs.map +1 -0
  57. package/dist/dialog-footer.d.mts +8 -0
  58. package/dist/dialog-footer.d.ts +8 -0
  59. package/dist/dialog-footer.js +91 -0
  60. package/dist/dialog-footer.js.map +1 -0
  61. package/dist/dialog-footer.mjs +10 -0
  62. package/dist/dialog-footer.mjs.map +1 -0
  63. package/dist/dialog-header.d.mts +8 -0
  64. package/dist/dialog-header.d.ts +8 -0
  65. package/dist/dialog-header.js +91 -0
  66. package/dist/dialog-header.js.map +1 -0
  67. package/dist/dialog-header.mjs +10 -0
  68. package/dist/dialog-header.mjs.map +1 -0
  69. package/dist/dialog-overlay.d.mts +8 -0
  70. package/dist/dialog-overlay.d.ts +8 -0
  71. package/dist/dialog-overlay.js +108 -0
  72. package/dist/dialog-overlay.js.map +1 -0
  73. package/dist/dialog-overlay.mjs +10 -0
  74. package/dist/dialog-overlay.mjs.map +1 -0
  75. package/dist/dialog.d.mts +7 -21
  76. package/dist/dialog.d.ts +7 -21
  77. package/dist/dialog.js +593 -678
  78. package/dist/dialog.js.map +1 -1
  79. package/dist/dialog.mjs +20 -13
  80. package/dist/drawer-body.d.mts +8 -0
  81. package/dist/drawer-body.d.ts +8 -0
  82. package/dist/drawer-body.js +94 -0
  83. package/dist/drawer-body.js.map +1 -0
  84. package/dist/drawer-body.mjs +10 -0
  85. package/dist/drawer-body.mjs.map +1 -0
  86. package/dist/drawer-close-button.d.mts +9 -0
  87. package/dist/drawer-close-button.d.ts +9 -0
  88. package/dist/drawer-close-button.js +96 -0
  89. package/dist/drawer-close-button.js.map +1 -0
  90. package/dist/drawer-close-button.mjs +10 -0
  91. package/dist/drawer-close-button.mjs.map +1 -0
  92. package/dist/drawer-content.d.mts +16 -0
  93. package/dist/drawer-content.d.ts +16 -0
  94. package/dist/drawer-content.js +278 -0
  95. package/dist/drawer-content.js.map +1 -0
  96. package/dist/drawer-content.mjs +12 -0
  97. package/dist/drawer-content.mjs.map +1 -0
  98. package/dist/drawer-drag-bar.d.mts +8 -0
  99. package/dist/drawer-drag-bar.d.ts +8 -0
  100. package/dist/drawer-drag-bar.js +66 -0
  101. package/dist/drawer-drag-bar.js.map +1 -0
  102. package/dist/drawer-drag-bar.mjs +9 -0
  103. package/dist/drawer-drag-bar.mjs.map +1 -0
  104. package/dist/drawer-footer.d.mts +8 -0
  105. package/dist/drawer-footer.d.ts +8 -0
  106. package/dist/drawer-footer.js +91 -0
  107. package/dist/drawer-footer.js.map +1 -0
  108. package/dist/drawer-footer.mjs +10 -0
  109. package/dist/drawer-footer.mjs.map +1 -0
  110. package/dist/drawer-header.d.mts +8 -0
  111. package/dist/drawer-header.d.ts +8 -0
  112. package/dist/drawer-header.js +91 -0
  113. package/dist/drawer-header.js.map +1 -0
  114. package/dist/drawer-header.mjs +10 -0
  115. package/dist/drawer-header.mjs.map +1 -0
  116. package/dist/drawer-overlay.d.mts +8 -0
  117. package/dist/drawer-overlay.d.ts +8 -0
  118. package/dist/drawer-overlay.js +108 -0
  119. package/dist/drawer-overlay.js.map +1 -0
  120. package/dist/drawer-overlay.mjs +10 -0
  121. package/dist/drawer-overlay.mjs.map +1 -0
  122. package/dist/drawer.d.mts +8 -27
  123. package/dist/drawer.d.ts +8 -27
  124. package/dist/drawer.js +405 -640
  125. package/dist/drawer.js.map +1 -1
  126. package/dist/drawer.mjs +14 -17
  127. package/dist/index.d.mts +13 -2
  128. package/dist/index.d.ts +13 -2
  129. package/dist/index.js +492 -413
  130. package/dist/index.js.map +1 -1
  131. package/dist/index.mjs +56 -18
  132. package/dist/modal-body.d.mts +3 -2
  133. package/dist/modal-body.d.ts +3 -2
  134. package/dist/modal-body.js +13 -856
  135. package/dist/modal-body.js.map +1 -1
  136. package/dist/modal-body.mjs +2 -1
  137. package/dist/modal-close-button.d.mts +3 -2
  138. package/dist/modal-close-button.d.ts +3 -2
  139. package/dist/modal-close-button.js +13 -854
  140. package/dist/modal-close-button.js.map +1 -1
  141. package/dist/modal-close-button.mjs +2 -1
  142. package/dist/modal-content.d.mts +9 -0
  143. package/dist/modal-content.d.ts +9 -0
  144. package/dist/modal-content.js +178 -0
  145. package/dist/modal-content.js.map +1 -0
  146. package/dist/modal-content.mjs +11 -0
  147. package/dist/modal-content.mjs.map +1 -0
  148. package/dist/modal-context.d.mts +27 -0
  149. package/dist/modal-context.d.ts +27 -0
  150. package/dist/modal-context.js +54 -0
  151. package/dist/modal-context.js.map +1 -0
  152. package/dist/modal-context.mjs +18 -0
  153. package/dist/modal-context.mjs.map +1 -0
  154. package/dist/modal-footer.d.mts +2 -1
  155. package/dist/modal-footer.d.ts +2 -1
  156. package/dist/modal-footer.js +13 -857
  157. package/dist/modal-footer.js.map +1 -1
  158. package/dist/modal-footer.mjs +2 -1
  159. package/dist/modal-header.d.mts +2 -1
  160. package/dist/modal-header.d.ts +2 -1
  161. package/dist/modal-header.js +13 -857
  162. package/dist/modal-header.js.map +1 -1
  163. package/dist/modal-header.mjs +2 -1
  164. package/dist/modal-overlay.d.mts +2 -1
  165. package/dist/modal-overlay.d.ts +2 -1
  166. package/dist/modal-overlay.js +16 -843
  167. package/dist/modal-overlay.js.map +1 -1
  168. package/dist/modal-overlay.mjs +2 -1
  169. package/dist/modal.d.mts +10 -14
  170. package/dist/modal.d.ts +10 -14
  171. package/dist/modal.js +183 -508
  172. package/dist/modal.js.map +1 -1
  173. package/dist/modal.mjs +13 -5
  174. package/package.json +10 -10
  175. package/dist/chunk-7PS3HWMF.mjs +0 -938
  176. package/dist/chunk-7PS3HWMF.mjs.map +0 -1
package/dist/index.js CHANGED
@@ -43,121 +43,175 @@ __export(src_exports, {
43
43
  module.exports = __toCommonJS(src_exports);
44
44
 
45
45
  // src/modal.tsx
46
- var import_core2 = require("@yamada-ui/core");
46
+ var import_core6 = require("@yamada-ui/core");
47
47
  var import_focus_lock = require("@yamada-ui/focus-lock");
48
- var import_motion2 = require("@yamada-ui/motion");
48
+ var import_motion6 = require("@yamada-ui/motion");
49
49
  var import_portal = require("@yamada-ui/portal");
50
- var import_transitions2 = require("@yamada-ui/transitions");
51
50
  var import_use_value2 = require("@yamada-ui/use-value");
52
- var import_utils2 = require("@yamada-ui/utils");
51
+ var import_utils11 = require("@yamada-ui/utils");
53
52
  var import_react2 = require("react");
54
53
  var import_react_remove_scroll = require("react-remove-scroll");
55
54
 
56
- // src/drawer.tsx
57
- var import_core = require("@yamada-ui/core");
58
- var import_motion = require("@yamada-ui/motion");
59
- var import_transitions = require("@yamada-ui/transitions");
60
- var import_use_value = require("@yamada-ui/use-value");
55
+ // src/dialog-overlay.tsx
56
+ var import_motion2 = require("@yamada-ui/motion");
57
+ var import_utils3 = require("@yamada-ui/utils");
58
+
59
+ // src/modal-context.ts
61
60
  var import_utils = require("@yamada-ui/utils");
62
- var import_react = require("react");
63
- var import_jsx_runtime = require("react/jsx-runtime");
61
+ var [ModalProvider, useModal] = (0, import_utils.createContext)({
62
+ name: `ModalContext`,
63
+ errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
64
+ });
65
+ var [DialogProvider, useDialog] = (0, import_utils.createContext)({
66
+ name: `DialogContext`,
67
+ errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
68
+ });
64
69
  var [DrawerProvider, useDrawer] = (0, import_utils.createContext)({
65
70
  name: `DrawerContext`,
66
71
  errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
67
72
  });
68
- var Drawer = (0, import_motion.motionForwardRef)(
69
- ({ size, placement = "right", closeOnDrag = false, ...props }, ref) => {
70
- const [styles, mergedProps] = (0, import_core.useMultiComponentStyle)("Drawer", {
71
- size,
72
- placement,
73
- closeOnDrag,
74
- ...props
75
- });
73
+
74
+ // src/modal-overlay.tsx
75
+ var import_motion = require("@yamada-ui/motion");
76
+ var import_transitions = require("@yamada-ui/transitions");
77
+ var import_utils2 = require("@yamada-ui/utils");
78
+ var import_jsx_runtime = require("react/jsx-runtime");
79
+ var ModalOverlay = (0, import_motion.motionForwardRef)(
80
+ ({ className, __css, onClick, ...rest }, ref) => {
76
81
  const {
77
- children,
78
- isOpen,
79
- onClose,
80
- onOverlayClick,
81
- onEsc,
82
- onCloseComplete,
83
- withCloseButton = !closeOnDrag,
84
- withOverlay = true,
85
- withDragBar = true,
86
- allowPinchZoom,
87
- autoFocus,
88
- restoreFocus,
89
- initialFocusRef,
90
- finalFocusRef,
91
- blockScrollOnMount,
82
+ styles,
92
83
  closeOnOverlay,
93
- closeOnEsc,
94
- lockFocusAcrossFrames,
95
- duration = { enter: 0.4, exit: 0.3 },
96
- dragConstraints = 0,
97
- dragElastic = 0.1,
98
- dragOffset = 80,
99
- dragVelocity = 100,
100
- blankForDragProps,
101
- portalProps,
102
- containerProps,
103
- ...rest
104
- } = (0, import_core.omitThemeProps)(mergedProps, ["isFullHeight"]);
105
- const validChildren = (0, import_utils.getValidChildren)(children);
106
- const [customDrawerOverlay, ...cloneChildren] = (0, import_utils.findChildren)(
107
- validChildren,
108
- DrawerOverlay
84
+ onOverlayClick,
85
+ onClose,
86
+ animation,
87
+ duration
88
+ } = useModal();
89
+ const css = {
90
+ position: "fixed",
91
+ top: 0,
92
+ left: 0,
93
+ w: "100vw",
94
+ h: "100vh",
95
+ ...__css ? __css : styles.overlay
96
+ };
97
+ const props = animation !== "none" ? import_transitions.fadeProps : {};
98
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
99
+ import_motion.motion.div,
100
+ {
101
+ ref,
102
+ className: (0, import_utils2.cx)("ui-modal__overlay", className),
103
+ custom: { duration },
104
+ __css: css,
105
+ onClick: (0, import_utils2.handlerAll)(onClick, onOverlayClick, (ev) => {
106
+ ev.stopPropagation();
107
+ if (closeOnOverlay) onClose == null ? void 0 : onClose();
108
+ }),
109
+ ...props,
110
+ ...rest
111
+ }
109
112
  );
110
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
111
- Modal,
113
+ }
114
+ );
115
+
116
+ // src/dialog-overlay.tsx
117
+ var import_jsx_runtime2 = require("react/jsx-runtime");
118
+ var DialogOverlay = (0, import_motion2.motionForwardRef)(
119
+ ({ className, ...rest }, ref) => {
120
+ const styles = useDialog();
121
+ const css = { ...styles.overlay };
122
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
123
+ ModalOverlay,
112
124
  {
113
125
  ref,
114
- ...{
115
- isOpen,
116
- onClose,
117
- onOverlayClick,
118
- onEsc,
119
- onCloseComplete,
120
- withCloseButton: false,
121
- withOverlay: false,
122
- allowPinchZoom,
123
- autoFocus,
124
- restoreFocus,
125
- initialFocusRef,
126
- finalFocusRef,
127
- blockScrollOnMount,
128
- closeOnOverlay,
129
- closeOnEsc,
130
- lockFocusAcrossFrames,
131
- duration,
132
- portalProps,
133
- containerProps
134
- },
135
- children: [
136
- customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerOverlay, {}) : null,
137
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
138
- DrawerContent,
139
- {
140
- ...{
141
- dragConstraints,
142
- dragElastic,
143
- dragOffset,
144
- dragVelocity,
145
- withCloseButton,
146
- withDragBar,
147
- blankForDragProps,
148
- ...rest,
149
- placement,
150
- closeOnDrag
151
- },
152
- children: cloneChildren
153
- }
154
- )
155
- ]
126
+ className: (0, import_utils3.cx)("ui-dialog__overlay", className),
127
+ __css: css,
128
+ ...rest
156
129
  }
157
- ) });
130
+ );
131
+ }
132
+ );
133
+
134
+ // src/drawer-content.tsx
135
+ var import_core4 = require("@yamada-ui/core");
136
+ var import_motion3 = require("@yamada-ui/motion");
137
+ var import_transitions2 = require("@yamada-ui/transitions");
138
+ var import_use_value = require("@yamada-ui/use-value");
139
+ var import_utils7 = require("@yamada-ui/utils");
140
+ var import_react = require("react");
141
+
142
+ // src/drawer-close-button.tsx
143
+ var import_core2 = require("@yamada-ui/core");
144
+ var import_utils5 = require("@yamada-ui/utils");
145
+
146
+ // src/modal-close-button.tsx
147
+ var import_close_button = require("@yamada-ui/close-button");
148
+ var import_core = require("@yamada-ui/core");
149
+ var import_utils4 = require("@yamada-ui/utils");
150
+ var import_jsx_runtime3 = require("react/jsx-runtime");
151
+ var ModalCloseButton = (0, import_core.forwardRef)(
152
+ ({ onClick, __css, ...rest }, ref) => {
153
+ const { styles, onClose } = useModal();
154
+ const css = {
155
+ position: "absolute",
156
+ ...__css ? __css : styles.closeButton
157
+ };
158
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
159
+ import_close_button.CloseButton,
160
+ {
161
+ ref,
162
+ className: (0, import_utils4.cx)("ui-modal__close-button"),
163
+ __css: css,
164
+ onClick: (0, import_utils4.handlerAll)(onClick, (ev) => {
165
+ ev.stopPropagation();
166
+ onClose == null ? void 0 : onClose();
167
+ }),
168
+ ...rest
169
+ }
170
+ );
171
+ }
172
+ );
173
+
174
+ // src/drawer-close-button.tsx
175
+ var import_jsx_runtime4 = require("react/jsx-runtime");
176
+ var DrawerCloseButton = (0, import_core2.forwardRef)(
177
+ ({ className, ...rest }, ref) => {
178
+ const styles = useDrawer();
179
+ const css = { ...styles.closeButton };
180
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
181
+ ModalCloseButton,
182
+ {
183
+ ref,
184
+ className: (0, import_utils5.cx)("ui-drawer__close-button", className),
185
+ __css: css,
186
+ ...rest
187
+ }
188
+ );
189
+ }
190
+ );
191
+
192
+ // src/drawer-drag-bar.tsx
193
+ var import_core3 = require("@yamada-ui/core");
194
+ var import_utils6 = require("@yamada-ui/utils");
195
+ var import_jsx_runtime5 = require("react/jsx-runtime");
196
+ var DrawerDragBar = (0, import_core3.forwardRef)(
197
+ ({ className, __css, ...rest }, ref) => {
198
+ const styles = useDrawer();
199
+ const css = { ...styles.dragBar };
200
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
201
+ import_core3.ui.div,
202
+ {
203
+ ref,
204
+ className: (0, import_utils6.cx)("ui-drawer__drag-bar", className),
205
+ __css: css,
206
+ ...rest
207
+ }
208
+ );
158
209
  }
159
210
  );
160
- var DrawerContent = (0, import_motion.motionForwardRef)(
211
+
212
+ // src/drawer-content.tsx
213
+ var import_jsx_runtime6 = require("react/jsx-runtime");
214
+ var DrawerContent = (0, import_motion3.motionForwardRef)(
161
215
  ({
162
216
  className,
163
217
  children,
@@ -175,8 +229,8 @@ var DrawerContent = (0, import_motion.motionForwardRef)(
175
229
  const { isOpen, onClose, duration } = useModal();
176
230
  const styles = useDrawer();
177
231
  const placement = (0, import_use_value.useValue)(_placement);
178
- const validChildren = (0, import_utils.getValidChildren)(children);
179
- const [customDrawerCloseButton, ...cloneChildren] = (0, import_utils.findChildren)(
232
+ const validChildren = (0, import_utils7.getValidChildren)(children);
233
+ const [customDrawerCloseButton, ...cloneChildren] = (0, import_utils7.findChildren)(
180
234
  validChildren,
181
235
  DrawerCloseButton
182
236
  );
@@ -185,7 +239,7 @@ var DrawerContent = (0, import_motion.motionForwardRef)(
185
239
  const propBg = (_c = (_b = (_a = rest.backgroundColor) != null ? _a : rest.bgColor) != null ? _b : rest.background) != null ? _c : rest.bg;
186
240
  const styleBg = (_j = (_h = (_f = (_d = styles.container) == null ? void 0 : _d.backgroundColor) != null ? _f : (_e = styles.container) == null ? void 0 : _e.bgColor) != null ? _h : (_g = styles.container) == null ? void 0 : _g.background) != null ? _j : (_i = styles.container) == null ? void 0 : _i.bg;
187
241
  const computedBg = propBg != null ? propBg : styleBg;
188
- return (0, import_utils.isArray)(computedBg) ? computedBg : [computedBg];
242
+ return (0, import_utils7.isArray)(computedBg) ? computedBg : [computedBg];
189
243
  }, [rest, styles]);
190
244
  const blankForDrag = (0, import_react.useMemo)(() => {
191
245
  let position = {};
@@ -272,11 +326,11 @@ var DrawerContent = (0, import_motion.motionForwardRef)(
272
326
  },
273
327
  [placement, dragVelocity, dragOffset]
274
328
  );
275
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
276
- import_transitions.Slide,
329
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
330
+ import_transitions2.Slide,
277
331
  {
278
332
  ref,
279
- className: (0, import_utils.cx)("ui-drawer", className),
333
+ className: (0, import_utils7.cx)("ui-drawer", className),
280
334
  isOpen,
281
335
  placement,
282
336
  duration,
@@ -292,122 +346,150 @@ var DrawerContent = (0, import_motion.motionForwardRef)(
292
346
  __css: css,
293
347
  ...rest,
294
348
  children: [
295
- customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerCloseButton, {}) : null,
296
- withDragBar && closeOnDrag && (placement === "bottom" || placement === "right") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerDragBar, {}) : null,
297
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
298
- import_core.ui.div,
349
+ customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerCloseButton, {}) : null,
350
+ withDragBar && closeOnDrag && (placement === "bottom" || placement === "right") ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDragBar, {}) : null,
351
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
352
+ import_core4.ui.div,
299
353
  {
300
354
  className: "ui-drawer__inner",
301
355
  __css: { display: "flex", flexDirection: "column", ...styles.inner },
302
356
  children: cloneChildren
303
357
  }
304
358
  ),
305
- withDragBar && closeOnDrag && (placement === "top" || placement === "left") ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(DrawerDragBar, {}) : null
359
+ withDragBar && closeOnDrag && (placement === "top" || placement === "left") ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDragBar, {}) : null
306
360
  ]
307
361
  }
308
362
  );
309
363
  }
310
364
  );
311
- var DrawerOverlay = (0, import_motion.motionForwardRef)(
365
+
366
+ // src/drawer-overlay.tsx
367
+ var import_motion4 = require("@yamada-ui/motion");
368
+ var import_utils8 = require("@yamada-ui/utils");
369
+ var import_jsx_runtime7 = require("react/jsx-runtime");
370
+ var DrawerOverlay = (0, import_motion4.motionForwardRef)(
312
371
  ({ className, ...rest }, ref) => {
313
372
  const styles = useDrawer();
314
373
  const css = { ...styles.overlay };
315
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
374
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
316
375
  ModalOverlay,
317
376
  {
318
377
  ref,
319
- className: (0, import_utils.cx)("ui-drawer__overlay", className),
378
+ className: (0, import_utils8.cx)("ui-drawer__overlay", className),
320
379
  __css: css,
321
380
  ...rest
322
381
  }
323
382
  );
324
383
  }
325
384
  );
326
- var DrawerDragBar = ({
327
- className,
328
- ...rest
329
- }) => {
330
- const styles = useDrawer();
331
- const css = { ...styles.dragBar };
332
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
333
- import_core.ui.div,
334
- {
335
- className: (0, import_utils.cx)("ui-drawer__drag-bar", className),
336
- __css: css,
337
- ...rest
338
- }
339
- );
340
- };
341
- var DrawerCloseButton = (0, import_core.forwardRef)(
385
+
386
+ // src/modal-content.tsx
387
+ var import_motion5 = require("@yamada-ui/motion");
388
+ var import_transitions3 = require("@yamada-ui/transitions");
389
+ var import_utils10 = require("@yamada-ui/utils");
390
+
391
+ // src/dialog-close-button.tsx
392
+ var import_core5 = require("@yamada-ui/core");
393
+ var import_utils9 = require("@yamada-ui/utils");
394
+ var import_jsx_runtime8 = require("react/jsx-runtime");
395
+ var DialogCloseButton = (0, import_core5.forwardRef)(
342
396
  ({ className, ...rest }, ref) => {
343
- const styles = useDrawer();
397
+ const styles = useDialog();
344
398
  const css = { ...styles.closeButton };
345
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
399
+ return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
346
400
  ModalCloseButton,
347
401
  {
348
402
  ref,
349
- className: (0, import_utils.cx)("ui-drawer__close-button", className),
350
- __css: css,
351
- ...rest
352
- }
353
- );
354
- }
355
- );
356
- var DrawerHeader = (0, import_core.forwardRef)(
357
- ({ className, ...rest }, ref) => {
358
- const styles = useDrawer();
359
- const css = { ...styles.header };
360
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
361
- ModalHeader,
362
- {
363
- ref,
364
- className: (0, import_utils.cx)("ui-drawer__header", className),
403
+ className: (0, import_utils9.cx)("ui-dialog__close-button", className),
365
404
  __css: css,
366
405
  ...rest
367
406
  }
368
407
  );
369
408
  }
370
409
  );
371
- var DrawerBody = (0, import_core.forwardRef)(
372
- ({ className, ...rest }, ref) => {
373
- const styles = useDrawer();
374
- const css = { ...styles.body };
375
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
376
- ModalBody,
377
- {
378
- ref,
379
- className: (0, import_utils.cx)("ui-drawer__body", className),
380
- __css: css,
381
- ...rest
382
- }
383
- );
384
- }
385
- );
386
- var DrawerFooter = (0, import_core.forwardRef)(
387
- ({ className, ...rest }, ref) => {
388
- const styles = useDrawer();
389
- const css = { ...styles.footer };
390
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
391
- ModalFooter,
410
+
411
+ // src/modal-content.tsx
412
+ var import_jsx_runtime9 = require("react/jsx-runtime");
413
+ var getModalContentProps = (animation = "scale", duration) => {
414
+ switch (animation) {
415
+ case "scale":
416
+ return {
417
+ ...import_transitions3.scaleFadeProps,
418
+ custom: { scale: 0.95, reverse: true, duration }
419
+ };
420
+ case "top":
421
+ return {
422
+ ...import_transitions3.slideFadeProps,
423
+ custom: { offsetY: -16, reverse: true, duration }
424
+ };
425
+ case "right":
426
+ return {
427
+ ...import_transitions3.slideFadeProps,
428
+ custom: { offsetX: 16, reverse: true, duration }
429
+ };
430
+ case "left":
431
+ return {
432
+ ...import_transitions3.slideFadeProps,
433
+ custom: { offsetX: -16, reverse: true, duration }
434
+ };
435
+ case "bottom":
436
+ return {
437
+ ...import_transitions3.slideFadeProps,
438
+ custom: { offsetY: 16, reverse: true, duration }
439
+ };
440
+ }
441
+ };
442
+ var ModalContent = (0, import_motion5.motionForwardRef)(
443
+ ({ className, children, __css, ...rest }, ref) => {
444
+ const {
445
+ styles,
446
+ scrollBehavior,
447
+ withCloseButton,
448
+ onClose,
449
+ animation,
450
+ duration
451
+ } = useModal();
452
+ const validChildren = (0, import_utils10.getValidChildren)(children);
453
+ const [customModalCloseButton, ...cloneChildren] = (0, import_utils10.findChildren)(
454
+ validChildren,
455
+ ModalCloseButton,
456
+ DialogCloseButton
457
+ );
458
+ const props = animation !== "none" ? getModalContentProps(animation, duration) : {};
459
+ const css = {
460
+ position: "relative",
461
+ maxH: "100%",
462
+ display: "flex",
463
+ flexDirection: "column",
464
+ overflow: scrollBehavior === "inside" ? "hidden" : "auto",
465
+ outline: 0,
466
+ ...__css ? __css : styles.container
467
+ };
468
+ return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
469
+ import_motion5.motion.section,
392
470
  {
471
+ role: "dialog",
472
+ "aria-modal": "true",
393
473
  ref,
394
- className: (0, import_utils.cx)("ui-drawer__footer", className),
474
+ className: (0, import_utils10.cx)("ui-modal", className),
475
+ tabIndex: -1,
395
476
  __css: css,
396
- ...rest
477
+ ...props,
478
+ ...rest,
479
+ children: [
480
+ customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModalCloseButton, {}) : null,
481
+ cloneChildren
482
+ ]
397
483
  }
398
484
  );
399
485
  }
400
486
  );
401
487
 
402
488
  // src/modal.tsx
403
- var import_jsx_runtime2 = require("react/jsx-runtime");
404
- var [ModalProvider, useModal] = (0, import_utils2.createContext)({
405
- name: `ModalContext`,
406
- errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
407
- });
408
- var Modal = (0, import_motion2.motionForwardRef)(
489
+ var import_jsx_runtime10 = require("react/jsx-runtime");
490
+ var Modal = (0, import_motion6.motionForwardRef)(
409
491
  ({ size, ...props }, ref) => {
410
- const [styles, mergedProps] = (0, import_core2.useMultiComponentStyle)("Modal", {
492
+ const [styles, mergedProps] = (0, import_core6.useComponentMultiStyle)("Modal", {
411
493
  size,
412
494
  ...props
413
495
  });
@@ -438,7 +520,7 @@ var Modal = (0, import_motion2.motionForwardRef)(
438
520
  portalProps,
439
521
  containerProps,
440
522
  ...rest
441
- } = (0, import_core2.omitThemeProps)(mergedProps);
523
+ } = (0, import_core6.omitThemeProps)(mergedProps);
442
524
  const onKeyDown = (0, import_react2.useCallback)(
443
525
  (ev) => {
444
526
  if (ev.key !== "Escape") return;
@@ -448,14 +530,14 @@ var Modal = (0, import_motion2.motionForwardRef)(
448
530
  },
449
531
  [closeOnEsc, onClose, onEsc]
450
532
  );
451
- const validChildren = (0, import_utils2.getValidChildren)(children);
452
- const [customModalOverlay, ...cloneChildren] = (0, import_utils2.findChildren)(
533
+ const validChildren = (0, import_utils11.getValidChildren)(children);
534
+ const [customModalOverlay, ...cloneChildren] = (0, import_utils11.findChildren)(
453
535
  validChildren,
454
536
  ModalOverlay,
455
537
  DialogOverlay,
456
538
  DrawerOverlay
457
539
  );
458
- let [drawerContent] = (0, import_utils2.findChildren)(validChildren, DrawerContent);
540
+ let [drawerContent] = (0, import_utils11.findChildren)(validChildren, DrawerContent);
459
541
  if (drawerContent)
460
542
  drawerContent = (0, import_react2.cloneElement)(drawerContent, { onKeyDown });
461
543
  const placement = (0, import_use_value2.useValue)(_placement);
@@ -471,7 +553,7 @@ var Modal = (0, import_motion2.motionForwardRef)(
471
553
  justifyContent: placement.includes("left") ? "flex-start" : placement.includes("right") ? "flex-end" : "center",
472
554
  alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
473
555
  };
474
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
556
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
475
557
  ModalProvider,
476
558
  {
477
559
  value: {
@@ -485,7 +567,7 @@ var Modal = (0, import_motion2.motionForwardRef)(
485
567
  duration,
486
568
  styles
487
569
  },
488
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_motion2.AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
570
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_motion6.AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_portal.Portal, { ...portalProps, children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
489
571
  import_focus_lock.FocusLock,
490
572
  {
491
573
  autoFocus,
@@ -493,15 +575,15 @@ var Modal = (0, import_motion2.motionForwardRef)(
493
575
  finalFocusRef,
494
576
  restoreFocus,
495
577
  lockFocusAcrossFrames,
496
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
578
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
497
579
  import_react_remove_scroll.RemoveScroll,
498
580
  {
499
581
  allowPinchZoom,
500
582
  enabled: blockScrollOnMount,
501
583
  forwardProps: true,
502
- children: /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(import_core2.ui.div, { __css: css, ...containerProps, children: [
503
- customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ModalOverlay, {}) : null,
504
- drawerContent != null ? drawerContent : /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
584
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_core6.ui.div, { __css: css, ...containerProps, children: [
585
+ customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ModalOverlay, {}) : null,
586
+ drawerContent != null ? drawerContent : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
505
587
  ModalContent,
506
588
  {
507
589
  ref,
@@ -520,169 +602,102 @@ var Modal = (0, import_motion2.motionForwardRef)(
520
602
  );
521
603
  }
522
604
  );
523
- var getModalContentProps = (animation = "scale", duration) => {
524
- switch (animation) {
525
- case "scale":
526
- return {
527
- ...import_transitions2.scaleFadeProps,
528
- custom: { scale: 0.95, reverse: true, duration }
529
- };
530
- case "top":
531
- return {
532
- ...import_transitions2.slideFadeProps,
533
- custom: { offsetY: -16, reverse: true, duration }
534
- };
535
- case "right":
536
- return {
537
- ...import_transitions2.slideFadeProps,
538
- custom: { offsetX: 16, reverse: true, duration }
539
- };
540
- case "left":
541
- return {
542
- ...import_transitions2.slideFadeProps,
543
- custom: { offsetX: -16, reverse: true, duration }
544
- };
545
- case "bottom":
546
- return {
547
- ...import_transitions2.slideFadeProps,
548
- custom: { offsetY: 16, reverse: true, duration }
549
- };
550
- }
551
- };
552
- var ModalContent = (0, import_motion2.motionForwardRef)(
553
- ({ className, children, __css, ...rest }, ref) => {
554
- const {
555
- styles,
556
- scrollBehavior,
557
- withCloseButton,
558
- onClose,
559
- animation,
560
- duration
561
- } = useModal();
562
- const validChildren = (0, import_utils2.getValidChildren)(children);
563
- const [customModalCloseButton, ...cloneChildren] = (0, import_utils2.findChildren)(
564
- validChildren,
565
- ModalCloseButton,
566
- DialogCloseButton
567
- );
568
- const props = animation !== "none" ? getModalContentProps(animation, duration) : {};
605
+
606
+ // src/modal-header.tsx
607
+ var import_core7 = require("@yamada-ui/core");
608
+ var import_utils12 = require("@yamada-ui/utils");
609
+ var import_jsx_runtime11 = require("react/jsx-runtime");
610
+ var ModalHeader = (0, import_core7.forwardRef)(
611
+ ({ className, __css, ...rest }, ref) => {
612
+ const { styles } = useModal();
569
613
  const css = {
570
- position: "relative",
571
- maxH: "100%",
572
614
  display: "flex",
573
- flexDirection: "column",
574
- overflow: scrollBehavior === "inside" ? "hidden" : "auto",
575
- outline: 0,
576
- ...__css ? __css : styles.container
615
+ alignItems: "center",
616
+ justifyContent: "flex-start",
617
+ ...__css ? __css : styles.header
577
618
  };
578
- return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
579
- import_motion2.motion.section,
619
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
620
+ import_core7.ui.header,
580
621
  {
581
- role: "dialog",
582
- "aria-modal": "true",
583
622
  ref,
584
- className: (0, import_utils2.cx)("ui-modal", className),
585
- tabIndex: -1,
623
+ className: (0, import_utils12.cx)("ui-modal__header", className),
586
624
  __css: css,
587
- ...props,
588
- ...rest,
589
- children: [
590
- customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(ModalCloseButton, {}) : null,
591
- cloneChildren
592
- ]
625
+ ...rest
593
626
  }
594
627
  );
595
628
  }
596
629
  );
597
630
 
598
- // src/modal-overlay.tsx
599
- var import_motion3 = require("@yamada-ui/motion");
600
- var import_transitions3 = require("@yamada-ui/transitions");
601
- var import_utils3 = require("@yamada-ui/utils");
602
- var import_jsx_runtime3 = require("react/jsx-runtime");
603
- var ModalOverlay = (0, import_motion3.motionForwardRef)(
604
- ({ className, __css, onClick, ...rest }, ref) => {
605
- const {
606
- styles,
607
- closeOnOverlay,
608
- onOverlayClick,
609
- onClose,
610
- animation,
611
- duration
612
- } = useModal();
631
+ // src/modal-body.tsx
632
+ var import_core8 = require("@yamada-ui/core");
633
+ var import_utils13 = require("@yamada-ui/utils");
634
+ var import_jsx_runtime12 = require("react/jsx-runtime");
635
+ var ModalBody = (0, import_core8.forwardRef)(
636
+ ({ className, __css, ...rest }, ref) => {
637
+ const { styles, scrollBehavior } = useModal();
613
638
  const css = {
614
- position: "fixed",
615
- top: 0,
616
- left: 0,
617
- w: "100vw",
618
- h: "100vh",
619
- ...__css ? __css : styles.overlay
639
+ display: "flex",
640
+ flexDirection: "column",
641
+ alignItems: "flex-start",
642
+ overflow: scrollBehavior === "inside" ? "auto" : void 0,
643
+ ...__css ? __css : styles.body
620
644
  };
621
- const props = animation !== "none" ? import_transitions3.fadeProps : {};
622
- return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
623
- import_motion3.motion.div,
645
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
646
+ import_core8.ui.div,
624
647
  {
625
648
  ref,
626
- className: (0, import_utils3.cx)("ui-modal__overlay", className),
627
- custom: { duration },
649
+ className: (0, import_utils13.cx)("ui-modal__body", className),
628
650
  __css: css,
629
- onClick: (0, import_utils3.handlerAll)(onClick, onOverlayClick, (ev) => {
630
- ev.stopPropagation();
631
- if (closeOnOverlay) onClose == null ? void 0 : onClose();
632
- }),
633
- ...props,
634
651
  ...rest
635
652
  }
636
653
  );
637
654
  }
638
655
  );
639
656
 
640
- // src/modal-close-button.tsx
641
- var import_close_button = require("@yamada-ui/close-button");
642
- var import_core3 = require("@yamada-ui/core");
643
- var import_utils4 = require("@yamada-ui/utils");
644
- var import_jsx_runtime4 = require("react/jsx-runtime");
645
- var ModalCloseButton = (0, import_core3.forwardRef)(
646
- ({ onClick, __css, ...rest }, ref) => {
647
- const { styles, onClose } = useModal();
657
+ // src/modal-footer.tsx
658
+ var import_core9 = require("@yamada-ui/core");
659
+ var import_utils14 = require("@yamada-ui/utils");
660
+ var import_jsx_runtime13 = require("react/jsx-runtime");
661
+ var ModalFooter = (0, import_core9.forwardRef)(
662
+ ({ className, __css, ...rest }, ref) => {
663
+ const { styles } = useModal();
648
664
  const css = {
649
- position: "absolute",
650
- ...__css ? __css : styles.closeButton
665
+ display: "flex",
666
+ alignItems: "center",
667
+ justifyContent: "flex-end",
668
+ ...__css ? __css : styles.footer
651
669
  };
652
- return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
653
- import_close_button.CloseButton,
670
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
671
+ import_core9.ui.footer,
654
672
  {
655
673
  ref,
656
- className: (0, import_utils4.cx)("ui-modal__close-button"),
674
+ className: (0, import_utils14.cx)("ui-modal__footer", className),
657
675
  __css: css,
658
- onClick: (0, import_utils4.handlerAll)(onClick, (ev) => {
659
- ev.stopPropagation();
660
- onClose == null ? void 0 : onClose();
661
- }),
662
676
  ...rest
663
677
  }
664
678
  );
665
679
  }
666
680
  );
667
681
 
668
- // src/modal-header.tsx
669
- var import_core4 = require("@yamada-ui/core");
670
- var import_utils5 = require("@yamada-ui/utils");
671
- var import_jsx_runtime5 = require("react/jsx-runtime");
672
- var ModalHeader = (0, import_core4.forwardRef)(
673
- ({ className, __css, ...rest }, ref) => {
674
- const { styles } = useModal();
675
- const css = {
676
- display: "flex",
677
- alignItems: "center",
678
- justifyContent: "flex-start",
679
- ...__css ? __css : styles.header
680
- };
681
- return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
682
- import_core4.ui.header,
682
+ // src/dialog.tsx
683
+ var import_button = require("@yamada-ui/button");
684
+ var import_core13 = require("@yamada-ui/core");
685
+ var import_motion7 = require("@yamada-ui/motion");
686
+ var import_utils18 = require("@yamada-ui/utils");
687
+
688
+ // src/dialog-body.tsx
689
+ var import_core10 = require("@yamada-ui/core");
690
+ var import_utils15 = require("@yamada-ui/utils");
691
+ var import_jsx_runtime14 = require("react/jsx-runtime");
692
+ var DialogBody = (0, import_core10.forwardRef)(
693
+ ({ className, ...rest }, ref) => {
694
+ const styles = useDialog();
695
+ const css = { ...styles.body };
696
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
697
+ ModalBody,
683
698
  {
684
699
  ref,
685
- className: (0, import_utils5.cx)("ui-modal__header", className),
700
+ className: (0, import_utils15.cx)("ui-dialog__body", className),
686
701
  __css: css,
687
702
  ...rest
688
703
  }
@@ -690,25 +705,19 @@ var ModalHeader = (0, import_core4.forwardRef)(
690
705
  }
691
706
  );
692
707
 
693
- // src/modal-body.tsx
694
- var import_core5 = require("@yamada-ui/core");
695
- var import_utils6 = require("@yamada-ui/utils");
696
- var import_jsx_runtime6 = require("react/jsx-runtime");
697
- var ModalBody = (0, import_core5.forwardRef)(
698
- ({ className, __css, ...rest }, ref) => {
699
- const { styles, scrollBehavior } = useModal();
700
- const css = {
701
- display: "flex",
702
- flexDirection: "column",
703
- alignItems: "flex-start",
704
- overflow: scrollBehavior === "inside" ? "auto" : void 0,
705
- ...__css ? __css : styles.body
706
- };
707
- return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
708
- import_core5.ui.div,
708
+ // src/dialog-footer.tsx
709
+ var import_core11 = require("@yamada-ui/core");
710
+ var import_utils16 = require("@yamada-ui/utils");
711
+ var import_jsx_runtime15 = require("react/jsx-runtime");
712
+ var DialogFooter = (0, import_core11.forwardRef)(
713
+ ({ className, ...rest }, ref) => {
714
+ const styles = useDialog();
715
+ const css = { ...styles.footer };
716
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
717
+ ModalFooter,
709
718
  {
710
719
  ref,
711
- className: (0, import_utils6.cx)("ui-modal__body", className),
720
+ className: (0, import_utils16.cx)("ui-dialog__footer", className),
712
721
  __css: css,
713
722
  ...rest
714
723
  }
@@ -716,24 +725,19 @@ var ModalBody = (0, import_core5.forwardRef)(
716
725
  }
717
726
  );
718
727
 
719
- // src/modal-footer.tsx
720
- var import_core6 = require("@yamada-ui/core");
721
- var import_utils7 = require("@yamada-ui/utils");
722
- var import_jsx_runtime7 = require("react/jsx-runtime");
723
- var ModalFooter = (0, import_core6.forwardRef)(
724
- ({ className, __css, ...rest }, ref) => {
725
- const { styles } = useModal();
726
- const css = {
727
- display: "flex",
728
- alignItems: "center",
729
- justifyContent: "flex-end",
730
- ...__css ? __css : styles.footer
731
- };
732
- return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
733
- import_core6.ui.footer,
728
+ // src/dialog-header.tsx
729
+ var import_core12 = require("@yamada-ui/core");
730
+ var import_utils17 = require("@yamada-ui/utils");
731
+ var import_jsx_runtime16 = require("react/jsx-runtime");
732
+ var DialogHeader = (0, import_core12.forwardRef)(
733
+ ({ className, ...rest }, ref) => {
734
+ const styles = useDialog();
735
+ const css = { ...styles.header };
736
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
737
+ ModalHeader,
734
738
  {
735
739
  ref,
736
- className: (0, import_utils7.cx)("ui-modal__footer", className),
740
+ className: (0, import_utils17.cx)("ui-dialog__header", className),
737
741
  __css: css,
738
742
  ...rest
739
743
  }
@@ -742,18 +746,10 @@ var ModalFooter = (0, import_core6.forwardRef)(
742
746
  );
743
747
 
744
748
  // src/dialog.tsx
745
- var import_button = require("@yamada-ui/button");
746
- var import_core7 = require("@yamada-ui/core");
747
- var import_motion4 = require("@yamada-ui/motion");
748
- var import_utils8 = require("@yamada-ui/utils");
749
- var import_jsx_runtime8 = require("react/jsx-runtime");
750
- var [DialogProvider, useDialog] = (0, import_utils8.createContext)({
751
- name: `DialogContext`,
752
- errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
753
- });
754
- var Dialog = (0, import_motion4.motionForwardRef)(
749
+ var import_jsx_runtime17 = require("react/jsx-runtime");
750
+ var Dialog = (0, import_motion7.motionForwardRef)(
755
751
  ({ size, ...props }, ref) => {
756
- const [styles, mergedProps] = (0, import_core7.useMultiComponentStyle)("Dialog", {
752
+ const [styles, mergedProps] = (0, import_core13.useComponentMultiStyle)("Dialog", {
757
753
  size,
758
754
  ...props
759
755
  });
@@ -773,17 +769,17 @@ var Dialog = (0, import_motion4.motionForwardRef)(
773
769
  onSuccess,
774
770
  containerProps,
775
771
  ...rest
776
- } = (0, import_core7.omitThemeProps)(mergedProps);
777
- const validChildren = (0, import_utils8.getValidChildren)(children);
778
- const [customDialogOverlay] = (0, import_utils8.findChildren)(validChildren, DialogOverlay);
779
- const [customDialogCloseButton] = (0, import_utils8.findChildren)(
772
+ } = (0, import_core13.omitThemeProps)(mergedProps);
773
+ const validChildren = (0, import_utils18.getValidChildren)(children);
774
+ const [customDialogOverlay] = (0, import_utils18.findChildren)(validChildren, DialogOverlay);
775
+ const [customDialogCloseButton] = (0, import_utils18.findChildren)(
780
776
  validChildren,
781
777
  DialogCloseButton
782
778
  );
783
- const [customDialogHeader] = (0, import_utils8.findChildren)(validChildren, DialogHeader);
784
- const [customDialogBody] = (0, import_utils8.findChildren)(validChildren, DialogBody);
785
- const [customDialogFooter] = (0, import_utils8.findChildren)(validChildren, DialogFooter);
786
- const cloneChildren = !(0, import_utils8.isEmpty)(validChildren) ? (0, import_utils8.omitChildren)(
779
+ const [customDialogHeader] = (0, import_utils18.findChildren)(validChildren, DialogHeader);
780
+ const [customDialogBody] = (0, import_utils18.findChildren)(validChildren, DialogBody);
781
+ const [customDialogFooter] = (0, import_utils18.findChildren)(validChildren, DialogFooter);
782
+ const cloneChildren = !(0, import_utils18.isEmpty)(validChildren) ? (0, import_utils18.omitChildren)(
787
783
  validChildren,
788
784
  DialogOverlay,
789
785
  DialogCloseButton,
@@ -792,20 +788,20 @@ var Dialog = (0, import_motion4.motionForwardRef)(
792
788
  DialogFooter
793
789
  ) : children;
794
790
  const css = { ...styles.container };
795
- const cancelButtonProps = (0, import_utils8.isValidElement)(cancel) ? { children: cancel } : cancel;
796
- const otherButtonProps = (0, import_utils8.isValidElement)(other) ? { children: other } : other;
797
- const successButtonProps = (0, import_utils8.isValidElement)(success) ? { children: success } : success;
791
+ const cancelButtonProps = (0, import_utils18.isValidElement)(cancel) ? { children: cancel } : cancel;
792
+ const otherButtonProps = (0, import_utils18.isValidElement)(other) ? { children: other } : other;
793
+ const successButtonProps = (0, import_utils18.isValidElement)(success) ? { children: success } : success;
798
794
  if (cancelButtonProps && !cancelButtonProps.variant)
799
795
  cancelButtonProps.variant = "ghost";
800
796
  if (otherButtonProps && !otherButtonProps.colorScheme)
801
797
  otherButtonProps.colorScheme = "secondary";
802
798
  if (successButtonProps && !successButtonProps.colorScheme)
803
799
  successButtonProps.colorScheme = "primary";
804
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
800
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(
805
801
  Modal,
806
802
  {
807
803
  ref,
808
- className: (0, import_utils8.cx)("ui-dialog", className),
804
+ className: (0, import_utils18.cx)("ui-dialog", className),
809
805
  __css: css,
810
806
  ...{
811
807
  onClose,
@@ -816,26 +812,26 @@ var Dialog = (0, import_motion4.motionForwardRef)(
816
812
  size
817
813
  },
818
814
  children: [
819
- customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogOverlay, {}) : null,
820
- customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogCloseButton, {}) : null,
821
- customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogHeader, { children: header }) : null,
822
- customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogBody, { children: cloneChildren }) : null,
823
- customDialogFooter != null ? customDialogFooter : footer || cancelButtonProps || otherButtonProps || successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(DialogFooter, { children: footer != null ? footer : /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(import_jsx_runtime8.Fragment, { children: [
824
- cancelButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
815
+ customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogOverlay, {}) : null,
816
+ customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogCloseButton, {}) : null,
817
+ customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogHeader, { children: header }) : null,
818
+ customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogBody, { children: cloneChildren }) : null,
819
+ customDialogFooter != null ? customDialogFooter : footer || cancelButtonProps || otherButtonProps || successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DialogFooter, { children: footer != null ? footer : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(import_jsx_runtime17.Fragment, { children: [
820
+ cancelButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
825
821
  import_button.Button,
826
822
  {
827
823
  onClick: () => onCancel == null ? void 0 : onCancel(onClose),
828
824
  ...cancelButtonProps
829
825
  }
830
826
  ) : null,
831
- otherButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
827
+ otherButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
832
828
  import_button.Button,
833
829
  {
834
830
  onClick: () => onOther == null ? void 0 : onOther(onClose),
835
831
  ...otherButtonProps
836
832
  }
837
833
  ) : null,
838
- successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
834
+ successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
839
835
  import_button.Button,
840
836
  {
841
837
  onClick: () => onSuccess == null ? void 0 : onSuccess(onClose),
@@ -848,75 +844,158 @@ var Dialog = (0, import_motion4.motionForwardRef)(
848
844
  ) });
849
845
  }
850
846
  );
851
- var DialogOverlay = (0, import_motion4.motionForwardRef)(
852
- ({ className, ...rest }, ref) => {
853
- const styles = useDialog();
854
- const css = { ...styles.overlay };
855
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
856
- ModalOverlay,
857
- {
858
- ref,
859
- className: (0, import_utils8.cx)("ui-dialog__overlay", className),
860
- __css: css,
861
- ...rest
862
- }
847
+
848
+ // src/drawer.tsx
849
+ var import_core14 = require("@yamada-ui/core");
850
+ var import_motion8 = require("@yamada-ui/motion");
851
+ var import_utils19 = require("@yamada-ui/utils");
852
+ var import_jsx_runtime18 = require("react/jsx-runtime");
853
+ var Drawer = (0, import_motion8.motionForwardRef)(
854
+ ({ size, placement = "right", closeOnDrag = false, ...props }, ref) => {
855
+ const [styles, mergedProps] = (0, import_core14.useComponentMultiStyle)("Drawer", {
856
+ size,
857
+ placement,
858
+ closeOnDrag,
859
+ ...props
860
+ });
861
+ const {
862
+ children,
863
+ isOpen,
864
+ onClose,
865
+ onOverlayClick,
866
+ onEsc,
867
+ onCloseComplete,
868
+ withCloseButton = !closeOnDrag,
869
+ withOverlay = true,
870
+ withDragBar = true,
871
+ allowPinchZoom,
872
+ autoFocus,
873
+ restoreFocus,
874
+ initialFocusRef,
875
+ finalFocusRef,
876
+ blockScrollOnMount,
877
+ closeOnOverlay,
878
+ closeOnEsc,
879
+ lockFocusAcrossFrames,
880
+ duration = { enter: 0.4, exit: 0.3 },
881
+ dragConstraints = 0,
882
+ dragElastic = 0.1,
883
+ dragOffset = 80,
884
+ dragVelocity = 100,
885
+ blankForDragProps,
886
+ portalProps,
887
+ containerProps,
888
+ ...rest
889
+ } = (0, import_core14.omitThemeProps)(mergedProps, ["isFullHeight"]);
890
+ const validChildren = (0, import_utils19.getValidChildren)(children);
891
+ const [customDrawerOverlay, ...cloneChildren] = (0, import_utils19.findChildren)(
892
+ validChildren,
893
+ DrawerOverlay
863
894
  );
864
- }
865
- );
866
- var DialogCloseButton = (0, import_core7.forwardRef)(
867
- ({ className, ...rest }, ref) => {
868
- const styles = useDialog();
869
- const css = { ...styles.closeButton };
870
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
871
- ModalCloseButton,
895
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DrawerProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(
896
+ Modal,
872
897
  {
873
898
  ref,
874
- className: (0, import_utils8.cx)("ui-dialog__close-button", className),
875
- __css: css,
876
- ...rest
899
+ ...{
900
+ isOpen,
901
+ onClose,
902
+ onOverlayClick,
903
+ onEsc,
904
+ onCloseComplete,
905
+ withCloseButton: false,
906
+ withOverlay: false,
907
+ allowPinchZoom,
908
+ autoFocus,
909
+ restoreFocus,
910
+ initialFocusRef,
911
+ finalFocusRef,
912
+ blockScrollOnMount,
913
+ closeOnOverlay,
914
+ closeOnEsc,
915
+ lockFocusAcrossFrames,
916
+ duration,
917
+ portalProps,
918
+ containerProps
919
+ },
920
+ children: [
921
+ customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(DrawerOverlay, {}) : null,
922
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
923
+ DrawerContent,
924
+ {
925
+ ...{
926
+ dragConstraints,
927
+ dragElastic,
928
+ dragOffset,
929
+ dragVelocity,
930
+ withCloseButton,
931
+ withDragBar,
932
+ blankForDragProps,
933
+ ...rest,
934
+ placement,
935
+ closeOnDrag
936
+ },
937
+ children: cloneChildren
938
+ }
939
+ )
940
+ ]
877
941
  }
878
- );
942
+ ) });
879
943
  }
880
944
  );
881
- var DialogHeader = (0, import_core7.forwardRef)(
945
+
946
+ // src/drawer-header.tsx
947
+ var import_core15 = require("@yamada-ui/core");
948
+ var import_utils20 = require("@yamada-ui/utils");
949
+ var import_jsx_runtime19 = require("react/jsx-runtime");
950
+ var DrawerHeader = (0, import_core15.forwardRef)(
882
951
  ({ className, ...rest }, ref) => {
883
- const styles = useDialog();
952
+ const styles = useDrawer();
884
953
  const css = { ...styles.header };
885
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
954
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
886
955
  ModalHeader,
887
956
  {
888
957
  ref,
889
- className: (0, import_utils8.cx)("ui-dialog__header", className),
958
+ className: (0, import_utils20.cx)("ui-drawer__header", className),
890
959
  __css: css,
891
960
  ...rest
892
961
  }
893
962
  );
894
963
  }
895
964
  );
896
- var DialogBody = (0, import_core7.forwardRef)(
965
+
966
+ // src/drawer-body.tsx
967
+ var import_core16 = require("@yamada-ui/core");
968
+ var import_utils21 = require("@yamada-ui/utils");
969
+ var import_jsx_runtime20 = require("react/jsx-runtime");
970
+ var DrawerBody = (0, import_core16.forwardRef)(
897
971
  ({ className, ...rest }, ref) => {
898
- const styles = useDialog();
972
+ const styles = useDrawer();
899
973
  const css = { ...styles.body };
900
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
974
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
901
975
  ModalBody,
902
976
  {
903
977
  ref,
904
- className: (0, import_utils8.cx)("ui-dialog__body", className),
978
+ className: (0, import_utils21.cx)("ui-drawer__body", className),
905
979
  __css: css,
906
980
  ...rest
907
981
  }
908
982
  );
909
983
  }
910
984
  );
911
- var DialogFooter = (0, import_core7.forwardRef)(
985
+
986
+ // src/drawer-footer.tsx
987
+ var import_core17 = require("@yamada-ui/core");
988
+ var import_utils22 = require("@yamada-ui/utils");
989
+ var import_jsx_runtime21 = require("react/jsx-runtime");
990
+ var DrawerFooter = (0, import_core17.forwardRef)(
912
991
  ({ className, ...rest }, ref) => {
913
- const styles = useDialog();
992
+ const styles = useDrawer();
914
993
  const css = { ...styles.footer };
915
- return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
994
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
916
995
  ModalFooter,
917
996
  {
918
997
  ref,
919
- className: (0, import_utils8.cx)("ui-dialog__footer", className),
998
+ className: (0, import_utils22.cx)("ui-drawer__footer", className),
920
999
  __css: css,
921
1000
  ...rest
922
1001
  }