@cogito.ai/cli 0.4.2 → 0.4.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.
- package/README.md +29 -22
- package/dist/index.js +9 -15
- package/dist/templates/web-nextjs/.github/copilot-instructions.md +5 -6
- package/dist/templates/web-nextjs/README.md +25 -24
- package/dist/templates/web-nextjs/apps/docs/.source/browser.ts +18 -8
- package/dist/templates/web-nextjs/apps/docs/.source/dynamic.ts +11 -5
- package/dist/templates/web-nextjs/apps/docs/.source/server.ts +37 -17
- package/dist/templates/web-nextjs/apps/docs/app/docs/[[...slug]]/page.tsx +1 -6
- package/dist/templates/web-nextjs/apps/docs/app/docs/layout.tsx +1 -4
- package/dist/templates/web-nextjs/apps/docs/app/llms-full.txt/route.ts +3 -1
- package/dist/templates/web-nextjs/apps/docs/next-env.d.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/.github/copilot-instructions.md +53 -6
- package/dist/templates/web-nextjs/apps/web/.github/skills/impeccable/SKILL.md +55 -0
- package/dist/templates/web-nextjs/apps/web/DESIGN.md +65 -0
- package/dist/templates/web-nextjs/apps/web/messages/en.json +81 -5
- package/dist/templates/web-nextjs/apps/web/messages/zh.json +81 -5
- package/dist/templates/web-nextjs/apps/web/next.config.ts +3 -3
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/forgot-password/page.tsx +174 -39
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/login/page.tsx +13 -3
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/reset-password/page.tsx +4 -1
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(auth)/signup/page.tsx +18 -17
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/dashboard/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/layout.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/(protected)/settings/profile/page.tsx +2 -8
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/about/page.tsx +3 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/globals.css +17 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/help/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/layout.tsx +10 -8
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/page.tsx +22 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/privacy/page.tsx +3 -6
- package/dist/templates/web-nextjs/apps/web/src/app/[locale]/terms/page.tsx +1 -5
- package/dist/templates/web-nextjs/apps/web/src/app/auth/callback/route.ts +2 -3
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/app-sidebar.tsx +13 -16
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/chart-area-interactive.tsx +122 -146
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/data-table.tsx +84 -149
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-documents.tsx +7 -16
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-main.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-secondary.tsx +4 -4
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/nav-user.tsx +12 -21
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/page.tsx +10 -13
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/section-cards.tsx +5 -9
- package/dist/templates/web-nextjs/apps/web/src/components/dashboard/site-header.tsx +6 -7
- package/dist/templates/web-nextjs/apps/web/src/components/landing/features.tsx +63 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/footer.tsx +48 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/header.tsx +97 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/hero.tsx +45 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/how-it-works.tsx +35 -0
- package/dist/templates/web-nextjs/apps/web/src/components/landing/pricing-teaser.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/profile/profile-form.tsx +6 -4
- package/dist/templates/web-nextjs/apps/web/src/components/providers/theme-provider.tsx +16 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert-dialog.tsx +32 -49
- package/dist/templates/web-nextjs/apps/web/src/components/ui/alert.tsx +16 -23
- package/dist/templates/web-nextjs/apps/web/src/components/ui/avatar.tsx +25 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/badge.tsx +16 -18
- package/dist/templates/web-nextjs/apps/web/src/components/ui/breadcrumb.tsx +19 -26
- package/dist/templates/web-nextjs/apps/web/src/components/ui/button.tsx +23 -24
- package/dist/templates/web-nextjs/apps/web/src/components/ui/card.tsx +19 -36
- package/dist/templates/web-nextjs/apps/web/src/components/ui/chart.tsx +60 -94
- package/dist/templates/web-nextjs/apps/web/src/components/ui/checkbox.tsx +8 -11
- package/dist/templates/web-nextjs/apps/web/src/components/ui/collapsible.tsx +5 -17
- package/dist/templates/web-nextjs/apps/web/src/components/ui/command.tsx +25 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dialog.tsx +21 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/drawer.tsx +24 -35
- package/dist/templates/web-nextjs/apps/web/src/components/ui/dropdown-menu.tsx +26 -55
- package/dist/templates/web-nextjs/apps/web/src/components/ui/field.tsx +62 -76
- package/dist/templates/web-nextjs/apps/web/src/components/ui/form.tsx +19 -34
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input-otp.tsx +13 -20
- package/dist/templates/web-nextjs/apps/web/src/components/ui/input.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/label.tsx +6 -6
- package/dist/templates/web-nextjs/apps/web/src/components/ui/pagination.tsx +21 -42
- package/dist/templates/web-nextjs/apps/web/src/components/ui/popover.tsx +16 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/progress.tsx +5 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/radio-group.tsx +8 -8
- package/dist/templates/web-nextjs/apps/web/src/components/ui/scroll-area.tsx +10 -12
- package/dist/templates/web-nextjs/apps/web/src/components/ui/select.tsx +26 -41
- package/dist/templates/web-nextjs/apps/web/src/components/ui/separator.tsx +7 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sheet.tsx +29 -38
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sidebar.tsx +157 -189
- package/dist/templates/web-nextjs/apps/web/src/components/ui/skeleton.tsx +3 -3
- package/dist/templates/web-nextjs/apps/web/src/components/ui/slider.tsx +10 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/sonner.tsx +13 -7
- package/dist/templates/web-nextjs/apps/web/src/components/ui/switch.tsx +9 -9
- package/dist/templates/web-nextjs/apps/web/src/components/ui/table.tsx +24 -48
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tabs.tsx +21 -31
- package/dist/templates/web-nextjs/apps/web/src/components/ui/textarea.tsx +5 -5
- package/dist/templates/web-nextjs/apps/web/src/components/ui/theme-toggle.tsx +23 -0
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle-group.tsx +15 -16
- package/dist/templates/web-nextjs/apps/web/src/components/ui/toggle.tsx +14 -15
- package/dist/templates/web-nextjs/apps/web/src/components/ui/tooltip.tsx +8 -12
- package/dist/templates/web-nextjs/apps/web/src/core/repositories/IAuthRepository.ts +2 -0
- package/dist/templates/web-nextjs/apps/web/src/core/types/auth.ts +1 -3
- package/dist/templates/web-nextjs/apps/web/src/features/auth/actions.ts +57 -1
- package/dist/templates/web-nextjs/apps/web/src/features/auth/index.ts +2 -0
- package/dist/templates/web-nextjs/apps/web/src/hooks/use-mobile.ts +4 -4
- package/dist/templates/web-nextjs/apps/web/src/i18n/config.ts +1 -1
- package/dist/templates/web-nextjs/apps/web/src/infra/db/SupabaseAuthRepository.ts +48 -4
- package/dist/templates/web-nextjs/apps/web/src/infra/db/client.ts +1 -4
- package/dist/templates/web-nextjs/apps/web/src/lib/utils.ts +2 -2
- package/dist/templates/web-nextjs/apps/web/src/lib/validations/auth.ts +13 -0
- package/dist/templates/web-nextjs/apps/web/src/styles/tokens.css +58 -0
- package/package.json +1 -1
|
@@ -1,39 +1,34 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
import * as React from
|
|
4
|
-
import { cva, type VariantProps } from
|
|
5
|
-
import { PanelLeftIcon } from
|
|
6
|
-
import { Slot } from
|
|
7
|
-
|
|
8
|
-
import { useIsMobile } from
|
|
9
|
-
import { cn } from
|
|
10
|
-
import { Button } from
|
|
11
|
-
import { Input } from
|
|
12
|
-
import { Separator } from
|
|
1
|
+
'use client'
|
|
2
|
+
|
|
3
|
+
import * as React from 'react'
|
|
4
|
+
import { cva, type VariantProps } from 'class-variance-authority'
|
|
5
|
+
import { PanelLeftIcon } from 'lucide-react'
|
|
6
|
+
import { Slot } from 'radix-ui'
|
|
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
|
|
20
|
-
import { Skeleton } from
|
|
21
|
-
import {
|
|
22
|
-
Tooltip,
|
|
23
|
-
TooltipContent,
|
|
24
|
-
TooltipProvider,
|
|
25
|
-
TooltipTrigger,
|
|
26
|
-
} from "@/components/ui/tooltip"
|
|
19
|
+
} from '@/components/ui/sheet'
|
|
20
|
+
import { Skeleton } from '@/components/ui/skeleton'
|
|
21
|
+
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/tooltip'
|
|
27
22
|
|
|
28
|
-
const SIDEBAR_COOKIE_NAME =
|
|
23
|
+
const SIDEBAR_COOKIE_NAME = 'sidebar_state'
|
|
29
24
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
|
30
|
-
const SIDEBAR_WIDTH =
|
|
31
|
-
const SIDEBAR_WIDTH_MOBILE =
|
|
32
|
-
const SIDEBAR_WIDTH_ICON =
|
|
33
|
-
const SIDEBAR_KEYBOARD_SHORTCUT =
|
|
25
|
+
const SIDEBAR_WIDTH = '16rem'
|
|
26
|
+
const SIDEBAR_WIDTH_MOBILE = '18rem'
|
|
27
|
+
const SIDEBAR_WIDTH_ICON = '3rem'
|
|
28
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = 'b'
|
|
34
29
|
|
|
35
30
|
type SidebarContextProps = {
|
|
36
|
-
state:
|
|
31
|
+
state: 'expanded' | 'collapsed'
|
|
37
32
|
open: boolean
|
|
38
33
|
setOpen: (open: boolean) => void
|
|
39
34
|
openMobile: boolean
|
|
@@ -47,7 +42,7 @@ const SidebarContext = React.createContext<SidebarContextProps | null>(null)
|
|
|
47
42
|
function useSidebar() {
|
|
48
43
|
const context = React.useContext(SidebarContext)
|
|
49
44
|
if (!context) {
|
|
50
|
-
throw new Error(
|
|
45
|
+
throw new Error('useSidebar must be used within a SidebarProvider.')
|
|
51
46
|
}
|
|
52
47
|
|
|
53
48
|
return context
|
|
@@ -61,7 +56,7 @@ function SidebarProvider({
|
|
|
61
56
|
style,
|
|
62
57
|
children,
|
|
63
58
|
...props
|
|
64
|
-
}: React.ComponentProps<
|
|
59
|
+
}: React.ComponentProps<'div'> & {
|
|
65
60
|
defaultOpen?: boolean
|
|
66
61
|
open?: boolean
|
|
67
62
|
onOpenChange?: (open: boolean) => void
|
|
@@ -75,7 +70,7 @@ function SidebarProvider({
|
|
|
75
70
|
const open = openProp ?? _open
|
|
76
71
|
const setOpen = React.useCallback(
|
|
77
72
|
(value: boolean | ((value: boolean) => boolean)) => {
|
|
78
|
-
const openState = typeof value ===
|
|
73
|
+
const openState = typeof value === 'function' ? value(open) : value
|
|
79
74
|
if (setOpenProp) {
|
|
80
75
|
setOpenProp(openState)
|
|
81
76
|
} else {
|
|
@@ -85,7 +80,7 @@ function SidebarProvider({
|
|
|
85
80
|
// This sets the cookie to keep the sidebar state.
|
|
86
81
|
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`
|
|
87
82
|
},
|
|
88
|
-
[setOpenProp, open]
|
|
83
|
+
[setOpenProp, open],
|
|
89
84
|
)
|
|
90
85
|
|
|
91
86
|
// Helper to toggle the sidebar.
|
|
@@ -96,22 +91,19 @@ function SidebarProvider({
|
|
|
96
91
|
// Adds a keyboard shortcut to toggle the sidebar.
|
|
97
92
|
React.useEffect(() => {
|
|
98
93
|
const handleKeyDown = (event: KeyboardEvent) => {
|
|
99
|
-
if (
|
|
100
|
-
event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
|
|
101
|
-
(event.metaKey || event.ctrlKey)
|
|
102
|
-
) {
|
|
94
|
+
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
103
95
|
event.preventDefault()
|
|
104
96
|
toggleSidebar()
|
|
105
97
|
}
|
|
106
98
|
}
|
|
107
99
|
|
|
108
|
-
window.addEventListener(
|
|
109
|
-
return () => window.removeEventListener(
|
|
100
|
+
window.addEventListener('keydown', handleKeyDown)
|
|
101
|
+
return () => window.removeEventListener('keydown', handleKeyDown)
|
|
110
102
|
}, [toggleSidebar])
|
|
111
103
|
|
|
112
104
|
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
113
105
|
// This makes it easier to style the sidebar with Tailwind classes.
|
|
114
|
-
const state = open ?
|
|
106
|
+
const state = open ? 'expanded' : 'collapsed'
|
|
115
107
|
|
|
116
108
|
const contextValue = React.useMemo<SidebarContextProps>(
|
|
117
109
|
() => ({
|
|
@@ -123,7 +115,7 @@ function SidebarProvider({
|
|
|
123
115
|
setOpenMobile,
|
|
124
116
|
toggleSidebar,
|
|
125
117
|
}),
|
|
126
|
-
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
118
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
|
|
127
119
|
)
|
|
128
120
|
|
|
129
121
|
return (
|
|
@@ -133,14 +125,14 @@ function SidebarProvider({
|
|
|
133
125
|
data-slot="sidebar-wrapper"
|
|
134
126
|
style={
|
|
135
127
|
{
|
|
136
|
-
|
|
137
|
-
|
|
128
|
+
'--sidebar-width': SIDEBAR_WIDTH,
|
|
129
|
+
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
138
130
|
...style,
|
|
139
131
|
} as React.CSSProperties
|
|
140
132
|
}
|
|
141
133
|
className={cn(
|
|
142
|
-
|
|
143
|
-
className
|
|
134
|
+
'group/sidebar-wrapper flex min-h-svh w-full has-data-[variant=inset]:bg-sidebar',
|
|
135
|
+
className,
|
|
144
136
|
)}
|
|
145
137
|
{...props}
|
|
146
138
|
>
|
|
@@ -152,26 +144,26 @@ function SidebarProvider({
|
|
|
152
144
|
}
|
|
153
145
|
|
|
154
146
|
function Sidebar({
|
|
155
|
-
side =
|
|
156
|
-
variant =
|
|
157
|
-
collapsible =
|
|
147
|
+
side = 'left',
|
|
148
|
+
variant = 'sidebar',
|
|
149
|
+
collapsible = 'offcanvas',
|
|
158
150
|
className,
|
|
159
151
|
children,
|
|
160
152
|
...props
|
|
161
|
-
}: React.ComponentProps<
|
|
162
|
-
side?:
|
|
163
|
-
variant?:
|
|
164
|
-
collapsible?:
|
|
153
|
+
}: React.ComponentProps<'div'> & {
|
|
154
|
+
side?: 'left' | 'right'
|
|
155
|
+
variant?: 'sidebar' | 'floating' | 'inset'
|
|
156
|
+
collapsible?: 'offcanvas' | 'icon' | 'none'
|
|
165
157
|
}) {
|
|
166
158
|
const { isMobile, state, openMobile, setOpenMobile } = useSidebar()
|
|
167
159
|
|
|
168
|
-
if (collapsible ===
|
|
160
|
+
if (collapsible === 'none') {
|
|
169
161
|
return (
|
|
170
162
|
<div
|
|
171
163
|
data-slot="sidebar"
|
|
172
164
|
className={cn(
|
|
173
|
-
|
|
174
|
-
className
|
|
165
|
+
'flex h-full w-(--sidebar-width) flex-col bg-sidebar text-sidebar-foreground',
|
|
166
|
+
className,
|
|
175
167
|
)}
|
|
176
168
|
{...props}
|
|
177
169
|
>
|
|
@@ -190,7 +182,7 @@ function Sidebar({
|
|
|
190
182
|
className="w-(--sidebar-width) bg-sidebar p-0 text-sidebar-foreground [&>button]:hidden"
|
|
191
183
|
style={
|
|
192
184
|
{
|
|
193
|
-
|
|
185
|
+
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
194
186
|
} as React.CSSProperties
|
|
195
187
|
}
|
|
196
188
|
side={side}
|
|
@@ -209,7 +201,7 @@ function Sidebar({
|
|
|
209
201
|
<div
|
|
210
202
|
className="group peer hidden text-sidebar-foreground md:block"
|
|
211
203
|
data-state={state}
|
|
212
|
-
data-collapsible={state ===
|
|
204
|
+
data-collapsible={state === 'collapsed' ? collapsible : ''}
|
|
213
205
|
data-variant={variant}
|
|
214
206
|
data-side={side}
|
|
215
207
|
data-slot="sidebar"
|
|
@@ -218,26 +210,26 @@ function Sidebar({
|
|
|
218
210
|
<div
|
|
219
211
|
data-slot="sidebar-gap"
|
|
220
212
|
className={cn(
|
|
221
|
-
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
variant ===
|
|
225
|
-
?
|
|
226
|
-
:
|
|
213
|
+
'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',
|
|
214
|
+
'group-data-[collapsible=offcanvas]:w-0',
|
|
215
|
+
'group-data-[side=right]:rotate-180',
|
|
216
|
+
variant === 'floating' || variant === 'inset'
|
|
217
|
+
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
218
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',
|
|
227
219
|
)}
|
|
228
220
|
/>
|
|
229
221
|
<div
|
|
230
222
|
data-slot="sidebar-container"
|
|
231
223
|
className={cn(
|
|
232
|
-
|
|
233
|
-
side ===
|
|
234
|
-
?
|
|
235
|
-
:
|
|
224
|
+
'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
|
|
225
|
+
side === 'left'
|
|
226
|
+
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
227
|
+
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
236
228
|
// Adjust the padding for floating and inset variants.
|
|
237
|
-
variant ===
|
|
238
|
-
?
|
|
239
|
-
:
|
|
240
|
-
className
|
|
229
|
+
variant === 'floating' || variant === 'inset'
|
|
230
|
+
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
231
|
+
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
232
|
+
className,
|
|
241
233
|
)}
|
|
242
234
|
{...props}
|
|
243
235
|
>
|
|
@@ -253,11 +245,7 @@ function Sidebar({
|
|
|
253
245
|
)
|
|
254
246
|
}
|
|
255
247
|
|
|
256
|
-
function SidebarTrigger({
|
|
257
|
-
className,
|
|
258
|
-
onClick,
|
|
259
|
-
...props
|
|
260
|
-
}: React.ComponentProps<typeof Button>) {
|
|
248
|
+
function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
|
|
261
249
|
const { toggleSidebar } = useSidebar()
|
|
262
250
|
|
|
263
251
|
return (
|
|
@@ -266,7 +254,7 @@ function SidebarTrigger({
|
|
|
266
254
|
data-slot="sidebar-trigger"
|
|
267
255
|
variant="ghost"
|
|
268
256
|
size="icon"
|
|
269
|
-
className={cn(
|
|
257
|
+
className={cn('size-7', className)}
|
|
270
258
|
onClick={(event) => {
|
|
271
259
|
onClick?.(event)
|
|
272
260
|
toggleSidebar()
|
|
@@ -279,7 +267,7 @@ function SidebarTrigger({
|
|
|
279
267
|
)
|
|
280
268
|
}
|
|
281
269
|
|
|
282
|
-
function SidebarRail({ className, ...props }: React.ComponentProps<
|
|
270
|
+
function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
|
|
283
271
|
const { toggleSidebar } = useSidebar()
|
|
284
272
|
|
|
285
273
|
return (
|
|
@@ -291,103 +279,97 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
|
|
|
291
279
|
onClick={toggleSidebar}
|
|
292
280
|
title="Toggle Sidebar"
|
|
293
281
|
className={cn(
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
297
|
-
|
|
298
|
-
|
|
299
|
-
|
|
300
|
-
className
|
|
282
|
+
'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] hover:after:bg-sidebar-border sm:flex',
|
|
283
|
+
'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
|
|
284
|
+
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
285
|
+
'group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full hover:group-data-[collapsible=offcanvas]:bg-sidebar',
|
|
286
|
+
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
|
|
287
|
+
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
|
|
288
|
+
className,
|
|
301
289
|
)}
|
|
302
290
|
{...props}
|
|
303
291
|
/>
|
|
304
292
|
)
|
|
305
293
|
}
|
|
306
294
|
|
|
307
|
-
function SidebarInset({ className, ...props }: React.ComponentProps<
|
|
295
|
+
function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
|
|
308
296
|
return (
|
|
309
297
|
<main
|
|
310
298
|
data-slot="sidebar-inset"
|
|
311
299
|
className={cn(
|
|
312
|
-
|
|
313
|
-
|
|
314
|
-
className
|
|
300
|
+
'relative flex w-full flex-1 flex-col bg-background',
|
|
301
|
+
'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',
|
|
302
|
+
className,
|
|
315
303
|
)}
|
|
316
304
|
{...props}
|
|
317
305
|
/>
|
|
318
306
|
)
|
|
319
307
|
}
|
|
320
308
|
|
|
321
|
-
function SidebarInput({
|
|
322
|
-
className,
|
|
323
|
-
...props
|
|
324
|
-
}: React.ComponentProps<typeof Input>) {
|
|
309
|
+
function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {
|
|
325
310
|
return (
|
|
326
311
|
<Input
|
|
327
312
|
data-slot="sidebar-input"
|
|
328
313
|
data-sidebar="input"
|
|
329
|
-
className={cn(
|
|
314
|
+
className={cn('h-8 w-full bg-background shadow-none', className)}
|
|
330
315
|
{...props}
|
|
331
316
|
/>
|
|
332
317
|
)
|
|
333
318
|
}
|
|
334
319
|
|
|
335
|
-
function SidebarHeader({ className, ...props }: React.ComponentProps<
|
|
320
|
+
function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
336
321
|
return (
|
|
337
322
|
<div
|
|
338
323
|
data-slot="sidebar-header"
|
|
339
324
|
data-sidebar="header"
|
|
340
|
-
className={cn(
|
|
325
|
+
className={cn('flex flex-col gap-2 p-2', className)}
|
|
341
326
|
{...props}
|
|
342
327
|
/>
|
|
343
328
|
)
|
|
344
329
|
}
|
|
345
330
|
|
|
346
|
-
function SidebarFooter({ className, ...props }: React.ComponentProps<
|
|
331
|
+
function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
347
332
|
return (
|
|
348
333
|
<div
|
|
349
334
|
data-slot="sidebar-footer"
|
|
350
335
|
data-sidebar="footer"
|
|
351
|
-
className={cn(
|
|
336
|
+
className={cn('flex flex-col gap-2 p-2', className)}
|
|
352
337
|
{...props}
|
|
353
338
|
/>
|
|
354
339
|
)
|
|
355
340
|
}
|
|
356
341
|
|
|
357
|
-
function SidebarSeparator({
|
|
358
|
-
className,
|
|
359
|
-
...props
|
|
360
|
-
}: React.ComponentProps<typeof Separator>) {
|
|
342
|
+
function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
|
|
361
343
|
return (
|
|
362
344
|
<Separator
|
|
363
345
|
data-slot="sidebar-separator"
|
|
364
346
|
data-sidebar="separator"
|
|
365
|
-
className={cn(
|
|
347
|
+
className={cn('mx-2 w-auto bg-sidebar-border', className)}
|
|
366
348
|
{...props}
|
|
367
349
|
/>
|
|
368
350
|
)
|
|
369
351
|
}
|
|
370
352
|
|
|
371
|
-
function SidebarContent({ className, ...props }: React.ComponentProps<
|
|
353
|
+
function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
372
354
|
return (
|
|
373
355
|
<div
|
|
374
356
|
data-slot="sidebar-content"
|
|
375
357
|
data-sidebar="content"
|
|
376
358
|
className={cn(
|
|
377
|
-
|
|
378
|
-
className
|
|
359
|
+
'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
|
|
360
|
+
className,
|
|
379
361
|
)}
|
|
380
362
|
{...props}
|
|
381
363
|
/>
|
|
382
364
|
)
|
|
383
365
|
}
|
|
384
366
|
|
|
385
|
-
function SidebarGroup({ className, ...props }: React.ComponentProps<
|
|
367
|
+
function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
386
368
|
return (
|
|
387
369
|
<div
|
|
388
370
|
data-slot="sidebar-group"
|
|
389
371
|
data-sidebar="group"
|
|
390
|
-
className={cn(
|
|
372
|
+
className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
|
|
391
373
|
{...props}
|
|
392
374
|
/>
|
|
393
375
|
)
|
|
@@ -397,17 +379,17 @@ function SidebarGroupLabel({
|
|
|
397
379
|
className,
|
|
398
380
|
asChild = false,
|
|
399
381
|
...props
|
|
400
|
-
}: React.ComponentProps<
|
|
401
|
-
const Comp = asChild ? Slot.Root :
|
|
382
|
+
}: React.ComponentProps<'div'> & { asChild?: boolean }) {
|
|
383
|
+
const Comp = asChild ? Slot.Root : 'div'
|
|
402
384
|
|
|
403
385
|
return (
|
|
404
386
|
<Comp
|
|
405
387
|
data-slot="sidebar-group-label"
|
|
406
388
|
data-sidebar="group-label"
|
|
407
389
|
className={cn(
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
className
|
|
390
|
+
'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 focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
391
|
+
'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
|
|
392
|
+
className,
|
|
411
393
|
)}
|
|
412
394
|
{...props}
|
|
413
395
|
/>
|
|
@@ -418,97 +400,94 @@ function SidebarGroupAction({
|
|
|
418
400
|
className,
|
|
419
401
|
asChild = false,
|
|
420
402
|
...props
|
|
421
|
-
}: React.ComponentProps<
|
|
422
|
-
const Comp = asChild ? Slot.Root :
|
|
403
|
+
}: React.ComponentProps<'button'> & { asChild?: boolean }) {
|
|
404
|
+
const Comp = asChild ? Slot.Root : 'button'
|
|
423
405
|
|
|
424
406
|
return (
|
|
425
407
|
<Comp
|
|
426
408
|
data-slot="sidebar-group-action"
|
|
427
409
|
data-sidebar="group-action"
|
|
428
410
|
className={cn(
|
|
429
|
-
|
|
411
|
+
'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 hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
430
412
|
// Increases the hit area of the button on mobile.
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
className
|
|
413
|
+
'after:absolute after:-inset-2 md:after:hidden',
|
|
414
|
+
'group-data-[collapsible=icon]:hidden',
|
|
415
|
+
className,
|
|
434
416
|
)}
|
|
435
417
|
{...props}
|
|
436
418
|
/>
|
|
437
419
|
)
|
|
438
420
|
}
|
|
439
421
|
|
|
440
|
-
function SidebarGroupContent({
|
|
441
|
-
className,
|
|
442
|
-
...props
|
|
443
|
-
}: React.ComponentProps<"div">) {
|
|
422
|
+
function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
444
423
|
return (
|
|
445
424
|
<div
|
|
446
425
|
data-slot="sidebar-group-content"
|
|
447
426
|
data-sidebar="group-content"
|
|
448
|
-
className={cn(
|
|
427
|
+
className={cn('w-full text-sm', className)}
|
|
449
428
|
{...props}
|
|
450
429
|
/>
|
|
451
430
|
)
|
|
452
431
|
}
|
|
453
432
|
|
|
454
|
-
function SidebarMenu({ className, ...props }: React.ComponentProps<
|
|
433
|
+
function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
455
434
|
return (
|
|
456
435
|
<ul
|
|
457
436
|
data-slot="sidebar-menu"
|
|
458
437
|
data-sidebar="menu"
|
|
459
|
-
className={cn(
|
|
438
|
+
className={cn('flex w-full min-w-0 flex-col gap-1', className)}
|
|
460
439
|
{...props}
|
|
461
440
|
/>
|
|
462
441
|
)
|
|
463
442
|
}
|
|
464
443
|
|
|
465
|
-
function SidebarMenuItem({ className, ...props }: React.ComponentProps<
|
|
444
|
+
function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {
|
|
466
445
|
return (
|
|
467
446
|
<li
|
|
468
447
|
data-slot="sidebar-menu-item"
|
|
469
448
|
data-sidebar="menu-item"
|
|
470
|
-
className={cn(
|
|
449
|
+
className={cn('group/menu-item relative', className)}
|
|
471
450
|
{...props}
|
|
472
451
|
/>
|
|
473
452
|
)
|
|
474
453
|
}
|
|
475
454
|
|
|
476
455
|
const sidebarMenuButtonVariants = cva(
|
|
477
|
-
|
|
456
|
+
'peer/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-[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 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
|
|
478
457
|
{
|
|
479
458
|
variants: {
|
|
480
459
|
variant: {
|
|
481
|
-
default:
|
|
460
|
+
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
482
461
|
outline:
|
|
483
|
-
|
|
462
|
+
'bg-background shadow-[0_0_0_1px_var(--sidebar-border)] hover:bg-sidebar-accent hover:text-sidebar-accent-foreground hover:shadow-[0_0_0_1px_var(--sidebar-accent)]',
|
|
484
463
|
},
|
|
485
464
|
size: {
|
|
486
|
-
default:
|
|
487
|
-
sm:
|
|
488
|
-
lg:
|
|
465
|
+
default: 'h-8 text-sm',
|
|
466
|
+
sm: 'h-7 text-xs',
|
|
467
|
+
lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',
|
|
489
468
|
},
|
|
490
469
|
},
|
|
491
470
|
defaultVariants: {
|
|
492
|
-
variant:
|
|
493
|
-
size:
|
|
471
|
+
variant: 'default',
|
|
472
|
+
size: 'default',
|
|
494
473
|
},
|
|
495
|
-
}
|
|
474
|
+
},
|
|
496
475
|
)
|
|
497
476
|
|
|
498
477
|
function SidebarMenuButton({
|
|
499
478
|
asChild = false,
|
|
500
479
|
isActive = false,
|
|
501
|
-
variant =
|
|
502
|
-
size =
|
|
480
|
+
variant = 'default',
|
|
481
|
+
size = 'default',
|
|
503
482
|
tooltip,
|
|
504
483
|
className,
|
|
505
484
|
...props
|
|
506
|
-
}: React.ComponentProps<
|
|
485
|
+
}: React.ComponentProps<'button'> & {
|
|
507
486
|
asChild?: boolean
|
|
508
487
|
isActive?: boolean
|
|
509
488
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>
|
|
510
489
|
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
511
|
-
const Comp = asChild ? Slot.Root :
|
|
490
|
+
const Comp = asChild ? Slot.Root : 'button'
|
|
512
491
|
const { isMobile, state } = useSidebar()
|
|
513
492
|
|
|
514
493
|
const button = (
|
|
@@ -526,7 +505,7 @@ function SidebarMenuButton({
|
|
|
526
505
|
return button
|
|
527
506
|
}
|
|
528
507
|
|
|
529
|
-
if (typeof tooltip ===
|
|
508
|
+
if (typeof tooltip === 'string') {
|
|
530
509
|
tooltip = {
|
|
531
510
|
children: tooltip,
|
|
532
511
|
}
|
|
@@ -538,7 +517,7 @@ function SidebarMenuButton({
|
|
|
538
517
|
<TooltipContent
|
|
539
518
|
side="right"
|
|
540
519
|
align="center"
|
|
541
|
-
hidden={state !==
|
|
520
|
+
hidden={state !== 'collapsed' || isMobile}
|
|
542
521
|
{...tooltip}
|
|
543
522
|
/>
|
|
544
523
|
</Tooltip>
|
|
@@ -550,49 +529,46 @@ function SidebarMenuAction({
|
|
|
550
529
|
asChild = false,
|
|
551
530
|
showOnHover = false,
|
|
552
531
|
...props
|
|
553
|
-
}: React.ComponentProps<
|
|
532
|
+
}: React.ComponentProps<'button'> & {
|
|
554
533
|
asChild?: boolean
|
|
555
534
|
showOnHover?: boolean
|
|
556
535
|
}) {
|
|
557
|
-
const Comp = asChild ? Slot.Root :
|
|
536
|
+
const Comp = asChild ? Slot.Root : 'button'
|
|
558
537
|
|
|
559
538
|
return (
|
|
560
539
|
<Comp
|
|
561
540
|
data-slot="sidebar-menu-action"
|
|
562
541
|
data-sidebar="menu-action"
|
|
563
542
|
className={cn(
|
|
564
|
-
|
|
543
|
+
'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 peer-hover/menu-button:text-sidebar-accent-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
565
544
|
// Increases the hit area of the button on mobile.
|
|
566
|
-
|
|
567
|
-
|
|
568
|
-
|
|
569
|
-
|
|
570
|
-
|
|
545
|
+
'after:absolute after:-inset-2 md:after:hidden',
|
|
546
|
+
'peer-data-[size=sm]/menu-button:top-1',
|
|
547
|
+
'peer-data-[size=default]/menu-button:top-1.5',
|
|
548
|
+
'peer-data-[size=lg]/menu-button:top-2.5',
|
|
549
|
+
'group-data-[collapsible=icon]:hidden',
|
|
571
550
|
showOnHover &&
|
|
572
|
-
|
|
573
|
-
className
|
|
551
|
+
'group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 peer-data-[active=true]/menu-button:text-sidebar-accent-foreground data-[state=open]:opacity-100 md:opacity-0',
|
|
552
|
+
className,
|
|
574
553
|
)}
|
|
575
554
|
{...props}
|
|
576
555
|
/>
|
|
577
556
|
)
|
|
578
557
|
}
|
|
579
558
|
|
|
580
|
-
function SidebarMenuBadge({
|
|
581
|
-
className,
|
|
582
|
-
...props
|
|
583
|
-
}: React.ComponentProps<"div">) {
|
|
559
|
+
function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>) {
|
|
584
560
|
return (
|
|
585
561
|
<div
|
|
586
562
|
data-slot="sidebar-menu-badge"
|
|
587
563
|
data-sidebar="menu-badge"
|
|
588
564
|
className={cn(
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
className
|
|
565
|
+
'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',
|
|
566
|
+
'peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground',
|
|
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
|
+
className,
|
|
596
572
|
)}
|
|
597
573
|
{...props}
|
|
598
574
|
/>
|
|
@@ -603,7 +579,7 @@ function SidebarMenuSkeleton({
|
|
|
603
579
|
className,
|
|
604
580
|
showIcon = false,
|
|
605
581
|
...props
|
|
606
|
-
}: React.ComponentProps<
|
|
582
|
+
}: React.ComponentProps<'div'> & {
|
|
607
583
|
showIcon?: boolean
|
|
608
584
|
}) {
|
|
609
585
|
// Random width between 50 to 90%.
|
|
@@ -615,21 +591,16 @@ function SidebarMenuSkeleton({
|
|
|
615
591
|
<div
|
|
616
592
|
data-slot="sidebar-menu-skeleton"
|
|
617
593
|
data-sidebar="menu-skeleton"
|
|
618
|
-
className={cn(
|
|
594
|
+
className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
|
|
619
595
|
{...props}
|
|
620
596
|
>
|
|
621
|
-
{showIcon &&
|
|
622
|
-
<Skeleton
|
|
623
|
-
className="size-4 rounded-md"
|
|
624
|
-
data-sidebar="menu-skeleton-icon"
|
|
625
|
-
/>
|
|
626
|
-
)}
|
|
597
|
+
{showIcon && <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />}
|
|
627
598
|
<Skeleton
|
|
628
599
|
className="h-4 max-w-(--skeleton-width) flex-1"
|
|
629
600
|
data-sidebar="menu-skeleton-text"
|
|
630
601
|
style={
|
|
631
602
|
{
|
|
632
|
-
|
|
603
|
+
'--skeleton-width': width,
|
|
633
604
|
} as React.CSSProperties
|
|
634
605
|
}
|
|
635
606
|
/>
|
|
@@ -637,30 +608,27 @@ function SidebarMenuSkeleton({
|
|
|
637
608
|
)
|
|
638
609
|
}
|
|
639
610
|
|
|
640
|
-
function SidebarMenuSub({ className, ...props }: React.ComponentProps<
|
|
611
|
+
function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
641
612
|
return (
|
|
642
613
|
<ul
|
|
643
614
|
data-slot="sidebar-menu-sub"
|
|
644
615
|
data-sidebar="menu-sub"
|
|
645
616
|
className={cn(
|
|
646
|
-
|
|
647
|
-
|
|
648
|
-
className
|
|
617
|
+
'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',
|
|
618
|
+
'group-data-[collapsible=icon]:hidden',
|
|
619
|
+
className,
|
|
649
620
|
)}
|
|
650
621
|
{...props}
|
|
651
622
|
/>
|
|
652
623
|
)
|
|
653
624
|
}
|
|
654
625
|
|
|
655
|
-
function SidebarMenuSubItem({
|
|
656
|
-
className,
|
|
657
|
-
...props
|
|
658
|
-
}: React.ComponentProps<"li">) {
|
|
626
|
+
function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {
|
|
659
627
|
return (
|
|
660
628
|
<li
|
|
661
629
|
data-slot="sidebar-menu-sub-item"
|
|
662
630
|
data-sidebar="menu-sub-item"
|
|
663
|
-
className={cn(
|
|
631
|
+
className={cn('group/menu-sub-item relative', className)}
|
|
664
632
|
{...props}
|
|
665
633
|
/>
|
|
666
634
|
)
|
|
@@ -668,16 +636,16 @@ function SidebarMenuSubItem({
|
|
|
668
636
|
|
|
669
637
|
function SidebarMenuSubButton({
|
|
670
638
|
asChild = false,
|
|
671
|
-
size =
|
|
639
|
+
size = 'md',
|
|
672
640
|
isActive = false,
|
|
673
641
|
className,
|
|
674
642
|
...props
|
|
675
|
-
}: React.ComponentProps<
|
|
643
|
+
}: React.ComponentProps<'a'> & {
|
|
676
644
|
asChild?: boolean
|
|
677
|
-
size?:
|
|
645
|
+
size?: 'sm' | 'md'
|
|
678
646
|
isActive?: boolean
|
|
679
647
|
}) {
|
|
680
|
-
const Comp = asChild ? Slot.Root :
|
|
648
|
+
const Comp = asChild ? Slot.Root : 'a'
|
|
681
649
|
|
|
682
650
|
return (
|
|
683
651
|
<Comp
|
|
@@ -686,12 +654,12 @@ function SidebarMenuSubButton({
|
|
|
686
654
|
data-size={size}
|
|
687
655
|
data-active={isActive}
|
|
688
656
|
className={cn(
|
|
689
|
-
|
|
690
|
-
|
|
691
|
-
size ===
|
|
692
|
-
size ===
|
|
693
|
-
|
|
694
|
-
className
|
|
657
|
+
'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 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 [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0 [&>svg]:text-sidebar-accent-foreground',
|
|
658
|
+
'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
|
|
659
|
+
size === 'sm' && 'text-xs',
|
|
660
|
+
size === 'md' && 'text-sm',
|
|
661
|
+
'group-data-[collapsible=icon]:hidden',
|
|
662
|
+
className,
|
|
695
663
|
)}
|
|
696
664
|
{...props}
|
|
697
665
|
/>
|