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.
@@ -1,256 +1,267 @@
1
- import { jsx as o, jsxs as S } from "react/jsx-runtime";
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 V, useEffect as z, useMemo as Pe } from "react";
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 Be } from "../../hooks/useSelectEngine.js";
9
- import { isSameOptionValue$u as Fe, getOptionKeys$u as He } from "../../shared/optionValue.js";
10
- import { getPopupTransitionStyle$u as C } from "../../shared/popupTransition.js";
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": ee,
18
- "aria-labelledby": te,
19
- "aria-describedby": ce,
20
- title: O = "",
21
- required: R = !1,
22
- options: T,
23
- styleSelectContainer: se,
24
- styleTitle: ie,
25
- styleSelect: le,
26
- lineUp: v = !1,
27
- rowGap: re = 4,
28
- columnGap: oe = 20,
29
- placeholder: ae = "Не выбрано",
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: g = !1,
31
+ isClearable: le = !1,
32
32
  onChange: f,
33
- className: ne,
34
- tableView: $ = !1,
35
- size: D,
36
- validationText: de = "Заполните поле",
37
- validationOn: L,
38
- error: pe,
39
- absoluteValidationText: fe,
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: me,
42
- onInputChange: y,
43
- loading: b,
44
- inputValue: x,
41
+ portalOn: pe,
42
+ onInputChange: u,
43
+ loading: x,
44
+ inputValue: y,
45
45
  onInputValueChange: c,
46
- emptyOptionsText: be = "Ничего не найдено",
47
- id: xe
46
+ emptyOptionsText: fe = "Ничего не найдено",
47
+ id: me
48
48
  }) => {
49
- const u = We(D, $), E = Ye(D, $), w = Je({ error: pe, validationOn: L, validationText: de }), [j, m] = Ke(""), K = V(!1), a = typeof x == "string" && typeof c == "function", r = j && !a ? T.filter((e) => (e.label ?? "").toLowerCase().includes((a ? x : j).toLowerCase())) : T, P = r.findIndex((e) => Fe(e == null ? void 0 : e.value, t == null ? void 0 : t.value)), d = Be({
50
- optionsLength: r.length,
51
- initialIndex: Math.max(0, P),
52
- selectedIndex: P,
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: me,
55
- loading: b,
56
- id: xe,
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 l = r[e];
63
- l && W.current(l);
62
+ const r = o[e];
63
+ r && M.current(r);
64
64
  }
65
65
  }), {
66
- isOpen: i,
67
- blockRef: A,
68
- portalOptionsRef: B,
66
+ isOpen: s,
67
+ blockRef: P,
68
+ portalOptionsRef: A,
69
69
  optionsListRef: F,
70
70
  listboxId: p,
71
- activeDescendantId: ye,
72
- activeIndex: ue,
73
- hoveredIndex: he,
74
- setHoveredIndex: Se,
75
- handleKeyDown: Oe,
71
+ activeDescendantId: be,
72
+ activeIndex: xe,
73
+ hoveredIndex: ye,
74
+ setHoveredIndex: ue,
75
+ handleKeyDown: he,
76
76
  shouldRenderPortal: ve,
77
- portalStatus: ge,
78
- shouldRenderLocal: we,
79
- localStatus: je,
77
+ portalStatus: Se,
78
+ shouldRenderLocal: Oe,
79
+ localStatus: ge,
80
80
  isAnimated: H,
81
- portalWidth: ke,
82
- anchor: Ne,
83
- usePortal: k
84
- } = d, s = d.portalPosition, ze = Ee(p, O, R, w, {
85
- "aria-label": ee,
86
- "aria-labelledby": te,
87
- "aria-describedby": ce
88
- }), G = d.close, M = (e) => typeof e == "number" ? `calc(${e} * var(--u-preset-unit, 1px))` : String(e), W = V(() => {
89
- }), { flippedTop: Re, flippedUp: Te } = Ge({
90
- isOpen: i,
91
- portalOn: k,
92
- anchor: Ne,
93
- blockRef: A,
94
- portalOptionsRef: B,
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: [s == null ? void 0 : s.x, s == null ? void 0 : s.y, r.length, b]
96
+ dependencies: [i == null ? void 0 : i.x, i == null ? void 0 : i.y, o.length, x]
97
97
  });
98
- z(() => {
99
- t && Object.keys(t).length == 0 && m("");
100
- }, [t]), z(() => {
101
- t != null && t.label && Object.keys(t).length && !i && m(t.label);
102
- }, [i, t]);
103
- const N = a ? x : j, $e = (e) => {
104
- n || (i || d.open(e.currentTarget), a ? c && c(e.target.value) : m(e.target.value), y && y(e.target.value));
105
- }, h = !!(t && typeof t == "object" && t.value !== void 0 && String(t.value).length > 0), Y = t != null && t.label && Object.keys(t).length ? t.label : "", q = !i && !N ? Y : "";
106
- z(() => {
107
- const e = K.current;
108
- K.current = i, e && !i && a && h && x.length > 0 && (c == null || c(""));
109
- }, [i, a, h, x, c]);
110
- const De = () => {
111
- n || (f == null || f(null), a ? c == null || c("") : m(""), y && y(""), G());
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.preventDefault(), e.stopPropagation(), De();
114
- }, Q = (e) => {
115
- f == null || f(e), G(), a ? c == null || c("") : m(e.label ?? "");
116
- }, Le = Pe(() => He(r), [r]);
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: l,
122
+ index: r,
123
123
  listboxId: p,
124
124
  selectedValue: t == null ? void 0 : t.value,
125
- isActive: he === l || ue === l,
126
- tableView: u,
127
- onSelect: Q,
128
- onHover: Se
125
+ isActive: ye === r || xe === r,
126
+ tableView: m,
127
+ onSelect: J,
128
+ onHover: ue
129
129
  },
130
- Le[l]
131
- ), I = /* @__PURE__ */ o(
130
+ $e[r]
131
+ ), Le = /* @__PURE__ */ l(
132
132
  "input",
133
133
  {
134
- className: i ? "u-selectbox-select u-selectbox-select-open" : "u-selectbox-select",
134
+ className: s ? "u-selectbox-select u-selectbox-select-open" : "u-selectbox-select",
135
135
  role: "combobox",
136
- ...ze,
137
- "aria-expanded": i,
136
+ ...Ne,
137
+ "aria-expanded": s,
138
138
  "aria-haspopup": "listbox",
139
139
  "aria-controls": p,
140
140
  "aria-autocomplete": "list",
141
- "aria-activedescendant": ye,
141
+ "aria-activedescendant": be,
142
142
  onClick: (e) => {
143
- N.length > 0 && (a ? c && c("") : m("")), !n && i && e.currentTarget.blur(), d.toggle(e.currentTarget);
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
- u ? {
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
- X != null ? { paddingRight: X } : {},
154
- L && { border: "1px solid var(--u-color-error, #EF302B)" }
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: N || q,
158
+ value: j || Y,
159
159
  onFocus: (e) => {
160
- q && e.currentTarget.select();
160
+ Y && e.currentTarget.select();
161
161
  },
162
- onChange: $e,
163
- onKeyDown: Oe,
164
- placeholder: Y || ae
162
+ onChange: Re,
163
+ onKeyDown: he,
164
+ placeholder: W || re
165
165
  }
166
166
  );
167
- return /* @__PURE__ */ S("div", { className: `u-react-select-container${E ? ` ${E}` : ""} ${ne ?? ""}`, style: { position: "relative" }, children: [
168
- /* @__PURE__ */ S(
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: v ? "row" : "column",
175
- rowGap: v ? null : M(re),
176
- columnGap: v ? M(oe) : null
174
+ flexDirection: S ? "row" : "column",
175
+ rowGap: S ? null : G(se),
176
+ columnGap: S ? G(ie) : null
177
177
  },
178
- se
178
+ ee
179
179
  ),
180
180
  children: [
181
- O && /* @__PURE__ */ o(
181
+ v && /* @__PURE__ */ l(
182
182
  "div",
183
183
  {
184
184
  id: `${p}-label`,
185
- className: `${R ? "u-required" : ""} u-react-select-title`,
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
- ie
191
+ te
192
192
  ),
193
- children: O
193
+ children: v
194
194
  }
195
195
  ),
196
- /* @__PURE__ */ S(
196
+ /* @__PURE__ */ h(
197
197
  "div",
198
198
  {
199
199
  className: `u-selectbox${n ? " u-selectbox-disabled" : ""} u-react-select`,
200
- ref: A,
200
+ ref: P,
201
201
  style: Object.assign(
202
202
  {
203
203
  width: "100%"
204
204
  },
205
- le
205
+ ce
206
206
  ),
207
207
  children: [
208
- g ? /* @__PURE__ */ S("div", { style: { position: "relative", width: "100%" }, children: [
209
- I,
210
- !n && h ? /* @__PURE__ */ o(
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: J,
217
+ onClick: q,
218
218
  onKeyDown: (e) => {
219
- (e.key === "Enter" || e.key === " ") && J(e);
219
+ (e.key === "Enter" || e.key === " ") && q(e);
220
220
  },
221
- style: {
222
- zIndex: 2,
223
- cursor: "pointer",
224
- right: u ? "calc(8 * var(--u-unit, 1px))" : "calc(20 * var(--u-unit, 1px))"
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
- ) : null
228
- ] }) : I,
229
- i && b ? /* @__PURE__ */ o(
241
+ )
242
+ ] }),
243
+ s && x ? /* @__PURE__ */ l(
230
244
  "div",
231
245
  {
232
246
  className: "u-selectbox-options",
233
- style: Object.assign(
234
- { textAlign: "center", padding: "calc(16 * var(--u-unit, 1px))" },
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
- !b && k && ve && s && Ae(
241
- /* @__PURE__ */ o(
251
+ !x && w && ve && i && Ae(
252
+ /* @__PURE__ */ l(
242
253
  "div",
243
254
  {
244
- ref: B,
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: ke,
252
- left: s == null ? void 0 : s.x,
253
- top: Re ?? (s == null ? void 0 : s.y) - 60,
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
- C(ge, H)
274
+ U(Se, H)
264
275
  ),
265
- children: r.length > 0 ? r.map((e, l) => U(e, l)) : _
276
+ children: o.length > 0 ? o.map((e, r) => Z(e, r)) : X
266
277
  }
267
278
  ),
268
279
  document.body
269
280
  ),
270
- !b && !k && we ? /* @__PURE__ */ o(
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: Te ? "u-selectbox-options u-selectbox-options-up" : "u-selectbox-options",
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
- C(je, H)
294
+ U(ge, H)
285
295
  ),
286
- children: r.length > 0 ? r.map((e, l) => U(e, l)) : _
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
- w.showText && /* @__PURE__ */ o("h5", { id: `${p}-error`, className: "h5 clr-red-main", style: fe ? { position: "absolute", bottom: "calc(-20 * var(--u-unit, 1px))" } : { position: "relative", marginTop: "calc(4 * var(--u-unit, 1px))" }, children: w.text })
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,4CA6LhB,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 x, useRef as p, useEffect as D, Fragment as ee } from "react";
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 oe } from "../Tooltip/Tooltip.js";
9
- import { useDismiss$u as te } from "../../hooks/useDismiss.js";
10
- import { useMountTransition$u as re } from "../../hooks/useMountTransition.js";
11
- import { getPopupTransitionStyle$u as ne, POPUP_TRANSITION_MS$u as se } from "../../shared/popupTransition.js";
12
- import { useTabsOverflow$u as ie } from "./useTabsOverflow.js";
13
- import { useTabsIndicator$u as le } from "./useTabsIndicator.js";
14
- import { useTabsScroll$u as ae } from "./useTabsScroll.js";
15
- import { useAutoId$u as ce } from "../../hooks/useAutoId.js";
16
- import { isPlainLeftClick$u as ue } from "../../vanilla/core/linkClick.js";
17
- const me = [], Se = ({
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 = me,
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, promote: L } = ie(n, m, y, g !== "segment"), [d, c] = x(!1), R = p(null), N = p(null), k = p(null), A = ce(void 0, "u-tabs-menu"), { shouldRender: H, status: J, isAnimated: Y } = re({ isOpen: d, duration: se }), O = p(u);
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", G = f ? "u-tab-segment-active" : "u-tab-active", { trackRef: I, indicatorRef: Q } = le(m, `${g}|${y}|${JSON.stringify(n.map((e) => e.id))}`);
32
- ae(I, !f, m), te({ refs: [R], enabled: d, onDismiss: () => c(!1) }), D(() => {
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 S = (e) => {
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
- L(e), c(!1), h == null || h(n[e]), o && ((s = N.current) == null || s.focus({ preventScroll: !0 }));
40
- }, P = () => {
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
- }, V = (e) => {
43
+ }, X = (e) => {
44
44
  var t;
45
- const o = P();
45
+ const o = S();
46
46
  (t = o[e < 0 ? o.length - 1 : e]) == null || t.focus();
47
- }, X = (e) => {
47
+ }, Z = (e) => {
48
48
  var i, l;
49
- const o = P(), 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;
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 }), Z = (e) => {
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 : () => S(e), children: t });
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 = (W) => {
65
- ue(W) && S(e);
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 ? ` ${G}` : ""}${t.disabled ? " u-tab--disabled" : ""}`,
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
- }, Z(t), o);
82
- return /* @__PURE__ */ r("div", { className: "u-tabs-item", children: U && !_ && !o ? /* @__PURE__ */ r(oe, { tooltipText: t.title, portalOn: !0, className: "u-tabs-tooltip", children: l }) : l }, e);
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: Q, "aria-hidden": "true" }),
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: X,
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(() => V(e.key === "ArrowUp" ? -1 : 0)));
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
- H && /* @__PURE__ */ r("div", { className: "u-tabs-more-menu", role: "menu", id: A, ref: k, style: ne(J, Y), children: O.current.filter((e) => n[e]).map((e) => /* @__PURE__ */ r(ee, { children: C(e, {
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