urfu-ui-kit-react 2.1.6 → 2.1.7-next.0

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,7 +1,7 @@
1
1
  import { useLayoutEffect as v } from "react";
2
2
  const F = (r, g, p, b, w) => {
3
3
  var o, f, m;
4
- const t = r.ownerDocument.defaultView, a = t == null ? void 0 : t.getComputedStyle(r), e = g.top + (parseFloat((a == null ? void 0 : a.borderTopWidth) ?? "") || 0) + (parseFloat((a == null ? void 0 : a.paddingTop) ?? "") || 0), i = Math.max(0, p - e + b), l = (f = (o = r.ownerDocument).createRange) == null ? void 0 : f.call(o);
4
+ const t = r.ownerDocument.defaultView, a = t == null ? void 0 : t.getComputedStyle(r), e = g.top + (Number.parseFloat((a == null ? void 0 : a.borderTopWidth) ?? "") || 0) + (Number.parseFloat((a == null ? void 0 : a.paddingTop) ?? "") || 0), i = Math.max(0, p - e + b), l = (f = (o = r.ownerDocument).createRange) == null ? void 0 : f.call(o);
5
5
  l == null || l.selectNodeContents(r);
6
6
  const s = [...((m = l == null ? void 0 : l.getClientRects) == null ? void 0 : m.call(l)) ?? []].filter((c) => c.width > 0 || c.height > 0).map((c) => (c.top + c.bottom) / 2 + w / 2);
7
7
  if (s.length === 0) return i;
@@ -9,8 +9,8 @@ const F = (r, g, p, b, w) => {
9
9
  if (i <= h) return i;
10
10
  const d = r.nextElementSibling, n = Math.max(
11
11
  0,
12
- parseFloat((a == null ? void 0 : a.marginBottom) ?? "") || 0,
13
- d && t && parseFloat(t.getComputedStyle(d).marginTop) || 0
12
+ Number.parseFloat((a == null ? void 0 : a.marginBottom) ?? "") || 0,
13
+ d && t && Number.parseFloat(t.getComputedStyle(d).marginTop) || 0
14
14
  );
15
15
  return Math.min(i, Math.max(h, p - e - n));
16
16
  }, A = (r, g, p, b, w) => {
@@ -22,12 +22,12 @@ const F = (r, g, p, b, w) => {
22
22
  t.setAttribute("data-u-modal-has-title", "");
23
23
  let s = 0;
24
24
  const h = () => {
25
- const o = e.getBoundingClientRect(), f = i.getBoundingClientRect(), m = t.getBoundingClientRect(), c = l.getComputedStyle(e), x = parseFloat(c.lineHeight) || (parseFloat(c.fontSize) || 16) * 1.2, C = t.offsetWidth > 0 && m.width > 0 ? m.width / t.offsetWidth : 1;
25
+ const o = e.getBoundingClientRect(), f = i.getBoundingClientRect(), m = t.getBoundingClientRect(), c = l.getComputedStyle(e), x = Number.parseFloat(c.lineHeight) || (Number.parseFloat(c.fontSize) || 16) * 1.2, C = t.offsetWidth > 0 && m.width > 0 ? m.width / t.offsetWidth : 1;
26
26
  t.style.setProperty(
27
27
  "--u-modal-title-close-top",
28
28
  `${(o.top - m.top - f.height / 2) / C + x / 2}px`
29
29
  );
30
- const u = i.getBoundingClientRect(), y = parseFloat(l.getComputedStyle(t).getPropertyValue("--u-modal-title-gap")) || 8;
30
+ const u = i.getBoundingClientRect(), y = Number.parseFloat(l.getComputedStyle(t).getPropertyValue("--u-modal-title-gap")) || 8;
31
31
  u.left < o.right + y && u.right > o.left && u.bottom + y > o.top && u.top < o.bottom ? (e.setAttribute("data-u-modal-title-clearance", ""), e.style.setProperty(
32
32
  "--u-modal-title-clearance-width",
33
33
  `${Math.min(o.width, Math.max(0, o.right - u.left + y))}px`
@@ -65,7 +65,7 @@ const yt = ({
65
65
  getPortalPosition: (e) => ({ x: e.x, y: e.y + 60 + e.height + e.scrollY }),
66
66
  // Поле растёт от чипов: строке варианта нужна его базовая высота, а не текущая.
67
67
  measureFieldHeight: (e) => {
68
- const t = parseFloat(getComputedStyle(e).minHeight), r = e.getBoundingClientRect().height;
68
+ const t = Number.parseFloat(getComputedStyle(e).minHeight), r = e.getBoundingClientRect().height;
69
69
  return t > 0 ? Math.min(t, r) : r;
70
70
  },
71
71
  onSelectByIndex: (e) => {
@@ -1,28 +1,28 @@
1
1
  import { getDataFromDateFilterType$u as T } from "./Functions.js";
2
- const O = (i) => typeof i == "object" && i !== null && "title" in i, I = ({
2
+ const N = (i) => typeof i == "object" && i !== null && "title" in i, I = ({
3
3
  data: i,
4
4
  columns: A,
5
5
  sort: s,
6
- uncheckedValues: g,
6
+ uncheckedValues: v,
7
7
  filterDates: w,
8
- whereFindChecked: a,
8
+ whereFindChecked: b,
9
9
  filterEmptyLabel: x,
10
- parentDataField: c,
10
+ parentDataField: u,
11
11
  filterMode: L = "client"
12
12
  }) => {
13
- const S = w.filter(
13
+ const O = w.filter(
14
14
  (r) => !(r.begin === null && r.end === null)
15
- ), j = (r) => {
15
+ ), S = (r) => {
16
16
  if (L === "server") return !0;
17
- const t = a.length > 0 ? r[a] : r, u = Object.keys(g).length === 0 || Object.keys(g).every((o) => {
18
- const n = A == null ? void 0 : A.find((f) => f.field === o), e = n != null && n.filterValue ? n.filterValue(t) : t[o];
19
- return Array.isArray(e) && e.every(O) ? !e.every(
20
- (f) => g[o].includes(f.title)
21
- ) : Array.isArray(e) ? !e.every((f) => g[o].includes(f)) : O(e) ? !g[o].includes(e.title) : !g[o].includes(
17
+ const t = b.length > 0 ? r[b] : r, f = Object.keys(v).length === 0 || Object.keys(v).every((o) => {
18
+ const n = A == null ? void 0 : A.find((c) => c.field === o), e = n != null && n.filterValue ? n.filterValue(t) : t[o];
19
+ return Array.isArray(e) && e.every(N) ? !e.every(
20
+ (c) => v[o].includes(c.title)
21
+ ) : Array.isArray(e) ? !e.every((c) => v[o].includes(c)) : N(e) ? !v[o].includes(e.title) : !v[o].includes(
22
22
  e == null || typeof e == "string" && e.length === 0 ? x : e
23
23
  );
24
- }), b = S.length === 0 || Object.keys(t).some(
25
- (o) => S.some(
24
+ }), p = O.length === 0 || Object.keys(t).some(
25
+ (o) => O.some(
26
26
  (n) => n.id === o && T(
27
27
  t[o],
28
28
  n.type,
@@ -30,47 +30,47 @@ const O = (i) => typeof i == "object" && i !== null && "title" in i, I = ({
30
30
  n.end
31
31
  )
32
32
  )
33
- ), l = S.some(
33
+ ), l = O.some(
34
34
  (o) => o.type === "except" && !Object.keys(t).includes(o.id)
35
35
  );
36
- return u && (b || l);
37
- }, B = (r, t) => {
38
- const u = r.customOrderSort, b = t.customOrderSort;
39
- if (u || b)
40
- return (u || 0) > (b || 0) ? -1 : 1;
41
- const l = A.find((v) => v.field === s.column);
36
+ return f && (p || l);
37
+ }, j = (r, t) => {
38
+ const f = r.customOrderSort, p = t.customOrderSort;
39
+ if (f || p)
40
+ return (f || 0) > (p || 0) ? -1 : 1;
41
+ const l = A.find((g) => g.field === s.column);
42
42
  if (l != null && l.sortComparator)
43
43
  return s.asc ? l.sortComparator(r, t) : -l.sortComparator(r, t);
44
- const o = (v) => {
45
- if (l != null && l.sortValue) return l.sortValue(v);
46
- const y = a.length > 0 ? v[a][s.column] : v[s.column];
47
- return Array.isArray(y) ? y.length > 0 && y.every(O) ? y[0].title : y[0] : O(y) ? y.title : y;
44
+ const o = (g) => {
45
+ if (l != null && l.sortValue) return l.sortValue(g);
46
+ const y = b.length > 0 ? g[b][s.column] : g[s.column];
47
+ return Array.isArray(y) ? y.length > 0 && y.every(N) ? y[0].title : y[0] : N(y) ? y.title : y;
48
48
  }, n = o(r), e = o(t);
49
49
  if (typeof n == "boolean" && typeof e == "boolean")
50
50
  return s.asc ? n === e ? 0 : n ? 1 : -1 : n === e ? 0 : n ? -1 : 1;
51
- const f = typeof n == "number" ? n : void 0, m = typeof e == "number" ? e : void 0;
52
- if (!isNaN(f) && !isNaN(m))
53
- return s.asc ? f - m : m - f;
51
+ const c = typeof n == "number" ? n : void 0, m = typeof e == "number" ? e : void 0;
52
+ if (c !== void 0 && m !== void 0 && !Number.isNaN(c) && !Number.isNaN(m))
53
+ return s.asc ? c - m : m - c;
54
54
  if (n == null) return s.asc ? -1 : 1;
55
55
  if (e == null) return s.asc ? 1 : -1;
56
- const N = String(n).toLowerCase(), h = String(e).toLowerCase();
57
- return N < h ? s.asc ? -1 : 1 : N > h ? s.asc ? 1 : -1 : 0;
58
- }, p = [...c ? i == null ? void 0 : i.map((r) => {
56
+ const B = String(n).toLowerCase(), h = String(e).toLowerCase();
57
+ return B < h ? s.asc ? -1 : 1 : B > h ? s.asc ? 1 : -1 : 0;
58
+ }, a = [...u ? i == null ? void 0 : i.map((r) => {
59
59
  var t;
60
60
  return {
61
61
  ...r,
62
- [c]: (t = r[c]) == null ? void 0 : t.filter(
63
- (u) => j(u)
62
+ [u]: (t = r[u]) == null ? void 0 : t.filter(
63
+ (f) => S(f)
64
64
  )
65
65
  };
66
66
  }).filter(
67
67
  (r) => {
68
68
  var t;
69
- return !r[c] && j(r) || (((t = r[c]) == null ? void 0 : t.length) ?? 0) > 0;
69
+ return !r[u] && S(r) || (((t = r[u]) == null ? void 0 : t.length) ?? 0) > 0;
70
70
  }
71
- ) : i == null ? void 0 : i.filter((r) => j(r))];
72
- return (s == null ? void 0 : s.asc) === void 0 || (p.sort((r, t) => B(r, t)), c && p.forEach((r) => {
73
- r[c] && Array.isArray(r[c]) && r[c].sort((t, u) => B(t, u));
74
- })), p;
71
+ ) : i == null ? void 0 : i.filter((r) => S(r))];
72
+ return (s == null ? void 0 : s.asc) === void 0 || (a.sort((r, t) => j(r, t)), u && a.forEach((r) => {
73
+ r[u] && Array.isArray(r[u]) && r[u].sort((t, f) => j(t, f));
74
+ })), a;
75
75
  };
76
76
  export { I as computeFilteredSortedData$u };
@@ -23,15 +23,15 @@ import { useMobileFilterColumns$u as wr } from "./useMobileFilterColumns.js";
23
23
  import { nextCardMode$u as xr, getStickyLeft$u as Fr } from "./Table.helpers.js";
24
24
  const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr = (i) => {
25
25
  if (typeof i == "number") return i > 0 ? i : void 0;
26
- if (typeof i == "string" && /^\d+(\.\d+)?(px)?$/.test(i.trim())) return parseFloat(i);
26
+ if (typeof i == "string" && /^\d+(\.\d+)?(px)?$/.test(i.trim())) return Number.parseFloat(i);
27
27
  }, Pr = ({
28
28
  data: i,
29
29
  columns: T,
30
30
  borders: y = "horizontal",
31
31
  striped: Me,
32
32
  linesNotActive: Te,
33
- fixedHeader: ze,
34
- headerBorders: Ne,
33
+ fixedHeader: Ne,
34
+ headerBorders: ze,
35
35
  tdStyle: Ve,
36
36
  thStyle: je,
37
37
  cellStyle: G,
@@ -39,7 +39,7 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
39
39
  thContentStyle: Le,
40
40
  cellContentStyle: Q,
41
41
  contentForEmptyTable: _e = /* @__PURE__ */ o("p", { children: "Ничего не найдено" }),
42
- messageForEmptyTable: z,
42
+ messageForEmptyTable: N,
43
43
  messageForEmptyFilter: X = "Ничего не найдено. Измените или сбросьте фильтры.",
44
44
  mobileMessageForEmptyTable: Y,
45
45
  className: Z = "",
@@ -62,7 +62,7 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
62
62
  setFilteredTableData: re,
63
63
  withoutHeader: oe,
64
64
  filterResetParam: se,
65
- filterMode: N = "client",
65
+ filterMode: z = "client",
66
66
  filters: Xe,
67
67
  defaultFilters: Ye,
68
68
  onFiltersChange: Ze,
@@ -110,7 +110,7 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
110
110
  setLookColumnWidths: Ht,
111
111
  handleMouseDown: It,
112
112
  thRefs: Mt
113
- } = br(g, C), [Tt, ue] = H(void 0), [zt, _] = H([]), [Nt, Vt] = H(void 0), jt = U(() => g.filter((e) => e.hidden !== !0), [g]), { filters: he, setFilters: ae, uncheckedValues: w, setUncheckedValues: Bt, filterDates: x, setFilterDates: Lt } = Sr({ filters: Xe, defaultFilters: Ye, onFiltersChange: Ze, filterResetParam: se }), {
113
+ } = br(g, C), [Tt, ue] = H(void 0), [Nt, _] = H([]), [zt, Vt] = H(void 0), jt = U(() => g.filter((e) => e.hidden !== !0), [g]), { filters: he, setFilters: ae, uncheckedValues: w, setUncheckedValues: Bt, filterDates: x, setFilterDates: Lt } = Sr({ filters: Xe, defaultFilters: Ye, onFiltersChange: Ze, filterResetParam: se }), {
114
114
  sort: F,
115
115
  setSort: _t,
116
116
  hoveredSortCol: kt,
@@ -132,12 +132,12 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
132
132
  columns: g,
133
133
  sort: le && !ie ? void 0 : F,
134
134
  uncheckedValues: w,
135
- filterMode: N,
135
+ filterMode: z,
136
136
  filterDates: x,
137
137
  whereFindChecked: Ue,
138
138
  filterEmptyLabel: ee,
139
139
  parentDataField: p
140
- })), pe = !r || Nt === r, s = U(() => pe ? void 0 : fe(r), [pe, r]) ?? zt, {
140
+ })), pe = !r || zt === r, s = U(() => pe ? void 0 : fe(r), [pe, r]) ?? Nt, {
141
141
  rootRef: u,
142
142
  start: O,
143
143
  visibleCount: Kt,
@@ -169,7 +169,7 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
169
169
  const e = fe(r);
170
170
  _(e), Vt(r), re && re(e);
171
171
  }
172
- }, [r, w, x, F, N]);
172
+ }, [r, w, x, F, z]);
173
173
  const Pt = (e) => {
174
174
  const t = [...s];
175
175
  t[e].parentDataOpened = !0, _(t);
@@ -213,7 +213,7 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
213
213
  ), Fe = P === void 0 ? -1 : n.findIndex((e, t) => M(e, t) === P), E = Fe >= 0 ? Fe : n.length - 1, v = n.map((e, t) => {
214
214
  const l = Wr(e.width), f = h && t === E && l !== void 0 ? l : or[M(e, t)] ?? l;
215
215
  return C && !e.resizeOff ? Math.max(L[e.field] || f || 0, e.width || 0) : f;
216
- }), Oe = xe && v.length > 0 && v.every((e) => (e ?? 0) > 0), sr = Object.values(w).some((e) => e.length > 0) || x.some((e) => e.begin != null || e.end != null), We = N === "client" && sr && (r == null ? void 0 : r.length) > 0 && s.length === 0, De = We ? X : z, J = !B && !d && s.length === 0 && !!De;
216
+ }), Oe = xe && v.length > 0 && v.every((e) => (e ?? 0) > 0), sr = Object.values(w).some((e) => e.length > 0) || x.some((e) => e.begin != null || e.end != null), We = z === "client" && sr && (r == null ? void 0 : r.length) > 0 && s.length === 0, De = We ? X : N, J = !B && !d && s.length === 0 && !!De;
217
217
  I(() => {
218
218
  const e = u.current;
219
219
  if (!J || !e || typeof ResizeObserver > "u") return;
@@ -245,11 +245,11 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
245
245
  fillColumnIndex: h ? E : -1
246
246
  };
247
247
  return /* @__PURE__ */ $(He, { children: [
248
- c || d || (r == null ? void 0 : r.length) !== 0 || (r == null ? void 0 : r.length) === 0 && z ? /* @__PURE__ */ o(
248
+ c || d || (r == null ? void 0 : r.length) !== 0 || (r == null ? void 0 : r.length) === 0 && N ? /* @__PURE__ */ o(
249
249
  "div",
250
250
  {
251
251
  id: S,
252
- className: `u-table${["horizontal", "vertical", "none", "both"].includes(y) ? dr(y) : ""}${Me ? " striped" : ""}${Te ? " not-active-lines" : ""}${ze ? " thead-fixed" : ""}${Ne ? " header-borders" : ""}${Z ? " " + Z : ""}${m ? " u-table-mobile" : ""}`,
252
+ className: `u-table${["horizontal", "vertical", "none", "both"].includes(y) ? dr(y) : ""}${Me ? " striped" : ""}${Te ? " not-active-lines" : ""}${Ne ? " thead-fixed" : ""}${ze ? " header-borders" : ""}${Z ? " " + Z : ""}${m ? " u-table-mobile" : ""}`,
253
253
  style: {
254
254
  maxHeight: Je,
255
255
  minHeight: Ke,
@@ -269,7 +269,7 @@ const Or = (i) => i.map((T, y) => ({ ...T, tableData: { number: y + 1 } })), Wr
269
269
  isCardMode: m,
270
270
  isLoading: c,
271
271
  isLoadingPreloader: d,
272
- messageForEmptyTable: Y === "off" || B ? void 0 : We ? X : Y ?? z,
272
+ messageForEmptyTable: Y === "off" || B ? void 0 : We ? X : Y ?? N,
273
273
  effectiveSortField: k,
274
274
  effectiveSortDir: q,
275
275
  applySort: At,
@@ -1,4 +1,4 @@
1
- import { useRef as i, useState as A, useLayoutEffect as k, useCallback as N, useMemo as Z, useEffect as B } from "react";
1
+ import { useRef as i, useState as A, useLayoutEffect as N, useCallback as k, useMemo as Z, useEffect as B } from "react";
2
2
  const ot = ({
3
3
  filteredData: e,
4
4
  virtualizationOn: c,
@@ -11,7 +11,7 @@ const ot = ({
11
11
  pageSize: p
12
12
  }) => {
13
13
  const s = i(null), [h, P] = A(0), [_, $] = A(0), d = i([]), j = i([]), F = i([]), G = i([]), J = i([]), K = i({}), T = i(0);
14
- k(() => {
14
+ N(() => {
15
15
  if (!C && !S && s.current) {
16
16
  if (e.length === 0) {
17
17
  T.current = 0;
@@ -21,7 +21,7 @@ const ot = ({
21
21
  t > 0 && (T.current = t);
22
22
  }
23
23
  });
24
- const [L, O] = A(void 0), Q = N(
24
+ const [L, O] = A(void 0), Q = k(
25
25
  (t) => d.current[t] ?? I,
26
26
  [I]
27
27
  ), l = Z(() => {
@@ -32,7 +32,7 @@ const ot = ({
32
32
  }, [e.length, Q, _]), a = Z(
33
33
  () => l.length > 0 ? l[l.length - 1] : 0,
34
34
  [l]
35
- ), w = q + 1, U = N(
35
+ ), b = q + 1, U = k(
36
36
  (t) => {
37
37
  let n = 0, o = l.length - 1;
38
38
  for (; n < o; ) {
@@ -44,15 +44,15 @@ const ot = ({
44
44
  [l, e.length]
45
45
  ), X = typeof H == "number" && typeof p == "number" && p > 0, z = X ? e.slice((H - 1) * p, H * p) : e, f = c && !X && e.length > q, D = f ? l[h] : 0, tt = f ? Math.max(
46
46
  0,
47
- a - l[Math.min(e.length, h + w)]
48
- ) : 0, V = N(
47
+ a - l[Math.min(e.length, h + b)]
48
+ ) : 0, V = k(
49
49
  (t) => {
50
50
  if (!f)
51
51
  return;
52
- const n = t.target, o = Math.max(0, e.length - w), r = Math.min(o, U(n.scrollTop));
52
+ const n = t.target, o = Math.max(0, e.length - b), r = Math.min(o, U(n.scrollTop));
53
53
  P(r);
54
54
  },
55
- [e.length, U, f, w]
55
+ [e.length, U, f, b]
56
56
  );
57
57
  B(() => {
58
58
  if (c && s.current) {
@@ -77,14 +77,14 @@ const ot = ({
77
77
  return o.observe(t), () => o.disconnect();
78
78
  }, [c]);
79
79
  const Y = i(null);
80
- return k(() => {
80
+ return N(() => {
81
81
  if (!c || C) return;
82
82
  const t = Y.current;
83
83
  Y.current = { data: e, width: M }, !(!t || t.data === e && t.width === M) && (d.current = [], $((n) => n + 1));
84
84
  }, [c, C, e, M]), B(() => {
85
85
  if (!c)
86
86
  return;
87
- const t = f ? h : 0, n = f ? Math.min(e.length, h + w) : e.length;
87
+ const t = f ? h : 0, n = f ? Math.min(e.length, h + b) : e.length;
88
88
  let o = !1;
89
89
  for (let r = t; r < n; r++) {
90
90
  const u = K.current[r];
@@ -93,16 +93,16 @@ const ot = ({
93
93
  (!d.current[r] || Math.abs(d.current[r] - m) > 0.5) && (d.current[r] = m, o = !0);
94
94
  }
95
95
  o && $((r) => r + 1);
96
- }, [c, f, h, w, e.length, M]), k(() => {
96
+ }, [c, f, h, b, e.length, M]), N(() => {
97
97
  var t;
98
98
  if (!C && e.length > 0) {
99
- const n = Array.from(((t = s.current) == null ? void 0 : t.querySelectorAll(".table tbody tr")) ?? []).filter((b) => b.cells.length > 0), o = new Array(e.length).fill(void 0), r = new Array(e.length).fill(void 0), u = new Array(e.length).fill(void 0), m = new Array(e.length).fill(void 0), v = new Array(e.length).fill(void 0);
100
- n.forEach((b, W) => {
101
- const y = Number(b.dataset.virtualIndex ?? W);
102
- if (isNaN(y)) return;
103
- const nt = b.getBoundingClientRect().height;
99
+ const n = Array.from(((t = s.current) == null ? void 0 : t.querySelectorAll(".table tbody tr")) ?? []).filter((w) => w.cells.length > 0), o = new Array(e.length).fill(void 0), r = new Array(e.length).fill(void 0), u = new Array(e.length).fill(void 0), m = new Array(e.length).fill(void 0), v = new Array(e.length).fill(void 0);
100
+ n.forEach((w, W) => {
101
+ const y = Number(w.dataset.virtualIndex ?? W);
102
+ if (Number.isNaN(y)) return;
103
+ const nt = w.getBoundingClientRect().height;
104
104
  o[y] = nt;
105
- const x = Array.from(b.children);
105
+ const x = Array.from(w.children);
106
106
  r[y] = x.map((R) => R.getBoundingClientRect().height), u[y] = x.map((R) => {
107
107
  const g = R.firstElementChild;
108
108
  return g ? g.getBoundingClientRect().height : 0;
@@ -117,9 +117,9 @@ const ot = ({
117
117
  background: g.background
118
118
  };
119
119
  });
120
- }), d.current = o.map((b, W) => b ?? d.current[W]), j.current = r.filter(Boolean), F.current = u.filter(Boolean), G.current = m.filter(Boolean), J.current = v.filter(Boolean);
120
+ }), d.current = o.map((w, W) => w ?? d.current[W]), j.current = r.filter(Boolean), F.current = u.filter(Boolean), G.current = m.filter(Boolean), J.current = v.filter(Boolean);
121
121
  }
122
- }, [C, e, E, H, p, h, w]), B(() => {
122
+ }, [C, e, E, H, p, h, b]), B(() => {
123
123
  !S && e.length > 0 && setTimeout(() => {
124
124
  const t = document.querySelector(`#${E} .table tbody`);
125
125
  t && O(t.getBoundingClientRect().height);
@@ -127,7 +127,7 @@ const ot = ({
127
127
  }, [S, e, E]), {
128
128
  rootRef: s,
129
129
  start: h,
130
- visibleCount: w,
130
+ visibleCount: b,
131
131
  pagedData: z,
132
132
  hasOverflow: f,
133
133
  topPadding: D,
@@ -1,49 +1,49 @@
1
- import { useRef as O, useState as B, useCallback as P, useLayoutEffect as D } from "react";
2
- import { TAB_PADDING_MIN_RATIO$u as T, distributeTabs$u as G, lineTabsSqueeze$u as k, tabsSqueeze$u as J } from "../../vanilla/core/distributeTabs.js";
3
- const U = (l, L, g, h) => {
4
- const u = O(null), p = O(null), S = O(null), w = JSON.stringify(l.map((t) => t.id)), z = l.map((t, e) => e), [F, _] = B({ signature: w, order: z }), f = F.signature === w ? F.order : z, [r, M] = B({ widths: [], paddings: [], available: 0, gap: 0, more: 0 }), o = P(() => {
5
- var A;
6
- const t = u.current, e = p.current;
1
+ import { useRef as O, useState as q, useCallback as P, useLayoutEffect as D } from "react";
2
+ import { TAB_PADDING_MIN_RATIO$u as B, distributeTabs$u as G, lineTabsSqueeze$u as k, tabsSqueeze$u as J } from "../../vanilla/core/distributeTabs.js";
3
+ const U = (l, N, u, b) => {
4
+ const g = O(null), m = O(null), L = O(null), h = JSON.stringify(l.map((t) => t.id)), S = l.map((t, e) => e), [z, T] = q({ signature: h, order: S }), p = z.signature === h ? z.order : S, [r, _] = q({ widths: [], paddings: [], available: 0, gap: 0, more: 0 }), o = P(() => {
5
+ var x;
6
+ const t = g.current, e = m.current;
7
7
  if (!t || !e) return;
8
- const n = getComputedStyle(t), a = t.getBoundingClientRect().width - (parseFloat(n.borderLeftWidth) || 0) - (parseFloat(n.borderRightWidth) || 0) - (parseFloat(n.paddingLeft) || 0) - (parseFloat(n.paddingRight) || 0), s = Array.from(e.querySelectorAll("[data-measure-tab]")), b = s.map((i) => i.getBoundingClientRect().width), R = s.map((i) => {
8
+ const n = getComputedStyle(t), a = t.getBoundingClientRect().width - (Number.parseFloat(n.borderLeftWidth) || 0) - (Number.parseFloat(n.borderRightWidth) || 0) - (Number.parseFloat(n.paddingLeft) || 0) - (Number.parseFloat(n.paddingRight) || 0), s = Array.from(e.querySelectorAll("[data-measure-tab]")), v = s.map((i) => i.getBoundingClientRect().width), R = s.map((i) => {
9
9
  const c = getComputedStyle(i);
10
- return [parseFloat(c.paddingLeft) || 0, parseFloat(c.paddingRight) || 0];
11
- }), m = {
12
- widths: b,
10
+ return [Number.parseFloat(c.paddingLeft) || 0, Number.parseFloat(c.paddingRight) || 0];
11
+ }), f = {
12
+ widths: v,
13
13
  paddings: R,
14
14
  available: a,
15
- gap: parseFloat(n.columnGap || "0") || 0,
16
- more: ((A = S.current) == null ? void 0 : A.getBoundingClientRect().width) || 0
15
+ gap: Number.parseFloat(n.columnGap || "0") || 0,
16
+ more: ((x = L.current) == null ? void 0 : x.getBoundingClientRect().width) || 0
17
17
  };
18
- M((i) => i.available === m.available && i.gap === m.gap && i.more === m.more && i.widths.length === b.length && i.widths.every((c, y) => c === b[y]) && i.paddings.every(([c, y], E) => {
19
- var I, q;
20
- return c === ((I = R[E]) == null ? void 0 : I[0]) && y === ((q = R[E]) == null ? void 0 : q[1]);
21
- }) ? i : m);
18
+ _((i) => i.available === f.available && i.gap === f.gap && i.more === f.more && i.widths.length === v.length && i.widths.every((c, y) => c === v[y]) && i.paddings.every(([c, y], A) => {
19
+ var E, I;
20
+ return c === ((E = R[A]) == null ? void 0 : E[0]) && y === ((I = R[A]) == null ? void 0 : I[1]);
21
+ }) ? i : f);
22
22
  }, []);
23
23
  D(() => {
24
24
  var n, a;
25
25
  o();
26
26
  let t = !1;
27
27
  const e = typeof ResizeObserver > "u" ? null : new ResizeObserver(o);
28
- return u.current && (e == null || e.observe(u.current)), p.current && (e == null || e.observe(p.current)), window.addEventListener("resize", o), (n = document.fonts) == null || n.addEventListener("loadingdone", o), (a = document.fonts) == null || a.ready.then(() => {
28
+ return g.current && (e == null || e.observe(g.current)), m.current && (e == null || e.observe(m.current)), window.addEventListener("resize", o), (n = document.fonts) == null || n.addEventListener("loadingdone", o), (a = document.fonts) == null || a.ready.then(() => {
29
29
  t || o();
30
30
  }), () => {
31
31
  var s;
32
32
  t = !0, e == null || e.disconnect(), window.removeEventListener("resize", o), (s = document.fonts) == null || s.removeEventListener("loadingdone", o);
33
33
  };
34
- }, [o, l, g, h]);
35
- const N = L === void 0 ? -1 : l.findIndex((t) => t.id === L), C = r.widths.length === l.length && r.widths.every((t) => t > 0), v = g ? [] : r.paddings.map(([t, e]) => (t + e) * (1 - T)), d = C && !h ? G(f, r.widths, r.available, r.gap, r.more, N, g, v) : { visible: f, overflow: [] }, x = !C || g ? 0 : h ? k(f, r.widths, v, r.available, r.gap) : J(d.visible, r.widths, v, r.available, r.gap, r.more, d.overflow.length > 0);
36
- return { containerRef: u, measureRef: p, moreMeasureRef: S, ...d, paddingOf: (t) => {
34
+ }, [o, l, u, b]);
35
+ const M = N === void 0 ? -1 : l.findIndex((t) => t.id === N), F = r.widths.length === l.length && r.widths.every((t) => t > 0), w = u ? [] : r.paddings.map(([t, e]) => (t + e) * (1 - B)), d = F && !b ? G(p, r.widths, r.available, r.gap, r.more, M, u, w) : { visible: p, overflow: [] }, C = !F || u ? 0 : b ? k(p, r.widths, w, r.available, r.gap) : J(d.visible, r.widths, w, r.available, r.gap, r.more, d.overflow.length > 0);
36
+ return { containerRef: g, measureRef: m, moreMeasureRef: L, ...d, paddingOf: (t) => {
37
37
  const e = r.paddings[t];
38
- if (!x || !e) return;
39
- const n = 1 - x * (1 - T);
38
+ if (!C || !e) return;
39
+ const n = 1 - C * (1 - B);
40
40
  return { paddingLeft: e[0] * n, paddingRight: e[1] * n };
41
41
  }, promote: (t) => {
42
42
  if (!d.overflow.includes(t)) return;
43
43
  const e = d.visible[d.visible.length - 1];
44
44
  if (e === void 0) return;
45
- const n = [...f], a = n.indexOf(t), s = n.indexOf(e);
46
- [n[a], n[s]] = [n[s], n[a]], _({ signature: w, order: n });
45
+ const n = [...p], a = n.indexOf(t), s = n.indexOf(e);
46
+ [n[a], n[s]] = [n[s], n[a]], T({ signature: h, order: n });
47
47
  } };
48
48
  };
49
49
  export { U as useTabsOverflow$u };
@@ -1,5 +1,5 @@
1
1
  import { jsxs as X, jsx as $ } from "react/jsx-runtime";
2
- import { useRef as z, useState as Y, useCallback as B, useEffect as v, useLayoutEffect as W, useId as q } from "react";
2
+ import { useRef as z, useState as N, useCallback as B, useEffect as v, useLayoutEffect as W, useId as q } from "react";
3
3
  /* empty css */
4
4
  import { createPortal as tt } from "react-dom";
5
5
  /* empty css */
@@ -17,7 +17,7 @@ const ot = 100, it = {
17
17
  return r === "bottom" ? { x: y, y: t.y + t.height + t.scrollY + u } : r === "right" ? { x: t.x + t.width + u + n / 2, y: m } : r === "left" ? { x: t.x - u - n / 2, y: m } : { x: y, y: t.y + t.scrollY - u - a };
18
18
  }, R = 8, V = 10, ct = 14, J = (r) => {
19
19
  if (typeof window > "u" || typeof document > "u") return r;
20
- const t = parseFloat(getComputedStyle(document.documentElement).fontSize);
20
+ const t = Number.parseFloat(getComputedStyle(document.documentElement).fontSize);
21
21
  return !Number.isFinite(t) || t <= 0 ? r : r * (t / 16);
22
22
  }, ut = {
23
23
  top: "bottom",
@@ -50,8 +50,8 @@ const ot = 100, it = {
50
50
  let f = M.x;
51
51
  const x = n / 2;
52
52
  f - x < R ? f = x + R : f + x > m - R && (f = m - R - x);
53
- const T = t.x + t.width / 2, s = Math.max(0, x - ct), N = Math.max(-s, Math.min(s, T - f));
54
- return { placement: M.placement, x: f, y: M.y, arrowShift: N };
53
+ const T = t.x + t.width / 2, s = Math.max(0, x - ct), Y = Math.max(-s, Math.min(s, T - f));
54
+ return { placement: M.placement, x: f, y: M.y, arrowShift: Y };
55
55
  }, K = (r) => {
56
56
  const t = document.activeElement;
57
57
  if (!r || !t || !r.contains(t)) return !1;
@@ -81,10 +81,10 @@ const at = () => {
81
81
  showWhenActive: d = !1,
82
82
  showDelay: M = ot
83
83
  }) => {
84
- const f = z(null), x = z(null), T = z(null), [s, N] = Y(!1), [_, I] = Y(null), [o, p] = Y(null), [b, H] = Y(w), [k, G] = Y(!1), P = () => {
84
+ const f = z(null), x = z(null), T = z(null), [s, Y] = N(!1), [_, I] = N(null), [o, p] = N(null), [b, H] = N(w), [k, G] = N(!1), P = () => {
85
85
  T.current && (clearTimeout(T.current), T.current = null);
86
86
  }, h = B(() => {
87
- P(), N(!1), I(null), G(!1);
87
+ P(), Y(!1), I(null), G(!1);
88
88
  }, []), { shouldRender: D, isAnimated: j } = nt({ isOpen: s, duration: rt.instant });
89
89
  v(() => {
90
90
  D || (p(null), H(w));
@@ -92,7 +92,7 @@ const at = () => {
92
92
  const F = B((e) => {
93
93
  P();
94
94
  const { x: c, y: i, width: l, height: E } = e.getBoundingClientRect();
95
- I({ x: c, y: i, width: l, height: E, scrollY: window.scrollY }), N(!0);
95
+ I({ x: c, y: i, width: l, height: E, scrollY: window.scrollY }), Y(!0);
96
96
  }, []), O = B((e) => {
97
97
  const { x: c, y: i, width: l, height: E } = e.getBoundingClientRect();
98
98
  I((S) => S && { x: c, y: i, width: l, height: E, scrollY: window.scrollY });
package/dist/dev/index.js CHANGED
@@ -1574,7 +1574,7 @@ function hn(t) {
1574
1574
  function mn() {
1575
1575
  (zt() ?? ot).reset();
1576
1576
  }
1577
- const bn = () => "2.1.6";
1577
+ const bn = () => "2.1.7-next.0";
1578
1578
  function xn(t) {
1579
1579
  return pn(t, { name: "urfu-ui-kit-react", version: bn() });
1580
1580
  }
@@ -1,5 +1,5 @@
1
1
  import { registerKitCopy$u as e, getKitCopies$u as r, hasLegacyKitOverlay$u as o, kitIdPrefix$u as n } from "../vanilla/core/kitRegistry.js";
2
- const c = "2.1.6", t = () => e("react", c), a = () => n(t());
2
+ const c = "2.1.7-next.0", t = () => e("react", c), a = () => n(t());
3
3
  function p() {
4
4
  return t(), r();
5
5
  }