@locusgraph/components 0.1.1 → 0.2.1

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 (116) hide show
  1. package/dist/action/button-group.js +148 -17
  2. package/dist/action/button.js +91 -27
  3. package/dist/action/toggle-group.js +176 -12
  4. package/dist/action/toggle.js +71 -18
  5. package/dist/display/avatar.js +118 -7
  6. package/dist/display/badge.d.ts +1 -1
  7. package/dist/display/badge.js +74 -17
  8. package/dist/display/chart/chart-container.js +205 -45
  9. package/dist/display/chart/chart-legend.js +79 -14
  10. package/dist/display/chart/chart-tooltip.js +211 -40
  11. package/dist/display/chat/attachment/attachment-parts.js +222 -13
  12. package/dist/display/chat/attachment/attachment.js +210 -28
  13. package/dist/display/chat/bubble.js +225 -37
  14. package/dist/display/chat/marker.js +143 -15
  15. package/dist/display/chat/message-scroller.js +277 -15
  16. package/dist/display/chat/message.js +238 -13
  17. package/dist/display/content/item.js +448 -47
  18. package/dist/display/content/kbd.js +78 -5
  19. package/dist/display/media/aspect-ratio.js +27 -3
  20. package/dist/display/media/carousel-controls.js +163 -12
  21. package/dist/display/media/carousel.js +325 -65
  22. package/dist/display/rule-grid/rule-grid.d.ts +3 -1
  23. package/dist/display/rule-grid/rule-grid.js +311 -25
  24. package/dist/display/separator.js +56 -3
  25. package/dist/display/skeletons/layouts/skeleton-rule-grid.d.ts +8 -0
  26. package/dist/display/skeletons/layouts/skeleton-rule-grid.js +83 -0
  27. package/dist/display/skeletons/layouts/skeleton-table.d.ts +8 -0
  28. package/dist/display/skeletons/layouts/skeleton-table.js +174 -0
  29. package/dist/display/skeletons/shapes/skeleton-avatar.d.ts +10 -0
  30. package/dist/display/skeletons/shapes/skeleton-avatar.js +102 -0
  31. package/dist/display/skeletons/shapes/skeleton-button.d.ts +10 -0
  32. package/dist/display/skeletons/shapes/skeleton-button.js +102 -0
  33. package/dist/display/skeletons/shapes/skeleton-text.d.ts +7 -0
  34. package/dist/display/skeletons/shapes/skeleton-text.js +84 -0
  35. package/dist/display/skeletons/skeleton-parts.d.ts +11 -0
  36. package/dist/display/skeletons/skeleton-parts.js +68 -0
  37. package/dist/display/status/alert.d.ts +1 -1
  38. package/dist/display/status/alert.js +137 -17
  39. package/dist/display/status/empty.js +250 -22
  40. package/dist/display/status/progress.d.ts +5 -1
  41. package/dist/display/status/progress.js +120 -3
  42. package/dist/display/status/skeleton.js +40 -3
  43. package/dist/display/status/spinner.js +42 -4
  44. package/dist/display/table.js +310 -17
  45. package/dist/feedback/toaster.d.ts +1 -1
  46. package/dist/feedback/toaster.js +100 -25
  47. package/dist/form/advanced/calendar-day-button.js +89 -12
  48. package/dist/form/advanced/calendar.js +349 -56
  49. package/dist/form/advanced/combobox/combobox-chips.js +152 -9
  50. package/dist/form/advanced/combobox/combobox-items.js +240 -15
  51. package/dist/form/advanced/combobox/combobox.js +387 -14
  52. package/dist/form/advanced/input-otp.js +202 -12
  53. package/dist/form/choice/checkbox.js +59 -4
  54. package/dist/form/choice/radio-group.js +95 -6
  55. package/dist/form/choice/select.js +479 -25
  56. package/dist/form/choice/slider.js +118 -4
  57. package/dist/form/choice/switch.js +53 -3
  58. package/dist/form/field/field-error.js +117 -14
  59. package/dist/form/field/field-separator.js +70 -3
  60. package/dist/form/field/field-set.js +85 -5
  61. package/dist/form/field/field-text.js +116 -7
  62. package/dist/form/field/field.js +138 -26
  63. package/dist/form/hook-form/form.js +338 -40
  64. package/dist/form/input-group.js +297 -47
  65. package/dist/form/input.js +47 -3
  66. package/dist/form/label.js +42 -3
  67. package/dist/form/native-select.js +148 -8
  68. package/dist/form/textarea.js +41 -3
  69. package/dist/index.d.ts +6 -0
  70. package/dist/index.js +6 -0
  71. package/dist/layout/accordion.js +166 -9
  72. package/dist/layout/collapsible.js +75 -7
  73. package/dist/layout/resizable.js +123 -8
  74. package/dist/layout/scroll/direction.js +25 -3
  75. package/dist/layout/scroll/scroll-area.d.ts +1 -1
  76. package/dist/layout/scroll/scroll-area.js +138 -5
  77. package/dist/layout/sidebar/sidebar-context.js +184 -51
  78. package/dist/layout/sidebar/sidebar-menu-sub.js +219 -14
  79. package/dist/layout/sidebar/sidebar-menu.js +319 -38
  80. package/dist/layout/sidebar/sidebar-sections.js +369 -22
  81. package/dist/layout/sidebar/sidebar.js +385 -29
  82. package/dist/layout/tabs.js +183 -18
  83. package/dist/layout/use-mobile.js +23 -10
  84. package/dist/navigation/breadcrumb.js +302 -18
  85. package/dist/navigation/menubar/menubar-items.js +323 -17
  86. package/dist/navigation/menubar/menubar-sub.js +126 -8
  87. package/dist/navigation/menubar/menubar.js +213 -13
  88. package/dist/navigation/navigation-menu.js +367 -19
  89. package/dist/navigation/pagination.js +329 -20
  90. package/dist/overlay/alert-dialog.js +485 -26
  91. package/dist/overlay/context-menu/context-menu-items.js +323 -17
  92. package/dist/overlay/context-menu/context-menu-sub.js +126 -8
  93. package/dist/overlay/context-menu/context-menu.js +140 -11
  94. package/dist/overlay/dialog.js +406 -25
  95. package/dist/overlay/floating/command.js +424 -21
  96. package/dist/overlay/floating/drawer.js +354 -22
  97. package/dist/overlay/floating/hover-card.js +107 -7
  98. package/dist/overlay/menu/dropdown-menu-choice.js +150 -8
  99. package/dist/overlay/menu/dropdown-menu-item.js +174 -9
  100. package/dist/overlay/menu/dropdown-menu-sub.js +125 -8
  101. package/dist/overlay/menu/dropdown-menu.js +147 -12
  102. package/dist/overlay/popover.js +106 -7
  103. package/dist/overlay/sheet.js +380 -27
  104. package/dist/overlay/tooltip.js +145 -9
  105. package/dist/shell/app-header.js +81 -5
  106. package/dist/shell/app-shell.js +58 -3
  107. package/dist/shell/breadcrumbs.js +102 -12
  108. package/dist/shell/docs/docs-header.js +211 -11
  109. package/dist/shell/docs/docs-shell.js +100 -3
  110. package/dist/shell/docs/docs-sidebar.js +88 -7
  111. package/dist/shell/docs/on-this-page.js +78 -7
  112. package/dist/shell/docs/use-active-section.js +88 -42
  113. package/dist/shell/navigation/app-sidebar.js +188 -6
  114. package/dist/shell/navigation/nav-group.js +161 -10
  115. package/dist/shell/theme-toggle.js +52 -5
  116. package/package.json +5 -5
@@ -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: "h-6 text-xs font-medium text-muted-foreground", 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,100 @@
1
+ import { c as _c } from "react/compiler-runtime";
1
2
  import { useCallback, useEffect, useRef, useState } from "react";
2
3
  const SMOOTH_SCROLL_MS = 800;
3
4
  function isWindowScrolledToBottom() {
4
- const pageHeight = document.documentElement.scrollHeight;
5
- const canScroll = pageHeight > window.innerHeight + 2;
6
- return canScroll && window.innerHeight + window.scrollY >= pageHeight - 2;
5
+ const pageHeight = document.documentElement.scrollHeight;
6
+ const canScroll = pageHeight > window.innerHeight + 2;
7
+ return canScroll && window.innerHeight + window.scrollY >= pageHeight - 2;
7
8
  }
8
9
  const ACTIVE_LINE_PX = 120;
9
10
  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
- }
11
+ let current = ids[0];
12
+ for (const id of ids) {
13
+ const top = document.getElementById(id)?.getBoundingClientRect().top;
14
+ if (top !== undefined && top <= ACTIVE_LINE_PX) {
15
+ current = id;
16
16
  }
17
- return current;
17
+ }
18
+ return current;
18
19
  }
19
20
  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);
25
- }
26
- }, []);
27
- const pinSection = useCallback((id) => {
28
- pinnedUntil.current = Date.now() + SMOOTH_SCROLL_MS;
21
+ const $ = _c(9);
22
+ const [activeId, setActiveId] = useState(sectionIds[0] ?? "");
23
+ const pinnedUntil = useRef(0);
24
+ let t0;
25
+ if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
26
+ t0 = id => {
27
+ if (Date.now() > pinnedUntil.current) {
29
28
  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];
29
+ }
30
+ };
31
+ $[0] = t0;
32
+ } else {
33
+ t0 = $[0];
34
+ }
35
+ const followScroll = t0;
36
+ let t1;
37
+ if ($[1] === Symbol.for("react.memo_cache_sentinel")) {
38
+ t1 = id_0 => {
39
+ pinnedUntil.current = Date.now() + SMOOTH_SCROLL_MS;
40
+ setActiveId(id_0);
41
+ };
42
+ $[1] = t1;
43
+ } else {
44
+ t1 = $[1];
45
+ }
46
+ const pinSection = t1;
47
+ let t2;
48
+ if ($[2] !== sectionIds) {
49
+ t2 = sectionIds.join(" ");
50
+ $[2] = sectionIds;
51
+ $[3] = t2;
52
+ } else {
53
+ t2 = $[3];
54
+ }
55
+ const idsKey = t2;
56
+ let t3;
57
+ let t4;
58
+ if ($[4] !== idsKey) {
59
+ t3 = () => {
60
+ const ids = idsKey.split(" ").filter(Boolean);
61
+ let frame = 0;
62
+ const updateActiveSection = () => {
63
+ cancelAnimationFrame(frame);
64
+ frame = requestAnimationFrame(() => {
65
+ const lastId = ids.at(-1);
66
+ const current = isWindowScrolledToBottom() && lastId ? lastId : lastSectionAboveLine(ids);
67
+ if (current) {
68
+ followScroll(current);
69
+ }
70
+ });
71
+ };
72
+ updateActiveSection();
73
+ window.addEventListener("scroll", updateActiveSection, {
74
+ passive: true
75
+ });
76
+ return () => {
77
+ cancelAnimationFrame(frame);
78
+ window.removeEventListener("scroll", updateActiveSection);
79
+ };
80
+ };
81
+ t4 = [idsKey, followScroll];
82
+ $[4] = idsKey;
83
+ $[5] = t3;
84
+ $[6] = t4;
85
+ } else {
86
+ t3 = $[5];
87
+ t4 = $[6];
88
+ }
89
+ useEffect(t3, t4);
90
+ let t5;
91
+ if ($[7] !== activeId) {
92
+ t5 = [activeId, pinSection];
93
+ $[7] = activeId;
94
+ $[8] = t5;
95
+ } else {
96
+ t5 = $[8];
97
+ }
98
+ return t5;
53
99
  }
54
100
  export { useActiveSection };
@@ -1,12 +1,194 @@
1
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { Sidebar, SidebarRail } from "../../layout/sidebar/sidebar.js";
3
3
  import { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "../../layout/sidebar/sidebar-menu.js";
4
- import { SidebarContent, SidebarFooter, SidebarHeader, } from "../../layout/sidebar/sidebar-sections.js";
4
+ import { SidebarContent, SidebarFooter, SidebarHeader } from "../../layout/sidebar/sidebar-sections.js";
5
5
  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 }))] })] }) }) }) }));
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ function BrandLink(t0) {
8
+ const $ = _c(14);
9
+ const {
10
+ brand,
11
+ Link
12
+ } = t0;
13
+ let t1;
14
+ if ($[0] !== brand.icon) {
15
+ t1 = /*#__PURE__*/_jsx("span", {
16
+ "data-slot": "app-brand-icon",
17
+ className: "flex aspect-square size-8 shrink-0 items-center justify-center rounded-lg border border-line bg-ghost",
18
+ children: brand.icon
19
+ });
20
+ $[0] = brand.icon;
21
+ $[1] = t1;
22
+ } else {
23
+ t1 = $[1];
24
+ }
25
+ let t2;
26
+ if ($[2] !== brand.title) {
27
+ t2 = /*#__PURE__*/_jsx("span", {
28
+ className: "truncate text-sm font-semibold tracking-tight",
29
+ children: brand.title
30
+ });
31
+ $[2] = brand.title;
32
+ $[3] = t2;
33
+ } else {
34
+ t2 = $[3];
35
+ }
36
+ let t3;
37
+ if ($[4] !== brand.subtitle) {
38
+ t3 = brand.subtitle && /*#__PURE__*/_jsx("span", {
39
+ className: "truncate text-xs text-soft",
40
+ children: brand.subtitle
41
+ });
42
+ $[4] = brand.subtitle;
43
+ $[5] = t3;
44
+ } else {
45
+ t3 = $[5];
46
+ }
47
+ let t4;
48
+ if ($[6] !== t2 || $[7] !== t3) {
49
+ t4 = /*#__PURE__*/_jsxs("span", {
50
+ className: "grid flex-1 text-left leading-tight",
51
+ children: [t2, t3]
52
+ });
53
+ $[6] = t2;
54
+ $[7] = t3;
55
+ $[8] = t4;
56
+ } else {
57
+ t4 = $[8];
58
+ }
59
+ let t5;
60
+ if ($[9] !== Link || $[10] !== brand.href || $[11] !== t1 || $[12] !== t4) {
61
+ t5 = /*#__PURE__*/_jsx(SidebarMenu, {
62
+ children: /*#__PURE__*/_jsx(SidebarMenuItem, {
63
+ children: /*#__PURE__*/_jsx(SidebarMenuButton, {
64
+ size: "lg",
65
+ asChild: true,
66
+ children: /*#__PURE__*/_jsxs(Link, {
67
+ href: brand.href,
68
+ children: [t1, t4]
69
+ })
70
+ })
71
+ })
72
+ });
73
+ $[9] = Link;
74
+ $[10] = brand.href;
75
+ $[11] = t1;
76
+ $[12] = t4;
77
+ $[13] = t5;
78
+ } else {
79
+ t5 = $[13];
80
+ }
81
+ return t5;
8
82
  }
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, {})] }));
83
+ function AppSidebar(t0) {
84
+ const $ = _c(24);
85
+ const {
86
+ brand,
87
+ groups,
88
+ bottomItems,
89
+ footer,
90
+ activeHref,
91
+ linkComponent: t1
92
+ } = t0;
93
+ const linkComponent = t1 === undefined ? "a" : t1;
94
+ let t2;
95
+ if ($[0] !== brand || $[1] !== linkComponent) {
96
+ t2 = /*#__PURE__*/_jsx(SidebarHeader, {
97
+ className: "h-14 justify-center border-b border-line py-0",
98
+ children: /*#__PURE__*/_jsx(BrandLink, {
99
+ brand: brand,
100
+ Link: linkComponent
101
+ })
102
+ });
103
+ $[0] = brand;
104
+ $[1] = linkComponent;
105
+ $[2] = t2;
106
+ } else {
107
+ t2 = $[2];
108
+ }
109
+ let t3;
110
+ if ($[3] !== activeHref || $[4] !== groups || $[5] !== linkComponent) {
111
+ let t4;
112
+ if ($[7] !== activeHref || $[8] !== linkComponent) {
113
+ t4 = group => /*#__PURE__*/_jsx(NavGroup, {
114
+ group: group,
115
+ activeHref: activeHref,
116
+ Link: linkComponent
117
+ }, group.label);
118
+ $[7] = activeHref;
119
+ $[8] = linkComponent;
120
+ $[9] = t4;
121
+ } else {
122
+ t4 = $[9];
123
+ }
124
+ t3 = groups.map(t4);
125
+ $[3] = activeHref;
126
+ $[4] = groups;
127
+ $[5] = linkComponent;
128
+ $[6] = t3;
129
+ } else {
130
+ t3 = $[6];
131
+ }
132
+ let t4;
133
+ if ($[10] !== activeHref || $[11] !== bottomItems || $[12] !== linkComponent) {
134
+ t4 = bottomItems && bottomItems.length > 0 && /*#__PURE__*/_jsx(NavGroup, {
135
+ group: {
136
+ label: "",
137
+ items: bottomItems
138
+ },
139
+ activeHref: activeHref,
140
+ Link: linkComponent,
141
+ className: "mt-auto"
142
+ });
143
+ $[10] = activeHref;
144
+ $[11] = bottomItems;
145
+ $[12] = linkComponent;
146
+ $[13] = t4;
147
+ } else {
148
+ t4 = $[13];
149
+ }
150
+ let t5;
151
+ if ($[14] !== t3 || $[15] !== t4) {
152
+ t5 = /*#__PURE__*/_jsxs(SidebarContent, {
153
+ children: [t3, t4]
154
+ });
155
+ $[14] = t3;
156
+ $[15] = t4;
157
+ $[16] = t5;
158
+ } else {
159
+ t5 = $[16];
160
+ }
161
+ let t6;
162
+ if ($[17] !== footer) {
163
+ t6 = footer && /*#__PURE__*/_jsx(SidebarFooter, {
164
+ className: "border-t border-line",
165
+ children: footer
166
+ });
167
+ $[17] = footer;
168
+ $[18] = t6;
169
+ } else {
170
+ t6 = $[18];
171
+ }
172
+ let t7;
173
+ if ($[19] === Symbol.for("react.memo_cache_sentinel")) {
174
+ t7 = /*#__PURE__*/_jsx(SidebarRail, {});
175
+ $[19] = t7;
176
+ } else {
177
+ t7 = $[19];
178
+ }
179
+ let t8;
180
+ if ($[20] !== t2 || $[21] !== t5 || $[22] !== t6) {
181
+ t8 = /*#__PURE__*/_jsxs(Sidebar, {
182
+ collapsible: "icon",
183
+ children: [t2, t5, t6, t7]
184
+ });
185
+ $[20] = t2;
186
+ $[21] = t5;
187
+ $[22] = t6;
188
+ $[23] = t8;
189
+ } else {
190
+ t8 = $[23];
191
+ }
192
+ return t8;
11
193
  }
12
194
  export { AppSidebar };
@@ -1,17 +1,168 @@
1
- import { Fragment as _Fragment, jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
1
+ import { c as _c } from "react/compiler-runtime";
2
2
  import { SidebarMenu, SidebarMenuButton, SidebarMenuItem } from "../../layout/sidebar/sidebar-menu.js";
3
- import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel, } from "../../layout/sidebar/sidebar-sections.js";
3
+ import { SidebarGroup, SidebarGroupContent, SidebarGroupLabel } from "../../layout/sidebar/sidebar-sections.js";
4
+ import { jsx as _jsx, Fragment as _Fragment, jsxs as _jsxs } from "react/jsx-runtime";
4
5
  function isActiveHref(itemHref, activeHref) {
5
- return activeHref === itemHref || activeHref.startsWith(`${itemHref}/`);
6
+ return activeHref === itemHref || activeHref.startsWith(`${itemHref}/`);
6
7
  }
7
- function NavItemLink({ item, Link, ...props }) {
8
- const content = (_jsxs(_Fragment, { children: [_jsx(item.icon, {}), _jsx("span", { children: item.title })] }));
9
- if (item.external) {
10
- return (_jsx("a", { ...props, href: item.href, target: "_blank", rel: "noreferrer", children: content }));
8
+ function NavItemLink(t0) {
9
+ const $ = _c(20);
10
+ let Link;
11
+ let item;
12
+ let props;
13
+ if ($[0] !== t0) {
14
+ ({
15
+ item,
16
+ Link,
17
+ ...props
18
+ } = t0);
19
+ $[0] = t0;
20
+ $[1] = Link;
21
+ $[2] = item;
22
+ $[3] = props;
23
+ } else {
24
+ Link = $[1];
25
+ item = $[2];
26
+ props = $[3];
27
+ }
28
+ let t1;
29
+ if ($[4] !== item.icon) {
30
+ t1 = /*#__PURE__*/_jsx(item.icon, {});
31
+ $[4] = item.icon;
32
+ $[5] = t1;
33
+ } else {
34
+ t1 = $[5];
35
+ }
36
+ let t2;
37
+ if ($[6] !== item.title) {
38
+ t2 = /*#__PURE__*/_jsx("span", {
39
+ children: item.title
40
+ });
41
+ $[6] = item.title;
42
+ $[7] = t2;
43
+ } else {
44
+ t2 = $[7];
45
+ }
46
+ let t3;
47
+ if ($[8] !== t1 || $[9] !== t2) {
48
+ t3 = /*#__PURE__*/_jsxs(_Fragment, {
49
+ children: [t1, t2]
50
+ });
51
+ $[8] = t1;
52
+ $[9] = t2;
53
+ $[10] = t3;
54
+ } else {
55
+ t3 = $[10];
56
+ }
57
+ const content = t3;
58
+ if (item.external) {
59
+ let t4;
60
+ if ($[11] !== content || $[12] !== item.href || $[13] !== props) {
61
+ t4 = /*#__PURE__*/_jsx("a", {
62
+ ...props,
63
+ href: item.href,
64
+ target: "_blank",
65
+ rel: "noreferrer",
66
+ children: content
67
+ });
68
+ $[11] = content;
69
+ $[12] = item.href;
70
+ $[13] = props;
71
+ $[14] = t4;
72
+ } else {
73
+ t4 = $[14];
11
74
  }
12
- return (_jsx(Link, { ...props, href: item.href, children: content }));
75
+ return t4;
76
+ }
77
+ let t4;
78
+ if ($[15] !== Link || $[16] !== content || $[17] !== item.href || $[18] !== props) {
79
+ t4 = /*#__PURE__*/_jsx(Link, {
80
+ ...props,
81
+ href: item.href,
82
+ children: content
83
+ });
84
+ $[15] = Link;
85
+ $[16] = content;
86
+ $[17] = item.href;
87
+ $[18] = props;
88
+ $[19] = t4;
89
+ } else {
90
+ t4 = $[19];
91
+ }
92
+ return t4;
13
93
  }
14
- function NavGroup({ group, activeHref, Link, className }) {
15
- return (_jsxs(SidebarGroup, { className: className, children: [group.label && _jsx(SidebarGroupLabel, { children: group.label }), _jsx(SidebarGroupContent, { children: _jsx(SidebarMenu, { children: group.items.map((item) => (_jsx(SidebarMenuItem, { children: _jsx(SidebarMenuButton, { asChild: true, isActive: isActiveHref(item.href, activeHref), tooltip: item.title, children: _jsx(NavItemLink, { item: item, Link: Link }) }) }, item.href))) }) })] }));
94
+ function NavGroup(t0) {
95
+ const $ = _c(15);
96
+ const {
97
+ group,
98
+ activeHref,
99
+ Link,
100
+ className
101
+ } = t0;
102
+ let t1;
103
+ if ($[0] !== group.label) {
104
+ t1 = group.label && /*#__PURE__*/_jsx(SidebarGroupLabel, {
105
+ children: group.label
106
+ });
107
+ $[0] = group.label;
108
+ $[1] = t1;
109
+ } else {
110
+ t1 = $[1];
111
+ }
112
+ let t2;
113
+ if ($[2] !== Link || $[3] !== activeHref || $[4] !== group.items) {
114
+ let t3;
115
+ if ($[6] !== Link || $[7] !== activeHref) {
116
+ t3 = item => /*#__PURE__*/_jsx(SidebarMenuItem, {
117
+ children: /*#__PURE__*/_jsx(SidebarMenuButton, {
118
+ asChild: true,
119
+ isActive: isActiveHref(item.href, activeHref),
120
+ tooltip: item.title,
121
+ children: /*#__PURE__*/_jsx(NavItemLink, {
122
+ item: item,
123
+ Link: Link
124
+ })
125
+ })
126
+ }, item.href);
127
+ $[6] = Link;
128
+ $[7] = activeHref;
129
+ $[8] = t3;
130
+ } else {
131
+ t3 = $[8];
132
+ }
133
+ t2 = group.items.map(t3);
134
+ $[2] = Link;
135
+ $[3] = activeHref;
136
+ $[4] = group.items;
137
+ $[5] = t2;
138
+ } else {
139
+ t2 = $[5];
140
+ }
141
+ let t3;
142
+ if ($[9] !== t2) {
143
+ t3 = /*#__PURE__*/_jsx(SidebarGroupContent, {
144
+ children: /*#__PURE__*/_jsx(SidebarMenu, {
145
+ children: t2
146
+ })
147
+ });
148
+ $[9] = t2;
149
+ $[10] = t3;
150
+ } else {
151
+ t3 = $[10];
152
+ }
153
+ let t4;
154
+ if ($[11] !== className || $[12] !== t1 || $[13] !== t3) {
155
+ t4 = /*#__PURE__*/_jsxs(SidebarGroup, {
156
+ className: className,
157
+ children: [t1, t3]
158
+ });
159
+ $[11] = className;
160
+ $[12] = t1;
161
+ $[13] = t3;
162
+ $[14] = t4;
163
+ } else {
164
+ t4 = $[14];
165
+ }
166
+ return t4;
16
167
  }
17
168
  export { isActiveHref, NavGroup };
@@ -1,9 +1,56 @@
1
1
  "use client";
2
- import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
3
- import { MoonIcon, SunIcon } from "lucide-react";
2
+
3
+ import { c as _c } from "react/compiler-runtime";
4
+ import { Moon as MoonIcon, Sun as SunIcon } from "@carbon/icons-react";
4
5
  import { Button } from "../action/button.js";
5
- function ThemeToggle({ theme, onThemeChange }) {
6
- const nextTheme = theme === "dark" ? "light" : "dark";
7
- return (_jsxs(Button, { variant: "ghost", size: "icon-sm", "aria-label": `Switch to ${nextTheme} theme`, onClick: () => onThemeChange(nextTheme), children: [_jsx(SunIcon, { className: "scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90" }), _jsx(MoonIcon, { className: "absolute scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0" })] }));
6
+ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
7
+ function ThemeToggle(t0) {
8
+ const $ = _c(8);
9
+ const {
10
+ theme,
11
+ onThemeChange
12
+ } = t0;
13
+ const nextTheme = theme === "dark" ? "light" : "dark";
14
+ const t1 = `Switch to ${nextTheme} theme`;
15
+ let t2;
16
+ if ($[0] !== nextTheme || $[1] !== onThemeChange) {
17
+ t2 = () => onThemeChange(nextTheme);
18
+ $[0] = nextTheme;
19
+ $[1] = onThemeChange;
20
+ $[2] = t2;
21
+ } else {
22
+ t2 = $[2];
23
+ }
24
+ let t3;
25
+ let t4;
26
+ if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
27
+ t3 = /*#__PURE__*/_jsx(SunIcon, {
28
+ className: "scale-100 rotate-0 transition-all dark:scale-0 dark:-rotate-90"
29
+ });
30
+ t4 = /*#__PURE__*/_jsx(MoonIcon, {
31
+ className: "absolute scale-0 rotate-90 transition-all dark:scale-100 dark:rotate-0"
32
+ });
33
+ $[3] = t3;
34
+ $[4] = t4;
35
+ } else {
36
+ t3 = $[3];
37
+ t4 = $[4];
38
+ }
39
+ let t5;
40
+ if ($[5] !== t1 || $[6] !== t2) {
41
+ t5 = /*#__PURE__*/_jsxs(Button, {
42
+ variant: "ghost",
43
+ size: "icon-sm",
44
+ "aria-label": t1,
45
+ onClick: t2,
46
+ children: [t3, t4]
47
+ });
48
+ $[5] = t1;
49
+ $[6] = t2;
50
+ $[7] = t5;
51
+ } else {
52
+ t5 = $[7];
53
+ }
54
+ return t5;
8
55
  }
9
56
  export { ThemeToggle };