@solostylist/ui-kit 1.0.212 → 1.0.213

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.
@@ -26,9 +26,11 @@ export interface SNavItemProps {
26
26
  sx?: SxProps<Theme>;
27
27
  /** Additional SX overrides for the inner anchor/div (useful for padding-left on nested items) */
28
28
  innerSx?: SxProps<Theme>;
29
+ /** Additional SX overrides for the title Typography */
30
+ titleSx?: SxProps<Theme>;
29
31
  }
30
32
  export declare const SNavItem: {
31
- ({ active, disabled, external, href, icon, onClick, rightAction, title, component, sx, innerSx, }: Readonly<SNavItemProps>): React.JSX.Element;
33
+ ({ active, disabled, external, href, icon, onClick, rightAction, title, component, sx, innerSx, titleSx, }: Readonly<SNavItemProps>): React.JSX.Element;
32
34
  displayName: string;
33
35
  };
34
36
  export default SNavItem;
@@ -4,7 +4,7 @@ import { t } from "../Typography-Ci004UCT.js";
4
4
  import "react";
5
5
  import { jsx as n, jsxs as r } from "react/jsx-runtime";
6
6
  //#region lib/s-nav-item/s-nav-item.tsx
7
- var i = ({ active: i, disabled: a, external: o, href: s, icon: c, onClick: l, rightAction: u, title: d, component: f, sx: p, innerSx: m }) => /* @__PURE__ */ n(e, {
7
+ var i = ({ active: i, disabled: a, external: o, href: s, icon: c, onClick: l, rightAction: u, title: d, component: f, sx: p, innerSx: m, titleSx: h }) => /* @__PURE__ */ n(e, {
8
8
  component: "li",
9
9
  sx: {
10
10
  userSelect: "none",
@@ -62,7 +62,7 @@ var i = ({ active: i, disabled: a, external: o, href: s, icon: c, onClick: l, ri
62
62
  children: c
63
63
  }) : null, /* @__PURE__ */ n(t, {
64
64
  component: "span",
65
- sx: { fontWeight: 500 },
65
+ sx: { ...h },
66
66
  children: d
67
67
  })]
68
68
  }), u ? /* @__PURE__ */ n(e, {
@@ -33,23 +33,29 @@ export interface SNavItemsProps {
33
33
  pathname?: string;
34
34
  /** Depth level, used internally for recursive rendering */
35
35
  depth?: number;
36
+ /**
37
+ * Default link component for all items (e.g., React Router Link).
38
+ * Can be overridden per-item via `SNavItemConfig.component`.
39
+ */
40
+ component?: React.ElementType;
36
41
  }
37
42
  interface SNavGroupItemProps {
38
43
  item: SNavItemConfig;
39
44
  pathname: string;
40
45
  depth: number;
46
+ component?: React.ElementType;
41
47
  }
42
48
  /**
43
49
  * Renders a single navigation entry — either a leaf link or a collapsible group with children.
44
50
  */
45
- export declare function SNavGroupItem({ item, pathname, depth }: SNavGroupItemProps): React.JSX.Element;
51
+ export declare function SNavGroupItem({ item, pathname, depth, component }: SNavGroupItemProps): React.JSX.Element;
46
52
  export declare namespace SNavGroupItem {
47
53
  var displayName: string;
48
54
  }
49
55
  /**
50
56
  * Renders a list of navigation items, supporting nested collapsible groups.
51
57
  */
52
- export declare function SNavItems({ items, pathname, depth }: SNavItemsProps): React.JSX.Element;
58
+ export declare function SNavItems({ items, pathname, depth, component }: SNavItemsProps): React.JSX.Element;
53
59
  export declare namespace SNavItems {
54
60
  var displayName: string;
55
61
  }
@@ -11,21 +11,21 @@ import { jsx as s, jsxs as c } from "react/jsx-runtime";
11
11
  function l(e, t) {
12
12
  return e.some((e) => e.href && (t === e.href || t.startsWith(e.href + "/")) ? !0 : e.items ? l(e.items, t) : !1);
13
13
  }
14
- function u({ item: t, pathname: u, depth: f }) {
15
- let p = !!(t.items && t.items.length > 0), m = t.href ? u === t.href || u.startsWith(t.href + "/") : !1, h = p ? l(t.items, u) : !1, [g, _] = o.useState(t.defaultOpen ?? h);
14
+ function u({ item: t, pathname: u, depth: f, component: p }) {
15
+ let m = !!(t.items && t.items.length > 0), h = t.href ? u === t.href || u.startsWith(t.href + "/") : !1, g = m ? l(t.items, u) : !1, [_, v] = o.useState(t.defaultOpen ?? g);
16
16
  if (o.useEffect(() => {
17
- h && _(!0);
18
- }, [h]), !p) return /* @__PURE__ */ s(a, {
19
- active: m,
17
+ g && v(!0);
18
+ }, [g]), !m) return /* @__PURE__ */ s(a, {
19
+ active: h,
20
20
  disabled: t.disabled,
21
21
  external: t.external,
22
22
  href: t.href,
23
- component: t.component,
24
- icon: t.icon ? t.icon(m) : null,
23
+ component: t.component ?? p,
24
+ icon: t.icon ? t.icon(h) : null,
25
25
  title: t.title,
26
26
  innerSx: f > 0 ? { pl: `${(f - 1) * 12 + 12}px` } : void 0
27
27
  });
28
- let v = m || h;
28
+ let y = h || g;
29
29
  return /* @__PURE__ */ c(e, {
30
30
  component: "li",
31
31
  sx: {
@@ -34,11 +34,11 @@ function u({ item: t, pathname: u, depth: f }) {
34
34
  },
35
35
  children: [/* @__PURE__ */ c(e, {
36
36
  role: "button",
37
- onClick: () => _((e) => !e),
37
+ onClick: () => v((e) => !e),
38
38
  sx: {
39
39
  alignItems: "center",
40
40
  borderRadius: 1,
41
- color: v ? "var(--s-palette-text-primary)" : "var(--s-palette-text-secondary)",
41
+ color: y ? "var(--s-palette-text-primary)" : "var(--s-palette-text-secondary)",
42
42
  cursor: t.disabled ? "not-allowed" : "pointer",
43
43
  display: "flex",
44
44
  flex: "0 0 auto",
@@ -49,15 +49,15 @@ function u({ item: t, pathname: u, depth: f }) {
49
49
  textDecoration: "none",
50
50
  whiteSpace: "nowrap",
51
51
  ...t.disabled && { color: "var(--s-palette-text-disabled)" },
52
- ...v && { bgcolor: "var(--s-palette-action-selected)" },
53
- "&:hover": { ...!v && !t.disabled && {
52
+ ...y && { bgcolor: "var(--s-palette-action-selected)" },
53
+ "&:hover": { ...!y && !t.disabled && {
54
54
  bgcolor: "var(--s-palette-action-hover)",
55
55
  color: "var(--s-palette-text-primary)"
56
56
  } }
57
57
  },
58
58
  tabIndex: 0,
59
59
  onKeyDown: (e) => {
60
- (e.key === "Enter" || e.key === " ") && (e.preventDefault(), _((e) => !e));
60
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), v((e) => !e));
61
61
  },
62
62
  children: [/* @__PURE__ */ c(e, {
63
63
  sx: {
@@ -72,7 +72,7 @@ function u({ item: t, pathname: u, depth: f }) {
72
72
  alignItems: "center",
73
73
  justifyContent: "center"
74
74
  },
75
- children: t.icon(v)
75
+ children: t.icon(y)
76
76
  }) : null, /* @__PURE__ */ s(n, {
77
77
  component: "span",
78
78
  sx: {
@@ -88,18 +88,18 @@ function u({ item: t, pathname: u, depth: f }) {
88
88
  alignItems: "center",
89
89
  color: "var(--s-palette-text-secondary)",
90
90
  transition: "transform 200ms ease",
91
- transform: g ? "rotate(0deg)" : "rotate(-90deg)"
91
+ transform: _ ? "rotate(0deg)" : "rotate(-90deg)"
92
92
  },
93
93
  children: /* @__PURE__ */ s(r, {})
94
94
  })]
95
95
  }), /* @__PURE__ */ s(i, {
96
- in: g,
96
+ in: _,
97
97
  timeout: 200,
98
98
  unmountOnExit: !0,
99
99
  children: /* @__PURE__ */ s(e, {
100
100
  sx: {
101
101
  borderLeft: "2px solid var(--s-palette-divider)",
102
- ml: f > 0 ? `${f * 16 + 24}px` : "24px",
102
+ ml: f > 0 ? `${f * 16 + 12}px` : "12px",
103
103
  mt: 1,
104
104
  mb: 1,
105
105
  pl: 1
@@ -107,14 +107,15 @@ function u({ item: t, pathname: u, depth: f }) {
107
107
  children: /* @__PURE__ */ s(d, {
108
108
  items: t.items,
109
109
  pathname: u,
110
- depth: f + 1
110
+ depth: f + 1,
111
+ component: p
111
112
  })
112
113
  })
113
114
  })]
114
115
  });
115
116
  }
116
117
  u.displayName = "SNavGroupItem";
117
- function d({ items: e, pathname: n = "", depth: r = 0 }) {
118
+ function d({ items: e, pathname: n = "", depth: r = 0, component: i }) {
118
119
  return /* @__PURE__ */ s(t, {
119
120
  component: "ul",
120
121
  spacing: 1,
@@ -126,7 +127,8 @@ function d({ items: e, pathname: n = "", depth: r = 0 }) {
126
127
  children: e.map((e) => /* @__PURE__ */ s(u, {
127
128
  item: e,
128
129
  pathname: n,
129
- depth: r
130
+ depth: r,
131
+ component: i
130
132
  }, e.key))
131
133
  });
132
134
  }
package/package.json CHANGED
@@ -3,7 +3,7 @@
3
3
  "publishConfig": {
4
4
  "registry": "https://registry.npmjs.org"
5
5
  },
6
- "version": "1.0.212",
6
+ "version": "1.0.213",
7
7
  "description": "advanced ui kit for solostylist",
8
8
  "type": "module",
9
9
  "main": "dist/main.js",