@schemavaults/ui 0.110.1 → 0.112.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.
- package/dist/components/layout/dashboard-layout/DashboardLayoutProps.d.ts +26 -1
- package/dist/components/layout/dashboard-layout/dashboard-layout.d.ts +1 -1
- package/dist/components/layout/dashboard-layout/dashboard-layout.js +4 -3
- package/dist/components/layout/dashboard-layout/dashboard-layout.js.map +1 -1
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.d.ts +24 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.js +32 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.js.map +1 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-indicator.d.ts +21 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-indicator.js +64 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-indicator.js.map +1 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.d.ts +32 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.js +62 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.js.map +1 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-renderer.js +32 -8
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-renderer.js.map +1 -1
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/index.d.ts +2 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/index.js +2 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/index.js.map +1 -1
- package/dist/components/layout/dashboard-layout/index.d.ts +1 -0
- package/dist/components/layout/dashboard-layout/index.js +1 -0
- package/dist/components/layout/dashboard-layout/index.js.map +1 -1
- package/dist/components/ui/index.d.ts +2 -0
- package/dist/components/ui/index.js +1 -0
- package/dist/components/ui/index.js.map +1 -1
- package/dist/components/ui/uptime-bar/index.d.ts +2 -0
- package/dist/components/ui/uptime-bar/index.js +2 -0
- package/dist/components/ui/uptime-bar/index.js.map +1 -0
- package/dist/components/ui/uptime-bar/uptime-bar.d.ts +77 -0
- package/dist/components/ui/uptime-bar/uptime-bar.js +121 -0
- package/dist/components/ui/uptime-bar/uptime-bar.js.map +1 -0
- package/dist/types/Link.d.ts +6 -0
- 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
|
|
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(
|
|
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,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ACV,CACH,CAAC;QACJ,CAAC;IACH,CAAC;IAED,MAAM,sBAAsB,GAEZ,KAAK,CAAC,aAAa,CAAC;IAEpC,OAAO;IACL,0EAA0E;IAC1E,0EAA0E;IAC1E,2EAA2E;IAC3E,wEAAwE;IACxE,+DAA+D;IAC/D,KAAC,YAAY,IAAC,aAAa,EAAE,oBAAoB,YAC/C,MAAC,+BAA+B,IAC9B,YAAY,EAAE,KAAK,CAAC,YAAY,EAChC,MAAM,EAAE,KAAK,CAAC,MAAM,EACpB,gBAAgB,EAAE,gBAAgB,EAClC,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,cAAc,EAAE,KAAK,CAAC,cAAc,aAEnC,OAAO,WAAW,KAAK,UAAU,IAAI,CACpC,KAAC,4BAA4B,IAAC,WAAW,EAAE,WAAW,GAAI,CAC3D,EACD,eACE,EAAE,EAAC,4BAA4B,EAC/B,SAAS,EAAE,EAAE,CACX,wBAAwB;oBACxB,kEAAkE;oBAClE,+DAA+D;oBAC/D,6BAA6B;oBAC7B,WAAW,IAAI,4BAA4B,CAC5C,EACD,KAAK,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;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kC,EAClC,uCAAuC,EACvC,sBAAsB,CAAC,oBAAoB,CAAC,EAC5C,eAAe,EACf,wBAAwB,EACxB,IAAI,CAAC,oCAAoC,EACzC,WAAW,IAAI,cAAc,CAC9B,EACD,KAAK,EAAE;wCACL,MAAM,EAAE,IAAI,CAAC,aAAa;qCAC3B,YAED,eAAK,SAAS,EAAC,8DAA8D,aAC3E,KAAC,6BAA6B,KAAG,EACjC,KAAC,SAAS,IACR,WAAW,EAAC,UAAU,EACtB,SAAS,EAAC,sCAAsC,GAChD,EACF,KAAC,gCAAgC,KAAG,EACpC,cAAK,IAAI,EAAC,MAAM,EAAC,SAAS,EAAC,MAAM,GAAG,EACnC,OAAO,sBAAsB,KAAK,UAAU,IAAI,CAC/C,KAAC,sBAAsB,IACrB,yBAAyB,EAAE,yBAAyB,EACpD,4BAA4B,EAAE,4BAA4B,EAC1D,IAAI,EAAE,IAAI,GACV,CACH,IACG,GACC,EACR,QAAQ,IAC2B,IAClC,IAC0B,GACrB,CAChB,CAAC;AACJ,CAAC;AAED,eAAe,eAAe,CAAC"}
|
|
@@ -0,0 +1,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;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M,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"}
|
package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.d.ts
ADDED
|
@@ -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;
|
package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item.js
ADDED
|
@@ -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;AAC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AC;IAEF,IAAI,IAAI,GAAkB,IAAI,CAAC;IAC/B,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;QACzB,MAAM,QAAQ,GAAkB,6BAA6B,CAAC,IAAI,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"}
|
package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-renderer.js
CHANGED
|
@@ -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
|
-
|
|
28
|
-
|
|
29
|
-
|
|
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(
|
|
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"
|
|
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",
|
|
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;
|
|
1
|
+
{"version":3,"file":"dashboard-sidebar-item-renderer.js","sourceRoot":"","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D,iEAAiE;4BACjE,8BAA8B;4BAC9B,IAAI,MAAM,EAAE,CAAC;gCACX,cAAc,CAAC,KAAK,CAAC,CAAC;4BACxB,CAAC;wBACH,CAAC,aAEA,MAAM,IAAI,CACT,KAAC,mCAAmC,IAClC,aAAa,EAAE,aAAa,GAC5B,CACH,EACD,KAAC,CAAC,CAAC,GAAG,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"}
|
|
@@ -136,6 +136,8 @@ export * from "./meter";
|
|
|
136
136
|
export type * from "./meter";
|
|
137
137
|
export * from "./segmented-bar";
|
|
138
138
|
export type * from "./segmented-bar";
|
|
139
|
+
export * from "./uptime-bar";
|
|
140
|
+
export type * from "./uptime-bar";
|
|
139
141
|
export * from "./breadcrumb";
|
|
140
142
|
export type * from "./breadcrumb";
|
|
141
143
|
export * from "./pagination";
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/components/ui/index.ts"],"names":[],"mappings":"AAAA,cAAc,UAAU,CAAC;AAGzB,cAAc,uBAAuB,CAAC;AAGtC,cAAc,aAAa,CAAC;AAG5B,cAAc,eAAe,CAAC;AAG9B,cAAc,SAAS,CAAC;AAGxB,cAAc,WAAW,CAAC;AAG1B,cAAc,cAAc,CAAC;AAG7B,cAAc,SAAS,CAAC;AAGxB,cAAc,mBAAmB,CAAC;AAGlC,cAAc,0BAA0B,CAAC;AAGzC,cAAc,UAAU,CAAC;AAGzB,cAAc,SAAS,CAAC;AAGxB,cAAc,kBAAkB,CAAC;AAGjC,cAAc,aAAa,CAAC;AAG5B,cAAc,kCAAkC,CAAC;AAGjD,cAAc,cAAc,CAAC;AAG7B,cAAc,YAAY,CAAC;AAG3B,cAAc,SAAS,CAAC;AAGxB,cAAc,SAAS,CAAC;AAExB,cAAc,WAAW,CAA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AAgB,CAAC;AAG/B,cAAc,UAAU,CAAC;AAGzB,cAAc,WAAW,CAAC;AAG1B,cAAc,mBAAmB,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../../src/components/ui/uptime-bar/index.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,SAAS,EACT,SAAS,IAAI,OAAO,EACpB,yBAAyB,EACzB,gBAAgB,EAChB,iBAAiB,EACjB,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,cAAc,CAAC"}
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { type VariantProps } from "class-variance-authority";
|
|
2
|
+
import type { HTMLAttributes, MouseEvent, ReactElement, ReactNode, Ref } from "react";
|
|
3
|
+
export declare const uptimeBarSizeIds: ["sm", "default", "lg"];
|
|
4
|
+
export type UptimeBarSizeId = (typeof uptimeBarSizeIds)[number];
|
|
5
|
+
export declare const uptimeBarShapeIds: ["rounded", "pill", "square"];
|
|
6
|
+
export type UptimeBarShapeId = (typeof uptimeBarShapeIds)[number];
|
|
7
|
+
/**
|
|
8
|
+
* Status of a single period (usually a day) on the bar. `no-data` covers
|
|
9
|
+
* periods before monitoring started or gaps in collection.
|
|
10
|
+
*/
|
|
11
|
+
export declare const uptimeBarStatusIds: ["operational", "degraded", "outage", "maintenance", "no-data"];
|
|
12
|
+
export type UptimeBarStatusId = (typeof uptimeBarStatusIds)[number];
|
|
13
|
+
export declare const uptimeBarTickVariants: (props?: ({
|
|
14
|
+
size?: "sm" | "default" | "lg" | null | undefined;
|
|
15
|
+
shape?: "square" | "rounded" | "pill" | null | undefined;
|
|
16
|
+
} & import("class-variance-authority/types").ClassProp) | undefined) => string;
|
|
17
|
+
export interface UptimeBarPeriod {
|
|
18
|
+
/** The period this tick represents. Used as React key and tooltip title. */
|
|
19
|
+
date: Date | string;
|
|
20
|
+
/** Overall status for the period. */
|
|
21
|
+
status: UptimeBarStatusId;
|
|
22
|
+
/**
|
|
23
|
+
* Measured uptime for the period, 0–100. When omitted the period counts as
|
|
24
|
+
* 100% unless its status is `outage` (0%). `no-data` periods are always
|
|
25
|
+
* excluded from the overall percentage.
|
|
26
|
+
*/
|
|
27
|
+
uptime?: number;
|
|
28
|
+
/** Extra detail shown in the tooltip (e.g. incident titles). */
|
|
29
|
+
description?: ReactNode;
|
|
30
|
+
}
|
|
31
|
+
export interface UptimeBarProps extends Omit<HTMLAttributes<HTMLDivElement>, "children">, VariantProps<typeof uptimeBarTickVariants> {
|
|
32
|
+
/** Periods to render, oldest first. */
|
|
33
|
+
periods: ReadonlyArray<UptimeBarPeriod>;
|
|
34
|
+
/** Accessible name for the whole bar, e.g. `"API uptime, last 90 days"`. */
|
|
35
|
+
label: string;
|
|
36
|
+
/** Visible heading above the bar (e.g. the service name). */
|
|
37
|
+
headerLabel?: ReactNode;
|
|
38
|
+
/**
|
|
39
|
+
* Show the overall uptime percentage in the header. Defaults to `true`.
|
|
40
|
+
* The value comes from `uptimePercentage` when supplied, otherwise from
|
|
41
|
+
* `calculateUptimePercentage(periods)`.
|
|
42
|
+
*/
|
|
43
|
+
showUptime?: boolean;
|
|
44
|
+
/** Override the computed overall uptime percentage. */
|
|
45
|
+
uptimePercentage?: number;
|
|
46
|
+
/** Decimal places for the uptime percentage. Defaults to `2`. */
|
|
47
|
+
uptimeDecimals?: number;
|
|
48
|
+
/** Footer label under the first tick. Defaults to `"<n> days ago"`. */
|
|
49
|
+
startLabel?: ReactNode;
|
|
50
|
+
/** Footer label under the last tick. Defaults to `"Today"`. */
|
|
51
|
+
endLabel?: ReactNode;
|
|
52
|
+
/** Render the footer row (start / end labels). Defaults to `true`. */
|
|
53
|
+
showFooter?: boolean;
|
|
54
|
+
/** Render a legend for the statuses present in `periods`. Defaults to `false`. */
|
|
55
|
+
showLegend?: boolean;
|
|
56
|
+
/** Override the human-readable name of any status. */
|
|
57
|
+
statusLabels?: Partial<Record<UptimeBarStatusId, string>>;
|
|
58
|
+
/** Format a period's date for the tooltip and accessible label. */
|
|
59
|
+
formatDate?: (date: Date) => string;
|
|
60
|
+
/** Replace the default tooltip body for a period. */
|
|
61
|
+
renderTooltip?: (period: UptimeBarPeriod, statusLabel: string) => ReactNode;
|
|
62
|
+
/** Fired when a tick is clicked or activated via Enter / Space. */
|
|
63
|
+
onPeriodClick?: (period: UptimeBarPeriod, event: MouseEvent<HTMLButtonElement>) => void;
|
|
64
|
+
/** Extra classes for the row containing the ticks. */
|
|
65
|
+
trackClassName?: string;
|
|
66
|
+
ref?: Ref<HTMLDivElement>;
|
|
67
|
+
}
|
|
68
|
+
/**
|
|
69
|
+
* Average uptime across every period that has data. Returns `null` when no
|
|
70
|
+
* period has data, so callers can render a placeholder instead of `NaN%`.
|
|
71
|
+
*/
|
|
72
|
+
export declare function calculateUptimePercentage(periods: ReadonlyArray<UptimeBarPeriod>): number | null;
|
|
73
|
+
declare function UptimeBar({ periods, label, headerLabel, showUptime, uptimePercentage, uptimeDecimals, startLabel, endLabel, showFooter, showLegend, statusLabels, formatDate, renderTooltip, onPeriodClick, size, shape, className, trackClassName, ref, ...props }: UptimeBarProps): ReactElement;
|
|
74
|
+
declare namespace UptimeBar {
|
|
75
|
+
var displayName: string;
|
|
76
|
+
}
|
|
77
|
+
export { UptimeBar };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { cva } from "class-variance-authority";
|
|
4
|
+
import { useId } from "react";
|
|
5
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger, } from "../../ui/tooltip";
|
|
6
|
+
import { cn } from "../../../lib/utils";
|
|
7
|
+
export const uptimeBarSizeIds = [
|
|
8
|
+
"sm",
|
|
9
|
+
"default",
|
|
10
|
+
"lg",
|
|
11
|
+
];
|
|
12
|
+
export const uptimeBarShapeIds = [
|
|
13
|
+
"rounded",
|
|
14
|
+
"pill",
|
|
15
|
+
"square",
|
|
16
|
+
];
|
|
17
|
+
/**
|
|
18
|
+
* Status of a single period (usually a day) on the bar. `no-data` covers
|
|
19
|
+
* periods before monitoring started or gaps in collection.
|
|
20
|
+
*/
|
|
21
|
+
export const uptimeBarStatusIds = [
|
|
22
|
+
"operational",
|
|
23
|
+
"degraded",
|
|
24
|
+
"outage",
|
|
25
|
+
"maintenance",
|
|
26
|
+
"no-data",
|
|
27
|
+
];
|
|
28
|
+
const STATUS_BG_CLASSES = {
|
|
29
|
+
operational: "bg-emerald-500 dark:bg-emerald-400",
|
|
30
|
+
degraded: "bg-warning",
|
|
31
|
+
outage: "bg-destructive",
|
|
32
|
+
maintenance: "bg-schemavaults-brand-blue",
|
|
33
|
+
"no-data": "bg-muted-foreground/25",
|
|
34
|
+
};
|
|
35
|
+
const DEFAULT_STATUS_LABELS = {
|
|
36
|
+
operational: "Operational",
|
|
37
|
+
degraded: "Degraded performance",
|
|
38
|
+
outage: "Outage",
|
|
39
|
+
maintenance: "Scheduled maintenance",
|
|
40
|
+
"no-data": "No data",
|
|
41
|
+
};
|
|
42
|
+
export const uptimeBarTickVariants = cva("block w-full transition-[opacity,transform] duration-150 hover:scale-y-110 hover:opacity-80 focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-ring focus-visible:ring-offset-1 focus-visible:ring-offset-background motion-reduce:transition-none motion-reduce:hover:scale-y-100", {
|
|
43
|
+
variants: {
|
|
44
|
+
size: {
|
|
45
|
+
sm: "h-5",
|
|
46
|
+
default: "h-8",
|
|
47
|
+
lg: "h-11",
|
|
48
|
+
},
|
|
49
|
+
shape: {
|
|
50
|
+
rounded: "rounded-[3px]",
|
|
51
|
+
pill: "rounded-full",
|
|
52
|
+
square: "rounded-none",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
defaultVariants: {
|
|
56
|
+
size: "default",
|
|
57
|
+
shape: "rounded",
|
|
58
|
+
},
|
|
59
|
+
});
|
|
60
|
+
function toDate(value) {
|
|
61
|
+
return value instanceof Date ? value : new Date(value);
|
|
62
|
+
}
|
|
63
|
+
function defaultFormatDate(date) {
|
|
64
|
+
if (Number.isNaN(date.getTime()))
|
|
65
|
+
return "Unknown date";
|
|
66
|
+
return date.toLocaleDateString(undefined, {
|
|
67
|
+
year: "numeric",
|
|
68
|
+
month: "short",
|
|
69
|
+
day: "numeric",
|
|
70
|
+
});
|
|
71
|
+
}
|
|
72
|
+
function periodUptime(period) {
|
|
73
|
+
if (period.uptime !== undefined && Number.isFinite(period.uptime)) {
|
|
74
|
+
return Math.min(100, Math.max(0, period.uptime));
|
|
75
|
+
}
|
|
76
|
+
return period.status === "outage" ? 0 : 100;
|
|
77
|
+
}
|
|
78
|
+
/**
|
|
79
|
+
* Average uptime across every period that has data. Returns `null` when no
|
|
80
|
+
* period has data, so callers can render a placeholder instead of `NaN%`.
|
|
81
|
+
*/
|
|
82
|
+
export function calculateUptimePercentage(periods) {
|
|
83
|
+
const measured = periods.filter((p) => p.status !== "no-data");
|
|
84
|
+
if (measured.length === 0)
|
|
85
|
+
return null;
|
|
86
|
+
const sum = measured.reduce((acc, p) => acc + periodUptime(p), 0);
|
|
87
|
+
return sum / measured.length;
|
|
88
|
+
}
|
|
89
|
+
function UptimeBar({ periods, label, headerLabel, showUptime = true, uptimePercentage, uptimeDecimals = 2, startLabel, endLabel = "Today", showFooter = true, showLegend = false, statusLabels, formatDate = defaultFormatDate, renderTooltip, onPeriodClick, size, shape, className, trackClassName, ref, ...props }) {
|
|
90
|
+
const titleId = useId();
|
|
91
|
+
const labels = {
|
|
92
|
+
...DEFAULT_STATUS_LABELS,
|
|
93
|
+
...statusLabels,
|
|
94
|
+
};
|
|
95
|
+
const overall = uptimePercentage ?? calculateUptimePercentage(periods);
|
|
96
|
+
const showHeader = headerLabel !== undefined || showUptime;
|
|
97
|
+
const presentStatuses = uptimeBarStatusIds.filter((id) => periods.some((p) => p.status === id));
|
|
98
|
+
function handleActivate(period, event) {
|
|
99
|
+
onPeriodClick?.(period, event);
|
|
100
|
+
}
|
|
101
|
+
return (_jsx(TooltipProvider, { delayDuration: 0, skipDelayDuration: 0, children: _jsxs("div", { ref: ref, "data-slot": "uptime-bar", className: cn("flex w-full flex-col gap-2", className), ...props, children: [showHeader && (_jsxs("div", { "data-slot": "uptime-bar-header", className: "flex items-baseline justify-between gap-2 text-sm", children: [headerLabel !== undefined ? (_jsx("span", { id: titleId, className: "font-medium text-foreground", children: headerLabel })) : (_jsx("span", {})), showUptime && (_jsx("span", { "data-slot": "uptime-bar-percentage", className: "tabular-nums text-muted-foreground", children: overall === null
|
|
102
|
+
? "—"
|
|
103
|
+
: `${overall.toFixed(uptimeDecimals)}% uptime` }))] })), _jsx("ul", { "aria-label": label, "data-slot": "uptime-bar-track", className: cn("flex w-full items-end gap-[2px]", trackClassName), children: periods.map((period, index) => {
|
|
104
|
+
const date = toDate(period.date);
|
|
105
|
+
const dateLabel = formatDate(date);
|
|
106
|
+
const statusLabel = labels[period.status];
|
|
107
|
+
const uptimeText = period.status === "no-data"
|
|
108
|
+
? undefined
|
|
109
|
+
: `${periodUptime(period).toFixed(uptimeDecimals)}%`;
|
|
110
|
+
const ariaLabel = [dateLabel, statusLabel, uptimeText]
|
|
111
|
+
.filter(Boolean)
|
|
112
|
+
.join(", ");
|
|
113
|
+
return (_jsx("li", { "data-slot": "uptime-bar-period", className: "flex min-w-[2px] flex-1", children: _jsxs(Tooltip, { children: [_jsx(TooltipTrigger, { asChild: true, children: _jsx("button", { type: "button", "aria-label": ariaLabel, "data-slot": "uptime-bar-tick", "data-status": period.status, className: cn(uptimeBarTickVariants({ size, shape }), STATUS_BG_CLASSES[period.status], onPeriodClick ? "cursor-pointer" : "cursor-default"), onClick: onPeriodClick
|
|
114
|
+
? (e) => handleActivate(period, e)
|
|
115
|
+
: undefined }) }), _jsx(TooltipContent, { side: "top", "data-slot": "uptime-bar-tooltip", className: "max-w-64", children: renderTooltip ? (renderTooltip(period, statusLabel)) : (_jsxs("div", { className: "flex flex-col gap-1", children: [_jsx("span", { className: "font-medium", children: dateLabel }), _jsxs("span", { className: "inline-flex items-center gap-1.5 text-xs", children: [_jsx("span", { "aria-hidden": "true", className: cn("inline-block size-2 shrink-0 rounded-full", STATUS_BG_CLASSES[period.status]) }), statusLabel, uptimeText && (_jsxs("span", { className: "tabular-nums text-muted-foreground", children: ["\u00B7 ", uptimeText] }))] }), period.description !== undefined && (_jsx("div", { className: "text-xs text-muted-foreground", children: period.description }))] })) })] }) }, `${date.getTime()}-${index}`));
|
|
116
|
+
}) }), showFooter && (_jsxs("div", { "data-slot": "uptime-bar-footer", "aria-hidden": "true", className: "flex items-center justify-between gap-2 text-xs text-muted-foreground", children: [_jsx("span", { children: startLabel ??
|
|
117
|
+
`${periods.length} ${periods.length === 1 ? "day" : "days"} ago` }), _jsx("span", { children: endLabel })] })), showLegend && presentStatuses.length > 0 && (_jsx("ul", { "data-slot": "uptime-bar-legend", className: "flex flex-wrap items-center gap-x-4 gap-y-1 text-xs", children: presentStatuses.map((status) => (_jsxs("li", { className: "inline-flex items-center gap-1.5 text-muted-foreground", children: [_jsx("span", { "aria-hidden": "true", className: cn("inline-block size-2.5 shrink-0 rounded-[3px]", STATUS_BG_CLASSES[status]) }), labels[status]] }, status))) }))] }) }));
|
|
118
|
+
}
|
|
119
|
+
UptimeBar.displayName = "UptimeBar";
|
|
120
|
+
export { UptimeBar };
|
|
121
|
+
//# sourceMappingURL=uptime-bar.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"uptime-bar.js","sourceRoot":"","sources":["../../../../src/components/ui/uptime-bar/uptime-bar.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,GAAG,EAAqB,MAAM,0BAA0B,CAAC;AAQlE,OAAO,EAAE,KAAK,EAAE,MAAM,OAAO,CAAC;AAE9B,OAAO,EACL,OAAO,EACP,cAAc,EACd,eAAe,EACf,cAAc,GACf,MAAM,yBAAyB,CAAC;AACjC,OAAO,EAAE,EAAE,EAAE,MAAM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,SAAS,EAAE,EAAE,CACX,8CAA8C,EAC9C,iBAAiB,CAAC,MAAM,CAAC,CAC1B,GACD,EACD,MAAM,CAAC,MAAM,CAAC,KAVV,MAAM,CAWR,CACN,CAAC,GACC,CACN,IACG,GACU,CACnB,CAAC;AACJ,CAAC;AACD,SAAS,CAAC,WAAW,GAAG,WAAW,CAAC;AAEpC,OAAO,EAAE,SAAS,EAAE,CAAC"}
|
package/dist/types/Link.d.ts
CHANGED
|
@@ -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.
|
|
3
|
+
"version": "0.112.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.
|
|
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",
|