@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 Re, useModel as
|
|
2
|
-
import { CircleX as
|
|
1
|
+
import { defineComponent as Re, useModel as Se, useId as we, useAttrs as Ce, computed as d, ref as V, useTemplateRef as S, onMounted as $e, nextTick as B, onBeforeUnmount as xe, watch as w, openBlock as n, createElementBlock as u, mergeProps as f, unref as o, createTextVNode as N, toDisplayString as v, createCommentVNode as y, createElementVNode as g, createVNode as q, withCtx as X, Fragment as ie, renderList as re, createBlock as U, renderSlot as D, resolveDynamicComponent as Ie, withModifiers as Ae, mergeModels as ne } from "vue";
|
|
2
|
+
import { CircleX as Me, ChevronDown as Ee } from "@lucide/vue";
|
|
3
3
|
import Te from "../Popover/Popover.vue.js";
|
|
4
4
|
import Ve from "../Radio/RadioMarker.vue.js";
|
|
5
|
-
import { useTestId as
|
|
6
|
-
import
|
|
7
|
-
import
|
|
8
|
-
const
|
|
5
|
+
import { useTestId as Be } from "../shared/useTestId.util.js";
|
|
6
|
+
import Ne from "../shared/VisuallyHidden.vue.js";
|
|
7
|
+
import qe from "./SelectCheckMarker.vue.js";
|
|
8
|
+
const De = ["disabled", "aria-labelledby", "aria-label", "aria-describedby", "aria-required"], Fe = ["aria-label", "aria-multiselectable", "aria-activedescendant"], Oe = ["id", "aria-selected", "aria-disabled", "onClick", "onMouseenter"], Ge = { class: "select-list__label" }, We = {
|
|
9
9
|
key: 0,
|
|
10
10
|
class: "select-list__empty"
|
|
11
|
-
},
|
|
11
|
+
}, ze = ["aria-hidden"], Le = ["src"], Xe = { class: "select__chip-label" }, Ue = ["disabled", "tabindex", "aria-label", "onClick"], je = ["aria-hidden"], He = {
|
|
12
12
|
key: 3,
|
|
13
13
|
class: "select__placeholder"
|
|
14
14
|
}, Ke = "Нет вариантов", lt = /* @__PURE__ */ Re({
|
|
15
15
|
inheritAttrs: !1,
|
|
16
16
|
__name: "Select",
|
|
17
|
-
props: /* @__PURE__ */
|
|
17
|
+
props: /* @__PURE__ */ ne({
|
|
18
18
|
options: {},
|
|
19
19
|
multiple: { type: Boolean, default: !1 },
|
|
20
20
|
label: { default: void 0 },
|
|
21
|
+
required: { type: Boolean, default: !1 },
|
|
21
22
|
placeholder: { default: "Выберите значение" },
|
|
22
23
|
supportText: { default: void 0 },
|
|
23
24
|
errorText: { default: void 0 },
|
|
@@ -30,7 +31,7 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
30
31
|
side: { default: "bottom" },
|
|
31
32
|
sideOffset: { default: 4 },
|
|
32
33
|
ariaLabel: { default: void 0 },
|
|
33
|
-
breakpointMobile: { default: "sm" },
|
|
34
|
+
breakpointMobile: { type: [String, Boolean], default: "sm" },
|
|
34
35
|
testId: { default: void 0 }
|
|
35
36
|
}, {
|
|
36
37
|
modelValue: {
|
|
@@ -38,28 +39,28 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
38
39
|
},
|
|
39
40
|
modelModifiers: {}
|
|
40
41
|
}),
|
|
41
|
-
emits: /* @__PURE__ */
|
|
42
|
-
setup(a, { emit:
|
|
43
|
-
const s = a,
|
|
44
|
-
class:
|
|
45
|
-
style:
|
|
46
|
-
})),
|
|
47
|
-
const { class: e, style: l, ...t } =
|
|
42
|
+
emits: /* @__PURE__ */ ne(["change", "select"], ["update:modelValue"]),
|
|
43
|
+
setup(a, { emit: oe }) {
|
|
44
|
+
const s = a, C = oe, $ = Se(a, "modelValue"), x = we(), j = `select-trigger-${x}`, H = `select-label-${x}`, k = `select-list-${x}`, K = `select-message-${x}`, c = Be(() => s.testId), F = Ce(), ue = d(() => ({
|
|
45
|
+
class: F.class,
|
|
46
|
+
style: F.style
|
|
47
|
+
})), ce = d(() => {
|
|
48
|
+
const { class: e, style: l, ...t } = F;
|
|
48
49
|
return t;
|
|
49
|
-
}), b =
|
|
50
|
-
const e =
|
|
50
|
+
}), b = V(!1), P = S("fieldRef"), I = S("listRef"), A = S("contentRef"), J = S("chipsRef"), Q = S("counterRef"), m = V(Number.MAX_SAFE_INTEGER), O = V(0), r = V(-1), _ = d(() => {
|
|
51
|
+
const e = $.value;
|
|
51
52
|
return e == null ? [] : Array.isArray(e) ? e : [e];
|
|
52
|
-
}), h =
|
|
53
|
-
() => s.options.filter((e) =>
|
|
54
|
-
), M =
|
|
53
|
+
}), h = d(
|
|
54
|
+
() => s.options.filter((e) => _.value.includes(e.value))
|
|
55
|
+
), M = d(
|
|
55
56
|
() => h.value.map((e) => e.label).join(", ")
|
|
56
|
-
),
|
|
57
|
+
), E = d(
|
|
57
58
|
() => Math.max(0, h.value.length - m.value)
|
|
58
|
-
), de =
|
|
59
|
+
), de = d(() => M.value || s.placeholder), G = d(
|
|
59
60
|
() => s.invalid ? s.errorText ?? s.supportText : s.supportText
|
|
60
|
-
), fe =
|
|
61
|
-
() =>
|
|
62
|
-
), be =
|
|
61
|
+
), fe = d(() => s.width ?? O.value), ve = d(
|
|
62
|
+
() => r.value === -1 ? void 0 : `${k}-option-${r.value}`
|
|
63
|
+
), be = d(() => [
|
|
63
64
|
"select",
|
|
64
65
|
`select--${s.size}`,
|
|
65
66
|
{
|
|
@@ -69,19 +70,19 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
69
70
|
"select--multiple": s.multiple
|
|
70
71
|
}
|
|
71
72
|
]);
|
|
72
|
-
function
|
|
73
|
-
return
|
|
73
|
+
function R(e) {
|
|
74
|
+
return _.value.includes(e);
|
|
74
75
|
}
|
|
75
|
-
function
|
|
76
|
+
function W(e) {
|
|
76
77
|
const l = s.options[e];
|
|
77
78
|
return !!l && !l?.disabled;
|
|
78
79
|
}
|
|
79
80
|
function me() {
|
|
80
|
-
return s.options.findIndex((e, l) =>
|
|
81
|
+
return s.options.findIndex((e, l) => W(l));
|
|
81
82
|
}
|
|
82
83
|
function Y() {
|
|
83
84
|
for (let e = s.options.length - 1; e >= 0; e -= 1)
|
|
84
|
-
if (
|
|
85
|
+
if (W(e)) return e;
|
|
85
86
|
return -1;
|
|
86
87
|
}
|
|
87
88
|
function Z(e, l) {
|
|
@@ -89,36 +90,36 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
89
90
|
if (t === 0) return -1;
|
|
90
91
|
let i = e;
|
|
91
92
|
for (let p = 0; p < t; p += 1)
|
|
92
|
-
if (i = (i + l + t) % t,
|
|
93
|
+
if (i = (i + l + t) % t, W(i)) return i;
|
|
93
94
|
return -1;
|
|
94
95
|
}
|
|
95
96
|
function ee(e = 20) {
|
|
96
|
-
|
|
97
|
+
B(() => {
|
|
97
98
|
if (!b.value) return;
|
|
98
|
-
const l =
|
|
99
|
+
const l = I.value;
|
|
99
100
|
l && (l.focus(), document.activeElement === l) || e > 0 && requestAnimationFrame(() => ee(e - 1));
|
|
100
101
|
});
|
|
101
102
|
}
|
|
102
103
|
function he(e, l) {
|
|
103
|
-
l || (
|
|
104
|
+
l || (r.value = e);
|
|
104
105
|
}
|
|
105
106
|
function pe(e) {
|
|
106
107
|
switch (e.key) {
|
|
107
108
|
case "ArrowDown":
|
|
108
|
-
e.preventDefault(),
|
|
109
|
+
e.preventDefault(), r.value = Z(r.value, 1);
|
|
109
110
|
break;
|
|
110
111
|
case "ArrowUp":
|
|
111
|
-
e.preventDefault(),
|
|
112
|
+
e.preventDefault(), r.value = r.value === -1 ? Y() : Z(r.value, -1);
|
|
112
113
|
break;
|
|
113
114
|
case "Home":
|
|
114
|
-
e.preventDefault(),
|
|
115
|
+
e.preventDefault(), r.value = me();
|
|
115
116
|
break;
|
|
116
117
|
case "End":
|
|
117
|
-
e.preventDefault(),
|
|
118
|
+
e.preventDefault(), r.value = Y();
|
|
118
119
|
break;
|
|
119
120
|
case "Enter":
|
|
120
121
|
case " ": {
|
|
121
|
-
const l = s.options[
|
|
122
|
+
const l = s.options[r.value];
|
|
122
123
|
if (!l) break;
|
|
123
124
|
e.preventDefault(), te(l);
|
|
124
125
|
break;
|
|
@@ -128,21 +129,21 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
128
129
|
function te(e) {
|
|
129
130
|
if (!(e.disabled || s.disabled)) {
|
|
130
131
|
if (s.multiple) {
|
|
131
|
-
const l =
|
|
132
|
-
|
|
132
|
+
const l = R(e.value) ? _.value.filter((t) => t !== e.value) : [..._.value, e.value];
|
|
133
|
+
$.value = l, C("change", l);
|
|
133
134
|
} else
|
|
134
|
-
|
|
135
|
-
|
|
135
|
+
$.value = e.value, C("change", e.value), b.value = !1;
|
|
136
|
+
C("select", e);
|
|
136
137
|
}
|
|
137
138
|
}
|
|
138
139
|
function ge(e) {
|
|
139
140
|
if (s.disabled) return;
|
|
140
|
-
const l =
|
|
141
|
-
|
|
141
|
+
const l = _.value.filter((t) => t !== e);
|
|
142
|
+
$.value = l, C("change", l);
|
|
142
143
|
}
|
|
143
|
-
function
|
|
144
|
+
function z() {
|
|
144
145
|
if (!s.multiple) return;
|
|
145
|
-
const e =
|
|
146
|
+
const e = A.value, l = J.value;
|
|
146
147
|
if (!e || !l) return;
|
|
147
148
|
const t = Array.from(
|
|
148
149
|
l.querySelectorAll('[data-chip="item"]')
|
|
@@ -151,52 +152,65 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
151
152
|
m.value = Number.MAX_SAFE_INTEGER;
|
|
152
153
|
return;
|
|
153
154
|
}
|
|
154
|
-
const i = Number.parseFloat(getComputedStyle(l).columnGap) || 0, p = Number.parseFloat(getComputedStyle(e).columnGap) || 0, ye =
|
|
155
|
-
let ae = 0,
|
|
155
|
+
const i = Number.parseFloat(getComputedStyle(l).columnGap) || 0, p = Number.parseFloat(getComputedStyle(e).columnGap) || 0, ye = E.value ? (Q.value?.offsetWidth ?? 0) + p : 0, ke = e.clientWidth - ye;
|
|
156
|
+
let ae = 0, L = 0;
|
|
156
157
|
for (const _e of t) {
|
|
157
|
-
const se = ae + (
|
|
158
|
+
const se = ae + (L ? i : 0) + _e.offsetWidth;
|
|
158
159
|
if (se > ke) break;
|
|
159
|
-
ae = se,
|
|
160
|
+
ae = se, L += 1;
|
|
160
161
|
}
|
|
161
|
-
m.value = Math.max(
|
|
162
|
+
m.value = Math.max(L, 1);
|
|
162
163
|
}
|
|
163
|
-
let
|
|
164
|
-
|
|
164
|
+
let T;
|
|
165
|
+
$e(() => {
|
|
165
166
|
const e = P.value;
|
|
166
|
-
e && (
|
|
167
|
+
e && (O.value = e.getBoundingClientRect().width, B(z), T = new ResizeObserver((l) => {
|
|
167
168
|
for (const t of l)
|
|
168
|
-
t.target === e && (
|
|
169
|
-
|
|
170
|
-
}),
|
|
171
|
-
}),
|
|
169
|
+
t.target === e && (O.value = t.borderBoxSize?.[0]?.inlineSize ?? e.getBoundingClientRect().width);
|
|
170
|
+
z();
|
|
171
|
+
}), T.observe(e), A.value && T.observe(A.value));
|
|
172
|
+
}), xe(() => T?.disconnect()), w(
|
|
172
173
|
() => h.value.map((e) => e.value).join("|"),
|
|
173
174
|
() => {
|
|
174
|
-
m.value = Number.MAX_SAFE_INTEGER,
|
|
175
|
+
m.value = Number.MAX_SAFE_INTEGER, B(z);
|
|
175
176
|
}
|
|
176
177
|
);
|
|
177
178
|
let le = null;
|
|
178
|
-
return
|
|
179
|
-
e ? (le = document.activeElement,
|
|
180
|
-
}),
|
|
179
|
+
return w(b, (e) => {
|
|
180
|
+
e ? (le = document.activeElement, r.value = -1) : (r.value = -1, le?.focus());
|
|
181
|
+
}), w(I, (e) => {
|
|
181
182
|
e && b.value && ee();
|
|
182
|
-
}),
|
|
183
|
+
}), w(r, (e) => {
|
|
184
|
+
e !== -1 && B(() => {
|
|
185
|
+
I.value?.querySelector(
|
|
186
|
+
`#${CSS.escape(`${k}-option-${e}`)}`
|
|
187
|
+
)?.scrollIntoView({ block: "nearest" });
|
|
188
|
+
});
|
|
189
|
+
}), w(
|
|
183
190
|
() => s.disabled,
|
|
184
191
|
(e) => {
|
|
185
192
|
e && (b.value = !1);
|
|
186
193
|
}
|
|
187
|
-
), (e, l) => (
|
|
188
|
-
a.label ? (
|
|
194
|
+
), (e, l) => (n(), u("div", f({ class: be.value }, { ...ue.value, ...o(c)("root") }), [
|
|
195
|
+
a.label ? (n(), u("label", f({
|
|
189
196
|
key: 0,
|
|
190
197
|
id: H,
|
|
191
198
|
class: "select__label",
|
|
192
|
-
for:
|
|
193
|
-
}, c
|
|
199
|
+
for: j
|
|
200
|
+
}, o(c)("label")), [
|
|
201
|
+
N(v(a.label) + " ", 1),
|
|
202
|
+
a.required ? (n(), u("span", f({
|
|
203
|
+
key: 0,
|
|
204
|
+
class: "select__required",
|
|
205
|
+
"aria-hidden": "true"
|
|
206
|
+
}, o(c)("required")), "*", 16)) : y("", !0)
|
|
207
|
+
], 16)) : y("", !0),
|
|
194
208
|
g("div", f({
|
|
195
209
|
ref_key: "fieldRef",
|
|
196
210
|
ref: P,
|
|
197
211
|
class: "select__field"
|
|
198
|
-
}, c
|
|
199
|
-
|
|
212
|
+
}, o(c)("field")), [
|
|
213
|
+
q(o(Te), {
|
|
200
214
|
open: b.value,
|
|
201
215
|
"onUpdate:open": l[0] || (l[0] = (t) => b.value = t),
|
|
202
216
|
width: fe.value,
|
|
@@ -207,36 +221,38 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
207
221
|
arrow: !1,
|
|
208
222
|
"breakpoint-mobile": a.breakpointMobile,
|
|
209
223
|
"trigger-has-popup": "listbox",
|
|
210
|
-
"trigger-controls":
|
|
224
|
+
"trigger-controls": k,
|
|
211
225
|
"test-id": a.testId
|
|
212
226
|
}, {
|
|
213
227
|
trigger: X(({ props: t }) => [
|
|
214
228
|
g("button", f({
|
|
215
|
-
id:
|
|
229
|
+
id: j,
|
|
216
230
|
type: "button",
|
|
231
|
+
role: "combobox",
|
|
217
232
|
class: "select__trigger",
|
|
218
233
|
disabled: a.disabled,
|
|
219
234
|
"aria-labelledby": a.label ? H : void 0,
|
|
220
235
|
"aria-label": a.label ? void 0 : a.ariaLabel,
|
|
221
|
-
"aria-describedby":
|
|
236
|
+
"aria-describedby": G.value ? K : void 0,
|
|
237
|
+
"aria-required": a.required || void 0
|
|
222
238
|
}, {
|
|
223
239
|
...t,
|
|
224
|
-
...
|
|
225
|
-
...c
|
|
240
|
+
...ce.value,
|
|
241
|
+
...o(c)("trigger")
|
|
226
242
|
}), [
|
|
227
|
-
|
|
243
|
+
q(Ne, null, {
|
|
228
244
|
default: X(() => [
|
|
229
|
-
|
|
245
|
+
N(v(de.value), 1)
|
|
230
246
|
]),
|
|
231
247
|
_: 1
|
|
232
248
|
})
|
|
233
|
-
], 16,
|
|
249
|
+
], 16, De)
|
|
234
250
|
]),
|
|
235
251
|
default: X(() => [
|
|
236
252
|
g("div", {
|
|
237
|
-
id:
|
|
253
|
+
id: k,
|
|
238
254
|
ref_key: "listRef",
|
|
239
|
-
ref:
|
|
255
|
+
ref: I,
|
|
240
256
|
role: "listbox",
|
|
241
257
|
tabindex: "0",
|
|
242
258
|
"aria-label": a.label ?? a.ariaLabel,
|
|
@@ -245,83 +261,83 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
245
261
|
class: "select-list",
|
|
246
262
|
onKeydown: pe
|
|
247
263
|
}, [
|
|
248
|
-
(
|
|
249
|
-
id: `${
|
|
264
|
+
(n(!0), u(ie, null, re(a.options, (t, i) => (n(), u("div", f({
|
|
265
|
+
id: `${k}-option-${i}`,
|
|
250
266
|
key: t.value,
|
|
251
267
|
role: "option",
|
|
252
268
|
class: ["select-list__option", {
|
|
253
|
-
"select-list__option--active":
|
|
269
|
+
"select-list__option--active": r.value === i,
|
|
254
270
|
"select-list__option--disabled": t.disabled
|
|
255
271
|
}],
|
|
256
|
-
"aria-selected":
|
|
272
|
+
"aria-selected": R(t.value),
|
|
257
273
|
"aria-disabled": t.disabled || void 0
|
|
258
|
-
}, { ref_for: !0 }, c
|
|
274
|
+
}, { ref_for: !0 }, o(c)("option", t.value), {
|
|
259
275
|
onClick: (p) => te(t),
|
|
260
276
|
onMouseenter: (p) => he(i, t.disabled)
|
|
261
277
|
}), [
|
|
262
|
-
a.multiple ? (
|
|
278
|
+
a.multiple ? (n(), U(qe, {
|
|
263
279
|
key: 0,
|
|
264
|
-
checked:
|
|
280
|
+
checked: R(t.value),
|
|
265
281
|
disabled: t.disabled,
|
|
266
|
-
state:
|
|
267
|
-
}, null, 8, ["checked", "disabled", "state"])) : (
|
|
282
|
+
state: r.value === i ? "hover" : "default"
|
|
283
|
+
}, null, 8, ["checked", "disabled", "state"])) : (n(), U(o(Ve), {
|
|
268
284
|
key: 1,
|
|
269
|
-
checked:
|
|
285
|
+
checked: R(t.value),
|
|
270
286
|
disabled: t.disabled,
|
|
271
|
-
state:
|
|
287
|
+
state: r.value === i ? "hover" : "default"
|
|
272
288
|
}, null, 8, ["checked", "disabled", "state"])),
|
|
273
|
-
|
|
289
|
+
D(e.$slots, "option", {
|
|
274
290
|
option: t,
|
|
275
|
-
selected:
|
|
276
|
-
active:
|
|
291
|
+
selected: R(t.value),
|
|
292
|
+
active: r.value === i,
|
|
277
293
|
index: i
|
|
278
294
|
}, () => [
|
|
279
|
-
g("span",
|
|
295
|
+
g("span", Ge, v(t.label), 1)
|
|
280
296
|
], !0)
|
|
281
|
-
], 16,
|
|
282
|
-
a.options.length ?
|
|
283
|
-
|
|
284
|
-
|
|
297
|
+
], 16, Oe))), 128)),
|
|
298
|
+
a.options.length ? y("", !0) : (n(), u("p", We, [
|
|
299
|
+
D(e.$slots, "empty", {}, () => [
|
|
300
|
+
N(v(Ke))
|
|
285
301
|
], !0)
|
|
286
302
|
]))
|
|
287
|
-
], 40,
|
|
303
|
+
], 40, Fe)
|
|
288
304
|
]),
|
|
289
305
|
_: 3
|
|
290
306
|
}, 8, ["open", "width", "side", "side-offset", "align", "align-offset", "breakpoint-mobile", "test-id"]),
|
|
291
307
|
g("div", {
|
|
292
308
|
ref_key: "contentRef",
|
|
293
|
-
ref:
|
|
309
|
+
ref: A,
|
|
294
310
|
class: "select__content"
|
|
295
311
|
}, [
|
|
296
|
-
a.multiple && h.value.length ? (
|
|
312
|
+
a.multiple && h.value.length ? (n(), u("span", {
|
|
297
313
|
key: 0,
|
|
298
314
|
ref_key: "chipsRef",
|
|
299
315
|
ref: J,
|
|
300
316
|
class: "select__chips"
|
|
301
317
|
}, [
|
|
302
|
-
(
|
|
318
|
+
(n(!0), u(ie, null, re(h.value, (t, i) => (n(), u("span", f({
|
|
303
319
|
key: t.value,
|
|
304
320
|
"data-chip": "item",
|
|
305
321
|
class: ["select__chip", {
|
|
306
322
|
"select__chip--measured": i >= m.value
|
|
307
323
|
}],
|
|
308
324
|
"aria-hidden": i >= m.value || void 0
|
|
309
|
-
}, { ref_for: !0 }, c
|
|
310
|
-
|
|
325
|
+
}, { ref_for: !0 }, o(c)("chip", t.value)), [
|
|
326
|
+
D(e.$slots, "chip", {
|
|
311
327
|
option: t,
|
|
312
328
|
index: i
|
|
313
329
|
}, () => [
|
|
314
|
-
t.avatar ? (
|
|
330
|
+
t.avatar ? (n(), u("img", {
|
|
315
331
|
key: 0,
|
|
316
332
|
class: "select__chip-avatar",
|
|
317
333
|
src: t.avatar,
|
|
318
334
|
alt: ""
|
|
319
|
-
}, null, 8,
|
|
335
|
+
}, null, 8, Le)) : t.icon ? (n(), U(Ie(t.icon), {
|
|
320
336
|
key: 1,
|
|
321
337
|
class: "select__chip-icon",
|
|
322
338
|
"aria-hidden": "true"
|
|
323
|
-
})) :
|
|
324
|
-
g("span",
|
|
339
|
+
})) : y("", !0),
|
|
340
|
+
g("span", Xe, v(t.label), 1)
|
|
325
341
|
], !0),
|
|
326
342
|
g("button", f({
|
|
327
343
|
type: "button",
|
|
@@ -329,44 +345,44 @@ const Fe = ["disabled", "aria-labelledby", "aria-label", "aria-describedby"], Oe
|
|
|
329
345
|
disabled: a.disabled,
|
|
330
346
|
tabindex: i >= m.value ? -1 : void 0,
|
|
331
347
|
"aria-label": `Убрать ${t.label}`
|
|
332
|
-
}, { ref_for: !0 }, c
|
|
333
|
-
onClick:
|
|
348
|
+
}, { ref_for: !0 }, o(c)("chip-remove", t.value), {
|
|
349
|
+
onClick: Ae((p) => ge(t.value), ["stop"])
|
|
334
350
|
}), [
|
|
335
|
-
|
|
351
|
+
q(o(Me), {
|
|
336
352
|
class: "select__chip-icon",
|
|
337
353
|
"aria-hidden": "true"
|
|
338
354
|
})
|
|
339
|
-
], 16,
|
|
340
|
-
], 16,
|
|
341
|
-
], 512)) :
|
|
342
|
-
a.multiple && h.value.length ? (
|
|
355
|
+
], 16, Ue)
|
|
356
|
+
], 16, ze))), 128))
|
|
357
|
+
], 512)) : y("", !0),
|
|
358
|
+
a.multiple && h.value.length ? (n(), u("span", f({
|
|
343
359
|
key: 1,
|
|
344
360
|
ref_key: "counterRef",
|
|
345
361
|
ref: Q,
|
|
346
|
-
class: ["select__chip select__chip--counter", { "select__chip--measured": !
|
|
347
|
-
"aria-hidden": !
|
|
348
|
-
}, c
|
|
362
|
+
class: ["select__chip select__chip--counter", { "select__chip--measured": !E.value }],
|
|
363
|
+
"aria-hidden": !E.value || void 0
|
|
364
|
+
}, o(c)("chip-counter")), " +" + v(E.value || 1), 17, je)) : M.value ? (n(), u("span", f({
|
|
349
365
|
key: 2,
|
|
350
366
|
class: "select__value"
|
|
351
|
-
}, c
|
|
352
|
-
|
|
367
|
+
}, o(c)("value")), [
|
|
368
|
+
D(e.$slots, "value", {
|
|
353
369
|
option: h.value[0],
|
|
354
370
|
displayValue: M.value
|
|
355
371
|
}, () => [
|
|
356
|
-
|
|
372
|
+
N(v(M.value), 1)
|
|
357
373
|
], !0)
|
|
358
|
-
], 16)) : (
|
|
374
|
+
], 16)) : (n(), u("span", He, v(a.placeholder), 1))
|
|
359
375
|
], 512),
|
|
360
|
-
|
|
376
|
+
q(o(Ee), {
|
|
361
377
|
class: "select__arrow",
|
|
362
378
|
"aria-hidden": "true"
|
|
363
379
|
})
|
|
364
380
|
], 16),
|
|
365
|
-
|
|
381
|
+
G.value ? (n(), u("p", f({
|
|
366
382
|
key: 1,
|
|
367
383
|
id: K,
|
|
368
384
|
class: "select__message"
|
|
369
|
-
}, c
|
|
385
|
+
}, o(c)("message")), v(G.value), 17)) : y("", !0)
|
|
370
386
|
], 16));
|
|
371
387
|
}
|
|
372
388
|
});
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { TBreakpointMobile } from '../../../types/global.types';
|
|
2
2
|
export type ToastVariant = 'info' | 'success' | 'warning' | 'error';
|
|
3
3
|
export type ToastPosition = 'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right';
|
|
4
4
|
/** Направление свайпа, которым тост закрывается. `none` — свайп отключён. */
|
|
@@ -55,7 +55,7 @@ export interface ToasterProps {
|
|
|
55
55
|
limit?: number;
|
|
56
56
|
zIndex?: number;
|
|
57
57
|
/** Брейкпоинт, ниже которого стек занимает всю ширину экрана. */
|
|
58
|
-
breakpointMobile?:
|
|
58
|
+
breakpointMobile?: TBreakpointMobile;
|
|
59
59
|
/** Направление свайпа. По умолчанию выводится из `position`. */
|
|
60
60
|
swipeDirection?: ToastSwipeDirection;
|
|
61
61
|
/** Доступное имя области с уведомлениями (`aria-label`). */
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.toaster[data-v-
|
|
1
|
+
.toaster[data-v-ad45c627]{width:23.75rem;max-width:calc(100vw - var(--toaster-offset) * 2);z-index:var(--toaster-z-index);pointer-events:none;flex-direction:column;gap:.5rem;display:flex;position:fixed}.toaster[data-v-ad45c627]>*{pointer-events:auto}.toaster--top[data-v-ad45c627]{top:var(--toaster-offset)}.toaster--bottom[data-v-ad45c627]{bottom:var(--toaster-offset);flex-direction:column-reverse}.toaster--left[data-v-ad45c627]{left:var(--toaster-offset)}.toaster--right[data-v-ad45c627]{right:var(--toaster-offset)}.toaster--center[data-v-ad45c627]{left:50%;transform:translate(-50%)}.toaster--mobile[data-v-ad45c627]{width:auto;max-width:none;left:var(--toaster-offset);right:var(--toaster-offset);transform:none}.toast-enter-from[data-v-ad45c627],.toast-leave-to[data-v-ad45c627]{opacity:0;transform:var(--toaster-slide)}.toast-enter-active[data-v-ad45c627],.toast-leave-active[data-v-ad45c627],.toast-move[data-v-ad45c627]{transition:transform var(--animation-duration) ease, opacity var(--animation-duration) ease}.toast-leave-active[data-v-ad45c627]{width:100%;position:absolute}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { ToasterProps, ToastSwipeDirection, ToastPosition } from './Toast.types';
|
|
2
2
|
import { DefineComponent, ComponentOptionsMixin, PublicProps, ComponentProvideOptions } from 'vue';
|
|
3
|
-
import {
|
|
3
|
+
import { TBreakpointMobile } from '../../../types/global.types';
|
|
4
4
|
declare const _default: DefineComponent<ToasterProps, {}, {}, {}, {}, ComponentOptionsMixin, ComponentOptionsMixin, {}, string, PublicProps, Readonly<ToasterProps> & Readonly<{}>, {
|
|
5
5
|
label: string;
|
|
6
6
|
offset: number;
|
|
7
7
|
position: ToastPosition;
|
|
8
8
|
zIndex: number;
|
|
9
|
-
breakpointMobile:
|
|
9
|
+
breakpointMobile: TBreakpointMobile;
|
|
10
10
|
swipeDirection: ToastSwipeDirection;
|
|
11
11
|
testId: string;
|
|
12
12
|
limit: number;
|
|
@@ -2,7 +2,7 @@ import './Toaster.css';
|
|
|
2
2
|
import o from "./Toaster.vue2.js";
|
|
3
3
|
/* empty css */
|
|
4
4
|
import t from "../../../_virtual/_plugin-vue_export-helper.js";
|
|
5
|
-
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-
|
|
5
|
+
const p = /* @__PURE__ */ t(o, [["__scopeId", "data-v-ad45c627"]]);
|
|
6
6
|
export {
|
|
7
7
|
p as default
|
|
8
8
|
};
|
|
@@ -1,27 +1,27 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import
|
|
3
|
-
import W from "../shared/
|
|
1
|
+
import { defineComponent as F, ref as k, computed as o, onMounted as x, onBeforeUnmount as L, watch as B, openBlock as i, createBlock as b, withCtx as T, createElementBlock as w, mergeProps as C, unref as a, createVNode as D, TransitionGroup as z, Fragment as E, renderList as Y, createCommentVNode as O } from "vue";
|
|
2
|
+
import P from "../shared/Portal.vue.js";
|
|
3
|
+
import { useIsMobile as W } from "../shared/useIsMobile.util.js";
|
|
4
4
|
import { useTestId as X } from "../shared/useTestId.util.js";
|
|
5
5
|
import A from "./Toast.vue.js";
|
|
6
6
|
import { TOAST_DEFAULT_LIMIT as N, useToast as U } from "./useToast.js";
|
|
7
|
-
const V = ["aria-label"], G = 10, Z = /* @__PURE__ */
|
|
7
|
+
const V = ["aria-label"], G = 10, Z = /* @__PURE__ */ F({
|
|
8
8
|
__name: "Toaster",
|
|
9
9
|
props: {
|
|
10
10
|
position: { default: "top-right" },
|
|
11
11
|
offset: { default: 24 },
|
|
12
12
|
limit: { default: N },
|
|
13
13
|
zIndex: { default: 9999 },
|
|
14
|
-
breakpointMobile: { default: "sm" },
|
|
14
|
+
breakpointMobile: { type: [String, Boolean], default: "sm" },
|
|
15
15
|
swipeDirection: { default: void 0 },
|
|
16
16
|
label: { default: "Уведомления" },
|
|
17
17
|
closeLabel: { default: void 0 },
|
|
18
18
|
testId: { default: void 0 }
|
|
19
19
|
},
|
|
20
20
|
setup(r) {
|
|
21
|
-
const s =
|
|
21
|
+
const s = k([]), t = r, { toasts: h, dismiss: M, pause: f, resume: v, setLimit: g } = U(), I = X(() => t.testId), l = /* @__PURE__ */ Symbol("toaster"), _ = o(
|
|
22
22
|
() => s.value[0] === l
|
|
23
23
|
);
|
|
24
|
-
|
|
24
|
+
x(() => {
|
|
25
25
|
s.value = [...s.value, l], s.value.length > 1 && console.warn(
|
|
26
26
|
"[Toaster] Смонтировано несколько Toaster — очередь тостов общая, поэтому лишние экземпляры не отрисовываются. Оставьте один Toaster на приложение."
|
|
27
27
|
);
|
|
@@ -30,9 +30,9 @@ const V = ["aria-label"], G = 10, Z = /* @__PURE__ */ S({
|
|
|
30
30
|
(m) => m !== l
|
|
31
31
|
);
|
|
32
32
|
});
|
|
33
|
-
const u =
|
|
33
|
+
const u = W(t.breakpointMobile), c = o(
|
|
34
34
|
() => t.position.startsWith("bottom") ? "bottom" : "top"
|
|
35
|
-
), d = o(() => t.position.endsWith("left") ? "left" : t.position.endsWith("center") ? "center" : "right"), p = o(() => t.swipeDirection ? t.swipeDirection : u.value || d.value === "center" ? c.value === "top" ? "up" : "down" : d.value === "left" ? "left" : "right"),
|
|
35
|
+
), d = o(() => t.position.endsWith("left") ? "left" : t.position.endsWith("center") ? "center" : "right"), p = o(() => t.swipeDirection ? t.swipeDirection : u.value || d.value === "center" ? c.value === "top" ? "up" : "down" : d.value === "left" ? "left" : "right"), S = o(() => {
|
|
36
36
|
switch (p.value) {
|
|
37
37
|
case "right":
|
|
38
38
|
return "translateX(120%)";
|
|
@@ -45,25 +45,25 @@ const V = ["aria-label"], G = 10, Z = /* @__PURE__ */ S({
|
|
|
45
45
|
default:
|
|
46
46
|
return c.value === "top" ? "translateY(-120%)" : "translateY(120%)";
|
|
47
47
|
}
|
|
48
|
-
}),
|
|
48
|
+
}), $ = o(() => [
|
|
49
49
|
"toaster",
|
|
50
50
|
`toaster--${c.value}`,
|
|
51
51
|
`toaster--${d.value}`,
|
|
52
52
|
{ "toaster--mobile": u.value }
|
|
53
|
-
]),
|
|
53
|
+
]), y = o(() => ({
|
|
54
54
|
"--toaster-offset": `${u.value ? G : t.offset}px`,
|
|
55
55
|
"--toaster-z-index": String(t.zIndex),
|
|
56
|
-
"--toaster-slide":
|
|
56
|
+
"--toaster-slide": S.value
|
|
57
57
|
}));
|
|
58
|
-
return
|
|
58
|
+
return B(() => t.limit, g, { immediate: !0 }), (m, K) => (i(), b(P, null, {
|
|
59
59
|
default: T(() => [
|
|
60
|
-
|
|
60
|
+
_.value ? (i(), w("div", C({
|
|
61
61
|
key: 0,
|
|
62
|
-
class:
|
|
63
|
-
style:
|
|
62
|
+
class: $.value,
|
|
63
|
+
style: y.value,
|
|
64
64
|
role: "region",
|
|
65
65
|
"aria-label": r.label
|
|
66
|
-
}, a(
|
|
66
|
+
}, a(I)("viewport")), [
|
|
67
67
|
D(z, { name: "toast" }, {
|
|
68
68
|
default: T(() => [
|
|
69
69
|
(i(!0), w(E, null, Y(a(h), (e) => (i(), b(A, {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
.tooltip-trigger[data-v-
|
|
1
|
+
.tooltip-trigger[data-v-06f091c9]{width:fit-content;display:inline-block}
|