@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/modal.js
CHANGED
|
@@ -21,32 +21,41 @@ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: tru
|
|
|
21
21
|
// src/modal.tsx
|
|
22
22
|
var modal_exports = {};
|
|
23
23
|
__export(modal_exports, {
|
|
24
|
-
Modal: () => Modal
|
|
25
|
-
useModal: () => useModal
|
|
24
|
+
Modal: () => Modal
|
|
26
25
|
});
|
|
27
26
|
module.exports = __toCommonJS(modal_exports);
|
|
28
|
-
var
|
|
27
|
+
var import_core6 = require("@yamada-ui/core");
|
|
29
28
|
var import_focus_lock = require("@yamada-ui/focus-lock");
|
|
30
|
-
var
|
|
29
|
+
var import_motion6 = require("@yamada-ui/motion");
|
|
31
30
|
var import_portal = require("@yamada-ui/portal");
|
|
32
|
-
var import_transitions3 = require("@yamada-ui/transitions");
|
|
33
31
|
var import_use_value2 = require("@yamada-ui/use-value");
|
|
34
|
-
var
|
|
32
|
+
var import_utils11 = require("@yamada-ui/utils");
|
|
35
33
|
var import_react2 = require("react");
|
|
36
34
|
var import_react_remove_scroll = require("react-remove-scroll");
|
|
37
35
|
|
|
38
|
-
// src/
|
|
39
|
-
var
|
|
40
|
-
var
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
var
|
|
44
|
-
var
|
|
36
|
+
// src/dialog-overlay.tsx
|
|
37
|
+
var import_motion2 = require("@yamada-ui/motion");
|
|
38
|
+
var import_utils3 = require("@yamada-ui/utils");
|
|
39
|
+
|
|
40
|
+
// src/modal-context.ts
|
|
41
|
+
var import_utils = require("@yamada-ui/utils");
|
|
42
|
+
var [ModalProvider, useModal] = (0, import_utils.createContext)({
|
|
43
|
+
name: `ModalContext`,
|
|
44
|
+
errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
|
|
45
|
+
});
|
|
46
|
+
var [DialogProvider, useDialog] = (0, import_utils.createContext)({
|
|
47
|
+
name: `DialogContext`,
|
|
48
|
+
errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
|
|
49
|
+
});
|
|
50
|
+
var [DrawerProvider, useDrawer] = (0, import_utils.createContext)({
|
|
51
|
+
name: `DrawerContext`,
|
|
52
|
+
errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
|
|
53
|
+
});
|
|
45
54
|
|
|
46
55
|
// src/modal-overlay.tsx
|
|
47
56
|
var import_motion = require("@yamada-ui/motion");
|
|
48
57
|
var import_transitions = require("@yamada-ui/transitions");
|
|
49
|
-
var
|
|
58
|
+
var import_utils2 = require("@yamada-ui/utils");
|
|
50
59
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
51
60
|
var ModalOverlay = (0, import_motion.motionForwardRef)(
|
|
52
61
|
({ className, __css, onClick, ...rest }, ref) => {
|
|
@@ -71,10 +80,10 @@ var ModalOverlay = (0, import_motion.motionForwardRef)(
|
|
|
71
80
|
import_motion.motion.div,
|
|
72
81
|
{
|
|
73
82
|
ref,
|
|
74
|
-
className: (0,
|
|
83
|
+
className: (0, import_utils2.cx)("ui-modal__overlay", className),
|
|
75
84
|
custom: { duration },
|
|
76
85
|
__css: css,
|
|
77
|
-
onClick: (0,
|
|
86
|
+
onClick: (0, import_utils2.handlerAll)(onClick, onOverlayClick, (ev) => {
|
|
78
87
|
ev.stopPropagation();
|
|
79
88
|
if (closeOnOverlay) onClose == null ? void 0 : onClose();
|
|
80
89
|
}),
|
|
@@ -85,78 +94,75 @@ var ModalOverlay = (0, import_motion.motionForwardRef)(
|
|
|
85
94
|
}
|
|
86
95
|
);
|
|
87
96
|
|
|
88
|
-
// src/
|
|
89
|
-
var import_close_button = require("@yamada-ui/close-button");
|
|
90
|
-
var import_core = require("@yamada-ui/core");
|
|
91
|
-
var import_utils2 = require("@yamada-ui/utils");
|
|
97
|
+
// src/dialog-overlay.tsx
|
|
92
98
|
var import_jsx_runtime2 = require("react/jsx-runtime");
|
|
93
|
-
var
|
|
94
|
-
({
|
|
95
|
-
const
|
|
96
|
-
const css = {
|
|
97
|
-
position: "absolute",
|
|
98
|
-
...__css ? __css : styles.closeButton
|
|
99
|
-
};
|
|
99
|
+
var DialogOverlay = (0, import_motion2.motionForwardRef)(
|
|
100
|
+
({ className, ...rest }, ref) => {
|
|
101
|
+
const styles = useDialog();
|
|
102
|
+
const css = { ...styles.overlay };
|
|
100
103
|
return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
|
|
101
|
-
|
|
104
|
+
ModalOverlay,
|
|
102
105
|
{
|
|
103
106
|
ref,
|
|
104
|
-
className: (0,
|
|
107
|
+
className: (0, import_utils3.cx)("ui-dialog__overlay", className),
|
|
105
108
|
__css: css,
|
|
106
|
-
onClick: (0, import_utils2.handlerAll)(onClick, (ev) => {
|
|
107
|
-
ev.stopPropagation();
|
|
108
|
-
onClose == null ? void 0 : onClose();
|
|
109
|
-
}),
|
|
110
109
|
...rest
|
|
111
110
|
}
|
|
112
111
|
);
|
|
113
112
|
}
|
|
114
113
|
);
|
|
115
114
|
|
|
116
|
-
// src/
|
|
115
|
+
// src/drawer-content.tsx
|
|
116
|
+
var import_core4 = require("@yamada-ui/core");
|
|
117
|
+
var import_motion3 = require("@yamada-ui/motion");
|
|
118
|
+
var import_transitions2 = require("@yamada-ui/transitions");
|
|
119
|
+
var import_use_value = require("@yamada-ui/use-value");
|
|
120
|
+
var import_utils7 = require("@yamada-ui/utils");
|
|
121
|
+
var import_react = require("react");
|
|
122
|
+
|
|
123
|
+
// src/drawer-close-button.tsx
|
|
117
124
|
var import_core2 = require("@yamada-ui/core");
|
|
118
|
-
var
|
|
125
|
+
var import_utils5 = require("@yamada-ui/utils");
|
|
126
|
+
|
|
127
|
+
// src/modal-close-button.tsx
|
|
128
|
+
var import_close_button = require("@yamada-ui/close-button");
|
|
129
|
+
var import_core = require("@yamada-ui/core");
|
|
130
|
+
var import_utils4 = require("@yamada-ui/utils");
|
|
119
131
|
var import_jsx_runtime3 = require("react/jsx-runtime");
|
|
120
|
-
var
|
|
121
|
-
({
|
|
122
|
-
const { styles } = useModal();
|
|
132
|
+
var ModalCloseButton = (0, import_core.forwardRef)(
|
|
133
|
+
({ onClick, __css, ...rest }, ref) => {
|
|
134
|
+
const { styles, onClose } = useModal();
|
|
123
135
|
const css = {
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
justifyContent: "flex-start",
|
|
127
|
-
...__css ? __css : styles.header
|
|
136
|
+
position: "absolute",
|
|
137
|
+
...__css ? __css : styles.closeButton
|
|
128
138
|
};
|
|
129
139
|
return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
|
|
130
|
-
|
|
140
|
+
import_close_button.CloseButton,
|
|
131
141
|
{
|
|
132
142
|
ref,
|
|
133
|
-
className: (0,
|
|
143
|
+
className: (0, import_utils4.cx)("ui-modal__close-button"),
|
|
134
144
|
__css: css,
|
|
145
|
+
onClick: (0, import_utils4.handlerAll)(onClick, (ev) => {
|
|
146
|
+
ev.stopPropagation();
|
|
147
|
+
onClose == null ? void 0 : onClose();
|
|
148
|
+
}),
|
|
135
149
|
...rest
|
|
136
150
|
}
|
|
137
151
|
);
|
|
138
152
|
}
|
|
139
153
|
);
|
|
140
154
|
|
|
141
|
-
// src/
|
|
142
|
-
var import_core3 = require("@yamada-ui/core");
|
|
143
|
-
var import_utils4 = require("@yamada-ui/utils");
|
|
155
|
+
// src/drawer-close-button.tsx
|
|
144
156
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
145
|
-
var
|
|
146
|
-
({ className,
|
|
147
|
-
const
|
|
148
|
-
const css = {
|
|
149
|
-
display: "flex",
|
|
150
|
-
flexDirection: "column",
|
|
151
|
-
alignItems: "flex-start",
|
|
152
|
-
overflow: scrollBehavior === "inside" ? "auto" : void 0,
|
|
153
|
-
...__css ? __css : styles.body
|
|
154
|
-
};
|
|
157
|
+
var DrawerCloseButton = (0, import_core2.forwardRef)(
|
|
158
|
+
({ className, ...rest }, ref) => {
|
|
159
|
+
const styles = useDrawer();
|
|
160
|
+
const css = { ...styles.closeButton };
|
|
155
161
|
return /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
156
|
-
|
|
162
|
+
ModalCloseButton,
|
|
157
163
|
{
|
|
158
164
|
ref,
|
|
159
|
-
className: (0,
|
|
165
|
+
className: (0, import_utils5.cx)("ui-drawer__close-button", className),
|
|
160
166
|
__css: css,
|
|
161
167
|
...rest
|
|
162
168
|
}
|
|
@@ -164,24 +170,19 @@ var ModalBody = (0, import_core3.forwardRef)(
|
|
|
164
170
|
}
|
|
165
171
|
);
|
|
166
172
|
|
|
167
|
-
// src/
|
|
168
|
-
var
|
|
169
|
-
var
|
|
173
|
+
// src/drawer-drag-bar.tsx
|
|
174
|
+
var import_core3 = require("@yamada-ui/core");
|
|
175
|
+
var import_utils6 = require("@yamada-ui/utils");
|
|
170
176
|
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
171
|
-
var
|
|
177
|
+
var DrawerDragBar = (0, import_core3.forwardRef)(
|
|
172
178
|
({ className, __css, ...rest }, ref) => {
|
|
173
|
-
const
|
|
174
|
-
const css = {
|
|
175
|
-
display: "flex",
|
|
176
|
-
alignItems: "center",
|
|
177
|
-
justifyContent: "flex-end",
|
|
178
|
-
...__css ? __css : styles.footer
|
|
179
|
-
};
|
|
179
|
+
const styles = useDrawer();
|
|
180
|
+
const css = { ...styles.dragBar };
|
|
180
181
|
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
181
|
-
|
|
182
|
+
import_core3.ui.div,
|
|
182
183
|
{
|
|
183
184
|
ref,
|
|
184
|
-
className: (0,
|
|
185
|
+
className: (0, import_utils6.cx)("ui-drawer__drag-bar", className),
|
|
185
186
|
__css: css,
|
|
186
187
|
...rest
|
|
187
188
|
}
|
|
@@ -189,287 +190,8 @@ var ModalFooter = (0, import_core4.forwardRef)(
|
|
|
189
190
|
}
|
|
190
191
|
);
|
|
191
192
|
|
|
192
|
-
// src/
|
|
193
|
-
var import_button = require("@yamada-ui/button");
|
|
194
|
-
var import_core5 = require("@yamada-ui/core");
|
|
195
|
-
var import_motion2 = require("@yamada-ui/motion");
|
|
196
|
-
var import_utils6 = require("@yamada-ui/utils");
|
|
193
|
+
// src/drawer-content.tsx
|
|
197
194
|
var import_jsx_runtime6 = require("react/jsx-runtime");
|
|
198
|
-
var [DialogProvider, useDialog] = (0, import_utils6.createContext)({
|
|
199
|
-
name: `DialogContext`,
|
|
200
|
-
errorMessage: `useDialog returned is 'undefined'. Seems you forgot to wrap the components in "<Dialog />" `
|
|
201
|
-
});
|
|
202
|
-
var Dialog = (0, import_motion2.motionForwardRef)(
|
|
203
|
-
({ size, ...props }, ref) => {
|
|
204
|
-
const [styles, mergedProps] = (0, import_core5.useMultiComponentStyle)("Dialog", {
|
|
205
|
-
size,
|
|
206
|
-
...props
|
|
207
|
-
});
|
|
208
|
-
const {
|
|
209
|
-
className,
|
|
210
|
-
children,
|
|
211
|
-
withOverlay = true,
|
|
212
|
-
withCloseButton = true,
|
|
213
|
-
header,
|
|
214
|
-
footer,
|
|
215
|
-
cancel,
|
|
216
|
-
other,
|
|
217
|
-
success,
|
|
218
|
-
onClose,
|
|
219
|
-
onCancel,
|
|
220
|
-
onOther,
|
|
221
|
-
onSuccess,
|
|
222
|
-
containerProps,
|
|
223
|
-
...rest
|
|
224
|
-
} = (0, import_core5.omitThemeProps)(mergedProps);
|
|
225
|
-
const validChildren = (0, import_utils6.getValidChildren)(children);
|
|
226
|
-
const [customDialogOverlay] = (0, import_utils6.findChildren)(validChildren, DialogOverlay);
|
|
227
|
-
const [customDialogCloseButton] = (0, import_utils6.findChildren)(
|
|
228
|
-
validChildren,
|
|
229
|
-
DialogCloseButton
|
|
230
|
-
);
|
|
231
|
-
const [customDialogHeader] = (0, import_utils6.findChildren)(validChildren, DialogHeader);
|
|
232
|
-
const [customDialogBody] = (0, import_utils6.findChildren)(validChildren, DialogBody);
|
|
233
|
-
const [customDialogFooter] = (0, import_utils6.findChildren)(validChildren, DialogFooter);
|
|
234
|
-
const cloneChildren = !(0, import_utils6.isEmpty)(validChildren) ? (0, import_utils6.omitChildren)(
|
|
235
|
-
validChildren,
|
|
236
|
-
DialogOverlay,
|
|
237
|
-
DialogCloseButton,
|
|
238
|
-
DialogHeader,
|
|
239
|
-
DialogBody,
|
|
240
|
-
DialogFooter
|
|
241
|
-
) : children;
|
|
242
|
-
const css = { ...styles.container };
|
|
243
|
-
const cancelButtonProps = (0, import_utils6.isValidElement)(cancel) ? { children: cancel } : cancel;
|
|
244
|
-
const otherButtonProps = (0, import_utils6.isValidElement)(other) ? { children: other } : other;
|
|
245
|
-
const successButtonProps = (0, import_utils6.isValidElement)(success) ? { children: success } : success;
|
|
246
|
-
if (cancelButtonProps && !cancelButtonProps.variant)
|
|
247
|
-
cancelButtonProps.variant = "ghost";
|
|
248
|
-
if (otherButtonProps && !otherButtonProps.colorScheme)
|
|
249
|
-
otherButtonProps.colorScheme = "secondary";
|
|
250
|
-
if (successButtonProps && !successButtonProps.colorScheme)
|
|
251
|
-
successButtonProps.colorScheme = "primary";
|
|
252
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
253
|
-
Modal,
|
|
254
|
-
{
|
|
255
|
-
ref,
|
|
256
|
-
className: (0, import_utils6.cx)("ui-dialog", className),
|
|
257
|
-
__css: css,
|
|
258
|
-
...{
|
|
259
|
-
onClose,
|
|
260
|
-
withOverlay: false,
|
|
261
|
-
withCloseButton: false,
|
|
262
|
-
containerProps,
|
|
263
|
-
...rest,
|
|
264
|
-
size
|
|
265
|
-
},
|
|
266
|
-
children: [
|
|
267
|
-
customDialogOverlay != null ? customDialogOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogOverlay, {}) : null,
|
|
268
|
-
customDialogCloseButton != null ? customDialogCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogCloseButton, {}) : null,
|
|
269
|
-
customDialogHeader != null ? customDialogHeader : header ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogHeader, { children: header }) : null,
|
|
270
|
-
customDialogBody != null ? customDialogBody : cloneChildren ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DialogBody, { children: cloneChildren }) : null,
|
|
271
|
-
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: [
|
|
272
|
-
cancelButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
273
|
-
import_button.Button,
|
|
274
|
-
{
|
|
275
|
-
onClick: () => onCancel == null ? void 0 : onCancel(onClose),
|
|
276
|
-
...cancelButtonProps
|
|
277
|
-
}
|
|
278
|
-
) : null,
|
|
279
|
-
otherButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
280
|
-
import_button.Button,
|
|
281
|
-
{
|
|
282
|
-
onClick: () => onOther == null ? void 0 : onOther(onClose),
|
|
283
|
-
...otherButtonProps
|
|
284
|
-
}
|
|
285
|
-
) : null,
|
|
286
|
-
successButtonProps ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
287
|
-
import_button.Button,
|
|
288
|
-
{
|
|
289
|
-
onClick: () => onSuccess == null ? void 0 : onSuccess(onClose),
|
|
290
|
-
...successButtonProps
|
|
291
|
-
}
|
|
292
|
-
) : null
|
|
293
|
-
] }) }) : null
|
|
294
|
-
]
|
|
295
|
-
}
|
|
296
|
-
) });
|
|
297
|
-
}
|
|
298
|
-
);
|
|
299
|
-
var DialogOverlay = (0, import_motion2.motionForwardRef)(
|
|
300
|
-
({ className, ...rest }, ref) => {
|
|
301
|
-
const styles = useDialog();
|
|
302
|
-
const css = { ...styles.overlay };
|
|
303
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
304
|
-
ModalOverlay,
|
|
305
|
-
{
|
|
306
|
-
ref,
|
|
307
|
-
className: (0, import_utils6.cx)("ui-dialog__overlay", className),
|
|
308
|
-
__css: css,
|
|
309
|
-
...rest
|
|
310
|
-
}
|
|
311
|
-
);
|
|
312
|
-
}
|
|
313
|
-
);
|
|
314
|
-
var DialogCloseButton = (0, import_core5.forwardRef)(
|
|
315
|
-
({ className, ...rest }, ref) => {
|
|
316
|
-
const styles = useDialog();
|
|
317
|
-
const css = { ...styles.closeButton };
|
|
318
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
319
|
-
ModalCloseButton,
|
|
320
|
-
{
|
|
321
|
-
ref,
|
|
322
|
-
className: (0, import_utils6.cx)("ui-dialog__close-button", className),
|
|
323
|
-
__css: css,
|
|
324
|
-
...rest
|
|
325
|
-
}
|
|
326
|
-
);
|
|
327
|
-
}
|
|
328
|
-
);
|
|
329
|
-
var DialogHeader = (0, import_core5.forwardRef)(
|
|
330
|
-
({ className, ...rest }, ref) => {
|
|
331
|
-
const styles = useDialog();
|
|
332
|
-
const css = { ...styles.header };
|
|
333
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
334
|
-
ModalHeader,
|
|
335
|
-
{
|
|
336
|
-
ref,
|
|
337
|
-
className: (0, import_utils6.cx)("ui-dialog__header", className),
|
|
338
|
-
__css: css,
|
|
339
|
-
...rest
|
|
340
|
-
}
|
|
341
|
-
);
|
|
342
|
-
}
|
|
343
|
-
);
|
|
344
|
-
var DialogBody = (0, import_core5.forwardRef)(
|
|
345
|
-
({ className, ...rest }, ref) => {
|
|
346
|
-
const styles = useDialog();
|
|
347
|
-
const css = { ...styles.body };
|
|
348
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
349
|
-
ModalBody,
|
|
350
|
-
{
|
|
351
|
-
ref,
|
|
352
|
-
className: (0, import_utils6.cx)("ui-dialog__body", className),
|
|
353
|
-
__css: css,
|
|
354
|
-
...rest
|
|
355
|
-
}
|
|
356
|
-
);
|
|
357
|
-
}
|
|
358
|
-
);
|
|
359
|
-
var DialogFooter = (0, import_core5.forwardRef)(
|
|
360
|
-
({ className, ...rest }, ref) => {
|
|
361
|
-
const styles = useDialog();
|
|
362
|
-
const css = { ...styles.footer };
|
|
363
|
-
return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
364
|
-
ModalFooter,
|
|
365
|
-
{
|
|
366
|
-
ref,
|
|
367
|
-
className: (0, import_utils6.cx)("ui-dialog__footer", className),
|
|
368
|
-
__css: css,
|
|
369
|
-
...rest
|
|
370
|
-
}
|
|
371
|
-
);
|
|
372
|
-
}
|
|
373
|
-
);
|
|
374
|
-
|
|
375
|
-
// src/drawer.tsx
|
|
376
|
-
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
377
|
-
var [DrawerProvider, useDrawer] = (0, import_utils7.createContext)({
|
|
378
|
-
name: `DrawerContext`,
|
|
379
|
-
errorMessage: `useDrawer returned is 'undefined'. Seems you forgot to wrap the components in "<Drawer />" `
|
|
380
|
-
});
|
|
381
|
-
var Drawer = (0, import_motion3.motionForwardRef)(
|
|
382
|
-
({ size, placement = "right", closeOnDrag = false, ...props }, ref) => {
|
|
383
|
-
const [styles, mergedProps] = (0, import_core6.useMultiComponentStyle)("Drawer", {
|
|
384
|
-
size,
|
|
385
|
-
placement,
|
|
386
|
-
closeOnDrag,
|
|
387
|
-
...props
|
|
388
|
-
});
|
|
389
|
-
const {
|
|
390
|
-
children,
|
|
391
|
-
isOpen,
|
|
392
|
-
onClose,
|
|
393
|
-
onOverlayClick,
|
|
394
|
-
onEsc,
|
|
395
|
-
onCloseComplete,
|
|
396
|
-
withCloseButton = !closeOnDrag,
|
|
397
|
-
withOverlay = true,
|
|
398
|
-
withDragBar = true,
|
|
399
|
-
allowPinchZoom,
|
|
400
|
-
autoFocus,
|
|
401
|
-
restoreFocus,
|
|
402
|
-
initialFocusRef,
|
|
403
|
-
finalFocusRef,
|
|
404
|
-
blockScrollOnMount,
|
|
405
|
-
closeOnOverlay,
|
|
406
|
-
closeOnEsc,
|
|
407
|
-
lockFocusAcrossFrames,
|
|
408
|
-
duration = { enter: 0.4, exit: 0.3 },
|
|
409
|
-
dragConstraints = 0,
|
|
410
|
-
dragElastic = 0.1,
|
|
411
|
-
dragOffset = 80,
|
|
412
|
-
dragVelocity = 100,
|
|
413
|
-
blankForDragProps,
|
|
414
|
-
portalProps,
|
|
415
|
-
containerProps,
|
|
416
|
-
...rest
|
|
417
|
-
} = (0, import_core6.omitThemeProps)(mergedProps, ["isFullHeight"]);
|
|
418
|
-
const validChildren = (0, import_utils7.getValidChildren)(children);
|
|
419
|
-
const [customDrawerOverlay, ...cloneChildren] = (0, import_utils7.findChildren)(
|
|
420
|
-
validChildren,
|
|
421
|
-
DrawerOverlay
|
|
422
|
-
);
|
|
423
|
-
return /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawerProvider, { value: styles, children: /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)(
|
|
424
|
-
Modal,
|
|
425
|
-
{
|
|
426
|
-
ref,
|
|
427
|
-
...{
|
|
428
|
-
isOpen,
|
|
429
|
-
onClose,
|
|
430
|
-
onOverlayClick,
|
|
431
|
-
onEsc,
|
|
432
|
-
onCloseComplete,
|
|
433
|
-
withCloseButton: false,
|
|
434
|
-
withOverlay: false,
|
|
435
|
-
allowPinchZoom,
|
|
436
|
-
autoFocus,
|
|
437
|
-
restoreFocus,
|
|
438
|
-
initialFocusRef,
|
|
439
|
-
finalFocusRef,
|
|
440
|
-
blockScrollOnMount,
|
|
441
|
-
closeOnOverlay,
|
|
442
|
-
closeOnEsc,
|
|
443
|
-
lockFocusAcrossFrames,
|
|
444
|
-
duration,
|
|
445
|
-
portalProps,
|
|
446
|
-
containerProps
|
|
447
|
-
},
|
|
448
|
-
children: [
|
|
449
|
-
customDrawerOverlay != null ? customDrawerOverlay : withOverlay ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(DrawerOverlay, {}) : null,
|
|
450
|
-
/* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
|
|
451
|
-
DrawerContent,
|
|
452
|
-
{
|
|
453
|
-
...{
|
|
454
|
-
dragConstraints,
|
|
455
|
-
dragElastic,
|
|
456
|
-
dragOffset,
|
|
457
|
-
dragVelocity,
|
|
458
|
-
withCloseButton,
|
|
459
|
-
withDragBar,
|
|
460
|
-
blankForDragProps,
|
|
461
|
-
...rest,
|
|
462
|
-
placement,
|
|
463
|
-
closeOnDrag
|
|
464
|
-
},
|
|
465
|
-
children: cloneChildren
|
|
466
|
-
}
|
|
467
|
-
)
|
|
468
|
-
]
|
|
469
|
-
}
|
|
470
|
-
) });
|
|
471
|
-
}
|
|
472
|
-
);
|
|
473
195
|
var DrawerContent = (0, import_motion3.motionForwardRef)(
|
|
474
196
|
({
|
|
475
197
|
className,
|
|
@@ -585,7 +307,7 @@ var DrawerContent = (0, import_motion3.motionForwardRef)(
|
|
|
585
307
|
},
|
|
586
308
|
[placement, dragVelocity, dragOffset]
|
|
587
309
|
);
|
|
588
|
-
return /* @__PURE__ */ (0,
|
|
310
|
+
return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(
|
|
589
311
|
import_transitions2.Slide,
|
|
590
312
|
{
|
|
591
313
|
ref,
|
|
@@ -605,23 +327,28 @@ var DrawerContent = (0, import_motion3.motionForwardRef)(
|
|
|
605
327
|
__css: css,
|
|
606
328
|
...rest,
|
|
607
329
|
children: [
|
|
608
|
-
customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0,
|
|
609
|
-
withDragBar && closeOnDrag && (placement === "bottom" || placement === "right") ? /* @__PURE__ */ (0,
|
|
610
|
-
/* @__PURE__ */ (0,
|
|
611
|
-
|
|
330
|
+
customDrawerCloseButton != null ? customDrawerCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerCloseButton, {}) : null,
|
|
331
|
+
withDragBar && closeOnDrag && (placement === "bottom" || placement === "right") ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDragBar, {}) : null,
|
|
332
|
+
/* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
|
|
333
|
+
import_core4.ui.div,
|
|
612
334
|
{
|
|
613
335
|
className: "ui-drawer__inner",
|
|
614
336
|
__css: { display: "flex", flexDirection: "column", ...styles.inner },
|
|
615
337
|
children: cloneChildren
|
|
616
338
|
}
|
|
617
339
|
),
|
|
618
|
-
withDragBar && closeOnDrag && (placement === "top" || placement === "left") ? /* @__PURE__ */ (0,
|
|
340
|
+
withDragBar && closeOnDrag && (placement === "top" || placement === "left") ? /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(DrawerDragBar, {}) : null
|
|
619
341
|
]
|
|
620
342
|
}
|
|
621
343
|
);
|
|
622
344
|
}
|
|
623
345
|
);
|
|
624
|
-
|
|
346
|
+
|
|
347
|
+
// src/drawer-overlay.tsx
|
|
348
|
+
var import_motion4 = require("@yamada-ui/motion");
|
|
349
|
+
var import_utils8 = require("@yamada-ui/utils");
|
|
350
|
+
var import_jsx_runtime7 = require("react/jsx-runtime");
|
|
351
|
+
var DrawerOverlay = (0, import_motion4.motionForwardRef)(
|
|
625
352
|
({ className, ...rest }, ref) => {
|
|
626
353
|
const styles = useDrawer();
|
|
627
354
|
const css = { ...styles.overlay };
|
|
@@ -629,98 +356,121 @@ var DrawerOverlay = (0, import_motion3.motionForwardRef)(
|
|
|
629
356
|
ModalOverlay,
|
|
630
357
|
{
|
|
631
358
|
ref,
|
|
632
|
-
className: (0,
|
|
359
|
+
className: (0, import_utils8.cx)("ui-drawer__overlay", className),
|
|
633
360
|
__css: css,
|
|
634
361
|
...rest
|
|
635
362
|
}
|
|
636
363
|
);
|
|
637
364
|
}
|
|
638
365
|
);
|
|
639
|
-
|
|
640
|
-
|
|
641
|
-
|
|
642
|
-
|
|
643
|
-
|
|
644
|
-
|
|
645
|
-
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
|
|
649
|
-
|
|
650
|
-
...rest
|
|
651
|
-
}
|
|
652
|
-
);
|
|
653
|
-
};
|
|
654
|
-
var DrawerCloseButton = (0, import_core6.forwardRef)(
|
|
366
|
+
|
|
367
|
+
// src/modal-content.tsx
|
|
368
|
+
var import_motion5 = require("@yamada-ui/motion");
|
|
369
|
+
var import_transitions3 = require("@yamada-ui/transitions");
|
|
370
|
+
var import_utils10 = require("@yamada-ui/utils");
|
|
371
|
+
|
|
372
|
+
// src/dialog-close-button.tsx
|
|
373
|
+
var import_core5 = require("@yamada-ui/core");
|
|
374
|
+
var import_utils9 = require("@yamada-ui/utils");
|
|
375
|
+
var import_jsx_runtime8 = require("react/jsx-runtime");
|
|
376
|
+
var DialogCloseButton = (0, import_core5.forwardRef)(
|
|
655
377
|
({ className, ...rest }, ref) => {
|
|
656
|
-
const styles =
|
|
378
|
+
const styles = useDialog();
|
|
657
379
|
const css = { ...styles.closeButton };
|
|
658
|
-
return /* @__PURE__ */ (0,
|
|
380
|
+
return /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(
|
|
659
381
|
ModalCloseButton,
|
|
660
382
|
{
|
|
661
383
|
ref,
|
|
662
|
-
className: (0,
|
|
384
|
+
className: (0, import_utils9.cx)("ui-dialog__close-button", className),
|
|
663
385
|
__css: css,
|
|
664
386
|
...rest
|
|
665
387
|
}
|
|
666
388
|
);
|
|
667
389
|
}
|
|
668
390
|
);
|
|
669
|
-
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
|
|
675
|
-
{
|
|
676
|
-
|
|
677
|
-
|
|
678
|
-
|
|
679
|
-
|
|
680
|
-
|
|
681
|
-
|
|
391
|
+
|
|
392
|
+
// src/modal-content.tsx
|
|
393
|
+
var import_jsx_runtime9 = require("react/jsx-runtime");
|
|
394
|
+
var getModalContentProps = (animation = "scale", duration) => {
|
|
395
|
+
switch (animation) {
|
|
396
|
+
case "scale":
|
|
397
|
+
return {
|
|
398
|
+
...import_transitions3.scaleFadeProps,
|
|
399
|
+
custom: { scale: 0.95, reverse: true, duration }
|
|
400
|
+
};
|
|
401
|
+
case "top":
|
|
402
|
+
return {
|
|
403
|
+
...import_transitions3.slideFadeProps,
|
|
404
|
+
custom: { offsetY: -16, reverse: true, duration }
|
|
405
|
+
};
|
|
406
|
+
case "right":
|
|
407
|
+
return {
|
|
408
|
+
...import_transitions3.slideFadeProps,
|
|
409
|
+
custom: { offsetX: 16, reverse: true, duration }
|
|
410
|
+
};
|
|
411
|
+
case "left":
|
|
412
|
+
return {
|
|
413
|
+
...import_transitions3.slideFadeProps,
|
|
414
|
+
custom: { offsetX: -16, reverse: true, duration }
|
|
415
|
+
};
|
|
416
|
+
case "bottom":
|
|
417
|
+
return {
|
|
418
|
+
...import_transitions3.slideFadeProps,
|
|
419
|
+
custom: { offsetY: 16, reverse: true, duration }
|
|
420
|
+
};
|
|
682
421
|
}
|
|
683
|
-
|
|
684
|
-
var
|
|
685
|
-
({ className, ...rest }, ref) => {
|
|
686
|
-
const
|
|
687
|
-
|
|
688
|
-
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
422
|
+
};
|
|
423
|
+
var ModalContent = (0, import_motion5.motionForwardRef)(
|
|
424
|
+
({ className, children, __css, ...rest }, ref) => {
|
|
425
|
+
const {
|
|
426
|
+
styles,
|
|
427
|
+
scrollBehavior,
|
|
428
|
+
withCloseButton,
|
|
429
|
+
onClose,
|
|
430
|
+
animation,
|
|
431
|
+
duration
|
|
432
|
+
} = useModal();
|
|
433
|
+
const validChildren = (0, import_utils10.getValidChildren)(children);
|
|
434
|
+
const [customModalCloseButton, ...cloneChildren] = (0, import_utils10.findChildren)(
|
|
435
|
+
validChildren,
|
|
436
|
+
ModalCloseButton,
|
|
437
|
+
DialogCloseButton
|
|
696
438
|
);
|
|
697
|
-
|
|
698
|
-
|
|
699
|
-
|
|
700
|
-
|
|
701
|
-
|
|
702
|
-
|
|
703
|
-
|
|
704
|
-
|
|
439
|
+
const props = animation !== "none" ? getModalContentProps(animation, duration) : {};
|
|
440
|
+
const css = {
|
|
441
|
+
position: "relative",
|
|
442
|
+
maxH: "100%",
|
|
443
|
+
display: "flex",
|
|
444
|
+
flexDirection: "column",
|
|
445
|
+
overflow: scrollBehavior === "inside" ? "hidden" : "auto",
|
|
446
|
+
outline: 0,
|
|
447
|
+
...__css ? __css : styles.container
|
|
448
|
+
};
|
|
449
|
+
return /* @__PURE__ */ (0, import_jsx_runtime9.jsxs)(
|
|
450
|
+
import_motion5.motion.section,
|
|
705
451
|
{
|
|
452
|
+
role: "dialog",
|
|
453
|
+
"aria-modal": "true",
|
|
706
454
|
ref,
|
|
707
|
-
className: (0,
|
|
455
|
+
className: (0, import_utils10.cx)("ui-modal", className),
|
|
456
|
+
tabIndex: -1,
|
|
708
457
|
__css: css,
|
|
709
|
-
...
|
|
458
|
+
...props,
|
|
459
|
+
...rest,
|
|
460
|
+
children: [
|
|
461
|
+
customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(ModalCloseButton, {}) : null,
|
|
462
|
+
cloneChildren
|
|
463
|
+
]
|
|
710
464
|
}
|
|
711
465
|
);
|
|
712
466
|
}
|
|
713
467
|
);
|
|
714
468
|
|
|
715
469
|
// src/modal.tsx
|
|
716
|
-
var
|
|
717
|
-
var
|
|
718
|
-
name: `ModalContext`,
|
|
719
|
-
errorMessage: `useModal returned is 'undefined'. Seems you forgot to wrap the components in "<Modal />" `
|
|
720
|
-
});
|
|
721
|
-
var Modal = (0, import_motion4.motionForwardRef)(
|
|
470
|
+
var import_jsx_runtime10 = require("react/jsx-runtime");
|
|
471
|
+
var Modal = (0, import_motion6.motionForwardRef)(
|
|
722
472
|
({ size, ...props }, ref) => {
|
|
723
|
-
const [styles, mergedProps] = (0,
|
|
473
|
+
const [styles, mergedProps] = (0, import_core6.useComponentMultiStyle)("Modal", {
|
|
724
474
|
size,
|
|
725
475
|
...props
|
|
726
476
|
});
|
|
@@ -751,7 +501,7 @@ var Modal = (0, import_motion4.motionForwardRef)(
|
|
|
751
501
|
portalProps,
|
|
752
502
|
containerProps,
|
|
753
503
|
...rest
|
|
754
|
-
} = (0,
|
|
504
|
+
} = (0, import_core6.omitThemeProps)(mergedProps);
|
|
755
505
|
const onKeyDown = (0, import_react2.useCallback)(
|
|
756
506
|
(ev) => {
|
|
757
507
|
if (ev.key !== "Escape") return;
|
|
@@ -761,14 +511,14 @@ var Modal = (0, import_motion4.motionForwardRef)(
|
|
|
761
511
|
},
|
|
762
512
|
[closeOnEsc, onClose, onEsc]
|
|
763
513
|
);
|
|
764
|
-
const validChildren = (0,
|
|
765
|
-
const [customModalOverlay, ...cloneChildren] = (0,
|
|
514
|
+
const validChildren = (0, import_utils11.getValidChildren)(children);
|
|
515
|
+
const [customModalOverlay, ...cloneChildren] = (0, import_utils11.findChildren)(
|
|
766
516
|
validChildren,
|
|
767
517
|
ModalOverlay,
|
|
768
518
|
DialogOverlay,
|
|
769
519
|
DrawerOverlay
|
|
770
520
|
);
|
|
771
|
-
let [drawerContent] = (0,
|
|
521
|
+
let [drawerContent] = (0, import_utils11.findChildren)(validChildren, DrawerContent);
|
|
772
522
|
if (drawerContent)
|
|
773
523
|
drawerContent = (0, import_react2.cloneElement)(drawerContent, { onKeyDown });
|
|
774
524
|
const placement = (0, import_use_value2.useValue)(_placement);
|
|
@@ -784,7 +534,7 @@ var Modal = (0, import_motion4.motionForwardRef)(
|
|
|
784
534
|
justifyContent: placement.includes("left") ? "flex-start" : placement.includes("right") ? "flex-end" : "center",
|
|
785
535
|
alignItems: placement.includes("top") ? "flex-start" : placement.includes("bottom") ? "flex-end" : "center"
|
|
786
536
|
};
|
|
787
|
-
return /* @__PURE__ */ (0,
|
|
537
|
+
return /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
788
538
|
ModalProvider,
|
|
789
539
|
{
|
|
790
540
|
value: {
|
|
@@ -798,7 +548,7 @@ var Modal = (0, import_motion4.motionForwardRef)(
|
|
|
798
548
|
duration,
|
|
799
549
|
styles
|
|
800
550
|
},
|
|
801
|
-
children: /* @__PURE__ */ (0,
|
|
551
|
+
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)(
|
|
802
552
|
import_focus_lock.FocusLock,
|
|
803
553
|
{
|
|
804
554
|
autoFocus,
|
|
@@ -806,15 +556,15 @@ var Modal = (0, import_motion4.motionForwardRef)(
|
|
|
806
556
|
finalFocusRef,
|
|
807
557
|
restoreFocus,
|
|
808
558
|
lockFocusAcrossFrames,
|
|
809
|
-
children: /* @__PURE__ */ (0,
|
|
559
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
810
560
|
import_react_remove_scroll.RemoveScroll,
|
|
811
561
|
{
|
|
812
562
|
allowPinchZoom,
|
|
813
563
|
enabled: blockScrollOnMount,
|
|
814
564
|
forwardProps: true,
|
|
815
|
-
children: /* @__PURE__ */ (0,
|
|
816
|
-
customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0,
|
|
817
|
-
drawerContent != null ? drawerContent : /* @__PURE__ */ (0,
|
|
565
|
+
children: /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)(import_core6.ui.div, { __css: css, ...containerProps, children: [
|
|
566
|
+
customModalOverlay != null ? customModalOverlay : withOverlay && size !== "full" ? /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(ModalOverlay, {}) : null,
|
|
567
|
+
drawerContent != null ? drawerContent : /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
|
|
818
568
|
ModalContent,
|
|
819
569
|
{
|
|
820
570
|
ref,
|
|
@@ -833,83 +583,8 @@ var Modal = (0, import_motion4.motionForwardRef)(
|
|
|
833
583
|
);
|
|
834
584
|
}
|
|
835
585
|
);
|
|
836
|
-
var getModalContentProps = (animation = "scale", duration) => {
|
|
837
|
-
switch (animation) {
|
|
838
|
-
case "scale":
|
|
839
|
-
return {
|
|
840
|
-
...import_transitions3.scaleFadeProps,
|
|
841
|
-
custom: { scale: 0.95, reverse: true, duration }
|
|
842
|
-
};
|
|
843
|
-
case "top":
|
|
844
|
-
return {
|
|
845
|
-
...import_transitions3.slideFadeProps,
|
|
846
|
-
custom: { offsetY: -16, reverse: true, duration }
|
|
847
|
-
};
|
|
848
|
-
case "right":
|
|
849
|
-
return {
|
|
850
|
-
...import_transitions3.slideFadeProps,
|
|
851
|
-
custom: { offsetX: 16, reverse: true, duration }
|
|
852
|
-
};
|
|
853
|
-
case "left":
|
|
854
|
-
return {
|
|
855
|
-
...import_transitions3.slideFadeProps,
|
|
856
|
-
custom: { offsetX: -16, reverse: true, duration }
|
|
857
|
-
};
|
|
858
|
-
case "bottom":
|
|
859
|
-
return {
|
|
860
|
-
...import_transitions3.slideFadeProps,
|
|
861
|
-
custom: { offsetY: 16, reverse: true, duration }
|
|
862
|
-
};
|
|
863
|
-
}
|
|
864
|
-
};
|
|
865
|
-
var ModalContent = (0, import_motion4.motionForwardRef)(
|
|
866
|
-
({ className, children, __css, ...rest }, ref) => {
|
|
867
|
-
const {
|
|
868
|
-
styles,
|
|
869
|
-
scrollBehavior,
|
|
870
|
-
withCloseButton,
|
|
871
|
-
onClose,
|
|
872
|
-
animation,
|
|
873
|
-
duration
|
|
874
|
-
} = useModal();
|
|
875
|
-
const validChildren = (0, import_utils8.getValidChildren)(children);
|
|
876
|
-
const [customModalCloseButton, ...cloneChildren] = (0, import_utils8.findChildren)(
|
|
877
|
-
validChildren,
|
|
878
|
-
ModalCloseButton,
|
|
879
|
-
DialogCloseButton
|
|
880
|
-
);
|
|
881
|
-
const props = animation !== "none" ? getModalContentProps(animation, duration) : {};
|
|
882
|
-
const css = {
|
|
883
|
-
position: "relative",
|
|
884
|
-
maxH: "100%",
|
|
885
|
-
display: "flex",
|
|
886
|
-
flexDirection: "column",
|
|
887
|
-
overflow: scrollBehavior === "inside" ? "hidden" : "auto",
|
|
888
|
-
outline: 0,
|
|
889
|
-
...__css ? __css : styles.container
|
|
890
|
-
};
|
|
891
|
-
return /* @__PURE__ */ (0, import_jsx_runtime8.jsxs)(
|
|
892
|
-
import_motion4.motion.section,
|
|
893
|
-
{
|
|
894
|
-
role: "dialog",
|
|
895
|
-
"aria-modal": "true",
|
|
896
|
-
ref,
|
|
897
|
-
className: (0, import_utils8.cx)("ui-modal", className),
|
|
898
|
-
tabIndex: -1,
|
|
899
|
-
__css: css,
|
|
900
|
-
...props,
|
|
901
|
-
...rest,
|
|
902
|
-
children: [
|
|
903
|
-
customModalCloseButton != null ? customModalCloseButton : withCloseButton && onClose ? /* @__PURE__ */ (0, import_jsx_runtime8.jsx)(ModalCloseButton, {}) : null,
|
|
904
|
-
cloneChildren
|
|
905
|
-
]
|
|
906
|
-
}
|
|
907
|
-
);
|
|
908
|
-
}
|
|
909
|
-
);
|
|
910
586
|
// Annotate the CommonJS export names for ESM import in node:
|
|
911
587
|
0 && (module.exports = {
|
|
912
|
-
Modal
|
|
913
|
-
useModal
|
|
588
|
+
Modal
|
|
914
589
|
});
|
|
915
590
|
//# sourceMappingURL=modal.js.map
|