mimir-ui-kit 1.38.24 → 1.38.25

Sign up to get free protection for your applications and to get access to all the features.
@@ -44,5 +44,9 @@ export type TTabTrailProps = {
44
44
  * Вариант кнопок навигации
45
45
  */
46
46
  buttonsVariant?: ETabTrailButtonVariant | `${ETabTrailButtonVariant}`;
47
+ /**
48
+ * Автоматически показывать кнопки навигации при переполнении
49
+ */
50
+ autoShowButtons?: boolean;
47
51
  };
48
52
  export declare const TabTrail: import('react').ForwardRefExoticComponent<TTabTrailProps & import('react').RefAttributes<HTMLElement>>;
@@ -1,284 +1,295 @@
1
- import { jsxs as Y, jsx as k } from "react/jsx-runtime";
1
+ import { jsxs as Q, jsx as A } from "react/jsx-runtime";
2
2
  import { c as Ee } from "../../index-DIxK0V-G.js";
3
- import * as M from "react";
4
- import R, { useRef as U, useState as Q, createContext as oe, useReducer as ye, useMemo as S, useId as ie, useContext as ue, forwardRef as ke, useEffect as le } from "react";
5
- import { ETabTrailSize as Ae } from "./constants.js";
6
- import { TabButtons as Se } from "./TabButtons/TabButtons.js";
3
+ import * as O from "react";
4
+ import L, { useRef as G, useState as K, createContext as oe, useReducer as ke, useMemo as D, useId as ie, useContext as ue, forwardRef as ye, useEffect as X } from "react";
5
+ import { ETabTrailSize as Se } from "./constants.js";
6
+ import { TabButtons as Ae } from "./TabButtons/TabButtons.js";
7
7
  import { ETabTrailButtonVariant as Fe } from "./TabButtons/constants.js";
8
8
  import { NotificationBadge as De } from "../NotificationBadge/NotificationBadge.js";
9
- import { n as W, M as se, W as V, s as j, y as q, o as A, H as z, $ as ce, b as Ne, D as de, a as G, u as Re, c as T, t as Me } from "../../keyboard-B0lm_zyn.js";
10
- import { w as Ce } from "../../use-active-press-86hajhdd.js";
11
- import { e as Le } from "../../use-resolve-button-type-DhFdPxnv.js";
12
- import { T as pe, s as Oe } from "../../hidden-DbgtYPOH.js";
13
- import { _ as B, T as J, P as N, F as I } from "../../focus-management-DE4t_lW3.js";
9
+ import { n as z, M as le, W as U, s as j, y as V, o as F, H as q, $ as ce, b as Ne, D as de, a as W, u as Re, c as P, t as Le } from "../../keyboard-B0lm_zyn.js";
10
+ import { w as Oe } from "../../use-active-press-86hajhdd.js";
11
+ import { e as Me } from "../../use-resolve-button-type-DhFdPxnv.js";
12
+ import { T as fe, s as Ce } from "../../hidden-DbgtYPOH.js";
13
+ import { _ as B, T as J, P as R, F as w } from "../../focus-management-DE4t_lW3.js";
14
14
  import '../../assets/TabTrail.css';function Be() {
15
- let e = U(!1);
16
- return W(() => (e.current = !0, () => {
15
+ let e = G(!1);
16
+ return z(() => (e.current = !0, () => {
17
17
  e.current = !1;
18
18
  }), []), e;
19
19
  }
20
- function Ge({ onFocus: e }) {
21
- let [t, n] = Q(!0), r = Be();
22
- return t ? R.createElement(pe, { as: "button", type: "button", features: Oe.Focusable, onFocus: (l) => {
23
- l.preventDefault();
24
- let s, o = 50;
25
- function d() {
20
+ function We({ onFocus: e }) {
21
+ let [t, n] = K(!0), r = Be();
22
+ return t ? L.createElement(fe, { as: "button", type: "button", features: Ce.Focusable, onFocus: (s) => {
23
+ s.preventDefault();
24
+ let l, o = 50;
25
+ function b() {
26
26
  if (o-- <= 0) {
27
- s && cancelAnimationFrame(s);
27
+ l && cancelAnimationFrame(l);
28
28
  return;
29
29
  }
30
30
  if (e()) {
31
- if (cancelAnimationFrame(s), !r.current) return;
31
+ if (cancelAnimationFrame(l), !r.current) return;
32
32
  n(!1);
33
33
  return;
34
34
  }
35
- s = requestAnimationFrame(d);
35
+ l = requestAnimationFrame(b);
36
36
  }
37
- s = requestAnimationFrame(d);
37
+ l = requestAnimationFrame(b);
38
38
  } }) : null;
39
39
  }
40
- const fe = M.createContext(null);
41
- function Ue() {
40
+ const pe = O.createContext(null);
41
+ function Ge() {
42
42
  return { groups: /* @__PURE__ */ new Map(), get(e, t) {
43
43
  var n;
44
44
  let r = this.groups.get(e);
45
45
  r || (r = /* @__PURE__ */ new Map(), this.groups.set(e, r));
46
- let l = (n = r.get(t)) != null ? n : 0;
47
- r.set(t, l + 1);
48
- let s = Array.from(r.keys()).indexOf(t);
46
+ let s = (n = r.get(t)) != null ? n : 0;
47
+ r.set(t, s + 1);
48
+ let l = Array.from(r.keys()).indexOf(t);
49
49
  function o() {
50
- let d = r.get(t);
51
- d > 1 ? r.set(t, d - 1) : r.delete(t);
50
+ let b = r.get(t);
51
+ b > 1 ? r.set(t, b - 1) : r.delete(t);
52
52
  }
53
- return [s, o];
53
+ return [l, o];
54
54
  } };
55
55
  }
56
- function We({ children: e }) {
57
- let t = M.useRef(Ue());
58
- return M.createElement(fe.Provider, { value: t }, e);
56
+ function ze({ children: e }) {
57
+ let t = O.useRef(Ge());
58
+ return O.createElement(pe.Provider, { value: t }, e);
59
59
  }
60
60
  function be(e) {
61
- let t = M.useContext(fe);
61
+ let t = O.useContext(pe);
62
62
  if (!t) throw new Error("You must wrap your component in a <StableCollection>");
63
- let n = M.useId(), [r, l] = t.current.get(e, n);
64
- return M.useEffect(() => l, []), r;
63
+ let n = O.useId(), [r, s] = t.current.get(e, n);
64
+ return O.useEffect(() => s, []), r;
65
65
  }
66
- var Ve = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(Ve || {}), qe = ((e) => (e[e.Less = -1] = "Less", e[e.Equal = 0] = "Equal", e[e.Greater = 1] = "Greater", e))(qe || {}), ze = ((e) => (e[e.SetSelectedIndex = 0] = "SetSelectedIndex", e[e.RegisterTab = 1] = "RegisterTab", e[e.UnregisterTab = 2] = "UnregisterTab", e[e.RegisterPanel = 3] = "RegisterPanel", e[e.UnregisterPanel = 4] = "UnregisterPanel", e))(ze || {});
66
+ var Ue = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(Ue || {}), Ve = ((e) => (e[e.Less = -1] = "Less", e[e.Equal = 0] = "Equal", e[e.Greater = 1] = "Greater", e))(Ve || {}), qe = ((e) => (e[e.SetSelectedIndex = 0] = "SetSelectedIndex", e[e.RegisterTab = 1] = "RegisterTab", e[e.UnregisterTab = 2] = "UnregisterTab", e[e.RegisterPanel = 3] = "RegisterPanel", e[e.UnregisterPanel = 4] = "UnregisterPanel", e))(qe || {});
67
67
  let He = { 0(e, t) {
68
68
  var n;
69
- let r = B(e.tabs, (u) => u.current), l = B(e.panels, (u) => u.current), s = r.filter((u) => {
70
- var m;
71
- return !((m = u.current) != null && m.hasAttribute("disabled"));
72
- }), o = { ...e, tabs: r, panels: l };
69
+ let r = B(e.tabs, (d) => d.current), s = B(e.panels, (d) => d.current), l = r.filter((d) => {
70
+ var v;
71
+ return !((v = d.current) != null && v.hasAttribute("disabled"));
72
+ }), o = { ...e, tabs: r, panels: s };
73
73
  if (t.index < 0 || t.index > r.length - 1) {
74
- let u = G(Math.sign(t.index - e.selectedIndex), { [-1]: () => 1, 0: () => G(Math.sign(t.index), { [-1]: () => 0, 0: () => 0, 1: () => 1 }), 1: () => 0 });
75
- if (s.length === 0) return o;
76
- let m = G(u, { 0: () => r.indexOf(s[0]), 1: () => r.indexOf(s[s.length - 1]) });
77
- return { ...o, selectedIndex: m === -1 ? e.selectedIndex : m };
74
+ let d = W(Math.sign(t.index - e.selectedIndex), { [-1]: () => 1, 0: () => W(Math.sign(t.index), { [-1]: () => 0, 0: () => 0, 1: () => 1 }), 1: () => 0 });
75
+ if (l.length === 0) return o;
76
+ let v = W(d, { 0: () => r.indexOf(l[0]), 1: () => r.indexOf(l[l.length - 1]) });
77
+ return { ...o, selectedIndex: v === -1 ? e.selectedIndex : v };
78
78
  }
79
- let d = r.slice(0, t.index), p = [...r.slice(t.index), ...d].find((u) => s.includes(u));
80
- if (!p) return o;
81
- let b = (n = r.indexOf(p)) != null ? n : e.selectedIndex;
82
- return b === -1 && (b = e.selectedIndex), { ...o, selectedIndex: b };
79
+ let b = r.slice(0, t.index), x = [...r.slice(t.index), ...b].find((d) => l.includes(d));
80
+ if (!x) return o;
81
+ let i = (n = r.indexOf(x)) != null ? n : e.selectedIndex;
82
+ return i === -1 && (i = e.selectedIndex), { ...o, selectedIndex: i };
83
83
  }, 1(e, t) {
84
84
  if (e.tabs.includes(t.tab)) return e;
85
- let n = e.tabs[e.selectedIndex], r = B([...e.tabs, t.tab], (s) => s.current), l = e.selectedIndex;
86
- return e.info.current.isControlled || (l = r.indexOf(n), l === -1 && (l = e.selectedIndex)), { ...e, tabs: r, selectedIndex: l };
85
+ let n = e.tabs[e.selectedIndex], r = B([...e.tabs, t.tab], (l) => l.current), s = e.selectedIndex;
86
+ return e.info.current.isControlled || (s = r.indexOf(n), s === -1 && (s = e.selectedIndex)), { ...e, tabs: r, selectedIndex: s };
87
87
  }, 2(e, t) {
88
88
  return { ...e, tabs: e.tabs.filter((n) => n !== t.tab) };
89
89
  }, 3(e, t) {
90
90
  return e.panels.includes(t.panel) ? e : { ...e, panels: B([...e.panels, t.panel], (n) => n.current) };
91
91
  }, 4(e, t) {
92
92
  return { ...e, panels: e.panels.filter((n) => n !== t.panel) };
93
- } }, X = oe(null);
94
- X.displayName = "TabsDataContext";
95
- function C(e) {
96
- let t = ue(X);
93
+ } }, Z = oe(null);
94
+ Z.displayName = "TabsDataContext";
95
+ function M(e) {
96
+ let t = ue(Z);
97
97
  if (t === null) {
98
98
  let n = new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);
99
- throw Error.captureStackTrace && Error.captureStackTrace(n, C), n;
99
+ throw Error.captureStackTrace && Error.captureStackTrace(n, M), n;
100
100
  }
101
101
  return t;
102
102
  }
103
- let Z = oe(null);
104
- Z.displayName = "TabsActionsContext";
105
- function ee(e) {
106
- let t = ue(Z);
103
+ let ee = oe(null);
104
+ ee.displayName = "TabsActionsContext";
105
+ function te(e) {
106
+ let t = ue(ee);
107
107
  if (t === null) {
108
108
  let n = new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);
109
- throw Error.captureStackTrace && Error.captureStackTrace(n, ee), n;
109
+ throw Error.captureStackTrace && Error.captureStackTrace(n, te), n;
110
110
  }
111
111
  return t;
112
112
  }
113
113
  function je(e, t) {
114
- return G(t.type, He, e, t);
114
+ return W(t.type, He, e, t);
115
115
  }
116
116
  let Je = "div";
117
117
  function Ke(e, t) {
118
- let { defaultIndex: n = 0, vertical: r = !1, manual: l = !1, onChange: s, selectedIndex: o = null, ...d } = e;
119
- const p = r ? "vertical" : "horizontal", b = l ? "manual" : "auto";
120
- let u = o !== null, m = j({ isControlled: u }), $ = q(t), [f, a] = ye(je, { info: m, selectedIndex: o ?? n, tabs: [], panels: [] }), v = S(() => ({ selectedIndex: f.selectedIndex }), [f.selectedIndex]), w = j(s || (() => {
121
- })), E = j(f.tabs), x = S(() => ({ orientation: p, activation: b, ...f }), [p, b, f]), F = A((c) => (a({ type: 1, tab: c }), () => a({ type: 2, tab: c }))), L = A((c) => (a({ type: 3, panel: c }), () => a({ type: 4, panel: c }))), g = A((c) => {
122
- h.current !== c && w.current(c), u || a({ type: 0, index: c });
123
- }), h = j(u ? e.selectedIndex : f.selectedIndex), O = S(() => ({ registerTab: F, registerPanel: L, change: g }), []);
124
- W(() => {
125
- a({ type: 0, index: o ?? n });
126
- }, [o]), W(() => {
127
- if (h.current === void 0 || f.tabs.length <= 0) return;
128
- let c = B(f.tabs, (y) => y.current);
129
- c.some((y, D) => f.tabs[D] !== y) && g(c.indexOf(f.tabs[h.current]));
118
+ let { defaultIndex: n = 0, vertical: r = !1, manual: s = !1, onChange: l, selectedIndex: o = null, ...b } = e;
119
+ const x = r ? "vertical" : "horizontal", i = s ? "manual" : "auto";
120
+ let d = o !== null, v = j({ isControlled: d }), E = V(t), [f, u] = ke(je, { info: v, selectedIndex: o ?? n, tabs: [], panels: [] }), y = D(() => ({ selectedIndex: f.selectedIndex }), [f.selectedIndex]), S = j(l || (() => {
121
+ })), T = j(f.tabs), a = D(() => ({ orientation: x, activation: i, ...f }), [x, i, f]), m = F((p) => (u({ type: 1, tab: p }), () => u({ type: 2, tab: p }))), I = F((p) => (u({ type: 3, panel: p }), () => u({ type: 4, panel: p }))), h = F((p) => {
122
+ g.current !== p && S.current(p), d || u({ type: 0, index: p });
123
+ }), g = j(d ? e.selectedIndex : f.selectedIndex), C = D(() => ({ registerTab: m, registerPanel: I, change: h }), []);
124
+ z(() => {
125
+ u({ type: 0, index: o ?? n });
126
+ }, [o]), z(() => {
127
+ if (g.current === void 0 || f.tabs.length <= 0) return;
128
+ let p = B(f.tabs, (k) => k.current);
129
+ p.some((k, N) => f.tabs[N] !== k) && h(p.indexOf(f.tabs[g.current]));
130
130
  });
131
- let K = { ref: $ };
132
- return R.createElement(We, null, R.createElement(Z.Provider, { value: O }, R.createElement(X.Provider, { value: x }, x.tabs.length <= 0 && R.createElement(Ge, { onFocus: () => {
133
- var c, y;
134
- for (let D of E.current) if (((c = D.current) == null ? void 0 : c.tabIndex) === 0) return (y = D.current) == null || y.focus(), !0;
131
+ let Y = { ref: E };
132
+ return L.createElement(ze, null, L.createElement(ee.Provider, { value: C }, L.createElement(Z.Provider, { value: a }, a.tabs.length <= 0 && L.createElement(We, { onFocus: () => {
133
+ var p, k;
134
+ for (let N of T.current) if (((p = N.current) == null ? void 0 : p.tabIndex) === 0) return (k = N.current) == null || k.focus(), !0;
135
135
  return !1;
136
- } }), z({ ourProps: K, theirProps: d, slot: v, defaultTag: Je, name: "Tabs" }))));
136
+ } }), q({ ourProps: Y, theirProps: b, slot: y, defaultTag: Je, name: "Tabs" }))));
137
137
  }
138
138
  let Ye = "div";
139
139
  function Qe(e, t) {
140
- let { orientation: n, selectedIndex: r } = C("Tab.List"), l = q(t), s = S(() => ({ selectedIndex: r }), [r]);
141
- return z({ ourProps: { ref: l, role: "tablist", "aria-orientation": n }, theirProps: e, slot: s, defaultTag: Ye, name: "Tabs.List" });
140
+ let { orientation: n, selectedIndex: r } = M("Tab.List"), s = V(t), l = D(() => ({ selectedIndex: r }), [r]);
141
+ return q({ ourProps: { ref: s, role: "tablist", "aria-orientation": n }, theirProps: e, slot: l, defaultTag: Ye, name: "Tabs.List" });
142
142
  }
143
143
  let Xe = "button";
144
144
  function Ze(e, t) {
145
145
  var n, r;
146
- let l = ie(), { id: s = `headlessui-tabs-tab-${l}`, disabled: o = !1, autoFocus: d = !1, ...p } = e, { orientation: b, activation: u, selectedIndex: m, tabs: $, panels: f } = C("Tab"), a = ee("Tab"), v = C("Tab"), [w, E] = Q(null), x = U(null), F = q(x, t, E);
147
- W(() => a.registerTab(x), [a, x]);
148
- let L = be("tabs"), g = $.indexOf(x);
149
- g === -1 && (g = L);
150
- let h = g === m, O = A((i) => {
151
- var _;
152
- let H = i();
153
- if (H === J.Success && u === "auto") {
154
- let $e = (_ = Re(x)) == null ? void 0 : _.activeElement, ae = v.tabs.findIndex((we) => we.current === $e);
155
- ae !== -1 && a.change(ae);
146
+ let s = ie(), { id: l = `headlessui-tabs-tab-${s}`, disabled: o = !1, autoFocus: b = !1, ...x } = e, { orientation: i, activation: d, selectedIndex: v, tabs: E, panels: f } = M("Tab"), u = te("Tab"), y = M("Tab"), [S, T] = K(null), a = G(null), m = V(a, t, T);
147
+ z(() => u.registerTab(a), [u, a]);
148
+ let I = be("tabs"), h = E.indexOf(a);
149
+ h === -1 && (h = I);
150
+ let g = h === v, C = F((c) => {
151
+ var $;
152
+ let H = c();
153
+ if (H === J.Success && d === "auto") {
154
+ let _e = ($ = Re(a)) == null ? void 0 : $.activeElement, se = y.tabs.findIndex(($e) => $e.current === _e);
155
+ se !== -1 && u.change(se);
156
156
  }
157
157
  return H;
158
- }), K = A((i) => {
159
- let _ = $.map((H) => H.current).filter(Boolean);
160
- if (i.key === T.Space || i.key === T.Enter) {
161
- i.preventDefault(), i.stopPropagation(), a.change(g);
158
+ }), Y = F((c) => {
159
+ let $ = E.map((H) => H.current).filter(Boolean);
160
+ if (c.key === P.Space || c.key === P.Enter) {
161
+ c.preventDefault(), c.stopPropagation(), u.change(h);
162
162
  return;
163
163
  }
164
- switch (i.key) {
165
- case T.Home:
166
- case T.PageUp:
167
- return i.preventDefault(), i.stopPropagation(), O(() => N(_, I.First));
168
- case T.End:
169
- case T.PageDown:
170
- return i.preventDefault(), i.stopPropagation(), O(() => N(_, I.Last));
164
+ switch (c.key) {
165
+ case P.Home:
166
+ case P.PageUp:
167
+ return c.preventDefault(), c.stopPropagation(), C(() => R($, w.First));
168
+ case P.End:
169
+ case P.PageDown:
170
+ return c.preventDefault(), c.stopPropagation(), C(() => R($, w.Last));
171
171
  }
172
- if (O(() => G(b, { vertical() {
173
- return i.key === T.ArrowUp ? N(_, I.Previous | I.WrapAround) : i.key === T.ArrowDown ? N(_, I.Next | I.WrapAround) : J.Error;
172
+ if (C(() => W(i, { vertical() {
173
+ return c.key === P.ArrowUp ? R($, w.Previous | w.WrapAround) : c.key === P.ArrowDown ? R($, w.Next | w.WrapAround) : J.Error;
174
174
  }, horizontal() {
175
- return i.key === T.ArrowLeft ? N(_, I.Previous | I.WrapAround) : i.key === T.ArrowRight ? N(_, I.Next | I.WrapAround) : J.Error;
176
- } })) === J.Success) return i.preventDefault();
177
- }), c = U(!1), y = A(() => {
178
- var i;
179
- c.current || (c.current = !0, (i = x.current) == null || i.focus({ preventScroll: !0 }), a.change(g), Me(() => {
180
- c.current = !1;
175
+ return c.key === P.ArrowLeft ? R($, w.Previous | w.WrapAround) : c.key === P.ArrowRight ? R($, w.Next | w.WrapAround) : J.Error;
176
+ } })) === J.Success) return c.preventDefault();
177
+ }), p = G(!1), k = F(() => {
178
+ var c;
179
+ p.current || (p.current = !0, (c = a.current) == null || c.focus({ preventScroll: !0 }), u.change(h), Le(() => {
180
+ p.current = !1;
181
181
  }));
182
- }), D = A((i) => {
183
- i.preventDefault();
184
- }), { isFocusVisible: te, focusProps: he } = ce({ autoFocus: d }), { isHovered: re, hoverProps: Te } = Ne({ isDisabled: o }), { pressed: ne, pressProps: Ie } = Ce({ disabled: o }), Pe = S(() => ({ selected: h, hover: re, active: ne, focus: te, autofocus: d, disabled: o }), [h, re, te, ne, d, o]), _e = de({ ref: F, onKeyDown: K, onMouseDown: D, onClick: y, id: s, role: "tab", type: Le(e, w), "aria-controls": (r = (n = f[g]) == null ? void 0 : n.current) == null ? void 0 : r.id, "aria-selected": h, tabIndex: h ? 0 : -1, disabled: o || void 0, autoFocus: d }, he, Te, Ie);
185
- return z({ ourProps: _e, theirProps: p, slot: Pe, defaultTag: Xe, name: "Tabs.Tab" });
182
+ }), N = F((c) => {
183
+ c.preventDefault();
184
+ }), { isFocusVisible: re, focusProps: ge } = ce({ autoFocus: b }), { isHovered: ne, hoverProps: Te } = Ne({ isDisabled: o }), { pressed: ae, pressProps: Ie } = Oe({ disabled: o }), Pe = D(() => ({ selected: g, hover: ne, active: ae, focus: re, autofocus: b, disabled: o }), [g, ne, re, ae, b, o]), we = de({ ref: m, onKeyDown: Y, onMouseDown: N, onClick: k, id: l, role: "tab", type: Me(e, S), "aria-controls": (r = (n = f[h]) == null ? void 0 : n.current) == null ? void 0 : r.id, "aria-selected": g, tabIndex: g ? 0 : -1, disabled: o || void 0, autoFocus: b }, ge, Te, Ie);
185
+ return q({ ourProps: we, theirProps: x, slot: Pe, defaultTag: Xe, name: "Tabs.Tab" });
186
186
  }
187
187
  let et = "div";
188
188
  function tt(e, t) {
189
- let { selectedIndex: n } = C("Tab.Panels"), r = q(t), l = S(() => ({ selectedIndex: n }), [n]);
190
- return z({ ourProps: { ref: r }, theirProps: e, slot: l, defaultTag: et, name: "Tabs.Panels" });
189
+ let { selectedIndex: n } = M("Tab.Panels"), r = V(t), s = D(() => ({ selectedIndex: n }), [n]);
190
+ return q({ ourProps: { ref: r }, theirProps: e, slot: s, defaultTag: et, name: "Tabs.Panels" });
191
191
  }
192
- let rt = "div", nt = se.RenderStrategy | se.Static;
192
+ let rt = "div", nt = le.RenderStrategy | le.Static;
193
193
  function at(e, t) {
194
- var n, r, l, s;
195
- let o = ie(), { id: d = `headlessui-tabs-panel-${o}`, tabIndex: p = 0, ...b } = e, { selectedIndex: u, tabs: m, panels: $ } = C("Tab.Panel"), f = ee("Tab.Panel"), a = U(null), v = q(a, t);
196
- W(() => f.registerPanel(a), [f, a]);
197
- let w = be("panels"), E = $.indexOf(a);
198
- E === -1 && (E = w);
199
- let x = E === u, { isFocusVisible: F, focusProps: L } = ce(), g = S(() => ({ selected: x, focus: F }), [x, F]), h = de({ ref: v, id: d, role: "tabpanel", "aria-labelledby": (r = (n = m[E]) == null ? void 0 : n.current) == null ? void 0 : r.id, tabIndex: x ? p : -1 }, L);
200
- return !x && ((l = b.unmount) == null || l) && !((s = b.static) != null && s) ? R.createElement(pe, { "aria-hidden": "true", ...h }) : z({ ourProps: h, theirProps: b, slot: g, defaultTag: rt, features: nt, visible: x, name: "Tabs.Panel" });
194
+ var n, r, s, l;
195
+ let o = ie(), { id: b = `headlessui-tabs-panel-${o}`, tabIndex: x = 0, ...i } = e, { selectedIndex: d, tabs: v, panels: E } = M("Tab.Panel"), f = te("Tab.Panel"), u = G(null), y = V(u, t);
196
+ z(() => f.registerPanel(u), [f, u]);
197
+ let S = be("panels"), T = E.indexOf(u);
198
+ T === -1 && (T = S);
199
+ let a = T === d, { isFocusVisible: m, focusProps: I } = ce(), h = D(() => ({ selected: a, focus: m }), [a, m]), g = de({ ref: y, id: b, role: "tabpanel", "aria-labelledby": (r = (n = v[T]) == null ? void 0 : n.current) == null ? void 0 : r.id, tabIndex: a ? x : -1 }, I);
200
+ return !a && ((s = i.unmount) == null || s) && !((l = i.static) != null && l) ? L.createElement(fe, { "aria-hidden": "true", ...g }) : q({ ourProps: g, theirProps: i, slot: h, defaultTag: rt, features: nt, visible: a, name: "Tabs.Panel" });
201
201
  }
202
- let lt = V(Ze), me = V(Ke), xe = V(Qe), ve = V(tt), ge = V(at), st = Object.assign(lt, { Group: me, List: xe, Panels: ve, Panel: ge });
203
- const ot = "_container_rlke5_2", it = "_group_rlke5_6", ut = "_tab_rlke5_16", ct = "_list_rlke5_51", dt = "_tabs_rlke5_62", pt = "_buttons_rlke5_68", ft = "_m_rlke5_75", bt = "_s_rlke5_83", P = {
202
+ let st = U(Ze), me = U(Ke), ve = U(Qe), xe = U(tt), he = U(at), lt = Object.assign(st, { Group: me, List: ve, Panels: xe, Panel: he });
203
+ const ot = "_container_rlke5_2", it = "_group_rlke5_6", ut = "_tab_rlke5_16", ct = "_list_rlke5_51", dt = "_tabs_rlke5_62", ft = "_buttons_rlke5_68", pt = "_m_rlke5_75", bt = "_s_rlke5_83", _ = {
204
204
  container: ot,
205
205
  group: it,
206
206
  "group-inner": "_group-inner_rlke5_9",
207
207
  tab: ut,
208
208
  list: ct,
209
209
  tabs: dt,
210
- buttons: pt,
211
- m: ft,
210
+ buttons: ft,
211
+ m: pt,
212
212
  s: bt
213
- }, yt = ke(
213
+ }, kt = ye(
214
214
  ({
215
215
  categories: e,
216
- size: t = Ae.M,
216
+ size: t = Se.M,
217
217
  showButtons: n = !0,
218
218
  className: r,
219
- selectedTabIndex: l,
220
- onTabChange: s,
221
- buttonsVariant: o = Fe.WHITE
222
- }, d) => {
223
- const [p, b] = Q(l || 0), u = U(null);
224
- le(() => {
225
- l !== void 0 && l !== p && b(l);
226
- }, [p, l]);
227
- const m = (a) => {
228
- b(a), s == null || s(a);
229
- }, $ = () => {
230
- const a = (p + 1) % e.length;
231
- m(a);
232
- }, f = () => {
233
- const a = (p - 1 + e.length) % e.length;
234
- m(a);
219
+ selectedTabIndex: s,
220
+ onTabChange: l,
221
+ buttonsVariant: o = Fe.WHITE,
222
+ autoShowButtons: b = !1
223
+ }, x) => {
224
+ const [i, d] = K(s || 0), [v, E] = K(!1), f = G(null);
225
+ X(() => {
226
+ s !== void 0 && s !== i && d(s);
227
+ }, [i, s]);
228
+ const u = (a) => {
229
+ d(a), l == null || l(a);
230
+ }, y = () => {
231
+ const a = (i + 1) % e.length;
232
+ u(a);
233
+ }, S = () => {
234
+ const a = (i - 1 + e.length) % e.length;
235
+ u(a);
235
236
  };
236
- return le(() => {
237
- var v;
238
- const a = (v = u.current) == null ? void 0 : v.querySelector(
239
- `.${P.tab}[data-active="true"]`
237
+ X(() => {
238
+ var m;
239
+ const a = (m = f.current) == null ? void 0 : m.querySelector(
240
+ `.${_.tab}[data-active="true"]`
240
241
  );
241
242
  a && typeof a.scrollIntoView == "function" && a.scrollIntoView({
242
243
  behavior: "smooth",
243
244
  block: "nearest",
244
245
  inline: "center"
245
246
  });
246
- }, [p]), /* @__PURE__ */ Y(
247
+ }, [i]), X(() => {
248
+ const a = () => {
249
+ if (f.current) {
250
+ const { scrollWidth: m, clientWidth: I } = f.current;
251
+ E(m > I);
252
+ }
253
+ };
254
+ return a(), window.addEventListener("resize", a), () => window.removeEventListener("resize", a);
255
+ }, [e]);
256
+ const T = b ? v : n;
257
+ return /* @__PURE__ */ Q(
247
258
  me,
248
259
  {
249
- ref: d,
250
- className: Ee(P.group, P[t], r),
251
- selectedIndex: p,
252
- onChange: m,
260
+ ref: x,
261
+ className: Ee(_.group, _[t], r),
262
+ selectedIndex: i,
263
+ onChange: u,
253
264
  children: [
254
- /* @__PURE__ */ Y("div", { className: P["group-inner"], children: [
255
- /* @__PURE__ */ k(xe, { ref: u, className: P.list, children: /* @__PURE__ */ k("div", { className: P.tabs, children: e.map(({ name: a, notificationCount: v }, w) => /* @__PURE__ */ Y(
256
- st,
265
+ /* @__PURE__ */ Q("div", { className: _["group-inner"], children: [
266
+ /* @__PURE__ */ A(ve, { ref: f, className: _.list, children: /* @__PURE__ */ A("div", { className: _.tabs, children: e.map(({ name: a, notificationCount: m }, I) => /* @__PURE__ */ Q(
267
+ lt,
257
268
  {
258
- className: `${P.tab} ${p === w ? 'data-active="true"' : ""}`,
259
- "data-active": p === w,
269
+ className: `${_.tab} ${i === I ? 'data-active="true"' : ""}`,
270
+ "data-active": i === I,
260
271
  children: [
261
272
  a,
262
- v && /* @__PURE__ */ k(De, { count: v, size: "m" })
273
+ m && /* @__PURE__ */ A(De, { count: m, size: "m" })
263
274
  ]
264
275
  },
265
276
  a
266
277
  )) }) }),
267
- n && /* @__PURE__ */ k("div", { className: P.buttons, children: /* @__PURE__ */ k(
268
- Se,
278
+ T && /* @__PURE__ */ A("div", { className: _.buttons, children: /* @__PURE__ */ A(
279
+ Ae,
269
280
  {
270
- handlePrevTab: f,
271
- handleNextTab: $,
281
+ handlePrevTab: S,
282
+ handleNextTab: y,
272
283
  buttonsVariant: o
273
284
  }
274
285
  ) })
275
286
  ] }),
276
- /* @__PURE__ */ k(ve, { className: P.panels, children: e.map(({ name: a, content: v }) => /* @__PURE__ */ k(ge, { className: P.panel, children: v }, a)) })
287
+ /* @__PURE__ */ A(xe, { className: _.panels, children: e.map(({ name: a, content: m }) => /* @__PURE__ */ A(he, { className: _.panel, children: m }, a)) })
277
288
  ]
278
289
  }
279
290
  );
280
291
  }
281
292
  );
282
293
  export {
283
- yt as TabTrail
294
+ kt as TabTrail
284
295
  };
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "mimir-ui-kit",
3
3
  "private": false,
4
- "version": "1.38.24",
4
+ "version": "1.38.25",
5
5
  "type": "module",
6
6
  "exports": {
7
7
  ".": {