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