@mastra/playground-ui 60.0.0-alpha.6 → 60.0.0-alpha.7
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/MainSidebar.cjs.js +125 -11
- package/dist/components/MainSidebar.cjs.js.map +1 -1
- package/dist/components/MainSidebar.es.js +120 -1
- package/dist/components/MainSidebar.es.js.map +1 -1
- package/dist/{main-sidebar-CV19jNRC.cjs → main-sidebar-link-active-DI_5Ex7F.cjs} +4 -117
- package/dist/main-sidebar-link-active-DI_5Ex7F.cjs.map +1 -0
- package/dist/{main-sidebar-CIiWGCgI.js → main-sidebar-link-active-HTU7v8UD.js} +6 -118
- package/dist/main-sidebar-link-active-HTU7v8UD.js.map +1 -0
- package/dist/new/sidebar.cjs.js +32 -32
- package/dist/new/sidebar.cjs.js.map +1 -1
- package/dist/new/sidebar.es.js +2 -2
- package/package.json +9 -9
- package/dist/main-sidebar-CIiWGCgI.js.map +0 -1
- package/dist/main-sidebar-CV19jNRC.cjs.map +0 -1
|
@@ -2,18 +2,132 @@
|
|
|
2
2
|
|
|
3
3
|
Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
|
|
4
4
|
|
|
5
|
-
const
|
|
5
|
+
const jsxRuntime = require('react/jsx-runtime');
|
|
6
|
+
const utils_cn = require('../cn-DG0X1KEP.cjs');
|
|
7
|
+
const mainSidebarLinkActive = require('../main-sidebar-link-active-DI_5Ex7F.cjs');
|
|
8
|
+
const reactVisuallyHidden = require('@radix-ui/react-visually-hidden');
|
|
9
|
+
const React = require('react');
|
|
6
10
|
|
|
11
|
+
function MainSidebarBottom({ className, children, ...props }) {
|
|
12
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("mt-auto", className), ...props, children });
|
|
13
|
+
}
|
|
7
14
|
|
|
15
|
+
function MainSidebarNavHeader({
|
|
16
|
+
children,
|
|
17
|
+
className,
|
|
18
|
+
state: stateProp,
|
|
19
|
+
href,
|
|
20
|
+
isActive,
|
|
21
|
+
LinkComponent: LinkProp,
|
|
22
|
+
...props
|
|
23
|
+
}) {
|
|
24
|
+
const ctx = mainSidebarLinkActive.useMaybeSidebarState();
|
|
25
|
+
const state = stateProp ?? ctx?.state ?? "default";
|
|
26
|
+
const isMobile = ctx?.isMobile ?? false;
|
|
27
|
+
const Link = LinkProp ?? ctx?.LinkComponent ?? "a";
|
|
28
|
+
const showTitle = state === "default" && !isMobile;
|
|
29
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("mt-2 mb-0.5 flex min-h-8 min-w-0 items-center", className), children: showTitle ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
30
|
+
"header",
|
|
31
|
+
{
|
|
32
|
+
...props,
|
|
33
|
+
className: utils_cn.cn("max-w-full min-w-0 truncate pl-3 text-column", {
|
|
34
|
+
"text-foreground": isActive,
|
|
35
|
+
"text-muted-foreground/70": !isActive
|
|
36
|
+
}),
|
|
37
|
+
children: href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
38
|
+
Link,
|
|
39
|
+
{
|
|
40
|
+
href,
|
|
41
|
+
className: utils_cn.cn("block min-w-0 truncate transition-colors duration-normal", {
|
|
42
|
+
"hover:text-foreground": !isActive,
|
|
43
|
+
"text-foreground": isActive
|
|
44
|
+
}),
|
|
45
|
+
children
|
|
46
|
+
}
|
|
47
|
+
) : children
|
|
48
|
+
}
|
|
49
|
+
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
50
|
+
/* @__PURE__ */ jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("header", { ...props, children }) }),
|
|
51
|
+
/* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", className: "mx-3 h-px flex-1 bg-border" })
|
|
52
|
+
] }) });
|
|
53
|
+
}
|
|
8
54
|
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
55
|
+
function getLinkKey(link) {
|
|
56
|
+
return `${link.url}:${link.name}`;
|
|
57
|
+
}
|
|
58
|
+
function MainSidebarSectionLink({ link, activeCandidates, level = 0, isActive }) {
|
|
59
|
+
const childLinks = link.children ?? [];
|
|
60
|
+
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
61
|
+
mainSidebarLinkActive.MainSidebarNavLink,
|
|
62
|
+
{
|
|
63
|
+
link,
|
|
64
|
+
isActive: isActive?.(link, activeCandidates) ?? link.isActive,
|
|
65
|
+
level,
|
|
66
|
+
subItems: childLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(mainSidebarLinkActive.MainSidebarNavList, { className: "mt-0.5", children: childLinks.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
67
|
+
MainSidebarSectionLink,
|
|
68
|
+
{
|
|
69
|
+
link: child,
|
|
70
|
+
activeCandidates,
|
|
71
|
+
level: level + 1,
|
|
72
|
+
isActive
|
|
73
|
+
},
|
|
74
|
+
getLinkKey(child)
|
|
75
|
+
)) }) : null
|
|
76
|
+
}
|
|
77
|
+
);
|
|
78
|
+
}
|
|
79
|
+
function MainSidebarSections({ sections, isActive, className }) {
|
|
80
|
+
const baseId = React.useId();
|
|
81
|
+
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: sections.map((section) => {
|
|
82
|
+
const showSeparator = section.links.length > 0 && section.separator;
|
|
83
|
+
const headerId = section.title ? `${baseId}-${section.key}` : void 0;
|
|
84
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
85
|
+
mainSidebarLinkActive.MainSidebarNavSection,
|
|
86
|
+
{
|
|
87
|
+
className,
|
|
88
|
+
"aria-labelledby": headerId,
|
|
89
|
+
"aria-label": !headerId ? section.key : void 0,
|
|
90
|
+
children: [
|
|
91
|
+
showSeparator ? /* @__PURE__ */ jsxRuntime.jsx(mainSidebarLinkActive.MainSidebarNavSeparator, {}) : null,
|
|
92
|
+
section.title ? /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavHeader, { id: headerId, href: section.href, isActive: section.isHeaderActive, children: section.title }) : null,
|
|
93
|
+
/* @__PURE__ */ jsxRuntime.jsx(mainSidebarLinkActive.MainSidebarNavList, { children: section.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
94
|
+
MainSidebarSectionLink,
|
|
95
|
+
{
|
|
96
|
+
link,
|
|
97
|
+
activeCandidates: section.links,
|
|
98
|
+
isActive
|
|
99
|
+
},
|
|
100
|
+
getLinkKey(link)
|
|
101
|
+
)) })
|
|
102
|
+
]
|
|
103
|
+
},
|
|
104
|
+
section.key
|
|
105
|
+
);
|
|
106
|
+
}) });
|
|
107
|
+
}
|
|
108
|
+
|
|
109
|
+
const MainSidebar = Object.assign(mainSidebarLinkActive.MainSidebarRoot, {
|
|
110
|
+
Bottom: MainSidebarBottom,
|
|
111
|
+
Nav: mainSidebarLinkActive.MainSidebarNav,
|
|
112
|
+
NavSection: mainSidebarLinkActive.MainSidebarNavSection,
|
|
113
|
+
NavLink: mainSidebarLinkActive.MainSidebarNavLink,
|
|
114
|
+
NavLabel: mainSidebarLinkActive.MainSidebarNavLabel,
|
|
115
|
+
NavHeader: MainSidebarNavHeader,
|
|
116
|
+
NavList: mainSidebarLinkActive.MainSidebarNavList,
|
|
117
|
+
NavSeparator: mainSidebarLinkActive.MainSidebarNavSeparator,
|
|
118
|
+
Sections: MainSidebarSections,
|
|
119
|
+
Trigger: mainSidebarLinkActive.MainSidebarTrigger,
|
|
120
|
+
MobileTrigger: mainSidebarLinkActive.MainSidebarMobileTrigger
|
|
121
|
+
});
|
|
122
|
+
|
|
123
|
+
exports.MainSidebarMobileTrigger = mainSidebarLinkActive.MainSidebarMobileTrigger;
|
|
124
|
+
exports.MainSidebarProvider = mainSidebarLinkActive.MainSidebarProvider;
|
|
125
|
+
exports.MainSidebarTrigger = mainSidebarLinkActive.MainSidebarTrigger;
|
|
126
|
+
exports.getIsLinkActive = mainSidebarLinkActive.getIsLinkActive;
|
|
127
|
+
exports.navItemClasses = mainSidebarLinkActive.navItemClasses;
|
|
128
|
+
exports.useMainSidebar = mainSidebarLinkActive.useMainSidebar;
|
|
129
|
+
exports.useMaybeSidebar = mainSidebarLinkActive.useMaybeSidebar;
|
|
130
|
+
exports.useMaybeSidebarState = mainSidebarLinkActive.useMaybeSidebarState;
|
|
131
|
+
exports.useMobileDrawer = mainSidebarLinkActive.useMobileDrawer;
|
|
132
|
+
exports.MainSidebar = MainSidebar;
|
|
19
133
|
//# sourceMappingURL=MainSidebar.cjs.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MainSidebar.cjs.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;"}
|
|
1
|
+
{"version":3,"file":"MainSidebar.cjs.js","sources":["../../src/ds/components/MainSidebar/main-sidebar-bottom.tsx","../../src/ds/components/MainSidebar/main-sidebar-nav-header.tsx","../../src/ds/components/MainSidebar/main-sidebar-sections.tsx","../../src/ds/components/MainSidebar/main-sidebar.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport type MainSidebarBottomProps = ComponentPropsWithoutRef<'div'>;\n\nexport function MainSidebarBottom({ className, children, ...props }: MainSidebarBottomProps) {\n return (\n <div className={cn('mt-auto', className)} {...props}>\n {children}\n </div>\n );\n}\n","import type { ComponentPropsWithoutRef } from 'react';\nimport type { SidebarState } from './main-sidebar-context';\nimport { useMaybeSidebarState } from './main-sidebar-context';\nimport { VisuallyHidden } from '@/ds/primitives/visually-hidden';\nimport type { LinkComponent } from '@/ds/types/link-component';\nimport { cn } from '@/lib/utils';\n\nexport type MainSidebarNavHeaderProps = Omit<ComponentPropsWithoutRef<'header'>, 'children'> & {\n children?: React.ReactNode;\n state?: SidebarState;\n href?: string;\n isActive?: boolean;\n LinkComponent?: LinkComponent;\n};\nexport function MainSidebarNavHeader({\n children,\n className,\n state: stateProp,\n href,\n isActive,\n LinkComponent: LinkProp,\n ...props\n}: MainSidebarNavHeaderProps) {\n const ctx = useMaybeSidebarState();\n const state: SidebarState = stateProp ?? ctx?.state ?? 'default';\n const isMobile = ctx?.isMobile ?? false;\n const Link: LinkComponent = LinkProp ?? ctx?.LinkComponent ?? 'a';\n const showTitle = state === 'default' && !isMobile;\n\n return (\n <div className={cn('mt-2 mb-0.5 flex min-h-8 min-w-0 items-center', className)}>\n {showTitle ? (\n <header\n {...props}\n className={cn('max-w-full min-w-0 truncate pl-3 text-column', {\n 'text-foreground': isActive,\n 'text-muted-foreground/70': !isActive,\n })}\n >\n {href ? (\n <Link\n href={href}\n className={cn('block min-w-0 truncate transition-colors duration-normal', {\n 'hover:text-foreground': !isActive,\n 'text-foreground': isActive,\n })}\n >\n {children}\n </Link>\n ) : (\n children\n )}\n </header>\n ) : (\n <>\n <VisuallyHidden asChild>\n <header {...props}>{children}</header>\n </VisuallyHidden>\n <div aria-hidden=\"true\" className=\"mx-3 h-px flex-1 bg-border\" />\n </>\n )}\n </div>\n );\n}\n","import { useId } from 'react';\nimport { MainSidebarNavHeader } from './main-sidebar-nav-header';\nimport { MainSidebarNavLink } from './main-sidebar-nav-link';\nimport type { NavLink } from './main-sidebar-nav-link';\nimport { MainSidebarNavList } from './main-sidebar-nav-list';\nimport { MainSidebarNavSection } from './main-sidebar-nav-section';\nimport type { NavSection } from './main-sidebar-nav-section';\nimport { MainSidebarNavSeparator } from './main-sidebar-nav-separator';\n\nexport type MainSidebarSectionsProps = {\n sections: NavSection[];\n /**\n * Called per link to decide the active state. Receives the section's links so\n * callers can use section-aware active logic without re-scanning `sections`\n * from the outside. Default: each link's `isActive`.\n */\n isActive?: (link: NavLink, activeCandidates: NavLink[]) => boolean;\n className?: string;\n};\n\ntype MainSidebarSectionLinkProps = {\n link: NavLink;\n activeCandidates: NavLink[];\n level?: number;\n isActive?: MainSidebarSectionsProps['isActive'];\n};\n\nfunction getLinkKey(link: NavLink) {\n return `${link.url}:${link.name}`;\n}\n\nfunction MainSidebarSectionLink({ link, activeCandidates, level = 0, isActive }: MainSidebarSectionLinkProps) {\n const childLinks = link.children ?? [];\n\n return (\n <MainSidebarNavLink\n link={link}\n isActive={isActive?.(link, activeCandidates) ?? link.isActive}\n level={level}\n subItems={\n childLinks.length > 0 ? (\n <MainSidebarNavList className=\"mt-0.5\">\n {childLinks.map(child => (\n <MainSidebarSectionLink\n key={getLinkKey(child)}\n link={child}\n activeCandidates={activeCandidates}\n level={level + 1}\n isActive={isActive}\n />\n ))}\n </MainSidebarNavList>\n ) : null\n }\n />\n );\n}\n\nexport function MainSidebarSections({ sections, isActive, className }: MainSidebarSectionsProps) {\n const baseId = useId();\n\n return (\n <>\n {sections.map(section => {\n const showSeparator = section.links.length > 0 && section.separator;\n const headerId = section.title ? `${baseId}-${section.key}` : undefined;\n return (\n <MainSidebarNavSection\n key={section.key}\n className={className}\n aria-labelledby={headerId}\n aria-label={!headerId ? section.key : undefined}\n >\n {/* Render separator and header independently — a section can have\n both (titled group preceded by a divider). */}\n {showSeparator ? <MainSidebarNavSeparator /> : null}\n {section.title ? (\n <MainSidebarNavHeader id={headerId} href={section.href} isActive={section.isHeaderActive}>\n {section.title}\n </MainSidebarNavHeader>\n ) : null}\n <MainSidebarNavList>\n {section.links.map(link => (\n <MainSidebarSectionLink\n key={getLinkKey(link)}\n link={link}\n activeCandidates={section.links}\n isActive={isActive}\n />\n ))}\n </MainSidebarNavList>\n </MainSidebarNavSection>\n );\n })}\n </>\n );\n}\n","import { MainSidebarBottom } from './main-sidebar-bottom';\nimport { MainSidebarMobileTrigger } from './main-sidebar-mobile-trigger';\nimport { MainSidebarNav } from './main-sidebar-nav';\nimport { MainSidebarNavHeader } from './main-sidebar-nav-header';\nimport { MainSidebarNavLabel } from './main-sidebar-nav-label';\nimport { MainSidebarNavLink } from './main-sidebar-nav-link';\nimport { MainSidebarNavList } from './main-sidebar-nav-list';\nimport { MainSidebarNavSection } from './main-sidebar-nav-section';\nimport { MainSidebarNavSeparator } from './main-sidebar-nav-separator';\nimport { MainSidebarRoot } from './main-sidebar-root';\nimport { MainSidebarSections } from './main-sidebar-sections';\nimport { MainSidebarTrigger } from './main-sidebar-trigger';\n\nexport type { MainSidebarStateContextValue, MobileDrawerContextValue, SidebarState } from './main-sidebar-context';\nexport { useMainSidebar, useMaybeSidebar, useMaybeSidebarState, useMobileDrawer } from './main-sidebar-context';\nexport { MainSidebarProvider, type MainSidebarProviderProps } from './main-sidebar-provider';\nexport { navItemClasses } from './main-sidebar-nav-item-classes';\nexport { type MainSidebarNavItemSize } from './main-sidebar-nav-item-classes';\nexport { type NavLink } from './main-sidebar-nav-link';\nexport { type NavSection } from './main-sidebar-nav-section';\nexport { MainSidebarTrigger } from './main-sidebar-trigger';\nexport { MainSidebarMobileTrigger } from './main-sidebar-mobile-trigger';\nexport { getIsLinkActive } from './main-sidebar-link-active';\n\nexport const MainSidebar = Object.assign(MainSidebarRoot, {\n Bottom: MainSidebarBottom,\n Nav: MainSidebarNav,\n NavSection: MainSidebarNavSection,\n NavLink: MainSidebarNavLink,\n NavLabel: MainSidebarNavLabel,\n NavHeader: MainSidebarNavHeader,\n NavList: MainSidebarNavList,\n NavSeparator: MainSidebarNavSeparator,\n Sections: MainSidebarSections,\n Trigger: MainSidebarTrigger,\n MobileTrigger: MainSidebarMobileTrigger,\n});\n"],"names":["jsx","cn","useMaybeSidebarState","jsxs","Fragment","VisuallyHidden","MainSidebarNavLink","MainSidebarNavList","useId","MainSidebarNavSection","MainSidebarNavSeparator","MainSidebarRoot","MainSidebarNav","MainSidebarNavLabel","MainSidebarTrigger","MainSidebarMobileTrigger"],"mappings":";;;;;;;;;;AAKO,SAAS,kBAAkB,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,OAAM,EAA2B;AAC3F,EAAA,uBACEA,cAAA,CAAC,SAAI,SAAA,EAAWC,WAAA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AKC,oCAAA;AAAA,EACL,UAAA,EAAYH,2CAAA;AAAA,EACZ,OAAA,EAASH,wCAAA;AAAA,EACT,QAAA,EAAUO,yCAAA;AAAA,EACV,SAAA,EAAW,oBAAA;AAAA,EACX,OAAA,EAASN,wCAAA;AAAA,EACT,YAAA,EAAcG,6CAAA;AAAA,EACd,QAAA,EAAU,mBAAA;AAAA,EACV,OAAA,EAASI,wCAAA;AAAA,EACT,aAAA,EAAeC;AACjB,CAAC;;;;;;;;;;;;;"}
|
|
@@ -1,2 +1,121 @@
|
|
|
1
|
-
|
|
1
|
+
import { jsx, jsxs, Fragment } from 'react/jsx-runtime';
|
|
2
|
+
import { c as cn } from '../cn-65Adrsfj.js';
|
|
3
|
+
import { u as useMaybeSidebarState, M as MainSidebarNavSection, a as MainSidebarNavSeparator, b as MainSidebarNavList, c as MainSidebarNavLink, d as MainSidebarRoot, e as MainSidebarMobileTrigger, f as MainSidebarTrigger, g as MainSidebarNavLabel, h as MainSidebarNav } from '../main-sidebar-link-active-HTU7v8UD.js';
|
|
4
|
+
export { i as MainSidebarProvider, j as getIsLinkActive, n as navItemClasses, k as useMainSidebar, l as useMaybeSidebar, m as useMobileDrawer } from '../main-sidebar-link-active-HTU7v8UD.js';
|
|
5
|
+
import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
|
|
6
|
+
import { useId } from 'react';
|
|
7
|
+
|
|
8
|
+
function MainSidebarBottom({ className, children, ...props }) {
|
|
9
|
+
return /* @__PURE__ */ jsx("div", { className: cn("mt-auto", className), ...props, children });
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
function MainSidebarNavHeader({
|
|
13
|
+
children,
|
|
14
|
+
className,
|
|
15
|
+
state: stateProp,
|
|
16
|
+
href,
|
|
17
|
+
isActive,
|
|
18
|
+
LinkComponent: LinkProp,
|
|
19
|
+
...props
|
|
20
|
+
}) {
|
|
21
|
+
const ctx = useMaybeSidebarState();
|
|
22
|
+
const state = stateProp ?? ctx?.state ?? "default";
|
|
23
|
+
const isMobile = ctx?.isMobile ?? false;
|
|
24
|
+
const Link = LinkProp ?? ctx?.LinkComponent ?? "a";
|
|
25
|
+
const showTitle = state === "default" && !isMobile;
|
|
26
|
+
return /* @__PURE__ */ jsx("div", { className: cn("mt-2 mb-0.5 flex min-h-8 min-w-0 items-center", className), children: showTitle ? /* @__PURE__ */ jsx(
|
|
27
|
+
"header",
|
|
28
|
+
{
|
|
29
|
+
...props,
|
|
30
|
+
className: cn("max-w-full min-w-0 truncate pl-3 text-column", {
|
|
31
|
+
"text-foreground": isActive,
|
|
32
|
+
"text-muted-foreground/70": !isActive
|
|
33
|
+
}),
|
|
34
|
+
children: href ? /* @__PURE__ */ jsx(
|
|
35
|
+
Link,
|
|
36
|
+
{
|
|
37
|
+
href,
|
|
38
|
+
className: cn("block min-w-0 truncate transition-colors duration-normal", {
|
|
39
|
+
"hover:text-foreground": !isActive,
|
|
40
|
+
"text-foreground": isActive
|
|
41
|
+
}),
|
|
42
|
+
children
|
|
43
|
+
}
|
|
44
|
+
) : children
|
|
45
|
+
}
|
|
46
|
+
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
47
|
+
/* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx("header", { ...props, children }) }),
|
|
48
|
+
/* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "mx-3 h-px flex-1 bg-border" })
|
|
49
|
+
] }) });
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
function getLinkKey(link) {
|
|
53
|
+
return `${link.url}:${link.name}`;
|
|
54
|
+
}
|
|
55
|
+
function MainSidebarSectionLink({ link, activeCandidates, level = 0, isActive }) {
|
|
56
|
+
const childLinks = link.children ?? [];
|
|
57
|
+
return /* @__PURE__ */ jsx(
|
|
58
|
+
MainSidebarNavLink,
|
|
59
|
+
{
|
|
60
|
+
link,
|
|
61
|
+
isActive: isActive?.(link, activeCandidates) ?? link.isActive,
|
|
62
|
+
level,
|
|
63
|
+
subItems: childLinks.length > 0 ? /* @__PURE__ */ jsx(MainSidebarNavList, { className: "mt-0.5", children: childLinks.map((child) => /* @__PURE__ */ jsx(
|
|
64
|
+
MainSidebarSectionLink,
|
|
65
|
+
{
|
|
66
|
+
link: child,
|
|
67
|
+
activeCandidates,
|
|
68
|
+
level: level + 1,
|
|
69
|
+
isActive
|
|
70
|
+
},
|
|
71
|
+
getLinkKey(child)
|
|
72
|
+
)) }) : null
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
function MainSidebarSections({ sections, isActive, className }) {
|
|
77
|
+
const baseId = useId();
|
|
78
|
+
return /* @__PURE__ */ jsx(Fragment, { children: sections.map((section) => {
|
|
79
|
+
const showSeparator = section.links.length > 0 && section.separator;
|
|
80
|
+
const headerId = section.title ? `${baseId}-${section.key}` : void 0;
|
|
81
|
+
return /* @__PURE__ */ jsxs(
|
|
82
|
+
MainSidebarNavSection,
|
|
83
|
+
{
|
|
84
|
+
className,
|
|
85
|
+
"aria-labelledby": headerId,
|
|
86
|
+
"aria-label": !headerId ? section.key : void 0,
|
|
87
|
+
children: [
|
|
88
|
+
showSeparator ? /* @__PURE__ */ jsx(MainSidebarNavSeparator, {}) : null,
|
|
89
|
+
section.title ? /* @__PURE__ */ jsx(MainSidebarNavHeader, { id: headerId, href: section.href, isActive: section.isHeaderActive, children: section.title }) : null,
|
|
90
|
+
/* @__PURE__ */ jsx(MainSidebarNavList, { children: section.links.map((link) => /* @__PURE__ */ jsx(
|
|
91
|
+
MainSidebarSectionLink,
|
|
92
|
+
{
|
|
93
|
+
link,
|
|
94
|
+
activeCandidates: section.links,
|
|
95
|
+
isActive
|
|
96
|
+
},
|
|
97
|
+
getLinkKey(link)
|
|
98
|
+
)) })
|
|
99
|
+
]
|
|
100
|
+
},
|
|
101
|
+
section.key
|
|
102
|
+
);
|
|
103
|
+
}) });
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
const MainSidebar = Object.assign(MainSidebarRoot, {
|
|
107
|
+
Bottom: MainSidebarBottom,
|
|
108
|
+
Nav: MainSidebarNav,
|
|
109
|
+
NavSection: MainSidebarNavSection,
|
|
110
|
+
NavLink: MainSidebarNavLink,
|
|
111
|
+
NavLabel: MainSidebarNavLabel,
|
|
112
|
+
NavHeader: MainSidebarNavHeader,
|
|
113
|
+
NavList: MainSidebarNavList,
|
|
114
|
+
NavSeparator: MainSidebarNavSeparator,
|
|
115
|
+
Sections: MainSidebarSections,
|
|
116
|
+
Trigger: MainSidebarTrigger,
|
|
117
|
+
MobileTrigger: MainSidebarMobileTrigger
|
|
118
|
+
});
|
|
119
|
+
|
|
120
|
+
export { MainSidebar, MainSidebarMobileTrigger, MainSidebarTrigger, useMaybeSidebarState };
|
|
2
121
|
//# sourceMappingURL=MainSidebar.es.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"MainSidebar.es.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
|
|
1
|
+
{"version":3,"file":"MainSidebar.es.js","sources":["../../src/ds/components/MainSidebar/main-sidebar-bottom.tsx","../../src/ds/components/MainSidebar/main-sidebar-nav-header.tsx","../../src/ds/components/MainSidebar/main-sidebar-sections.tsx","../../src/ds/components/MainSidebar/main-sidebar.ts"],"sourcesContent":["import type { ComponentPropsWithoutRef } from 'react';\nimport { cn } from '@/lib/utils';\n\nexport type MainSidebarBottomProps = ComponentPropsWithoutRef<'div'>;\n\nexport function MainSidebarBottom({ className, children, ...props }: MainSidebarBottomProps) {\n return (\n <div className={cn('mt-auto', className)} {...props}>\n {children}\n </div>\n );\n}\n","import type { ComponentPropsWithoutRef } from 'react';\nimport type { SidebarState } from './main-sidebar-context';\nimport { useMaybeSidebarState } from './main-sidebar-context';\nimport { VisuallyHidden } from '@/ds/primitives/visually-hidden';\nimport type { LinkComponent } from '@/ds/types/link-component';\nimport { cn } from '@/lib/utils';\n\nexport type MainSidebarNavHeaderProps = Omit<ComponentPropsWithoutRef<'header'>, 'children'> & {\n children?: React.ReactNode;\n state?: SidebarState;\n href?: string;\n isActive?: boolean;\n LinkComponent?: LinkComponent;\n};\nexport function MainSidebarNavHeader({\n children,\n className,\n state: stateProp,\n href,\n isActive,\n LinkComponent: LinkProp,\n ...props\n}: MainSidebarNavHeaderProps) {\n const ctx = useMaybeSidebarState();\n const state: SidebarState = stateProp ?? ctx?.state ?? 'default';\n const isMobile = ctx?.isMobile ?? false;\n const Link: LinkComponent = LinkProp ?? ctx?.LinkComponent ?? 'a';\n const showTitle = state === 'default' && !isMobile;\n\n return (\n <div className={cn('mt-2 mb-0.5 flex min-h-8 min-w-0 items-center', className)}>\n {showTitle ? (\n <header\n {...props}\n className={cn('max-w-full min-w-0 truncate pl-3 text-column', {\n 'text-foreground': isActive,\n 'text-muted-foreground/70': !isActive,\n })}\n >\n {href ? (\n <Link\n href={href}\n className={cn('block min-w-0 truncate transition-colors duration-normal', {\n 'hover:text-foreground': !isActive,\n 'text-foreground': isActive,\n })}\n >\n {children}\n </Link>\n ) : (\n children\n )}\n </header>\n ) : (\n <>\n <VisuallyHidden asChild>\n <header {...props}>{children}</header>\n </VisuallyHidden>\n <div aria-hidden=\"true\" className=\"mx-3 h-px flex-1 bg-border\" />\n </>\n )}\n </div>\n );\n}\n","import { useId } from 'react';\nimport { MainSidebarNavHeader } from './main-sidebar-nav-header';\nimport { MainSidebarNavLink } from './main-sidebar-nav-link';\nimport type { NavLink } from './main-sidebar-nav-link';\nimport { MainSidebarNavList } from './main-sidebar-nav-list';\nimport { MainSidebarNavSection } from './main-sidebar-nav-section';\nimport type { NavSection } from './main-sidebar-nav-section';\nimport { MainSidebarNavSeparator } from './main-sidebar-nav-separator';\n\nexport type MainSidebarSectionsProps = {\n sections: NavSection[];\n /**\n * Called per link to decide the active state. Receives the section's links so\n * callers can use section-aware active logic without re-scanning `sections`\n * from the outside. Default: each link's `isActive`.\n */\n isActive?: (link: NavLink, activeCandidates: NavLink[]) => boolean;\n className?: string;\n};\n\ntype MainSidebarSectionLinkProps = {\n link: NavLink;\n activeCandidates: NavLink[];\n level?: number;\n isActive?: MainSidebarSectionsProps['isActive'];\n};\n\nfunction getLinkKey(link: NavLink) {\n return `${link.url}:${link.name}`;\n}\n\nfunction MainSidebarSectionLink({ link, activeCandidates, level = 0, isActive }: MainSidebarSectionLinkProps) {\n const childLinks = link.children ?? [];\n\n return (\n <MainSidebarNavLink\n link={link}\n isActive={isActive?.(link, activeCandidates) ?? link.isActive}\n level={level}\n subItems={\n childLinks.length > 0 ? (\n <MainSidebarNavList className=\"mt-0.5\">\n {childLinks.map(child => (\n <MainSidebarSectionLink\n key={getLinkKey(child)}\n link={child}\n activeCandidates={activeCandidates}\n level={level + 1}\n isActive={isActive}\n />\n ))}\n </MainSidebarNavList>\n ) : null\n }\n />\n );\n}\n\nexport function MainSidebarSections({ sections, isActive, className }: MainSidebarSectionsProps) {\n const baseId = useId();\n\n return (\n <>\n {sections.map(section => {\n const showSeparator = section.links.length > 0 && section.separator;\n const headerId = section.title ? `${baseId}-${section.key}` : undefined;\n return (\n <MainSidebarNavSection\n key={section.key}\n className={className}\n aria-labelledby={headerId}\n aria-label={!headerId ? section.key : undefined}\n >\n {/* Render separator and header independently — a section can have\n both (titled group preceded by a divider). */}\n {showSeparator ? <MainSidebarNavSeparator /> : null}\n {section.title ? (\n <MainSidebarNavHeader id={headerId} href={section.href} isActive={section.isHeaderActive}>\n {section.title}\n </MainSidebarNavHeader>\n ) : null}\n <MainSidebarNavList>\n {section.links.map(link => (\n <MainSidebarSectionLink\n key={getLinkKey(link)}\n link={link}\n activeCandidates={section.links}\n isActive={isActive}\n />\n ))}\n </MainSidebarNavList>\n </MainSidebarNavSection>\n );\n })}\n </>\n );\n}\n","import { MainSidebarBottom } from './main-sidebar-bottom';\nimport { MainSidebarMobileTrigger } from './main-sidebar-mobile-trigger';\nimport { MainSidebarNav } from './main-sidebar-nav';\nimport { MainSidebarNavHeader } from './main-sidebar-nav-header';\nimport { MainSidebarNavLabel } from './main-sidebar-nav-label';\nimport { MainSidebarNavLink } from './main-sidebar-nav-link';\nimport { MainSidebarNavList } from './main-sidebar-nav-list';\nimport { MainSidebarNavSection } from './main-sidebar-nav-section';\nimport { MainSidebarNavSeparator } from './main-sidebar-nav-separator';\nimport { MainSidebarRoot } from './main-sidebar-root';\nimport { MainSidebarSections } from './main-sidebar-sections';\nimport { MainSidebarTrigger } from './main-sidebar-trigger';\n\nexport type { MainSidebarStateContextValue, MobileDrawerContextValue, SidebarState } from './main-sidebar-context';\nexport { useMainSidebar, useMaybeSidebar, useMaybeSidebarState, useMobileDrawer } from './main-sidebar-context';\nexport { MainSidebarProvider, type MainSidebarProviderProps } from './main-sidebar-provider';\nexport { navItemClasses } from './main-sidebar-nav-item-classes';\nexport { type MainSidebarNavItemSize } from './main-sidebar-nav-item-classes';\nexport { type NavLink } from './main-sidebar-nav-link';\nexport { type NavSection } from './main-sidebar-nav-section';\nexport { MainSidebarTrigger } from './main-sidebar-trigger';\nexport { MainSidebarMobileTrigger } from './main-sidebar-mobile-trigger';\nexport { getIsLinkActive } from './main-sidebar-link-active';\n\nexport const MainSidebar = Object.assign(MainSidebarRoot, {\n Bottom: MainSidebarBottom,\n Nav: MainSidebarNav,\n NavSection: MainSidebarNavSection,\n NavLink: MainSidebarNavLink,\n NavLabel: MainSidebarNavLabel,\n NavHeader: MainSidebarNavHeader,\n NavList: MainSidebarNavList,\n NavSeparator: MainSidebarNavSeparator,\n Sections: MainSidebarSections,\n Trigger: MainSidebarTrigger,\n MobileTrigger: MainSidebarMobileTrigger,\n});\n"],"names":[],"mappings":";;;;;;;AAKO,SAAS,kBAAkB,EAAE,SAAA,EAAW,QAAA,EAAU,GAAG,OAAM,EAA2B;AAC3F,EAAA,uBACE,GAAA,CAAC,SAAI,SAAA,EAAW,EAAA,CAAG,WAAW,SAAS,CAAA,EAAI,GAAG,KAAA,EAC3C,QAAA,EACH,CAAA;AAEJ;;ACGO,SAAS,oBAAA,CAAqB;AAAA,EACnC,QAAA;AAAA,EACA,SAAA;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,EACT,YAAA,EAAc,uBAAA;AAAA,EACd,QAAA,EAAU,mBAAA;AAAA,EACV,OAAA,EAAS,kBAAA;AAAA,EACT,aAAA,EAAe;AACjB,CAAC;;;;"}
|
|
@@ -1,25 +1,21 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
const utils_cn = require('./cn-DG0X1KEP.cjs');
|
|
5
4
|
const lucideReact = require('lucide-react');
|
|
6
|
-
const React = require('react');
|
|
7
5
|
const primitives_typography = require('./primitives/typography.cjs.js');
|
|
6
|
+
const utils_cn = require('./cn-DG0X1KEP.cjs');
|
|
8
7
|
const scrollArea = require('./scroll-area-BzOyuS8Y.cjs');
|
|
9
|
-
const
|
|
8
|
+
const React = require('react');
|
|
10
9
|
const index = require('./index-C-fBJhpb.cjs');
|
|
11
10
|
const primitives_controlSize = require('./primitives/control-size.cjs.js');
|
|
12
11
|
const primitives_raisedSurface = require('./primitives/raised-surface.cjs.js');
|
|
13
12
|
const primitives_transitions = require('./primitives/transitions.cjs.js');
|
|
13
|
+
const reactVisuallyHidden = require('@radix-ui/react-visually-hidden');
|
|
14
14
|
const tooltip = require('./tooltip-DIZ5oqjV.cjs');
|
|
15
15
|
const drawer = require('./drawer-tUWEluOi.cjs');
|
|
16
16
|
const primitives_resizeHandleIndicator = require('./primitives/resize-handle-indicator.cjs.js');
|
|
17
17
|
const kbd = require('./kbd-BptPsKP6.cjs');
|
|
18
18
|
|
|
19
|
-
function MainSidebarBottom({ className, children, ...props }) {
|
|
20
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("mt-auto", className), ...props, children });
|
|
21
|
-
}
|
|
22
|
-
|
|
23
19
|
const MainSidebarContext = React.createContext(null);
|
|
24
20
|
const MobileDrawerContext = React.createContext(null);
|
|
25
21
|
function useMaybeSidebarState() {
|
|
@@ -91,46 +87,6 @@ function MainSidebarNav({
|
|
|
91
87
|
return /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": ariaLabel, className: utils_cn.cn("flex min-h-0 flex-1 flex-col", className), ...props, children: /* @__PURE__ */ jsxRuntime.jsx(scrollArea.ScrollArea, { className: "min-h-0 flex-1", viewPortClassName: "px-0.5", children }) });
|
|
92
88
|
}
|
|
93
89
|
|
|
94
|
-
function MainSidebarNavHeader({
|
|
95
|
-
children,
|
|
96
|
-
className,
|
|
97
|
-
state: stateProp,
|
|
98
|
-
href,
|
|
99
|
-
isActive,
|
|
100
|
-
LinkComponent: LinkProp,
|
|
101
|
-
...props
|
|
102
|
-
}) {
|
|
103
|
-
const ctx = useMaybeSidebarState();
|
|
104
|
-
const state = stateProp ?? ctx?.state ?? "default";
|
|
105
|
-
const isMobile = ctx?.isMobile ?? false;
|
|
106
|
-
const Link = LinkProp ?? ctx?.LinkComponent ?? "a";
|
|
107
|
-
const showTitle = state === "default" && !isMobile;
|
|
108
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("mt-2 mb-0.5 flex min-h-8 min-w-0 items-center", className), children: showTitle ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
109
|
-
"header",
|
|
110
|
-
{
|
|
111
|
-
...props,
|
|
112
|
-
className: utils_cn.cn("max-w-full min-w-0 truncate pl-3 text-column", {
|
|
113
|
-
"text-foreground": isActive,
|
|
114
|
-
"text-muted-foreground/70": !isActive
|
|
115
|
-
}),
|
|
116
|
-
children: href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
117
|
-
Link,
|
|
118
|
-
{
|
|
119
|
-
href,
|
|
120
|
-
className: utils_cn.cn("block min-w-0 truncate transition-colors duration-normal", {
|
|
121
|
-
"hover:text-foreground": !isActive,
|
|
122
|
-
"text-foreground": isActive
|
|
123
|
-
}),
|
|
124
|
-
children
|
|
125
|
-
}
|
|
126
|
-
) : children
|
|
127
|
-
}
|
|
128
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
129
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("header", { ...props, children }) }),
|
|
130
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", className: "mx-3 h-px flex-1 bg-border" })
|
|
131
|
-
] }) });
|
|
132
|
-
}
|
|
133
|
-
|
|
134
90
|
function MainSidebarNavLabel({ children, className, state: stateProp, ...rest }) {
|
|
135
91
|
const ctx = useMaybeSidebarState();
|
|
136
92
|
const state = stateProp ?? ctx?.state ?? "default";
|
|
@@ -557,60 +513,6 @@ function MainSidebarRoot({ children, className, mobileMode = "drawer" }) {
|
|
|
557
513
|
);
|
|
558
514
|
}
|
|
559
515
|
|
|
560
|
-
function getLinkKey(link) {
|
|
561
|
-
return `${link.url}:${link.name}`;
|
|
562
|
-
}
|
|
563
|
-
function MainSidebarSectionLink({ link, activeCandidates, level = 0, isActive }) {
|
|
564
|
-
const childLinks = link.children ?? [];
|
|
565
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
566
|
-
MainSidebarNavLink,
|
|
567
|
-
{
|
|
568
|
-
link,
|
|
569
|
-
isActive: isActive?.(link, activeCandidates) ?? link.isActive,
|
|
570
|
-
level,
|
|
571
|
-
subItems: childLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavList, { className: "mt-0.5", children: childLinks.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
572
|
-
MainSidebarSectionLink,
|
|
573
|
-
{
|
|
574
|
-
link: child,
|
|
575
|
-
activeCandidates,
|
|
576
|
-
level: level + 1,
|
|
577
|
-
isActive
|
|
578
|
-
},
|
|
579
|
-
getLinkKey(child)
|
|
580
|
-
)) }) : null
|
|
581
|
-
}
|
|
582
|
-
);
|
|
583
|
-
}
|
|
584
|
-
function MainSidebarSections({ sections, isActive, className }) {
|
|
585
|
-
const baseId = React.useId();
|
|
586
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: sections.map((section) => {
|
|
587
|
-
const showSeparator = section.links.length > 0 && section.separator;
|
|
588
|
-
const headerId = section.title ? `${baseId}-${section.key}` : void 0;
|
|
589
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
590
|
-
MainSidebarNavSection,
|
|
591
|
-
{
|
|
592
|
-
className,
|
|
593
|
-
"aria-labelledby": headerId,
|
|
594
|
-
"aria-label": !headerId ? section.key : void 0,
|
|
595
|
-
children: [
|
|
596
|
-
showSeparator ? /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavSeparator, {}) : null,
|
|
597
|
-
section.title ? /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavHeader, { id: headerId, href: section.href, isActive: section.isHeaderActive, children: section.title }) : null,
|
|
598
|
-
/* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavList, { children: section.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
599
|
-
MainSidebarSectionLink,
|
|
600
|
-
{
|
|
601
|
-
link,
|
|
602
|
-
activeCandidates: section.links,
|
|
603
|
-
isActive
|
|
604
|
-
},
|
|
605
|
-
getLinkKey(link)
|
|
606
|
-
)) })
|
|
607
|
-
]
|
|
608
|
-
},
|
|
609
|
-
section.key
|
|
610
|
-
);
|
|
611
|
-
}) });
|
|
612
|
-
}
|
|
613
|
-
|
|
614
516
|
function MainSidebarTrigger({ className, onClick, ...props }) {
|
|
615
517
|
const { desktopState, toggleSidebar } = useMainSidebar();
|
|
616
518
|
const isCollapsed = desktopState === "collapsed";
|
|
@@ -882,21 +784,6 @@ function getIsLinkActive(link, pathname, siblings = []) {
|
|
|
882
784
|
);
|
|
883
785
|
}
|
|
884
786
|
|
|
885
|
-
const MainSidebar = Object.assign(MainSidebarRoot, {
|
|
886
|
-
Bottom: MainSidebarBottom,
|
|
887
|
-
Nav: MainSidebarNav,
|
|
888
|
-
NavSection: MainSidebarNavSection,
|
|
889
|
-
NavLink: MainSidebarNavLink,
|
|
890
|
-
NavLabel: MainSidebarNavLabel,
|
|
891
|
-
NavHeader: MainSidebarNavHeader,
|
|
892
|
-
NavList: MainSidebarNavList,
|
|
893
|
-
NavSeparator: MainSidebarNavSeparator,
|
|
894
|
-
Sections: MainSidebarSections,
|
|
895
|
-
Trigger: MainSidebarTrigger,
|
|
896
|
-
MobileTrigger: MainSidebarMobileTrigger
|
|
897
|
-
});
|
|
898
|
-
|
|
899
|
-
exports.MainSidebar = MainSidebar;
|
|
900
787
|
exports.MainSidebarMobileTrigger = MainSidebarMobileTrigger;
|
|
901
788
|
exports.MainSidebarNav = MainSidebarNav;
|
|
902
789
|
exports.MainSidebarNavLabel = MainSidebarNavLabel;
|
|
@@ -913,4 +800,4 @@ exports.useMainSidebar = useMainSidebar;
|
|
|
913
800
|
exports.useMaybeSidebar = useMaybeSidebar;
|
|
914
801
|
exports.useMaybeSidebarState = useMaybeSidebarState;
|
|
915
802
|
exports.useMobileDrawer = useMobileDrawer;
|
|
916
|
-
//# sourceMappingURL=main-sidebar-
|
|
803
|
+
//# sourceMappingURL=main-sidebar-link-active-DI_5Ex7F.cjs.map
|