mimir-ui-kit 1.50.0 → 1.51.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.
- package/dist/assets/MergedButton.css +1 -1
- package/dist/components/MergedButton/MergedButton.js +39 -38
- package/dist/components/MergedButton/constants.d.ts +2 -1
- package/dist/components/MergedButton/constants.js +1 -1
- package/dist/components/TabTrail/TabTrail.d.ts +32 -0
- package/dist/components/TabTrail/TabTrail.js +254 -192
- package/package.json +1 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._buttons_12jbn_2{display:-webkit-inline-box;display:-ms-inline-flexbox;display:inline-flex}._merged-button_12jbn_6{--button-height: var(--button-height-m);--button-space: var(--mimir-control-space-xs)}._merged-button_12jbn_6:first-child{border-radius:0;border-top-left-radius:var(--mimir-control-radius);border-bottom-left-radius:var(--mimir-control-radius)}._merged-button_12jbn_6:last-child{border-radius:0;border-top-right-radius:var(--mimir-control-radius);border-bottom-right-radius:var(--mimir-control-radius)}._merged-button_12jbn_6:hover{color:var(--button-color-hover);background:var(--button-bg-color-hover)}._merged-button_12jbn_6:active{color:var(--button-color-active);background:var(--button-bg-color-active)}._merged-button_12jbn_6._gray_12jbn_28{--button-bg-color: var(--black-5);--button-bg-color-hover: var(--black-5);--button-bg-color-active: var(--asphalt-normal);--button-color: var(--asphalt-normal);--button-color-hover: var(--sapphire-normal);--button-color-active: var(--light-text)}._merged-button_12jbn_6._white_12jbn_36{--button-bg-color: var(--white-normal);--button-bg-color-active: var(--asphalt-normal);--button-bg-color-hover: var(--white-normal);--button-color: var(--asphalt-normal);--button-color-hover: var(--sapphire-normal);--button-color-active: var(--light-text)}._merged-button_12jbn_6._transparent_12jbn_44{--button-bg-color: var(--black-5);--button-bg-color-hover: var(--black-5);--button-bg-color-active: var(--asphalt-normal);--button-bg-color-focus: var(--sapphire-normal);--button-color: var(--light-text);--button-color-hover: var(--sapphire-normal);--button-color-active: var(--light-text)}._merged-button_12jbn_6._asphalt_12jbn_53{--button-bg-color: var(--asphalt-normal);--button-bg-color-hover: var(--asphalt-hover);--button-bg-color-active: var(--asphalt-active);--button-color: var(--light-text);--button-color-hover: var(--light-text);--button-color-active: var(--light-text)}._merged-button_12jbn_6._is-icon_12jbn_61{width:var(--button-height);min-width:var(--button-height);padding:0}._merged-button_12jbn_6._is-icon_12jbn_61._s_12jbn_66{--button-height: 32px;width:32px;width:var(--button-height)}._merged-button_12jbn_6._is-icon_12jbn_61._m_12jbn_6{--button-height: 40px;width:40px;width:var(--button-height)}._merged-button_12jbn_6._one-button_12jbn_74{border-radius:var(--mimir-control-radius)}._merged-button_12jbn_6:disabled{--button-cursor: not-allowed;color:var(--disabled-color);background-color:var(--black-5)}._merged-button_12jbn_6:disabled:hover,._merged-button_12jbn_6:disabled:active,._merged-button_12jbn_6:disabled:focus{color:var(--disabled-color);background-color:var(--black-5);-webkit-box-shadow:none;box-shadow:none}
|
|
@@ -1,53 +1,54 @@
|
|
|
1
1
|
import { jsx as e } from "react/jsx-runtime";
|
|
2
2
|
import { c as r } from "../../index-DIxK0V-G.js";
|
|
3
|
-
import { memo as
|
|
4
|
-
import { EMergedButtonVariantRound as
|
|
5
|
-
import { Button as
|
|
6
|
-
import '../../assets/MergedButton.css';const
|
|
7
|
-
buttons:
|
|
8
|
-
"merged-button": "_merged-
|
|
9
|
-
gray:
|
|
10
|
-
white:
|
|
11
|
-
transparent:
|
|
12
|
-
|
|
13
|
-
|
|
3
|
+
import { memo as l } from "react";
|
|
4
|
+
import { EMergedButtonVariantRound as g } from "./constants.js";
|
|
5
|
+
import { Button as b } from "../Button/Button.js";
|
|
6
|
+
import '../../assets/MergedButton.css';const d = "_buttons_12jbn_2", h = "_gray_12jbn_28", j = "_white_12jbn_36", B = "_transparent_12jbn_44", I = "_asphalt_12jbn_53", f = "_s_12jbn_66", N = "_m_12jbn_6", t = {
|
|
7
|
+
buttons: d,
|
|
8
|
+
"merged-button": "_merged-button_12jbn_6",
|
|
9
|
+
gray: h,
|
|
10
|
+
white: j,
|
|
11
|
+
transparent: B,
|
|
12
|
+
asphalt: I,
|
|
13
|
+
"is-icon": "_is-icon_12jbn_61",
|
|
14
|
+
s: f,
|
|
14
15
|
m: N,
|
|
15
|
-
"one-button": "_one-
|
|
16
|
-
}, v =
|
|
17
|
-
({ buttons: s, buttonsWrapperClassName: c }) => /* @__PURE__ */ e("div", { className: r(
|
|
16
|
+
"one-button": "_one-button_12jbn_74"
|
|
17
|
+
}, v = l(
|
|
18
|
+
({ buttons: s, buttonsWrapperClassName: c }) => /* @__PURE__ */ e("div", { className: r(t.buttons, c), children: s.map(
|
|
18
19
|
({
|
|
19
|
-
variant:
|
|
20
|
-
disabled:
|
|
21
|
-
className:
|
|
20
|
+
variant: a = g.White,
|
|
21
|
+
disabled: o,
|
|
22
|
+
className: i,
|
|
22
23
|
size: _ = "m",
|
|
23
|
-
...
|
|
24
|
-
},
|
|
25
|
-
const
|
|
26
|
-
...
|
|
27
|
-
isIconButton:
|
|
28
|
-
iconName:
|
|
29
|
-
leftIcon:
|
|
30
|
-
rightIcon:
|
|
31
|
-
},
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
24
|
+
...n
|
|
25
|
+
}, m) => {
|
|
26
|
+
const u = {
|
|
27
|
+
...n,
|
|
28
|
+
isIconButton: n.isIconButton ?? !1,
|
|
29
|
+
iconName: n.isIconButton ? n.iconName : void 0,
|
|
30
|
+
leftIcon: n.isIconButton ? void 0 : n.leftIcon,
|
|
31
|
+
rightIcon: n.isIconButton ? void 0 : n.rightIcon
|
|
32
|
+
}, p = r(
|
|
33
|
+
t["merged-button"],
|
|
34
|
+
t[_ ?? "m"],
|
|
35
|
+
i,
|
|
35
36
|
{
|
|
36
|
-
[
|
|
37
|
-
[
|
|
38
|
-
[
|
|
39
|
-
[
|
|
37
|
+
[t[a]]: !o,
|
|
38
|
+
[t.disabled]: o,
|
|
39
|
+
[t["is-icon"]]: n.isIconButton,
|
|
40
|
+
[t["one-button"]]: s.length === 1
|
|
40
41
|
}
|
|
41
42
|
);
|
|
42
43
|
return /* @__PURE__ */ e(
|
|
43
|
-
|
|
44
|
+
b,
|
|
44
45
|
{
|
|
45
46
|
clear: !0,
|
|
46
|
-
disabled:
|
|
47
|
-
className:
|
|
48
|
-
...
|
|
47
|
+
disabled: o,
|
|
48
|
+
className: p,
|
|
49
|
+
...u
|
|
49
50
|
},
|
|
50
|
-
|
|
51
|
+
m
|
|
51
52
|
);
|
|
52
53
|
}
|
|
53
54
|
) })
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var a = /* @__PURE__ */ ((
|
|
1
|
+
var a = /* @__PURE__ */ ((p) => (p.Transparent = "transparent", p.Gray = "gray", p.White = "white", p.Asphalt = "asphalt", p))(a || {});
|
|
2
2
|
export {
|
|
3
3
|
a as EMergedButtonVariantRound
|
|
4
4
|
};
|
|
@@ -89,5 +89,37 @@ export type TTabTrailProps = {
|
|
|
89
89
|
* Вариант отображения табов
|
|
90
90
|
*/
|
|
91
91
|
variant?: 'default' | 'detailed';
|
|
92
|
+
/**
|
|
93
|
+
* Дополнительный класс для tab-content.
|
|
94
|
+
*/
|
|
95
|
+
tabContentClassName?: string;
|
|
96
|
+
/**
|
|
97
|
+
* Дополнительный класс для tab-header.
|
|
98
|
+
*/
|
|
99
|
+
tabHeaderClassName?: string;
|
|
100
|
+
/**
|
|
101
|
+
* Дополнительный класс для tab-text.
|
|
102
|
+
*/
|
|
103
|
+
tabTextClassName?: string;
|
|
104
|
+
/**
|
|
105
|
+
* Дополнительный класс для tab-value.
|
|
106
|
+
*/
|
|
107
|
+
tabValueClassName?: string;
|
|
108
|
+
/**
|
|
109
|
+
* Дополнительный класс для tab-name.
|
|
110
|
+
*/
|
|
111
|
+
tabNameClassName?: string;
|
|
112
|
+
/**
|
|
113
|
+
* Дополнительный класс для tab-icon.
|
|
114
|
+
*/
|
|
115
|
+
tabIconClassName?: string;
|
|
116
|
+
/**
|
|
117
|
+
* Дополнительный класс для tabs.
|
|
118
|
+
*/
|
|
119
|
+
tabsClassName?: string;
|
|
120
|
+
/**
|
|
121
|
+
* Дополнительный класс для group-inner.
|
|
122
|
+
*/
|
|
123
|
+
groupInnerClassName?: string;
|
|
92
124
|
};
|
|
93
125
|
export declare const TabTrail: import('react').ForwardRefExoticComponent<TTabTrailProps & import('react').RefAttributes<HTMLElement>>;
|
|
@@ -1,39 +1,39 @@
|
|
|
1
|
-
import { jsxs as
|
|
2
|
-
import { c as
|
|
3
|
-
import * as
|
|
4
|
-
import
|
|
1
|
+
import { jsxs as J, jsx as h, Fragment as Ne } from "react/jsx-runtime";
|
|
2
|
+
import { c as P } from "../../index-DIxK0V-G.js";
|
|
3
|
+
import * as V from "react";
|
|
4
|
+
import z, { useState as ne, createContext as ve, useReducer as Se, useMemo as C, useId as he, useRef as ae, useContext as xe, forwardRef as Ae, useEffect as ue } from "react";
|
|
5
5
|
import { ETabTrailSize as Fe } from "./constants.js";
|
|
6
6
|
import { TabButtons as ke } from "./TabButtons/TabButtons.js";
|
|
7
7
|
import { ETabTrailButtonVariant as De } from "./TabButtons/constants.js";
|
|
8
|
-
import { Icon as
|
|
8
|
+
import { Icon as be } from "../../icons/Icon.js";
|
|
9
9
|
import { NotificationBadge as Re } from "../NotificationBadge/NotificationBadge.js";
|
|
10
|
-
import { M as
|
|
10
|
+
import { M as me, W as Q, s as te, y as X, o as W, n as se, H as Z, $ as ge, b as Le, D as _e, a as Y, u as Oe, c as N, e as Me } from "../../keyboard-wis2TUql.js";
|
|
11
11
|
import { w as Be } from "../../use-active-press-CnDeVvQq.js";
|
|
12
12
|
import { e as We } from "../../use-resolve-button-type-DhFdPxnv.js";
|
|
13
13
|
import { f as Ce } from "../../use-is-mounted-MBU4fiLr.js";
|
|
14
|
-
import { T as
|
|
15
|
-
import { _ as
|
|
14
|
+
import { T as Te, s as Ge } from "../../hidden-CkTYbiNM.js";
|
|
15
|
+
import { _ as K, T as re, P as U, F as S } from "../../focus-management-BAl0GmRk.js";
|
|
16
16
|
import '../../assets/TabTrail.css';function Ue({ onFocus: e }) {
|
|
17
|
-
let [t, n] =
|
|
18
|
-
return t ?
|
|
17
|
+
let [t, n] = ne(!0), r = Ce();
|
|
18
|
+
return t ? z.createElement(Te, { as: "button", type: "button", features: Ge.Focusable, onFocus: (a) => {
|
|
19
19
|
a.preventDefault();
|
|
20
|
-
let
|
|
20
|
+
let s, l = 50;
|
|
21
21
|
function f() {
|
|
22
|
-
if (
|
|
23
|
-
|
|
22
|
+
if (l-- <= 0) {
|
|
23
|
+
s && cancelAnimationFrame(s);
|
|
24
24
|
return;
|
|
25
25
|
}
|
|
26
26
|
if (e()) {
|
|
27
|
-
if (cancelAnimationFrame(
|
|
27
|
+
if (cancelAnimationFrame(s), !r.current) return;
|
|
28
28
|
n(!1);
|
|
29
29
|
return;
|
|
30
30
|
}
|
|
31
|
-
|
|
31
|
+
s = requestAnimationFrame(f);
|
|
32
32
|
}
|
|
33
|
-
|
|
33
|
+
s = requestAnimationFrame(f);
|
|
34
34
|
} }) : null;
|
|
35
35
|
}
|
|
36
|
-
const
|
|
36
|
+
const Ie = V.createContext(null);
|
|
37
37
|
function ze() {
|
|
38
38
|
return { groups: /* @__PURE__ */ new Map(), get(e, t) {
|
|
39
39
|
var n;
|
|
@@ -41,161 +41,161 @@ function ze() {
|
|
|
41
41
|
r || (r = /* @__PURE__ */ new Map(), this.groups.set(e, r));
|
|
42
42
|
let a = (n = r.get(t)) != null ? n : 0;
|
|
43
43
|
r.set(t, a + 1);
|
|
44
|
-
let
|
|
45
|
-
function
|
|
44
|
+
let s = Array.from(r.keys()).indexOf(t);
|
|
45
|
+
function l() {
|
|
46
46
|
let f = r.get(t);
|
|
47
47
|
f > 1 ? r.set(t, f - 1) : r.delete(t);
|
|
48
48
|
}
|
|
49
|
-
return [
|
|
49
|
+
return [s, l];
|
|
50
50
|
} };
|
|
51
51
|
}
|
|
52
52
|
function Ve({ children: e }) {
|
|
53
|
-
let t =
|
|
54
|
-
return
|
|
53
|
+
let t = V.useRef(ze());
|
|
54
|
+
return V.createElement(Ie.Provider, { value: t }, e);
|
|
55
55
|
}
|
|
56
|
-
function
|
|
57
|
-
let t =
|
|
56
|
+
function Pe(e) {
|
|
57
|
+
let t = V.useContext(Ie);
|
|
58
58
|
if (!t) throw new Error("You must wrap your component in a <StableCollection>");
|
|
59
|
-
let n =
|
|
60
|
-
return
|
|
59
|
+
let n = V.useId(), [r, a] = t.current.get(e, n);
|
|
60
|
+
return V.useEffect(() => a, []), r;
|
|
61
61
|
}
|
|
62
62
|
var qe = ((e) => (e[e.Forwards = 0] = "Forwards", e[e.Backwards = 1] = "Backwards", e))(qe || {}), He = ((e) => (e[e.Less = -1] = "Less", e[e.Equal = 0] = "Equal", e[e.Greater = 1] = "Greater", e))(He || {}), je = ((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))(je || {});
|
|
63
63
|
let Je = { 0(e, t) {
|
|
64
64
|
var n;
|
|
65
|
-
let r =
|
|
66
|
-
var
|
|
67
|
-
return !((
|
|
68
|
-
}),
|
|
65
|
+
let r = K(e.tabs, (d) => d.current), a = K(e.panels, (d) => d.current), s = r.filter((d) => {
|
|
66
|
+
var x;
|
|
67
|
+
return !((x = d.current) != null && x.hasAttribute("disabled"));
|
|
68
|
+
}), l = { ...e, tabs: r, panels: a };
|
|
69
69
|
if (t.index < 0 || t.index > r.length - 1) {
|
|
70
|
-
let d =
|
|
71
|
-
if (
|
|
72
|
-
let
|
|
73
|
-
return { ...
|
|
70
|
+
let d = Y(Math.sign(t.index - e.selectedIndex), { [-1]: () => 1, 0: () => Y(Math.sign(t.index), { [-1]: () => 0, 0: () => 0, 1: () => 1 }), 1: () => 0 });
|
|
71
|
+
if (s.length === 0) return l;
|
|
72
|
+
let x = Y(d, { 0: () => r.indexOf(s[0]), 1: () => r.indexOf(s[s.length - 1]) });
|
|
73
|
+
return { ...l, selectedIndex: x === -1 ? e.selectedIndex : x };
|
|
74
74
|
}
|
|
75
|
-
let f = r.slice(0, t.index),
|
|
76
|
-
if (!
|
|
77
|
-
let
|
|
78
|
-
return
|
|
75
|
+
let f = r.slice(0, t.index), w = [...r.slice(t.index), ...f].find((d) => s.includes(d));
|
|
76
|
+
if (!w) return l;
|
|
77
|
+
let v = (n = r.indexOf(w)) != null ? n : e.selectedIndex;
|
|
78
|
+
return v === -1 && (v = e.selectedIndex), { ...l, selectedIndex: v };
|
|
79
79
|
}, 1(e, t) {
|
|
80
80
|
if (e.tabs.includes(t.tab)) return e;
|
|
81
|
-
let n = e.tabs[e.selectedIndex], r =
|
|
81
|
+
let n = e.tabs[e.selectedIndex], r = K([...e.tabs, t.tab], (s) => s.current), a = e.selectedIndex;
|
|
82
82
|
return e.info.current.isControlled || (a = r.indexOf(n), a === -1 && (a = e.selectedIndex)), { ...e, tabs: r, selectedIndex: a };
|
|
83
83
|
}, 2(e, t) {
|
|
84
84
|
return { ...e, tabs: e.tabs.filter((n) => n !== t.tab) };
|
|
85
85
|
}, 3(e, t) {
|
|
86
|
-
return e.panels.includes(t.panel) ? e : { ...e, panels:
|
|
86
|
+
return e.panels.includes(t.panel) ? e : { ...e, panels: K([...e.panels, t.panel], (n) => n.current) };
|
|
87
87
|
}, 4(e, t) {
|
|
88
88
|
return { ...e, panels: e.panels.filter((n) => n !== t.panel) };
|
|
89
|
-
} },
|
|
90
|
-
|
|
91
|
-
function
|
|
92
|
-
let t =
|
|
89
|
+
} }, de = ve(null);
|
|
90
|
+
de.displayName = "TabsDataContext";
|
|
91
|
+
function q(e) {
|
|
92
|
+
let t = xe(de);
|
|
93
93
|
if (t === null) {
|
|
94
94
|
let n = new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);
|
|
95
|
-
throw Error.captureStackTrace && Error.captureStackTrace(n,
|
|
95
|
+
throw Error.captureStackTrace && Error.captureStackTrace(n, q), n;
|
|
96
96
|
}
|
|
97
97
|
return t;
|
|
98
98
|
}
|
|
99
|
-
let
|
|
100
|
-
|
|
101
|
-
function
|
|
102
|
-
let t =
|
|
99
|
+
let fe = ve(null);
|
|
100
|
+
fe.displayName = "TabsActionsContext";
|
|
101
|
+
function pe(e) {
|
|
102
|
+
let t = xe(fe);
|
|
103
103
|
if (t === null) {
|
|
104
104
|
let n = new Error(`<${e} /> is missing a parent <Tab.Group /> component.`);
|
|
105
|
-
throw Error.captureStackTrace && Error.captureStackTrace(n,
|
|
105
|
+
throw Error.captureStackTrace && Error.captureStackTrace(n, pe), n;
|
|
106
106
|
}
|
|
107
107
|
return t;
|
|
108
108
|
}
|
|
109
109
|
function Ke(e, t) {
|
|
110
|
-
return
|
|
110
|
+
return Y(t.type, Je, e, t);
|
|
111
111
|
}
|
|
112
112
|
let Ye = "div";
|
|
113
113
|
function Qe(e, t) {
|
|
114
|
-
let { defaultIndex: n = 0, vertical: r = !1, manual: a = !1, onChange:
|
|
115
|
-
const
|
|
116
|
-
let d =
|
|
117
|
-
})),
|
|
118
|
-
|
|
119
|
-
}),
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
}, [
|
|
123
|
-
if (
|
|
124
|
-
let
|
|
125
|
-
|
|
114
|
+
let { defaultIndex: n = 0, vertical: r = !1, manual: a = !1, onChange: s, selectedIndex: l = null, ...f } = e;
|
|
115
|
+
const w = r ? "vertical" : "horizontal", v = a ? "manual" : "auto";
|
|
116
|
+
let d = l !== null, x = te({ isControlled: d }), A = X(t), [p, u] = Se(Ke, { info: x, selectedIndex: l ?? n, tabs: [], panels: [] }), D = C(() => ({ selectedIndex: p.selectedIndex }), [p.selectedIndex]), R = te(s || (() => {
|
|
117
|
+
})), y = te(p.tabs), b = C(() => ({ orientation: w, activation: v, ...p }), [w, v, p]), F = W((o) => (u({ type: 1, tab: o }), () => u({ type: 2, tab: o }))), L = W((o) => (u({ type: 3, panel: o }), () => u({ type: 4, panel: o }))), g = W((o) => {
|
|
118
|
+
_.current !== o && R.current(o), d || u({ type: 0, index: o });
|
|
119
|
+
}), _ = te(d ? e.selectedIndex : p.selectedIndex), O = C(() => ({ registerTab: F, registerPanel: L, change: g }), []);
|
|
120
|
+
se(() => {
|
|
121
|
+
u({ type: 0, index: l ?? n });
|
|
122
|
+
}, [l]), se(() => {
|
|
123
|
+
if (_.current === void 0 || p.tabs.length <= 0) return;
|
|
124
|
+
let o = K(p.tabs, (E) => E.current);
|
|
125
|
+
o.some((E, k) => p.tabs[k] !== E) && g(o.indexOf(p.tabs[_.current]));
|
|
126
126
|
});
|
|
127
|
-
let
|
|
128
|
-
return
|
|
129
|
-
var
|
|
130
|
-
for (let
|
|
127
|
+
let T = { ref: A };
|
|
128
|
+
return z.createElement(Ve, null, z.createElement(fe.Provider, { value: O }, z.createElement(de.Provider, { value: b }, b.tabs.length <= 0 && z.createElement(Ue, { onFocus: () => {
|
|
129
|
+
var o, E;
|
|
130
|
+
for (let k of y.current) if (((o = k.current) == null ? void 0 : o.tabIndex) === 0) return (E = k.current) == null || E.focus(), !0;
|
|
131
131
|
return !1;
|
|
132
|
-
} }),
|
|
132
|
+
} }), Z({ ourProps: T, theirProps: f, slot: D, defaultTag: Ye, name: "Tabs" }))));
|
|
133
133
|
}
|
|
134
134
|
let Xe = "div";
|
|
135
135
|
function Ze(e, t) {
|
|
136
|
-
let { orientation: n, selectedIndex: r } =
|
|
137
|
-
return
|
|
136
|
+
let { orientation: n, selectedIndex: r } = q("Tab.List"), a = X(t), s = C(() => ({ selectedIndex: r }), [r]);
|
|
137
|
+
return Z({ ourProps: { ref: a, role: "tablist", "aria-orientation": n }, theirProps: e, slot: s, defaultTag: Xe, name: "Tabs.List" });
|
|
138
138
|
}
|
|
139
139
|
let et = "button";
|
|
140
140
|
function tt(e, t) {
|
|
141
141
|
var n, r;
|
|
142
|
-
let a =
|
|
143
|
-
|
|
144
|
-
let
|
|
145
|
-
|
|
146
|
-
let
|
|
147
|
-
var
|
|
148
|
-
let
|
|
149
|
-
if (
|
|
150
|
-
let
|
|
151
|
-
|
|
142
|
+
let a = he(), { id: s = `headlessui-tabs-tab-${a}`, disabled: l = !1, autoFocus: f = !1, ...w } = e, { orientation: v, activation: d, selectedIndex: x, tabs: A, panels: p } = q("Tab"), u = pe("Tab"), D = q("Tab"), [R, y] = ne(null), b = ae(null), F = X(b, t, y);
|
|
143
|
+
se(() => u.registerTab(b), [u, b]);
|
|
144
|
+
let L = Pe("tabs"), g = A.indexOf(b);
|
|
145
|
+
g === -1 && (g = L);
|
|
146
|
+
let _ = g === x, O = W((i) => {
|
|
147
|
+
var I;
|
|
148
|
+
let B = i();
|
|
149
|
+
if (B === re.Success && d === "auto") {
|
|
150
|
+
let H = (I = Oe(b)) == null ? void 0 : I.activeElement, j = D.tabs.findIndex((ce) => ce.current === H);
|
|
151
|
+
j !== -1 && u.change(j);
|
|
152
152
|
}
|
|
153
|
-
return
|
|
154
|
-
}),
|
|
155
|
-
let
|
|
156
|
-
if (
|
|
157
|
-
|
|
153
|
+
return B;
|
|
154
|
+
}), T = W((i) => {
|
|
155
|
+
let I = A.map((B) => B.current).filter(Boolean);
|
|
156
|
+
if (i.key === N.Space || i.key === N.Enter) {
|
|
157
|
+
i.preventDefault(), i.stopPropagation(), u.change(g);
|
|
158
158
|
return;
|
|
159
159
|
}
|
|
160
|
-
switch (
|
|
161
|
-
case
|
|
162
|
-
case
|
|
163
|
-
return
|
|
164
|
-
case
|
|
165
|
-
case
|
|
166
|
-
return
|
|
160
|
+
switch (i.key) {
|
|
161
|
+
case N.Home:
|
|
162
|
+
case N.PageUp:
|
|
163
|
+
return i.preventDefault(), i.stopPropagation(), O(() => U(I, S.First));
|
|
164
|
+
case N.End:
|
|
165
|
+
case N.PageDown:
|
|
166
|
+
return i.preventDefault(), i.stopPropagation(), O(() => U(I, S.Last));
|
|
167
167
|
}
|
|
168
|
-
if (
|
|
169
|
-
return
|
|
168
|
+
if (O(() => Y(v, { vertical() {
|
|
169
|
+
return i.key === N.ArrowUp ? U(I, S.Previous | S.WrapAround) : i.key === N.ArrowDown ? U(I, S.Next | S.WrapAround) : re.Error;
|
|
170
170
|
}, horizontal() {
|
|
171
|
-
return
|
|
172
|
-
} })) ===
|
|
173
|
-
}),
|
|
174
|
-
var
|
|
175
|
-
|
|
176
|
-
|
|
171
|
+
return i.key === N.ArrowLeft ? U(I, S.Previous | S.WrapAround) : i.key === N.ArrowRight ? U(I, S.Next | S.WrapAround) : re.Error;
|
|
172
|
+
} })) === re.Success) return i.preventDefault();
|
|
173
|
+
}), o = ae(!1), E = W(() => {
|
|
174
|
+
var i;
|
|
175
|
+
o.current || (o.current = !0, (i = b.current) == null || i.focus({ preventScroll: !0 }), u.change(g), Me(() => {
|
|
176
|
+
o.current = !1;
|
|
177
177
|
}));
|
|
178
|
-
}),
|
|
179
|
-
|
|
180
|
-
}), { isFocusVisible:
|
|
181
|
-
return
|
|
178
|
+
}), k = W((i) => {
|
|
179
|
+
i.preventDefault();
|
|
180
|
+
}), { isFocusVisible: M, focusProps: le } = ge({ autoFocus: f }), { isHovered: G, hoverProps: ie } = Le({ isDisabled: l }), { pressed: ee, pressProps: oe } = Be({ disabled: l }), c = C(() => ({ selected: _, hover: G, active: ee, focus: M, autofocus: f, disabled: l }), [_, G, M, ee, f, l]), $ = _e({ ref: F, onKeyDown: T, onMouseDown: k, onClick: E, id: s, role: "tab", type: We(e, R), "aria-controls": (r = (n = p[g]) == null ? void 0 : n.current) == null ? void 0 : r.id, "aria-selected": _, tabIndex: _ ? 0 : -1, disabled: l || void 0, autoFocus: f }, le, ie, oe);
|
|
181
|
+
return Z({ ourProps: $, theirProps: w, slot: c, defaultTag: et, name: "Tabs.Tab" });
|
|
182
182
|
}
|
|
183
183
|
let rt = "div";
|
|
184
184
|
function nt(e, t) {
|
|
185
|
-
let { selectedIndex: n } =
|
|
186
|
-
return
|
|
185
|
+
let { selectedIndex: n } = q("Tab.Panels"), r = X(t), a = C(() => ({ selectedIndex: n }), [n]);
|
|
186
|
+
return Z({ ourProps: { ref: r }, theirProps: e, slot: a, defaultTag: rt, name: "Tabs.Panels" });
|
|
187
187
|
}
|
|
188
|
-
let at = "div", st =
|
|
188
|
+
let at = "div", st = me.RenderStrategy | me.Static;
|
|
189
189
|
function lt(e, t) {
|
|
190
|
-
var n, r, a,
|
|
191
|
-
let
|
|
192
|
-
|
|
193
|
-
let
|
|
194
|
-
|
|
195
|
-
let b =
|
|
196
|
-
return !b && ((a =
|
|
190
|
+
var n, r, a, s;
|
|
191
|
+
let l = he(), { id: f = `headlessui-tabs-panel-${l}`, tabIndex: w = 0, ...v } = e, { selectedIndex: d, tabs: x, panels: A } = q("Tab.Panel"), p = pe("Tab.Panel"), u = ae(null), D = X(u, t);
|
|
192
|
+
se(() => p.registerPanel(u), [p, u]);
|
|
193
|
+
let R = Pe("panels"), y = A.indexOf(u);
|
|
194
|
+
y === -1 && (y = R);
|
|
195
|
+
let b = y === d, { isFocusVisible: F, focusProps: L } = ge(), g = C(() => ({ selected: b, focus: F }), [b, F]), _ = _e({ ref: D, id: f, role: "tabpanel", "aria-labelledby": (r = (n = x[y]) == null ? void 0 : n.current) == null ? void 0 : r.id, tabIndex: b ? w : -1 }, L);
|
|
196
|
+
return !b && ((a = v.unmount) == null || a) && !((s = v.static) != null && s) ? z.createElement(Te, { "aria-hidden": "true", ..._ }) : Z({ ourProps: _, theirProps: v, slot: g, defaultTag: at, features: st, visible: b, name: "Tabs.Panel" });
|
|
197
197
|
}
|
|
198
|
-
let it =
|
|
198
|
+
let it = Q(tt), we = Q(Qe), $e = Q(Ze), ye = Q(nt), Ee = Q(lt), ot = Object.assign(it, { Group: we, List: $e, Panels: ye, Panel: Ee });
|
|
199
199
|
const ct = "_container_14t2i_2", ut = "_group_14t2i_6", dt = "_tab_14t2i_17", ft = "_list_14t2i_55", pt = "_tabs_14t2i_66", bt = "_buttons_14t2i_72", mt = "_m_14t2i_79", vt = "_s_14t2i_87", ht = "_detailed_14t2i_95", m = {
|
|
200
200
|
container: ct,
|
|
201
201
|
group: ut,
|
|
@@ -220,128 +220,190 @@ const ct = "_container_14t2i_2", ut = "_group_14t2i_6", dt = "_tab_14t2i_17", ft
|
|
|
220
220
|
showButtons: n = !0,
|
|
221
221
|
className: r,
|
|
222
222
|
selectedTabIndex: a,
|
|
223
|
-
onTabChange:
|
|
224
|
-
buttonsVariant:
|
|
223
|
+
onTabChange: s,
|
|
224
|
+
buttonsVariant: l = De.WHITE,
|
|
225
225
|
autoShowButtons: f = !1,
|
|
226
|
-
tabClassName:
|
|
227
|
-
listClassName:
|
|
226
|
+
tabClassName: w,
|
|
227
|
+
listClassName: v,
|
|
228
228
|
panelClassName: d,
|
|
229
|
-
buttonsClassName:
|
|
230
|
-
indicatorColor:
|
|
229
|
+
buttonsClassName: x,
|
|
230
|
+
indicatorColor: A,
|
|
231
231
|
tabIcons: p = {},
|
|
232
|
-
variant:
|
|
233
|
-
|
|
234
|
-
|
|
235
|
-
|
|
232
|
+
variant: u = "default",
|
|
233
|
+
tabContentClassName: D,
|
|
234
|
+
tabHeaderClassName: R,
|
|
235
|
+
tabTextClassName: y,
|
|
236
|
+
tabValueClassName: b,
|
|
237
|
+
tabNameClassName: F,
|
|
238
|
+
tabIconClassName: L,
|
|
239
|
+
tabsClassName: g,
|
|
240
|
+
groupInnerClassName: _
|
|
241
|
+
}, O) => {
|
|
242
|
+
const [T, o] = ne(a || 0), [E, k] = ne(!1), M = ae(null), le = {
|
|
243
|
+
...A && { "--tab-indicator-color": A }
|
|
236
244
|
};
|
|
237
|
-
|
|
238
|
-
a !== void 0 && a !==
|
|
239
|
-
}, [
|
|
240
|
-
const
|
|
241
|
-
|
|
242
|
-
},
|
|
243
|
-
const
|
|
244
|
-
|
|
245
|
-
},
|
|
246
|
-
const
|
|
247
|
-
|
|
245
|
+
ue(() => {
|
|
246
|
+
a !== void 0 && a !== T && o(a);
|
|
247
|
+
}, [T, a]);
|
|
248
|
+
const G = (c) => {
|
|
249
|
+
o(c), s == null || s(c);
|
|
250
|
+
}, ie = () => {
|
|
251
|
+
const c = (T + 1) % e.length;
|
|
252
|
+
G(c);
|
|
253
|
+
}, ee = () => {
|
|
254
|
+
const c = (T - 1 + e.length) % e.length;
|
|
255
|
+
G(c);
|
|
248
256
|
};
|
|
249
|
-
|
|
250
|
-
var
|
|
251
|
-
const
|
|
257
|
+
ue(() => {
|
|
258
|
+
var $;
|
|
259
|
+
const c = ($ = M.current) == null ? void 0 : $.querySelector(
|
|
252
260
|
`.${m.tab}[data-active="true"]`
|
|
253
261
|
);
|
|
254
|
-
|
|
262
|
+
c && typeof c.scrollIntoView == "function" && c.scrollIntoView({
|
|
255
263
|
behavior: "smooth",
|
|
256
264
|
block: "nearest",
|
|
257
265
|
inline: "center"
|
|
258
266
|
});
|
|
259
|
-
}, [
|
|
260
|
-
const
|
|
261
|
-
if (
|
|
262
|
-
const { scrollWidth:
|
|
263
|
-
|
|
267
|
+
}, [T]), ue(() => {
|
|
268
|
+
const c = () => {
|
|
269
|
+
if (M.current) {
|
|
270
|
+
const { scrollWidth: $, clientWidth: i } = M.current;
|
|
271
|
+
k($ > i);
|
|
264
272
|
}
|
|
265
273
|
};
|
|
266
|
-
return
|
|
274
|
+
return c(), window.addEventListener("resize", c), () => window.removeEventListener("resize", c);
|
|
267
275
|
}, [e]);
|
|
268
|
-
const
|
|
269
|
-
return /* @__PURE__ */
|
|
270
|
-
|
|
276
|
+
const oe = f ? E : n;
|
|
277
|
+
return /* @__PURE__ */ J(
|
|
278
|
+
we,
|
|
271
279
|
{
|
|
272
|
-
ref:
|
|
273
|
-
className:
|
|
280
|
+
ref: O,
|
|
281
|
+
className: P(
|
|
274
282
|
m.group,
|
|
275
283
|
m[t],
|
|
276
|
-
|
|
284
|
+
u === "detailed" && m.detailed,
|
|
277
285
|
r
|
|
278
286
|
),
|
|
279
|
-
selectedIndex:
|
|
280
|
-
onChange:
|
|
281
|
-
style:
|
|
287
|
+
selectedIndex: T,
|
|
288
|
+
onChange: G,
|
|
289
|
+
style: le,
|
|
282
290
|
children: [
|
|
283
|
-
/* @__PURE__ */
|
|
284
|
-
/* @__PURE__ */
|
|
285
|
-
|
|
291
|
+
/* @__PURE__ */ J("div", { className: P(m["group-inner"], _), children: [
|
|
292
|
+
/* @__PURE__ */ h(
|
|
293
|
+
$e,
|
|
286
294
|
{
|
|
287
|
-
ref:
|
|
288
|
-
className:
|
|
289
|
-
children: /* @__PURE__ */
|
|
290
|
-
({ name:
|
|
291
|
-
const
|
|
292
|
-
...
|
|
293
|
-
"--detailed-value-color":
|
|
295
|
+
ref: M,
|
|
296
|
+
className: P(m.list, v),
|
|
297
|
+
children: /* @__PURE__ */ h("div", { className: P(m.tabs, g), children: e.map(
|
|
298
|
+
({ name: c, notificationCount: $, value: i, valueColor: I, borderColor: B }, H) => {
|
|
299
|
+
const j = p[H], ce = u === "detailed" ? {
|
|
300
|
+
...I && {
|
|
301
|
+
"--detailed-value-color": I
|
|
294
302
|
},
|
|
295
|
-
...
|
|
296
|
-
"--detailed-border-color":
|
|
303
|
+
...B && {
|
|
304
|
+
"--detailed-border-color": B
|
|
297
305
|
}
|
|
298
306
|
} : void 0;
|
|
299
|
-
return /* @__PURE__ */
|
|
307
|
+
return /* @__PURE__ */ h(
|
|
300
308
|
ot,
|
|
301
309
|
{
|
|
302
|
-
className: `${m.tab} ${
|
|
303
|
-
"data-active":
|
|
304
|
-
style:
|
|
305
|
-
children:
|
|
306
|
-
|
|
307
|
-
|
|
308
|
-
|
|
309
|
-
|
|
310
|
-
|
|
311
|
-
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
|
|
310
|
+
className: `${m.tab} ${T === H ? 'data-active="true"' : ""} ${w || ""}`,
|
|
311
|
+
"data-active": T === H,
|
|
312
|
+
style: ce,
|
|
313
|
+
children: u === "detailed" ? /* @__PURE__ */ h(
|
|
314
|
+
"div",
|
|
315
|
+
{
|
|
316
|
+
className: P(
|
|
317
|
+
m["tab-content"],
|
|
318
|
+
D
|
|
319
|
+
),
|
|
320
|
+
children: /* @__PURE__ */ J(
|
|
321
|
+
"div",
|
|
322
|
+
{
|
|
323
|
+
className: P(
|
|
324
|
+
m["tab-header"],
|
|
325
|
+
R
|
|
326
|
+
),
|
|
327
|
+
children: [
|
|
328
|
+
/* @__PURE__ */ J(
|
|
329
|
+
"div",
|
|
330
|
+
{
|
|
331
|
+
className: P(
|
|
332
|
+
m["tab-text"],
|
|
333
|
+
y
|
|
334
|
+
),
|
|
335
|
+
children: [
|
|
336
|
+
/* @__PURE__ */ h(
|
|
337
|
+
"div",
|
|
338
|
+
{
|
|
339
|
+
className: P(
|
|
340
|
+
m["tab-value"],
|
|
341
|
+
b
|
|
342
|
+
),
|
|
343
|
+
children: i
|
|
344
|
+
}
|
|
345
|
+
),
|
|
346
|
+
/* @__PURE__ */ h(
|
|
347
|
+
"div",
|
|
348
|
+
{
|
|
349
|
+
className: P(
|
|
350
|
+
m["tab-name"],
|
|
351
|
+
F
|
|
352
|
+
),
|
|
353
|
+
children: c
|
|
354
|
+
}
|
|
355
|
+
)
|
|
356
|
+
]
|
|
357
|
+
}
|
|
358
|
+
),
|
|
359
|
+
/* @__PURE__ */ h(
|
|
360
|
+
"div",
|
|
361
|
+
{
|
|
362
|
+
className: P(
|
|
363
|
+
m["tab-icon"],
|
|
364
|
+
L
|
|
365
|
+
),
|
|
366
|
+
children: /* @__PURE__ */ h(be, { iconName: "ArrowUpRight24px" })
|
|
367
|
+
}
|
|
368
|
+
)
|
|
369
|
+
]
|
|
370
|
+
}
|
|
371
|
+
)
|
|
372
|
+
}
|
|
373
|
+
) : /* @__PURE__ */ J(Ne, { children: [
|
|
374
|
+
j && /* @__PURE__ */ h(be, { iconName: j }),
|
|
375
|
+
c,
|
|
376
|
+
$ && /* @__PURE__ */ h(
|
|
315
377
|
Re,
|
|
316
378
|
{
|
|
317
|
-
count:
|
|
379
|
+
count: $,
|
|
318
380
|
size: "m"
|
|
319
381
|
}
|
|
320
382
|
)
|
|
321
383
|
] })
|
|
322
384
|
},
|
|
323
|
-
|
|
385
|
+
c
|
|
324
386
|
);
|
|
325
387
|
}
|
|
326
388
|
) })
|
|
327
389
|
}
|
|
328
390
|
),
|
|
329
|
-
|
|
391
|
+
oe && /* @__PURE__ */ h("div", { className: P(m.buttons, x), children: /* @__PURE__ */ h(
|
|
330
392
|
ke,
|
|
331
393
|
{
|
|
332
|
-
handlePrevTab:
|
|
333
|
-
handleNextTab:
|
|
334
|
-
buttonsVariant:
|
|
394
|
+
handlePrevTab: ee,
|
|
395
|
+
handleNextTab: ie,
|
|
396
|
+
buttonsVariant: l
|
|
335
397
|
}
|
|
336
398
|
) })
|
|
337
399
|
] }),
|
|
338
|
-
/* @__PURE__ */
|
|
339
|
-
|
|
400
|
+
/* @__PURE__ */ h(ye, { className: m.panels, children: e.map(({ name: c, content: $ }) => /* @__PURE__ */ h(
|
|
401
|
+
Ee,
|
|
340
402
|
{
|
|
341
|
-
className:
|
|
342
|
-
children:
|
|
403
|
+
className: P(m.panel, d),
|
|
404
|
+
children: $
|
|
343
405
|
},
|
|
344
|
-
|
|
406
|
+
c
|
|
345
407
|
)) })
|
|
346
408
|
]
|
|
347
409
|
}
|