@bridge-ui/vue 0.22.1 → 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/Actions/Snackbar/BridgeSnackbarAction.vue_vue_type_script_setup_true_lang.js +4 -4
- package/dist/Actions/Snackbar/BridgeSnackbarItem.vue_vue_type_script_setup_true_lang.js +31 -25
- package/dist/Actions/Snackbar/bridgeSnackbar.types.d.ts +14 -7
- package/dist/Actions/Snackbar/index.d.ts +1 -1
- package/dist/Actions/index.d.ts +1 -1
- 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/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/Components/Snackbar/composables/useSnackbar.js +107 -107
- package/dist/Components/Snackbar/snackbar.types.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,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 };
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { PopoverOwnProps, PopoverSlots } from './popover.types';
|
|
2
|
+
type __VLS_Slots = PopoverSlots;
|
|
3
|
+
type __VLS_Props = PopoverOwnProps;
|
|
4
|
+
type __VLS_ModelProps = {
|
|
5
|
+
modelValue?: boolean;
|
|
6
|
+
};
|
|
7
|
+
type __VLS_PublicProps = __VLS_Props & __VLS_ModelProps;
|
|
8
|
+
declare const __VLS_base: import('vue').DefineComponent<__VLS_PublicProps, {}, {}, {}, {}, import('vue').ComponentOptionsMixin, import('vue').ComponentOptionsMixin, {
|
|
9
|
+
close: () => any;
|
|
10
|
+
"update:modelValue": (value: boolean) => any;
|
|
11
|
+
}, string, import('vue').PublicProps, Readonly<__VLS_PublicProps> & Readonly<{
|
|
12
|
+
onClose?: (() => any) | undefined;
|
|
13
|
+
"onUpdate:modelValue"?: ((value: boolean) => any) | undefined;
|
|
14
|
+
}>, {
|
|
15
|
+
offset: number;
|
|
16
|
+
rounded: import('@bridge-ui/core/Utils').MergeProps<import('@bridge-ui/core/Tokens').PopoverRounded, import('./popover.types').PopoverRoundedOverrides>;
|
|
17
|
+
shadow: import('@bridge-ui/core/Utils').MergeProps<import('@bridge-ui/core/Tokens').PopoverShadow, import('./popover.types').PopoverShadowOverrides>;
|
|
18
|
+
closeOnEscape: boolean;
|
|
19
|
+
disableScrollLock: boolean;
|
|
20
|
+
keepMounted: boolean;
|
|
21
|
+
persistent: boolean;
|
|
22
|
+
placement: import('@floating-ui/utils').Placement;
|
|
23
|
+
teleportTo: false | string;
|
|
24
|
+
anchorEl: null | HTMLElement;
|
|
25
|
+
closeOnClickAway: boolean;
|
|
26
|
+
disableAutoFocus: boolean;
|
|
27
|
+
matchWidth: boolean;
|
|
28
|
+
strategy: import('@bridge-ui/core/Runtime').PositionStrategy;
|
|
29
|
+
arrow: boolean;
|
|
30
|
+
closeOnFocusOut: boolean;
|
|
31
|
+
}, {}, {}, {}, string, import('vue').ComponentProvideOptions, false, {}, any>;
|
|
32
|
+
declare const __VLS_export: __VLS_WithSlots<typeof __VLS_base, __VLS_Slots>;
|
|
33
|
+
declare const _default: typeof __VLS_export;
|
|
34
|
+
export default _default;
|
|
35
|
+
type __VLS_WithSlots<T, S> = T & {
|
|
36
|
+
new (): {
|
|
37
|
+
$slots: S;
|
|
38
|
+
};
|
|
39
|
+
};
|
|
@@ -0,0 +1,100 @@
|
|
|
1
|
+
import { hasNamedSlot as e } from "../../Utils/slotOrProp.js";
|
|
2
|
+
import { usePopover as t } from "./composables/usePopover.js";
|
|
3
|
+
import { Fragment as n, Teleport as r, computed as i, createBlock as a, createCommentVNode as o, createElementBlock as s, createElementVNode as c, createTextVNode as l, defineComponent as u, mergeModels as d, mergeProps as f, normalizeProps as p, openBlock as m, renderSlot as h, toDisplayString as g, unref as _, useModel as v, useSlots as y } from "vue";
|
|
4
|
+
// src/Components/Popover/Popover.vue?vue&type=script&setup=true&lang.ts
|
|
5
|
+
var b = /*@__PURE__*/ u({
|
|
6
|
+
inheritAttrs: !1,
|
|
7
|
+
__name: "Popover",
|
|
8
|
+
props: /*@__PURE__*/ d({
|
|
9
|
+
anchorEl: { default: null },
|
|
10
|
+
arrow: {
|
|
11
|
+
type: Boolean,
|
|
12
|
+
default: !1
|
|
13
|
+
},
|
|
14
|
+
classes: {},
|
|
15
|
+
closeOnClickAway: {
|
|
16
|
+
type: Boolean,
|
|
17
|
+
default: !0
|
|
18
|
+
},
|
|
19
|
+
closeOnEscape: {
|
|
20
|
+
type: Boolean,
|
|
21
|
+
default: !0
|
|
22
|
+
},
|
|
23
|
+
closeOnFocusOut: {
|
|
24
|
+
type: Boolean,
|
|
25
|
+
default: !0
|
|
26
|
+
},
|
|
27
|
+
customProps: {},
|
|
28
|
+
disableAutoFocus: {
|
|
29
|
+
type: Boolean,
|
|
30
|
+
default: !1
|
|
31
|
+
},
|
|
32
|
+
disableScrollLock: {
|
|
33
|
+
type: Boolean,
|
|
34
|
+
default: !0
|
|
35
|
+
},
|
|
36
|
+
keepMounted: {
|
|
37
|
+
type: Boolean,
|
|
38
|
+
default: !1
|
|
39
|
+
},
|
|
40
|
+
matchWidth: {
|
|
41
|
+
type: Boolean,
|
|
42
|
+
default: !1
|
|
43
|
+
},
|
|
44
|
+
offset: { default: 8 },
|
|
45
|
+
onShowChange: {},
|
|
46
|
+
persistent: {
|
|
47
|
+
type: Boolean,
|
|
48
|
+
default: !1
|
|
49
|
+
},
|
|
50
|
+
placement: { default: "bottom-start" },
|
|
51
|
+
rounded: { default: "md" },
|
|
52
|
+
shadow: { default: "md" },
|
|
53
|
+
strategy: { default: "fixed" },
|
|
54
|
+
teleportTo: {
|
|
55
|
+
type: [Boolean, String],
|
|
56
|
+
default: "body"
|
|
57
|
+
},
|
|
58
|
+
title: {}
|
|
59
|
+
}, {
|
|
60
|
+
modelValue: {
|
|
61
|
+
type: Boolean,
|
|
62
|
+
default: !1
|
|
63
|
+
},
|
|
64
|
+
modelModifiers: {}
|
|
65
|
+
}),
|
|
66
|
+
emits: /*@__PURE__*/ d(["close"], ["update:modelValue"]),
|
|
67
|
+
setup(u, { emit: d }) {
|
|
68
|
+
let b = y(), x = d, S = u, C = v(u, "modelValue"), { close: w, merged: T, mounted: E, hasTitle: D, rootBind: O, titleBind: k, arrowBind: A, triggerBind: j, contentBind: M, setArrowRef: N, setTriggerRef: P, setContentRef: F } = t(S, {
|
|
69
|
+
offset: 8,
|
|
70
|
+
arrow: !1,
|
|
71
|
+
shadow: "md",
|
|
72
|
+
rounded: "md",
|
|
73
|
+
strategy: "fixed",
|
|
74
|
+
teleportTo: "body",
|
|
75
|
+
closeOnEscape: !0,
|
|
76
|
+
closeOnFocusOut: !0,
|
|
77
|
+
closeOnClickAway: !0,
|
|
78
|
+
disableScrollLock: !0,
|
|
79
|
+
placement: "bottom-start"
|
|
80
|
+
}, {
|
|
81
|
+
show: C,
|
|
82
|
+
onClose: () => x("close"),
|
|
83
|
+
hasTitleSlot: () => e(b, "title"),
|
|
84
|
+
onShowChange: (e) => S.onShowChange?.(e)
|
|
85
|
+
}), I = i(() => T.value.teleportTo === !1), L = i(() => T.value.teleportTo === !1 ? "body" : T.value.teleportTo);
|
|
86
|
+
return (t, i) => (m(), s(n, null, [_(e)(_(b), "trigger") ? (m(), s("div", p(f({ key: 0 }, _(O))), [c("div", f({ ref: _(P) }, _(j)), [h(t.$slots, "trigger")], 16)], 16)) : o("", !0), _(E) ? (m(), a(r, {
|
|
87
|
+
key: 1,
|
|
88
|
+
to: L.value,
|
|
89
|
+
disabled: I.value
|
|
90
|
+
}, [c("div", f({ ref: _(F) }, _(M)), [
|
|
91
|
+
_(D) ? (m(), s("div", p(f({ key: 0 }, _(k))), [h(t.$slots, "title", {}, () => [l(g(_(T).title), 1)])], 16)) : o("", !0),
|
|
92
|
+
h(t.$slots, "default", { close: _(w) }),
|
|
93
|
+
_(A) ? (m(), s("div", f({
|
|
94
|
+
key: 1,
|
|
95
|
+
ref: _(N)
|
|
96
|
+
}, _(A)), null, 16)) : o("", !0)
|
|
97
|
+
], 16)], 8, ["to", "disabled"])) : o("", !0)], 64));
|
|
98
|
+
}
|
|
99
|
+
});
|
|
100
|
+
export { b as default };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { HTMLAttributes, Ref } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Root and trigger parts shared by Popover and Menu (the anchored panels
|
|
4
|
+
* built on `usePopoverBase`). Content, roles and keyboard handling
|
|
5
|
+
* stay in each component.
|
|
6
|
+
*/
|
|
7
|
+
type PartClasses = undefined | Partial<Record<"root" | "trigger", string>>;
|
|
8
|
+
type PartProps = undefined | HTMLAttributes;
|
|
9
|
+
/**
|
|
10
|
+
* `setShow` for an overlay bound with `v-model:show`: calls `onClose` on
|
|
11
|
+
* close, updates the model, then calls `onShowChange`.
|
|
12
|
+
*/
|
|
13
|
+
export declare function createPopoverSetShow(options: {
|
|
14
|
+
onClose?: () => void;
|
|
15
|
+
onShowChange?: (show: boolean) => void;
|
|
16
|
+
show?: Ref<boolean>;
|
|
17
|
+
}): (show: boolean) => void;
|
|
18
|
+
/**
|
|
19
|
+
* Panel token class (`rounded`, `shadow`): the base token map merged with
|
|
20
|
+
* the registry overrides, resolved for the selected key.
|
|
21
|
+
*/
|
|
22
|
+
export declare function getPopoverPanelTokenClass<T extends object>(props: T, overrides: undefined | Partial<T>, key: keyof T | undefined): string | undefined;
|
|
23
|
+
/**
|
|
24
|
+
* Root wrapper bind (holds the trigger).
|
|
25
|
+
*/
|
|
26
|
+
export declare function getPopoverRootBind(options: {
|
|
27
|
+
classes: PartClasses;
|
|
28
|
+
customProps: PartProps;
|
|
29
|
+
inheritedAttrs: object;
|
|
30
|
+
}): import('@bridge-ui/core/Utils').MergePartBind<object, "class", PartProps, object>;
|
|
31
|
+
/**
|
|
32
|
+
* Trigger wrapper bind: a focusable button that toggles the panel.
|
|
33
|
+
*/
|
|
34
|
+
export declare function getPopoverTriggerBind(options: {
|
|
35
|
+
classes: PartClasses;
|
|
36
|
+
controlsId: string;
|
|
37
|
+
customProps: PartProps;
|
|
38
|
+
hasPopup: "menu" | "dialog";
|
|
39
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
40
|
+
show: boolean;
|
|
41
|
+
toggle: () => void;
|
|
42
|
+
}): import('@bridge-ui/core/Utils').MergePartBind<{
|
|
43
|
+
tabindex: number;
|
|
44
|
+
role: string;
|
|
45
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
46
|
+
"aria-expanded": boolean;
|
|
47
|
+
onClickCapture: () => void;
|
|
48
|
+
"aria-haspopup": "menu" | "dialog";
|
|
49
|
+
"aria-controls": string | undefined;
|
|
50
|
+
class: string;
|
|
51
|
+
}, "class", PartProps, {}>;
|
|
52
|
+
export {};
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
import { mergePartBind as e } from "../../../Utils/index.js";
|
|
2
|
+
import { get as t } from "es-toolkit/compat";
|
|
3
|
+
import { cn as n, mergeBridgeUILayeredClasses as r } from "@bridge-ui/core/Utils";
|
|
4
|
+
// src/Components/Popover/composables/popoverParts.ts
|
|
5
|
+
function i(e) {
|
|
6
|
+
return (t) => {
|
|
7
|
+
t || e.onClose?.(), e.show && (e.show.value = t), e.onShowChange?.(t);
|
|
8
|
+
};
|
|
9
|
+
}
|
|
10
|
+
function a(e, n, i) {
|
|
11
|
+
let a = r(e, n);
|
|
12
|
+
return t(a, i);
|
|
13
|
+
}
|
|
14
|
+
function o(r) {
|
|
15
|
+
return e(r.customProps, r.inheritedAttrs, n({
|
|
16
|
+
"relative inline-flex": !0,
|
|
17
|
+
[t(r.classes, "root") ?? ""]: !0
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
function s(r) {
|
|
21
|
+
return e(r.customProps, {}, {
|
|
22
|
+
tabindex: 0,
|
|
23
|
+
role: "button",
|
|
24
|
+
onKeydown: r.onKeydown,
|
|
25
|
+
"aria-expanded": r.show,
|
|
26
|
+
onClickCapture: r.toggle,
|
|
27
|
+
"aria-haspopup": r.hasPopup,
|
|
28
|
+
"aria-controls": r.show ? r.controlsId : void 0,
|
|
29
|
+
class: n({
|
|
30
|
+
"inline-flex w-fit max-w-full cursor-pointer outline-hidden": !0,
|
|
31
|
+
[t(r.classes, "trigger") ?? ""]: !0
|
|
32
|
+
})
|
|
33
|
+
});
|
|
34
|
+
}
|
|
35
|
+
export { i as createPopoverSetShow, a as getPopoverPanelTokenClass, o as getPopoverRootBind, s as getPopoverTriggerBind };
|
|
@@ -0,0 +1,68 @@
|
|
|
1
|
+
import { Ref } from 'vue';
|
|
2
|
+
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
3
|
+
import { PopoverOwnProps } from '../popover.types';
|
|
4
|
+
type PopoverLibDefaults = LibDefaultsShape<PopoverOwnProps, "arrow" | "offset" | "shadow" | "rounded" | "strategy" | "placement" | "teleportTo" | "closeOnEscape" | "closeOnFocusOut" | "closeOnClickAway" | "disableScrollLock">;
|
|
5
|
+
type PopoverMerged = MergeLibDefaults<PopoverOwnProps, PopoverLibDefaults>;
|
|
6
|
+
export type PopoverOptions = {
|
|
7
|
+
/**
|
|
8
|
+
* Whether the `title` slot is provided (labels the dialog).
|
|
9
|
+
*/
|
|
10
|
+
hasTitleSlot?: () => boolean;
|
|
11
|
+
/**
|
|
12
|
+
* Called when the user dismisses the popover.
|
|
13
|
+
* Sugar for `onShowChange(false)`.
|
|
14
|
+
*/
|
|
15
|
+
onClose?: () => void;
|
|
16
|
+
/**
|
|
17
|
+
* Called when `show` should change (controlled state).
|
|
18
|
+
*/
|
|
19
|
+
onShowChange?: (show: boolean) => void;
|
|
20
|
+
/**
|
|
21
|
+
* Whether the popover is visible (`defineModel()` / `v-model`).
|
|
22
|
+
*
|
|
23
|
+
* @default false
|
|
24
|
+
*/
|
|
25
|
+
show?: Ref<boolean>;
|
|
26
|
+
};
|
|
27
|
+
export declare function usePopover(props: PopoverOwnProps, libDefaults: PopoverLibDefaults, options?: PopoverOptions): {
|
|
28
|
+
close: () => void;
|
|
29
|
+
merged: import('vue').ComputedRef<PopoverMerged>;
|
|
30
|
+
hasTitle: import('vue').ComputedRef<boolean>;
|
|
31
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, object>>;
|
|
32
|
+
popoverId: string;
|
|
33
|
+
titleBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
34
|
+
id: string;
|
|
35
|
+
class: string;
|
|
36
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
37
|
+
arrowBind: import('vue').ComputedRef<({
|
|
38
|
+
"aria-hidden": boolean;
|
|
39
|
+
class: string;
|
|
40
|
+
} & object & Record<"class", string>) | null>;
|
|
41
|
+
isPortaled: import('vue').ComputedRef<boolean>;
|
|
42
|
+
triggerBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
43
|
+
tabindex: number;
|
|
44
|
+
role: string;
|
|
45
|
+
onKeydown: (event: KeyboardEvent) => void;
|
|
46
|
+
"aria-expanded": boolean;
|
|
47
|
+
onClickCapture: () => void;
|
|
48
|
+
"aria-haspopup": "menu" | "dialog";
|
|
49
|
+
"aria-controls": string | undefined;
|
|
50
|
+
class: string;
|
|
51
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
52
|
+
contentBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
53
|
+
tabindex: number;
|
|
54
|
+
id: string;
|
|
55
|
+
role: string;
|
|
56
|
+
"aria-labelledby": string | undefined;
|
|
57
|
+
style: {
|
|
58
|
+
zIndex: number;
|
|
59
|
+
};
|
|
60
|
+
"aria-hidden": boolean | undefined;
|
|
61
|
+
class: string;
|
|
62
|
+
}, "class", import('vue').HTMLAttributes | undefined, {}>>;
|
|
63
|
+
mounted: Ref<boolean, boolean>;
|
|
64
|
+
setArrowRef: (element: null | Element | import('vue').ComponentPublicInstance) => void;
|
|
65
|
+
setTriggerRef: (element: null | Element | import('vue').ComponentPublicInstance) => void;
|
|
66
|
+
setContentRef: (element: null | Element | import('vue').ComponentPublicInstance) => void;
|
|
67
|
+
};
|
|
68
|
+
export {};
|