@profitliga/ui 2.0.2 → 2.0.3
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/components/v2/Combobox/Combobox.css +1 -1
- package/dist/components/v2/Combobox/Combobox.types.d.ts +14 -0
- package/dist/components/v2/Combobox/Combobox.vue.d.ts +3 -2
- package/dist/components/v2/Combobox/Combobox.vue.js +1 -1
- package/dist/components/v2/Combobox/Combobox.vue2.js +300 -255
- package/dist/components/v2/Divider/Divider.css +1 -1
- package/dist/components/v2/Divider/Divider.vue.js +2 -2
- package/dist/components/v2/Input/Input.css +1 -1
- package/dist/components/v2/Input/Input.vue.js +2 -2
- package/dist/components/v2/Input/Input.vue2.js +113 -107
- package/dist/components/v2/Select/Select.css +1 -1
- package/dist/components/v2/Select/Select.vue.js +1 -1
- package/dist/components/v2/Select/Select.vue2.js +107 -101
- package/package.json +1 -1
|
@@ -1,18 +1,18 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Search as
|
|
3
|
-
import { breakpoints as
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useTestId as
|
|
9
|
-
const
|
|
1
|
+
import { defineComponent as Ge, useModel as ye, useId as ze, useAttrs as Ue, computed as u, ref as E, useTemplateRef as R, shallowRef as Xe, watch as I, onMounted as qe, nextTick as G, onBeforeUnmount as Ke, openBlock as c, createElementBlock as f, mergeProps as v, unref as s, toDisplayString as w, createCommentVNode as g, createVNode as M, withCtx as Y, createElementVNode as x, renderSlot as z, createTextVNode as ge, Fragment as ke, renderList as _e, createBlock as Z, resolveDynamicComponent as je, withModifiers as ee, mergeModels as we } from "vue";
|
|
2
|
+
import { Search as Qe, CircleX as He, X as Je, ChevronDown as Ye } from "@lucide/vue";
|
|
3
|
+
import { breakpoints as Ze } from "../../../utils/breakpoints.util.js";
|
|
4
|
+
import ea from "../Input/Input.vue.js";
|
|
5
|
+
import aa from "../Popover/Popover.vue.js";
|
|
6
|
+
import la from "../Radio/RadioMarker.vue.js";
|
|
7
|
+
import ta from "../Select/SelectCheckMarker.vue.js";
|
|
8
|
+
import { useTestId as oa } from "../shared/useTestId.util.js";
|
|
9
|
+
const ia = ["value", "placeholder", "disabled", "readonly", "aria-labelledby", "aria-label", "aria-describedby", "aria-activedescendant"], sa = ["aria-hidden"], na = ["src"], ua = { class: "combobox__chip-label" }, ra = ["disabled", "tabindex", "aria-label", "onClick"], ca = ["aria-hidden"], da = ["aria-label"], fa = ["disabled"], va = { class: "combobox-list" }, ba = {
|
|
10
10
|
key: 0,
|
|
11
11
|
class: "combobox-list__search"
|
|
12
|
-
},
|
|
12
|
+
}, ma = ["aria-label", "aria-multiselectable"], ha = ["id", "aria-selected", "aria-disabled", "onClick", "onMouseenter"], pa = { class: "combobox-list__label" }, xa = 64, Ma = /* @__PURE__ */ Ge({
|
|
13
13
|
inheritAttrs: !1,
|
|
14
14
|
__name: "Combobox",
|
|
15
|
-
props: /* @__PURE__ */
|
|
15
|
+
props: /* @__PURE__ */ we({
|
|
16
16
|
options: {},
|
|
17
17
|
multiple: { type: Boolean, default: !1 },
|
|
18
18
|
filter: { type: Boolean, default: !0 },
|
|
@@ -25,6 +25,7 @@ const Qe = ["value", "placeholder", "disabled", "readonly", "aria-labelledby", "
|
|
|
25
25
|
invalid: { type: Boolean, default: !1 },
|
|
26
26
|
size: { default: "default" },
|
|
27
27
|
disabled: { type: Boolean, default: !1 },
|
|
28
|
+
hideEmptyList: { type: Boolean, default: !1 },
|
|
28
29
|
emptyText: { default: "Нет вариантов" },
|
|
29
30
|
notFoundText: { default: "Ничего не найдено" },
|
|
30
31
|
loadingText: { default: "Загрузка…" },
|
|
@@ -44,438 +45,482 @@ const Qe = ["value", "placeholder", "disabled", "readonly", "aria-labelledby", "
|
|
|
44
45
|
search: { default: "" },
|
|
45
46
|
searchModifiers: {}
|
|
46
47
|
}),
|
|
47
|
-
emits: /* @__PURE__ */
|
|
48
|
-
setup(
|
|
49
|
-
const o =
|
|
50
|
-
class:
|
|
51
|
-
style:
|
|
52
|
-
})),
|
|
53
|
-
const { class: e, style: a, ...l } =
|
|
48
|
+
emits: /* @__PURE__ */ we(["change", "select", "search", "clear"], ["update:modelValue", "update:search"]),
|
|
49
|
+
setup(i, { emit: Ce }) {
|
|
50
|
+
const o = i, p = Ce, T = ye(i, "modelValue"), n = ye(i, "search"), V = ze(), ae = `combobox-input-${V}`, le = `combobox-label-${V}`, C = `combobox-list-${V}`, te = `combobox-message-${V}`, d = oa(() => o.testId), U = Ue(), Re = u(() => ({
|
|
51
|
+
class: U.class,
|
|
52
|
+
style: U.style
|
|
53
|
+
})), Ie = u(() => {
|
|
54
|
+
const { class: e, style: a, ...l } = U;
|
|
54
55
|
return l;
|
|
55
|
-
}),
|
|
56
|
-
const e =
|
|
56
|
+
}), k = Ze.smaller(o.breakpointMobile), b = E(!1), oe = R("fieldRef"), N = R("contentRef"), ie = R("chipsRef"), se = R("counterRef"), L = R("inputRef"), ne = R("listRef"), _ = E(Number.MAX_SAFE_INTEGER), X = E(0), r = E(-1), m = u(() => {
|
|
57
|
+
const e = T.value;
|
|
57
58
|
return e == null ? [] : Array.isArray(e) ? e : [e];
|
|
58
|
-
}),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
() =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
59
|
+
}), q = Xe(/* @__PURE__ */ new Map());
|
|
60
|
+
I(
|
|
61
|
+
[m, () => o.options],
|
|
62
|
+
() => {
|
|
63
|
+
const e = /* @__PURE__ */ new Map();
|
|
64
|
+
for (const a of m.value) {
|
|
65
|
+
const l = o.options.find((t) => t.value === a) ?? q.value.get(a);
|
|
66
|
+
l && e.set(a, l);
|
|
67
|
+
}
|
|
68
|
+
q.value = e;
|
|
69
|
+
},
|
|
70
|
+
{ immediate: !0 }
|
|
71
|
+
);
|
|
72
|
+
const S = u(() => {
|
|
73
|
+
const e = o.options.filter(
|
|
74
|
+
(t) => m.value.includes(t.value)
|
|
75
|
+
);
|
|
76
|
+
if (e.length === m.value.length) return e;
|
|
77
|
+
const a = new Set(e.map((t) => t.value)), l = m.value.filter((t) => !a.has(t)).map((t) => q.value.get(t)).filter((t) => t !== void 0);
|
|
78
|
+
return [...e, ...l];
|
|
79
|
+
}), ue = u(
|
|
80
|
+
() => S.value.map((e) => e.label).join(", ")
|
|
81
|
+
), K = u(
|
|
82
|
+
() => o.multiple && S.value.length > 0
|
|
83
|
+
), Me = u(
|
|
84
|
+
() => !o.multiple && !o.disabled && m.value.length > 0
|
|
85
|
+
), Te = u(() => "Очистить поле"), D = u(
|
|
86
|
+
() => Math.max(0, S.value.length - _.value)
|
|
87
|
+
), $ = E(!1), Se = u(() => b.value && $.value ? n.value : o.multiple ? "" : ue.value), $e = u(() => K.value ? "" : o.placeholder), y = u(() => {
|
|
88
|
+
const e = n.value.trim().toLowerCase();
|
|
68
89
|
return !o.filter || !e ? o.options : o.options.filter(
|
|
69
90
|
(a) => a.label.toLowerCase().includes(e)
|
|
70
91
|
);
|
|
71
|
-
}),
|
|
92
|
+
}), Ae = u(
|
|
93
|
+
() => o.loading || y.value.length > 0
|
|
94
|
+
), F = u({
|
|
95
|
+
get: () => b.value && (!o.hideEmptyList || k.value || Ae.value),
|
|
96
|
+
set: (e) => {
|
|
97
|
+
b.value = e;
|
|
98
|
+
}
|
|
99
|
+
}), j = u(
|
|
72
100
|
() => o.invalid ? o.errorText ?? o.supportText : o.supportText
|
|
73
|
-
),
|
|
74
|
-
() =>
|
|
75
|
-
),
|
|
101
|
+
), Be = u(() => o.width ?? X.value), re = u(
|
|
102
|
+
() => F.value && r.value !== -1 ? `${C}-option-${r.value}` : void 0
|
|
103
|
+
), Ee = u(() => [
|
|
76
104
|
"combobox",
|
|
77
105
|
`combobox--${o.size}`,
|
|
78
106
|
{
|
|
79
|
-
|
|
107
|
+
/* Стрелка и рамка следуют за видимым списком, а не за намерением открыть. */
|
|
108
|
+
"combobox--open": F.value,
|
|
80
109
|
"combobox--invalid": o.invalid,
|
|
81
110
|
"combobox--disabled": o.disabled,
|
|
82
111
|
"combobox--multiple": o.multiple
|
|
83
112
|
}
|
|
84
113
|
]);
|
|
85
|
-
function
|
|
86
|
-
return
|
|
114
|
+
function A(e) {
|
|
115
|
+
return m.value.includes(e);
|
|
87
116
|
}
|
|
88
|
-
function
|
|
89
|
-
const a =
|
|
117
|
+
function Q(e) {
|
|
118
|
+
const a = y.value[e];
|
|
90
119
|
return !!a && !a?.disabled;
|
|
91
120
|
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
121
|
+
function ce() {
|
|
122
|
+
return y.value.findIndex((e, a) => Q(a));
|
|
94
123
|
}
|
|
95
|
-
function
|
|
96
|
-
for (let e =
|
|
97
|
-
if (
|
|
124
|
+
function Ve() {
|
|
125
|
+
for (let e = y.value.length - 1; e >= 0; e -= 1)
|
|
126
|
+
if (Q(e)) return e;
|
|
98
127
|
return -1;
|
|
99
128
|
}
|
|
100
|
-
function
|
|
101
|
-
const l =
|
|
129
|
+
function de(e, a) {
|
|
130
|
+
const l = y.value.length;
|
|
102
131
|
if (l === 0) return -1;
|
|
103
|
-
let
|
|
104
|
-
for (let
|
|
105
|
-
if (
|
|
132
|
+
let t = e;
|
|
133
|
+
for (let h = 0; h < l; h += 1)
|
|
134
|
+
if (t = (t + a + l) % l, Q(t)) return t;
|
|
106
135
|
return -1;
|
|
107
136
|
}
|
|
108
|
-
function
|
|
109
|
-
|
|
137
|
+
function O() {
|
|
138
|
+
k.value || L.value?.focus();
|
|
110
139
|
}
|
|
111
|
-
function
|
|
112
|
-
o.disabled ||
|
|
140
|
+
function B() {
|
|
141
|
+
o.disabled || b.value || (b.value = !0);
|
|
113
142
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
143
|
+
function P() {
|
|
144
|
+
b.value = !1;
|
|
116
145
|
}
|
|
117
|
-
function
|
|
118
|
-
|
|
146
|
+
function Ne() {
|
|
147
|
+
o.disabled || (T.value = void 0, p("change", void 0), p("clear"), $.value = !1, n.value && (n.value = "", p("search", "")), O());
|
|
119
148
|
}
|
|
120
|
-
function
|
|
149
|
+
function Le(e) {
|
|
150
|
+
e.stopPropagation(), !o.disabled && (B(), O());
|
|
151
|
+
}
|
|
152
|
+
function De() {
|
|
121
153
|
if (!o.disabled) {
|
|
122
|
-
if (
|
|
123
|
-
|
|
154
|
+
if (b.value) {
|
|
155
|
+
P();
|
|
124
156
|
return;
|
|
125
157
|
}
|
|
126
|
-
|
|
158
|
+
B(), O();
|
|
127
159
|
}
|
|
128
160
|
}
|
|
129
|
-
function
|
|
161
|
+
function fe(e) {
|
|
130
162
|
const a = e.target.value;
|
|
131
|
-
|
|
163
|
+
$.value = !0, n.value = a, p("search", a), B();
|
|
132
164
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
165
|
+
function Fe(e) {
|
|
166
|
+
k.value || e.preventDefault();
|
|
135
167
|
}
|
|
136
|
-
function
|
|
137
|
-
a || (
|
|
168
|
+
function Oe(e, a) {
|
|
169
|
+
a || (r.value = e);
|
|
138
170
|
}
|
|
139
|
-
function
|
|
171
|
+
function ve(e) {
|
|
140
172
|
switch (e.key) {
|
|
141
173
|
case "ArrowDown":
|
|
142
|
-
if (e.preventDefault(), !
|
|
143
|
-
|
|
174
|
+
if (e.preventDefault(), !b.value) {
|
|
175
|
+
B();
|
|
144
176
|
break;
|
|
145
177
|
}
|
|
146
|
-
|
|
178
|
+
r.value = de(r.value, 1);
|
|
147
179
|
break;
|
|
148
180
|
case "ArrowUp":
|
|
149
|
-
if (e.preventDefault(), !
|
|
150
|
-
|
|
181
|
+
if (e.preventDefault(), !b.value) {
|
|
182
|
+
B();
|
|
151
183
|
break;
|
|
152
184
|
}
|
|
153
|
-
|
|
185
|
+
r.value = r.value === -1 ? Ve() : de(r.value, -1);
|
|
154
186
|
break;
|
|
155
187
|
case "Enter": {
|
|
156
|
-
if (!
|
|
157
|
-
const a =
|
|
188
|
+
if (!b.value) break;
|
|
189
|
+
const a = y.value[r.value];
|
|
158
190
|
if (!a) break;
|
|
159
|
-
e.preventDefault(),
|
|
191
|
+
e.preventDefault(), be(a);
|
|
160
192
|
break;
|
|
161
193
|
}
|
|
162
194
|
case "Escape":
|
|
163
|
-
if (
|
|
164
|
-
|
|
195
|
+
if (b.value) {
|
|
196
|
+
n.value = "";
|
|
165
197
|
break;
|
|
166
198
|
}
|
|
167
|
-
|
|
199
|
+
n.value && (n.value = "");
|
|
168
200
|
break;
|
|
169
201
|
case "Tab":
|
|
170
|
-
|
|
202
|
+
P();
|
|
171
203
|
break;
|
|
172
204
|
case "Backspace": {
|
|
173
|
-
if (!o.multiple ||
|
|
174
|
-
const a =
|
|
205
|
+
if (!o.multiple || n.value) break;
|
|
206
|
+
const a = m.value[m.value.length - 1];
|
|
175
207
|
if (a === void 0) break;
|
|
176
|
-
|
|
208
|
+
me(a);
|
|
177
209
|
break;
|
|
178
210
|
}
|
|
179
211
|
}
|
|
180
212
|
}
|
|
181
|
-
function
|
|
213
|
+
function be(e) {
|
|
182
214
|
if (!(e.disabled || o.disabled)) {
|
|
183
215
|
if (o.multiple) {
|
|
184
|
-
const a =
|
|
185
|
-
|
|
216
|
+
const a = A(e.value) ? m.value.filter((l) => l !== e.value) : [...m.value, e.value];
|
|
217
|
+
T.value = a, p("change", a), n.value && (n.value = "", p("search", "")), O();
|
|
186
218
|
} else
|
|
187
|
-
|
|
188
|
-
|
|
219
|
+
T.value = e.value, p("change", e.value), P(), k.value || L.value?.focus();
|
|
220
|
+
p("select", e);
|
|
189
221
|
}
|
|
190
222
|
}
|
|
191
|
-
function
|
|
223
|
+
function me(e) {
|
|
192
224
|
if (o.disabled) return;
|
|
193
|
-
const a =
|
|
194
|
-
|
|
225
|
+
const a = m.value.filter((l) => l !== e);
|
|
226
|
+
T.value = a, p("change", a);
|
|
195
227
|
}
|
|
196
|
-
function
|
|
228
|
+
function H() {
|
|
197
229
|
if (!o.multiple) return;
|
|
198
|
-
const e =
|
|
230
|
+
const e = N.value, a = ie.value;
|
|
199
231
|
if (!e || !a) return;
|
|
200
232
|
const l = Array.from(
|
|
201
233
|
a.querySelectorAll('[data-chip="item"]')
|
|
202
234
|
);
|
|
203
235
|
if (!l.length) {
|
|
204
|
-
|
|
236
|
+
_.value = Number.MAX_SAFE_INTEGER;
|
|
205
237
|
return;
|
|
206
238
|
}
|
|
207
|
-
const
|
|
208
|
-
let
|
|
209
|
-
for (const
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
|
|
239
|
+
const t = Number.parseFloat(getComputedStyle(a).columnGap) || 0, h = Number.parseFloat(getComputedStyle(e).columnGap) || 0, he = D.value ? (se.value?.offsetWidth ?? 0) + h : 0, Pe = e.clientWidth - he - xa - h;
|
|
240
|
+
let pe = 0, J = 0;
|
|
241
|
+
for (const We of l) {
|
|
242
|
+
const xe = pe + (J ? t : 0) + We.offsetWidth;
|
|
243
|
+
if (xe > Pe) break;
|
|
244
|
+
pe = xe, J += 1;
|
|
213
245
|
}
|
|
214
|
-
|
|
246
|
+
_.value = Math.max(J, 1);
|
|
215
247
|
}
|
|
216
|
-
let
|
|
217
|
-
return
|
|
218
|
-
const e =
|
|
219
|
-
e && (
|
|
248
|
+
let W;
|
|
249
|
+
return qe(() => {
|
|
250
|
+
const e = oe.value;
|
|
251
|
+
e && (X.value = e.getBoundingClientRect().width, G(H), W = new ResizeObserver((a) => {
|
|
220
252
|
for (const l of a)
|
|
221
|
-
l.target === e && (
|
|
222
|
-
|
|
223
|
-
}),
|
|
224
|
-
}),
|
|
225
|
-
() =>
|
|
253
|
+
l.target === e && (X.value = l.borderBoxSize?.[0]?.inlineSize ?? e.getBoundingClientRect().width);
|
|
254
|
+
H();
|
|
255
|
+
}), W.observe(e), N.value && W.observe(N.value));
|
|
256
|
+
}), Ke(() => W?.disconnect()), I(
|
|
257
|
+
() => S.value.map((e) => e.value).join("|"),
|
|
226
258
|
() => {
|
|
227
|
-
|
|
259
|
+
_.value = Number.MAX_SAFE_INTEGER, G(H);
|
|
228
260
|
}
|
|
229
|
-
),
|
|
230
|
-
|
|
231
|
-
}),
|
|
261
|
+
), I([y, n], () => {
|
|
262
|
+
r.value = n.value ? ce() : -1;
|
|
263
|
+
}), I(b, (e) => {
|
|
232
264
|
if (e) {
|
|
233
|
-
|
|
265
|
+
r.value = n.value ? ce() : -1, $.value = !1, !k.value && !o.multiple && ue.value && G(() => L.value?.select());
|
|
234
266
|
return;
|
|
235
267
|
}
|
|
236
|
-
|
|
237
|
-
}),
|
|
238
|
-
e !== -1 &&
|
|
239
|
-
|
|
240
|
-
`#${CSS.escape(`${
|
|
268
|
+
r.value = -1, $.value = !1, n.value && (n.value = "", p("search", ""));
|
|
269
|
+
}), I(r, (e) => {
|
|
270
|
+
e !== -1 && G(() => {
|
|
271
|
+
ne.value?.querySelector(
|
|
272
|
+
`#${CSS.escape(`${C}-option-${e}`)}`
|
|
241
273
|
)?.scrollIntoView({ block: "nearest" });
|
|
242
274
|
});
|
|
243
|
-
}),
|
|
275
|
+
}), I(
|
|
244
276
|
() => o.disabled,
|
|
245
277
|
(e) => {
|
|
246
|
-
e &&
|
|
278
|
+
e && P();
|
|
247
279
|
}
|
|
248
|
-
), (e, a) => (
|
|
249
|
-
|
|
280
|
+
), (e, a) => (c(), f("div", v({ class: Ee.value }, { ...Re.value, ...s(d)("root") }), [
|
|
281
|
+
i.label ? (c(), f("label", v({
|
|
250
282
|
key: 0,
|
|
251
|
-
id:
|
|
283
|
+
id: le,
|
|
252
284
|
class: "combobox__label",
|
|
253
|
-
for:
|
|
254
|
-
}, s(
|
|
255
|
-
|
|
256
|
-
open:
|
|
257
|
-
"onUpdate:open": a[1] || (a[1] = (l) =>
|
|
258
|
-
width:
|
|
259
|
-
side:
|
|
260
|
-
"side-offset":
|
|
261
|
-
align:
|
|
262
|
-
"align-offset":
|
|
285
|
+
for: ae
|
|
286
|
+
}, s(d)("label")), w(i.label), 17)) : g("", !0),
|
|
287
|
+
M(s(aa), {
|
|
288
|
+
open: F.value,
|
|
289
|
+
"onUpdate:open": a[1] || (a[1] = (l) => F.value = l),
|
|
290
|
+
width: Be.value,
|
|
291
|
+
side: i.side,
|
|
292
|
+
"side-offset": i.sideOffset,
|
|
293
|
+
align: i.align,
|
|
294
|
+
"align-offset": i.alignOffset,
|
|
263
295
|
arrow: !1,
|
|
264
|
-
"breakpoint-mobile":
|
|
296
|
+
"breakpoint-mobile": i.breakpointMobile,
|
|
265
297
|
"trigger-has-popup": "listbox",
|
|
266
|
-
"trigger-controls":
|
|
298
|
+
"trigger-controls": C,
|
|
267
299
|
"trap-focus": !1,
|
|
268
|
-
"test-id":
|
|
300
|
+
"test-id": i.testId
|
|
269
301
|
}, {
|
|
270
|
-
trigger:
|
|
271
|
-
|
|
302
|
+
trigger: Y(({ props: l }) => [
|
|
303
|
+
x("div", v({
|
|
272
304
|
ref_key: "fieldRef",
|
|
273
|
-
ref:
|
|
305
|
+
ref: oe,
|
|
274
306
|
class: "combobox__field"
|
|
275
|
-
}, s(
|
|
276
|
-
|
|
307
|
+
}, s(d)("field"), { onClick: Le }), [
|
|
308
|
+
x("div", {
|
|
277
309
|
ref_key: "contentRef",
|
|
278
|
-
ref:
|
|
310
|
+
ref: N,
|
|
279
311
|
class: "combobox__content"
|
|
280
312
|
}, [
|
|
281
|
-
|
|
282
|
-
id:
|
|
313
|
+
x("input", v({
|
|
314
|
+
id: ae,
|
|
283
315
|
ref_key: "inputRef",
|
|
284
|
-
ref:
|
|
316
|
+
ref: L,
|
|
285
317
|
role: "combobox",
|
|
286
318
|
type: "text",
|
|
287
319
|
class: "combobox__input",
|
|
288
320
|
autocomplete: "off",
|
|
289
321
|
spellcheck: "false",
|
|
290
322
|
"aria-autocomplete": "list",
|
|
291
|
-
value:
|
|
292
|
-
placeholder:
|
|
293
|
-
disabled:
|
|
294
|
-
readonly: s(
|
|
295
|
-
"aria-labelledby":
|
|
296
|
-
"aria-label":
|
|
297
|
-
"aria-describedby":
|
|
298
|
-
"aria-activedescendant":
|
|
323
|
+
value: Se.value,
|
|
324
|
+
placeholder: $e.value,
|
|
325
|
+
disabled: i.disabled,
|
|
326
|
+
readonly: s(k),
|
|
327
|
+
"aria-labelledby": i.label ? le : void 0,
|
|
328
|
+
"aria-label": i.label ? void 0 : i.ariaLabel,
|
|
329
|
+
"aria-describedby": j.value ? te : void 0,
|
|
330
|
+
"aria-activedescendant": re.value
|
|
299
331
|
}, {
|
|
300
332
|
...l,
|
|
301
|
-
...
|
|
302
|
-
...s(
|
|
333
|
+
...Ie.value,
|
|
334
|
+
...s(d)("input")
|
|
303
335
|
}, {
|
|
304
|
-
onInput:
|
|
305
|
-
onKeydown:
|
|
306
|
-
}), null, 16,
|
|
307
|
-
|
|
336
|
+
onInput: fe,
|
|
337
|
+
onKeydown: ve
|
|
338
|
+
}), null, 16, ia),
|
|
339
|
+
K.value ? (c(), f("span", {
|
|
308
340
|
key: 0,
|
|
309
341
|
ref_key: "chipsRef",
|
|
310
|
-
ref:
|
|
342
|
+
ref: ie,
|
|
311
343
|
class: "combobox__chips"
|
|
312
344
|
}, [
|
|
313
|
-
(
|
|
314
|
-
key:
|
|
345
|
+
(c(!0), f(ke, null, _e(S.value, (t, h) => (c(), f("span", v({
|
|
346
|
+
key: t.value,
|
|
315
347
|
"data-chip": "item",
|
|
316
348
|
class: ["combobox__chip", {
|
|
317
|
-
"combobox__chip--measured":
|
|
349
|
+
"combobox__chip--measured": h >= _.value
|
|
318
350
|
}],
|
|
319
|
-
"aria-hidden":
|
|
320
|
-
}, { ref_for: !0 }, s(
|
|
321
|
-
|
|
322
|
-
option:
|
|
323
|
-
index:
|
|
351
|
+
"aria-hidden": h >= _.value || void 0
|
|
352
|
+
}, { ref_for: !0 }, s(d)("chip", t.value)), [
|
|
353
|
+
z(e.$slots, "chip", {
|
|
354
|
+
option: t,
|
|
355
|
+
index: h
|
|
324
356
|
}, () => [
|
|
325
|
-
|
|
357
|
+
t.avatar ? (c(), f("img", {
|
|
326
358
|
key: 0,
|
|
327
359
|
class: "combobox__chip-avatar",
|
|
328
|
-
src:
|
|
360
|
+
src: t.avatar,
|
|
329
361
|
alt: ""
|
|
330
|
-
}, null, 8,
|
|
362
|
+
}, null, 8, na)) : t.icon ? (c(), Z(je(t.icon), {
|
|
331
363
|
key: 1,
|
|
332
364
|
class: "combobox__chip-icon",
|
|
333
365
|
"aria-hidden": "true"
|
|
334
|
-
})) :
|
|
335
|
-
|
|
366
|
+
})) : g("", !0),
|
|
367
|
+
x("span", ua, w(t.label), 1)
|
|
336
368
|
], !0),
|
|
337
|
-
|
|
369
|
+
x("button", v({
|
|
338
370
|
type: "button",
|
|
339
371
|
class: "combobox__chip-remove",
|
|
340
|
-
disabled:
|
|
341
|
-
tabindex:
|
|
342
|
-
"aria-label": `Убрать ${
|
|
343
|
-
}, { ref_for: !0 }, s(
|
|
344
|
-
onClick:
|
|
372
|
+
disabled: i.disabled,
|
|
373
|
+
tabindex: h >= _.value ? -1 : void 0,
|
|
374
|
+
"aria-label": `Убрать ${t.label}`
|
|
375
|
+
}, { ref_for: !0 }, s(d)("chip-remove", t.value), {
|
|
376
|
+
onClick: ee((he) => me(t.value), ["stop"])
|
|
345
377
|
}), [
|
|
346
|
-
|
|
378
|
+
M(s(He), {
|
|
347
379
|
class: "combobox__chip-icon",
|
|
348
380
|
"aria-hidden": "true"
|
|
349
381
|
})
|
|
350
|
-
], 16,
|
|
351
|
-
], 16,
|
|
352
|
-
], 512)) :
|
|
353
|
-
|
|
382
|
+
], 16, ra)
|
|
383
|
+
], 16, sa))), 128))
|
|
384
|
+
], 512)) : g("", !0),
|
|
385
|
+
K.value ? (c(), f("span", v({
|
|
354
386
|
key: 1,
|
|
355
387
|
ref_key: "counterRef",
|
|
356
|
-
ref:
|
|
388
|
+
ref: se,
|
|
357
389
|
class: ["combobox__chip combobox__chip--counter", {
|
|
358
|
-
"combobox__chip--measured": !
|
|
390
|
+
"combobox__chip--measured": !D.value
|
|
359
391
|
}],
|
|
360
|
-
"aria-hidden": !
|
|
361
|
-
}, s(
|
|
392
|
+
"aria-hidden": !D.value || void 0
|
|
393
|
+
}, s(d)("chip-counter")), " +" + w(D.value || 1), 17, ca)) : g("", !0)
|
|
362
394
|
], 512),
|
|
363
|
-
|
|
395
|
+
Me.value ? (c(), f("button", v({
|
|
396
|
+
key: 0,
|
|
397
|
+
type: "button",
|
|
398
|
+
class: "combobox__clear-button",
|
|
399
|
+
"aria-label": Te.value
|
|
400
|
+
}, s(d)("clear"), {
|
|
401
|
+
onClick: ee(Ne, ["stop"])
|
|
402
|
+
}), [
|
|
403
|
+
M(s(Je), {
|
|
404
|
+
class: "combobox__clear",
|
|
405
|
+
"aria-hidden": "true"
|
|
406
|
+
})
|
|
407
|
+
], 16, da)) : g("", !0),
|
|
408
|
+
x("button", v({
|
|
364
409
|
type: "button",
|
|
365
410
|
class: "combobox__arrow-button",
|
|
366
411
|
tabindex: "-1",
|
|
367
412
|
"aria-hidden": "true",
|
|
368
|
-
disabled:
|
|
369
|
-
}, s(
|
|
370
|
-
onClick:
|
|
413
|
+
disabled: i.disabled
|
|
414
|
+
}, s(d)("arrow"), {
|
|
415
|
+
onClick: ee(De, ["stop"])
|
|
371
416
|
}), [
|
|
372
|
-
|
|
373
|
-
], 16,
|
|
417
|
+
M(s(Ye), { class: "combobox__arrow" })
|
|
418
|
+
], 16, fa)
|
|
374
419
|
], 16)
|
|
375
420
|
]),
|
|
376
|
-
default:
|
|
377
|
-
|
|
378
|
-
s(
|
|
379
|
-
|
|
380
|
-
modelValue:
|
|
381
|
-
"onUpdate:modelValue": a[0] || (a[0] = (l) =>
|
|
421
|
+
default: Y(() => [
|
|
422
|
+
x("div", va, [
|
|
423
|
+
s(k) ? (c(), f("div", ba, [
|
|
424
|
+
M(s(ea), v({
|
|
425
|
+
modelValue: n.value,
|
|
426
|
+
"onUpdate:modelValue": a[0] || (a[0] = (l) => n.value = l),
|
|
382
427
|
"native-type": "search",
|
|
383
|
-
placeholder:
|
|
384
|
-
"aria-label":
|
|
385
|
-
"aria-controls":
|
|
386
|
-
"aria-activedescendant":
|
|
428
|
+
placeholder: i.searchPlaceholder,
|
|
429
|
+
"aria-label": i.searchPlaceholder,
|
|
430
|
+
"aria-controls": C,
|
|
431
|
+
"aria-activedescendant": re.value,
|
|
387
432
|
"aria-autocomplete": "list",
|
|
388
433
|
autocomplete: "off",
|
|
389
434
|
spellcheck: "false"
|
|
390
|
-
}, s(
|
|
391
|
-
onInput:
|
|
392
|
-
onKeydown:
|
|
435
|
+
}, s(d)("search"), {
|
|
436
|
+
onInput: fe,
|
|
437
|
+
onKeydown: ve
|
|
393
438
|
}), {
|
|
394
|
-
prefix:
|
|
395
|
-
|
|
439
|
+
prefix: Y(() => [
|
|
440
|
+
M(s(Qe), { "aria-hidden": "true" })
|
|
396
441
|
]),
|
|
397
442
|
_: 1
|
|
398
443
|
}, 16, ["modelValue", "placeholder", "aria-label", "aria-activedescendant"])
|
|
399
|
-
])) :
|
|
400
|
-
|
|
444
|
+
])) : g("", !0),
|
|
445
|
+
x("div", {
|
|
401
446
|
ref_key: "listRef",
|
|
402
|
-
ref:
|
|
447
|
+
ref: ne,
|
|
403
448
|
class: "combobox-list__scroll",
|
|
404
|
-
onMousedown:
|
|
449
|
+
onMousedown: Fe
|
|
405
450
|
}, [
|
|
406
|
-
|
|
407
|
-
id:
|
|
451
|
+
x("div", {
|
|
452
|
+
id: C,
|
|
408
453
|
role: "listbox",
|
|
409
|
-
"aria-label":
|
|
410
|
-
"aria-multiselectable":
|
|
454
|
+
"aria-label": i.label ?? i.ariaLabel,
|
|
455
|
+
"aria-multiselectable": i.multiple || void 0,
|
|
411
456
|
class: "combobox-list__options"
|
|
412
457
|
}, [
|
|
413
|
-
|
|
458
|
+
i.loading ? (c(), f("p", v({
|
|
414
459
|
key: 0,
|
|
415
460
|
class: "combobox-list__status"
|
|
416
|
-
}, s(
|
|
417
|
-
|
|
418
|
-
|
|
461
|
+
}, s(d)("loading")), [
|
|
462
|
+
z(e.$slots, "loading", {}, () => [
|
|
463
|
+
ge(w(i.loadingText), 1)
|
|
419
464
|
], !0)
|
|
420
|
-
], 16)) :
|
|
421
|
-
(
|
|
422
|
-
id: `${
|
|
465
|
+
], 16)) : g("", !0),
|
|
466
|
+
(c(!0), f(ke, null, _e(y.value, (l, t) => (c(), f("div", v({
|
|
467
|
+
id: `${C}-option-${t}`,
|
|
423
468
|
key: l.value,
|
|
424
469
|
role: "option",
|
|
425
470
|
class: ["combobox-list__option", {
|
|
426
|
-
"combobox-list__option--active":
|
|
471
|
+
"combobox-list__option--active": r.value === t,
|
|
427
472
|
"combobox-list__option--disabled": l.disabled
|
|
428
473
|
}],
|
|
429
|
-
"aria-selected":
|
|
474
|
+
"aria-selected": A(l.value),
|
|
430
475
|
"aria-disabled": l.disabled || void 0
|
|
431
|
-
}, { ref_for: !0 }, s(
|
|
432
|
-
onClick: (
|
|
433
|
-
onMouseenter: (
|
|
476
|
+
}, { ref_for: !0 }, s(d)("option", l.value), {
|
|
477
|
+
onClick: (h) => be(l),
|
|
478
|
+
onMouseenter: (h) => Oe(t, l.disabled)
|
|
434
479
|
}), [
|
|
435
|
-
|
|
480
|
+
i.multiple ? (c(), Z(ta, {
|
|
436
481
|
key: 0,
|
|
437
|
-
checked:
|
|
482
|
+
checked: A(l.value),
|
|
438
483
|
disabled: l.disabled,
|
|
439
|
-
state:
|
|
440
|
-
}, null, 8, ["checked", "disabled", "state"])) : (
|
|
484
|
+
state: r.value === t ? "hover" : "default"
|
|
485
|
+
}, null, 8, ["checked", "disabled", "state"])) : (c(), Z(s(la), {
|
|
441
486
|
key: 1,
|
|
442
|
-
checked:
|
|
487
|
+
checked: A(l.value),
|
|
443
488
|
disabled: l.disabled,
|
|
444
|
-
state:
|
|
489
|
+
state: r.value === t ? "hover" : "default"
|
|
445
490
|
}, null, 8, ["checked", "disabled", "state"])),
|
|
446
|
-
|
|
491
|
+
z(e.$slots, "option", {
|
|
447
492
|
option: l,
|
|
448
|
-
selected:
|
|
449
|
-
active:
|
|
450
|
-
index:
|
|
493
|
+
selected: A(l.value),
|
|
494
|
+
active: r.value === t,
|
|
495
|
+
index: t
|
|
451
496
|
}, () => [
|
|
452
|
-
|
|
497
|
+
x("span", pa, w(l.label), 1)
|
|
453
498
|
], !0)
|
|
454
|
-
], 16,
|
|
455
|
-
!
|
|
499
|
+
], 16, ha))), 128)),
|
|
500
|
+
!i.loading && !y.value.length ? (c(), f("p", v({
|
|
456
501
|
key: 1,
|
|
457
502
|
class: "combobox-list__status"
|
|
458
|
-
}, s(
|
|
459
|
-
|
|
460
|
-
notFound: !!
|
|
503
|
+
}, s(d)("empty")), [
|
|
504
|
+
z(e.$slots, "empty", {
|
|
505
|
+
notFound: !!i.options.length
|
|
461
506
|
}, () => [
|
|
462
|
-
|
|
507
|
+
ge(w(i.options.length ? i.notFoundText : i.emptyText), 1)
|
|
463
508
|
], !0)
|
|
464
|
-
], 16)) :
|
|
465
|
-
], 8,
|
|
509
|
+
], 16)) : g("", !0)
|
|
510
|
+
], 8, ma)
|
|
466
511
|
], 544)
|
|
467
512
|
])
|
|
468
513
|
]),
|
|
469
514
|
_: 3
|
|
470
515
|
}, 8, ["open", "width", "side", "side-offset", "align", "align-offset", "breakpoint-mobile", "test-id"]),
|
|
471
|
-
|
|
516
|
+
j.value ? (c(), f("p", v({
|
|
472
517
|
key: 1,
|
|
473
|
-
id:
|
|
518
|
+
id: te,
|
|
474
519
|
class: "combobox__message"
|
|
475
|
-
}, s(
|
|
520
|
+
}, s(d)("message")), w(j.value), 17)) : g("", !0)
|
|
476
521
|
], 16));
|
|
477
522
|
}
|
|
478
523
|
});
|
|
479
524
|
export {
|
|
480
|
-
|
|
525
|
+
Ma as default
|
|
481
526
|
};
|