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