@grasp-labs/ds-react-components 0.17.0 → 0.18.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.
@@ -1,43 +1,43 @@
1
1
  import { JSX, ReactElement, ReactNode } from 'react';
2
2
  /**
3
- * Represents a single route in the menu.
3
+ * Represents a single route in the sidebar.
4
4
  */
5
- export type MenuRoute = {
5
+ export type SidebarRoute = {
6
6
  /** Unique path of the route, used as key and for navigation */
7
7
  path: string;
8
- /** Display title of the menu item */
8
+ /** Display title of the sidebar item */
9
9
  title: string;
10
10
  /** Optional icon element to render next to the title */
11
11
  icon?: ReactNode;
12
12
  /** Nested children entries for submenus */
13
- children?: MenuRoute[];
13
+ children?: SidebarRoute[];
14
14
  /** Permissions required to display this route */
15
15
  permissions?: string[];
16
- /** Whether this route should be hidden from the menu */
17
- hideMenu?: boolean;
16
+ /** Whether this route should be hidden from the sidebar */
17
+ isHidden?: boolean;
18
18
  };
19
19
  /**
20
- * Props for the `Menu` component.
20
+ * Props for the `Sidebar` component.
21
21
  */
22
- export type MenuProps = {
23
- /** React element to display as the menu logo (e.g. an SVG component or img element) */
22
+ export type SidebarProps = {
23
+ /** React element to display as the sidebar logo (e.g. an SVG component or img element) */
24
24
  logo: ReactElement;
25
25
  /** Content to display in the footer */
26
26
  footerContent: React.ReactNode;
27
- /** Array of routes to display in the menu */
28
- routes: MenuRoute[];
27
+ /** Array of routes to display in the sidebar */
28
+ routes: SidebarRoute[];
29
29
  /** Current user permissions used to filter routes */
30
30
  permissions?: string[];
31
31
  /** Optional additional class names for styling */
32
32
  className?: string;
33
33
  };
34
34
  /**
35
- * `Menu` is a vertical navigation component that displays a header with a logo,
35
+ * `Sidebar` is a vertical navigation component that displays a header with a logo,
36
36
  * a list of navigable entries (filtered by permissions), and a footer.
37
37
  *
38
38
  * @example
39
39
  * ```tsx
40
- * <Menu
40
+ * <Sidebar
41
41
  * logo={<MyLogo />}
42
42
  * footerContent="© 2025 My Company"
43
43
  * routes={[
@@ -48,4 +48,4 @@ export type MenuProps = {
48
48
  * />
49
49
  * ```
50
50
  */
51
- export declare const Menu: ({ logo, footerContent, routes, permissions, className, }: MenuProps) => JSX.Element;
51
+ export declare const Sidebar: ({ logo, footerContent, routes, permissions, className, }: SidebarProps) => JSX.Element;
@@ -1,33 +1,33 @@
1
1
  import { JSX, ReactNode } from 'react';
2
2
  /**
3
- * Represents a child route/entry in the menu hierarchy.
3
+ * Represents a child route/entry in the sidebar hierarchy.
4
4
  */
5
- export type MenuChild = {
5
+ export type SidebarChild = {
6
6
  /** Unique path of the child entry (if navigable) */
7
7
  path?: string;
8
- /** Display title of the menu item */
8
+ /** Display title of the sidebar item */
9
9
  title: string;
10
- /** Optional icon for the menu item */
10
+ /** Optional icon for the sidebar item */
11
11
  icon?: ReactNode;
12
12
  /** Nested children for submenus */
13
- children?: MenuChild[];
13
+ children?: SidebarChild[];
14
14
  /** Required permissions for the entry */
15
15
  permissions?: string[];
16
- /** Whether this entry should be hidden from the menu */
17
- hideMenu?: boolean;
16
+ /** Whether this entry should be hidden from the sidebar */
17
+ isHidden?: boolean;
18
18
  };
19
19
  /**
20
- * Props for the `MenuEntry` component.
20
+ * Props for the `SidebarEntry` component.
21
21
  */
22
- export type MenuEntryProps = {
22
+ export type SidebarEntryProps = {
23
23
  /** Icon to display before the title */
24
24
  icon?: ReactNode;
25
- /** Title text of the menu item */
25
+ /** Title text of the sidebar item */
26
26
  title: string;
27
27
  /** Path used for navigation when clicked (ignored if it has children) */
28
28
  path?: string;
29
- /** Nested children menu entries */
30
- childrenEntries?: MenuChild[];
29
+ /** Nested children sidebar entries */
30
+ childrenEntries?: SidebarChild[];
31
31
  /** Current user permissions for filtering children */
32
32
  permissions?: string[];
33
33
  /** The currently active path to highlight the entry */
@@ -40,15 +40,15 @@ export type MenuEntryProps = {
40
40
  depth?: number;
41
41
  };
42
42
  /**
43
- * `MenuEntry` renders a single menu item.
43
+ * `SidebarEntry` renders a single sidebar item.
44
44
  *
45
45
  * - If the entry has children, it can expand/collapse to reveal them.
46
46
  * - If it has a `path`, clicking navigates to that path via `onNavigate`.
47
- * - Entries are filtered by `permissions` and `hideMenu` before rendering.
47
+ * - Entries are filtered by `permissions` and `isHidden` before rendering.
48
48
  *
49
49
  * @example
50
50
  * ```tsx
51
- * <MenuEntry
51
+ * <SidebarEntry
52
52
  * title="Settings"
53
53
  * path="/settings"
54
54
  * icon={<SettingsIcon />}
@@ -56,7 +56,7 @@ export type MenuEntryProps = {
56
56
  * onNavigate={(path) => console.log("Navigate to:", path)}
57
57
  * />
58
58
  *
59
- * <MenuEntry
59
+ * <SidebarEntry
60
60
  * title="Admin"
61
61
  * icon={<AdminIcon />}
62
62
  * childrenEntries={[
@@ -69,5 +69,5 @@ export type MenuEntryProps = {
69
69
  * />
70
70
  * ```
71
71
  */
72
- declare const MenuEntry: ({ icon, title, path, childrenEntries, permissions, className, activePath, onNavigate, depth, }: MenuEntryProps) => JSX.Element;
73
- export default MenuEntry;
72
+ declare const SidebarEntry: ({ icon, title, path, childrenEntries, permissions, className, activePath, onNavigate, depth, }: SidebarEntryProps) => JSX.Element;
73
+ export default SidebarEntry;
@@ -0,0 +1,11 @@
1
+ /**
2
+ * Barrel exports for the Sidebar system.
3
+ * Allows importing the main Sidebar component.
4
+ *
5
+ * @example
6
+ * ```tsx
7
+ * import { Sidebar } from "@/components/Sidebar";
8
+ * ```
9
+ */
10
+ export { Sidebar } from './Sidebar';
11
+ export type { SidebarProps, SidebarRoute } from './Sidebar';
@@ -4110,7 +4110,7 @@ const Ec = ({ status: e }) => {
4110
4110
  iconCancel: "var(--error)"
4111
4111
  }
4112
4112
  }, Tc = le(
4113
- () => import("./index.esm-B4HiWhze.js").then((e) => ({
4113
+ () => import("./index.esm-Dvqs323u.js").then((e) => ({
4114
4114
  default: e.JsonEditor
4115
4115
  }))
4116
4116
  );
@@ -4236,7 +4236,7 @@ const Ds = "EMPTY", Yt = ({
4236
4236
  onNavigate: i,
4237
4237
  depth: l = 0
4238
4238
  }) => {
4239
- const [c, d] = Ee(!1), u = Array.isArray(r) && r.length > 0, h = Ne(() => r ? r.filter((g) => g.hideMenu ? !1 : g.permissions && s ? g.permissions.some((O) => s.includes(O)) : !(g.permissions && !s)) : [], [r, s]), w = n && a && (a === n || a.startsWith(n + "/")), C = () => {
4239
+ const [c, d] = Ee(!1), u = Array.isArray(r) && r.length > 0, h = Ne(() => r ? r.filter((g) => g.isHidden ? !1 : g.permissions && s ? g.permissions.some((O) => s.includes(O)) : !(g.permissions && !s)) : [], [r, s]), w = n && a && (a === n || a.startsWith(n + "/")), C = () => {
4240
4240
  u ? d((g) => !g) : n && i && i(n);
4241
4241
  }, _ = (g) => {
4242
4242
  (g.key === "Enter" || g.key === " ") && (g.preventDefault(), C());
@@ -4289,7 +4289,7 @@ const Ds = "EMPTY", Yt = ({
4289
4289
  ] });
4290
4290
  };
4291
4291
  function jc(e, t) {
4292
- return e.filter((n) => n.hideMenu ? !1 : n.permissions && t ? n.permissions.some((r) => t.includes(r)) : !(n.permissions && !t));
4292
+ return e.filter((n) => n.isHidden ? !1 : n.permissions && t ? n.permissions.some((r) => t.includes(r)) : !(n.permissions && !t));
4293
4293
  }
4294
4294
  const Xh = ({
4295
4295
  logo: e,
@@ -11430,13 +11430,13 @@ export {
11430
11430
  Uh as J,
11431
11431
  Qu as K,
11432
11432
  Gh as L,
11433
- Xh as M,
11433
+ Qh as M,
11434
11434
  ed as N,
11435
11435
  rp as O,
11436
11436
  qu as P,
11437
11437
  Eo as Q,
11438
11438
  ep as R,
11439
- Gu as S,
11439
+ Xh as S,
11440
11440
  np as T,
11441
11441
  $u as U,
11442
11442
  op as V,
@@ -11511,8 +11511,8 @@ export {
11511
11511
  Ds as t,
11512
11512
  Yt as u,
11513
11513
  Zh as v,
11514
- Qh as w,
11515
- Dt as x,
11514
+ Dt as w,
11515
+ Gu as x,
11516
11516
  tp as y,
11517
11517
  Zu as z
11518
11518
  };
package/dist/index.d.ts CHANGED
@@ -17,7 +17,7 @@ export * from './components/iconButton';
17
17
  export * from './components/jsonEditor';
18
18
  export * from './components/list';
19
19
  export * from './components/logo';
20
- export * from './components/menu';
20
+ export * from './components/sidebar';
21
21
  export * from './components/multiSelect';
22
22
  export * from './components/popover';
23
23
  export * from './components/portal';
@@ -1,4 +1,4 @@
1
- import { j as o } from "./index-CTQbH0dg.js";
1
+ import { j as o } from "./index-B-Odpfhq.js";
2
2
  import { useState as G, useEffect as Oe, createContext as Xt, useRef as ce, useContext as Zt, useMemo as le, useCallback as Ie } from "react";
3
3
  const Be = (e, t, n, r, a) => {
4
4
  if (!r) throw new Error(a ?? `Invalid property path: ${t}
package/dist/index.js CHANGED
@@ -1,4 +1,4 @@
1
- import { A as e, b as o, B as n, a as l, c, d as r, a6 as t, C as i, y as I, a7 as d, e as u, f as C, a8 as g, a9 as b, aa as T, ab as h, ac as D, ad as F, ae as p, g as B, af as x, ag as E, a4 as P, ah as H, ai as L, D as S, h as m, i as v, t as w, aj as f, E as y, ak as O, al as R, k, am as A, ao as M, an as W, F as G, m as _, q, l as z, p as J, n as N, r as U, o as V, ap as Y, s as j, Y as K, Z as Q, _ as X, $ as Z, a0 as $, a1 as aa, aq as sa, ar as ea, I as oa, as as na, at as la, J as ca, a2 as ra, L as ta, u as ia, v as Ia, M as da, w as ua, G as Ca, au as ga, av as ba, P as Ta, x as ha, R as Da, aw as Fa, ax as pa, ay as Ba, az as xa, S as Ea, z as Pa, aA as Ha, aB as La, N as Sa, O as ma, T as va, aC as wa, H as fa, K as ya, aD as Oa, Q as Ra, U as ka, V as Aa, W as Ma, X as Wa, a3 as Ga, aE as _a, aF as qa, a5 as za, aG as Ja, aH as Na } from "./index-CTQbH0dg.js";
1
+ import { A as e, b as o, B as n, a as l, c, d as r, a6 as t, C as i, y as I, a7 as d, e as u, f as C, a8 as g, a9 as b, aa as T, ab as h, ac as D, ad as F, ae as p, g as B, af as x, ag as E, a4 as P, ah as S, ai as H, D as L, h as m, i as v, t as w, aj as f, E as y, ak as O, al as R, k, am as A, ao as M, an as W, F as G, m as _, q, l as z, p as J, n as N, r as U, o as V, ap as Y, s as j, Y as K, Z as Q, _ as X, $ as Z, a0 as $, a1 as aa, aq as sa, ar as ea, I as oa, as as na, at as la, J as ca, a2 as ra, L as ta, u as ia, v as Ia, M as da, G as ua, au as Ca, av as ga, P as ba, w as Ta, R as ha, aw as Da, ax as Fa, ay as pa, az as Ba, x as xa, S as Ea, z as Pa, aA as Sa, aB as Ha, N as La, O as ma, T as va, aC as wa, H as fa, K as ya, aD as Oa, Q as Ra, U as ka, V as Aa, W as Ma, X as Wa, a3 as Ga, aE as _a, aF as qa, a5 as za, aG as Ja, aH as Na } from "./index-B-Odpfhq.js";
2
2
  export {
3
3
  e as Alert,
4
4
  o as AnimatedList,
@@ -23,9 +23,9 @@ export {
23
23
  x as DashIcon,
24
24
  E as DatabaseIcon,
25
25
  P as DatePicker,
26
- H as DeleteIcon,
27
- L as DetailsIcon,
28
- S as Dialog,
26
+ S as DeleteIcon,
27
+ H as DetailsIcon,
28
+ L as Dialog,
29
29
  m as Drawer,
30
30
  v as DynamicIcon,
31
31
  w as EMPTY_OPTION_ID,
@@ -63,23 +63,23 @@ export {
63
63
  ta as List,
64
64
  ia as ListItem,
65
65
  Ia as Logo,
66
- da as Menu,
67
- ua as MultiSelect,
68
- Ca as Pagination,
69
- ga as PlayIcon,
70
- ba as PlusIcon,
71
- Ta as Popover,
72
- ha as Portal,
73
- Da as RadioButton,
74
- Fa as RecycleIcon,
75
- pa as ReloadIcon,
76
- Ba as SaveIcon,
77
- xa as SearchIcon,
78
- Ea as Select,
66
+ da as MultiSelect,
67
+ ua as Pagination,
68
+ Ca as PlayIcon,
69
+ ga as PlusIcon,
70
+ ba as Popover,
71
+ Ta as Portal,
72
+ ha as RadioButton,
73
+ Da as RecycleIcon,
74
+ Fa as ReloadIcon,
75
+ pa as SaveIcon,
76
+ Ba as SearchIcon,
77
+ xa as Select,
78
+ Ea as Sidebar,
79
79
  Pa as Spinner,
80
- Ha as SuccessFilledIcon,
81
- La as SuccessOutlinedIcon,
82
- Sa as Tab,
80
+ Sa as SuccessFilledIcon,
81
+ Ha as SuccessOutlinedIcon,
82
+ La as Tab,
83
83
  ma as TabPanel,
84
84
  va as Table,
85
85
  wa as TableArrowIcon,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@grasp-labs/ds-react-components",
3
- "version": "0.17.0",
3
+ "version": "0.18.0",
4
4
  "private": false,
5
5
  "license": "Apache-2.0",
6
6
  "type": "module",
@@ -1,11 +0,0 @@
1
- /**
2
- * Barrel exports for the Menu system.
3
- * Allows importing the main menu component.
4
- *
5
- * @example
6
- * ```tsx
7
- * import { Menu } from "@/components/Menu";
8
- * ```
9
- */
10
- export { Menu } from './Menu';
11
- export type { MenuProps, MenuRoute } from './Menu';