@krak-stack/registry 0.1.0

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 (84) hide show
  1. package/README.md +29 -0
  2. package/dist/components/ui/alert-dialog.d.ts +18 -0
  3. package/dist/components/ui/app-brand.d.ts +26 -0
  4. package/dist/components/ui/app-brand.js +78 -0
  5. package/dist/components/ui/attachment.d.ts +23 -0
  6. package/dist/components/ui/badge.d.ts +7 -0
  7. package/dist/components/ui/button.d.ts +8 -0
  8. package/dist/components/ui/card.d.ts +11 -0
  9. package/dist/components/ui/checkbox.d.ts +3 -0
  10. package/dist/components/ui/code-block.d.ts +14 -0
  11. package/dist/components/ui/code-block.js +224 -0
  12. package/dist/components/ui/command.d.ts +18 -0
  13. package/dist/components/ui/copy-button.d.ts +18 -0
  14. package/dist/components/ui/copy-button.js +133 -0
  15. package/dist/components/ui/data-table.d.ts +264 -0
  16. package/dist/components/ui/data-table.js +3594 -0
  17. package/dist/components/ui/dialog.d.ts +13 -0
  18. package/dist/components/ui/dropdown-menu.d.ts +29 -0
  19. package/dist/components/ui/editing-locale-switcher.d.ts +7 -0
  20. package/dist/components/ui/editing-locale-switcher.js +626 -0
  21. package/dist/components/ui/effect-form.d.ts +137 -0
  22. package/dist/components/ui/effect-form.js +2330 -0
  23. package/dist/components/ui/field.d.ts +24 -0
  24. package/dist/components/ui/file-picker.d.ts +30 -0
  25. package/dist/components/ui/file-picker.js +811 -0
  26. package/dist/components/ui/form.d.ts +402 -0
  27. package/dist/components/ui/form.js +2245 -0
  28. package/dist/components/ui/google-map.d.ts +103 -0
  29. package/dist/components/ui/google-map.js +754 -0
  30. package/dist/components/ui/icon-input.d.ts +9 -0
  31. package/dist/components/ui/icon-input.js +971 -0
  32. package/dist/components/ui/input-group.d.ts +17 -0
  33. package/dist/components/ui/input.d.ts +3 -0
  34. package/dist/components/ui/label.d.ts +3 -0
  35. package/dist/components/ui/loading.d.ts +7 -0
  36. package/dist/components/ui/loading.js +467 -0
  37. package/dist/components/ui/locale-switcher.d.ts +7 -0
  38. package/dist/components/ui/locale-switcher.js +632 -0
  39. package/dist/components/ui/pagination.d.ts +43 -0
  40. package/dist/components/ui/pagination.js +787 -0
  41. package/dist/components/ui/popover.d.ts +9 -0
  42. package/dist/components/ui/scroll-area.d.ts +4 -0
  43. package/dist/components/ui/search-menu.d.ts +34 -0
  44. package/dist/components/ui/search-menu.js +839 -0
  45. package/dist/components/ui/select.d.ts +15 -0
  46. package/dist/components/ui/separator.d.ts +3 -0
  47. package/dist/components/ui/sheet.d.ts +14 -0
  48. package/dist/components/ui/sidebar-layout.d.ts +29 -0
  49. package/dist/components/ui/sidebar-layout.js +755 -0
  50. package/dist/components/ui/sidebar.d.ts +63 -0
  51. package/dist/components/ui/skeleton.d.ts +2 -0
  52. package/dist/components/ui/stats-card.d.ts +12 -0
  53. package/dist/components/ui/stats-card.js +125 -0
  54. package/dist/components/ui/table.d.ts +10 -0
  55. package/dist/components/ui/textarea.d.ts +3 -0
  56. package/dist/components/ui/theme-switcher.d.ts +29 -0
  57. package/dist/components/ui/theme-switcher.js +775 -0
  58. package/dist/components/ui/tooltip.d.ts +6 -0
  59. package/dist/components/ui/virtualized-combobox.d.ts +54 -0
  60. package/dist/components/ui/virtualized-combobox.js +821 -0
  61. package/dist/hooks/use-mobile.d.ts +1 -0
  62. package/dist/lib/query.d.ts +49 -0
  63. package/dist/lib/utils.d.ts +2 -0
  64. package/dist/paraglide/runtime.d.ts +978 -0
  65. package/dist/services/embedding.d.ts +2 -0
  66. package/dist/services/embedding.js +23 -0
  67. package/dist/services/notification/channels/index.d.ts +22 -0
  68. package/dist/services/notification/channels/index.js +11 -0
  69. package/dist/services/notification/channels/ses/index.d.ts +51 -0
  70. package/dist/services/notification/channels/ses/index.js +145 -0
  71. package/dist/services/notification/channels/ses/schema.d.ts +13 -0
  72. package/dist/services/notification/channels/ses/schema.js +35 -0
  73. package/dist/services/notification/index.d.ts +15 -0
  74. package/dist/services/notification/index.js +67 -0
  75. package/dist/services/notification/schema.d.ts +10 -0
  76. package/dist/services/notification/schema.js +30 -0
  77. package/dist/services/opentelemetry.d.ts +8 -0
  78. package/dist/services/opentelemetry.js +23 -0
  79. package/dist/services/s3/index.d.ts +62 -0
  80. package/dist/services/s3/index.js +208 -0
  81. package/dist/services/s3/schema.d.ts +18 -0
  82. package/dist/services/s3/schema.js +37 -0
  83. package/package.json +218 -0
  84. package/tailwind.css +1 -0
@@ -0,0 +1,755 @@
1
+ // ../../src/components/ui/sidebar-layout.tsx
2
+ import { useAtom } from "@effect/atom-react";
3
+ import { BrowserKeyValueStore } from "@effect/platform-browser";
4
+ import { Link, Outlet, useRouterState } from "@tanstack/react-router";
5
+ import { Schema } from "effect";
6
+ import { Atom } from "effect/unstable/reactivity";
7
+
8
+ // ../../src/components/ui/badge.tsx
9
+ import { mergeProps } from "@base-ui/react/merge-props";
10
+ import { useRender } from "@base-ui/react/use-render";
11
+ import { cva } from "class-variance-authority";
12
+
13
+ // ../../src/lib/utils.ts
14
+ import { clsx } from "clsx";
15
+ import { twMerge } from "tailwind-merge";
16
+ function cn(...inputs) {
17
+ return twMerge(clsx(inputs));
18
+ }
19
+
20
+ // ../../src/components/ui/badge.tsx
21
+ var badgeVariants = cva("group/badge inline-flex h-5 w-fit shrink-0 items-center justify-center gap-1 overflow-hidden rounded-4xl border border-transparent px-2 py-0.5 text-xs font-medium whitespace-nowrap transition-all focus-visible:border-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 aria-invalid:border-destructive aria-invalid:ring-destructive/20 dark:aria-invalid:ring-destructive/40 [&>svg]:pointer-events-none [&>svg]:size-3!", {
22
+ variants: {
23
+ variant: {
24
+ default: "bg-primary text-primary-foreground [a]:hover:bg-primary/80",
25
+ secondary: "bg-secondary text-secondary-foreground [a]:hover:bg-secondary/80",
26
+ destructive: "bg-destructive/10 text-destructive focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:focus-visible:ring-destructive/40 [a]:hover:bg-destructive/20",
27
+ outline: "border-border text-foreground [a]:hover:bg-muted [a]:hover:text-muted-foreground",
28
+ ghost: "hover:bg-muted hover:text-muted-foreground dark:hover:bg-muted/50",
29
+ link: "text-primary underline-offset-4 hover:underline"
30
+ }
31
+ },
32
+ defaultVariants: {
33
+ variant: "default"
34
+ }
35
+ });
36
+ function Badge({
37
+ className,
38
+ variant = "default",
39
+ render,
40
+ ...props
41
+ }) {
42
+ return useRender({
43
+ defaultTagName: "span",
44
+ props: mergeProps({
45
+ className: cn(badgeVariants({ variant }), className)
46
+ }, props),
47
+ render,
48
+ state: {
49
+ slot: "badge",
50
+ variant
51
+ }
52
+ });
53
+ }
54
+
55
+ // ../../src/components/ui/sidebar.tsx
56
+ import * as React2 from "react";
57
+ import { mergeProps as mergeProps2 } from "@base-ui/react/merge-props";
58
+ import { useRender as useRender2 } from "@base-ui/react/use-render";
59
+ import { cva as cva3 } from "class-variance-authority";
60
+
61
+ // ../../src/hooks/use-mobile.ts
62
+ import * as React from "react";
63
+ var MOBILE_BREAKPOINT = 768;
64
+ function useIsMobile() {
65
+ const [isMobile, setIsMobile] = React.useState(undefined);
66
+ React.useEffect(() => {
67
+ const mql = window.matchMedia(`(max-width: ${MOBILE_BREAKPOINT - 1}px)`);
68
+ const onChange = () => {
69
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
70
+ };
71
+ mql.addEventListener("change", onChange);
72
+ setIsMobile(window.innerWidth < MOBILE_BREAKPOINT);
73
+ return () => mql.removeEventListener("change", onChange);
74
+ }, []);
75
+ return !!isMobile;
76
+ }
77
+
78
+ // ../../src/components/ui/button.tsx
79
+ import { Button as ButtonPrimitive } from "@base-ui/react/button";
80
+ import { cva as cva2 } from "class-variance-authority";
81
+ import { jsxDEV } from "react/jsx-dev-runtime";
82
+ var buttonVariants = cva2("group/button inline-flex shrink-0 items-center justify-center rounded-md border border-transparent bg-clip-padding text-sm font-medium whitespace-nowrap transition-all outline-none select-none focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 active:not-aria-[haspopup]:translate-y-px disabled:pointer-events-none disabled:opacity-50 aria-invalid:border-destructive aria-invalid:ring-3 aria-invalid:ring-destructive/20 dark:aria-invalid:border-destructive/50 dark:aria-invalid:ring-destructive/40 [&_svg]:pointer-events-none [&_svg]:shrink-0 [&_svg:not([class*='size-'])]:size-4", {
83
+ variants: {
84
+ variant: {
85
+ default: "bg-primary text-primary-foreground hover:bg-primary/80",
86
+ outline: "border-border bg-background shadow-xs hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:border-input dark:bg-input/30 dark:hover:bg-input/50",
87
+ secondary: "bg-secondary text-secondary-foreground hover:bg-[color-mix(in_oklch,var(--secondary),var(--foreground)_5%)] aria-expanded:bg-secondary aria-expanded:text-secondary-foreground",
88
+ ghost: "hover:bg-muted hover:text-foreground aria-expanded:bg-muted aria-expanded:text-foreground dark:hover:bg-muted/50",
89
+ destructive: "bg-destructive/10 text-destructive hover:bg-destructive/20 focus-visible:border-destructive/40 focus-visible:ring-destructive/20 dark:bg-destructive/20 dark:hover:bg-destructive/30 dark:focus-visible:ring-destructive/40",
90
+ link: "text-primary underline-offset-4 hover:underline"
91
+ },
92
+ size: {
93
+ default: "h-9 gap-1.5 px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
94
+ xs: "h-6 gap-1 rounded-[min(var(--radius-md),8px)] px-2 text-xs in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5 [&_svg:not([class*='size-'])]:size-3",
95
+ sm: "h-8 gap-1 rounded-[min(var(--radius-md),10px)] px-2.5 in-data-[slot=button-group]:rounded-md has-data-[icon=inline-end]:pr-1.5 has-data-[icon=inline-start]:pl-1.5",
96
+ lg: "h-10 gap-1.5 px-2.5 has-data-[icon=inline-end]:pr-2 has-data-[icon=inline-start]:pl-2",
97
+ icon: "size-9",
98
+ "icon-xs": "size-6 rounded-[min(var(--radius-md),8px)] in-data-[slot=button-group]:rounded-md [&_svg:not([class*='size-'])]:size-3",
99
+ "icon-sm": "size-8 rounded-[min(var(--radius-md),10px)] in-data-[slot=button-group]:rounded-md",
100
+ "icon-lg": "size-10"
101
+ }
102
+ },
103
+ defaultVariants: {
104
+ variant: "default",
105
+ size: "default"
106
+ }
107
+ });
108
+ function Button({
109
+ className,
110
+ variant = "default",
111
+ size = "default",
112
+ ...props
113
+ }) {
114
+ return /* @__PURE__ */ jsxDEV(ButtonPrimitive, {
115
+ "data-slot": "button",
116
+ className: cn(buttonVariants({ variant, size, className })),
117
+ ...props
118
+ }, undefined, false, undefined, this);
119
+ }
120
+
121
+ // ../../src/components/ui/input.tsx
122
+ import { Input as InputPrimitive } from "@base-ui/react/input";
123
+ import { jsxDEV as jsxDEV2 } from "react/jsx-dev-runtime";
124
+
125
+ // ../../src/components/ui/separator.tsx
126
+ import { Separator as SeparatorPrimitive } from "@base-ui/react/separator";
127
+ import { jsxDEV as jsxDEV3 } from "react/jsx-dev-runtime";
128
+
129
+ // ../../src/components/ui/sheet.tsx
130
+ import { Dialog as SheetPrimitive } from "@base-ui/react/dialog";
131
+ import { XIcon } from "lucide-react";
132
+ import { jsxDEV as jsxDEV4 } from "react/jsx-dev-runtime";
133
+ "use client";
134
+ function Sheet({ ...props }) {
135
+ return /* @__PURE__ */ jsxDEV4(SheetPrimitive.Root, {
136
+ "data-slot": "sheet",
137
+ ...props
138
+ }, undefined, false, undefined, this);
139
+ }
140
+ function SheetPortal({ ...props }) {
141
+ return /* @__PURE__ */ jsxDEV4(SheetPrimitive.Portal, {
142
+ "data-slot": "sheet-portal",
143
+ ...props
144
+ }, undefined, false, undefined, this);
145
+ }
146
+ function SheetOverlay({ className, ...props }) {
147
+ return /* @__PURE__ */ jsxDEV4(SheetPrimitive.Backdrop, {
148
+ "data-slot": "sheet-overlay",
149
+ className: cn("fixed inset-0 z-50 bg-black/10 transition-opacity duration-150 data-ending-style:opacity-0 data-starting-style:opacity-0 supports-backdrop-filter:backdrop-blur-xs", className),
150
+ ...props
151
+ }, undefined, false, undefined, this);
152
+ }
153
+ function SheetContent({
154
+ className,
155
+ children,
156
+ side = "right",
157
+ showCloseButton = true,
158
+ ...props
159
+ }) {
160
+ return /* @__PURE__ */ jsxDEV4(SheetPortal, {
161
+ children: [
162
+ /* @__PURE__ */ jsxDEV4(SheetOverlay, {}, undefined, false, undefined, this),
163
+ /* @__PURE__ */ jsxDEV4(SheetPrimitive.Popup, {
164
+ "data-slot": "sheet-content",
165
+ "data-side": side,
166
+ className: cn("fixed z-50 flex flex-col gap-4 bg-popover bg-clip-padding text-sm text-popover-foreground shadow-lg transition duration-200 ease-in-out data-ending-style:opacity-0 data-starting-style:opacity-0 data-[side=bottom]:inset-x-0 data-[side=bottom]:bottom-0 data-[side=bottom]:h-auto data-[side=bottom]:border-t data-[side=bottom]:data-ending-style:translate-y-[2.5rem] data-[side=bottom]:data-starting-style:translate-y-[2.5rem] data-[side=left]:inset-y-0 data-[side=left]:left-0 data-[side=left]:h-full data-[side=left]:w-3/4 data-[side=left]:border-r data-[side=left]:data-ending-style:translate-x-[-2.5rem] data-[side=left]:data-starting-style:translate-x-[-2.5rem] data-[side=right]:inset-y-0 data-[side=right]:right-0 data-[side=right]:h-full data-[side=right]:w-3/4 data-[side=right]:border-l data-[side=right]:data-ending-style:translate-x-[2.5rem] data-[side=right]:data-starting-style:translate-x-[2.5rem] data-[side=top]:inset-x-0 data-[side=top]:top-0 data-[side=top]:h-auto data-[side=top]:border-b data-[side=top]:data-ending-style:translate-y-[-2.5rem] data-[side=top]:data-starting-style:translate-y-[-2.5rem] data-[side=left]:sm:max-w-sm data-[side=right]:sm:max-w-sm", className),
167
+ ...props,
168
+ children: [
169
+ children,
170
+ showCloseButton && /* @__PURE__ */ jsxDEV4(SheetPrimitive.Close, {
171
+ "data-slot": "sheet-close",
172
+ render: /* @__PURE__ */ jsxDEV4(Button, {
173
+ variant: "ghost",
174
+ className: "absolute top-4 right-4",
175
+ size: "icon-sm"
176
+ }, undefined, false, undefined, this),
177
+ children: [
178
+ /* @__PURE__ */ jsxDEV4(XIcon, {}, undefined, false, undefined, this),
179
+ /* @__PURE__ */ jsxDEV4("span", {
180
+ className: "sr-only",
181
+ children: "Close"
182
+ }, undefined, false, undefined, this)
183
+ ]
184
+ }, undefined, true, undefined, this)
185
+ ]
186
+ }, undefined, true, undefined, this)
187
+ ]
188
+ }, undefined, true, undefined, this);
189
+ }
190
+ function SheetHeader({ className, ...props }) {
191
+ return /* @__PURE__ */ jsxDEV4("div", {
192
+ "data-slot": "sheet-header",
193
+ className: cn("flex flex-col gap-1.5 p-4", className),
194
+ ...props
195
+ }, undefined, false, undefined, this);
196
+ }
197
+ function SheetTitle({ className, ...props }) {
198
+ return /* @__PURE__ */ jsxDEV4(SheetPrimitive.Title, {
199
+ "data-slot": "sheet-title",
200
+ className: cn("font-medium text-foreground", className),
201
+ ...props
202
+ }, undefined, false, undefined, this);
203
+ }
204
+ function SheetDescription({
205
+ className,
206
+ ...props
207
+ }) {
208
+ return /* @__PURE__ */ jsxDEV4(SheetPrimitive.Description, {
209
+ "data-slot": "sheet-description",
210
+ className: cn("text-sm text-muted-foreground", className),
211
+ ...props
212
+ }, undefined, false, undefined, this);
213
+ }
214
+
215
+ // ../../src/components/ui/skeleton.tsx
216
+ import { jsxDEV as jsxDEV5 } from "react/jsx-dev-runtime";
217
+
218
+ // ../../src/components/ui/tooltip.tsx
219
+ import { Tooltip as TooltipPrimitive } from "@base-ui/react/tooltip";
220
+ import { jsxDEV as jsxDEV6 } from "react/jsx-dev-runtime";
221
+ "use client";
222
+ function Tooltip({ ...props }) {
223
+ return /* @__PURE__ */ jsxDEV6(TooltipPrimitive.Root, {
224
+ "data-slot": "tooltip",
225
+ ...props
226
+ }, undefined, false, undefined, this);
227
+ }
228
+ function TooltipTrigger({ ...props }) {
229
+ return /* @__PURE__ */ jsxDEV6(TooltipPrimitive.Trigger, {
230
+ "data-slot": "tooltip-trigger",
231
+ ...props
232
+ }, undefined, false, undefined, this);
233
+ }
234
+ function TooltipContent({
235
+ className,
236
+ side = "top",
237
+ sideOffset = 4,
238
+ align = "center",
239
+ alignOffset = 0,
240
+ children,
241
+ ...props
242
+ }) {
243
+ return /* @__PURE__ */ jsxDEV6(TooltipPrimitive.Portal, {
244
+ children: /* @__PURE__ */ jsxDEV6(TooltipPrimitive.Positioner, {
245
+ align,
246
+ alignOffset,
247
+ side,
248
+ sideOffset,
249
+ className: "isolate z-50",
250
+ children: /* @__PURE__ */ jsxDEV6(TooltipPrimitive.Popup, {
251
+ "data-slot": "tooltip-content",
252
+ className: cn("z-50 inline-flex w-fit max-w-xs origin-(--transform-origin) items-center gap-1.5 rounded-md bg-foreground px-3 py-1.5 text-xs text-background has-data-[slot=kbd]:pr-1.5 data-[side=bottom]:slide-in-from-top-2 data-[side=inline-end]:slide-in-from-left-2 data-[side=inline-start]:slide-in-from-right-2 data-[side=left]:slide-in-from-right-2 data-[side=right]:slide-in-from-left-2 data-[side=top]:slide-in-from-bottom-2 **:data-[slot=kbd]:relative **:data-[slot=kbd]:isolate **:data-[slot=kbd]:z-50 **:data-[slot=kbd]:rounded-sm data-[state=delayed-open]:animate-in data-[state=delayed-open]:fade-in-0 data-[state=delayed-open]:zoom-in-95 data-open:animate-in data-open:fade-in-0 data-open:zoom-in-95 data-closed:animate-out data-closed:fade-out-0 data-closed:zoom-out-95", className),
253
+ ...props,
254
+ children: [
255
+ children,
256
+ /* @__PURE__ */ jsxDEV6(TooltipPrimitive.Arrow, {
257
+ className: "bg-foreground fill-foreground z-50 size-2.5 translate-y-[calc(-50%-2px)] rotate-45 rounded-[2px] data-[side=bottom]:top-1 data-[side=inline-end]:top-1/2! data-[side=inline-end]:-left-1 data-[side=inline-end]:-translate-y-1/2 data-[side=inline-start]:top-1/2! data-[side=inline-start]:-right-1 data-[side=inline-start]:-translate-y-1/2 data-[side=left]:top-1/2! data-[side=left]:-right-1 data-[side=left]:-translate-y-1/2 data-[side=right]:top-1/2! data-[side=right]:-left-1 data-[side=right]:-translate-y-1/2 data-[side=top]:-bottom-2.5"
258
+ }, undefined, false, undefined, this)
259
+ ]
260
+ }, undefined, true, undefined, this)
261
+ }, undefined, false, undefined, this)
262
+ }, undefined, false, undefined, this);
263
+ }
264
+
265
+ // ../../src/components/ui/sidebar.tsx
266
+ import { PanelLeftIcon } from "lucide-react";
267
+ import { jsxDEV as jsxDEV7 } from "react/jsx-dev-runtime";
268
+ var SIDEBAR_COOKIE_NAME = "sidebar_state";
269
+ var SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
270
+ var SIDEBAR_WIDTH = "16rem";
271
+ var SIDEBAR_WIDTH_MOBILE = "18rem";
272
+ var SIDEBAR_WIDTH_ICON = "3rem";
273
+ var SIDEBAR_KEYBOARD_SHORTCUT = "b";
274
+ var SidebarContext = React2.createContext(null);
275
+ function useSidebar() {
276
+ const context = React2.useContext(SidebarContext);
277
+ if (!context) {
278
+ throw new Error("useSidebar must be used within a SidebarProvider.");
279
+ }
280
+ return context;
281
+ }
282
+ function SidebarProvider({
283
+ defaultOpen = true,
284
+ open: openProp,
285
+ onOpenChange: setOpenProp,
286
+ className,
287
+ style,
288
+ children,
289
+ ...props
290
+ }) {
291
+ const isMobile = useIsMobile();
292
+ const [openMobile, setOpenMobile] = React2.useState(false);
293
+ const [_open, _setOpen] = React2.useState(defaultOpen);
294
+ const open = openProp ?? _open;
295
+ const setOpen = React2.useCallback((value) => {
296
+ const openState = typeof value === "function" ? value(open) : value;
297
+ if (setOpenProp) {
298
+ setOpenProp(openState);
299
+ } else {
300
+ _setOpen(openState);
301
+ }
302
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
303
+ }, [setOpenProp, open]);
304
+ const toggleSidebar = React2.useCallback(() => {
305
+ return isMobile ? setOpenMobile((open2) => !open2) : setOpen((open2) => !open2);
306
+ }, [isMobile, setOpen, setOpenMobile]);
307
+ React2.useEffect(() => {
308
+ const handleKeyDown = (event) => {
309
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
310
+ event.preventDefault();
311
+ toggleSidebar();
312
+ }
313
+ };
314
+ window.addEventListener("keydown", handleKeyDown);
315
+ return () => window.removeEventListener("keydown", handleKeyDown);
316
+ }, [toggleSidebar]);
317
+ const state = open ? "expanded" : "collapsed";
318
+ const contextValue = React2.useMemo(() => ({
319
+ state,
320
+ open,
321
+ setOpen,
322
+ isMobile,
323
+ openMobile,
324
+ setOpenMobile,
325
+ toggleSidebar
326
+ }), [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]);
327
+ return /* @__PURE__ */ jsxDEV7(SidebarContext.Provider, {
328
+ value: contextValue,
329
+ children: /* @__PURE__ */ jsxDEV7("div", {
330
+ "data-slot": "sidebar-wrapper",
331
+ style: {
332
+ "--sidebar-width": SIDEBAR_WIDTH,
333
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
334
+ ...style
335
+ },
336
+ className: cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className),
337
+ ...props,
338
+ children
339
+ }, undefined, false, undefined, this)
340
+ }, undefined, false, undefined, this);
341
+ }
342
+ function Sidebar({
343
+ side = "left",
344
+ variant = "sidebar",
345
+ collapsible = "offcanvas",
346
+ className,
347
+ children,
348
+ dir,
349
+ ...props
350
+ }) {
351
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
352
+ if (collapsible === "none") {
353
+ return /* @__PURE__ */ jsxDEV7("div", {
354
+ "data-slot": "sidebar",
355
+ className: cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className),
356
+ ...props,
357
+ children
358
+ }, undefined, false, undefined, this);
359
+ }
360
+ if (isMobile) {
361
+ return /* @__PURE__ */ jsxDEV7(Sheet, {
362
+ open: openMobile,
363
+ onOpenChange: setOpenMobile,
364
+ ...props,
365
+ children: /* @__PURE__ */ jsxDEV7(SheetContent, {
366
+ dir,
367
+ "data-sidebar": "sidebar",
368
+ "data-slot": "sidebar",
369
+ "data-mobile": "true",
370
+ className: "bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden",
371
+ style: {
372
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE
373
+ },
374
+ side,
375
+ children: [
376
+ /* @__PURE__ */ jsxDEV7(SheetHeader, {
377
+ className: "sr-only",
378
+ children: [
379
+ /* @__PURE__ */ jsxDEV7(SheetTitle, {
380
+ children: "Sidebar"
381
+ }, undefined, false, undefined, this),
382
+ /* @__PURE__ */ jsxDEV7(SheetDescription, {
383
+ children: "Displays the mobile sidebar."
384
+ }, undefined, false, undefined, this)
385
+ ]
386
+ }, undefined, true, undefined, this),
387
+ /* @__PURE__ */ jsxDEV7("div", {
388
+ className: "flex h-full w-full flex-col",
389
+ children
390
+ }, undefined, false, undefined, this)
391
+ ]
392
+ }, undefined, true, undefined, this)
393
+ }, undefined, false, undefined, this);
394
+ }
395
+ return /* @__PURE__ */ jsxDEV7("div", {
396
+ className: "group peer text-sidebar-foreground hidden md:block",
397
+ "data-state": state,
398
+ "data-collapsible": state === "collapsed" ? collapsible : "",
399
+ "data-variant": variant,
400
+ "data-side": side,
401
+ "data-slot": "sidebar",
402
+ children: [
403
+ /* @__PURE__ */ jsxDEV7("div", {
404
+ "data-slot": "sidebar-gap",
405
+ className: cn("relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear", "group-data-[collapsible=offcanvas]:w-0", "group-data-[side=right]:rotate-180", variant === "floating" || variant === "inset" ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)")
406
+ }, undefined, false, undefined, this),
407
+ /* @__PURE__ */ jsxDEV7("div", {
408
+ "data-slot": "sidebar-container",
409
+ "data-side": side,
410
+ className: cn("fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear data-[side=left]:left-0 data-[side=left]:group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)] data-[side=right]:right-0 data-[side=right]:group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)] md:flex", variant === "floating" || variant === "inset" ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]" : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l", className),
411
+ ...props,
412
+ children: /* @__PURE__ */ jsxDEV7("div", {
413
+ "data-sidebar": "sidebar",
414
+ "data-slot": "sidebar-inner",
415
+ className: "bg-sidebar group-data-[variant=floating]:ring-sidebar-border flex size-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1",
416
+ children
417
+ }, undefined, false, undefined, this)
418
+ }, undefined, false, undefined, this)
419
+ ]
420
+ }, undefined, true, undefined, this);
421
+ }
422
+ function SidebarTrigger({
423
+ className,
424
+ onClick,
425
+ ...props
426
+ }) {
427
+ const { toggleSidebar } = useSidebar();
428
+ return /* @__PURE__ */ jsxDEV7(Button, {
429
+ "data-sidebar": "trigger",
430
+ "data-slot": "sidebar-trigger",
431
+ variant: "ghost",
432
+ size: "icon-sm",
433
+ className: cn(className),
434
+ onClick: (event) => {
435
+ onClick?.(event);
436
+ toggleSidebar();
437
+ },
438
+ ...props,
439
+ children: [
440
+ /* @__PURE__ */ jsxDEV7(PanelLeftIcon, {}, undefined, false, undefined, this),
441
+ /* @__PURE__ */ jsxDEV7("span", {
442
+ className: "sr-only",
443
+ children: "Toggle Sidebar"
444
+ }, undefined, false, undefined, this)
445
+ ]
446
+ }, undefined, true, undefined, this);
447
+ }
448
+ function SidebarRail({ className, ...props }) {
449
+ const { toggleSidebar } = useSidebar();
450
+ return /* @__PURE__ */ jsxDEV7("button", {
451
+ "data-sidebar": "rail",
452
+ "data-slot": "sidebar-rail",
453
+ "aria-label": "Toggle Sidebar",
454
+ tabIndex: -1,
455
+ onClick: toggleSidebar,
456
+ title: "Toggle Sidebar",
457
+ className: cn("absolute inset-y-0 z-20 hidden w-4 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:start-1/2 after:w-[2px] hover:after:bg-sidebar-border sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2", "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize", "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize", "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar", "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2", "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2", className),
458
+ ...props
459
+ }, undefined, false, undefined, this);
460
+ }
461
+ function SidebarInset({ className, ...props }) {
462
+ return /* @__PURE__ */ jsxDEV7("main", {
463
+ "data-slot": "sidebar-inset",
464
+ className: cn("relative flex w-full flex-1 flex-col bg-background md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:ml-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:shadow-sm md:peer-data-[variant=inset]:peer-data-[state=collapsed]:ml-2", className),
465
+ ...props
466
+ }, undefined, false, undefined, this);
467
+ }
468
+ function SidebarHeader({ className, ...props }) {
469
+ return /* @__PURE__ */ jsxDEV7("div", {
470
+ "data-slot": "sidebar-header",
471
+ "data-sidebar": "header",
472
+ className: cn("flex flex-col gap-2 p-2", className),
473
+ ...props
474
+ }, undefined, false, undefined, this);
475
+ }
476
+ function SidebarFooter({ className, ...props }) {
477
+ return /* @__PURE__ */ jsxDEV7("div", {
478
+ "data-slot": "sidebar-footer",
479
+ "data-sidebar": "footer",
480
+ className: cn("flex flex-col gap-2 p-2", className),
481
+ ...props
482
+ }, undefined, false, undefined, this);
483
+ }
484
+ function SidebarContent({ className, ...props }) {
485
+ return /* @__PURE__ */ jsxDEV7("div", {
486
+ "data-slot": "sidebar-content",
487
+ "data-sidebar": "content",
488
+ className: cn("no-scrollbar flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden", className),
489
+ ...props
490
+ }, undefined, false, undefined, this);
491
+ }
492
+ function SidebarGroup({ className, ...props }) {
493
+ return /* @__PURE__ */ jsxDEV7("div", {
494
+ "data-slot": "sidebar-group",
495
+ "data-sidebar": "group",
496
+ className: cn("relative flex w-full min-w-0 flex-col p-2", className),
497
+ ...props
498
+ }, undefined, false, undefined, this);
499
+ }
500
+ function SidebarGroupLabel({
501
+ className,
502
+ render,
503
+ ...props
504
+ }) {
505
+ return useRender2({
506
+ defaultTagName: "div",
507
+ props: mergeProps2({
508
+ className: cn("flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium text-sidebar-foreground/70 ring-sidebar-ring outline-hidden transition-[margin,opacity] duration-200 ease-linear group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0", className)
509
+ }, props),
510
+ render,
511
+ state: {
512
+ slot: "sidebar-group-label",
513
+ sidebar: "group-label"
514
+ }
515
+ });
516
+ }
517
+ function SidebarGroupContent({
518
+ className,
519
+ ...props
520
+ }) {
521
+ return /* @__PURE__ */ jsxDEV7("div", {
522
+ "data-slot": "sidebar-group-content",
523
+ "data-sidebar": "group-content",
524
+ className: cn("w-full text-sm", className),
525
+ ...props
526
+ }, undefined, false, undefined, this);
527
+ }
528
+ function SidebarMenu({ className, ...props }) {
529
+ return /* @__PURE__ */ jsxDEV7("ul", {
530
+ "data-slot": "sidebar-menu",
531
+ "data-sidebar": "menu",
532
+ className: cn("flex w-full min-w-0 flex-col gap-1", className),
533
+ ...props
534
+ }, undefined, false, undefined, this);
535
+ }
536
+ function SidebarMenuItem({ className, ...props }) {
537
+ return /* @__PURE__ */ jsxDEV7("li", {
538
+ "data-slot": "sidebar-menu-item",
539
+ "data-sidebar": "menu-item",
540
+ className: cn("group/menu-item relative", className),
541
+ ...props
542
+ }, undefined, false, undefined, this);
543
+ }
544
+ var sidebarMenuButtonVariants = cva3("peer/menu-button group/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm ring-sidebar-ring outline-hidden transition-[width,height,padding] group-has-data-[sidebar=menu-action]/menu-item:pr-8 group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-open:hover:bg-sidebar-accent data-open:hover:text-sidebar-accent-foreground data-active:bg-sidebar-accent data-active:font-medium data-active:text-sidebar-accent-foreground [&_svg]:size-4 [&_svg]:shrink-0 [&>span:last-child]:truncate", {
545
+ variants: {
546
+ variant: {
547
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
548
+ outline: "bg-background shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]"
549
+ },
550
+ size: {
551
+ default: "h-8 text-sm",
552
+ sm: "h-7 text-xs",
553
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!"
554
+ }
555
+ },
556
+ defaultVariants: {
557
+ variant: "default",
558
+ size: "default"
559
+ }
560
+ });
561
+ function SidebarMenuButton({
562
+ render,
563
+ isActive = false,
564
+ variant = "default",
565
+ size = "default",
566
+ tooltip,
567
+ className,
568
+ ...props
569
+ }) {
570
+ const { isMobile, state } = useSidebar();
571
+ const comp = useRender2({
572
+ defaultTagName: "button",
573
+ props: mergeProps2({
574
+ className: cn(sidebarMenuButtonVariants({ variant, size }), className)
575
+ }, props),
576
+ render: !tooltip ? render : /* @__PURE__ */ jsxDEV7(TooltipTrigger, {
577
+ render
578
+ }, undefined, false, undefined, this),
579
+ state: {
580
+ slot: "sidebar-menu-button",
581
+ sidebar: "menu-button",
582
+ size,
583
+ active: isActive
584
+ }
585
+ });
586
+ if (!tooltip) {
587
+ return comp;
588
+ }
589
+ if (typeof tooltip === "string") {
590
+ tooltip = {
591
+ children: tooltip
592
+ };
593
+ }
594
+ return /* @__PURE__ */ jsxDEV7(Tooltip, {
595
+ children: [
596
+ comp,
597
+ /* @__PURE__ */ jsxDEV7(TooltipContent, {
598
+ side: "right",
599
+ align: "center",
600
+ hidden: state !== "collapsed" || isMobile,
601
+ ...tooltip
602
+ }, undefined, false, undefined, this)
603
+ ]
604
+ }, undefined, true, undefined, this);
605
+ }
606
+
607
+ // ../../src/components/ui/sidebar-layout.tsx
608
+ import { jsxDEV as jsxDEV8 } from "react/jsx-dev-runtime";
609
+ var sidebarStorageRuntime = Atom.runtime(BrowserKeyValueStore.layerLocalStorage);
610
+ var sidebarOpenAtom = Atom.kvs({
611
+ runtime: sidebarStorageRuntime,
612
+ key: "sidebar:open",
613
+ schema: Schema.Boolean,
614
+ defaultValue: () => true
615
+ });
616
+ function AppSidebar({ footer, groups, header }) {
617
+ const { isMobile, setOpenMobile } = useSidebar();
618
+ const pathname = useRouterState({
619
+ select: (state) => state.location.pathname
620
+ });
621
+ const closeMobileSidebar = () => {
622
+ if (isMobile)
623
+ setOpenMobile(false);
624
+ };
625
+ return /* @__PURE__ */ jsxDEV8(Sidebar, {
626
+ collapsible: "icon",
627
+ children: [
628
+ header && /* @__PURE__ */ jsxDEV8(SidebarHeader, {
629
+ children: header
630
+ }, undefined, false, undefined, this),
631
+ /* @__PURE__ */ jsxDEV8(SidebarContent, {
632
+ children: groups.map((group) => /* @__PURE__ */ jsxDEV8(SidebarGroup, {
633
+ children: [
634
+ /* @__PURE__ */ jsxDEV8(SidebarGroupLabel, {
635
+ children: group.label()
636
+ }, undefined, false, undefined, this),
637
+ /* @__PURE__ */ jsxDEV8(SidebarGroupContent, {
638
+ children: /* @__PURE__ */ jsxDEV8(SidebarMenu, {
639
+ children: group.items.map((item) => {
640
+ const render = item.external ? /* @__PURE__ */ jsxDEV8("a", {
641
+ href: item.href,
642
+ target: "_blank",
643
+ rel: "noreferrer"
644
+ }, undefined, false, undefined, this) : /* @__PURE__ */ jsxDEV8(Link, {
645
+ to: item.href
646
+ }, undefined, false, undefined, this);
647
+ return /* @__PURE__ */ jsxDEV8(SidebarMenuItem, {
648
+ children: /* @__PURE__ */ jsxDEV8(SidebarMenuButton, {
649
+ isActive: !item.external && pathname === item.href,
650
+ onClick: closeMobileSidebar,
651
+ render,
652
+ tooltip: item.label(),
653
+ children: [
654
+ /* @__PURE__ */ jsxDEV8(item.icon, {}, undefined, false, undefined, this),
655
+ /* @__PURE__ */ jsxDEV8("span", {
656
+ children: item.label()
657
+ }, undefined, false, undefined, this)
658
+ ]
659
+ }, undefined, true, undefined, this)
660
+ }, item.href, false, undefined, this);
661
+ })
662
+ }, undefined, false, undefined, this)
663
+ }, undefined, false, undefined, this)
664
+ ]
665
+ }, group.label(), true, undefined, this))
666
+ }, undefined, false, undefined, this),
667
+ footer ? /* @__PURE__ */ jsxDEV8(SidebarFooter, {
668
+ children: footer
669
+ }, undefined, false, undefined, this) : null,
670
+ /* @__PURE__ */ jsxDEV8(SidebarRail, {}, undefined, false, undefined, this)
671
+ ]
672
+ }, undefined, true, undefined, this);
673
+ }
674
+ function SidebarPageHeader({
675
+ title,
676
+ description,
677
+ badge,
678
+ actions
679
+ }) {
680
+ return /* @__PURE__ */ jsxDEV8("header", {
681
+ className: "flex flex-col gap-4 sm:flex-row sm:items-start sm:justify-between",
682
+ children: [
683
+ /* @__PURE__ */ jsxDEV8("div", {
684
+ className: "flex flex-col gap-2",
685
+ children: [
686
+ badge ? /* @__PURE__ */ jsxDEV8(Badge, {
687
+ className: "w-fit",
688
+ variant: badge.variant ?? "secondary",
689
+ children: badge.label
690
+ }, undefined, false, undefined, this) : null,
691
+ /* @__PURE__ */ jsxDEV8("div", {
692
+ className: "flex flex-col gap-1",
693
+ children: [
694
+ /* @__PURE__ */ jsxDEV8("h1", {
695
+ className: "text-3xl font-bold tracking-tight",
696
+ children: title
697
+ }, undefined, false, undefined, this),
698
+ description ? /* @__PURE__ */ jsxDEV8("p", {
699
+ className: "text-muted-foreground max-w-2xl text-sm",
700
+ children: description
701
+ }, undefined, false, undefined, this) : null
702
+ ]
703
+ }, undefined, true, undefined, this)
704
+ ]
705
+ }, undefined, true, undefined, this),
706
+ actions ? /* @__PURE__ */ jsxDEV8("div", {
707
+ className: "flex gap-2",
708
+ children: actions
709
+ }, undefined, false, undefined, this) : null
710
+ ]
711
+ }, undefined, true, undefined, this);
712
+ }
713
+ function SidebarLayout({
714
+ groups,
715
+ children,
716
+ sidebarFooter,
717
+ sidebarHeader,
718
+ headerActions
719
+ }) {
720
+ const [sidebarOpen, setSidebarOpen] = useAtom(sidebarOpenAtom);
721
+ return /* @__PURE__ */ jsxDEV8(SidebarProvider, {
722
+ open: sidebarOpen,
723
+ onOpenChange: setSidebarOpen,
724
+ children: [
725
+ /* @__PURE__ */ jsxDEV8(AppSidebar, {
726
+ footer: sidebarFooter,
727
+ groups,
728
+ header: sidebarHeader
729
+ }, undefined, false, undefined, this),
730
+ /* @__PURE__ */ jsxDEV8(SidebarInset, {
731
+ className: "min-w-0 overflow-x-hidden",
732
+ children: [
733
+ /* @__PURE__ */ jsxDEV8("header", {
734
+ className: "bg-background/95 supports-[backdrop-filter]:bg-background/60 sticky top-0 z-10 flex h-14 shrink-0 items-center gap-2 border-b px-4 backdrop-blur",
735
+ children: [
736
+ /* @__PURE__ */ jsxDEV8(SidebarTrigger, {}, undefined, false, undefined, this),
737
+ /* @__PURE__ */ jsxDEV8("div", {
738
+ className: "ml-auto flex items-center gap-2",
739
+ children: headerActions
740
+ }, undefined, false, undefined, this)
741
+ ]
742
+ }, undefined, true, undefined, this),
743
+ /* @__PURE__ */ jsxDEV8("div", {
744
+ className: "flex flex-col gap-6 px-5 py-6 md:px-8",
745
+ children: children ?? /* @__PURE__ */ jsxDEV8(Outlet, {}, undefined, false, undefined, this)
746
+ }, undefined, false, undefined, this)
747
+ ]
748
+ }, undefined, true, undefined, this)
749
+ ]
750
+ }, undefined, true, undefined, this);
751
+ }
752
+ export {
753
+ SidebarPageHeader,
754
+ SidebarLayout
755
+ };