@luanthnh/cntt-ui 0.1.7 → 0.1.9
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 +5 -1
- package/.storybook/globals.d.ts +0 -1
- package/.storybook/main.ts +0 -29
- package/.storybook/preview.ts +0 -32
- package/assets/fonts/Montserrat-Black.eot +0 -0
- package/assets/fonts/Montserrat-Black.ttf +0 -0
- package/assets/fonts/Montserrat-Black.woff +0 -0
- package/assets/fonts/Montserrat-Black.woff2 +0 -0
- package/assets/fonts/Montserrat-BlackItalic.eot +0 -0
- package/assets/fonts/Montserrat-BlackItalic.ttf +0 -0
- package/assets/fonts/Montserrat-BlackItalic.woff +0 -0
- package/assets/fonts/Montserrat-BlackItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Bold.eot +0 -0
- package/assets/fonts/Montserrat-Bold.ttf +0 -0
- package/assets/fonts/Montserrat-Bold.woff +0 -0
- package/assets/fonts/Montserrat-Bold.woff2 +0 -0
- package/assets/fonts/Montserrat-BoldItalic.eot +0 -0
- package/assets/fonts/Montserrat-BoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-BoldItalic.woff +0 -0
- package/assets/fonts/Montserrat-BoldItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraBold.eot +0 -0
- package/assets/fonts/Montserrat-ExtraBold.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraBold.woff +0 -0
- package/assets/fonts/Montserrat-ExtraBold.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.eot +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.woff +0 -0
- package/assets/fonts/Montserrat-ExtraBoldItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraLight.eot +0 -0
- package/assets/fonts/Montserrat-ExtraLight.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraLight.woff +0 -0
- package/assets/fonts/Montserrat-ExtraLight.woff2 +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.eot +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.woff +0 -0
- package/assets/fonts/Montserrat-ExtraLightItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Italic.eot +0 -0
- package/assets/fonts/Montserrat-Italic.ttf +0 -0
- package/assets/fonts/Montserrat-Italic.woff +0 -0
- package/assets/fonts/Montserrat-Italic.woff2 +0 -0
- package/assets/fonts/Montserrat-Light.eot +0 -0
- package/assets/fonts/Montserrat-Light.ttf +0 -0
- package/assets/fonts/Montserrat-Light.woff +0 -0
- package/assets/fonts/Montserrat-Light.woff2 +0 -0
- package/assets/fonts/Montserrat-LightItalic.eot +0 -0
- package/assets/fonts/Montserrat-LightItalic.ttf +0 -0
- package/assets/fonts/Montserrat-LightItalic.woff +0 -0
- package/assets/fonts/Montserrat-LightItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Medium.eot +0 -0
- package/assets/fonts/Montserrat-Medium.ttf +0 -0
- package/assets/fonts/Montserrat-Medium.woff +0 -0
- package/assets/fonts/Montserrat-Medium.woff2 +0 -0
- package/assets/fonts/Montserrat-MediumItalic.eot +0 -0
- package/assets/fonts/Montserrat-MediumItalic.ttf +0 -0
- package/assets/fonts/Montserrat-MediumItalic.woff +0 -0
- package/assets/fonts/Montserrat-MediumItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Regular.eot +0 -0
- package/assets/fonts/Montserrat-Regular.ttf +0 -0
- package/assets/fonts/Montserrat-Regular.woff +0 -0
- package/assets/fonts/Montserrat-Regular.woff2 +0 -0
- package/assets/fonts/Montserrat-SemiBold.eot +0 -0
- package/assets/fonts/Montserrat-SemiBold.ttf +0 -0
- package/assets/fonts/Montserrat-SemiBold.woff +0 -0
- package/assets/fonts/Montserrat-SemiBold.woff2 +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.eot +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.ttf +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.woff +0 -0
- package/assets/fonts/Montserrat-SemiBoldItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Thin.eot +0 -0
- package/assets/fonts/Montserrat-Thin.ttf +0 -0
- package/assets/fonts/Montserrat-Thin.woff +0 -0
- package/assets/fonts/Montserrat-Thin.woff2 +0 -0
- package/assets/fonts/Montserrat-ThinItalic.eot +0 -0
- package/assets/fonts/Montserrat-ThinItalic.ttf +0 -0
- package/assets/fonts/Montserrat-ThinItalic.woff +0 -0
- package/assets/fonts/Montserrat-ThinItalic.woff2 +0 -0
- package/assets/fonts/Montserrat-Variable.eot +0 -0
- package/assets/fonts/Montserrat-Variable.ttf +0 -0
- package/assets/fonts/Montserrat-Variable.woff +0 -0
- package/assets/fonts/Montserrat-Variable.woff2 +0 -0
- package/assets/fonts/Montserrat-VariableItalic.eot +0 -0
- package/assets/fonts/Montserrat-VariableItalic.ttf +0 -0
- package/assets/fonts/Montserrat-VariableItalic.woff +0 -0
- package/assets/fonts/Montserrat-VariableItalic.woff2 +0 -0
- package/assets/icons/arrow-left.svg +0 -1
- package/assets/icons/file.svg +0 -1
- package/assets/icons/globe.svg +0 -1
- package/assets/icons/logo-line.svg +0 -1
- package/assets/icons/next.svg +0 -1
- package/assets/icons/panel-left-expand.svg +0 -1
- package/assets/icons/placeholder.svg +0 -57
- package/assets/icons/vercel.svg +0 -1
- package/assets/icons/window.svg +0 -1
- package/assets/lotties/error-404.json +0 -19642
- package/assets/lotties/error.json +0 -2414
- package/assets/lotties/loader.json +0 -305
- package/components/Welcome.mdx +0 -74
- package/components/lenis/index.tsx +0 -48
- package/components/motion/auto-height.tsx +0 -56
- package/components/motion/cursor.tsx +0 -108
- package/components/motion/highlight.tsx +0 -605
- package/components/motion/number-ticker.tsx +0 -55
- package/components/motion/slot.tsx +0 -106
- package/components/motion/waves.tsx +0 -417
- package/components/primitives/tabs.tsx +0 -174
- package/components/ui/Accordion/index.stories.tsx +0 -39
- package/components/ui/Accordion/index.tsx +0 -170
- package/components/ui/Alert/index.stories.tsx +0 -39
- package/components/ui/Alert/index.tsx +0 -60
- package/components/ui/AlertDialog/index.stories.tsx +0 -47
- package/components/ui/AlertDialog/index.tsx +0 -172
- package/components/ui/AspectRatio/index.stories.tsx +0 -40
- package/components/ui/AspectRatio/index.tsx +0 -9
- package/components/ui/Avatar/index.stories.tsx +0 -39
- package/components/ui/Avatar/index.tsx +0 -44
- package/components/ui/Badge/index.stories.tsx +0 -64
- package/components/ui/Badge/index.tsx +0 -46
- package/components/ui/Breadcrumb/index.stories.tsx +0 -64
- package/components/ui/Breadcrumb/index.tsx +0 -102
- package/components/ui/Button/index.stories.tsx +0 -232
- package/components/ui/Button/index.tsx +0 -114
- package/components/ui/Calendar/index.stories.tsx +0 -20
- package/components/ui/Calendar/index.tsx +0 -149
- package/components/ui/Card/index.stories.tsx +0 -39
- package/components/ui/Card/index.tsx +0 -65
- package/components/ui/Carousel/index.stories.tsx +0 -37
- package/components/ui/Carousel/index.tsx +0 -242
- package/components/ui/Chart/index.stories.tsx +0 -53
- package/components/ui/Chart/index.tsx +0 -322
- package/components/ui/Checkbox/index.stories.tsx +0 -56
- package/components/ui/Checkbox/index.tsx +0 -167
- package/components/ui/CircleProcess/index.stories.tsx +0 -29
- package/components/ui/CircleProcess/index.tsx +0 -50
- package/components/ui/Collapsible/index.stories.tsx +0 -33
- package/components/ui/Collapsible/index.tsx +0 -124
- package/components/ui/Command/index.stories.tsx +0 -65
- package/components/ui/Command/index.tsx +0 -161
- package/components/ui/Container/index.stories.tsx +0 -22
- package/components/ui/Container/index.tsx +0 -30
- package/components/ui/ContextMenu/index.stories.tsx +0 -51
- package/components/ui/ContextMenu/index.tsx +0 -224
- package/components/ui/Dialog/index.stories.tsx +0 -44
- package/components/ui/Dialog/index.tsx +0 -156
- package/components/ui/Drawer/index.stories.tsx +0 -54
- package/components/ui/Drawer/index.tsx +0 -124
- package/components/ui/DropdownMenu/index.stories.tsx +0 -83
- package/components/ui/DropdownMenu/index.tsx +0 -231
- package/components/ui/Dropzone/index.stories.tsx +0 -18
- package/components/ui/Dropzone/index.tsx +0 -47
- package/components/ui/Form/date-field.tsx +0 -77
- package/components/ui/Form/index.stories.tsx +0 -67
- package/components/ui/Form/index.tsx +0 -188
- package/components/ui/Form/select-field.tsx +0 -55
- package/components/ui/Form/text-area-field.tsx +0 -37
- package/components/ui/Form/text-field.tsx +0 -72
- package/components/ui/HStack/index.stories.tsx +0 -48
- package/components/ui/HStack/index.tsx +0 -73
- package/components/ui/HoverCard/index.stories.tsx +0 -38
- package/components/ui/HoverCard/index.tsx +0 -38
- package/components/ui/Icons/index.stories.tsx +0 -27
- package/components/ui/Icons/index.tsx +0 -33
- package/components/ui/ImageWithFallback/index.stories.tsx +0 -32
- package/components/ui/ImageWithFallback/index.tsx +0 -34
- package/components/ui/Input/index.stories.tsx +0 -47
- package/components/ui/Input/index.tsx +0 -21
- package/components/ui/InputOtp/index.stories.tsx +0 -35
- package/components/ui/InputOtp/index.tsx +0 -70
- package/components/ui/Label/index.stories.tsx +0 -18
- package/components/ui/Label/index.tsx +0 -21
- package/components/ui/Marquee/index.stories.tsx +0 -71
- package/components/ui/Marquee/index.tsx +0 -65
- package/components/ui/Menubar/index.stories.tsx +0 -116
- package/components/ui/Menubar/index.tsx +0 -252
- package/components/ui/NavigationMenu/index.stories.tsx +0 -112
- package/components/ui/NavigationMenu/index.tsx +0 -185
- package/components/ui/NoData/index.stories.tsx +0 -24
- package/components/ui/NoData/index.tsx +0 -19
- package/components/ui/Pagination/index.stories.tsx +0 -53
- package/components/ui/Pagination/index.tsx +0 -114
- package/components/ui/Popover/index.stories.tsx +0 -31
- package/components/ui/Popover/index.tsx +0 -42
- package/components/ui/Progress/index.stories.tsx +0 -35
- package/components/ui/Progress/index.tsx +0 -28
- package/components/ui/RadioGroup/index.stories.tsx +0 -28
- package/components/ui/RadioGroup/index.tsx +0 -45
- package/components/ui/Resizable/index.stories.tsx +0 -44
- package/components/ui/Resizable/index.tsx +0 -54
- package/components/ui/ScrollArea/index.stories.tsx +0 -31
- package/components/ui/ScrollArea/index.tsx +0 -56
- package/components/ui/Select/index.stories.tsx +0 -64
- package/components/ui/Select/index.tsx +0 -170
- package/components/ui/Separator/index.stories.tsx +0 -31
- package/components/ui/Separator/index.tsx +0 -28
- package/components/ui/Sheet/index.stories.tsx +0 -45
- package/components/ui/Sheet/index.tsx +0 -130
- package/components/ui/Sidebar/index.stories.tsx +0 -82
- package/components/ui/Sidebar/index.tsx +0 -676
- package/components/ui/Skeleton/index.stories.tsx +0 -36
- package/components/ui/Skeleton/index.tsx +0 -13
- package/components/ui/Slider/index.stories.tsx +0 -48
- package/components/ui/Slider/index.tsx +0 -82
- package/components/ui/Slot/index.stories.tsx +0 -29
- package/components/ui/Slot/index.tsx +0 -106
- package/components/ui/Sonner/index.stories.tsx +0 -36
- package/components/ui/Sonner/index.tsx +0 -31
- package/components/ui/Switch/index.stories.tsx +0 -33
- package/components/ui/Switch/index.tsx +0 -28
- package/components/ui/Table/index.stories.tsx +0 -74
- package/components/ui/Table/index.tsx +0 -95
- package/components/ui/Tabs/index.stories.tsx +0 -38
- package/components/ui/Tabs/index.tsx +0 -78
- package/components/ui/Text/index.stories.tsx +0 -53
- package/components/ui/Text/index.tsx +0 -138
- package/components/ui/Textarea/index.stories.tsx +0 -25
- package/components/ui/Textarea/index.tsx +0 -18
- package/components/ui/Toggle/index.stories.tsx +0 -52
- package/components/ui/Toggle/index.tsx +0 -46
- package/components/ui/ToggleGroup/index.stories.tsx +0 -52
- package/components/ui/ToggleGroup/index.tsx +0 -69
- package/components/ui/Tooltip/index.stories.tsx +0 -29
- package/components/ui/Tooltip/index.tsx +0 -35
- package/components/ui/VStack/index.stories.tsx +0 -45
- package/components/ui/VStack/index.tsx +0 -69
- package/components/ui/colors.stories.tsx +0 -148
- package/eslint.config.js +0 -10
- package/hooks/index.ts +0 -3
- package/hooks/use-auto-height.tsx +0 -99
- package/hooks/use-controlled-state.tsx +0 -32
- package/hooks/use-mobile.ts +0 -19
- package/index.ts +0 -58
- package/lib/get-strict-context.ts +0 -15
- package/lib/utils.ts +0 -10
- package/scripts/generate-exports.ts +0 -32
- package/tsconfig.json +0 -12
- package/tsconfig.tsbuildinfo +0 -1
- package/tsup.config.ts +0 -11
- package/types/svg.d.ts +0 -10
- package/vercel.json +0 -5
|
@@ -1,676 +0,0 @@
|
|
|
1
|
-
'use client';
|
|
2
|
-
|
|
3
|
-
import * as React from 'react';
|
|
4
|
-
import { Slot } from '@radix-ui/react-slot';
|
|
5
|
-
import { cva, VariantProps } from 'class-variance-authority';
|
|
6
|
-
import { PanelLeftIcon } from 'lucide-react';
|
|
7
|
-
|
|
8
|
-
import { cn } from '@/lib/utils';
|
|
9
|
-
import { useIsMobile } from '@/hooks/use-mobile';
|
|
10
|
-
import { Button } from '@/components/ui/Button';
|
|
11
|
-
import { Input } from '@/components/ui/Input';
|
|
12
|
-
import { Separator } from '@/components/ui/Separator';
|
|
13
|
-
import { Skeleton } from '@/components/ui/Skeleton';
|
|
14
|
-
import { Tooltip, TooltipProvider } from '@/components/ui/Tooltip';
|
|
15
|
-
|
|
16
|
-
const SIDEBAR_COOKIE_NAME = 'sidebar_state';
|
|
17
|
-
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
18
|
-
const SIDEBAR_WIDTH = '16rem';
|
|
19
|
-
// const SIDEBAR_WIDTH_MOBILE = '18rem';
|
|
20
|
-
const SIDEBAR_WIDTH_ICON = '3rem';
|
|
21
|
-
const SIDEBAR_KEYBOARD_SHORTCUT = 'b';
|
|
22
|
-
|
|
23
|
-
type SidebarContextProps = {
|
|
24
|
-
state: 'expanded' | 'collapsed';
|
|
25
|
-
open: boolean;
|
|
26
|
-
setOpen: (open: boolean) => void;
|
|
27
|
-
openMobile: boolean;
|
|
28
|
-
setOpenMobile: (open: boolean) => void;
|
|
29
|
-
isMobile: boolean;
|
|
30
|
-
toggleSidebar: () => void;
|
|
31
|
-
};
|
|
32
|
-
|
|
33
|
-
const SidebarContext = React.createContext<SidebarContextProps | null>(null);
|
|
34
|
-
|
|
35
|
-
function useSidebar() {
|
|
36
|
-
const context = React.useContext(SidebarContext);
|
|
37
|
-
if (!context) {
|
|
38
|
-
throw new Error('useSidebar must be used within a SidebarProvider.');
|
|
39
|
-
}
|
|
40
|
-
|
|
41
|
-
return context;
|
|
42
|
-
}
|
|
43
|
-
|
|
44
|
-
function SidebarProvider({
|
|
45
|
-
defaultOpen = true,
|
|
46
|
-
open: openProp,
|
|
47
|
-
onOpenChange: setOpenProp,
|
|
48
|
-
className,
|
|
49
|
-
style,
|
|
50
|
-
children,
|
|
51
|
-
...props
|
|
52
|
-
}: React.ComponentProps<'div'> & {
|
|
53
|
-
defaultOpen?: boolean;
|
|
54
|
-
open?: boolean;
|
|
55
|
-
onOpenChange?: (open: boolean) => void;
|
|
56
|
-
}) {
|
|
57
|
-
const isMobile = useIsMobile();
|
|
58
|
-
const [openMobile, setOpenMobile] = React.useState(false);
|
|
59
|
-
|
|
60
|
-
// This is the internal state of the sidebar.
|
|
61
|
-
// We use openProp and setOpenProp for control from outside the component.
|
|
62
|
-
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
63
|
-
const open = openProp ?? _open;
|
|
64
|
-
const setOpen = React.useCallback(
|
|
65
|
-
(value: boolean | ((value: boolean) => boolean)) => {
|
|
66
|
-
const openState = typeof value === 'function' ? value(open) : value;
|
|
67
|
-
if (setOpenProp) {
|
|
68
|
-
setOpenProp(openState);
|
|
69
|
-
} else {
|
|
70
|
-
_setOpen(openState);
|
|
71
|
-
}
|
|
72
|
-
|
|
73
|
-
// This sets the cookie to keep the sidebar state.
|
|
74
|
-
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
75
|
-
},
|
|
76
|
-
[setOpenProp, open],
|
|
77
|
-
);
|
|
78
|
-
|
|
79
|
-
// Helper to toggle the sidebar.
|
|
80
|
-
const toggleSidebar = React.useCallback(() => {
|
|
81
|
-
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
82
|
-
}, [isMobile, setOpen, setOpenMobile]);
|
|
83
|
-
|
|
84
|
-
// Adds a keyboard shortcut to toggle the sidebar.
|
|
85
|
-
React.useEffect(() => {
|
|
86
|
-
const handleKeyDown = (event: KeyboardEvent) => {
|
|
87
|
-
if (event.key === SIDEBAR_KEYBOARD_SHORTCUT && (event.metaKey || event.ctrlKey)) {
|
|
88
|
-
event.preventDefault();
|
|
89
|
-
toggleSidebar();
|
|
90
|
-
}
|
|
91
|
-
};
|
|
92
|
-
|
|
93
|
-
window.addEventListener('keydown', handleKeyDown);
|
|
94
|
-
return () => window.removeEventListener('keydown', handleKeyDown);
|
|
95
|
-
}, [toggleSidebar]);
|
|
96
|
-
|
|
97
|
-
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
98
|
-
// This makes it easier to style the sidebar with Tailwind classes.
|
|
99
|
-
const state = open ? 'expanded' : 'collapsed';
|
|
100
|
-
|
|
101
|
-
const contextValue = React.useMemo<SidebarContextProps>(
|
|
102
|
-
() => ({
|
|
103
|
-
state,
|
|
104
|
-
open,
|
|
105
|
-
setOpen,
|
|
106
|
-
isMobile,
|
|
107
|
-
openMobile,
|
|
108
|
-
setOpenMobile,
|
|
109
|
-
toggleSidebar,
|
|
110
|
-
}),
|
|
111
|
-
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar],
|
|
112
|
-
);
|
|
113
|
-
|
|
114
|
-
return (
|
|
115
|
-
<SidebarContext.Provider value={contextValue}>
|
|
116
|
-
<TooltipProvider delayDuration={0}>
|
|
117
|
-
<div
|
|
118
|
-
data-slot="sidebar-wrapper"
|
|
119
|
-
style={
|
|
120
|
-
{
|
|
121
|
-
'--sidebar-width': SIDEBAR_WIDTH,
|
|
122
|
-
'--sidebar-width-icon': SIDEBAR_WIDTH_ICON,
|
|
123
|
-
...style,
|
|
124
|
-
} as React.CSSProperties
|
|
125
|
-
}
|
|
126
|
-
className={cn(
|
|
127
|
-
'group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex w-full',
|
|
128
|
-
className,
|
|
129
|
-
)}
|
|
130
|
-
{...props}
|
|
131
|
-
>
|
|
132
|
-
{children}
|
|
133
|
-
</div>
|
|
134
|
-
</TooltipProvider>
|
|
135
|
-
</SidebarContext.Provider>
|
|
136
|
-
);
|
|
137
|
-
}
|
|
138
|
-
|
|
139
|
-
function Sidebar({
|
|
140
|
-
side = 'left',
|
|
141
|
-
variant = 'sidebar',
|
|
142
|
-
collapsible = 'offcanvas',
|
|
143
|
-
className,
|
|
144
|
-
children,
|
|
145
|
-
...props
|
|
146
|
-
}: React.ComponentProps<'div'> & {
|
|
147
|
-
side?: 'left' | 'right';
|
|
148
|
-
variant?: 'sidebar' | 'floating' | 'inset';
|
|
149
|
-
collapsible?: 'offcanvas' | 'icon' | 'none';
|
|
150
|
-
}) {
|
|
151
|
-
const { state } = useSidebar();
|
|
152
|
-
|
|
153
|
-
if (collapsible === 'none') {
|
|
154
|
-
return (
|
|
155
|
-
<div
|
|
156
|
-
data-slot="sidebar"
|
|
157
|
-
className={cn(
|
|
158
|
-
'bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col',
|
|
159
|
-
className,
|
|
160
|
-
)}
|
|
161
|
-
{...props}
|
|
162
|
-
>
|
|
163
|
-
{children}
|
|
164
|
-
</div>
|
|
165
|
-
);
|
|
166
|
-
}
|
|
167
|
-
|
|
168
|
-
// if (isMobile) {
|
|
169
|
-
// return (
|
|
170
|
-
// <Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
171
|
-
// <SheetContent
|
|
172
|
-
// data-sidebar="sidebar"
|
|
173
|
-
// data-slot="sidebar"
|
|
174
|
-
// data-mobile="true"
|
|
175
|
-
// className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
|
|
176
|
-
// style={
|
|
177
|
-
// {
|
|
178
|
-
// '--sidebar-width': SIDEBAR_WIDTH_MOBILE,
|
|
179
|
-
// } as React.CSSProperties
|
|
180
|
-
// }
|
|
181
|
-
// side={side}
|
|
182
|
-
// >
|
|
183
|
-
// <SheetHeader className="sr-only">
|
|
184
|
-
// <SheetTitle>Sidebar</SheetTitle>
|
|
185
|
-
// <SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
186
|
-
// </SheetHeader>
|
|
187
|
-
// <div className="flex h-full w-full flex-col">{children}</div>
|
|
188
|
-
// </SheetContent>
|
|
189
|
-
// </Sheet>
|
|
190
|
-
// );
|
|
191
|
-
// }
|
|
192
|
-
|
|
193
|
-
return (
|
|
194
|
-
<div
|
|
195
|
-
className="group peer text-sidebar-foreground w-full lg:sticky lg:top-6 lg:w-fit"
|
|
196
|
-
data-state={state}
|
|
197
|
-
data-collapsible={state === 'collapsed' ? collapsible : ''}
|
|
198
|
-
data-variant={variant}
|
|
199
|
-
data-side={side}
|
|
200
|
-
data-slot="sidebar"
|
|
201
|
-
>
|
|
202
|
-
{/* This is what handles the sidebar gap on desktop */}
|
|
203
|
-
<div
|
|
204
|
-
data-slot="sidebar-gap"
|
|
205
|
-
className={cn(
|
|
206
|
-
'relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear',
|
|
207
|
-
'group-data-[collapsible=offcanvas]:w-0',
|
|
208
|
-
'group-data-[side=right]:rotate-180',
|
|
209
|
-
variant === 'floating' || variant === 'inset'
|
|
210
|
-
? 'group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]'
|
|
211
|
-
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon)',
|
|
212
|
-
)}
|
|
213
|
-
/>
|
|
214
|
-
<div
|
|
215
|
-
data-slot="sidebar-container"
|
|
216
|
-
className={cn(
|
|
217
|
-
'fixed inset-y-0 z-10 h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear',
|
|
218
|
-
side === 'left'
|
|
219
|
-
? 'left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]'
|
|
220
|
-
: 'right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]',
|
|
221
|
-
// Adjust the padding for floating and inset variants.
|
|
222
|
-
variant === 'floating' || variant === 'inset'
|
|
223
|
-
? 'p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]'
|
|
224
|
-
: 'group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l',
|
|
225
|
-
className,
|
|
226
|
-
)}
|
|
227
|
-
{...props}
|
|
228
|
-
>
|
|
229
|
-
<div
|
|
230
|
-
data-sidebar="sidebar"
|
|
231
|
-
data-slot="sidebar-inner"
|
|
232
|
-
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"
|
|
233
|
-
>
|
|
234
|
-
{children}
|
|
235
|
-
</div>
|
|
236
|
-
</div>
|
|
237
|
-
</div>
|
|
238
|
-
);
|
|
239
|
-
}
|
|
240
|
-
|
|
241
|
-
function SidebarTrigger({ className, onClick, ...props }: React.ComponentProps<typeof Button>) {
|
|
242
|
-
const { toggleSidebar } = useSidebar();
|
|
243
|
-
|
|
244
|
-
return (
|
|
245
|
-
<Button
|
|
246
|
-
data-sidebar="trigger"
|
|
247
|
-
data-slot="sidebar-trigger"
|
|
248
|
-
variant="ghost"
|
|
249
|
-
size="icon"
|
|
250
|
-
className={cn('size-7', className)}
|
|
251
|
-
onClick={(event: React.MouseEvent<HTMLButtonElement>) => {
|
|
252
|
-
onClick?.(event);
|
|
253
|
-
toggleSidebar();
|
|
254
|
-
}}
|
|
255
|
-
{...props}
|
|
256
|
-
>
|
|
257
|
-
<PanelLeftIcon />
|
|
258
|
-
<span className="sr-only">Toggle Sidebar</span>
|
|
259
|
-
</Button>
|
|
260
|
-
);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
function SidebarRail({ className, ...props }: React.ComponentProps<'button'>) {
|
|
264
|
-
const { toggleSidebar } = useSidebar();
|
|
265
|
-
|
|
266
|
-
return (
|
|
267
|
-
<button
|
|
268
|
-
data-sidebar="rail"
|
|
269
|
-
data-slot="sidebar-rail"
|
|
270
|
-
aria-label="Toggle Sidebar"
|
|
271
|
-
tabIndex={-1}
|
|
272
|
-
onClick={toggleSidebar}
|
|
273
|
-
title="Toggle Sidebar"
|
|
274
|
-
className={cn(
|
|
275
|
-
'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',
|
|
276
|
-
'in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize',
|
|
277
|
-
'[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize',
|
|
278
|
-
'hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full',
|
|
279
|
-
'[[data-side=left][data-collapsible=offcanvas]_&]:-right-2',
|
|
280
|
-
'[[data-side=right][data-collapsible=offcanvas]_&]:-left-2',
|
|
281
|
-
className,
|
|
282
|
-
)}
|
|
283
|
-
{...props}
|
|
284
|
-
/>
|
|
285
|
-
);
|
|
286
|
-
}
|
|
287
|
-
|
|
288
|
-
function SidebarInset({ className, ...props }: React.ComponentProps<'main'>) {
|
|
289
|
-
return (
|
|
290
|
-
<main
|
|
291
|
-
data-slot="sidebar-inset"
|
|
292
|
-
className={cn(
|
|
293
|
-
'bg-background relative flex w-full flex-1 flex-col',
|
|
294
|
-
'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',
|
|
295
|
-
className,
|
|
296
|
-
)}
|
|
297
|
-
{...props}
|
|
298
|
-
/>
|
|
299
|
-
);
|
|
300
|
-
}
|
|
301
|
-
|
|
302
|
-
function SidebarInput({ className, ...props }: React.ComponentProps<typeof Input>) {
|
|
303
|
-
return (
|
|
304
|
-
<Input
|
|
305
|
-
data-slot="sidebar-input"
|
|
306
|
-
data-sidebar="input"
|
|
307
|
-
className={cn('bg-background h-8 w-full shadow-none', className)}
|
|
308
|
-
{...props}
|
|
309
|
-
/>
|
|
310
|
-
);
|
|
311
|
-
}
|
|
312
|
-
|
|
313
|
-
function SidebarHeader({ className, ...props }: React.ComponentProps<'div'>) {
|
|
314
|
-
return (
|
|
315
|
-
<div
|
|
316
|
-
data-slot="sidebar-header"
|
|
317
|
-
data-sidebar="header"
|
|
318
|
-
className={cn('flex flex-col gap-2 p-2', className)}
|
|
319
|
-
{...props}
|
|
320
|
-
/>
|
|
321
|
-
);
|
|
322
|
-
}
|
|
323
|
-
|
|
324
|
-
function SidebarFooter({ className, ...props }: React.ComponentProps<'div'>) {
|
|
325
|
-
return (
|
|
326
|
-
<div
|
|
327
|
-
data-slot="sidebar-footer"
|
|
328
|
-
data-sidebar="footer"
|
|
329
|
-
className={cn('flex flex-col gap-2 p-2', className)}
|
|
330
|
-
{...props}
|
|
331
|
-
/>
|
|
332
|
-
);
|
|
333
|
-
}
|
|
334
|
-
|
|
335
|
-
function SidebarSeparator({ className, ...props }: React.ComponentProps<typeof Separator>) {
|
|
336
|
-
return (
|
|
337
|
-
<Separator
|
|
338
|
-
data-slot="sidebar-separator"
|
|
339
|
-
data-sidebar="separator"
|
|
340
|
-
className={cn('bg-sidebar-border mx-2 w-auto', className)}
|
|
341
|
-
{...props}
|
|
342
|
-
/>
|
|
343
|
-
);
|
|
344
|
-
}
|
|
345
|
-
|
|
346
|
-
function SidebarContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
347
|
-
return (
|
|
348
|
-
<div
|
|
349
|
-
data-slot="sidebar-content"
|
|
350
|
-
data-sidebar="content"
|
|
351
|
-
className={cn(
|
|
352
|
-
'flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden',
|
|
353
|
-
className,
|
|
354
|
-
)}
|
|
355
|
-
{...props}
|
|
356
|
-
/>
|
|
357
|
-
);
|
|
358
|
-
}
|
|
359
|
-
|
|
360
|
-
function SidebarGroup({ className, ...props }: React.ComponentProps<'div'>) {
|
|
361
|
-
return (
|
|
362
|
-
<div
|
|
363
|
-
data-slot="sidebar-group"
|
|
364
|
-
data-sidebar="group"
|
|
365
|
-
className={cn('relative flex w-full min-w-0 flex-col p-2', className)}
|
|
366
|
-
{...props}
|
|
367
|
-
/>
|
|
368
|
-
);
|
|
369
|
-
}
|
|
370
|
-
|
|
371
|
-
function SidebarGroupLabel({
|
|
372
|
-
className,
|
|
373
|
-
asChild = false,
|
|
374
|
-
...props
|
|
375
|
-
}: React.ComponentProps<'div'> & { asChild?: boolean }) {
|
|
376
|
-
const Comp = asChild ? Slot : 'div';
|
|
377
|
-
|
|
378
|
-
return (
|
|
379
|
-
<Comp
|
|
380
|
-
data-slot="sidebar-group-label"
|
|
381
|
-
data-sidebar="group-label"
|
|
382
|
-
className={cn(
|
|
383
|
-
'text-sidebar-foreground/70 ring-sidebar-ring flex h-8 shrink-0 items-center rounded-md px-2 text-sm font-medium outline-hidden transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:size-4 [&>svg]:shrink-0',
|
|
384
|
-
'group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0',
|
|
385
|
-
className,
|
|
386
|
-
)}
|
|
387
|
-
{...props}
|
|
388
|
-
/>
|
|
389
|
-
);
|
|
390
|
-
}
|
|
391
|
-
|
|
392
|
-
function SidebarGroupAction({
|
|
393
|
-
className,
|
|
394
|
-
asChild = false,
|
|
395
|
-
...props
|
|
396
|
-
}: React.ComponentProps<'button'> & { asChild?: boolean }) {
|
|
397
|
-
const Comp = asChild ? Slot : 'button';
|
|
398
|
-
|
|
399
|
-
return (
|
|
400
|
-
<Comp
|
|
401
|
-
data-slot="sidebar-group-action"
|
|
402
|
-
data-sidebar="group-action"
|
|
403
|
-
className={cn(
|
|
404
|
-
'text-sidebar-foreground ring-sidebar-ring hover:bg-primary-50 dark:hover:bg-primary-900/30 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',
|
|
405
|
-
// Increases the hit area of the button on mobile.
|
|
406
|
-
'after:absolute after:-inset-2 md:after:hidden',
|
|
407
|
-
'group-data-[collapsible=icon]:hidden',
|
|
408
|
-
className,
|
|
409
|
-
)}
|
|
410
|
-
{...props}
|
|
411
|
-
/>
|
|
412
|
-
);
|
|
413
|
-
}
|
|
414
|
-
|
|
415
|
-
function SidebarGroupContent({ className, ...props }: React.ComponentProps<'div'>) {
|
|
416
|
-
return (
|
|
417
|
-
<div
|
|
418
|
-
data-slot="sidebar-group-content"
|
|
419
|
-
data-sidebar="group-content"
|
|
420
|
-
className={cn('w-full text-base', className)}
|
|
421
|
-
{...props}
|
|
422
|
-
/>
|
|
423
|
-
);
|
|
424
|
-
}
|
|
425
|
-
|
|
426
|
-
function SidebarMenu({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
427
|
-
return (
|
|
428
|
-
<ul
|
|
429
|
-
data-slot="sidebar-menu"
|
|
430
|
-
data-sidebar="menu"
|
|
431
|
-
className={cn('flex w-full min-w-0 flex-col gap-1', className)}
|
|
432
|
-
{...props}
|
|
433
|
-
/>
|
|
434
|
-
);
|
|
435
|
-
}
|
|
436
|
-
|
|
437
|
-
function SidebarMenuItem({ className, ...props }: React.ComponentProps<'li'>) {
|
|
438
|
-
return (
|
|
439
|
-
<li
|
|
440
|
-
data-slot="sidebar-menu-item"
|
|
441
|
-
data-sidebar="menu-item"
|
|
442
|
-
className={cn('group/menu-item relative', className)}
|
|
443
|
-
{...props}
|
|
444
|
-
/>
|
|
445
|
-
);
|
|
446
|
-
}
|
|
447
|
-
|
|
448
|
-
const sidebarMenuButtonVariants = cva(
|
|
449
|
-
'peer/menu-button ring-sidebar-ring hover:bg-primary-50 dark:hover:bg-primary-900/30 active:bg-primary-50 dark:active:bg-primary-900/30 data-[active=true]:bg-primary data-[active=true]:text-primary-foreground data-[state=open]:hover:bg-primary-50 dark:data-[state=open]:hover:bg-primary-900/30 data-[state=open]:hover:text-primary-foreground flex w-full items-center gap-2 overflow-hidden rounded-lg p-4 text-left text-base 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! focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:font-medium [&>span:last-child]:truncate [&>svg]:size-4 [&>svg]:shrink-0',
|
|
450
|
-
{
|
|
451
|
-
variants: {
|
|
452
|
-
variant: {
|
|
453
|
-
default: 'hover:bg-primary-50 dark:hover:bg-primary-900/30',
|
|
454
|
-
outline:
|
|
455
|
-
'bg-background hover:bg-primary-50 dark:hover:bg-primary-900/30 shadow-[0_0_0_1px_hsl(var(--sidebar-border))] hover:shadow-[0_0_0_1px_hsl(var(--sidebar-accent))]',
|
|
456
|
-
},
|
|
457
|
-
size: {
|
|
458
|
-
default: 'h-8 text-base',
|
|
459
|
-
sm: 'h-7 text-sm',
|
|
460
|
-
lg: 'h-12 text-base group-data-[collapsible=icon]:p-0!',
|
|
461
|
-
},
|
|
462
|
-
},
|
|
463
|
-
defaultVariants: {
|
|
464
|
-
variant: 'default',
|
|
465
|
-
size: 'default',
|
|
466
|
-
},
|
|
467
|
-
},
|
|
468
|
-
);
|
|
469
|
-
|
|
470
|
-
function SidebarMenuButton({
|
|
471
|
-
asChild = false,
|
|
472
|
-
isActive = false,
|
|
473
|
-
variant = 'default',
|
|
474
|
-
size = 'default',
|
|
475
|
-
tooltip,
|
|
476
|
-
className,
|
|
477
|
-
...props
|
|
478
|
-
}: React.ComponentProps<'button'> & {
|
|
479
|
-
asChild?: boolean;
|
|
480
|
-
isActive?: boolean;
|
|
481
|
-
tooltip?: string | React.ComponentProps<typeof Tooltip>;
|
|
482
|
-
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
483
|
-
const Comp = asChild ? Slot : 'button';
|
|
484
|
-
const { isMobile, state } = useSidebar();
|
|
485
|
-
|
|
486
|
-
const button = (
|
|
487
|
-
<Comp
|
|
488
|
-
data-slot="sidebar-menu-button"
|
|
489
|
-
data-sidebar="menu-button"
|
|
490
|
-
data-size={size}
|
|
491
|
-
data-active={isActive}
|
|
492
|
-
className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
|
|
493
|
-
{...props}
|
|
494
|
-
/>
|
|
495
|
-
);
|
|
496
|
-
|
|
497
|
-
if (!tooltip) {
|
|
498
|
-
return button;
|
|
499
|
-
}
|
|
500
|
-
|
|
501
|
-
if (state !== 'collapsed' || isMobile) {
|
|
502
|
-
return button;
|
|
503
|
-
}
|
|
504
|
-
|
|
505
|
-
return (
|
|
506
|
-
<Tooltip label={typeof tooltip === 'string' ? tooltip : tooltip.children}>{button}</Tooltip>
|
|
507
|
-
);
|
|
508
|
-
}
|
|
509
|
-
|
|
510
|
-
function SidebarMenuAction({
|
|
511
|
-
className,
|
|
512
|
-
asChild = false,
|
|
513
|
-
showOnHover = false,
|
|
514
|
-
...props
|
|
515
|
-
}: React.ComponentProps<'button'> & {
|
|
516
|
-
asChild?: boolean;
|
|
517
|
-
showOnHover?: boolean;
|
|
518
|
-
}) {
|
|
519
|
-
const Comp = asChild ? Slot : 'button';
|
|
520
|
-
|
|
521
|
-
return (
|
|
522
|
-
<Comp
|
|
523
|
-
data-slot="sidebar-menu-action"
|
|
524
|
-
data-sidebar="menu-action"
|
|
525
|
-
className={cn(
|
|
526
|
-
'text-sidebar-foreground ring-sidebar-ring hover:bg-primary-50 dark:hover:bg-primary-900/30 peer-hover/menu-button:text-primary-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',
|
|
527
|
-
'after:absolute after:-inset-2 md:after:hidden',
|
|
528
|
-
'peer-data-[size=sm]/menu-button:top-1',
|
|
529
|
-
'peer-data-[size=default]/menu-button:top-1.5',
|
|
530
|
-
'peer-data-[size=lg]/menu-button:top-2.5',
|
|
531
|
-
'group-data-[collapsible=icon]:hidden',
|
|
532
|
-
showOnHover &&
|
|
533
|
-
'peer-data-[active=true]/menu-button:text-primary-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0',
|
|
534
|
-
className,
|
|
535
|
-
)}
|
|
536
|
-
{...props}
|
|
537
|
-
/>
|
|
538
|
-
);
|
|
539
|
-
}
|
|
540
|
-
|
|
541
|
-
function SidebarMenuBadge({ className, ...props }: React.ComponentProps<'div'>) {
|
|
542
|
-
return (
|
|
543
|
-
<div
|
|
544
|
-
data-slot="sidebar-menu-badge"
|
|
545
|
-
data-sidebar="menu-badge"
|
|
546
|
-
className={cn(
|
|
547
|
-
'text-sidebar-foreground pointer-events-none absolute right-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-sm font-medium tabular-nums select-none',
|
|
548
|
-
'peer-hover/menu-button:text-primary-foreground peer-data-[active=true]/menu-button:text-primary-foreground',
|
|
549
|
-
'peer-data-[size=sm]/menu-button:top-1',
|
|
550
|
-
'peer-data-[size=default]/menu-button:top-1.5',
|
|
551
|
-
'peer-data-[size=lg]/menu-button:top-2.5',
|
|
552
|
-
'group-data-[collapsible=icon]:hidden',
|
|
553
|
-
className,
|
|
554
|
-
)}
|
|
555
|
-
{...props}
|
|
556
|
-
/>
|
|
557
|
-
);
|
|
558
|
-
}
|
|
559
|
-
|
|
560
|
-
function SidebarMenuSkeleton({
|
|
561
|
-
className,
|
|
562
|
-
showIcon = false,
|
|
563
|
-
...props
|
|
564
|
-
}: React.ComponentProps<'div'> & {
|
|
565
|
-
showIcon?: boolean;
|
|
566
|
-
}) {
|
|
567
|
-
// Random width between 50 to 90%.
|
|
568
|
-
const [width] = React.useState(() => {
|
|
569
|
-
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
570
|
-
});
|
|
571
|
-
|
|
572
|
-
return (
|
|
573
|
-
<div
|
|
574
|
-
data-slot="sidebar-menu-skeleton"
|
|
575
|
-
data-sidebar="menu-skeleton"
|
|
576
|
-
className={cn('flex h-8 items-center gap-2 rounded-md px-2', className)}
|
|
577
|
-
{...props}
|
|
578
|
-
>
|
|
579
|
-
{showIcon && <Skeleton className="size-4 rounded-md" data-sidebar="menu-skeleton-icon" />}
|
|
580
|
-
<Skeleton
|
|
581
|
-
className="h-4 max-w-(--skeleton-width) flex-1"
|
|
582
|
-
data-sidebar="menu-skeleton-text"
|
|
583
|
-
style={
|
|
584
|
-
{
|
|
585
|
-
'--skeleton-width': width,
|
|
586
|
-
} as React.CSSProperties
|
|
587
|
-
}
|
|
588
|
-
/>
|
|
589
|
-
</div>
|
|
590
|
-
);
|
|
591
|
-
}
|
|
592
|
-
|
|
593
|
-
function SidebarMenuSub({ className, ...props }: React.ComponentProps<'ul'>) {
|
|
594
|
-
return (
|
|
595
|
-
<ul
|
|
596
|
-
data-slot="sidebar-menu-sub"
|
|
597
|
-
data-sidebar="menu-sub"
|
|
598
|
-
className={cn(
|
|
599
|
-
'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',
|
|
600
|
-
'group-data-[collapsible=icon]:hidden',
|
|
601
|
-
className,
|
|
602
|
-
)}
|
|
603
|
-
{...props}
|
|
604
|
-
/>
|
|
605
|
-
);
|
|
606
|
-
}
|
|
607
|
-
|
|
608
|
-
function SidebarMenuSubItem({ className, ...props }: React.ComponentProps<'li'>) {
|
|
609
|
-
return (
|
|
610
|
-
<li
|
|
611
|
-
data-slot="sidebar-menu-sub-item"
|
|
612
|
-
data-sidebar="menu-sub-item"
|
|
613
|
-
className={cn('group/menu-sub-item relative', className)}
|
|
614
|
-
{...props}
|
|
615
|
-
/>
|
|
616
|
-
);
|
|
617
|
-
}
|
|
618
|
-
|
|
619
|
-
function SidebarMenuSubButton({
|
|
620
|
-
asChild = false,
|
|
621
|
-
size = 'md',
|
|
622
|
-
isActive = false,
|
|
623
|
-
className,
|
|
624
|
-
...props
|
|
625
|
-
}: React.ComponentProps<'a'> & {
|
|
626
|
-
asChild?: boolean;
|
|
627
|
-
size?: 'sm' | 'md';
|
|
628
|
-
isActive?: boolean;
|
|
629
|
-
}) {
|
|
630
|
-
const Comp = asChild ? Slot : 'a';
|
|
631
|
-
|
|
632
|
-
return (
|
|
633
|
-
<Comp
|
|
634
|
-
data-slot="sidebar-menu-sub-button"
|
|
635
|
-
data-sidebar="menu-sub-button"
|
|
636
|
-
data-size={size}
|
|
637
|
-
data-active={isActive}
|
|
638
|
-
className={cn(
|
|
639
|
-
'text-sidebar-foreground ring-sidebar-ring hover:bg-primary-50 dark:hover:bg-primary-900/30 active:bg-primary-50 dark:active:bg-primary-900/30 [&>svg]:text-muted-foreground flex min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 py-2 outline-hidden transition-all duration-300 ease-in-out 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',
|
|
640
|
-
'data-[active=true]:bg-primary data-[active=true]:text-primary-foreground',
|
|
641
|
-
size === 'sm' && 'text-sm',
|
|
642
|
-
size === 'md' && 'text-base',
|
|
643
|
-
'group-data-[collapsible=icon]:hidden',
|
|
644
|
-
className,
|
|
645
|
-
)}
|
|
646
|
-
{...props}
|
|
647
|
-
/>
|
|
648
|
-
);
|
|
649
|
-
}
|
|
650
|
-
|
|
651
|
-
export {
|
|
652
|
-
Sidebar,
|
|
653
|
-
SidebarContent,
|
|
654
|
-
SidebarFooter,
|
|
655
|
-
SidebarGroup,
|
|
656
|
-
SidebarGroupAction,
|
|
657
|
-
SidebarGroupContent,
|
|
658
|
-
SidebarGroupLabel,
|
|
659
|
-
SidebarHeader,
|
|
660
|
-
SidebarInput,
|
|
661
|
-
SidebarInset,
|
|
662
|
-
SidebarMenu,
|
|
663
|
-
SidebarMenuAction,
|
|
664
|
-
SidebarMenuBadge,
|
|
665
|
-
SidebarMenuButton,
|
|
666
|
-
SidebarMenuItem,
|
|
667
|
-
SidebarMenuSkeleton,
|
|
668
|
-
SidebarMenuSub,
|
|
669
|
-
SidebarMenuSubButton,
|
|
670
|
-
SidebarMenuSubItem,
|
|
671
|
-
SidebarProvider,
|
|
672
|
-
SidebarRail,
|
|
673
|
-
SidebarSeparator,
|
|
674
|
-
SidebarTrigger,
|
|
675
|
-
useSidebar,
|
|
676
|
-
};
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import type { Meta, StoryObj } from '@storybook/react';
|
|
2
|
-
|
|
3
|
-
import { Skeleton } from './index';
|
|
4
|
-
|
|
5
|
-
const meta: Meta<typeof Skeleton> = {
|
|
6
|
-
title: 'UI/Skeleton',
|
|
7
|
-
component: Skeleton,
|
|
8
|
-
tags: ['autodocs'],
|
|
9
|
-
};
|
|
10
|
-
|
|
11
|
-
export default meta;
|
|
12
|
-
type Story = StoryObj<typeof Skeleton>;
|
|
13
|
-
|
|
14
|
-
export const Default: Story = {
|
|
15
|
-
render: (args) => (
|
|
16
|
-
<div className="flex items-center space-x-4">
|
|
17
|
-
<Skeleton {...args} className="h-12 w-12 rounded-full" />
|
|
18
|
-
<div className="space-y-2">
|
|
19
|
-
<Skeleton {...args} className="h-4 w-62.5" />
|
|
20
|
-
<Skeleton {...args} className="h-4 w-50" />
|
|
21
|
-
</div>
|
|
22
|
-
</div>
|
|
23
|
-
),
|
|
24
|
-
};
|
|
25
|
-
|
|
26
|
-
export const CardSkeleton: Story = {
|
|
27
|
-
render: (args) => (
|
|
28
|
-
<div className="flex flex-col space-y-3">
|
|
29
|
-
<Skeleton {...args} className="h-31.25 w-62.5 rounded-xl" />
|
|
30
|
-
<div className="space-y-2">
|
|
31
|
-
<Skeleton {...args} className="h-4 w-62.5" />
|
|
32
|
-
<Skeleton {...args} className="h-4 w-50" />
|
|
33
|
-
</div>
|
|
34
|
-
</div>
|
|
35
|
-
),
|
|
36
|
-
};
|