@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.
- package/dist/components/AlertDialog/AlertDialogAction.vue.js +2 -3
- package/dist/components/AlertDialog/AlertDialogCancel.vue.js +8 -9
- package/dist/components/AlertDialog/AlertDialogTrigger.vue.js +7 -8
- package/dist/components/Button/Button.css +1 -1
- package/dist/components/Button/Button.vue.js +5 -52
- package/dist/components/Button/Button.vue2.js +52 -3
- package/dist/components/Calendar/CalendarNext.vue.js +3 -4
- package/dist/components/Calendar/CalendarPrev.vue.js +7 -8
- package/dist/components/ConfirmDialog/ConfirmDialog.vue2.js +11 -12
- package/dist/components/DatePicker/DatePickerNext.vue.js +1 -2
- package/dist/components/DatePicker/DatePickerPrev.vue.js +7 -8
- package/dist/components/DateRangePicker/DateRangePickerNext.vue.js +6 -7
- package/dist/components/DateRangePicker/DateRangePickerPrev.vue.js +7 -8
- package/dist/components/RangeCalendar/RangeCalendarNext.vue.js +3 -4
- package/dist/components/RangeCalendar/RangeCalendarPrev.vue.js +3 -4
- package/dist/components/Schedule/Schedule.vue2.js +38 -39
- package/dist/components/index.js +391 -392
- package/dist/components/v2/AlertDialog/AlertDialog.css +1 -1
- package/dist/components/v2/AlertDialog/AlertDialog.types.d.ts +2 -2
- package/dist/components/v2/AlertDialog/AlertDialog.vue.d.ts +2 -2
- package/dist/components/v2/AlertDialog/AlertDialog.vue.js +2 -2
- package/dist/components/v2/AlertDialog/AlertDialog.vue2.js +29 -29
- package/dist/components/v2/Checkbox/Checkbox.css +1 -1
- package/dist/components/v2/Checkbox/Checkbox.types.d.ts +11 -0
- package/dist/components/v2/Checkbox/Checkbox.vue.d.ts +2 -0
- package/dist/components/v2/Checkbox/Checkbox.vue.js +2 -2
- package/dist/components/v2/Checkbox/Checkbox.vue2.js +61 -49
- package/dist/components/v2/Combobox/Combobox.css +1 -1
- package/dist/components/v2/Combobox/Combobox.types.d.ts +28 -2
- package/dist/components/v2/Combobox/Combobox.vue.d.ts +3 -2
- package/dist/components/v2/Combobox/Combobox.vue.js +1 -1
- package/dist/components/v2/Combobox/Combobox.vue2.js +305 -251
- package/dist/components/v2/ConfirmDialog/ConfirmDialog.types.d.ts +2 -2
- package/dist/components/v2/ConfirmDialog/ConfirmDialog.vue.d.ts +2 -2
- package/dist/components/v2/ConfirmDialog/ConfirmDialog.vue.js +6 -6
- package/dist/components/v2/DatePicker/DatePicker.css +1 -1
- package/dist/components/v2/DatePicker/DatePicker.types.d.ts +2 -2
- package/dist/components/v2/DatePicker/DatePicker.vue.d.ts +2 -2
- package/dist/components/v2/DatePicker/DatePicker.vue.js +2 -2
- package/dist/components/v2/DatePicker/DatePicker.vue2.js +54 -54
- package/dist/components/v2/Divider/Divider.css +1 -1
- package/dist/components/v2/Divider/Divider.types.d.ts +8 -0
- package/dist/components/v2/Divider/Divider.vue.js +2 -2
- package/dist/components/v2/DropdownMenu/DropdownMenu.types.d.ts +2 -2
- package/dist/components/v2/DropdownMenu/DropdownMenu.vue.d.ts +2 -2
- package/dist/components/v2/DropdownMenu/DropdownMenu.vue2.js +6 -6
- package/dist/components/v2/FileUpload/FileUpload.css +1 -1
- package/dist/components/v2/FileUpload/FileUpload.vue.js +2 -2
- package/dist/components/v2/FileUpload/FileUpload.vue2.js +16 -16
- package/dist/components/v2/FormField/FormField.css +1 -0
- package/dist/components/v2/FormField/FormField.types.d.ts +48 -0
- package/dist/components/v2/FormField/FormField.vue.d.ts +25 -0
- package/dist/components/v2/FormField/FormField.vue.js +8 -0
- package/dist/components/v2/FormField/FormField.vue2.js +54 -0
- package/dist/components/v2/FormField/index.d.ts +3 -0
- package/dist/components/v2/Image/Image.css +1 -0
- package/dist/components/v2/Image/Image.types.d.ts +26 -0
- package/dist/components/v2/Image/Image.vue.d.ts +16 -0
- package/dist/components/v2/Image/Image.vue.js +8 -0
- package/dist/components/v2/Image/Image.vue2.js +91 -0
- package/dist/components/v2/Image/ImageList.css +1 -0
- package/dist/components/v2/Image/ImageList.types.d.ts +28 -0
- package/dist/components/v2/Image/ImageList.vue.d.ts +15 -0
- package/dist/components/v2/Image/ImageList.vue.js +8 -0
- package/dist/components/v2/Image/ImageList.vue2.js +38 -0
- package/dist/components/v2/Image/index.d.ts +5 -0
- package/dist/components/v2/Input/Input.css +1 -1
- package/dist/components/v2/Input/Input.vue.js +2 -2
- package/dist/components/v2/Input/Input.vue2.js +113 -107
- package/dist/components/v2/InputNumber/InputNumber.css +1 -1
- package/dist/components/v2/InputNumber/InputNumber.vue.js +2 -2
- package/dist/components/v2/InputNumber/InputNumber.vue2.js +22 -21
- package/dist/components/v2/InputSelect/InputSelect.types.d.ts +2 -2
- package/dist/components/v2/InputSelect/InputSelect.vue.d.ts +2 -2
- package/dist/components/v2/InputSelect/InputSelect.vue.js +14 -14
- package/dist/components/v2/InputSelect/InputSelectChip.css +1 -1
- package/dist/components/v2/InputSelect/InputSelectChip.vue.d.ts +3 -3
- package/dist/components/v2/InputSelect/InputSelectChip.vue.js +2 -2
- package/dist/components/v2/InputSelect/InputSelectChip.vue2.js +17 -17
- package/dist/components/v2/Popover/Popover.css +1 -1
- package/dist/components/v2/Popover/Popover.types.d.ts +2 -2
- package/dist/components/v2/Popover/Popover.vue.d.ts +2 -2
- package/dist/components/v2/Popover/Popover.vue.js +2 -2
- package/dist/components/v2/Popover/Popover.vue2.js +24 -24
- package/dist/components/v2/Radio/Radio.css +1 -1
- package/dist/components/v2/Radio/Radio.vue.d.ts +4 -0
- package/dist/components/v2/Radio/Radio.vue.js +1 -1
- package/dist/components/v2/Radio/Radio.vue2.js +57 -49
- package/dist/components/v2/Schedule/Schedule.css +1 -1
- package/dist/components/v2/Schedule/Schedule.types.d.ts +2 -2
- package/dist/components/v2/Schedule/Schedule.vue.d.ts +2 -2
- package/dist/components/v2/Schedule/Schedule.vue.js +3 -3
- package/dist/components/v2/Schedule/Schedule.vue2.js +55 -55
- package/dist/components/v2/Select/Select.css +1 -1
- package/dist/components/v2/Select/Select.types.d.ts +8 -2
- package/dist/components/v2/Select/Select.vue.js +3 -3
- package/dist/components/v2/Select/Select.vue2.js +143 -127
- package/dist/components/v2/Toast/Toast.types.d.ts +2 -2
- package/dist/components/v2/Toast/Toaster.css +1 -1
- package/dist/components/v2/Toast/Toaster.vue.d.ts +2 -2
- package/dist/components/v2/Toast/Toaster.vue.js +1 -1
- package/dist/components/v2/Toast/Toaster.vue2.js +17 -17
- package/dist/components/v2/Tooltip/Tooltip.css +1 -1
- package/dist/components/v2/Tooltip/Tooltip.types.d.ts +2 -2
- package/dist/components/v2/Tooltip/Tooltip.vue.d.ts +2 -2
- package/dist/components/v2/Tooltip/Tooltip.vue.js +1 -1
- package/dist/components/v2/Tooltip/Tooltip.vue2.js +39 -38
- package/dist/components/v2/Tooltip/TooltipContent.css +1 -1
- package/dist/components/v2/Tooltip/TooltipContent.vue.d.ts +2 -2
- package/dist/components/v2/Tooltip/TooltipContent.vue.js +2 -2
- package/dist/components/v2/Tooltip/TooltipContent.vue2.js +20 -20
- package/dist/components/v2/Tooltip/vTooltip.directive.js +40 -41
- package/dist/components/v2/index.d.ts +2 -0
- package/dist/components/v2/index.js +82 -76
- package/dist/components/v2/shared/isHtmlElement.util.d.ts +15 -0
- package/dist/components/v2/shared/isHtmlElement.util.js +10 -0
- package/dist/components/v2/shared/useIsMobile.util.d.ts +13 -0
- package/dist/components/v2/shared/useIsMobile.util.js +8 -0
- package/dist/components/v2/shared/useTriggerAria.util.js +4 -3
- package/dist/types/global.types.d.ts +10 -0
- package/package.json +3 -1
|
@@ -1,23 +1,24 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { Search as
|
|
3
|
-
import
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
import { useTestId as
|
|
9
|
-
const
|
|
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
|
-
},
|
|
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__ */
|
|
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__ */
|
|
48
|
-
setup(
|
|
49
|
-
const o =
|
|
50
|
-
class:
|
|
51
|
-
style:
|
|
52
|
-
})),
|
|
53
|
-
const { class: e, style: a, ...l } =
|
|
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
|
-
}),
|
|
56
|
-
const e =
|
|
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
|
-
}),
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
() =>
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
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
|
-
}),
|
|
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
|
-
),
|
|
74
|
-
() =>
|
|
75
|
-
),
|
|
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
|
-
|
|
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
|
|
86
|
-
return
|
|
115
|
+
function B(e) {
|
|
116
|
+
return m.value.includes(e);
|
|
87
117
|
}
|
|
88
|
-
function
|
|
89
|
-
const a =
|
|
118
|
+
function Q(e) {
|
|
119
|
+
const a = g.value[e];
|
|
90
120
|
return !!a && !a?.disabled;
|
|
91
121
|
}
|
|
92
|
-
function
|
|
93
|
-
return
|
|
122
|
+
function de() {
|
|
123
|
+
return g.value.findIndex((e, a) => Q(a));
|
|
94
124
|
}
|
|
95
|
-
function
|
|
96
|
-
for (let e =
|
|
97
|
-
if (
|
|
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
|
|
101
|
-
const l =
|
|
130
|
+
function ve(e, a) {
|
|
131
|
+
const l = g.value.length;
|
|
102
132
|
if (l === 0) return -1;
|
|
103
|
-
let
|
|
104
|
-
for (let
|
|
105
|
-
if (
|
|
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
|
|
109
|
-
|
|
138
|
+
function F() {
|
|
139
|
+
k.value || L.value?.focus();
|
|
110
140
|
}
|
|
111
|
-
function
|
|
112
|
-
o.disabled ||
|
|
141
|
+
function A() {
|
|
142
|
+
o.disabled || b.value || (b.value = !0);
|
|
113
143
|
}
|
|
114
|
-
function
|
|
115
|
-
|
|
144
|
+
function O() {
|
|
145
|
+
b.value = !1;
|
|
116
146
|
}
|
|
117
|
-
function
|
|
118
|
-
|
|
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
|
|
150
|
+
function De(e) {
|
|
151
|
+
e.stopPropagation(), !o.disabled && (A(), F());
|
|
152
|
+
}
|
|
153
|
+
function qe() {
|
|
121
154
|
if (!o.disabled) {
|
|
122
|
-
if (
|
|
123
|
-
|
|
155
|
+
if (b.value) {
|
|
156
|
+
O();
|
|
124
157
|
return;
|
|
125
158
|
}
|
|
126
|
-
|
|
159
|
+
A(), F();
|
|
127
160
|
}
|
|
128
161
|
}
|
|
129
|
-
function
|
|
162
|
+
function fe(e) {
|
|
130
163
|
const a = e.target.value;
|
|
131
|
-
|
|
164
|
+
$.value = !0, n.value = a, p("search", a), A();
|
|
132
165
|
}
|
|
133
|
-
function
|
|
134
|
-
|
|
166
|
+
function Fe(e) {
|
|
167
|
+
k.value || e.preventDefault();
|
|
135
168
|
}
|
|
136
|
-
function
|
|
137
|
-
a || (
|
|
169
|
+
function Oe(e, a) {
|
|
170
|
+
a || (c.value = e);
|
|
138
171
|
}
|
|
139
|
-
function
|
|
172
|
+
function be(e) {
|
|
140
173
|
switch (e.key) {
|
|
141
174
|
case "ArrowDown":
|
|
142
|
-
if (e.preventDefault(), !
|
|
143
|
-
|
|
175
|
+
if (e.preventDefault(), !b.value) {
|
|
176
|
+
A();
|
|
144
177
|
break;
|
|
145
178
|
}
|
|
146
|
-
|
|
179
|
+
c.value = ve(c.value, 1);
|
|
147
180
|
break;
|
|
148
181
|
case "ArrowUp":
|
|
149
|
-
if (e.preventDefault(), !
|
|
150
|
-
|
|
182
|
+
if (e.preventDefault(), !b.value) {
|
|
183
|
+
A();
|
|
151
184
|
break;
|
|
152
185
|
}
|
|
153
|
-
|
|
186
|
+
c.value = c.value === -1 ? Ne() : ve(c.value, -1);
|
|
154
187
|
break;
|
|
155
188
|
case "Enter": {
|
|
156
|
-
if (!
|
|
157
|
-
const a =
|
|
189
|
+
if (!b.value) break;
|
|
190
|
+
const a = g.value[c.value];
|
|
158
191
|
if (!a) break;
|
|
159
|
-
e.preventDefault(),
|
|
192
|
+
e.preventDefault(), me(a);
|
|
160
193
|
break;
|
|
161
194
|
}
|
|
162
195
|
case "Escape":
|
|
163
|
-
if (
|
|
164
|
-
|
|
196
|
+
if (b.value) {
|
|
197
|
+
n.value = "";
|
|
165
198
|
break;
|
|
166
199
|
}
|
|
167
|
-
|
|
200
|
+
n.value && (n.value = "");
|
|
168
201
|
break;
|
|
169
202
|
case "Tab":
|
|
170
|
-
|
|
203
|
+
O();
|
|
171
204
|
break;
|
|
172
205
|
case "Backspace": {
|
|
173
|
-
if (!o.multiple ||
|
|
174
|
-
const a =
|
|
206
|
+
if (!o.multiple || n.value) break;
|
|
207
|
+
const a = m.value[m.value.length - 1];
|
|
175
208
|
if (a === void 0) break;
|
|
176
|
-
|
|
209
|
+
he(a);
|
|
177
210
|
break;
|
|
178
211
|
}
|
|
179
212
|
}
|
|
180
213
|
}
|
|
181
|
-
function
|
|
214
|
+
function me(e) {
|
|
182
215
|
if (!(e.disabled || o.disabled)) {
|
|
183
216
|
if (o.multiple) {
|
|
184
|
-
const a =
|
|
185
|
-
|
|
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
|
-
|
|
188
|
-
|
|
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
|
|
224
|
+
function he(e) {
|
|
192
225
|
if (o.disabled) return;
|
|
193
|
-
const a =
|
|
194
|
-
|
|
226
|
+
const a = m.value.filter((l) => l !== e);
|
|
227
|
+
S.value = a, p("change", a);
|
|
195
228
|
}
|
|
196
|
-
function
|
|
229
|
+
function H() {
|
|
197
230
|
if (!o.multiple) return;
|
|
198
|
-
const e =
|
|
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
|
-
|
|
237
|
+
_.value = Number.MAX_SAFE_INTEGER;
|
|
205
238
|
return;
|
|
206
239
|
}
|
|
207
|
-
const
|
|
208
|
-
let
|
|
209
|
-
for (const
|
|
210
|
-
const
|
|
211
|
-
if (
|
|
212
|
-
|
|
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
|
-
|
|
247
|
+
_.value = Math.max(J, 1);
|
|
215
248
|
}
|
|
216
|
-
let
|
|
217
|
-
return
|
|
218
|
-
const e =
|
|
219
|
-
e && (
|
|
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 && (
|
|
222
|
-
|
|
223
|
-
}),
|
|
224
|
-
}),
|
|
225
|
-
() =>
|
|
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
|
-
|
|
260
|
+
_.value = Number.MAX_SAFE_INTEGER, W(H);
|
|
228
261
|
}
|
|
229
|
-
),
|
|
230
|
-
|
|
231
|
-
}),
|
|
262
|
+
), R([g, n], () => {
|
|
263
|
+
c.value = n.value ? de() : -1;
|
|
264
|
+
}), R(b, (e) => {
|
|
232
265
|
if (e) {
|
|
233
|
-
|
|
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
|
-
|
|
237
|
-
}),
|
|
238
|
-
e !== -1 &&
|
|
239
|
-
|
|
240
|
-
`#${CSS.escape(`${
|
|
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
|
-
}),
|
|
276
|
+
}), R(
|
|
244
277
|
() => o.disabled,
|
|
245
278
|
(e) => {
|
|
246
|
-
e &&
|
|
279
|
+
e && O();
|
|
247
280
|
}
|
|
248
|
-
), (e, a) => (r(),
|
|
249
|
-
|
|
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:
|
|
284
|
+
id: te,
|
|
252
285
|
class: "combobox__label",
|
|
253
|
-
for:
|
|
254
|
-
}, s(
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
260
|
-
"
|
|
261
|
-
|
|
262
|
-
|
|
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":
|
|
304
|
+
"breakpoint-mobile": i.breakpointMobile,
|
|
265
305
|
"trigger-has-popup": "listbox",
|
|
266
|
-
"trigger-controls":
|
|
306
|
+
"trigger-controls": C,
|
|
267
307
|
"trap-focus": !1,
|
|
268
|
-
"test-id":
|
|
308
|
+
"test-id": i.testId
|
|
269
309
|
}, {
|
|
270
|
-
trigger:
|
|
271
|
-
|
|
310
|
+
trigger: Z(({ props: l }) => [
|
|
311
|
+
y("div", f({
|
|
272
312
|
ref_key: "fieldRef",
|
|
273
|
-
ref:
|
|
313
|
+
ref: ie,
|
|
274
314
|
class: "combobox__field"
|
|
275
|
-
}, s(
|
|
276
|
-
|
|
315
|
+
}, s(d)("field"), { onClick: De }), [
|
|
316
|
+
y("div", {
|
|
277
317
|
ref_key: "contentRef",
|
|
278
|
-
ref:
|
|
318
|
+
ref: N,
|
|
279
319
|
class: "combobox__content"
|
|
280
320
|
}, [
|
|
281
|
-
|
|
282
|
-
id:
|
|
321
|
+
y("input", f({
|
|
322
|
+
id: le,
|
|
283
323
|
ref_key: "inputRef",
|
|
284
|
-
ref:
|
|
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:
|
|
292
|
-
placeholder:
|
|
293
|
-
disabled:
|
|
294
|
-
readonly: s(
|
|
295
|
-
"aria-labelledby":
|
|
296
|
-
"aria-label":
|
|
297
|
-
"aria-describedby":
|
|
298
|
-
"aria-activedescendant":
|
|
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
|
-
...
|
|
302
|
-
...s(
|
|
342
|
+
...Re.value,
|
|
343
|
+
...s(d)("input")
|
|
303
344
|
}, {
|
|
304
|
-
onInput:
|
|
305
|
-
onKeydown:
|
|
306
|
-
}), null, 16,
|
|
307
|
-
|
|
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:
|
|
351
|
+
ref: se,
|
|
311
352
|
class: "combobox__chips"
|
|
312
353
|
}, [
|
|
313
|
-
(r(!0),
|
|
314
|
-
key:
|
|
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":
|
|
358
|
+
"combobox__chip--measured": h >= _.value
|
|
318
359
|
}],
|
|
319
|
-
"aria-hidden":
|
|
320
|
-
}, { ref_for: !0 }, s(
|
|
321
|
-
|
|
322
|
-
option:
|
|
323
|
-
index:
|
|
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
|
-
|
|
366
|
+
t.avatar ? (r(), v("img", {
|
|
326
367
|
key: 0,
|
|
327
368
|
class: "combobox__chip-avatar",
|
|
328
|
-
src:
|
|
369
|
+
src: t.avatar,
|
|
329
370
|
alt: ""
|
|
330
|
-
}, null, 8,
|
|
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
|
-
|
|
376
|
+
y("span", ra, w(t.label), 1)
|
|
336
377
|
], !0),
|
|
337
|
-
|
|
378
|
+
y("button", f({
|
|
338
379
|
type: "button",
|
|
339
380
|
class: "combobox__chip-remove",
|
|
340
|
-
disabled:
|
|
341
|
-
tabindex:
|
|
342
|
-
"aria-label": `Убрать ${
|
|
343
|
-
}, { ref_for: !0 }, s(
|
|
344
|
-
onClick:
|
|
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
|
-
|
|
387
|
+
M(s(Je), {
|
|
347
388
|
class: "combobox__chip-icon",
|
|
348
389
|
"aria-hidden": "true"
|
|
349
390
|
})
|
|
350
|
-
], 16,
|
|
351
|
-
], 16,
|
|
391
|
+
], 16, ca)
|
|
392
|
+
], 16, na))), 128))
|
|
352
393
|
], 512)) : x("", !0),
|
|
353
|
-
|
|
394
|
+
K.value ? (r(), v("span", f({
|
|
354
395
|
key: 1,
|
|
355
396
|
ref_key: "counterRef",
|
|
356
|
-
ref:
|
|
397
|
+
ref: ne,
|
|
357
398
|
class: ["combobox__chip combobox__chip--counter", {
|
|
358
|
-
"combobox__chip--measured": !
|
|
399
|
+
"combobox__chip--measured": !D.value
|
|
359
400
|
}],
|
|
360
|
-
"aria-hidden": !
|
|
361
|
-
}, s(
|
|
401
|
+
"aria-hidden": !D.value || void 0
|
|
402
|
+
}, s(d)("chip-counter")), " +" + w(D.value || 1), 17, da)) : x("", !0)
|
|
362
403
|
], 512),
|
|
363
|
-
|
|
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:
|
|
369
|
-
}, s(
|
|
370
|
-
onClick:
|
|
422
|
+
disabled: i.disabled
|
|
423
|
+
}, s(d)("arrow"), {
|
|
424
|
+
onClick: ae(qe, ["stop"])
|
|
371
425
|
}), [
|
|
372
|
-
|
|
373
|
-
], 16,
|
|
426
|
+
M(s(Ze), { class: "combobox__arrow" })
|
|
427
|
+
], 16, fa)
|
|
374
428
|
], 16)
|
|
375
429
|
]),
|
|
376
|
-
default:
|
|
377
|
-
|
|
378
|
-
s(
|
|
379
|
-
|
|
380
|
-
modelValue:
|
|
381
|
-
"onUpdate:modelValue": a[0] || (a[0] = (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:
|
|
384
|
-
"aria-label":
|
|
385
|
-
"aria-controls":
|
|
386
|
-
"aria-activedescendant":
|
|
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(
|
|
391
|
-
onInput:
|
|
392
|
-
onKeydown:
|
|
444
|
+
}, s(d)("search"), {
|
|
445
|
+
onInput: fe,
|
|
446
|
+
onKeydown: be
|
|
393
447
|
}), {
|
|
394
|
-
prefix:
|
|
395
|
-
|
|
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
|
-
|
|
454
|
+
y("div", {
|
|
401
455
|
ref_key: "listRef",
|
|
402
|
-
ref:
|
|
456
|
+
ref: ue,
|
|
403
457
|
class: "combobox-list__scroll",
|
|
404
|
-
onMousedown:
|
|
458
|
+
onMousedown: Fe
|
|
405
459
|
}, [
|
|
406
|
-
|
|
407
|
-
id:
|
|
460
|
+
y("div", {
|
|
461
|
+
id: C,
|
|
408
462
|
role: "listbox",
|
|
409
|
-
"aria-label":
|
|
410
|
-
"aria-multiselectable":
|
|
463
|
+
"aria-label": i.label ?? i.ariaLabel,
|
|
464
|
+
"aria-multiselectable": i.multiple || void 0,
|
|
411
465
|
class: "combobox-list__options"
|
|
412
466
|
}, [
|
|
413
|
-
|
|
467
|
+
i.loading ? (r(), v("p", f({
|
|
414
468
|
key: 0,
|
|
415
469
|
class: "combobox-list__status"
|
|
416
|
-
}, s(
|
|
417
|
-
|
|
418
|
-
|
|
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),
|
|
422
|
-
id: `${
|
|
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":
|
|
480
|
+
"combobox-list__option--active": c.value === t,
|
|
427
481
|
"combobox-list__option--disabled": l.disabled
|
|
428
482
|
}],
|
|
429
|
-
"aria-selected":
|
|
483
|
+
"aria-selected": B(l.value),
|
|
430
484
|
"aria-disabled": l.disabled || void 0
|
|
431
|
-
}, { ref_for: !0 }, s(
|
|
432
|
-
onClick: (
|
|
433
|
-
onMouseenter: (
|
|
485
|
+
}, { ref_for: !0 }, s(d)("option", l.value), {
|
|
486
|
+
onClick: (h) => me(l),
|
|
487
|
+
onMouseenter: (h) => Oe(t, l.disabled)
|
|
434
488
|
}), [
|
|
435
|
-
|
|
489
|
+
i.multiple ? (r(), ee(ta, {
|
|
436
490
|
key: 0,
|
|
437
|
-
checked:
|
|
491
|
+
checked: B(l.value),
|
|
438
492
|
disabled: l.disabled,
|
|
439
|
-
state:
|
|
440
|
-
}, null, 8, ["checked", "disabled", "state"])) : (r(),
|
|
493
|
+
state: c.value === t ? "hover" : "default"
|
|
494
|
+
}, null, 8, ["checked", "disabled", "state"])) : (r(), ee(s(la), {
|
|
441
495
|
key: 1,
|
|
442
|
-
checked:
|
|
496
|
+
checked: B(l.value),
|
|
443
497
|
disabled: l.disabled,
|
|
444
|
-
state:
|
|
498
|
+
state: c.value === t ? "hover" : "default"
|
|
445
499
|
}, null, 8, ["checked", "disabled", "state"])),
|
|
446
|
-
|
|
500
|
+
G(e.$slots, "option", {
|
|
447
501
|
option: l,
|
|
448
|
-
selected:
|
|
449
|
-
active:
|
|
450
|
-
index:
|
|
502
|
+
selected: B(l.value),
|
|
503
|
+
active: c.value === t,
|
|
504
|
+
index: t
|
|
451
505
|
}, () => [
|
|
452
|
-
|
|
506
|
+
y("span", xa, w(l.label), 1)
|
|
453
507
|
], !0)
|
|
454
|
-
], 16,
|
|
455
|
-
!
|
|
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(
|
|
459
|
-
|
|
460
|
-
notFound: !!
|
|
512
|
+
}, s(d)("empty")), [
|
|
513
|
+
G(e.$slots, "empty", {
|
|
514
|
+
notFound: !!i.options.length
|
|
461
515
|
}, () => [
|
|
462
|
-
|
|
516
|
+
Y(w(i.options.length ? i.notFoundText : i.emptyText), 1)
|
|
463
517
|
], !0)
|
|
464
518
|
], 16)) : x("", !0)
|
|
465
|
-
], 8,
|
|
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
|
-
|
|
525
|
+
j.value ? (r(), v("p", f({
|
|
472
526
|
key: 1,
|
|
473
|
-
id:
|
|
527
|
+
id: oe,
|
|
474
528
|
class: "combobox__message"
|
|
475
|
-
}, s(
|
|
529
|
+
}, s(d)("message")), w(j.value), 17)) : x("", !0)
|
|
476
530
|
], 16));
|
|
477
531
|
}
|
|
478
532
|
});
|
|
479
533
|
export {
|
|
480
|
-
|
|
534
|
+
Sa as default
|
|
481
535
|
};
|