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