urfu-ui-kit-react 2.1.7-next.3 → 2.1.7-next.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/Calendar/Calendar.d.ts.map +1 -1
- package/dist/components/Calendar/Calendar.js +226 -205
- package/dist/components/Calendar/Calendar.types.d.ts +19 -0
- package/dist/components/Calendar/Calendar.types.d.ts.map +1 -1
- package/dist/components/SearchSelect/SearchSelect.d.ts.map +1 -1
- package/dist/components/SearchSelect/SearchSelect.js +162 -152
- package/dist/components/Tabs/Tabs.d.ts.map +1 -1
- package/dist/components/Tabs/Tabs.js +34 -33
- package/dist/components/Tabs/distributeTabs.d.ts +7 -3
- package/dist/components/Tabs/distributeTabs.d.ts.map +1 -1
- package/dist/components/Tabs/useTabsOverflow.d.ts +4 -0
- package/dist/components/Tabs/useTabsOverflow.d.ts.map +1 -1
- package/dist/components/Tabs/useTabsOverflow.js +40 -41
- package/dist/dev/index.js +2 -2
- package/dist/index.d.ts +2 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/shared/kitCopy.js +1 -1
- package/dist/style-no-fonts.css +1 -1
- package/dist/style.css +1 -1
- package/dist/style.layer.css +2 -2
- package/dist/style.shell.css +2 -2
- package/dist/urfu-ui-kit-react.js +11 -10
- package/dist/vanilla/core/dateLimits.js +21 -0
- package/dist/vanilla/core/describeError.js +1 -1
- package/dist/vanilla/core/distributeTabs.js +36 -23
- package/package.json +1 -1
|
@@ -1,256 +1,267 @@
|
|
|
1
|
-
import { jsx as
|
|
1
|
+
import { jsx as l, jsxs as h } from "react/jsx-runtime";
|
|
2
2
|
import { getFieldAccessibility$u as Ee } from "../../shared/fieldAccessibility.js";
|
|
3
|
-
import { useState as Ke, useRef as
|
|
3
|
+
import { useState as Ke, useRef as _, useEffect as k, useMemo as Pe } from "react";
|
|
4
4
|
/* empty css */
|
|
5
5
|
import { createPortal as Ae } from "react-dom";
|
|
6
6
|
/* empty css */
|
|
7
7
|
/* empty css */
|
|
8
|
-
import { useSelectEngine$u as
|
|
9
|
-
import { isSameOptionValue$u as
|
|
10
|
-
import { getPopupTransitionStyle$u as
|
|
8
|
+
import { useSelectEngine$u as Fe } from "../../hooks/useSelectEngine.js";
|
|
9
|
+
import { isSameOptionValue$u as He, getOptionKeys$u as Be } from "../../shared/optionValue.js";
|
|
10
|
+
import { getPopupTransitionStyle$u as U } from "../../shared/popupTransition.js";
|
|
11
11
|
import { useFlippedPlacement$u as Ge } from "./useFlippedPlacement.js";
|
|
12
12
|
import { SearchSelectOption$u as Me } from "./SearchSelectOption.js";
|
|
13
13
|
import { isCompact$u as We, sizeClassName$u as Ye } from "../../shared/size.js";
|
|
14
14
|
import { getPortalScopeProps$u as qe } from "../../shared/uiKitDefaults.js";
|
|
15
15
|
import { resolveValidation$u as Je } from "../../vanilla/core/validation.js";
|
|
16
16
|
const ot = ({
|
|
17
|
-
"aria-label":
|
|
18
|
-
"aria-labelledby":
|
|
19
|
-
"aria-describedby":
|
|
20
|
-
title:
|
|
21
|
-
required:
|
|
22
|
-
options:
|
|
23
|
-
styleSelectContainer:
|
|
24
|
-
styleTitle:
|
|
25
|
-
styleSelect:
|
|
26
|
-
lineUp:
|
|
27
|
-
rowGap:
|
|
28
|
-
columnGap:
|
|
29
|
-
placeholder:
|
|
17
|
+
"aria-label": I,
|
|
18
|
+
"aria-labelledby": C,
|
|
19
|
+
"aria-describedby": V,
|
|
20
|
+
title: v = "",
|
|
21
|
+
required: z = !1,
|
|
22
|
+
options: R,
|
|
23
|
+
styleSelectContainer: ee,
|
|
24
|
+
styleTitle: te,
|
|
25
|
+
styleSelect: ce,
|
|
26
|
+
lineUp: S = !1,
|
|
27
|
+
rowGap: se = 4,
|
|
28
|
+
columnGap: ie = 20,
|
|
29
|
+
placeholder: re = "Не выбрано",
|
|
30
30
|
value: t,
|
|
31
|
-
isClearable:
|
|
31
|
+
isClearable: le = !1,
|
|
32
32
|
onChange: f,
|
|
33
|
-
className:
|
|
34
|
-
tableView:
|
|
35
|
-
size:
|
|
36
|
-
validationText:
|
|
37
|
-
validationOn:
|
|
38
|
-
error:
|
|
39
|
-
absoluteValidationText:
|
|
33
|
+
className: oe,
|
|
34
|
+
tableView: T = !1,
|
|
35
|
+
size: $,
|
|
36
|
+
validationText: ae = "Заполните поле",
|
|
37
|
+
validationOn: D,
|
|
38
|
+
error: ne,
|
|
39
|
+
absoluteValidationText: de,
|
|
40
40
|
disabled: n,
|
|
41
|
-
portalOn:
|
|
42
|
-
onInputChange:
|
|
43
|
-
loading:
|
|
44
|
-
inputValue:
|
|
41
|
+
portalOn: pe,
|
|
42
|
+
onInputChange: u,
|
|
43
|
+
loading: x,
|
|
44
|
+
inputValue: y,
|
|
45
45
|
onInputValueChange: c,
|
|
46
|
-
emptyOptionsText:
|
|
47
|
-
id:
|
|
46
|
+
emptyOptionsText: fe = "Ничего не найдено",
|
|
47
|
+
id: me
|
|
48
48
|
}) => {
|
|
49
|
-
const
|
|
50
|
-
optionsLength:
|
|
51
|
-
initialIndex: Math.max(0,
|
|
52
|
-
selectedIndex:
|
|
49
|
+
const m = We($, T), L = Ye($, T), O = Je({ error: ne, validationOn: D, validationText: ae }), [g, b] = Ke(""), E = _(!1), a = typeof y == "string" && typeof c == "function", o = g && !a ? R.filter((e) => (e.label ?? "").toLowerCase().includes((a ? y : g).toLowerCase())) : R, K = o.findIndex((e) => He(e == null ? void 0 : e.value, t == null ? void 0 : t.value)), d = Fe({
|
|
50
|
+
optionsLength: o.length,
|
|
51
|
+
initialIndex: Math.max(0, K),
|
|
52
|
+
selectedIndex: K,
|
|
53
53
|
disabled: n,
|
|
54
|
-
portalOn:
|
|
55
|
-
loading:
|
|
56
|
-
id:
|
|
54
|
+
portalOn: pe,
|
|
55
|
+
loading: x,
|
|
56
|
+
id: me,
|
|
57
57
|
idPrefix: "u-search-select",
|
|
58
58
|
// Под полем, а не в 30 пикселях от его верха: прежняя постоянная
|
|
59
59
|
// подходила только компактному полю и накрывала обычное.
|
|
60
60
|
getPortalPosition: (e) => ({ x: e.x, y: e.y + 60 + e.height + e.scrollY }),
|
|
61
61
|
onSelectByIndex: (e) => {
|
|
62
|
-
const
|
|
63
|
-
|
|
62
|
+
const r = o[e];
|
|
63
|
+
r && M.current(r);
|
|
64
64
|
}
|
|
65
65
|
}), {
|
|
66
|
-
isOpen:
|
|
67
|
-
blockRef:
|
|
68
|
-
portalOptionsRef:
|
|
66
|
+
isOpen: s,
|
|
67
|
+
blockRef: P,
|
|
68
|
+
portalOptionsRef: A,
|
|
69
69
|
optionsListRef: F,
|
|
70
70
|
listboxId: p,
|
|
71
|
-
activeDescendantId:
|
|
72
|
-
activeIndex:
|
|
73
|
-
hoveredIndex:
|
|
74
|
-
setHoveredIndex:
|
|
75
|
-
handleKeyDown:
|
|
71
|
+
activeDescendantId: be,
|
|
72
|
+
activeIndex: xe,
|
|
73
|
+
hoveredIndex: ye,
|
|
74
|
+
setHoveredIndex: ue,
|
|
75
|
+
handleKeyDown: he,
|
|
76
76
|
shouldRenderPortal: ve,
|
|
77
|
-
portalStatus:
|
|
78
|
-
shouldRenderLocal:
|
|
79
|
-
localStatus:
|
|
77
|
+
portalStatus: Se,
|
|
78
|
+
shouldRenderLocal: Oe,
|
|
79
|
+
localStatus: ge,
|
|
80
80
|
isAnimated: H,
|
|
81
|
-
portalWidth:
|
|
82
|
-
anchor:
|
|
83
|
-
usePortal:
|
|
84
|
-
} = d,
|
|
85
|
-
"aria-label":
|
|
86
|
-
"aria-labelledby":
|
|
87
|
-
"aria-describedby":
|
|
88
|
-
}),
|
|
89
|
-
}), { flippedTop:
|
|
90
|
-
isOpen:
|
|
91
|
-
portalOn:
|
|
92
|
-
anchor:
|
|
93
|
-
blockRef:
|
|
94
|
-
portalOptionsRef:
|
|
81
|
+
portalWidth: we,
|
|
82
|
+
anchor: je,
|
|
83
|
+
usePortal: w
|
|
84
|
+
} = d, i = d.portalPosition, Ne = Ee(p, v, z, O, {
|
|
85
|
+
"aria-label": I,
|
|
86
|
+
"aria-labelledby": C,
|
|
87
|
+
"aria-describedby": V
|
|
88
|
+
}), B = d.close, G = (e) => typeof e == "number" ? `calc(${e} * var(--u-preset-unit, 1px))` : String(e), M = _(() => {
|
|
89
|
+
}), { flippedTop: ke, flippedUp: ze } = Ge({
|
|
90
|
+
isOpen: s,
|
|
91
|
+
portalOn: w,
|
|
92
|
+
anchor: je,
|
|
93
|
+
blockRef: P,
|
|
94
|
+
portalOptionsRef: A,
|
|
95
95
|
optionsListRef: F,
|
|
96
|
-
dependencies: [
|
|
96
|
+
dependencies: [i == null ? void 0 : i.x, i == null ? void 0 : i.y, o.length, x]
|
|
97
97
|
});
|
|
98
|
-
|
|
99
|
-
t && Object.keys(t).length == 0 &&
|
|
100
|
-
}, [t]),
|
|
101
|
-
t != null && t.label && Object.keys(t).length && !
|
|
102
|
-
}, [
|
|
103
|
-
const
|
|
104
|
-
n || (
|
|
105
|
-
},
|
|
106
|
-
|
|
107
|
-
const e =
|
|
108
|
-
|
|
109
|
-
}, [
|
|
110
|
-
const
|
|
111
|
-
n || (f == null || f(null), a ? c == null || c("") :
|
|
98
|
+
k(() => {
|
|
99
|
+
t && Object.keys(t).length == 0 && b("");
|
|
100
|
+
}, [t]), k(() => {
|
|
101
|
+
t != null && t.label && Object.keys(t).length && !s && b(t.label);
|
|
102
|
+
}, [s, t]);
|
|
103
|
+
const j = a ? y : g, Re = (e) => {
|
|
104
|
+
n || (s || d.open(e.currentTarget), a ? c && c(e.target.value) : b(e.target.value), u && u(e.target.value));
|
|
105
|
+
}, N = !!(t && typeof t == "object" && t.value !== void 0 && String(t.value).length > 0), W = t != null && t.label && Object.keys(t).length ? t.label : "", Y = !s && !j ? W : "";
|
|
106
|
+
k(() => {
|
|
107
|
+
const e = E.current;
|
|
108
|
+
E.current = s, e && !s && a && N && y.length > 0 && (c == null || c(""));
|
|
109
|
+
}, [s, a, N, y, c]);
|
|
110
|
+
const Te = () => {
|
|
111
|
+
n || (f == null || f(null), a ? c == null || c("") : b(""), u && u(""), B());
|
|
112
|
+
}, q = (e) => {
|
|
113
|
+
e.preventDefault(), e.stopPropagation(), Te();
|
|
112
114
|
}, J = (e) => {
|
|
113
|
-
e
|
|
114
|
-
},
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
W.current = Q;
|
|
118
|
-
const X = g && h ? u ? "calc(28 * var(--u-unit, 1px))" : "calc(40 * var(--u-unit, 1px))" : void 0, Z = g ? { display: "block" } : null, _ = /* @__PURE__ */ o("div", { className: "u-selectbox-empty-text", children: be }), U = (e, l) => /* @__PURE__ */ o(
|
|
115
|
+
f == null || f(e), B(), a ? c == null || c("") : b(e.label ?? "");
|
|
116
|
+
}, $e = Pe(() => Be(o), [o]);
|
|
117
|
+
M.current = J;
|
|
118
|
+
const Q = le && !n && N, De = Q ? m ? "calc(44 * var(--u-unit, 1px))" : "calc(64 * var(--u-unit, 1px))" : m ? "calc(28 * var(--u-unit, 1px))" : "calc(40 * var(--u-unit, 1px))", X = /* @__PURE__ */ l("div", { className: "u-selectbox-empty-text", children: fe }), Z = (e, r) => /* @__PURE__ */ l(
|
|
119
119
|
Me,
|
|
120
120
|
{
|
|
121
121
|
option: e,
|
|
122
|
-
index:
|
|
122
|
+
index: r,
|
|
123
123
|
listboxId: p,
|
|
124
124
|
selectedValue: t == null ? void 0 : t.value,
|
|
125
|
-
isActive:
|
|
126
|
-
tableView:
|
|
127
|
-
onSelect:
|
|
128
|
-
onHover:
|
|
125
|
+
isActive: ye === r || xe === r,
|
|
126
|
+
tableView: m,
|
|
127
|
+
onSelect: J,
|
|
128
|
+
onHover: ue
|
|
129
129
|
},
|
|
130
|
-
|
|
131
|
-
),
|
|
130
|
+
$e[r]
|
|
131
|
+
), Le = /* @__PURE__ */ l(
|
|
132
132
|
"input",
|
|
133
133
|
{
|
|
134
|
-
className:
|
|
134
|
+
className: s ? "u-selectbox-select u-selectbox-select-open" : "u-selectbox-select",
|
|
135
135
|
role: "combobox",
|
|
136
|
-
...
|
|
137
|
-
"aria-expanded":
|
|
136
|
+
...Ne,
|
|
137
|
+
"aria-expanded": s,
|
|
138
138
|
"aria-haspopup": "listbox",
|
|
139
139
|
"aria-controls": p,
|
|
140
140
|
"aria-autocomplete": "list",
|
|
141
|
-
"aria-activedescendant":
|
|
141
|
+
"aria-activedescendant": be,
|
|
142
142
|
onClick: (e) => {
|
|
143
|
-
|
|
143
|
+
j.length > 0 && (a ? c && c("") : b("")), !n && s && e.currentTarget.blur(), d.toggle(e.currentTarget);
|
|
144
144
|
},
|
|
145
145
|
style: Object.assign(
|
|
146
|
-
|
|
146
|
+
m ? {
|
|
147
147
|
height: "var(--u-compact-height)",
|
|
148
148
|
fontSize: "var(--u-compact-font-size)",
|
|
149
149
|
lineHeight: 1,
|
|
150
150
|
padding: "var(--u-compact-padding)",
|
|
151
151
|
borderRadius: "calc(8 * var(--u-unit, 1px))"
|
|
152
152
|
} : {},
|
|
153
|
-
|
|
154
|
-
|
|
153
|
+
{ paddingRight: De },
|
|
154
|
+
D && { border: "1px solid var(--u-color-error, #EF302B)" }
|
|
155
155
|
),
|
|
156
156
|
type: "text",
|
|
157
157
|
disabled: n,
|
|
158
|
-
value:
|
|
158
|
+
value: j || Y,
|
|
159
159
|
onFocus: (e) => {
|
|
160
|
-
|
|
160
|
+
Y && e.currentTarget.select();
|
|
161
161
|
},
|
|
162
|
-
onChange:
|
|
163
|
-
onKeyDown:
|
|
164
|
-
placeholder:
|
|
162
|
+
onChange: Re,
|
|
163
|
+
onKeyDown: he,
|
|
164
|
+
placeholder: W || re
|
|
165
165
|
}
|
|
166
166
|
);
|
|
167
|
-
return /* @__PURE__ */
|
|
168
|
-
/* @__PURE__ */
|
|
167
|
+
return /* @__PURE__ */ h("div", { className: `u-react-select-container${L ? ` ${L}` : ""} ${oe ?? ""}`, style: { position: "relative" }, children: [
|
|
168
|
+
/* @__PURE__ */ h(
|
|
169
169
|
"div",
|
|
170
170
|
{
|
|
171
171
|
style: Object.assign(
|
|
172
172
|
{
|
|
173
173
|
display: "flex",
|
|
174
|
-
flexDirection:
|
|
175
|
-
rowGap:
|
|
176
|
-
columnGap:
|
|
174
|
+
flexDirection: S ? "row" : "column",
|
|
175
|
+
rowGap: S ? null : G(se),
|
|
176
|
+
columnGap: S ? G(ie) : null
|
|
177
177
|
},
|
|
178
|
-
|
|
178
|
+
ee
|
|
179
179
|
),
|
|
180
180
|
children: [
|
|
181
|
-
|
|
181
|
+
v && /* @__PURE__ */ l(
|
|
182
182
|
"div",
|
|
183
183
|
{
|
|
184
184
|
id: `${p}-label`,
|
|
185
|
-
className: `${
|
|
185
|
+
className: `${z ? "u-required" : ""} u-react-select-title`,
|
|
186
186
|
style: Object.assign(
|
|
187
187
|
{
|
|
188
188
|
color: "var(--u-field-title-color, #545454)",
|
|
189
189
|
fontSize: "var(--u-field-label-size-main, calc(14 * var(--u-unit, 1px)))"
|
|
190
190
|
},
|
|
191
|
-
|
|
191
|
+
te
|
|
192
192
|
),
|
|
193
|
-
children:
|
|
193
|
+
children: v
|
|
194
194
|
}
|
|
195
195
|
),
|
|
196
|
-
/* @__PURE__ */
|
|
196
|
+
/* @__PURE__ */ h(
|
|
197
197
|
"div",
|
|
198
198
|
{
|
|
199
199
|
className: `u-selectbox${n ? " u-selectbox-disabled" : ""} u-react-select`,
|
|
200
|
-
ref:
|
|
200
|
+
ref: P,
|
|
201
201
|
style: Object.assign(
|
|
202
202
|
{
|
|
203
203
|
width: "100%"
|
|
204
204
|
},
|
|
205
|
-
|
|
205
|
+
ce
|
|
206
206
|
),
|
|
207
207
|
children: [
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
|
|
208
|
+
/* @__PURE__ */ h("div", { style: { position: "relative", width: "100%" }, children: [
|
|
209
|
+
Le,
|
|
210
|
+
Q ? /* @__PURE__ */ l(
|
|
211
211
|
"div",
|
|
212
212
|
{
|
|
213
213
|
role: "button",
|
|
214
214
|
tabIndex: -1,
|
|
215
215
|
className: "u-selectbox-select-icon-cross",
|
|
216
216
|
"aria-label": "Очистить",
|
|
217
|
-
onClick:
|
|
217
|
+
onClick: q,
|
|
218
218
|
onKeyDown: (e) => {
|
|
219
|
-
(e.key === "Enter" || e.key === " ") &&
|
|
219
|
+
(e.key === "Enter" || e.key === " ") && q(e);
|
|
220
220
|
},
|
|
221
|
-
style:
|
|
222
|
-
zIndex: 2,
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
221
|
+
style: Object.assign(
|
|
222
|
+
{ zIndex: 2, cursor: "pointer" },
|
|
223
|
+
m ? { right: "calc(28 * var(--u-unit, 1px))" } : {}
|
|
224
|
+
)
|
|
225
|
+
}
|
|
226
|
+
) : null,
|
|
227
|
+
/* @__PURE__ */ l(
|
|
228
|
+
"i",
|
|
229
|
+
{
|
|
230
|
+
className: "u-selectbox-select-icon-arrow",
|
|
231
|
+
"aria-hidden": "true",
|
|
232
|
+
style: Object.assign(
|
|
233
|
+
{ pointerEvents: "none" },
|
|
234
|
+
s ? {
|
|
235
|
+
transform: "rotate(180deg)",
|
|
236
|
+
top: "calc(50% - calc(4 * var(--u-unit, 1px)))"
|
|
237
|
+
} : {},
|
|
238
|
+
m ? { right: "calc(8 * var(--u-unit, 1px))" } : {}
|
|
239
|
+
)
|
|
226
240
|
}
|
|
227
|
-
)
|
|
228
|
-
] })
|
|
229
|
-
|
|
241
|
+
)
|
|
242
|
+
] }),
|
|
243
|
+
s && x ? /* @__PURE__ */ l(
|
|
230
244
|
"div",
|
|
231
245
|
{
|
|
232
246
|
className: "u-selectbox-options",
|
|
233
|
-
style:
|
|
234
|
-
|
|
235
|
-
Z ?? {}
|
|
236
|
-
),
|
|
237
|
-
children: /* @__PURE__ */ o("span", { className: "u-selectbox-loading", children: "Загрузка..." })
|
|
247
|
+
style: { textAlign: "center", padding: "calc(16 * var(--u-unit, 1px))", display: "block" },
|
|
248
|
+
children: /* @__PURE__ */ l("span", { className: "u-selectbox-loading", children: "Загрузка..." })
|
|
238
249
|
}
|
|
239
250
|
) : null,
|
|
240
|
-
!
|
|
241
|
-
/* @__PURE__ */
|
|
251
|
+
!x && w && ve && i && Ae(
|
|
252
|
+
/* @__PURE__ */ l(
|
|
242
253
|
"div",
|
|
243
254
|
{
|
|
244
|
-
ref:
|
|
255
|
+
ref: A,
|
|
245
256
|
...qe(),
|
|
246
257
|
id: p,
|
|
247
258
|
role: "listbox",
|
|
248
259
|
className: "u-selectbox-options",
|
|
249
260
|
style: Object.assign(
|
|
250
261
|
{
|
|
251
|
-
width:
|
|
252
|
-
left:
|
|
253
|
-
top:
|
|
262
|
+
width: we,
|
|
263
|
+
left: i == null ? void 0 : i.x,
|
|
264
|
+
top: ke ?? (i == null ? void 0 : i.y) - 60,
|
|
254
265
|
opacity: 1,
|
|
255
266
|
visibility: "visible",
|
|
256
267
|
height: "fit-content",
|
|
@@ -260,30 +271,29 @@ const ot = ({
|
|
|
260
271
|
display: "block"
|
|
261
272
|
},
|
|
262
273
|
d.optionsStyle,
|
|
263
|
-
|
|
274
|
+
U(Se, H)
|
|
264
275
|
),
|
|
265
|
-
children:
|
|
276
|
+
children: o.length > 0 ? o.map((e, r) => Z(e, r)) : X
|
|
266
277
|
}
|
|
267
278
|
),
|
|
268
279
|
document.body
|
|
269
280
|
),
|
|
270
|
-
!
|
|
281
|
+
!x && !w && Oe ? /* @__PURE__ */ l(
|
|
271
282
|
"div",
|
|
272
283
|
{
|
|
273
284
|
ref: F,
|
|
274
285
|
id: p,
|
|
275
286
|
role: "listbox",
|
|
276
|
-
className:
|
|
287
|
+
className: ze ? "u-selectbox-options u-selectbox-options-up" : "u-selectbox-options",
|
|
277
288
|
style: Object.assign(
|
|
278
289
|
{},
|
|
279
|
-
Z ?? {},
|
|
280
290
|
// см. Select: без своего `display` переход срывается на кадре,
|
|
281
291
|
// когда vanilla уже спрятала список, а узел ещё нужен
|
|
282
292
|
{ display: "block" },
|
|
283
293
|
d.optionsStyle,
|
|
284
|
-
|
|
294
|
+
U(ge, H)
|
|
285
295
|
),
|
|
286
|
-
children:
|
|
296
|
+
children: o.length > 0 ? o.map((e, r) => Z(e, r)) : X
|
|
287
297
|
}
|
|
288
298
|
) : null
|
|
289
299
|
]
|
|
@@ -292,7 +302,7 @@ const ot = ({
|
|
|
292
302
|
]
|
|
293
303
|
}
|
|
294
304
|
),
|
|
295
|
-
|
|
305
|
+
O.showText && /* @__PURE__ */ l("h5", { id: `${p}-error`, className: "h5 clr-red-main", style: de ? { position: "absolute", bottom: "calc(-20 * var(--u-unit, 1px))" } : { position: "relative", marginTop: "calc(4 * var(--u-unit, 1px))" }, children: O.text })
|
|
296
306
|
] });
|
|
297
307
|
};
|
|
298
308
|
export { ot as SearchSelect$u };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,mDAAmD,CAAC;AAC3D,OAAO,aAAa,CAAC;AACrB,OAAO,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,cAAc,CAAC;AA2BvE,eAAO,MAAM,IAAI,GAAI,wHAWlB,cAAc,
|
|
1
|
+
{"version":3,"file":"Tabs.d.ts","sourceRoot":"","sources":["../../../src/components/Tabs/Tabs.tsx"],"names":[],"mappings":"AAAA,OAAO,kCAAkC,CAAC;AAC1C,OAAO,mDAAmD,CAAC;AAC3D,OAAO,aAAa,CAAC;AACrB,OAAO,0BAA0B,CAAC;AAElC,OAAO,KAAK,EAAsB,cAAc,EAAE,MAAM,cAAc,CAAC;AA2BvE,eAAO,MAAM,IAAI,GAAI,wHAWlB,cAAc,4CA8LhB,CAAC"}
|
|
@@ -3,20 +3,20 @@ import { jsxs as a, jsx as r } from "react/jsx-runtime";
|
|
|
3
3
|
/* empty css */
|
|
4
4
|
/* empty css */
|
|
5
5
|
/* empty css */
|
|
6
|
-
import { useState as
|
|
6
|
+
import { useState as D, useRef as p, useEffect as ee, Fragment as oe } from "react";
|
|
7
7
|
import { Icon$u as b } from "../Icon/Icon.js";
|
|
8
|
-
import { Tooltip$u as
|
|
9
|
-
import { useDismiss$u as
|
|
10
|
-
import { useMountTransition$u as
|
|
11
|
-
import { getPopupTransitionStyle$u as
|
|
12
|
-
import { useTabsOverflow$u as
|
|
13
|
-
import { useTabsIndicator$u as
|
|
14
|
-
import { useTabsScroll$u as
|
|
15
|
-
import { useAutoId$u as
|
|
16
|
-
import { isPlainLeftClick$u as
|
|
17
|
-
const
|
|
8
|
+
import { Tooltip$u as te } from "../Tooltip/Tooltip.js";
|
|
9
|
+
import { useDismiss$u as re } from "../../hooks/useDismiss.js";
|
|
10
|
+
import { useMountTransition$u as ne } from "../../hooks/useMountTransition.js";
|
|
11
|
+
import { getPopupTransitionStyle$u as se, POPUP_TRANSITION_MS$u as ie } from "../../shared/popupTransition.js";
|
|
12
|
+
import { useTabsOverflow$u as le } from "./useTabsOverflow.js";
|
|
13
|
+
import { useTabsIndicator$u as ae } from "./useTabsIndicator.js";
|
|
14
|
+
import { useTabsScroll$u as ce } from "./useTabsScroll.js";
|
|
15
|
+
import { useAutoId$u as ue } from "../../hooks/useAutoId.js";
|
|
16
|
+
import { isPlainLeftClick$u as me } from "../../vanilla/core/linkClick.js";
|
|
17
|
+
const de = [], Se = ({
|
|
18
18
|
onClick: h,
|
|
19
|
-
tabsData: n =
|
|
19
|
+
tabsData: n = de,
|
|
20
20
|
activeTab: m,
|
|
21
21
|
className: w = "",
|
|
22
22
|
variant: g = "line",
|
|
@@ -26,29 +26,29 @@ const me = [], Se = ({
|
|
|
26
26
|
LinkComponent: $,
|
|
27
27
|
ariaLabel: B
|
|
28
28
|
}) => {
|
|
29
|
-
const { containerRef: K, measureRef: j, moreMeasureRef: q, visible: z, overflow: u, paddingOf: F,
|
|
29
|
+
const { containerRef: K, measureRef: j, moreMeasureRef: q, visible: z, overflow: u, paddingOf: F, morePadding: L, promote: H } = le(n, m, y, g !== "segment"), [d, c] = D(!1), R = p(null), N = p(null), k = p(null), A = ue(void 0, "u-tabs-menu"), { shouldRender: J, status: Y, isAnimated: G } = ne({ isOpen: d, duration: ie }), O = p(u);
|
|
30
30
|
d && (O.current = u);
|
|
31
|
-
const f = g === "segment", T = n.some((e) => e.url), v = f ? "u-tab-segment" : "u-tab-line",
|
|
32
|
-
|
|
31
|
+
const f = g === "segment", T = n.some((e) => e.url), v = f ? "u-tab-segment" : "u-tab-line", Q = f ? "u-tab-segment-active" : "u-tab-active", { trackRef: I, indicatorRef: V } = ae(m, `${g}|${y}|${JSON.stringify(n.map((e) => e.id))}`);
|
|
32
|
+
ce(I, !f, m), re({ refs: [R], enabled: d, onDismiss: () => c(!1) }), ee(() => {
|
|
33
33
|
u.length || c(!1);
|
|
34
34
|
}, [u.length]);
|
|
35
|
-
const
|
|
35
|
+
const P = (e) => {
|
|
36
36
|
var t, s;
|
|
37
37
|
if ((t = n[e]) != null && t.disabled) return;
|
|
38
38
|
const o = u.includes(e);
|
|
39
|
-
|
|
40
|
-
},
|
|
39
|
+
H(e), c(!1), h == null || h(n[e]), o && ((s = N.current) == null || s.focus({ preventScroll: !0 }));
|
|
40
|
+
}, S = () => {
|
|
41
41
|
var e;
|
|
42
42
|
return Array.from(((e = k.current) == null ? void 0 : e.querySelectorAll('[role="menuitem"]:not([aria-disabled="true"])')) || []);
|
|
43
|
-
},
|
|
43
|
+
}, X = (e) => {
|
|
44
44
|
var t;
|
|
45
|
-
const o =
|
|
45
|
+
const o = S();
|
|
46
46
|
(t = o[e < 0 ? o.length - 1 : e]) == null || t.focus();
|
|
47
|
-
},
|
|
47
|
+
}, Z = (e) => {
|
|
48
48
|
var i, l;
|
|
49
|
-
const o =
|
|
49
|
+
const o = S(), t = o.indexOf(document.activeElement), s = e.key === "ArrowDown" ? (t + 1) % o.length : e.key === "ArrowUp" ? (t - 1 + o.length) % o.length : e.key === "Home" ? 0 : e.key === "End" ? o.length - 1 : -1;
|
|
50
50
|
s >= 0 ? (e.preventDefault(), (i = o[s]) == null || i.focus()) : e.key === "Escape" && (e.preventDefault(), c(!1), (l = N.current) == null || l.focus());
|
|
51
|
-
}, M = (e) => /* @__PURE__ */ r("span", { className: "u-tabs-title", "data-label": e.title, children: e.title }),
|
|
51
|
+
}, M = (e) => /* @__PURE__ */ r("span", { className: "u-tabs-title", "data-label": e.title, children: e.title }), W = (e) => {
|
|
52
52
|
if (!e.icon) return M(e);
|
|
53
53
|
const o = e.iconPosition === "right";
|
|
54
54
|
return /* @__PURE__ */ a("span", { className: `u-tabs-content${o ? " u-tabs-content-reverse" : ""}`, children: [
|
|
@@ -58,16 +58,16 @@ const me = [], Se = ({
|
|
|
58
58
|
}, C = (e, o, t, s = !1) => {
|
|
59
59
|
const i = n[e];
|
|
60
60
|
if (!i.url)
|
|
61
|
-
return /* @__PURE__ */ r("button", { type: "button", ...o, onClick: s ? void 0 : () =>
|
|
61
|
+
return /* @__PURE__ */ r("button", { type: "button", ...o, onClick: s ? void 0 : () => P(e), children: t });
|
|
62
62
|
if (s || i.disabled)
|
|
63
63
|
return /* @__PURE__ */ r("a", { ...o, role: o.role ?? (s ? void 0 : "link"), children: t });
|
|
64
|
-
const l = (
|
|
65
|
-
|
|
64
|
+
const l = (x) => {
|
|
65
|
+
me(x) && P(e);
|
|
66
66
|
};
|
|
67
67
|
return $ ? /* @__PURE__ */ r($, { to: i.url, ...o, onClick: l, children: t }) : /* @__PURE__ */ r("a", { href: i.url, ...o, onClick: l, children: t });
|
|
68
68
|
}, E = (e, o = !1) => {
|
|
69
69
|
const t = n[e], s = !!(t.icon && t.iconOnly), i = t.icon ? s ? " u-tab-icon-only" : ` u-tab-with-icon${t.iconPosition === "right" ? " u-tab-icon-right" : ""}` : "", l = C(e, {
|
|
70
|
-
className: `${v}${i}${t.id === m ? ` ${
|
|
70
|
+
className: `${v}${i}${t.id === m ? ` ${Q}` : ""}${t.disabled ? " u-tab--disabled" : ""}`,
|
|
71
71
|
"data-label": s ? void 0 : t.title,
|
|
72
72
|
"aria-label": s ? t.title : void 0,
|
|
73
73
|
"data-measure-tab": o ? "" : void 0,
|
|
@@ -78,8 +78,8 @@ const me = [], Se = ({
|
|
|
78
78
|
tabIndex: o || t.disabled ? -1 : void 0,
|
|
79
79
|
"aria-current": !o && t.id === m ? "page" : void 0,
|
|
80
80
|
"aria-disabled": !o && t.disabled ? "true" : void 0
|
|
81
|
-
},
|
|
82
|
-
return /* @__PURE__ */ r("div", { className: "u-tabs-item", children: U && !_ && !o ? /* @__PURE__ */ r(
|
|
81
|
+
}, W(t), o);
|
|
82
|
+
return /* @__PURE__ */ r("div", { className: "u-tabs-item", children: U && !_ && !o ? /* @__PURE__ */ r(te, { tooltipText: t.title, portalOn: !0, className: "u-tabs-tooltip", children: l }) : l }, e);
|
|
83
83
|
};
|
|
84
84
|
return /* @__PURE__ */ a(
|
|
85
85
|
T ? "nav" : "div",
|
|
@@ -89,14 +89,14 @@ const me = [], Se = ({
|
|
|
89
89
|
"aria-label": T ? B : void 0,
|
|
90
90
|
children: [
|
|
91
91
|
/* @__PURE__ */ a("div", { className: "u-tabs-track", ref: I, children: [
|
|
92
|
-
/* @__PURE__ */ r("span", { className: "u-tabs-indicator", ref:
|
|
92
|
+
/* @__PURE__ */ r("span", { className: "u-tabs-indicator", ref: V, "aria-hidden": "true" }),
|
|
93
93
|
z.map((e) => E(e)),
|
|
94
94
|
u.length > 0 && /* @__PURE__ */ a(
|
|
95
95
|
"div",
|
|
96
96
|
{
|
|
97
97
|
className: "u-tabs-more",
|
|
98
98
|
ref: R,
|
|
99
|
-
onKeyDown:
|
|
99
|
+
onKeyDown: Z,
|
|
100
100
|
onBlur: (e) => {
|
|
101
101
|
const o = e.relatedTarget;
|
|
102
102
|
o && !e.currentTarget.contains(o) && c(!1);
|
|
@@ -108,12 +108,13 @@ const me = [], Se = ({
|
|
|
108
108
|
type: "button",
|
|
109
109
|
ref: N,
|
|
110
110
|
className: `${v} u-tabs-more-trigger`,
|
|
111
|
+
style: L(),
|
|
111
112
|
"aria-expanded": d,
|
|
112
113
|
"aria-haspopup": "menu",
|
|
113
114
|
"aria-controls": A,
|
|
114
115
|
onClick: () => c((e) => !e),
|
|
115
116
|
onKeyDown: (e) => {
|
|
116
|
-
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), e.stopPropagation(), c(!0), requestAnimationFrame(() =>
|
|
117
|
+
(e.key === "ArrowDown" || e.key === "ArrowUp") && (e.preventDefault(), e.stopPropagation(), c(!0), requestAnimationFrame(() => X(e.key === "ArrowUp" ? -1 : 0)));
|
|
117
118
|
},
|
|
118
119
|
children: [
|
|
119
120
|
/* @__PURE__ */ r("span", { children: "Ещё" }),
|
|
@@ -121,7 +122,7 @@ const me = [], Se = ({
|
|
|
121
122
|
]
|
|
122
123
|
}
|
|
123
124
|
),
|
|
124
|
-
|
|
125
|
+
J && /* @__PURE__ */ r("div", { className: "u-tabs-more-menu", role: "menu", id: A, ref: k, style: se(Y, G), children: O.current.filter((e) => n[e]).map((e) => /* @__PURE__ */ r(oe, { children: C(e, {
|
|
125
126
|
role: "menuitem",
|
|
126
127
|
"aria-disabled": n[e].disabled ? "true" : void 0,
|
|
127
128
|
tabIndex: n[e].disabled ? -1 : void 0
|