@pismo/marola 1.0.0-beta.23 → 1.0.0-beta.24
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/{Tabs.module-jkH1Qjn7.js → Tabs.module-BGGTkDc5.js} +7 -7
- package/dist/assets/Tabs.css +1 -1
- package/dist/components/Pagination/Pagination.js +26 -33
- package/dist/components/Tabs/Tab.d.ts +5 -3
- package/dist/components/Tabs/Tab.js +34 -33
- package/dist/components/Tabs/TabPanel.d.ts +4 -2
- package/dist/components/Tabs/TabPanel.js +48 -38
- package/dist/components/Tabs/Tabs.d.ts +6 -4
- package/dist/components/Tabs/Tabs.js +113 -110
- package/package.json +1 -1
|
@@ -2,21 +2,21 @@ import './assets/Tabs.css';
|
|
|
2
2
|
import * as a from "react";
|
|
3
3
|
const s = /* @__PURE__ */ a.createContext(null);
|
|
4
4
|
process.env.NODE_ENV !== "production" && (s.displayName = "TabsContext");
|
|
5
|
-
function
|
|
5
|
+
function e() {
|
|
6
6
|
const t = a.useContext(s);
|
|
7
7
|
if (t == null)
|
|
8
8
|
throw new Error("No TabsContext provided");
|
|
9
9
|
return t;
|
|
10
10
|
}
|
|
11
|
-
const _ = "
|
|
11
|
+
const _ = "_tabs_1xfbu_1", b = "_tabs__tab_1xfbu_5", o = {
|
|
12
12
|
tabs: _,
|
|
13
|
-
tabs__tab:
|
|
14
|
-
"tabs__tab--disabled": "_tabs__tab--
|
|
15
|
-
"tabs__tab--selected": "_tabs__tab--
|
|
16
|
-
"tabs__tab-panel": "_tabs__tab-
|
|
13
|
+
tabs__tab: b,
|
|
14
|
+
"tabs__tab--disabled": "_tabs__tab--disabled_1xfbu_23",
|
|
15
|
+
"tabs__tab--selected": "_tabs__tab--selected_1xfbu_32",
|
|
16
|
+
"tabs__tab-panel": "_tabs__tab-panel_1xfbu_36"
|
|
17
17
|
};
|
|
18
18
|
export {
|
|
19
19
|
s as T,
|
|
20
20
|
o as s,
|
|
21
|
-
|
|
21
|
+
e as u
|
|
22
22
|
};
|
package/dist/assets/Tabs.css
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
.
|
|
1
|
+
._tabs_1xfbu_1{gap:8px;width:100%}._tabs__tab_1xfbu_5{min-width:94px;height:48px;padding:0 8px 0 0;color:var(--gray-75);cursor:pointer;background-color:transparent;border:none;border-bottom:2px solid transparent}._tabs__tab_1xfbu_5:hover{color:var(--hover);border-bottom:2px solid var(--hover)}._tabs__tab_1xfbu_5:active{color:var(--active);border-bottom:2px solid var(--active)}._tabs__tab--disabled_1xfbu_23{color:#00000040;cursor:default;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--disabled_1xfbu_23:focus,._tabs__tab--disabled_1xfbu_23:active,._tabs__tab--disabled_1xfbu_23:hover{color:#00000040;border-bottom:2px solid rgba(0,0,0,.25)}._tabs__tab--selected_1xfbu_32{color:var(--accent);border-bottom:2px solid var(--accent)}._tabs__tab-panel_1xfbu_36{width:100%;margin-top:16px}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import '../../assets/Pagination.css';
|
|
2
2
|
import { jsxs as s, Fragment as p, jsx as t } from "react/jsx-runtime";
|
|
3
|
-
import { c as
|
|
3
|
+
import { c as _ } from "../../clsx-DB4S2d7J.js";
|
|
4
4
|
import { Select as d } from "../Select/Select.js";
|
|
5
5
|
import I from "./usePagination.js";
|
|
6
6
|
const C = "_pagination_2n0nk_43", a = {
|
|
@@ -44,7 +44,7 @@ const C = "_pagination_2n0nk_43", a = {
|
|
|
44
44
|
next: "Next",
|
|
45
45
|
perPage: "Items per page"
|
|
46
46
|
}
|
|
47
|
-
}, j = ({ perPageOptions:
|
|
47
|
+
}, j = ({ perPageOptions: o = [5, 10, 25, 50, 100], language: y = "en", ...e }) => {
|
|
48
48
|
const l = Math.ceil(e.totalItems / e.perPage), b = e.currentPage <= 1, m = e.currentPage >= l, k = { ...w[y], ...e.t || {} }, i = (n) => k[n], { items: v } = I({
|
|
49
49
|
count: l,
|
|
50
50
|
hideNextButton: !0,
|
|
@@ -53,14 +53,14 @@ const C = "_pagination_2n0nk_43", a = {
|
|
|
53
53
|
siblingCount: 1,
|
|
54
54
|
boundaryCount: 2
|
|
55
55
|
}), c = e.perPage * (e.currentPage - 1) + 1, u = c + e.perPage - 1, x = u > e.totalItems ? u - e.totalItems : 0, P = u - x;
|
|
56
|
-
return /* @__PURE__ */ s("div", { className:
|
|
56
|
+
return /* @__PURE__ */ s("div", { className: _(a.pagination, e.className), "data-testid": e["data-testid"], children: [
|
|
57
57
|
/* @__PURE__ */ s(
|
|
58
58
|
"div",
|
|
59
59
|
{
|
|
60
|
-
className:
|
|
60
|
+
className: _(a["per-page-container"], e.classNamePerPage),
|
|
61
61
|
"data-testid": e["data-testid-per-page"],
|
|
62
62
|
children: [
|
|
63
|
-
|
|
63
|
+
o && /* @__PURE__ */ s(p, { children: [
|
|
64
64
|
/* @__PURE__ */ t("span", { children: i`perPage` }),
|
|
65
65
|
/* @__PURE__ */ t(
|
|
66
66
|
d,
|
|
@@ -68,7 +68,7 @@ const C = "_pagination_2n0nk_43", a = {
|
|
|
68
68
|
className: a["per-page-container__select"],
|
|
69
69
|
value: String(e.perPage),
|
|
70
70
|
onChange: (n) => e.onRowsPerPageChange(Number(n)),
|
|
71
|
-
children:
|
|
71
|
+
children: o == null ? void 0 : o.map((n) => {
|
|
72
72
|
const r = typeof n == "number";
|
|
73
73
|
return /* @__PURE__ */ t(
|
|
74
74
|
d.Option,
|
|
@@ -82,35 +82,28 @@ const C = "_pagination_2n0nk_43", a = {
|
|
|
82
82
|
}
|
|
83
83
|
)
|
|
84
84
|
] }),
|
|
85
|
-
/* @__PURE__ */ s(
|
|
86
|
-
"
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
/* @__PURE__ */ t("strong", { children: e.totalItems }),
|
|
101
|
-
" ",
|
|
102
|
-
i`results`
|
|
103
|
-
] })
|
|
104
|
-
]
|
|
105
|
-
}
|
|
106
|
-
)
|
|
85
|
+
/* @__PURE__ */ s("div", { className: e.classNamePagesInfo, "data-testid": e["data-testid-pages-info"], children: [
|
|
86
|
+
/* @__PURE__ */ s("span", { children: [
|
|
87
|
+
c,
|
|
88
|
+
" - ",
|
|
89
|
+
P
|
|
90
|
+
] }),
|
|
91
|
+
" ",
|
|
92
|
+
/* @__PURE__ */ s("span", { children: [
|
|
93
|
+
i`of`,
|
|
94
|
+
" ",
|
|
95
|
+
/* @__PURE__ */ t("strong", { children: e.totalItems }),
|
|
96
|
+
" ",
|
|
97
|
+
i`results`
|
|
98
|
+
] })
|
|
99
|
+
] })
|
|
107
100
|
]
|
|
108
101
|
}
|
|
109
102
|
),
|
|
110
103
|
/* @__PURE__ */ s(
|
|
111
104
|
"div",
|
|
112
105
|
{
|
|
113
|
-
className:
|
|
106
|
+
className: _(a["pages-navigator-container"], e.classNamePagesNav),
|
|
114
107
|
"data-testid": e["data-testid-pages-nav"],
|
|
115
108
|
children: [
|
|
116
109
|
/* @__PURE__ */ t(
|
|
@@ -125,17 +118,17 @@ const C = "_pagination_2n0nk_43", a = {
|
|
|
125
118
|
"page__previous"
|
|
126
119
|
),
|
|
127
120
|
/* @__PURE__ */ t("ul", { children: v.map(({ page: n, type: r, selected: N, ...f }, h) => {
|
|
128
|
-
let
|
|
129
|
-
return r === "start-ellipsis" || r === "end-ellipsis" ?
|
|
121
|
+
let g = /* @__PURE__ */ t(p, {});
|
|
122
|
+
return r === "start-ellipsis" || r === "end-ellipsis" ? g = /* @__PURE__ */ t("span", { className: a["page-item"], children: "..." }) : r === "page" ? g = /* @__PURE__ */ t(
|
|
130
123
|
"button",
|
|
131
124
|
{
|
|
132
|
-
className:
|
|
125
|
+
className: _(a["page-number__btn"], N && a["page-number__btn--selected"]),
|
|
133
126
|
onClick: () => e.onPageChange(n || 0),
|
|
134
127
|
type: "button",
|
|
135
128
|
children: n
|
|
136
129
|
},
|
|
137
130
|
`page__${h}`
|
|
138
|
-
) :
|
|
131
|
+
) : g = /* @__PURE__ */ t("button", { type: "button", ...f, children: r }), /* @__PURE__ */ t("li", { children: g }, h);
|
|
139
132
|
}) }),
|
|
140
133
|
/* @__PURE__ */ t(
|
|
141
134
|
"button",
|
|
@@ -4,11 +4,13 @@ export interface TabProps {
|
|
|
4
4
|
/** The value to be showing in the tab */
|
|
5
5
|
children: ReactNode;
|
|
6
6
|
/** The value that corresponds to the panel to show.
|
|
7
|
-
* e.g. value="1" when this tab is clicked it will show the panel which also has value="1
|
|
7
|
+
* e.g. value="1" when this tab is clicked it will show the panel which also has value="1" */
|
|
8
8
|
value: string | number;
|
|
9
9
|
/** Disable clicking the tab */
|
|
10
10
|
disabled?: boolean;
|
|
11
|
-
/**
|
|
12
|
-
|
|
11
|
+
/** CSS classes to be applied on the container element */
|
|
12
|
+
className?: string;
|
|
13
|
+
/** Id to be applied as `data-testid` on the container element */
|
|
14
|
+
'data-testid'?: string;
|
|
13
15
|
}
|
|
14
16
|
export declare const Tab: import('react').ForwardRefExoticComponent<TabProps & import('react').RefAttributes<HTMLButtonElement>>;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as N } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as b from "react";
|
|
3
3
|
import { forwardRef as H, useContext as U, useMemo as j } from "react";
|
|
4
4
|
import { c as k } from "../../clsx-DB4S2d7J.js";
|
|
5
|
-
import { u as B, T as D, s as y } from "../../Tabs.module-
|
|
6
|
-
import { g as L, a as W, u as O, f as $, b as
|
|
5
|
+
import { u as B, T as D, s as y } from "../../Tabs.module-BGGTkDc5.js";
|
|
6
|
+
import { g as L, a as W, u as O, f as $, b as f, _ as q, c as z, P as e, d as A, e as G } from "../../useSlotProps-C_I1kEHr.js";
|
|
7
7
|
import { u as J, c as K } from "../../combineHooksSlotProps-C-zYvfnF.js";
|
|
8
8
|
import { u as Q } from "../../useId-BW-oWmul.js";
|
|
9
9
|
import { u as X } from "../../useButton-DcihopJG.js";
|
|
@@ -22,27 +22,27 @@ function te(o) {
|
|
|
22
22
|
rootRef: s,
|
|
23
23
|
disabled: n = !1,
|
|
24
24
|
id: c
|
|
25
|
-
} = o,
|
|
26
|
-
value:
|
|
25
|
+
} = o, r = b.useRef(null), a = Q(c), {
|
|
26
|
+
value: i,
|
|
27
27
|
selectionFollowsFocus: p,
|
|
28
28
|
getTabPanelId: m
|
|
29
|
-
} = B(), P =
|
|
29
|
+
} = B(), P = b.useMemo(() => ({
|
|
30
30
|
disabled: n,
|
|
31
|
-
ref:
|
|
32
|
-
id:
|
|
33
|
-
}), [n,
|
|
31
|
+
ref: r,
|
|
32
|
+
id: a
|
|
33
|
+
}), [n, r, a]), {
|
|
34
34
|
id: l,
|
|
35
35
|
index: R,
|
|
36
36
|
totalItemCount: g
|
|
37
37
|
} = Y(t ?? ee, P), {
|
|
38
38
|
getRootProps: h,
|
|
39
39
|
highlighted: T,
|
|
40
|
-
selected:
|
|
40
|
+
selected: u
|
|
41
41
|
} = J({
|
|
42
42
|
item: l
|
|
43
43
|
}), {
|
|
44
44
|
getRootProps: C,
|
|
45
|
-
rootRef:
|
|
45
|
+
rootRef: d,
|
|
46
46
|
active: v,
|
|
47
47
|
focusVisible: I,
|
|
48
48
|
setFocusVisible: V
|
|
@@ -50,15 +50,15 @@ function te(o) {
|
|
|
50
50
|
disabled: n,
|
|
51
51
|
focusableWhenDisabled: !p,
|
|
52
52
|
type: "button"
|
|
53
|
-
}), _ = O(
|
|
53
|
+
}), _ = O(r, s, d), M = l !== void 0 ? m(l) : void 0;
|
|
54
54
|
return {
|
|
55
55
|
getRootProps: (x = {}) => {
|
|
56
56
|
const S = $(x), w = K(h, C);
|
|
57
|
-
return
|
|
57
|
+
return f({}, x, w(S), {
|
|
58
58
|
role: "tab",
|
|
59
59
|
"aria-controls": M,
|
|
60
|
-
"aria-selected":
|
|
61
|
-
id:
|
|
60
|
+
"aria-selected": u,
|
|
61
|
+
id: a,
|
|
62
62
|
ref: _
|
|
63
63
|
});
|
|
64
64
|
},
|
|
@@ -69,7 +69,7 @@ function te(o) {
|
|
|
69
69
|
rootRef: _,
|
|
70
70
|
// the `selected` state isn't set on the server (it relies on effects to be calculated),
|
|
71
71
|
// so we fall back to checking the `value` prop with the selectedValue from the TabsContext
|
|
72
|
-
selected:
|
|
72
|
+
selected: u || l === i,
|
|
73
73
|
setFocusVisible: V,
|
|
74
74
|
totalTabsCount: g
|
|
75
75
|
};
|
|
@@ -82,39 +82,39 @@ const oe = ["action", "children", "disabled", "onChange", "onClick", "onFocus",
|
|
|
82
82
|
return A({
|
|
83
83
|
root: ["root", t && "selected", s && "disabled"]
|
|
84
84
|
}, G(Z));
|
|
85
|
-
}, F = /* @__PURE__ */
|
|
85
|
+
}, F = /* @__PURE__ */ b.forwardRef(function(t, s) {
|
|
86
86
|
var n;
|
|
87
87
|
const {
|
|
88
88
|
children: c,
|
|
89
|
-
disabled:
|
|
90
|
-
slotProps:
|
|
91
|
-
slots:
|
|
89
|
+
disabled: r = !1,
|
|
90
|
+
slotProps: a = {},
|
|
91
|
+
slots: i = {},
|
|
92
92
|
value: p
|
|
93
|
-
} = t, m = q(t, oe), P =
|
|
93
|
+
} = t, m = q(t, oe), P = b.useRef(), l = O(P, s), {
|
|
94
94
|
active: R,
|
|
95
95
|
highlighted: g,
|
|
96
96
|
selected: h,
|
|
97
97
|
getRootProps: T
|
|
98
|
-
} = te(
|
|
98
|
+
} = te(f({}, t, {
|
|
99
99
|
rootRef: l,
|
|
100
100
|
value: p
|
|
101
|
-
})),
|
|
101
|
+
})), u = f({}, t, {
|
|
102
102
|
active: R,
|
|
103
|
-
disabled:
|
|
103
|
+
disabled: r,
|
|
104
104
|
highlighted: g,
|
|
105
105
|
selected: h
|
|
106
|
-
}), C = se(
|
|
107
|
-
elementType:
|
|
106
|
+
}), C = se(u), d = (n = i.root) != null ? n : "button", v = z({
|
|
107
|
+
elementType: d,
|
|
108
108
|
getSlotProps: T,
|
|
109
|
-
externalSlotProps:
|
|
109
|
+
externalSlotProps: a.root,
|
|
110
110
|
externalForwardedProps: m,
|
|
111
111
|
additionalProps: {
|
|
112
112
|
ref: s
|
|
113
113
|
},
|
|
114
|
-
ownerState:
|
|
114
|
+
ownerState: u,
|
|
115
115
|
className: C.root
|
|
116
116
|
});
|
|
117
|
-
return /* @__PURE__ */ N(
|
|
117
|
+
return /* @__PURE__ */ N(d, f({}, v, {
|
|
118
118
|
children: c
|
|
119
119
|
}));
|
|
120
120
|
});
|
|
@@ -165,16 +165,17 @@ process.env.NODE_ENV !== "production" && (F.propTypes = {
|
|
|
165
165
|
value: e.oneOfType([e.number, e.string])
|
|
166
166
|
});
|
|
167
167
|
const pe = H(
|
|
168
|
-
({ children: o, value: t, disabled: s,
|
|
169
|
-
const a = U(D),
|
|
168
|
+
({ children: o, value: t, disabled: s, className: n, "data-testid": c }, r) => {
|
|
169
|
+
const a = U(D), i = j(
|
|
170
170
|
() => k(
|
|
171
171
|
y.tabs__tab,
|
|
172
172
|
t === (a == null ? void 0 : a.value) && y["tabs__tab--selected"],
|
|
173
|
-
s && y["tabs__tab--disabled"]
|
|
173
|
+
s && y["tabs__tab--disabled"],
|
|
174
|
+
n
|
|
174
175
|
),
|
|
175
176
|
[t, a, s]
|
|
176
177
|
);
|
|
177
|
-
return /* @__PURE__ */ N(F, { className:
|
|
178
|
+
return /* @__PURE__ */ N(F, { className: i, disabled: s, value: t, "data-testid": c, ref: r, children: o });
|
|
178
179
|
}
|
|
179
180
|
);
|
|
180
181
|
export {
|
|
@@ -6,7 +6,9 @@ export interface TabPanelProps {
|
|
|
6
6
|
/** The value that identifies which tab is selected.
|
|
7
7
|
* e.g. value="1" when the tab button with the value="1" is selected this content will show */
|
|
8
8
|
value: string | number;
|
|
9
|
-
/**
|
|
10
|
-
|
|
9
|
+
/** CSS classes to be applied on the container element */
|
|
10
|
+
className?: string;
|
|
11
|
+
/** Id to be applied as `data-testid` on the container element */
|
|
12
|
+
'data-testid'?: string;
|
|
11
13
|
}
|
|
12
14
|
export declare const TabPanel: import('react').ForwardRefExoticComponent<TabPanelProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
@@ -1,79 +1,80 @@
|
|
|
1
1
|
import { jsx as T } from "react/jsx-runtime";
|
|
2
2
|
import * as P from "react";
|
|
3
3
|
import { forwardRef as v } from "react";
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { u as S } from "../../
|
|
7
|
-
import { u as U } from "../../
|
|
4
|
+
import { c as y } from "../../clsx-DB4S2d7J.js";
|
|
5
|
+
import { u as x, s as C } from "../../Tabs.module-BGGTkDc5.js";
|
|
6
|
+
import { g as N, a as _, u as w, b, _ as O, c as E, P as o, d as I, e as S } from "../../useSlotProps-C_I1kEHr.js";
|
|
7
|
+
import { u as U } from "../../useId-BW-oWmul.js";
|
|
8
|
+
import { u as j } from "../../useCompoundItem-B7Eo_qZk.js";
|
|
8
9
|
const h = "TabPanel";
|
|
9
|
-
function j(t) {
|
|
10
|
-
return C(h, t);
|
|
11
|
-
}
|
|
12
|
-
N(h, ["root", "hidden"]);
|
|
13
10
|
function M(t) {
|
|
14
|
-
return t
|
|
11
|
+
return N(h, t);
|
|
15
12
|
}
|
|
13
|
+
_(h, ["root", "hidden"]);
|
|
16
14
|
function V(t) {
|
|
15
|
+
return t.size;
|
|
16
|
+
}
|
|
17
|
+
function F(t) {
|
|
17
18
|
const {
|
|
18
19
|
value: e,
|
|
19
20
|
id: s,
|
|
20
21
|
rootRef: n
|
|
21
|
-
} = t,
|
|
22
|
-
if (
|
|
22
|
+
} = t, a = x();
|
|
23
|
+
if (a === null)
|
|
23
24
|
throw new Error("No TabContext provided");
|
|
24
25
|
const {
|
|
25
26
|
value: f,
|
|
26
27
|
getTabId: m
|
|
27
|
-
} =
|
|
28
|
+
} = a, r = U(s), l = P.useRef(null), c = w(l, n), u = P.useMemo(() => ({
|
|
28
29
|
id: r,
|
|
29
|
-
ref:
|
|
30
|
+
ref: l
|
|
30
31
|
}), [r]), {
|
|
31
|
-
id:
|
|
32
|
-
} =
|
|
32
|
+
id: d
|
|
33
|
+
} = j(e ?? V, u), i = d !== f, p = d !== void 0 ? m(d) : void 0;
|
|
33
34
|
return {
|
|
34
|
-
hidden:
|
|
35
|
+
hidden: i,
|
|
35
36
|
getRootProps: (g = {}) => b({
|
|
36
37
|
"aria-labelledby": p ?? void 0,
|
|
37
|
-
hidden:
|
|
38
|
+
hidden: i,
|
|
38
39
|
id: r ?? void 0
|
|
39
40
|
}, g, {
|
|
40
|
-
ref:
|
|
41
|
+
ref: c
|
|
41
42
|
}),
|
|
42
|
-
rootRef:
|
|
43
|
+
rootRef: c
|
|
43
44
|
};
|
|
44
45
|
}
|
|
45
|
-
const
|
|
46
|
+
const $ = ["children", "value", "slotProps", "slots"], k = (t) => {
|
|
46
47
|
const {
|
|
47
48
|
hidden: e
|
|
48
49
|
} = t;
|
|
49
|
-
return
|
|
50
|
+
return I({
|
|
50
51
|
root: ["root", e && "hidden"]
|
|
51
|
-
},
|
|
52
|
+
}, S(M));
|
|
52
53
|
}, R = /* @__PURE__ */ P.forwardRef(function(e, s) {
|
|
53
54
|
var n;
|
|
54
55
|
const {
|
|
55
|
-
children:
|
|
56
|
+
children: a,
|
|
56
57
|
slotProps: f = {},
|
|
57
58
|
slots: m = {}
|
|
58
|
-
} = e, r =
|
|
59
|
-
hidden:
|
|
60
|
-
getRootProps:
|
|
61
|
-
} =
|
|
62
|
-
hidden:
|
|
63
|
-
}),
|
|
64
|
-
elementType:
|
|
65
|
-
getSlotProps:
|
|
59
|
+
} = e, r = O(e, $), {
|
|
60
|
+
hidden: l,
|
|
61
|
+
getRootProps: c
|
|
62
|
+
} = F(e), u = b({}, e, {
|
|
63
|
+
hidden: l
|
|
64
|
+
}), d = k(u), i = (n = m.root) != null ? n : "div", p = E({
|
|
65
|
+
elementType: i,
|
|
66
|
+
getSlotProps: c,
|
|
66
67
|
externalSlotProps: f.root,
|
|
67
68
|
externalForwardedProps: r,
|
|
68
69
|
additionalProps: {
|
|
69
70
|
role: "tabpanel",
|
|
70
71
|
ref: s
|
|
71
72
|
},
|
|
72
|
-
ownerState:
|
|
73
|
-
className:
|
|
73
|
+
ownerState: u,
|
|
74
|
+
className: d.root
|
|
74
75
|
});
|
|
75
|
-
return /* @__PURE__ */ T(
|
|
76
|
-
children: !
|
|
76
|
+
return /* @__PURE__ */ T(i, b({}, p, {
|
|
77
|
+
children: !l && a
|
|
77
78
|
}));
|
|
78
79
|
});
|
|
79
80
|
process.env.NODE_ENV !== "production" && (R.propTypes = {
|
|
@@ -111,9 +112,18 @@ process.env.NODE_ENV !== "production" && (R.propTypes = {
|
|
|
111
112
|
*/
|
|
112
113
|
value: o.oneOfType([o.number, o.string])
|
|
113
114
|
});
|
|
114
|
-
const
|
|
115
|
-
({ children: t, value: e,
|
|
115
|
+
const H = v(
|
|
116
|
+
({ children: t, value: e, className: s, "data-testid": n }, a) => /* @__PURE__ */ T(
|
|
117
|
+
R,
|
|
118
|
+
{
|
|
119
|
+
className: y(C["tabs__tab-panel"], s),
|
|
120
|
+
value: e,
|
|
121
|
+
"data-testid": n,
|
|
122
|
+
ref: a,
|
|
123
|
+
children: t
|
|
124
|
+
}
|
|
125
|
+
)
|
|
116
126
|
);
|
|
117
127
|
export {
|
|
118
|
-
|
|
128
|
+
H as TabPanel
|
|
119
129
|
};
|
|
@@ -4,11 +4,13 @@ export interface TabsProps {
|
|
|
4
4
|
/** Should contain `Tab` and `TabPanel` components to be rendered */
|
|
5
5
|
children?: ReactNode;
|
|
6
6
|
/** Selected tab */
|
|
7
|
-
value?: number |
|
|
7
|
+
value?: string | number | null;
|
|
8
|
+
/** CSS classes to be applied on the container element */
|
|
9
|
+
className?: string;
|
|
10
|
+
/** Id to be applied as `data-testid` on the container element */
|
|
11
|
+
'data-testid'?: string;
|
|
8
12
|
/** Callback triggered when the user has selected a tab */
|
|
9
|
-
onChange?: (tabValue:
|
|
10
|
-
/** Test id */
|
|
11
|
-
dataTestId?: string;
|
|
13
|
+
onChange?: (tabValue: string | number | null, event?: React.SyntheticEvent<Element, Event> | null) => void;
|
|
12
14
|
}
|
|
13
15
|
export declare const Tabs: import('react').ForwardRefExoticComponent<TabsProps & import('react').RefAttributes<HTMLDivElement>>;
|
|
14
16
|
export * from './Tab';
|
|
@@ -1,11 +1,12 @@
|
|
|
1
1
|
import { jsx as T } from "react/jsx-runtime";
|
|
2
2
|
import * as r from "react";
|
|
3
|
-
import { forwardRef as q
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import { a as
|
|
3
|
+
import { forwardRef as q } from "react";
|
|
4
|
+
import { c as B } from "../../clsx-DB4S2d7J.js";
|
|
5
|
+
import { T as G, u as J, s as Q } from "../../Tabs.module-BGGTkDc5.js";
|
|
6
|
+
import { Tab as Ie } from "./Tab.js";
|
|
7
|
+
import { TabPanel as Fe } from "./TabPanel.js";
|
|
8
|
+
import { g as I, a as _, b as C, _ as F, c as $, P as t, d as N, e as w } from "../../useSlotProps-C_I1kEHr.js";
|
|
9
|
+
import { a as M, C as O } from "../../useCompoundItem-B7Eo_qZk.js";
|
|
9
10
|
import { u as X } from "../../useControlled-CCMYYdCM.js";
|
|
10
11
|
import { L as Y, a as Z } from "../../combineHooksSlotProps-C-zYvfnF.js";
|
|
11
12
|
import { l as ee, m as te, u as oe } from "../../useList-B9C55YB7.js";
|
|
@@ -18,21 +19,21 @@ function ne(s) {
|
|
|
18
19
|
const {
|
|
19
20
|
value: e,
|
|
20
21
|
defaultValue: o,
|
|
21
|
-
onChange:
|
|
22
|
-
orientation:
|
|
22
|
+
onChange: l,
|
|
23
|
+
orientation: a = "horizontal",
|
|
23
24
|
direction: c = "ltr",
|
|
24
|
-
selectionFollowsFocus:
|
|
25
|
-
} = s, [d,
|
|
25
|
+
selectionFollowsFocus: n = !1
|
|
26
|
+
} = s, [d, i] = X({
|
|
26
27
|
controlled: e,
|
|
27
28
|
default: o,
|
|
28
29
|
name: "Tabs",
|
|
29
30
|
state: "value"
|
|
30
|
-
}),
|
|
31
|
-
|
|
32
|
-
}, [
|
|
31
|
+
}), u = r.useCallback((x, y) => {
|
|
32
|
+
i(y), l == null || l(x, y);
|
|
33
|
+
}, [l, i]), {
|
|
33
34
|
subitems: m,
|
|
34
|
-
contextValue:
|
|
35
|
-
} =
|
|
35
|
+
contextValue: h
|
|
36
|
+
} = M(), p = r.useRef(() => {
|
|
36
37
|
}), f = r.useCallback((x) => {
|
|
37
38
|
var y;
|
|
38
39
|
return (y = m.get(x)) == null ? void 0 : y.id;
|
|
@@ -44,12 +45,12 @@ function ne(s) {
|
|
|
44
45
|
direction: c,
|
|
45
46
|
getTabId: b,
|
|
46
47
|
getTabPanelId: f,
|
|
47
|
-
onSelected:
|
|
48
|
-
orientation:
|
|
48
|
+
onSelected: u,
|
|
49
|
+
orientation: a,
|
|
49
50
|
registerTabIdLookup: P,
|
|
50
|
-
selectionFollowsFocus:
|
|
51
|
+
selectionFollowsFocus: n,
|
|
51
52
|
value: d
|
|
52
|
-
},
|
|
53
|
+
}, h)
|
|
53
54
|
};
|
|
54
55
|
}
|
|
55
56
|
function le(s) {
|
|
@@ -57,32 +58,32 @@ function le(s) {
|
|
|
57
58
|
value: e,
|
|
58
59
|
children: o
|
|
59
60
|
} = s, {
|
|
60
|
-
direction:
|
|
61
|
-
getItemIndex:
|
|
61
|
+
direction: l,
|
|
62
|
+
getItemIndex: a,
|
|
62
63
|
onSelected: c,
|
|
63
|
-
orientation:
|
|
64
|
+
orientation: n,
|
|
64
65
|
registerItem: d,
|
|
65
|
-
registerTabIdLookup:
|
|
66
|
-
selectionFollowsFocus:
|
|
66
|
+
registerTabIdLookup: i,
|
|
67
|
+
selectionFollowsFocus: u,
|
|
67
68
|
totalSubitemCount: m,
|
|
68
|
-
value:
|
|
69
|
+
value: h,
|
|
69
70
|
getTabId: p,
|
|
70
71
|
getTabPanelId: f
|
|
71
72
|
} = e, b = r.useMemo(() => ({
|
|
72
|
-
getItemIndex:
|
|
73
|
+
getItemIndex: a,
|
|
73
74
|
registerItem: d,
|
|
74
75
|
totalSubitemCount: m
|
|
75
|
-
}), [d,
|
|
76
|
-
direction:
|
|
76
|
+
}), [d, a, m]), P = r.useMemo(() => ({
|
|
77
|
+
direction: l,
|
|
77
78
|
getTabId: p,
|
|
78
79
|
getTabPanelId: f,
|
|
79
80
|
onSelected: c,
|
|
80
|
-
orientation:
|
|
81
|
-
registerTabIdLookup:
|
|
82
|
-
selectionFollowsFocus:
|
|
83
|
-
value:
|
|
84
|
-
}), [
|
|
85
|
-
return /* @__PURE__ */ T(
|
|
81
|
+
orientation: n,
|
|
82
|
+
registerTabIdLookup: i,
|
|
83
|
+
selectionFollowsFocus: u,
|
|
84
|
+
value: h
|
|
85
|
+
}), [l, p, f, c, n, i, u, h]);
|
|
86
|
+
return /* @__PURE__ */ T(O.Provider, {
|
|
86
87
|
value: b,
|
|
87
88
|
children: /* @__PURE__ */ T(G.Provider, {
|
|
88
89
|
value: P,
|
|
@@ -96,24 +97,24 @@ const re = ["children", "value", "defaultValue", "orientation", "direction", "on
|
|
|
96
97
|
} = s;
|
|
97
98
|
return N({
|
|
98
99
|
root: ["root", e]
|
|
99
|
-
},
|
|
100
|
-
},
|
|
101
|
-
var
|
|
100
|
+
}, w(se));
|
|
101
|
+
}, S = /* @__PURE__ */ r.forwardRef(function(e, o) {
|
|
102
|
+
var l;
|
|
102
103
|
const {
|
|
103
|
-
children:
|
|
104
|
+
children: a,
|
|
104
105
|
orientation: c = "horizontal",
|
|
105
|
-
direction:
|
|
106
|
+
direction: n = "ltr",
|
|
106
107
|
slotProps: d = {},
|
|
107
|
-
slots:
|
|
108
|
-
} = e,
|
|
108
|
+
slots: i = {}
|
|
109
|
+
} = e, u = F(e, re), m = C({}, e, {
|
|
109
110
|
orientation: c,
|
|
110
|
-
direction:
|
|
111
|
+
direction: n
|
|
111
112
|
}), {
|
|
112
|
-
contextValue:
|
|
113
|
-
} = ne(m), p = ae(m), f = (
|
|
113
|
+
contextValue: h
|
|
114
|
+
} = ne(m), p = ae(m), f = (l = i.root) != null ? l : "div", b = $({
|
|
114
115
|
elementType: f,
|
|
115
116
|
externalSlotProps: d.root,
|
|
116
|
-
externalForwardedProps:
|
|
117
|
+
externalForwardedProps: u,
|
|
117
118
|
additionalProps: {
|
|
118
119
|
ref: o
|
|
119
120
|
},
|
|
@@ -122,12 +123,12 @@ const re = ["children", "value", "defaultValue", "orientation", "direction", "on
|
|
|
122
123
|
});
|
|
123
124
|
return /* @__PURE__ */ T(f, C({}, b, {
|
|
124
125
|
children: /* @__PURE__ */ T(le, {
|
|
125
|
-
value:
|
|
126
|
-
children:
|
|
126
|
+
value: h,
|
|
127
|
+
children: a
|
|
127
128
|
})
|
|
128
129
|
}));
|
|
129
130
|
});
|
|
130
|
-
process.env.NODE_ENV !== "production" && (
|
|
131
|
+
process.env.NODE_ENV !== "production" && (S.propTypes = {
|
|
131
132
|
// ┌────────────────────────────── Warning ──────────────────────────────┐
|
|
132
133
|
// │ These PropTypes are generated from the TypeScript type definitions. │
|
|
133
134
|
// │ To update them, edit the TypeScript types and run `pnpm proptypes`. │
|
|
@@ -199,7 +200,7 @@ function ue(s, e) {
|
|
|
199
200
|
});
|
|
200
201
|
const o = ee(s, e), {
|
|
201
202
|
context: {
|
|
202
|
-
selectionFollowsFocus:
|
|
203
|
+
selectionFollowsFocus: l
|
|
203
204
|
}
|
|
204
205
|
} = e;
|
|
205
206
|
if (e.type === Y.itemsChange) {
|
|
@@ -209,7 +210,7 @@ function ue(s, e) {
|
|
|
209
210
|
});
|
|
210
211
|
te(null, "reset", e.context);
|
|
211
212
|
}
|
|
212
|
-
return
|
|
213
|
+
return l && o.highlightedValue != null ? C({}, o, {
|
|
213
214
|
selectedValues: [o.highlightedValue]
|
|
214
215
|
}) : o;
|
|
215
216
|
}
|
|
@@ -218,37 +219,37 @@ function ce(s) {
|
|
|
218
219
|
const {
|
|
219
220
|
rootRef: o
|
|
220
221
|
} = s, {
|
|
221
|
-
direction:
|
|
222
|
-
onSelected:
|
|
222
|
+
direction: l = "ltr",
|
|
223
|
+
onSelected: a,
|
|
223
224
|
orientation: c = "horizontal",
|
|
224
|
-
value:
|
|
225
|
+
value: n,
|
|
225
226
|
registerTabIdLookup: d,
|
|
226
|
-
selectionFollowsFocus:
|
|
227
|
+
selectionFollowsFocus: i
|
|
227
228
|
} = J(), {
|
|
228
|
-
subitems:
|
|
229
|
+
subitems: u,
|
|
229
230
|
contextValue: m
|
|
230
|
-
} =
|
|
231
|
+
} = M(), h = r.useCallback((g) => {
|
|
231
232
|
var v;
|
|
232
|
-
return (v =
|
|
233
|
-
}, [
|
|
234
|
-
d(
|
|
235
|
-
const p = r.useMemo(() => Array.from(
|
|
233
|
+
return (v = u.get(g)) == null ? void 0 : v.id;
|
|
234
|
+
}, [u]);
|
|
235
|
+
d(h);
|
|
236
|
+
const p = r.useMemo(() => Array.from(u.keys()), [u]), f = r.useCallback((g) => {
|
|
236
237
|
var v, V;
|
|
237
|
-
return
|
|
238
|
-
}, [
|
|
238
|
+
return g == null ? null : (v = (V = u.get(g)) == null ? void 0 : V.ref.current) != null ? v : null;
|
|
239
|
+
}, [u]), b = l === "rtl";
|
|
239
240
|
let P;
|
|
240
241
|
c === "vertical" ? P = "vertical" : P = b ? "horizontal-rtl" : "horizontal-ltr";
|
|
241
|
-
const x = r.useCallback((
|
|
242
|
+
const x = r.useCallback((g, v) => {
|
|
242
243
|
var V;
|
|
243
|
-
|
|
244
|
-
}, [
|
|
245
|
-
selectedValues: [
|
|
244
|
+
a(g, (V = v[0]) != null ? V : null);
|
|
245
|
+
}, [a]), y = r.useMemo(() => n === void 0 ? {} : n != null ? {
|
|
246
|
+
selectedValues: [n]
|
|
246
247
|
} : {
|
|
247
248
|
selectedValues: []
|
|
248
|
-
}, [
|
|
249
|
+
}, [n]), U = r.useCallback((g) => {
|
|
249
250
|
var v, V;
|
|
250
|
-
return (v = (V =
|
|
251
|
-
}, [
|
|
251
|
+
return (v = (V = u.get(g)) == null ? void 0 : V.disabled) != null ? v : !1;
|
|
252
|
+
}, [u]), {
|
|
252
253
|
contextValue: L,
|
|
253
254
|
dispatch: R,
|
|
254
255
|
getRootProps: D,
|
|
@@ -259,7 +260,7 @@ function ce(s) {
|
|
|
259
260
|
rootRef: K
|
|
260
261
|
} = oe({
|
|
261
262
|
controlledProps: y,
|
|
262
|
-
disabledItemsFocusable: !
|
|
263
|
+
disabledItemsFocusable: !i,
|
|
263
264
|
focusManagement: "DOM",
|
|
264
265
|
getItemDomElement: f,
|
|
265
266
|
isItemDisabled: U,
|
|
@@ -268,18 +269,18 @@ function ce(s) {
|
|
|
268
269
|
onChange: x,
|
|
269
270
|
orientation: P,
|
|
270
271
|
reducerActionContext: r.useMemo(() => ({
|
|
271
|
-
selectionFollowsFocus:
|
|
272
|
-
}), [
|
|
272
|
+
selectionFollowsFocus: i || !1
|
|
273
|
+
}), [i]),
|
|
273
274
|
selectionMode: "single",
|
|
274
275
|
stateReducer: ue
|
|
275
276
|
});
|
|
276
277
|
r.useEffect(() => {
|
|
277
|
-
|
|
278
|
+
n !== void 0 && n != null && R({
|
|
278
279
|
type: z.valueChange,
|
|
279
|
-
value:
|
|
280
|
+
value: n
|
|
280
281
|
});
|
|
281
|
-
}, [R,
|
|
282
|
-
const W = (
|
|
282
|
+
}, [R, n]);
|
|
283
|
+
const W = (g = {}) => C({}, g, D(g), {
|
|
283
284
|
"aria-orientation": c === "vertical" ? "vertical" : void 0,
|
|
284
285
|
role: "tablist"
|
|
285
286
|
});
|
|
@@ -299,24 +300,24 @@ function de(s) {
|
|
|
299
300
|
value: e,
|
|
300
301
|
children: o
|
|
301
302
|
} = s, {
|
|
302
|
-
dispatch:
|
|
303
|
-
getItemIndex:
|
|
303
|
+
dispatch: l,
|
|
304
|
+
getItemIndex: a,
|
|
304
305
|
getItemState: c,
|
|
305
|
-
registerItem:
|
|
306
|
+
registerItem: n,
|
|
306
307
|
totalSubitemCount: d
|
|
307
|
-
} = e,
|
|
308
|
-
dispatch:
|
|
308
|
+
} = e, i = r.useMemo(() => ({
|
|
309
|
+
dispatch: l,
|
|
309
310
|
getItemState: c,
|
|
310
|
-
getItemIndex:
|
|
311
|
-
}), [
|
|
312
|
-
getItemIndex:
|
|
313
|
-
registerItem:
|
|
311
|
+
getItemIndex: a
|
|
312
|
+
}), [l, a, c]), u = r.useMemo(() => ({
|
|
313
|
+
getItemIndex: a,
|
|
314
|
+
registerItem: n,
|
|
314
315
|
totalSubitemCount: d
|
|
315
|
-
}), [
|
|
316
|
-
return /* @__PURE__ */ T(
|
|
317
|
-
value:
|
|
316
|
+
}), [n, a, d]);
|
|
317
|
+
return /* @__PURE__ */ T(O.Provider, {
|
|
318
|
+
value: u,
|
|
318
319
|
children: /* @__PURE__ */ T(Z.Provider, {
|
|
319
|
-
value:
|
|
320
|
+
value: i,
|
|
320
321
|
children: o
|
|
321
322
|
})
|
|
322
323
|
});
|
|
@@ -327,24 +328,24 @@ const me = ["children", "slotProps", "slots"], pe = (s) => {
|
|
|
327
328
|
} = s;
|
|
328
329
|
return N({
|
|
329
330
|
root: ["root", e]
|
|
330
|
-
},
|
|
331
|
+
}, w(ie));
|
|
331
332
|
}, A = /* @__PURE__ */ r.forwardRef(function(e, o) {
|
|
332
|
-
var
|
|
333
|
+
var l;
|
|
333
334
|
const {
|
|
334
|
-
children:
|
|
335
|
+
children: a,
|
|
335
336
|
slotProps: c = {},
|
|
336
|
-
slots:
|
|
337
|
+
slots: n = {}
|
|
337
338
|
} = e, d = F(e, me), {
|
|
338
|
-
isRtl:
|
|
339
|
-
orientation:
|
|
339
|
+
isRtl: i,
|
|
340
|
+
orientation: u,
|
|
340
341
|
getRootProps: m,
|
|
341
|
-
contextValue:
|
|
342
|
+
contextValue: h
|
|
342
343
|
} = ce({
|
|
343
344
|
rootRef: o
|
|
344
345
|
}), p = C({}, e, {
|
|
345
|
-
isRtl:
|
|
346
|
-
orientation:
|
|
347
|
-
}), f = pe(p), b = (
|
|
346
|
+
isRtl: i,
|
|
347
|
+
orientation: u
|
|
348
|
+
}), f = pe(p), b = (l = n.root) != null ? l : "div", P = $({
|
|
348
349
|
elementType: b,
|
|
349
350
|
getSlotProps: m,
|
|
350
351
|
externalSlotProps: c.root,
|
|
@@ -353,9 +354,9 @@ const me = ["children", "slotProps", "slots"], pe = (s) => {
|
|
|
353
354
|
className: f.root
|
|
354
355
|
});
|
|
355
356
|
return /* @__PURE__ */ T(de, {
|
|
356
|
-
value:
|
|
357
|
+
value: h,
|
|
357
358
|
children: /* @__PURE__ */ T(b, C({}, P, {
|
|
358
|
-
children:
|
|
359
|
+
children: a
|
|
359
360
|
}))
|
|
360
361
|
});
|
|
361
362
|
});
|
|
@@ -388,14 +389,16 @@ process.env.NODE_ENV !== "production" && (A.propTypes = {
|
|
|
388
389
|
root: t.elementType
|
|
389
390
|
})
|
|
390
391
|
});
|
|
391
|
-
const
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
});
|
|
392
|
+
const ye = q(
|
|
393
|
+
({ value: s, className: e, "data-testid": o, children: l, onChange: a }, c) => {
|
|
394
|
+
const n = (d, i) => {
|
|
395
|
+
a && a(i, d);
|
|
396
|
+
};
|
|
397
|
+
return /* @__PURE__ */ T(S, { "data-testid": o, value: s, onChange: (d, i) => n(d, i), ref: c, children: /* @__PURE__ */ T(A, { className: B(Q.tabs, e), children: l }) });
|
|
398
|
+
}
|
|
399
|
+
);
|
|
397
400
|
export {
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
+
Ie as Tab,
|
|
402
|
+
Fe as TabPanel,
|
|
403
|
+
ye as Tabs
|
|
401
404
|
};
|