@yamada-ui/modal 0.2.7 → 0.2.8
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-VHMYEQE4.mjs +777 -0
- package/dist/dialog.js +382 -238
- package/dist/dialog.mjs +1 -1
- package/dist/drawer.js +382 -238
- package/dist/drawer.mjs +1 -1
- package/dist/index.js +382 -238
- package/dist/index.mjs +1 -1
- package/dist/modal-body.js +382 -238
- package/dist/modal-body.mjs +1 -1
- package/dist/modal-close-button.js +382 -238
- package/dist/modal-close-button.mjs +1 -1
- package/dist/modal-footer.js +382 -238
- package/dist/modal-footer.mjs +1 -1
- package/dist/modal-header.js +382 -238
- package/dist/modal-header.mjs +1 -1
- package/dist/modal-overlay.js +382 -238
- package/dist/modal-overlay.mjs +1 -1
- package/dist/modal.js +382 -238
- package/dist/modal.mjs +1 -1
- package/package.json +10 -10
- package/dist/chunk-OUW3Q5QN.mjs +0 -623
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 {
|
|
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)(
|
|
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)(
|
|
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)(
|
|
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)(
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
DialogHeader
|
|
203
|
-
DialogBody
|
|
204
|
-
DialogFooter
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
212
|
-
|
|
213
|
-
|
|
214
|
-
|
|
215
|
-
|
|
216
|
-
|
|
217
|
-
|
|
218
|
-
|
|
219
|
-
|
|
220
|
-
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
227
|
-
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
|
|
231
|
-
|
|
232
|
-
|
|
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)(
|
|
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)(
|
|
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)(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
|
|
301
|
-
|
|
302
|
-
|
|
303
|
-
|
|
304
|
-
|
|
305
|
-
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
315
|
-
|
|
316
|
-
|
|
317
|
-
|
|
318
|
-
|
|
319
|
-
|
|
320
|
-
|
|
321
|
-
|
|
322
|
-
|
|
323
|
-
|
|
324
|
-
|
|
325
|
-
|
|
326
|
-
|
|
327
|
-
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
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
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
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 {
|
|
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)(
|
|
468
|
-
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
481
|
-
|
|
482
|
-
|
|
483
|
-
|
|
484
|
-
|
|
485
|
-
|
|
486
|
-
|
|
487
|
-
|
|
488
|
-
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
|
|
517
|
-
|
|
518
|
-
|
|
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)(
|
|
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)(
|
|
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:
|