@bridge-ui/vue 0.0.6 → 0.0.7
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/dist/Actions/Snackbar/BridgeSnackbarAction.vue_vue_type_script_setup_true_lang.js +8 -8
- package/dist/Actions/Snackbar/BridgeSnackbarHost.vue_vue_type_script_setup_true_lang.js +5 -5
- package/dist/Actions/Snackbar/createBridgeSnackbarApi.js +17 -17
- package/dist/Adapters/I18n/index.d.ts +1 -1
- package/dist/Adapters/I18n/index.js +2 -2
- package/dist/Adapters/I18n/useI18nAdapter.d.ts +7 -3
- package/dist/Adapters/I18n/useI18nAdapter.js +12 -7
- package/dist/Adapters/Icon/useIconAdapter.d.ts +1 -1
- package/dist/Adapters/index.d.ts +1 -1
- package/dist/Adapters/index.js +3 -3
- package/dist/Components/Alert/composables/useAlert.js +17 -17
- package/dist/Components/Autocomplete/Autocomplete.js +5 -0
- package/dist/Components/Autocomplete/Autocomplete.vue.d.ts +40 -0
- package/dist/Components/Autocomplete/Autocomplete.vue_vue_type_script_setup_true_lang.js +197 -0
- package/dist/Components/Autocomplete/AutocompleteOption.js +5 -0
- package/dist/Components/Autocomplete/AutocompleteOption.vue.d.ts +4 -0
- package/dist/Components/Autocomplete/AutocompleteOption.vue_vue_type_script_setup_true_lang.js +32 -0
- package/dist/Components/Autocomplete/autocomplete.types.d.ts +285 -0
- package/dist/Components/Autocomplete/autocompleteInjectionKey.d.ts +7 -0
- package/dist/Components/Autocomplete/autocompleteInjectionKey.js +4 -0
- package/dist/Components/Autocomplete/composables/useAutocomplete.d.ts +762 -0
- package/dist/Components/Autocomplete/composables/useAutocomplete.js +382 -0
- package/dist/Components/Autocomplete/index.d.ts +4 -0
- package/dist/Components/Autocomplete/index.js +4 -0
- package/dist/Components/Avatar/composables/useAvatar.js +13 -13
- package/dist/Components/Badge/composables/useBadge.js +8 -8
- package/dist/Components/Button/composables/useButton.js +14 -14
- package/dist/Components/Card/composables/useCard.js +27 -27
- package/dist/Components/Checkbox/Checkbox.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Checkbox/composables/useCheckbox.d.ts +3 -3
- package/dist/Components/Checkbox/composables/useCheckbox.js +9 -9
- package/dist/Components/Chip/composables/useChip.js +6 -6
- package/dist/Components/Divider/composables/useDivider.js +5 -5
- package/dist/Components/Drawer/composables/useDrawer.js +23 -23
- package/dist/Components/FormControl/FormControl.vue_vue_type_script_setup_true_lang.js +1 -1
- package/dist/Components/FormControl/composables/useFormControl.d.ts +3 -3
- package/dist/Components/FormControl/composables/useFormControl.js +12 -12
- package/dist/Components/FormControl/formControl.types.d.ts +6 -6
- package/dist/Components/FormField/FilledFormField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/FormField/NotchedFormField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/FormField/OutlinedFormField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/FormField/StackedFormField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/FormField/UnderlinedFormField.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/FormField/composables/useFormField.d.ts +3 -3
- package/dist/Components/FormField/composables/useFormField.js +28 -28
- package/dist/Components/FormField/formField.types.d.ts +14 -14
- package/dist/Components/Icon/composables/useIcon.js +5 -5
- package/dist/Components/Label/composables/useLabel.js +5 -5
- package/dist/Components/Link/composables/useLink.js +9 -9
- package/dist/Components/List/composables/useList.js +6 -6
- package/dist/Components/ListItem/composables/useListItem.js +20 -20
- package/dist/Components/ListSection/composables/useListSection.js +8 -8
- package/dist/Components/Listbox/Listbox.vue_vue_type_script_setup_true_lang.js +28 -28
- package/dist/Components/Listbox/composables/useListbox.js +7 -7
- package/dist/Components/Listbox/index.js +3 -3
- package/dist/Components/Menu/composables/useMenu.js +43 -43
- package/dist/Components/Modal/composables/useModal.js +18 -18
- package/dist/Components/NumberField/NumberField.vue_vue_type_script_setup_true_lang.js +34 -34
- package/dist/Components/NumberField/composables/useNumberField.d.ts +4 -4
- package/dist/Components/NumberField/composables/useNumberField.js +9 -9
- package/dist/Components/OtpField/OtpField.js +5 -0
- package/dist/Components/OtpField/OtpField.vue.d.ts +31 -0
- package/dist/Components/OtpField/OtpField.vue_vue_type_script_setup_true_lang.js +80 -0
- package/dist/Components/OtpField/OtpFieldLabel.js +5 -0
- package/dist/Components/OtpField/OtpFieldLabel.vue.d.ts +7 -0
- package/dist/Components/OtpField/OtpFieldLabel.vue_vue_type_script_setup_true_lang.js +16 -0
- package/dist/Components/OtpField/composables/useOtpField.d.ts +460 -0
- package/dist/Components/OtpField/composables/useOtpField.js +212 -0
- package/dist/Components/OtpField/index.d.ts +4 -0
- package/dist/Components/OtpField/index.js +3 -0
- package/dist/Components/OtpField/otpField.types.d.ts +290 -0
- package/dist/Components/PasswordField/PasswordField.vue_vue_type_script_setup_true_lang.js +23 -23
- package/dist/Components/PasswordField/composables/usePasswordField.d.ts +4 -4
- package/dist/Components/PasswordField/composables/usePasswordField.js +2 -2
- package/dist/Components/Progress/composables/useProgress.js +11 -11
- package/dist/Components/Radio/Radio.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Radio/composables/useRadio.d.ts +3 -3
- package/dist/Components/Radio/composables/useRadio.js +9 -9
- package/dist/Components/Select/Select.vue.d.ts +1 -1
- package/dist/Components/Select/Select.vue_vue_type_script_setup_true_lang.js +16 -13
- package/dist/Components/Select/composables/useSelect.d.ts +4 -4
- package/dist/Components/Select/composables/useSelect.js +161 -161
- package/dist/Components/Skeleton/composables/useSkeleton.js +5 -5
- package/dist/Components/Snackbar/Snackbar.vue_vue_type_script_setup_true_lang.js +54 -54
- package/dist/Components/Snackbar/composables/useSnackbar.js +115 -115
- package/dist/Components/Spinner/composables/useSpinner.js +11 -11
- package/dist/Components/Switch/Switch.vue_vue_type_script_setup_true_lang.js +2 -2
- package/dist/Components/Switch/composables/useSwitch.d.ts +3 -3
- package/dist/Components/Switch/composables/useSwitch.js +9 -9
- package/dist/Components/Tab/composables/useTab.js +11 -11
- package/dist/Components/TabList/composables/useTabList.js +7 -7
- package/dist/Components/TabPanel/composables/useTabPanel.js +7 -7
- package/dist/Components/Tabs/composables/useTabs.js +22 -22
- package/dist/Components/TextField/TextField.vue.d.ts +1 -1
- package/dist/Components/TextField/TextField.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/Components/TextField/composables/useTextField.d.ts +4 -4
- package/dist/Components/TextField/composables/useTextField.js +1 -1
- package/dist/Components/Textarea/Textarea.vue.d.ts +1 -1
- package/dist/Components/Textarea/Textarea.vue_vue_type_script_setup_true_lang.js +6 -6
- package/dist/Components/Textarea/composables/useTextarea.d.ts +4 -4
- package/dist/Components/Textarea/composables/useTextarea.js +9 -9
- package/dist/Components/Tooltip/composables/useTooltip.js +17 -17
- package/dist/Provider/bridgeUITypes.d.ts +4 -1
- package/dist/Provider/createBridgeUIApi.js +13 -1
- package/dist/Utils/index.js +7 -7
- package/dist/Utils/useBreakpoint.js +7 -7
- package/dist/augments.d.ts +2 -2
- package/dist/index.d.ts +6 -2
- package/dist/index.js +84 -80
- package/package.json +3 -2
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useResolveMessage as e } from "../../../Adapters/I18n/useI18nAdapter.js";
|
|
2
2
|
import { hasNamedSlot as t } from "../../../Utils/slotOrProp.js";
|
|
3
3
|
import { mergePartBind as n, resolveFieldAdornmentIconSize as r, useBridgeUIComponent as ee, useBridgeUIMergedRegistryClasses as i } from "../../../Utils/index.js";
|
|
4
4
|
import { formFieldBridgeKeys as te, useFormField as ne } from "../../FormField/composables/useFormField.js";
|
|
5
5
|
import { useListboxNavigation as re } from "../../Listbox/composables/useListboxNavigation.js";
|
|
6
|
-
import { Comment as ie, Text as ae, computed as a, nextTick as
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import { colorProps as
|
|
6
|
+
import { Comment as ie, Text as ae, computed as a, nextTick as oe, onBeforeUnmount as se, onMounted as ce, ref as o, useAttrs as le, useId as ue, useSlots as de, watch as s } from "vue";
|
|
7
|
+
import { adjustAutosizeTextareaHeight as fe, cn as c, createSelectAsyncSearch as pe, filterListboxEntries as me, flattenListboxOptions as l, mergeBridgeUILayeredClasses as u, normalizeListboxEntries as he, normalizeSelectOptions as ge, resolveSelectAsyncDebounce as _e, resolveSelectAsyncOptions as ve, selectValuesEqual as d, splitComponentProps as ye } from "@bridge-ui/core";
|
|
8
|
+
import { get as f, isNil as be, omit as xe } from "es-toolkit/compat";
|
|
9
|
+
import { colorProps as Se, invalidatedProps as Ce } from "@bridge-ui/core/Tokens/Listbox";
|
|
10
10
|
//#region src/Components/Select/composables/useSelect.ts
|
|
11
|
-
var
|
|
11
|
+
var we = [
|
|
12
12
|
"classes",
|
|
13
13
|
"loading",
|
|
14
14
|
"options",
|
|
@@ -29,92 +29,92 @@ var Se = [
|
|
|
29
29
|
"minItemsForSearch",
|
|
30
30
|
"optionDescription"
|
|
31
31
|
];
|
|
32
|
-
function
|
|
33
|
-
let
|
|
34
|
-
bridgeKeys:
|
|
32
|
+
function p(p, m, h, g, _) {
|
|
33
|
+
let Te = le(), v = de(), y = ue(), b = e(), x = o(!1), S = o(""), C = o(-1), w = o(null), T = o(!1), E = o([]), D = null, O = o([]), k = a(() => ye({
|
|
34
|
+
bridgeKeys: we,
|
|
35
35
|
props: {
|
|
36
|
-
...
|
|
37
|
-
...
|
|
36
|
+
...Te,
|
|
37
|
+
...p
|
|
38
38
|
}
|
|
39
|
-
})),
|
|
39
|
+
})), A = a(() => k.value.componentProps), j = a(() => ({ classes: A.value.classes })), { components: M, entry: Ee } = ee({
|
|
40
40
|
componentName: "Select",
|
|
41
|
-
props: () =>
|
|
41
|
+
props: () => j.value
|
|
42
42
|
}), N = i({
|
|
43
|
-
entry:
|
|
44
|
-
props: () =>
|
|
45
|
-
}), P = a(() => !!
|
|
46
|
-
optionLabel:
|
|
47
|
-
optionValue:
|
|
48
|
-
optionDescription:
|
|
49
|
-
})), I = a(() =>
|
|
43
|
+
entry: Ee,
|
|
44
|
+
props: () => j.value
|
|
45
|
+
}), P = a(() => !!A.value.multiple), F = a(() => ({
|
|
46
|
+
optionLabel: A.value.optionLabel ?? "label",
|
|
47
|
+
optionValue: A.value.optionValue ?? "value",
|
|
48
|
+
optionDescription: A.value.optionDescription ?? "description"
|
|
49
|
+
})), I = a(() => _.value.length > 0 ? _.value.map((e) => ({
|
|
50
50
|
option: e,
|
|
51
51
|
type: "option"
|
|
52
|
-
})) :
|
|
53
|
-
function
|
|
52
|
+
})) : he(A.value.options, F.value)), De = a(() => l(I.value)), L = o([]);
|
|
53
|
+
function Oe(e) {
|
|
54
54
|
if (!e || typeof e != "object") return !1;
|
|
55
55
|
let t = e.type;
|
|
56
56
|
if (!t || typeof t != "object") return !1;
|
|
57
57
|
let n = t.name, r = t.__name;
|
|
58
58
|
return n === "SelectOption" || r === "SelectOption";
|
|
59
59
|
}
|
|
60
|
-
function
|
|
61
|
-
return t(
|
|
60
|
+
function ke() {
|
|
61
|
+
return t(v, "default") ? (v.default?.({}) ?? []).some((e) => {
|
|
62
62
|
if (!e || typeof e != "object") return !1;
|
|
63
63
|
let t = e.type;
|
|
64
|
-
return t === ie || t === ae || t === void 0 || typeof t == "symbol" ? !1 : !
|
|
64
|
+
return t === ie || t === ae || t === void 0 || typeof t == "symbol" ? !1 : !Oe(e);
|
|
65
65
|
}) : !1;
|
|
66
66
|
}
|
|
67
|
-
let R = a(() =>
|
|
67
|
+
let R = a(() => ke() && !A.value.options?.length), z = a(() => {
|
|
68
68
|
if (R.value) return [];
|
|
69
|
-
if (
|
|
70
|
-
let e =
|
|
71
|
-
return
|
|
69
|
+
if (E.value.length > 0) {
|
|
70
|
+
let e = he(E.value, F.value);
|
|
71
|
+
return A.value.flipOptions ? [...e].reverse() : e;
|
|
72
72
|
}
|
|
73
|
-
return
|
|
73
|
+
return A.value.flipOptions ? [...I.value].reverse().map((e) => e.type === "section" ? {
|
|
74
74
|
...e,
|
|
75
75
|
options: [...e.options].reverse()
|
|
76
76
|
} : e) : I.value;
|
|
77
|
-
}),
|
|
78
|
-
let e =
|
|
79
|
-
return P.value ? Array.isArray(e) ? e : [] : !
|
|
77
|
+
}), Ae = a(() => R.value ? L.value : l(z.value)), B = a(() => {
|
|
78
|
+
let e = m.value;
|
|
79
|
+
return P.value ? Array.isArray(e) ? e : [] : !be(e) && e !== "" ? [e] : [];
|
|
80
80
|
}), V = a(() => {
|
|
81
81
|
let e = /* @__PURE__ */ new Map();
|
|
82
|
-
for (let t of [...
|
|
82
|
+
for (let t of [...Ae.value, ...O.value]) e.set(t.value, t);
|
|
83
83
|
return B.value.map((t) => e.get(t) ?? {
|
|
84
84
|
value: t,
|
|
85
85
|
label: String(t)
|
|
86
86
|
});
|
|
87
|
-
}),
|
|
88
|
-
if (H.value ||
|
|
89
|
-
let e =
|
|
90
|
-
return
|
|
91
|
-
}), W = a(() =>
|
|
87
|
+
}), je = a(() => B.value.length > 0), Me = a(() => A.value.clearable !== !1), H = a(() => !!A.value.asyncData), U = a(() => {
|
|
88
|
+
if (H.value || A.value.searchable) return !0;
|
|
89
|
+
let e = A.value.minItemsForSearch ?? 11;
|
|
90
|
+
return De.value.length >= e;
|
|
91
|
+
}), W = a(() => x.value && U.value), Ne = a(() => !!A.value.loading || T.value), Pe = a(() => {
|
|
92
92
|
if (R.value) return [];
|
|
93
|
-
if (!W.value || !
|
|
94
|
-
let e =
|
|
95
|
-
return
|
|
96
|
-
}), G = a(() => R.value ? L.value :
|
|
97
|
-
|
|
93
|
+
if (!W.value || !S.value.trim()) return z.value;
|
|
94
|
+
let e = S.value.trim().toLowerCase();
|
|
95
|
+
return me(z.value, (t) => t.label.toLowerCase().includes(e));
|
|
96
|
+
}), G = a(() => R.value ? L.value : l(Pe.value)), K = re(() => G.value, C, y), Fe = a(() => p.readonly || p.disabled ? !0 : !W.value), Ie = a(() => W.value || P.value ? S.value : V.value[0]?.label ?? ""), Le = (e) => {
|
|
97
|
+
w.value = e instanceof HTMLElement ? e : null;
|
|
98
98
|
};
|
|
99
|
-
function
|
|
99
|
+
function Re(e) {
|
|
100
100
|
e.preventDefault();
|
|
101
101
|
}
|
|
102
|
-
function
|
|
103
|
-
if (
|
|
102
|
+
function ze(e) {
|
|
103
|
+
if (p.disabled || p.readonly) return;
|
|
104
104
|
let t = e.target;
|
|
105
105
|
if (!t.closest("[data-select-clear]") && !(t.closest(".wrapper-start-slot") || t.closest(".wrapper-end-slot"))) {
|
|
106
|
-
if (!
|
|
106
|
+
if (!x.value) {
|
|
107
107
|
Q();
|
|
108
108
|
return;
|
|
109
109
|
}
|
|
110
|
-
W.value || ($(),
|
|
110
|
+
W.value || ($(), h.value?.focus({ preventScroll: !0 }));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
|
-
let
|
|
113
|
+
let Be = a(() => {
|
|
114
114
|
let e = ye({
|
|
115
115
|
bridgeKeys: te,
|
|
116
|
-
props:
|
|
117
|
-
}).componentProps, r = e.endIcon ?? (t(
|
|
116
|
+
props: xe(k.value.inheritedAttrs, ["class"])
|
|
117
|
+
}).componentProps, r = e.endIcon ?? (t(v, "end") ? void 0 : "chevronUpDown"), { listbox: ee, ...i } = e.customProps ?? {};
|
|
118
118
|
return {
|
|
119
119
|
...e,
|
|
120
120
|
endIcon: r,
|
|
@@ -122,97 +122,97 @@ function g(g, _, v, y, b) {
|
|
|
122
122
|
customProps: {
|
|
123
123
|
...i,
|
|
124
124
|
container: n(i.container, {}, {
|
|
125
|
-
ref:
|
|
126
|
-
onClick:
|
|
127
|
-
class:
|
|
125
|
+
ref: Le,
|
|
126
|
+
onClick: ze,
|
|
127
|
+
class: c({ "cursor-pointer": !p.disabled && !p.readonly && !W.value })
|
|
128
128
|
})
|
|
129
129
|
}
|
|
130
130
|
};
|
|
131
|
-
}),
|
|
131
|
+
}), Ve = a(() => p.customProps?.listbox), q = ne(() => Be.value, {
|
|
132
132
|
size: "md",
|
|
133
133
|
rounded: "md",
|
|
134
134
|
color: "primary",
|
|
135
135
|
variant: "outline",
|
|
136
|
-
|
|
136
|
+
showErrorIcon: !0
|
|
137
137
|
}, {
|
|
138
138
|
likeInput: () => P.value,
|
|
139
139
|
control: () => P.value ? "textarea" : "input"
|
|
140
140
|
}), J = (e) => {
|
|
141
|
-
!e || !P.value ||
|
|
141
|
+
!e || !P.value || fe(e);
|
|
142
142
|
};
|
|
143
143
|
function Y(e) {
|
|
144
|
-
return B.value.some((t) =>
|
|
144
|
+
return B.value.some((t) => d(t, e));
|
|
145
145
|
}
|
|
146
146
|
function X(e) {
|
|
147
|
-
|
|
147
|
+
m.value = e;
|
|
148
148
|
}
|
|
149
149
|
function Z(e) {
|
|
150
150
|
if (P.value) {
|
|
151
151
|
let t = Array.isArray(e) ? e : [];
|
|
152
|
-
|
|
152
|
+
g("update:modelValue", t), g("change", t);
|
|
153
153
|
return;
|
|
154
154
|
}
|
|
155
155
|
let t = e ?? "";
|
|
156
|
-
|
|
156
|
+
g("update:modelValue", t), g("change", t);
|
|
157
157
|
}
|
|
158
158
|
function Q() {
|
|
159
|
-
|
|
159
|
+
p.disabled || p.readonly || x.value || (x.value = !0, S.value = "", K.highlightCurrentSelection(Y), g("open"), H.value && A.value.asyncData && D?.searchImmediate(""));
|
|
160
160
|
}
|
|
161
161
|
function $() {
|
|
162
|
-
|
|
162
|
+
D?.cancel(), x.value && (x.value = !1, S.value = "", C.value = -1, g("close"));
|
|
163
163
|
}
|
|
164
|
-
function
|
|
164
|
+
function He(e) {
|
|
165
165
|
if (!e.disabled) {
|
|
166
166
|
if (P.value) {
|
|
167
|
-
let t = [...B.value], n = t.findIndex((t) =>
|
|
168
|
-
n >= 0 ? (t.splice(n, 1),
|
|
169
|
-
J(
|
|
167
|
+
let t = [...B.value], n = t.findIndex((t) => d(t, e.value));
|
|
168
|
+
n >= 0 ? (t.splice(n, 1), g("deselect", e)) : (t.push(e.value), g("select", e)), X(t), Z(t), S.value = "", C.value = -1, oe(() => {
|
|
169
|
+
J(h.value), h.value?.focus({ preventScroll: !0 });
|
|
170
170
|
});
|
|
171
171
|
return;
|
|
172
172
|
}
|
|
173
|
-
X(e.value), Z(e.value),
|
|
173
|
+
X(e.value), Z(e.value), g("select", e), $();
|
|
174
174
|
}
|
|
175
175
|
}
|
|
176
|
-
function
|
|
177
|
-
e?.preventDefault(), e?.stopPropagation(), P.value ? (X([]), Z([])) : (X(null), Z(null)),
|
|
176
|
+
function Ue(e) {
|
|
177
|
+
e?.preventDefault(), e?.stopPropagation(), P.value ? (X([]), Z([])) : (X(null), Z(null)), g("clear"), $();
|
|
178
178
|
}
|
|
179
|
-
function
|
|
179
|
+
function We(e, t) {
|
|
180
180
|
if (t.preventDefault(), t.stopPropagation(), !P.value) return;
|
|
181
|
-
let n = B.value.filter((t) => !
|
|
182
|
-
X(n), Z(n),
|
|
181
|
+
let n = B.value.filter((t) => !d(t, e.value));
|
|
182
|
+
X(n), Z(n), g("deselect", e), oe(() => J(h.value));
|
|
183
183
|
}
|
|
184
|
-
function
|
|
184
|
+
function Ge() {
|
|
185
185
|
let e = K.getHighlightedOption();
|
|
186
|
-
e &&
|
|
186
|
+
e && He(e);
|
|
187
187
|
}
|
|
188
|
-
function
|
|
189
|
-
|
|
188
|
+
function Ke(e) {
|
|
189
|
+
S.value = e.target.value, g("search", S.value), x.value || Q(), K.resetHighlight(), H.value && D?.searchDebounced(S.value);
|
|
190
190
|
}
|
|
191
|
-
function
|
|
192
|
-
if (!(
|
|
191
|
+
function qe(e) {
|
|
192
|
+
if (!(p.disabled || p.readonly)) switch (e.key) {
|
|
193
193
|
case "ArrowDown":
|
|
194
|
-
e.preventDefault(),
|
|
194
|
+
e.preventDefault(), x.value ? K.moveHighlight(1) : Q();
|
|
195
195
|
break;
|
|
196
196
|
case "ArrowUp":
|
|
197
|
-
e.preventDefault(),
|
|
197
|
+
e.preventDefault(), x.value ? K.moveHighlight(-1) : Q();
|
|
198
198
|
break;
|
|
199
199
|
case "Enter":
|
|
200
|
-
e.preventDefault(),
|
|
200
|
+
e.preventDefault(), x.value ? Ge() : Q();
|
|
201
201
|
break;
|
|
202
202
|
case "Escape":
|
|
203
203
|
e.preventDefault(), $();
|
|
204
204
|
break;
|
|
205
205
|
case "Home":
|
|
206
|
-
|
|
206
|
+
x.value && (e.preventDefault(), K.highlightFirst());
|
|
207
207
|
break;
|
|
208
208
|
case "End":
|
|
209
|
-
|
|
209
|
+
x.value && (e.preventDefault(), K.highlightLast());
|
|
210
210
|
break;
|
|
211
211
|
case "Backspace":
|
|
212
|
-
if (P.value && !
|
|
212
|
+
if (P.value && !S.value && V.value.length > 0) {
|
|
213
213
|
e.preventDefault();
|
|
214
214
|
let t = V.value.at(-1);
|
|
215
|
-
t &&
|
|
215
|
+
t && We(t, e);
|
|
216
216
|
}
|
|
217
217
|
break;
|
|
218
218
|
case "Tab":
|
|
@@ -221,141 +221,141 @@ function g(g, _, v, y, b) {
|
|
|
221
221
|
default: break;
|
|
222
222
|
}
|
|
223
223
|
}
|
|
224
|
-
async function
|
|
225
|
-
let t =
|
|
224
|
+
async function Je(e) {
|
|
225
|
+
let t = A.value.asyncData;
|
|
226
226
|
if (t) {
|
|
227
|
-
|
|
227
|
+
T.value = !0;
|
|
228
228
|
try {
|
|
229
229
|
let { options: n, resolvedSelected: r } = await ve(t, e, B.value, (e) => ge(e, F.value));
|
|
230
|
-
r.length > 0 && (
|
|
230
|
+
r.length > 0 && (O.value = r), E.value = n;
|
|
231
231
|
} finally {
|
|
232
|
-
|
|
232
|
+
T.value = !1;
|
|
233
233
|
}
|
|
234
234
|
}
|
|
235
235
|
}
|
|
236
|
-
async function
|
|
237
|
-
let e =
|
|
238
|
-
!e?.resolve || B.value.length === 0 || (
|
|
236
|
+
async function Ye() {
|
|
237
|
+
let e = A.value.asyncData;
|
|
238
|
+
!e?.resolve || B.value.length === 0 || (O.value = ge(await e.resolve(B.value), F.value));
|
|
239
239
|
}
|
|
240
|
-
let
|
|
241
|
-
let e =
|
|
240
|
+
let Xe = a(() => {
|
|
241
|
+
let e = f(u(Se, f(M.value, [
|
|
242
242
|
"Listbox",
|
|
243
243
|
"tokens",
|
|
244
244
|
"color"
|
|
245
245
|
])), q.merged.value.color ?? "primary");
|
|
246
|
-
return q.invalidated.value ?
|
|
246
|
+
return q.invalidated.value ? u(Ce, f(M.value, [
|
|
247
247
|
"Listbox",
|
|
248
248
|
"tokens",
|
|
249
249
|
"invalidated"
|
|
250
250
|
])) : e;
|
|
251
|
-
}),
|
|
252
|
-
let e = !
|
|
251
|
+
}), Ze = a(() => Xe.value?.value), Qe = a(() => {
|
|
252
|
+
let e = !p.disabled && !p.readonly && !W.value, t = !p.disabled && !p.readonly && W.value && U.value, r = je.value && !P.value && !W.value;
|
|
253
253
|
return n({
|
|
254
254
|
role: "combobox",
|
|
255
|
-
value:
|
|
256
|
-
"aria-controls":
|
|
257
|
-
"aria-expanded":
|
|
258
|
-
readonly:
|
|
259
|
-
onKeydown:
|
|
260
|
-
placeholder:
|
|
255
|
+
value: Ie.value,
|
|
256
|
+
"aria-controls": y,
|
|
257
|
+
"aria-expanded": x.value,
|
|
258
|
+
readonly: Fe.value,
|
|
259
|
+
onKeydown: qe,
|
|
260
|
+
placeholder: A.value.placeholder,
|
|
261
261
|
"aria-autocomplete": U.value ? "list" : void 0,
|
|
262
|
-
"aria-activedescendant":
|
|
262
|
+
"aria-activedescendant": x.value ? K.activeDescendantId.value : void 0,
|
|
263
263
|
...P.value ? {
|
|
264
264
|
rows: 1,
|
|
265
265
|
onInput: (e) => {
|
|
266
|
-
|
|
266
|
+
Ke(e), J(e.target);
|
|
267
267
|
}
|
|
268
|
-
} : { onInput:
|
|
269
|
-
}, q.inputBind.value,
|
|
268
|
+
} : { onInput: Ke }
|
|
269
|
+
}, q.inputBind.value, c({
|
|
270
270
|
"cursor-text": t,
|
|
271
271
|
"cursor-pointer": e,
|
|
272
272
|
"resize-none overflow-hidden": P.value,
|
|
273
|
-
[
|
|
273
|
+
[c(Ze.value, N.value.value) ?? ""]: r
|
|
274
274
|
}));
|
|
275
275
|
});
|
|
276
|
-
|
|
277
|
-
|
|
276
|
+
s(() => [
|
|
277
|
+
x.value,
|
|
278
278
|
P.value,
|
|
279
|
-
|
|
279
|
+
h.value
|
|
280
280
|
], () => {
|
|
281
|
-
J(
|
|
282
|
-
}, { immediate: !0 }),
|
|
283
|
-
|
|
284
|
-
}, { immediate: !0 }),
|
|
285
|
-
if (
|
|
286
|
-
|
|
281
|
+
J(h.value);
|
|
282
|
+
}, { immediate: !0 }), s(() => m.value, () => {
|
|
283
|
+
Ye();
|
|
284
|
+
}, { immediate: !0 }), s(() => A.value.asyncData, (e) => {
|
|
285
|
+
if (D?.cancel(), E.value = [], Ye(), !e) {
|
|
286
|
+
D = null;
|
|
287
287
|
return;
|
|
288
288
|
}
|
|
289
|
-
|
|
290
|
-
}, { immediate: !0 }),
|
|
291
|
-
|
|
292
|
-
}),
|
|
293
|
-
J(
|
|
289
|
+
D = pe((e) => void Je(e), _e(e));
|
|
290
|
+
}, { immediate: !0 }), se(() => {
|
|
291
|
+
D?.cancel();
|
|
292
|
+
}), ce(() => {
|
|
293
|
+
J(h.value);
|
|
294
294
|
});
|
|
295
|
-
let
|
|
295
|
+
let $e = a(() => r(q.merged.value.size)), et = a(() => n({}, {}, {
|
|
296
296
|
tabindex: 0,
|
|
297
297
|
role: "button",
|
|
298
298
|
"data-select-clear": !0,
|
|
299
|
-
onMousedown:
|
|
300
|
-
class:
|
|
299
|
+
onMousedown: Re,
|
|
300
|
+
class: c({
|
|
301
301
|
"inline-flex shrink-0 cursor-pointer items-center justify-center rounded-sm transition-colors duration-150": !0,
|
|
302
|
-
[
|
|
302
|
+
[Xe.value?.clear ?? ""]: !0,
|
|
303
303
|
[N.value.clear ?? ""]: !0
|
|
304
304
|
})
|
|
305
|
-
})),
|
|
306
|
-
listboxId:
|
|
305
|
+
})), tt = a(() => ({
|
|
306
|
+
listboxId: y,
|
|
307
307
|
isSelected: Y,
|
|
308
308
|
disableAutoFocus: !0,
|
|
309
|
-
loading:
|
|
309
|
+
loading: Ne.value,
|
|
310
310
|
multiple: P.value,
|
|
311
|
-
maxHeight:
|
|
312
|
-
entries:
|
|
311
|
+
maxHeight: p.maxHeight,
|
|
312
|
+
entries: Pe.value,
|
|
313
313
|
options: G.value,
|
|
314
314
|
size: q.merged.value.size,
|
|
315
315
|
color: q.merged.value.color,
|
|
316
316
|
labelledBy: q.controlId.value,
|
|
317
317
|
rounded: q.merged.value.rounded,
|
|
318
318
|
invalidated: q.invalidated.value,
|
|
319
|
-
highlightedIndex:
|
|
320
|
-
disableMaxHeight:
|
|
321
|
-
hideEmptyMessage:
|
|
322
|
-
emptyMessage:
|
|
323
|
-
loadingMessage:
|
|
324
|
-
...
|
|
319
|
+
highlightedIndex: C.value,
|
|
320
|
+
disableMaxHeight: p.disableMaxHeight === !0,
|
|
321
|
+
hideEmptyMessage: A.value.hideEmptyMessage === !0,
|
|
322
|
+
emptyMessage: A.value.emptyMessage ?? b("No options"),
|
|
323
|
+
loadingMessage: A.value.loadingMessage ?? b("Loading..."),
|
|
324
|
+
...Ve.value
|
|
325
325
|
}));
|
|
326
|
-
function
|
|
326
|
+
function nt(e) {
|
|
327
327
|
let t = L.value;
|
|
328
328
|
t.length === e.length && t.every((t, n) => String(t.value) === String(e[n]?.value)) || (L.value = e);
|
|
329
329
|
}
|
|
330
330
|
return {
|
|
331
|
-
open:
|
|
332
|
-
slots:
|
|
333
|
-
hasValue:
|
|
331
|
+
open: x,
|
|
332
|
+
slots: v,
|
|
333
|
+
hasValue: je,
|
|
334
334
|
multiple: P,
|
|
335
|
-
listboxId:
|
|
335
|
+
listboxId: y,
|
|
336
336
|
formField: q,
|
|
337
|
-
isLoading:
|
|
338
|
-
clearable:
|
|
339
|
-
clearBind:
|
|
337
|
+
isLoading: Ne,
|
|
338
|
+
clearable: Me,
|
|
339
|
+
clearBind: et,
|
|
340
340
|
isSelected: Y,
|
|
341
|
-
clearValue:
|
|
342
|
-
removeChip:
|
|
343
|
-
triggerBind:
|
|
344
|
-
selectOption:
|
|
345
|
-
containerRef:
|
|
346
|
-
listboxProps:
|
|
347
|
-
clearIconSize:
|
|
341
|
+
clearValue: Ue,
|
|
342
|
+
removeChip: We,
|
|
343
|
+
triggerBind: Qe,
|
|
344
|
+
selectOption: He,
|
|
345
|
+
containerRef: w,
|
|
346
|
+
listboxProps: tt,
|
|
347
|
+
clearIconSize: $e,
|
|
348
348
|
mergedClasses: N,
|
|
349
349
|
visibleOptions: G,
|
|
350
350
|
isSearchActive: W,
|
|
351
351
|
selectedOptions: V,
|
|
352
352
|
hasComposedList: R,
|
|
353
|
-
highlightedIndex:
|
|
354
|
-
handleRegisteredOptionsChange:
|
|
355
|
-
hideEmptyMessage: a(() =>
|
|
356
|
-
emptyMessage: a(() =>
|
|
357
|
-
loadingMessage: a(() =>
|
|
353
|
+
highlightedIndex: C,
|
|
354
|
+
handleRegisteredOptionsChange: nt,
|
|
355
|
+
hideEmptyMessage: a(() => A.value.hideEmptyMessage === !0),
|
|
356
|
+
emptyMessage: a(() => A.value.emptyMessage ?? b("No options")),
|
|
357
|
+
loadingMessage: a(() => A.value.loadingMessage ?? b("Loading..."))
|
|
358
358
|
};
|
|
359
359
|
}
|
|
360
360
|
//#endregion
|
|
361
|
-
export {
|
|
361
|
+
export { p as useSelect };
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { mergePartBind as e, useBridgeUIComponent as t, useBridgeUIMergedRegistryClasses as n } from "../../../Utils/index.js";
|
|
2
2
|
import { computed as r, useAttrs as i } from "vue";
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { cn as a, mergeBridgeUILayeredClasses as o, splitComponentProps as s } from "@bridge-ui/core";
|
|
4
|
+
import { get as c } from "es-toolkit/compat";
|
|
5
5
|
import { roundedProps as l } from "@bridge-ui/core/Tokens/Skeleton";
|
|
6
6
|
//#region src/Components/Skeleton/composables/useSkeleton.ts
|
|
7
7
|
var u = ["classes", "rounded"];
|
|
8
8
|
function d(d, f) {
|
|
9
|
-
let p = i(), m = r(() =>
|
|
9
|
+
let p = i(), m = r(() => s({
|
|
10
10
|
props: {
|
|
11
11
|
...p,
|
|
12
12
|
...d
|
|
@@ -19,10 +19,10 @@ function d(d, f) {
|
|
|
19
19
|
}), _ = n({
|
|
20
20
|
entry: g,
|
|
21
21
|
props: () => m.value.componentProps
|
|
22
|
-
}), v = r(() =>
|
|
22
|
+
}), v = r(() => c(o(l, g.value?.tokens?.rounded), h.value.rounded));
|
|
23
23
|
return {
|
|
24
24
|
merged: h,
|
|
25
|
-
rootBind: r(() => e({}, m.value.inheritedAttrs,
|
|
25
|
+
rootBind: r(() => e({}, m.value.inheritedAttrs, a({
|
|
26
26
|
"block animate-pulse bg-gray-200 dark:bg-gray-700": !0,
|
|
27
27
|
[v.value ?? ""]: !0,
|
|
28
28
|
[_.value.root ?? ""]: !0
|