@schemavaults/ui 0.115.0 → 0.116.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 +9 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.d.ts +3 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.js +6 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-active-item-context.js.map +1 -1
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-context-provider.js +2 -1
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-context-provider.js.map +1 -1
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed-context.d.ts +29 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed-context.js +56 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed-context.js.map +1 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed.d.ts +21 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed.js +32 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed.js.map +1 -0
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-renderer.js +64 -6
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-renderer.js.map +1 -1
- package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group.d.ts +35 -0
- package/package.json +1 -1
|
@@ -11,6 +11,15 @@ export interface DashboardLayoutProps extends PropsWithChildren {
|
|
|
11
11
|
topBarTitle: string | CustomizableDashboardLayoutComponent;
|
|
12
12
|
topBarButtons?: CustomizableDashboardLayoutComponent;
|
|
13
13
|
sidebarFooterContent?: CustomizableDashboardLayoutComponent;
|
|
14
|
+
/**
|
|
15
|
+
* The sidebar menu: links, and groups of links under a heading, in the
|
|
16
|
+
* order they should appear.
|
|
17
|
+
*
|
|
18
|
+
* A group with `collapsible: true` can be folded away from its heading.
|
|
19
|
+
* `defaultCollapsed` starts it folded (unless it holds the active item),
|
|
20
|
+
* and `collapsed` with `onCollapsedChange` hands its state to the consumer,
|
|
21
|
+
* e.g. to persist it.
|
|
22
|
+
*/
|
|
14
23
|
sidebarItems: DashboardSidebarItemsAndGroupsDefinitions;
|
|
15
24
|
sizing?: DashboardLayoutSidebarSizing;
|
|
16
25
|
/**
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { type PropsWithChildren, type ReactElement } from "react";
|
|
2
2
|
import type { DashboardSidebarItemDefinition } from "./dashboard-sidebar-item-definition";
|
|
3
|
+
import type { DashboardSidebarItemGroupDefinition } from "./dashboard-sidebar-item-group";
|
|
3
4
|
/**
|
|
4
5
|
* The normalized path of the menu item for the current page, or `null` when
|
|
5
6
|
* the current page is unknown or matches no item.
|
|
@@ -22,3 +23,5 @@ export interface DashboardSidebarActiveItemFromPathnameHookProviderProps extends
|
|
|
22
23
|
export declare function DashboardSidebarActiveItemFromPathnameHookProvider({ usePathname, currentPathname, children, }: DashboardSidebarActiveItemFromPathnameHookProviderProps): ReactElement;
|
|
23
24
|
/** Whether `item` is the menu item for the page currently being viewed. */
|
|
24
25
|
export declare function useIsDashboardSidebarItemActive(item: DashboardSidebarItemDefinition): boolean;
|
|
26
|
+
/** Whether one of `group`'s items is the menu item for the current page. */
|
|
27
|
+
export declare function useDashboardSidebarItemGroupContainsActiveItem(group: DashboardSidebarItemGroupDefinition): boolean;
|
|
@@ -29,4 +29,10 @@ export function useIsDashboardSidebarItemActive(item) {
|
|
|
29
29
|
return (activePath !== null &&
|
|
30
30
|
normalizeDashboardSidebarPath(item.url) === activePath);
|
|
31
31
|
}
|
|
32
|
+
/** Whether one of `group`'s items is the menu item for the current page. */
|
|
33
|
+
export function useDashboardSidebarItemGroupContainsActiveItem(group) {
|
|
34
|
+
const activePath = useContext(DashboardSidebarActiveItemContext);
|
|
35
|
+
return (activePath !== null &&
|
|
36
|
+
group.items.some((item) => normalizeDashboardSidebarPath(item.url) === activePath));
|
|
37
|
+
}
|
|
32
38
|
//# sourceMappingURL=dashboard-sidebar-active-item-context.js.map
|
|
@@ -1 +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;
|
|
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;AAItD;;;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;AAED,4EAA4E;AAC5E,MAAM,UAAU,8CAA8C,CAC5D,KAA0C;IAE1C,MAAM,UAAU,GAAkB,UAAU,CAC1C,iCAAiC,CAClC,CAAC;IACF,OAAO,CACL,UAAU,KAAK,IAAI;QACnB,KAAK,CAAC,KAAK,CAAC,IAAI,CACd,CAAC,IAAoC,EAAW,EAAE,CAChD,6BAA6B,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,UAAU,CACzD,CACF,CAAC;AACJ,CAAC"}
|
|
@@ -3,6 +3,7 @@ import { jsx as _jsx } from "react/jsx-runtime";
|
|
|
3
3
|
import { useMemo } from "react";
|
|
4
4
|
import { DashboardSidebarItemsAndGroupsContext, } from "./dashboard-sidebar-items-and-groups-context";
|
|
5
5
|
import DashboardSidebarOpenStateProvider from "./dashboard-sidebar-open-state-provider";
|
|
6
|
+
import { DashboardSidebarToggledGroupsProvider } from "./dashboard-sidebar-item-group-collapsed-context";
|
|
6
7
|
import { DashboardLayoutSidebarSizeContext, DEFAULT_DASHBOARD_SIDEBAR_SIZE, } from "./dashboard-sidebar-sizing";
|
|
7
8
|
export function DashboardSidebarContextProvider({ children, sidebarItems, ...props }) {
|
|
8
9
|
const baseSizing = props.sizing ?? DEFAULT_DASHBOARD_SIDEBAR_SIZE;
|
|
@@ -10,7 +11,7 @@ export function DashboardSidebarContextProvider({ children, sidebarItems, ...pro
|
|
|
10
11
|
const sizing = useMemo(() => typeof sidebarOpenWidth === "string" && sidebarOpenWidth.length > 0
|
|
11
12
|
? { ...baseSizing, desktop_expanded_width: sidebarOpenWidth }
|
|
12
13
|
: baseSizing, [baseSizing, sidebarOpenWidth]);
|
|
13
|
-
return (_jsx(DashboardSidebarOpenStateProvider, { onOpenSidebar: props.onOpenSidebar, onCloseSidebar: props.onCloseSidebar, children: _jsx(DashboardSidebarItemsAndGroupsContext.Provider, { value: sidebarItems, children: _jsx(DashboardLayoutSidebarSizeContext.Provider, { value: sizing, children: children }) }) }));
|
|
14
|
+
return (_jsx(DashboardSidebarOpenStateProvider, { onOpenSidebar: props.onOpenSidebar, onCloseSidebar: props.onCloseSidebar, children: _jsx(DashboardSidebarItemsAndGroupsContext.Provider, { value: sidebarItems, children: _jsx(DashboardSidebarToggledGroupsProvider, { children: _jsx(DashboardLayoutSidebarSizeContext.Provider, { value: sizing, children: children }) }) }) }));
|
|
14
15
|
}
|
|
15
16
|
export default DashboardSidebarContextProvider;
|
|
16
17
|
//# sourceMappingURL=dashboard-sidebar-context-provider.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-sidebar-context-provider.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-context-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAA6C,MAAM,OAAO,CAAC;AAC3E,OAAO,EACL,qCAAqC,GAEtC,MAAM,8CAA8C,CAAC;AACtD,OAAO,iCAAiC,MAAM,yCAAyC,CAAC;AACxF,OAAO,EACL,iCAAiC,EACjC,8BAA8B,GAE/B,MAAM,4BAA4B,CAAC;AAkBpC,MAAM,UAAU,+BAA+B,CAAC,EAC9C,QAAQ,EACR,YAAY,EACZ,GAAG,KAAK,EAC4B;IACpC,MAAM,UAAU,GACd,KAAK,CAAC,MAAM,IAAI,8BAA8B,CAAC;IACjD,MAAM,gBAAgB,GAAuB,KAAK,CAAC,gBAAgB,CAAC;IACpE,MAAM,MAAM,GAAiC,OAAO,CAClD,GAAiC,EAAE,CACjC,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC;QACjE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE;QAC7D,CAAC,CAAC,UAAU,EAChB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAC/B,CAAC;IACF,OAAO,CACL,KAAC,iCAAiC,IAChC,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,cAAc,EAAE,KAAK,CAAC,cAAc,YAEpC,KAAC,qCAAqC,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACjE,KAAC,iCAAiC,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YACtD,QAAQ,GACkC,
|
|
1
|
+
{"version":3,"file":"dashboard-sidebar-context-provider.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-context-provider.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EAAE,OAAO,EAA6C,MAAM,OAAO,CAAC;AAC3E,OAAO,EACL,qCAAqC,GAEtC,MAAM,8CAA8C,CAAC;AACtD,OAAO,iCAAiC,MAAM,yCAAyC,CAAC;AACxF,OAAO,EAAE,qCAAqC,EAAE,MAAM,kDAAkD,CAAC;AACzG,OAAO,EACL,iCAAiC,EACjC,8BAA8B,GAE/B,MAAM,4BAA4B,CAAC;AAkBpC,MAAM,UAAU,+BAA+B,CAAC,EAC9C,QAAQ,EACR,YAAY,EACZ,GAAG,KAAK,EAC4B;IACpC,MAAM,UAAU,GACd,KAAK,CAAC,MAAM,IAAI,8BAA8B,CAAC;IACjD,MAAM,gBAAgB,GAAuB,KAAK,CAAC,gBAAgB,CAAC;IACpE,MAAM,MAAM,GAAiC,OAAO,CAClD,GAAiC,EAAE,CACjC,OAAO,gBAAgB,KAAK,QAAQ,IAAI,gBAAgB,CAAC,MAAM,GAAG,CAAC;QACjE,CAAC,CAAC,EAAE,GAAG,UAAU,EAAE,sBAAsB,EAAE,gBAAgB,EAAE;QAC7D,CAAC,CAAC,UAAU,EAChB,CAAC,UAAU,EAAE,gBAAgB,CAAC,CAC/B,CAAC;IACF,OAAO,CACL,KAAC,iCAAiC,IAChC,aAAa,EAAE,KAAK,CAAC,aAAa,EAClC,cAAc,EAAE,KAAK,CAAC,cAAc,YAEpC,KAAC,qCAAqC,CAAC,QAAQ,IAAC,KAAK,EAAE,YAAY,YACjE,KAAC,qCAAqC,cACpC,KAAC,iCAAiC,CAAC,QAAQ,IAAC,KAAK,EAAE,MAAM,YACtD,QAAQ,GACkC,GACP,GACO,GACf,CACrC,CAAC;AACJ,CAAC;AAED,eAAe,+BAA+B,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { type PropsWithChildren, type ReactElement } from "react";
|
|
2
|
+
import type { DashboardSidebarItemGroupDefinition } from "./dashboard-sidebar-item-group";
|
|
3
|
+
export interface IDashboardSidebarToggledGroupsContextType {
|
|
4
|
+
/** The collapsed state of each group the viewer has toggled, by title. */
|
|
5
|
+
toggledGroups: ReadonlyMap<string, boolean>;
|
|
6
|
+
setGroupToggled: (title: string, collapsed: boolean) => void;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* The groups the viewer has collapsed or expanded.
|
|
10
|
+
*
|
|
11
|
+
* Held above the sidebar rather than in each group, because the sidebar does
|
|
12
|
+
* not stay mounted: the mobile Sheet unmounts its content every time it
|
|
13
|
+
* closes, and the sidebar swaps between the Sheet and the desktop rail when
|
|
14
|
+
* the viewport crosses the breakpoint. State kept in a group would reset to
|
|
15
|
+
* `defaultCollapsed` on every one of those.
|
|
16
|
+
*/
|
|
17
|
+
export declare const DashboardSidebarToggledGroupsContext: import("react").Context<IDashboardSidebarToggledGroupsContextType>;
|
|
18
|
+
export declare function DashboardSidebarToggledGroupsProvider({ children, }: PropsWithChildren): ReactElement;
|
|
19
|
+
export interface DashboardSidebarItemGroupCollapsedState {
|
|
20
|
+
/** Whether the group is collapsed. Always `false` unless `collapsible`. */
|
|
21
|
+
collapsed: boolean;
|
|
22
|
+
/** Collapse an expanded group, or expand a collapsed one. */
|
|
23
|
+
toggle: () => void;
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* The collapsed state of a sidebar group, and the toggle for its heading. See
|
|
27
|
+
* {@link resolveDashboardSidebarItemGroupCollapsed} for how it is decided.
|
|
28
|
+
*/
|
|
29
|
+
export declare function useDashboardSidebarItemGroupCollapsedState(group: DashboardSidebarItemGroupDefinition): DashboardSidebarItemGroupCollapsedState;
|
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useCallback, useContext, useMemo, useState, } from "react";
|
|
4
|
+
import { resolveDashboardSidebarItemGroupCollapsed } from "./dashboard-sidebar-item-group-collapsed";
|
|
5
|
+
import { useDashboardSidebarItemGroupContainsActiveItem } from "./dashboard-sidebar-active-item-context";
|
|
6
|
+
/**
|
|
7
|
+
* The groups the viewer has collapsed or expanded.
|
|
8
|
+
*
|
|
9
|
+
* Held above the sidebar rather than in each group, because the sidebar does
|
|
10
|
+
* not stay mounted: the mobile Sheet unmounts its content every time it
|
|
11
|
+
* closes, and the sidebar swaps between the Sheet and the desktop rail when
|
|
12
|
+
* the viewport crosses the breakpoint. State kept in a group would reset to
|
|
13
|
+
* `defaultCollapsed` on every one of those.
|
|
14
|
+
*/
|
|
15
|
+
export const DashboardSidebarToggledGroupsContext = createContext({
|
|
16
|
+
toggledGroups: new Map(),
|
|
17
|
+
setGroupToggled: (title, collapsed) => {
|
|
18
|
+
void title;
|
|
19
|
+
void collapsed;
|
|
20
|
+
throw new Error("Not within <DashboardSidebarToggledGroupsProvider>!");
|
|
21
|
+
},
|
|
22
|
+
});
|
|
23
|
+
export function DashboardSidebarToggledGroupsProvider({ children, }) {
|
|
24
|
+
// A Map rather than a plain object, so that a group titled `constructor` or
|
|
25
|
+
// `__proto__` cannot read a prototype member as its state.
|
|
26
|
+
const [toggledGroups, setToggledGroups] = useState(() => new Map());
|
|
27
|
+
const setGroupToggled = useCallback((title, collapsed) => {
|
|
28
|
+
setToggledGroups((previous) => new Map(previous).set(title, collapsed));
|
|
29
|
+
}, []);
|
|
30
|
+
const value = useMemo(() => ({
|
|
31
|
+
toggledGroups,
|
|
32
|
+
setGroupToggled,
|
|
33
|
+
}), [toggledGroups, setGroupToggled]);
|
|
34
|
+
return (_jsx(DashboardSidebarToggledGroupsContext.Provider, { value: value, children: children }));
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* The collapsed state of a sidebar group, and the toggle for its heading. See
|
|
38
|
+
* {@link resolveDashboardSidebarItemGroupCollapsed} for how it is decided.
|
|
39
|
+
*/
|
|
40
|
+
export function useDashboardSidebarItemGroupCollapsedState(group) {
|
|
41
|
+
const { toggledGroups, setGroupToggled } = useContext(DashboardSidebarToggledGroupsContext);
|
|
42
|
+
const containsActiveItem = useDashboardSidebarItemGroupContainsActiveItem(group);
|
|
43
|
+
const collapsed = resolveDashboardSidebarItemGroupCollapsed(group, toggledGroups.get(group.title), containsActiveItem);
|
|
44
|
+
function toggle() {
|
|
45
|
+
const next = !collapsed;
|
|
46
|
+
// A controlled group's state belongs to its owner, who hears about the
|
|
47
|
+
// toggle below; recording it here as well would resurface as a stale
|
|
48
|
+
// value if the owner ever stopped passing `collapsed`.
|
|
49
|
+
if (group.collapsed === undefined) {
|
|
50
|
+
setGroupToggled(group.title, next);
|
|
51
|
+
}
|
|
52
|
+
group.onCollapsedChange?.(next);
|
|
53
|
+
}
|
|
54
|
+
return { collapsed, toggle };
|
|
55
|
+
}
|
|
56
|
+
//# sourceMappingURL=dashboard-sidebar-item-group-collapsed-context.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-sidebar-item-group-collapsed-context.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed-context.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,EACL,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,EACP,QAAQ,GAGT,MAAM,OAAO,CAAC;AAEf,OAAO,EAAE,yCAAyC,EAAE,MAAM,0CAA0C,CAAC;AACrG,OAAO,EAAE,8CAA8C,EAAE,MAAM,yCAAyC,CAAC;AAQzG;;;;;;;;GAQG;AACH,MAAM,CAAC,MAAM,oCAAoC,GAC/C,aAAa,CAA4C;IACvD,aAAa,EAAE,IAAI,GAAG,EAAmB;IACzC,eAAe,EAAE,CAAC,KAAa,EAAE,SAAkB,EAAQ,EAAE;QAC3D,KAAK,KAAK,CAAC;QACX,KAAK,SAAS,CAAC;QACf,MAAM,IAAI,KAAK,CACb,qDAAqD,CACtD,CAAC;IACJ,CAAC;CACF,CAAC,CAAC;AAEL,MAAM,UAAU,qCAAqC,CAAC,EACpD,QAAQ,GACU;IAClB,4EAA4E;IAC5E,2DAA2D;IAC3D,MAAM,CAAC,aAAa,EAAE,gBAAgB,CAAC,GAAG,QAAQ,CAEhD,GAAiC,EAAE,CAAC,IAAI,GAAG,EAAmB,CAAC,CAAC;IAElE,MAAM,eAAe,GAAG,WAAW,CACjC,CAAC,KAAa,EAAE,SAAkB,EAAQ,EAAE;QAC1C,gBAAgB,CACd,CACE,QAAsC,EACR,EAAE,CAChC,IAAI,GAAG,CAAkB,QAAQ,CAAC,CAAC,GAAG,CAAC,KAAK,EAAE,SAAS,CAAC,CAC3D,CAAC;IACJ,CAAC,EACD,EAAE,CACH,CAAC;IAEF,MAAM,KAAK,GAA8C,OAAO,CAC9D,GAA8C,EAAE,CAAC,CAAC;QAChD,aAAa;QACb,eAAe;KAChB,CAAC,EACF,CAAC,aAAa,EAAE,eAAe,CAAC,CACjC,CAAC;IAEF,OAAO,CACL,KAAC,oCAAoC,CAAC,QAAQ,IAAC,KAAK,EAAE,KAAK,YACxD,QAAQ,GACqC,CACjD,CAAC;AACJ,CAAC;AASD;;;GAGG;AACH,MAAM,UAAU,0CAA0C,CACxD,KAA0C;IAE1C,MAAM,EAAE,aAAa,EAAE,eAAe,EAAE,GAAG,UAAU,CACnD,oCAAoC,CACrC,CAAC;IACF,MAAM,kBAAkB,GACtB,8CAA8C,CAAC,KAAK,CAAC,CAAC;IAExD,MAAM,SAAS,GAAY,yCAAyC,CAClE,KAAK,EACL,aAAa,CAAC,GAAG,CAAC,KAAK,CAAC,KAAK,CAAC,EAC9B,kBAAkB,CACnB,CAAC;IAEF,SAAS,MAAM;QACb,MAAM,IAAI,GAAY,CAAC,SAAS,CAAC;QACjC,uEAAuE;QACvE,qEAAqE;QACrE,uDAAuD;QACvD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;YAClC,eAAe,CAAC,KAAK,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;QACrC,CAAC;QACD,KAAK,CAAC,iBAAiB,EAAE,CAAC,IAAI,CAAC,CAAC;IAClC,CAAC;IAED,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,CAAC;AAC/B,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import type { DashboardSidebarItemGroupDefinition } from "./dashboard-sidebar-item-group";
|
|
2
|
+
/**
|
|
3
|
+
* Whether a sidebar group's links are folded away under its heading.
|
|
4
|
+
*
|
|
5
|
+
* In order of precedence:
|
|
6
|
+
*
|
|
7
|
+
* 1. A group that is not `collapsible` is never collapsed.
|
|
8
|
+
* 2. A controlled group (`collapsed` supplied) is whatever its owner says.
|
|
9
|
+
* 3. A group the viewer has toggled stays as they left it.
|
|
10
|
+
* 4. Otherwise it starts from `defaultCollapsed` — unless it holds the item
|
|
11
|
+
* for the page being viewed, which a default must not hide. Only a
|
|
12
|
+
* default yields to the active item: a viewer who folds that group away
|
|
13
|
+
* has asked for it, and an owner controlling the state already knows
|
|
14
|
+
* which page is current.
|
|
15
|
+
*
|
|
16
|
+
* @param toggledCollapsed The state the viewer last toggled the group to, or
|
|
17
|
+
* `undefined` when they have not toggled it.
|
|
18
|
+
* @param containsActiveItem Whether one of the group's items is the menu item
|
|
19
|
+
* for the current page.
|
|
20
|
+
*/
|
|
21
|
+
export declare function resolveDashboardSidebarItemGroupCollapsed(group: DashboardSidebarItemGroupDefinition, toggledCollapsed: boolean | undefined, containsActiveItem: boolean): boolean;
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Whether a sidebar group's links are folded away under its heading.
|
|
3
|
+
*
|
|
4
|
+
* In order of precedence:
|
|
5
|
+
*
|
|
6
|
+
* 1. A group that is not `collapsible` is never collapsed.
|
|
7
|
+
* 2. A controlled group (`collapsed` supplied) is whatever its owner says.
|
|
8
|
+
* 3. A group the viewer has toggled stays as they left it.
|
|
9
|
+
* 4. Otherwise it starts from `defaultCollapsed` — unless it holds the item
|
|
10
|
+
* for the page being viewed, which a default must not hide. Only a
|
|
11
|
+
* default yields to the active item: a viewer who folds that group away
|
|
12
|
+
* has asked for it, and an owner controlling the state already knows
|
|
13
|
+
* which page is current.
|
|
14
|
+
*
|
|
15
|
+
* @param toggledCollapsed The state the viewer last toggled the group to, or
|
|
16
|
+
* `undefined` when they have not toggled it.
|
|
17
|
+
* @param containsActiveItem Whether one of the group's items is the menu item
|
|
18
|
+
* for the current page.
|
|
19
|
+
*/
|
|
20
|
+
export function resolveDashboardSidebarItemGroupCollapsed(group, toggledCollapsed, containsActiveItem) {
|
|
21
|
+
if (group.collapsible !== true) {
|
|
22
|
+
return false;
|
|
23
|
+
}
|
|
24
|
+
if (group.collapsed !== undefined) {
|
|
25
|
+
return group.collapsed;
|
|
26
|
+
}
|
|
27
|
+
if (toggledCollapsed !== undefined) {
|
|
28
|
+
return toggledCollapsed;
|
|
29
|
+
}
|
|
30
|
+
return (group.defaultCollapsed ?? false) && !containsActiveItem;
|
|
31
|
+
}
|
|
32
|
+
//# sourceMappingURL=dashboard-sidebar-item-group-collapsed.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"dashboard-sidebar-item-group-collapsed.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-collapsed.ts"],"names":[],"mappings":"AAEA;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,UAAU,yCAAyC,CACvD,KAA0C,EAC1C,gBAAqC,EACrC,kBAA2B;IAE3B,IAAI,KAAK,CAAC,WAAW,KAAK,IAAI,EAAE,CAAC;QAC/B,OAAO,KAAK,CAAC;IACf,CAAC;IACD,IAAI,KAAK,CAAC,SAAS,KAAK,SAAS,EAAE,CAAC;QAClC,OAAO,KAAK,CAAC,SAAS,CAAC;IACzB,CAAC;IACD,IAAI,gBAAgB,KAAK,SAAS,EAAE,CAAC;QACnC,OAAO,gBAAgB,CAAC;IAC1B,CAAC;IACD,OAAO,CAAC,KAAK,CAAC,gBAAgB,IAAI,KAAK,CAAC,IAAI,CAAC,kBAAkB,CAAC;AAClE,CAAC"}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use client";
|
|
2
2
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { ChevronDown } from "lucide-react";
|
|
3
4
|
import DashboardSidebarItemRenderer from "./dashboard-sidebar-item-renderer";
|
|
4
5
|
import { Label } from "../../../ui";
|
|
5
6
|
import useDashboardSidebarOpenState from "./useDashboardSidebarOpenState";
|
|
@@ -8,17 +9,35 @@ import { AnimatePresence, m } from "../../../../framer-motion";
|
|
|
8
9
|
import useDashboardSidebarSizing from "./useDashboardSidebarSizing";
|
|
9
10
|
import { toggleDashboardLayoutCollapsedTransitionEasing } from "../toggle-dashboard-layout-collapsed-transition-time";
|
|
10
11
|
import useToggleDashboardLayoutCollapsedTransitionTime from "../useToggleDashboardLayoutCollapsedTransitionTime";
|
|
11
|
-
import useDashboardLayoutReducedMotion from "../useDashboardLayoutReducedMotion";
|
|
12
|
+
import useDashboardLayoutReducedMotion, { useDashboardLayoutReducedMotionSetting, } from "../useDashboardLayoutReducedMotion";
|
|
13
|
+
import { reducedMotionClassName, } from "../dashboard-layout-reduced-motion";
|
|
12
14
|
import { DashboardSidebarAdminOnlyItemsContext } from "./dashboard-sidebar-admin-only-items-context";
|
|
13
15
|
import { DEFAULT_LEADING_SIDEBAR_MENU_GROUP_LABEL_TOP_PADDING } from "./dashboard-sidebar-sizing";
|
|
16
|
+
import { useDashboardSidebarItemGroupCollapsedState } from "./dashboard-sidebar-item-group-collapsed-context";
|
|
17
|
+
/**
|
|
18
|
+
* Vertical padding, in pixels, inside a collapsible group's heading button.
|
|
19
|
+
*
|
|
20
|
+
* It makes the toggle a 22px target instead of a 14px line of text, and gives
|
|
21
|
+
* its inset focus ring room to clear the glyphs. The same amount comes back
|
|
22
|
+
* off the space below the heading, so the heading's text and the first row
|
|
23
|
+
* keep the distance between them that every other group has.
|
|
24
|
+
*/
|
|
25
|
+
const COLLAPSIBLE_GROUP_HEADING_VERTICAL_PADDING = 4;
|
|
14
26
|
export function DashboardSidebarItemGroupRenderer({ group, Link, first = false, }) {
|
|
15
27
|
const groupTitle = group.title;
|
|
16
28
|
const openState = useDashboardSidebarOpenState();
|
|
17
29
|
const sizes = useDashboardSidebarSizing();
|
|
18
30
|
const reducedMotion = useDashboardLayoutReducedMotion();
|
|
31
|
+
const reducedMotionSetting = useDashboardLayoutReducedMotionSetting();
|
|
19
32
|
const transitionTime = useToggleDashboardLayoutCollapsedTransitionTime();
|
|
33
|
+
const { collapsed, toggle } = useDashboardSidebarItemGroupCollapsedState(group);
|
|
20
34
|
const groupItemsContainerId = `sidebar-group-items-[${group.title}]`;
|
|
21
35
|
const showGroupLabel = openState.mobile || openState.open;
|
|
36
|
+
const collapsible = group.collapsible === true;
|
|
37
|
+
// The heading is the only way back into a collapsed group, so the group's
|
|
38
|
+
// links fold away only while the heading is showing. The collapsed desktop
|
|
39
|
+
// sidebar renders no headings, and lists every link in every group.
|
|
40
|
+
const itemsFolded = collapsible && collapsed && showGroupLabel;
|
|
22
41
|
// Zero for every group but the leading one, so the target below stays a
|
|
23
42
|
// single value rather than two conditional variants: a non-leading group
|
|
24
43
|
// animates 0 to 0 and is unaffected.
|
|
@@ -38,6 +57,9 @@ export function DashboardSidebarItemGroupRenderer({ group, Link, first = false,
|
|
|
38
57
|
? (sizes.sidebar_leading_menu_group_label_top_padding ??
|
|
39
58
|
DEFAULT_LEADING_SIDEBAR_MENU_GROUP_LABEL_TOP_PADDING)
|
|
40
59
|
: 0;
|
|
60
|
+
const groupItems = (_jsx(m.ul, { id: groupItemsContainerId, layout: !reducedMotion, className: cn("w-full flex flex-col", "items-start justify-start", sizes.sidebar_menu_item_gap_classname), children: group.items.map((item) => {
|
|
61
|
+
return (_jsx(DashboardSidebarItemRenderer, { item: item, Link: Link }, `sidebar-item-[${groupTitle}]-[${item.title}]`));
|
|
62
|
+
}) }));
|
|
41
63
|
return (_jsxs(m.div, { className: cn("w-full", "flex flex-col flex-nowrap", "items-start justify-start",
|
|
42
64
|
// The menu <nav> is a scrolling flex column, so its children shrink
|
|
43
65
|
// by default once the menu overflows. Keep the group at its natural
|
|
@@ -110,8 +132,28 @@ export function DashboardSidebarItemGroupRenderer({ group, Link, first = false,
|
|
|
110
132
|
delay: 0,
|
|
111
133
|
},
|
|
112
134
|
}, children: _jsx("div", { className: cn("min-h-0 overflow-hidden", "text-nowrap"), children: _jsx("div", { style: {
|
|
113
|
-
paddingBottom:
|
|
114
|
-
|
|
135
|
+
paddingBottom: collapsible
|
|
136
|
+
? Math.max(0, sizes.sidebar_expanded_menu_group_label_bottom_padding -
|
|
137
|
+
COLLAPSIBLE_GROUP_HEADING_VERTICAL_PADDING)
|
|
138
|
+
: sizes.sidebar_expanded_menu_group_label_bottom_padding,
|
|
139
|
+
}, children: collapsible ? (_jsxs("button", { type: "button", "aria-expanded": !collapsed, "aria-controls": groupItemsContainerId, "data-state": collapsed ? "collapsed" : "expanded", onClick: toggle, className: cn("w-full flex flex-row flex-nowrap items-center justify-between gap-2",
|
|
140
|
+
// The heading Label's typography, so a collapsible
|
|
141
|
+
// group's heading reads like any other.
|
|
142
|
+
"text-sm font-bold leading-none text-left text-nowrap",
|
|
143
|
+
// Menu rows highlight the same way.
|
|
144
|
+
"hover:bg-accent transition-colors",
|
|
145
|
+
// Inset: the element that clips the heading while it
|
|
146
|
+
// opens and closes would cut an outset ring off.
|
|
147
|
+
"focus-visible:outline-none focus-visible:ring-2 focus-visible:ring-inset focus-visible:ring-ring"), style: {
|
|
148
|
+
// Same inset as the Label below, so the title lines up
|
|
149
|
+
// with the item titles.
|
|
150
|
+
paddingLeft: sizes.desktop_collapsed_width,
|
|
151
|
+
paddingRight: "0.75rem",
|
|
152
|
+
paddingTop: COLLAPSIBLE_GROUP_HEADING_VERTICAL_PADDING,
|
|
153
|
+
paddingBottom: COLLAPSIBLE_GROUP_HEADING_VERTICAL_PADDING,
|
|
154
|
+
}, children: [_jsx("span", { className: "min-w-0 truncate", children: groupTitle }), _jsx(ChevronDown, { "aria-hidden": "true", className: cn("h-3.5 w-3.5 shrink-0 text-muted-foreground",
|
|
155
|
+
// Points down while open and right while collapsed.
|
|
156
|
+
"transition-transform duration-300 ease-in-out", reducedMotionClassName(reducedMotionSetting), collapsed && "-rotate-90") })] })) : (_jsx(Label, { htmlFor: groupItemsContainerId, className: cn("font-bold text-nowrap", "block"),
|
|
115
157
|
// Align the group heading with the item titles underneath
|
|
116
158
|
// it: each item renders its icon inside a box exactly
|
|
117
159
|
// `desktop_collapsed_width` wide, so its title starts at
|
|
@@ -122,9 +164,25 @@ export function DashboardSidebarItemGroupRenderer({ group, Link, first = false,
|
|
|
122
164
|
style: {
|
|
123
165
|
paddingLeft: sizes.desktop_collapsed_width,
|
|
124
166
|
paddingRight: "0.5rem",
|
|
125
|
-
}, children: groupTitle }) }) }) }, "sidebar-item-group-label")) }), _jsx(DashboardSidebarAdminOnlyItemsContext.Provider, { value: group.adminOnly ?? false, children: _jsx(m.
|
|
126
|
-
|
|
127
|
-
|
|
167
|
+
}, children: groupTitle })) }) }) }, "sidebar-item-group-label")) }), _jsx(DashboardSidebarAdminOnlyItemsContext.Provider, { value: group.adminOnly ?? false, children: collapsible ? (_jsx(m.div
|
|
168
|
+
// Folds the list the way the heading above opens and closes: a
|
|
169
|
+
// one-row grid whose track runs between `1fr` and `0fr`, so
|
|
170
|
+
// nothing has to be measured and the fold reaches a true zero.
|
|
171
|
+
// See the heading for why `height: auto` is not used.
|
|
172
|
+
, { "data-slot": "dashboard-sidebar-group-items-fold", "data-state": itemsFolded ? "folded" : "unfolded", className: "w-full grid", initial: false, animate: {
|
|
173
|
+
gridTemplateRows: itemsFolded ? "0fr" : "1fr",
|
|
174
|
+
// Clipping is only needed while the list is folded or on its
|
|
175
|
+
// way in or out. At rest it would crop the glow around the
|
|
176
|
+
// active row's indicator bar wherever that row is first or
|
|
177
|
+
// last in the group, so the clip is lifted once the list has
|
|
178
|
+
// finished opening.
|
|
179
|
+
overflow: "hidden",
|
|
180
|
+
transitionEnd: itemsFolded ? undefined : { overflow: "visible" },
|
|
181
|
+
transition: {
|
|
182
|
+
duration: transitionTime,
|
|
183
|
+
ease: toggleDashboardLayoutCollapsedTransitionEasing,
|
|
184
|
+
},
|
|
185
|
+
}, children: _jsx("div", { className: "min-h-0", inert: itemsFolded, children: groupItems }) })) : (groupItems) })] }, `sidebar-group-[${group.title}]`));
|
|
128
186
|
}
|
|
129
187
|
export default DashboardSidebarItemGroupRenderer;
|
|
130
188
|
//# sourceMappingURL=dashboard-sidebar-item-group-renderer.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"dashboard-sidebar-item-group-renderer.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-renderer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;
|
|
1
|
+
{"version":3,"file":"dashboard-sidebar-item-group-renderer.js","sourceRoot":"","sources":["../../../../../src/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group-renderer.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAGb,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAG3C,OAAO,4BAA4B,MAAM,mCAAmC,CAAC;AAC7E,OAAO,EAAE,KAAK,EAAE,MAAM,iBAAiB,CAAC;AACxC,OAAO,4BAA4B,MAAM,gCAAgC,CAAC;AAC1E,OAAO,EAAE,EAAE,EAAE,MAAM,aAAa,CAAC;AACjC,OAAO,EAAE,eAAe,EAAE,CAAC,EAAE,MAAM,iBAAiB,CAAC;AACrD,OAAO,yBAAyB,MAAM,6BAA6B,CAAC;AACpE,OAAO,EAAE,8CAA8C,EAAE,MAAM,sDAAsD,CAAC;AACtH,OAAO,+CAA+C,MAAM,oDAAoD,CAAC;AACjH,OAAO,+BAA+B,EAAE,EACtC,sCAAsC,GACvC,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EACL,sBAAsB,GAEvB,MAAM,oCAAoC,CAAC;AAC5C,OAAO,EAAE,qCAAqC,EAAE,MAAM,8CAA8C,CAAC;AACrG,OAAO,EAAE,oDAAoD,EAAE,MAAM,4BAA4B,CAAC;AAElG,OAAO,EAAE,0CAA0C,EAAE,MAAM,kDAAkD,CAAC;AAE9G;;;;;;;GAOG;AACH,MAAM,0CAA0C,GAAG,CAAC,CAA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O,EAAE;wBACP,gBAAgB,EAAE,WAAW,CAAC,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,KAAK;wBAC7C,6DAA6D;wBAC7D,2DAA2D;wBAC3D,2DAA2D;wBAC3D,6DAA6D;wBAC7D,oBAAoB;wBACpB,QAAQ,EAAE,QAAQ;wBAClB,aAAa,EAAE,WAAW,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,EAAE,QAAQ,EAAE,SAAS,EAAE;wBAChE,UAAU,EAAE;4BACV,QAAQ,EAAE,cAAc;4BACxB,IAAI,EAAE,8CAA8C;yBACrD;qBACF,YAQD,cAAK,SAAS,EAAC,SAAS,EAAC,KAAK,EAAE,WAAW,YACxC,UAAU,GACP,GACA,CACT,CAAC,CAAC,CAAC,CACF,UAAU,CACX,GAC8C,KA3M5C,kBAAkB,KAAK,CAAC,KAAK,GAAG,CA4M/B,CACT,CAAC;AACJ,CAAC;AAED,eAAe,iCAAiC,CAAC"}
|
package/dist/components/layout/dashboard-layout/dashboard-sidebar/dashboard-sidebar-item-group.d.ts
CHANGED
|
@@ -4,4 +4,39 @@ export interface DashboardSidebarItemGroupDefinition {
|
|
|
4
4
|
items: readonly DashboardSidebarItemDefinition[];
|
|
5
5
|
title: string;
|
|
6
6
|
adminOnly?: boolean;
|
|
7
|
+
/**
|
|
8
|
+
* Lets the viewer fold the group's links away under its heading. The heading
|
|
9
|
+
* becomes a button with a chevron that collapses and expands the group's
|
|
10
|
+
* list. Defaults to `false`, which renders the group exactly as before.
|
|
11
|
+
*
|
|
12
|
+
* Only the expanded menu folds: the collapsed (icon-only) desktop sidebar
|
|
13
|
+
* shows no headings, so it has no toggle to reopen a group with, and it
|
|
14
|
+
* lists every link whether its group is collapsed or not.
|
|
15
|
+
*
|
|
16
|
+
* The collapsed state is remembered for as long as the layout is mounted,
|
|
17
|
+
* including while the mobile sidebar is closed. A group is identified by its
|
|
18
|
+
* `title`, so keep titles unique among collapsible groups. Use `collapsed`
|
|
19
|
+
* and `onCollapsedChange` to persist it any longer, e.g. across reloads.
|
|
20
|
+
*/
|
|
21
|
+
collapsible?: boolean;
|
|
22
|
+
/**
|
|
23
|
+
* Whether a `collapsible` group starts out collapsed. Defaults to `false`.
|
|
24
|
+
*
|
|
25
|
+
* It does not hide the page being viewed: while the group holds the active
|
|
26
|
+
* item (see `DashboardLayout`'s `activeHref` and `usePathname`) it starts
|
|
27
|
+
* expanded instead. Once the viewer toggles the group, their choice wins.
|
|
28
|
+
* Ignored when `collapsed` is supplied.
|
|
29
|
+
*/
|
|
30
|
+
defaultCollapsed?: boolean;
|
|
31
|
+
/**
|
|
32
|
+
* The collapsed state of a `collapsible` group, for controlling it from
|
|
33
|
+
* outside. Leave it `undefined` to let the sidebar manage the state itself,
|
|
34
|
+
* starting from `defaultCollapsed`.
|
|
35
|
+
*/
|
|
36
|
+
collapsed?: boolean;
|
|
37
|
+
/**
|
|
38
|
+
* Called with the group's new collapsed state when the viewer toggles a
|
|
39
|
+
* `collapsible` group, whether or not `collapsed` is supplied.
|
|
40
|
+
*/
|
|
41
|
+
onCollapsedChange?: (collapsed: boolean) => void;
|
|
7
42
|
}
|