@schemavaults/ui 0.110.1 → 0.111.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.
Files changed (23) hide show
  1. package/dist/components/layout/dashboard-layout/DashboardLayoutProps.d.ts +26 -1
  2. package/dist/components/layout/dashboard-layout/dashboard-layout.d.ts +1 -1
  3. package/dist/components/layout/dashboard-layout/dashboard-layout.js +4 -3
  4. package/dist/components/layout/dashboard-layout/dashboard-layout.js.map +1 -1
  5. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.d.ts +24 -0
  6. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.js +32 -0
  7. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.js.map +1 -0
  8. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-indicator.d.ts +21 -0
  9. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-indicator.js +64 -0
  10. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-indicator.js.map +1 -0
  11. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.d.ts +32 -0
  12. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.js +62 -0
  13. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.js.map +1 -0
  14. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-renderer.js +32 -8
  15. package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-renderer.js.map +1 -1
  16. package/dist/components/layout/dashboard-layout/dashboard-sidebar/index.d.ts +2 -0
  17. package/dist/components/layout/dashboard-layout/dashboard-sidebar/index.js +2 -0
  18. package/dist/components/layout/dashboard-layout/dashboard-sidebar/index.js.map +1 -1
  19. package/dist/components/layout/dashboard-layout/index.d.ts +1 -0
  20. package/dist/components/layout/dashboard-layout/index.js +1 -0
  21. package/dist/components/layout/dashboard-layout/index.js.map +1 -1
  22. package/dist/types/Link.d.ts +6 -0
  23. package/package.json +2 -2
@@ -31,9 +31,34 @@ export interface DashboardLayoutProps extends PropsWithChildren {
31
31
  /**
32
32
  * Optional `usePathname` hook (e.g. from `next/navigation`). When provided,
33
33
  * the mobile sidebar will automatically close whenever the pathname
34
- * changes. Pass the hook itself, not its return value.
34
+ * changes, and the sidebar item for the current page is marked active (see
35
+ * `activeHref`). Pass the hook itself, not its return value.
35
36
  */
36
37
  usePathname?: () => string;
38
+ /**
39
+ * The pathname of the page currently being viewed, for marking its sidebar
40
+ * item as active. Takes precedence over `usePathname`; use it when the
41
+ * router does not expose a `usePathname`-style hook, or to pin the active
42
+ * item explicitly.
43
+ *
44
+ * An item is active when the current path equals its `url` or is nested
45
+ * beneath it (`/settings/billing` is within `/settings`). When several
46
+ * items match, the longest `url` wins, so only the most specific item
47
+ * lights up. The query string and fragment are ignored, and only
48
+ * root-relative `url`s (starting with `/`) take part.
49
+ *
50
+ * The active item gets a gradient wash, a glowing gradient bar down its
51
+ * left edge and a bold gradient label, running between the
52
+ * `--sidebar-active-start` and `--sidebar-active-end` tokens of
53
+ * `@schemavaults/theme`, which default to the SchemaVaults brand blue and
54
+ * brand red. Re-theme a deployment through the theme's overrides
55
+ * (`--sv-theme-light-sidebar-active-start`, `THEME_DARK_SIDEBAR_ACTIVE_END`,
56
+ * ...), or set the two tokens on an ancestor of the layout to re-colour
57
+ * just that subtree. Rows in an `adminOnly` group keep their red label and
58
+ * icon. The active link also gets
59
+ * `aria-current="page"` and its `<li>` `data-active="true"`.
60
+ */
61
+ activeHref?: string;
37
62
  /**
38
63
  * When `true`, the dashboard "chrome" (the left sidebar and the top header
39
64
  * bar) is hidden from printed output via `@media print`, so the system print
@@ -1,5 +1,5 @@
1
1
  import type { ReactElement } from "react";
2
2
  import type { DashboardLayoutProps } from "./DashboardLayoutProps";
3
3
  export type { DashboardLayoutProps };
4
- export declare function DashboardLayout({ children, wordmark, logo, Link, brandHref, topBarTitle, usePathname, printHidden, sidebarOpenWidth, reducedMotion, ...props }: DashboardLayoutProps): ReactElement;
4
+ export declare function DashboardLayout({ children, wordmark, logo, Link, brandHref, topBarTitle, usePathname, activeHref, printHidden, sidebarOpenWidth, reducedMotion, ...props }: DashboardLayoutProps): ReactElement;
5
5
  export default DashboardLayout;
@@ -1,6 +1,6 @@
1
1
  "use client";
2
2
  import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import DashboardSidebar, { DashboardLayoutSidebarTrigger, DashboardSidebarContextProvider, useCloseDashboardSidebarOnRouteChange, useDashboardSidebarOpenState, useDashboardSidebarSizing, DASHBOARD_SIDEBAR_OPEN_WIDTH_CSS_VARIABLE, } from "./dashboard-sidebar";
3
+ import DashboardSidebar, { DashboardLayoutSidebarTrigger, DashboardSidebarActiveItemFromPathnameHookProvider, DashboardSidebarActiveItemProvider, DashboardSidebarContextProvider, useCloseDashboardSidebarOnRouteChange, useDashboardSidebarOpenState, useDashboardSidebarSizing, DASHBOARD_SIDEBAR_OPEN_WIDTH_CSS_VARIABLE, } from "./dashboard-sidebar";
4
4
  import { Separator } from "../../ui/separator";
5
5
  import DashboardLayoutMainContentContainer from "./dashboard-layout-main-content-container";
6
6
  import { cn } from "../../../lib/utils";
@@ -21,7 +21,7 @@ function AutoCloseSidebarOnNavigation({ usePathname, }) {
21
21
  useCloseDashboardSidebarOnRouteChange(usePathname);
22
22
  return null;
23
23
  }
24
- export function DashboardLayout({ children, wordmark, logo, Link, brandHref, topBarTitle, usePathname, printHidden = false, sidebarOpenWidth, reducedMotion, ...props }) {
24
+ export function DashboardLayout({ children, wordmark, logo, Link, brandHref, topBarTitle, usePathname, activeHref, printHidden = false, sidebarOpenWidth, reducedMotion, ...props }) {
25
25
  const size = useDashboardSidebarSizing();
26
26
  // Resolved once, here, and published on the subtree through `MotionConfig`
27
27
  // below. Everything the layout animates — in CSS or in Framer Motion —
@@ -47,6 +47,7 @@ export function DashboardLayout({ children, wordmark, logo, Link, brandHref, top
47
47
  }
48
48
  }
49
49
  const TopBarButtonsComponent = props.topBarButtons;
50
+ const sidebar = (_jsx(DashboardSidebar, { wordmark: wordmark, Link: Link, brandHref: brandHref, logo: logo, sidebarFooterContent: props.sidebarFooterContent, className: cn(printHidden && "print:hidden") }));
50
51
  return (
51
52
  // Hands the resolved preference to every Framer Motion element inside the
52
53
  // layout — the sidebar's own `m.*` elements, and any the consumer renders
@@ -57,7 +58,7 @@ export function DashboardLayout({ children, wordmark, logo, Link, brandHref, top
57
58
  // When hiding chrome for print, let the container grow to fit all
58
59
  // page content across printed pages instead of clamping to the
59
60
  // on-screen viewport height.
60
- printHidden && "print:h-auto print:min-h-0"), style: containerStyle, children: [_jsx(DashboardSidebar, { wordmark: wordmark, Link: Link, brandHref: brandHref, logo: logo, sidebarFooterContent: props.sidebarFooterContent, className: cn(printHidden && "print:hidden") }), _jsxs(DashboardLayoutMainContentContainer, { printHidden: printHidden, children: [_jsx("header", { id: "dashboard-layout-main-content-header", className: cn("sticky top-0", "flex shrink-0 items-center gap-2", "transition-[width,height] ease-linear", reducedMotionClassName(reducedMotionSetting), "bg-background", "border-b border-border", size.sidebar_and_header_z_index_classname, printHidden && "print:hidden"), style: {
61
+ printHidden && "print:h-auto print:min-h-0"), style: containerStyle, children: [typeof usePathname === "function" ? (_jsx(DashboardSidebarActiveItemFromPathnameHookProvider, { usePathname: usePathname, currentPathname: activeHref, children: sidebar })) : (_jsx(DashboardSidebarActiveItemProvider, { currentPathname: activeHref, children: sidebar })), _jsxs(DashboardLayoutMainContentContainer, { printHidden: printHidden, children: [_jsx("header", { id: "dashboard-layout-main-content-header", className: cn("sticky top-0", "flex shrink-0 items-center gap-2", "transition-[width,height] ease-linear", reducedMotionClassName(reducedMotionSetting), "bg-background", "border-b border-border", size.sidebar_and_header_z_index_classname, printHidden && "print:hidden"), style: {
61
62
  height: size.header_height,
62
63
  }, children: _jsxs("div", { className: "flex flex-row justify-between items-center gap-2 px-4 w-full", children: [_jsx(DashboardLayoutSidebarTrigger, {}), _jsx(Separator, { orientation: "vertical", className: "mr-2 data-[orientation=vertical]:h-4" }), _jsx(HeaderBarPageIdentifierComponent, {}), _jsx("div", { role: "none", className: "grow" }), typeof TopBarButtonsComponent === "function" && (_jsx(TopBarButtonsComponent, { useDashboardSidebarSizing: useDashboardSidebarSizing, useDashboardSidebarOpenState: useDashboardSidebarOpenState, Link: Link }))] }) }), children] })] })] }) }));
63
64
  }
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-layout.js","sourceRoot":"","sources":["../../../../src/components/layout/dashboard-layout/dashboard-layout.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,gBAAgB,EAAE,EACvB,6BAA6B,EAC7B,+BAA+B,EAC/B,qCAAqC,EACrC,4BAA4B,EAC5B,yBAAyB,EACzB,yCAAyC,GAC1C,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,mCAAmC,MAAM,2CAA2C,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,sBAAsB,GAEvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,8CAA8C,EAAE,MAAM,mCAAmC,CAAC;AAInG;;;;;GAKG;AACH,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,0DAA0D;AAC1D,SAAS,4BAA4B,CAAC,EACpC,WAAW,GAGZ;IACC,qCAAqC,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,WAAW,EACX,WAAW,EACX,WA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Ae,eAAe,CAAC"}
1
+ {"version":3,"file":"dashboard-layout.js","sourceRoot":"","sources":["../../../../src/components/layout/dashboard-layout/dashboard-layout.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,gBAAgB,EAAE,EACvB,6BAA6B,EAC7B,kDAAkD,EAClD,kCAAkC,EAClC,+BAA+B,EAC/B,qCAAqC,EACrC,4BAA4B,EAC5B,yBAAyB,EACzB,yCAAyC,GAC1C,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,SAAS,EAAE,MAAM,2BAA2B,CAAC;AACtD,OAAO,mCAAmC,MAAM,2CAA2C,CAAC;AAE5F,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,YAAY,EAAE,MAAM,iBAAiB,CAAC;AAC/C,OAAO,EACL,sBAAsB,GAEvB,MAAM,mCAAmC,CAAC;AAC3C,OAAO,EAAE,8CAA8C,EAAE,MAAM,mCAAmC,CAAC;AAInG;;;;;GAKG;AACH,2EAA2E;AAC3E,2EAA2E;AAC3E,4EAA4E;AAC5E,0DAA0D;AAC1D,SAAS,4BAA4B,CAAC,EACpC,WAAW,GAGZ;IACC,qCAAqC,CAAC,WAAW,CAAC,CAAC;IACnD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,eAAe,CAAC,EAC9B,QAAQ,EACR,QAAQ,EACR,IAAI,EACJ,IAAI,EACJ,SAAS,EACT,WAAW,EACX,WAAW,EACX,UAAU,EACV,WAAW,GAAG,KAAK,EACnB,gBAAgB,EAChB,aAAa,EACb,GAAG,KAAK,EACa;IACrB,MAAM,IAAI,GAAG,yBAAyB,EAAE,CAAC;IAEzC,2EAA2E;IAC3E,uEAAuE;IACvE,4EAA4E;IAC5E,2BAA2B;IAC3B,MAAM,oBAAoB,GACxB,8CAA8C,CAAC,aAAa,CAAC,CAAC;IAEhE,uEAAuE;IACvE,4EAA4E;IAC5E,mEAAmE;IACnE,kEAAkE;IAClE,MA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,24 @@
1
+ import { type PropsWithChildren, type ReactElement } from "react";
2
+ import type { DashboardSidebarItemDefinition } from "./dashboard-sidebar-item-definition";
3
+ /**
4
+ * The normalized path of the menu item for the current page, or `null` when
5
+ * the current page is unknown or matches no item.
6
+ */
7
+ export declare const DashboardSidebarActiveItemContext: import("react").Context<string | null>;
8
+ export interface DashboardSidebarActiveItemProviderProps extends PropsWithChildren {
9
+ /** The current page's pathname (or full href). */
10
+ currentPathname?: string;
11
+ }
12
+ export declare function DashboardSidebarActiveItemProvider({ currentPathname, children, }: DashboardSidebarActiveItemProviderProps): ReactElement;
13
+ export interface DashboardSidebarActiveItemFromPathnameHookProviderProps extends DashboardSidebarActiveItemProviderProps {
14
+ usePathname: () => string;
15
+ }
16
+ /**
17
+ * Reads the current page from the consumer's `usePathname` hook. Kept as its
18
+ * own component so `DashboardLayout` can choose between this and the plain
19
+ * provider without calling a hook conditionally. An explicit
20
+ * `currentPathname` still wins over the hook's value.
21
+ */
22
+ export declare function DashboardSidebarActiveItemFromPathnameHookProvider({ usePathname, currentPathname, children, }: DashboardSidebarActiveItemFromPathnameHookProviderProps): ReactElement;
23
+ /** Whether `item` is the menu item for the page currently being viewed. */
24
+ export declare function useIsDashboardSidebarItemActive(item: DashboardSidebarItemDefinition): boolean;
@@ -0,0 +1,32 @@
1
+ "use client";
2
+ import { jsx as _jsx } from "react/jsx-runtime";
3
+ import { createContext, useContext, useMemo, } from "react";
4
+ import { normalizeDashboardSidebarPath, resolveActiveDashboardSidebarItemPath, } from "./dashboard-sidebar-active-item";
5
+ import { DashboardSidebarItemsAndGroupsContext, } from "./dashboard-sidebar-items-and-groups-context";
6
+ /**
7
+ * The normalized path of the menu item for the current page, or `null` when
8
+ * the current page is unknown or matches no item.
9
+ */
10
+ export const DashboardSidebarActiveItemContext = createContext(null);
11
+ export function DashboardSidebarActiveItemProvider({ currentPathname, children, }) {
12
+ const sidebarItems = useContext(DashboardSidebarItemsAndGroupsContext);
13
+ const activePath = useMemo(() => resolveActiveDashboardSidebarItemPath(sidebarItems, currentPathname), [sidebarItems, currentPathname]);
14
+ return (_jsx(DashboardSidebarActiveItemContext.Provider, { value: activePath, children: children }));
15
+ }
16
+ /**
17
+ * Reads the current page from the consumer's `usePathname` hook. Kept as its
18
+ * own component so `DashboardLayout` can choose between this and the plain
19
+ * provider without calling a hook conditionally. An explicit
20
+ * `currentPathname` still wins over the hook's value.
21
+ */
22
+ export function DashboardSidebarActiveItemFromPathnameHookProvider({ usePathname, currentPathname, children, }) {
23
+ const pathname = usePathname();
24
+ return (_jsx(DashboardSidebarActiveItemProvider, { currentPathname: currentPathname ?? pathname, children: children }));
25
+ }
26
+ /** Whether `item` is the menu item for the page currently being viewed. */
27
+ export function useIsDashboardSidebarItemActive(item) {
28
+ const activePath = useContext(DashboardSidebarActiveItemContext);
29
+ return (activePath !== null &&
30
+ normalizeDashboardSidebarPath(item.url) === activePath);
31
+ }
32
+ //# sourceMappingURL=dashboard-sidebar-active-item-context.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-sidebar-active-item-context.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,aAAa,EACb,UAAU,EACV,OAAO,GAGR,MAAM,OAAO,CAAC;AACf,OAAO,EACL,6BAA6B,EAC7B,qCAAqC,GACtC,MAAM,iCAAiC,CAAC;AACzC,OAAO,EACL,qCAAqC,GAEtC,MAAM,8CAA8C,CAAC;AAGtD;;;GAGG;AACH,MAAM,CAAC,MAAM,iCAAiC,GAAG,aAAa,CAC5D,IAAI,CACL,CAAC;AAQF,MAAM,UAAU,kCAAkC,CAAC,EACjD,eAAe,EACf,QAAQ,GACgC;IACxC,MAAM,YAAY,GAA8C,UAAU,CACxE,qCAAqC,CACtC,CAAC;IACF,MAAM,UAAU,GAAkB,OAAO,CACvC,GAAkB,EAAE,CAClB,qCAAqC,CAAC,YAAY,EAAE,eAAe,CAAC,EACtE,CAAC,YAAY,EAAE,eAAe,CAAC,CAChC,CAAC;IACF,OAAO,CACL,KAAC,iCAAiC,CAAC,QAAQ,IAAC,KAAK,EAAE,UAAU,YAC1D,QAAQ,GACkC,CAC9C,CAAC;AACJ,CAAC;AAOD;;;;;GAKG;AACH,MAAM,UAAU,kDAAkD,CAAC,EACjE,WAAW,EACX,eAAe,EACf,QAAQ,GACgD;IACxD,MAAM,QAAQ,GAAW,WAAW,EAAE,CAAC;IACvC,OAAO,CACL,KAAC,kCAAkC,IACjC,eAAe,EAAE,eAAe,IAAI,QAAQ,YAE3C,QAAQ,GAC0B,CACtC,CAAC;AACJ,CAAC;AAED,2EAA2E;AAC3E,MAAM,UAAU,+BAA+B,CAC7C,IAAoC;IAEpC,MAAM,UAAU,GAAkB,UAAU,CAC1C,iCAAiC,CAClC,CAAC;IACF,OAAO,CACL,UAAU,KAAK,IAAI;QACnB,6BAA6B,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,UAAU,CACvD,CAAC;AACJ,CAAC"}
@@ -0,0 +1,21 @@
1
+ import type { CSSProperties, ReactElement } from "react";
2
+ /** Colour for the active row's icon, which draws in `currentColor`. */
3
+ export declare const DASHBOARD_SIDEBAR_ACTIVE_ICON_STYLE: CSSProperties;
4
+ /** The active row's label: bold, with the gradient clipped to its glyphs. */
5
+ export declare const DASHBOARD_SIDEBAR_ACTIVE_LABEL_CLASSNAME: string;
6
+ export declare const DASHBOARD_SIDEBAR_ACTIVE_LABEL_STYLE: CSSProperties;
7
+ export interface DashboardSidebarActiveItemIndicatorProps {
8
+ reducedMotion: boolean;
9
+ }
10
+ /**
11
+ * The decoration painted behind the active row's icon and label: a gradient
12
+ * wash across the row and a glowing gradient bar on its left edge. The bar
13
+ * grows in from its centre and the wash fades in when a row becomes active.
14
+ *
15
+ * Render it as the first child of the row's link. Both layers are absolutely
16
+ * positioned with a negative z-index, so the link must be `relative isolate`:
17
+ * they then sit above the link's own hover background but beneath its
18
+ * content, and never shift the icon column or the label.
19
+ */
20
+ export declare function DashboardSidebarActiveItemIndicator({ reducedMotion, }: DashboardSidebarActiveItemIndicatorProps): ReactElement;
21
+ export default DashboardSidebarActiveItemIndicator;
@@ -0,0 +1,64 @@
1
+ "use client";
2
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
3
+ import { m } from "../../../../framer-motion";
4
+ import { cn } from "../../../../lib/utils";
5
+ /**
6
+ * The two accent colours of the active row's gradient: the
7
+ * `--sidebar-active-start` / `--sidebar-active-end` tokens from
8
+ * `@schemavaults/theme` 0.30.0+. They default to the brand blue and red, and a
9
+ * deployment re-themes them with `--sv-theme-{light,dark}-sidebar-active-*`
10
+ * or the matching `THEME_*` environment variables. The brand-colour fallbacks
11
+ * keep the gradient intact in an application whose `globals.css` still comes
12
+ * from an older theme.
13
+ */
14
+ const ACTIVE_START_COLOR = "var(--sidebar-active-start, var(--schemavaults-brand-blue))";
15
+ const ACTIVE_END_COLOR = "var(--sidebar-active-end, var(--schemavaults-brand-red))";
16
+ /**
17
+ * An accent made safe for text and icons. The accents are picked for
18
+ * vibrancy, not legibility — the default brand blue is 2.5:1 on white — so
19
+ * text uses each one mixed 60/40 with the page foreground. That darkens it on
20
+ * a light background and lightens it on a dark one: the default pair reads at
21
+ * 5.6:1 or better on the tinted row in both modes.
22
+ */
23
+ function legibleAccent(accent) {
24
+ return `color-mix(in oklab, ${accent} 60%, hsl(var(--foreground)))`;
25
+ }
26
+ /** Colour for the active row's icon, which draws in `currentColor`. */
27
+ export const DASHBOARD_SIDEBAR_ACTIVE_ICON_STYLE = {
28
+ color: legibleAccent(ACTIVE_START_COLOR),
29
+ };
30
+ /** The active row's label: bold, with the gradient clipped to its glyphs. */
31
+ export const DASHBOARD_SIDEBAR_ACTIVE_LABEL_CLASSNAME = "font-semibold bg-clip-text text-transparent";
32
+ export const DASHBOARD_SIDEBAR_ACTIVE_LABEL_STYLE = {
33
+ backgroundImage: `linear-gradient(90deg, ${legibleAccent(ACTIVE_START_COLOR)}, ${legibleAccent(ACTIVE_END_COLOR)})`,
34
+ };
35
+ // How strongly the fill is tinted. Set per mode by the classes on the fill: a
36
+ // dark background needs more of the accent for the same visible wash.
37
+ const TINT = "var(--dashboard-sidebar-active-tint)";
38
+ // A wash of the start colour that shades into the end colour and fades out
39
+ // before the row's right edge.
40
+ const FILL_STYLE = {
41
+ backgroundImage: `linear-gradient(90deg, color-mix(in oklab, ${ACTIVE_START_COLOR} ${TINT}, transparent), color-mix(in oklab, ${ACTIVE_END_COLOR} calc(${TINT} * 0.75), transparent) 70%, transparent)`,
42
+ };
43
+ // A pill down the left edge running from one accent to the other, with a soft
44
+ // glow of each around it.
45
+ const BAR_STYLE = {
46
+ backgroundImage: `linear-gradient(180deg, ${ACTIVE_START_COLOR}, ${ACTIVE_END_COLOR})`,
47
+ boxShadow: `0 -2px 10px color-mix(in oklab, ${ACTIVE_START_COLOR} 55%, transparent), 0 4px 12px color-mix(in oklab, ${ACTIVE_END_COLOR} 40%, transparent)`,
48
+ };
49
+ /**
50
+ * The decoration painted behind the active row's icon and label: a gradient
51
+ * wash across the row and a glowing gradient bar on its left edge. The bar
52
+ * grows in from its centre and the wash fades in when a row becomes active.
53
+ *
54
+ * Render it as the first child of the row's link. Both layers are absolutely
55
+ * positioned with a negative z-index, so the link must be `relative isolate`:
56
+ * they then sit above the link's own hover background but beneath its
57
+ * content, and never shift the icon column or the label.
58
+ */
59
+ export function DashboardSidebarActiveItemIndicator({ reducedMotion, }) {
60
+ const duration = reducedMotion ? 0 : 0.3;
61
+ return (_jsxs(_Fragment, { children: [_jsx(m.span, { "aria-hidden": "true", "data-slot": "dashboard-sidebar-active-item-wash", className: cn("absolute inset-0 -z-10 pointer-events-none", "[--dashboard-sidebar-active-tint:16%] dark:[--dashboard-sidebar-active-tint:24%]"), style: FILL_STYLE, initial: { opacity: 0 }, animate: { opacity: 1 }, transition: { duration } }), _jsx(m.span, { "aria-hidden": "true", "data-slot": "dashboard-sidebar-active-item-bar", className: "absolute inset-y-1 left-0 w-1 -z-10 rounded-r-full pointer-events-none", style: BAR_STYLE, initial: { scaleY: 0 }, animate: { scaleY: 1 }, transition: { duration, ease: "easeOut" } })] }));
62
+ }
63
+ export default DashboardSidebarActiveItemIndicator;
64
+ //# sourceMappingURL=dashboard-sidebar-active-item-indicator.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-sidebar-active-item-indicator.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-indicator.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AACpC,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AAEjC;;;;;;;;GAQG;AACH,MAAM,kBAAkB,GACtB,6DAA6D,CAAC;AAChE,MAAM,gBAAgB,GACpB,0DAA0D,CAAC;AAE7D;;;;;;GAMG;AACH,SAAS,aAAa,CAAC,MAAc;IACnC,OAAO,uBAAuB,MAAM,+BAA+B,CAAC;AACtE,CAAC;AAED,uEAAuE;AACvE,MAAM,CAAC,MAAM,mCAAmC,GAAkB;IAChE,KAAK,EAAE,aAAa,CAAC,kBAAkB,CAAC;CACzC,CAAC;AAEF,6EAA6E;AAC7E,MAAM,CAAC,MAAM,wCAAwC,GACnD,6CAA6C,CAAC;AAChD,MAAM,CAAC,MAAM,oCAAoC,GAAkB;IACjE,eAAe,EAAE,0BAA0B,aAAa,CAAC,kBAAkB,CAAC,KAAK,aAAa,CAAC,gBAAgB,CAAC,GAAG;CACpH,CAAC;AAEF,8EAA8E;AAC9E,sEAAsE;AACtE,MAAM,IAAI,GAAW,sCAAsC,CAAC;AAE5D,2EAA2E;AAC3E,+BAA+B;AAC/B,MAAM,UAAU,GAAkB;IAChC,eAAe,EAAE,8CAA8C,kBAAkB,IAAI,IAAI,uCAAuC,gBAAgB,SAAS,IAAI,0CAA0C;CACxM,CAAC;AAEF,8EAA8E;AAC9E,0BAA0B;AAC1B,MAAM,SAAS,GAAkB;IAC/B,eAAe,EAAE,2BAA2B,kBAAkB,KAAK,gBAAgB,GAAG;IACtF,SAAS,EAAE,mCAAmC,kBAAkB,sDAAsD,gBAAgB,oBAAoB;CAC3J,CAAC;AAMF;;;;;;;;;GASG;AACH,MAAM,UAAU,mCAAmC,CAAC,EAClD,aAAa,GAC4B;IACzC,MAAM,QAAQ,GAAW,aAAa,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC;IACjD,OAAO,CACL,8BACE,KAAC,CAAC,CAAC,IAAI,mBACO,MAAM,eACR,oCAAoC,EAC9C,SAAS,EAAE,EAAE,CACX,4CAA4C,EAC5C,kFAAkF,CACnF,EACD,KAAK,EAAE,UAAU,EACjB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EACvB,OAAO,EAAE,EAAE,OAAO,EAAE,CAAC,EAAE,EACvB,UAAU,EAAE,EAAE,QAAQ,EAAE,GACxB,EACF,KAAC,CAAC,CAAC,IAAI,mBACO,MAAM,eACR,mCAAmC,EAC7C,SAAS,EAAC,wEAAwE,EAClF,KAAK,EAAE,SAAS,EAChB,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EACtB,OAAO,EAAE,EAAE,MAAM,EAAE,CAAC,EAAE,EACtB,UAAU,EAAE,EAAE,QAAQ,EAAE,IAAI,EAAE,SAAS,EAAE,GACzC,IACD,CACJ,CAAC;AACJ,CAAC;AAED,eAAe,mCAAmC,CAAC"}
@@ -0,0 +1,32 @@
1
+ import type { DashboardSidebarItemDefinition } from "./dashboard-sidebar-item-definition";
2
+ import type { DashboardSidebarItemGroupDefinition } from "./dashboard-sidebar-item-group";
3
+ /**
4
+ * Reduce an href to the path the sidebar compares on: the query string and
5
+ * fragment are dropped, and trailing slashes are trimmed so `/settings/` and
6
+ * `/settings` are the same page.
7
+ *
8
+ * Only root-relative paths take part in matching. Anything else — `#`, an
9
+ * empty string, a relative path, or an absolute URL to another site — returns
10
+ * `null` and is never marked active: the layout only knows the pathname of
11
+ * the current page, not its origin, so it cannot tell whether such a link
12
+ * points here.
13
+ */
14
+ export declare function normalizeDashboardSidebarPath(href: string): string | null;
15
+ /**
16
+ * Whether `currentPath` is the page at `itemPath` or a page nested beneath
17
+ * it, e.g. `/settings/billing` is within `/settings`. The root path `/` only
18
+ * matches itself; otherwise a "Home" item would claim every page.
19
+ */
20
+ export declare function isDashboardSidebarPathWithin(itemPath: string, currentPath: string): boolean;
21
+ /**
22
+ * Pick the single sidebar path that best describes the current page: the
23
+ * longest item path that the current path equals or is nested beneath.
24
+ * Longest-wins means that with both `/settings` and `/settings/billing` in
25
+ * the menu, only "Billing" lights up on `/settings/billing`, while
26
+ * `/settings/profile` (not in the menu) still falls back to "Settings".
27
+ *
28
+ * Returns the normalized path rather than an item, so that every item
29
+ * pointing at that page is marked — a link can legitimately appear in two
30
+ * groups.
31
+ */
32
+ export declare function resolveActiveDashboardSidebarItemPath(entries: readonly (DashboardSidebarItemDefinition | DashboardSidebarItemGroupDefinition)[], currentHref: string | null | undefined): string | null;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * Reduce an href to the path the sidebar compares on: the query string and
3
+ * fragment are dropped, and trailing slashes are trimmed so `/settings/` and
4
+ * `/settings` are the same page.
5
+ *
6
+ * Only root-relative paths take part in matching. Anything else — `#`, an
7
+ * empty string, a relative path, or an absolute URL to another site — returns
8
+ * `null` and is never marked active: the layout only knows the pathname of
9
+ * the current page, not its origin, so it cannot tell whether such a link
10
+ * points here.
11
+ */
12
+ export function normalizeDashboardSidebarPath(href) {
13
+ const path = href.split("#")[0].split("?")[0];
14
+ if (!path.startsWith("/") || path.startsWith("//")) {
15
+ return null;
16
+ }
17
+ const trimmed = path.replace(/\/+$/, "");
18
+ return trimmed.length > 0 ? trimmed : "/";
19
+ }
20
+ /**
21
+ * Whether `currentPath` is the page at `itemPath` or a page nested beneath
22
+ * it, e.g. `/settings/billing` is within `/settings`. The root path `/` only
23
+ * matches itself; otherwise a "Home" item would claim every page.
24
+ */
25
+ export function isDashboardSidebarPathWithin(itemPath, currentPath) {
26
+ if (currentPath === itemPath) {
27
+ return true;
28
+ }
29
+ return itemPath !== "/" && currentPath.startsWith(`${itemPath}/`);
30
+ }
31
+ /**
32
+ * Pick the single sidebar path that best describes the current page: the
33
+ * longest item path that the current path equals or is nested beneath.
34
+ * Longest-wins means that with both `/settings` and `/settings/billing` in
35
+ * the menu, only "Billing" lights up on `/settings/billing`, while
36
+ * `/settings/profile` (not in the menu) still falls back to "Settings".
37
+ *
38
+ * Returns the normalized path rather than an item, so that every item
39
+ * pointing at that page is marked — a link can legitimately appear in two
40
+ * groups.
41
+ */
42
+ export function resolveActiveDashboardSidebarItemPath(entries, currentHref) {
43
+ if (typeof currentHref !== "string") {
44
+ return null;
45
+ }
46
+ const currentPath = normalizeDashboardSidebarPath(currentHref);
47
+ if (currentPath === null) {
48
+ return null;
49
+ }
50
+ const items = entries.flatMap((entry) => entry.type === "dashboard-sidebar-item-group" ? entry.items : [entry]);
51
+ let best = null;
52
+ for (const item of items) {
53
+ const itemPath = normalizeDashboardSidebarPath(item.url);
54
+ if (itemPath !== null &&
55
+ isDashboardSidebarPathWithin(itemPath, currentPath) &&
56
+ (best === null || itemPath.length > best.length)) {
57
+ best = itemPath;
58
+ }
59
+ }
60
+ return best;
61
+ }
62
+ //# sourceMappingURL=dashboard-sidebar-active-item.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dashboard-sidebar-active-item.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;GAUG;AACH,MAAM,UAAU,6BAA6B,CAAC,IAAY;IACxD,MAAM,IAAI,GAAW,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAE,CAAC,KAAK,CAAC,GAAG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,CAAC,GAAG,CAAC,CAAC;QACxE,IACE,QAAQ,KAAK,IAAI;YACjB,4BAA4B,CAAC,QAAQ,EAAE,WAAW,CAAC;YACnD,CAAC,IAAI,KAAK,IAAI,IAAI,QAAQ,CAAC,MAAM,GAAG,IAAI,CAAC,MAAM,CAAC,EAChD,CAAC;YACD,IAAI,GAAG,QAAQ,CAAC;QAClB,CAAC;IACH,CAAC;IAED,OAAO,IAAI,CAAC;AACd,CAAC"}
@@ -11,6 +11,8 @@ import { DashboardSidebarAdminOnlyItemsContext } from "./dashboard-sidebar-admin
11
11
  import { Tooltip, TooltipContent, TooltipTrigger, TooltipArrow, } from "../../../ui";
12
12
  import useDashboardSidebarOpenStateDispatch from "./useDashboardSidebarOpenStateDispatch";
13
13
  import useDebug from "../../../hooks/use-debug";
14
+ import { useIsDashboardSidebarItemActive } from "./dashboard-sidebar-active-item-context";
15
+ import { DASHBOARD_SIDEBAR_ACTIVE_ICON_STYLE, DASHBOARD_SIDEBAR_ACTIVE_LABEL_CLASSNAME, DASHBOARD_SIDEBAR_ACTIVE_LABEL_STYLE, DashboardSidebarActiveItemIndicator, } from "./dashboard-sidebar-active-item-indicator";
14
16
  export function DashboardSidebarItemRenderer({ item, Link, }) {
15
17
  const debug = useDebug();
16
18
  const { open, mobile } = useDashboardSidebarOpenState();
@@ -23,12 +25,29 @@ export function DashboardSidebarItemRenderer({ item, Link, }) {
23
25
  // over values this component already has.
24
26
  const transitionTime = useToggleDashboardLayoutCollapsedTransitionTime();
25
27
  const showItemLabel = mobile || open;
28
+ const active = useIsDashboardSidebarItemActive(item);
26
29
  const IconComponent = item.icon;
27
- const itemColorClassName = isAdminItemGroup
28
- ? "text-red-500"
29
- : "text-foreground";
30
+ // The active row takes the gradient's accents on its icon and label. Admin
31
+ // rows keep their red instead, active or not: red is what marks them as
32
+ // admin-only, and the row's gradient backdrop already says "active".
33
+ const showActiveAccents = active && !isAdminItemGroup;
34
+ let iconClassName;
35
+ let labelClassName;
36
+ if (isAdminItemGroup) {
37
+ iconClassName = "text-red-500";
38
+ labelClassName = cn("text-red-500", active && "font-semibold");
39
+ }
40
+ else if (active) {
41
+ // No colour class: the icon inherits the accent from its wrapper below.
42
+ iconClassName = "";
43
+ labelClassName = DASHBOARD_SIDEBAR_ACTIVE_LABEL_CLASSNAME;
44
+ }
45
+ else {
46
+ iconClassName = "text-foreground";
47
+ labelClassName = "text-foreground";
48
+ }
30
49
  function SidebarMenuItemTitle() {
31
- return (_jsx(m.span, { className: cn(itemColorClassName, "text-nowrap"), initial: {
50
+ return (_jsx(m.span, { className: cn(labelClassName, "text-nowrap"), style: showActiveAccents ? DASHBOARD_SIDEBAR_ACTIVE_LABEL_STYLE : undefined, initial: {
32
51
  opacity: 1,
33
52
  scale: 1,
34
53
  transitionEnd: {
@@ -54,7 +73,7 @@ export function DashboardSidebarItemRenderer({ item, Link, }) {
54
73
  // which have always had it. Without it, ungrouped rows snapped into
55
74
  // place while grouped rows glided. Under reduced motion every row
56
75
  // snaps instead, which is the point.
57
- layout: !reducedMotion, className: cn("w-full", sizes.sidebar_menu_item_height_classname,
76
+ layout: !reducedMotion, "data-active": active ? "true" : undefined, className: cn("w-full", sizes.sidebar_menu_item_height_classname,
58
77
  // The menu <nav> is a flex column with a definite height (it grows
59
78
  // inside an h-screen sidebar) and its own scrollbar. Flex children
60
79
  // shrink by default, so once the menu overflowed, rows squashed
@@ -63,10 +82,15 @@ export function DashboardSidebarItemRenderer({ item, Link, }) {
63
82
  // the ungrouped rows collapsed. That is the "different spacing"
64
83
  // between plain and grouped links. Opt out of shrinking, like the
65
84
  // sidebar header and footer already do.
66
- "flex-shrink-0"), children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: cn("w-full h-full"), children: _jsxs(Link, { href: item.url, className: cn("flex flex-row flex-nowrap", "justify-start items-center", "w-full h-full",
85
+ "flex-shrink-0"), children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { className: cn("w-full h-full"), children: _jsxs(Link, { href: item.url, "aria-current": active ? "page" : undefined, className: cn("flex flex-row flex-nowrap", "justify-start items-center", "w-full h-full",
67
86
  // Theme token rather than a hardcoded gray: bg-gray-200 was
68
87
  // near-invisible against a dark background.
69
- "hover:bg-accent transition-colors"), onClick: () => {
88
+ "hover:bg-accent transition-colors",
89
+ // Positioning context for the active indicator below. `isolate`
90
+ // makes the link its own stacking context, so the indicator's
91
+ // negative z-index puts it above the link's hover background
92
+ // but beneath the icon and label.
93
+ "relative isolate"), onClick: () => {
70
94
  if (debug) {
71
95
  console.log("[DashboardSidebarItemRenderer] onClick(item), where item = ", item);
72
96
  }
@@ -86,7 +110,7 @@ export function DashboardSidebarItemRenderer({ item, Link, }) {
86
110
  if (mobile) {
87
111
  setSidebarOpen(false);
88
112
  }
89
- }, children: [_jsx(m.div, { className: cn("flex-shrink-0", sizes.desktop_collapsed_width_classname, "flex items-center justify-center"), children: _jsx(IconComponent, { className: cn("h-6 w-6", itemColorClassName) }) }), _jsx(AnimatePresence, { children: showItemLabel && _jsx(SidebarMenuItemTitle, {}, item.title) })] }) }), _jsxs(TooltipContent, { side: "right", children: [item.tooltip ?? item.title, _jsx(TooltipArrow, {})] })] }) }, item.title));
113
+ }, children: [active && (_jsx(DashboardSidebarActiveItemIndicator, { reducedMotion: reducedMotion })), _jsx(m.div, { className: cn("flex-shrink-0", sizes.desktop_collapsed_width_classname, "flex items-center justify-center"), style: showActiveAccents ? DASHBOARD_SIDEBAR_ACTIVE_ICON_STYLE : undefined, children: _jsx(IconComponent, { className: cn("h-6 w-6", iconClassName) }) }), _jsx(AnimatePresence, { children: showItemLabel && _jsx(SidebarMenuItemTitle, {}, item.title) })] }) }), _jsxs(TooltipContent, { side: "right", children: [item.tooltip ?? item.title, _jsx(TooltipArrow, {})] })] }) }, item.title));
90
114
  }
91
115
  export default DashboardSidebarItemRenderer;
92
116
  //# sourceMappingURL=dashboard-sidebar-item-renderer.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"dashboard-sidebar-item-renderer.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-renderer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AAGtD,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,+CAA+C,MAAM,oDAAoD,CAAC;AACjH,OAAO,+BAA+B,MAAM,oCAAoC,CAAC;AACjF,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EACL,OAAO,EACP,cAAc,EACd,cAAc,EACd,YAAY,GACb,MAAM,iBAAiB,CAAC;AAEzB,OAAO,oCAAoC,MAAM,wCAAwC,CAAC;AAC1F,OAAO,QAAQ,MAAM,8BAA8B,CAAC;AAGpD,MAAM,UAAU,4BAA4B,CAAC,EAC3C,IAAI,EACJ,IAAI,GAIL;IACC,MAAM,KAAK,GAAY,QAAQ,EAAE,CAAC;IAClC,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,GAAG,4BAA4B,EAAE,CAAC;IACxD,MAAM,cAAc,GAAG,oCAAoC,EAAE,CAAC;IAC9D,MAAM,KAAK,GAAG,yBAAyB,EAAE,CAAC;IAC1C,MAAM,gBAAgB,GAAY,UAAU,CAC1C,qCAAqC,CACtC,CAAC;IACF,MAAM,aAAa,GAAY,+BAA+B,EAAE,CAAC;IACjE,uEAAuE;IACvE,0EAA0E;IAC1E,0CAA0C;IAC1C,MAAM,cAAc,GAClB,+CAA+C,EAAE,CAAC;IACpD,MAAM,aAAa,GAAY,MAAM,IAAI,IAAI,CAAC;IAE9C,MAAM,aAAa,GAA6B,IAAI,CAAC,IAAI,CAAC;IAC1D,MAAM,kBAA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;wBAC5C,mCAAmC,CACpC,EACD,OAAO,EAAE,GAAS,EAAE;4BAClB,IAAI,KAAK,EAAE,CAAC;gCACV,OAAO,CAAC,GAAG,CACT,6DAA6D,EAC7D,IAAI,CACL,CAAC;4BACJ,CAAC;4BACD,6DAA6D;4BAC7D,+DAA+D;4BAC/D,gEAAgE;4BAChE,+DAA+D;4BAC/D,8DAA8D;4BAC9D,6DAA6D;4BAC7D,yCAAyC;4BACzC,EAAE;4BACF,2DAA2D;4BAC3D,6DAA6D;4BAC7D,+DAA+D;4BAC/D,iEAAiE;4BACjE,8BAA8B;4BAC9B,IAAI,MAAM,EAAE,CAAC;gCACX,cAAc,CAAC,KAAK,CAAC,CAAC;4BACxB,CAAC;wBACH,CAAC,aAED,KAAC,CAAC,CAAC,GAAG,IAAC,SAAS,EAAE,EAAE,CAClB,eAAe,EACf,KAAK,CAAC,iCAAiC,EACvC,kCAAkC,CACnC,YACC,KAAC,aAAa,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,kBAAkB,CAAC,GAAI,GACzD,EAER,KAAC,eAAe,cACb,aAAa,IAAI,KAAC,oBAAoB,MAAM,IAAI,CAAC,KAAK,CAAI,GAC3C,IACb,GACQ,EACjB,MAAC,cAAc,IAAC,IAAI,EAAC,OAAO,aACzB,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,EAC3B,KAAC,YAAY,KAAG,IACD,IACT,IA3EL,IAAI,CAAC,KAAK,CA4EV,CACR,CAAC;AACJ,CAAC;AAED,eAAe,4BAA4B,CAAC"}
1
+ {"version":3,"file":"dashboard-sidebar-item-renderer.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-renderer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,UAAU,EAAqB,MAAM,OAAO,CAAC;AAGtD,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAA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,IACJ,SAAS,EAAE,EAAE,CACX,eAAe,EACf,KAAK,CAAC,iCAAiC,EACvC,kCAAkC,CACnC,EACD,KAAK,EAAE,iBAAiB,CAAC,CAAC,CAAC,mCAAmC,CAAC,CAAC,CAAC,SAAS,YAE1E,KAAC,aAAa,IAAC,SAAS,EAAE,EAAE,CAAC,SAAS,EAAE,aAAa,CAAC,GAAI,GACpD,EAER,KAAC,eAAe,cACb,aAAa,IAAI,KAAC,oBAAoB,MAAM,IAAI,CAAC,KAAK,CAAI,GAC3C,IACb,GACQ,EACjB,MAAC,cAAc,IAAC,IAAI,EAAC,OAAO,aACzB,IAAI,CAAC,OAAO,IAAI,IAAI,CAAC,KAAK,EAC3B,KAAC,YAAY,KAAG,IACD,IACT,IA1FL,IAAI,CAAC,KAAK,CA2FV,CACR,CAAC;AACJ,CAAC;AAED,eAAe,4BAA4B,CAAC"}
@@ -11,3 +11,5 @@ export type { DashboardSidebarItemsAndGroupsDefinitions } from "./dashboard-side
11
11
  export type { DashboardLayoutSidebarSizing } from "./dashboard-sidebar-sizing";
12
12
  export { DASHBOARD_SIDEBAR_OPEN_WIDTH_CSS_VARIABLE, DEFAULT_DASHBOARD_SIDEBAR_OPEN_WIDTH, DEFAULT_LEADING_SIDEBAR_MENU_GROUP_LABEL_TOP_PADDING, } from "./dashboard-sidebar-sizing";
13
13
  export type { IDashboardSidebarOpenStateContextType } from "./dashboard-sidebar-open-state";
14
+ export { resolveActiveDashboardSidebarItemPath } from "./dashboard-sidebar-active-item";
15
+ export { DashboardSidebarActiveItemProvider, DashboardSidebarActiveItemFromPathnameHookProvider, } from "./dashboard-sidebar-active-item-context";
@@ -6,4 +6,6 @@ export { useDashboardSidebarOpenStateDispatch } from "./useDashboardSidebarOpenS
6
6
  export { useCloseDashboardSidebarOnRouteChange } from "./useCloseDashboardSidebarOnRouteChange";
7
7
  export { DashboardSidebarContextProvider } from "./dashboard-sidebar-context-provider";
8
8
  export { DASHBOARD_SIDEBAR_OPEN_WIDTH_CSS_VARIABLE, DEFAULT_DASHBOARD_SIDEBAR_OPEN_WIDTH, DEFAULT_LEADING_SIDEBAR_MENU_GROUP_LABEL_TOP_PADDING, } from "./dashboard-sidebar-sizing";
9
+ export { resolveActiveDashboardSidebarItemPath } from "./dashboard-sidebar-active-item";
10
+ export { DashboardSidebarActiveItemProvider, DashboardSidebarActiveItemFromPathnameHookProvider, } from "./dashboard-sidebar-active-item-context";
9
11
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,IAAI,OAAO,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAEhG,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAMvF,OAAO,EACL,yCAAyC,EACzC,oCAAoC,EACpC,oDAAoD,GACrD,MAAM,4BAA4B,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,gBAAgB,EAChB,gBAAgB,IAAI,OAAO,GAC5B,MAAM,qBAAqB,CAAC;AAE7B,OAAO,EAAE,6BAA6B,EAAE,MAAM,oCAAoC,CAAC;AAEnF,OAAO,EAAE,4BAA4B,EAAE,MAAM,gCAAgC,CAAC;AAC9E,OAAO,EAAE,yBAAyB,EAAE,MAAM,6BAA6B,CAAC;AACxE,OAAO,EAAE,oCAAoC,EAAE,MAAM,wCAAwC,CAAC;AAC9F,OAAO,EAAE,qCAAqC,EAAE,MAAM,yCAAyC,CAAC;AAEhG,OAAO,EAAE,+BAA+B,EAAE,MAAM,sCAAsC,CAAC;AAMvF,OAAO,EACL,yCAAyC,EACzC,oCAAoC,EACpC,oDAAoD,GACrD,MAAM,4BAA4B,CAAC;AAGpC,OAAO,EAAE,qCAAqC,EAAE,MAAM,iCAAiC,CAAC;AACxF,OAAO,EACL,kCAAkC,EAClC,kDAAkD,GACnD,MAAM,yCAAyC,CAAC"}
@@ -7,4 +7,5 @@ export { DEFAULT_DASHBOARD_LAYOUT_REDUCED_MOTION_SETTING } from "./dashboard-lay
7
7
  export { useDashboardLayoutReducedMotion } from "./useDashboardLayoutReducedMotion";
8
8
  export { useDashboardSidebarOpenState, useDashboardSidebarOpenStateDispatch, useCloseDashboardSidebarOnRouteChange, } from "./dashboard-sidebar";
9
9
  export type { DashboardSidebarItemDefinition, DashboardSidebarItemGroupDefinition, DashboardSidebarItemsAndGroupsDefinitions, } from "./dashboard-sidebar";
10
+ export { resolveActiveDashboardSidebarItemPath } from "./dashboard-sidebar";
10
11
  export { DASHBOARD_SIDEBAR_OPEN_WIDTH_CSS_VARIABLE, DEFAULT_DASHBOARD_SIDEBAR_OPEN_WIDTH, DEFAULT_LEADING_SIDEBAR_MENU_GROUP_LABEL_TOP_PADDING, } from "./dashboard-sidebar";
@@ -5,5 +5,6 @@ export { DEFAULT_DASHBOARD_LAYOUT_REDUCED_MOTION_SETTING } from "./dashboard-lay
5
5
  // the motion of the layout chrome they are rendered into.
6
6
  export { useDashboardLayoutReducedMotion } from "./useDashboardLayoutReducedMotion";
7
7
  export { useDashboardSidebarOpenState, useDashboardSidebarOpenStateDispatch, useCloseDashboardSidebarOnRouteChange, } from "./dashboard-sidebar";
8
+ export { resolveActiveDashboardSidebarItemPath } from "./dashboard-sidebar";
8
9
  export { DASHBOARD_SIDEBAR_OPEN_WIDTH_CSS_VARIABLE, DEFAULT_DASHBOARD_SIDEBAR_OPEN_WIDTH, DEFAULT_LEADING_SIDEBAR_MENU_GROUP_LABEL_TOP_PADDING, } from "./dashboard-sidebar";
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/layout/dashboard-layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAKhE,OAAO,EAAE,+CAA+C,EAAE,MAAM,mCAAmC,CAAC;AACpG,8EAA8E;AAC9E,0DAA0D;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EACL,4BAA4B,EAC5B,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EACL,yCAAyC,EACzC,oCAAoC,EACpC,oDAAoD,GACrD,MAAM,qBAAqB,CAAC"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/layout/dashboard-layout/index.ts"],"names":[],"mappings":"AAAA,cAAc,oBAAoB,CAAC;AAEnC,OAAO,EAAE,eAAe,IAAI,OAAO,EAAE,MAAM,oBAAoB,CAAC;AAKhE,OAAO,EAAE,+CAA+C,EAAE,MAAM,mCAAmC,CAAC;AACpG,8EAA8E;AAC9E,0DAA0D;AAC1D,OAAO,EAAE,+BAA+B,EAAE,MAAM,mCAAmC,CAAC;AAEpF,OAAO,EACL,4BAA4B,EAC5B,oCAAoC,EACpC,qCAAqC,GACtC,MAAM,qBAAqB,CAAC;AAM7B,OAAO,EAAE,qCAAqC,EAAE,MAAM,qBAAqB,CAAC;AAC5E,OAAO,EACL,yCAAyC,EACzC,oCAAoC,EACpC,oDAAoD,GACrD,MAAM,qBAAqB,CAAC"}
@@ -3,6 +3,12 @@ export interface LinkComponentProps extends PropsWithChildren<{
3
3
  href: string;
4
4
  className?: string;
5
5
  onClick?: (e: MouseEvent) => void;
6
+ /**
7
+ * Set to `"page"` on the dashboard sidebar link for the page currently
8
+ * being viewed. Forward it to the rendered `<a>` so assistive technology
9
+ * announces the link as the current page.
10
+ */
11
+ "aria-current"?: "page";
6
12
  }> {
7
13
  }
8
14
  export type LinkComponentType = (props: LinkComponentProps) => ReactElement;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@schemavaults/ui",
3
- "version": "0.110.1",
3
+ "version": "0.111.0",
4
4
  "private": false,
5
5
  "license": "MIT",
6
6
  "description": "React.js UI components for SchemaVaults frontend applications",
@@ -36,7 +36,7 @@
36
36
  "@radix-ui/react-toast": "1.2.14",
37
37
  "@radix-ui/react-tooltip": "1.2.7",
38
38
  "@radix-ui/react-visually-hidden": "1.2.3",
39
- "@schemavaults/theme": "0.29.0",
39
+ "@schemavaults/theme": "0.30.0",
40
40
  "@tanstack/react-table": "8.20.1",
41
41
  "class-variance-authority": "0.7.1",
42
42
  "clsx": "2.1.1",