@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.
Files changed (45) hide show
  1. package/ai/skills/bridge-ui-overlays/SKILL.md +4 -2
  2. package/dist/Actions/Snackbar/BridgeSnackbarAction.vue_vue_type_script_setup_true_lang.js +4 -4
  3. package/dist/Actions/Snackbar/BridgeSnackbarItem.vue_vue_type_script_setup_true_lang.js +31 -25
  4. package/dist/Actions/Snackbar/bridgeSnackbar.types.d.ts +14 -7
  5. package/dist/Actions/Snackbar/index.d.ts +1 -1
  6. package/dist/Actions/index.d.ts +1 -1
  7. package/dist/Components/ColorField/composables/useColorField.js +1 -1
  8. package/dist/Components/DateField/composables/useDateField.js +1 -1
  9. package/dist/Components/DateRangeField/composables/useDateRangeField.js +1 -1
  10. package/dist/Components/DateTimeField/composables/useDateTimeField.js +1 -1
  11. package/dist/Components/DateTimeRangeField/composables/useDateTimeRangeField.js +1 -1
  12. package/dist/Components/Drawer/Drawer.vue_vue_type_script_setup_true_lang.js +7 -7
  13. package/dist/Components/Drawer/composables/useDrawer.d.ts +1 -0
  14. package/dist/Components/Drawer/composables/useDrawer.js +96 -90
  15. package/dist/Components/Menu/composables/useMenu.d.ts +8 -8
  16. package/dist/Components/Menu/composables/useMenu.js +81 -195
  17. package/dist/Components/Modal/Modal.vue_vue_type_script_setup_true_lang.js +7 -7
  18. package/dist/Components/Modal/composables/useModal.d.ts +1 -0
  19. package/dist/Components/Modal/composables/useModal.js +120 -114
  20. package/dist/Components/Popover/Popover.js +4 -0
  21. package/dist/Components/Popover/Popover.vue.d.ts +39 -0
  22. package/dist/Components/Popover/Popover.vue_vue_type_script_setup_true_lang.js +100 -0
  23. package/dist/Components/Popover/composables/popoverParts.d.ts +52 -0
  24. package/dist/Components/Popover/composables/popoverParts.js +35 -0
  25. package/dist/Components/Popover/composables/usePopover.d.ts +68 -0
  26. package/dist/Components/Popover/composables/usePopover.js +119 -0
  27. package/dist/Components/Popover/composables/usePopoverBase.d.ts +130 -0
  28. package/dist/Components/Popover/composables/usePopoverBase.js +210 -0
  29. package/dist/Components/Popover/index.d.ts +4 -0
  30. package/dist/Components/Popover/index.js +3 -0
  31. package/dist/Components/Popover/popover.types.d.ts +207 -0
  32. package/dist/Components/Resizable/composables/useResizable.js +85 -85
  33. package/dist/Components/Snackbar/Snackbar.vue.d.ts +1 -1
  34. package/dist/Components/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +23 -23
  35. package/dist/Components/Snackbar/composables/useSnackbar.js +107 -107
  36. package/dist/Components/Snackbar/snackbar.types.d.ts +1 -1
  37. package/dist/Components/TimeField/composables/useTimeField.js +1 -1
  38. package/dist/Components/TimeRangeField/composables/useTimeRangeField.js +1 -1
  39. package/dist/augments.d.ts +5 -0
  40. package/dist/index.d.ts +2 -0
  41. package/dist/index.js +78 -76
  42. package/docs/README.md +1 -0
  43. package/docs/components/Menu.md +4 -0
  44. package/docs/components/Popover.md +210 -0
  45. package/package.json +2 -2
@@ -1,6 +1,6 @@
1
- import { ComponentPublicInstance, Ref } from 'vue';
1
+ import { Ref } from 'vue';
2
2
  import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
3
- import { MenuOwnProps, MenuProps } from '../menu.types';
3
+ import { MenuOwnProps } from '../menu.types';
4
4
  type MenuLibDefaults = LibDefaultsShape<MenuOwnProps, "offset" | "shadow" | "rounded" | "strategy" | "placement" | "teleportTo" | "closeOnEscape" | "closeOnClickAway" | "disableScrollLock">;
5
5
  type MenuMerged = MergeLibDefaults<MenuOwnProps, MenuLibDefaults>;
6
6
  export type MenuOptions = {
@@ -23,16 +23,15 @@ export type MenuOptions = {
23
23
  export declare function useMenu(props: MenuOwnProps, libDefaults: MenuLibDefaults, options?: MenuOptions): {
24
24
  merged: import('vue').ComputedRef<MenuMerged>;
25
25
  menuId: string;
26
- mounted: Ref<boolean, boolean>;
27
- rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, Omit<Omit<MenuProps, "offset" | "classes" | "customProps" | "rounded" | "shadow" | "closeOnEscape" | "disableScrollLock" | "keepMounted" | "persistent" | "placement" | "teleportTo" | "closeOnClickAway" | "disableAutoFocus" | "matchWidth" | "strategy">, "anchorEl" | "onShowChange">>>;
26
+ rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", import('vue').HTMLAttributes | undefined, object>>;
28
27
  isPortaled: import('vue').ComputedRef<boolean>;
29
28
  triggerBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
30
29
  tabindex: number;
31
30
  role: string;
32
- "aria-expanded": boolean;
33
31
  onKeydown: (event: KeyboardEvent) => void;
34
- "aria-haspopup": "menu";
32
+ "aria-expanded": boolean;
35
33
  onClickCapture: () => void;
34
+ "aria-haspopup": "menu" | "dialog";
36
35
  "aria-controls": string | undefined;
37
36
  class: string;
38
37
  }, "class", import('vue').HTMLAttributes | undefined, {}>>;
@@ -46,7 +45,8 @@ export declare function useMenu(props: MenuOwnProps, libDefaults: MenuLibDefault
46
45
  "aria-hidden": boolean | undefined;
47
46
  class: string;
48
47
  }, "class", import('vue').HTMLAttributes | undefined, {}>>;
49
- setTriggerRef: (element: null | Element | ComponentPublicInstance) => void;
50
- setContentRef: (element: null | Element | ComponentPublicInstance) => void;
48
+ mounted: Ref<boolean, boolean>;
49
+ setTriggerRef: (element: null | Element | import('vue').ComponentPublicInstance) => void;
50
+ setContentRef: (element: null | Element | import('vue').ComponentPublicInstance) => void;
51
51
  };
52
52
  export {};
@@ -1,12 +1,14 @@
1
- import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as r } from "../../../Utils/index.js";
2
- import { computed as i, nextTick as a, onBeforeUnmount as ee, ref as o, toValue as te, useAttrs as s, useId as c, watch as l } from "vue";
3
- import { get as u, omit as d } from "es-toolkit/compat";
4
- import { menuRoundedProps as ne, menuShadowProps as re } from "@bridge-ui/core/Tokens";
5
- import { cn as f, mergeBridgeUILayeredClasses as p, splitComponentProps as m } from "@bridge-ui/core/Utils";
6
- import { createFocusable as h, createPositionable as ie } from "@bridge-ui/core/Runtime";
7
- import { LAYER_STACK_BASE_Z_INDEX as g, acquireLayerStackOrder as ae, claimOpenMenu as oe, getLayerStackEntry as se, pushLayerStack as ce, subscribeLayerStack as le } from "@bridge-ui/core/Layer";
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 ue = [
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 _(_, de, v = {}) {
27
- let y = s(), b = c(), x = o(!1), S = o(""), C = o(null), w = o(null), T = null, E = null, D = null, O = null, k = null, A = null, j = !1, M = o(g), N = i(() => te(v.show ?? !1));
28
- function P(e) {
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
- ...y,
35
- ..._
32
+ ...E,
33
+ ...S
36
34
  }
37
- })), { merged: I, entry: L } = n({
38
- libDefaults: de,
35
+ })), { merged: A, entry: j } = t({
36
+ libDefaults: C,
39
37
  componentName: "Menu",
40
- props: () => F.value.componentProps
41
- }), R = i(() => I.value.customProps), z = r({
42
- entry: L,
43
- props: () => F.value.componentProps
44
- }), B = i(() => I.value.keepMounted && !N.value), V = i(() => I.value.teleportTo !== !1), fe = i(() => {
45
- let e = p(ne, L.value?.tokens?.rounded);
46
- return u(e, I.value.rounded);
47
- }), pe = i(() => {
48
- let e = p(re, L.value?.tokens?.shadow);
49
- return u(e, I.value.shadow);
50
- }), H = i(() => !I.value.persistent), U = i(() => d(F.value.inheritedAttrs, ["anchorEl", "onShowChange"]));
51
- function W() {
52
- return _.anchorEl ?? C.value;
53
- }
54
- function G() {
55
- W()?.focus({ preventScroll: !0 });
56
- }
57
- function K(e) {
58
- return W()?.contains(e) ?? !1;
59
- }
60
- function me(e) {
61
- return !(e instanceof Element) || K(e) || w.value?.contains(e) ? !1 : !!e.closest("[aria-haspopup=\"menu\"], button, [role=\"button\"]");
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(), n.next()?.focus({ preventScroll: !0 });
62
+ e.preventDefault(), r.next()?.focus({ preventScroll: !0 });
82
63
  break;
83
64
  case "ArrowUp":
84
- e.preventDefault(), n.previous()?.focus({ preventScroll: !0 });
65
+ e.preventDefault(), r.previous()?.focus({ preventScroll: !0 });
85
66
  break;
86
67
  case "Home":
87
- e.preventDefault(), n.focusFirst();
68
+ e.preventDefault(), r.focusFirst();
88
69
  break;
89
- case "End": e.preventDefault(), n.focusLast();
70
+ case "End": e.preventDefault(), r.focusLast();
90
71
  }
91
72
  }
92
- function J() {
93
- j = !1, O?.destroy(), O = null;
94
- }
95
- function Y() {
96
- J();
97
- let e = W(), t = w.value;
98
- N.value && e && t && (O = ie({
99
- floating: t,
100
- reference: e,
101
- offset: I.value.offset,
102
- strategy: I.value.strategy,
103
- placement: I.value.placement,
104
- matchWidth: I.value.matchWidth === !0,
105
- onReferenceHidden: () => {
106
- j && H.value && N.value && q();
107
- }
108
- }), O.start(), a(() => {
109
- j = !0;
110
- }));
111
- }
112
- function X() {
113
- N.value && !I.value.disableAutoFocus && w.value && h(w.value).focusFirst();
114
- }
115
- function ve() {
116
- if (k?.(), !N.value) {
117
- k = null;
118
- return;
119
- }
120
- function e(e) {
121
- let t = e.target;
122
- K(t) || w.value?.contains(t) || I.value.closeOnClickAway !== !1 && H.value && (me(t) || q());
123
- }
124
- document.addEventListener("pointerdown", e, !0), k = () => {
125
- document.removeEventListener("pointerdown", e, !0);
126
- };
127
- }
128
- function ye(e) {
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 { _ as useMenu };
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, overlayBind: w, wrapperBind: T, setPanelRef: E, layerStackId: D } = e(v, {
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 ?? D.value) });
82
- let O = n(() => b.value.teleportTo === !1), k = n(() => b.value.teleportTo === !1 ? "body" : b.value.teleportTo), A = n(() => v.hideBackdrop !== !0 && b.value.hideBackdrop !== !0);
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: k.value,
86
- disabled: O.value
87
- }, [o("div", d(c(m(S))), [A.value ? (f(), a("div", u({
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(w)), null, 16)) : i("", !0), o("div", d(c(m(T))), [o("div", u({ ref: m(E) }, m(C)), [p(e.$slots, "default")], 16)], 16)], 16)], 8, ["to", "disabled"])) : i("", !0);
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";