startx 1.0.1 → 1.0.3

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 (147) hide show
  1. package/.dockerignore +4 -0
  2. package/apps/cli/src/commands/index.ts +1 -1
  3. package/apps/cli/src/commands/{common → test}/test.ts +4 -2
  4. package/apps/cli/tsconfig.json +0 -1
  5. package/apps/core-server/Dockerfile +5 -4
  6. package/apps/core-server/package.json +1 -1
  7. package/apps/core-server/tsconfig.json +1 -1
  8. package/apps/queue-worker/package.json +1 -1
  9. package/apps/queue-worker/tsconfig.json +1 -1
  10. package/apps/startx-cli/dist/index.mjs +68 -53
  11. package/apps/startx-cli/src/commands/package.ts +453 -0
  12. package/apps/startx-cli/src/configs/scripts.ts +18 -2
  13. package/apps/startx-cli/src/index.ts +2 -4
  14. package/apps/startx-cli/src/types.ts +2 -4
  15. package/apps/startx-cli/src/utils/inquirer.ts +8 -1
  16. package/apps/web-client/.dockerignore +4 -0
  17. package/apps/web-client/app/app.css +1 -0
  18. package/apps/web-client/app/components.json +23 -0
  19. package/apps/web-client/app/config/auth/auth-state.ts +59 -0
  20. package/apps/web-client/app/config/axios-client.ts +87 -0
  21. package/apps/web-client/app/config/env.ts +5 -0
  22. package/apps/web-client/app/entry.client.tsx +7 -0
  23. package/apps/web-client/app/eslint.config.ts +4 -0
  24. package/apps/web-client/app/root.tsx +77 -0
  25. package/apps/web-client/app/routes/home.tsx +12 -0
  26. package/apps/web-client/app/routes.ts +3 -0
  27. package/apps/web-client/eslint.config.ts +4 -0
  28. package/apps/web-client/package.json +55 -0
  29. package/apps/web-client/react-router.config.ts +7 -0
  30. package/apps/web-client/tsconfig.json +22 -0
  31. package/apps/web-client/vite-env.d.ts +8 -0
  32. package/apps/web-client/vite.config.ts +30 -0
  33. package/biome.json +5 -0
  34. package/configs/eslint-config/eslint.config.ts +1 -0
  35. package/configs/eslint-config/src/configs/base.ts +0 -1
  36. package/configs/eslint-config/src/configs/frontend.ts +1 -1
  37. package/configs/eslint-config/tsconfig.json +1 -1
  38. package/configs/typescript-config/tsconfig.frontend.json +1 -1
  39. package/configs/vitest-config/tsconfig.json +1 -1
  40. package/package.json +1 -1
  41. package/packages/@db/drizzle/tsconfig.json +1 -1
  42. package/packages/@db/sqlite/tsconfig.json +1 -1
  43. package/packages/@repo/env/package.json +1 -2
  44. package/packages/@repo/env/src/utils.ts +17 -11
  45. package/packages/@repo/lib/package.json +3 -1
  46. package/packages/@repo/lib/src/session-module/i-session.ts +108 -0
  47. package/packages/@repo/lib/src/session-module/index.ts +8 -111
  48. package/packages/@repo/lib/src/session-module/redis-session.ts +44 -0
  49. package/packages/@repo/lib/tsconfig.json +0 -1
  50. package/packages/@repo/logger/package.json +0 -1
  51. package/packages/@repo/logger/tsconfig.json +1 -1
  52. package/packages/@repo/mail/tsconfig.json +1 -1
  53. package/packages/@repo/redis/tsconfig.json +1 -1
  54. package/packages/aix/package.json +2 -0
  55. package/packages/aix/src/providers/ai-interface.ts +4 -4
  56. package/packages/aix/src/providers/bedrock/bedrock.ts +261 -0
  57. package/packages/aix/src/providers/default-models.ts +65 -0
  58. package/packages/aix/src/providers/openai/openai.ts +2 -2
  59. package/packages/aix/src/providers/providers.ts +11 -0
  60. package/packages/aix/src/providers/types.ts +1 -1
  61. package/packages/{constants → common}/package.json +4 -2
  62. package/packages/{constants/src/index.ts → common/src/constants.ts} +0 -5
  63. package/packages/common/src/types/users.ts +10 -0
  64. package/packages/{constants → common}/tsconfig.json +0 -3
  65. package/packages/ui/components.json +15 -8
  66. package/packages/ui/package.json +23 -36
  67. package/packages/ui/src/api/axios/i-client.ts +40 -0
  68. package/packages/ui/src/api/index.ts +6 -0
  69. package/packages/ui/src/api/query-provider.tsx +34 -0
  70. package/packages/ui/src/api/use-api/api-builder.ts +139 -0
  71. package/packages/ui/src/api/use-api/api-helpers.ts +165 -0
  72. package/packages/ui/src/api/use-api/api-types.ts +138 -0
  73. package/packages/ui/src/api/use-api/query-factory.ts +66 -0
  74. package/packages/ui/src/api/use-api/react-query/types.ts +64 -0
  75. package/packages/ui/src/api/use-api/react-query/use-api-client.ts +56 -0
  76. package/packages/ui/src/api/use-api/react-query/use-api.ts +297 -0
  77. package/packages/ui/src/components/custom/form-wrapper.tsx +113 -160
  78. package/packages/ui/src/components/custom/grid-component.tsx +4 -4
  79. package/packages/ui/src/components/custom/hover-tool.tsx +1 -1
  80. package/packages/ui/src/components/custom/image-picker.tsx +18 -20
  81. package/packages/ui/src/components/custom/no-content.tsx +6 -16
  82. package/packages/ui/src/components/custom/page-section.tsx +14 -17
  83. package/packages/ui/src/components/custom/simple-popover.tsx +5 -9
  84. package/packages/ui/src/components/custom/theme-provider.tsx +117 -42
  85. package/packages/ui/src/components/custom/typography.tsx +20 -22
  86. package/packages/ui/src/components/extensions/timeline.tsx +100 -0
  87. package/packages/ui/src/components/ui/alert-dialog.tsx +46 -108
  88. package/packages/ui/src/components/ui/avatar.tsx +79 -42
  89. package/packages/ui/src/components/ui/badge.tsx +29 -34
  90. package/packages/ui/src/components/ui/breadcrumb.tsx +65 -81
  91. package/packages/ui/src/components/ui/button.tsx +80 -80
  92. package/packages/ui/src/components/ui/card.tsx +48 -69
  93. package/packages/ui/src/components/ui/carousel.tsx +184 -211
  94. package/packages/ui/src/components/ui/checkbox.tsx +21 -24
  95. package/packages/ui/src/components/ui/command.tsx +121 -102
  96. package/packages/ui/src/components/ui/dialog.tsx +45 -32
  97. package/packages/ui/src/components/ui/dropdown-menu.tsx +45 -33
  98. package/packages/ui/src/components/ui/field.tsx +218 -0
  99. package/packages/ui/src/components/ui/form.tsx +63 -76
  100. package/packages/ui/src/components/ui/input-group.tsx +137 -0
  101. package/packages/ui/src/components/ui/input-otp.tsx +60 -50
  102. package/packages/ui/src/components/ui/input.tsx +16 -15
  103. package/packages/ui/src/components/ui/label.tsx +14 -17
  104. package/packages/ui/src/components/ui/multiple-select.tsx +22 -33
  105. package/packages/ui/src/components/ui/popover.tsx +20 -8
  106. package/packages/ui/src/components/ui/select.tsx +33 -34
  107. package/packages/ui/src/components/ui/separator.tsx +8 -8
  108. package/packages/ui/src/components/ui/sheet.tsx +32 -59
  109. package/packages/ui/src/components/ui/sidebar.tsx +654 -0
  110. package/packages/ui/src/components/ui/skeleton.tsx +2 -8
  111. package/packages/ui/src/components/ui/sonner.tsx +39 -0
  112. package/packages/ui/src/components/ui/spinner.tsx +6 -13
  113. package/packages/ui/src/components/ui/switch.tsx +15 -10
  114. package/packages/ui/src/components/ui/table.tsx +48 -89
  115. package/packages/ui/src/components/ui/tabs.tsx +37 -15
  116. package/packages/ui/src/components/ui/textarea.tsx +13 -13
  117. package/packages/ui/src/components/ui/tooltip.tsx +37 -23
  118. package/packages/ui/src/{components/hooks → hooks}/event/use-click.tsx +6 -10
  119. package/packages/ui/src/hooks/time/use-timer.tsx +51 -0
  120. package/packages/ui/src/hooks/use-media-query.tsx +19 -0
  121. package/packages/ui/src/hooks/use-mobile.tsx +17 -0
  122. package/packages/ui/src/{components/hooks → hooks}/use-update-effect.tsx +2 -2
  123. package/packages/ui/src/lib/utils.ts +113 -0
  124. package/packages/ui/src/styles/globals.css +311 -0
  125. package/packages/ui/src/styles/tailwind.css +89 -0
  126. package/packages/ui/tsconfig.json +7 -9
  127. package/pnpm-workspace.yaml +74 -64
  128. package/packages/ui/postcss.config.mjs +0 -9
  129. package/packages/ui/src/components/extensions/carousel.tsx +0 -392
  130. package/packages/ui/src/components/hooks/time/useTimer.tsx +0 -51
  131. package/packages/ui/src/components/hooks/use-media-query.tsx +0 -19
  132. package/packages/ui/src/components/lib/utils.ts +0 -242
  133. package/packages/ui/src/components/ui/timeline.tsx +0 -118
  134. package/packages/ui/src/components/util/n-formattor.ts +0 -22
  135. package/packages/ui/src/components/util/storage.ts +0 -37
  136. package/packages/ui/src/globals.css +0 -87
  137. package/packages/ui/tailwind.config.ts +0 -94
  138. /package/packages/{constants → common}/eslint.config.ts +0 -0
  139. /package/packages/{constants → common}/src/api.ts +0 -0
  140. /package/packages/{constants → common}/src/time.ts +0 -0
  141. /package/packages/{constants → common}/vitest.config.ts +0 -0
  142. /package/packages/ui/src/{components/hooks/time/useDebounce.tsx → hooks/time/use-debounce.tsx} +0 -0
  143. /package/packages/ui/src/{components/hooks/time/useInterval.tsx → hooks/time/use-interval.tsx} +0 -0
  144. /package/packages/ui/src/{components/hooks/time/useTimeout.tsx → hooks/time/use-timeout.tsx} +0 -0
  145. /package/packages/ui/src/{components/hooks → hooks}/use-persistent-storage.tsx +0 -0
  146. /package/packages/ui/src/{components/hooks → hooks}/use-window-dimension.tsx +0 -0
  147. /package/packages/ui/src/{components/sonner.tsx → sonner.ts} +0 -0
@@ -0,0 +1,654 @@
1
+ "use client";
2
+
3
+ import { cva, type VariantProps } from "class-variance-authority";
4
+ import { PanelLeftIcon } from "lucide-react";
5
+ import { Slot } from "radix-ui";
6
+ import * as React from "react";
7
+ import { Button } from "@repo/ui/components/ui/button";
8
+ import { Input } from "@repo/ui/components/ui/input";
9
+ import { Separator } from "@repo/ui/components/ui/separator";
10
+ import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from "@repo/ui/components/ui/sheet";
11
+ import { Skeleton } from "@repo/ui/components/ui/skeleton";
12
+ import { Tooltip, TooltipContent, TooltipTrigger } from "@repo/ui/components/ui/tooltip";
13
+ import { useIsMobile } from "@repo/ui/hooks/use-mobile";
14
+ import { cn } from "@repo/ui/lib/utils";
15
+
16
+ const SIDEBAR_COOKIE_NAME = "sidebar_state";
17
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
18
+ const SIDEBAR_WIDTH = "16rem";
19
+ const SIDEBAR_WIDTH_MOBILE = "18rem";
20
+ const SIDEBAR_WIDTH_ICON = "3rem";
21
+ const SIDEBAR_KEYBOARD_SHORTCUT = "b";
22
+
23
+ type SidebarContextProps = {
24
+ state: "expanded" | "collapsed";
25
+ open: boolean;
26
+ setOpen: (open: boolean) => void;
27
+ openMobile: boolean;
28
+ setOpenMobile: (open: boolean) => void;
29
+ isMobile: boolean;
30
+ toggleSidebar: () => void;
31
+ };
32
+
33
+ const SidebarContext = React.createContext<SidebarContextProps | null>(null);
34
+
35
+ function useSidebar() {
36
+ const context = React.useContext(SidebarContext);
37
+ if (!context) {
38
+ throw new Error("useSidebar must be used within a SidebarProvider.");
39
+ }
40
+
41
+ return context;
42
+ }
43
+
44
+ function SidebarProvider({
45
+ defaultOpen = true,
46
+ open: openProp,
47
+ onOpenChange: setOpenProp,
48
+ className,
49
+ style,
50
+ children,
51
+ ...props
52
+ }: React.ComponentProps<"div"> & {
53
+ defaultOpen?: boolean;
54
+ open?: boolean;
55
+ onOpenChange?: (open: boolean) => void;
56
+ }) {
57
+ const isMobile = useIsMobile();
58
+ const [openMobile, setOpenMobile] = React.useState(false);
59
+
60
+ // This is the internal state of the sidebar.
61
+ // We use openProp and setOpenProp for control from outside the component.
62
+ const [_open, _setOpen] = React.useState(defaultOpen);
63
+ const open = openProp ?? _open;
64
+ const setOpen = React.useCallback(
65
+ (value: boolean | ((value: boolean) => boolean)) => {
66
+ const openState = typeof value === "function" ? value(open) : value;
67
+ if (setOpenProp) {
68
+ setOpenProp(openState);
69
+ } else {
70
+ _setOpen(openState);
71
+ }
72
+
73
+ // This sets the cookie to keep the sidebar state.
74
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
75
+ },
76
+ [setOpenProp, open]
77
+ );
78
+
79
+ // Helper to toggle the sidebar.
80
+ const toggleSidebar = React.useCallback(() => {
81
+ return isMobile ? setOpenMobile(open => !open) : setOpen(open => !open);
82
+ }, [isMobile, setOpen, setOpenMobile]);
83
+
84
+ // Adds a keyboard shortcut to toggle the sidebar.
85
+ React.useEffect(() => {
86
+ const handleKeyDown = (event: KeyboardEvent) => {
87
+ if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
88
+ event.preventDefault();
89
+ toggleSidebar();
90
+ }
91
+ };
92
+
93
+ window.addEventListener("keydown", handleKeyDown);
94
+ return () => window.removeEventListener("keydown", handleKeyDown);
95
+ }, [toggleSidebar]);
96
+
97
+ // We add a state so that we can do data-state="expanded" or "collapsed".
98
+ // This makes it easier to style the sidebar with Tailwind classes.
99
+ const state = open ? "expanded" : "collapsed";
100
+
101
+ const contextValue = React.useMemo<SidebarContextProps>(
102
+ () => ({
103
+ state,
104
+ open,
105
+ setOpen,
106
+ isMobile,
107
+ openMobile,
108
+ setOpenMobile,
109
+ toggleSidebar,
110
+ }),
111
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
112
+ );
113
+
114
+ return (
115
+ <SidebarContext.Provider value={contextValue}>
116
+ <div
117
+ data-slot="sidebar-wrapper"
118
+ style={
119
+ {
120
+ "--sidebar-width": SIDEBAR_WIDTH,
121
+ "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
122
+ ...style,
123
+ } as React.CSSProperties
124
+ }
125
+ className={cn("group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar", className)}
126
+ {...props}
127
+ >
128
+ {children}
129
+ </div>
130
+ </SidebarContext.Provider>
131
+ );
132
+ }
133
+
134
+ function Sidebar({
135
+ side = "left",
136
+ variant = "sidebar",
137
+ collapsible = "offcanvas",
138
+ className,
139
+ children,
140
+ dir,
141
+ ...props
142
+ }: React.ComponentProps<"div"> & {
143
+ side?: "left" | "right";
144
+ variant?: "sidebar" | "floating" | "inset";
145
+ collapsible?: "offcanvas" | "icon" | "none";
146
+ }) {
147
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
148
+
149
+ if (collapsible === "none") {
150
+ return (
151
+ <div
152
+ data-slot="sidebar"
153
+ className={cn("flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground", className)}
154
+ {...props}
155
+ >
156
+ {children}
157
+ </div>
158
+ );
159
+ }
160
+
161
+ if (isMobile) {
162
+ return (
163
+ <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
164
+ <SheetContent
165
+ dir={dir}
166
+ data-sidebar="sidebar"
167
+ data-slot="sidebar"
168
+ data-mobile="true"
169
+ className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
170
+ style={
171
+ {
172
+ "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
173
+ } as React.CSSProperties
174
+ }
175
+ side={side}
176
+ >
177
+ <SheetHeader className="sr-only">
178
+ <SheetTitle>Sidebar</SheetTitle>
179
+ <SheetDescription>Displays the mobile sidebar.</SheetDescription>
180
+ </SheetHeader>
181
+ <div className="flex h-full w-full flex-col">{children}</div>
182
+ </SheetContent>
183
+ </Sheet>
184
+ );
185
+ }
186
+
187
+ return (
188
+ <div
189
+ className="group peer hidden text-sidebar-foreground md:block"
190
+ data-state={state}
191
+ data-collapsible={state === "collapsed" ? collapsible : ""}
192
+ data-variant={variant}
193
+ data-side={side}
194
+ data-slot="sidebar"
195
+ >
196
+ {/* This is what handles the sidebar gap on desktop */}
197
+ <div
198
+ data-slot="sidebar-gap"
199
+ className={cn(
200
+ "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
201
+ "group-data-[collapsible=offcanvas]:w-0",
202
+ "group-data-[side=right]:rotate-180",
203
+ variant === "floating" || variant === "inset"
204
+ ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
205
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
206
+ )}
207
+ />
208
+ <div
209
+ data-slot="sidebar-container"
210
+ data-side={side}
211
+ className={cn(
212
+ "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",
213
+ // Adjust the padding for floating and inset variants.
214
+ variant === "floating" || variant === "inset"
215
+ ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
216
+ : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
217
+ className
218
+ )}
219
+ {...props}
220
+ >
221
+ <div
222
+ data-sidebar="sidebar"
223
+ data-slot="sidebar-inner"
224
+ className="flex size-full flex-col bg-sidebar group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:shadow-sm group-data-[variant=floating]:ring-1 group-data-[variant=floating]:ring-sidebar-border"
225
+ >
226
+ {children}
227
+ </div>
228
+ </div>
229
+ </div>
230
+ );
231
+ }
232
+
233
+ function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
234
+ const { toggleSidebar } = useSidebar();
235
+
236
+ return (
237
+ <Button
238
+ data-sidebar="trigger"
239
+ data-slot="sidebar-trigger"
240
+ variant="ghost"
241
+ size="icon-sm"
242
+ className={cn(className)}
243
+ onClick={event => {
244
+ onClick?.(event);
245
+ toggleSidebar();
246
+ }}
247
+ {...props}
248
+ >
249
+ <PanelLeftIcon className="cn-rtl-flip" />
250
+ <span className="sr-only">Toggle Sidebar</span>
251
+ </Button>
252
+ );
253
+ }
254
+
255
+ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
256
+ const { toggleSidebar } = useSidebar();
257
+
258
+ return (
259
+ <button
260
+ data-sidebar="rail"
261
+ data-slot="sidebar-rail"
262
+ aria-label="Toggle Sidebar"
263
+ tabIndex={-1}
264
+ onClick={toggleSidebar}
265
+ title="Toggle Sidebar"
266
+ className={cn(
267
+ "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",
268
+ "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
269
+ "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
270
+ "group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar",
271
+ "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
272
+ "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
273
+ className
274
+ )}
275
+ {...props}
276
+ />
277
+ );
278
+ }
279
+
280
+ function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
281
+ return (
282
+ <main
283
+ data-slot="sidebar-inset"
284
+ className={cn(
285
+ "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",
286
+ className
287
+ )}
288
+ {...props}
289
+ />
290
+ );
291
+ }
292
+
293
+ function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {
294
+ return (
295
+ <Input
296
+ data-slot="sidebar-input"
297
+ data-sidebar="input"
298
+ className={cn("h-8 w-full bg-background shadow-none", className)}
299
+ {...props}
300
+ />
301
+ );
302
+ }
303
+
304
+ function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
305
+ return (
306
+ <div
307
+ data-slot="sidebar-header"
308
+ data-sidebar="header"
309
+ className={cn("flex flex-col gap-2 p-2", className)}
310
+ {...props}
311
+ />
312
+ );
313
+ }
314
+
315
+ function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
316
+ return (
317
+ <div
318
+ data-slot="sidebar-footer"
319
+ data-sidebar="footer"
320
+ className={cn("flex flex-col gap-2 p-2", className)}
321
+ {...props}
322
+ />
323
+ );
324
+ }
325
+
326
+ function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
327
+ return (
328
+ <Separator
329
+ data-slot="sidebar-separator"
330
+ data-sidebar="separator"
331
+ className={cn("mx-2 w-auto bg-sidebar-border", className)}
332
+ {...props}
333
+ />
334
+ );
335
+ }
336
+
337
+ function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
338
+ return (
339
+ <div
340
+ data-slot="sidebar-content"
341
+ data-sidebar="content"
342
+ className={cn(
343
+ "no-scrollbar flex min-h-0 flex-1 flex-col gap-0 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
344
+ className
345
+ )}
346
+ {...props}
347
+ />
348
+ );
349
+ }
350
+
351
+ function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
352
+ return (
353
+ <div
354
+ data-slot="sidebar-group"
355
+ data-sidebar="group"
356
+ className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
357
+ {...props}
358
+ />
359
+ );
360
+ }
361
+
362
+ function SidebarGroupLabel({
363
+ className,
364
+ asChild = false,
365
+ ...props
366
+ }: React.ComponentProps<"div"> & { asChild?: boolean }) {
367
+ const Comp = asChild ? Slot.Root : "div";
368
+
369
+ return (
370
+ <Comp
371
+ data-slot="sidebar-group-label"
372
+ data-sidebar="group-label"
373
+ className={cn(
374
+ "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",
375
+ className
376
+ )}
377
+ {...props}
378
+ />
379
+ );
380
+ }
381
+
382
+ function SidebarGroupAction({
383
+ className,
384
+ asChild = false,
385
+ ...props
386
+ }: React.ComponentProps<"button"> & { asChild?: boolean }) {
387
+ const Comp = asChild ? Slot.Root : "button";
388
+
389
+ return (
390
+ <Comp
391
+ data-slot="sidebar-group-action"
392
+ data-sidebar="group-action"
393
+ className={cn(
394
+ "absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
395
+ className
396
+ )}
397
+ {...props}
398
+ />
399
+ );
400
+ }
401
+
402
+ function SidebarGroupContent({ className, ...props }: React.ComponentProps<"div">) {
403
+ return (
404
+ <div
405
+ data-slot="sidebar-group-content"
406
+ data-sidebar="group-content"
407
+ className={cn("w-full text-sm", className)}
408
+ {...props}
409
+ />
410
+ );
411
+ }
412
+
413
+ function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
414
+ return (
415
+ <ul
416
+ data-slot="sidebar-menu"
417
+ data-sidebar="menu"
418
+ className={cn("flex w-full min-w-0 flex-col gap-0", className)}
419
+ {...props}
420
+ />
421
+ );
422
+ }
423
+
424
+ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
425
+ return (
426
+ <li
427
+ data-slot="sidebar-menu-item"
428
+ data-sidebar="menu-item"
429
+ className={cn("group/menu-item relative", className)}
430
+ {...props}
431
+ />
432
+ );
433
+ }
434
+
435
+ const sidebarMenuButtonVariants = cva(
436
+ "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",
437
+ {
438
+ variants: {
439
+ variant: {
440
+ default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
441
+ outline:
442
+ "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))]",
443
+ },
444
+ size: {
445
+ default: "h-8 text-sm",
446
+ sm: "h-7 text-xs",
447
+ lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
448
+ },
449
+ },
450
+ defaultVariants: {
451
+ variant: "default",
452
+ size: "default",
453
+ },
454
+ }
455
+ );
456
+
457
+ function SidebarMenuButton({
458
+ asChild = false,
459
+ isActive = false,
460
+ variant = "default",
461
+ size = "default",
462
+ tooltip,
463
+ className,
464
+ ...props
465
+ }: React.ComponentProps<"button"> & {
466
+ asChild?: boolean;
467
+ isActive?: boolean;
468
+ // eslint-disable-next-line @typescript-eslint/no-redundant-type-constituents
469
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
470
+ } & VariantProps<typeof sidebarMenuButtonVariants>) {
471
+ const Comp = asChild ? Slot.Root : "button";
472
+ const { isMobile, state } = useSidebar();
473
+
474
+ const button = (
475
+ <Comp
476
+ data-slot="sidebar-menu-button"
477
+ data-sidebar="menu-button"
478
+ data-size={size}
479
+ data-active={isActive}
480
+ className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
481
+ {...props}
482
+ />
483
+ );
484
+
485
+ if (!tooltip) {
486
+ return button;
487
+ }
488
+
489
+ if (typeof tooltip === "string") {
490
+ tooltip = {
491
+ children: tooltip,
492
+ };
493
+ }
494
+
495
+ return (
496
+ <Tooltip>
497
+ <TooltipTrigger asChild>{button}</TooltipTrigger>
498
+ <TooltipContent side="right" align="center" hidden={state !== "collapsed" || isMobile} {...tooltip} />
499
+ </Tooltip>
500
+ );
501
+ }
502
+
503
+ function SidebarMenuAction({
504
+ className,
505
+ asChild = false,
506
+ showOnHover = false,
507
+ ...props
508
+ }: React.ComponentProps<"button"> & {
509
+ asChild?: boolean;
510
+ showOnHover?: boolean;
511
+ }) {
512
+ const Comp = asChild ? Slot.Root : "button";
513
+
514
+ return (
515
+ <Comp
516
+ data-slot="sidebar-menu-action"
517
+ data-sidebar="menu-action"
518
+ className={cn(
519
+ "absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 text-sidebar-foreground ring-sidebar-ring outline-hidden transition-transform group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 after:absolute after:-inset-2 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 md:after:hidden [&>svg]:size-4 [&>svg]:shrink-0",
520
+ showOnHover &&
521
+ "group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-active/menu-button:text-sidebar-accent-foreground aria-expanded:opacity-100 md:opacity-0",
522
+ className
523
+ )}
524
+ {...props}
525
+ />
526
+ );
527
+ }
528
+
529
+ function SidebarMenuBadge({ className, ...props }: React.ComponentProps<"div">) {
530
+ return (
531
+ <div
532
+ data-slot="sidebar-menu-badge"
533
+ data-sidebar="menu-badge"
534
+ className={cn(
535
+ "pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium text-sidebar-foreground tabular-nums select-none group-data-[collapsible=icon]:hidden peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[size=default]/menu-button:top-1.5 peer-data-[size=lg]/menu-button:top-2.5 peer-data-[size=sm]/menu-button:top-1 peer-data-active/menu-button:text-sidebar-accent-foreground",
536
+ className
537
+ )}
538
+ {...props}
539
+ />
540
+ );
541
+ }
542
+
543
+ function SidebarMenuSkeleton({
544
+ className,
545
+ showIcon = false,
546
+ ...props
547
+ }: React.ComponentProps<"div"> & {
548
+ showIcon?: boolean;
549
+ }) {
550
+ // Random width between 50 to 90%.
551
+ const [width] = React.useState(() => {
552
+ return `${Math.floor(Math.random() * 40) + 50}%`;
553
+ });
554
+
555
+ return (
556
+ <div
557
+ data-slot="sidebar-menu-skeleton"
558
+ data-sidebar="menu-skeleton"
559
+ className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
560
+ {...props}
561
+ >
562
+ {showIcon ? <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" /> : null}
563
+ <Skeleton
564
+ className="h-4 max-w-(--skeleton-width) flex-1"
565
+ data-sidebar="menu-skeleton-text"
566
+ style={
567
+ {
568
+ "--skeleton-width": width,
569
+ } as React.CSSProperties
570
+ }
571
+ />
572
+ </div>
573
+ );
574
+ }
575
+
576
+ function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
577
+ return (
578
+ <ul
579
+ data-slot="sidebar-menu-sub"
580
+ data-sidebar="menu-sub"
581
+ className={cn(
582
+ "mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l border-sidebar-border px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",
583
+ className
584
+ )}
585
+ {...props}
586
+ />
587
+ );
588
+ }
589
+
590
+ function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<"li">) {
591
+ return (
592
+ <li
593
+ data-slot="sidebar-menu-sub-item"
594
+ data-sidebar="menu-sub-item"
595
+ className={cn("group/menu-sub-item relative", className)}
596
+ {...props}
597
+ />
598
+ );
599
+ }
600
+
601
+ function SidebarMenuSubButton({
602
+ asChild = false,
603
+ size = "md",
604
+ isActive = false,
605
+ className,
606
+ ...props
607
+ }: React.ComponentProps<"a"> & {
608
+ asChild?: boolean;
609
+ size?: "sm" | "md";
610
+ isActive?: boolean;
611
+ }) {
612
+ const Comp = asChild ? Slot.Root : "a";
613
+
614
+ return (
615
+ <Comp
616
+ data-slot="sidebar-menu-sub-button"
617
+ data-sidebar="menu-sub-button"
618
+ data-size={size}
619
+ data-active={isActive}
620
+ className={cn(
621
+ "flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 text-sidebar-foreground ring-sidebar-ring outline-hidden group-data-[collapsible=icon]:hidden 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-[size=md]:text-sm data-[size=sm]:text-xs data-active:bg-sidebar-accent data-active:text-sidebar-accent-foreground [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground",
622
+ className
623
+ )}
624
+ {...props}
625
+ />
626
+ );
627
+ }
628
+
629
+ export {
630
+ Sidebar,
631
+ SidebarContent,
632
+ SidebarFooter,
633
+ SidebarGroup,
634
+ SidebarGroupAction,
635
+ SidebarGroupContent,
636
+ SidebarGroupLabel,
637
+ SidebarHeader,
638
+ SidebarInput,
639
+ SidebarInset,
640
+ SidebarMenu,
641
+ SidebarMenuAction,
642
+ SidebarMenuBadge,
643
+ SidebarMenuButton,
644
+ SidebarMenuItem,
645
+ SidebarMenuSkeleton,
646
+ SidebarMenuSub,
647
+ SidebarMenuSubButton,
648
+ SidebarMenuSubItem,
649
+ SidebarProvider,
650
+ SidebarRail,
651
+ SidebarSeparator,
652
+ SidebarTrigger,
653
+ useSidebar,
654
+ };
@@ -1,13 +1,7 @@
1
- import { cn } from "../lib/utils";
1
+ import { cn } from "@repo/ui/lib/utils";
2
2
 
3
3
  function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
4
- return (
5
- <div
6
- data-slot="skeleton"
7
- className={cn("bg-accent animate-pulse rounded-md", className)}
8
- {...props}
9
- />
10
- );
4
+ return <div data-slot="skeleton" className={cn("animate-pulse rounded-md bg-muted", className)} {...props} />;
11
5
  }
12
6
 
13
7
  export { Skeleton };
@@ -0,0 +1,39 @@
1
+ "use client";
2
+
3
+ import { CircleCheckIcon, InfoIcon, Loader2Icon, OctagonXIcon, TriangleAlertIcon } from "lucide-react";
4
+ import { useTheme } from "next-themes";
5
+ import { Toaster as Sonner, type ToasterProps } from "sonner";
6
+
7
+ const Toaster = ({ ...props }: ToasterProps) => {
8
+ const { theme = "system" } = useTheme();
9
+
10
+ return (
11
+ <Sonner
12
+ theme={theme as ToasterProps["theme"]}
13
+ className="toaster group"
14
+ icons={{
15
+ success: <CircleCheckIcon className="size-4" />,
16
+ info: <InfoIcon className="size-4" />,
17
+ warning: <TriangleAlertIcon className="size-4" />,
18
+ error: <OctagonXIcon className="size-4" />,
19
+ loading: <Loader2Icon className="size-4 animate-spin" />,
20
+ }}
21
+ style={
22
+ {
23
+ "--normal-bg": "var(--popover)",
24
+ "--normal-text": "var(--popover-foreground)",
25
+ "--normal-border": "var(--border)",
26
+ "--border-radius": "var(--radius)",
27
+ } as React.CSSProperties
28
+ }
29
+ toastOptions={{
30
+ classNames: {
31
+ toast: "cn-toast",
32
+ },
33
+ }}
34
+ {...props}
35
+ />
36
+ );
37
+ };
38
+
39
+ export { Toaster };