@vendure-io/ui 2.2.0 → 3.0.0-next.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +19 -5
- package/src/components/atoms/accordion.tsx +21 -6
- package/src/components/atoms/alert-dialog.tsx +31 -6
- package/src/components/atoms/alert.tsx +72 -18
- package/src/components/atoms/avatar.tsx +12 -4
- package/src/components/atoms/badge.tsx +7 -2
- package/src/components/atoms/breadcrumb.tsx +493 -4
- package/src/components/atoms/button-group.tsx +30 -6
- package/src/components/atoms/button.tsx +128 -18
- package/src/components/atoms/calendar.tsx +6 -6
- package/src/components/atoms/card.tsx +130 -16
- package/src/components/atoms/carousel.tsx +16 -9
- package/src/components/atoms/chart.tsx +87 -1
- package/src/components/atoms/checkbox.tsx +85 -7
- package/src/components/atoms/collapsible.tsx +2 -1
- package/src/components/atoms/combobox.tsx +358 -29
- package/src/components/atoms/command.tsx +336 -13
- package/src/components/atoms/context-menu.tsx +28 -23
- package/src/components/atoms/dialog.tsx +173 -29
- package/src/components/atoms/direction.tsx +23 -2
- package/src/components/atoms/drawer.tsx +15 -10
- package/src/components/atoms/dropdown-menu.tsx +43 -28
- package/src/components/atoms/empty.tsx +5 -1
- package/src/components/atoms/field.tsx +41 -15
- package/src/components/atoms/hover-card.tsx +61 -8
- package/src/components/atoms/input-group.tsx +19 -11
- package/src/components/atoms/input-otp.tsx +6 -6
- package/src/components/atoms/input.tsx +7 -1
- package/src/components/atoms/item.tsx +3 -3
- package/src/components/atoms/kbd.tsx +32 -3
- package/src/components/atoms/label-swap.tsx +113 -0
- package/src/components/atoms/label.tsx +1 -1
- package/src/components/atoms/menubar.tsx +28 -26
- package/src/components/atoms/native-select.tsx +3 -2
- package/src/components/atoms/navigation-menu.tsx +13 -8
- package/src/components/atoms/pagination.tsx +2 -2
- package/src/components/atoms/popover.tsx +29 -6
- package/src/components/atoms/progress.tsx +46 -33
- package/src/components/atoms/radio-group.tsx +9 -4
- package/src/components/atoms/resizable.tsx +1 -1
- package/src/components/atoms/scroll-area.tsx +2 -2
- package/src/components/atoms/select.tsx +258 -19
- package/src/components/atoms/sheet.tsx +76 -23
- package/src/components/atoms/sidebar.tsx +405 -23
- package/src/components/atoms/skeleton.tsx +1 -1
- package/src/components/atoms/slider.tsx +1 -1
- package/src/components/atoms/sonner.tsx +128 -38
- package/src/components/atoms/spinner.tsx +1 -1
- package/src/components/atoms/switch.tsx +10 -5
- package/src/components/atoms/table.tsx +147 -7
- package/src/components/atoms/tabs.tsx +3 -3
- package/src/components/atoms/textarea.tsx +3 -1
- package/src/components/atoms/toggle-group.tsx +4 -2
- package/src/components/atoms/toggle.tsx +28 -6
- package/src/components/atoms/tooltip.tsx +85 -15
- package/src/components/molecules/anonymized-token.tsx +24 -8
- package/src/components/molecules/app-shell.tsx +53 -20
- package/src/components/molecules/arrow-link.tsx +40 -0
- package/src/components/molecules/chip.tsx +43 -4
- package/src/components/molecules/code-block.tsx +54 -31
- package/src/components/molecules/collapsible-section.tsx +129 -0
- package/src/components/molecules/confirm-dialog.tsx +122 -9
- package/src/components/molecules/copyable-text.tsx +75 -11
- package/src/components/molecules/count-badge.tsx +115 -0
- package/src/components/molecules/data-table/data-table-bulk-actions.tsx +32 -4
- package/src/components/molecules/data-table/data-table-column-header.tsx +20 -3
- package/src/components/molecules/data-table/data-table-filters.tsx +62 -22
- package/src/components/molecules/data-table/data-table-helpers.tsx +88 -1
- package/src/components/molecules/data-table/data-table-selection-storage.tsx +115 -0
- package/src/components/molecules/data-table/data-table-types.tsx +160 -4
- package/src/components/molecules/data-table/data-table-view-options.tsx +2 -2
- package/src/components/molecules/data-table/data-table.tsx +869 -81
- package/src/components/molecules/data-table/table-pagination.tsx +2 -2
- package/src/components/molecules/date-picker.tsx +13 -7
- package/src/components/molecules/date-range-picker.tsx +13 -6
- package/src/components/molecules/date-time-picker.tsx +13 -7
- package/src/components/molecules/date-time.tsx +8 -1
- package/src/components/molecules/direction-link.tsx +130 -0
- package/src/components/molecules/elapsed-time.tsx +223 -0
- package/src/components/molecules/file-dropzone.tsx +2 -2
- package/src/components/molecules/id-chip.tsx +169 -32
- package/src/components/molecules/inline-code.tsx +4 -0
- package/src/components/molecules/issued-secret.tsx +318 -0
- package/src/components/molecules/list-row.tsx +349 -0
- package/src/components/molecules/live-indicator.tsx +83 -0
- package/src/components/molecules/page-header.tsx +117 -5
- package/src/components/molecules/password-input.tsx +2 -2
- package/src/components/molecules/relative-time.tsx +85 -56
- package/src/components/molecules/search-trigger.tsx +111 -0
- package/src/components/molecules/secret-value.tsx +29 -9
- package/src/components/molecules/skip-link.tsx +1 -1
- package/src/components/molecules/stat-card.tsx +4 -4
- package/src/components/molecules/state-views/empty-state.tsx +35 -17
- package/src/components/molecules/state-views/error-state.tsx +32 -14
- package/src/components/molecules/status-badge.tsx +415 -49
- package/src/components/molecules/time-tooltip.tsx +140 -0
- package/src/components/molecules/timeline.tsx +246 -0
- package/src/components/molecules/visibility-icon.tsx +89 -0
- package/src/hooks/use-active-label-size.ts +66 -0
- package/src/hooks/use-apple-platform.ts +26 -0
- package/src/hooks/use-pinned-height.ts +55 -0
- package/src/hooks/use-scrolled.ts +27 -0
- package/src/lib/content-inset.ts +17 -0
- package/src/lib/control-name.ts +55 -0
- package/src/lib/dialog-padding.ts +48 -0
- package/src/lib/field-surface.ts +31 -0
- package/src/lib/format-elapsed.ts +67 -0
- package/src/lib/format-relative.ts +29 -1
- package/src/lib/highlight.ts +3 -3
- package/src/lib/menu-item.tsx +72 -0
- package/src/lib/outline-edge.ts +21 -0
- package/src/lib/popup-align.ts +67 -0
- package/src/lib/popup-direction.ts +22 -0
- package/src/lib/popup-motion.ts +19 -0
- package/src/lib/state-dictionary.ts +42 -6
- package/src/lib/syntax-colors.ts +8 -0
- package/src/lib/tint-recipes.ts +68 -0
- package/src/lib/tone-icons.ts +24 -0
- package/src/lib/trigger-slot.ts +16 -0
- package/src/lib/utils.ts +97 -1
|
@@ -23,13 +23,13 @@ import {
|
|
|
23
23
|
TooltipContent,
|
|
24
24
|
TooltipTrigger,
|
|
25
25
|
} from "@vendure-io/ui/components/atoms/tooltip"
|
|
26
|
-
import { PanelLeftIcon } from "lucide-react"
|
|
26
|
+
import { ChevronLeftIcon, ChevronsUpDownIcon, PanelLeftIcon } from "lucide-react"
|
|
27
27
|
|
|
28
28
|
const SIDEBAR_COOKIE_NAME = "sidebar_state"
|
|
29
29
|
const SIDEBAR_COOKIE_MAX_AGE = 60 * 60 * 24 * 7
|
|
30
|
-
const SIDEBAR_WIDTH = "
|
|
30
|
+
const SIDEBAR_WIDTH = "14.5rem"
|
|
31
31
|
const SIDEBAR_WIDTH_MOBILE = "18rem"
|
|
32
|
-
const SIDEBAR_WIDTH_ICON = "
|
|
32
|
+
const SIDEBAR_WIDTH_ICON = "3.75rem"
|
|
33
33
|
const SIDEBAR_KEYBOARD_SHORTCUT = "b"
|
|
34
34
|
|
|
35
35
|
type SidebarContextProps = {
|
|
@@ -205,9 +205,13 @@ function Sidebar({
|
|
|
205
205
|
)
|
|
206
206
|
}
|
|
207
207
|
|
|
208
|
+
// The sidebar's flex order follows its physical side, not its place in the
|
|
209
|
+
// markup, so the gap that keeps its width sits on the same side as the
|
|
210
|
+
// fixed container: at the start of the line for the start side, at the end
|
|
211
|
+
// for the end side, in either direction.
|
|
208
212
|
return (
|
|
209
213
|
<div
|
|
210
|
-
className="group peer text-sidebar-foreground hidden md:block"
|
|
214
|
+
className="group peer text-sidebar-foreground hidden md:block data-[side=left]:order-first data-[side=left]:rtl:order-last data-[side=right]:order-last data-[side=right]:rtl:order-first"
|
|
211
215
|
data-state={state}
|
|
212
216
|
data-collapsible={state === "collapsed" ? collapsible : ""}
|
|
213
217
|
data-variant={variant}
|
|
@@ -218,7 +222,7 @@ function Sidebar({
|
|
|
218
222
|
<div
|
|
219
223
|
data-slot="sidebar-gap"
|
|
220
224
|
className={cn(
|
|
221
|
-
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-
|
|
225
|
+
"relative w-(--sidebar-width) bg-transparent transition-[width] duration-slow ease-drawer motion-reduce:transition-none",
|
|
222
226
|
"group-data-[collapsible=offcanvas]:w-0",
|
|
223
227
|
"group-data-[side=right]:rotate-180",
|
|
224
228
|
variant === "floating" || variant === "inset"
|
|
@@ -230,7 +234,7 @@ function Sidebar({
|
|
|
230
234
|
data-slot="sidebar-container"
|
|
231
235
|
data-side={side}
|
|
232
236
|
className={cn(
|
|
233
|
-
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-
|
|
237
|
+
"fixed inset-y-0 z-10 hidden h-svh w-(--sidebar-width) transition-[left,right,width] duration-slow ease-drawer motion-reduce:transition-none 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
238
|
// Adjust the padding for floating and inset variants.
|
|
235
239
|
variant === "floating" || variant === "inset"
|
|
236
240
|
? "p-2 group-data-[collapsible=icon]:w-[calc(var(--sidebar-width-icon)+(--spacing(4))+2px)]"
|
|
@@ -289,7 +293,7 @@ function SidebarRail({ className, ...props }: React.ComponentProps<"button">) {
|
|
|
289
293
|
onClick={toggleSidebar}
|
|
290
294
|
title="Toggle Sidebar"
|
|
291
295
|
className={cn(
|
|
292
|
-
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-
|
|
296
|
+
"hover:after:bg-sidebar-border absolute inset-y-0 z-20 hidden w-4 transition-[left,right,translate,background-color] ease-drawer 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] sm:flex ltr:-translate-x-1/2 rtl:-translate-x-1/2",
|
|
293
297
|
"in-data-[side=left]:cursor-w-resize in-data-[side=right]:cursor-e-resize",
|
|
294
298
|
"[[data-side=left][data-state=collapsed]_&]:cursor-e-resize [[data-side=right][data-state=collapsed]_&]:cursor-w-resize",
|
|
295
299
|
"hover:group-data-[collapsible=offcanvas]:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full",
|
|
@@ -312,12 +316,14 @@ function SidebarInset({
|
|
|
312
316
|
// recedes and cards (--surface-raised) lift off the pane. A border carries the
|
|
313
317
|
// tier in light mode where the ramp collapses to white; flat by design, no drop
|
|
314
318
|
// shadow (see AGENTS.md "flat look"). The default variant stays flush on canvas.
|
|
319
|
+
// The pane drops its margin on the sidebar's side. `side` is physical, as
|
|
320
|
+
// for Sheet: it does not mirror in right-to-left.
|
|
315
321
|
return useRender({
|
|
316
322
|
defaultTagName: "main",
|
|
317
323
|
props: mergeProps<"main">(
|
|
318
324
|
{
|
|
319
325
|
className: cn(
|
|
320
|
-
"bg-background relative flex w-full flex-1 flex-col md:peer-data-[variant=inset]:bg-surface 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]:border md:peer-data-[variant=inset]:border-border/60",
|
|
326
|
+
"bg-background relative flex w-full flex-1 flex-col md:peer-data-[variant=inset]:bg-surface md:peer-data-[variant=inset]:m-2 md:peer-data-[variant=inset]:peer-data-[side=left]:ml-0 md:peer-data-[variant=inset]:peer-data-[side=right]:mr-0 md:peer-data-[variant=inset]:rounded-xl md:peer-data-[variant=inset]:border md:peer-data-[variant=inset]:border-border/60",
|
|
321
327
|
className
|
|
322
328
|
),
|
|
323
329
|
},
|
|
@@ -338,7 +344,7 @@ function SidebarInput({
|
|
|
338
344
|
<Input
|
|
339
345
|
data-slot="sidebar-input"
|
|
340
346
|
data-sidebar="input"
|
|
341
|
-
className={cn("bg-background h-8 w-full
|
|
347
|
+
className={cn("bg-background h-8 w-full", className)}
|
|
342
348
|
{...props}
|
|
343
349
|
/>
|
|
344
350
|
)
|
|
@@ -386,7 +392,7 @@ function SidebarContent({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
386
392
|
data-slot="sidebar-content"
|
|
387
393
|
data-sidebar="content"
|
|
388
394
|
className={cn(
|
|
389
|
-
"no-scrollbar flex min-h-0 flex-1 flex-col gap-
|
|
395
|
+
"no-scrollbar flex min-h-0 flex-1 flex-col gap-1 overflow-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
390
396
|
className
|
|
391
397
|
)}
|
|
392
398
|
{...props}
|
|
@@ -399,7 +405,7 @@ function SidebarGroup({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
399
405
|
<div
|
|
400
406
|
data-slot="sidebar-group"
|
|
401
407
|
data-sidebar="group"
|
|
402
|
-
className={cn("relative flex w-full min-w-0 flex-col
|
|
408
|
+
className={cn("relative flex w-full min-w-0 flex-col px-2.5 py-2", className)}
|
|
403
409
|
{...props}
|
|
404
410
|
/>
|
|
405
411
|
)
|
|
@@ -415,7 +421,7 @@ function SidebarGroupLabel({
|
|
|
415
421
|
props: mergeProps<"div">(
|
|
416
422
|
{
|
|
417
423
|
className: cn(
|
|
418
|
-
"text-
|
|
424
|
+
"text-muted-foreground h-5.5 overflow-hidden rounded-md px-2.5 text-xs leading-4.5 font-medium whitespace-nowrap transition-[height,opacity] duration-slow ease-height motion-reduce:transition-opacity group-data-[collapsible=icon]:h-0 group-data-[collapsible=icon]:opacity-0 focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sidebar-ring [&>svg]:size-4 [&>svg:not([class*='stroke-'])]:stroke-[1.75] flex shrink-0 items-start outline-hidden [&>svg]:shrink-0",
|
|
419
425
|
className
|
|
420
426
|
),
|
|
421
427
|
},
|
|
@@ -439,7 +445,7 @@ function SidebarGroupAction({
|
|
|
439
445
|
props: mergeProps<"button">(
|
|
440
446
|
{
|
|
441
447
|
className: cn(
|
|
442
|
-
"text-sidebar-foreground
|
|
448
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 end-3 w-5 rounded-md p-0 focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sidebar-ring [&>svg]:size-4 [&>svg:not([class*='stroke-'])]:stroke-[1.75] 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",
|
|
443
449
|
className
|
|
444
450
|
),
|
|
445
451
|
},
|
|
@@ -467,13 +473,112 @@ function SidebarGroupContent({
|
|
|
467
473
|
)
|
|
468
474
|
}
|
|
469
475
|
|
|
470
|
-
function SidebarMenu({
|
|
476
|
+
function SidebarMenu({
|
|
477
|
+
className,
|
|
478
|
+
slidingIndicator = true,
|
|
479
|
+
children,
|
|
480
|
+
...props
|
|
481
|
+
}: React.ComponentProps<"ul"> & {
|
|
482
|
+
/**
|
|
483
|
+
* Draws the active item's highlight as one raised pill that slides from item
|
|
484
|
+
* to item when the active item changes. On by default. Set it to false to
|
|
485
|
+
* have each item mark itself with a fill and a leading bar instead.
|
|
486
|
+
*/
|
|
487
|
+
slidingIndicator?: boolean
|
|
488
|
+
}) {
|
|
471
489
|
return (
|
|
472
490
|
<ul
|
|
473
491
|
data-slot="sidebar-menu"
|
|
474
492
|
data-sidebar="menu"
|
|
475
|
-
|
|
493
|
+
data-active-indicator={slidingIndicator ? "pill" : undefined}
|
|
494
|
+
className={cn("relative flex w-full min-w-0 flex-col gap-px", className)}
|
|
476
495
|
{...props}
|
|
496
|
+
>
|
|
497
|
+
{slidingIndicator && <SidebarMenuIndicator />}
|
|
498
|
+
{children}
|
|
499
|
+
</ul>
|
|
500
|
+
)
|
|
501
|
+
}
|
|
502
|
+
|
|
503
|
+
// The sliding pill of a SidebarMenu. It follows the menu's active
|
|
504
|
+
// SidebarMenuButton: a MutationObserver catches data-active moving between
|
|
505
|
+
// items and a ResizeObserver catches layout changes (a sub-menu opening above
|
|
506
|
+
// the active item). The pill moves with transform and height on the drawer
|
|
507
|
+
// curve; it only transitions after its first placement, so it does not glide
|
|
508
|
+
// in on load. Reduced motion keeps the fade and drops the slide.
|
|
509
|
+
function SidebarMenuIndicator() {
|
|
510
|
+
const ref = React.useRef<HTMLLIElement>(null)
|
|
511
|
+
|
|
512
|
+
React.useLayoutEffect(() => {
|
|
513
|
+
const indicator = ref.current
|
|
514
|
+
const menu = indicator?.parentElement
|
|
515
|
+
if (!indicator || !menu) {
|
|
516
|
+
return
|
|
517
|
+
}
|
|
518
|
+
|
|
519
|
+
const place = () => {
|
|
520
|
+
const active = menu.querySelector<HTMLElement>(
|
|
521
|
+
'[data-slot="sidebar-menu-button"][data-active]'
|
|
522
|
+
)
|
|
523
|
+
if (!active) {
|
|
524
|
+
delete indicator.dataset.shown
|
|
525
|
+
return
|
|
526
|
+
}
|
|
527
|
+
// Layout offsets, not client rects: they ignore transforms such as the
|
|
528
|
+
// mobile sheet sliding in.
|
|
529
|
+
let top = 0
|
|
530
|
+
for (
|
|
531
|
+
let node: HTMLElement | null = active;
|
|
532
|
+
node && node !== menu;
|
|
533
|
+
node = node.offsetParent as HTMLElement | null
|
|
534
|
+
) {
|
|
535
|
+
top += node.offsetTop
|
|
536
|
+
}
|
|
537
|
+
// A pill that appears (the first active item of this menu, or one
|
|
538
|
+
// coming back from another menu or a sub-item) fades in place: only a
|
|
539
|
+
// pill already on show slides to the new item.
|
|
540
|
+
const appearing = !("shown" in indicator.dataset)
|
|
541
|
+
if (appearing) {
|
|
542
|
+
indicator.style.transitionProperty = "opacity"
|
|
543
|
+
}
|
|
544
|
+
indicator.style.transform = `translateY(${top}px)`
|
|
545
|
+
indicator.style.height = `${active.offsetHeight}px`
|
|
546
|
+
indicator.dataset.shown = ""
|
|
547
|
+
if (appearing) {
|
|
548
|
+
// Commit the jump before the slide comes back.
|
|
549
|
+
void indicator.offsetHeight
|
|
550
|
+
indicator.style.transitionProperty = ""
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
|
|
554
|
+
place()
|
|
555
|
+
const frame = requestAnimationFrame(() => {
|
|
556
|
+
indicator.dataset.ready = ""
|
|
557
|
+
})
|
|
558
|
+
const mutations = new MutationObserver(place)
|
|
559
|
+
mutations.observe(menu, {
|
|
560
|
+
subtree: true,
|
|
561
|
+
childList: true,
|
|
562
|
+
attributes: true,
|
|
563
|
+
attributeFilter: ["data-active"],
|
|
564
|
+
})
|
|
565
|
+
const resize = new ResizeObserver(place)
|
|
566
|
+
resize.observe(menu)
|
|
567
|
+
|
|
568
|
+
return () => {
|
|
569
|
+
cancelAnimationFrame(frame)
|
|
570
|
+
mutations.disconnect()
|
|
571
|
+
resize.disconnect()
|
|
572
|
+
}
|
|
573
|
+
}, [])
|
|
574
|
+
|
|
575
|
+
return (
|
|
576
|
+
<li
|
|
577
|
+
ref={ref}
|
|
578
|
+
aria-hidden="true"
|
|
579
|
+
data-slot="sidebar-menu-indicator"
|
|
580
|
+
data-sidebar="menu-indicator"
|
|
581
|
+
className="bg-surface-raised border-sidebar-border shadow-control pointer-events-none absolute inset-x-0 top-0 rounded-lg border opacity-0 data-shown:opacity-100 data-ready:[transition:transform_var(--transition-duration-sidebar-pill)_var(--ease-drawer),height_var(--transition-duration-sidebar-pill)_var(--ease-drawer),opacity_var(--transition-duration-moderate)_var(--ease-soft)] motion-reduce:data-ready:transition-opacity"
|
|
477
582
|
/>
|
|
478
583
|
)
|
|
479
584
|
}
|
|
@@ -489,10 +594,28 @@ function SidebarMenuItem({ className, ...props }: React.ComponentProps<"li">) {
|
|
|
489
594
|
)
|
|
490
595
|
}
|
|
491
596
|
|
|
492
|
-
//
|
|
493
|
-
//
|
|
597
|
+
// By default the menu's sliding pill marks the active item, so the item drops
|
|
598
|
+
// its own fill and bar. In a SidebarMenu with slidingIndicator={false} (or a
|
|
599
|
+
// button outside a SidebarMenu), hover and active share the sidebar-accent
|
|
600
|
+
// fill, so the active item also gets a sidebar-primary bar on its leading edge.
|
|
601
|
+
// An active SidebarMenuSubButton never gets the pill or a bar: it keeps its
|
|
602
|
+
// fill, and the guide line of its sub-list already runs next to it. The active
|
|
603
|
+
// icon takes brand-indicator.
|
|
604
|
+
//
|
|
605
|
+
// For the current page exactly one icon takes brand-indicator. An active
|
|
606
|
+
// SidebarMenuSubButton lights its own leading icon. A group with
|
|
607
|
+
// hasActiveChild lights its icon too, except while an active sub-button with
|
|
608
|
+
// an icon is shown inside the same menu item (the :has() selector below): then
|
|
609
|
+
// the sub-button's icon is the one. In the icon rail the sub-buttons are
|
|
610
|
+
// hidden, so the group's icon is lit regardless.
|
|
611
|
+
//
|
|
612
|
+
// The icon rail keeps every button at full width and its padding unchanged:
|
|
613
|
+
// the icon stays where it is (centred in the rail) and the label fades out,
|
|
614
|
+
// clipped by the narrowing rail, instead of the button shrinking to a square.
|
|
615
|
+
// Only the label fades: a direct span that is an Avatar, or that wraps an icon
|
|
616
|
+
// or an image, is media and stays visible in the rail.
|
|
494
617
|
const sidebarMenuButtonVariants = cva(
|
|
495
|
-
"before:bg-sidebar-primary relative before:absolute before:inset-y-1.5 before:
|
|
618
|
+
"before:bg-sidebar-primary relative before:absolute before:inset-y-1.5 before:start-0 before:w-0.5 before:rounded-full before:opacity-0 data-active:before:opacity-100 in-data-[active-indicator=pill]:before:hidden in-data-[active-indicator=pill]:data-active:bg-transparent! 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.5 rounded-lg px-2.5 py-2 text-start text-sm transition-[width,height,padding,background-color,color] duration-fast ease-default motion-reduce:transition-none group-has-data-[sidebar=menu-action]/menu-item:pe-8 focus-visible:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sidebar-ring 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:first-of-type]:truncate [&>span]:transition-opacity [&>span]:duration-moderate group-data-[collapsible=icon]:[&>span:not([data-slot=avatar]):not(:has(svg,img))]:opacity-0 group-data-[collapsible=icon]:[&>span]:duration-fast [&_svg]:size-4 [&>svg:first-child]:[stroke-width:1.75] [&>svg:first-child]:opacity-55 [&>svg:first-child]:transition-[opacity,color] [&>svg:first-child]:duration-normal hover:[&>svg:first-child]:opacity-85 data-active:[&>svg:first-child]:opacity-100 data-active:[&>svg:first-child]:text-brand-indicator data-has-active-child:not-group-has-[[data-slot=sidebar-menu-sub-button][data-active]>svg:first-child]/menu-item:[&>svg:first-child]:opacity-100 data-has-active-child:not-group-has-[[data-slot=sidebar-menu-sub-button][data-active]>svg:first-child]/menu-item:[&>svg:first-child]:text-brand-indicator group-data-[collapsible=icon]:data-has-active-child:[&>svg:first-child]:opacity-100 group-data-[collapsible=icon]:data-has-active-child:[&>svg:first-child]:text-brand-indicator [&_svg]:shrink-0",
|
|
496
619
|
{
|
|
497
620
|
variants: {
|
|
498
621
|
variant: {
|
|
@@ -503,7 +626,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
503
626
|
size: {
|
|
504
627
|
default: "h-8 text-sm",
|
|
505
628
|
sm: "h-7 text-xs",
|
|
506
|
-
lg: "h-12 text-sm
|
|
629
|
+
lg: "h-12 px-2 text-sm",
|
|
507
630
|
},
|
|
508
631
|
},
|
|
509
632
|
defaultVariants: {
|
|
@@ -516,6 +639,7 @@ const sidebarMenuButtonVariants = cva(
|
|
|
516
639
|
function SidebarMenuButton({
|
|
517
640
|
render,
|
|
518
641
|
isActive = false,
|
|
642
|
+
hasActiveChild = false,
|
|
519
643
|
variant = "default",
|
|
520
644
|
size = "default",
|
|
521
645
|
tooltip,
|
|
@@ -524,6 +648,16 @@ function SidebarMenuButton({
|
|
|
524
648
|
}: useRender.ComponentProps<"button"> &
|
|
525
649
|
React.ComponentProps<"button"> & {
|
|
526
650
|
isActive?: boolean
|
|
651
|
+
/**
|
|
652
|
+
* Set it on the button of every group that holds the current page, whether
|
|
653
|
+
* or not the current item has an icon. For the current page exactly one
|
|
654
|
+
* icon takes the active colour, and the sidebar picks it: the current
|
|
655
|
+
* item's own icon when it has one, otherwise this group's icon. The group's
|
|
656
|
+
* icon also takes it when the group is closed (its items are not mounted)
|
|
657
|
+
* and in the icon rail (its items are hidden). The group gets no fill and
|
|
658
|
+
* no bar.
|
|
659
|
+
*/
|
|
660
|
+
hasActiveChild?: boolean
|
|
527
661
|
tooltip?: string | React.ComponentProps<typeof TooltipContent>
|
|
528
662
|
} & VariantProps<typeof sidebarMenuButtonVariants>) {
|
|
529
663
|
const { isMobile, state } = useSidebar()
|
|
@@ -541,6 +675,7 @@ function SidebarMenuButton({
|
|
|
541
675
|
sidebar: "menu-button",
|
|
542
676
|
size,
|
|
543
677
|
active: isActive,
|
|
678
|
+
"has-active-child": hasActiveChild,
|
|
544
679
|
},
|
|
545
680
|
})
|
|
546
681
|
|
|
@@ -560,6 +695,9 @@ function SidebarMenuButton({
|
|
|
560
695
|
<TooltipContent
|
|
561
696
|
side="right"
|
|
562
697
|
align="center"
|
|
698
|
+
// Clears the rail: the button ends one group padding (8px) short of
|
|
699
|
+
// the rail edge, and the label sits 8px beyond that edge.
|
|
700
|
+
sideOffset={16}
|
|
563
701
|
hidden={state !== "collapsed" || isMobile}
|
|
564
702
|
{...tooltip}
|
|
565
703
|
/>
|
|
@@ -567,6 +705,76 @@ function SidebarMenuButton({
|
|
|
567
705
|
)
|
|
568
706
|
}
|
|
569
707
|
|
|
708
|
+
// The account or user switch at the top or bottom of the sidebar: media (an
|
|
709
|
+
// Avatar), a SidebarIdentityText (a title over a caption) and an up/down
|
|
710
|
+
// chevron. Render it as the trigger of the menu it opens:
|
|
711
|
+
// <DropdownMenuTrigger render={<SidebarIdentityButton />}>. It takes the fill
|
|
712
|
+
// while that menu is open: a Base UI trigger marks that with data-popup-open,
|
|
713
|
+
// not data-open. The muted avatar fill is translucent and darkens on that fill,
|
|
714
|
+
// so default initials take the sidebar text colour to keep their contrast. A
|
|
715
|
+
// fallback with its own colour (no text-muted-foreground) keeps it. In the
|
|
716
|
+
// icon rail the text and the chevron fade like a label and the media stays;
|
|
717
|
+
// both stay mounted, so the button keeps its accessible name in the rail.
|
|
718
|
+
function SidebarIdentityButton({
|
|
719
|
+
className,
|
|
720
|
+
children,
|
|
721
|
+
...props
|
|
722
|
+
}: Omit<React.ComponentProps<typeof SidebarMenuButton>, "size">) {
|
|
723
|
+
return (
|
|
724
|
+
<SidebarMenuButton
|
|
725
|
+
size="lg"
|
|
726
|
+
className={cn(
|
|
727
|
+
"data-popup-open:bg-sidebar-accent data-popup-open:text-sidebar-accent-foreground [&_[data-slot=avatar-fallback].text-muted-foreground]:text-sidebar-foreground",
|
|
728
|
+
className
|
|
729
|
+
)}
|
|
730
|
+
{...props}
|
|
731
|
+
>
|
|
732
|
+
{children}
|
|
733
|
+
<ChevronsUpDownIcon
|
|
734
|
+
data-slot="sidebar-identity-chevron"
|
|
735
|
+
aria-hidden="true"
|
|
736
|
+
className="text-muted-foreground ms-auto transition-opacity duration-moderate group-data-[collapsible=icon]:opacity-0 group-data-[collapsible=icon]:duration-fast"
|
|
737
|
+
/>
|
|
738
|
+
</SidebarMenuButton>
|
|
739
|
+
)
|
|
740
|
+
}
|
|
741
|
+
|
|
742
|
+
// The two lines of a SidebarIdentityButton. Also fits the identity row at the
|
|
743
|
+
// top of the menu it opens. The text fades in the icon rail even when the
|
|
744
|
+
// title holds an icon, which the generic label fade of SidebarMenuButton skips.
|
|
745
|
+
function SidebarIdentityText({
|
|
746
|
+
title,
|
|
747
|
+
caption,
|
|
748
|
+
className,
|
|
749
|
+
...props
|
|
750
|
+
}: Omit<React.ComponentProps<"span">, "title" | "children"> & {
|
|
751
|
+
title: React.ReactNode
|
|
752
|
+
caption?: React.ReactNode
|
|
753
|
+
}) {
|
|
754
|
+
return (
|
|
755
|
+
<span
|
|
756
|
+
data-slot="sidebar-identity-text"
|
|
757
|
+
className={cn(
|
|
758
|
+
"grid min-w-0 flex-1 text-start text-sm leading-tight transition-opacity duration-moderate group-data-[collapsible=icon]:opacity-0 group-data-[collapsible=icon]:duration-fast",
|
|
759
|
+
className
|
|
760
|
+
)}
|
|
761
|
+
{...props}
|
|
762
|
+
>
|
|
763
|
+
<span data-slot="sidebar-identity-title" className="truncate font-semibold">
|
|
764
|
+
{title}
|
|
765
|
+
</span>
|
|
766
|
+
{caption ? (
|
|
767
|
+
<span
|
|
768
|
+
data-slot="sidebar-identity-caption"
|
|
769
|
+
className="text-muted-foreground truncate text-xs font-normal"
|
|
770
|
+
>
|
|
771
|
+
{caption}
|
|
772
|
+
</span>
|
|
773
|
+
) : null}
|
|
774
|
+
</span>
|
|
775
|
+
)
|
|
776
|
+
}
|
|
777
|
+
|
|
570
778
|
function SidebarMenuAction({
|
|
571
779
|
className,
|
|
572
780
|
render,
|
|
@@ -581,7 +789,7 @@ function SidebarMenuAction({
|
|
|
581
789
|
props: mergeProps<"button">(
|
|
582
790
|
{
|
|
583
791
|
className: cn(
|
|
584
|
-
"text-sidebar-foreground
|
|
792
|
+
"text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 end-1 aspect-square w-5 rounded-md 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:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sidebar-ring [&>svg]:size-4 [&>svg:not([class*='stroke-'])]:stroke-[1.75] 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",
|
|
585
793
|
showOnHover &&
|
|
586
794
|
"peer-data-active/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 aria-expanded:opacity-100 md:opacity-0",
|
|
587
795
|
className
|
|
@@ -606,7 +814,7 @@ function SidebarMenuBadge({
|
|
|
606
814
|
data-slot="sidebar-menu-badge"
|
|
607
815
|
data-sidebar="menu-badge"
|
|
608
816
|
className={cn(
|
|
609
|
-
"text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute
|
|
817
|
+
"text-sidebar-foreground peer-hover/menu-button:text-sidebar-accent-foreground peer-data-active/menu-button:text-sidebar-accent-foreground pointer-events-none absolute end-1 flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none group-data-[collapsible=icon]:hidden 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",
|
|
610
818
|
className
|
|
611
819
|
)}
|
|
612
820
|
{...props}
|
|
@@ -658,7 +866,7 @@ function SidebarMenuSub({ className, ...props }: React.ComponentProps<"ul">) {
|
|
|
658
866
|
data-slot="sidebar-menu-sub"
|
|
659
867
|
data-sidebar="menu-sub"
|
|
660
868
|
className={cn(
|
|
661
|
-
"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 border-
|
|
869
|
+
"border-sidebar-border mx-3.5 flex min-w-0 translate-x-px rtl:-translate-x-px flex-col gap-1 border-s px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",
|
|
662
870
|
className
|
|
663
871
|
)}
|
|
664
872
|
{...props}
|
|
@@ -696,7 +904,7 @@ function SidebarMenuSubButton({
|
|
|
696
904
|
props: mergeProps<"a">(
|
|
697
905
|
{
|
|
698
906
|
className: cn(
|
|
699
|
-
"
|
|
907
|
+
"relative text-sidebar-foreground 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:outline-solid focus-visible:outline-2 focus-visible:-outline-offset-2 focus-visible:outline-sidebar-ring [&>svg]:opacity-55 [&>svg]:transition-opacity [&>svg]:duration-normal hover:[&>svg]:opacity-85 data-active:[&>svg]:opacity-100 data-active:[&>svg]:text-brand-indicator data-[size=md]:text-sm data-[size=sm]:text-xs [&>svg]:size-4 flex min-w-0 -translate-x-px rtl: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",
|
|
700
908
|
className
|
|
701
909
|
),
|
|
702
910
|
},
|
|
@@ -712,6 +920,175 @@ function SidebarMenuSubButton({
|
|
|
712
920
|
})
|
|
713
921
|
}
|
|
714
922
|
|
|
923
|
+
type SidebarLevelsContextProps = {
|
|
924
|
+
level: string
|
|
925
|
+
ready: boolean
|
|
926
|
+
order: string[]
|
|
927
|
+
}
|
|
928
|
+
|
|
929
|
+
const SidebarLevelsContext =
|
|
930
|
+
React.createContext<SidebarLevelsContextProps | null>(null)
|
|
931
|
+
|
|
932
|
+
/**
|
|
933
|
+
* Holds the levels of a drill-down sidebar: one `SidebarLevel` per level, as
|
|
934
|
+
* direct children, in order from the first level to the deepest. Exactly one level shows: the one
|
|
935
|
+
* whose `value` is `level`. The consumer controls `level` (it follows the
|
|
936
|
+
* route). Going deeper slides the new level in from the end side and the old
|
|
937
|
+
* one out to the start side; going back slides the other way. Hidden levels
|
|
938
|
+
* are inert. When focus was in the sidebar, it moves to the new level's first
|
|
939
|
+
* item, and on the way back to the item that opened the level.
|
|
940
|
+
*/
|
|
941
|
+
function SidebarLevels({
|
|
942
|
+
level,
|
|
943
|
+
className,
|
|
944
|
+
children,
|
|
945
|
+
...props
|
|
946
|
+
}: React.ComponentProps<"div"> & {
|
|
947
|
+
/** The `value` of the `SidebarLevel` that shows. */
|
|
948
|
+
level: string
|
|
949
|
+
}) {
|
|
950
|
+
const ref = React.useRef<HTMLDivElement>(null)
|
|
951
|
+
// The order of the levels says which way to slide.
|
|
952
|
+
const order = React.Children.toArray(children).flatMap((child) =>
|
|
953
|
+
React.isValidElement<{ value?: unknown }>(child) &&
|
|
954
|
+
typeof child.props.value === "string"
|
|
955
|
+
? [child.props.value]
|
|
956
|
+
: []
|
|
957
|
+
)
|
|
958
|
+
const orderRef = React.useRef(order)
|
|
959
|
+
orderRef.current = order
|
|
960
|
+
const [ready, setReady] = React.useState(false)
|
|
961
|
+
const previous = React.useRef(level)
|
|
962
|
+
// The item that opened each level, so going back can return focus to it.
|
|
963
|
+
const openers = React.useRef(new Map<string, HTMLElement>())
|
|
964
|
+
|
|
965
|
+
React.useEffect(() => {
|
|
966
|
+
const frame = requestAnimationFrame(() => setReady(true))
|
|
967
|
+
return () => cancelAnimationFrame(frame)
|
|
968
|
+
}, [])
|
|
969
|
+
|
|
970
|
+
React.useLayoutEffect(() => {
|
|
971
|
+
const from = previous.current
|
|
972
|
+
previous.current = level
|
|
973
|
+
const root = ref.current
|
|
974
|
+
if (from === level || !root) {
|
|
975
|
+
return
|
|
976
|
+
}
|
|
977
|
+
const focused = document.activeElement
|
|
978
|
+
if (!(focused instanceof HTMLElement) || !root.contains(focused)) {
|
|
979
|
+
return
|
|
980
|
+
}
|
|
981
|
+
const deeper =
|
|
982
|
+
orderRef.current.indexOf(level) > orderRef.current.indexOf(from)
|
|
983
|
+
const panel = root.querySelector<HTMLElement>(
|
|
984
|
+
`[data-slot="sidebar-level"][data-value="${CSS.escape(level)}"]`
|
|
985
|
+
)
|
|
986
|
+
if (!panel) {
|
|
987
|
+
return
|
|
988
|
+
}
|
|
989
|
+
if (deeper) {
|
|
990
|
+
openers.current.set(level, focused)
|
|
991
|
+
}
|
|
992
|
+
const opener = deeper ? undefined : openers.current.get(from)
|
|
993
|
+
const target =
|
|
994
|
+
opener && panel.contains(opener)
|
|
995
|
+
? opener
|
|
996
|
+
: panel.querySelector<HTMLElement>(
|
|
997
|
+
'a[href], button:not([disabled]), [tabindex]:not([tabindex="-1"])'
|
|
998
|
+
)
|
|
999
|
+
target?.focus({ preventScroll: true })
|
|
1000
|
+
}, [level])
|
|
1001
|
+
|
|
1002
|
+
// A new value each render is fine: the levels re-render with this one anyway.
|
|
1003
|
+
const value = { level, ready, order }
|
|
1004
|
+
|
|
1005
|
+
return (
|
|
1006
|
+
<SidebarLevelsContext.Provider value={value}>
|
|
1007
|
+
<div
|
|
1008
|
+
ref={ref}
|
|
1009
|
+
data-slot="sidebar-levels"
|
|
1010
|
+
data-sidebar="levels"
|
|
1011
|
+
className={cn("relative min-h-0 flex-1 overflow-hidden", className)}
|
|
1012
|
+
{...props}
|
|
1013
|
+
>
|
|
1014
|
+
{children}
|
|
1015
|
+
</div>
|
|
1016
|
+
</SidebarLevelsContext.Provider>
|
|
1017
|
+
)
|
|
1018
|
+
}
|
|
1019
|
+
|
|
1020
|
+
/**
|
|
1021
|
+
* One level of `SidebarLevels`. Put its groups and menus inside, and start a
|
|
1022
|
+
* second level with `SidebarLevelBack`. Each level has its own menus, so the
|
|
1023
|
+
* active pill never slides from one level to the other.
|
|
1024
|
+
*/
|
|
1025
|
+
function SidebarLevel({
|
|
1026
|
+
value,
|
|
1027
|
+
className,
|
|
1028
|
+
...props
|
|
1029
|
+
}: React.ComponentProps<"div"> & {
|
|
1030
|
+
/** Names the level; `SidebarLevels` shows the level whose value is `level`. */
|
|
1031
|
+
value: string
|
|
1032
|
+
}) {
|
|
1033
|
+
const context = React.useContext(SidebarLevelsContext)
|
|
1034
|
+
if (!context) {
|
|
1035
|
+
throw new Error("SidebarLevel must be used within SidebarLevels.")
|
|
1036
|
+
}
|
|
1037
|
+
const { level, ready, order } = context
|
|
1038
|
+
const index = order.indexOf(value)
|
|
1039
|
+
const activeIndex = order.indexOf(level)
|
|
1040
|
+
const state =
|
|
1041
|
+
value === level ? "active" : index < activeIndex ? "before" : "after"
|
|
1042
|
+
|
|
1043
|
+
return (
|
|
1044
|
+
<div
|
|
1045
|
+
data-slot="sidebar-level"
|
|
1046
|
+
data-sidebar="level"
|
|
1047
|
+
data-value={value}
|
|
1048
|
+
data-state={state}
|
|
1049
|
+
data-ready={ready ? "" : undefined}
|
|
1050
|
+
inert={state !== "active"}
|
|
1051
|
+
className={cn(
|
|
1052
|
+
"no-scrollbar absolute inset-0 flex min-h-0 flex-col gap-1 overflow-y-auto group-data-[collapsible=icon]:overflow-hidden",
|
|
1053
|
+
"data-[state=before]:-translate-x-10 rtl:data-[state=before]:translate-x-10 data-[state=after]:translate-x-10 rtl:data-[state=after]:-translate-x-10",
|
|
1054
|
+
"data-[state=before]:invisible data-[state=after]:invisible data-[state=before]:opacity-0 data-[state=after]:opacity-0 data-[state=before]:blur-[2px] data-[state=after]:blur-[2px] data-[state=before]:pointer-events-none data-[state=after]:pointer-events-none",
|
|
1055
|
+
"data-ready:[transition:translate_var(--transition-duration-slow)_var(--ease-drawer),opacity_var(--transition-duration-normal)_var(--ease-soft),filter_var(--transition-duration-normal)_var(--ease-soft),visibility_0s]",
|
|
1056
|
+
"data-ready:data-[state=before]:[transition:translate_var(--transition-duration-slow)_var(--ease-drawer),opacity_var(--transition-duration-moderate)_var(--ease-soft),filter_var(--transition-duration-moderate)_var(--ease-soft),visibility_0s_linear_var(--transition-duration-slow)]",
|
|
1057
|
+
"data-ready:data-[state=after]:[transition:translate_var(--transition-duration-slow)_var(--ease-drawer),opacity_var(--transition-duration-moderate)_var(--ease-soft),filter_var(--transition-duration-moderate)_var(--ease-soft),visibility_0s_linear_var(--transition-duration-slow)]",
|
|
1058
|
+
"motion-reduce:translate-x-0! motion-reduce:blur-none!",
|
|
1059
|
+
className
|
|
1060
|
+
)}
|
|
1061
|
+
{...props}
|
|
1062
|
+
/>
|
|
1063
|
+
)
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
/**
|
|
1067
|
+
* The first row of a second level: a chevron and the area's name. It returns
|
|
1068
|
+
* to the level before; the consumer changes `level` in `onClick` (or renders
|
|
1069
|
+
* a link with `render`). In the icon rail only the chevron shows: give it a
|
|
1070
|
+
* `tooltip` that says where it goes.
|
|
1071
|
+
*/
|
|
1072
|
+
function SidebarLevelBack({
|
|
1073
|
+
className,
|
|
1074
|
+
children,
|
|
1075
|
+
...props
|
|
1076
|
+
}: React.ComponentProps<typeof SidebarMenuButton>) {
|
|
1077
|
+
return (
|
|
1078
|
+
<SidebarMenuButton
|
|
1079
|
+
data-sidebar="level-back"
|
|
1080
|
+
className={cn(
|
|
1081
|
+
"text-sidebar-accent-foreground mb-2 font-semibold [&>svg:first-child]:transition-[opacity,translate] [&>svg:first-child]:duration-normal [&>svg:first-child]:ease-out hover:[&>svg:first-child]:-translate-x-0.5 rtl:hover:[&>svg:first-child]:translate-x-0.5 motion-reduce:hover:[&>svg:first-child]:translate-x-0",
|
|
1082
|
+
className
|
|
1083
|
+
)}
|
|
1084
|
+
{...props}
|
|
1085
|
+
>
|
|
1086
|
+
<ChevronLeftIcon className="rtl:rotate-180" />
|
|
1087
|
+
<span>{children}</span>
|
|
1088
|
+
</SidebarMenuButton>
|
|
1089
|
+
)
|
|
1090
|
+
}
|
|
1091
|
+
|
|
715
1092
|
export {
|
|
716
1093
|
Sidebar,
|
|
717
1094
|
SidebarContent,
|
|
@@ -721,8 +1098,13 @@ export {
|
|
|
721
1098
|
SidebarGroupContent,
|
|
722
1099
|
SidebarGroupLabel,
|
|
723
1100
|
SidebarHeader,
|
|
1101
|
+
SidebarIdentityButton,
|
|
1102
|
+
SidebarIdentityText,
|
|
724
1103
|
SidebarInput,
|
|
725
1104
|
SidebarInset,
|
|
1105
|
+
SidebarLevel,
|
|
1106
|
+
SidebarLevelBack,
|
|
1107
|
+
SidebarLevels,
|
|
726
1108
|
SidebarMenu,
|
|
727
1109
|
SidebarMenuAction,
|
|
728
1110
|
SidebarMenuBadge,
|
|
@@ -5,7 +5,7 @@ function Skeleton({ className, ...props }: React.ComponentProps<"div">) {
|
|
|
5
5
|
<div
|
|
6
6
|
data-slot="skeleton"
|
|
7
7
|
className={cn(
|
|
8
|
-
"animate-shimmer motion-reduce:animate-none motion-reduce:bg-none motion-reduce:bg-muted rounded-md bg-[length:200%_100%] bg-[linear-gradient(90deg,var(--
|
|
8
|
+
"animate-shimmer motion-reduce:animate-none motion-reduce:bg-none motion-reduce:bg-muted rounded-md bg-[length:200%_100%] bg-[linear-gradient(90deg,var(--muted)_25%,var(--accent)_50%,var(--muted)_75%)]",
|
|
9
9
|
className
|
|
10
10
|
)}
|
|
11
11
|
{...props}
|
|
@@ -48,7 +48,7 @@ function Slider({
|
|
|
48
48
|
<SliderPrimitive.Thumb
|
|
49
49
|
data-slot="slider-thumb"
|
|
50
50
|
key={index}
|
|
51
|
-
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-background transition-[color,box-shadow] select-none hover:ring-4 focus-visible:
|
|
51
|
+
className="border-primary ring-ring/50 block size-4 shrink-0 rounded-full border bg-background transition-[color,box-shadow] select-none hover:ring-4 focus-visible:outline-solid focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-ring disabled:pointer-events-none disabled:opacity-50"
|
|
52
52
|
/>
|
|
53
53
|
))}
|
|
54
54
|
</SliderPrimitive.Control>
|