@coze-arch/cli 0.0.1-alpha.ecba20 → 0.0.1-alpha.ee5d83

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 (43) hide show
  1. package/lib/__templates__/expo/.coze +1 -1
  2. package/lib/__templates__/expo/.cozeproj/scripts/dev_build.sh +19 -82
  3. package/lib/__templates__/expo/.cozeproj/scripts/dev_run.sh +62 -81
  4. package/lib/__templates__/expo/README.md +22 -14
  5. package/lib/__templates__/expo/client/app/index.tsx +1 -0
  6. package/lib/__templates__/expo/client/app.config.ts +64 -60
  7. package/lib/__templates__/expo/client/constants/theme.ts +22 -18
  8. package/lib/__templates__/expo/client/hooks/useColorScheme.ts +34 -1
  9. package/lib/__templates__/expo/client/package.json +1 -0
  10. package/lib/__templates__/expo/client/screens/home/index.tsx +12 -37
  11. package/lib/__templates__/expo/client/screens/home/styles.ts +19 -51
  12. package/lib/__templates__/expo/pnpm-lock.yaml +57 -5
  13. package/lib/__templates__/expo/server/package.json +3 -1
  14. package/lib/__templates__/expo/server/src/index.ts +8 -2
  15. package/lib/__templates__/expo/template.config.js +1 -0
  16. package/lib/__templates__/nextjs/.coze +1 -0
  17. package/lib/__templates__/nextjs/_npmrc +1 -0
  18. package/lib/__templates__/nextjs/next.config.ts +11 -0
  19. package/lib/__templates__/nextjs/package.json +3 -5
  20. package/lib/__templates__/nextjs/pnpm-lock.yaml +13 -1025
  21. package/lib/__templates__/nextjs/scripts/dev.sh +1 -1
  22. package/lib/__templates__/nextjs/scripts/prepare.sh +9 -0
  23. package/lib/__templates__/nextjs/src/app/globals.css +10 -2
  24. package/lib/__templates__/nextjs/src/app/layout.tsx +1 -16
  25. package/lib/__templates__/nextjs/src/app/page.tsx +33 -21
  26. package/lib/__templates__/nextjs/src/components/ui/resizable.tsx +29 -22
  27. package/lib/__templates__/nextjs/src/components/ui/sidebar.tsx +228 -230
  28. package/lib/__templates__/nextjs/template.config.js +30 -0
  29. package/lib/__templates__/templates.json +61 -70
  30. package/lib/__templates__/vite/.coze +1 -0
  31. package/lib/__templates__/vite/_npmrc +1 -0
  32. package/lib/__templates__/vite/eslint.config.mjs +9 -0
  33. package/lib/__templates__/vite/package.json +5 -1
  34. package/lib/__templates__/vite/pnpm-lock.yaml +3481 -14
  35. package/lib/__templates__/vite/scripts/prepare.sh +9 -0
  36. package/lib/__templates__/vite/template.config.js +28 -4
  37. package/lib/cli.js +46 -22
  38. package/package.json +1 -1
  39. package/lib/__templates__/nextjs/.babelrc +0 -15
  40. package/lib/__templates__/nextjs/.vscode/settings.json +0 -121
  41. package/lib/__templates__/nextjs/server.mjs +0 -50
  42. package/lib/__templates__/vite/.vscode/settings.json +0 -7
  43. /package/lib/__templates__/expo/client/app/{index.ts → home.tsx} +0 -0
@@ -1,56 +1,56 @@
1
- "use client"
2
-
3
- import * as React from "react"
4
- import { Slot } from "@radix-ui/react-slot"
5
- import { cva, type VariantProps } from "class-variance-authority"
6
- import { PanelLeftIcon } from "lucide-react"
7
-
8
- import { useIsMobile } from "@/hooks/use-mobile"
9
- import { cn } from "@/lib/utils"
10
- import { Button } from "@/components/ui/button"
11
- import { Input } from "@/components/ui/input"
12
- import { Separator } from "@/components/ui/separator"
1
+ 'use client';
2
+
3
+ import * as React from 'react';
4
+ import { Slot } from '@radix-ui/react-slot';
5
+ import { cva, type VariantProps } from 'class-variance-authority';
6
+ import { PanelLeftIcon } from 'lucide-react';
7
+
8
+ import { useIsMobile } from '@/hooks/use-mobile';
9
+ import { cn } from '@/lib/utils';
10
+ import { Button } from '@/components/ui/button';
11
+ import { Input } from '@/components/ui/input';
12
+ import { Separator } from '@/components/ui/separator';
13
13
  import {
14
14
  Sheet,
15
15
  SheetContent,
16
16
  SheetDescription,
17
17
  SheetHeader,
18
18
  SheetTitle,
19
- } from "@/components/ui/sheet"
20
- import { Skeleton } from "@/components/ui/skeleton"
19
+ } from '@/components/ui/sheet';
20
+ import { Skeleton } from '@/components/ui/skeleton';
21
21
  import {
22
22
  Tooltip,
23
23
  TooltipContent,
24
24
  TooltipProvider,
25
25
  TooltipTrigger,
26
- } from "@/components/ui/tooltip"
26
+ } from '@/components/ui/tooltip';
27
27
 
28
- const SIDEBAR_COOKIE_NAME = "sidebar_state"
29
- const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
30
- const SIDEBAR_WIDTH = "16rem"
31
- const SIDEBAR_WIDTH_MOBILE = "18rem"
32
- const SIDEBAR_WIDTH_ICON = "3rem"
33
- const SIDEBAR_KEYBOARD_SHORTCUT = "b"
28
+ const SIDEBAR_COOKIE_NAME = 'sidebar_state';
29
+ const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
30
+ const SIDEBAR_WIDTH = '16rem';
31
+ const SIDEBAR_WIDTH_MOBILE = '18rem';
32
+ const SIDEBAR_WIDTH_ICON = '3rem';
33
+ const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
34
34
 
35
35
  type SidebarContextProps = {
36
- state: "expanded" | "collapsed"
37
- open: boolean
38
- setOpen: (open: boolean) => void
39
- openMobile: boolean
40
- setOpenMobile: (open: boolean) => void
41
- isMobile: boolean
42
- toggleSidebar: () => void
43
- }
36
+ state: 'expanded' | 'collapsed';
37
+ open: boolean;
38
+ setOpen: (open: boolean) => void;
39
+ openMobile: boolean;
40
+ setOpenMobile: (open: boolean) => void;
41
+ isMobile: boolean;
42
+ toggleSidebar: () => void;
43
+ };
44
44
 
45
- const SidebarContext = React.createContext<SidebarContextProps | null>(null)
45
+ const SidebarContext = React.createContext<SidebarContextProps | null>(null);
46
46
 
47
47
  function useSidebar() {
48
- const context = React.useContext(SidebarContext)
48
+ const context = React.useContext(SidebarContext);
49
49
  if (!context) {
50
- throw new Error("useSidebar must be used within a SidebarProvider.")
50
+ throw new Error('useSidebar must be used within a SidebarProvider.');
51
51
  }
52
52
 
53
- return context
53
+ return context;
54
54
  }
55
55
 
56
56
  function SidebarProvider({
@@ -61,37 +61,37 @@ function SidebarProvider({
61
61
  style,
62
62
  children,
63
63
  ...props
64
- }: React.ComponentProps<"div"> & {
65
- defaultOpen?: boolean
66
- open?: boolean
67
- onOpenChange?: (open: boolean) => void
64
+ }: React.ComponentProps<'div'> & {
65
+ defaultOpen?: boolean;
66
+ open?: boolean;
67
+ onOpenChange?: (open: boolean) => void;
68
68
  }) {
69
- const isMobile = useIsMobile()
70
- const [openMobile, setOpenMobile] = React.useState(false)
69
+ const isMobile = useIsMobile();
70
+ const [openMobile, setOpenMobile] = React.useState(false);
71
71
 
72
72
  // This is the internal state of the sidebar.
73
73
  // We use openProp and setOpenProp for control from outside the component.
74
- const [_open, _setOpen] = React.useState(defaultOpen)
75
- const open = openProp ?? _open
74
+ const [_open, _setOpen] = React.useState(defaultOpen);
75
+ const open = openProp ?? _open;
76
76
  const setOpen = React.useCallback(
77
77
  (value: boolean | ((value: boolean) => boolean)) => {
78
- const openState = typeof value === "function" ? value(open) : value
78
+ const openState = typeof value === 'function' ? value(open) : value;
79
79
  if (setOpenProp) {
80
- setOpenProp(openState)
80
+ setOpenProp(openState);
81
81
  } else {
82
- _setOpen(openState)
82
+ _setOpen(openState);
83
83
  }
84
84
 
85
85
  // This sets the cookie to keep the sidebar state.
86
- document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
86
+ document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
87
87
  },
88
- [setOpenProp, open]
89
- )
88
+ [setOpenProp, open],
89
+ );
90
90
 
91
91
  // Helper to toggle the sidebar.
92
92
  const toggleSidebar = React.useCallback(() => {
93
- return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open)
94
- }, [isMobile, setOpen, setOpenMobile])
93
+ return isMobile ? setOpenMobile(open => !open) : setOpen(open => !open);
94
+ }, [isMobile, setOpen, setOpenMobile]);
95
95
 
96
96
  // Adds a keyboard shortcut to toggle the sidebar.
97
97
  React.useEffect(() => {
@@ -100,18 +100,18 @@ function SidebarProvider({
100
100
  event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
101
101
  (event.metaKey || event.ctrlKey)
102
102
  ) {
103
- event.preventDefault()
104
- toggleSidebar()
103
+ event.preventDefault();
104
+ toggleSidebar();
105
105
  }
106
- }
106
+ };
107
107
 
108
- window.addEventListener("keydown", handleKeyDown)
109
- return () => window.removeEventListener("keydown", handleKeyDown)
110
- }, [toggleSidebar])
108
+ window.addEventListener('keydown', handleKeyDown);
109
+ return () => window.removeEventListener('keydown', handleKeyDown);
110
+ }, [toggleSidebar]);
111
111
 
112
112
  // We add a state so that we can do data-state="expanded" or "collapsed".
113
113
  // This makes it easier to style the sidebar with Tailwind classes.
114
- const state = open ? "expanded" : "collapsed"
114
+ const state = open ? 'expanded' : 'collapsed';
115
115
 
116
116
  const contextValue = React.useMemo<SidebarContextProps>(
117
117
  () => ({
@@ -123,8 +123,8 @@ function SidebarProvider({
123
123
  setOpenMobile,
124
124
  toggleSidebar,
125
125
  }),
126
- [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
127
- )
126
+ [state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
127
+ );
128
128
 
129
129
  return (
130
130
  <SidebarContext.Provider value={contextValue}>
@@ -133,14 +133,14 @@ function SidebarProvider({
133
133
  data-slot="sidebar-wrapper"
134
134
  style={
135
135
  {
136
- "--sidebar-width": SIDEBAR_WIDTH,
137
- "--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
136
+ '--sidebar-width': SIDEBAR_WIDTH,
137
+ '--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
138
138
  ...style,
139
139
  } as React.CSSProperties
140
140
  }
141
141
  className={cn(
142
- "group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
143
- className
142
+ 'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full',
143
+ className,
144
144
  )}
145
145
  {...props}
146
146
  >
@@ -148,36 +148,36 @@ function SidebarProvider({
148
148
  </div>
149
149
  </TooltipProvider>
150
150
  </SidebarContext.Provider>
151
- )
151
+ );
152
152
  }
153
153
 
154
154
  function Sidebar({
155
- side = "left",
156
- variant = "sidebar",
157
- collapsible = "offcanvas",
155
+ side = 'left',
156
+ variant = 'sidebar',
157
+ collapsible = 'offcanvas',
158
158
  className,
159
159
  children,
160
160
  ...props
161
- }: React.ComponentProps<"div"> & {
162
- side?: "left" | "right"
163
- variant?: "sidebar" | "floating" | "inset"
164
- collapsible?: "offcanvas" | "icon" | "none"
161
+ }: React.ComponentProps<'div'> & {
162
+ side?: 'left' | 'right';
163
+ variant?: 'sidebar' | 'floating' | 'inset';
164
+ collapsible?: 'offcanvas' | 'icon' | 'none';
165
165
  }) {
166
- const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
166
+ const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
167
167
 
168
- if (collapsible === "none") {
168
+ if (collapsible === 'none') {
169
169
  return (
170
170
  <div
171
171
  data-slot="sidebar"
172
172
  className={cn(
173
- "bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
174
- className
173
+ 'bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col',
174
+ className,
175
175
  )}
176
176
  {...props}
177
177
  >
178
178
  {children}
179
179
  </div>
180
- )
180
+ );
181
181
  }
182
182
 
183
183
  if (isMobile) {
@@ -190,7 +190,7 @@ function Sidebar({
190
190
  className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
191
191
  style={
192
192
  {
193
- "--sidebar-width": SIDEBAR_WIDTH_MOBILE,
193
+ '--sidebar-width': SIDEBAR_WIDTH_MOBILE,
194
194
  } as React.CSSProperties
195
195
  }
196
196
  side={side}
@@ -202,14 +202,14 @@ function Sidebar({
202
202
  <div className="flex h-full w-full flex-col">{children}</div>
203
203
  </SheetContent>
204
204
  </Sheet>
205
- )
205
+ );
206
206
  }
207
207
 
208
208
  return (
209
209
  <div
210
210
  className="group peer text-sidebar-foreground hidden md:block"
211
211
  data-state={state}
212
- data-collapsible={state === "collapsed" ? collapsible : ""}
212
+ data-collapsible={state === 'collapsed' ? collapsible : ''}
213
213
  data-variant={variant}
214
214
  data-side={side}
215
215
  data-slot="sidebar"
@@ -218,26 +218,26 @@ function Sidebar({
218
218
  <div
219
219
  data-slot="sidebar-gap"
220
220
  className={cn(
221
- "relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
222
- "group-data-[collapsible=offcanvas]:w-0",
223
- "group-data-[side=right]:rotate-180",
224
- variant === "floating" || variant === "inset"
225
- ? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
226
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
221
+ 'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',
222
+ 'group-data-[collapsible=offcanvas]:w-0',
223
+ 'group-data-[side=right]:rotate-180',
224
+ variant === 'floating' || variant === 'inset'
225
+ ? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
226
+ : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',
227
227
  )}
228
228
  />
229
229
  <div
230
230
  data-slot="sidebar-container"
231
231
  className={cn(
232
- "fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
233
- side === "left"
234
- ? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
235
- : "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
232
+ 'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
233
+ side === 'left'
234
+ ? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
235
+ : 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
236
236
  // Adjust the padding for floating and inset variants.
237
- variant === "floating" || variant === "inset"
238
- ? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
239
- : "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
240
- className
237
+ variant === 'floating' || variant === 'inset'
238
+ ? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
239
+ : 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
240
+ className,
241
241
  )}
242
242
  {...props}
243
243
  >
@@ -250,7 +250,7 @@ function Sidebar({
250
250
  </div>
251
251
  </div>
252
252
  </div>
253
- )
253
+ );
254
254
  }
255
255
 
256
256
  function SidebarTrigger({
@@ -258,7 +258,7 @@ function SidebarTrigger({
258
258
  onClick,
259
259
  ...props
260
260
  }: React.ComponentProps<typeof Button>) {
261
- const { toggleSidebar } = useSidebar()
261
+ const { toggleSidebar } = useSidebar();
262
262
 
263
263
  return (
264
264
  <Button
@@ -266,21 +266,21 @@ function SidebarTrigger({
266
266
  data-slot="sidebar-trigger"
267
267
  variant="ghost"
268
268
  size="icon"
269
- className={cn("size-7", className)}
270
- onClick={(event) => {
271
- onClick?.(event)
272
- toggleSidebar()
269
+ className={cn('size-7', className)}
270
+ onClick={event => {
271
+ onClick?.(event);
272
+ toggleSidebar();
273
273
  }}
274
274
  {...props}
275
275
  >
276
276
  <PanelLeftIcon />
277
277
  <span className="sr-only">Toggle Sidebar</span>
278
278
  </Button>
279
- )
279
+ );
280
280
  }
281
281
 
282
- function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
283
- const { toggleSidebar } = useSidebar()
282
+ function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
283
+ const { toggleSidebar } = useSidebar();
284
284
 
285
285
  return (
286
286
  <button
@@ -291,31 +291,31 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
291
291
  onClick={toggleSidebar}
292
292
  title="Toggle Sidebar"
293
293
  className={cn(
294
- "hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex",
295
- "in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
296
- "[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
297
- "hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
298
- "[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
299
- "[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
300
- className
294
+ 'hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 -translate-x-1/2 transition-all ease-linear group-data-[side=left]:-right-4 group-data-[side=right]:left-0 after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex',
295
+ 'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
296
+ '[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
297
+ 'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
298
+ '[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
299
+ '[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
300
+ className,
301
301
  )}
302
302
  {...props}
303
303
  />
304
- )
304
+ );
305
305
  }
306
306
 
307
- function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
307
+ function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
308
308
  return (
309
309
  <main
310
310
  data-slot="sidebar-inset"
311
311
  className={cn(
312
- "bg-background relative flex w-full flex-1 flex-col",
313
- "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",
314
- className
312
+ 'bg-background relative flex w-full flex-1 flex-col',
313
+ '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',
314
+ className,
315
315
  )}
316
316
  {...props}
317
317
  />
318
- )
318
+ );
319
319
  }
320
320
 
321
321
  function SidebarInput({
@@ -326,32 +326,32 @@ function SidebarInput({
326
326
  <Input
327
327
  data-slot="sidebar-input"
328
328
  data-sidebar="input"
329
- className={cn("bg-background h-8 w-full shadow-none", className)}
329
+ className={cn('bg-background h-8 w-full shadow-none', className)}
330
330
  {...props}
331
331
  />
332
- )
332
+ );
333
333
  }
334
334
 
335
- function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
335
+ function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
336
336
  return (
337
337
  <div
338
338
  data-slot="sidebar-header"
339
339
  data-sidebar="header"
340
- className={cn("flex flex-col gap-2 p-2", className)}
340
+ className={cn('flex flex-col gap-2 p-2', className)}
341
341
  {...props}
342
342
  />
343
- )
343
+ );
344
344
  }
345
345
 
346
- function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
346
+ function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {
347
347
  return (
348
348
  <div
349
349
  data-slot="sidebar-footer"
350
350
  data-sidebar="footer"
351
- className={cn("flex flex-col gap-2 p-2", className)}
351
+ className={cn('flex flex-col gap-2 p-2', className)}
352
352
  {...props}
353
353
  />
354
- )
354
+ );
355
355
  }
356
356
 
357
357
  function SidebarSeparator({
@@ -362,154 +362,154 @@ function SidebarSeparator({
362
362
  <Separator
363
363
  data-slot="sidebar-separator"
364
364
  data-sidebar="separator"
365
- className={cn("bg-sidebar-border mx-2 w-auto", className)}
365
+ className={cn('bg-sidebar-border mx-2 w-auto', className)}
366
366
  {...props}
367
367
  />
368
- )
368
+ );
369
369
  }
370
370
 
371
- function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
371
+ function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
372
372
  return (
373
373
  <div
374
374
  data-slot="sidebar-content"
375
375
  data-sidebar="content"
376
376
  className={cn(
377
- "flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
378
- className
377
+ 'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
378
+ className,
379
379
  )}
380
380
  {...props}
381
381
  />
382
- )
382
+ );
383
383
  }
384
384
 
385
- function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
385
+ function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
386
386
  return (
387
387
  <div
388
388
  data-slot="sidebar-group"
389
389
  data-sidebar="group"
390
- className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
390
+ className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
391
391
  {...props}
392
392
  />
393
- )
393
+ );
394
394
  }
395
395
 
396
396
  function SidebarGroupLabel({
397
397
  className,
398
398
  asChild = false,
399
399
  ...props
400
- }: React.ComponentProps<"div"> & { asChild?: boolean }) {
401
- const Comp = asChild ? Slot : "div"
400
+ }: React.ComponentProps<'div'> & { asChild?: boolean }) {
401
+ const Comp = asChild ? Slot : 'div';
402
402
 
403
403
  return (
404
404
  <Comp
405
405
  data-slot="sidebar-group-label"
406
406
  data-sidebar="group-label"
407
407
  className={cn(
408
- "text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
409
- "group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
410
- className
408
+ 'text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-xs font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
409
+ 'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
410
+ className,
411
411
  )}
412
412
  {...props}
413
413
  />
414
- )
414
+ );
415
415
  }
416
416
 
417
417
  function SidebarGroupAction({
418
418
  className,
419
419
  asChild = false,
420
420
  ...props
421
- }: React.ComponentProps<"button"> & { asChild?: boolean }) {
422
- const Comp = asChild ? Slot : "button"
421
+ }: React.ComponentProps<'button'> & { asChild?: boolean }) {
422
+ const Comp = asChild ? Slot : 'button';
423
423
 
424
424
  return (
425
425
  <Comp
426
426
  data-slot="sidebar-group-action"
427
427
  data-sidebar="group-action"
428
428
  className={cn(
429
- "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
429
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
430
430
  // Increases the hit area of the button on mobile.
431
- "after:absolute after:-inset-2 md:after:hidden",
432
- "group-data-[collapsible=icon]:hidden",
433
- className
431
+ 'after:absolute after:-inset-2 md:after:hidden',
432
+ 'group-data-[collapsible=icon]:hidden',
433
+ className,
434
434
  )}
435
435
  {...props}
436
436
  />
437
- )
437
+ );
438
438
  }
439
439
 
440
440
  function SidebarGroupContent({
441
441
  className,
442
442
  ...props
443
- }: React.ComponentProps<"div">) {
443
+ }: React.ComponentProps<'div'>) {
444
444
  return (
445
445
  <div
446
446
  data-slot="sidebar-group-content"
447
447
  data-sidebar="group-content"
448
- className={cn("w-full text-sm", className)}
448
+ className={cn('w-full text-sm', className)}
449
449
  {...props}
450
450
  />
451
- )
451
+ );
452
452
  }
453
453
 
454
- function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
454
+ function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {
455
455
  return (
456
456
  <ul
457
457
  data-slot="sidebar-menu"
458
458
  data-sidebar="menu"
459
- className={cn("flex w-full min-w-0 flex-col gap-1", className)}
459
+ className={cn('flex w-full min-w-0 flex-col gap-1', className)}
460
460
  {...props}
461
461
  />
462
- )
462
+ );
463
463
  }
464
464
 
465
- function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
465
+ function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {
466
466
  return (
467
467
  <li
468
468
  data-slot="sidebar-menu-item"
469
469
  data-sidebar="menu-item"
470
- className={cn("group/menu-item relative", className)}
470
+ className={cn('group/menu-item relative', className)}
471
471
  {...props}
472
472
  />
473
- )
473
+ );
474
474
  }
475
475
 
476
476
  const sidebarMenuButtonVariants = cva(
477
- "peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] 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 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
477
+ 'peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-md p-2 text-left text-sm outline-hidden ring-sidebar-ring transition-[width,height,padding] 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 group-has-data-[sidebar=menu-action]/menu-item:pr-8 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-medium data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:size-8! group-data-[collapsible=icon]:p-2! [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
478
478
  {
479
479
  variants: {
480
480
  variant: {
481
- default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
481
+ default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
482
482
  outline:
483
- "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))]",
483
+ '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))]',
484
484
  },
485
485
  size: {
486
- default: "h-8 text-sm",
487
- sm: "h-7 text-xs",
488
- lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
486
+ default: 'h-8 text-sm',
487
+ sm: 'h-7 text-xs',
488
+ lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',
489
489
  },
490
490
  },
491
491
  defaultVariants: {
492
- variant: "default",
493
- size: "default",
492
+ variant: 'default',
493
+ size: 'default',
494
494
  },
495
- }
496
- )
495
+ },
496
+ );
497
497
 
498
498
  function SidebarMenuButton({
499
499
  asChild = false,
500
500
  isActive = false,
501
- variant = "default",
502
- size = "default",
501
+ variant = 'default',
502
+ size = 'default',
503
503
  tooltip,
504
504
  className,
505
505
  ...props
506
- }: React.ComponentProps<"button"> & {
507
- asChild?: boolean
508
- isActive?: boolean
509
- tooltip?: string | React.ComponentProps<typeof TooltipContent>
506
+ }: React.ComponentProps<'button'> & {
507
+ asChild?: boolean;
508
+ isActive?: boolean;
509
+ tooltip?: string | React.ComponentProps<typeof TooltipContent>;
510
510
  } & VariantProps<typeof sidebarMenuButtonVariants>) {
511
- const Comp = asChild ? Slot : "button"
512
- const { isMobile, state } = useSidebar()
511
+ const Comp = asChild ? Slot : 'button';
512
+ const { isMobile, state } = useSidebar();
513
513
 
514
514
  const button = (
515
515
  <Comp
@@ -520,16 +520,16 @@ function SidebarMenuButton({
520
520
  className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
521
521
  {...props}
522
522
  />
523
- )
523
+ );
524
524
 
525
525
  if (!tooltip) {
526
- return button
526
+ return button;
527
527
  }
528
528
 
529
- if (typeof tooltip === "string") {
529
+ if (typeof tooltip === 'string') {
530
530
  tooltip = {
531
531
  children: tooltip,
532
- }
532
+ };
533
533
  }
534
534
 
535
535
  return (
@@ -538,11 +538,11 @@ function SidebarMenuButton({
538
538
  <TooltipContent
539
539
  side="right"
540
540
  align="center"
541
- hidden={state !== "collapsed" || isMobile}
541
+ hidden={state !== 'collapsed' || isMobile}
542
542
  {...tooltip}
543
543
  />
544
544
  </Tooltip>
545
- )
545
+ );
546
546
  }
547
547
 
548
548
  function SidebarMenuAction({
@@ -550,72 +550,70 @@ function SidebarMenuAction({
550
550
  asChild = false,
551
551
  showOnHover = false,
552
552
  ...props
553
- }: React.ComponentProps<"button"> & {
554
- asChild?: boolean
555
- showOnHover?: boolean
553
+ }: React.ComponentProps<'button'> & {
554
+ asChild?: boolean;
555
+ showOnHover?: boolean;
556
556
  }) {
557
- const Comp = asChild ? Slot : "button"
557
+ const Comp = asChild ? Slot : 'button';
558
558
 
559
559
  return (
560
560
  <Comp
561
561
  data-slot="sidebar-menu-action"
562
562
  data-sidebar="menu-action"
563
563
  className={cn(
564
- "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0",
564
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 outline-hidden transition-transform focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
565
565
  // Increases the hit area of the button on mobile.
566
- "after:absolute after:-inset-2 md:after:hidden",
567
- "peer-data-[size=sm]/menu-button:top-1",
568
- "peer-data-[size=default]/menu-button:top-1.5",
569
- "peer-data-[size=lg]/menu-button:top-2.5",
570
- "group-data-[collapsible=icon]:hidden",
566
+ 'after:absolute after:-inset-2 md:after:hidden',
567
+ 'peer-data-[size=sm]/menu-button:top-1',
568
+ 'peer-data-[size=default]/menu-button:top-1.5',
569
+ 'peer-data-[size=lg]/menu-button:top-2.5',
570
+ 'group-data-[collapsible=icon]:hidden',
571
571
  showOnHover &&
572
- "peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",
573
- className
572
+ 'peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
573
+ className,
574
574
  )}
575
575
  {...props}
576
576
  />
577
- )
577
+ );
578
578
  }
579
579
 
580
580
  function SidebarMenuBadge({
581
581
  className,
582
582
  ...props
583
- }: React.ComponentProps<"div">) {
583
+ }: React.ComponentProps<'div'>) {
584
584
  return (
585
585
  <div
586
586
  data-slot="sidebar-menu-badge"
587
587
  data-sidebar="menu-badge"
588
588
  className={cn(
589
- "text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none",
590
- "peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
591
- "peer-data-[size=sm]/menu-button:top-1",
592
- "peer-data-[size=default]/menu-button:top-1.5",
593
- "peer-data-[size=lg]/menu-button:top-2.5",
594
- "group-data-[collapsible=icon]:hidden",
595
- className
589
+ 'text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none',
590
+ 'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
591
+ 'peer-data-[size=sm]/menu-button:top-1',
592
+ 'peer-data-[size=default]/menu-button:top-1.5',
593
+ 'peer-data-[size=lg]/menu-button:top-2.5',
594
+ 'group-data-[collapsible=icon]:hidden',
595
+ className,
596
596
  )}
597
597
  {...props}
598
598
  />
599
- )
599
+ );
600
600
  }
601
601
 
602
602
  function SidebarMenuSkeleton({
603
603
  className,
604
604
  showIcon = false,
605
605
  ...props
606
- }: React.ComponentProps<"div"> & {
607
- showIcon?: boolean
606
+ }: React.ComponentProps<'div'> & {
607
+ showIcon?: boolean;
608
608
  }) {
609
- // Random width between 50 to 90%.
610
- const width = React.useMemo(() => {
611
- return `${Math.floor(Math.random() * 40) + 50}%`
612
- }, [])
609
+ // Fixed width for skeleton loading
610
+ const width = '70%';
613
611
 
614
612
  return (
615
613
  <div
616
614
  data-slot="sidebar-menu-skeleton"
617
615
  data-sidebar="menu-skeleton"
618
- className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
616
+ className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
619
617
  {...props}
620
618
  >
621
619
  {showIcon && (
@@ -629,55 +627,55 @@ function SidebarMenuSkeleton({
629
627
  data-sidebar="menu-skeleton-text"
630
628
  style={
631
629
  {
632
- "--skeleton-width": width,
630
+ '--skeleton-width': width,
633
631
  } as React.CSSProperties
634
632
  }
635
633
  />
636
634
  </div>
637
- )
635
+ );
638
636
  }
639
637
 
640
- function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
638
+ function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
641
639
  return (
642
640
  <ul
643
641
  data-slot="sidebar-menu-sub"
644
642
  data-sidebar="menu-sub"
645
643
  className={cn(
646
- "border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5",
647
- "group-data-[collapsible=icon]:hidden",
648
- className
644
+ 'border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-l px-2.5 py-0.5',
645
+ 'group-data-[collapsible=icon]:hidden',
646
+ className,
649
647
  )}
650
648
  {...props}
651
649
  />
652
- )
650
+ );
653
651
  }
654
652
 
655
653
  function SidebarMenuSubItem({
656
654
  className,
657
655
  ...props
658
- }: React.ComponentProps<"li">) {
656
+ }: React.ComponentProps<'li'>) {
659
657
  return (
660
658
  <li
661
659
  data-slot="sidebar-menu-sub-item"
662
660
  data-sidebar="menu-sub-item"
663
- className={cn("group/menu-sub-item relative", className)}
661
+ className={cn('group/menu-sub-item relative', className)}
664
662
  {...props}
665
663
  />
666
- )
664
+ );
667
665
  }
668
666
 
669
667
  function SidebarMenuSubButton({
670
668
  asChild = false,
671
- size = "md",
669
+ size = 'md',
672
670
  isActive = false,
673
671
  className,
674
672
  ...props
675
- }: React.ComponentProps<"a"> & {
676
- asChild?: boolean
677
- size?: "sm" | "md"
678
- isActive?: boolean
673
+ }: React.ComponentProps<'a'> & {
674
+ asChild?: boolean;
675
+ size?: 'sm' | 'md';
676
+ isActive?: boolean;
679
677
  }) {
680
- const Comp = asChild ? Slot : "a"
678
+ const Comp = asChild ? Slot : 'a';
681
679
 
682
680
  return (
683
681
  <Comp
@@ -686,16 +684,16 @@ function SidebarMenuSubButton({
686
684
  data-size={size}
687
685
  data-active={isActive}
688
686
  className={cn(
689
- "text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0",
690
- "data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
691
- size === "sm" && "text-xs",
692
- size === "md" && "text-sm",
693
- "group-data-[collapsible=icon]:hidden",
694
- className
687
+ 'text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground active:bg-sidebar-accent active:text-sidebar-accent-foreground [&>svg]:text-sidebar-accent-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 outline-hidden focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
688
+ 'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
689
+ size === 'sm' && 'text-xs',
690
+ size === 'md' && 'text-sm',
691
+ 'group-data-[collapsible=icon]:hidden',
692
+ className,
695
693
  )}
696
694
  {...props}
697
695
  />
698
- )
696
+ );
699
697
  }
700
698
 
701
699
  export {
@@ -723,4 +721,4 @@ export {
723
721
  SidebarSeparator,
724
722
  SidebarTrigger,
725
723
  useSidebar,
726
- }
724
+ };