@saas-ui/modals 2.4.2 → 3.0.0-alpha.0
Sign up to get free protection for your applications and to get access to all the features.
- package/CHANGELOG.md +11 -5
- package/dist/index.cjs +206 -0
- package/dist/index.cjs.map +1 -0
- package/dist/index.d.cts +182 -0
- package/dist/index.d.ts +110 -185
- package/dist/index.js +86 -531
- package/dist/index.js.map +1 -1
- package/package.json +15 -33
- package/src/alert-dialog.tsx +156 -0
- package/src/default-modals.ts +3 -7
- package/src/drawer.tsx +46 -60
- package/src/form.tsx +15 -22
- package/src/index.ts +22 -38
- package/src/modal.tsx +43 -52
- package/src/types.ts +46 -33
- package/dist/chunk-FRC2HTO7.mjs +0 -154
- package/dist/chunk-FRC2HTO7.mjs.map +0 -1
- package/dist/form-BtCUKHAs.d.mts +0 -82
- package/dist/form-BtCUKHAs.d.ts +0 -82
- package/dist/index.d.mts +0 -257
- package/dist/index.mjs +0 -469
- package/dist/index.mjs.map +0 -1
- package/dist/yup/index.d.mts +0 -15
- package/dist/yup/index.d.ts +0 -15
- package/dist/yup/index.js +0 -165
- package/dist/yup/index.js.map +0 -1
- package/dist/yup/index.mjs +0 -20
- package/dist/yup/index.mjs.map +0 -1
- package/dist/zod/index.d.mts +0 -15
- package/dist/zod/index.d.ts +0 -15
- package/dist/zod/index.js +0 -165
- package/dist/zod/index.js.map +0 -1
- package/dist/zod/index.mjs +0 -20
- package/dist/zod/index.mjs.map +0 -1
- package/src/create-modals.tsx +0 -30
- package/src/dialog.tsx +0 -151
- package/src/menu.tsx +0 -107
- package/src/provider.tsx +0 -357
package/dist/index.mjs
DELETED
@@ -1,469 +0,0 @@
|
|
1
|
-
'use client'
|
2
|
-
import {
|
3
|
-
BaseModal,
|
4
|
-
FormDialog,
|
5
|
-
Modal,
|
6
|
-
createFormDialog
|
7
|
-
} from "./chunk-FRC2HTO7.mjs";
|
8
|
-
|
9
|
-
// src/dialog.tsx
|
10
|
-
import * as React from "react";
|
11
|
-
import {
|
12
|
-
AlertDialog,
|
13
|
-
AlertDialogBody,
|
14
|
-
AlertDialogFooter,
|
15
|
-
AlertDialogHeader,
|
16
|
-
AlertDialogContent,
|
17
|
-
AlertDialogOverlay,
|
18
|
-
ButtonGroup,
|
19
|
-
Button
|
20
|
-
} from "@chakra-ui/react";
|
21
|
-
import { jsx, jsxs } from "react/jsx-runtime";
|
22
|
-
var ConfirmDialog = (props) => {
|
23
|
-
const {
|
24
|
-
title,
|
25
|
-
cancelLabel = "Cancel",
|
26
|
-
confirmLabel = "Confirm",
|
27
|
-
cancelProps,
|
28
|
-
confirmProps,
|
29
|
-
buttonGroupProps,
|
30
|
-
isOpen,
|
31
|
-
closeOnCancel = true,
|
32
|
-
closeOnConfirm = true,
|
33
|
-
leastDestructiveFocus = "cancel",
|
34
|
-
onClose,
|
35
|
-
onCancel,
|
36
|
-
onConfirm,
|
37
|
-
children,
|
38
|
-
...rest
|
39
|
-
} = props;
|
40
|
-
const cancelRef = React.useRef(null);
|
41
|
-
const confirmRef = React.useRef(null);
|
42
|
-
const [isLoading, setIsLoading] = React.useState(false);
|
43
|
-
const handleConfirm = async () => {
|
44
|
-
try {
|
45
|
-
const result = onConfirm == null ? void 0 : onConfirm();
|
46
|
-
if (typeof (result == null ? void 0 : result.then) === "function") {
|
47
|
-
setIsLoading(true);
|
48
|
-
await result;
|
49
|
-
}
|
50
|
-
closeOnConfirm && onClose();
|
51
|
-
} catch (e) {
|
52
|
-
throw e;
|
53
|
-
} finally {
|
54
|
-
setIsLoading(false);
|
55
|
-
}
|
56
|
-
};
|
57
|
-
return /* @__PURE__ */ jsx(
|
58
|
-
AlertDialog,
|
59
|
-
{
|
60
|
-
isOpen,
|
61
|
-
onClose,
|
62
|
-
...rest,
|
63
|
-
leastDestructiveRef: leastDestructiveFocus === "cancel" ? cancelRef : confirmRef,
|
64
|
-
children: /* @__PURE__ */ jsx(AlertDialogOverlay, { children: /* @__PURE__ */ jsxs(AlertDialogContent, { children: [
|
65
|
-
/* @__PURE__ */ jsx(AlertDialogHeader, { children: title }),
|
66
|
-
/* @__PURE__ */ jsx(AlertDialogBody, { children }),
|
67
|
-
/* @__PURE__ */ jsx(AlertDialogFooter, { children: /* @__PURE__ */ jsxs(ButtonGroup, { ...buttonGroupProps, children: [
|
68
|
-
/* @__PURE__ */ jsx(
|
69
|
-
Button,
|
70
|
-
{
|
71
|
-
ref: cancelRef,
|
72
|
-
...cancelProps,
|
73
|
-
onClick: () => {
|
74
|
-
onCancel == null ? void 0 : onCancel();
|
75
|
-
closeOnCancel && onClose();
|
76
|
-
},
|
77
|
-
children: (cancelProps == null ? void 0 : cancelProps.children) || cancelLabel
|
78
|
-
}
|
79
|
-
),
|
80
|
-
/* @__PURE__ */ jsx(
|
81
|
-
Button,
|
82
|
-
{
|
83
|
-
ref: confirmRef,
|
84
|
-
isLoading,
|
85
|
-
...confirmProps,
|
86
|
-
onClick: handleConfirm,
|
87
|
-
children: (confirmProps == null ? void 0 : confirmProps.children) || confirmLabel
|
88
|
-
}
|
89
|
-
)
|
90
|
-
] }) })
|
91
|
-
] }) })
|
92
|
-
}
|
93
|
-
);
|
94
|
-
};
|
95
|
-
|
96
|
-
// src/drawer.tsx
|
97
|
-
import {
|
98
|
-
Drawer as ChakraDrawer,
|
99
|
-
DrawerOverlay,
|
100
|
-
DrawerContent,
|
101
|
-
DrawerHeader,
|
102
|
-
DrawerFooter,
|
103
|
-
DrawerBody,
|
104
|
-
DrawerCloseButton
|
105
|
-
} from "@chakra-ui/react";
|
106
|
-
import { runIfFn } from "@chakra-ui/utils";
|
107
|
-
import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
|
108
|
-
var BaseDrawer = (props) => {
|
109
|
-
const {
|
110
|
-
title,
|
111
|
-
children,
|
112
|
-
footer,
|
113
|
-
isOpen,
|
114
|
-
onClose,
|
115
|
-
hideCloseButton,
|
116
|
-
hideOverlay,
|
117
|
-
headerProps,
|
118
|
-
contentProps,
|
119
|
-
footerProps,
|
120
|
-
...rest
|
121
|
-
} = props;
|
122
|
-
return /* @__PURE__ */ jsxs2(ChakraDrawer, { isOpen, onClose, ...rest, children: [
|
123
|
-
!hideOverlay && /* @__PURE__ */ jsx2(DrawerOverlay, {}),
|
124
|
-
/* @__PURE__ */ jsxs2(DrawerContent, { ...contentProps, children: [
|
125
|
-
title && /* @__PURE__ */ jsx2(DrawerHeader, { ...headerProps, children: title }),
|
126
|
-
!hideCloseButton && /* @__PURE__ */ jsx2(DrawerCloseButton, {}),
|
127
|
-
runIfFn(children, {
|
128
|
-
isOpen,
|
129
|
-
onClose
|
130
|
-
}),
|
131
|
-
footer && /* @__PURE__ */ jsx2(DrawerFooter, { ...footerProps, children: footer })
|
132
|
-
] })
|
133
|
-
] });
|
134
|
-
};
|
135
|
-
var Drawer = (props) => {
|
136
|
-
const { children, isOpen, onClose, ...rest } = props;
|
137
|
-
return /* @__PURE__ */ jsx2(BaseDrawer, { isOpen, onClose, ...rest, children: /* @__PURE__ */ jsx2(DrawerBody, { children: runIfFn(children, {
|
138
|
-
isOpen,
|
139
|
-
onClose
|
140
|
-
}) }) });
|
141
|
-
};
|
142
|
-
|
143
|
-
// src/menu.tsx
|
144
|
-
import {
|
145
|
-
ModalFooter,
|
146
|
-
chakra,
|
147
|
-
forwardRef,
|
148
|
-
useMenuContext,
|
149
|
-
useMenuList,
|
150
|
-
createStylesContext,
|
151
|
-
useMultiStyleConfig,
|
152
|
-
Menu,
|
153
|
-
useBreakpointValue
|
154
|
-
} from "@chakra-ui/react";
|
155
|
-
import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
|
156
|
-
var [StylesProvider] = createStylesContext("SuiMenuDialog");
|
157
|
-
var MenuDialog = (props) => {
|
158
|
-
const { onClose, onCloseComplete, ...rest } = props;
|
159
|
-
return /* @__PURE__ */ jsx3(
|
160
|
-
Menu,
|
161
|
-
{
|
162
|
-
variant: "dialog",
|
163
|
-
onClose: () => {
|
164
|
-
onClose == null ? void 0 : onClose();
|
165
|
-
onCloseComplete == null ? void 0 : onCloseComplete();
|
166
|
-
},
|
167
|
-
...rest
|
168
|
-
}
|
169
|
-
);
|
170
|
-
};
|
171
|
-
var MenuDialogList = forwardRef(
|
172
|
-
(props, forwardedRef) => {
|
173
|
-
const {
|
174
|
-
rootProps,
|
175
|
-
title,
|
176
|
-
footer,
|
177
|
-
initialFocusRef,
|
178
|
-
hideCloseButton,
|
179
|
-
motionPreset = "slideInBottom",
|
180
|
-
isCentered: isCenteredProp,
|
181
|
-
...rest
|
182
|
-
} = props;
|
183
|
-
const { isOpen, onClose, menuRef } = useMenuContext();
|
184
|
-
const { ref, ...ownProps } = useMenuList(rest, forwardedRef);
|
185
|
-
const styles = useMultiStyleConfig("Menu", props);
|
186
|
-
const isCentered = useBreakpointValue({ base: true, md: false });
|
187
|
-
return /* @__PURE__ */ jsxs3(
|
188
|
-
BaseModal,
|
189
|
-
{
|
190
|
-
isOpen,
|
191
|
-
onClose,
|
192
|
-
initialFocusRef: initialFocusRef || menuRef,
|
193
|
-
title,
|
194
|
-
hideCloseButton,
|
195
|
-
motionPreset,
|
196
|
-
isCentered: isCenteredProp != null ? isCenteredProp : isCentered,
|
197
|
-
contentProps: { mx: 4 },
|
198
|
-
children: [
|
199
|
-
/* @__PURE__ */ jsx3(StylesProvider, { value: styles, children: /* @__PURE__ */ jsx3(
|
200
|
-
chakra.div,
|
201
|
-
{
|
202
|
-
...ownProps,
|
203
|
-
ref,
|
204
|
-
__css: {
|
205
|
-
outline: 0,
|
206
|
-
maxHeight: "80vh",
|
207
|
-
// can override this in theme
|
208
|
-
overflowY: "auto",
|
209
|
-
// can override this in theme
|
210
|
-
...styles.list,
|
211
|
-
boxShadow: "none",
|
212
|
-
border: 0,
|
213
|
-
_dark: {
|
214
|
-
/* @ts-expect-error */
|
215
|
-
...styles.list._dark || {},
|
216
|
-
boxShadow: "none"
|
217
|
-
}
|
218
|
-
}
|
219
|
-
}
|
220
|
-
) }),
|
221
|
-
footer && /* @__PURE__ */ jsx3(ModalFooter, { children: footer })
|
222
|
-
]
|
223
|
-
}
|
224
|
-
);
|
225
|
-
}
|
226
|
-
);
|
227
|
-
|
228
|
-
// src/provider.tsx
|
229
|
-
import * as React2 from "react";
|
230
|
-
|
231
|
-
// src/default-modals.ts
|
232
|
-
var defaultModals = {
|
233
|
-
alert: ConfirmDialog,
|
234
|
-
confirm: ConfirmDialog,
|
235
|
-
drawer: Drawer,
|
236
|
-
modal: Modal,
|
237
|
-
menu: MenuDialog,
|
238
|
-
form: FormDialog
|
239
|
-
};
|
240
|
-
|
241
|
-
// src/provider.tsx
|
242
|
-
import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
|
243
|
-
var ModalsContext = React2.createContext(null);
|
244
|
-
var initialModalState = {
|
245
|
-
id: null,
|
246
|
-
props: null,
|
247
|
-
type: "modal"
|
248
|
-
};
|
249
|
-
function ModalsProvider({ children, modals }) {
|
250
|
-
const _instances = React2.useMemo(() => /* @__PURE__ */ new Set(), []);
|
251
|
-
const [activeModals, setActiveModals] = React2.useState({
|
252
|
-
modal: initialModalState
|
253
|
-
});
|
254
|
-
const getModalComponent = React2.useMemo(() => {
|
255
|
-
const _modals = {
|
256
|
-
...defaultModals,
|
257
|
-
...modals
|
258
|
-
};
|
259
|
-
return (type = "modal") => {
|
260
|
-
const component = _modals[type] || _modals.modal;
|
261
|
-
return component;
|
262
|
-
};
|
263
|
-
}, [modals]);
|
264
|
-
const setActiveModal = (modal, scope) => {
|
265
|
-
if (!scope) {
|
266
|
-
return setActiveModals({
|
267
|
-
modal
|
268
|
-
});
|
269
|
-
}
|
270
|
-
setActiveModals((prevState) => ({
|
271
|
-
...prevState,
|
272
|
-
[scope]: modal
|
273
|
-
}));
|
274
|
-
};
|
275
|
-
const open = (componentOrOptions, options) => {
|
276
|
-
let _options;
|
277
|
-
if (typeof componentOrOptions === "function") {
|
278
|
-
_options = {
|
279
|
-
component: componentOrOptions,
|
280
|
-
...options
|
281
|
-
};
|
282
|
-
} else {
|
283
|
-
_options = componentOrOptions;
|
284
|
-
}
|
285
|
-
const {
|
286
|
-
id = _instances.size + 1,
|
287
|
-
type = "modal",
|
288
|
-
scope = "modal",
|
289
|
-
component,
|
290
|
-
...props
|
291
|
-
} = _options;
|
292
|
-
const modal = {
|
293
|
-
id,
|
294
|
-
props,
|
295
|
-
type,
|
296
|
-
scope,
|
297
|
-
component,
|
298
|
-
isOpen: true
|
299
|
-
};
|
300
|
-
_instances.add(modal);
|
301
|
-
setActiveModal(modal, scope);
|
302
|
-
return id;
|
303
|
-
};
|
304
|
-
const drawer = (options) => {
|
305
|
-
return open({
|
306
|
-
...options,
|
307
|
-
type: "drawer"
|
308
|
-
});
|
309
|
-
};
|
310
|
-
const alert = (options) => {
|
311
|
-
return open({
|
312
|
-
...options,
|
313
|
-
scope: "alert",
|
314
|
-
type: "alert",
|
315
|
-
cancelProps: {
|
316
|
-
display: "none"
|
317
|
-
},
|
318
|
-
confirmProps: {
|
319
|
-
label: "OK"
|
320
|
-
},
|
321
|
-
leastDestructiveFocus: "confirm"
|
322
|
-
});
|
323
|
-
};
|
324
|
-
const confirm = (options) => {
|
325
|
-
return open({
|
326
|
-
...options,
|
327
|
-
scope: "alert",
|
328
|
-
type: "confirm"
|
329
|
-
});
|
330
|
-
};
|
331
|
-
const menu = (options) => {
|
332
|
-
return open({
|
333
|
-
...options,
|
334
|
-
type: "menu"
|
335
|
-
});
|
336
|
-
};
|
337
|
-
const form = (options) => {
|
338
|
-
return open({
|
339
|
-
...options,
|
340
|
-
type: "form"
|
341
|
-
});
|
342
|
-
};
|
343
|
-
const close = async (id, force) => {
|
344
|
-
var _a, _b;
|
345
|
-
const modals2 = [...Array.from(_instances)];
|
346
|
-
const modal = modals2.filter((modal2) => modal2.id === id)[0];
|
347
|
-
if (!modal) {
|
348
|
-
return;
|
349
|
-
}
|
350
|
-
const shouldClose = await ((_b = (_a = modal.props) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a, { force }));
|
351
|
-
if (shouldClose === false) {
|
352
|
-
return;
|
353
|
-
}
|
354
|
-
const scoped = modals2.filter(({ scope }) => scope === modal.scope);
|
355
|
-
if (scoped.length === 1) {
|
356
|
-
setActiveModal(
|
357
|
-
{
|
358
|
-
...modal,
|
359
|
-
isOpen: false
|
360
|
-
},
|
361
|
-
modal.scope
|
362
|
-
);
|
363
|
-
} else if (scoped.length > 1) {
|
364
|
-
setActiveModal(scoped[scoped.length - 2], modal.scope);
|
365
|
-
} else {
|
366
|
-
setActiveModal(
|
367
|
-
{
|
368
|
-
id: null,
|
369
|
-
props: null,
|
370
|
-
type: modal.type
|
371
|
-
// Keep type same as last modal type to make sure the animation isn't interrupted
|
372
|
-
},
|
373
|
-
modal.scope
|
374
|
-
);
|
375
|
-
}
|
376
|
-
setTimeout(() => closeComplete(id), 200);
|
377
|
-
};
|
378
|
-
const closeComplete = (id) => {
|
379
|
-
const modals2 = [...Array.from(_instances)];
|
380
|
-
const modal = modals2.filter((modal2) => modal2.id === id)[0];
|
381
|
-
_instances.delete(modal);
|
382
|
-
const scoped = modal && modals2.filter(({ scope }) => scope === modal.scope);
|
383
|
-
if ((scoped == null ? void 0 : scoped.length) === 1) {
|
384
|
-
setActiveModal(initialModalState, modal.scope);
|
385
|
-
}
|
386
|
-
};
|
387
|
-
const closeAll = () => {
|
388
|
-
_instances.forEach((modal) => {
|
389
|
-
var _a, _b;
|
390
|
-
return (_b = (_a = modal.props) == null ? void 0 : _a.onClose) == null ? void 0 : _b.call(_a, { force: true });
|
391
|
-
});
|
392
|
-
_instances.clear();
|
393
|
-
setActiveModal(initialModalState);
|
394
|
-
};
|
395
|
-
const context = {
|
396
|
-
open,
|
397
|
-
drawer,
|
398
|
-
alert,
|
399
|
-
confirm,
|
400
|
-
menu,
|
401
|
-
form,
|
402
|
-
close,
|
403
|
-
closeAll
|
404
|
-
};
|
405
|
-
const content = React2.useMemo(
|
406
|
-
() => Object.entries(activeModals).map(([scope, config]) => {
|
407
|
-
const Component = config.component || getModalComponent(config.type);
|
408
|
-
const { title, body, children: children2, ...props } = config.props || {};
|
409
|
-
return /* @__PURE__ */ jsx4(
|
410
|
-
Component,
|
411
|
-
{
|
412
|
-
title,
|
413
|
-
children: body || children2,
|
414
|
-
...props,
|
415
|
-
isOpen: !!config.isOpen,
|
416
|
-
onClose: () => close(config.id),
|
417
|
-
onCloseComplete: () => closeComplete(config.id)
|
418
|
-
},
|
419
|
-
scope
|
420
|
-
);
|
421
|
-
}),
|
422
|
-
[activeModals]
|
423
|
-
);
|
424
|
-
return /* @__PURE__ */ jsxs4(ModalsContext.Provider, { value: context, children: [
|
425
|
-
content,
|
426
|
-
children
|
427
|
-
] });
|
428
|
-
}
|
429
|
-
var useModalsContext = () => React2.useContext(ModalsContext);
|
430
|
-
var useModals = () => {
|
431
|
-
const modals = useModalsContext();
|
432
|
-
if (!modals) {
|
433
|
-
throw new Error("useModals must be used within a ModalsProvider");
|
434
|
-
}
|
435
|
-
return modals;
|
436
|
-
};
|
437
|
-
|
438
|
-
// src/create-modals.tsx
|
439
|
-
import { jsx as jsx5 } from "react/jsx-runtime";
|
440
|
-
var createModals = (options) => {
|
441
|
-
const modals = {
|
442
|
-
...defaultModals,
|
443
|
-
...options.modals
|
444
|
-
};
|
445
|
-
const Provider = (props) => {
|
446
|
-
return /* @__PURE__ */ jsx5(ModalsProvider, { children: props.children, modals });
|
447
|
-
};
|
448
|
-
return {
|
449
|
-
ModalsProvider: Provider,
|
450
|
-
useModals
|
451
|
-
};
|
452
|
-
};
|
453
|
-
export {
|
454
|
-
BaseDrawer,
|
455
|
-
BaseModal,
|
456
|
-
ConfirmDialog,
|
457
|
-
Drawer,
|
458
|
-
FormDialog,
|
459
|
-
MenuDialog,
|
460
|
-
MenuDialogList,
|
461
|
-
Modal,
|
462
|
-
ModalsContext,
|
463
|
-
ModalsProvider,
|
464
|
-
createFormDialog,
|
465
|
-
createModals,
|
466
|
-
useModals,
|
467
|
-
useModalsContext
|
468
|
-
};
|
469
|
-
//# sourceMappingURL=index.mjs.map
|
package/dist/index.mjs.map
DELETED
@@ -1 +0,0 @@
|
|
1
|
-
{"version":3,"sources":["../src/dialog.tsx","../src/drawer.tsx","../src/menu.tsx","../src/provider.tsx","../src/default-modals.ts","../src/create-modals.tsx"],"sourcesContent":["import * as React from 'react'\n\nimport {\n AlertDialog,\n AlertDialogBody,\n AlertDialogFooter,\n AlertDialogHeader,\n AlertDialogContent,\n AlertDialogOverlay,\n AlertDialogProps,\n ButtonGroup,\n ButtonGroupProps,\n Button,\n ButtonProps,\n} from '@chakra-ui/react'\n\nexport interface ConfirmDialogProps\n extends Omit<AlertDialogProps, 'leastDestructiveRef'> {\n /**\n * The dialog title\n */\n title?: React.ReactNode\n /**\n * The cancel button label\n */\n cancelLabel?: React.ReactNode\n /**\n * The confirm button label\n */\n confirmLabel?: React.ReactNode\n /**\n * The cancel button props\n */\n cancelProps?: ButtonProps\n /**\n * The confirm button props\n */\n confirmProps?: ButtonProps\n /**\n * The button group props\n */\n buttonGroupProps?: ButtonGroupProps\n /**\n * Close the dialog on cancel\n * @default true\n */\n closeOnCancel?: boolean\n /**\n * Close the dialog on confirm\n * @default true\n */\n closeOnConfirm?: boolean\n /**\n * Defines which button gets initial focus\n * https://www.w3.org/TR/wai-aria-practices/#alertdialog\n */\n leastDestructiveFocus?: 'cancel' | 'confirm'\n /**\n * Function that's called when cancel is clicked\n */\n onCancel?: () => void\n /**\n * Function that's called when confirm is clicked.\n */\n onConfirm?: () => Promise<void> | void\n}\n\nexport const ConfirmDialog: React.FC<ConfirmDialogProps> = (props) => {\n const {\n title,\n cancelLabel = 'Cancel',\n confirmLabel = 'Confirm',\n cancelProps,\n confirmProps,\n buttonGroupProps,\n isOpen,\n closeOnCancel = true,\n closeOnConfirm = true,\n leastDestructiveFocus = 'cancel',\n onClose,\n onCancel,\n onConfirm,\n children,\n ...rest\n } = props\n\n const cancelRef = React.useRef(null)\n const confirmRef = React.useRef(null)\n const [isLoading, setIsLoading] = React.useState(false)\n\n const handleConfirm = async () => {\n try {\n const result = onConfirm?.()\n if (typeof result?.then === 'function') {\n setIsLoading(true)\n await result\n }\n\n closeOnConfirm && onClose()\n /* eslint-disable no-useless-catch */\n } catch (e: any) {\n throw e\n } finally {\n setIsLoading(false)\n }\n /* eslint-enable */\n }\n\n return (\n <AlertDialog\n isOpen={isOpen}\n onClose={onClose}\n {...rest}\n leastDestructiveRef={\n leastDestructiveFocus === 'cancel' ? cancelRef : confirmRef\n }\n >\n <AlertDialogOverlay>\n <AlertDialogContent>\n <AlertDialogHeader>{title}</AlertDialogHeader>\n\n <AlertDialogBody>{children}</AlertDialogBody>\n\n <AlertDialogFooter>\n <ButtonGroup {...buttonGroupProps}>\n <Button\n ref={cancelRef}\n {...cancelProps}\n onClick={() => {\n onCancel?.()\n\n closeOnCancel && onClose()\n }}\n >\n {cancelProps?.children || cancelLabel}\n </Button>\n <Button\n ref={confirmRef}\n isLoading={isLoading}\n {...confirmProps}\n onClick={handleConfirm}\n >\n {confirmProps?.children || confirmLabel}\n </Button>\n </ButtonGroup>\n </AlertDialogFooter>\n </AlertDialogContent>\n </AlertDialogOverlay>\n </AlertDialog>\n )\n}\n","import * as React from 'react'\n\nimport {\n Drawer as ChakraDrawer,\n DrawerOverlay,\n DrawerContent,\n DrawerHeader,\n DrawerFooter,\n DrawerBody,\n DrawerCloseButton,\n DrawerProps as ChakraDrawerProps,\n ModalHeaderProps,\n ModalContentProps,\n ModalFooterProps,\n} from '@chakra-ui/react'\nimport { runIfFn, MaybeRenderProp } from '@chakra-ui/utils'\n\nexport interface BaseDrawerProps extends Omit<ChakraDrawerProps, 'children'> {\n /**\n * The drawer title\n */\n title: React.ReactNode\n /**\n * The modal children\n */\n children: MaybeRenderProp<{\n isOpen: boolean\n onClose: () => void\n }>\n /**\n * The modal footer\n */\n footer?: React.ReactNode\n /**\n * Hide the close button\n */\n hideCloseButton?: boolean\n /**\n * Hide the overflow\n */\n hideOverlay?: boolean\n /**\n * Props for the modal header\n */\n headerProps?: ModalHeaderProps\n /**\n * Props for the modal content\n */\n contentProps?: ModalContentProps\n /**\n * Props for the modal footer\n */\n footerProps?: ModalFooterProps\n}\n\nexport const BaseDrawer: React.FC<BaseDrawerProps> = (props) => {\n const {\n title,\n children,\n footer,\n isOpen,\n onClose,\n hideCloseButton,\n hideOverlay,\n headerProps,\n contentProps,\n footerProps,\n ...rest\n } = props\n return (\n <ChakraDrawer isOpen={isOpen} onClose={onClose} {...rest}>\n {!hideOverlay && <DrawerOverlay />}\n <DrawerContent {...contentProps}>\n {title && <DrawerHeader {...headerProps}>{title}</DrawerHeader>}\n {!hideCloseButton && <DrawerCloseButton />}\n {runIfFn(children, {\n isOpen,\n onClose,\n })}\n {footer && <DrawerFooter {...footerProps}>{footer}</DrawerFooter>}\n </DrawerContent>\n </ChakraDrawer>\n )\n}\n\nexport interface DrawerProps extends BaseDrawerProps {\n /**\n * Drawer footer content, wrapped with `DrawerFooter`\n */\n footer?: React.ReactNode\n}\n\nexport const Drawer: React.FC<DrawerProps> = (props) => {\n const { children, isOpen, onClose, ...rest } = props\n return (\n <BaseDrawer isOpen={isOpen} onClose={onClose} {...rest}>\n <DrawerBody>\n {runIfFn(children, {\n isOpen,\n onClose,\n })}\n </DrawerBody>\n </BaseDrawer>\n )\n}\n","import * as React from 'react'\n\nimport {\n ModalFooter,\n chakra,\n forwardRef,\n useMenuContext,\n useMenuList,\n createStylesContext,\n useMultiStyleConfig,\n Menu,\n MenuListProps,\n useBreakpointValue,\n} from '@chakra-ui/react'\n\nimport { BaseModal, BaseModalProps } from './modal'\n\nconst [StylesProvider] = createStylesContext('SuiMenuDialog')\n\nexport interface MenuDialogProps extends BaseModalProps {\n /**\n * The modal footer, wrapped with `ModalFooter`\n */\n footer?: React.ReactNode\n}\n\nexport const MenuDialog: React.FC<MenuDialogProps> = (props) => {\n const { onClose, onCloseComplete, ...rest } = props\n\n return (\n <Menu\n variant=\"dialog\"\n onClose={() => {\n onClose?.()\n // Not supported in Menu, so we call it here instead\n // @todo Refactor this in v2?\n onCloseComplete?.()\n }}\n {...rest}\n />\n )\n}\n\nexport interface MenuDialogListProps\n extends Omit<\n BaseModalProps,\n 'isOpen' | 'onClose' | 'children' | 'scrollBehavior'\n >,\n Omit<MenuListProps, 'title'> {}\n\nexport const MenuDialogList = forwardRef<MenuDialogListProps, 'div'>(\n (props, forwardedRef) => {\n const {\n rootProps,\n title,\n footer,\n initialFocusRef,\n hideCloseButton,\n motionPreset = 'slideInBottom',\n isCentered: isCenteredProp,\n ...rest\n } = props\n\n const { isOpen, onClose, menuRef } = useMenuContext()\n\n const { ref, ...ownProps } = useMenuList(rest, forwardedRef)\n\n const styles = useMultiStyleConfig('Menu', props)\n\n const isCentered = useBreakpointValue({ base: true, md: false })\n\n return (\n <BaseModal\n isOpen={isOpen}\n onClose={onClose}\n initialFocusRef={initialFocusRef || menuRef}\n title={title}\n hideCloseButton={hideCloseButton}\n motionPreset={motionPreset}\n isCentered={isCenteredProp ?? isCentered}\n contentProps={{ mx: 4 }}\n >\n {/* We forward the styles again, otherwise the modal styles will be picked up */}\n <StylesProvider value={styles}>\n <chakra.div\n {...ownProps}\n ref={ref as React.Ref<HTMLDivElement>}\n __css={{\n outline: 0,\n maxHeight: '80vh', // can override this in theme\n overflowY: 'auto', // can override this in theme\n ...styles.list,\n boxShadow: 'none',\n border: 0,\n _dark: {\n /* @ts-expect-error */\n ...(styles.list._dark || {}),\n boxShadow: 'none',\n },\n }}\n />\n </StylesProvider>\n {footer && <ModalFooter>{footer}</ModalFooter>}\n </BaseModal>\n )\n }\n)\n","import * as React from 'react'\n\nimport { BaseModalProps } from './modal'\nimport { DrawerProps } from './drawer'\nimport { ConfirmDialogProps } from './dialog'\nimport { MenuDialogProps } from './menu'\nimport { FormDialogProps } from './form'\nimport { defaultModals } from './default-modals'\nimport { FieldValues, FormType } from '@saas-ui/forms'\nimport { FormDialogHandler, FormHandler } from './types'\n\nexport interface ModalsContextValue<\n TModals extends Record<string, React.FC<any>> = Record<string, React.FC<any>>,\n TTypes extends Extract<keyof TModals, string> = Extract<keyof TModals, string>\n> {\n open: <T extends OpenOptions<TTypes>>(\n componentOrOptions: T extends {\n component: infer TComponent extends React.FC<any>\n }\n ? WithModalOptions<React.ComponentPropsWithRef<TComponent>>\n : T extends {\n type: infer TType extends keyof TModals\n }\n ? WithModalOptions<React.ComponentPropsWithRef<TModals[TType]>>\n : T,\n options?: T extends React.FC<any>\n ? WithModalOptions<React.ComponentPropsWithRef<T>>\n : never\n ) => ModalId\n drawer: (options: DrawerOptions) => ModalId\n alert: (options: ConfirmDialogOptions) => ModalId\n confirm: (options: ConfirmDialogOptions) => ModalId\n menu: (options: MenuDialogOptions) => ModalId\n form: FormDialogHandler<TModals['form']>\n close: (id: ModalId) => void\n closeAll: () => void\n}\n\nexport const ModalsContext = React.createContext<ModalsContextValue<\n typeof defaultModals\n> | null>(null)\n\nexport interface ModalsProviderProps<\n TModals extends Record<string, React.FC<any>> = Record<string, React.FC<any>>\n> {\n children: React.ReactNode\n modals?: TModals\n}\n\nexport type ModalId = string | number\n\ntype WithModalOptions<T> = Omit<T, 'isOpen' | 'onClose'> & ModalOptions\n\ninterface ModalOptions\n extends Omit<BaseModalProps, 'isOpen' | 'onClose' | 'children'> {\n onClose?: (args: { force?: boolean }) => Promise<boolean | undefined> | void\n [key: string]: any\n}\n\nexport interface DrawerOptions\n extends ModalOptions,\n Omit<DrawerProps, 'onClose' | 'isOpen' | 'children' | 'title' | 'size'> {}\n\nexport interface ConfirmDialogOptions\n extends ModalOptions,\n Omit<ConfirmDialogProps, 'onClose' | 'isOpen' | 'children'> {}\n\nexport interface MenuDialogOptions\n extends ModalOptions,\n Omit<MenuDialogProps, 'onClose' | 'isOpen' | 'children'> {}\n\nexport interface FormDialogOptions\n extends ModalOptions,\n Omit<FormDialogProps, 'onClose' | 'isOpen' | 'children'> {}\n\nexport interface OpenOptions<TModalTypes extends string> extends ModalOptions {\n type?: TModalTypes\n scope?: ModalScopes\n}\n\nexport type ModalScopes = 'modal' | 'alert'\n\nexport interface ModalConfig<\n TModalOptions extends ModalOptions = ModalOptions,\n TModalTypes extends string = string\n> {\n /**\n * The modal id, autogenerated when not set.\n * Can be used to close modals.\n */\n id?: ModalId | null\n /**\n * The modal props\n */\n props?: TModalOptions | null\n /**\n * The modal scope\n * Modals can only have one level per scope.\n * The default scopes are 'modal' and 'alert', alerts can be openend above modals.\n */\n scope?: ModalScopes | string\n /**\n * The modal type to open.\n * Build in types are 'modal', 'drawer', 'alert', 'confirm'\n *\n * Custom types can be configured using the `modals` prop of `ModalProvider`\n */\n type?: TModalTypes\n /**\n * Render a custom modal component.\n * This will ignore the `type` param.\n */\n component?: React.FC<BaseModalProps>\n /**\n * Whether the modal is open or not.\n * This is used internally to keep track of the modal state.\n */\n isOpen?: boolean\n}\n\nconst initialModalState: ModalConfig = {\n id: null,\n props: null,\n type: 'modal',\n}\n\nexport function ModalsProvider({ children, modals }: ModalsProviderProps) {\n // Note that updating the Set doesn't trigger a re-render,\n // use in conjuction with setActiveModals\n const _instances = React.useMemo(() => new Set<ModalConfig>(), [])\n\n const [activeModals, setActiveModals] = React.useState<\n Record<string, ModalConfig>\n >({\n modal: initialModalState,\n })\n\n const getModalComponent = React.useMemo(() => {\n const _modals: Record<string, React.FC<any>> = {\n ...defaultModals,\n ...modals,\n }\n\n return (type = 'modal') => {\n const component = _modals[type] || _modals.modal\n\n return component\n }\n }, [modals])\n\n const setActiveModal = (modal: ModalConfig, scope?: string) => {\n if (!scope) {\n return setActiveModals({\n modal,\n })\n }\n setActiveModals((prevState) => ({\n ...prevState,\n [scope]: modal,\n }))\n }\n\n const open = <T extends OpenOptions<any>>(\n componentOrOptions: any,\n options?: T extends React.FC<any>\n ? WithModalOptions<React.ComponentPropsWithRef<T>>\n : never\n ): ModalId => {\n let _options: ModalOptions\n if (typeof componentOrOptions === 'function') {\n _options = {\n component: componentOrOptions,\n ...options,\n } as unknown as T\n } else {\n _options = componentOrOptions\n }\n\n const {\n id = _instances.size + 1,\n type = 'modal',\n scope = 'modal',\n component,\n ...props\n } = _options\n\n const modal: ModalConfig<T> = {\n id,\n props: props as T,\n type,\n scope,\n component,\n isOpen: true,\n }\n\n _instances.add(modal)\n setActiveModal(modal, scope)\n\n return id\n }\n\n const drawer = (options: DrawerOptions) => {\n return open<DrawerOptions>({\n ...options,\n type: 'drawer',\n })\n }\n\n const alert = (options: ConfirmDialogOptions) => {\n return open({\n ...options,\n scope: 'alert',\n type: 'alert',\n cancelProps: {\n display: 'none',\n },\n confirmProps: {\n label: 'OK',\n },\n leastDestructiveFocus: 'confirm',\n })\n }\n\n const confirm = (options: ConfirmDialogOptions) => {\n return open<ConfirmDialogOptions>({\n ...options,\n scope: 'alert',\n type: 'confirm',\n })\n }\n\n const menu = (options: MenuDialogOptions) => {\n return open<MenuDialogOptions>({\n ...options,\n type: 'menu',\n })\n }\n\n const form = (options: any) => {\n return open({\n ...options,\n type: 'form',\n })\n }\n\n const close = async (id?: ModalId | null, force?: boolean) => {\n const modals = [...Array.from(_instances)]\n const modal = modals.filter((modal) => modal.id === id)[0]\n\n if (!modal) {\n return\n }\n\n const shouldClose = await modal.props?.onClose?.({ force })\n if (shouldClose === false) {\n return\n }\n\n const scoped = modals.filter(({ scope }) => scope === modal.scope)\n\n if (scoped.length === 1) {\n setActiveModal(\n {\n ...modal,\n isOpen: false,\n },\n modal.scope\n )\n } else if (scoped.length > 1) {\n setActiveModal(scoped[scoped.length - 2], modal.scope)\n } else {\n setActiveModal(\n {\n id: null,\n props: null,\n type: modal.type, // Keep type same as last modal type to make sure the animation isn't interrupted\n },\n modal.scope\n )\n }\n\n // @todo this is not ideal, but not all modals support onCloseComplete\n setTimeout(() => closeComplete(id), 200)\n }\n\n const closeComplete = (id?: ModalId | null) => {\n const modals = [...Array.from(_instances)]\n const modal = modals.filter((modal) => modal.id === id)[0]\n\n _instances.delete(modal)\n\n const scoped = modal && modals.filter(({ scope }) => scope === modal.scope)\n\n if (scoped?.length === 1) {\n setActiveModal(initialModalState, modal.scope)\n }\n }\n\n const closeAll = () => {\n _instances.forEach((modal) => modal.props?.onClose?.({ force: true }))\n _instances.clear()\n\n setActiveModal(initialModalState)\n }\n\n const context = {\n open,\n drawer,\n alert,\n confirm,\n menu,\n form,\n close,\n closeAll,\n }\n\n const content = React.useMemo(\n () =>\n Object.entries(activeModals).map(([scope, config]) => {\n const Component = config.component || getModalComponent(config.type)\n\n const { title, body, children, ...props } = config.props || {}\n\n return (\n <Component\n key={scope}\n title={title}\n children={body || children}\n {...props}\n isOpen={!!config.isOpen}\n onClose={() => close(config.id)}\n onCloseComplete={() => closeComplete(config.id)}\n />\n )\n }),\n [activeModals]\n )\n\n return (\n <ModalsContext.Provider value={context}>\n {content}\n {children}\n </ModalsContext.Provider>\n )\n}\n\nexport const useModalsContext = () => React.useContext(ModalsContext)\n\nexport const useModals = () => {\n const modals = useModalsContext()\n\n if (!modals) {\n throw new Error('useModals must be used within a ModalsProvider')\n }\n\n return modals\n}\n","import { ConfirmDialog } from './dialog'\nimport { MenuDialog } from './menu'\nimport { FormDialog } from './form'\nimport { Drawer } from './drawer'\nimport { Modal } from './modal'\n\nexport const defaultModals = {\n alert: ConfirmDialog,\n confirm: ConfirmDialog,\n drawer: Drawer,\n modal: Modal,\n menu: MenuDialog,\n form: FormDialog,\n}\n","import { defaultModals } from './default-modals'\nimport {\n ModalsContextValue,\n ModalsProvider,\n ModalsProviderProps,\n useModals,\n} from './provider'\n\nexport interface CreateModalsOptions<\n TModalDefs extends Record<string, React.FC<any>>\n> {\n modals: TModalDefs\n}\n\nexport const createModals = <TModalDefs extends Record<string, React.FC<any>>>(\n options: CreateModalsOptions<TModalDefs>\n) => {\n const modals = {\n ...defaultModals,\n ...options.modals,\n }\n const Provider = (props: Omit<ModalsProviderProps, 'modals'>) => {\n return <ModalsProvider children={props.children} modals={modals} />\n }\n\n return {\n ModalsProvider: Provider,\n useModals: useModals as () => ModalsContextValue<typeof modals>,\n }\n}\n"],"mappings":";;;;;;;;;AAAA,YAAY,WAAW;AAEvB;AAAA,EACE;AAA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
|
package/dist/yup/index.d.mts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import * as _saas_ui_forms_yup from '@saas-ui/forms/yup';
|
2
|
-
import { YupFormType } from '@saas-ui/forms/yup';
|
3
|
-
import * as _chakra_ui_react from '@chakra-ui/react';
|
4
|
-
import * as _saas_ui_forms from '@saas-ui/forms';
|
5
|
-
import { B as BaseModalProps, F as FormDialogFieldOverrides } from '../form-BtCUKHAs.mjs';
|
6
|
-
import 'react';
|
7
|
-
import '@chakra-ui/utils';
|
8
|
-
|
9
|
-
declare function createYupFormDialog<FieldDefs = any, ExtraProps = object, ExtraFieldProps extends object = object, ExtraOverrides = object>(Form: YupFormType<FieldDefs, ExtraProps, ExtraFieldProps, ExtraOverrides>): YupFormType<FieldDefs, ExtraProps & Omit<BaseModalProps, "children">, ExtraFieldProps, ExtraOverrides & FormDialogFieldOverrides>;
|
10
|
-
|
11
|
-
declare const FormDialog: _saas_ui_forms_yup.YupFormType<unknown, object & Omit<BaseModalProps, "children">, any, object & _saas_ui_forms.DefaultFieldOverrides & {
|
12
|
-
cancel?: _chakra_ui_react.ButtonProps;
|
13
|
-
}>;
|
14
|
-
|
15
|
-
export { FormDialog, createYupFormDialog };
|
package/dist/yup/index.d.ts
DELETED
@@ -1,15 +0,0 @@
|
|
1
|
-
import * as _saas_ui_forms_yup from '@saas-ui/forms/yup';
|
2
|
-
import { YupFormType } from '@saas-ui/forms/yup';
|
3
|
-
import * as _chakra_ui_react from '@chakra-ui/react';
|
4
|
-
import * as _saas_ui_forms from '@saas-ui/forms';
|
5
|
-
import { B as BaseModalProps, F as FormDialogFieldOverrides } from '../form-BtCUKHAs.js';
|
6
|
-
import 'react';
|
7
|
-
import '@chakra-ui/utils';
|
8
|
-
|
9
|
-
declare function createYupFormDialog<FieldDefs = any, ExtraProps = object, ExtraFieldProps extends object = object, ExtraOverrides = object>(Form: YupFormType<FieldDefs, ExtraProps, ExtraFieldProps, ExtraOverrides>): YupFormType<FieldDefs, ExtraProps & Omit<BaseModalProps, "children">, ExtraFieldProps, ExtraOverrides & FormDialogFieldOverrides>;
|
10
|
-
|
11
|
-
declare const FormDialog: _saas_ui_forms_yup.YupFormType<unknown, object & Omit<BaseModalProps, "children">, any, object & _saas_ui_forms.DefaultFieldOverrides & {
|
12
|
-
cancel?: _chakra_ui_react.ButtonProps;
|
13
|
-
}>;
|
14
|
-
|
15
|
-
export { FormDialog, createYupFormDialog };
|