create-auto-app 1.34.0 → 1.36.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +2 -2
- package/templates/typical/.gitignore +1 -1
- package/templates/typical/auto.config.ts +85 -80
- package/templates/typical/client/.gitignore +0 -4
- package/templates/typical/client/.storybook/main.ts +0 -66
- package/templates/typical/client/.storybook/manager-head.html +0 -154
- package/templates/typical/client/.storybook/manager.ts +0 -164
- package/templates/typical/client/.storybook/preview-head.html +0 -31
- package/templates/typical/client/.storybook/preview.tsx +0 -120
- package/templates/typical/client/codegen.ts +0 -17
- package/templates/typical/client/components.json +0 -29
- package/templates/typical/client/index.html +0 -12
- package/templates/typical/client/package.json +0 -69
- package/templates/typical/client/pnpm-lock.yaml +0 -7868
- package/templates/typical/client/public/blank.svg +0 -1
- package/templates/typical/client/public/mockServiceWorker.js +0 -336
- package/templates/typical/client/src/App.tsx +0 -29
- package/templates/typical/client/src/components/.gitkeep +0 -0
- package/templates/typical/client/src/components/ui/Accordion.stories.tsx +0 -49
- package/templates/typical/client/src/components/ui/Accordion.tsx +0 -55
- package/templates/typical/client/src/components/ui/Alert.stories.tsx +0 -29
- package/templates/typical/client/src/components/ui/Alert.tsx +0 -56
- package/templates/typical/client/src/components/ui/AlertDialog.stories.tsx +0 -67
- package/templates/typical/client/src/components/ui/AlertDialog.tsx +0 -178
- package/templates/typical/client/src/components/ui/AspectRatio.stories.tsx +0 -35
- package/templates/typical/client/src/components/ui/AspectRatio.tsx +0 -13
- package/templates/typical/client/src/components/ui/Avatar.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/Avatar.tsx +0 -98
- package/templates/typical/client/src/components/ui/Badge.stories.tsx +0 -41
- package/templates/typical/client/src/components/ui/Badge.tsx +0 -45
- package/templates/typical/client/src/components/ui/Breadcrumb.stories.tsx +0 -54
- package/templates/typical/client/src/components/ui/Breadcrumb.tsx +0 -104
- package/templates/typical/client/src/components/ui/Button.stories.tsx +0 -102
- package/templates/typical/client/src/components/ui/Button.tsx +0 -67
- package/templates/typical/client/src/components/ui/ButtonGroup.stories.tsx +0 -32
- package/templates/typical/client/src/components/ui/ButtonGroup.tsx +0 -81
- package/templates/typical/client/src/components/ui/Calendar.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/Calendar.tsx +0 -165
- package/templates/typical/client/src/components/ui/Card.stories.tsx +0 -44
- package/templates/typical/client/src/components/ui/Card.tsx +0 -66
- package/templates/typical/client/src/components/ui/Carousel.stories.tsx +0 -56
- package/templates/typical/client/src/components/ui/Carousel.tsx +0 -225
- package/templates/typical/client/src/components/ui/Chart.stories.tsx +0 -39
- package/templates/typical/client/src/components/ui/Chart.tsx +0 -305
- package/templates/typical/client/src/components/ui/Checkbox.stories.tsx +0 -35
- package/templates/typical/client/src/components/ui/Checkbox.tsx +0 -30
- package/templates/typical/client/src/components/ui/Collapsible.stories.tsx +0 -58
- package/templates/typical/client/src/components/ui/Collapsible.tsx +0 -18
- package/templates/typical/client/src/components/ui/Combobox.stories.tsx +0 -75
- package/templates/typical/client/src/components/ui/Combobox.tsx +0 -296
- package/templates/typical/client/src/components/ui/Command.stories.tsx +0 -71
- package/templates/typical/client/src/components/ui/Command.tsx +0 -157
- package/templates/typical/client/src/components/ui/ContextMenu.stories.tsx +0 -68
- package/templates/typical/client/src/components/ui/ContextMenu.tsx +0 -231
- package/templates/typical/client/src/components/ui/DesignSystem-Colors.mdx +0 -68
- package/templates/typical/client/src/components/ui/DesignSystem-Colors.stories.tsx +0 -117
- package/templates/typical/client/src/components/ui/DesignSystem-Layout.mdx +0 -64
- package/templates/typical/client/src/components/ui/DesignSystem-Layout.stories.tsx +0 -167
- package/templates/typical/client/src/components/ui/DesignSystem-Overview.stories.tsx +0 -748
- package/templates/typical/client/src/components/ui/DesignSystem-Typography.mdx +0 -31
- package/templates/typical/client/src/components/ui/DesignSystem-Typography.stories.tsx +0 -80
- package/templates/typical/client/src/components/ui/Dialog.stories.tsx +0 -74
- package/templates/typical/client/src/components/ui/Dialog.tsx +0 -154
- package/templates/typical/client/src/components/ui/Direction.stories.tsx +0 -38
- package/templates/typical/client/src/components/ui/Direction.tsx +0 -24
- package/templates/typical/client/src/components/ui/Drawer.stories.tsx +0 -70
- package/templates/typical/client/src/components/ui/Drawer.tsx +0 -124
- package/templates/typical/client/src/components/ui/DropdownMenu.stories.tsx +0 -74
- package/templates/typical/client/src/components/ui/DropdownMenu.tsx +0 -239
- package/templates/typical/client/src/components/ui/Empty.stories.tsx +0 -37
- package/templates/typical/client/src/components/ui/Empty.tsx +0 -98
- package/templates/typical/client/src/components/ui/Field.stories.tsx +0 -50
- package/templates/typical/client/src/components/ui/Field.tsx +0 -251
- package/templates/typical/client/src/components/ui/Form.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/Form.tsx +0 -148
- package/templates/typical/client/src/components/ui/HoverCard.stories.tsx +0 -49
- package/templates/typical/client/src/components/ui/HoverCard.tsx +0 -39
- package/templates/typical/client/src/components/ui/Input.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Input.tsx +0 -22
- package/templates/typical/client/src/components/ui/InputGroup.stories.tsx +0 -53
- package/templates/typical/client/src/components/ui/InputGroup.tsx +0 -153
- package/templates/typical/client/src/components/ui/InputOTP.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/InputOTP.tsx +0 -72
- package/templates/typical/client/src/components/ui/Item.stories.tsx +0 -64
- package/templates/typical/client/src/components/ui/Item.tsx +0 -168
- package/templates/typical/client/src/components/ui/Kbd.stories.tsx +0 -59
- package/templates/typical/client/src/components/ui/Kbd.tsx +0 -22
- package/templates/typical/client/src/components/ui/Label.stories.tsx +0 -90
- package/templates/typical/client/src/components/ui/Label.tsx +0 -44
- package/templates/typical/client/src/components/ui/Menubar.stories.tsx +0 -78
- package/templates/typical/client/src/components/ui/Menubar.tsx +0 -251
- package/templates/typical/client/src/components/ui/NativeSelect.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/NativeSelect.tsx +0 -50
- package/templates/typical/client/src/components/ui/NavigationMenu.stories.tsx +0 -80
- package/templates/typical/client/src/components/ui/NavigationMenu.tsx +0 -152
- package/templates/typical/client/src/components/ui/Pagination.stories.tsx +0 -77
- package/templates/typical/client/src/components/ui/Pagination.tsx +0 -108
- package/templates/typical/client/src/components/ui/Popover.stories.tsx +0 -53
- package/templates/typical/client/src/components/ui/Popover.tsx +0 -57
- package/templates/typical/client/src/components/ui/Progress.stories.tsx +0 -32
- package/templates/typical/client/src/components/ui/Progress.tsx +0 -25
- package/templates/typical/client/src/components/ui/RadioGroup.stories.tsx +0 -50
- package/templates/typical/client/src/components/ui/RadioGroup.tsx +0 -36
- package/templates/typical/client/src/components/ui/Resizable.stories.tsx +0 -72
- package/templates/typical/client/src/components/ui/Resizable.tsx +0 -54
- package/templates/typical/client/src/components/ui/ScrollArea.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/ScrollArea.tsx +0 -51
- package/templates/typical/client/src/components/ui/Select.stories.tsx +0 -59
- package/templates/typical/client/src/components/ui/Select.tsx +0 -171
- package/templates/typical/client/src/components/ui/Separator.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Separator.tsx +0 -27
- package/templates/typical/client/src/components/ui/Sheet.stories.tsx +0 -68
- package/templates/typical/client/src/components/ui/Sheet.tsx +0 -115
- package/templates/typical/client/src/components/ui/Sidebar.stories.tsx +0 -96
- package/templates/typical/client/src/components/ui/Sidebar.tsx +0 -695
- package/templates/typical/client/src/components/ui/Skeleton.stories.tsx +0 -40
- package/templates/typical/client/src/components/ui/Skeleton.tsx +0 -11
- package/templates/typical/client/src/components/ui/Slider.stories.tsx +0 -24
- package/templates/typical/client/src/components/ui/Slider.tsx +0 -55
- package/templates/typical/client/src/components/ui/Sonner.stories.tsx +0 -45
- package/templates/typical/client/src/components/ui/Sonner.tsx +0 -38
- package/templates/typical/client/src/components/ui/Spinner.stories.tsx +0 -26
- package/templates/typical/client/src/components/ui/Spinner.tsx +0 -13
- package/templates/typical/client/src/components/ui/Switch.stories.tsx +0 -39
- package/templates/typical/client/src/components/ui/Switch.tsx +0 -35
- package/templates/typical/client/src/components/ui/Table.stories.tsx +0 -67
- package/templates/typical/client/src/components/ui/Table.tsx +0 -86
- package/templates/typical/client/src/components/ui/Tabs.stories.tsx +0 -53
- package/templates/typical/client/src/components/ui/Tabs.tsx +0 -75
- package/templates/typical/client/src/components/ui/Textarea.stories.tsx +0 -27
- package/templates/typical/client/src/components/ui/Textarea.tsx +0 -22
- package/templates/typical/client/src/components/ui/Toast.stories.tsx +0 -116
- package/templates/typical/client/src/components/ui/Toast.tsx +0 -123
- package/templates/typical/client/src/components/ui/Toaster.tsx +0 -32
- package/templates/typical/client/src/components/ui/Toggle.stories.tsx +0 -44
- package/templates/typical/client/src/components/ui/Toggle.tsx +0 -42
- package/templates/typical/client/src/components/ui/ToggleGroup.stories.tsx +0 -61
- package/templates/typical/client/src/components/ui/ToggleGroup.tsx +0 -83
- package/templates/typical/client/src/components/ui/Tooltip.stories.tsx +0 -42
- package/templates/typical/client/src/components/ui/Tooltip.tsx +0 -48
- package/templates/typical/client/src/gql/execute.ts +0 -11
- package/templates/typical/client/src/gql/fragment-masking.ts +0 -83
- package/templates/typical/client/src/gql/gql.ts +0 -9
- package/templates/typical/client/src/gql/graphql.ts +0 -182
- package/templates/typical/client/src/gql/index.ts +0 -2
- package/templates/typical/client/src/graphql/mutations.ts +0 -0
- package/templates/typical/client/src/graphql/queries.ts +0 -0
- package/templates/typical/client/src/hooks/.gitkeep +0 -0
- package/templates/typical/client/src/hooks/use-mobile.ts +0 -19
- package/templates/typical/client/src/hooks/use-toast.ts +0 -186
- package/templates/typical/client/src/index.css +0 -121
- package/templates/typical/client/src/lib/utils.ts +0 -6
- package/templates/typical/client/src/main.tsx +0 -5
- package/templates/typical/client/tsconfig.app.json +0 -26
- package/templates/typical/client/tsconfig.json +0 -10
- package/templates/typical/client/vite.config.ts +0 -50
|
@@ -1,695 +0,0 @@
|
|
|
1
|
-
import * as React from 'react';
|
|
2
|
-
import { cva, type VariantProps } from 'class-variance-authority';
|
|
3
|
-
import { PanelLeftIcon } from 'lucide-react';
|
|
4
|
-
import { Slot } from 'radix-ui';
|
|
5
|
-
|
|
6
|
-
import { useIsMobile } from '@/hooks/use-mobile';
|
|
7
|
-
import { cn } from '@/lib/utils';
|
|
8
|
-
import { Button } from '@/components/ui/Button';
|
|
9
|
-
import { Input } from '@/components/ui/Input';
|
|
10
|
-
import { Separator } from '@/components/ui/Separator';
|
|
11
|
-
import { Sheet, SheetContent, SheetDescription, SheetHeader, SheetTitle } from '@/components/ui/Sheet';
|
|
12
|
-
import { Skeleton } from '@/components/ui/Skeleton';
|
|
13
|
-
import { Tooltip, TooltipContent, TooltipProvider, TooltipTrigger } from '@/components/ui/Tooltip';
|
|
14
|
-
|
|
15
|
-
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
16
|
-
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
17
|
-
const SIDEBAR_WIDTH = '16rem';
|
|
18
|
-
const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
19
|
-
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
20
|
-
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
21
|
-
|
|
22
|
-
type SidebarContextProps = {
|
|
23
|
-
state: 'expanded' | 'collapsed';
|
|
24
|
-
open: boolean;
|
|
25
|
-
setOpen: (open: boolean) => void;
|
|
26
|
-
openMobile: boolean;
|
|
27
|
-
setOpenMobile: (open: boolean) => void;
|
|
28
|
-
isMobile: boolean;
|
|
29
|
-
toggleSidebar: () => void;
|
|
30
|
-
};
|
|
31
|
-
|
|
32
|
-
const SidebarContext = React.createContext<SidebarContextProps | null>(null);
|
|
33
|
-
|
|
34
|
-
function useSidebar() {
|
|
35
|
-
const context = React.useContext(SidebarContext);
|
|
36
|
-
if (!context) {
|
|
37
|
-
throw new Error('useSidebar must be used within a SidebarProvider.');
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
return context;
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
/**
|
|
44
|
-
* Context provider that manages sidebar open/collapsed state, mobile responsiveness, and keyboard shortcut (Cmd+B).
|
|
45
|
-
* Wrap your layout with this to enable sidebar state management for all child Sidebar components.
|
|
46
|
-
*/
|
|
47
|
-
function SidebarProvider({
|
|
48
|
-
defaultOpen = true,
|
|
49
|
-
open: openProp,
|
|
50
|
-
onOpenChange: setOpenProp,
|
|
51
|
-
className,
|
|
52
|
-
style,
|
|
53
|
-
children,
|
|
54
|
-
...props
|
|
55
|
-
}: React.ComponentProps<'div'> & {
|
|
56
|
-
defaultOpen?: boolean;
|
|
57
|
-
open?: boolean;
|
|
58
|
-
onOpenChange?: (open: boolean) => void;
|
|
59
|
-
}) {
|
|
60
|
-
const isMobile = useIsMobile();
|
|
61
|
-
const [openMobile, setOpenMobile] = React.useState(false);
|
|
62
|
-
|
|
63
|
-
// This is the internal state of the sidebar.
|
|
64
|
-
// We use openProp and setOpenProp for control from outside the component.
|
|
65
|
-
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
66
|
-
const open = openProp ?? _open;
|
|
67
|
-
const setOpen = React.useCallback(
|
|
68
|
-
(value: boolean | ((value: boolean) => boolean)) => {
|
|
69
|
-
const openState = typeof value === 'function' ? value(open) : value;
|
|
70
|
-
if (setOpenProp) {
|
|
71
|
-
setOpenProp(openState);
|
|
72
|
-
} else {
|
|
73
|
-
_setOpen(openState);
|
|
74
|
-
}
|
|
75
|
-
|
|
76
|
-
// This sets the cookie to keep the sidebar state.
|
|
77
|
-
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
78
|
-
},
|
|
79
|
-
[setOpenProp, open],
|
|
80
|
-
);
|
|
81
|
-
|
|
82
|
-
// Helper to toggle the sidebar.
|
|
83
|
-
const toggleSidebar = React.useCallback(() => {
|
|
84
|
-
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
85
|
-
}, [isMobile, setOpen, setOpenMobile]);
|
|
86
|
-
|
|
87
|
-
// Adds a keyboard shortcut to toggle the sidebar.
|
|
88
|
-
React.useEffect(() => {
|
|
89
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
90
|
-
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
91
|
-
event.preventDefault();
|
|
92
|
-
toggleSidebar();
|
|
93
|
-
}
|
|
94
|
-
};
|
|
95
|
-
|
|
96
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
97
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
98
|
-
}, [toggleSidebar]);
|
|
99
|
-
|
|
100
|
-
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
101
|
-
// This makes it easier to style the sidebar with Tailwind classes.
|
|
102
|
-
const state = open ? 'expanded' : 'collapsed';
|
|
103
|
-
|
|
104
|
-
const contextValue = React.useMemo<SidebarContextProps>(
|
|
105
|
-
() => ({
|
|
106
|
-
state,
|
|
107
|
-
open,
|
|
108
|
-
setOpen,
|
|
109
|
-
isMobile,
|
|
110
|
-
openMobile,
|
|
111
|
-
setOpenMobile,
|
|
112
|
-
toggleSidebar,
|
|
113
|
-
}),
|
|
114
|
-
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
|
|
115
|
-
);
|
|
116
|
-
|
|
117
|
-
return (
|
|
118
|
-
<SidebarContext.Provider value={contextValue}>
|
|
119
|
-
<TooltipProvider delayDuration={0}>
|
|
120
|
-
<div
|
|
121
|
-
data-slot="sidebar-wrapper"
|
|
122
|
-
style={
|
|
123
|
-
{
|
|
124
|
-
'--sidebar-width': SIDEBAR_WIDTH,
|
|
125
|
-
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
126
|
-
...style,
|
|
127
|
-
} as React.CSSProperties
|
|
128
|
-
}
|
|
129
|
-
className={cn('group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full', className)}
|
|
130
|
-
{...props}
|
|
131
|
-
>
|
|
132
|
-
{children}
|
|
133
|
-
</div>
|
|
134
|
-
</TooltipProvider>
|
|
135
|
-
</SidebarContext.Provider>
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
/**
|
|
140
|
-
* A responsive sidebar navigation panel that collapses on mobile into a Sheet overlay.
|
|
141
|
-
* Supports left/right placement, multiple visual variants (sidebar, floating, inset), and collapsible modes (offcanvas, icon, none).
|
|
142
|
-
*/
|
|
143
|
-
function Sidebar({
|
|
144
|
-
/** Which edge of the viewport the sidebar is placed on. */
|
|
145
|
-
side = 'left',
|
|
146
|
-
/** Visual style: "sidebar" (bordered), "floating" (rounded with shadow), or "inset" (embedded). */
|
|
147
|
-
variant = 'sidebar',
|
|
148
|
-
/** Collapse behavior: "offcanvas" (slides off-screen), "icon" (collapses to icon width), or "none" (always visible). */
|
|
149
|
-
collapsible = 'offcanvas',
|
|
150
|
-
className,
|
|
151
|
-
children,
|
|
152
|
-
...props
|
|
153
|
-
}: React.ComponentProps<'div'> & {
|
|
154
|
-
side?: 'left' | 'right';
|
|
155
|
-
variant?: 'sidebar' | 'floating' | 'inset';
|
|
156
|
-
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
157
|
-
}) {
|
|
158
|
-
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
159
|
-
|
|
160
|
-
if (collapsible === 'none') {
|
|
161
|
-
return (
|
|
162
|
-
<div
|
|
163
|
-
data-slot="sidebar"
|
|
164
|
-
className={cn('bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col', className)}
|
|
165
|
-
{...props}
|
|
166
|
-
>
|
|
167
|
-
{children}
|
|
168
|
-
</div>
|
|
169
|
-
);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
if (isMobile) {
|
|
173
|
-
return (
|
|
174
|
-
<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
175
|
-
<SheetContent
|
|
176
|
-
data-sidebar="sidebar"
|
|
177
|
-
data-slot="sidebar"
|
|
178
|
-
data-mobile="true"
|
|
179
|
-
className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
|
|
180
|
-
style={
|
|
181
|
-
{
|
|
182
|
-
'--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
183
|
-
} as React.CSSProperties
|
|
184
|
-
}
|
|
185
|
-
side={side}
|
|
186
|
-
>
|
|
187
|
-
<SheetHeader className="sr-only">
|
|
188
|
-
<SheetTitle>Sidebar</SheetTitle>
|
|
189
|
-
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
190
|
-
</SheetHeader>
|
|
191
|
-
<div className="flex h-full w-full flex-col">{children}</div>
|
|
192
|
-
</SheetContent>
|
|
193
|
-
</Sheet>
|
|
194
|
-
);
|
|
195
|
-
}
|
|
196
|
-
|
|
197
|
-
return (
|
|
198
|
-
<div
|
|
199
|
-
className="group peer text-sidebar-foreground hidden md:block"
|
|
200
|
-
data-state={state}
|
|
201
|
-
data-collapsible={state === 'collapsed' ? collapsible : ''}
|
|
202
|
-
data-variant={variant}
|
|
203
|
-
data-side={side}
|
|
204
|
-
data-slot="sidebar"
|
|
205
|
-
>
|
|
206
|
-
{/* This is what handles the sidebar gap on desktop */}
|
|
207
|
-
<div
|
|
208
|
-
data-slot="sidebar-gap"
|
|
209
|
-
className={cn(
|
|
210
|
-
'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',
|
|
211
|
-
'group-data-[collapsible=offcanvas]:w-0',
|
|
212
|
-
'group-data-[side=right]:rotate-180',
|
|
213
|
-
variant === 'floating' || variant === 'inset'
|
|
214
|
-
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
215
|
-
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',
|
|
216
|
-
)}
|
|
217
|
-
/>
|
|
218
|
-
<div
|
|
219
|
-
data-slot="sidebar-container"
|
|
220
|
-
className={cn(
|
|
221
|
-
'fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex',
|
|
222
|
-
side === 'left'
|
|
223
|
-
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
224
|
-
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
225
|
-
// Adjust the padding for floating and inset variants.
|
|
226
|
-
variant === 'floating' || variant === 'inset'
|
|
227
|
-
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
228
|
-
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
229
|
-
className,
|
|
230
|
-
)}
|
|
231
|
-
{...props}
|
|
232
|
-
>
|
|
233
|
-
<div
|
|
234
|
-
data-sidebar="sidebar"
|
|
235
|
-
data-slot="sidebar-inner"
|
|
236
|
-
className="bg-sidebar group-data-[variant=floating]:border-sidebar-border flex h-full w-full flex-col group-data-[variant=floating]:rounded-lg group-data-[variant=floating]:border group-data-[variant=floating]:shadow-sm"
|
|
237
|
-
>
|
|
238
|
-
{children}
|
|
239
|
-
</div>
|
|
240
|
-
</div>
|
|
241
|
-
</div>
|
|
242
|
-
);
|
|
243
|
-
}
|
|
244
|
-
|
|
245
|
-
/** A button that toggles the sidebar open/closed state. */
|
|
246
|
-
function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
|
|
247
|
-
const { toggleSidebar } = useSidebar();
|
|
248
|
-
|
|
249
|
-
return (
|
|
250
|
-
<Button
|
|
251
|
-
data-sidebar="trigger"
|
|
252
|
-
data-slot="sidebar-trigger"
|
|
253
|
-
variant="ghost"
|
|
254
|
-
size="icon"
|
|
255
|
-
className={cn('size-7', className)}
|
|
256
|
-
onClick={(event) => {
|
|
257
|
-
onClick?.(event);
|
|
258
|
-
toggleSidebar();
|
|
259
|
-
}}
|
|
260
|
-
{...props}
|
|
261
|
-
>
|
|
262
|
-
<PanelLeftIcon />
|
|
263
|
-
<span className="sr-only">Toggle Sidebar</span>
|
|
264
|
-
</Button>
|
|
265
|
-
);
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/** A thin hover-activated rail along the sidebar edge that toggles collapse on click. */
|
|
269
|
-
function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
|
|
270
|
-
const { toggleSidebar } = useSidebar();
|
|
271
|
-
|
|
272
|
-
return (
|
|
273
|
-
<button
|
|
274
|
-
data-sidebar="rail"
|
|
275
|
-
data-slot="sidebar-rail"
|
|
276
|
-
aria-label="Toggle Sidebar"
|
|
277
|
-
tabIndex={-1}
|
|
278
|
-
onClick={toggleSidebar}
|
|
279
|
-
title="Toggle Sidebar"
|
|
280
|
-
className={cn(
|
|
281
|
-
'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',
|
|
282
|
-
'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
|
|
283
|
-
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
284
|
-
'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
|
|
285
|
-
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
|
|
286
|
-
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
|
|
287
|
-
className,
|
|
288
|
-
)}
|
|
289
|
-
{...props}
|
|
290
|
-
/>
|
|
291
|
-
);
|
|
292
|
-
}
|
|
293
|
-
|
|
294
|
-
/** The main content area that sits alongside the sidebar, adjusting its margin based on sidebar state. */
|
|
295
|
-
function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
|
|
296
|
-
return (
|
|
297
|
-
<main
|
|
298
|
-
data-slot="sidebar-inset"
|
|
299
|
-
className={cn(
|
|
300
|
-
'bg-background relative flex w-full flex-1 flex-col',
|
|
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,
|
|
303
|
-
)}
|
|
304
|
-
{...props}
|
|
305
|
-
/>
|
|
306
|
-
);
|
|
307
|
-
}
|
|
308
|
-
|
|
309
|
-
function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {
|
|
310
|
-
return (
|
|
311
|
-
<Input
|
|
312
|
-
data-slot="sidebar-input"
|
|
313
|
-
data-sidebar="input"
|
|
314
|
-
className={cn('bg-background h-8 w-full shadow-none', className)}
|
|
315
|
-
{...props}
|
|
316
|
-
/>
|
|
317
|
-
);
|
|
318
|
-
}
|
|
319
|
-
|
|
320
|
-
function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
321
|
-
return (
|
|
322
|
-
<div
|
|
323
|
-
data-slot="sidebar-header"
|
|
324
|
-
data-sidebar="header"
|
|
325
|
-
className={cn('flex flex-col gap-2 p-2', className)}
|
|
326
|
-
{...props}
|
|
327
|
-
/>
|
|
328
|
-
);
|
|
329
|
-
}
|
|
330
|
-
|
|
331
|
-
function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
332
|
-
return (
|
|
333
|
-
<div
|
|
334
|
-
data-slot="sidebar-footer"
|
|
335
|
-
data-sidebar="footer"
|
|
336
|
-
className={cn('flex flex-col gap-2 p-2', className)}
|
|
337
|
-
{...props}
|
|
338
|
-
/>
|
|
339
|
-
);
|
|
340
|
-
}
|
|
341
|
-
|
|
342
|
-
function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
|
|
343
|
-
return (
|
|
344
|
-
<Separator
|
|
345
|
-
data-slot="sidebar-separator"
|
|
346
|
-
data-sidebar="separator"
|
|
347
|
-
className={cn('bg-sidebar-border mx-2 w-auto', className)}
|
|
348
|
-
{...props}
|
|
349
|
-
/>
|
|
350
|
-
);
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
/** The scrollable main body area of the sidebar that holds SidebarGroup sections. */
|
|
354
|
-
function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
355
|
-
return (
|
|
356
|
-
<div
|
|
357
|
-
data-slot="sidebar-content"
|
|
358
|
-
data-sidebar="content"
|
|
359
|
-
className={cn(
|
|
360
|
-
'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
|
|
361
|
-
className,
|
|
362
|
-
)}
|
|
363
|
-
{...props}
|
|
364
|
-
/>
|
|
365
|
-
);
|
|
366
|
-
}
|
|
367
|
-
|
|
368
|
-
/** A logical grouping of sidebar menu items, optionally with a label and action button. */
|
|
369
|
-
function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
370
|
-
return (
|
|
371
|
-
<div
|
|
372
|
-
data-slot="sidebar-group"
|
|
373
|
-
data-sidebar="group"
|
|
374
|
-
className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
|
|
375
|
-
{...props}
|
|
376
|
-
/>
|
|
377
|
-
);
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
/** A small heading label for a SidebarGroup. Hidden when the sidebar is collapsed to icon mode. */
|
|
381
|
-
function SidebarGroupLabel({
|
|
382
|
-
className,
|
|
383
|
-
asChild = false,
|
|
384
|
-
...props
|
|
385
|
-
}: React.ComponentProps<'div'> & { asChild?: boolean }) {
|
|
386
|
-
const Comp = asChild ? Slot.Root : 'div';
|
|
387
|
-
|
|
388
|
-
return (
|
|
389
|
-
<Comp
|
|
390
|
-
data-slot="sidebar-group-label"
|
|
391
|
-
data-sidebar="group-label"
|
|
392
|
-
className={cn(
|
|
393
|
-
'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',
|
|
394
|
-
'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
|
|
395
|
-
className,
|
|
396
|
-
)}
|
|
397
|
-
{...props}
|
|
398
|
-
/>
|
|
399
|
-
);
|
|
400
|
-
}
|
|
401
|
-
|
|
402
|
-
function SidebarGroupAction({
|
|
403
|
-
className,
|
|
404
|
-
asChild = false,
|
|
405
|
-
...props
|
|
406
|
-
}: React.ComponentProps<'button'> & { asChild?: boolean }) {
|
|
407
|
-
const Comp = asChild ? Slot.Root : 'button';
|
|
408
|
-
|
|
409
|
-
return (
|
|
410
|
-
<Comp
|
|
411
|
-
data-slot="sidebar-group-action"
|
|
412
|
-
data-sidebar="group-action"
|
|
413
|
-
className={cn(
|
|
414
|
-
'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',
|
|
415
|
-
// Increases the hit area of the button on mobile.
|
|
416
|
-
'after:absolute after:-inset-2 md:after:hidden',
|
|
417
|
-
'group-data-[collapsible=icon]:hidden',
|
|
418
|
-
className,
|
|
419
|
-
)}
|
|
420
|
-
{...props}
|
|
421
|
-
/>
|
|
422
|
-
);
|
|
423
|
-
}
|
|
424
|
-
|
|
425
|
-
function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
426
|
-
return (
|
|
427
|
-
<div
|
|
428
|
-
data-slot="sidebar-group-content"
|
|
429
|
-
data-sidebar="group-content"
|
|
430
|
-
className={cn('w-full text-sm', className)}
|
|
431
|
-
{...props}
|
|
432
|
-
/>
|
|
433
|
-
);
|
|
434
|
-
}
|
|
435
|
-
|
|
436
|
-
function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
437
|
-
return (
|
|
438
|
-
<ul
|
|
439
|
-
data-slot="sidebar-menu"
|
|
440
|
-
data-sidebar="menu"
|
|
441
|
-
className={cn('flex w-full min-w-0 flex-col gap-1', className)}
|
|
442
|
-
{...props}
|
|
443
|
-
/>
|
|
444
|
-
);
|
|
445
|
-
}
|
|
446
|
-
|
|
447
|
-
function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {
|
|
448
|
-
return (
|
|
449
|
-
<li
|
|
450
|
-
data-slot="sidebar-menu-item"
|
|
451
|
-
data-sidebar="menu-item"
|
|
452
|
-
className={cn('group/menu-item relative', className)}
|
|
453
|
-
{...props}
|
|
454
|
-
/>
|
|
455
|
-
);
|
|
456
|
-
}
|
|
457
|
-
|
|
458
|
-
const sidebarMenuButtonVariants = cva(
|
|
459
|
-
'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',
|
|
460
|
-
{
|
|
461
|
-
variants: {
|
|
462
|
-
variant: {
|
|
463
|
-
default: 'hover:bg-sidebar-accent hover:text-sidebar-accent-foreground',
|
|
464
|
-
outline:
|
|
465
|
-
'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))]',
|
|
466
|
-
},
|
|
467
|
-
size: {
|
|
468
|
-
default: 'h-8 text-sm',
|
|
469
|
-
sm: 'h-7 text-xs',
|
|
470
|
-
lg: 'h-12 text-sm group-data-[collapsible=icon]:p-0!',
|
|
471
|
-
},
|
|
472
|
-
},
|
|
473
|
-
defaultVariants: {
|
|
474
|
-
variant: 'default',
|
|
475
|
-
size: 'default',
|
|
476
|
-
},
|
|
477
|
-
},
|
|
478
|
-
);
|
|
479
|
-
|
|
480
|
-
/** An interactive menu item button with optional tooltip support when collapsed. Supports active state highlighting and size variants. */
|
|
481
|
-
function SidebarMenuButton({
|
|
482
|
-
asChild = false,
|
|
483
|
-
isActive = false,
|
|
484
|
-
variant = 'default',
|
|
485
|
-
size = 'default',
|
|
486
|
-
tooltip,
|
|
487
|
-
className,
|
|
488
|
-
...props
|
|
489
|
-
}: React.ComponentProps<'button'> & {
|
|
490
|
-
asChild?: boolean;
|
|
491
|
-
isActive?: boolean;
|
|
492
|
-
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
493
|
-
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
494
|
-
const Comp = asChild ? Slot.Root : 'button';
|
|
495
|
-
const { isMobile, state } = useSidebar();
|
|
496
|
-
|
|
497
|
-
const button = (
|
|
498
|
-
<Comp
|
|
499
|
-
data-slot="sidebar-menu-button"
|
|
500
|
-
data-sidebar="menu-button"
|
|
501
|
-
data-size={size}
|
|
502
|
-
data-active={isActive}
|
|
503
|
-
className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
|
|
504
|
-
{...props}
|
|
505
|
-
/>
|
|
506
|
-
);
|
|
507
|
-
|
|
508
|
-
if (!tooltip) {
|
|
509
|
-
return button;
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
if (typeof tooltip === 'string') {
|
|
513
|
-
tooltip = {
|
|
514
|
-
children: tooltip,
|
|
515
|
-
};
|
|
516
|
-
}
|
|
517
|
-
|
|
518
|
-
return (
|
|
519
|
-
<Tooltip>
|
|
520
|
-
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
521
|
-
<TooltipContent side="right" align="center" hidden={state !== 'collapsed' || isMobile} {...tooltip} />
|
|
522
|
-
</Tooltip>
|
|
523
|
-
);
|
|
524
|
-
}
|
|
525
|
-
|
|
526
|
-
/** An action button (e.g., delete, settings) positioned to the right of a SidebarMenuButton. */
|
|
527
|
-
function SidebarMenuAction({
|
|
528
|
-
className,
|
|
529
|
-
asChild = false,
|
|
530
|
-
showOnHover = false,
|
|
531
|
-
...props
|
|
532
|
-
}: React.ComponentProps<'button'> & {
|
|
533
|
-
asChild?: boolean;
|
|
534
|
-
showOnHover?: boolean;
|
|
535
|
-
}) {
|
|
536
|
-
const Comp = asChild ? Slot.Root : 'button';
|
|
537
|
-
|
|
538
|
-
return (
|
|
539
|
-
<Comp
|
|
540
|
-
data-slot="sidebar-menu-action"
|
|
541
|
-
data-sidebar="menu-action"
|
|
542
|
-
className={cn(
|
|
543
|
-
'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',
|
|
544
|
-
// Increases the hit area of the button on mobile.
|
|
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',
|
|
550
|
-
showOnHover &&
|
|
551
|
-
'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',
|
|
552
|
-
className,
|
|
553
|
-
)}
|
|
554
|
-
{...props}
|
|
555
|
-
/>
|
|
556
|
-
);
|
|
557
|
-
}
|
|
558
|
-
|
|
559
|
-
function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>) {
|
|
560
|
-
return (
|
|
561
|
-
<div
|
|
562
|
-
data-slot="sidebar-menu-badge"
|
|
563
|
-
data-sidebar="menu-badge"
|
|
564
|
-
className={cn(
|
|
565
|
-
'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',
|
|
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,
|
|
572
|
-
)}
|
|
573
|
-
{...props}
|
|
574
|
-
/>
|
|
575
|
-
);
|
|
576
|
-
}
|
|
577
|
-
|
|
578
|
-
function SidebarMenuSkeleton({
|
|
579
|
-
className,
|
|
580
|
-
showIcon = false,
|
|
581
|
-
...props
|
|
582
|
-
}: React.ComponentProps<'div'> & {
|
|
583
|
-
showIcon?: boolean;
|
|
584
|
-
}) {
|
|
585
|
-
// Random width between 50 to 90%.
|
|
586
|
-
const width = React.useMemo(() => {
|
|
587
|
-
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
588
|
-
}, []);
|
|
589
|
-
|
|
590
|
-
return (
|
|
591
|
-
<div
|
|
592
|
-
data-slot="sidebar-menu-skeleton"
|
|
593
|
-
data-sidebar="menu-skeleton"
|
|
594
|
-
className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
|
|
595
|
-
{...props}
|
|
596
|
-
>
|
|
597
|
-
{showIcon && <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />}
|
|
598
|
-
<Skeleton
|
|
599
|
-
className="h-4 max-w-(--skeleton-width) flex-1"
|
|
600
|
-
data-sidebar="menu-skeleton-text"
|
|
601
|
-
style={
|
|
602
|
-
{
|
|
603
|
-
'--skeleton-width': width,
|
|
604
|
-
} as React.CSSProperties
|
|
605
|
-
}
|
|
606
|
-
/>
|
|
607
|
-
</div>
|
|
608
|
-
);
|
|
609
|
-
}
|
|
610
|
-
|
|
611
|
-
/** A nested sub-menu list indented under a parent menu item with a left border. */
|
|
612
|
-
function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
613
|
-
return (
|
|
614
|
-
<ul
|
|
615
|
-
data-slot="sidebar-menu-sub"
|
|
616
|
-
data-sidebar="menu-sub"
|
|
617
|
-
className={cn(
|
|
618
|
-
'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',
|
|
619
|
-
'group-data-[collapsible=icon]:hidden',
|
|
620
|
-
className,
|
|
621
|
-
)}
|
|
622
|
-
{...props}
|
|
623
|
-
/>
|
|
624
|
-
);
|
|
625
|
-
}
|
|
626
|
-
|
|
627
|
-
function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {
|
|
628
|
-
return (
|
|
629
|
-
<li
|
|
630
|
-
data-slot="sidebar-menu-sub-item"
|
|
631
|
-
data-sidebar="menu-sub-item"
|
|
632
|
-
className={cn('group/menu-sub-item relative', className)}
|
|
633
|
-
{...props}
|
|
634
|
-
/>
|
|
635
|
-
);
|
|
636
|
-
}
|
|
637
|
-
|
|
638
|
-
function SidebarMenuSubButton({
|
|
639
|
-
asChild = false,
|
|
640
|
-
size = 'md',
|
|
641
|
-
isActive = false,
|
|
642
|
-
className,
|
|
643
|
-
...props
|
|
644
|
-
}: React.ComponentProps<'a'> & {
|
|
645
|
-
asChild?: boolean;
|
|
646
|
-
size?: 'sm' | 'md';
|
|
647
|
-
isActive?: boolean;
|
|
648
|
-
}) {
|
|
649
|
-
const Comp = asChild ? Slot.Root : 'a';
|
|
650
|
-
|
|
651
|
-
return (
|
|
652
|
-
<Comp
|
|
653
|
-
data-slot="sidebar-menu-sub-button"
|
|
654
|
-
data-sidebar="menu-sub-button"
|
|
655
|
-
data-size={size}
|
|
656
|
-
data-active={isActive}
|
|
657
|
-
className={cn(
|
|
658
|
-
'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',
|
|
659
|
-
'data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground',
|
|
660
|
-
size === 'sm' && 'text-xs',
|
|
661
|
-
size === 'md' && 'text-sm',
|
|
662
|
-
'group-data-[collapsible=icon]:hidden',
|
|
663
|
-
className,
|
|
664
|
-
)}
|
|
665
|
-
{...props}
|
|
666
|
-
/>
|
|
667
|
-
);
|
|
668
|
-
}
|
|
669
|
-
|
|
670
|
-
export {
|
|
671
|
-
Sidebar,
|
|
672
|
-
SidebarContent,
|
|
673
|
-
SidebarFooter,
|
|
674
|
-
SidebarGroup,
|
|
675
|
-
SidebarGroupAction,
|
|
676
|
-
SidebarGroupContent,
|
|
677
|
-
SidebarGroupLabel,
|
|
678
|
-
SidebarHeader,
|
|
679
|
-
SidebarInput,
|
|
680
|
-
SidebarInset,
|
|
681
|
-
SidebarMenu,
|
|
682
|
-
SidebarMenuAction,
|
|
683
|
-
SidebarMenuBadge,
|
|
684
|
-
SidebarMenuButton,
|
|
685
|
-
SidebarMenuItem,
|
|
686
|
-
SidebarMenuSkeleton,
|
|
687
|
-
SidebarMenuSub,
|
|
688
|
-
SidebarMenuSubButton,
|
|
689
|
-
SidebarMenuSubItem,
|
|
690
|
-
SidebarProvider,
|
|
691
|
-
SidebarRail,
|
|
692
|
-
SidebarSeparator,
|
|
693
|
-
SidebarTrigger,
|
|
694
|
-
useSidebar,
|
|
695
|
-
};
|