@mastra/playground-ui 56.0.0-alpha.7 → 56.0.0-alpha.8
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-BxC9yo3t.cjs → main-sidebar-link-active-Bzw7LY7r.cjs} +4 -117
- package/dist/main-sidebar-link-active-Bzw7LY7r.cjs.map +1 -0
- package/dist/{main-sidebar-D9QEbGX4.js → main-sidebar-link-active-D1iR9bHo.js} +6 -118
- package/dist/main-sidebar-link-active-D1iR9bHo.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 +6 -6
- package/dist/main-sidebar-BxC9yo3t.cjs.map +0 -1
- package/dist/main-sidebar-D9QEbGX4.js.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-BuHW7Wrt.cjs');
|
|
7
|
+
const mainSidebarLinkActive = require('../main-sidebar-link-active-Bzw7LY7r.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-ui-sm font-medium", {
|
|
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: "bg-border mx-3 h-px flex-1" })
|
|
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-ui-sm font-medium', {\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=\"bg-border mx-3 h-px flex-1\" />\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,SAA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AAAA,EACR,GAAA,EAAKC,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-C6s2yXwM.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-D1iR9bHo.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-D1iR9bHo.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-ui-sm font-medium", {
|
|
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: "bg-border mx-3 h-px flex-1" })
|
|
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-ui-sm font-medium', {\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=\"bg-border mx-3 h-px flex-1\" />\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,CAAq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;AAAA,EACX,OAAA,EAAS,kBAAA;AAAA,EACT,YAAA,EAAc,uBAAA;AAAA,EACd,QAAA,EAAU,mBAAA;AAAA,EACV,OAAA,EAAS,kBAAA;AAAA,EACT,aAAA,EAAe;AACjB,CAAC;;;;"}
|
|
@@ -1,22 +1,18 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
3
|
require('./new-theme.css');const jsxRuntime = require('react/jsx-runtime');
|
|
4
|
-
const utils_cn = require('./cn-BuHW7Wrt.cjs');
|
|
5
4
|
const lucideReact = require('lucide-react');
|
|
6
|
-
const
|
|
5
|
+
const utils_cn = require('./cn-BuHW7Wrt.cjs');
|
|
7
6
|
const scrollArea = require('./scroll-area-l6Yx-88I.cjs');
|
|
8
|
-
const
|
|
7
|
+
const React = require('react');
|
|
9
8
|
const index = require('./index-gbqoNdVM.cjs');
|
|
9
|
+
const reactVisuallyHidden = require('@radix-ui/react-visually-hidden');
|
|
10
10
|
const tooltip = require('./tooltip-_cda-a7s.cjs');
|
|
11
11
|
;/* empty css */
|
|
12
12
|
const drawer = require('./drawer-CEufBgtb.cjs');
|
|
13
13
|
const primitives_resizeHandleIndicator = require('./primitives/resize-handle-indicator.cjs.js');
|
|
14
14
|
const kbd = require('./kbd-DjjBBIZN.cjs');
|
|
15
15
|
|
|
16
|
-
function MainSidebarBottom({ className, children, ...props }) {
|
|
17
|
-
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: utils_cn.cn("mt-auto", className), ...props, children });
|
|
18
|
-
}
|
|
19
|
-
|
|
20
16
|
const MainSidebarContext = React.createContext(null);
|
|
21
17
|
const MobileDrawerContext = React.createContext(null);
|
|
22
18
|
function useMaybeSidebarState() {
|
|
@@ -87,46 +83,6 @@ function MainSidebarNav({
|
|
|
87
83
|
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 }) });
|
|
88
84
|
}
|
|
89
85
|
|
|
90
|
-
function MainSidebarNavHeader({
|
|
91
|
-
children,
|
|
92
|
-
className,
|
|
93
|
-
state: stateProp,
|
|
94
|
-
href,
|
|
95
|
-
isActive,
|
|
96
|
-
LinkComponent: LinkProp,
|
|
97
|
-
...props
|
|
98
|
-
}) {
|
|
99
|
-
const ctx = useMaybeSidebarState();
|
|
100
|
-
const state = stateProp ?? ctx?.state ?? "default";
|
|
101
|
-
const isMobile = ctx?.isMobile ?? false;
|
|
102
|
-
const Link = LinkProp ?? ctx?.LinkComponent ?? "a";
|
|
103
|
-
const showTitle = state === "default" && !isMobile;
|
|
104
|
-
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(
|
|
105
|
-
"header",
|
|
106
|
-
{
|
|
107
|
-
...props,
|
|
108
|
-
className: utils_cn.cn("max-w-full min-w-0 truncate pl-3 text-ui-sm font-medium", {
|
|
109
|
-
"text-foreground": isActive,
|
|
110
|
-
"text-muted-foreground/70": !isActive
|
|
111
|
-
}),
|
|
112
|
-
children: href ? /* @__PURE__ */ jsxRuntime.jsx(
|
|
113
|
-
Link,
|
|
114
|
-
{
|
|
115
|
-
href,
|
|
116
|
-
className: utils_cn.cn("block min-w-0 truncate transition-colors duration-normal", {
|
|
117
|
-
"hover:text-foreground": !isActive,
|
|
118
|
-
"text-foreground": isActive
|
|
119
|
-
}),
|
|
120
|
-
children
|
|
121
|
-
}
|
|
122
|
-
) : children
|
|
123
|
-
}
|
|
124
|
-
) : /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
|
|
125
|
-
/* @__PURE__ */ jsxRuntime.jsx(reactVisuallyHidden.VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsxRuntime.jsx("header", { ...props, children }) }),
|
|
126
|
-
/* @__PURE__ */ jsxRuntime.jsx("div", { "aria-hidden": "true", className: "bg-border mx-3 h-px flex-1" })
|
|
127
|
-
] }) });
|
|
128
|
-
}
|
|
129
|
-
|
|
130
86
|
function MainSidebarNavLabel({ children, className, state: stateProp, ...rest }) {
|
|
131
87
|
const ctx = useMaybeSidebarState();
|
|
132
88
|
const state = stateProp ?? ctx?.state ?? "default";
|
|
@@ -541,60 +497,6 @@ function MainSidebarRoot({ children, className, mobileMode = "drawer" }) {
|
|
|
541
497
|
);
|
|
542
498
|
}
|
|
543
499
|
|
|
544
|
-
function getLinkKey(link) {
|
|
545
|
-
return `${link.url}:${link.name}`;
|
|
546
|
-
}
|
|
547
|
-
function MainSidebarSectionLink({ link, activeCandidates, level = 0, isActive }) {
|
|
548
|
-
const childLinks = link.children ?? [];
|
|
549
|
-
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
550
|
-
MainSidebarNavLink,
|
|
551
|
-
{
|
|
552
|
-
link,
|
|
553
|
-
isActive: isActive?.(link, activeCandidates) ?? link.isActive,
|
|
554
|
-
level,
|
|
555
|
-
subItems: childLinks.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavList, { className: "mt-0.5", children: childLinks.map((child) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
556
|
-
MainSidebarSectionLink,
|
|
557
|
-
{
|
|
558
|
-
link: child,
|
|
559
|
-
activeCandidates,
|
|
560
|
-
level: level + 1,
|
|
561
|
-
isActive
|
|
562
|
-
},
|
|
563
|
-
getLinkKey(child)
|
|
564
|
-
)) }) : null
|
|
565
|
-
}
|
|
566
|
-
);
|
|
567
|
-
}
|
|
568
|
-
function MainSidebarSections({ sections, isActive, className }) {
|
|
569
|
-
const baseId = React.useId();
|
|
570
|
-
return /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children: sections.map((section) => {
|
|
571
|
-
const showSeparator = section.links.length > 0 && section.separator;
|
|
572
|
-
const headerId = section.title ? `${baseId}-${section.key}` : void 0;
|
|
573
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
574
|
-
MainSidebarNavSection,
|
|
575
|
-
{
|
|
576
|
-
className,
|
|
577
|
-
"aria-labelledby": headerId,
|
|
578
|
-
"aria-label": !headerId ? section.key : void 0,
|
|
579
|
-
children: [
|
|
580
|
-
showSeparator ? /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavSeparator, {}) : null,
|
|
581
|
-
section.title ? /* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavHeader, { id: headerId, href: section.href, isActive: section.isHeaderActive, children: section.title }) : null,
|
|
582
|
-
/* @__PURE__ */ jsxRuntime.jsx(MainSidebarNavList, { children: section.links.map((link) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
583
|
-
MainSidebarSectionLink,
|
|
584
|
-
{
|
|
585
|
-
link,
|
|
586
|
-
activeCandidates: section.links,
|
|
587
|
-
isActive
|
|
588
|
-
},
|
|
589
|
-
getLinkKey(link)
|
|
590
|
-
)) })
|
|
591
|
-
]
|
|
592
|
-
},
|
|
593
|
-
section.key
|
|
594
|
-
);
|
|
595
|
-
}) });
|
|
596
|
-
}
|
|
597
|
-
|
|
598
500
|
function MainSidebarTrigger({ className, onClick, ...props }) {
|
|
599
501
|
const { desktopState, toggleSidebar } = useMainSidebar();
|
|
600
502
|
const isCollapsed = desktopState === "collapsed";
|
|
@@ -866,21 +768,6 @@ function getIsLinkActive(link, pathname, siblings = []) {
|
|
|
866
768
|
);
|
|
867
769
|
}
|
|
868
770
|
|
|
869
|
-
const MainSidebar = Object.assign(MainSidebarRoot, {
|
|
870
|
-
Bottom: MainSidebarBottom,
|
|
871
|
-
Nav: MainSidebarNav,
|
|
872
|
-
NavSection: MainSidebarNavSection,
|
|
873
|
-
NavLink: MainSidebarNavLink,
|
|
874
|
-
NavLabel: MainSidebarNavLabel,
|
|
875
|
-
NavHeader: MainSidebarNavHeader,
|
|
876
|
-
NavList: MainSidebarNavList,
|
|
877
|
-
NavSeparator: MainSidebarNavSeparator,
|
|
878
|
-
Sections: MainSidebarSections,
|
|
879
|
-
Trigger: MainSidebarTrigger,
|
|
880
|
-
MobileTrigger: MainSidebarMobileTrigger
|
|
881
|
-
});
|
|
882
|
-
|
|
883
|
-
exports.MainSidebar = MainSidebar;
|
|
884
771
|
exports.MainSidebarMobileTrigger = MainSidebarMobileTrigger;
|
|
885
772
|
exports.MainSidebarNav = MainSidebarNav;
|
|
886
773
|
exports.MainSidebarNavLabel = MainSidebarNavLabel;
|
|
@@ -897,4 +784,4 @@ exports.useMainSidebar = useMainSidebar;
|
|
|
897
784
|
exports.useMaybeSidebar = useMaybeSidebar;
|
|
898
785
|
exports.useMaybeSidebarState = useMaybeSidebarState;
|
|
899
786
|
exports.useMobileDrawer = useMobileDrawer;
|
|
900
|
-
//# sourceMappingURL=main-sidebar-
|
|
787
|
+
//# sourceMappingURL=main-sidebar-link-active-Bzw7LY7r.cjs.map
|