@mzc-fe/design-system 0.0.6 → 0.0.7-rc.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/components/accordion/accordion.tsx +114 -0
- package/components/accordion/index.ts +1 -0
- package/components/alert/alert.tsx +97 -0
- package/components/alert/index.ts +1 -0
- package/components/alert-dialog/alert-dialog.tsx +190 -0
- package/components/alert-dialog/index.ts +1 -0
- package/components/aspect-ratio/aspect-ratio.tsx +23 -0
- package/components/aspect-ratio/index.ts +1 -0
- package/components/avatar/avatar.tsx +62 -0
- package/components/avatar/index.ts +1 -0
- package/components/badge/badge.tsx +58 -0
- package/components/badge/index.ts +1 -0
- package/components/breadcrumb/breadcrumb.tsx +132 -0
- package/components/breadcrumb/index.ts +1 -0
- package/components/button/button.tsx +77 -0
- package/components/button/index.ts +1 -0
- package/components/button-group/button-group.tsx +99 -0
- package/components/button-group/index.ts +1 -0
- package/components/calendar/calendar.tsx +235 -0
- package/components/calendar/index.ts +1 -0
- package/components/card/card.tsx +107 -0
- package/components/card/index.ts +1 -0
- package/components/carousel/carousel.tsx +263 -0
- package/components/carousel/index.ts +1 -0
- package/components/chart/chart.tsx +377 -0
- package/components/chart/index.ts +1 -0
- package/components/checkbox/checkbox.tsx +41 -0
- package/components/checkbox/index.ts +1 -0
- package/components/collapsible/collapsible.tsx +44 -0
- package/components/collapsible/index.ts +1 -0
- package/components/command/command.tsx +201 -0
- package/components/command/index.ts +1 -0
- package/components/context-menu/context-menu.tsx +270 -0
- package/components/context-menu/index.ts +1 -0
- package/components/dialog/dialog.tsx +166 -0
- package/components/dialog/index.ts +1 -0
- package/components/drawer/drawer.tsx +154 -0
- package/components/drawer/index.ts +1 -0
- package/components/dropdown-menu/dropdown-menu.tsx +276 -0
- package/components/dropdown-menu/index.ts +1 -0
- package/components/empty/empty.tsx +129 -0
- package/components/empty/index.ts +1 -0
- package/components/field/field.tsx +272 -0
- package/components/field/index.ts +1 -0
- package/components/form/form.tsx +197 -0
- package/components/form/index.ts +1 -0
- package/components/hover-card/hover-card.tsx +57 -0
- package/components/hover-card/index.ts +1 -0
- package/components/input/index.ts +1 -0
- package/components/input/input.tsx +31 -0
- package/components/input-group/index.ts +1 -0
- package/components/input-group/input-group.tsx +189 -0
- package/components/input-otp/index.ts +1 -0
- package/components/input-otp/input-otp.tsx +99 -0
- package/components/item/index.ts +1 -0
- package/components/item/item.tsx +225 -0
- package/components/kbd/index.ts +1 -0
- package/components/kbd/kbd.tsx +38 -0
- package/components/label/index.ts +1 -0
- package/components/label/label.tsx +33 -0
- package/components/menubar/index.ts +1 -0
- package/components/menubar/menubar.tsx +299 -0
- package/components/navigation-menu/index.ts +1 -0
- package/components/navigation-menu/navigation-menu.tsx +194 -0
- package/components/pagination/index.ts +1 -0
- package/components/pagination/pagination.tsx +153 -0
- package/components/popover/index.ts +1 -0
- package/components/popover/popover.tsx +106 -0
- package/components/progress/index.ts +1 -0
- package/components/progress/progress.tsx +39 -0
- package/components/radio-group/index.ts +1 -0
- package/components/radio-group/radio-group.tsx +57 -0
- package/components/resizable/index.ts +1 -0
- package/components/resizable/resizable.tsx +73 -0
- package/components/scroll-area/index.ts +1 -0
- package/components/scroll-area/scroll-area.tsx +72 -0
- package/components/select/index.ts +1 -0
- package/components/select/select.tsx +213 -0
- package/components/separator/index.ts +1 -0
- package/components/separator/separator.tsx +39 -0
- package/components/sheet/index.ts +1 -0
- package/components/sheet/sheet.tsx +160 -0
- package/components/sidebar/index.ts +1 -0
- package/components/sidebar/sidebar.tsx +776 -0
- package/components/skeleton/index.ts +1 -0
- package/components/skeleton/skeleton.tsx +21 -0
- package/components/slider/index.ts +1 -0
- package/components/slider/slider.tsx +75 -0
- package/components/sonner/index.ts +2 -0
- package/components/sonner/sonner.tsx +52 -0
- package/components/spinner/index.ts +1 -0
- package/components/spinner/spinner.tsx +26 -0
- package/components/switch/index.ts +1 -0
- package/components/switch/switch.tsx +39 -0
- package/components/table/index.ts +1 -0
- package/components/table/table.tsx +140 -0
- package/components/tabs/index.ts +1 -0
- package/components/tabs/tabs.tsx +94 -0
- package/components/textarea/index.ts +1 -0
- package/components/textarea/textarea.tsx +26 -0
- package/components/toggle/index.ts +1 -0
- package/components/toggle/toggle.tsx +58 -0
- package/components/toggle-group/index.ts +1 -0
- package/components/toggle-group/toggle-group.tsx +97 -0
- package/components/tooltip/index.ts +1 -0
- package/components/tooltip/tooltip.tsx +82 -0
- package/dist/components/accordion/accordion.d.ts +50 -0
- package/dist/components/alert/alert.d.ts +31 -0
- package/dist/components/alert-dialog/alert-dialog.d.ts +35 -0
- package/dist/components/aspect-ratio/aspect-ratio.d.ts +12 -0
- package/dist/components/avatar/avatar.d.ts +11 -0
- package/dist/components/badge/badge.d.ts +12 -0
- package/dist/components/breadcrumb/breadcrumb.d.ts +23 -0
- package/dist/components/button/button.d.ts +15 -0
- package/dist/components/button-group/button-group.d.ts +16 -0
- package/dist/components/calendar/calendar.d.ts +15 -0
- package/dist/components/card/card.d.ts +15 -0
- package/dist/components/carousel/carousel.d.ts +24 -0
- package/dist/components/chart/chart.d.ts +20 -0
- package/dist/components/checkbox/checkbox.d.ts +9 -0
- package/dist/components/collapsible/collapsible.d.ts +13 -0
- package/dist/components/command/command.d.ts +18 -0
- package/dist/components/context-menu/context-menu.d.ts +18 -0
- package/dist/components/dialog/dialog.d.ts +25 -0
- package/dist/components/drawer/drawer.d.ts +18 -0
- package/dist/components/dropdown-menu/dropdown-menu.d.ts +21 -0
- package/dist/components/empty/empty.d.ts +25 -0
- package/dist/components/field/field.d.ts +26 -0
- package/dist/components/form/form.d.ts +30 -1
- package/dist/components/hover-card/hover-card.d.ts +13 -0
- package/dist/components/input/input.d.ts +10 -0
- package/dist/components/input-group/input-group.d.ts +19 -0
- package/dist/components/input-otp/input-otp.d.ts +23 -0
- package/dist/components/item/item.d.ts +33 -1
- package/dist/components/kbd/kbd.d.ts +10 -0
- package/dist/components/label/label.d.ts +9 -0
- package/dist/components/menubar/menubar.d.ts +25 -0
- package/dist/components/navigation-menu/navigation-menu.d.ts +26 -0
- package/dist/components/pagination/pagination.d.ts +26 -0
- package/dist/components/popover/popover.d.ts +17 -0
- package/dist/components/progress/progress.d.ts +10 -0
- package/dist/components/radio-group/radio-group.d.ts +12 -0
- package/dist/components/resizable/resizable.d.ts +19 -0
- package/dist/components/scroll-area/scroll-area.d.ts +14 -0
- package/dist/components/select/select.d.ts +25 -0
- package/dist/components/separator/separator.d.ts +11 -0
- package/dist/components/sheet/sheet.d.ts +23 -0
- package/dist/components/sidebar/sidebar.d.ts +50 -0
- package/dist/components/skeleton/skeleton.d.ts +8 -0
- package/dist/components/slider/slider.d.ts +12 -0
- package/dist/components/sonner/sonner.d.ts +14 -0
- package/dist/components/spinner/spinner.d.ts +9 -0
- package/dist/components/switch/switch.d.ts +8 -0
- package/dist/components/table/table.d.ts +26 -0
- package/dist/components/tabs/tabs.d.ts +16 -6
- package/dist/components/textarea/textarea.d.ts +8 -0
- package/dist/components/toggle/toggle.d.ts +13 -0
- package/dist/components/toggle-group/toggle-group.d.ts +1 -0
- package/dist/components/tooltip/tooltip.d.ts +21 -0
- package/dist/design-system.css +1 -1
- package/dist/design-system.es.js +3481 -28494
- package/dist/design-system.umd.js +4 -257
- package/foundations/ThemeProvider.tsx +77 -0
- package/foundations/color.css +232 -0
- package/foundations/palette.css +249 -0
- package/foundations/spacing.css +8 -0
- package/foundations/typography.css +143 -0
- package/hooks/use-mobile.ts +19 -0
- package/index.css +173 -0
- package/index.ts +339 -0
- package/lib/utils.ts +6 -0
- package/package.json +40 -19
- package/README.md +0 -184
|
@@ -0,0 +1,776 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
import * as React from "react";
|
|
4
|
+
import { Slot } from "@radix-ui/react-slot";
|
|
5
|
+
import { cva, type VariantProps } from "class-variance-authority";
|
|
6
|
+
import { PanelLeftIcon } from "lucide-react";
|
|
7
|
+
|
|
8
|
+
import { useIsMobile } from "@/hooks/use-mobile";
|
|
9
|
+
import { cn } from "@/lib/utils";
|
|
10
|
+
import { Button } from "@/components/button";
|
|
11
|
+
import { Input } from "@/components/input";
|
|
12
|
+
import { Separator } from "@/components/separator";
|
|
13
|
+
import {
|
|
14
|
+
Sheet,
|
|
15
|
+
SheetContent,
|
|
16
|
+
SheetDescription,
|
|
17
|
+
SheetHeader,
|
|
18
|
+
SheetTitle,
|
|
19
|
+
} from "@/components/sheet";
|
|
20
|
+
import { Skeleton } from "@/components/skeleton";
|
|
21
|
+
import {
|
|
22
|
+
Tooltip,
|
|
23
|
+
TooltipContent,
|
|
24
|
+
TooltipProvider,
|
|
25
|
+
TooltipTrigger,
|
|
26
|
+
} from "@/components/tooltip";
|
|
27
|
+
|
|
28
|
+
const SIDEBAR_COOKIE_NAME = "sidebar_state";
|
|
29
|
+
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7;
|
|
30
|
+
const SIDEBAR_WIDTH = "16rem";
|
|
31
|
+
const SIDEBAR_WIDTH_MOBILE = "18rem";
|
|
32
|
+
const SIDEBAR_WIDTH_ICON = "3rem";
|
|
33
|
+
const SIDEBAR_KEYBOARD_SHORTCUT = "b";
|
|
34
|
+
|
|
35
|
+
type SidebarContextProps = {
|
|
36
|
+
state: "expanded" | "collapsed";
|
|
37
|
+
open: boolean;
|
|
38
|
+
setOpen: (open: boolean) => void;
|
|
39
|
+
openMobile: boolean;
|
|
40
|
+
setOpenMobile: (open: boolean) => void;
|
|
41
|
+
isMobile: boolean;
|
|
42
|
+
toggleSidebar: () => void;
|
|
43
|
+
};
|
|
44
|
+
|
|
45
|
+
const SidebarContext = React.createContext<SidebarContextProps | null>(null);
|
|
46
|
+
|
|
47
|
+
function useSidebar() {
|
|
48
|
+
const context = React.useContext(SidebarContext);
|
|
49
|
+
if (!context) {
|
|
50
|
+
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
51
|
+
}
|
|
52
|
+
|
|
53
|
+
return context;
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
/**
|
|
57
|
+
* 사이드바 상태를 관리하는 Provider 컴포넌트입니다.
|
|
58
|
+
*
|
|
59
|
+
* @param props.defaultOpen - 초기 열림 상태
|
|
60
|
+
* @param props.open - 제어 모드 열림 상태
|
|
61
|
+
* @param props.onOpenChange - 열림 상태 변경 콜백
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```tsx
|
|
65
|
+
* <SidebarProvider>
|
|
66
|
+
* <Sidebar>
|
|
67
|
+
* <SidebarHeader>헤더</SidebarHeader>
|
|
68
|
+
* <SidebarContent>콘텐츠</SidebarContent>
|
|
69
|
+
* <SidebarFooter>푸터</SidebarFooter>
|
|
70
|
+
* </Sidebar>
|
|
71
|
+
* <SidebarInset>메인 콘텐츠</SidebarInset>
|
|
72
|
+
* </SidebarProvider>
|
|
73
|
+
* ```
|
|
74
|
+
*/
|
|
75
|
+
function SidebarProvider({
|
|
76
|
+
defaultOpen = true,
|
|
77
|
+
open: openProp,
|
|
78
|
+
onOpenChange: setOpenProp,
|
|
79
|
+
className,
|
|
80
|
+
style,
|
|
81
|
+
children,
|
|
82
|
+
...props
|
|
83
|
+
}: React.ComponentProps<"div"> & {
|
|
84
|
+
defaultOpen?: boolean;
|
|
85
|
+
open?: boolean;
|
|
86
|
+
onOpenChange?: (open: boolean) => void;
|
|
87
|
+
}) {
|
|
88
|
+
const isMobile = useIsMobile();
|
|
89
|
+
const [openMobile, setOpenMobile] = React.useState(false);
|
|
90
|
+
|
|
91
|
+
// This is the internal state of the sidebar.
|
|
92
|
+
// We use openProp and setOpenProp for control from outside the component.
|
|
93
|
+
const [_open, _setOpen] = React.useState(defaultOpen);
|
|
94
|
+
const open = openProp ?? _open;
|
|
95
|
+
const setOpen = React.useCallback(
|
|
96
|
+
(value: boolean | ((value: boolean) => boolean)) => {
|
|
97
|
+
const openState = typeof value === "function" ? value(open) : value;
|
|
98
|
+
if (setOpenProp) {
|
|
99
|
+
setOpenProp(openState);
|
|
100
|
+
} else {
|
|
101
|
+
_setOpen(openState);
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
// This sets the cookie to keep the sidebar state.
|
|
105
|
+
document.cookie = `${SIDEBAR_COOKIE_NAME}=${openState}; path=/; max-age=${SIDEBAR_COOKIE_MAX_AGE}`;
|
|
106
|
+
},
|
|
107
|
+
[setOpenProp, open]
|
|
108
|
+
);
|
|
109
|
+
|
|
110
|
+
// Helper to toggle the sidebar.
|
|
111
|
+
const toggleSidebar = React.useCallback(() => {
|
|
112
|
+
return isMobile ? setOpenMobile((open) => !open) : setOpen((open) => !open);
|
|
113
|
+
}, [isMobile, setOpen, setOpenMobile]);
|
|
114
|
+
|
|
115
|
+
// Adds a keyboard shortcut to toggle the sidebar.
|
|
116
|
+
React.useEffect(() => {
|
|
117
|
+
const handleKeyDown = (event: KeyboardEvent) => {
|
|
118
|
+
if (
|
|
119
|
+
event.key === SIDEBAR_KEYBOARD_SHORTCUT &&
|
|
120
|
+
(event.metaKey || event.ctrlKey)
|
|
121
|
+
) {
|
|
122
|
+
event.preventDefault();
|
|
123
|
+
toggleSidebar();
|
|
124
|
+
}
|
|
125
|
+
};
|
|
126
|
+
|
|
127
|
+
window.addEventListener("keydown", handleKeyDown);
|
|
128
|
+
return () => window.removeEventListener("keydown", handleKeyDown);
|
|
129
|
+
}, [toggleSidebar]);
|
|
130
|
+
|
|
131
|
+
// We add a state so that we can do data-state="expanded" or "collapsed".
|
|
132
|
+
// This makes it easier to style the sidebar with Tailwind classes.
|
|
133
|
+
const state = open ? "expanded" : "collapsed";
|
|
134
|
+
|
|
135
|
+
const contextValue = React.useMemo<SidebarContextProps>(
|
|
136
|
+
() => ({
|
|
137
|
+
state,
|
|
138
|
+
open,
|
|
139
|
+
setOpen,
|
|
140
|
+
isMobile,
|
|
141
|
+
openMobile,
|
|
142
|
+
setOpenMobile,
|
|
143
|
+
toggleSidebar,
|
|
144
|
+
}),
|
|
145
|
+
[state, open, setOpen, isMobile, openMobile, setOpenMobile, toggleSidebar]
|
|
146
|
+
);
|
|
147
|
+
|
|
148
|
+
return (
|
|
149
|
+
<SidebarContext.Provider value={contextValue}>
|
|
150
|
+
<TooltipProvider delayDuration={0}>
|
|
151
|
+
<div
|
|
152
|
+
data-slot="sidebar-wrapper"
|
|
153
|
+
style={
|
|
154
|
+
{
|
|
155
|
+
"--sidebar-width": SIDEBAR_WIDTH,
|
|
156
|
+
"--sidebar-width-icon": SIDEBAR_WIDTH_ICON,
|
|
157
|
+
...style,
|
|
158
|
+
} as React.CSSProperties
|
|
159
|
+
}
|
|
160
|
+
className={cn(
|
|
161
|
+
"group/sidebar-wrapper has-data-[variant=inset]:bg-sidebar flex min-h-svh w-full",
|
|
162
|
+
className
|
|
163
|
+
)}
|
|
164
|
+
{...props}
|
|
165
|
+
>
|
|
166
|
+
{children}
|
|
167
|
+
</div>
|
|
168
|
+
</TooltipProvider>
|
|
169
|
+
</SidebarContext.Provider>
|
|
170
|
+
);
|
|
171
|
+
}
|
|
172
|
+
|
|
173
|
+
/**
|
|
174
|
+
* 사이드바 컴포넌트입니다.
|
|
175
|
+
* @param props.side - 위치 ('left' | 'right')
|
|
176
|
+
* @param props.variant - 스타일 변형 ('sidebar' | 'floating' | 'inset')
|
|
177
|
+
* @param props.collapsible - 접힘 방식 ('offcanvas' | 'icon' | 'none')
|
|
178
|
+
*/
|
|
179
|
+
function Sidebar({
|
|
180
|
+
side = "left",
|
|
181
|
+
variant = "sidebar",
|
|
182
|
+
collapsible = "offcanvas",
|
|
183
|
+
className,
|
|
184
|
+
children,
|
|
185
|
+
...props
|
|
186
|
+
}: React.ComponentProps<"div"> & {
|
|
187
|
+
side?: "left" | "right";
|
|
188
|
+
variant?: "sidebar" | "floating" | "inset";
|
|
189
|
+
collapsible?: "offcanvas" | "icon" | "none";
|
|
190
|
+
}) {
|
|
191
|
+
const { isMobile, state, openMobile, setOpenMobile } = useSidebar();
|
|
192
|
+
|
|
193
|
+
if (collapsible === "none") {
|
|
194
|
+
return (
|
|
195
|
+
<div
|
|
196
|
+
data-slot="sidebar"
|
|
197
|
+
className={cn(
|
|
198
|
+
"bg-sidebar text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",
|
|
199
|
+
className
|
|
200
|
+
)}
|
|
201
|
+
{...props}
|
|
202
|
+
>
|
|
203
|
+
{children}
|
|
204
|
+
</div>
|
|
205
|
+
);
|
|
206
|
+
}
|
|
207
|
+
|
|
208
|
+
if (isMobile) {
|
|
209
|
+
return (
|
|
210
|
+
<Sheet open={openMobile} onOpenChange={setOpenMobile} {...props}>
|
|
211
|
+
<SheetContent
|
|
212
|
+
data-sidebar="sidebar"
|
|
213
|
+
data-slot="sidebar"
|
|
214
|
+
data-mobile="true"
|
|
215
|
+
className="bg-sidebar text-sidebar-foreground w-(--sidebar-width) p-0 [&>button]:hidden"
|
|
216
|
+
style={
|
|
217
|
+
{
|
|
218
|
+
"--sidebar-width": SIDEBAR_WIDTH_MOBILE,
|
|
219
|
+
} as React.CSSProperties
|
|
220
|
+
}
|
|
221
|
+
side={side}
|
|
222
|
+
>
|
|
223
|
+
<SheetHeader className="sr-only">
|
|
224
|
+
<SheetTitle>Sidebar</SheetTitle>
|
|
225
|
+
<SheetDescription>Displays the mobile sidebar.</SheetDescription>
|
|
226
|
+
</SheetHeader>
|
|
227
|
+
<div className="flex h-full w-full flex-col">{children}</div>
|
|
228
|
+
</SheetContent>
|
|
229
|
+
</Sheet>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
|
|
233
|
+
return (
|
|
234
|
+
<div
|
|
235
|
+
className="group peer text-sidebar-foreground hidden md:block"
|
|
236
|
+
data-state={state}
|
|
237
|
+
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
238
|
+
data-variant={variant}
|
|
239
|
+
data-side={side}
|
|
240
|
+
data-slot="sidebar"
|
|
241
|
+
>
|
|
242
|
+
{/* This is what handles the sidebar gap on desktop */}
|
|
243
|
+
<div
|
|
244
|
+
data-slot="sidebar-gap"
|
|
245
|
+
className={cn(
|
|
246
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-200 ease-linear",
|
|
247
|
+
"group-data-[collapsible=offcanvas]:w-0",
|
|
248
|
+
"group-data-[side=right]:rotate-180",
|
|
249
|
+
variant === "floating" || variant === "inset"
|
|
250
|
+
? "group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4)))]"
|
|
251
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon)"
|
|
252
|
+
)}
|
|
253
|
+
/>
|
|
254
|
+
<div
|
|
255
|
+
data-slot="sidebar-container"
|
|
256
|
+
className={cn(
|
|
257
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-200 ease-linear md:flex",
|
|
258
|
+
side === "left"
|
|
259
|
+
? "left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]"
|
|
260
|
+
: "right-0 group-data-[collapsible=offcanvas]:right-[calc(var(--sidebar-width)*-1)]",
|
|
261
|
+
// Adjust the padding for floating and inset variants.
|
|
262
|
+
variant === "floating" || variant === "inset"
|
|
263
|
+
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
264
|
+
: "group-data-[collapsible=icon]:w-(--sidebar-width-icon) group-data-[side=left]:border-r group-data-[side=right]:border-l",
|
|
265
|
+
className
|
|
266
|
+
)}
|
|
267
|
+
{...props}
|
|
268
|
+
>
|
|
269
|
+
<div
|
|
270
|
+
data-sidebar="sidebar"
|
|
271
|
+
data-slot="sidebar-inner"
|
|
272
|
+
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"
|
|
273
|
+
>
|
|
274
|
+
{children}
|
|
275
|
+
</div>
|
|
276
|
+
</div>
|
|
277
|
+
</div>
|
|
278
|
+
);
|
|
279
|
+
}
|
|
280
|
+
|
|
281
|
+
/** 사이드바를 토글하는 버튼입니다. */
|
|
282
|
+
function SidebarTrigger({
|
|
283
|
+
className,
|
|
284
|
+
onClick,
|
|
285
|
+
...props
|
|
286
|
+
}: React.ComponentProps<typeof Button>) {
|
|
287
|
+
const { toggleSidebar } = useSidebar();
|
|
288
|
+
|
|
289
|
+
return (
|
|
290
|
+
<Button
|
|
291
|
+
data-sidebar="trigger"
|
|
292
|
+
data-slot="sidebar-trigger"
|
|
293
|
+
variant="ghost"
|
|
294
|
+
size="icon"
|
|
295
|
+
className={cn("size-7", className)}
|
|
296
|
+
onClick={(event) => {
|
|
297
|
+
onClick?.(event);
|
|
298
|
+
toggleSidebar();
|
|
299
|
+
}}
|
|
300
|
+
{...props}
|
|
301
|
+
>
|
|
302
|
+
<PanelLeftIcon />
|
|
303
|
+
<span className="sr-only">Toggle Sidebar</span>
|
|
304
|
+
</Button>
|
|
305
|
+
);
|
|
306
|
+
}
|
|
307
|
+
|
|
308
|
+
/** 사이드바 가장자리의 토글 레일입니다. */
|
|
309
|
+
function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
|
|
310
|
+
const { toggleSidebar } = useSidebar();
|
|
311
|
+
|
|
312
|
+
return (
|
|
313
|
+
<button
|
|
314
|
+
data-sidebar="rail"
|
|
315
|
+
data-slot="sidebar-rail"
|
|
316
|
+
aria-label="Toggle Sidebar"
|
|
317
|
+
tabIndex={-1}
|
|
318
|
+
onClick={toggleSidebar}
|
|
319
|
+
title="Toggle Sidebar"
|
|
320
|
+
className={cn(
|
|
321
|
+
"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",
|
|
322
|
+
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
323
|
+
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
324
|
+
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
325
|
+
"[[data-side=left][data-collapsible=offcanvas]_&]:-right-2",
|
|
326
|
+
"[[data-side=right][data-collapsible=offcanvas]_&]:-left-2",
|
|
327
|
+
className
|
|
328
|
+
)}
|
|
329
|
+
{...props}
|
|
330
|
+
/>
|
|
331
|
+
);
|
|
332
|
+
}
|
|
333
|
+
|
|
334
|
+
/** 사이드바 옆 메인 콘텐츠 영역입니다. */
|
|
335
|
+
function SidebarInset({ className, ...props }: React.ComponentProps<"main">) {
|
|
336
|
+
return (
|
|
337
|
+
<main
|
|
338
|
+
data-slot="sidebar-inset"
|
|
339
|
+
className={cn(
|
|
340
|
+
"bg-background relative flex w-full flex-1 flex-col",
|
|
341
|
+
"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",
|
|
342
|
+
className
|
|
343
|
+
)}
|
|
344
|
+
{...props}
|
|
345
|
+
/>
|
|
346
|
+
);
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
/** 사이드바 내 검색 입력 필드입니다. */
|
|
350
|
+
function SidebarInput({
|
|
351
|
+
className,
|
|
352
|
+
...props
|
|
353
|
+
}: React.ComponentProps<typeof Input>) {
|
|
354
|
+
return (
|
|
355
|
+
<Input
|
|
356
|
+
data-slot="sidebar-input"
|
|
357
|
+
data-sidebar="input"
|
|
358
|
+
className={cn("bg-background h-8 w-full shadow-none", className)}
|
|
359
|
+
{...props}
|
|
360
|
+
/>
|
|
361
|
+
);
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
/** 사이드바의 헤더 영역입니다. */
|
|
365
|
+
function SidebarHeader({ className, ...props }: React.ComponentProps<"div">) {
|
|
366
|
+
return (
|
|
367
|
+
<div
|
|
368
|
+
data-slot="sidebar-header"
|
|
369
|
+
data-sidebar="header"
|
|
370
|
+
className={cn("flex flex-col gap-2 p-2", className)}
|
|
371
|
+
{...props}
|
|
372
|
+
/>
|
|
373
|
+
);
|
|
374
|
+
}
|
|
375
|
+
|
|
376
|
+
/** 사이드바의 푸터 영역입니다. */
|
|
377
|
+
function SidebarFooter({ className, ...props }: React.ComponentProps<"div">) {
|
|
378
|
+
return (
|
|
379
|
+
<div
|
|
380
|
+
data-slot="sidebar-footer"
|
|
381
|
+
data-sidebar="footer"
|
|
382
|
+
className={cn("flex flex-col gap-2 p-2", className)}
|
|
383
|
+
{...props}
|
|
384
|
+
/>
|
|
385
|
+
);
|
|
386
|
+
}
|
|
387
|
+
|
|
388
|
+
/** 사이드바 내 구분선입니다. */
|
|
389
|
+
function SidebarSeparator({
|
|
390
|
+
className,
|
|
391
|
+
...props
|
|
392
|
+
}: React.ComponentProps<typeof Separator>) {
|
|
393
|
+
return (
|
|
394
|
+
<Separator
|
|
395
|
+
data-slot="sidebar-separator"
|
|
396
|
+
data-sidebar="separator"
|
|
397
|
+
className={cn("bg-sidebar-border mx-2 w-auto", className)}
|
|
398
|
+
{...props}
|
|
399
|
+
/>
|
|
400
|
+
);
|
|
401
|
+
}
|
|
402
|
+
|
|
403
|
+
/** 사이드바의 스크롤 가능한 콘텐츠 영역입니다. */
|
|
404
|
+
function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
405
|
+
return (
|
|
406
|
+
<div
|
|
407
|
+
data-slot="sidebar-content"
|
|
408
|
+
data-sidebar="content"
|
|
409
|
+
className={cn(
|
|
410
|
+
"flex min-h-0 flex-1 flex-col gap-2 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
411
|
+
className
|
|
412
|
+
)}
|
|
413
|
+
{...props}
|
|
414
|
+
/>
|
|
415
|
+
);
|
|
416
|
+
}
|
|
417
|
+
|
|
418
|
+
/** 사이드바 메뉴를 그룹화하는 컴포넌트입니다. */
|
|
419
|
+
function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
420
|
+
return (
|
|
421
|
+
<div
|
|
422
|
+
data-slot="sidebar-group"
|
|
423
|
+
data-sidebar="group"
|
|
424
|
+
className={cn("relative flex w-full min-w-0 flex-col p-2", className)}
|
|
425
|
+
{...props}
|
|
426
|
+
/>
|
|
427
|
+
);
|
|
428
|
+
}
|
|
429
|
+
|
|
430
|
+
/** 사이드바 그룹의 레이블입니다. */
|
|
431
|
+
function SidebarGroupLabel({
|
|
432
|
+
className,
|
|
433
|
+
asChild = false,
|
|
434
|
+
...props
|
|
435
|
+
}: React.ComponentProps<"div"> & { asChild?: boolean }) {
|
|
436
|
+
const Comp = asChild ? Slot : "div";
|
|
437
|
+
|
|
438
|
+
return (
|
|
439
|
+
<Comp
|
|
440
|
+
data-slot="sidebar-group-label"
|
|
441
|
+
data-sidebar="group-label"
|
|
442
|
+
className={cn(
|
|
443
|
+
"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",
|
|
444
|
+
"group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",
|
|
445
|
+
className
|
|
446
|
+
)}
|
|
447
|
+
{...props}
|
|
448
|
+
/>
|
|
449
|
+
);
|
|
450
|
+
}
|
|
451
|
+
|
|
452
|
+
/** 사이드바 그룹의 액션 버튼입니다. */
|
|
453
|
+
function SidebarGroupAction({
|
|
454
|
+
className,
|
|
455
|
+
asChild = false,
|
|
456
|
+
...props
|
|
457
|
+
}: React.ComponentProps<"button"> & { asChild?: boolean }) {
|
|
458
|
+
const Comp = asChild ? Slot : "button";
|
|
459
|
+
|
|
460
|
+
return (
|
|
461
|
+
<Comp
|
|
462
|
+
data-slot="sidebar-group-action"
|
|
463
|
+
data-sidebar="group-action"
|
|
464
|
+
className={cn(
|
|
465
|
+
"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",
|
|
466
|
+
// Increases the hit area of the button on mobile.
|
|
467
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
468
|
+
"group-data-[collapsible=icon]:hidden",
|
|
469
|
+
className
|
|
470
|
+
)}
|
|
471
|
+
{...props}
|
|
472
|
+
/>
|
|
473
|
+
);
|
|
474
|
+
}
|
|
475
|
+
|
|
476
|
+
/** 사이드바 그룹의 콘텐츠 영역입니다. */
|
|
477
|
+
function SidebarGroupContent({
|
|
478
|
+
className,
|
|
479
|
+
...props
|
|
480
|
+
}: React.ComponentProps<"div">) {
|
|
481
|
+
return (
|
|
482
|
+
<div
|
|
483
|
+
data-slot="sidebar-group-content"
|
|
484
|
+
data-sidebar="group-content"
|
|
485
|
+
className={cn("w-full text-sm", className)}
|
|
486
|
+
{...props}
|
|
487
|
+
/>
|
|
488
|
+
);
|
|
489
|
+
}
|
|
490
|
+
|
|
491
|
+
/** 사이드바 메뉴 목록입니다. */
|
|
492
|
+
function SidebarMenu({ className, ...props }: React.ComponentProps<"ul">) {
|
|
493
|
+
return (
|
|
494
|
+
<ul
|
|
495
|
+
data-slot="sidebar-menu"
|
|
496
|
+
data-sidebar="menu"
|
|
497
|
+
className={cn("flex w-full min-w-0 flex-col gap-1", className)}
|
|
498
|
+
{...props}
|
|
499
|
+
/>
|
|
500
|
+
);
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
/** 사이드바 메뉴 아이템입니다. */
|
|
504
|
+
function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
505
|
+
return (
|
|
506
|
+
<li
|
|
507
|
+
data-slot="sidebar-menu-item"
|
|
508
|
+
data-sidebar="menu-item"
|
|
509
|
+
className={cn("group/menu-item relative", className)}
|
|
510
|
+
{...props}
|
|
511
|
+
/>
|
|
512
|
+
);
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
const sidebarMenuButtonVariants = cva(
|
|
516
|
+
"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",
|
|
517
|
+
{
|
|
518
|
+
variants: {
|
|
519
|
+
variant: {
|
|
520
|
+
default: "hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",
|
|
521
|
+
outline:
|
|
522
|
+
"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))]",
|
|
523
|
+
},
|
|
524
|
+
size: {
|
|
525
|
+
default: "h-8 text-sm",
|
|
526
|
+
sm: "h-7 text-xs",
|
|
527
|
+
lg: "h-12 text-sm group-data-[collapsible=icon]:p-0!",
|
|
528
|
+
},
|
|
529
|
+
},
|
|
530
|
+
defaultVariants: {
|
|
531
|
+
variant: "default",
|
|
532
|
+
size: "default",
|
|
533
|
+
},
|
|
534
|
+
}
|
|
535
|
+
);
|
|
536
|
+
|
|
537
|
+
/**
|
|
538
|
+
* 사이드바 메뉴 버튼입니다.
|
|
539
|
+
* @param props.isActive - 활성 상태
|
|
540
|
+
* @param props.tooltip - 축소 시 표시할 툴팁
|
|
541
|
+
*/
|
|
542
|
+
function SidebarMenuButton({
|
|
543
|
+
asChild = false,
|
|
544
|
+
isActive = false,
|
|
545
|
+
variant = "default",
|
|
546
|
+
size = "default",
|
|
547
|
+
tooltip,
|
|
548
|
+
className,
|
|
549
|
+
...props
|
|
550
|
+
}: React.ComponentProps<"button"> & {
|
|
551
|
+
asChild?: boolean;
|
|
552
|
+
isActive?: boolean;
|
|
553
|
+
tooltip?: string | React.ComponentProps<typeof TooltipContent>;
|
|
554
|
+
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
555
|
+
const Comp = asChild ? Slot : "button";
|
|
556
|
+
const { isMobile, state } = useSidebar();
|
|
557
|
+
|
|
558
|
+
const button = (
|
|
559
|
+
<Comp
|
|
560
|
+
data-slot="sidebar-menu-button"
|
|
561
|
+
data-sidebar="menu-button"
|
|
562
|
+
data-size={size}
|
|
563
|
+
data-active={isActive}
|
|
564
|
+
className={cn(sidebarMenuButtonVariants({ variant, size }), className)}
|
|
565
|
+
{...props}
|
|
566
|
+
/>
|
|
567
|
+
);
|
|
568
|
+
|
|
569
|
+
if (!tooltip) {
|
|
570
|
+
return button;
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if (typeof tooltip === "string") {
|
|
574
|
+
tooltip = {
|
|
575
|
+
children: tooltip,
|
|
576
|
+
};
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
return (
|
|
580
|
+
<Tooltip>
|
|
581
|
+
<TooltipTrigger asChild>{button}</TooltipTrigger>
|
|
582
|
+
<TooltipContent
|
|
583
|
+
side="right"
|
|
584
|
+
align="center"
|
|
585
|
+
hidden={state !== "collapsed" || isMobile}
|
|
586
|
+
{...tooltip}
|
|
587
|
+
/>
|
|
588
|
+
</Tooltip>
|
|
589
|
+
);
|
|
590
|
+
}
|
|
591
|
+
|
|
592
|
+
/** 사이드바 메뉴 아이템의 액션 버튼입니다. */
|
|
593
|
+
function SidebarMenuAction({
|
|
594
|
+
className,
|
|
595
|
+
asChild = false,
|
|
596
|
+
showOnHover = false,
|
|
597
|
+
...props
|
|
598
|
+
}: React.ComponentProps<"button"> & {
|
|
599
|
+
asChild?: boolean;
|
|
600
|
+
showOnHover?: boolean;
|
|
601
|
+
}) {
|
|
602
|
+
const Comp = asChild ? Slot : "button";
|
|
603
|
+
|
|
604
|
+
return (
|
|
605
|
+
<Comp
|
|
606
|
+
data-slot="sidebar-menu-action"
|
|
607
|
+
data-sidebar="menu-action"
|
|
608
|
+
className={cn(
|
|
609
|
+
"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",
|
|
610
|
+
// Increases the hit area of the button on mobile.
|
|
611
|
+
"after:absolute after:-inset-2 md:after:hidden",
|
|
612
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
613
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
614
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
615
|
+
"group-data-[collapsible=icon]:hidden",
|
|
616
|
+
showOnHover &&
|
|
617
|
+
"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",
|
|
618
|
+
className
|
|
619
|
+
)}
|
|
620
|
+
{...props}
|
|
621
|
+
/>
|
|
622
|
+
);
|
|
623
|
+
}
|
|
624
|
+
|
|
625
|
+
/** 사이드바 메뉴 아이템의 배지입니다. */
|
|
626
|
+
function SidebarMenuBadge({
|
|
627
|
+
className,
|
|
628
|
+
...props
|
|
629
|
+
}: React.ComponentProps<"div">) {
|
|
630
|
+
return (
|
|
631
|
+
<div
|
|
632
|
+
data-slot="sidebar-menu-badge"
|
|
633
|
+
data-sidebar="menu-badge"
|
|
634
|
+
className={cn(
|
|
635
|
+
"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",
|
|
636
|
+
"peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground",
|
|
637
|
+
"peer-data-[size=sm]/menu-button:top-1",
|
|
638
|
+
"peer-data-[size=default]/menu-button:top-1.5",
|
|
639
|
+
"peer-data-[size=lg]/menu-button:top-2.5",
|
|
640
|
+
"group-data-[collapsible=icon]:hidden",
|
|
641
|
+
className
|
|
642
|
+
)}
|
|
643
|
+
{...props}
|
|
644
|
+
/>
|
|
645
|
+
);
|
|
646
|
+
}
|
|
647
|
+
|
|
648
|
+
/** 로딩 중 표시할 스켈레톤 컴포넌트입니다. */
|
|
649
|
+
function SidebarMenuSkeleton({
|
|
650
|
+
className,
|
|
651
|
+
showIcon = false,
|
|
652
|
+
...props
|
|
653
|
+
}: React.ComponentProps<"div"> & {
|
|
654
|
+
showIcon?: boolean;
|
|
655
|
+
}) {
|
|
656
|
+
// Random width between 50 to 90%.
|
|
657
|
+
const width = React.useMemo(() => {
|
|
658
|
+
return `${Math.floor(Math.random() * 40) + 50}%`;
|
|
659
|
+
}, []);
|
|
660
|
+
|
|
661
|
+
return (
|
|
662
|
+
<div
|
|
663
|
+
data-slot="sidebar-menu-skeleton"
|
|
664
|
+
data-sidebar="menu-skeleton"
|
|
665
|
+
className={cn("flex h-8 items-center gap-2 rounded-md px-2", className)}
|
|
666
|
+
{...props}
|
|
667
|
+
>
|
|
668
|
+
{showIcon && (
|
|
669
|
+
<Skeleton
|
|
670
|
+
className="size-4 rounded-md"
|
|
671
|
+
data-sidebar="menu-skeleton-icon"
|
|
672
|
+
/>
|
|
673
|
+
)}
|
|
674
|
+
<Skeleton
|
|
675
|
+
className="h-4 max-w-(--skeleton-width) flex-1"
|
|
676
|
+
data-sidebar="menu-skeleton-text"
|
|
677
|
+
style={
|
|
678
|
+
{
|
|
679
|
+
"--skeleton-width": width,
|
|
680
|
+
} as React.CSSProperties
|
|
681
|
+
}
|
|
682
|
+
/>
|
|
683
|
+
</div>
|
|
684
|
+
);
|
|
685
|
+
}
|
|
686
|
+
|
|
687
|
+
/** 사이드바 하위 메뉴 목록입니다. */
|
|
688
|
+
function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
|
|
689
|
+
return (
|
|
690
|
+
<ul
|
|
691
|
+
data-slot="sidebar-menu-sub"
|
|
692
|
+
data-sidebar="menu-sub"
|
|
693
|
+
className={cn(
|
|
694
|
+
"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",
|
|
695
|
+
"group-data-[collapsible=icon]:hidden",
|
|
696
|
+
className
|
|
697
|
+
)}
|
|
698
|
+
{...props}
|
|
699
|
+
/>
|
|
700
|
+
);
|
|
701
|
+
}
|
|
702
|
+
|
|
703
|
+
/** 사이드바 하위 메뉴 아이템입니다. */
|
|
704
|
+
function SidebarMenuSubItem({
|
|
705
|
+
className,
|
|
706
|
+
...props
|
|
707
|
+
}: React.ComponentProps<"li">) {
|
|
708
|
+
return (
|
|
709
|
+
<li
|
|
710
|
+
data-slot="sidebar-menu-sub-item"
|
|
711
|
+
data-sidebar="menu-sub-item"
|
|
712
|
+
className={cn("group/menu-sub-item relative", className)}
|
|
713
|
+
{...props}
|
|
714
|
+
/>
|
|
715
|
+
);
|
|
716
|
+
}
|
|
717
|
+
|
|
718
|
+
/** 사이드바 하위 메뉴 버튼입니다. */
|
|
719
|
+
function SidebarMenuSubButton({
|
|
720
|
+
asChild = false,
|
|
721
|
+
size = "md",
|
|
722
|
+
isActive = false,
|
|
723
|
+
className,
|
|
724
|
+
...props
|
|
725
|
+
}: React.ComponentProps<"a"> & {
|
|
726
|
+
asChild?: boolean;
|
|
727
|
+
size?: "sm" | "md";
|
|
728
|
+
isActive?: boolean;
|
|
729
|
+
}) {
|
|
730
|
+
const Comp = asChild ? Slot : "a";
|
|
731
|
+
|
|
732
|
+
return (
|
|
733
|
+
<Comp
|
|
734
|
+
data-slot="sidebar-menu-sub-button"
|
|
735
|
+
data-sidebar="menu-sub-button"
|
|
736
|
+
data-size={size}
|
|
737
|
+
data-active={isActive}
|
|
738
|
+
className={cn(
|
|
739
|
+
"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",
|
|
740
|
+
"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",
|
|
741
|
+
size === "sm" && "text-xs",
|
|
742
|
+
size === "md" && "text-sm",
|
|
743
|
+
"group-data-[collapsible=icon]:hidden",
|
|
744
|
+
className
|
|
745
|
+
)}
|
|
746
|
+
{...props}
|
|
747
|
+
/>
|
|
748
|
+
);
|
|
749
|
+
}
|
|
750
|
+
|
|
751
|
+
export {
|
|
752
|
+
Sidebar,
|
|
753
|
+
SidebarContent,
|
|
754
|
+
SidebarFooter,
|
|
755
|
+
SidebarGroup,
|
|
756
|
+
SidebarGroupAction,
|
|
757
|
+
SidebarGroupContent,
|
|
758
|
+
SidebarGroupLabel,
|
|
759
|
+
SidebarHeader,
|
|
760
|
+
SidebarInput,
|
|
761
|
+
SidebarInset,
|
|
762
|
+
SidebarMenu,
|
|
763
|
+
SidebarMenuAction,
|
|
764
|
+
SidebarMenuBadge,
|
|
765
|
+
SidebarMenuButton,
|
|
766
|
+
SidebarMenuItem,
|
|
767
|
+
SidebarMenuSkeleton,
|
|
768
|
+
SidebarMenuSub,
|
|
769
|
+
SidebarMenuSubButton,
|
|
770
|
+
SidebarMenuSubItem,
|
|
771
|
+
SidebarProvider,
|
|
772
|
+
SidebarRail,
|
|
773
|
+
SidebarSeparator,
|
|
774
|
+
SidebarTrigger,
|
|
775
|
+
useSidebar,
|
|
776
|
+
};
|