@solostylist/ui-kit 1.0.193 → 1.0.195

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.
@@ -6,10 +6,10 @@ import { BoxProps } from '@mui/material';
6
6
  export interface STabPanelProps extends BoxProps {
7
7
  /** Content to display in the tab panel */
8
8
  children?: React.ReactNode;
9
- /** Index of this specific tab panel (0-based) */
10
- index: number;
11
- /** Current active tab index from the parent tabs component */
12
- value: number;
9
+ /** Index (or value) of this specific tab panel */
10
+ index: number | string;
11
+ /** Current active tab index (or value) from the parent tabs component */
12
+ value: number | string;
13
13
  /** Keep the panel mounted in the DOM when not active */
14
14
  keepMounted?: boolean;
15
15
  }
@@ -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 */
@@ -1,16 +1,16 @@
1
1
  import { j as o } from "../jsx-runtime-tc70JA_2.js";
2
- import r, { forwardRef as j } from "react";
3
- import { Tabs as g, Tab as y, Box as f } from "@mui/material";
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: p, activeTab: s = 0, onTabChange: c, children: l, tabPanelProps: m, ...a }, u) => {
6
- const [i, t] = r.useState(s);
7
- r.useEffect(() => {
8
- s !== !1 && t(s);
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 && t(n), c?.(e, n);
12
- }, h = a.orientation === "vertical", d = /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
13
- /* @__PURE__ */ o.jsx(g, { ref: u, value: i, onChange: x, ...a, children: p.map((e, n) => /* @__PURE__ */ o.jsx(
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
- l && /* @__PURE__ */ o.jsx(f, { role: "tabpanel", padding: 2, ...m, children: r.Children.toArray(l)[i] })
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(f, { display: "flex", children: d }) : d;
28
+ return h ? /* @__PURE__ */ o.jsx(p, { display: "flex", children: f }) : f;
29
29
  }
30
30
  );
31
31
  C.displayName = "STabs";
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org"
5
5
  },
6
- "version": "1.0.193",
6
+ "version": "1.0.195",
7
7
  "description": "advanced ui kit for solostylist",
8
8
  "type": "module",
9
9
  "main": "dist/main.js",