@bridge-ui/vue 0.9.0 → 0.10.1
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-forms/SKILL.md +1 -1
- package/dist/Actions/Dialog/BridgeDialogHost.vue_vue_type_script_setup_true_lang.js +16 -13
- package/dist/Actions/Dialog/useDialogAction.js +16 -15
- package/dist/Actions/Drawer/BridgeDrawerHost.vue_vue_type_script_setup_true_lang.js +19 -16
- package/dist/Actions/Drawer/useDrawerAction.js +16 -15
- package/dist/Actions/Modal/BridgeModalHost.vue_vue_type_script_setup_true_lang.js +19 -16
- package/dist/Actions/Modal/useModalAction.js +16 -15
- package/dist/Actions/Snackbar/BridgeSnackbarHost.vue_vue_type_script_setup_true_lang.js +35 -32
- package/dist/Actions/Snackbar/BridgeSnackbarItem.vue_vue_type_script_setup_true_lang.js +1 -2
- package/dist/Actions/Snackbar/useSnackbarAction.js +17 -16
- package/dist/Actions/actionHostRegistry.d.ts +13 -0
- package/dist/Actions/actionHostRegistry.js +10 -0
- package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +1 -0
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +4 -10
- package/dist/Components/ListItem/composables/useListItem.js +4 -5
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +38 -36
- package/dist/Components/Listbox/composables/useListbox.d.ts +1 -1
- package/dist/Components/Listbox/composables/useListbox.js +1 -0
- package/dist/Components/Listbox/listbox.types.d.ts +7 -0
- package/dist/Components/Select/composables/useSelect.d.ts +1 -0
- package/dist/Components/Snackbar/composables/useSnackbar.js +109 -108
- package/docs/components/Autocomplete.md +14 -0
- package/docs/components/BridgeUIProvider.md +13 -1
- package/docs/components/Menu.md +1 -0
- package/docs/components/Select.md +14 -0
- package/package.json +2 -2
|
@@ -45,4 +45,4 @@ Controlled fields: **`v-model` / `modelValue`**. Never React `value`/`onChange`.
|
|
|
45
45
|
1. Map validation to `error`, `error-message`, `description`, `disabled`, `readOnly`.
|
|
46
46
|
2. Native input attrs often go through `:custom-props` → `input` — see TextField docs.
|
|
47
47
|
3. Use only documented option shapes for Select/Autocomplete.
|
|
48
|
-
4. Prefer public fields/controls in apps. `FormField`, `FormControl`, and `BaseField` are exported building blocks for advanced composition. Theme shared chrome via `components.FormField` / `FormControl` / `BaseField` (a public entry such as `components.TextField` still overrides `defaultProps`). Chrome tokens live on those shared keys. Dropdown tokens live on `components.Listbox
|
|
48
|
+
4. Prefer public fields/controls in apps. `FormField`, `FormControl`, and `BaseField` are exported building blocks for advanced composition. Theme shared chrome via `components.FormField` / `FormControl` / `BaseField` (a public entry such as `components.TextField` still overrides `defaultProps`). Chrome tokens live on those shared keys. Dropdown tokens live on `components.Listbox` (`defaultProps.matchWidth` matches the field). Time overlay chrome: `components.TimePanel` (`TimePicker` / `TimeRangePicker` override). Shared form density: `global.formDefaults: { size, rounded }` (Radio/Switch/BaseField/FormControl ignore `rounded`).
|
|
@@ -1,20 +1,23 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
1
|
+
import { dialogActionHosts as e, registerActionHost as t } from "../actionHostRegistry.js";
|
|
2
|
+
import { BRIDGE_DIALOG_INJECTION_KEY as n } from "./bridgeDialogInjectionKey.js";
|
|
3
|
+
import r from "./BridgeDialogItem.js";
|
|
4
|
+
import { createBridgeDialogApi as i } from "./createBridgeDialogApi.js";
|
|
5
|
+
import { Fragment as a, computed as o, createBlock as s, createElementBlock as c, defineComponent as l, inject as u, openBlock as d, provide as f, renderList as p, renderSlot as m, unref as h } from "vue";
|
|
5
6
|
//#region src/Actions/Dialog/BridgeDialogHost.vue?vue&type=script&setup=true&lang.ts
|
|
6
|
-
var
|
|
7
|
+
var g = "[Bridge UI] Nested <BridgeDialogHost /> detected. useDialogAction() will target the nearest host only. Remove the extra host.", _ = /*@__PURE__*/ l({
|
|
7
8
|
__name: "BridgeDialogHost",
|
|
8
9
|
props: { modal: {} },
|
|
9
|
-
setup(
|
|
10
|
-
let
|
|
11
|
-
|
|
12
|
-
let
|
|
13
|
-
|
|
14
|
-
|
|
10
|
+
setup(l) {
|
|
11
|
+
let _ = l;
|
|
12
|
+
u(n, null) && process.env.NODE_ENV !== "production" && console.warn(g);
|
|
13
|
+
let v = i();
|
|
14
|
+
t(e, v);
|
|
15
|
+
let y = o(() => v.entries.value);
|
|
16
|
+
return f(n, v), (e, t) => (d(), c(a, null, [m(e.$slots, "default"), (d(!0), c(a, null, p(y.value, (e) => (d(), s(r, {
|
|
17
|
+
api: h(v),
|
|
15
18
|
entry: e,
|
|
16
19
|
key: e.id,
|
|
17
|
-
"host-modal":
|
|
20
|
+
"host-modal": _.modal
|
|
18
21
|
}, null, 8, [
|
|
19
22
|
"api",
|
|
20
23
|
"entry",
|
|
@@ -23,4 +26,4 @@ var m = "[Bridge UI] Nested <BridgeDialogHost /> detected. useDialogAction() wil
|
|
|
23
26
|
}
|
|
24
27
|
});
|
|
25
28
|
//#endregion
|
|
26
|
-
export {
|
|
29
|
+
export { _ as default };
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { dialogActionHosts as e } from "../actionHostRegistry.js";
|
|
2
|
+
import { BRIDGE_DIALOG_INJECTION_KEY as t } from "./bridgeDialogInjectionKey.js";
|
|
3
|
+
import { computed as n, inject as r } from "vue";
|
|
4
|
+
import { getLayerCount as i } from "@bridge-ui/core/Layer";
|
|
4
5
|
//#region src/Actions/Dialog/useDialogAction.ts
|
|
5
|
-
var
|
|
6
|
+
var a = class extends Error {
|
|
6
7
|
constructor() {
|
|
7
8
|
super("useDialogAction() requires <BridgeDialogHost /> in the app tree."), this.name = "BridgeDialogHostMissingError";
|
|
8
9
|
}
|
|
9
10
|
};
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
if (!
|
|
13
|
-
let
|
|
11
|
+
function o() {
|
|
12
|
+
let o = e.resolve(r(t, null));
|
|
13
|
+
if (!o) throw new a();
|
|
14
|
+
let s = n(() => i(o.entries.value));
|
|
14
15
|
return {
|
|
15
|
-
open:
|
|
16
|
-
close:
|
|
17
|
-
isOpen:
|
|
18
|
-
update:
|
|
19
|
-
closeTop:
|
|
16
|
+
open: o.open,
|
|
17
|
+
close: o.close,
|
|
18
|
+
isOpen: o.isOpen,
|
|
19
|
+
update: o.update,
|
|
20
|
+
closeTop: o.closeTop,
|
|
20
21
|
get stackSize() {
|
|
21
|
-
return
|
|
22
|
+
return s.value;
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
//#endregion
|
|
26
|
-
export {
|
|
27
|
+
export { a as BridgeDialogHostMissingError, o as useDialogAction };
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import e from "../../Components/Drawer/Drawer.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { drawerActionHosts as t, registerActionHost as n } from "../actionHostRegistry.js";
|
|
3
|
+
import { BRIDGE_DRAWER_INJECTION_KEY as r } from "./bridgeDrawerInjectionKey.js";
|
|
4
|
+
import { createBridgeDrawerApi as i } from "./createBridgeDrawerApi.js";
|
|
5
|
+
import { Fragment as a, computed as o, createBlock as s, createElementBlock as c, defineComponent as l, inject as u, mergeProps as d, openBlock as f, provide as p, renderList as m, renderSlot as h, resolveDynamicComponent as g, unref as _, withCtx as v } from "vue";
|
|
6
|
+
import { completeLayerHide as y, invokeLayerDismiss as b, mergeLayerShellProps as x } from "@bridge-ui/core/Layer";
|
|
6
7
|
//#region src/Actions/Drawer/BridgeDrawerHost.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var
|
|
8
|
+
var S = "[Bridge UI] Nested <BridgeDrawerHost /> detected. useDrawerAction() will target the nearest host only. Remove the extra host.", C = /*@__PURE__*/ l({
|
|
8
9
|
__name: "BridgeDrawerHost",
|
|
9
10
|
props: { drawer: {} },
|
|
10
|
-
setup(
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
|
|
11
|
+
setup(l) {
|
|
12
|
+
let C = l;
|
|
13
|
+
u(r, null) && process.env.NODE_ENV !== "production" && console.warn(S);
|
|
14
|
+
let w = i();
|
|
15
|
+
n(t, w);
|
|
16
|
+
let T = o(() => w.entries.value);
|
|
17
|
+
return p(r, w), (t, n) => (f(), c(a, null, [h(t.$slots, "default"), (f(!0), c(a, null, m(T.value, (t) => (f(), s(_(e), d({
|
|
15
18
|
key: t.id,
|
|
16
19
|
"stack-id": t.id,
|
|
17
20
|
"model-value": t.show,
|
|
18
|
-
"onUpdate:modelValue": (e) =>
|
|
19
|
-
}, { ref_for: !0 },
|
|
20
|
-
onClose: (e) =>
|
|
21
|
-
onShowChange: (e) =>
|
|
21
|
+
"onUpdate:modelValue": (e) => _(w).syncShow(t.id, e)
|
|
22
|
+
}, { ref_for: !0 }, _(x)(C.drawer, t.drawer), {
|
|
23
|
+
onClose: (e) => _(b)(_(w).entries.value, t.id),
|
|
24
|
+
onShowChange: (e) => _(y)(_(w).entries.value, t.id, e, _(w).removeEntry)
|
|
22
25
|
}), {
|
|
23
|
-
default:
|
|
26
|
+
default: v(() => [(f(), s(g(t.component), d({ ref_for: !0 }, t.props), null, 16))]),
|
|
24
27
|
_: 2
|
|
25
28
|
}, 1040, [
|
|
26
29
|
"stack-id",
|
|
@@ -32,4 +35,4 @@ var b = "[Bridge UI] Nested <BridgeDrawerHost /> detected. useDrawerAction() wil
|
|
|
32
35
|
}
|
|
33
36
|
});
|
|
34
37
|
//#endregion
|
|
35
|
-
export {
|
|
38
|
+
export { C as default };
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { drawerActionHosts as e } from "../actionHostRegistry.js";
|
|
2
|
+
import { BRIDGE_DRAWER_INJECTION_KEY as t } from "./bridgeDrawerInjectionKey.js";
|
|
3
|
+
import { computed as n, inject as r } from "vue";
|
|
4
|
+
import { getLayerCount as i } from "@bridge-ui/core/Layer";
|
|
4
5
|
//#region src/Actions/Drawer/useDrawerAction.ts
|
|
5
|
-
var
|
|
6
|
+
var a = class extends Error {
|
|
6
7
|
constructor() {
|
|
7
8
|
super("useDrawerAction() requires <BridgeDrawerHost /> in the app tree."), this.name = "BridgeDrawerHostMissingError";
|
|
8
9
|
}
|
|
9
10
|
};
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
if (!
|
|
13
|
-
let
|
|
11
|
+
function o() {
|
|
12
|
+
let o = e.resolve(r(t, null));
|
|
13
|
+
if (!o) throw new a();
|
|
14
|
+
let s = n(() => i(o.entries.value));
|
|
14
15
|
return {
|
|
15
|
-
open:
|
|
16
|
-
close:
|
|
17
|
-
isOpen:
|
|
18
|
-
update:
|
|
19
|
-
closeTop:
|
|
16
|
+
open: o.open,
|
|
17
|
+
close: o.close,
|
|
18
|
+
isOpen: o.isOpen,
|
|
19
|
+
update: o.update,
|
|
20
|
+
closeTop: o.closeTop,
|
|
20
21
|
get stackSize() {
|
|
21
|
-
return
|
|
22
|
+
return s.value;
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
//#endregion
|
|
26
|
-
export {
|
|
27
|
+
export { a as BridgeDrawerHostMissingError, o as useDrawerAction };
|
|
@@ -1,26 +1,29 @@
|
|
|
1
1
|
import e from "../../Components/Modal/Modal.js";
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
2
|
+
import { modalActionHosts as t, registerActionHost as n } from "../actionHostRegistry.js";
|
|
3
|
+
import { BRIDGE_MODAL_INJECTION_KEY as r } from "./bridgeModalInjectionKey.js";
|
|
4
|
+
import { createBridgeModalApi as i } from "./createBridgeModalApi.js";
|
|
5
|
+
import { Fragment as a, computed as o, createBlock as s, createElementBlock as c, defineComponent as l, inject as u, mergeProps as d, openBlock as f, provide as p, renderList as m, renderSlot as h, resolveDynamicComponent as g, unref as _, withCtx as v } from "vue";
|
|
6
|
+
import { completeLayerHide as y, invokeLayerDismiss as b, mergeLayerShellProps as x } from "@bridge-ui/core/Layer";
|
|
6
7
|
//#region src/Actions/Modal/BridgeModalHost.vue?vue&type=script&setup=true&lang.ts
|
|
7
|
-
var
|
|
8
|
+
var S = "[Bridge UI] Nested <BridgeModalHost /> detected. useModalAction() will target the nearest host only. Remove the extra host.", C = /*@__PURE__*/ l({
|
|
8
9
|
__name: "BridgeModalHost",
|
|
9
10
|
props: { modal: {} },
|
|
10
|
-
setup(
|
|
11
|
-
let
|
|
12
|
-
|
|
13
|
-
let
|
|
14
|
-
|
|
11
|
+
setup(l) {
|
|
12
|
+
let C = l;
|
|
13
|
+
u(r, null) && process.env.NODE_ENV !== "production" && console.warn(S);
|
|
14
|
+
let w = i();
|
|
15
|
+
n(t, w);
|
|
16
|
+
let T = o(() => w.entries.value);
|
|
17
|
+
return p(r, w), (t, n) => (f(), c(a, null, [h(t.$slots, "default"), (f(!0), c(a, null, m(T.value, (t) => (f(), s(_(e), d({
|
|
15
18
|
key: t.id,
|
|
16
19
|
"stack-id": t.id,
|
|
17
20
|
"model-value": t.show
|
|
18
|
-
}, { ref_for: !0 },
|
|
19
|
-
"onUpdate:modelValue": (e) =>
|
|
20
|
-
onClose: (e) =>
|
|
21
|
-
onShowChange: (e) =>
|
|
21
|
+
}, { ref_for: !0 }, _(x)(C.modal, t.modal), {
|
|
22
|
+
"onUpdate:modelValue": (e) => _(w).syncShow(t.id, e),
|
|
23
|
+
onClose: (e) => _(b)(_(w).entries.value, t.id),
|
|
24
|
+
onShowChange: (e) => _(y)(_(w).entries.value, t.id, e, _(w).removeEntry)
|
|
22
25
|
}), {
|
|
23
|
-
default:
|
|
26
|
+
default: v(() => [(f(), s(g(t.component), d({ ref_for: !0 }, t.props), null, 16))]),
|
|
24
27
|
_: 2
|
|
25
28
|
}, 1040, [
|
|
26
29
|
"stack-id",
|
|
@@ -32,4 +35,4 @@ var b = "[Bridge UI] Nested <BridgeModalHost /> detected. useModalAction() will
|
|
|
32
35
|
}
|
|
33
36
|
});
|
|
34
37
|
//#endregion
|
|
35
|
-
export {
|
|
38
|
+
export { C as default };
|
|
@@ -1,26 +1,27 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { modalActionHosts as e } from "../actionHostRegistry.js";
|
|
2
|
+
import { BRIDGE_MODAL_INJECTION_KEY as t } from "./bridgeModalInjectionKey.js";
|
|
3
|
+
import { computed as n, inject as r } from "vue";
|
|
4
|
+
import { getLayerCount as i } from "@bridge-ui/core/Layer";
|
|
4
5
|
//#region src/Actions/Modal/useModalAction.ts
|
|
5
|
-
var
|
|
6
|
+
var a = class extends Error {
|
|
6
7
|
constructor() {
|
|
7
8
|
super("useModalAction() requires <BridgeModalHost /> in the app tree."), this.name = "BridgeModalHostMissingError";
|
|
8
9
|
}
|
|
9
10
|
};
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
if (!
|
|
13
|
-
let
|
|
11
|
+
function o() {
|
|
12
|
+
let o = e.resolve(r(t, null));
|
|
13
|
+
if (!o) throw new a();
|
|
14
|
+
let s = n(() => i(o.entries.value));
|
|
14
15
|
return {
|
|
15
|
-
open:
|
|
16
|
-
close:
|
|
17
|
-
isOpen:
|
|
18
|
-
update:
|
|
19
|
-
closeTop:
|
|
16
|
+
open: o.open,
|
|
17
|
+
close: o.close,
|
|
18
|
+
isOpen: o.isOpen,
|
|
19
|
+
update: o.update,
|
|
20
|
+
closeTop: o.closeTop,
|
|
20
21
|
get stackSize() {
|
|
21
|
-
return
|
|
22
|
+
return s.value;
|
|
22
23
|
}
|
|
23
24
|
};
|
|
24
25
|
}
|
|
25
26
|
//#endregion
|
|
26
|
-
export {
|
|
27
|
+
export { a as BridgeModalHostMissingError, o as useModalAction };
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { useBridgeUI as e } from "../../Provider/useBridgeUI.js";
|
|
2
|
-
import {
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
2
|
+
import { registerActionHost as t, snackbarActionHosts as n } from "../actionHostRegistry.js";
|
|
3
|
+
import { BRIDGE_SNACKBAR_INJECTION_KEY as r } from "./bridgeSnackbarInjectionKey.js";
|
|
4
|
+
import i from "./BridgeSnackbarItem.js";
|
|
5
|
+
import { createBridgeSnackbarApi as a } from "./createBridgeSnackbarApi.js";
|
|
6
|
+
import { Fragment as o, Teleport as s, computed as c, createBlock as l, createElementBlock as u, createElementVNode as d, defineComponent as f, inject as p, normalizeClass as m, openBlock as h, provide as g, renderList as _, renderSlot as v, unref as y } from "vue";
|
|
7
|
+
import { get as b } from "es-toolkit/compat";
|
|
8
|
+
import { snackbarPositionProps as x } from "@bridge-ui/core/Tokens";
|
|
9
|
+
import { cn as S, mergeBridgeUILayeredClasses as C } from "@bridge-ui/core/Utils";
|
|
9
10
|
//#region src/Actions/Snackbar/BridgeSnackbarHost.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var
|
|
11
|
+
var w = "[Bridge UI] Nested <BridgeSnackbarHost /> detected. useSnackbarAction() will target the nearest host only. Remove the extra host.", T = /*@__PURE__*/ f({
|
|
11
12
|
__name: "BridgeSnackbarHost",
|
|
12
13
|
props: {
|
|
13
14
|
max: {},
|
|
@@ -19,35 +20,37 @@ var S = "[Bridge UI] Nested <BridgeSnackbarHost /> detected. useSnackbarAction()
|
|
|
19
20
|
},
|
|
20
21
|
timeout: { type: [Boolean, Number] }
|
|
21
22
|
},
|
|
22
|
-
setup(
|
|
23
|
-
let
|
|
24
|
-
|
|
25
|
-
let
|
|
26
|
-
max:
|
|
27
|
-
timeout:
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
let
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
23
|
+
setup(f) {
|
|
24
|
+
let T = f;
|
|
25
|
+
p(r, null) && process.env.NODE_ENV !== "production" && console.warn(w);
|
|
26
|
+
let E = a({
|
|
27
|
+
max: T.max,
|
|
28
|
+
timeout: T.timeout
|
|
29
|
+
});
|
|
30
|
+
t(n, E);
|
|
31
|
+
let D = e();
|
|
32
|
+
g(r, E);
|
|
33
|
+
let O = c(() => E.entries.value), k = c(() => D?.components.value.Snackbar), A = c(() => T.position ?? k.value?.defaultProps?.position ?? "bottom-center"), j = c(() => {
|
|
34
|
+
let e = C(x, k.value?.tokens?.position);
|
|
35
|
+
return b(e, A.value);
|
|
36
|
+
}), M = c(() => T.teleportTo === !1), N = c(() => T.teleportTo === !1 ? "body" : T.teleportTo), P = c(() => A.value.startsWith("top") ? "flex-col" : "flex-col-reverse");
|
|
37
|
+
return (e, t) => (h(), u(o, null, [v(e.$slots, "default"), (h(), l(s, {
|
|
38
|
+
to: N.value,
|
|
39
|
+
disabled: M.value
|
|
40
|
+
}, [d("div", {
|
|
38
41
|
"data-snackbar-host": "",
|
|
39
|
-
class:
|
|
42
|
+
class: m(y(S)({
|
|
40
43
|
"fixed inset-0 z-40 flex pointer-events-none px-4 py-6 sm:p-5 sm:pt-4": !0,
|
|
41
|
-
[
|
|
44
|
+
[j.value ?? ""]: !0
|
|
42
45
|
}))
|
|
43
|
-
}, [
|
|
46
|
+
}, [d("div", { class: m(y(S)({
|
|
44
47
|
"flex w-full max-w-sm gap-y-2 pointer-events-auto": !0,
|
|
45
|
-
[
|
|
46
|
-
})) }, [(
|
|
47
|
-
api:
|
|
48
|
+
[P.value]: !0
|
|
49
|
+
})) }, [(h(!0), u(o, null, _(O.value, (e) => (h(), l(i, {
|
|
50
|
+
api: y(E),
|
|
48
51
|
entry: e,
|
|
49
52
|
key: e.id,
|
|
50
|
-
"host-snackbar":
|
|
53
|
+
"host-snackbar": T.snackbar
|
|
51
54
|
}, null, 8, [
|
|
52
55
|
"api",
|
|
53
56
|
"entry",
|
|
@@ -56,4 +59,4 @@ var S = "[Bridge UI] Nested <BridgeSnackbarHost /> detected. useSnackbarAction()
|
|
|
56
59
|
}
|
|
57
60
|
});
|
|
58
61
|
//#endregion
|
|
59
|
-
export {
|
|
62
|
+
export { T as default };
|
|
@@ -28,8 +28,7 @@ var y = { class: "flex flex-col border-l border-dark-200 dark:border-dark-700" }
|
|
|
28
28
|
"model-value": l.entry.show,
|
|
29
29
|
onClose: O,
|
|
30
30
|
"onUpdate:modelValue": g[5] ||= (e) => l.api.syncShow(l.entry.id, e),
|
|
31
|
-
onLeaveComplete: g[6] ||= () => p(h)(l.api.entries.value, l.entry.id, !1, l.api.removeEntry)
|
|
32
|
-
onShowChange: g[7] ||= (e) => p(h)(l.api.entries.value, l.entry.id, e, l.api.removeEntry)
|
|
31
|
+
onLeaveComplete: g[6] ||= () => p(h)(l.api.entries.value, l.entry.id, !1, l.api.removeEntry)
|
|
33
32
|
}), s({ _: 2 }, [
|
|
34
33
|
M.value ? {
|
|
35
34
|
name: "actions",
|
|
@@ -1,27 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
1
|
+
import { snackbarActionHosts as e } from "../actionHostRegistry.js";
|
|
2
|
+
import { BRIDGE_SNACKBAR_INJECTION_KEY as t } from "./bridgeSnackbarInjectionKey.js";
|
|
3
|
+
import { computed as n, inject as r } from "vue";
|
|
4
|
+
import { getLayerCount as i } from "@bridge-ui/core/Layer";
|
|
4
5
|
//#region src/Actions/Snackbar/useSnackbarAction.ts
|
|
5
|
-
var
|
|
6
|
+
var a = class extends Error {
|
|
6
7
|
constructor() {
|
|
7
8
|
super("useSnackbarAction() requires <BridgeSnackbarHost /> in the app tree."), this.name = "BridgeSnackbarHostMissingError";
|
|
8
9
|
}
|
|
9
10
|
};
|
|
10
|
-
function
|
|
11
|
-
let
|
|
12
|
-
if (!
|
|
13
|
-
let
|
|
11
|
+
function o() {
|
|
12
|
+
let o = e.resolve(r(t, null));
|
|
13
|
+
if (!o) throw new a();
|
|
14
|
+
let s = n(() => i(o.entries.value));
|
|
14
15
|
return {
|
|
15
|
-
open:
|
|
16
|
-
close:
|
|
17
|
-
isOpen:
|
|
18
|
-
update:
|
|
19
|
-
closeTop:
|
|
20
|
-
closeAll:
|
|
16
|
+
open: o.open,
|
|
17
|
+
close: o.close,
|
|
18
|
+
isOpen: o.isOpen,
|
|
19
|
+
update: o.update,
|
|
20
|
+
closeTop: o.closeTop,
|
|
21
|
+
closeAll: o.closeAll,
|
|
21
22
|
get stackSize() {
|
|
22
|
-
return
|
|
23
|
+
return s.value;
|
|
23
24
|
}
|
|
24
25
|
};
|
|
25
26
|
}
|
|
26
27
|
//#endregion
|
|
27
|
-
export {
|
|
28
|
+
export { a as BridgeSnackbarHostMissingError, o as useSnackbarAction };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { ActionHostRegistry } from '@bridge-ui/core/Layer';
|
|
2
|
+
import { BridgeDialogController } from './Dialog/bridgeDialog.types';
|
|
3
|
+
import { BridgeDrawerController } from './Drawer/bridgeDrawer.types';
|
|
4
|
+
import { BridgeModalController } from './Modal/bridgeModal.types';
|
|
5
|
+
import { BridgeSnackbarController } from './Snackbar/bridgeSnackbar.types';
|
|
6
|
+
export declare const dialogActionHosts: ActionHostRegistry<BridgeDialogController>;
|
|
7
|
+
export declare const drawerActionHosts: ActionHostRegistry<BridgeDrawerController>;
|
|
8
|
+
export declare const modalActionHosts: ActionHostRegistry<BridgeModalController>;
|
|
9
|
+
export declare const snackbarActionHosts: ActionHostRegistry<BridgeSnackbarController>;
|
|
10
|
+
/**
|
|
11
|
+
* Registers `api` until the current component unmounts.
|
|
12
|
+
*/
|
|
13
|
+
export declare function registerActionHost<T>(registry: ActionHostRegistry<T>, api: T): void;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { onUnmounted as e } from "vue";
|
|
2
|
+
import { createActionHostRegistry as t } from "@bridge-ui/core/Layer";
|
|
3
|
+
//#region src/Actions/actionHostRegistry.ts
|
|
4
|
+
var n = t(), r = t(), i = t(), a = t();
|
|
5
|
+
function o(t, n) {
|
|
6
|
+
let r = t.register(n);
|
|
7
|
+
e(r);
|
|
8
|
+
}
|
|
9
|
+
//#endregion
|
|
10
|
+
export { n as dialogActionHosts, r as drawerActionHosts, i as modalActionHosts, o as registerActionHost, a as snackbarActionHosts };
|
|
@@ -744,6 +744,7 @@ export declare function useAutocomplete(props: AutocompleteOwnProps, model: Ref<
|
|
|
744
744
|
listboxId: string;
|
|
745
745
|
loading: boolean;
|
|
746
746
|
loadingMessage: string;
|
|
747
|
+
matchWidth?: boolean;
|
|
747
748
|
maxHeight: string;
|
|
748
749
|
multiple: boolean;
|
|
749
750
|
options: import('@bridge-ui/core/Domain').ListboxOption[];
|
|
@@ -27,8 +27,8 @@ var _e = { class: "min-w-0 flex-1" }, ve = { class: "flex shrink-0 items-center
|
|
|
27
27
|
class: "inline-flex items-center rounded-lg border border-dark-200 bg-white p-0.5 dark:border-dark-700 dark:bg-dark-900"
|
|
28
28
|
}, be = { class: "relative" }, xe = {
|
|
29
29
|
key: 1,
|
|
30
|
-
class: "flex w-full min-w-0 items-center gap-1.5
|
|
31
|
-
}, O = { class: "min-w-0 truncate leading-
|
|
30
|
+
class: "flex w-full min-w-0 items-center gap-1.5"
|
|
31
|
+
}, O = { class: "min-w-0 truncate leading-normal" }, k = [
|
|
32
32
|
"aria-expanded",
|
|
33
33
|
"aria-label",
|
|
34
34
|
"onClick"
|
|
@@ -177,15 +177,9 @@ var _e = { class: "min-w-0 flex-1" }, ve = { class: "flex shrink-0 items-center
|
|
|
177
177
|
return {
|
|
178
178
|
...e,
|
|
179
179
|
listbox: {
|
|
180
|
+
matchWidth: !0,
|
|
180
181
|
showCheckmark: !1,
|
|
181
|
-
...e?.listbox
|
|
182
|
-
customProps: {
|
|
183
|
-
...e?.listbox?.customProps,
|
|
184
|
-
menu: {
|
|
185
|
-
matchWidth: !0,
|
|
186
|
-
...e?.listbox?.customProps?.menu
|
|
187
|
-
}
|
|
188
|
-
}
|
|
182
|
+
...e?.listbox
|
|
189
183
|
}
|
|
190
184
|
};
|
|
191
185
|
}), gt = he(), $ = (e) => e.node ?? null;
|
|
@@ -88,11 +88,10 @@ function S(S, C, w) {
|
|
|
88
88
|
[M.value?.mergedClasses.optionHighlighted ?? ""]: F.value && R.value && !I.value,
|
|
89
89
|
"opacity-50 pointer-events-none": A.value.disabled,
|
|
90
90
|
[m(B.value, "interactive") ?? ""]: !0,
|
|
91
|
-
[M.value?.sizeClasses?.option ?? ""]: F.value
|
|
92
|
-
"leading-none": !0
|
|
91
|
+
[M.value?.sizeClasses?.option ?? ""]: F.value
|
|
93
92
|
})
|
|
94
93
|
}) : null), X = s(() => y({
|
|
95
|
-
"flex w-full min-w-0 items-center gap-x-2
|
|
94
|
+
"flex w-full min-w-0 items-center gap-x-2": !0,
|
|
96
95
|
"rounded-md text-dark-900 dark:text-dark-100": !J.value,
|
|
97
96
|
"px-2": !J.value,
|
|
98
97
|
"py-1.5": !J.value && !V.value,
|
|
@@ -107,9 +106,9 @@ function S(S, C, w) {
|
|
|
107
106
|
"block truncate text-sm font-medium": !0,
|
|
108
107
|
[M.value?.sizeClasses?.primary ?? ""]: F.value,
|
|
109
108
|
[m(B.value, "primary") ?? ""]: !0,
|
|
110
|
-
"leading-
|
|
109
|
+
"leading-normal": !0
|
|
111
110
|
}))), ee = s(() => t(z.value?.secondary, {}, y({
|
|
112
|
-
"mt-0.5 block truncate text-xs text-dark-500 dark:text-dark-400": !0,
|
|
111
|
+
"mt-0.5 block truncate text-xs leading-normal text-dark-500 dark:text-dark-400": !0,
|
|
113
112
|
[M.value?.sizeClasses?.secondary ?? ""]: F.value,
|
|
114
113
|
[m(B.value, "secondary") ?? ""]: !0
|
|
115
114
|
})));
|
|
@@ -2,21 +2,21 @@ import { useResolveMessage as e } from "../../Adapters/I18n/useI18nAdapter.js";
|
|
|
2
2
|
import { hasNamedSlot as t } from "../../Utils/slotOrProp.js";
|
|
3
3
|
import { mergeNestedComponentProps as n } from "../../Utils/index.js";
|
|
4
4
|
import ee from "../ActionFooter/ActionFooter.js";
|
|
5
|
-
import { useListbox as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { LISTBOX_INJECTION_KEY as
|
|
9
|
-
import
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import { Fragment as
|
|
13
|
-
import { isNil as
|
|
14
|
-
import { entriesFromListboxOptions as
|
|
5
|
+
import { useListbox as te } from "./composables/useListbox.js";
|
|
6
|
+
import r from "../FieldOverlay/FieldOverlay.js";
|
|
7
|
+
import i from "../List/List.js";
|
|
8
|
+
import { LISTBOX_INJECTION_KEY as a } from "./listboxInjectionKey.js";
|
|
9
|
+
import ne from "../ListItem/ListItem.js";
|
|
10
|
+
import re from "../ListSection/ListSection.js";
|
|
11
|
+
import ie from "../Progress/Progress.js";
|
|
12
|
+
import { Fragment as o, computed as s, createBlock as c, createCommentVNode as l, createElementBlock as u, createElementVNode as d, createSlots as ae, createVNode as f, defineComponent as p, guardReactiveProps as m, mergeModels as h, mergeProps as g, normalizeClass as _, normalizeProps as v, openBlock as y, provide as b, ref as x, renderList as S, renderSlot as C, toDisplayString as w, unref as T, useModel as oe, useSlots as se, watch as E, withCtx as D } from "vue";
|
|
13
|
+
import { isNil as O } from "es-toolkit/compat";
|
|
14
|
+
import { entriesFromListboxOptions as ce, flattenListboxOptions as le, mapListboxEntriesToRows as ue, upsertListboxOption as k } from "@bridge-ui/core/Domain";
|
|
15
15
|
import { cn as A } from "@bridge-ui/core/Utils";
|
|
16
16
|
//#region src/Components/Listbox/Listbox.vue?vue&type=script&setup=true&lang.ts
|
|
17
|
-
var j = { key: 1 }, M = /*@__PURE__*/
|
|
17
|
+
var j = { key: 1 }, M = /*@__PURE__*/ p({
|
|
18
18
|
__name: "Listbox",
|
|
19
|
-
props: /*@__PURE__*/
|
|
19
|
+
props: /*@__PURE__*/ h({
|
|
20
20
|
anchorEl: {},
|
|
21
21
|
classes: {},
|
|
22
22
|
color: { default: "primary" },
|
|
@@ -42,6 +42,7 @@ var j = { key: 1 }, M = /*@__PURE__*/ m({
|
|
|
42
42
|
default: !1
|
|
43
43
|
},
|
|
44
44
|
loadingMessage: {},
|
|
45
|
+
matchWidth: { type: Boolean },
|
|
45
46
|
maxHeight: {},
|
|
46
47
|
multiple: {
|
|
47
48
|
type: Boolean,
|
|
@@ -67,22 +68,22 @@ var j = { key: 1 }, M = /*@__PURE__*/ m({
|
|
|
67
68
|
},
|
|
68
69
|
modelModifiers: {}
|
|
69
70
|
}),
|
|
70
|
-
emits: /*@__PURE__*/
|
|
71
|
+
emits: /*@__PURE__*/ h([
|
|
71
72
|
"apply",
|
|
72
73
|
"cancel",
|
|
73
74
|
"registered-options-change",
|
|
74
75
|
"select",
|
|
75
76
|
"show-change"
|
|
76
77
|
], ["update:modelValue"]),
|
|
77
|
-
setup(
|
|
78
|
-
let M = se(), N =
|
|
78
|
+
setup(p, { emit: h }) {
|
|
79
|
+
let M = se(), N = h, P = oe(p, "modelValue");
|
|
79
80
|
E(P, (e) => {
|
|
80
81
|
N("show-change", e);
|
|
81
82
|
});
|
|
82
|
-
let F =
|
|
83
|
+
let F = p, I = e(), L = s(() => F.emptyMessage ?? I("No options")), R = s(() => F.loadingMessage ?? I("Loading...")), { merged: z, checkClass: B, scrollBind: V, footerBind: H, showFooter: U, messageBind: W, surfaceBind: de, sizeClasses: fe, mergedClasses: G, applyButtonProps: pe, optionHoverClass: me, cancelButtonProps: he, optionSelectedClass: ge, optionHighlightedClass: _e } = te(F, {
|
|
83
84
|
size: "md",
|
|
84
85
|
color: "primary"
|
|
85
|
-
}), ve =
|
|
86
|
+
}), ve = s(() => F.options ?? []), K = s(() => F.entries ? F.entries : ce(ve.value)), q = s(() => le(K.value)), J = s(() => t(M, "default")), Y = s(() => !F.loading && !J.value && q.value.length === 0 && F.hideEmptyMessage !== !0), ye = s(() => A(B.value, G.value.check)), X = x([]);
|
|
86
87
|
function Z(e) {
|
|
87
88
|
return F.isSelected?.(e) ?? !1;
|
|
88
89
|
}
|
|
@@ -101,7 +102,7 @@ var j = { key: 1 }, M = /*@__PURE__*/ m({
|
|
|
101
102
|
E(X, (e) => {
|
|
102
103
|
J.value && N("registered-options-change", e);
|
|
103
104
|
}, { deep: !0 });
|
|
104
|
-
let Ce =
|
|
105
|
+
let Ce = s(() => ({
|
|
105
106
|
getOptionIndex: Se,
|
|
106
107
|
registerOption: xe,
|
|
107
108
|
onSelect: be,
|
|
@@ -120,18 +121,19 @@ var j = { key: 1 }, M = /*@__PURE__*/ m({
|
|
|
120
121
|
optionHighlighted: G.value.optionHighlighted
|
|
121
122
|
}
|
|
122
123
|
}));
|
|
123
|
-
|
|
124
|
-
let we =
|
|
124
|
+
b(a, Ce);
|
|
125
|
+
let we = s(() => ue(K.value, Z)), Te = s(() => z.value.customProps?.menu), Ee = s(() => z.value.customProps?.modal), De = s(() => z.value.customProps?.drawer), Oe = s(() => z.value.customProps?.list), ke = s(() => z.value.customProps?.listItem), Ae = s(() => z.value.customProps?.progress), je = s(() => z.value.customProps?.listSection), Me = s(() => ({
|
|
125
126
|
modal: Ee.value,
|
|
126
127
|
drawer: De.value,
|
|
127
128
|
menu: {
|
|
128
129
|
anchorEl: F.anchorEl,
|
|
129
130
|
placement: F.placement,
|
|
130
131
|
disableAutoFocus: F.disableAutoFocus,
|
|
131
|
-
...
|
|
132
|
+
...O(F.rounded) ? {} : { rounded: F.rounded },
|
|
133
|
+
...O(z.value.matchWidth) ? {} : { matchWidth: z.value.matchWidth },
|
|
132
134
|
...Te.value
|
|
133
135
|
}
|
|
134
|
-
})), Ne =
|
|
136
|
+
})), Ne = s(() => ({
|
|
135
137
|
size: "xs",
|
|
136
138
|
"aria-hidden": !0,
|
|
137
139
|
color: z.value.color,
|
|
@@ -139,7 +141,7 @@ var j = { key: 1 }, M = /*@__PURE__*/ m({
|
|
|
139
141
|
class: "shrink-0",
|
|
140
142
|
classes: { bar: G.value.loading }
|
|
141
143
|
})
|
|
142
|
-
})), Pe =
|
|
144
|
+
})), Pe = s(() => ({
|
|
143
145
|
role: "listbox",
|
|
144
146
|
id: F.listboxId,
|
|
145
147
|
"aria-labelledby": F.labelledBy,
|
|
@@ -152,27 +154,27 @@ var j = { key: 1 }, M = /*@__PURE__*/ m({
|
|
|
152
154
|
function $() {
|
|
153
155
|
N("cancel"), P.value = !1;
|
|
154
156
|
}
|
|
155
|
-
return (e, n) => (
|
|
157
|
+
return (e, n) => (y(), c(T(r), {
|
|
156
158
|
modelValue: P.value,
|
|
157
159
|
"onUpdate:modelValue": n[0] ||= (e) => P.value = e,
|
|
158
|
-
overlay:
|
|
160
|
+
overlay: p.overlay,
|
|
159
161
|
"custom-props": Me.value
|
|
160
162
|
}, {
|
|
161
|
-
default: D(() => [
|
|
162
|
-
T(t)(T(M), "beforeOptions") ? C(e.$slots, "beforeOptions", {}, void 0, void 0, 0) :
|
|
163
|
-
|
|
164
|
-
default: D(() => [J.value ? C(e.$slots, "default", {}, void 0, void 0, 0) : (
|
|
163
|
+
default: D(() => [d("div", { class: _(T(de)) }, [
|
|
164
|
+
T(t)(T(M), "beforeOptions") ? C(e.$slots, "beforeOptions", {}, void 0, void 0, 0) : l("", !0),
|
|
165
|
+
p.loading ? (y(), u(o, { key: 1 }, [f(T(ie), v(m(Ne.value)), null, 16), d("div", v(m(T(W))), [T(t)(T(M), "loading") ? C(e.$slots, "loading", {}, void 0, void 0, 0) : (y(), u("span", j, w(R.value), 1))], 16)], 64)) : (y(), u("div", v(g({ key: 2 }, T(V))), [f(T(i), v(m(Pe.value)), {
|
|
166
|
+
default: D(() => [J.value ? C(e.$slots, "default", {}, void 0, void 0, 0) : (y(!0), u(o, { key: 1 }, S(we.value, (n) => (y(), u(o, { key: n.key }, [n.kind === "section" ? (y(), c(T(re), g({
|
|
165
167
|
key: 0,
|
|
166
168
|
title: n.title,
|
|
167
169
|
sticky: n.sticky
|
|
168
|
-
}, { ref_for: !0 }, je.value), null, 16, ["title", "sticky"])) : (
|
|
170
|
+
}, { ref_for: !0 }, je.value), null, 16, ["title", "sticky"])) : (y(), c(T(ne), g({
|
|
169
171
|
key: 1,
|
|
170
172
|
interactive: "",
|
|
171
173
|
value: n.option.value,
|
|
172
174
|
disabled: n.option.disabled,
|
|
173
175
|
secondary: n.option.description,
|
|
174
176
|
primary: T(t)(T(M), "option") ? void 0 : n.option.label
|
|
175
|
-
}, { ref_for: !0 }, ke.value),
|
|
177
|
+
}, { ref_for: !0 }, ke.value), ae({ _: 2 }, [T(t)(T(M), "option") ? {
|
|
176
178
|
name: "default",
|
|
177
179
|
fn: D(() => [C(e.$slots, "option", {
|
|
178
180
|
option: n.option,
|
|
@@ -187,19 +189,19 @@ var j = { key: 1 }, M = /*@__PURE__*/ m({
|
|
|
187
189
|
]))], 64))), 128))]),
|
|
188
190
|
_: 3
|
|
189
191
|
}, 16)], 16)),
|
|
190
|
-
Y.value && !T(t)(T(M), "empty") ? (
|
|
191
|
-
T(t)(T(M), "afterOptions") ? C(e.$slots, "afterOptions", {}, void 0, void 0, 5) :
|
|
192
|
-
T(U) ? (
|
|
192
|
+
Y.value && !T(t)(T(M), "empty") ? (y(), u("div", v(g({ key: 3 }, T(W))), w(L.value), 17)) : Y.value && T(t)(T(M), "empty") ? C(e.$slots, "empty", {}, void 0, void 0, 4) : l("", !0),
|
|
193
|
+
T(t)(T(M), "afterOptions") ? C(e.$slots, "afterOptions", {}, void 0, void 0, 5) : l("", !0),
|
|
194
|
+
T(U) ? (y(), u("div", v(g({ key: 6 }, T(H))), [C(e.$slots, "footer", {
|
|
193
195
|
apply: Q,
|
|
194
196
|
cancel: $
|
|
195
|
-
}, () => [
|
|
197
|
+
}, () => [f(T(ee), {
|
|
196
198
|
onApply: Q,
|
|
197
199
|
onCancel: $,
|
|
198
200
|
"custom-props": {
|
|
199
201
|
applyButton: T(pe),
|
|
200
202
|
cancelButton: T(he)
|
|
201
203
|
}
|
|
202
|
-
}, null, 8, ["custom-props"])])], 16)) :
|
|
204
|
+
}, null, 8, ["custom-props"])])], 16)) : l("", !0)
|
|
203
205
|
], 2)]),
|
|
204
206
|
_: 3
|
|
205
207
|
}, 8, [
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { LibDefaultsShape, MergeLibDefaults } from '@bridge-ui/core/Utils';
|
|
2
2
|
import { ListboxClasses, ListboxOwnProps } from '../listbox.types';
|
|
3
|
-
export declare const listboxBridgeKeys: readonly ["size", "color", "error", "classes", "maxHeight", "showFooter", "customProps", "disableMaxHeight"];
|
|
3
|
+
export declare const listboxBridgeKeys: readonly ["size", "color", "error", "classes", "maxHeight", "matchWidth", "showFooter", "customProps", "disableMaxHeight"];
|
|
4
4
|
type ListboxLibDefaults = LibDefaultsShape<ListboxOwnProps, "size" | "color">;
|
|
5
5
|
type ListboxMerged = MergeLibDefaults<ListboxOwnProps, ListboxLibDefaults>;
|
|
6
6
|
export declare function useListbox(props: ListboxOwnProps, libDefaults: ListboxLibDefaults): {
|
|
@@ -232,6 +232,13 @@ export interface ListboxOwnProps {
|
|
|
232
232
|
* @default "Loading..."
|
|
233
233
|
*/
|
|
234
234
|
loadingMessage?: string;
|
|
235
|
+
/**
|
|
236
|
+
* When true, the menu panel width matches the anchor (typically the field).
|
|
237
|
+
* Only applies when the overlay resolves to `menu`. Forwarded to `Menu`.
|
|
238
|
+
*
|
|
239
|
+
* @default false
|
|
240
|
+
*/
|
|
241
|
+
matchWidth?: boolean;
|
|
235
242
|
/**
|
|
236
243
|
* Tailwind max-height class for the options scroll area (e.g. `max-h-80`).
|
|
237
244
|
* Dialog overlays (`modal` / `drawer`) default to `max-h-[min(60dvh,28rem)]`
|
|
@@ -745,6 +745,7 @@ export declare function useSelect(props: SelectOwnProps, model: Ref<null | undef
|
|
|
745
745
|
listboxId: string;
|
|
746
746
|
loading: boolean;
|
|
747
747
|
loadingMessage: string;
|
|
748
|
+
matchWidth?: boolean;
|
|
748
749
|
maxHeight: string;
|
|
749
750
|
multiple: boolean;
|
|
750
751
|
options: import('@bridge-ui/core/Domain').ListboxOption[];
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { mergePartBind as e, resolveVnodeRefElement as t, useBridgeUIComponent as n, useBridgeUIMergedRegistryClasses as ee } from "../../../Utils/index.js";
|
|
2
2
|
import { snackbarDefaultIcons as r } from "../snackbarDefaultIcons.js";
|
|
3
|
-
import { computed as i, nextTick as a, onBeforeUnmount as
|
|
4
|
-
import { get as
|
|
3
|
+
import { computed as i, nextTick as a, onBeforeUnmount as o, ref as s, toValue as te, useAttrs as ne, watch as c } from "vue";
|
|
4
|
+
import { get as l, isNil as re, isNull as ie, isObject as ae, omit as oe } from "es-toolkit/compat";
|
|
5
5
|
import { snackbarColorProps as se, snackbarPaddingProps as ce, snackbarPositionProps as le, snackbarRoundedProps as ue, snackbarTransitionProps as de } from "@bridge-ui/core/Tokens";
|
|
6
|
-
import { cn as u, mergeBridgeUILayeredClasses as d, splitComponentProps as
|
|
7
|
-
import { LAYER_STACK_BASE_Z_INDEX as
|
|
6
|
+
import { cn as u, mergeBridgeUILayeredClasses as d, splitComponentProps as fe } from "@bridge-ui/core/Utils";
|
|
7
|
+
import { LAYER_STACK_BASE_Z_INDEX as f, SNACKBAR_LEAVE_FALLBACK_MS as pe, acquireLayerStackOrder as me, getLayerStackEntry as he, getSnackbarTransitionClass as ge, hasSnackbarTransition as _e, pushLayerStack as ve, resolveEffectiveSnackbarTransition as ye, subscribeLayerStack as p } from "@bridge-ui/core/Layer";
|
|
8
8
|
//#region src/Components/Snackbar/composables/useSnackbar.ts
|
|
9
|
-
var
|
|
9
|
+
var be = [
|
|
10
10
|
"img",
|
|
11
11
|
"icon",
|
|
12
12
|
"color",
|
|
@@ -24,55 +24,60 @@ var ve = [
|
|
|
24
24
|
"description",
|
|
25
25
|
"progressbar"
|
|
26
26
|
];
|
|
27
|
-
function m(m,
|
|
28
|
-
let
|
|
27
|
+
function m(m, xe, h = {}) {
|
|
28
|
+
let Se = ne(), g = s(!1), _ = s(""), v = s(1), y = s(0), b = s(!1), x = s(!1), S = s(0), C = s(!1), w = s(0), T = s(null), E = s(f), D = s("closed"), O = s(null), k = null, A = null, j = null, M = null, N = i(() => fe({
|
|
29
29
|
props: {
|
|
30
|
-
...
|
|
30
|
+
...Se,
|
|
31
31
|
...m
|
|
32
32
|
},
|
|
33
|
-
bridgeKeys:
|
|
34
|
-
})), { merged:
|
|
35
|
-
libDefaults:
|
|
33
|
+
bridgeKeys: be
|
|
34
|
+
})), { merged: P, entry: F } = n({
|
|
35
|
+
libDefaults: xe,
|
|
36
36
|
componentName: "Snackbar",
|
|
37
|
-
props: () =>
|
|
38
|
-
}),
|
|
39
|
-
entry:
|
|
40
|
-
props: () =>
|
|
41
|
-
}),
|
|
42
|
-
let e =
|
|
43
|
-
return
|
|
44
|
-
}),
|
|
45
|
-
let e = d(se,
|
|
46
|
-
return
|
|
47
|
-
}),
|
|
48
|
-
let e = d(ce,
|
|
49
|
-
return
|
|
50
|
-
}),
|
|
51
|
-
let e = d(ue,
|
|
52
|
-
return
|
|
53
|
-
}),
|
|
54
|
-
if (!
|
|
55
|
-
let e = d(le,
|
|
56
|
-
return
|
|
37
|
+
props: () => N.value.componentProps
|
|
38
|
+
}), I = i(() => P.value.customProps), L = i(() => oe(N.value.inheritedAttrs, ["onShowChange"])), R = ee({
|
|
39
|
+
entry: F,
|
|
40
|
+
props: () => N.value.componentProps
|
|
41
|
+
}), z = i(() => !re(h.show) && te(h.show)), B = i(() => {
|
|
42
|
+
let e = P.value.transition ?? "none", t = e in de ? e : "none";
|
|
43
|
+
return ye(t);
|
|
44
|
+
}), V = i(() => _e(B.value)), Ce = i(() => ge(B.value)), H = i(() => {
|
|
45
|
+
let e = d(se, F.value?.tokens?.color);
|
|
46
|
+
return l(e, P.value.color);
|
|
47
|
+
}), U = i(() => {
|
|
48
|
+
let e = d(ce, F.value?.tokens?.padding);
|
|
49
|
+
return l(e, P.value.padding);
|
|
50
|
+
}), we = i(() => {
|
|
51
|
+
let e = d(ue, F.value?.tokens?.rounded);
|
|
52
|
+
return l(e, P.value.rounded);
|
|
53
|
+
}), Te = i(() => ie(P.value.icon) ? null : P.value.icon ? P.value.icon : l(H.value, "icon") ?? l(r, P.value.color)), W = i(() => P.value.duration === !1 ? 0 : P.value.duration ?? 0), G = i(() => z.value && g.value && W.value > 0 && P.value.progressbar !== !1), K = i(() => P.value.teleportTo !== !1), Ee = i(() => {
|
|
54
|
+
if (!K.value) return "";
|
|
55
|
+
let e = d(le, F.value?.tokens?.position);
|
|
56
|
+
return l(e, P.value.position ?? "bottom-center");
|
|
57
57
|
});
|
|
58
58
|
function q() {
|
|
59
59
|
O.value &&= (clearTimeout(O.value), null);
|
|
60
60
|
}
|
|
61
|
-
function J(
|
|
62
|
-
|
|
61
|
+
function J() {
|
|
62
|
+
j !== null && (clearTimeout(j), j = null);
|
|
63
63
|
}
|
|
64
|
-
function Y() {
|
|
65
|
-
|
|
64
|
+
function Y(e) {
|
|
65
|
+
e || h.onClose?.(), ae(h.show) && "value" in h.show && (h.show.value = e), h.onShowChange?.(e);
|
|
66
66
|
}
|
|
67
67
|
function X() {
|
|
68
|
-
|
|
69
|
-
|
|
68
|
+
x.value && (x.value = !1, D.value = "closed", q(), J(), z.value ? Y(!1) : h.onLeaveComplete?.(), g.value = !1);
|
|
69
|
+
}
|
|
70
|
+
function De() {
|
|
71
|
+
if (q(), x.value = !0, !V.value) {
|
|
72
|
+
X();
|
|
70
73
|
return;
|
|
71
74
|
}
|
|
72
|
-
D.value = "closed"
|
|
75
|
+
D.value = "closed", J(), j = setTimeout(() => {
|
|
76
|
+
j = null, X();
|
|
77
|
+
}, pe);
|
|
73
78
|
}
|
|
74
|
-
function
|
|
75
|
-
if (x.value = !1, !
|
|
79
|
+
function Oe() {
|
|
80
|
+
if (x.value = !1, J(), !V.value) {
|
|
76
81
|
D.value = "open";
|
|
77
82
|
return;
|
|
78
83
|
}
|
|
@@ -83,47 +88,43 @@ function m(m, ye, h = {}) {
|
|
|
83
88
|
});
|
|
84
89
|
}
|
|
85
90
|
function Z() {
|
|
86
|
-
|
|
87
|
-
J(!1);
|
|
88
|
-
return;
|
|
89
|
-
}
|
|
90
|
-
g.value && X();
|
|
91
|
+
z.value && Y(!1);
|
|
91
92
|
}
|
|
92
93
|
function Q(e) {
|
|
93
94
|
q(), y.value = e, S.value = Date.now(), w.value = e, O.value = setTimeout(() => {
|
|
94
95
|
Z();
|
|
95
96
|
}, e);
|
|
96
97
|
}
|
|
97
|
-
function
|
|
98
|
-
!O.value ||
|
|
98
|
+
function ke() {
|
|
99
|
+
!O.value || W.value <= 0 || (q(), y.value -= Date.now() - S.value, v.value = Math.max(y.value / W.value, 0), C.value = !1, b.value = !0);
|
|
99
100
|
}
|
|
100
|
-
function
|
|
101
|
-
if (
|
|
101
|
+
function Ae() {
|
|
102
|
+
if (W.value <= 0 || !b.value) return;
|
|
102
103
|
let e = Math.max(y.value, 0);
|
|
103
104
|
b.value = !1, C.value = !1, requestAnimationFrame(() => {
|
|
104
105
|
C.value = !0;
|
|
105
106
|
}), Q(e);
|
|
106
107
|
}
|
|
107
|
-
function
|
|
108
|
-
!g.value || D.value !== "closed" || e.target === e.currentTarget && e.propertyName !== "none" && e.elapsedTime !== 0 &&
|
|
108
|
+
function je(e) {
|
|
109
|
+
!x.value || !g.value || D.value !== "closed" || e.target === e.currentTarget && e.propertyName !== "none" && e.elapsedTime !== 0 && X();
|
|
109
110
|
}
|
|
110
|
-
|
|
111
|
+
c(z, (e) => {
|
|
111
112
|
if (e) {
|
|
112
|
-
g.value = !0,
|
|
113
|
+
g.value = !0, Oe();
|
|
113
114
|
return;
|
|
114
115
|
}
|
|
115
|
-
g.value &&
|
|
116
|
-
}, { immediate: !0 }),
|
|
117
|
-
|
|
116
|
+
g.value && De();
|
|
117
|
+
}, { immediate: !0 }), c([
|
|
118
|
+
z,
|
|
118
119
|
g,
|
|
119
|
-
|
|
120
|
+
W
|
|
120
121
|
], ([e, t, n]) => {
|
|
121
122
|
if (!e || !t || n <= 0) {
|
|
122
123
|
q();
|
|
123
124
|
return;
|
|
124
125
|
}
|
|
125
126
|
b.value = !1, Q(n);
|
|
126
|
-
}, { immediate: !0 }),
|
|
127
|
+
}, { immediate: !0 }), c([W, G], ([e]) => {
|
|
127
128
|
if (!e) {
|
|
128
129
|
C.value = !1, v.value = 1;
|
|
129
130
|
return;
|
|
@@ -137,14 +138,14 @@ function m(m, ye, h = {}) {
|
|
|
137
138
|
};
|
|
138
139
|
}, { immediate: !0 });
|
|
139
140
|
function $() {
|
|
140
|
-
let e =
|
|
141
|
+
let e = he(_.value);
|
|
141
142
|
e && (E.value = e.zIndex);
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
+
function Me(e) {
|
|
144
145
|
T.value = t(e), A?.setContainer(T.value);
|
|
145
146
|
}
|
|
146
|
-
|
|
147
|
-
t && (e ? (k =
|
|
147
|
+
c([g, K], ([e, t]) => {
|
|
148
|
+
t && (e ? (k = me(), A = ve({
|
|
148
149
|
order: k,
|
|
149
150
|
lockScroll: !1,
|
|
150
151
|
id: h.stackId,
|
|
@@ -152,80 +153,80 @@ function m(m, ye, h = {}) {
|
|
|
152
153
|
onEscape: () => {
|
|
153
154
|
Z();
|
|
154
155
|
}
|
|
155
|
-
}), _.value = A.id, E.value = A.zIndex, $(),
|
|
156
|
+
}), _.value = A.id, E.value = A.zIndex, $(), M = p($), a(() => {
|
|
156
157
|
A?.setContainer(T.value);
|
|
157
|
-
})) : (
|
|
158
|
-
}, { immediate: !0 }),
|
|
159
|
-
q(),
|
|
158
|
+
})) : (M?.(), M = null, A?.release(), A = null, k = null, _.value = "", E.value = f));
|
|
159
|
+
}, { immediate: !0 }), o(() => {
|
|
160
|
+
q(), J(), M?.(), M = null, A?.release(), A = null;
|
|
160
161
|
});
|
|
161
|
-
let
|
|
162
|
+
let Ne = i(() => e(I.value?.portal, {
|
|
162
163
|
"data-snackbar-layer": !0,
|
|
163
164
|
style: { zIndex: E.value }
|
|
164
165
|
}, u({
|
|
165
166
|
"fixed inset-0 flex pointer-events-none px-4 py-6 sm:p-5 sm:pt-4": !0,
|
|
166
|
-
[
|
|
167
|
-
[
|
|
168
|
-
}))),
|
|
169
|
-
...
|
|
167
|
+
[Ee.value ?? ""]: !0,
|
|
168
|
+
[l(R.value, "portal") ?? ""]: !0
|
|
169
|
+
}))), Pe = i(() => e(I.value?.root, {
|
|
170
|
+
...L.value,
|
|
170
171
|
"data-snackbar-part": "panel",
|
|
171
|
-
onMouseenter:
|
|
172
|
-
onMouseleave:
|
|
172
|
+
onMouseenter: ke,
|
|
173
|
+
onMouseleave: Ae,
|
|
173
174
|
"data-state": D.value,
|
|
174
|
-
onTransitionend:
|
|
175
|
-
role:
|
|
176
|
-
"aria-live":
|
|
175
|
+
onTransitionend: je,
|
|
176
|
+
role: L.value.role ?? "status",
|
|
177
|
+
"aria-live": L.value["aria-live"] ?? "polite"
|
|
177
178
|
}, u({
|
|
178
179
|
"relative w-full max-w-sm overflow-hidden pointer-events-auto": !0,
|
|
179
180
|
"bg-white shadow-lg ring-1 ring-black/5": !0,
|
|
180
181
|
"dark:bg-dark-800 dark:border dark:border-dark-700": !0,
|
|
181
|
-
[
|
|
182
|
-
[
|
|
183
|
-
[
|
|
184
|
-
}))),
|
|
182
|
+
[l(we.value, "base") ?? ""]: !0,
|
|
183
|
+
[Ce.value]: V.value,
|
|
184
|
+
[l(R.value, "root") ?? ""]: !0
|
|
185
|
+
}))), Fe = i(() => e(I.value?.icon, {}, u({
|
|
185
186
|
"w-6 h-6 shrink-0": !0,
|
|
186
|
-
[
|
|
187
|
-
[
|
|
188
|
-
}))),
|
|
187
|
+
[l(H.value, "iconColor") ?? ""]: !0,
|
|
188
|
+
[l(R.value, "icon") ?? ""]: !0
|
|
189
|
+
}))), Ie = i(() => e(I.value?.title, {}, u({
|
|
189
190
|
"text-sm font-medium": !0,
|
|
190
|
-
[
|
|
191
|
-
[
|
|
192
|
-
}))),
|
|
191
|
+
[l(H.value, "titleColor") ?? ""]: !0,
|
|
192
|
+
[l(R.value, "title") ?? ""]: !0
|
|
193
|
+
}))), Le = i(() => e(I.value?.description, {}, u({
|
|
193
194
|
"mt-1 text-sm text-dark-500 dark:text-dark-500": !0,
|
|
194
|
-
[
|
|
195
|
-
}))),
|
|
195
|
+
[l(R.value, "description") ?? ""]: !0
|
|
196
|
+
}))), Re = i(() => e(I.value?.progress, {}, {
|
|
196
197
|
class: u({
|
|
197
198
|
"absolute bottom-0 left-0 h-0.5 w-full rounded-full": !0,
|
|
198
|
-
[
|
|
199
|
-
[
|
|
199
|
+
[l(H.value, "progressColor") ?? ""]: !0,
|
|
200
|
+
[l(R.value, "progress") ?? ""]: !0
|
|
200
201
|
}),
|
|
201
|
-
style:
|
|
202
|
+
style: G.value ? {
|
|
202
203
|
transformOrigin: "left center",
|
|
203
204
|
transform: `scaleX(${C.value && !b.value ? 0 : v.value})`,
|
|
204
205
|
transition: C.value && !b.value ? `transform ${w.value}ms linear` : "none"
|
|
205
206
|
} : void 0
|
|
206
207
|
}));
|
|
207
|
-
function
|
|
208
|
-
return e(
|
|
209
|
-
[
|
|
210
|
-
[
|
|
211
|
-
[
|
|
208
|
+
function ze(t) {
|
|
209
|
+
return e(I.value?.content, {}, u({
|
|
210
|
+
[l(U.value, "contentRight") ?? ""]: t,
|
|
211
|
+
[l(U.value, "content") ?? ""]: !t,
|
|
212
|
+
[l(R.value, "content") ?? ""]: !0
|
|
212
213
|
}));
|
|
213
214
|
}
|
|
214
215
|
return {
|
|
215
|
-
merged:
|
|
216
|
-
iconBind:
|
|
216
|
+
merged: P,
|
|
217
|
+
iconBind: Fe,
|
|
217
218
|
rendered: g,
|
|
218
|
-
panelBind:
|
|
219
|
-
titleBind:
|
|
220
|
-
isPortaled:
|
|
221
|
-
portalBind:
|
|
222
|
-
contentBind:
|
|
223
|
-
setPanelRef:
|
|
224
|
-
showProgress:
|
|
225
|
-
progressBind:
|
|
219
|
+
panelBind: Pe,
|
|
220
|
+
titleBind: Ie,
|
|
221
|
+
isPortaled: K,
|
|
222
|
+
portalBind: Ne,
|
|
223
|
+
contentBind: ze,
|
|
224
|
+
setPanelRef: Me,
|
|
225
|
+
showProgress: G,
|
|
226
|
+
progressBind: Re,
|
|
226
227
|
requestClose: Z,
|
|
227
|
-
resolvedIcon:
|
|
228
|
-
descriptionBind:
|
|
228
|
+
resolvedIcon: Te,
|
|
229
|
+
descriptionBind: Le
|
|
229
230
|
};
|
|
230
231
|
}
|
|
231
232
|
//#endregion
|
|
@@ -153,6 +153,20 @@ When unset, `showFooter` defaults to `true` for `modal` / `drawer` overlays (`fa
|
|
|
153
153
|
/>
|
|
154
154
|
```
|
|
155
155
|
|
|
156
|
+
### Match field width
|
|
157
|
+
|
|
158
|
+
```vue
|
|
159
|
+
<Autocomplete
|
|
160
|
+
label="Country"
|
|
161
|
+
:options="countries"
|
|
162
|
+
:custom-props="{
|
|
163
|
+
listbox: { matchWidth: true },
|
|
164
|
+
}"
|
|
165
|
+
/>
|
|
166
|
+
```
|
|
167
|
+
|
|
168
|
+
Set `components.Listbox.defaultProps.matchWidth` on `createBridgeUI` to apply this to every Select / Autocomplete menu.
|
|
169
|
+
|
|
156
170
|
## Props
|
|
157
171
|
|
|
158
172
|
### Autocomplete-specific
|
|
@@ -99,7 +99,7 @@ app.use(
|
|
|
99
99
|
|
|
100
100
|
### Shared chrome
|
|
101
101
|
|
|
102
|
-
`FormField`, `FormControl`, `BaseField`, and `TimePanel` are registry keys. Set them once to theme a family; a public entry still overrides `defaultProps`. Chrome tokens live on the shared key (`components.FormField.tokens`, `components.BaseField.tokens`). Dropdown tokens live on `components.Listbox`. Cancel / Apply in pickers and listboxes live on `components.ActionFooter`.
|
|
102
|
+
`FormField`, `FormControl`, `BaseField`, and `TimePanel` are registry keys. Set them once to theme a family; a public entry still overrides `defaultProps`. Chrome tokens live on the shared key (`components.FormField.tokens`, `components.BaseField.tokens`). Dropdown tokens live on `components.Listbox`. Set `components.Listbox.defaultProps.matchWidth` so Select / Autocomplete menus match the field width. Cancel / Apply in pickers and listboxes live on `components.ActionFooter`.
|
|
103
103
|
|
|
104
104
|
```ts
|
|
105
105
|
app.use(
|
|
@@ -146,6 +146,18 @@ app.use(
|
|
|
146
146
|
);
|
|
147
147
|
```
|
|
148
148
|
|
|
149
|
+
```ts
|
|
150
|
+
app.use(
|
|
151
|
+
createBridgeUI({
|
|
152
|
+
components: {
|
|
153
|
+
Listbox: {
|
|
154
|
+
defaultProps: { matchWidth: true },
|
|
155
|
+
},
|
|
156
|
+
},
|
|
157
|
+
}),
|
|
158
|
+
);
|
|
159
|
+
```
|
|
160
|
+
|
|
149
161
|
```ts
|
|
150
162
|
app.use(
|
|
151
163
|
createBridgeUI({
|
package/docs/components/Menu.md
CHANGED
|
@@ -70,6 +70,7 @@ import { Menu } from "@bridge-ui/vue/Components/Menu";
|
|
|
70
70
|
| `disableAutoFocus` | `boolean` | `false` | When true, the menu does not auto-focus the first focusable item on open. |
|
|
71
71
|
| `disableScrollLock` | `boolean` | `true` | When true, body scroll is not locked while the menu is open. |
|
|
72
72
|
| `keepMounted` | `boolean` | `false` | When true, the menu stays mounted in the DOM after closing (hidden). |
|
|
73
|
+
| `matchWidth` | `boolean` | `false` | When true, the panel width matches the trigger / anchor. |
|
|
73
74
|
| `offset` | `number` | 4 | Gap between the trigger and the menu panel (px). |
|
|
74
75
|
| `onShowChange` | `(show: boolean) => void` | — | Called when `show` should change (controlled state without `v-model`). |
|
|
75
76
|
| `persistent` | `boolean` | `false` | When true, escape and click-away do not close the menu. |
|
|
@@ -137,6 +137,20 @@ When unset, `showFooter` defaults to `true` for `modal` / `drawer` overlays (`fa
|
|
|
137
137
|
/>
|
|
138
138
|
```
|
|
139
139
|
|
|
140
|
+
### Match field width
|
|
141
|
+
|
|
142
|
+
```vue
|
|
143
|
+
<Select
|
|
144
|
+
label="Country"
|
|
145
|
+
:options="countries"
|
|
146
|
+
:custom-props="{
|
|
147
|
+
listbox: { matchWidth: true },
|
|
148
|
+
}"
|
|
149
|
+
/>
|
|
150
|
+
```
|
|
151
|
+
|
|
152
|
+
Set `components.Listbox.defaultProps.matchWidth` on `createBridgeUI` to apply this to every Select / Autocomplete menu.
|
|
153
|
+
|
|
140
154
|
## Props
|
|
141
155
|
|
|
142
156
|
### Select-specific
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"type": "module",
|
|
3
3
|
"license": "MIT",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.10.1",
|
|
5
5
|
"author": "BridgeUI",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"name": "@bridge-ui/vue",
|
|
@@ -89,7 +89,7 @@
|
|
|
89
89
|
}
|
|
90
90
|
},
|
|
91
91
|
"dependencies": {
|
|
92
|
-
"@bridge-ui/core": "^0.
|
|
92
|
+
"@bridge-ui/core": "^0.10.1",
|
|
93
93
|
"clsx": "^2.1.1",
|
|
94
94
|
"es-toolkit": "^1.50.0",
|
|
95
95
|
"tailwind-merge": "^3.6.0"
|