@mantine-vue/modals 3.0.0 → 3.2.0
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/cjs/index.cjs +167 -123
- package/cjs/index.cjs.map +1 -1
- package/esm/index.mjs +167 -123
- package/esm/index.mjs.map +1 -1
- package/lib/components/ConfirmModal/ConfirmModal.types.d.ts +32 -0
- package/lib/components/ConfirmModal/ConfirmModal.vue.d.ts +20 -0
- package/lib/components/ConfirmModal/index.d.ts +2 -0
- package/lib/components/ModalsProvider/ModalsProvider.types.d.ts +10 -0
- package/lib/components/ModalsProvider/ModalsProvider.vue.d.ts +14 -0
- package/lib/components/ModalsProvider/index.d.ts +2 -0
- package/lib/context.d.ts +19 -2
- package/lib/index.d.mts +4 -4
- package/lib/index.d.ts +4 -4
- package/lib/modals.store.d.ts +7 -0
- package/package.json +3 -3
- package/lib/ConfirmModal.d.ts +0 -106
- package/lib/ModalsProvider.d.ts +0 -42
package/cjs/index.cjs
CHANGED
|
@@ -12,23 +12,13 @@ function useModals() {
|
|
|
12
12
|
return ctx;
|
|
13
13
|
}
|
|
14
14
|
//#endregion
|
|
15
|
-
//#region src/ConfirmModal.
|
|
16
|
-
var
|
|
15
|
+
//#region src/components/ConfirmModal/ConfirmModal.vue
|
|
16
|
+
var ConfirmModal_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
17
17
|
name: "ConfirmModal",
|
|
18
18
|
inheritAttrs: false,
|
|
19
|
+
__name: "ConfirmModal",
|
|
19
20
|
props: {
|
|
20
|
-
id: {
|
|
21
|
-
type: String,
|
|
22
|
-
default: void 0
|
|
23
|
-
},
|
|
24
|
-
onCancel: {
|
|
25
|
-
type: Function,
|
|
26
|
-
default: void 0
|
|
27
|
-
},
|
|
28
|
-
onConfirm: {
|
|
29
|
-
type: Function,
|
|
30
|
-
default: void 0
|
|
31
|
-
},
|
|
21
|
+
id: {},
|
|
32
22
|
closeOnConfirm: {
|
|
33
23
|
type: Boolean,
|
|
34
24
|
default: true
|
|
@@ -37,53 +27,68 @@ var ConfirmModal = (0, vue.defineComponent)({
|
|
|
37
27
|
type: Boolean,
|
|
38
28
|
default: true
|
|
39
29
|
},
|
|
40
|
-
cancelProps: {
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
},
|
|
48
|
-
groupProps: {
|
|
49
|
-
type: Object,
|
|
50
|
-
default: void 0
|
|
51
|
-
},
|
|
52
|
-
labels: {
|
|
53
|
-
type: Object,
|
|
54
|
-
default: () => ({
|
|
55
|
-
cancel: "",
|
|
56
|
-
confirm: ""
|
|
57
|
-
})
|
|
58
|
-
}
|
|
30
|
+
cancelProps: {},
|
|
31
|
+
confirmProps: {},
|
|
32
|
+
groupProps: {},
|
|
33
|
+
labels: { default: () => ({
|
|
34
|
+
cancel: "",
|
|
35
|
+
confirm: ""
|
|
36
|
+
}) }
|
|
59
37
|
},
|
|
60
|
-
|
|
38
|
+
emits: ["cancel", "confirm"],
|
|
39
|
+
setup(__props, { emit: __emit }) {
|
|
40
|
+
const props = __props;
|
|
41
|
+
const emit = __emit;
|
|
42
|
+
const slots = (0, vue.useSlots)();
|
|
61
43
|
const ctx = useModals();
|
|
62
|
-
const
|
|
44
|
+
const hasChildren = (0, vue.computed)(() => Boolean(slots.default));
|
|
45
|
+
const cancelButtonProps = (0, vue.computed)(() => {
|
|
46
|
+
const value = { ...props.cancelProps };
|
|
47
|
+
delete value.onClick;
|
|
48
|
+
delete value.children;
|
|
49
|
+
return value;
|
|
50
|
+
});
|
|
51
|
+
const confirmButtonProps = (0, vue.computed)(() => {
|
|
52
|
+
const value = { ...props.confirmProps };
|
|
53
|
+
delete value.onClick;
|
|
54
|
+
delete value.children;
|
|
55
|
+
return value;
|
|
56
|
+
});
|
|
57
|
+
const renderCancelLabel = () => props.cancelProps?.children ?? props.labels.cancel;
|
|
58
|
+
const renderConfirmLabel = () => props.confirmProps?.children ?? props.labels.confirm;
|
|
59
|
+
function cancel(event) {
|
|
63
60
|
props.cancelProps?.onClick?.(event);
|
|
64
|
-
|
|
61
|
+
emit("cancel");
|
|
65
62
|
if (props.closeOnCancel) ctx.closeModal(props.id);
|
|
66
|
-
}
|
|
67
|
-
|
|
63
|
+
}
|
|
64
|
+
function confirm(event) {
|
|
68
65
|
props.confirmProps?.onClick?.(event);
|
|
69
|
-
|
|
66
|
+
emit("confirm");
|
|
70
67
|
if (props.closeOnConfirm) ctx.closeModal(props.id);
|
|
71
|
-
}
|
|
72
|
-
return () => {
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
}, ()
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
68
|
+
}
|
|
69
|
+
return (_ctx, _cache) => {
|
|
70
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [hasChildren.value ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.unref)(_mantine_vue_core.Box), {
|
|
71
|
+
key: 0,
|
|
72
|
+
mb: "md"
|
|
73
|
+
}, {
|
|
74
|
+
default: (0, vue.withCtx)(() => [(0, vue.renderSlot)(_ctx.$slots, "default")]),
|
|
75
|
+
_: 3
|
|
76
|
+
})) : (0, vue.createCommentVNode)("", true), (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Group), (0, vue.mergeProps)(props.groupProps, {
|
|
77
|
+
mt: hasChildren.value ? 0 : "md",
|
|
78
|
+
justify: "flex-end"
|
|
79
|
+
}), {
|
|
80
|
+
default: (0, vue.withCtx)(() => [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Button), (0, vue.mergeProps)(cancelButtonProps.value, {
|
|
81
|
+
variant: "default",
|
|
82
|
+
onClick: cancel
|
|
83
|
+
}), {
|
|
84
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(renderCancelLabel)))]),
|
|
85
|
+
_: 1
|
|
86
|
+
}, 16), (0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Button), (0, vue.mergeProps)(confirmButtonProps.value, { onClick: confirm }), {
|
|
87
|
+
default: (0, vue.withCtx)(() => [((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(renderConfirmLabel)))]),
|
|
88
|
+
_: 1
|
|
89
|
+
}, 16)]),
|
|
90
|
+
_: 1
|
|
91
|
+
}, 16, ["mt"])], 64);
|
|
87
92
|
};
|
|
88
93
|
}
|
|
89
94
|
});
|
|
@@ -244,12 +249,19 @@ function openContextModalPayload(payload, store = modalsStore) {
|
|
|
244
249
|
return openContextModalAction(modal, rest, store);
|
|
245
250
|
}
|
|
246
251
|
var modals = {
|
|
252
|
+
/** Opens a regular modal and returns its id. */
|
|
247
253
|
open: (props) => openModalAction(props),
|
|
254
|
+
/** Closes the modal with the given id. */
|
|
248
255
|
close: (id) => closeModalAction(id),
|
|
256
|
+
/** Closes all opened modals. */
|
|
249
257
|
closeAll: () => closeAllModalsAction(),
|
|
258
|
+
/** Opens a confirm modal and returns its id. */
|
|
250
259
|
openConfirmModal: (props) => openConfirmModalAction(props),
|
|
260
|
+
/** Opens a predefined context modal and returns its id. */
|
|
251
261
|
openContextModal: (payload) => openContextModalPayload(payload),
|
|
262
|
+
/** Dynamically updates the content and properties of a regular or confirm modal. */
|
|
252
263
|
updateModal: (payload) => updateModalAction(payload),
|
|
264
|
+
/** Dynamically updates the content and properties of a context modal. */
|
|
253
265
|
updateContextModal: (payload) => updateContextModalAction(payload)
|
|
254
266
|
};
|
|
255
267
|
var openModal = modals.open;
|
|
@@ -260,44 +272,17 @@ var openContextModal = modals.openContextModal;
|
|
|
260
272
|
var updateModal = modals.updateModal;
|
|
261
273
|
var updateContextModal = modals.updateContextModal;
|
|
262
274
|
//#endregion
|
|
263
|
-
//#region src/ModalsProvider.
|
|
264
|
-
|
|
265
|
-
const { id, children: _children, onCancel, onConfirm, closeOnConfirm, closeOnCancel, cancelProps, confirmProps, groupProps, labels, ...modalProps } = props;
|
|
266
|
-
return {
|
|
267
|
-
confirmModalProps: {
|
|
268
|
-
id,
|
|
269
|
-
onCancel,
|
|
270
|
-
onConfirm,
|
|
271
|
-
closeOnConfirm,
|
|
272
|
-
closeOnCancel,
|
|
273
|
-
cancelProps,
|
|
274
|
-
confirmProps,
|
|
275
|
-
groupProps,
|
|
276
|
-
labels
|
|
277
|
-
},
|
|
278
|
-
modalProps: {
|
|
279
|
-
id,
|
|
280
|
-
...modalProps
|
|
281
|
-
}
|
|
282
|
-
};
|
|
283
|
-
}
|
|
284
|
-
var ModalsProvider = (0, vue.defineComponent)({
|
|
275
|
+
//#region src/components/ModalsProvider/ModalsProvider.vue
|
|
276
|
+
var ModalsProvider_default = /* @__PURE__ */ (0, vue.defineComponent)({
|
|
285
277
|
name: "ModalsProvider",
|
|
278
|
+
__name: "ModalsProvider",
|
|
286
279
|
props: {
|
|
287
|
-
modals: {
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
},
|
|
291
|
-
modalProps: {
|
|
292
|
-
type: Object,
|
|
293
|
-
default: void 0
|
|
294
|
-
},
|
|
295
|
-
labels: {
|
|
296
|
-
type: Object,
|
|
297
|
-
default: void 0
|
|
298
|
-
}
|
|
280
|
+
modals: {},
|
|
281
|
+
modalProps: {},
|
|
282
|
+
labels: {}
|
|
299
283
|
},
|
|
300
|
-
setup(
|
|
284
|
+
setup(__props) {
|
|
285
|
+
const props = __props;
|
|
301
286
|
const state = useModalsState(modalsStore);
|
|
302
287
|
const openModal = (settings) => openModalAction(settings, modalsStore);
|
|
303
288
|
const openConfirmModal = (settings) => openConfirmModalAction(settings, modalsStore);
|
|
@@ -306,7 +291,7 @@ var ModalsProvider = (0, vue.defineComponent)({
|
|
|
306
291
|
const closeAll = () => closeAllModalsAction(void 0, modalsStore);
|
|
307
292
|
const updateModal = (payload) => updateModalAction(payload, modalsStore);
|
|
308
293
|
const updateContextModal = (payload) => updateContextModalAction(payload, modalsStore);
|
|
309
|
-
const
|
|
294
|
+
const context = {
|
|
310
295
|
get modalProps() {
|
|
311
296
|
return props.modalProps || {};
|
|
312
297
|
},
|
|
@@ -322,46 +307,105 @@ var ModalsProvider = (0, vue.defineComponent)({
|
|
|
322
307
|
updateModal,
|
|
323
308
|
updateContextModal
|
|
324
309
|
};
|
|
325
|
-
(0, vue.provide)(ModalsContextKey,
|
|
326
|
-
|
|
310
|
+
(0, vue.provide)(ModalsContextKey, context);
|
|
311
|
+
function separateConfirmModalProps(settings) {
|
|
312
|
+
const value = { ...settings };
|
|
313
|
+
const confirmModalProps = {
|
|
314
|
+
id: value.id,
|
|
315
|
+
onCancel: value.onCancel,
|
|
316
|
+
onConfirm: value.onConfirm,
|
|
317
|
+
closeOnConfirm: value.closeOnConfirm,
|
|
318
|
+
closeOnCancel: value.closeOnCancel,
|
|
319
|
+
cancelProps: value.cancelProps,
|
|
320
|
+
confirmProps: value.confirmProps,
|
|
321
|
+
groupProps: value.groupProps,
|
|
322
|
+
labels: value.labels
|
|
323
|
+
};
|
|
324
|
+
for (const key of [
|
|
325
|
+
"children",
|
|
326
|
+
"onCancel",
|
|
327
|
+
"onConfirm",
|
|
328
|
+
"closeOnConfirm",
|
|
329
|
+
"closeOnCancel",
|
|
330
|
+
"cancelProps",
|
|
331
|
+
"confirmProps",
|
|
332
|
+
"groupProps",
|
|
333
|
+
"labels"
|
|
334
|
+
]) delete value[key];
|
|
335
|
+
return {
|
|
336
|
+
confirmModalProps,
|
|
337
|
+
modalProps: value
|
|
338
|
+
};
|
|
339
|
+
}
|
|
340
|
+
const presentation = (0, vue.computed)(() => {
|
|
327
341
|
const current = state.value.current;
|
|
328
|
-
|
|
329
|
-
|
|
330
|
-
|
|
331
|
-
|
|
332
|
-
|
|
333
|
-
|
|
334
|
-
|
|
335
|
-
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
343
|
-
|
|
344
|
-
id: current.id,
|
|
345
|
-
labels: current.props.labels || props.labels
|
|
346
|
-
});
|
|
347
|
-
} else {
|
|
348
|
-
const { children, ...rest } = current.props;
|
|
349
|
-
currentModalProps = rest;
|
|
350
|
-
content = typeof children === "function" ? children() : children ?? null;
|
|
342
|
+
if (!current) return {
|
|
343
|
+
modalProps: {},
|
|
344
|
+
component: null,
|
|
345
|
+
componentProps: {}
|
|
346
|
+
};
|
|
347
|
+
if (current.type === "context") {
|
|
348
|
+
const { innerProps, ...modalProps } = current.props;
|
|
349
|
+
return {
|
|
350
|
+
modalProps,
|
|
351
|
+
component: props.modals?.[current.ctx] ?? null,
|
|
352
|
+
componentProps: {
|
|
353
|
+
innerProps,
|
|
354
|
+
context,
|
|
355
|
+
id: current.id
|
|
356
|
+
}
|
|
357
|
+
};
|
|
351
358
|
}
|
|
352
|
-
|
|
359
|
+
if (current.type === "confirm") {
|
|
360
|
+
const separated = separateConfirmModalProps(current.props);
|
|
361
|
+
return {
|
|
362
|
+
modalProps: separated.modalProps,
|
|
363
|
+
component: ConfirmModal_default,
|
|
364
|
+
componentProps: {
|
|
365
|
+
...separated.confirmModalProps,
|
|
366
|
+
id: current.id,
|
|
367
|
+
labels: current.props.labels || props.labels
|
|
368
|
+
}
|
|
369
|
+
};
|
|
370
|
+
}
|
|
371
|
+
const modalProps = { ...current.props };
|
|
372
|
+
delete modalProps.children;
|
|
373
|
+
return {
|
|
374
|
+
modalProps,
|
|
375
|
+
component: null,
|
|
376
|
+
componentProps: {}
|
|
377
|
+
};
|
|
378
|
+
});
|
|
379
|
+
const modalAttrs = (0, vue.computed)(() => {
|
|
380
|
+
const value = {
|
|
353
381
|
zIndex: (0, _mantine_vue_core.getDefaultZIndex)("modal") + 1,
|
|
354
382
|
...props.modalProps,
|
|
355
|
-
...
|
|
356
|
-
|
|
357
|
-
|
|
358
|
-
|
|
383
|
+
...presentation.value.modalProps
|
|
384
|
+
};
|
|
385
|
+
delete value.opened;
|
|
386
|
+
delete value.onClose;
|
|
387
|
+
return value;
|
|
388
|
+
});
|
|
389
|
+
const renderContent = () => {
|
|
390
|
+
const current = state.value.current;
|
|
391
|
+
if (!current || current.type !== "content") return null;
|
|
392
|
+
const children = current.props.children;
|
|
393
|
+
return typeof children === "function" ? children() : children ?? null;
|
|
394
|
+
};
|
|
395
|
+
return (_ctx, _cache) => {
|
|
396
|
+
return (0, vue.openBlock)(), (0, vue.createElementBlock)(vue.Fragment, null, [(0, vue.createVNode)((0, vue.unref)(_mantine_vue_core.Modal), (0, vue.mergeProps)(modalAttrs.value, {
|
|
397
|
+
opened: (0, vue.unref)(state).modals.length > 0,
|
|
398
|
+
onClose: _cache[0] || (_cache[0] = ($event) => closeModal((0, vue.unref)(state).current?.id))
|
|
399
|
+
}), {
|
|
400
|
+
default: (0, vue.withCtx)(() => [presentation.value.component ? ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(presentation.value.component), (0, vue.normalizeProps)((0, vue.mergeProps)({ key: 0 }, presentation.value.componentProps)), null, 16)) : ((0, vue.openBlock)(), (0, vue.createBlock)((0, vue.resolveDynamicComponent)(renderContent), { key: 1 }))]),
|
|
401
|
+
_: 1
|
|
402
|
+
}, 16, ["opened"]), (0, vue.renderSlot)(_ctx.$slots, "default")], 64);
|
|
359
403
|
};
|
|
360
404
|
}
|
|
361
405
|
});
|
|
362
406
|
//#endregion
|
|
363
|
-
exports.ConfirmModal =
|
|
364
|
-
exports.ModalsProvider =
|
|
407
|
+
exports.ConfirmModal = ConfirmModal_default;
|
|
408
|
+
exports.ModalsProvider = ModalsProvider_default;
|
|
365
409
|
exports.closeAllModals = closeAllModals;
|
|
366
410
|
exports.closeAllModalsAction = closeAllModalsAction;
|
|
367
411
|
exports.closeModal = closeModal;
|
package/cjs/index.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.cjs","names":[],"sources":["../src/context.ts","../src/use-modals.ts","../src/ConfirmModal.ts","../src/reducer.ts","../src/modals.store.ts","../src/ModalsProvider.ts"],"sourcesContent":["import type { InjectionKey, VNodeChild } from 'vue'\nimport type { ModalProps } from '@mantine-vue/core'\nimport type { ConfirmModalProps } from './ConfirmModal'\n\nexport type ModalSettings = Partial<Omit<ModalProps, 'opened'>> & {\n modalId?: string\n children?: VNodeChild | (() => VNodeChild)\n onClose?: () => void\n}\n\nexport type ConfirmLabels = Record<'confirm' | 'cancel', VNodeChild>\n\nexport interface OpenConfirmModal extends ModalSettings, ConfirmModalProps {}\n\nexport interface OpenContextModal<\n CustomProps extends Record<string, any> = Record<string, any>,\n> extends ModalSettings {\n innerProps: CustomProps\n}\n\nexport interface ContextModalProps<T extends Record<string, any> = Record<string, any>> {\n context: ModalsContextProps\n innerProps: T\n id: string\n}\n\nexport type ModalState =\n | { id: string; type: 'content'; props: ModalSettings }\n | { id: string; type: 'confirm'; props: OpenConfirmModal }\n | { id: string; type: 'context'; props: OpenContextModal; ctx: string }\n\nexport interface ModalsContextProps {\n modalProps: ModalSettings\n modals: ModalState[]\n openModal: (props: ModalSettings) => string\n openConfirmModal: (props: OpenConfirmModal) => string\n openContextModal: (modal: string, props: OpenContextModal) => string\n closeModal: (id: string, canceled?: boolean) => void\n closeContextModal: (id: string, canceled?: boolean) => void\n closeAll: () => void\n updateModal: (payload: { modalId: string } & Partial<OpenConfirmModal>) => void\n updateContextModal: (payload: { modalId: string } & Partial<OpenContextModal<any>>) => void\n}\n\nexport const ModalsContextKey: InjectionKey<ModalsContextProps> = Symbol('ModalsContext')\n","import { inject } from 'vue'\nimport { ModalsContextKey, type ModalsContextProps } from './context'\n\nexport function useModals(): ModalsContextProps {\n const ctx = inject(ModalsContextKey, null)\n\n if (!ctx) {\n throw new Error(\n '[@mantine-vue/modals] useModals composable was called outside of context, wrap your app with the ModalsProvider component',\n )\n }\n\n return ctx\n}\n","import { defineComponent, h, type PropType } from 'vue'\nimport { Box, Button, Group } from '@mantine-vue/core'\nimport type { ConfirmLabels } from './context'\nimport { useModals } from './use-modals'\n\nexport interface ConfirmModalProps {\n id?: string\n onCancel?: () => void\n onConfirm?: () => void\n closeOnConfirm?: boolean\n closeOnCancel?: boolean\n cancelProps?: Record<string, any>\n confirmProps?: Record<string, any>\n groupProps?: Record<string, any>\n labels?: ConfirmLabels\n}\n\nexport const ConfirmModal = defineComponent({\n name: 'ConfirmModal',\n inheritAttrs: false,\n props: {\n id: { type: String, default: undefined },\n onCancel: { type: Function as PropType<() => void>, default: undefined },\n onConfirm: { type: Function as PropType<() => void>, default: undefined },\n closeOnConfirm: { type: Boolean, default: true },\n closeOnCancel: { type: Boolean, default: true },\n cancelProps: { type: Object as PropType<Record<string, any>>, default: undefined },\n confirmProps: { type: Object as PropType<Record<string, any>>, default: undefined },\n groupProps: { type: Object as PropType<Record<string, any>>, default: undefined },\n labels: {\n type: Object as PropType<ConfirmLabels>,\n default: () => ({ cancel: '', confirm: '' }),\n },\n },\n setup(props, { slots }) {\n const ctx = useModals()\n\n const handleCancel = (event: MouseEvent) => {\n props.cancelProps?.onClick?.(event)\n props.onCancel?.()\n if (props.closeOnCancel) {\n ctx.closeModal(props.id!)\n }\n }\n\n const handleConfirm = (event: MouseEvent) => {\n props.confirmProps?.onClick?.(event)\n props.onConfirm?.()\n if (props.closeOnConfirm) {\n ctx.closeModal(props.id!)\n }\n }\n\n return () => {\n const children = slots.default?.()\n const hasChildren = !!children && children.length > 0\n\n return [\n hasChildren ? h(Box, { mb: 'md' }, () => children) : null,\n h(Group, { mt: hasChildren ? 0 : 'md', justify: 'flex-end', ...props.groupProps }, () => [\n h(\n Button,\n { variant: 'default', ...props.cancelProps, onClick: handleCancel },\n () => props.cancelProps?.children ?? props.labels?.cancel,\n ),\n h(\n Button,\n { ...props.confirmProps, onClick: handleConfirm },\n () => props.confirmProps?.children ?? props.labels?.confirm,\n ),\n ]),\n ]\n }\n },\n})\n","import type { ModalSettings, ModalState } from './context'\n\nexport interface ModalsState {\n modals: ModalState[]\n current: ModalState | null\n}\n\nexport interface OpenAction {\n type: 'OPEN'\n modal: ModalState\n}\n\nexport interface CloseAction {\n type: 'CLOSE'\n modalId: string\n canceled?: boolean\n}\n\nexport interface CloseAllAction {\n type: 'CLOSE_ALL'\n canceled?: boolean\n}\n\nexport interface UpdateAction {\n type: 'UPDATE'\n modalId: string\n newProps: Partial<ModalSettings>\n}\n\nexport type ModalsAction = OpenAction | CloseAction | CloseAllAction | UpdateAction\n\nexport function handleCloseModal(modal: ModalState, canceled?: boolean) {\n if (canceled && modal.type === 'confirm') {\n modal.props.onCancel?.()\n }\n\n modal.props.onClose?.()\n}\n\nexport function modalsReducer(state: ModalsState, action: ModalsAction): ModalsState {\n switch (action.type) {\n case 'OPEN': {\n if (state.modals.some((modal) => modal.id === action.modal.id)) {\n return state\n }\n\n return {\n current: action.modal,\n modals: [...state.modals, action.modal],\n }\n }\n\n case 'CLOSE': {\n const modals = state.modals.filter((modal) => modal.id !== action.modalId)\n return {\n current: modals.length > 0 ? modals[modals.length - 1] : state.current,\n modals,\n }\n }\n\n case 'CLOSE_ALL': {\n return {\n current: state.current,\n modals: [],\n }\n }\n\n case 'UPDATE': {\n const modals = state.modals.map((modal) => {\n if (modal.id !== action.modalId) {\n return modal\n }\n\n if (modal.type === 'context') {\n return {\n ...modal,\n props: {\n ...modal.props,\n ...action.newProps,\n innerProps: {\n ...modal.props.innerProps,\n ...(action.newProps as any).innerProps,\n },\n },\n }\n }\n\n return { ...modal, props: { ...modal.props, ...action.newProps } } as ModalState\n })\n\n const current =\n state.current && state.current.id === action.modalId\n ? modals.find((modal) => modal.id === action.modalId) || state.current\n : state.current\n\n return { current, modals }\n }\n\n default:\n return state\n }\n}\n","import { type Ref } from 'vue'\nimport { createStore, type MantineStore } from '@mantine-vue/store'\nimport type { ModalSettings, OpenConfirmModal, OpenContextModal } from './context'\nimport { handleCloseModal, modalsReducer, type ModalsAction, type ModalsState } from './reducer'\n\nexport type ModalsStore = MantineStore<ModalsState>\n\nfunction randomId() {\n return `mantine-${Math.random().toString(36).slice(2, 11)}`\n}\n\nexport const createModalsStore = () => createStore<ModalsState>({ modals: [], current: null })\n\nexport const modalsStore = createModalsStore()\n\nexport const useModalsState = (store: ModalsStore = modalsStore): Readonly<Ref<ModalsState>> =>\n store.value\n\nconst closingMap = new WeakMap<ModalsStore, boolean>()\n\nfunction dispatch(action: ModalsAction, store: ModalsStore) {\n store.setState((state) => modalsReducer(state, action))\n}\n\nexport function openModalAction(props: ModalSettings, store: ModalsStore = modalsStore): string {\n const { modalId, ...rest } = props\n const id = modalId || randomId()\n dispatch({ type: 'OPEN', modal: { id, type: 'content', props: rest } }, store)\n return id\n}\n\nexport function openConfirmModalAction(\n props: OpenConfirmModal,\n store: ModalsStore = modalsStore,\n): string {\n const { modalId, ...rest } = props\n const id = modalId || randomId()\n dispatch({ type: 'OPEN', modal: { id, type: 'confirm', props: rest } }, store)\n return id\n}\n\nexport function openContextModalAction(\n modal: string,\n props: OpenContextModal,\n store: ModalsStore = modalsStore,\n): string {\n const { modalId, ...rest } = props\n const id = modalId || randomId()\n dispatch({ type: 'OPEN', modal: { id, type: 'context', props: rest, ctx: modal } }, store)\n return id\n}\n\nexport function closeModalAction(id: string, canceled?: boolean, store: ModalsStore = modalsStore) {\n if (!closingMap.get(store)) {\n const modal = store.getState().modals.find((item) => item.id === id)\n if (modal) {\n closingMap.set(store, true)\n handleCloseModal(modal, canceled)\n closingMap.set(store, false)\n }\n }\n\n dispatch({ type: 'CLOSE', modalId: id, canceled }, store)\n}\n\nexport function closeAllModalsAction(canceled?: boolean, store: ModalsStore = modalsStore) {\n if (!closingMap.get(store)) {\n closingMap.set(store, true)\n store\n .getState()\n .modals.slice()\n .reverse()\n .forEach((modal) => handleCloseModal(modal, canceled))\n closingMap.set(store, false)\n }\n\n dispatch({ type: 'CLOSE_ALL', canceled }, store)\n}\n\nexport function updateModalAction(\n payload: { modalId: string } & Partial<ModalSettings>,\n store: ModalsStore = modalsStore,\n) {\n const { modalId, ...newProps } = payload\n dispatch({ type: 'UPDATE', modalId, newProps }, store)\n}\n\nexport function updateContextModalAction(\n payload: { modalId: string } & Partial<OpenContextModal<any>>,\n store: ModalsStore = modalsStore,\n) {\n const { modalId, ...newProps } = payload\n dispatch({ type: 'UPDATE', modalId, newProps }, store)\n}\n\nfunction openContextModalPayload(\n payload: OpenContextModal & { modal: string },\n store: ModalsStore = modalsStore,\n): string {\n const { modal, ...rest } = payload\n return openContextModalAction(modal, rest, store)\n}\n\nexport const modals = {\n open: (props: ModalSettings) => openModalAction(props),\n close: (id: string) => closeModalAction(id),\n closeAll: () => closeAllModalsAction(),\n openConfirmModal: (props: OpenConfirmModal) => openConfirmModalAction(props),\n openContextModal: (payload: OpenContextModal & { modal: string }) =>\n openContextModalPayload(payload),\n updateModal: (payload: { modalId: string } & Partial<OpenConfirmModal>) =>\n updateModalAction(payload),\n updateContextModal: (payload: { modalId: string } & Partial<OpenContextModal<any>>) =>\n updateContextModalAction(payload),\n} as const\n\nexport const openModal = modals.open\nexport const closeModal = modals.close\nexport const closeAllModals = modals.closeAll\nexport const openConfirmModal = modals.openConfirmModal\nexport const openContextModal = modals.openContextModal\nexport const updateModal = modals.updateModal\nexport const updateContextModal = modals.updateContextModal\n","import { defineComponent, h, provide, type PropType, type VNodeChild } from 'vue'\nimport { getDefaultZIndex, Modal } from '@mantine-vue/core'\nimport { ConfirmModal } from './ConfirmModal'\nimport {\n ModalsContextKey,\n type ConfirmLabels,\n type ModalsContextProps,\n type ModalSettings,\n type OpenConfirmModal,\n type OpenContextModal,\n} from './context'\nimport {\n closeAllModalsAction,\n closeModalAction,\n modalsStore,\n openConfirmModalAction,\n openContextModalAction,\n openModalAction,\n updateContextModalAction,\n updateModalAction,\n useModalsState,\n} from './modals.store'\n\nexport interface ModalsProviderProps {\n modals?: Record<string, any>\n modalProps?: ModalSettings\n labels?: ConfirmLabels\n}\n\nfunction separateConfirmModalProps(props: OpenConfirmModal) {\n const {\n id,\n children: _children,\n onCancel,\n onConfirm,\n closeOnConfirm,\n closeOnCancel,\n cancelProps,\n confirmProps,\n groupProps,\n labels,\n ...modalProps\n } = props as any\n\n return {\n confirmModalProps: {\n id,\n onCancel,\n onConfirm,\n closeOnConfirm,\n closeOnCancel,\n cancelProps,\n confirmProps,\n groupProps,\n labels,\n },\n modalProps: { id, ...modalProps },\n }\n}\n\nexport const ModalsProvider = defineComponent({\n name: 'ModalsProvider',\n props: {\n modals: { type: Object as PropType<Record<string, any>>, default: undefined },\n modalProps: { type: Object as PropType<ModalSettings>, default: undefined },\n labels: { type: Object as PropType<ConfirmLabels>, default: undefined },\n },\n setup(props, { slots }) {\n const state = useModalsState(modalsStore)\n\n const openModal = (settings: ModalSettings) => openModalAction(settings, modalsStore)\n const openConfirmModal = (settings: OpenConfirmModal) =>\n openConfirmModalAction(settings, modalsStore)\n const openContextModal = (modal: string, settings: OpenContextModal) =>\n openContextModalAction(modal, settings, modalsStore)\n const closeModal = (id: string, canceled?: boolean) =>\n closeModalAction(id, canceled, modalsStore)\n const closeAll = () => closeAllModalsAction(undefined, modalsStore)\n const updateModal = (payload: { modalId: string } & Partial<OpenConfirmModal>) =>\n updateModalAction(payload, modalsStore)\n const updateContextModal = (payload: { modalId: string } & Partial<OpenContextModal<any>>) =>\n updateContextModalAction(payload, modalsStore)\n\n const ctx: ModalsContextProps = {\n get modalProps() {\n return props.modalProps || {}\n },\n get modals() {\n return state.value.modals\n },\n openModal,\n openConfirmModal,\n openContextModal,\n closeModal,\n closeContextModal: closeModal,\n closeAll,\n updateModal,\n updateContextModal,\n }\n\n provide(ModalsContextKey, ctx)\n\n return () => {\n const current = state.value.current\n let currentModalProps: Record<string, any> = {}\n let content: VNodeChild = null\n\n if (current) {\n if (current.type === 'context') {\n const { innerProps, ...rest } = current.props\n currentModalProps = rest\n const ContextModalComponent = props.modals?.[current.ctx]\n content = ContextModalComponent\n ? h(ContextModalComponent, { innerProps, context: ctx, id: current.id })\n : null\n } else if (current.type === 'confirm') {\n const { confirmModalProps, modalProps: separatedModalProps } = separateConfirmModalProps(\n current.props,\n )\n currentModalProps = separatedModalProps\n content = h(ConfirmModal, {\n ...confirmModalProps,\n id: current.id,\n labels: current.props.labels || props.labels,\n })\n } else {\n const { children, ...rest } = current.props as any\n currentModalProps = rest\n content = typeof children === 'function' ? children() : (children ?? null)\n }\n }\n\n return [\n h(\n Modal,\n {\n zIndex: getDefaultZIndex('modal') + 1,\n ...props.modalProps,\n ...currentModalProps,\n opened: state.value.modals.length > 0,\n onClose: () => closeModal(state.value.current?.id as string),\n },\n () => content,\n ),\n slots.default?.(),\n ]\n }\n },\n})\n"],"mappings":";;;;;AA4CA,IAAa,mBAAqD,OAAO,eAAe;;;ACzCxF,SAAgB,YAAgC;CAC9C,MAAM,OAAA,GAAA,IAAA,QAAa,kBAAkB,IAAI;CAEzC,IAAI,CAAC,KACH,MAAM,IAAI,MACR,2HACF;CAGF,OAAO;AACT;;;ACIA,IAAa,gBAAA,GAAA,IAAA,iBAA+B;CAC1C,MAAM;CACN,cAAc;CACd,OAAO;EACL,IAAI;GAAE,MAAM;GAAQ,SAAS,KAAA;EAAU;EACvC,UAAU;GAAE,MAAM;GAAkC,SAAS,KAAA;EAAU;EACvE,WAAW;GAAE,MAAM;GAAkC,SAAS,KAAA;EAAU;EACxE,gBAAgB;GAAE,MAAM;GAAS,SAAS;EAAK;EAC/C,eAAe;GAAE,MAAM;GAAS,SAAS;EAAK;EAC9C,aAAa;GAAE,MAAM;GAAyC,SAAS,KAAA;EAAU;EACjF,cAAc;GAAE,MAAM;GAAyC,SAAS,KAAA;EAAU;EAClF,YAAY;GAAE,MAAM;GAAyC,SAAS,KAAA;EAAU;EAChF,QAAQ;GACN,MAAM;GACN,gBAAgB;IAAE,QAAQ;IAAI,SAAS;GAAG;EAC5C;CACF;CACA,MAAM,OAAO,EAAE,SAAS;EACtB,MAAM,MAAM,UAAU;EAEtB,MAAM,gBAAgB,UAAsB;GA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;IACpB,UAAU,OAAO,aAAa,aAAa,SAAS,IAAK,YAAY;GACvE;GAGF,OAAO,EAAA,GAAA,IAAA,GAEH,kBAAA,OACA;IACE,SAAA,GAAA,kBAAA,kBAAyB,OAAO,IAAI;IACpC,GAAG,MAAM;IACT,GAAG;IACH,QAAQ,MAAM,MAAM,OAAO,SAAS;IACpC,eAAe,WAAW,MAAM,MAAM,SAAS,EAAY;GAC7D,SACM,OACR,GACA,MAAM,UAAU,CAClB;EACF;CACF;AACF,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.cjs","names":[],"sources":["../src/context.ts","../src/use-modals.ts","../src/components/ConfirmModal/ConfirmModal.vue","../src/components/ConfirmModal/ConfirmModal.vue","../src/reducer.ts","../src/modals.store.ts","../src/components/ModalsProvider/ModalsProvider.vue","../src/components/ModalsProvider/ModalsProvider.vue"],"sourcesContent":["import type { InjectionKey, VNodeChild } from 'vue'\nimport type { ModalProps } from '@mantine-vue/core'\nimport type { ConfirmModalCallbacks, ConfirmModalProps } from './components/ConfirmModal'\n\nexport type ModalSettings = Partial<Omit<ModalProps, 'opened'>> & {\n /** Modal id, defaults to a random id, can be used to close or update the modal programmatically. */\n modalId?: string\n /** Modal content. */\n children?: VNodeChild | (() => VNodeChild)\n /** Called when the modal closes. */\n onClose?: () => void\n}\n\nexport type ConfirmLabels = Record<'confirm' | 'cancel', VNodeChild>\n\nexport interface OpenConfirmModal extends ModalSettings, ConfirmModalProps, ConfirmModalCallbacks {}\n\nexport interface OpenContextModal<\n CustomProps extends Record<string, any> = Record<string, any>,\n> extends ModalSettings {\n /** Props passed to the registered context modal component. */\n innerProps: CustomProps\n}\n\nexport interface ContextModalProps<T extends Record<string, any> = Record<string, any>> {\n /** Modals manager context. */\n context: ModalsContextProps\n /** Props passed to `modals.openContextModal`. */\n innerProps: T\n /** Current modal id. */\n id: string\n}\n\nexport type ModalState =\n | { id: string; type: 'content'; props: ModalSettings }\n | { id: string; type: 'confirm'; props: OpenConfirmModal }\n | { id: string; type: 'context'; props: OpenContextModal; ctx: string }\n\nexport interface ModalsContextProps {\n /** Shared Modal component props applied to every modal. */\n modalProps: ModalSettings\n /** Currently opened modal stack. */\n modals: ModalState[]\n /** Opens a regular modal and returns its id. */\n openModal: (props: ModalSettings) => string\n /** Opens a confirm modal and returns its id. */\n openConfirmModal: (props: OpenConfirmModal) => string\n /** Opens a predefined context modal and returns its id. */\n openContextModal: (modal: string, props: OpenContextModal) => string\n /** Closes the modal with the given id. */\n closeModal: (id: string, canceled?: boolean) => void\n /** Closes the context modal with the given id. */\n closeContextModal: (id: string, canceled?: boolean) => void\n /** Closes all opened modals. */\n closeAll: () => void\n /** Dynamically updates the content and properties of a regular or confirm modal. */\n updateModal: (payload: { modalId: string } & Partial<OpenConfirmModal>) => void\n /** Dynamically updates the content and properties of a context modal. */\n updateContextModal: (payload: { modalId: string } & Partial<OpenContextModal<any>>) => void\n}\n\nexport const ModalsContextKey: InjectionKey<ModalsContextProps> = Symbol('ModalsContext')\n","import { inject } from 'vue'\nimport { ModalsContextKey, type ModalsContextProps } from './context'\n\nexport function useModals(): ModalsContextProps {\n const ctx = inject(ModalsContextKey, null)\n\n if (!ctx) {\n throw new Error(\n '[@mantine-vue/modals] useModals composable was called outside of context, wrap your app with the ModalsProvider component',\n )\n }\n\n return ctx\n}\n","<script setup lang=\"ts\">\nimport { computed, useSlots } from 'vue'\nimport { Box, Button, Group } from '@mantine-vue/core'\nimport { useModals } from '../../use-modals'\nimport type { ConfirmModalEmits, ConfirmModalProps } from './ConfirmModal.types'\n\ndefineOptions({ name: 'ConfirmModal', inheritAttrs: false })\nconst props = withDefaults(defineProps<ConfirmModalProps>(), {\n closeOnConfirm: true,\n closeOnCancel: true,\n labels: () => ({ cancel: '', confirm: '' }),\n})\nconst emit = defineEmits<ConfirmModalEmits>()\nconst slots = useSlots()\nconst ctx = useModals()\nconst hasChildren = computed(() => Boolean(slots.default))\nconst cancelButtonProps = computed(() => {\n const value = { ...props.cancelProps }\n delete value.onClick\n delete value.children\n return value\n})\nconst confirmButtonProps = computed(() => {\n const value = { ...props.confirmProps }\n delete value.onClick\n delete value.children\n return value\n})\nconst renderCancelLabel = () => props.cancelProps?.children ?? props.labels.cancel\nconst renderConfirmLabel = () => props.confirmProps?.children ?? props.labels.confirm\n\nfunction cancel(event: MouseEvent) {\n props.cancelProps?.onClick?.(event)\n emit('cancel')\n if (props.closeOnCancel) ctx.closeModal(props.id!)\n}\nfunction confirm(event: MouseEvent) {\n props.confirmProps?.onClick?.(event)\n emit('confirm')\n if (props.closeOnConfirm) ctx.closeModal(props.id!)\n}\n</script>\n\n<template>\n <Box v-if=\"hasChildren\" mb=\"md\"><slot /></Box>\n <Group v-bind=\"props.groupProps\" :mt=\"hasChildren ? 0 : 'md'\" justify=\"flex-end\">\n <Button v-bind=\"cancelButtonProps\" variant=\"default\" @click=\"cancel\">\n <component :is=\"renderCancelLabel\" />\n </Button>\n <Button v-bind=\"confirmButtonProps\" @click=\"confirm\">\n <component :is=\"renderConfirmLabel\" />\n </Button>\n </Group>\n</template>\n","<script setup lang=\"ts\">\nimport { computed, useSlots } from 'vue'\nimport { Box, Button, Group } from '@mantine-vue/core'\nimport { useModals } from '../../use-modals'\nimport type { ConfirmModalEmits, ConfirmModalProps } from './ConfirmModal.types'\n\ndefineOptions({ name: 'ConfirmModal', inheritAttrs: false })\nconst props = withDefaults(defineProps<ConfirmModalProps>(), {\n closeOnConfirm: true,\n closeOnCancel: true,\n labels: () => ({ cancel: '', confirm: '' }),\n})\nconst emit = defineEmits<ConfirmModalEmits>()\nconst slots = useSlots()\nconst ctx = useModals()\nconst hasChildren = computed(() => Boolean(slots.default))\nconst cancelButtonProps = computed(() => {\n const value = { ...props.cancelProps }\n delete value.onClick\n delete value.children\n return value\n})\nconst confirmButtonProps = computed(() => {\n const value = { ...props.confirmProps }\n delete value.onClick\n delete value.children\n return value\n})\nconst renderCancelLabel = () => props.cancelProps?.children ?? props.labels.cancel\nconst renderConfirmLabel = () => props.confirmProps?.children ?? props.labels.confirm\n\nfunction cancel(event: MouseEvent) {\n props.cancelProps?.onClick?.(event)\n emit('cancel')\n if (props.closeOnCancel) ctx.closeModal(props.id!)\n}\nfunction confirm(event: MouseEvent) {\n props.confirmProps?.onClick?.(event)\n emit('confirm')\n if (props.closeOnConfirm) ctx.closeModal(props.id!)\n}\n</script>\n\n<template>\n <Box v-if=\"hasChildren\" mb=\"md\"><slot /></Box>\n <Group v-bind=\"props.groupProps\" :mt=\"hasChildren ? 0 : 'md'\" justify=\"flex-end\">\n <Button v-bind=\"cancelButtonProps\" variant=\"default\" @click=\"cancel\">\n <component :is=\"renderCancelLabel\" />\n </Button>\n <Button v-bind=\"confirmButtonProps\" @click=\"confirm\">\n <component :is=\"renderConfirmLabel\" />\n </Button>\n </Group>\n</template>\n","import type { ModalSettings, ModalState } from './context'\n\nexport interface ModalsState {\n modals: ModalState[]\n current: ModalState | null\n}\n\nexport interface OpenAction {\n type: 'OPEN'\n modal: ModalState\n}\n\nexport interface CloseAction {\n type: 'CLOSE'\n modalId: string\n canceled?: boolean\n}\n\nexport interface CloseAllAction {\n type: 'CLOSE_ALL'\n canceled?: boolean\n}\n\nexport interface UpdateAction {\n type: 'UPDATE'\n modalId: string\n newProps: Partial<ModalSettings>\n}\n\nexport type ModalsAction = OpenAction | CloseAction | CloseAllAction | UpdateAction\n\nexport function handleCloseModal(modal: ModalState, canceled?: boolean) {\n if (canceled && modal.type === 'confirm') {\n modal.props.onCancel?.()\n }\n\n modal.props.onClose?.()\n}\n\nexport function modalsReducer(state: ModalsState, action: ModalsAction): ModalsState {\n switch (action.type) {\n case 'OPEN': {\n if (state.modals.some((modal) => modal.id === action.modal.id)) {\n return state\n }\n\n return {\n current: action.modal,\n modals: [...state.modals, action.modal],\n }\n }\n\n case 'CLOSE': {\n const modals = state.modals.filter((modal) => modal.id !== action.modalId)\n return {\n current: modals.length > 0 ? modals[modals.length - 1] : state.current,\n modals,\n }\n }\n\n case 'CLOSE_ALL': {\n return {\n current: state.current,\n modals: [],\n }\n }\n\n case 'UPDATE': {\n const modals = state.modals.map((modal) => {\n if (modal.id !== action.modalId) {\n return modal\n }\n\n if (modal.type === 'context') {\n return {\n ...modal,\n props: {\n ...modal.props,\n ...action.newProps,\n innerProps: {\n ...modal.props.innerProps,\n ...(action.newProps as any).innerProps,\n },\n },\n }\n }\n\n return { ...modal, props: { ...modal.props, ...action.newProps } } as ModalState\n })\n\n const current =\n state.current && state.current.id === action.modalId\n ? modals.find((modal) => modal.id === action.modalId) || state.current\n : state.current\n\n return { current, modals }\n }\n\n default:\n return state\n }\n}\n","import { type Ref } from 'vue'\nimport { createStore, type MantineStore } from '@mantine-vue/store'\nimport type { ModalSettings, OpenConfirmModal, OpenContextModal } from './context'\nimport { handleCloseModal, modalsReducer, type ModalsAction, type ModalsState } from './reducer'\n\nexport type ModalsStore = MantineStore<ModalsState>\n\nfunction randomId() {\n return `mantine-${Math.random().toString(36).slice(2, 11)}`\n}\n\nexport const createModalsStore = () => createStore<ModalsState>({ modals: [], current: null })\n\nexport const modalsStore = createModalsStore()\n\nexport const useModalsState = (store: ModalsStore = modalsStore): Readonly<Ref<ModalsState>> =>\n store.value\n\nconst closingMap = new WeakMap<ModalsStore, boolean>()\n\nfunction dispatch(action: ModalsAction, store: ModalsStore) {\n store.setState((state) => modalsReducer(state, action))\n}\n\nexport function openModalAction(props: ModalSettings, store: ModalsStore = modalsStore): string {\n const { modalId, ...rest } = props\n const id = modalId || randomId()\n dispatch({ type: 'OPEN', modal: { id, type: 'content', props: rest } }, store)\n return id\n}\n\nexport function openConfirmModalAction(\n props: OpenConfirmModal,\n store: ModalsStore = modalsStore,\n): string {\n const { modalId, ...rest } = props\n const id = modalId || randomId()\n dispatch({ type: 'OPEN', modal: { id, type: 'confirm', props: rest } }, store)\n return id\n}\n\nexport function openContextModalAction(\n modal: string,\n props: OpenContextModal,\n store: ModalsStore = modalsStore,\n): string {\n const { modalId, ...rest } = props\n const id = modalId || randomId()\n dispatch({ type: 'OPEN', modal: { id, type: 'context', props: rest, ctx: modal } }, store)\n return id\n}\n\nexport function closeModalAction(id: string, canceled?: boolean, store: ModalsStore = modalsStore) {\n if (!closingMap.get(store)) {\n const modal = store.getState().modals.find((item) => item.id === id)\n if (modal) {\n closingMap.set(store, true)\n handleCloseModal(modal, canceled)\n closingMap.set(store, false)\n }\n }\n\n dispatch({ type: 'CLOSE', modalId: id, canceled }, store)\n}\n\nexport function closeAllModalsAction(canceled?: boolean, store: ModalsStore = modalsStore) {\n if (!closingMap.get(store)) {\n closingMap.set(store, true)\n store\n .getState()\n .modals.slice()\n .reverse()\n .forEach((modal) => handleCloseModal(modal, canceled))\n closingMap.set(store, false)\n }\n\n dispatch({ type: 'CLOSE_ALL', canceled }, store)\n}\n\nexport function updateModalAction(\n payload: { modalId: string } & Partial<ModalSettings>,\n store: ModalsStore = modalsStore,\n) {\n const { modalId, ...newProps } = payload\n dispatch({ type: 'UPDATE', modalId, newProps }, store)\n}\n\nexport function updateContextModalAction(\n payload: { modalId: string } & Partial<OpenContextModal<any>>,\n store: ModalsStore = modalsStore,\n) {\n const { modalId, ...newProps } = payload\n dispatch({ type: 'UPDATE', modalId, newProps }, store)\n}\n\nfunction openContextModalPayload(\n payload: OpenContextModal & { modal: string },\n store: ModalsStore = modalsStore,\n): string {\n const { modal, ...rest } = payload\n return openContextModalAction(modal, rest, store)\n}\n\nexport const modals = {\n /** Opens a regular modal and returns its id. */\n open: (props: ModalSettings) => openModalAction(props),\n /** Closes the modal with the given id. */\n close: (id: string) => closeModalAction(id),\n /** Closes all opened modals. */\n closeAll: () => closeAllModalsAction(),\n /** Opens a confirm modal and returns its id. */\n openConfirmModal: (props: OpenConfirmModal) => openConfirmModalAction(props),\n /** Opens a predefined context modal and returns its id. */\n openContextModal: (payload: OpenContextModal & { modal: string }) =>\n openContextModalPayload(payload),\n /** Dynamically updates the content and properties of a regular or confirm modal. */\n updateModal: (payload: { modalId: string } & Partial<OpenConfirmModal>) =>\n updateModalAction(payload),\n /** Dynamically updates the content and properties of a context modal. */\n updateContextModal: (payload: { modalId: string } & Partial<OpenContextModal<any>>) =>\n updateContextModalAction(payload),\n} as const\n\nexport const openModal = modals.open\nexport const closeModal = modals.close\nexport const closeAllModals = modals.closeAll\nexport const openConfirmModal = modals.openConfirmModal\nexport const openContextModal = modals.openContextModal\nexport const updateModal = modals.updateModal\nexport const updateContextModal = modals.updateContextModal\n","<script setup lang=\"ts\">\nimport { computed, provide } from 'vue'\nimport { Modal, getDefaultZIndex } from '@mantine-vue/core'\nimport ConfirmModal from '../ConfirmModal/ConfirmModal.vue'\nimport {\n ModalsContextKey,\n type ModalsContextProps,\n type ModalSettings,\n type OpenConfirmModal,\n type OpenContextModal,\n} from '../../context'\nimport {\n closeAllModalsAction,\n closeModalAction,\n modalsStore,\n openConfirmModalAction,\n openContextModalAction,\n openModalAction,\n updateContextModalAction,\n updateModalAction,\n useModalsState,\n} from '../../modals.store'\nimport type { ModalsProviderProps } from './ModalsProvider.types'\n\ndefineOptions({ name: 'ModalsProvider' })\nconst props = defineProps<ModalsProviderProps>()\nconst state = useModalsState(modalsStore)\nconst openModal = (settings: ModalSettings) => openModalAction(settings, modalsStore)\nconst openConfirmModal = (settings: OpenConfirmModal) =>\n openConfirmModalAction(settings, modalsStore)\nconst openContextModal = (modal: string, settings: OpenContextModal) =>\n openContextModalAction(modal, settings, modalsStore)\nconst closeModal = (id: string, canceled?: boolean) => closeModalAction(id, canceled, modalsStore)\nconst closeAll = () => closeAllModalsAction(undefined, modalsStore)\nconst updateModal = (payload: { modalId: string } & Partial<OpenConfirmModal>) =>\n updateModalAction(payload, modalsStore)\nconst updateContextModal = (payload: { modalId: string } & Partial<OpenContextModal<any>>) =>\n updateContextModalAction(payload, modalsStore)\n\nconst context: ModalsContextProps = {\n get modalProps() {\n return props.modalProps || {}\n },\n get modals() {\n return state.value.modals\n },\n openModal,\n openConfirmModal,\n openContextModal,\n closeModal,\n closeContextModal: closeModal,\n closeAll,\n updateModal,\n updateContextModal,\n}\nprovide(ModalsContextKey, context)\n\nfunction separateConfirmModalProps(settings: OpenConfirmModal) {\n const value = { ...settings } as any\n const confirmModalProps = {\n id: value.id,\n onCancel: value.onCancel,\n onConfirm: value.onConfirm,\n closeOnConfirm: value.closeOnConfirm,\n closeOnCancel: value.closeOnCancel,\n cancelProps: value.cancelProps,\n confirmProps: value.confirmProps,\n groupProps: value.groupProps,\n labels: value.labels,\n }\n for (const key of [\n 'children',\n 'onCancel',\n 'onConfirm',\n 'closeOnConfirm',\n 'closeOnCancel',\n 'cancelProps',\n 'confirmProps',\n 'groupProps',\n 'labels',\n ])\n delete value[key]\n return { confirmModalProps, modalProps: value }\n}\n\nconst presentation = computed(() => {\n const current = state.value.current\n if (!current) return { modalProps: {}, component: null, componentProps: {} }\n if (current.type === 'context') {\n const { innerProps, ...modalProps } = current.props\n return {\n modalProps,\n component: props.modals?.[current.ctx] ?? null,\n componentProps: { innerProps, context, id: current.id },\n }\n }\n if (current.type === 'confirm') {\n const separated = separateConfirmModalProps(current.props)\n return {\n modalProps: separated.modalProps,\n component: ConfirmModal,\n componentProps: {\n ...separated.confirmModalProps,\n id: current.id,\n labels: current.props.labels || props.labels,\n },\n }\n }\n const modalProps = { ...current.props } as any\n delete modalProps.children\n return { modalProps, component: null, componentProps: {} }\n})\nconst modalAttrs = computed(() => {\n const value = {\n zIndex: getDefaultZIndex('modal') + 1,\n ...props.modalProps,\n ...presentation.value.modalProps,\n }\n delete value.opened\n delete value.onClose\n return value\n})\nconst renderContent = () => {\n const current = state.value.current\n if (!current || current.type !== 'content') return null\n const children = current.props.children\n return typeof children === 'function' ? children() : (children ?? null)\n}\n</script>\n\n<template>\n <Modal\n v-bind=\"modalAttrs\"\n :opened=\"state.modals.length > 0\"\n @close=\"closeModal(state.current?.id as string)\"\n >\n <component\n :is=\"presentation.component\"\n v-if=\"presentation.component\"\n v-bind=\"presentation.componentProps\"\n />\n <component :is=\"renderContent\" v-else />\n </Modal>\n <slot />\n</template>\n","<script setup lang=\"ts\">\nimport { computed, provide } from 'vue'\nimport { Modal, getDefaultZIndex } from '@mantine-vue/core'\nimport ConfirmModal from '../ConfirmModal/ConfirmModal.vue'\nimport {\n ModalsContextKey,\n type ModalsContextProps,\n type ModalSettings,\n type OpenConfirmModal,\n type OpenContextModal,\n} from '../../context'\nimport {\n closeAllModalsAction,\n closeModalAction,\n modalsStore,\n openConfirmModalAction,\n openContextModalAction,\n openModalAction,\n updateContextModalAction,\n updateModalAction,\n useModalsState,\n} from '../../modals.store'\nimport type { ModalsProviderProps } from './ModalsProvider.types'\n\ndefineOptions({ name: 'ModalsProvider' })\nconst props = defineProps<ModalsProviderProps>()\nconst state = useModalsState(modalsStore)\nconst openModal = (settings: ModalSettings) => openModalAction(settings, modalsStore)\nconst openConfirmModal = (settings: OpenConfirmModal) =>\n openConfirmModalAction(settings, modalsStore)\nconst openContextModal = (modal: string, settings: OpenContextModal) =>\n openContextModalAction(modal, settings, modalsStore)\nconst closeModal = (id: string, canceled?: boolean) => closeModalAction(id, canceled, modalsStore)\nconst closeAll = () => closeAllModalsAction(undefined, modalsStore)\nconst updateModal = (payload: { modalId: string } & Partial<OpenConfirmModal>) =>\n updateModalAction(payload, modalsStore)\nconst updateContextModal = (payload: { modalId: string } & Partial<OpenContextModal<any>>) =>\n updateContextModalAction(payload, modalsStore)\n\nconst context: ModalsContextProps = {\n get modalProps() {\n return props.modalProps || {}\n },\n get modals() {\n return state.value.modals\n },\n openModal,\n openConfirmModal,\n openContextModal,\n closeModal,\n closeContextModal: closeModal,\n closeAll,\n updateModal,\n updateContextModal,\n}\nprovide(ModalsContextKey, context)\n\nfunction separateConfirmModalProps(settings: OpenConfirmModal) {\n const value = { ...settings } as any\n const confirmModalProps = {\n id: value.id,\n onCancel: value.onCancel,\n onConfirm: value.onConfirm,\n closeOnConfirm: value.closeOnConfirm,\n closeOnCancel: value.closeOnCancel,\n cancelProps: value.cancelProps,\n confirmProps: value.confirmProps,\n groupProps: value.groupProps,\n labels: value.labels,\n }\n for (const key of [\n 'children',\n 'onCancel',\n 'onConfirm',\n 'closeOnConfirm',\n 'closeOnCancel',\n 'cancelProps',\n 'confirmProps',\n 'groupProps',\n 'labels',\n ])\n delete value[key]\n return { confirmModalProps, modalProps: value }\n}\n\nconst presentation = computed(() => {\n const current = state.value.current\n if (!current) return { modalProps: {}, component: null, componentProps: {} }\n if (current.type === 'context') {\n const { innerProps, ...modalProps } = current.props\n return {\n modalProps,\n component: props.modals?.[current.ctx] ?? null,\n componentProps: { innerProps, context, id: current.id },\n }\n }\n if (current.type === 'confirm') {\n const separated = separateConfirmModalProps(current.props)\n return {\n modalProps: separated.modalProps,\n component: ConfirmModal,\n componentProps: {\n ...separated.confirmModalProps,\n id: current.id,\n labels: current.props.labels || props.labels,\n },\n }\n }\n const modalProps = { ...current.props } as any\n delete modalProps.children\n return { modalProps, component: null, componentProps: {} }\n})\nconst modalAttrs = computed(() => {\n const value = {\n zIndex: getDefaultZIndex('modal') + 1,\n ...props.modalProps,\n ...presentation.value.modalProps,\n }\n delete value.opened\n delete value.onClose\n return value\n})\nconst renderContent = () => {\n const current = state.value.current\n if (!current || current.type !== 'content') return null\n const children = current.props.children\n return typeof children === 'function' ? children() : (children ?? null)\n}\n</script>\n\n<template>\n <Modal\n v-bind=\"modalAttrs\"\n :opened=\"state.modals.length > 0\"\n @close=\"closeModal(state.current?.id as string)\"\n >\n <component\n :is=\"presentation.component\"\n v-if=\"presentation.component\"\n v-bind=\"presentation.componentProps\"\n />\n <component :is=\"renderContent\" v-else />\n </Modal>\n <slot />\n</template>\n"],"mappings":";;;;;AA6DA,IAAa,mBAAqD,OAAO,eAAe;;;AC1DxF,SAAgB,YAAgC;CAC9C,MAAM,OAAA,GAAA,IAAA,QAAa,kBAAkB,IAAI;CAEzC,IAAI,CAAC,KACH,MAAM,IAAI,MACR,2HACF;CAGF,OAAO;AACT;;;;;;;;;;;;;;;;;;;;;;;;;;;ECNA,MAAM,QAAQ;EAKd,MAAM,OAA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