@bridge-ui/vue 0.5.1 → 0.6.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-components/SKILL.md +2 -2
- package/dist/Components/Alert/alertDefaultIcons.js +1 -0
- package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +1 -1
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +150 -145
- package/dist/Components/Button/Button.vue_vue_type_script_setup_true_lang.js +1 -0
- package/dist/Components/Button/button.types.d.ts +6 -0
- package/dist/Components/Button/composables/useButton.d.ts +4 -1
- package/dist/Components/Button/composables/useButton.js +88 -69
- package/dist/Components/ButtonGroup/ButtonGroup.js +5 -0
- package/dist/Components/ButtonGroup/ButtonGroup.vue.d.ts +14 -0
- package/dist/Components/ButtonGroup/ButtonGroup.vue_vue_type_script_setup_true_lang.js +37 -0
- package/dist/Components/ButtonGroup/buttonGroup.types.d.ts +93 -0
- package/dist/Components/ButtonGroup/buttonGroupInjectionKey.d.ts +7 -0
- package/dist/Components/ButtonGroup/buttonGroupInjectionKey.js +4 -0
- package/dist/Components/ButtonGroup/composables/useButtonGroup.d.ts +16 -0
- package/dist/Components/ButtonGroup/composables/useButtonGroup.js +66 -0
- package/dist/Components/ButtonGroup/index.d.ts +4 -0
- package/dist/Components/ButtonGroup/index.js +4 -0
- package/dist/Components/Calendar/Calendar.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/CalendarRange/CalendarRange.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Checkbox/composables/useCheckbox.js +1 -1
- package/dist/Components/DataTable/DataTable.vue_vue_type_script_setup_true_lang.js +89 -90
- package/dist/Components/DataTable/DataTableColumnsMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTableFilterMenu.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTableFilterOptions.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/DataTable/DataTableSortButton.vue.d.ts +5 -11
- package/dist/Components/DataTable/DataTableSortButton.vue_vue_type_script_setup_true_lang.js +22 -26
- package/dist/Components/DataTable/composables/useDataTable.d.ts +0 -3
- package/dist/Components/DataTable/composables/useDataTable.js +199 -213
- package/dist/Components/FieldOverlay/composables/useFieldOverlay.js +4 -1
- package/dist/Components/List/composables/useList.js +1 -1
- package/dist/Components/ListItem/ListItem.vue.d.ts +1 -1
- package/dist/Components/ListItem/composables/useListItem.d.ts +2 -2
- package/dist/Components/ListItem/composables/useListItem.js +101 -86
- package/dist/Components/ListSection/composables/useListSection.js +34 -31
- package/dist/Components/ListSection/listSection.types.d.ts +2 -1
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +82 -82
- package/dist/Components/Listbox/collectComposedListboxOptions.d.ts +5 -0
- package/dist/Components/Listbox/collectComposedListboxOptions.js +27 -0
- package/dist/Components/Radio/composables/useRadio.js +2 -1
- package/dist/Components/Select/composables/useSelect.d.ts +1 -1
- package/dist/Components/Select/composables/useSelect.js +104 -99
- package/dist/Components/Sidebar/composables/useSidebarListItem.js +29 -28
- package/dist/Components/Sidebar/composables/useSidebarTrigger.js +14 -14
- package/dist/Components/Slider/composables/useSlider.js +53 -53
- package/dist/Components/Snackbar/snackbarDefaultIcons.js +1 -0
- package/dist/Components/Tabs/Tabs.vue_vue_type_script_setup_true_lang.js +11 -10
- package/dist/Components/TimePanel/composables/useTimePanel.js +106 -106
- package/dist/augments.d.ts +5 -0
- package/dist/index.d.ts +2 -0
- package/dist/index.js +150 -147
- package/docs/README.md +1 -0
- package/docs/components/Badge.md +2 -0
- package/docs/components/Button.md +5 -1
- package/docs/components/ButtonGroup.md +124 -0
- package/docs/components/DataTable.md +4 -0
- package/docs/components/Divider.md +1 -0
- package/docs/components/ToggleGroup.md +1 -1
- package/docs/examples/i18n-dictionary.ts +3 -0
- package/package.json +2 -2
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
name: bridge-ui-components
|
|
3
3
|
description: >-
|
|
4
|
-
Use Bridge UI Vue components — Button, Avatar, Card, Alert, Accordion, Badge, Icon,
|
|
4
|
+
Use Bridge UI Vue components — Button, ButtonGroup, Avatar, Card, Alert, Accordion, Badge, Icon,
|
|
5
5
|
Link, List, Table, DataTable, Tabs, Spinner, Skeleton, EmptyState, Sidebar, Progress, Stepper, Pagination, TextField, Select,
|
|
6
6
|
Autocomplete, DateField, DatePicker, DateRangeField, DateRangePicker,
|
|
7
7
|
TimeField, TimePicker, DateTimeField, DateTimePicker, ColorField, ColorPicker,
|
|
@@ -18,7 +18,7 @@ In templates, use kebab-case attrs (`start-icon`, `custom-props`, `error-message
|
|
|
18
18
|
|
|
19
19
|
| Need | Doc |
|
|
20
20
|
| ----------------------------- | --------------------------------------------------------------------- |
|
|
21
|
-
| Actions | `.ai/docs/components/Button.md`
|
|
21
|
+
| Actions | `.ai/docs/components/Button.md`, `ButtonGroup.md` |
|
|
22
22
|
| Surfaces / modal body | `.ai/docs/components/Card.md` |
|
|
23
23
|
| Avatar | `.ai/docs/components/Avatar.md` |
|
|
24
24
|
| Badge | `.ai/docs/components/Badge.md` |
|
|
@@ -728,7 +728,7 @@ export declare function useAutocomplete(props: AutocompleteOwnProps, model: Ref<
|
|
|
728
728
|
listboxProps: import('vue').ComputedRef<{
|
|
729
729
|
anchorEl?: null | HTMLElement;
|
|
730
730
|
classes?: import('../../Listbox').ListboxClasses;
|
|
731
|
-
color: "info" | "error" | "success" | "warning" | "dark" | "primary" | "secondary";
|
|
731
|
+
color: "info" | "error" | "success" | "warning" | "black" | "dark" | "primary" | "secondary";
|
|
732
732
|
customProps?: import('../../Listbox').ListboxCustomProps;
|
|
733
733
|
disableAutoFocus: boolean;
|
|
734
734
|
disableMaxHeight: boolean;
|
|
@@ -1,16 +1,17 @@
|
|
|
1
1
|
import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
|
|
2
2
|
import { hasNamedSlot as t } from "../../../Utils/slotOrProp.js";
|
|
3
3
|
import { useBreakpoint as n } from "../../../Utils/useBreakpoint.js";
|
|
4
|
-
import { mergePartBind as r, resolveFieldAdornmentIconSize as
|
|
5
|
-
import { formFieldBridgeKeys as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
4
|
+
import { mergePartBind as r, resolveFieldAdornmentIconSize as ee, useBridgeUIComponent as te, useBridgeUIMergedRegistryClasses as i, useFieldShowFooter as ne } from "../../../Utils/index.js";
|
|
5
|
+
import { formFieldBridgeKeys as re, useFormField as ie } from "../../FormField/composables/useFormField.js";
|
|
6
|
+
import { collectComposedListboxOptions as ae } from "../../Listbox/collectComposedListboxOptions.js";
|
|
7
|
+
import { useListboxNavigation as oe } from "../../Listbox/composables/useListboxNavigation.js";
|
|
8
|
+
import { Comment as se, Text as ce, computed as a, nextTick as o, onBeforeUnmount as le, onMounted as ue, ref as s, useAttrs as de, useId as fe, useSlots as pe, watch as c } from "vue";
|
|
9
|
+
import { get as me, isNil as he, isObjectLike as l, isSymbol as ge, omit as _e } from "es-toolkit/compat";
|
|
10
|
+
import { commitFreeSoloValue as u, createSelectAsyncSearch as ve, filterListboxEntries as ye, flattenListboxOptions as d, mergeListboxOptionsByValue as be, normalizeListboxEntries as xe, normalizeSelectOptions as Se, resolveFieldOverlay as Ce, resolveSelectAsyncDebounce as we, resolveSelectAsyncOptions as Te, selectValuesEqual as f } from "@bridge-ui/core/Domain";
|
|
11
|
+
import { listboxColorProps as Ee } from "@bridge-ui/core/Tokens";
|
|
12
|
+
import { adjustAutosizeTextareaHeight as De, cn as p, getColorToken as Oe, mergeBridgeUILayeredClasses as ke, splitComponentProps as Ae } from "@bridge-ui/core/Utils";
|
|
12
13
|
//#region src/Components/Autocomplete/composables/useAutocomplete.ts
|
|
13
|
-
var
|
|
14
|
+
var je = [
|
|
14
15
|
"classes",
|
|
15
16
|
"loading",
|
|
16
17
|
"options",
|
|
@@ -34,81 +35,81 @@ var De = [
|
|
|
34
35
|
"minItemsForSearch",
|
|
35
36
|
"optionDescription"
|
|
36
37
|
];
|
|
37
|
-
function m(m, h, g, _,
|
|
38
|
-
let
|
|
38
|
+
function m(m, h, g, _, Me) {
|
|
39
|
+
let Ne = de(), v = pe(), y = fe(), Pe = n(), b = e(), x = s(!1), S = s(""), C = s(!1), w = s(-1), T = s([]), E = s([]), D = s([]), Fe = s(null), O = null, Ie = a(() => Ae({
|
|
39
40
|
props: {
|
|
40
|
-
...
|
|
41
|
+
...Ne,
|
|
41
42
|
...m
|
|
42
43
|
},
|
|
43
|
-
bridgeKeys:
|
|
44
|
-
})),
|
|
44
|
+
bridgeKeys: je
|
|
45
|
+
})), k = a(() => Ie.value.componentProps), A = a(() => ({ classes: k.value.classes })), { components: Le, entry: Re } = te({
|
|
45
46
|
componentName: "Autocomplete",
|
|
46
|
-
props: () =>
|
|
47
|
-
}), j =
|
|
48
|
-
entry:
|
|
49
|
-
props: () =>
|
|
50
|
-
}), M =
|
|
51
|
-
optionLabel:
|
|
52
|
-
optionValue:
|
|
53
|
-
optionDescription:
|
|
54
|
-
})), P =
|
|
47
|
+
props: () => A.value
|
|
48
|
+
}), j = i({
|
|
49
|
+
entry: Re,
|
|
50
|
+
props: () => A.value
|
|
51
|
+
}), M = a(() => !!k.value.multiple), N = a(() => ({
|
|
52
|
+
optionLabel: k.value.optionLabel ?? "label",
|
|
53
|
+
optionValue: k.value.optionValue ?? "value",
|
|
54
|
+
optionDescription: k.value.optionDescription ?? "description"
|
|
55
|
+
})), P = a(() => Me.value.length > 0 ? Me.value.map((e) => ({
|
|
55
56
|
option: e,
|
|
56
57
|
type: "option"
|
|
57
|
-
})) :
|
|
58
|
-
function
|
|
59
|
-
if (!e
|
|
58
|
+
})) : xe(k.value.options, N.value)), ze = a(() => d(P.value)), F = s([]);
|
|
59
|
+
function Be(e) {
|
|
60
|
+
if (!l(e)) return !1;
|
|
60
61
|
let t = e.type;
|
|
61
|
-
if (!t
|
|
62
|
+
if (!l(t)) return !1;
|
|
62
63
|
let n = t.name, r = t.__name;
|
|
63
64
|
return n === "AutocompleteOption" || r === "AutocompleteOption";
|
|
64
65
|
}
|
|
65
|
-
function
|
|
66
|
+
function Ve() {
|
|
66
67
|
return t(v, "default") ? (v.default?.({}) ?? []).some((e) => {
|
|
67
|
-
if (!e
|
|
68
|
+
if (!l(e)) return !1;
|
|
68
69
|
let t = e.type;
|
|
69
|
-
return t ===
|
|
70
|
+
return t === se || t === ce || t === void 0 || ge(t) ? !1 : !Be(e);
|
|
70
71
|
}) : !1;
|
|
71
72
|
}
|
|
72
|
-
let I =
|
|
73
|
+
let I = a(() => Ve()), He = a(() => I.value ? ae(v.default?.({}) ?? []) : []), L = a(() => {
|
|
73
74
|
if (I.value) return [];
|
|
74
75
|
if (E.value.length > 0) {
|
|
75
|
-
let e =
|
|
76
|
-
return
|
|
76
|
+
let e = xe(E.value, N.value);
|
|
77
|
+
return k.value.flipOptions ? [...e].reverse() : e;
|
|
77
78
|
}
|
|
78
|
-
return
|
|
79
|
+
return k.value.flipOptions ? [...P.value].reverse().map((e) => e.type === "section" ? {
|
|
79
80
|
...e,
|
|
80
81
|
options: [...e.options].reverse()
|
|
81
82
|
} : e) : P.value;
|
|
82
|
-
}),
|
|
83
|
+
}), Ue = a(() => I.value ? be(F.value, He.value) : d(L.value)), R = a(() => {
|
|
83
84
|
let e = h.value;
|
|
84
|
-
return M.value ? Array.isArray(e) ? e : [] : !
|
|
85
|
-
}),
|
|
86
|
-
overlay:
|
|
85
|
+
return M.value ? Array.isArray(e) ? e : [] : !he(e) && e !== "" ? [e] : [];
|
|
86
|
+
}), We = a(() => Ce(k.value.overlay, Pe.mobile)), z = ne({
|
|
87
|
+
overlay: We,
|
|
87
88
|
componentName: "Autocomplete",
|
|
88
|
-
showFooter: () =>
|
|
89
|
-
}),
|
|
89
|
+
showFooter: () => k.value.showFooter
|
|
90
|
+
}), Ge = a(() => z.value ? T.value : R.value), B = a(() => {
|
|
90
91
|
let e = /* @__PURE__ */ new Map();
|
|
91
|
-
for (let t of [...
|
|
92
|
+
for (let t of [...Ue.value, ...D.value]) e.set(t.value, t);
|
|
92
93
|
return R.value.map((t) => e.get(t) ?? {
|
|
93
94
|
value: t,
|
|
94
95
|
label: String(t)
|
|
95
96
|
});
|
|
96
|
-
}), V =
|
|
97
|
-
if (H.value || (
|
|
98
|
-
let e =
|
|
99
|
-
return
|
|
100
|
-
}), W =
|
|
97
|
+
}), V = a(() => R.value.length > 0), Ke = a(() => k.value.clearable !== !1), H = a(() => !!k.value.asyncData), U = a(() => {
|
|
98
|
+
if (H.value || (k.value.searchable ?? !0)) return !0;
|
|
99
|
+
let e = k.value.minItemsForSearch ?? 11;
|
|
100
|
+
return ze.value.length >= e;
|
|
101
|
+
}), W = a(() => x.value && U.value), qe = a(() => !!k.value.loading || C.value), Je = a(() => {
|
|
101
102
|
if (I.value) return [];
|
|
102
103
|
if (!W.value || !S.value.trim()) return L.value;
|
|
103
104
|
let e = S.value.trim().toLowerCase();
|
|
104
|
-
return
|
|
105
|
-
}), G =
|
|
106
|
-
|
|
105
|
+
return ye(L.value, (t) => t.label.toLowerCase().includes(e));
|
|
106
|
+
}), G = a(() => I.value ? F.value : d(Je.value)), K = oe(() => G.value, w, y), Ye = a(() => m.readonly || m.disabled ? !0 : !W.value), Xe = a(() => W.value || M.value ? S.value : B.value[0]?.label ?? ""), Ze = (e) => {
|
|
107
|
+
Fe.value = e instanceof HTMLElement ? e : null;
|
|
107
108
|
};
|
|
108
|
-
function
|
|
109
|
+
function Qe(e) {
|
|
109
110
|
e.preventDefault();
|
|
110
111
|
}
|
|
111
|
-
function
|
|
112
|
+
function $e(e) {
|
|
112
113
|
if (m.disabled || m.readonly) return;
|
|
113
114
|
let t = e.target;
|
|
114
115
|
if (!t.closest("[data-autocomplete-clear]") && !(t.closest(".wrapper-start-slot") || t.closest(".wrapper-end-slot"))) {
|
|
@@ -119,25 +120,25 @@ function m(m, h, g, _, Oe) {
|
|
|
119
120
|
W.value || (Q(), g.value?.focus({ preventScroll: !0 }));
|
|
120
121
|
}
|
|
121
122
|
}
|
|
122
|
-
let
|
|
123
|
-
let e =
|
|
124
|
-
bridgeKeys:
|
|
123
|
+
let et = a(() => {
|
|
124
|
+
let e = _e(Ie.value.inheritedAttrs, ["class"]), n = Ae({
|
|
125
|
+
bridgeKeys: re,
|
|
125
126
|
props: e
|
|
126
|
-
}).componentProps,
|
|
127
|
+
}).componentProps, ee = n.endIcon ?? (t(v, "end") ? void 0 : "chevronUpDown"), { listbox: te, ...i } = n.customProps ?? {};
|
|
127
128
|
return {
|
|
128
129
|
...n,
|
|
129
|
-
endIcon:
|
|
130
|
+
endIcon: ee,
|
|
130
131
|
classes: j.value,
|
|
131
132
|
customProps: {
|
|
132
|
-
...
|
|
133
|
-
container: r(
|
|
134
|
-
ref:
|
|
135
|
-
onClick:
|
|
133
|
+
...i,
|
|
134
|
+
container: r(i.container, {}, {
|
|
135
|
+
ref: Ze,
|
|
136
|
+
onClick: $e,
|
|
136
137
|
class: p({ "cursor-pointer": !m.disabled && !m.readonly && !W.value })
|
|
137
138
|
})
|
|
138
139
|
}
|
|
139
140
|
};
|
|
140
|
-
}),
|
|
141
|
+
}), tt = a(() => m.customProps?.listbox), q = ie(() => et.value, {
|
|
141
142
|
size: "md",
|
|
142
143
|
rounded: "md",
|
|
143
144
|
color: "primary",
|
|
@@ -147,11 +148,11 @@ function m(m, h, g, _, Oe) {
|
|
|
147
148
|
componentName: "Autocomplete",
|
|
148
149
|
likeInput: () => M.value,
|
|
149
150
|
control: () => M.value ? "textarea" : "input"
|
|
150
|
-
}),
|
|
151
|
-
!e || !M.value ||
|
|
151
|
+
}), nt = a(() => V.value && Ke.value && !m.readonly && !q.isDisabled.value), J = (e) => {
|
|
152
|
+
!e || !M.value || De(e);
|
|
152
153
|
};
|
|
153
|
-
function
|
|
154
|
-
return
|
|
154
|
+
function rt(e) {
|
|
155
|
+
return Ge.value.some((t) => f(t, e));
|
|
155
156
|
}
|
|
156
157
|
function Y(e) {
|
|
157
158
|
h.value = e;
|
|
@@ -166,25 +167,25 @@ function m(m, h, g, _, Oe) {
|
|
|
166
167
|
_("update:modelValue", t), _("change", t);
|
|
167
168
|
}
|
|
168
169
|
function Z() {
|
|
169
|
-
m.disabled || m.readonly || x.value || (T.value = [...R.value], x.value = !0, S.value = "", K.highlightCurrentSelection((e) => R.value.some((t) => f(t, e))), _("open"), H.value &&
|
|
170
|
+
m.disabled || m.readonly || x.value || (T.value = [...R.value], x.value = !0, S.value = "", K.highlightCurrentSelection((e) => R.value.some((t) => f(t, e))), _("open"), H.value && k.value.asyncData && O?.searchImmediate(""));
|
|
170
171
|
}
|
|
171
172
|
function Q(e) {
|
|
172
|
-
|
|
173
|
+
O?.cancel();
|
|
173
174
|
let t = x.value;
|
|
174
|
-
if (t && e?.commitFreeSolo &&
|
|
175
|
+
if (t && e?.commitFreeSolo && k.value.freeSolo !== !1) {
|
|
175
176
|
let e = u(S.value, R.value, M.value);
|
|
176
|
-
e != null && (Y(e), X(e), M.value &&
|
|
177
|
+
e != null && (Y(e), X(e), M.value && o(() => {
|
|
177
178
|
J(g.value), g.value?.focus({ preventScroll: !0 });
|
|
178
179
|
}));
|
|
179
180
|
}
|
|
180
181
|
S.value = "", w.value = -1, t && (x.value = !1, _("close"));
|
|
181
182
|
}
|
|
182
|
-
function
|
|
183
|
+
function it(e) {
|
|
183
184
|
if (!e.disabled) {
|
|
184
185
|
if (z.value) {
|
|
185
186
|
if (M.value) {
|
|
186
187
|
let t = [...T.value], n = t.findIndex((t) => f(t, e.value));
|
|
187
|
-
n >= 0 ? (t.splice(n, 1), _("deselect", e)) : (t.push(e.value), _("select", e)), T.value = t, S.value = "", w.value = -1,
|
|
188
|
+
n >= 0 ? (t.splice(n, 1), _("deselect", e)) : (t.push(e.value), _("select", e)), T.value = t, S.value = "", w.value = -1, o(() => {
|
|
188
189
|
g.value?.focus({ preventScroll: !0 });
|
|
189
190
|
});
|
|
190
191
|
return;
|
|
@@ -194,7 +195,7 @@ function m(m, h, g, _, Oe) {
|
|
|
194
195
|
}
|
|
195
196
|
if (M.value) {
|
|
196
197
|
let t = [...R.value], n = t.findIndex((t) => f(t, e.value));
|
|
197
|
-
n >= 0 ? (t.splice(n, 1), _("deselect", e)) : (t.push(e.value), _("select", e)), Y(t), X(t), S.value = "", w.value = -1,
|
|
198
|
+
n >= 0 ? (t.splice(n, 1), _("deselect", e)) : (t.push(e.value), _("select", e)), Y(t), X(t), S.value = "", w.value = -1, o(() => {
|
|
198
199
|
J(g.value), g.value?.focus({ preventScroll: !0 });
|
|
199
200
|
});
|
|
200
201
|
return;
|
|
@@ -202,7 +203,7 @@ function m(m, h, g, _, Oe) {
|
|
|
202
203
|
Y(e.value), X(e.value), _("select", e), Q();
|
|
203
204
|
}
|
|
204
205
|
}
|
|
205
|
-
function
|
|
206
|
+
function at() {
|
|
206
207
|
if (M.value) Y(T.value), X(T.value);
|
|
207
208
|
else {
|
|
208
209
|
let e = T.value[0] ?? null;
|
|
@@ -210,33 +211,33 @@ function m(m, h, g, _, Oe) {
|
|
|
210
211
|
}
|
|
211
212
|
Q(), _("apply");
|
|
212
213
|
}
|
|
213
|
-
function
|
|
214
|
+
function ot() {
|
|
214
215
|
T.value = [...R.value], Q(), _("cancel");
|
|
215
216
|
}
|
|
216
|
-
function
|
|
217
|
-
if (
|
|
217
|
+
function st() {
|
|
218
|
+
if (k.value.freeSolo === !1) return !1;
|
|
218
219
|
let e = u(S.value, R.value, M.value);
|
|
219
|
-
return e != null && (Y(e), X(e), S.value = "", w.value = -1, M.value ? (
|
|
220
|
+
return e != null && (Y(e), X(e), S.value = "", w.value = -1, M.value ? (o(() => {
|
|
220
221
|
J(g.value), g.value?.focus({ preventScroll: !0 });
|
|
221
222
|
}), !0) : (Q(), !0));
|
|
222
223
|
}
|
|
223
|
-
function
|
|
224
|
+
function ct(e) {
|
|
224
225
|
e?.preventDefault(), e?.stopPropagation(), !(m.disabled || m.readonly) && (M.value ? (Y([]), X([])) : (Y(null), X(null)), _("clear"), Q());
|
|
225
226
|
}
|
|
226
|
-
function
|
|
227
|
+
function lt(e, t) {
|
|
227
228
|
if (t.preventDefault(), t.stopPropagation(), !M.value) return;
|
|
228
229
|
let n = R.value.filter((t) => !f(t, e.value));
|
|
229
|
-
Y(n), X(n), _("deselect", e),
|
|
230
|
+
Y(n), X(n), _("deselect", e), o(() => J(g.value));
|
|
230
231
|
}
|
|
231
|
-
function
|
|
232
|
+
function ut() {
|
|
232
233
|
let e = K.getHighlightedOption();
|
|
233
|
-
return e ? (
|
|
234
|
+
return e ? (it(e), !0) : !1;
|
|
234
235
|
}
|
|
235
|
-
function
|
|
236
|
+
function dt(e) {
|
|
236
237
|
let t = e.target;
|
|
237
|
-
S.value = t.value, _("search", S.value), x.value || Z(), K.resetHighlight(), H.value &&
|
|
238
|
+
S.value = t.value, _("search", S.value), x.value || Z(), K.resetHighlight(), H.value && O?.searchDebounced(S.value);
|
|
238
239
|
}
|
|
239
|
-
function
|
|
240
|
+
function ft(e) {
|
|
240
241
|
if (!(m.disabled || m.readonly)) switch (e.key) {
|
|
241
242
|
case "ArrowDown":
|
|
242
243
|
e.preventDefault(), x.value ? K.moveHighlight(1) : Z();
|
|
@@ -245,7 +246,7 @@ function m(m, h, g, _, Oe) {
|
|
|
245
246
|
e.preventDefault(), x.value ? K.moveHighlight(-1) : Z();
|
|
246
247
|
break;
|
|
247
248
|
case "Enter":
|
|
248
|
-
e.preventDefault(), x.value ?
|
|
249
|
+
e.preventDefault(), x.value ? ut() || st() : Z();
|
|
249
250
|
break;
|
|
250
251
|
case "Escape":
|
|
251
252
|
e.preventDefault(), Q();
|
|
@@ -260,104 +261,104 @@ function m(m, h, g, _, Oe) {
|
|
|
260
261
|
if (M.value && !S.value && B.value.length > 0) {
|
|
261
262
|
e.preventDefault();
|
|
262
263
|
let t = B.value.at(-1);
|
|
263
|
-
t &&
|
|
264
|
+
t && lt(t, e);
|
|
264
265
|
}
|
|
265
266
|
break;
|
|
266
267
|
case "Tab": Q({ commitFreeSolo: !0 });
|
|
267
268
|
}
|
|
268
269
|
}
|
|
269
|
-
async function
|
|
270
|
-
let t =
|
|
270
|
+
async function pt(e) {
|
|
271
|
+
let t = k.value.asyncData;
|
|
271
272
|
if (t) {
|
|
272
273
|
C.value = !0;
|
|
273
274
|
try {
|
|
274
|
-
let { options: n, resolvedSelected: r } = await
|
|
275
|
+
let { options: n, resolvedSelected: r } = await Te(t, e, R.value, (e) => Se(e, N.value));
|
|
275
276
|
r.length > 0 && (D.value = r), E.value = n;
|
|
276
277
|
} finally {
|
|
277
278
|
C.value = !1;
|
|
278
279
|
}
|
|
279
280
|
}
|
|
280
281
|
}
|
|
281
|
-
async function
|
|
282
|
-
let e =
|
|
283
|
-
!e?.resolve || R.value.length === 0 || (D.value =
|
|
282
|
+
async function mt() {
|
|
283
|
+
let e = k.value.asyncData;
|
|
284
|
+
!e?.resolve || R.value.length === 0 || (D.value = Se(await e.resolve(R.value), N.value));
|
|
284
285
|
}
|
|
285
|
-
let $ =
|
|
286
|
-
let e =
|
|
286
|
+
let $ = a(() => {
|
|
287
|
+
let e = ke(Ee, me(Le.value, [
|
|
287
288
|
"Autocomplete",
|
|
288
289
|
"tokens",
|
|
289
290
|
"listbox",
|
|
290
291
|
"color"
|
|
291
292
|
]));
|
|
292
|
-
return
|
|
293
|
+
return Oe({
|
|
293
294
|
tokens: e,
|
|
294
295
|
color: q.merged.value.color,
|
|
295
296
|
invalid: q.invalidated.value
|
|
296
297
|
});
|
|
297
|
-
}),
|
|
298
|
+
}), ht = a(() => $.value?.value), gt = a(() => {
|
|
298
299
|
let e = !m.disabled && !m.readonly && !W.value, t = !m.disabled && !m.readonly && W.value && U.value, n = V.value && !M.value && !W.value;
|
|
299
300
|
return r({
|
|
300
301
|
role: "combobox",
|
|
301
|
-
value:
|
|
302
|
+
value: Xe.value,
|
|
302
303
|
"aria-controls": y,
|
|
303
304
|
"aria-expanded": x.value,
|
|
304
|
-
readonly:
|
|
305
|
-
onKeydown:
|
|
306
|
-
placeholder:
|
|
305
|
+
readonly: Ye.value,
|
|
306
|
+
onKeydown: ft,
|
|
307
|
+
placeholder: k.value.placeholder,
|
|
307
308
|
"aria-autocomplete": U.value ? "list" : void 0,
|
|
308
309
|
"aria-activedescendant": x.value ? K.activeDescendantId.value : void 0,
|
|
309
310
|
...M.value ? {
|
|
310
311
|
rows: 1,
|
|
311
312
|
onInput: (e) => {
|
|
312
|
-
|
|
313
|
+
dt(e), J(e.target);
|
|
313
314
|
}
|
|
314
|
-
} : { onInput:
|
|
315
|
+
} : { onInput: dt }
|
|
315
316
|
}, q.inputBind.value, p({
|
|
316
317
|
"cursor-text": t,
|
|
317
318
|
"cursor-pointer": e,
|
|
318
319
|
"resize-none overflow-hidden": M.value,
|
|
319
|
-
[p(
|
|
320
|
+
[p(ht.value, j.value.value) ?? ""]: n
|
|
320
321
|
}));
|
|
321
322
|
});
|
|
322
|
-
|
|
323
|
+
c(() => [
|
|
323
324
|
x.value,
|
|
324
325
|
M.value,
|
|
325
326
|
g.value
|
|
326
327
|
], () => {
|
|
327
328
|
J(g.value);
|
|
328
|
-
}, { immediate: !0 }),
|
|
329
|
-
|
|
330
|
-
}, { immediate: !0 }),
|
|
331
|
-
if (
|
|
332
|
-
|
|
329
|
+
}, { immediate: !0 }), c(() => h.value, () => {
|
|
330
|
+
mt();
|
|
331
|
+
}, { immediate: !0 }), c(() => k.value.asyncData, (e) => {
|
|
332
|
+
if (O?.cancel(), E.value = [], mt(), !e) {
|
|
333
|
+
O = null;
|
|
333
334
|
return;
|
|
334
335
|
}
|
|
335
|
-
|
|
336
|
-
}, { immediate: !0 }),
|
|
337
|
-
|
|
338
|
-
}),
|
|
336
|
+
O = ve((e) => void pt(e), we(e));
|
|
337
|
+
}, { immediate: !0 }), le(() => {
|
|
338
|
+
O?.cancel();
|
|
339
|
+
}), ue(() => {
|
|
339
340
|
J(g.value);
|
|
340
341
|
});
|
|
341
|
-
let
|
|
342
|
+
let _t = a(() => ee(q.merged.value.size)), vt = a(() => r({}, {}, {
|
|
342
343
|
tabindex: 0,
|
|
343
344
|
role: "button",
|
|
344
345
|
"data-autocomplete-clear": !0,
|
|
345
|
-
onMousedown:
|
|
346
|
+
onMousedown: Qe,
|
|
346
347
|
class: p({
|
|
347
348
|
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm transition-colors duration-150": !0,
|
|
348
349
|
[$.value?.clear ?? ""]: !0,
|
|
349
350
|
[j.value.clear ?? ""]: !0
|
|
350
351
|
})
|
|
351
|
-
})),
|
|
352
|
+
})), yt = a(() => ({
|
|
352
353
|
listboxId: y,
|
|
353
|
-
isSelected:
|
|
354
|
+
isSelected: rt,
|
|
354
355
|
disableAutoFocus: !0,
|
|
355
356
|
overlay: m.overlay,
|
|
356
|
-
loading:
|
|
357
|
+
loading: qe.value,
|
|
357
358
|
multiple: M.value,
|
|
358
359
|
maxHeight: m.maxHeight,
|
|
359
360
|
showFooter: z.value,
|
|
360
|
-
entries:
|
|
361
|
+
entries: Je.value,
|
|
361
362
|
options: G.value,
|
|
362
363
|
size: q.merged.value.size,
|
|
363
364
|
error: q.invalidated.value,
|
|
@@ -366,14 +367,18 @@ function m(m, h, g, _, Oe) {
|
|
|
366
367
|
rounded: q.merged.value.rounded,
|
|
367
368
|
highlightedIndex: w.value,
|
|
368
369
|
disableMaxHeight: m.disableMaxHeight === !0,
|
|
369
|
-
hideEmptyMessage:
|
|
370
|
-
emptyMessage:
|
|
371
|
-
loadingMessage:
|
|
372
|
-
...
|
|
370
|
+
hideEmptyMessage: k.value.hideEmptyMessage === !0,
|
|
371
|
+
emptyMessage: k.value.emptyMessage ?? b("No options"),
|
|
372
|
+
loadingMessage: k.value.loadingMessage ?? b("Loading..."),
|
|
373
|
+
...tt.value
|
|
373
374
|
}));
|
|
374
|
-
function
|
|
375
|
+
function bt(e) {
|
|
376
|
+
if (e.length === 0) return;
|
|
375
377
|
let t = F.value;
|
|
376
|
-
t.length === e.length && t.every((t, n) =>
|
|
378
|
+
t.length === e.length && t.every((t, n) => {
|
|
379
|
+
let r = e[n];
|
|
380
|
+
return t.label === r?.label && t.description === r?.description && String(t.value) === String(r?.value) && !!t.disabled == !!r?.disabled;
|
|
381
|
+
}) || (F.value = e);
|
|
377
382
|
}
|
|
378
383
|
return {
|
|
379
384
|
slots: v,
|
|
@@ -381,24 +386,24 @@ function m(m, h, g, _, Oe) {
|
|
|
381
386
|
multiple: M,
|
|
382
387
|
listboxId: y,
|
|
383
388
|
formField: q,
|
|
384
|
-
isLoading:
|
|
385
|
-
clearable:
|
|
386
|
-
clearBind:
|
|
387
|
-
isSelected:
|
|
388
|
-
clearValue:
|
|
389
|
-
removeChip:
|
|
390
|
-
triggerBind:
|
|
391
|
-
handleApply:
|
|
392
|
-
selectOption:
|
|
393
|
-
handleCancel:
|
|
394
|
-
containerRef:
|
|
395
|
-
listboxProps:
|
|
396
|
-
clearIconSize:
|
|
389
|
+
isLoading: qe,
|
|
390
|
+
clearable: Ke,
|
|
391
|
+
clearBind: vt,
|
|
392
|
+
isSelected: rt,
|
|
393
|
+
clearValue: ct,
|
|
394
|
+
removeChip: lt,
|
|
395
|
+
triggerBind: gt,
|
|
396
|
+
handleApply: at,
|
|
397
|
+
selectOption: it,
|
|
398
|
+
handleCancel: ot,
|
|
399
|
+
containerRef: Fe,
|
|
400
|
+
listboxProps: yt,
|
|
401
|
+
clearIconSize: _t,
|
|
397
402
|
mergedClasses: j,
|
|
398
|
-
showClearIcon:
|
|
403
|
+
showClearIcon: nt,
|
|
399
404
|
visibleOptions: G,
|
|
400
405
|
isSearchActive: W,
|
|
401
|
-
open:
|
|
406
|
+
open: a({
|
|
402
407
|
get: () => x.value,
|
|
403
408
|
set: (e) => {
|
|
404
409
|
e ? Z() : Q({ commitFreeSolo: !0 });
|
|
@@ -407,10 +412,10 @@ function m(m, h, g, _, Oe) {
|
|
|
407
412
|
selectedOptions: B,
|
|
408
413
|
hasComposedList: I,
|
|
409
414
|
highlightedIndex: w,
|
|
410
|
-
handleRegisteredOptionsChange:
|
|
411
|
-
hideEmptyMessage:
|
|
412
|
-
emptyMessage:
|
|
413
|
-
loadingMessage:
|
|
415
|
+
handleRegisteredOptionsChange: bt,
|
|
416
|
+
hideEmptyMessage: a(() => k.value.hideEmptyMessage === !0),
|
|
417
|
+
emptyMessage: a(() => k.value.emptyMessage ?? b("No options")),
|
|
418
|
+
loadingMessage: a(() => k.value.loadingMessage ?? b("Loading..."))
|
|
414
419
|
};
|
|
415
420
|
}
|
|
416
421
|
//#endregion
|
|
@@ -134,6 +134,12 @@ export interface ButtonOwnProps {
|
|
|
134
134
|
* @default "md"
|
|
135
135
|
*/
|
|
136
136
|
rounded?: MergeProps<ButtonRounded, ButtonRoundedOverrides>;
|
|
137
|
+
/**
|
|
138
|
+
* Whether the button is in a selected / pressed state.
|
|
139
|
+
*
|
|
140
|
+
* @default false
|
|
141
|
+
*/
|
|
142
|
+
selected?: boolean;
|
|
137
143
|
/**
|
|
138
144
|
* The size of the button.
|
|
139
145
|
*
|
|
@@ -7,7 +7,10 @@ export declare function useButton(props: ButtonOwnProps, libDefaults: ButtonLibD
|
|
|
7
7
|
merged: import('vue').ComputedRef<ButtonMerged>;
|
|
8
8
|
isMini: import('vue').ComputedRef<boolean>;
|
|
9
9
|
iconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|
|
10
|
-
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<
|
|
10
|
+
rootBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<{
|
|
11
|
+
"aria-pressed": boolean | undefined;
|
|
12
|
+
class: string;
|
|
13
|
+
}, "class", import('vue').HTMLAttributes | undefined, Omit<ButtonProps, "color" | "href" | "icon" | "size" | "classes" | "customProps" | "full" | "rounded" | "variant" | "text" | "disabled" | "endIcon" | "startIcon" | "as" | "density" | "loading" | "selected">>>;
|
|
11
14
|
rootHref: import('vue').ComputedRef<string | undefined>;
|
|
12
15
|
rootType: import('vue').ComputedRef<"button" | undefined>;
|
|
13
16
|
endIconBind: import('vue').ComputedRef<import('@bridge-ui/core/Utils').MergePartBind<object, "class", Partial<Omit<import('../../Icon').IconProps, "icon">> | undefined, {}>>;
|