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