@bridge-ui/vue 0.23.0 → 0.24.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/ai/skills/bridge-ui-overlays/SKILL.md +4 -2
- package/dist/Components/ColorField/composables/useColorField.js +1 -1
- package/dist/Components/DateField/composables/useDateField.js +1 -1
- package/dist/Components/DateRangeField/composables/useDateRangeField.js +1 -1
- package/dist/Components/DateTimeField/composables/useDateTimeField.js +1 -1
- package/dist/Components/DateTimeRangeField/composables/useDateTimeRangeField.js +1 -1
- package/dist/Components/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -0
- package/dist/Components/Drawer/composables/useDrawer.js +96 -90
- package/dist/Components/Menu/composables/useMenu.d.ts +8 -8
- package/dist/Components/Menu/composables/useMenu.js +81 -195
- package/dist/Components/Modal/Modal.vue_vue_type_script_setup_true_lang.js +7 -7
- package/dist/Components/Modal/composables/useModal.d.ts +1 -0
- package/dist/Components/Modal/composables/useModal.js +120 -114
- package/dist/Components/Popover/Popover.js +4 -0
- package/dist/Components/Popover/Popover.vue.d.ts +39 -0
- package/dist/Components/Popover/Popover.vue_vue_type_script_setup_true_lang.js +100 -0
- package/dist/Components/Popover/composables/popoverParts.d.ts +52 -0
- package/dist/Components/Popover/composables/popoverParts.js +35 -0
- package/dist/Components/Popover/composables/usePopover.d.ts +68 -0
- package/dist/Components/Popover/composables/usePopover.js +119 -0
- package/dist/Components/Popover/composables/usePopoverBase.d.ts +130 -0
- package/dist/Components/Popover/composables/usePopoverBase.js +210 -0
- package/dist/Components/Popover/index.d.ts +4 -0
- package/dist/Components/Popover/index.js +3 -0
- package/dist/Components/Popover/popover.types.d.ts +207 -0
- package/dist/Components/Resizable/composables/useResizable.js +85 -85
- package/dist/Components/Snackbar/Snackbar.vue.d.ts +1 -1
- package/dist/Components/TimeField/composables/useTimeField.js +1 -1
- package/dist/Components/TimeRangeField/composables/useTimeRangeField.js +1 -1
- package/dist/augments.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +78 -76
- package/docs/README.md +1 -0
- package/docs/components/Menu.md +4 -0
- package/docs/components/Popover.md +210 -0
- package/package.json +2 -2
|
@@ -1,12 +1,14 @@
|
|
|
1
|
-
import { mergePartBind as e,
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
1
|
+
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { createPopoverSetShow as r, getPopoverPanelTokenClass as i, getPopoverRootBind as a, getPopoverTriggerBind as o } from "../../Popover/composables/popoverParts.js";
|
|
3
|
+
import { usePopoverBase as s } from "../../Popover/composables/usePopoverBase.js";
|
|
4
|
+
import { computed as c, toValue as l, useAttrs as u, useId as d } from "vue";
|
|
5
|
+
import { get as f, omit as p } from "es-toolkit/compat";
|
|
6
|
+
import { menuRoundedProps as m, menuShadowProps as h } from "@bridge-ui/core/Tokens";
|
|
7
|
+
import { cn as g, splitComponentProps as _ } from "@bridge-ui/core/Utils";
|
|
8
|
+
import { createFocusable as v } from "@bridge-ui/core/Runtime";
|
|
9
|
+
import { claimOpenMenu as y, isMenuClickAwayIgnored as b } from "@bridge-ui/core/Layer";
|
|
8
10
|
// src/Components/Menu/composables/useMenu.ts
|
|
9
|
-
var
|
|
11
|
+
var x = [
|
|
10
12
|
"offset",
|
|
11
13
|
"shadow",
|
|
12
14
|
"classes",
|
|
@@ -23,204 +25,88 @@ var ue = [
|
|
|
23
25
|
"disableAutoFocus",
|
|
24
26
|
"disableScrollLock"
|
|
25
27
|
];
|
|
26
|
-
function
|
|
27
|
-
let
|
|
28
|
-
|
|
29
|
-
e || v.onClose?.(), v.show && (v.show.value = e), v.onShowChange?.(e);
|
|
30
|
-
}
|
|
31
|
-
let F = i(() => m({
|
|
32
|
-
bridgeKeys: ue,
|
|
28
|
+
function S(S, C, w = {}) {
|
|
29
|
+
let T = d(), E = u(), D = c(() => l(w.show ?? !1)), O = r(w), k = c(() => _({
|
|
30
|
+
bridgeKeys: x,
|
|
33
31
|
props: {
|
|
34
|
-
...
|
|
35
|
-
...
|
|
32
|
+
...E,
|
|
33
|
+
...S
|
|
36
34
|
}
|
|
37
|
-
})), { merged:
|
|
38
|
-
libDefaults:
|
|
35
|
+
})), { merged: A, entry: j } = t({
|
|
36
|
+
libDefaults: C,
|
|
39
37
|
componentName: "Menu",
|
|
40
|
-
props: () =>
|
|
41
|
-
}),
|
|
42
|
-
entry:
|
|
43
|
-
props: () =>
|
|
44
|
-
}),
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
function q() {
|
|
64
|
-
H.value && N.value && P(!1);
|
|
65
|
-
}
|
|
66
|
-
function he() {
|
|
67
|
-
I.value.persistent && N.value || P(!N.value);
|
|
68
|
-
}
|
|
69
|
-
function ge(e) {
|
|
70
|
-
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), N.value || P(!0));
|
|
71
|
-
}
|
|
72
|
-
function _e(e) {
|
|
73
|
-
let t = w.value;
|
|
74
|
-
if (!t) return;
|
|
75
|
-
let n = h(t);
|
|
38
|
+
props: () => k.value.componentProps
|
|
39
|
+
}), M = c(() => A.value.customProps), N = n({
|
|
40
|
+
entry: j,
|
|
41
|
+
props: () => k.value.componentProps
|
|
42
|
+
}), P = c(() => A.value.teleportTo !== !1), F = c(() => i(m, j.value?.tokens?.rounded, A.value.rounded)), I = c(() => i(h, j.value?.tokens?.shadow, A.value.shadow)), L = c(() => p(k.value.inheritedAttrs, ["anchorEl", "onShowChange"])), R = s({
|
|
43
|
+
show: D,
|
|
44
|
+
setShow: O,
|
|
45
|
+
id: T,
|
|
46
|
+
config: A,
|
|
47
|
+
claimOpen: y,
|
|
48
|
+
anchorEl: () => S.anchorEl,
|
|
49
|
+
isClickAwayIgnored: b
|
|
50
|
+
});
|
|
51
|
+
function z(e) {
|
|
52
|
+
(e.key === "ArrowDown" || e.key === "Enter" || e.key === " ") && (e.preventDefault(), D.value || O(!0));
|
|
53
|
+
}
|
|
54
|
+
function B(e) {
|
|
55
|
+
let t = R.contentRef.value;
|
|
56
|
+
if (!t || e.defaultPrevented) return;
|
|
57
|
+
let n = e.target;
|
|
58
|
+
if (!t.contains(n) || R.isInsideNestedLayer(n)) return;
|
|
59
|
+
let r = v(t);
|
|
76
60
|
switch (e.key) {
|
|
77
|
-
case "Escape":
|
|
78
|
-
e.preventDefault(), q(), G();
|
|
79
|
-
break;
|
|
80
61
|
case "ArrowDown":
|
|
81
|
-
e.preventDefault(),
|
|
62
|
+
e.preventDefault(), r.next()?.focus({ preventScroll: !0 });
|
|
82
63
|
break;
|
|
83
64
|
case "ArrowUp":
|
|
84
|
-
e.preventDefault(),
|
|
65
|
+
e.preventDefault(), r.previous()?.focus({ preventScroll: !0 });
|
|
85
66
|
break;
|
|
86
67
|
case "Home":
|
|
87
|
-
e.preventDefault(),
|
|
68
|
+
e.preventDefault(), r.focusFirst();
|
|
88
69
|
break;
|
|
89
|
-
case "End": e.preventDefault(),
|
|
70
|
+
case "End": e.preventDefault(), r.focusLast();
|
|
90
71
|
}
|
|
91
72
|
}
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
}
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
let n = t(e);
|
|
130
|
-
C.value !== n && (C.value = n, n && a(() => {
|
|
131
|
-
Y();
|
|
132
|
-
}));
|
|
133
|
-
}
|
|
134
|
-
function Z() {
|
|
135
|
-
E?.setContainer(w.value);
|
|
136
|
-
}
|
|
137
|
-
function be(e) {
|
|
138
|
-
let n = t(e);
|
|
139
|
-
w.value !== n && (w.value = n, Z(), n && a(() => {
|
|
140
|
-
Y(), X();
|
|
141
|
-
}));
|
|
142
|
-
}
|
|
143
|
-
function xe() {
|
|
144
|
-
N.value && I.value.closeOnEscape !== !1 && H.value && (q(), G());
|
|
145
|
-
}
|
|
146
|
-
function Q() {
|
|
147
|
-
let e = se(S.value);
|
|
148
|
-
e && (M.value = e.zIndex);
|
|
149
|
-
}
|
|
150
|
-
function $() {
|
|
151
|
-
A?.(), A = null, k?.(), k = null, D?.(), D = null, E?.release(), E = null, T = null, S.value = "", M.value = g, J();
|
|
152
|
-
}
|
|
153
|
-
let Se = i(() => e(R.value?.root, U.value, f({
|
|
154
|
-
"relative inline-flex": !0,
|
|
155
|
-
[u(z.value, "root") ?? ""]: !0
|
|
156
|
-
}))), Ce = i(() => e(R.value?.trigger, {}, {
|
|
157
|
-
tabindex: 0,
|
|
158
|
-
role: "button",
|
|
159
|
-
"aria-expanded": N.value,
|
|
160
|
-
onKeydown: ge,
|
|
161
|
-
"aria-haspopup": "menu",
|
|
162
|
-
onClickCapture: he,
|
|
163
|
-
"aria-controls": N.value ? b : void 0,
|
|
164
|
-
class: f({
|
|
165
|
-
"inline-flex w-fit max-w-full cursor-pointer outline-hidden": !0,
|
|
166
|
-
[u(z.value, "trigger") ?? ""]: !0
|
|
167
|
-
})
|
|
168
|
-
})), we = i(() => e(R.value?.content, {}, {
|
|
169
|
-
id: b,
|
|
170
|
-
role: "menu",
|
|
171
|
-
onKeydown: _e,
|
|
172
|
-
style: { zIndex: M.value },
|
|
173
|
-
"aria-hidden": B.value ? !0 : void 0,
|
|
174
|
-
class: f({
|
|
175
|
-
"bg-white text-dark-900 dark:bg-dark-800 dark:text-dark-100 ring-1 ring-black/5 dark:ring-white/10 outline-hidden overflow-hidden max-w-[calc(100vw-16px)]": !0,
|
|
176
|
-
"min-w-0 w-full": I.value.matchWidth === !0,
|
|
177
|
-
"min-w-32 w-max": I.value.matchWidth !== !0,
|
|
178
|
-
"invisible pointer-events-none": B.value,
|
|
179
|
-
[fe.value ?? ""]: !0,
|
|
180
|
-
[pe.value ?? ""]: !0,
|
|
181
|
-
[u(z.value, "content") ?? ""]: !0
|
|
182
|
-
})
|
|
183
|
-
}));
|
|
184
|
-
return l(N, (e) => {
|
|
185
|
-
e ? (x.value = !0, a(() => {
|
|
186
|
-
N.value && (A = oe({
|
|
187
|
-
id: b,
|
|
188
|
-
requestClose: q
|
|
189
|
-
}));
|
|
190
|
-
}), T = ae(), E = ce({
|
|
191
|
-
order: T,
|
|
192
|
-
onEscape: xe,
|
|
193
|
-
container: w.value ?? void 0,
|
|
194
|
-
lockScroll: I.value.disableScrollLock !== !0
|
|
195
|
-
}), S.value = E.id, M.value = E.zIndex, Q(), D = le(Q), a(() => {
|
|
196
|
-
Z(), Y(), X(), ve();
|
|
197
|
-
})) : ($(), I.value.keepMounted || (x.value = !1));
|
|
198
|
-
}, { immediate: !0 }), l([
|
|
199
|
-
N,
|
|
200
|
-
() => _.anchorEl,
|
|
201
|
-
() => I.value.offset,
|
|
202
|
-
() => I.value.strategy,
|
|
203
|
-
() => I.value.placement
|
|
204
|
-
], () => {
|
|
205
|
-
a(() => {
|
|
206
|
-
Y();
|
|
207
|
-
});
|
|
208
|
-
}), l([N, () => I.value.disableAutoFocus], () => {
|
|
209
|
-
a(() => {
|
|
210
|
-
X();
|
|
211
|
-
});
|
|
212
|
-
}), ee(() => {
|
|
213
|
-
$();
|
|
214
|
-
}), {
|
|
215
|
-
merged: I,
|
|
216
|
-
menuId: b,
|
|
217
|
-
mounted: x,
|
|
218
|
-
rootBind: Se,
|
|
219
|
-
isPortaled: V,
|
|
220
|
-
triggerBind: Ce,
|
|
221
|
-
contentBind: we,
|
|
222
|
-
setTriggerRef: ye,
|
|
223
|
-
setContentRef: be
|
|
73
|
+
return {
|
|
74
|
+
merged: A,
|
|
75
|
+
menuId: T,
|
|
76
|
+
rootBind: c(() => a({
|
|
77
|
+
classes: N.value,
|
|
78
|
+
customProps: M.value?.root,
|
|
79
|
+
inheritedAttrs: L.value
|
|
80
|
+
})),
|
|
81
|
+
isPortaled: P,
|
|
82
|
+
triggerBind: c(() => o({
|
|
83
|
+
show: D.value,
|
|
84
|
+
hasPopup: "menu",
|
|
85
|
+
controlsId: T,
|
|
86
|
+
toggle: R.toggle,
|
|
87
|
+
classes: N.value,
|
|
88
|
+
onKeydown: z,
|
|
89
|
+
customProps: M.value?.trigger
|
|
90
|
+
})),
|
|
91
|
+
contentBind: c(() => e(M.value?.content, {}, {
|
|
92
|
+
id: T,
|
|
93
|
+
role: "menu",
|
|
94
|
+
onKeydown: B,
|
|
95
|
+
style: { zIndex: R.stackZIndex.value },
|
|
96
|
+
"aria-hidden": R.isHiddenWhileMounted.value ? !0 : void 0,
|
|
97
|
+
class: g({
|
|
98
|
+
"bg-white text-dark-900 dark:bg-dark-800 dark:text-dark-100 ring-1 ring-black/5 dark:ring-white/10 outline-hidden overflow-hidden max-w-[calc(100vw-16px)]": !0,
|
|
99
|
+
"min-w-0 w-full": A.value.matchWidth === !0,
|
|
100
|
+
"min-w-32 w-max": A.value.matchWidth !== !0,
|
|
101
|
+
"invisible pointer-events-none": R.isHiddenWhileMounted.value,
|
|
102
|
+
[F.value ?? ""]: !0,
|
|
103
|
+
[I.value ?? ""]: !0,
|
|
104
|
+
[f(N.value, "content") ?? ""]: !0
|
|
105
|
+
})
|
|
106
|
+
})),
|
|
107
|
+
mounted: R.mounted,
|
|
108
|
+
setTriggerRef: R.setTriggerRef,
|
|
109
|
+
setContentRef: R.setContentRef
|
|
224
110
|
};
|
|
225
111
|
}
|
|
226
|
-
export {
|
|
112
|
+
export { S as useMenu };
|
|
@@ -62,7 +62,7 @@ var g = /*@__PURE__*/ s({
|
|
|
62
62
|
}),
|
|
63
63
|
emits: /*@__PURE__*/ l(["close", "show-change"], ["update:modelValue"]),
|
|
64
64
|
setup(s, { expose: l, emit: g }) {
|
|
65
|
-
let _ = g, v = s, y = h(s, "modelValue"), { merged: b, mounted: x, rootBind: S, panelBind: C,
|
|
65
|
+
let _ = g, v = s, y = h(s, "modelValue"), { merged: b, mounted: x, rootBind: S, panelBind: C, setRootRef: w, overlayBind: T, wrapperBind: E, setPanelRef: D, layerStackId: O } = e(v, {
|
|
66
66
|
size: "md",
|
|
67
67
|
blur: "none",
|
|
68
68
|
scroll: "body",
|
|
@@ -78,16 +78,16 @@ var g = /*@__PURE__*/ s({
|
|
|
78
78
|
onClose: () => _("close"),
|
|
79
79
|
onShowChange: (e) => _("show-change", e)
|
|
80
80
|
});
|
|
81
|
-
l({ stackId: n(() => v.stackId ??
|
|
82
|
-
let
|
|
81
|
+
l({ stackId: n(() => v.stackId ?? O.value) });
|
|
82
|
+
let k = n(() => b.value.teleportTo === !1), A = n(() => b.value.teleportTo === !1 ? "body" : b.value.teleportTo), j = n(() => v.hideBackdrop !== !0 && b.value.hideBackdrop !== !0);
|
|
83
83
|
return (e, n) => m(x) ? (f(), r(t, {
|
|
84
84
|
key: 0,
|
|
85
|
-
to:
|
|
86
|
-
disabled:
|
|
87
|
-
}, [o("div",
|
|
85
|
+
to: A.value,
|
|
86
|
+
disabled: k.value
|
|
87
|
+
}, [o("div", u({ ref: m(w) }, m(S)), [j.value ? (f(), a("div", u({
|
|
88
88
|
key: 0,
|
|
89
89
|
"aria-hidden": "true"
|
|
90
|
-
}, m(
|
|
90
|
+
}, m(T)), null, 16)) : i("", !0), o("div", d(c(m(E))), [o("div", u({ ref: m(D) }, m(C)), [p(e.$slots, "default")], 16)], 16)], 16)], 8, ["to", "disabled"])) : i("", !0);
|
|
91
91
|
}
|
|
92
92
|
});
|
|
93
93
|
export { g as default };
|
|
@@ -43,6 +43,7 @@ export declare function useModal(props: ModalOwnProps, libDefaults: ModalLibDefa
|
|
|
43
43
|
role: string;
|
|
44
44
|
"aria-modal": boolean;
|
|
45
45
|
}>>;
|
|
46
|
+
setRootRef: (element: null | Element | ComponentPublicInstance) => void;
|
|
46
47
|
overlayBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
47
48
|
"data-modal-part": string;
|
|
48
49
|
"data-state": "open" | "closed";
|
|
@@ -1,12 +1,12 @@
|
|
|
1
|
-
import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as ee, useBridgeUIMergedRegistryClasses as
|
|
2
|
-
import { computed as
|
|
1
|
+
import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as ee, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
|
+
import { computed as r, nextTick as te, onBeforeUnmount as ne, ref as i, toValue as re, useAttrs as ie, watch as a } from "vue";
|
|
3
3
|
import { get as o } from "es-toolkit/compat";
|
|
4
|
-
import { modalAlignProps as ae, modalBlurProps as oe, modalSizeProps as
|
|
5
|
-
import { cn as
|
|
6
|
-
import { createFocusTrap as
|
|
7
|
-
import { LAYER_STACK_BASE_Z_INDEX as
|
|
4
|
+
import { modalAlignProps as ae, modalBlurProps as oe, modalSizeProps as se } from "@bridge-ui/core/Tokens";
|
|
5
|
+
import { cn as s, mergeBridgeUILayeredClasses as c, splitComponentProps as ce } from "@bridge-ui/core/Utils";
|
|
6
|
+
import { createFocusTrap as l, isModalBackdropClick as u, requestAfterNextPaint as le } from "@bridge-ui/core/Runtime";
|
|
7
|
+
import { LAYER_STACK_BASE_Z_INDEX as d, MODAL_LEAVE_FALLBACK_MS as ue, acquireLayerStackOrder as de, countModalTransitionLayers as fe, getLayerFocusTrapGuards as pe, getLayerStackEntry as me, getModalOverlayTransitionClass as he, getModalPanelTransitionClass as ge, hasModalTransition as _e, pushLayerStack as ve, resolveEffectiveModalTransition as ye, subscribeLayerStack as be } from "@bridge-ui/core/Layer";
|
|
8
8
|
// src/Components/Modal/composables/useModal.ts
|
|
9
|
-
var
|
|
9
|
+
var xe = [
|
|
10
10
|
"blur",
|
|
11
11
|
"size",
|
|
12
12
|
"align",
|
|
@@ -26,161 +26,167 @@ var ye = [
|
|
|
26
26
|
"disableEnforceFocus",
|
|
27
27
|
"disableRestoreFocus"
|
|
28
28
|
];
|
|
29
|
-
function
|
|
30
|
-
let
|
|
31
|
-
function
|
|
32
|
-
e ||
|
|
29
|
+
function f(f, p, m = {}) {
|
|
30
|
+
let h = ie(), g = i(!1), _ = i(!1), v = i(""), y = i(d), b = i("closed"), x = i(null), S = i(null), C = !1, w = 0, T = null, E = null, D = null, O = null, k = null, A = null, j = r(() => re(m.show ?? !1));
|
|
31
|
+
function M(e) {
|
|
32
|
+
e || m.onClose?.(), m.show && (m.show.value = e), m.onShowChange?.(e);
|
|
33
33
|
}
|
|
34
|
-
let
|
|
35
|
-
bridgeKeys:
|
|
34
|
+
let N = r(() => ce({
|
|
35
|
+
bridgeKeys: xe,
|
|
36
36
|
props: {
|
|
37
|
-
...
|
|
38
|
-
...
|
|
37
|
+
...h,
|
|
38
|
+
...f
|
|
39
39
|
}
|
|
40
|
-
})), { merged:
|
|
41
|
-
libDefaults:
|
|
40
|
+
})), { merged: P, entry: F } = ee({
|
|
41
|
+
libDefaults: p,
|
|
42
42
|
componentName: "Modal",
|
|
43
|
-
props: () =>
|
|
44
|
-
}),
|
|
45
|
-
entry:
|
|
46
|
-
props: () =>
|
|
47
|
-
}),
|
|
48
|
-
let e =
|
|
49
|
-
return o(e,
|
|
50
|
-
}),
|
|
51
|
-
let e =
|
|
52
|
-
return o(e,
|
|
53
|
-
}),
|
|
54
|
-
let e =
|
|
55
|
-
return o(e,
|
|
56
|
-
}),
|
|
57
|
-
onTransitionend:
|
|
58
|
-
style: { zIndex:
|
|
59
|
-
"aria-hidden":
|
|
60
|
-
class:
|
|
43
|
+
props: () => N.value.componentProps
|
|
44
|
+
}), I = r(() => P.value.customProps), L = n({
|
|
45
|
+
entry: F,
|
|
46
|
+
props: () => N.value.componentProps
|
|
47
|
+
}), R = r(() => ye(P.value.transition ?? "none")), z = r(() => _e(R.value)), B = r(() => P.value.scroll ?? "body"), V = r(() => P.value.keepMounted && !g.value), Se = r(() => {
|
|
48
|
+
let e = c(ae, F.value?.tokens?.align);
|
|
49
|
+
return o(e, P.value.align);
|
|
50
|
+
}), Ce = r(() => {
|
|
51
|
+
let e = c(oe, F.value?.tokens?.blur);
|
|
52
|
+
return o(e, P.value.blur);
|
|
53
|
+
}), we = r(() => {
|
|
54
|
+
let e = c(se, F.value?.tokens?.size);
|
|
55
|
+
return o(e, P.value.size);
|
|
56
|
+
}), Te = r(() => he(R.value)), Ee = r(() => ge(R.value)), H = r(() => !P.value.persistent), De = r(() => N.value.inheritedAttrs), Oe = r(() => e(I.value?.root, De.value, {
|
|
57
|
+
onTransitionend: Pe,
|
|
58
|
+
style: { zIndex: y.value },
|
|
59
|
+
"aria-hidden": V.value ? !0 : void 0,
|
|
60
|
+
class: s({
|
|
61
61
|
"fixed inset-0": !0,
|
|
62
|
-
"overflow-y-auto":
|
|
63
|
-
"overflow-hidden":
|
|
64
|
-
"invisible pointer-events-none":
|
|
65
|
-
[o(
|
|
62
|
+
"overflow-y-auto": B.value === "body",
|
|
63
|
+
"overflow-hidden": B.value === "paper",
|
|
64
|
+
"invisible pointer-events-none": V.value,
|
|
65
|
+
[o(L.value, "root") ?? ""]: !0
|
|
66
66
|
})
|
|
67
|
-
})),
|
|
67
|
+
})), ke = r(() => e(I.value?.overlay, { onClick: Z }, {
|
|
68
68
|
"data-modal-part": "overlay",
|
|
69
|
-
"data-state":
|
|
70
|
-
class:
|
|
69
|
+
"data-state": b.value,
|
|
70
|
+
class: s({
|
|
71
71
|
"fixed inset-0 bg-black/50": !0,
|
|
72
|
-
[
|
|
73
|
-
[
|
|
74
|
-
[o(
|
|
72
|
+
[Ce.value ?? ""]: !0,
|
|
73
|
+
[Te.value]: z.value,
|
|
74
|
+
[o(L.value, "overlay") ?? ""]: !0
|
|
75
75
|
})
|
|
76
|
-
})),
|
|
76
|
+
})), Ae = r(() => e(I.value?.wrapper, { onClick: Q }, s({
|
|
77
77
|
"flex min-h-full w-full transform p-4": !0,
|
|
78
|
-
[
|
|
79
|
-
[o(
|
|
80
|
-
}))),
|
|
78
|
+
[Se.value ?? ""]: !0,
|
|
79
|
+
[o(L.value, "wrapper") ?? ""]: !0
|
|
80
|
+
}))), je = r(() => e(I.value?.panel, {
|
|
81
81
|
role: "dialog",
|
|
82
82
|
"aria-modal": !0
|
|
83
83
|
}, {
|
|
84
84
|
"data-modal-part": "panel",
|
|
85
|
-
"data-state":
|
|
86
|
-
class:
|
|
85
|
+
"data-state": b.value,
|
|
86
|
+
class: s({
|
|
87
87
|
"relative w-full": !0,
|
|
88
|
-
[
|
|
89
|
-
"max-h-[calc(100dvh-2rem)] overflow-y-auto bridge-scroll-fade-y bridge-hide-scrollbar":
|
|
90
|
-
[
|
|
91
|
-
[o(
|
|
88
|
+
[we.value ?? ""]: !0,
|
|
89
|
+
"max-h-[calc(100dvh-2rem)] overflow-y-auto bridge-scroll-fade-y bridge-hide-scrollbar": B.value === "paper",
|
|
90
|
+
[Ee.value]: z.value,
|
|
91
|
+
[o(L.value, "panel") ?? ""]: !0
|
|
92
92
|
})
|
|
93
93
|
}));
|
|
94
|
+
function U() {
|
|
95
|
+
E?.release(), E = null;
|
|
96
|
+
}
|
|
94
97
|
function W() {
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
disableEnforceFocus: F.value.disableEnforceFocus,
|
|
102
|
-
disableRestoreFocus: F.value.disableRestoreFocus,
|
|
103
|
-
...fe(() => x.value)
|
|
98
|
+
!g.value || b.value !== "open" || !S.value ? U() : (D?.setContainer(x.value), U(), E = l({
|
|
99
|
+
container: S.value,
|
|
100
|
+
disableAutoFocus: !P.value.autoFocus,
|
|
101
|
+
disableEnforceFocus: P.value.disableEnforceFocus,
|
|
102
|
+
disableRestoreFocus: P.value.disableRestoreFocus,
|
|
103
|
+
...pe(() => v.value)
|
|
104
104
|
}));
|
|
105
105
|
}
|
|
106
|
-
function
|
|
107
|
-
|
|
106
|
+
function Me(e) {
|
|
107
|
+
x.value = t(e), D?.setContainer(x.value);
|
|
108
|
+
}
|
|
109
|
+
function G(e) {
|
|
110
|
+
S.value = t(e), W();
|
|
108
111
|
}
|
|
109
112
|
function K() {
|
|
110
|
-
|
|
113
|
+
A !== null && (clearTimeout(A), A = null);
|
|
111
114
|
}
|
|
112
115
|
function q() {
|
|
113
|
-
|
|
116
|
+
O?.(), O = null;
|
|
114
117
|
}
|
|
115
118
|
function J() {
|
|
116
|
-
|
|
119
|
+
C && (C = !1, K(), w = 0, g.value = !1, U(), j.value ? M(!1) : m.onShowChange?.(!1), b.value = "closed", P.value.keepMounted || (_.value = !1));
|
|
117
120
|
}
|
|
118
121
|
function Y() {
|
|
119
|
-
q(),
|
|
120
|
-
|
|
121
|
-
},
|
|
122
|
+
q(), D?.releaseScrollLock(), C = !0, z.value ? (b.value = "closed", w = fe(R.value, { hideBackdrop: P.value.hideBackdrop }), w === 0 ? J() : (K(), A = setTimeout(() => {
|
|
123
|
+
A = null, w > 0 && J();
|
|
124
|
+
}, ue))) : J();
|
|
122
125
|
}
|
|
123
|
-
function
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
})) :
|
|
126
|
+
function Ne() {
|
|
127
|
+
D?.restoreScrollLock(), C = !1, K(), w = 0, z.value ? (b.value = "closed", q(), O = le(() => {
|
|
128
|
+
b.value = "open";
|
|
129
|
+
})) : b.value = "open";
|
|
127
130
|
}
|
|
128
|
-
function
|
|
129
|
-
if (!
|
|
131
|
+
function Pe(e) {
|
|
132
|
+
if (!C || !_.value || b.value !== "closed") return;
|
|
130
133
|
let t = e.target;
|
|
131
|
-
(t?.dataset.modalPart === "overlay" || t?.dataset.modalPart === "panel") && e.propertyName !== "none" && e.elapsedTime !== 0 && (--
|
|
134
|
+
(t?.dataset.modalPart === "overlay" || t?.dataset.modalPart === "panel") && e.propertyName !== "none" && e.elapsedTime !== 0 && (--w, w <= 0 && J());
|
|
132
135
|
}
|
|
133
136
|
function X() {
|
|
134
|
-
|
|
137
|
+
H.value && (z.value ? _.value && Y() : M(!1));
|
|
135
138
|
}
|
|
136
139
|
function Z() {
|
|
137
|
-
|
|
140
|
+
P.value.closeOnOverlay !== !1 && H.value && X();
|
|
138
141
|
}
|
|
139
142
|
function Q(e) {
|
|
140
|
-
|
|
143
|
+
u(e) && Z();
|
|
141
144
|
}
|
|
142
|
-
function
|
|
143
|
-
|
|
145
|
+
function Fe() {
|
|
146
|
+
j.value && P.value.closeOnEscape !== !1 && H.value && X();
|
|
144
147
|
}
|
|
145
|
-
a(
|
|
146
|
-
e ? (
|
|
148
|
+
a(j, (e) => {
|
|
149
|
+
e ? (_.value = !0, g.value = !0, Ne()) : _.value && Y();
|
|
147
150
|
}, { immediate: !0 }), a([
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
() =>
|
|
151
|
-
() =>
|
|
152
|
-
() =>
|
|
151
|
+
g,
|
|
152
|
+
b,
|
|
153
|
+
() => P.value.autoFocus,
|
|
154
|
+
() => P.value.disableEnforceFocus,
|
|
155
|
+
() => P.value.disableRestoreFocus
|
|
153
156
|
], () => {
|
|
154
|
-
|
|
155
|
-
|
|
157
|
+
te(() => {
|
|
158
|
+
W();
|
|
156
159
|
});
|
|
157
160
|
});
|
|
158
161
|
function $() {
|
|
159
|
-
let e =
|
|
160
|
-
e && (
|
|
162
|
+
let e = me(v.value);
|
|
163
|
+
e && (y.value = e.zIndex);
|
|
161
164
|
}
|
|
162
|
-
return a(
|
|
163
|
-
e ? (
|
|
165
|
+
return a(g, (e) => {
|
|
166
|
+
e ? (T = de(), D = ve({
|
|
164
167
|
trapsFocus: !0,
|
|
165
|
-
order:
|
|
166
|
-
id:
|
|
167
|
-
onEscape:
|
|
168
|
-
container:
|
|
169
|
-
lockScroll:
|
|
170
|
-
}),
|
|
171
|
-
}, { immediate: !0 }),
|
|
172
|
-
|
|
168
|
+
order: T,
|
|
169
|
+
id: m.stackId,
|
|
170
|
+
onEscape: Fe,
|
|
171
|
+
container: x.value ?? void 0,
|
|
172
|
+
lockScroll: P.value.disableScrollLock !== !0
|
|
173
|
+
}), v.value = D.id, y.value = D.zIndex, $(), k = be($)) : (k?.(), k = null, D?.release(), D = null, T = null, v.value = "", y.value = d);
|
|
174
|
+
}, { immediate: !0 }), a(() => P.value.disableScrollLock, (e) => {
|
|
175
|
+
D?.setLockScroll(e !== !0);
|
|
176
|
+
}), ne(() => {
|
|
177
|
+
K(), q(), k?.(), k = null, U(), D?.release(), D = null;
|
|
173
178
|
}), {
|
|
174
|
-
merged:
|
|
175
|
-
mounted:
|
|
176
|
-
rootBind:
|
|
177
|
-
panelBind:
|
|
178
|
-
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
|
|
179
|
+
merged: P,
|
|
180
|
+
mounted: _,
|
|
181
|
+
rootBind: Oe,
|
|
182
|
+
panelBind: je,
|
|
183
|
+
setRootRef: Me,
|
|
184
|
+
overlayBind: ke,
|
|
185
|
+
wrapperBind: Ae,
|
|
186
|
+
setPanelRef: G,
|
|
187
|
+
layerStackId: v,
|
|
182
188
|
handleOverlayClick: Z,
|
|
183
189
|
handleWrapperClick: Q
|
|
184
190
|
};
|
|
185
191
|
}
|
|
186
|
-
export {
|
|
192
|
+
export { f as useModal };
|