@profitliga/ui 2.0.2 → 2.0.4

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