@locusgraph/components 0.2.0 → 0.2.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.
Files changed (102) hide show
  1. package/dist/action/button-group.js +45 -17
  2. package/dist/action/button.js +44 -27
  3. package/dist/action/toggle-group.js +176 -12
  4. package/dist/action/toggle.js +70 -17
  5. package/dist/display/avatar.js +118 -7
  6. package/dist/display/badge.js +33 -20
  7. package/dist/display/chart/chart-container.js +205 -45
  8. package/dist/display/chart/chart-legend.js +79 -14
  9. package/dist/display/chart/chart-tooltip.js +211 -40
  10. package/dist/display/chat/attachment/attachment-parts.js +56 -13
  11. package/dist/display/chat/attachment/attachment.js +70 -28
  12. package/dist/display/chat/bubble.js +80 -37
  13. package/dist/display/chat/marker.js +44 -15
  14. package/dist/display/chat/message-scroller.js +276 -14
  15. package/dist/display/chat/message.js +58 -13
  16. package/dist/display/content/item.js +134 -47
  17. package/dist/display/content/kbd.js +19 -5
  18. package/dist/display/media/aspect-ratio.js +27 -3
  19. package/dist/display/media/carousel-controls.js +162 -11
  20. package/dist/display/media/carousel.js +325 -65
  21. package/dist/display/rule-grid/rule-grid.js +86 -29
  22. package/dist/display/separator.js +56 -3
  23. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +30 -6
  24. package/dist/display/skeletons/layouts/skeleton-table.js +44 -6
  25. package/dist/display/skeletons/shapes/skeleton-avatar.js +31 -13
  26. package/dist/display/skeletons/shapes/skeleton-button.js +31 -13
  27. package/dist/display/skeletons/shapes/skeleton-text.js +25 -7
  28. package/dist/display/skeletons/skeleton-parts.js +22 -6
  29. package/dist/display/status/alert.js +44 -18
  30. package/dist/display/status/empty.js +69 -22
  31. package/dist/display/status/progress.js +116 -16
  32. package/dist/display/status/skeleton.js +10 -3
  33. package/dist/display/status/spinner.js +11 -3
  34. package/dist/display/table.js +77 -17
  35. package/dist/feedback/toaster.js +98 -21
  36. package/dist/form/advanced/calendar-day-button.js +89 -12
  37. package/dist/form/advanced/calendar.js +349 -56
  38. package/dist/form/advanced/combobox/combobox-chips.js +151 -8
  39. package/dist/form/advanced/combobox/combobox-items.js +239 -14
  40. package/dist/form/advanced/combobox/combobox.js +386 -13
  41. package/dist/form/advanced/input-otp.js +201 -11
  42. package/dist/form/choice/checkbox.js +58 -3
  43. package/dist/form/choice/radio-group.js +94 -5
  44. package/dist/form/choice/select.js +479 -25
  45. package/dist/form/choice/slider.js +118 -4
  46. package/dist/form/choice/switch.js +53 -3
  47. package/dist/form/field/field-error.js +34 -14
  48. package/dist/form/field/field-separator.js +19 -3
  49. package/dist/form/field/field-set.js +21 -5
  50. package/dist/form/field/field-text.js +28 -7
  51. package/dist/form/field/field.js +43 -25
  52. package/dist/form/hook-form/form.js +338 -40
  53. package/dist/form/input-group.js +297 -47
  54. package/dist/form/input.js +13 -3
  55. package/dist/form/label.js +42 -3
  56. package/dist/form/native-select.js +39 -7
  57. package/dist/form/textarea.js +11 -3
  58. package/dist/layout/accordion.js +165 -8
  59. package/dist/layout/collapsible.js +75 -7
  60. package/dist/layout/resizable.js +122 -7
  61. package/dist/layout/scroll/direction.js +25 -3
  62. package/dist/layout/scroll/scroll-area.js +138 -5
  63. package/dist/layout/sidebar/sidebar-context.js +184 -51
  64. package/dist/layout/sidebar/sidebar-menu-sub.js +219 -14
  65. package/dist/layout/sidebar/sidebar-menu.js +319 -38
  66. package/dist/layout/sidebar/sidebar-sections.js +369 -22
  67. package/dist/layout/sidebar/sidebar.js +384 -28
  68. package/dist/layout/tabs.js +183 -18
  69. package/dist/layout/use-mobile.js +11 -11
  70. package/dist/navigation/breadcrumb.js +82 -17
  71. package/dist/navigation/menubar/menubar-items.js +322 -16
  72. package/dist/navigation/menubar/menubar-sub.js +125 -7
  73. package/dist/navigation/menubar/menubar.js +213 -13
  74. package/dist/navigation/navigation-menu.js +90 -18
  75. package/dist/navigation/pagination.js +91 -20
  76. package/dist/overlay/alert-dialog.js +485 -26
  77. package/dist/overlay/context-menu/context-menu-items.js +322 -16
  78. package/dist/overlay/context-menu/context-menu-sub.js +125 -7
  79. package/dist/overlay/context-menu/context-menu.js +140 -11
  80. package/dist/overlay/dialog.js +405 -24
  81. package/dist/overlay/floating/command.js +423 -20
  82. package/dist/overlay/floating/drawer.js +354 -22
  83. package/dist/overlay/floating/hover-card.js +107 -7
  84. package/dist/overlay/menu/dropdown-menu-choice.js +149 -7
  85. package/dist/overlay/menu/dropdown-menu-item.js +174 -9
  86. package/dist/overlay/menu/dropdown-menu-sub.js +124 -7
  87. package/dist/overlay/menu/dropdown-menu.js +147 -12
  88. package/dist/overlay/popover.js +106 -7
  89. package/dist/overlay/sheet.js +379 -26
  90. package/dist/overlay/tooltip.js +145 -9
  91. package/dist/shell/app-header.js +29 -5
  92. package/dist/shell/app-shell.js +19 -3
  93. package/dist/shell/breadcrumbs.js +46 -14
  94. package/dist/shell/docs/docs-header.js +210 -10
  95. package/dist/shell/docs/docs-shell.js +36 -3
  96. package/dist/shell/docs/docs-sidebar.js +41 -7
  97. package/dist/shell/docs/on-this-page.js +78 -7
  98. package/dist/shell/docs/use-active-section.js +44 -42
  99. package/dist/shell/navigation/app-sidebar.js +66 -6
  100. package/dist/shell/navigation/nav-group.js +53 -11
  101. package/dist/shell/theme-toggle.js +51 -4
  102. package/package.json +2 -2
@@ -1,18 +1,50 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { ChevronRight as ChevronRightIcon } from "@carbon/icons-react";
3
- function CrumbLabel({ crumb, last, Link, }) {
4
- if (last) {
5
- return (_jsx("span", { "aria-current": "page", className: "truncate font-medium", children: crumb.label }));
6
- }
7
- if (crumb.href === undefined) {
8
- return _jsx("span", { className: "truncate text-soft", children: crumb.label });
9
- }
10
- return (_jsx(Link, { href: crumb.href, className: "truncate text-soft transition-colors hover:text-foreground", children: crumb.label }));
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ function CrumbLabel({
4
+ crumb,
5
+ last,
6
+ Link
7
+ }) {
8
+ if (last) {
9
+ return /*#__PURE__*/_jsx("span", {
10
+ "aria-current": "page",
11
+ className: "truncate font-medium",
12
+ children: crumb.label
13
+ });
14
+ }
15
+ if (crumb.href === undefined) {
16
+ return /*#__PURE__*/_jsx("span", {
17
+ className: "truncate text-soft",
18
+ children: crumb.label
19
+ });
20
+ }
21
+ return /*#__PURE__*/_jsx(Link, {
22
+ href: crumb.href,
23
+ className: "truncate text-soft transition-colors hover:text-foreground",
24
+ children: crumb.label
25
+ });
11
26
  }
12
- function Breadcrumbs({ items, linkComponent = "a" }) {
13
- return (_jsx("nav", { "aria-label": "Breadcrumb", className: "flex min-w-0 items-center gap-1.5 text-sm", children: items.map((crumb, index) => {
14
- const last = index === items.length - 1;
15
- return (_jsxs("span", { className: last ? "flex min-w-0 items-center gap-1.5" : "hidden items-center gap-1.5 sm:flex", children: [_jsx(CrumbLabel, { crumb: crumb, last: last, Link: linkComponent }), last ? null : (_jsx(ChevronRightIcon, { className: "size-3.5 shrink-0 text-faint", "aria-hidden": true }))] }, crumb.href ?? index));
16
- }) }));
27
+ function Breadcrumbs({
28
+ items,
29
+ linkComponent = "a"
30
+ }) {
31
+ return /*#__PURE__*/_jsx("nav", {
32
+ "aria-label": "Breadcrumb",
33
+ className: "flex min-w-0 items-center gap-1.5 text-sm",
34
+ children: items.map((crumb, index) => {
35
+ const last = index === items.length - 1;
36
+ return /*#__PURE__*/_jsxs("span", {
37
+ className: last ? "flex min-w-0 items-center gap-1.5" : "hidden items-center gap-1.5 sm:flex",
38
+ children: [/*#__PURE__*/_jsx(CrumbLabel, {
39
+ crumb: crumb,
40
+ last: last,
41
+ Link: linkComponent
42
+ }), last ? null : /*#__PURE__*/_jsx(ChevronRightIcon, {
43
+ className: "size-3.5 shrink-0 text-faint",
44
+ "aria-hidden": true
45
+ })]
46
+ }, crumb.href ?? index);
47
+ })
48
+ });
17
49
  }
18
50
  export { Breadcrumbs };
@@ -1,20 +1,220 @@
1
1
  "use client";
2
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { Menu as MenuIcon } from "@carbon/icons-react";
4
5
  import { cn } from "cn";
5
6
  import { useState } from "react";
6
7
  import { Button } from "../../action/button.js";
7
8
  import { Sheet, SheetContent, SheetTitle } from "../../overlay/sheet.js";
8
- function MobileNavSheet({ children }) {
9
- const [open, setOpen] = useState(false);
10
- const closeOnLinkClick = (event) => {
11
- if (event.target.closest("a")) {
12
- setOpen(false);
13
- }
9
+ import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
10
+ function MobileNavSheet(t0) {
11
+ const $ = _c(8);
12
+ const {
13
+ children
14
+ } = t0;
15
+ const [open, setOpen] = useState(false);
16
+ let t1;
17
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
18
+ t1 = event => {
19
+ if (event.target.closest("a")) {
20
+ setOpen(false);
21
+ }
14
22
  };
15
- return (_jsxs(_Fragment, { children: [_jsx(Button, { variant: "ghost", size: "icon-sm", className: "lg:hidden", "aria-label": "Open menu", onClick: () => setOpen(true), children: _jsx(MenuIcon, {}) }), _jsx(Sheet, { open: open, onOpenChange: setOpen, children: _jsxs(SheetContent, { side: "left", className: "w-72 overflow-y-auto p-4", children: [_jsx(SheetTitle, { className: "sr-only", children: "Menu" }), _jsx("div", { onClickCapture: closeOnLinkClick, children: children })] }) })] }));
23
+ $[0] = t1;
24
+ } else {
25
+ t1 = $[0];
26
+ }
27
+ const closeOnLinkClick = t1;
28
+ let t2;
29
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
30
+ t2 = /*#__PURE__*/_jsx(Button, {
31
+ variant: "ghost",
32
+ size: "icon-sm",
33
+ className: "lg:hidden",
34
+ "aria-label": "Open menu",
35
+ onClick: () => setOpen(true),
36
+ children: /*#__PURE__*/_jsx(MenuIcon, {})
37
+ });
38
+ $[1] = t2;
39
+ } else {
40
+ t2 = $[1];
41
+ }
42
+ let t3;
43
+ if ($[2] === Symbol.for("react.memo_cache_sentinel")) {
44
+ t3 = /*#__PURE__*/_jsx(SheetTitle, {
45
+ className: "sr-only",
46
+ children: "Menu"
47
+ });
48
+ $[2] = t3;
49
+ } else {
50
+ t3 = $[2];
51
+ }
52
+ let t4;
53
+ if ($[3] !== children) {
54
+ t4 = /*#__PURE__*/_jsxs(SheetContent, {
55
+ side: "left",
56
+ className: "w-72 overflow-y-auto p-4",
57
+ children: [t3, /*#__PURE__*/_jsx("div", {
58
+ onClickCapture: closeOnLinkClick,
59
+ children: children
60
+ })]
61
+ });
62
+ $[3] = children;
63
+ $[4] = t4;
64
+ } else {
65
+ t4 = $[4];
66
+ }
67
+ let t5;
68
+ if ($[5] !== open || $[6] !== t4) {
69
+ t5 = /*#__PURE__*/_jsxs(_Fragment, {
70
+ children: [t2, /*#__PURE__*/_jsx(Sheet, {
71
+ open: open,
72
+ onOpenChange: setOpen,
73
+ children: t4
74
+ })]
75
+ });
76
+ $[5] = open;
77
+ $[6] = t4;
78
+ $[7] = t5;
79
+ } else {
80
+ t5 = $[7];
81
+ }
82
+ return t5;
16
83
  }
17
- function DocsHeader({ brand, links, activeHref, mobileNav, linkComponent: Link = "a", children, }) {
18
- return (_jsx("header", { "data-slot": "docs-header", className: "sticky top-0 z-50 w-full bg-background/95 backdrop-blur", children: _jsxs("div", { className: "mx-auto flex h-(--docs-header-height) w-full max-w-[1536px] items-center gap-4 px-6 **:data-[slot=separator]:h-4!", children: [_jsx(MobileNavSheet, { children: mobileNav }), _jsxs(Link, { href: brand.href, className: "flex items-center gap-2 font-brand text-base tracking-tight", children: [brand.icon, _jsxs("span", { children: [_jsx("span", { className: "font-bold", children: brand.name }), brand.product && _jsx("span", { className: "font-light", children: brand.product })] })] }), _jsx("nav", { "aria-label": "Main", className: "hidden items-center gap-0.5 lg:flex", children: links.map((link) => (_jsx(Link, { href: link.href, "aria-current": link.href === activeHref ? "page" : undefined, className: cn("rounded-md px-2.5 py-1.5 text-sm font-medium text-foreground/80 transition-colors hover:text-foreground", link.href === activeHref && "text-foreground"), children: link.title }, link.href))) }), _jsx("div", { className: "ml-auto flex items-center gap-2", children: children })] }) }));
84
+ function DocsHeader(t0) {
85
+ const $ = _c(30);
86
+ const {
87
+ brand,
88
+ links,
89
+ activeHref,
90
+ mobileNav,
91
+ linkComponent: t1,
92
+ children
93
+ } = t0;
94
+ const Link = t1 === undefined ? "a" : t1;
95
+ let t2;
96
+ if ($[0] !== mobileNav) {
97
+ t2 = /*#__PURE__*/_jsx(MobileNavSheet, {
98
+ children: mobileNav
99
+ });
100
+ $[0] = mobileNav;
101
+ $[1] = t2;
102
+ } else {
103
+ t2 = $[1];
104
+ }
105
+ let t3;
106
+ if ($[2] !== brand.name) {
107
+ t3 = /*#__PURE__*/_jsx("span", {
108
+ className: "font-bold",
109
+ children: brand.name
110
+ });
111
+ $[2] = brand.name;
112
+ $[3] = t3;
113
+ } else {
114
+ t3 = $[3];
115
+ }
116
+ let t4;
117
+ if ($[4] !== brand.product) {
118
+ t4 = brand.product && /*#__PURE__*/_jsx("span", {
119
+ className: "font-light",
120
+ children: brand.product
121
+ });
122
+ $[4] = brand.product;
123
+ $[5] = t4;
124
+ } else {
125
+ t4 = $[5];
126
+ }
127
+ let t5;
128
+ if ($[6] !== t3 || $[7] !== t4) {
129
+ t5 = /*#__PURE__*/_jsxs("span", {
130
+ children: [t3, t4]
131
+ });
132
+ $[6] = t3;
133
+ $[7] = t4;
134
+ $[8] = t5;
135
+ } else {
136
+ t5 = $[8];
137
+ }
138
+ let t6;
139
+ if ($[9] !== Link || $[10] !== brand.href || $[11] !== brand.icon || $[12] !== t5) {
140
+ t6 = /*#__PURE__*/_jsxs(Link, {
141
+ href: brand.href,
142
+ className: "flex items-center gap-2 font-brand text-base tracking-tight",
143
+ children: [brand.icon, t5]
144
+ });
145
+ $[9] = Link;
146
+ $[10] = brand.href;
147
+ $[11] = brand.icon;
148
+ $[12] = t5;
149
+ $[13] = t6;
150
+ } else {
151
+ t6 = $[13];
152
+ }
153
+ let t7;
154
+ if ($[14] !== Link || $[15] !== activeHref || $[16] !== links) {
155
+ let t8;
156
+ if ($[18] !== Link || $[19] !== activeHref) {
157
+ t8 = link => /*#__PURE__*/_jsx(Link, {
158
+ href: link.href,
159
+ "aria-current": link.href === activeHref ? "page" : undefined,
160
+ className: cn("rounded-md px-2.5 py-1.5 text-sm font-medium text-foreground/80 transition-colors hover:text-foreground", link.href === activeHref && "text-foreground"),
161
+ children: link.title
162
+ }, link.href);
163
+ $[18] = Link;
164
+ $[19] = activeHref;
165
+ $[20] = t8;
166
+ } else {
167
+ t8 = $[20];
168
+ }
169
+ t7 = links.map(t8);
170
+ $[14] = Link;
171
+ $[15] = activeHref;
172
+ $[16] = links;
173
+ $[17] = t7;
174
+ } else {
175
+ t7 = $[17];
176
+ }
177
+ let t8;
178
+ if ($[21] !== t7) {
179
+ t8 = /*#__PURE__*/_jsx("nav", {
180
+ "aria-label": "Main",
181
+ className: "hidden items-center gap-0.5 lg:flex",
182
+ children: t7
183
+ });
184
+ $[21] = t7;
185
+ $[22] = t8;
186
+ } else {
187
+ t8 = $[22];
188
+ }
189
+ let t9;
190
+ if ($[23] !== children) {
191
+ t9 = /*#__PURE__*/_jsx("div", {
192
+ className: "ml-auto flex items-center gap-2",
193
+ children: children
194
+ });
195
+ $[23] = children;
196
+ $[24] = t9;
197
+ } else {
198
+ t9 = $[24];
199
+ }
200
+ let t10;
201
+ if ($[25] !== t2 || $[26] !== t6 || $[27] !== t8 || $[28] !== t9) {
202
+ t10 = /*#__PURE__*/_jsx("header", {
203
+ "data-slot": "docs-header",
204
+ className: "sticky top-0 z-50 w-full bg-background/95 backdrop-blur",
205
+ children: /*#__PURE__*/_jsxs("div", {
206
+ className: "mx-auto flex h-(--docs-header-height) w-full max-w-[1536px] items-center gap-4 px-6 **:data-[slot=separator]:h-4!",
207
+ children: [t2, t6, t8, t9]
208
+ })
209
+ });
210
+ $[25] = t2;
211
+ $[26] = t6;
212
+ $[27] = t8;
213
+ $[28] = t9;
214
+ $[29] = t10;
215
+ } else {
216
+ t10 = $[29];
217
+ }
218
+ return t10;
19
219
  }
20
220
  export { DocsHeader };
@@ -1,7 +1,40 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
3
2
  import { TooltipProvider } from "../../overlay/tooltip.js";
4
- function DocsShell({ header, sidebar, aside, children }) {
5
- return (_jsx(TooltipProvider, { delayDuration: 0, children: _jsxs("div", { "data-slot": "docs-shell", className: "flex min-h-svh flex-col bg-background [--docs-header-height:3.5rem] lg:[--docs-header-height:4rem]", children: [header, _jsxs("div", { className: cn("mx-auto w-full max-w-[1536px] flex-1 items-start px-2", sidebar && "lg:grid lg:grid-cols-[18rem_minmax(0,1fr)]"), children: [sidebar && (_jsx("aside", { "data-slot": "docs-sidebar", className: "sticky top-[calc(var(--docs-header-height)+0.6rem)] hidden h-[calc(100svh-10rem)] lg:block", children: sidebar })), _jsxs("div", { className: "flex min-w-0 items-stretch", children: [_jsx("main", { "data-slot": "docs-body", className: "min-w-0 flex-1 px-4 pt-6 pb-16 md:px-6 lg:pt-10", children: children }), aside && (_jsx("aside", { "data-slot": "docs-aside", className: "sticky top-[calc(var(--docs-header-height)+1px)] hidden h-[90svh] w-72 shrink-0 flex-col gap-8 overflow-hidden pt-10 xl:flex", children: _jsx("div", { className: "no-scrollbar flex flex-col gap-8 overflow-y-auto px-8", children: aside }) }))] })] })] }) }));
3
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
4
+ function DocsShell({
5
+ header,
6
+ sidebar,
7
+ aside,
8
+ children
9
+ }) {
10
+ return /*#__PURE__*/_jsx(TooltipProvider, {
11
+ delayDuration: 0,
12
+ children: /*#__PURE__*/_jsxs("div", {
13
+ "data-slot": "docs-shell",
14
+ className: "flex min-h-svh flex-col bg-background [--docs-header-height:3.5rem] lg:[--docs-header-height:4rem]",
15
+ children: [header, /*#__PURE__*/_jsxs("div", {
16
+ className: cn("mx-auto w-full max-w-[1536px] flex-1 items-start px-2", sidebar && "lg:grid lg:grid-cols-[18rem_minmax(0,1fr)]"),
17
+ children: [sidebar && /*#__PURE__*/_jsx("aside", {
18
+ "data-slot": "docs-sidebar",
19
+ className: "sticky top-[calc(var(--docs-header-height)+0.6rem)] hidden h-[calc(100svh-10rem)] lg:block",
20
+ children: sidebar
21
+ }), /*#__PURE__*/_jsxs("div", {
22
+ className: "flex min-w-0 items-stretch",
23
+ children: [/*#__PURE__*/_jsx("main", {
24
+ "data-slot": "docs-body",
25
+ className: "min-w-0 flex-1 px-4 pt-6 pb-16 md:px-6 lg:pt-10",
26
+ children: children
27
+ }), aside && /*#__PURE__*/_jsx("aside", {
28
+ "data-slot": "docs-aside",
29
+ className: "sticky top-[calc(var(--docs-header-height)+1px)] hidden h-[90svh] w-72 shrink-0 flex-col gap-8 overflow-hidden pt-10 xl:flex",
30
+ children: /*#__PURE__*/_jsx("div", {
31
+ className: "no-scrollbar flex flex-col gap-8 overflow-y-auto px-8",
32
+ children: aside
33
+ })
34
+ })]
35
+ })]
36
+ })]
37
+ })
38
+ });
6
39
  }
7
40
  export { DocsShell };
@@ -1,12 +1,46 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { cn } from "cn";
3
- function DocsNavList({ groups, activeHref, linkComponent: Link = "a" }) {
4
- return (_jsx("div", { className: "flex flex-col gap-4", children: groups.map((group) => (_jsxs("div", { className: "flex flex-col", children: [_jsx("p", { className: "eyebrow flex h-8 items-center px-2", children: group.label }), _jsx("ul", { className: "flex flex-col gap-0.5", children: group.items.map((item) => {
5
- const active = item.href === activeHref;
6
- return (_jsx("li", { children: _jsx(Link, { href: item.href, "aria-current": active ? "page" : undefined, className: cn("flex h-[30px] w-fit items-center rounded-md border border-transparent px-2 text-sm font-medium transition-colors hover:bg-accent", active && "border-accent bg-accent"), children: item.title }) }, item.href));
7
- }) })] }, group.label))) }));
2
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
+ function DocsNavList({
4
+ groups,
5
+ activeHref,
6
+ linkComponent: Link = "a"
7
+ }) {
8
+ return /*#__PURE__*/_jsx("div", {
9
+ className: "flex flex-col gap-4",
10
+ children: groups.map(group => /*#__PURE__*/_jsxs("div", {
11
+ className: "flex flex-col",
12
+ children: [/*#__PURE__*/_jsx("p", {
13
+ className: "eyebrow flex h-8 items-center px-2",
14
+ children: group.label
15
+ }), /*#__PURE__*/_jsx("ul", {
16
+ className: "flex flex-col gap-0.5",
17
+ children: group.items.map(item => {
18
+ const active = item.href === activeHref;
19
+ return /*#__PURE__*/_jsx("li", {
20
+ children: /*#__PURE__*/_jsx(Link, {
21
+ href: item.href,
22
+ "aria-current": active ? "page" : undefined,
23
+ className: cn("flex h-[30px] w-fit items-center rounded-md border border-transparent px-2 text-sm font-medium transition-colors hover:bg-accent", active && "border-accent bg-accent"),
24
+ children: item.title
25
+ })
26
+ }, item.href);
27
+ })
28
+ })]
29
+ }, group.label))
30
+ });
8
31
  }
9
32
  function DocsSidebar(props) {
10
- return (_jsxs("div", { className: "relative h-full", children: [_jsx("div", { className: "absolute top-12 right-2 bottom-0 w-px bg-[linear-gradient(to_bottom,transparent_0%,var(--border)_10%,var(--border)_90%,transparent_100%)]" }), _jsx("nav", { "aria-label": "Documentation", className: "no-scrollbar h-full w-56 overflow-y-auto pt-10 pb-12 pl-2.5 [mask-image:linear-gradient(to_bottom,transparent,black_2rem,black_calc(100%-3rem),transparent)]", children: _jsx(DocsNavList, { ...props }) })] }));
33
+ return /*#__PURE__*/_jsxs("div", {
34
+ className: "relative h-full",
35
+ children: [/*#__PURE__*/_jsx("div", {
36
+ className: "absolute top-12 right-2 bottom-0 w-px bg-[linear-gradient(to_bottom,transparent_0%,var(--border)_10%,var(--border)_90%,transparent_100%)]"
37
+ }), /*#__PURE__*/_jsx("nav", {
38
+ "aria-label": "Documentation",
39
+ className: "no-scrollbar h-full w-56 overflow-y-auto pt-10 pb-12 pl-2.5 [mask-image:linear-gradient(to_bottom,transparent,black_2rem,black_calc(100%-3rem),transparent)]",
40
+ children: /*#__PURE__*/_jsx(DocsNavList, {
41
+ ...props
42
+ })
43
+ })]
44
+ });
11
45
  }
12
46
  export { DocsNavList, DocsSidebar };
@@ -1,12 +1,83 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
3
4
  import { cn } from "cn";
4
5
  import { useActiveSection } from "./use-active-section.js";
5
- function OnThisPage({ sections, title = "On This Page" }) {
6
- const [activeId, pinSection] = useActiveSection(sections.map((section) => section.id));
7
- return (_jsxs("nav", { "aria-label": title, className: "flex flex-col gap-2 text-sm", children: [_jsx("p", { className: "eyebrow flex h-6 items-center", children: title }), sections.map((section) => (_jsx("button", { type: "button", onClick: () => {
8
- pinSection(section.id);
9
- document.getElementById(section.id)?.scrollIntoView({ behavior: "smooth" });
10
- }, "aria-current": activeId === section.id ? "location" : undefined, className: cn("text-left text-[0.8rem] text-muted-foreground transition-colors hover:text-foreground", section.nested && "pl-4", activeId === section.id && "font-medium text-foreground"), children: section.title }, section.id)))] }));
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ function OnThisPage(t0) {
8
+ const $ = _c(15);
9
+ const {
10
+ sections,
11
+ title: t1
12
+ } = t0;
13
+ const title = t1 === undefined ? "On This Page" : t1;
14
+ let t2;
15
+ if ($[0] !== sections) {
16
+ t2 = sections.map(_temp);
17
+ $[0] = sections;
18
+ $[1] = t2;
19
+ } else {
20
+ t2 = $[1];
21
+ }
22
+ const [activeId, pinSection] = useActiveSection(t2);
23
+ let t3;
24
+ if ($[2] !== title) {
25
+ t3 = /*#__PURE__*/_jsx("p", {
26
+ className: "eyebrow flex h-6 items-center",
27
+ children: title
28
+ });
29
+ $[2] = title;
30
+ $[3] = t3;
31
+ } else {
32
+ t3 = $[3];
33
+ }
34
+ let t4;
35
+ if ($[4] !== activeId || $[5] !== pinSection || $[6] !== sections) {
36
+ let t5;
37
+ if ($[8] !== activeId || $[9] !== pinSection) {
38
+ t5 = section_0 => /*#__PURE__*/_jsx("button", {
39
+ type: "button",
40
+ onClick: () => {
41
+ pinSection(section_0.id);
42
+ document.getElementById(section_0.id)?.scrollIntoView({
43
+ behavior: "smooth"
44
+ });
45
+ },
46
+ "aria-current": activeId === section_0.id ? "location" : undefined,
47
+ className: cn("text-left text-[0.8rem] text-muted-foreground transition-colors hover:text-foreground", section_0.nested && "pl-4", activeId === section_0.id && "font-medium text-foreground"),
48
+ children: section_0.title
49
+ }, section_0.id);
50
+ $[8] = activeId;
51
+ $[9] = pinSection;
52
+ $[10] = t5;
53
+ } else {
54
+ t5 = $[10];
55
+ }
56
+ t4 = sections.map(t5);
57
+ $[4] = activeId;
58
+ $[5] = pinSection;
59
+ $[6] = sections;
60
+ $[7] = t4;
61
+ } else {
62
+ t4 = $[7];
63
+ }
64
+ let t5;
65
+ if ($[11] !== t3 || $[12] !== t4 || $[13] !== title) {
66
+ t5 = /*#__PURE__*/_jsxs("nav", {
67
+ "aria-label": title,
68
+ className: "flex flex-col gap-2 text-sm",
69
+ children: [t3, t4]
70
+ });
71
+ $[11] = t3;
72
+ $[12] = t4;
73
+ $[13] = title;
74
+ $[14] = t5;
75
+ } else {
76
+ t5 = $[14];
77
+ }
78
+ return t5;
79
+ }
80
+ function _temp(section) {
81
+ return section.id;
11
82
  }
12
83
  export { OnThisPage };
@@ -1,54 +1,56 @@
1
1
  import { useCallback, useEffect, useRef, useState } from "react";
2
2
  const SMOOTH_SCROLL_MS = 800;
3
3
  function isWindowScrolledToBottom() {
4
- const pageHeight = document.documentElement.scrollHeight;
5
- const canScroll = pageHeight > window.innerHeight + 2;
6
- return canScroll && window.innerHeight + window.scrollY >= pageHeight - 2;
4
+ const pageHeight = document.documentElement.scrollHeight;
5
+ const canScroll = pageHeight > window.innerHeight + 2;
6
+ return canScroll && window.innerHeight + window.scrollY >= pageHeight - 2;
7
7
  }
8
8
  const ACTIVE_LINE_PX = 120;
9
9
  function lastSectionAboveLine(ids) {
10
- let current = ids[0];
11
- for (const id of ids) {
12
- const top = document.getElementById(id)?.getBoundingClientRect().top;
13
- if (top !== undefined && top <= ACTIVE_LINE_PX) {
14
- current = id;
15
- }
10
+ let current = ids[0];
11
+ for (const id of ids) {
12
+ const top = document.getElementById(id)?.getBoundingClientRect().top;
13
+ if (top !== undefined && top <= ACTIVE_LINE_PX) {
14
+ current = id;
16
15
  }
17
- return current;
16
+ }
17
+ return current;
18
18
  }
19
19
  function useActiveSection(sectionIds) {
20
- const [activeId, setActiveId] = useState(sectionIds[0] ?? "");
21
- const pinnedUntil = useRef(0);
22
- const followScroll = useCallback((id) => {
23
- if (Date.now() > pinnedUntil.current) {
24
- setActiveId(id);
20
+ const [activeId, setActiveId] = useState(sectionIds[0] ?? "");
21
+ const pinnedUntil = useRef(0);
22
+ const followScroll = useCallback(id => {
23
+ if (Date.now() > pinnedUntil.current) {
24
+ setActiveId(id);
25
+ }
26
+ }, []);
27
+ const pinSection = useCallback(id => {
28
+ pinnedUntil.current = Date.now() + SMOOTH_SCROLL_MS;
29
+ setActiveId(id);
30
+ }, []);
31
+ const idsKey = sectionIds.join(" ");
32
+ useEffect(() => {
33
+ const ids = idsKey.split(" ").filter(Boolean);
34
+ let frame = 0;
35
+ const updateActiveSection = () => {
36
+ cancelAnimationFrame(frame);
37
+ frame = requestAnimationFrame(() => {
38
+ const lastId = ids.at(-1);
39
+ const current = isWindowScrolledToBottom() && lastId ? lastId : lastSectionAboveLine(ids);
40
+ if (current) {
41
+ followScroll(current);
25
42
  }
26
- }, []);
27
- const pinSection = useCallback((id) => {
28
- pinnedUntil.current = Date.now() + SMOOTH_SCROLL_MS;
29
- setActiveId(id);
30
- }, []);
31
- const idsKey = sectionIds.join(" ");
32
- useEffect(() => {
33
- const ids = idsKey.split(" ").filter(Boolean);
34
- let frame = 0;
35
- const updateActiveSection = () => {
36
- cancelAnimationFrame(frame);
37
- frame = requestAnimationFrame(() => {
38
- const lastId = ids.at(-1);
39
- const current = isWindowScrolledToBottom() && lastId ? lastId : lastSectionAboveLine(ids);
40
- if (current) {
41
- followScroll(current);
42
- }
43
- });
44
- };
45
- updateActiveSection();
46
- window.addEventListener("scroll", updateActiveSection, { passive: true });
47
- return () => {
48
- cancelAnimationFrame(frame);
49
- window.removeEventListener("scroll", updateActiveSection);
50
- };
51
- }, [idsKey, followScroll]);
52
- return [activeId, pinSection];
43
+ });
44
+ };
45
+ updateActiveSection();
46
+ window.addEventListener("scroll", updateActiveSection, {
47
+ passive: true
48
+ });
49
+ return () => {
50
+ cancelAnimationFrame(frame);
51
+ window.removeEventListener("scroll", updateActiveSection);
52
+ };
53
+ }, [idsKey, followScroll]);
54
+ return [activeId, pinSection];
53
55
  }
54
56
  export { useActiveSection };
@@ -1,12 +1,72 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
2
1
  import { Sidebar, SidebarRail } from "../../layout/sidebar/sidebar.js";
3
2
  import { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "../../layout/sidebar/sidebar-menu.js";
4
- import { SidebarContent, SidebarFooter, SidebarHeader, } from "../../layout/sidebar/sidebar-sections.js";
3
+ import { SidebarContent, SidebarFooter, SidebarHeader } from "../../layout/sidebar/sidebar-sections.js";
5
4
  import { NavGroup } from "./nav-group.js";
6
- function BrandLink({ brand, Link }) {
7
- return (_jsx(SidebarMenu, { children: _jsx(SidebarMenuItem, { children: _jsx(SidebarMenuButton, { size: "lg", asChild: true, children: _jsxs(Link, { href: brand.href, children: [_jsx("span", { "data-slot": "app-brand-icon", className: "flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg border border-line bg-ghost", children: brand.icon }), _jsxs("span", { className: "grid flex-1 text-left leading-tight", children: [_jsx("span", { className: "truncate text-sm font-semibold tracking-tight", children: brand.title }), brand.subtitle && (_jsx("span", { className: "truncate text-xs text-soft", children: brand.subtitle }))] })] }) }) }) }));
5
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
6
+ function BrandLink({
7
+ brand,
8
+ Link
9
+ }) {
10
+ return /*#__PURE__*/_jsx(SidebarMenu, {
11
+ children: /*#__PURE__*/_jsx(SidebarMenuItem, {
12
+ children: /*#__PURE__*/_jsx(SidebarMenuButton, {
13
+ size: "lg",
14
+ asChild: true,
15
+ children: /*#__PURE__*/_jsxs(Link, {
16
+ href: brand.href,
17
+ children: [/*#__PURE__*/_jsx("span", {
18
+ "data-slot": "app-brand-icon",
19
+ className: "flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg border border-line bg-ghost",
20
+ children: brand.icon
21
+ }), /*#__PURE__*/_jsxs("span", {
22
+ className: "grid flex-1 text-left leading-tight",
23
+ children: [/*#__PURE__*/_jsx("span", {
24
+ className: "truncate text-sm font-semibold tracking-tight",
25
+ children: brand.title
26
+ }), brand.subtitle && /*#__PURE__*/_jsx("span", {
27
+ className: "truncate text-xs text-soft",
28
+ children: brand.subtitle
29
+ })]
30
+ })]
31
+ })
32
+ })
33
+ })
34
+ });
8
35
  }
9
- function AppSidebar({ brand, groups, bottomItems, footer, activeHref, linkComponent = "a", }) {
10
- return (_jsxs(Sidebar, { collapsible: "icon", children: [_jsx(SidebarHeader, { className: "h-14 justify-center border-b border-line py-0", children: _jsx(BrandLink, { brand: brand, Link: linkComponent }) }), _jsxs(SidebarContent, { children: [groups.map((group) => (_jsx(NavGroup, { group: group, activeHref: activeHref, Link: linkComponent }, group.label))), bottomItems && bottomItems.length > 0 && (_jsx(NavGroup, { group: { label: "", items: bottomItems }, activeHref: activeHref, Link: linkComponent, className: "mt-auto" }))] }), footer && _jsx(SidebarFooter, { className: "border-t border-line", children: footer }), _jsx(SidebarRail, {})] }));
36
+ function AppSidebar({
37
+ brand,
38
+ groups,
39
+ bottomItems,
40
+ footer,
41
+ activeHref,
42
+ linkComponent = "a"
43
+ }) {
44
+ return /*#__PURE__*/_jsxs(Sidebar, {
45
+ collapsible: "icon",
46
+ children: [/*#__PURE__*/_jsx(SidebarHeader, {
47
+ className: "h-14 justify-center border-b border-line py-0",
48
+ children: /*#__PURE__*/_jsx(BrandLink, {
49
+ brand: brand,
50
+ Link: linkComponent
51
+ })
52
+ }), /*#__PURE__*/_jsxs(SidebarContent, {
53
+ children: [groups.map(group => /*#__PURE__*/_jsx(NavGroup, {
54
+ group: group,
55
+ activeHref: activeHref,
56
+ Link: linkComponent
57
+ }, group.label)), bottomItems && bottomItems.length > 0 && /*#__PURE__*/_jsx(NavGroup, {
58
+ group: {
59
+ label: "",
60
+ items: bottomItems
61
+ },
62
+ activeHref: activeHref,
63
+ Link: linkComponent,
64
+ className: "mt-auto"
65
+ })]
66
+ }), footer && /*#__PURE__*/_jsx(SidebarFooter, {
67
+ className: "border-t border-line",
68
+ children: footer
69
+ }), /*#__PURE__*/_jsx(SidebarRail, {})]
70
+ });
11
71
  }
12
72
  export { AppSidebar };