@solostylist/ui-kit 1.0.193 → 1.0.194
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/s-tabs/s-tabs.d.ts +3 -3
- package/dist/s-tabs/s-tabs.js +11 -11
- package/package.json +1 -1
package/dist/s-tabs/s-tabs.d.ts
CHANGED
|
@@ -7,9 +7,9 @@ export interface STabsProps extends Omit<TabsProps, 'children'> {
|
|
|
7
7
|
/** Array of tab configuration objects defining the tabs to display */
|
|
8
8
|
tabs: STabItem[];
|
|
9
9
|
/** Index of the currently active tab. Set to false for uncontrolled mode */
|
|
10
|
-
activeTab?: number | false;
|
|
10
|
+
activeTab?: number | string | false;
|
|
11
11
|
/** Callback function called when a tab is selected */
|
|
12
|
-
onTabChange?: (event: React.SyntheticEvent, value: number) => void;
|
|
12
|
+
onTabChange?: (event: React.SyntheticEvent, value: number | string) => void;
|
|
13
13
|
/** Tab panel content. Children are matched to tabs by index */
|
|
14
14
|
children?: React.ReactNode;
|
|
15
15
|
/** Additional props passed to the tab panel wrapper Box component */
|
|
@@ -22,7 +22,7 @@ export interface STabItem {
|
|
|
22
22
|
/** The content displayed in the tab */
|
|
23
23
|
label: React.ReactNode;
|
|
24
24
|
/** Custom value for the tab. If not provided, uses the tab index */
|
|
25
|
-
value?: number;
|
|
25
|
+
value?: number | string;
|
|
26
26
|
/** Whether the tab is disabled and cannot be selected */
|
|
27
27
|
disabled?: boolean;
|
|
28
28
|
/** Icon element to display in the tab */
|
package/dist/s-tabs/s-tabs.js
CHANGED
|
@@ -1,16 +1,16 @@
|
|
|
1
1
|
import { j as o } from "../jsx-runtime-tc70JA_2.js";
|
|
2
|
-
import
|
|
3
|
-
import { Tabs as g, Tab as y, Box as
|
|
2
|
+
import l, { forwardRef as j } from "react";
|
|
3
|
+
import { Tabs as g, Tab as y, Box as p } from "@mui/material";
|
|
4
4
|
const C = j(
|
|
5
|
-
({ tabs:
|
|
6
|
-
const [
|
|
7
|
-
|
|
8
|
-
s !== !1 &&
|
|
5
|
+
({ tabs: r, activeTab: s = 0, onTabChange: c, children: i, tabPanelProps: u, ...a }, m) => {
|
|
6
|
+
const [t, d] = l.useState(s);
|
|
7
|
+
l.useEffect(() => {
|
|
8
|
+
s !== !1 && d(s);
|
|
9
9
|
}, [s]);
|
|
10
10
|
const x = (e, n) => {
|
|
11
|
-
s === !1 &&
|
|
12
|
-
}, h = a.orientation === "vertical",
|
|
13
|
-
/* @__PURE__ */ o.jsx(g, { ref:
|
|
11
|
+
s === !1 && d(n), c?.(e, n);
|
|
12
|
+
}, h = a.orientation === "vertical", f = /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
13
|
+
/* @__PURE__ */ o.jsx(g, { ref: m, value: t, onChange: x, ...a, children: r.map((e, n) => /* @__PURE__ */ o.jsx(
|
|
14
14
|
y,
|
|
15
15
|
{
|
|
16
16
|
label: e.label,
|
|
@@ -23,9 +23,9 @@ const C = j(
|
|
|
23
23
|
},
|
|
24
24
|
n
|
|
25
25
|
)) }),
|
|
26
|
-
|
|
26
|
+
i && /* @__PURE__ */ o.jsx(p, { role: "tabpanel", padding: 2, ...u, children: l.Children.toArray(i)[r.findIndex((e, n) => (e.value ?? n) === t)] })
|
|
27
27
|
] });
|
|
28
|
-
return h ? /* @__PURE__ */ o.jsx(
|
|
28
|
+
return h ? /* @__PURE__ */ o.jsx(p, { display: "flex", children: f }) : f;
|
|
29
29
|
}
|
|
30
30
|
);
|
|
31
31
|
C.displayName = "STabs";
|