@mastra/playground-ui 57.0.0-alpha.1 → 57.0.0-alpha.2
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-C5PU7zgc.js → main-sidebar-link-active-CCOxOqzR.js} +6 -118
- package/dist/main-sidebar-link-active-CCOxOqzR.js.map +1 -0
- package/dist/{main-sidebar-BsEmFpKN.cjs → main-sidebar-link-active-qQkuwjqp.cjs} +4 -117
- package/dist/main-sidebar-link-active-qQkuwjqp.cjs.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/dist/src/domains/traces/hooks/use-trace-spans.d.ts +4 -4
- package/package.json +6 -6
- package/dist/main-sidebar-BsEmFpKN.cjs.map +0 -1
- package/dist/main-sidebar-C5PU7zgc.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-DG0X1KEP.cjs');
|
|
7
|
+
const mainSidebarLinkActive = require('../main-sidebar-link-active-qQkuwjqp.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,u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D,MAAA,EAAQ,iBAAA;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-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-CCOxOqzR.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-CCOxOqzR.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,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oBAAA;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,23 +1,19 @@
|
|
|
1
|
-
import { jsx, jsxs
|
|
2
|
-
import { c as cn } from './cn-65Adrsfj.js';
|
|
1
|
+
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
2
|
import { MenuIcon, PanelRightIcon } from 'lucide-react';
|
|
4
|
-
import React__default, { useRef, useEffect, useCallback, useId } from 'react';
|
|
5
3
|
import { quietTextHover, quietTextHoverInGroup } from './primitives/typography.es.js';
|
|
4
|
+
import { c as cn } from './cn-65Adrsfj.js';
|
|
6
5
|
import { S as ScrollArea } from './scroll-area-DyTZoISq.js';
|
|
7
|
-
import {
|
|
6
|
+
import React__default, { useRef, useEffect, useCallback } from 'react';
|
|
8
7
|
import { c as cva } from './index-Dubp6Qv4.js';
|
|
9
8
|
import { controlHeight } from './primitives/control-size.es.js';
|
|
10
9
|
import { surfaceStateLayerStyle, surfaceGroupStateLayerStyle, overlaySurfaceStyle } from './primitives/raised-surface.es.js';
|
|
11
10
|
import { focusRing, controlStateColorTransition } from './primitives/transitions.es.js';
|
|
11
|
+
import { VisuallyHidden } from '@radix-ui/react-visually-hidden';
|
|
12
12
|
import { T as Tooltip, c as TooltipTrigger, a as TooltipContent } from './tooltip-BrDiP0RI.js';
|
|
13
13
|
import { D as Drawer, d as DrawerContent, c as DrawerClose, o as DrawerTitle, e as DrawerDescription } from './drawer-DnfOugYZ.js';
|
|
14
14
|
import { ResizeHandleIndicator } from './primitives/resize-handle-indicator.es.js';
|
|
15
15
|
import { K as Kbd } from './kbd-BDVTQHD_.js';
|
|
16
16
|
|
|
17
|
-
function MainSidebarBottom({ className, children, ...props }) {
|
|
18
|
-
return /* @__PURE__ */ jsx("div", { className: cn("mt-auto", className), ...props, children });
|
|
19
|
-
}
|
|
20
|
-
|
|
21
17
|
const MainSidebarContext = React__default.createContext(null);
|
|
22
18
|
const MobileDrawerContext = React__default.createContext(null);
|
|
23
19
|
function useMaybeSidebarState() {
|
|
@@ -89,46 +85,6 @@ function MainSidebarNav({
|
|
|
89
85
|
return /* @__PURE__ */ jsx("nav", { "aria-label": ariaLabel, className: cn("flex min-h-0 flex-1 flex-col", className), ...props, children: /* @__PURE__ */ jsx(ScrollArea, { className: "min-h-0 flex-1", viewPortClassName: "px-0.5", children }) });
|
|
90
86
|
}
|
|
91
87
|
|
|
92
|
-
function MainSidebarNavHeader({
|
|
93
|
-
children,
|
|
94
|
-
className,
|
|
95
|
-
state: stateProp,
|
|
96
|
-
href,
|
|
97
|
-
isActive,
|
|
98
|
-
LinkComponent: LinkProp,
|
|
99
|
-
...props
|
|
100
|
-
}) {
|
|
101
|
-
const ctx = useMaybeSidebarState();
|
|
102
|
-
const state = stateProp ?? ctx?.state ?? "default";
|
|
103
|
-
const isMobile = ctx?.isMobile ?? false;
|
|
104
|
-
const Link = LinkProp ?? ctx?.LinkComponent ?? "a";
|
|
105
|
-
const showTitle = state === "default" && !isMobile;
|
|
106
|
-
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(
|
|
107
|
-
"header",
|
|
108
|
-
{
|
|
109
|
-
...props,
|
|
110
|
-
className: cn("max-w-full min-w-0 truncate pl-3 text-column", {
|
|
111
|
-
"text-foreground": isActive,
|
|
112
|
-
"text-muted-foreground/70": !isActive
|
|
113
|
-
}),
|
|
114
|
-
children: href ? /* @__PURE__ */ jsx(
|
|
115
|
-
Link,
|
|
116
|
-
{
|
|
117
|
-
href,
|
|
118
|
-
className: cn("block min-w-0 truncate transition-colors duration-normal", {
|
|
119
|
-
"hover:text-foreground": !isActive,
|
|
120
|
-
"text-foreground": isActive
|
|
121
|
-
}),
|
|
122
|
-
children
|
|
123
|
-
}
|
|
124
|
-
) : children
|
|
125
|
-
}
|
|
126
|
-
) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
127
|
-
/* @__PURE__ */ jsx(VisuallyHidden, { asChild: true, children: /* @__PURE__ */ jsx("header", { ...props, children }) }),
|
|
128
|
-
/* @__PURE__ */ jsx("div", { "aria-hidden": "true", className: "mx-3 h-px flex-1 bg-border" })
|
|
129
|
-
] }) });
|
|
130
|
-
}
|
|
131
|
-
|
|
132
88
|
function MainSidebarNavLabel({ children, className, state: stateProp, ...rest }) {
|
|
133
89
|
const ctx = useMaybeSidebarState();
|
|
134
90
|
const state = stateProp ?? ctx?.state ?? "default";
|
|
@@ -555,60 +511,6 @@ function MainSidebarRoot({ children, className, mobileMode = "drawer" }) {
|
|
|
555
511
|
);
|
|
556
512
|
}
|
|
557
513
|
|
|
558
|
-
function getLinkKey(link) {
|
|
559
|
-
return `${link.url}:${link.name}`;
|
|
560
|
-
}
|
|
561
|
-
function MainSidebarSectionLink({ link, activeCandidates, level = 0, isActive }) {
|
|
562
|
-
const childLinks = link.children ?? [];
|
|
563
|
-
return /* @__PURE__ */ jsx(
|
|
564
|
-
MainSidebarNavLink,
|
|
565
|
-
{
|
|
566
|
-
link,
|
|
567
|
-
isActive: isActive?.(link, activeCandidates) ?? link.isActive,
|
|
568
|
-
level,
|
|
569
|
-
subItems: childLinks.length > 0 ? /* @__PURE__ */ jsx(MainSidebarNavList, { className: "mt-0.5", children: childLinks.map((child) => /* @__PURE__ */ jsx(
|
|
570
|
-
MainSidebarSectionLink,
|
|
571
|
-
{
|
|
572
|
-
link: child,
|
|
573
|
-
activeCandidates,
|
|
574
|
-
level: level + 1,
|
|
575
|
-
isActive
|
|
576
|
-
},
|
|
577
|
-
getLinkKey(child)
|
|
578
|
-
)) }) : null
|
|
579
|
-
}
|
|
580
|
-
);
|
|
581
|
-
}
|
|
582
|
-
function MainSidebarSections({ sections, isActive, className }) {
|
|
583
|
-
const baseId = useId();
|
|
584
|
-
return /* @__PURE__ */ jsx(Fragment, { children: sections.map((section) => {
|
|
585
|
-
const showSeparator = section.links.length > 0 && section.separator;
|
|
586
|
-
const headerId = section.title ? `${baseId}-${section.key}` : void 0;
|
|
587
|
-
return /* @__PURE__ */ jsxs(
|
|
588
|
-
MainSidebarNavSection,
|
|
589
|
-
{
|
|
590
|
-
className,
|
|
591
|
-
"aria-labelledby": headerId,
|
|
592
|
-
"aria-label": !headerId ? section.key : void 0,
|
|
593
|
-
children: [
|
|
594
|
-
showSeparator ? /* @__PURE__ */ jsx(MainSidebarNavSeparator, {}) : null,
|
|
595
|
-
section.title ? /* @__PURE__ */ jsx(MainSidebarNavHeader, { id: headerId, href: section.href, isActive: section.isHeaderActive, children: section.title }) : null,
|
|
596
|
-
/* @__PURE__ */ jsx(MainSidebarNavList, { children: section.links.map((link) => /* @__PURE__ */ jsx(
|
|
597
|
-
MainSidebarSectionLink,
|
|
598
|
-
{
|
|
599
|
-
link,
|
|
600
|
-
activeCandidates: section.links,
|
|
601
|
-
isActive
|
|
602
|
-
},
|
|
603
|
-
getLinkKey(link)
|
|
604
|
-
)) })
|
|
605
|
-
]
|
|
606
|
-
},
|
|
607
|
-
section.key
|
|
608
|
-
);
|
|
609
|
-
}) });
|
|
610
|
-
}
|
|
611
|
-
|
|
612
514
|
function MainSidebarTrigger({ className, onClick, ...props }) {
|
|
613
515
|
const { desktopState, toggleSidebar } = useMainSidebar();
|
|
614
516
|
const isCollapsed = desktopState === "collapsed";
|
|
@@ -880,19 +782,5 @@ function getIsLinkActive(link, pathname, siblings = []) {
|
|
|
880
782
|
);
|
|
881
783
|
}
|
|
882
784
|
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
Nav: MainSidebarNav,
|
|
886
|
-
NavSection: MainSidebarNavSection,
|
|
887
|
-
NavLink: MainSidebarNavLink,
|
|
888
|
-
NavLabel: MainSidebarNavLabel,
|
|
889
|
-
NavHeader: MainSidebarNavHeader,
|
|
890
|
-
NavList: MainSidebarNavList,
|
|
891
|
-
NavSeparator: MainSidebarNavSeparator,
|
|
892
|
-
Sections: MainSidebarSections,
|
|
893
|
-
Trigger: MainSidebarTrigger,
|
|
894
|
-
MobileTrigger: MainSidebarMobileTrigger
|
|
895
|
-
});
|
|
896
|
-
|
|
897
|
-
export { MainSidebar as M, MainSidebarMobileTrigger as a, MainSidebarProvider as b, MainSidebarTrigger as c, useMaybeSidebar as d, useMaybeSidebarState as e, useMobileDrawer as f, getIsLinkActive as g, MainSidebarNav as h, MainSidebarRoot as i, MainSidebarNavLink as j, MainSidebarNavList as k, MainSidebarNavLabel as l, MainSidebarNavSection as m, navItemClasses as n, MainSidebarNavSeparator as o, useMainSidebar as u };
|
|
898
|
-
//# sourceMappingURL=main-sidebar-C5PU7zgc.js.map
|
|
785
|
+
export { MainSidebarNavSection as M, MainSidebarNavSeparator as a, MainSidebarNavList as b, MainSidebarNavLink as c, MainSidebarRoot as d, MainSidebarMobileTrigger as e, MainSidebarTrigger as f, MainSidebarNavLabel as g, MainSidebarNav as h, MainSidebarProvider as i, getIsLinkActive as j, useMainSidebar as k, useMaybeSidebar as l, useMobileDrawer as m, navItemClasses as n, useMaybeSidebarState as u };
|
|
786
|
+
//# sourceMappingURL=main-sidebar-link-active-CCOxOqzR.js.map
|