@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.
- package/dist/chunk-2EF6C34T.mjs +35 -0
- package/dist/chunk-2EF6C34T.mjs.map +1 -0
- package/dist/chunk-2GGZOTUT.mjs +32 -0
- package/dist/chunk-2GGZOTUT.mjs.map +1 -0
- package/dist/chunk-2UHL64SV.mjs +150 -0
- package/dist/chunk-2UHL64SV.mjs.map +1 -0
- package/dist/chunk-2XQPQIQG.mjs +32 -0
- package/dist/chunk-2XQPQIQG.mjs.map +1 -0
- package/dist/chunk-3CPIBNSS.mjs +32 -0
- package/dist/chunk-3CPIBNSS.mjs.map +1 -0
- package/dist/chunk-3S4JQQU3.mjs +32 -0
- package/dist/chunk-3S4JQQU3.mjs.map +1 -0
- package/dist/chunk-4G6PCQ4G.mjs +51 -0
- package/dist/chunk-4G6PCQ4G.mjs.map +1 -0
- package/dist/chunk-4J4ISPN7.mjs +26 -0
- package/dist/chunk-4J4ISPN7.mjs.map +1 -0
- package/dist/chunk-5OKOSAXO.mjs +37 -0
- package/dist/chunk-5OKOSAXO.mjs.map +1 -0
- package/dist/chunk-B2LUOR6L.mjs +32 -0
- package/dist/chunk-B2LUOR6L.mjs.map +1 -0
- package/dist/chunk-B436JYPR.mjs +34 -0
- package/dist/chunk-B436JYPR.mjs.map +1 -0
- package/dist/chunk-CW5ZZAAV.mjs +34 -0
- package/dist/chunk-CW5ZZAAV.mjs.map +1 -0
- package/dist/chunk-DV6BTDBZ.mjs +32 -0
- package/dist/chunk-DV6BTDBZ.mjs.map +1 -0
- package/dist/chunk-G646NVHY.mjs +176 -0
- package/dist/chunk-G646NVHY.mjs.map +1 -0
- package/dist/chunk-HM447TIY.mjs +32 -0
- package/dist/chunk-HM447TIY.mjs.map +1 -0
- package/dist/chunk-I6LPF3F6.mjs +95 -0
- package/dist/chunk-I6LPF3F6.mjs.map +1 -0
- package/dist/chunk-OFDDT2JT.mjs +32 -0
- package/dist/chunk-OFDDT2JT.mjs.map +1 -0
- package/dist/chunk-RSAJUBWR.mjs +32 -0
- package/dist/chunk-RSAJUBWR.mjs.map +1 -0
- package/dist/chunk-WEDZHILB.mjs +29 -0
- package/dist/chunk-WEDZHILB.mjs.map +1 -0
- package/dist/chunk-Y2QXIJZA.mjs +138 -0
- package/dist/chunk-Y2QXIJZA.mjs.map +1 -0
- package/dist/chunk-Y5NCRCDU.mjs +32 -0
- package/dist/chunk-Y5NCRCDU.mjs.map +1 -0
- package/dist/chunk-ZR2AEIGZ.mjs +116 -0
- package/dist/chunk-ZR2AEIGZ.mjs.map +1 -0
- package/dist/dialog-body.d.mts +8 -0
- package/dist/dialog-body.d.ts +8 -0
- package/dist/dialog-body.js +94 -0
- package/dist/dialog-body.js.map +1 -0
- package/dist/dialog-body.mjs +10 -0
- package/dist/dialog-body.mjs.map +1 -0
- package/dist/dialog-close-button.d.mts +8 -0
- package/dist/dialog-close-button.d.ts +8 -0
- package/dist/dialog-close-button.js +96 -0
- package/dist/dialog-close-button.js.map +1 -0
- package/dist/dialog-close-button.mjs +10 -0
- package/dist/dialog-close-button.mjs.map +1 -0
- package/dist/dialog-footer.d.mts +8 -0
- package/dist/dialog-footer.d.ts +8 -0
- package/dist/dialog-footer.js +91 -0
- package/dist/dialog-footer.js.map +1 -0
- package/dist/dialog-footer.mjs +10 -0
- package/dist/dialog-footer.mjs.map +1 -0
- package/dist/dialog-header.d.mts +8 -0
- package/dist/dialog-header.d.ts +8 -0
- package/dist/dialog-header.js +91 -0
- package/dist/dialog-header.js.map +1 -0
- package/dist/dialog-header.mjs +10 -0
- package/dist/dialog-header.mjs.map +1 -0
- package/dist/dialog-overlay.d.mts +8 -0
- package/dist/dialog-overlay.d.ts +8 -0
- package/dist/dialog-overlay.js +108 -0
- package/dist/dialog-overlay.js.map +1 -0
- package/dist/dialog-overlay.mjs +10 -0
- package/dist/dialog-overlay.mjs.map +1 -0
- package/dist/dialog.d.mts +7 -21
- package/dist/dialog.d.ts +7 -21
- package/dist/dialog.js +593 -678
- package/dist/dialog.js.map +1 -1
- package/dist/dialog.mjs +20 -13
- package/dist/drawer-body.d.mts +8 -0
- package/dist/drawer-body.d.ts +8 -0
- package/dist/drawer-body.js +94 -0
- package/dist/drawer-body.js.map +1 -0
- package/dist/drawer-body.mjs +10 -0
- package/dist/drawer-body.mjs.map +1 -0
- package/dist/drawer-close-button.d.mts +9 -0
- package/dist/drawer-close-button.d.ts +9 -0
- package/dist/drawer-close-button.js +96 -0
- package/dist/drawer-close-button.js.map +1 -0
- package/dist/drawer-close-button.mjs +10 -0
- package/dist/drawer-close-button.mjs.map +1 -0
- package/dist/drawer-content.d.mts +16 -0
- package/dist/drawer-content.d.ts +16 -0
- package/dist/drawer-content.js +278 -0
- package/dist/drawer-content.js.map +1 -0
- package/dist/drawer-content.mjs +12 -0
- package/dist/drawer-content.mjs.map +1 -0
- package/dist/drawer-drag-bar.d.mts +8 -0
- package/dist/drawer-drag-bar.d.ts +8 -0
- package/dist/drawer-drag-bar.js +66 -0
- package/dist/drawer-drag-bar.js.map +1 -0
- package/dist/drawer-drag-bar.mjs +9 -0
- package/dist/drawer-drag-bar.mjs.map +1 -0
- package/dist/drawer-footer.d.mts +8 -0
- package/dist/drawer-footer.d.ts +8 -0
- package/dist/drawer-footer.js +91 -0
- package/dist/drawer-footer.js.map +1 -0
- package/dist/drawer-footer.mjs +10 -0
- package/dist/drawer-footer.mjs.map +1 -0
- package/dist/drawer-header.d.mts +8 -0
- package/dist/drawer-header.d.ts +8 -0
- package/dist/drawer-header.js +91 -0
- package/dist/drawer-header.js.map +1 -0
- package/dist/drawer-header.mjs +10 -0
- package/dist/drawer-header.mjs.map +1 -0
- package/dist/drawer-overlay.d.mts +8 -0
- package/dist/drawer-overlay.d.ts +8 -0
- package/dist/drawer-overlay.js +108 -0
- package/dist/drawer-overlay.js.map +1 -0
- package/dist/drawer-overlay.mjs +10 -0
- package/dist/drawer-overlay.mjs.map +1 -0
- package/dist/drawer.d.mts +8 -27
- package/dist/drawer.d.ts +8 -27
- package/dist/drawer.js +405 -640
- package/dist/drawer.js.map +1 -1
- package/dist/drawer.mjs +14 -17
- package/dist/index.d.mts +13 -2
- package/dist/index.d.ts +13 -2
- package/dist/index.js +492 -413
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +56 -18
- package/dist/modal-body.d.mts +3 -2
- package/dist/modal-body.d.ts +3 -2
- package/dist/modal-body.js +13 -856
- package/dist/modal-body.js.map +1 -1
- package/dist/modal-body.mjs +2 -1
- package/dist/modal-close-button.d.mts +3 -2
- package/dist/modal-close-button.d.ts +3 -2
- package/dist/modal-close-button.js +13 -854
- package/dist/modal-close-button.js.map +1 -1
- package/dist/modal-close-button.mjs +2 -1
- package/dist/modal-content.d.mts +9 -0
- package/dist/modal-content.d.ts +9 -0
- package/dist/modal-content.js +178 -0
- package/dist/modal-content.js.map +1 -0
- package/dist/modal-content.mjs +11 -0
- package/dist/modal-content.mjs.map +1 -0
- package/dist/modal-context.d.mts +27 -0
- package/dist/modal-context.d.ts +27 -0
- package/dist/modal-context.js +54 -0
- package/dist/modal-context.js.map +1 -0
- package/dist/modal-context.mjs +18 -0
- package/dist/modal-context.mjs.map +1 -0
- package/dist/modal-footer.d.mts +2 -1
- package/dist/modal-footer.d.ts +2 -1
- package/dist/modal-footer.js +13 -857
- package/dist/modal-footer.js.map +1 -1
- package/dist/modal-footer.mjs +2 -1
- package/dist/modal-header.d.mts +2 -1
- package/dist/modal-header.d.ts +2 -1
- package/dist/modal-header.js +13 -857
- package/dist/modal-header.js.map +1 -1
- package/dist/modal-header.mjs +2 -1
- package/dist/modal-overlay.d.mts +2 -1
- package/dist/modal-overlay.d.ts +2 -1
- package/dist/modal-overlay.js +16 -843
- package/dist/modal-overlay.js.map +1 -1
- package/dist/modal-overlay.mjs +2 -1
- package/dist/modal.d.mts +10 -14
- package/dist/modal.d.ts +10 -14
- package/dist/modal.js +183 -508
- package/dist/modal.js.map +1 -1
- package/dist/modal.mjs +13 -5
- package/package.json +10 -10
- package/dist/chunk-7PS3HWMF.mjs +0 -938
- package/dist/chunk-7PS3HWMF.mjs.map +0 -1
package/dist/chunk-7PS3HWMF.mjs
DELETED
|
@@ -1,938 +0,0 @@
|
|
|
1
|
-
"use client"
|
|
2
|
-
|
|
3
|
-
// src/drawer.tsx
|
|
4
|
-
import {
|
|
5
|
-
ui as ui5,
|
|
6
|
-
forwardRef as forwardRef6,
|
|
7
|
-
useMultiComponentStyle as useMultiComponentStyle3,
|
|
8
|
-
omitThemeProps as omitThemeProps3
|
|
9
|
-
} from "@yamada-ui/core";
|
|
10
|
-
import { motionForwardRef as motionForwardRef4 } from "@yamada-ui/motion";
|
|
11
|
-
import { Slide } from "@yamada-ui/transitions";
|
|
12
|
-
import { useValue as useValue2 } from "@yamada-ui/use-value";
|
|
13
|
-
import {
|
|
14
|
-
createContext as createContext3,
|
|
15
|
-
getValidChildren as getValidChildren3,
|
|
16
|
-
findChildren as findChildren3,
|
|
17
|
-
cx as cx8,
|
|
18
|
-
isArray
|
|
19
|
-
} from "@yamada-ui/utils";
|
|
20
|
-
import { useCallback as useCallback2, useMemo } from "react";
|
|
21
|
-
|
|
22
|
-
// src/modal.tsx
|
|
23
|
-
import { ui as ui4, omitThemeProps as omitThemeProps2, useMultiComponentStyle as useMultiComponentStyle2 } from "@yamada-ui/core";
|
|
24
|
-
import { FocusLock } from "@yamada-ui/focus-lock";
|
|
25
|
-
import { AnimatePresence, motion as motion2, motionForwardRef as motionForwardRef3 } from "@yamada-ui/motion";
|
|
26
|
-
import { Portal } from "@yamada-ui/portal";
|
|
27
|
-
import { scaleFadeProps, slideFadeProps } from "@yamada-ui/transitions";
|
|
28
|
-
import { useValue } from "@yamada-ui/use-value";
|
|
29
|
-
import {
|
|
30
|
-
cx as cx7,
|
|
31
|
-
createContext as createContext2,
|
|
32
|
-
getValidChildren as getValidChildren2,
|
|
33
|
-
findChildren as findChildren2
|
|
34
|
-
} from "@yamada-ui/utils";
|
|
35
|
-
import { cloneElement, useCallback } from "react";
|
|
36
|
-
import { RemoveScroll } from "react-remove-scroll";
|
|
37
|
-
|
|
38
|
-
// src/modal-overlay.tsx
|
|
39
|
-
import { motion, motionForwardRef } from "@yamada-ui/motion";
|
|
40
|
-
import { fadeProps } from "@yamada-ui/transitions";
|
|
41
|
-
import { cx, handlerAll } from "@yamada-ui/utils";
|
|
42
|
-
import { jsx } from "react/jsx-runtime";
|
|
43
|
-
var ModalOverlay = motionForwardRef(
|
|
44
|
-
({ className, __css, onClick, ...rest }, ref) => {
|
|
45
|
-
const {
|
|
46
|
-
styles,
|
|
47
|
-
closeOnOverlay,
|
|
48
|
-
onOverlayClick,
|
|
49
|
-
onClose,
|
|
50
|
-
animation,
|
|
51
|
-
duration
|
|
52
|
-
} = useModal();
|
|
53
|
-
const css = {
|
|
54
|
-
position: "fixed",
|
|
55
|
-
top: 0,
|
|
56
|
-
left: 0,
|
|
57
|
-
w: "100vw",
|
|
58
|
-
h: "100vh",
|
|
59
|
-
...__css ? __css : styles.overlay
|
|
60
|
-
};
|
|
61
|
-
const props = animation !== "none" ? fadeProps : {};
|
|
62
|
-
return /* @__PURE__ */ jsx(
|
|
63
|
-
motion.div,
|
|
64
|
-
{
|
|
65
|
-
ref,
|
|
66
|
-
className: cx("ui-modal__overlay", className),
|
|
67
|
-
custom: { duration },
|
|
68
|
-
__css: css,
|
|
69
|
-
onClick: handlerAll(onClick, onOverlayClick, (ev) => {
|
|
70
|
-
ev.stopPropagation();
|
|
71
|
-
if (closeOnOverlay) onClose == null ? void 0 : onClose();
|
|
72
|
-
}),
|
|
73
|
-
...props,
|
|
74
|
-
...rest
|
|
75
|
-
}
|
|
76
|
-
);
|
|
77
|
-
}
|
|
78
|
-
);
|
|
79
|
-
|
|
80
|
-
// src/modal-close-button.tsx
|
|
81
|
-
import { CloseButton } from "@yamada-ui/close-button";
|
|
82
|
-
import { forwardRef } from "@yamada-ui/core";
|
|
83
|
-
import { cx as cx2, handlerAll as handlerAll2 } from "@yamada-ui/utils";
|
|
84
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
85
|
-
var ModalCloseButton = forwardRef(
|
|
86
|
-
({ onClick, __css, ...rest }, ref) => {
|
|
87
|
-
const { styles, onClose } = useModal();
|
|
88
|
-
const css = {
|
|
89
|
-
position: "absolute",
|
|
90
|
-
...__css ? __css : styles.closeButton
|
|
91
|
-
};
|
|
92
|
-
return /* @__PURE__ */ jsx2(
|
|
93
|
-
CloseButton,
|
|
94
|
-
{
|
|
95
|
-
ref,
|
|
96
|
-
className: cx2("ui-modal__close-button"),
|
|
97
|
-
__css: css,
|
|
98
|
-
onClick: handlerAll2(onClick, (ev) => {
|
|
99
|
-
ev.stopPropagation();
|
|
100
|
-
onClose == null ? void 0 : onClose();
|
|
101
|
-
}),
|
|
102
|
-
...rest
|
|
103
|
-
}
|
|
104
|
-
);
|
|
105
|
-
}
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
// src/modal-header.tsx
|
|
109
|
-
import { ui, forwardRef as forwardRef2 } from "@yamada-ui/core";
|
|
110
|
-
import { cx as cx3 } from "@yamada-ui/utils";
|
|
111
|
-
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
112
|
-
var ModalHeader = forwardRef2(
|
|
113
|
-
({ className, __css, ...rest }, ref) => {
|
|
114
|
-
const { styles } = useModal();
|
|
115
|
-
const css = {
|
|
116
|
-
display: "flex",
|
|
117
|
-
alignItems: "center",
|
|
118
|
-
justifyContent: "flex-start",
|
|
119
|
-
...__css ? __css : styles.header
|
|
120
|
-
};
|
|
121
|
-
return /* @__PURE__ */ jsx3(
|
|
122
|
-
ui.header,
|
|
123
|
-
{
|
|
124
|
-
ref,
|
|
125
|
-
className: cx3("ui-modal__header", className),
|
|
126
|
-
__css: css,
|
|
127
|
-
...rest
|
|
128
|
-
}
|
|
129
|
-
);
|
|
130
|
-
}
|
|
131
|
-
);
|
|
132
|
-
|
|
133
|
-
// src/modal-body.tsx
|
|
134
|
-
import { ui as ui2, forwardRef as forwardRef3 } from "@yamada-ui/core";
|
|
135
|
-
import { cx as cx4 } from "@yamada-ui/utils";
|
|
136
|
-
import { jsx as jsx4 } from "react/jsx-runtime";
|
|
137
|
-
var ModalBody = forwardRef3(
|
|
138
|
-
({ className, __css, ...rest }, ref) => {
|
|
139
|
-
const { styles, scrollBehavior } = useModal();
|
|
140
|
-
const css = {
|
|
141
|
-
display: "flex",
|
|
142
|
-
flexDirection: "column",
|
|
143
|
-
alignItems: "flex-start",
|
|
144
|
-
overflow: scrollBehavior === "inside" ? "auto" : void 0,
|
|
145
|
-
...__css ? __css : styles.body
|
|
146
|
-
};
|
|
147
|
-
return /* @__PURE__ */ jsx4(
|
|
148
|
-
ui2.div,
|
|
149
|
-
{
|
|
150
|
-
ref,
|
|
151
|
-
className: cx4("ui-modal__body", className),
|
|
152
|
-
__css: css,
|
|
153
|
-
...rest
|
|
154
|
-
}
|
|
155
|
-
);
|
|
156
|
-
}
|
|
157
|
-
);
|
|
158
|
-
|
|
159
|
-
// src/modal-footer.tsx
|
|
160
|
-
import { ui as ui3, forwardRef as forwardRef4 } from "@yamada-ui/core";
|
|
161
|
-
import { cx as cx5 } from "@yamada-ui/utils";
|
|
162
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
|
163
|
-
var ModalFooter = forwardRef4(
|
|
164
|
-
({ className, __css, ...rest }, ref) => {
|
|
165
|
-
const { styles } = useModal();
|
|
166
|
-
const css = {
|
|
167
|
-
display: "flex",
|
|
168
|
-
alignItems: "center",
|
|
169
|
-
justifyContent: "flex-end",
|
|
170
|
-
...__css ? __css : styles.footer
|
|
171
|
-
};
|
|
172
|
-
return /* @__PURE__ */ jsx5(
|
|
173
|
-
ui3.footer,
|
|
174
|
-
{
|
|
175
|
-
ref,
|
|
176
|
-
className: cx5("ui-modal__footer", className),
|
|
177
|
-
__css: css,
|
|
178
|
-
...rest
|
|
179
|
-
}
|
|
180
|
-
);
|
|
181
|
-
}
|
|
182
|
-
);
|
|
183
|
-
|
|
184
|
-
// src/dialog.tsx
|
|
185
|
-
import { Button } from "@yamada-ui/button";
|
|
186
|
-
import {
|
|
187
|
-
forwardRef as forwardRef5,
|
|
188
|
-
useMultiComponentStyle,
|
|
189
|
-
omitThemeProps
|
|
190
|
-
} from "@yamada-ui/core";
|
|
191
|
-
import { motionForwardRef as motionForwardRef2 } from "@yamada-ui/motion";
|
|
192
|
-
import {
|
|
193
|
-
createContext,
|
|
194
|
-
getValidChildren,
|
|
195
|
-
findChildren,
|
|
196
|
-
omitChildren,
|
|
197
|
-
isValidElement,
|
|
198
|
-
isEmpty,
|
|
199
|
-
cx as cx6
|
|
200
|
-
} from "@yamada-ui/utils";
|
|
201
|
-
import { Fragment, jsx as jsx6, jsxs } from "react/jsx-runtime";
|
|
202
|
-
var [DialogProvider, useDialog] = createContext({
|
|
203
|
-
name: `DialogContext`,
|
|
204
|
-
errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
|
|
205
|
-
});
|
|
206
|
-
var Dialog = motionForwardRef2(
|
|
207
|
-
({ size, ...props }, ref) => {
|
|
208
|
-
const [styles, mergedProps] = useMultiComponentStyle("Dialog", {
|
|
209
|
-
size,
|
|
210
|
-
...props
|
|
211
|
-
});
|
|
212
|
-
const {
|
|
213
|
-
className,
|
|
214
|
-
children,
|
|
215
|
-
withOverlay = true,
|
|
216
|
-
withCloseButton = true,
|
|
217
|
-
header,
|
|
218
|
-
footer,
|
|
219
|
-
cancel,
|
|
220
|
-
other,
|
|
221
|
-
success,
|
|
222
|
-
onClose,
|
|
223
|
-
onCancel,
|
|
224
|
-
onOther,
|
|
225
|
-
onSuccess,
|
|
226
|
-
containerProps,
|
|
227
|
-
...rest
|
|
228
|
-
} = omitThemeProps(mergedProps);
|
|
229
|
-
const validChildren = getValidChildren(children);
|
|
230
|
-
const [customDialogOverlay] = findChildren(validChildren, DialogOverlay);
|
|
231
|
-
const [customDialogCloseButton] = findChildren(
|
|
232
|
-
validChildren,
|
|
233
|
-
DialogCloseButton
|
|
234
|
-
);
|
|
235
|
-
const [customDialogHeader] = findChildren(validChildren, DialogHeader);
|
|
236
|
-
const [customDialogBody] = findChildren(validChildren, DialogBody);
|
|
237
|
-
const [customDialogFooter] = findChildren(validChildren, DialogFooter);
|
|
238
|
-
const cloneChildren = !isEmpty(validChildren) ? omitChildren(
|
|
239
|
-
validChildren,
|
|
240
|
-
DialogOverlay,
|
|
241
|
-
DialogCloseButton,
|
|
242
|
-
DialogHeader,
|
|
243
|
-
DialogBody,
|
|
244
|
-
DialogFooter
|
|
245
|
-
) : children;
|
|
246
|
-
const css = { ...styles.container };
|
|
247
|
-
const cancelButtonProps = isValidElement(cancel) ? { children: cancel } : cancel;
|
|
248
|
-
const otherButtonProps = isValidElement(other) ? { children: other } : other;
|
|
249
|
-
const successButtonProps = isValidElement(success) ? { children: success } : success;
|
|
250
|
-
if (cancelButtonProps && !cancelButtonProps.variant)
|
|
251
|
-
cancelButtonProps.variant = "ghost";
|
|
252
|
-
if (otherButtonProps && !otherButtonProps.colorScheme)
|
|
253
|
-
otherButtonProps.colorScheme = "secondary";
|
|
254
|
-
if (successButtonProps && !successButtonProps.colorScheme)
|
|
255
|
-
successButtonProps.colorScheme = "primary";
|
|
256
|
-
return /* @__PURE__ */ jsx6(DialogProvider, { value: styles, children: /* @__PURE__ */ jsxs(
|
|
257
|
-
Modal,
|
|
258
|
-
{
|
|
259
|
-
ref,
|
|
260
|
-
className: cx6("ui-dialog", className),
|
|
261
|
-
__css: css,
|
|
262
|
-
...{
|
|
263
|
-
onClose,
|
|
264
|
-
withOverlay: false,
|
|
265
|
-
withCloseButton: false,
|
|
266
|
-
containerProps,
|
|
267
|
-
...rest,
|
|
268
|
-
size
|
|
269
|
-
},
|
|
270
|
-
children: [
|
|
271
|
-
customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ jsx6(DialogOverlay, {}) : null,
|
|
272
|
-
customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ jsx6(DialogCloseButton, {}) : null,
|
|
273
|
-
customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ jsx6(DialogHeader, { children: header }) : null,
|
|
274
|
-
customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ jsx6(DialogBody, { children: cloneChildren }) : null,
|
|
275
|
-
customDialogFooter != null ? customDialogFooter : footer || cancelButtonProps || otherButtonProps || successButtonProps ? /* @__PURE__ */ jsx6(DialogFooter, { children: footer != null ? footer : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
276
|
-
cancelButtonProps ? /* @__PURE__ */ jsx6(
|
|
277
|
-
Button,
|
|
278
|
-
{
|
|
279
|
-
onClick: () => onCancel == null ? void 0 : onCancel(onClose),
|
|
280
|
-
...cancelButtonProps
|
|
281
|
-
}
|
|
282
|
-
) : null,
|
|
283
|
-
otherButtonProps ? /* @__PURE__ */ jsx6(
|
|
284
|
-
Button,
|
|
285
|
-
{
|
|
286
|
-
onClick: () => onOther == null ? void 0 : onOther(onClose),
|
|
287
|
-
...otherButtonProps
|
|
288
|
-
}
|
|
289
|
-
) : null,
|
|
290
|
-
successButtonProps ? /* @__PURE__ */ jsx6(
|
|
291
|
-
Button,
|
|
292
|
-
{
|
|
293
|
-
onClick: () => onSuccess == null ? void 0 : onSuccess(onClose),
|
|
294
|
-
...successButtonProps
|
|
295
|
-
}
|
|
296
|
-
) : null
|
|
297
|
-
] }) }) : null
|
|
298
|
-
]
|
|
299
|
-
}
|
|
300
|
-
) });
|
|
301
|
-
}
|
|
302
|
-
);
|
|
303
|
-
var DialogOverlay = motionForwardRef2(
|
|
304
|
-
({ className, ...rest }, ref) => {
|
|
305
|
-
const styles = useDialog();
|
|
306
|
-
const css = { ...styles.overlay };
|
|
307
|
-
return /* @__PURE__ */ jsx6(
|
|
308
|
-
ModalOverlay,
|
|
309
|
-
{
|
|
310
|
-
ref,
|
|
311
|
-
className: cx6("ui-dialog__overlay", className),
|
|
312
|
-
__css: css,
|
|
313
|
-
...rest
|
|
314
|
-
}
|
|
315
|
-
);
|
|
316
|
-
}
|
|
317
|
-
);
|
|
318
|
-
var DialogCloseButton = forwardRef5(
|
|
319
|
-
({ className, ...rest }, ref) => {
|
|
320
|
-
const styles = useDialog();
|
|
321
|
-
const css = { ...styles.closeButton };
|
|
322
|
-
return /* @__PURE__ */ jsx6(
|
|
323
|
-
ModalCloseButton,
|
|
324
|
-
{
|
|
325
|
-
ref,
|
|
326
|
-
className: cx6("ui-dialog__close-button", className),
|
|
327
|
-
__css: css,
|
|
328
|
-
...rest
|
|
329
|
-
}
|
|
330
|
-
);
|
|
331
|
-
}
|
|
332
|
-
);
|
|
333
|
-
var DialogHeader = forwardRef5(
|
|
334
|
-
({ className, ...rest }, ref) => {
|
|
335
|
-
const styles = useDialog();
|
|
336
|
-
const css = { ...styles.header };
|
|
337
|
-
return /* @__PURE__ */ jsx6(
|
|
338
|
-
ModalHeader,
|
|
339
|
-
{
|
|
340
|
-
ref,
|
|
341
|
-
className: cx6("ui-dialog__header", className),
|
|
342
|
-
__css: css,
|
|
343
|
-
...rest
|
|
344
|
-
}
|
|
345
|
-
);
|
|
346
|
-
}
|
|
347
|
-
);
|
|
348
|
-
var DialogBody = forwardRef5(
|
|
349
|
-
({ className, ...rest }, ref) => {
|
|
350
|
-
const styles = useDialog();
|
|
351
|
-
const css = { ...styles.body };
|
|
352
|
-
return /* @__PURE__ */ jsx6(
|
|
353
|
-
ModalBody,
|
|
354
|
-
{
|
|
355
|
-
ref,
|
|
356
|
-
className: cx6("ui-dialog__body", className),
|
|
357
|
-
__css: css,
|
|
358
|
-
...rest
|
|
359
|
-
}
|
|
360
|
-
);
|
|
361
|
-
}
|
|
362
|
-
);
|
|
363
|
-
var DialogFooter = forwardRef5(
|
|
364
|
-
({ className, ...rest }, ref) => {
|
|
365
|
-
const styles = useDialog();
|
|
366
|
-
const css = { ...styles.footer };
|
|
367
|
-
return /* @__PURE__ */ jsx6(
|
|
368
|
-
ModalFooter,
|
|
369
|
-
{
|
|
370
|
-
ref,
|
|
371
|
-
className: cx6("ui-dialog__footer", className),
|
|
372
|
-
__css: css,
|
|
373
|
-
...rest
|
|
374
|
-
}
|
|
375
|
-
);
|
|
376
|
-
}
|
|
377
|
-
);
|
|
378
|
-
|
|
379
|
-
// src/modal.tsx
|
|
380
|
-
import { jsx as jsx7, jsxs as jsxs2 } from "react/jsx-runtime";
|
|
381
|
-
var [ModalProvider, useModal] = createContext2({
|
|
382
|
-
name: `ModalContext`,
|
|
383
|
-
errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
|
|
384
|
-
});
|
|
385
|
-
var Modal = motionForwardRef3(
|
|
386
|
-
({ size, ...props }, ref) => {
|
|
387
|
-
const [styles, mergedProps] = useMultiComponentStyle2("Modal", {
|
|
388
|
-
size,
|
|
389
|
-
...props
|
|
390
|
-
});
|
|
391
|
-
const {
|
|
392
|
-
className,
|
|
393
|
-
children,
|
|
394
|
-
isOpen,
|
|
395
|
-
onClose,
|
|
396
|
-
onOverlayClick,
|
|
397
|
-
onEsc,
|
|
398
|
-
onCloseComplete,
|
|
399
|
-
placement: _placement = "center",
|
|
400
|
-
outside = "fallback(4, 1rem)",
|
|
401
|
-
withCloseButton = true,
|
|
402
|
-
withOverlay = true,
|
|
403
|
-
allowPinchZoom = false,
|
|
404
|
-
scrollBehavior = "inside",
|
|
405
|
-
autoFocus,
|
|
406
|
-
restoreFocus,
|
|
407
|
-
initialFocusRef,
|
|
408
|
-
finalFocusRef,
|
|
409
|
-
blockScrollOnMount = true,
|
|
410
|
-
closeOnOverlay = true,
|
|
411
|
-
closeOnEsc = true,
|
|
412
|
-
lockFocusAcrossFrames = true,
|
|
413
|
-
animation = "scale",
|
|
414
|
-
duration,
|
|
415
|
-
portalProps,
|
|
416
|
-
containerProps,
|
|
417
|
-
...rest
|
|
418
|
-
} = omitThemeProps2(mergedProps);
|
|
419
|
-
const onKeyDown = useCallback(
|
|
420
|
-
(ev) => {
|
|
421
|
-
if (ev.key !== "Escape") return;
|
|
422
|
-
ev.stopPropagation();
|
|
423
|
-
if (closeOnEsc) onClose == null ? void 0 : onClose();
|
|
424
|
-
onEsc == null ? void 0 : onEsc();
|
|
425
|
-
},
|
|
426
|
-
[closeOnEsc, onClose, onEsc]
|
|
427
|
-
);
|
|
428
|
-
const validChildren = getValidChildren2(children);
|
|
429
|
-
const [customModalOverlay, ...cloneChildren] = findChildren2(
|
|
430
|
-
validChildren,
|
|
431
|
-
ModalOverlay,
|
|
432
|
-
DialogOverlay,
|
|
433
|
-
DrawerOverlay
|
|
434
|
-
);
|
|
435
|
-
let [drawerContent] = findChildren2(validChildren, DrawerContent);
|
|
436
|
-
if (drawerContent)
|
|
437
|
-
drawerContent = cloneElement(drawerContent, { onKeyDown });
|
|
438
|
-
const placement = useValue(_placement);
|
|
439
|
-
const css = {
|
|
440
|
-
position: "fixed",
|
|
441
|
-
top: 0,
|
|
442
|
-
left: 0,
|
|
443
|
-
zIndex: "fallback(jeice, 110)",
|
|
444
|
-
w: "100vw",
|
|
445
|
-
h: "100dvh",
|
|
446
|
-
p: size !== "full" ? outside : void 0,
|
|
447
|
-
display: "flex",
|
|
448
|
-
justifyContent: placement.includes("left") ? "flex-start" : placement.includes("right") ? "flex-end" : "center",
|
|
449
|
-
alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
|
|
450
|
-
};
|
|
451
|
-
return /* @__PURE__ */ jsx7(
|
|
452
|
-
ModalProvider,
|
|
453
|
-
{
|
|
454
|
-
value: {
|
|
455
|
-
isOpen,
|
|
456
|
-
onClose,
|
|
457
|
-
onOverlayClick,
|
|
458
|
-
withCloseButton,
|
|
459
|
-
scrollBehavior,
|
|
460
|
-
closeOnOverlay,
|
|
461
|
-
animation,
|
|
462
|
-
duration,
|
|
463
|
-
styles
|
|
464
|
-
},
|
|
465
|
-
children: /* @__PURE__ */ jsx7(AnimatePresence, { onExitComplete: onCloseComplete, children: isOpen ? /* @__PURE__ */ jsx7(Portal, { ...portalProps, children: /* @__PURE__ */ jsx7(
|
|
466
|
-
FocusLock,
|
|
467
|
-
{
|
|
468
|
-
autoFocus,
|
|
469
|
-
initialFocusRef,
|
|
470
|
-
finalFocusRef,
|
|
471
|
-
restoreFocus,
|
|
472
|
-
lockFocusAcrossFrames,
|
|
473
|
-
children: /* @__PURE__ */ jsx7(
|
|
474
|
-
RemoveScroll,
|
|
475
|
-
{
|
|
476
|
-
allowPinchZoom,
|
|
477
|
-
enabled: blockScrollOnMount,
|
|
478
|
-
forwardProps: true,
|
|
479
|
-
children: /* @__PURE__ */ jsxs2(ui4.div, { __css: css, ...containerProps, children: [
|
|
480
|
-
customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ jsx7(ModalOverlay, {}) : null,
|
|
481
|
-
drawerContent != null ? drawerContent : /* @__PURE__ */ jsx7(
|
|
482
|
-
ModalContent,
|
|
483
|
-
{
|
|
484
|
-
ref,
|
|
485
|
-
className,
|
|
486
|
-
onKeyDown,
|
|
487
|
-
...rest,
|
|
488
|
-
children: cloneChildren
|
|
489
|
-
}
|
|
490
|
-
)
|
|
491
|
-
] })
|
|
492
|
-
}
|
|
493
|
-
)
|
|
494
|
-
}
|
|
495
|
-
) }) : null })
|
|
496
|
-
}
|
|
497
|
-
);
|
|
498
|
-
}
|
|
499
|
-
);
|
|
500
|
-
var getModalContentProps = (animation = "scale", duration) => {
|
|
501
|
-
switch (animation) {
|
|
502
|
-
case "scale":
|
|
503
|
-
return {
|
|
504
|
-
...scaleFadeProps,
|
|
505
|
-
custom: { scale: 0.95, reverse: true, duration }
|
|
506
|
-
};
|
|
507
|
-
case "top":
|
|
508
|
-
return {
|
|
509
|
-
...slideFadeProps,
|
|
510
|
-
custom: { offsetY: -16, reverse: true, duration }
|
|
511
|
-
};
|
|
512
|
-
case "right":
|
|
513
|
-
return {
|
|
514
|
-
...slideFadeProps,
|
|
515
|
-
custom: { offsetX: 16, reverse: true, duration }
|
|
516
|
-
};
|
|
517
|
-
case "left":
|
|
518
|
-
return {
|
|
519
|
-
...slideFadeProps,
|
|
520
|
-
custom: { offsetX: -16, reverse: true, duration }
|
|
521
|
-
};
|
|
522
|
-
case "bottom":
|
|
523
|
-
return {
|
|
524
|
-
...slideFadeProps,
|
|
525
|
-
custom: { offsetY: 16, reverse: true, duration }
|
|
526
|
-
};
|
|
527
|
-
}
|
|
528
|
-
};
|
|
529
|
-
var ModalContent = motionForwardRef3(
|
|
530
|
-
({ className, children, __css, ...rest }, ref) => {
|
|
531
|
-
const {
|
|
532
|
-
styles,
|
|
533
|
-
scrollBehavior,
|
|
534
|
-
withCloseButton,
|
|
535
|
-
onClose,
|
|
536
|
-
animation,
|
|
537
|
-
duration
|
|
538
|
-
} = useModal();
|
|
539
|
-
const validChildren = getValidChildren2(children);
|
|
540
|
-
const [customModalCloseButton, ...cloneChildren] = findChildren2(
|
|
541
|
-
validChildren,
|
|
542
|
-
ModalCloseButton,
|
|
543
|
-
DialogCloseButton
|
|
544
|
-
);
|
|
545
|
-
const props = animation !== "none" ? getModalContentProps(animation, duration) : {};
|
|
546
|
-
const css = {
|
|
547
|
-
position: "relative",
|
|
548
|
-
maxH: "100%",
|
|
549
|
-
display: "flex",
|
|
550
|
-
flexDirection: "column",
|
|
551
|
-
overflow: scrollBehavior === "inside" ? "hidden" : "auto",
|
|
552
|
-
outline: 0,
|
|
553
|
-
...__css ? __css : styles.container
|
|
554
|
-
};
|
|
555
|
-
return /* @__PURE__ */ jsxs2(
|
|
556
|
-
motion2.section,
|
|
557
|
-
{
|
|
558
|
-
role: "dialog",
|
|
559
|
-
"aria-modal": "true",
|
|
560
|
-
ref,
|
|
561
|
-
className: cx7("ui-modal", className),
|
|
562
|
-
tabIndex: -1,
|
|
563
|
-
__css: css,
|
|
564
|
-
...props,
|
|
565
|
-
...rest,
|
|
566
|
-
children: [
|
|
567
|
-
customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */ jsx7(ModalCloseButton, {}) : null,
|
|
568
|
-
cloneChildren
|
|
569
|
-
]
|
|
570
|
-
}
|
|
571
|
-
);
|
|
572
|
-
}
|
|
573
|
-
);
|
|
574
|
-
|
|
575
|
-
// src/drawer.tsx
|
|
576
|
-
import { jsx as jsx8, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
577
|
-
var [DrawerProvider, useDrawer] = createContext3({
|
|
578
|
-
name: `DrawerContext`,
|
|
579
|
-
errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
|
|
580
|
-
});
|
|
581
|
-
var Drawer = motionForwardRef4(
|
|
582
|
-
({ size, placement = "right", closeOnDrag = false, ...props }, ref) => {
|
|
583
|
-
const [styles, mergedProps] = useMultiComponentStyle3("Drawer", {
|
|
584
|
-
size,
|
|
585
|
-
placement,
|
|
586
|
-
closeOnDrag,
|
|
587
|
-
...props
|
|
588
|
-
});
|
|
589
|
-
const {
|
|
590
|
-
children,
|
|
591
|
-
isOpen,
|
|
592
|
-
onClose,
|
|
593
|
-
onOverlayClick,
|
|
594
|
-
onEsc,
|
|
595
|
-
onCloseComplete,
|
|
596
|
-
withCloseButton = !closeOnDrag,
|
|
597
|
-
withOverlay = true,
|
|
598
|
-
withDragBar = true,
|
|
599
|
-
allowPinchZoom,
|
|
600
|
-
autoFocus,
|
|
601
|
-
restoreFocus,
|
|
602
|
-
initialFocusRef,
|
|
603
|
-
finalFocusRef,
|
|
604
|
-
blockScrollOnMount,
|
|
605
|
-
closeOnOverlay,
|
|
606
|
-
closeOnEsc,
|
|
607
|
-
lockFocusAcrossFrames,
|
|
608
|
-
duration = { enter: 0.4, exit: 0.3 },
|
|
609
|
-
dragConstraints = 0,
|
|
610
|
-
dragElastic = 0.1,
|
|
611
|
-
dragOffset = 80,
|
|
612
|
-
dragVelocity = 100,
|
|
613
|
-
blankForDragProps,
|
|
614
|
-
portalProps,
|
|
615
|
-
containerProps,
|
|
616
|
-
...rest
|
|
617
|
-
} = omitThemeProps3(mergedProps, ["isFullHeight"]);
|
|
618
|
-
const validChildren = getValidChildren3(children);
|
|
619
|
-
const [customDrawerOverlay, ...cloneChildren] = findChildren3(
|
|
620
|
-
validChildren,
|
|
621
|
-
DrawerOverlay
|
|
622
|
-
);
|
|
623
|
-
return /* @__PURE__ */ jsx8(DrawerProvider, { value: styles, children: /* @__PURE__ */ jsxs3(
|
|
624
|
-
Modal,
|
|
625
|
-
{
|
|
626
|
-
ref,
|
|
627
|
-
...{
|
|
628
|
-
isOpen,
|
|
629
|
-
onClose,
|
|
630
|
-
onOverlayClick,
|
|
631
|
-
onEsc,
|
|
632
|
-
onCloseComplete,
|
|
633
|
-
withCloseButton: false,
|
|
634
|
-
withOverlay: false,
|
|
635
|
-
allowPinchZoom,
|
|
636
|
-
autoFocus,
|
|
637
|
-
restoreFocus,
|
|
638
|
-
initialFocusRef,
|
|
639
|
-
finalFocusRef,
|
|
640
|
-
blockScrollOnMount,
|
|
641
|
-
closeOnOverlay,
|
|
642
|
-
closeOnEsc,
|
|
643
|
-
lockFocusAcrossFrames,
|
|
644
|
-
duration,
|
|
645
|
-
portalProps,
|
|
646
|
-
containerProps
|
|
647
|
-
},
|
|
648
|
-
children: [
|
|
649
|
-
customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ jsx8(DrawerOverlay, {}) : null,
|
|
650
|
-
/* @__PURE__ */ jsx8(
|
|
651
|
-
DrawerContent,
|
|
652
|
-
{
|
|
653
|
-
...{
|
|
654
|
-
dragConstraints,
|
|
655
|
-
dragElastic,
|
|
656
|
-
dragOffset,
|
|
657
|
-
dragVelocity,
|
|
658
|
-
withCloseButton,
|
|
659
|
-
withDragBar,
|
|
660
|
-
blankForDragProps,
|
|
661
|
-
...rest,
|
|
662
|
-
placement,
|
|
663
|
-
closeOnDrag
|
|
664
|
-
},
|
|
665
|
-
children: cloneChildren
|
|
666
|
-
}
|
|
667
|
-
)
|
|
668
|
-
]
|
|
669
|
-
}
|
|
670
|
-
) });
|
|
671
|
-
}
|
|
672
|
-
);
|
|
673
|
-
var DrawerContent = motionForwardRef4(
|
|
674
|
-
({
|
|
675
|
-
className,
|
|
676
|
-
children,
|
|
677
|
-
placement: _placement,
|
|
678
|
-
withCloseButton,
|
|
679
|
-
withDragBar,
|
|
680
|
-
closeOnDrag,
|
|
681
|
-
dragConstraints,
|
|
682
|
-
dragElastic,
|
|
683
|
-
dragOffset,
|
|
684
|
-
dragVelocity,
|
|
685
|
-
blankForDragProps,
|
|
686
|
-
...rest
|
|
687
|
-
}, ref) => {
|
|
688
|
-
const { isOpen, onClose, duration } = useModal();
|
|
689
|
-
const styles = useDrawer();
|
|
690
|
-
const placement = useValue2(_placement);
|
|
691
|
-
const validChildren = getValidChildren3(children);
|
|
692
|
-
const [customDrawerCloseButton, ...cloneChildren] = findChildren3(
|
|
693
|
-
validChildren,
|
|
694
|
-
DrawerCloseButton
|
|
695
|
-
);
|
|
696
|
-
const blankForDragBg = useMemo(() => {
|
|
697
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _i, _j;
|
|
698
|
-
const propBg = (_c = (_b = (_a = rest.backgroundColor) != null ? _a : rest.bgColor) != null ? _b : rest.background) != null ? _c : rest.bg;
|
|
699
|
-
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;
|
|
700
|
-
const computedBg = propBg != null ? propBg : styleBg;
|
|
701
|
-
return isArray(computedBg) ? computedBg : [computedBg];
|
|
702
|
-
}, [rest, styles]);
|
|
703
|
-
const blankForDrag = useMemo(() => {
|
|
704
|
-
let position = {};
|
|
705
|
-
switch (placement) {
|
|
706
|
-
case "top":
|
|
707
|
-
position = { top: "calc(-100dvh + 1px)", left: 0, right: 0 };
|
|
708
|
-
break;
|
|
709
|
-
case "bottom":
|
|
710
|
-
position = { bottom: "calc(-100dvh + 1px)", left: 0, right: 0 };
|
|
711
|
-
break;
|
|
712
|
-
case "left":
|
|
713
|
-
position = { left: "calc(-100% + 1px)", top: 0, bottom: 0 };
|
|
714
|
-
break;
|
|
715
|
-
case "right":
|
|
716
|
-
position = { right: "calc(-100% + 1px)", top: 0, bottom: 0 };
|
|
717
|
-
break;
|
|
718
|
-
}
|
|
719
|
-
const [lightBg, darkBg] = blankForDragBg;
|
|
720
|
-
return {
|
|
721
|
-
_after: {
|
|
722
|
-
content: '""',
|
|
723
|
-
display: "block",
|
|
724
|
-
w: "100%",
|
|
725
|
-
h: "100dvh",
|
|
726
|
-
bg: lightBg,
|
|
727
|
-
position: "absolute",
|
|
728
|
-
...position,
|
|
729
|
-
...blankForDragProps
|
|
730
|
-
},
|
|
731
|
-
_dark: {
|
|
732
|
-
_after: {
|
|
733
|
-
bg: darkBg
|
|
734
|
-
}
|
|
735
|
-
}
|
|
736
|
-
};
|
|
737
|
-
}, [placement, blankForDragBg, blankForDragProps]);
|
|
738
|
-
const css = useMemo(
|
|
739
|
-
() => ({
|
|
740
|
-
display: "flex",
|
|
741
|
-
flexDirection: placement === "top" || placement === "bottom" ? "column" : "row",
|
|
742
|
-
outline: 0,
|
|
743
|
-
...closeOnDrag ? blankForDrag : {},
|
|
744
|
-
...styles.container
|
|
745
|
-
}),
|
|
746
|
-
[blankForDrag, closeOnDrag, placement, styles]
|
|
747
|
-
);
|
|
748
|
-
const getDragDirectionRestriction = useCallback2(
|
|
749
|
-
(value) => {
|
|
750
|
-
switch (placement) {
|
|
751
|
-
case "top":
|
|
752
|
-
return { bottom: value };
|
|
753
|
-
case "bottom":
|
|
754
|
-
return { top: value };
|
|
755
|
-
case "left":
|
|
756
|
-
return { right: value };
|
|
757
|
-
case "right":
|
|
758
|
-
return { left: value };
|
|
759
|
-
}
|
|
760
|
-
},
|
|
761
|
-
[placement]
|
|
762
|
-
);
|
|
763
|
-
const getDragDirection = useCallback2(() => {
|
|
764
|
-
switch (placement) {
|
|
765
|
-
case "top":
|
|
766
|
-
case "bottom":
|
|
767
|
-
return "y";
|
|
768
|
-
case "left":
|
|
769
|
-
case "right":
|
|
770
|
-
return "x";
|
|
771
|
-
}
|
|
772
|
-
}, [placement]);
|
|
773
|
-
const isCloseByDragInfo = useCallback2(
|
|
774
|
-
(info) => {
|
|
775
|
-
switch (placement) {
|
|
776
|
-
case "top":
|
|
777
|
-
return info.velocity.y <= dragVelocity * -1 || info.offset.y <= dragOffset * -1;
|
|
778
|
-
case "bottom":
|
|
779
|
-
return info.velocity.y >= dragVelocity || info.offset.y >= dragOffset;
|
|
780
|
-
case "left":
|
|
781
|
-
return info.velocity.x <= dragVelocity * -1 || info.offset.x <= dragOffset * -1;
|
|
782
|
-
case "right":
|
|
783
|
-
return info.velocity.x >= dragVelocity || info.offset.x >= dragOffset;
|
|
784
|
-
}
|
|
785
|
-
},
|
|
786
|
-
[placement, dragVelocity, dragOffset]
|
|
787
|
-
);
|
|
788
|
-
return /* @__PURE__ */ jsxs3(
|
|
789
|
-
Slide,
|
|
790
|
-
{
|
|
791
|
-
ref,
|
|
792
|
-
className: cx8("ui-drawer", className),
|
|
793
|
-
isOpen,
|
|
794
|
-
placement,
|
|
795
|
-
duration,
|
|
796
|
-
drag: closeOnDrag ? getDragDirection() : false,
|
|
797
|
-
dragConstraints: getDragDirectionRestriction(dragConstraints),
|
|
798
|
-
dragElastic: getDragDirectionRestriction(dragElastic),
|
|
799
|
-
dragSnapToOrigin: true,
|
|
800
|
-
dragMomentum: false,
|
|
801
|
-
onDragEnd: (_, info) => {
|
|
802
|
-
if (isCloseByDragInfo(info)) onClose == null ? void 0 : onClose();
|
|
803
|
-
},
|
|
804
|
-
tabIndex: -1,
|
|
805
|
-
__css: css,
|
|
806
|
-
...rest,
|
|
807
|
-
children: [
|
|
808
|
-
customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ jsx8(DrawerCloseButton, {}) : null,
|
|
809
|
-
withDragBar && closeOnDrag && (placement === "bottom" || placement === "right") ? /* @__PURE__ */ jsx8(DrawerDragBar, {}) : null,
|
|
810
|
-
/* @__PURE__ */ jsx8(
|
|
811
|
-
ui5.div,
|
|
812
|
-
{
|
|
813
|
-
className: "ui-drawer__inner",
|
|
814
|
-
__css: { display: "flex", flexDirection: "column", ...styles.inner },
|
|
815
|
-
children: cloneChildren
|
|
816
|
-
}
|
|
817
|
-
),
|
|
818
|
-
withDragBar && closeOnDrag && (placement === "top" || placement === "left") ? /* @__PURE__ */ jsx8(DrawerDragBar, {}) : null
|
|
819
|
-
]
|
|
820
|
-
}
|
|
821
|
-
);
|
|
822
|
-
}
|
|
823
|
-
);
|
|
824
|
-
var DrawerOverlay = motionForwardRef4(
|
|
825
|
-
({ className, ...rest }, ref) => {
|
|
826
|
-
const styles = useDrawer();
|
|
827
|
-
const css = { ...styles.overlay };
|
|
828
|
-
return /* @__PURE__ */ jsx8(
|
|
829
|
-
ModalOverlay,
|
|
830
|
-
{
|
|
831
|
-
ref,
|
|
832
|
-
className: cx8("ui-drawer__overlay", className),
|
|
833
|
-
__css: css,
|
|
834
|
-
...rest
|
|
835
|
-
}
|
|
836
|
-
);
|
|
837
|
-
}
|
|
838
|
-
);
|
|
839
|
-
var DrawerDragBar = ({
|
|
840
|
-
className,
|
|
841
|
-
...rest
|
|
842
|
-
}) => {
|
|
843
|
-
const styles = useDrawer();
|
|
844
|
-
const css = { ...styles.dragBar };
|
|
845
|
-
return /* @__PURE__ */ jsx8(
|
|
846
|
-
ui5.div,
|
|
847
|
-
{
|
|
848
|
-
className: cx8("ui-drawer__drag-bar", className),
|
|
849
|
-
__css: css,
|
|
850
|
-
...rest
|
|
851
|
-
}
|
|
852
|
-
);
|
|
853
|
-
};
|
|
854
|
-
var DrawerCloseButton = forwardRef6(
|
|
855
|
-
({ className, ...rest }, ref) => {
|
|
856
|
-
const styles = useDrawer();
|
|
857
|
-
const css = { ...styles.closeButton };
|
|
858
|
-
return /* @__PURE__ */ jsx8(
|
|
859
|
-
ModalCloseButton,
|
|
860
|
-
{
|
|
861
|
-
ref,
|
|
862
|
-
className: cx8("ui-drawer__close-button", className),
|
|
863
|
-
__css: css,
|
|
864
|
-
...rest
|
|
865
|
-
}
|
|
866
|
-
);
|
|
867
|
-
}
|
|
868
|
-
);
|
|
869
|
-
var DrawerHeader = forwardRef6(
|
|
870
|
-
({ className, ...rest }, ref) => {
|
|
871
|
-
const styles = useDrawer();
|
|
872
|
-
const css = { ...styles.header };
|
|
873
|
-
return /* @__PURE__ */ jsx8(
|
|
874
|
-
ModalHeader,
|
|
875
|
-
{
|
|
876
|
-
ref,
|
|
877
|
-
className: cx8("ui-drawer__header", className),
|
|
878
|
-
__css: css,
|
|
879
|
-
...rest
|
|
880
|
-
}
|
|
881
|
-
);
|
|
882
|
-
}
|
|
883
|
-
);
|
|
884
|
-
var DrawerBody = forwardRef6(
|
|
885
|
-
({ className, ...rest }, ref) => {
|
|
886
|
-
const styles = useDrawer();
|
|
887
|
-
const css = { ...styles.body };
|
|
888
|
-
return /* @__PURE__ */ jsx8(
|
|
889
|
-
ModalBody,
|
|
890
|
-
{
|
|
891
|
-
ref,
|
|
892
|
-
className: cx8("ui-drawer__body", className),
|
|
893
|
-
__css: css,
|
|
894
|
-
...rest
|
|
895
|
-
}
|
|
896
|
-
);
|
|
897
|
-
}
|
|
898
|
-
);
|
|
899
|
-
var DrawerFooter = forwardRef6(
|
|
900
|
-
({ className, ...rest }, ref) => {
|
|
901
|
-
const styles = useDrawer();
|
|
902
|
-
const css = { ...styles.footer };
|
|
903
|
-
return /* @__PURE__ */ jsx8(
|
|
904
|
-
ModalFooter,
|
|
905
|
-
{
|
|
906
|
-
ref,
|
|
907
|
-
className: cx8("ui-drawer__footer", className),
|
|
908
|
-
__css: css,
|
|
909
|
-
...rest
|
|
910
|
-
}
|
|
911
|
-
);
|
|
912
|
-
}
|
|
913
|
-
);
|
|
914
|
-
|
|
915
|
-
export {
|
|
916
|
-
Drawer,
|
|
917
|
-
DrawerContent,
|
|
918
|
-
DrawerOverlay,
|
|
919
|
-
DrawerDragBar,
|
|
920
|
-
DrawerCloseButton,
|
|
921
|
-
DrawerHeader,
|
|
922
|
-
DrawerBody,
|
|
923
|
-
DrawerFooter,
|
|
924
|
-
useModal,
|
|
925
|
-
Modal,
|
|
926
|
-
ModalOverlay,
|
|
927
|
-
ModalCloseButton,
|
|
928
|
-
ModalHeader,
|
|
929
|
-
ModalBody,
|
|
930
|
-
ModalFooter,
|
|
931
|
-
Dialog,
|
|
932
|
-
DialogOverlay,
|
|
933
|
-
DialogCloseButton,
|
|
934
|
-
DialogHeader,
|
|
935
|
-
DialogBody,
|
|
936
|
-
DialogFooter
|
|
937
|
-
};
|
|
938
|
-
//# sourceMappingURL=chunk-7PS3HWMF.mjs.map
|