@brightlocal/ui-components 2.6.0 → 2.7.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/component-meta.json +4 -5
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +110 -83
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +428 -389
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +4 -0
- package/dist/blocks/sidebar.d.ts.map +1 -1
- package/dist/blocks/sidebar.js +70 -70
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts +6 -24
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +91 -92
- package/dist/index.cjs +1 -1
- package/dist/index.js +169 -173
- package/dist/table.cjs +1 -1
- package/dist/table.js +28 -28
- package/package.json +3 -3
- package/src/blocks/data-table.tsx +462 -293
- package/src/blocks/sidebar.tsx +6 -2
- package/src/components/global-layout.tsx +27 -58
- package/src/components/table.tsx +1 -1
package/dist/blocks/sidebar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),Ne=require("react"),y=require("@radix-ui/react-slot"),D=require("class-variance-authority"),b=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),_=require("../button.cjs"),ye=require("../input.cjs"),ke=require("../separator.cjs"),T=require("../sheet.cjs"),N=require("../drawer.cjs"),R=require("../accordion.cjs"),je=require("@radix-ui/react-accordion"),Ce=require("../scroll-area.cjs"),z=require("../skeleton.cjs"),M=require("../tooltip.cjs"),Me=require("../hooks/use-mobile.cjs");function B(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const n=B(Ne),Re=B(je);var L=(e=>(e.LEFT="left",e))(L||{}),q=(e=>(e.SIDEBAR="sidebar",e))(q||{}),P=(e=>(e.OFFCANVAS="offcanvas",e.ICON="icon",e.NONE="none",e))(P||{}),G=(e=>(e.DEFAULT="default",e.SM="sm",e.XS="xs",e))(G||{}),F=(e=>(e.DEFAULT="default",e.COLLAPSIBLE="collapsible",e.ACTION="action",e))(F||{}),H=(e=>(e.SIMPLE="simple",e.COLLAPSIBLE="collapsible",e.DROPDOWN="dropdown",e.TREE="tree",e.BADGE="badge",e.BIG_ICON="bigIcon",e.CHECKBOX="checkbox",e))(H||{}),K=(e=>(e.DEFAULT="default",e.SM="sm",e.LG="lg",e))(K||{}),U=(e=>(e.DEFAULT="default",e.BORDER="border",e.INDENT="indent",e))(U||{}),V=(e=>(e.SM="sm",e.MD="md",e))(V||{}),W=(e=>(e.CARET="caret",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.UP_DOWN="upDown",e.PLUS_MINUS="plusMinus",e.DOTS="dots",e))(W||{});const De="sidebar:state",Ie=3600*24*7,Ae="256px",Oe="288px",Ee="48px",Te="b",X=n.createContext(null);function k(){const e=n.useContext(X);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Y=n.forwardRef(({dataHook:e,trackingEl:t,trackingLabel:r,defaultOpen:o=!0,open:i,onOpenChange:s,className:l,style:c,children:p,...g},h)=>{const f=Me.useIsMobile(),[u,x]=n.useState(!1),[S,Se]=n.useState(o),w=i??S,j=n.useCallback(m=>{const v=typeof m=="function"?m(w):m;s?s(v):Se(v),document.cookie=`${De}=${v}; path=/; max-age=${Ie}`},[s,w]),C=n.useCallback(()=>f?x(m=>!m):j(m=>!m),[f,j,x]);n.useEffect(()=>{const m=v=>{v.key===Te&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),C())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[C]);const E=w?"expanded":"collapsed",we=n.useMemo(()=>({state:E,open:w,setOpen:j,isMobile:f,openMobile:u,setOpenMobile:x,toggleSidebar:C}),[E,w,j,f,u,x,C]);return a.jsx(X.Provider,{value:we,children:a.jsx(M.TooltipProvider,{delayDuration:0,children:a.jsx("div",{ref:h,className:d.cn("group/sidebar-wrapper flex min-h-svh w-full",l),"data-hook":e,"data-slot":"sidebar-provider","data-tracking-el":t||"sidebar-provider","data-tracking-label":r,style:{"--sidebar-width":Ae,"--sidebar-width-icon":Ee,...c},...g,children:p})})})});Y.displayName="SidebarProvider";const Z=n.forwardRef(({dataHook:e,trackingEl:t,trackingLabel:r,side:o="left",variant:i="sidebar",collapsible:s="offcanvas",embedded:l=!1,className:c,children:p,...g},h)=>{const{isMobile:f,state:u,openMobile:x,setOpenMobile:S}=k();return s==="none"?a.jsx("div",{ref:h,className:d.cn("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",c),"data-hook":e,"data-slot":"sidebar","data-tracking-el":t||"sidebar","data-tracking-label":r,...g,children:p}):l?a.jsx("div",{ref:h,className:d.cn("group bg-sidebar text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",u==="expanded"&&"w-[var(--sidebar-width)]",s==="icon"&&u==="collapsed"&&"w-[var(--sidebar-width-icon)]",s==="offcanvas"&&u==="collapsed"&&"w-0",c),"data-collapsible":u==="collapsed"?s:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":u,"data-tracking-el":t||"sidebar","data-tracking-label":r,"data-variant":i,...g,children:p}):f?a.jsx(T.Sheet,{open:x,onOpenChange:S,children:a.jsx(T.SheetContent,{className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden","data-hook":`${e}-mobile-content`,"data-mobile":"true","data-sidebar":"sidebar",side:"left",style:{"--sidebar-width":Oe},children:a.jsx("div",{className:"flex h-full w-full flex-col",children:p})})}):a.jsxs("div",{ref:h,className:"group peer text-sidebar-foreground hidden md:block","data-collapsible":u==="collapsed"?s:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":u,"data-tracking-el":t||"sidebar","data-tracking-label":r,"data-variant":i,children:[a.jsx("div",{className:d.cn("relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),a.jsx("div",{className:d.cn("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]","group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]",c),...g,children:a.jsx("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:p})})]})});Z.displayName="Sidebar";const $=n.forwardRef(({className:e,onClick:t,dataHook:r="sidebar-trigger",...o},i)=>{const{toggleSidebar:s}=k();return a.jsxs(_.Button,{ref:i,"aria-label":"Toggle Sidebar",className:d.cn("h-7 w-7",e),"data-slot":"sidebar-trigger",dataHook:r,size:"sm",variant:"ghost",onClick:l=>{t?.(l),s()},...o,children:[a.jsx(b.PanelLeft,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});$.displayName="SidebarTrigger";const J=n.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:o}=k();return a.jsx("button",{ref:r,"aria-label":"Toggle Sidebar",className:d.cn("hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex","cursor-w-resize","[[data-state=collapsed]_&]:cursor-e-resize","group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-collapsible=offcanvas]_&]:-right-2",e),"data-slot":"sidebar-rail",tabIndex:-1,title:"Toggle Sidebar",onClick:o,...t})});J.displayName="SidebarRail";const Q=n.forwardRef(({className:e,dataHook:t,trackingEl:r,trackingLabel:o,...i},s)=>a.jsx("main",{ref:s,className:d.cn("bg-background relative flex min-h-svh flex-1 flex-col",e),"data-hook":t,"data-slot":"sidebar-inset","data-tracking-el":r||"sidebar-inset","data-tracking-label":o,...i}));Q.displayName="SidebarInset";const ee=n.forwardRef(({className:e,...t},r)=>a.jsx(ye.Input,{ref:r,className:d.cn("bg-background focus-visible:ring-sidebar-ring h-8 w-full shadow-none focus-visible:ring-2",e),"data-slot":"sidebar-input",dataHook:"sidebar-input",...t}));ee.displayName="SidebarInput";const ae=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("px-section-xs flex flex-col gap-2 pt-2 pb-9",e),"data-hook":t,"data-slot":"sidebar-header",...r}));ae.displayName="SidebarHeader";const te=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("flex flex-col gap-2 p-2",e),"data-hook":t,"data-slot":"sidebar-footer",...r}));te.displayName="SidebarFooter";const re=n.forwardRef(({className:e,...t},r)=>a.jsx(ke.Separator,{ref:r,className:d.cn("bg-sidebar-border mx-2 my-2 w-auto group-data-[collapsible=icon]:mx-0",e),"data-slot":"sidebar-separator",...t}));re.displayName="SidebarSeparator";const oe=n.forwardRef(({className:e,dataHook:t,children:r,...o},i)=>a.jsx(Ce.ScrollArea,{ref:i,className:d.cn("min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&>[data-slot=scroll-area-viewport]]:p-0",e),dataHook:t??"sidebar-content-scroll",...o,children:a.jsx("nav",{"aria-label":"Sidebar",className:"flex flex-col gap-2","data-slot":"sidebar-content",children:r})}));oe.displayName="SidebarContent";const ie=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("relative flex w-full min-w-0 flex-col p-2",e),"data-hook":t,"data-slot":"sidebar-group",...r}));ie.displayName="SidebarGroup";const ze=D.cva("flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",{variants:{size:{default:"text-sm",sm:"text-sm",xs:"text-xs"},variant:{default:"",collapsible:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",action:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}},defaultVariants:{size:"sm",variant:"default"}}),se=n.forwardRef(({className:e,dataHook:t,asChild:r=!1,size:o="sm",variant:i="default",isOpen:s=!1,onToggle:l,onAction:c,children:p,...g},h)=>{const f=r?y.Slot:"div",u=()=>{i==="collapsible"&&l?l():i==="action"&&c&&c()},x=S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u())};return a.jsxs(f,{ref:h,className:d.cn(ze({size:o,variant:i}),e),"data-hook":t,"data-slot":"sidebar-group-label","data-variant":i,role:i!=="default"?"button":void 0,tabIndex:i!=="default"?0:void 0,onClick:i!=="default"?u:void 0,onKeyDown:i!=="default"?x:void 0,...g,children:[a.jsx("span",{children:p}),i==="collapsible"&&a.jsx(b.ChevronDown,{className:d.cn("shrink-0 transition-transform duration-200",s&&"rotate-180"),size:16}),i==="action"&&a.jsx(b.Plus,{className:"shrink-0",size:16})]})});se.displayName="SidebarGroupLabel";const ne=n.forwardRef(({className:e,asChild:t=!1,...r},o)=>{const i=t?y.Slot:"button";return a.jsx(i,{ref:o,className:d.cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-group-action",...r})});ne.displayName="SidebarGroupAction";const de=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("w-full text-sm",e),"data-hook":t,"data-slot":"sidebar-group-content",...r}));de.displayName="SidebarGroupContent";const le=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("ul",{ref:o,className:d.cn("flex w-full min-w-0 flex-col gap-1",e),"data-hook":t,"data-slot":"sidebar-menu",...r}));le.displayName="SidebarMenu";const I=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("li",{ref:o,className:d.cn("group/menu-item relative",e),"data-hook":t,"data-slot":"sidebar-menu-item",...r}));I.displayName="SidebarMenuItem";const ce=n.forwardRef(({type:e="caret",isActive:t=!1,className:r,...o},i)=>{const s={ref:i,className:d.cn("shrink-0 transition-transform",t&&e==="caret"&&"rotate-90",r),"data-slot":"sidebar-collapse-icon",...o};switch(e){case"horizontal":return a.jsx(b.ChevronRight,{...s});case"vertical":return a.jsx(b.ChevronDown,{...s});case"upDown":return a.jsx(b.ChevronsUpDown,{...s});case"plusMinus":return t?a.jsx(b.Minus,{...s}):a.jsx(b.Plus,{...s});case"dots":return a.jsx(b.Ellipsis,{...s});default:return a.jsx(b.ChevronRight,{...s})}});ce.displayName="SidebarCollapseIcon";const _e=D.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none ring-sidebar-ring transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-150 ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:last-child]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",{variants:{variant:{simple:"",collapsible:"[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform data-[state=open]:[&>[data-collapse-icon]]:rotate-90",dropdown:"group-has-[[data-sidebar=menu-action]]/menu-item:pr-8",tree:"[&>[data-tree-icon]]:size-4 [&>[data-tree-icon]]:shrink-0 [&>[data-tree-icon]]:opacity-70 [&>[data-tree-icon]]:transition-transform data-[state=open]:[&>[data-tree-icon]]:rotate-90 group-data-[collapsible=icon]:[&>[data-tree-icon]]:hidden",badge:"group-has-[[data-sidebar=menu-badge]]/menu-item:pr-16",bigIcon:"h-auto flex-col items-start gap-1 rounded-lg p-3 [&>svg]:size-6 [&>svg]:rounded-md [&>svg]:bg-sidebar-foreground [&>svg]:p-1 [&>svg]:text-sidebar [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar group-data-[collapsible=icon]:!size-10 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:[&>svg]:size-6",checkbox:"[&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground"},size:{default:"h-12 text-sm/4",sm:"h-7 text-xs/4",lg:"h-12 text-sm/4 group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"simple",size:"default"}}),A=n.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="simple",size:o="default",tooltip:i,className:s,dataHook:l,...c},p)=>{const g=e?y.Slot:"button",{isMobile:h,state:f}=k(),u=a.jsx(g,{ref:p,className:d.cn(_e({variant:r,size:o}),s),"data-active":t,"data-hook":l,"data-size":o,"data-slot":"sidebar-menu-button","data-variant":r,...c});return i?(typeof i=="string"&&(i={children:i,dataHook:"sidebar-menu-button-tooltip"}),a.jsxs(M.Tooltip,{children:[a.jsx(M.TooltipTrigger,{asChild:!0,children:u}),a.jsx(M.TooltipContent,{hideArrow:!0,...i,align:"center",className:d.cn("bg-foreground text-background border-none",i.className),hidden:f!=="collapsed"||h,side:"right",sideOffset:8})]})):u});A.displayName="SidebarMenuButton";const ue=n.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...o},i)=>{const s=t?y.Slot:"button";return a.jsx(s,{ref:i,className:d.cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","peer-data-[size=bigIcon]/menu-button:top-2.5","peer-data-[size=tree]/menu-button:top-1.5","group-data-[collapsible=icon]:hidden",r&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",e),"data-slot":"sidebar-menu-action",...o})});ue.displayName="SidebarMenuAction";const be=n.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:d.cn("text-sidebar-foreground pointer-events-none absolute inset-y-0 right-4 my-auto flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-menu-badge",...t}));be.displayName="SidebarMenuBadge";const pe=n.forwardRef(({className:e,showIcon:t=!1,...r},o)=>{const i=n.useId(),s=n.useMemo(()=>{let l=0;for(let c=0;c<i.length;c++)l=(l<<5)-l+i.charCodeAt(c),l|=0;return`${Math.abs(l)%40+50}%`},[i]);return a.jsxs("div",{ref:o,className:d.cn("flex h-8 items-center gap-2 rounded-md px-2",e),"data-slot":"sidebar-menu-skeleton",...r,children:[t&&a.jsx(z.Skeleton,{className:"size-4 rounded-md","data-slot":"sidebar-menu-skeleton-icon"}),a.jsx(z.Skeleton,{className:"h-4 max-w-[--skeleton-width] flex-1","data-slot":"sidebar-menu-skeleton-text",style:{"--skeleton-width":s}})]})});pe.displayName="SidebarMenuSkeleton";const Be=D.cva("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",{variants:{variant:{default:"",border:"border-l border-sidebar-border",indent:"ml-0 border-l-0"}},defaultVariants:{variant:"border"}}),O=n.forwardRef(({className:e,variant:t="border",dataHook:r,...o},i)=>a.jsx("ul",{ref:i,className:d.cn(Be({variant:t}),e),"data-hook":r,"data-slot":"sidebar-menu-sub",...o}));O.displayName="SidebarMenuSub";const fe=n.forwardRef(({dataHook:e,...t},r)=>a.jsx("li",{ref:r,"data-hook":e,"data-slot":"sidebar-menu-sub-item",...t}));fe.displayName="SidebarMenuSubItem";const me=n.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:o,dataHook:i,...s},l)=>{const c=e?y.Slot:"a";return a.jsx(c,{ref:l,className:d.cn("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-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),"data-active":r,"data-hook":i,"data-size":t,"data-slot":"sidebar-menu-sub-button",...s})});me.displayName="SidebarMenuSubButton";function ge({dataHook:e,className:t,children:r,defaultOpen:o,open:i,onOpenChange:s}){return a.jsx(I,{children:a.jsx(R.Accordion,{collapsible:!0,className:t,dataHook:e??"sidebar-menu-collapsible",defaultValue:o?"item":void 0,type:"single",value:i!==void 0?i?"item":"":void 0,onValueChange:s?l=>s(l==="item"):void 0,children:a.jsx(R.AccordionItem,{className:"group/collapsible border-none",value:"item",children:r})})})}ge.displayName="SidebarMenuCollapsible";const he=n.forwardRef(({children:e,className:t,...r},o)=>a.jsx(Re.Trigger,{asChild:!0,children:a.jsxs(A,{ref:o,className:d.cn("relative",t),variant:"collapsible",...r,children:[a.jsx(b.ChevronRight,{"data-collapse-icon":!0,className:"absolute left-2.5 !opacity-100 transition-transform duration-200 ease-out group-data-[state=open]/collapsible:rotate-90",size:12}),e]})}));he.displayName="SidebarMenuCollapsibleTrigger";const xe=n.forwardRef(({dataHook:e,children:t,...r},o)=>a.jsx(R.AccordionContent,{className:"p-0",children:a.jsx(O,{ref:o,dataHook:e,...r,children:t})}));xe.displayName="SidebarMenuCollapsibleContent";function ve({dataHook:e,title:t="Navigation",description:r="Main navigation menu",trackingEl:o,trackingLabel:i,children:s,className:l,...c}){return a.jsxs(N.Drawer,{direction:"left",children:[a.jsx(N.DrawerTrigger,{asChild:!0,children:a.jsx(_.Button,{iconOnly:!0,"aria-label":"Open menu",dataHook:`${e}-trigger`,size:"sm",trackingEl:o,trackingLabel:i,variant:"ghost",children:a.jsx(b.Menu,{size:24})})}),a.jsxs(N.DrawerContent,{className:d.cn("max-w-96",l),dataHook:e,...c,children:[a.jsx(N.DrawerTitle,{className:"sr-only",children:t}),a.jsx(N.DrawerDescription,{className:"sr-only",children:r}),a.jsx("div",{className:"flex h-full flex-col p-6",children:s})]})]})}ve.displayName="SidebarDrawer";exports.Sidebar=Z;exports.SidebarCollapseIcon=ce;exports.SidebarCollapseIconType=W;exports.SidebarCollapsible=P;exports.SidebarContent=oe;exports.SidebarDrawer=ve;exports.SidebarFooter=te;exports.SidebarGroup=ie;exports.SidebarGroupAction=ne;exports.SidebarGroupContent=de;exports.SidebarGroupLabel=se;exports.SidebarGroupLabelSize=G;exports.SidebarGroupLabelVariant=F;exports.SidebarHeader=ae;exports.SidebarInput=ee;exports.SidebarInset=Q;exports.SidebarMenu=le;exports.SidebarMenuAction=ue;exports.SidebarMenuBadge=be;exports.SidebarMenuButton=A;exports.SidebarMenuButtonSize=K;exports.SidebarMenuButtonVariant=H;exports.SidebarMenuCollapsible=ge;exports.SidebarMenuCollapsibleContent=xe;exports.SidebarMenuCollapsibleTrigger=he;exports.SidebarMenuItem=I;exports.SidebarMenuSkeleton=pe;exports.SidebarMenuSub=O;exports.SidebarMenuSubButton=me;exports.SidebarMenuSubButtonSize=V;exports.SidebarMenuSubItem=fe;exports.SidebarMenuSubVariant=U;exports.SidebarProvider=Y;exports.SidebarRail=J;exports.SidebarSeparator=re;exports.SidebarSide=L;exports.SidebarTrigger=$;exports.SidebarVariant=q;exports.useSidebar=k;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),Ne=require("react"),y=require("@radix-ui/react-slot"),D=require("class-variance-authority"),b=require("@brightlocal/icons"),d=require("@brightlocal/ui-components/lib/utils"),_=require("../button.cjs"),ye=require("../input.cjs"),ke=require("../separator.cjs"),T=require("../sheet.cjs"),N=require("../drawer.cjs"),R=require("../accordion.cjs"),je=require("@radix-ui/react-accordion"),Ce=require("../scroll-area.cjs"),z=require("../skeleton.cjs"),M=require("../tooltip.cjs"),Me=require("../hooks/use-mobile.cjs");function B(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const o=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(t,r,o.get?o:{enumerable:!0,get:()=>e[r]})}}return t.default=e,Object.freeze(t)}const n=B(Ne),Re=B(je);var L=(e=>(e.LEFT="left",e))(L||{}),q=(e=>(e.SIDEBAR="sidebar",e))(q||{}),P=(e=>(e.OFFCANVAS="offcanvas",e.ICON="icon",e.NONE="none",e))(P||{}),G=(e=>(e.DEFAULT="default",e.SM="sm",e.XS="xs",e))(G||{}),F=(e=>(e.DEFAULT="default",e.COLLAPSIBLE="collapsible",e.ACTION="action",e))(F||{}),H=(e=>(e.SIMPLE="simple",e.COLLAPSIBLE="collapsible",e.DROPDOWN="dropdown",e.TREE="tree",e.BADGE="badge",e.BIG_ICON="bigIcon",e.CHECKBOX="checkbox",e))(H||{}),K=(e=>(e.DEFAULT="default",e.SM="sm",e.LG="lg",e))(K||{}),U=(e=>(e.DEFAULT="default",e.BORDER="border",e.INDENT="indent",e))(U||{}),V=(e=>(e.SM="sm",e.MD="md",e))(V||{}),W=(e=>(e.CARET="caret",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.UP_DOWN="upDown",e.PLUS_MINUS="plusMinus",e.DOTS="dots",e))(W||{});const De="sidebar:state",Ie=3600*24*7,Ae="256px",Oe="288px",Ee="48px",Te="b",X=n.createContext(null);function k(){const e=n.useContext(X);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const Y=n.forwardRef(({dataHook:e,trackingEl:t,trackingLabel:r,defaultOpen:o=!0,open:i,onOpenChange:s,className:l,style:c,children:p,...g},h)=>{const f=Me.useIsMobile(),[u,x]=n.useState(!1),[S,Se]=n.useState(o),w=i??S,j=n.useCallback(m=>{const v=typeof m=="function"?m(w):m;s?s(v):Se(v),document.cookie=`${De}=${v}; path=/; max-age=${Ie}`},[s,w]),C=n.useCallback(()=>f?x(m=>!m):j(m=>!m),[f,j,x]);n.useEffect(()=>{const m=v=>{v.key===Te&&(v.metaKey||v.ctrlKey)&&(v.preventDefault(),C())};return window.addEventListener("keydown",m),()=>window.removeEventListener("keydown",m)},[C]);const E=w?"expanded":"collapsed",we=n.useMemo(()=>({state:E,open:w,setOpen:j,isMobile:f,openMobile:u,setOpenMobile:x,toggleSidebar:C}),[E,w,j,f,u,x,C]);return a.jsx(X.Provider,{value:we,children:a.jsx(M.TooltipProvider,{delayDuration:0,children:a.jsx("div",{ref:h,className:d.cn("group/sidebar-wrapper flex min-h-svh w-full",l),"data-hook":e,"data-slot":"sidebar-provider","data-tracking-el":t||"sidebar-provider","data-tracking-label":r,style:{"--sidebar-width":Ae,"--sidebar-width-icon":Ee,...c},...g,children:p})})})});Y.displayName="SidebarProvider";const Z=n.forwardRef(({dataHook:e,trackingEl:t,trackingLabel:r,side:o="left",variant:i="sidebar",collapsible:s="offcanvas",embedded:l=!1,className:c,children:p,...g},h)=>{const{isMobile:f,state:u,openMobile:x,setOpenMobile:S}=k();return s==="none"?a.jsx("div",{ref:h,className:d.cn("bg-sidebar text-sidebar-foreground flex h-full w-[var(--sidebar-width)] flex-col",c),"data-hook":e,"data-slot":"sidebar","data-tracking-el":t||"sidebar","data-tracking-label":r,...g,children:p}):l?a.jsx("div",{ref:h,className:d.cn("group bg-sidebar text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",u==="expanded"&&"w-[var(--sidebar-width)]",s==="icon"&&u==="collapsed"&&"w-[var(--sidebar-width-icon)]",s==="offcanvas"&&u==="collapsed"&&"w-0",c),"data-collapsible":u==="collapsed"?s:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":u,"data-tracking-el":t||"sidebar","data-tracking-label":r,"data-variant":i,...g,children:p}):f?a.jsx(T.Sheet,{open:x,onOpenChange:S,children:a.jsx(T.SheetContent,{className:"bg-sidebar text-sidebar-foreground w-[var(--sidebar-width)] p-0 [&>button]:hidden","data-hook":`${e}-mobile-content`,"data-mobile":"true","data-sidebar":"sidebar",side:"left",style:{"--sidebar-width":Oe},children:a.jsx("div",{className:"flex h-full w-full flex-col",children:p})})}):a.jsxs("div",{ref:h,className:"group peer text-sidebar-foreground hidden md:block","data-collapsible":u==="collapsed"?s:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":u,"data-tracking-el":t||"sidebar","data-tracking-label":r,"data-variant":i,children:[a.jsx("div",{className:d.cn("relative h-svh w-[var(--sidebar-width)] bg-transparent transition-[width] duration-200 ease-linear","group-data-[collapsible=offcanvas]:w-0","group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]")}),a.jsx("div",{className:d.cn("fixed inset-y-0 z-10 hidden h-svh w-[var(--sidebar-width)] transition-[left,right,width] duration-200 ease-linear md:flex","left-0 group-data-[collapsible=offcanvas]:left-[calc(var(--sidebar-width)*-1)]","group-data-[collapsible=icon]:w-[var(--sidebar-width-icon)]",c),...g,children:a.jsx("div",{className:"bg-sidebar flex h-full w-full flex-col","data-sidebar":"sidebar",children:p})})]})});Z.displayName="Sidebar";const $=n.forwardRef(({className:e,onClick:t,dataHook:r="sidebar-trigger",...o},i)=>{const{toggleSidebar:s}=k();return a.jsxs(_.Button,{ref:i,"aria-label":"Toggle Sidebar",className:d.cn("h-7 w-7",e),"data-slot":"sidebar-trigger",dataHook:r,size:"sm",variant:"ghost",onClick:l=>{t?.(l),s()},...o,children:[a.jsx(b.PanelLeft,{}),a.jsx("span",{className:"sr-only",children:"Toggle Sidebar"})]})});$.displayName="SidebarTrigger";const J=n.forwardRef(({className:e,...t},r)=>{const{toggleSidebar:o}=k();return a.jsx("button",{ref:r,"aria-label":"Toggle Sidebar",className:d.cn("hover:after:bg-sidebar-border absolute inset-y-0 -right-4 z-20 hidden w-4 -translate-x-1/2 transition-transform ease-linear after:absolute after:inset-y-0 after:left-1/2 after:w-[2px] sm:flex","cursor-w-resize","[[data-state=collapsed]_&]:cursor-e-resize","group-data-[collapsible=offcanvas]:hover:bg-sidebar group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","[[data-collapsible=offcanvas]_&]:-right-2",e),"data-slot":"sidebar-rail",tabIndex:-1,title:"Toggle Sidebar",onClick:o,...t})});J.displayName="SidebarRail";const Q=n.forwardRef(({className:e,dataHook:t,trackingEl:r,trackingLabel:o,...i},s)=>a.jsx("main",{ref:s,className:d.cn("bg-background relative flex min-h-svh flex-1 flex-col",e),"data-hook":t,"data-slot":"sidebar-inset","data-tracking-el":r||"sidebar-inset","data-tracking-label":o,...i}));Q.displayName="SidebarInset";const ee=n.forwardRef(({className:e,...t},r)=>a.jsx(ye.Input,{ref:r,className:d.cn("bg-background focus-visible:ring-sidebar-ring h-8 w-full shadow-none focus-visible:ring-2",e),"data-slot":"sidebar-input",dataHook:"sidebar-input",...t}));ee.displayName="SidebarInput";const ae=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("px-section-xs flex flex-col gap-2 pt-2 pb-9",e),"data-hook":t,"data-slot":"sidebar-header",...r}));ae.displayName="SidebarHeader";const te=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("flex flex-col gap-2 p-2",e),"data-hook":t,"data-slot":"sidebar-footer",...r}));te.displayName="SidebarFooter";const re=n.forwardRef(({className:e,...t},r)=>a.jsx(ke.Separator,{ref:r,className:d.cn("bg-sidebar-border mx-2 my-2 w-auto group-data-[collapsible=icon]:mx-0",e),"data-slot":"sidebar-separator",...t}));re.displayName="SidebarSeparator";const oe=n.forwardRef(({className:e,dataHook:t,ariaLabel:r="Sidebar",children:o,...i},s)=>a.jsx(Ce.ScrollArea,{ref:s,className:d.cn("min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&>[data-slot=scroll-area-viewport]]:p-0",e),dataHook:t??"sidebar-content-scroll",...i,children:a.jsx("nav",{"aria-label":r,className:"flex flex-col gap-2","data-slot":"sidebar-content",children:o})}));oe.displayName="SidebarContent";const ie=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("relative flex w-full min-w-0 flex-col p-2",e),"data-hook":t,"data-slot":"sidebar-group",...r}));ie.displayName="SidebarGroup";const ze=D.cva("flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none ring-sidebar-ring transition-[margin,opacity] duration-200 ease-linear focus-visible:ring-2 [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",{variants:{size:{default:"text-sm",sm:"text-sm",xs:"text-xs"},variant:{default:"",collapsible:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground",action:"w-full justify-between cursor-pointer hover:bg-sidebar-accent hover:text-sidebar-accent-foreground"}},defaultVariants:{size:"sm",variant:"default"}}),se=n.forwardRef(({className:e,dataHook:t,asChild:r=!1,size:o="sm",variant:i="default",isOpen:s=!1,onToggle:l,onAction:c,children:p,...g},h)=>{const f=r?y.Slot:"div",u=()=>{i==="collapsible"&&l?l():i==="action"&&c&&c()},x=S=>{(S.key==="Enter"||S.key===" ")&&(S.preventDefault(),u())};return a.jsxs(f,{ref:h,className:d.cn(ze({size:o,variant:i}),e),"data-hook":t,"data-slot":"sidebar-group-label","data-variant":i,role:i!=="default"?"button":void 0,tabIndex:i!=="default"?0:void 0,onClick:i!=="default"?u:void 0,onKeyDown:i!=="default"?x:void 0,...g,children:[a.jsx("span",{children:p}),i==="collapsible"&&a.jsx(b.ChevronDown,{className:d.cn("shrink-0 transition-transform duration-200",s&&"rotate-180"),size:16}),i==="action"&&a.jsx(b.Plus,{className:"shrink-0",size:16})]})});se.displayName="SidebarGroupLabel";const ne=n.forwardRef(({className:e,asChild:t=!1,...r},o)=>{const i=t?y.Slot:"button";return a.jsx(i,{ref:o,className:d.cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground absolute top-3.5 right-3 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-group-action",...r})});ne.displayName="SidebarGroupAction";const de=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("div",{ref:o,className:d.cn("w-full text-sm",e),"data-hook":t,"data-slot":"sidebar-group-content",...r}));de.displayName="SidebarGroupContent";const le=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("ul",{ref:o,className:d.cn("flex w-full min-w-0 flex-col gap-1",e),"data-hook":t,"data-slot":"sidebar-menu",...r}));le.displayName="SidebarMenu";const I=n.forwardRef(({className:e,dataHook:t,...r},o)=>a.jsx("li",{ref:o,className:d.cn("group/menu-item relative",e),"data-hook":t,"data-slot":"sidebar-menu-item",...r}));I.displayName="SidebarMenuItem";const ce=n.forwardRef(({type:e="caret",isActive:t=!1,className:r,...o},i)=>{const s={ref:i,className:d.cn("shrink-0 transition-transform",t&&e==="caret"&&"rotate-90",r),"data-slot":"sidebar-collapse-icon",...o};switch(e){case"horizontal":return a.jsx(b.ChevronRight,{...s});case"vertical":return a.jsx(b.ChevronDown,{...s});case"upDown":return a.jsx(b.ChevronsUpDown,{...s});case"plusMinus":return t?a.jsx(b.Minus,{...s}):a.jsx(b.Plus,{...s});case"dots":return a.jsx(b.Ellipsis,{...s});default:return a.jsx(b.ChevronRight,{...s})}});ce.displayName="SidebarCollapseIcon";const _e=D.cva("peer/menu-button flex w-full items-center gap-2 overflow-hidden rounded-full px-6 py-2 text-left text-sm font-medium outline-none ring-sidebar-ring transition-[color,background-color,border-color,box-shadow,opacity,width,height,padding] duration-150 ease-in-out hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:ring-2 active:bg-sidebar-accent active:text-sidebar-accent-foreground disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 data-[active=true]:bg-sidebar-accent data-[active=true]:font-semibold data-[active=true]:text-sidebar-accent-foreground data-[state=open]:hover:bg-sidebar-accent data-[state=open]:hover:text-sidebar-accent-foreground group-data-[collapsible=icon]:!size-8 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:rounded-md [&>span:last-child]:truncate [&>svg]:shrink-0 [&>svg]:opacity-70 data-[active=true]:[&>svg]:opacity-100 group-data-[collapsible=icon]:[&>span]:hidden group-data-[collapsible=icon]:[&>div]:hidden",{variants:{variant:{simple:"",collapsible:"[&>[data-collapse-icon]]:ml-auto [&>[data-collapse-icon]]:transition-transform data-[state=open]:[&>[data-collapse-icon]]:rotate-90",dropdown:"group-has-[[data-sidebar=menu-action]]/menu-item:pr-8",tree:"[&>[data-tree-icon]]:size-4 [&>[data-tree-icon]]:shrink-0 [&>[data-tree-icon]]:opacity-70 [&>[data-tree-icon]]:transition-transform data-[state=open]:[&>[data-tree-icon]]:rotate-90 group-data-[collapsible=icon]:[&>[data-tree-icon]]:hidden",badge:"group-has-[[data-sidebar=menu-badge]]/menu-item:pr-16",bigIcon:"h-auto flex-col items-start gap-1 rounded-lg p-3 [&>svg]:size-6 [&>svg]:rounded-md [&>svg]:bg-sidebar-foreground [&>svg]:p-1 [&>svg]:text-sidebar [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar group-data-[collapsible=icon]:!size-10 group-data-[collapsible=icon]:!p-2 group-data-[collapsible=icon]:items-center group-data-[collapsible=icon]:[&>svg]:size-6",checkbox:"[&>[data-checkbox]]:size-4 [&>[data-checkbox]]:shrink-0 [&>[data-checkbox]]:rounded [&>[data-checkbox]]:border [&>[data-checkbox]]:border-sidebar-foreground/30 data-[checked=true]:[&>[data-checkbox]]:bg-primary data-[checked=true]:[&>[data-checkbox]]:border-primary data-[checked=true]:[&>[data-checkbox]]:text-primary-foreground"},size:{default:"h-12 text-sm/4",sm:"h-7 text-xs/4",lg:"h-12 text-sm/4 group-data-[collapsible=icon]:!p-0"}},defaultVariants:{variant:"simple",size:"default"}}),A=n.forwardRef(({asChild:e=!1,isActive:t=!1,variant:r="simple",size:o="default",tooltip:i,className:s,dataHook:l,...c},p)=>{const g=e?y.Slot:"button",{isMobile:h,state:f}=k(),u=a.jsx(g,{ref:p,className:d.cn(_e({variant:r,size:o}),s),"data-active":t,"data-hook":l,"data-size":o,"data-slot":"sidebar-menu-button","data-variant":r,...c});return i?(typeof i=="string"&&(i={children:i,dataHook:"sidebar-menu-button-tooltip"}),a.jsxs(M.Tooltip,{children:[a.jsx(M.TooltipTrigger,{asChild:!0,children:u}),a.jsx(M.TooltipContent,{hideArrow:!0,...i,align:"center",className:d.cn("bg-foreground text-background border-none",i.className),hidden:f!=="collapsed"||h,side:"right",sideOffset:8})]})):u});A.displayName="SidebarMenuButton";const ue=n.forwardRef(({className:e,asChild:t=!1,showOnHover:r=!1,...o},i)=>{const s=t?y.Slot:"button";return a.jsx(s,{ref:i,className:d.cn("text-sidebar-foreground ring-sidebar-ring hover:bg-sidebar-accent hover:text-sidebar-accent-foreground peer-hover/menu-button:text-sidebar-accent-foreground absolute top-1.5 right-1 flex aspect-square w-5 items-center justify-center rounded-md p-0 transition-transform outline-none focus-visible:ring-2 [&>svg]:shrink-0","after:absolute after:-inset-2 after:md:hidden","peer-data-[size=sm]/menu-button:top-1","peer-data-[size=default]/menu-button:top-1.5","peer-data-[size=lg]/menu-button:top-2.5","peer-data-[size=bigIcon]/menu-button:top-2.5","peer-data-[size=tree]/menu-button:top-1.5","group-data-[collapsible=icon]:hidden",r&&"peer-data-[active=true]/menu-button:text-sidebar-accent-foreground group-focus-within/menu-item:opacity-100 group-hover/menu-item:opacity-100 data-[state=open]:opacity-100 md:opacity-0",e),"data-slot":"sidebar-menu-action",...o})});ue.displayName="SidebarMenuAction";const be=n.forwardRef(({className:e,...t},r)=>a.jsx("div",{ref:r,className:d.cn("text-sidebar-foreground pointer-events-none absolute inset-y-0 right-4 my-auto flex h-5 min-w-5 items-center justify-center rounded-md px-1 text-xs font-medium tabular-nums select-none","peer-hover/menu-button:text-sidebar-accent-foreground peer-data-[active=true]/menu-button:text-sidebar-accent-foreground","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-menu-badge",...t}));be.displayName="SidebarMenuBadge";const pe=n.forwardRef(({className:e,showIcon:t=!1,...r},o)=>{const i=n.useId(),s=n.useMemo(()=>{let l=0;for(let c=0;c<i.length;c++)l=(l<<5)-l+i.charCodeAt(c),l|=0;return`${Math.abs(l)%40+50}%`},[i]);return a.jsxs("div",{ref:o,className:d.cn("flex h-8 items-center gap-2 rounded-md px-2",e),"data-slot":"sidebar-menu-skeleton",...r,children:[t&&a.jsx(z.Skeleton,{className:"size-4 rounded-md","data-slot":"sidebar-menu-skeleton-icon"}),a.jsx(z.Skeleton,{className:"h-4 max-w-[--skeleton-width] flex-1","data-slot":"sidebar-menu-skeleton-text",style:{"--skeleton-width":s}})]})});pe.displayName="SidebarMenuSkeleton";const Be=D.cva("mx-3.5 flex min-w-0 translate-x-px flex-col gap-1 px-2.5 py-0.5 group-data-[collapsible=icon]:hidden",{variants:{variant:{default:"",border:"border-l border-sidebar-border",indent:"ml-0 border-l-0"}},defaultVariants:{variant:"border"}}),O=n.forwardRef(({className:e,variant:t="border",dataHook:r,...o},i)=>a.jsx("ul",{ref:i,className:d.cn(Be({variant:t}),e),"data-hook":r,"data-slot":"sidebar-menu-sub",...o}));O.displayName="SidebarMenuSub";const fe=n.forwardRef(({dataHook:e,...t},r)=>a.jsx("li",{ref:r,"data-hook":e,"data-slot":"sidebar-menu-sub-item",...t}));fe.displayName="SidebarMenuSubItem";const me=n.forwardRef(({asChild:e=!1,size:t="md",isActive:r,className:o,dataHook:i,...s},l)=>{const c=e?y.Slot:"a";return a.jsx(c,{ref:l,className:d.cn("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-foreground flex h-7 min-w-0 -translate-x-px items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none focus-visible:ring-2 disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-child]:truncate [&>svg]:shrink-0","data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",t==="sm"&&"text-xs",t==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),"data-active":r,"data-hook":i,"data-size":t,"data-slot":"sidebar-menu-sub-button",...s})});me.displayName="SidebarMenuSubButton";function ge({dataHook:e,className:t,children:r,defaultOpen:o,open:i,onOpenChange:s}){return a.jsx(I,{children:a.jsx(R.Accordion,{collapsible:!0,className:t,dataHook:e??"sidebar-menu-collapsible",defaultValue:o?"item":void 0,type:"single",value:i!==void 0?i?"item":"":void 0,onValueChange:s?l=>s(l==="item"):void 0,children:a.jsx(R.AccordionItem,{className:"group/collapsible border-none",value:"item",children:r})})})}ge.displayName="SidebarMenuCollapsible";const he=n.forwardRef(({children:e,className:t,...r},o)=>a.jsx(Re.Trigger,{asChild:!0,children:a.jsxs(A,{ref:o,className:d.cn("relative",t),variant:"collapsible",...r,children:[a.jsx(b.ChevronRight,{"data-collapse-icon":!0,className:"absolute left-2.5 !opacity-100 transition-transform duration-200 ease-out group-data-[state=open]/collapsible:rotate-90",size:12}),e]})}));he.displayName="SidebarMenuCollapsibleTrigger";const xe=n.forwardRef(({dataHook:e,children:t,...r},o)=>a.jsx(R.AccordionContent,{className:"p-0",children:a.jsx(O,{ref:o,dataHook:e,...r,children:t})}));xe.displayName="SidebarMenuCollapsibleContent";function ve({dataHook:e,title:t="Navigation",description:r="Main navigation menu",trackingEl:o,trackingLabel:i,children:s,className:l,...c}){return a.jsxs(N.Drawer,{direction:"left",children:[a.jsx(N.DrawerTrigger,{asChild:!0,children:a.jsx(_.Button,{iconOnly:!0,"aria-label":"Open menu",dataHook:`${e}-trigger`,size:"sm",trackingEl:o,trackingLabel:i,variant:"ghost",children:a.jsx(b.Menu,{size:24})})}),a.jsxs(N.DrawerContent,{className:d.cn("max-w-96",l),dataHook:e,...c,children:[a.jsx(N.DrawerTitle,{className:"sr-only",children:t}),a.jsx(N.DrawerDescription,{className:"sr-only",children:r}),a.jsx("div",{className:"flex h-full flex-col p-6",children:s})]})]})}ve.displayName="SidebarDrawer";exports.Sidebar=Z;exports.SidebarCollapseIcon=ce;exports.SidebarCollapseIconType=W;exports.SidebarCollapsible=P;exports.SidebarContent=oe;exports.SidebarDrawer=ve;exports.SidebarFooter=te;exports.SidebarGroup=ie;exports.SidebarGroupAction=ne;exports.SidebarGroupContent=de;exports.SidebarGroupLabel=se;exports.SidebarGroupLabelSize=G;exports.SidebarGroupLabelVariant=F;exports.SidebarHeader=ae;exports.SidebarInput=ee;exports.SidebarInset=Q;exports.SidebarMenu=le;exports.SidebarMenuAction=ue;exports.SidebarMenuBadge=be;exports.SidebarMenuButton=A;exports.SidebarMenuButtonSize=K;exports.SidebarMenuButtonVariant=H;exports.SidebarMenuCollapsible=ge;exports.SidebarMenuCollapsibleContent=xe;exports.SidebarMenuCollapsibleTrigger=he;exports.SidebarMenuItem=I;exports.SidebarMenuSkeleton=pe;exports.SidebarMenuSub=O;exports.SidebarMenuSubButton=me;exports.SidebarMenuSubButtonSize=V;exports.SidebarMenuSubItem=fe;exports.SidebarMenuSubVariant=U;exports.SidebarProvider=Y;exports.SidebarRail=J;exports.SidebarSeparator=re;exports.SidebarSide=L;exports.SidebarTrigger=$;exports.SidebarVariant=q;exports.useSidebar=k;
|
package/dist/blocks/sidebar.d.ts
CHANGED
|
@@ -271,6 +271,10 @@ declare const SidebarSeparator: React.ForwardRefExoticComponent<Omit<Omit<import
|
|
|
271
271
|
interface SidebarContentProps extends Omit<React.ComponentProps<"div">, "dir"> {
|
|
272
272
|
/** Data hook for automated testing */
|
|
273
273
|
dataHook?: string;
|
|
274
|
+
/** Accessible label for the sidebar navigation landmark. Override for i18n.
|
|
275
|
+
* @default "Sidebar"
|
|
276
|
+
*/
|
|
277
|
+
ariaLabel?: string;
|
|
274
278
|
}
|
|
275
279
|
declare const SidebarContent: React.ForwardRefExoticComponent<Omit<SidebarContentProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
|
|
276
280
|
/**
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"sidebar.d.ts","sourceRoot":"","sources":["../../src/blocks/sidebar.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAE/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAalE,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,KAAK,EAAE,MAAM,qBAAqB,CAAC;AAC5C,OAAO,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAiBpD,OAAO,EAEL,cAAc,EAGf,MAAM,uBAAuB,CAAC;AAG/B;;GAEG;AACH,oBAAY,WAAW;IACrB,qCAAqC;IACrC,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,cAAc;IACxB,wCAAwC;IACxC,OAAO,YAAY;CACpB;AAED;;GAEG;AACH,oBAAY,kBAAkB;IAC5B,uCAAuC;IACvC,SAAS,cAAc;IACvB,kCAAkC;IAClC,IAAI,SAAS;IACb,8BAA8B;IAC9B,IAAI,SAAS;CACd;AAED;;GAEG;AACH,oBAAY,qBAAqB;IAC/B,mBAAmB;IACnB,OAAO,YAAY;IACnB,iBAAiB;IACjB,EAAE,OAAO;IACT,uBAAuB;IACvB,EAAE,OAAO;CACV;AAED;;GAEG;AACH,oBAAY,wBAAwB;IAClC,mBAAmB;IACnB,OAAO,YAAY;IACnB,qCAAqC;IACrC,WAAW,gBAAgB;IAC3B,kCAAkC;IAClC,MAAM,WAAW;CAClB;AAED;;GAEG;AACH,oBAAY,wBAAwB;IAClC,yCAAyC;IACzC,MAAM,WAAW;IACjB,qDAAqD;IACrD,WAAW,gBAAgB;IAC3B,sCAAsC;IACtC,QAAQ,aAAa;IACrB,wCAAwC;IACxC,IAAI,SAAS;IACb,sCAAsC;IACtC,KAAK,UAAU;IACf,0CAA0C;IAC1C,QAAQ,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s as x } from "react/jsx-runtime";
|
|
2
|
-
import * as
|
|
2
|
+
import * as d from "react";
|
|
3
3
|
import { Slot as S } from "@radix-ui/react-slot";
|
|
4
4
|
import { cva as D } from "class-variance-authority";
|
|
5
5
|
import { ChevronRight as R, Ellipsis as F, Minus as G, Plus as E, ChevronsUpDown as H, ChevronDown as A, Menu as K, PanelLeft as U } from "@brightlocal/icons";
|
|
@@ -16,40 +16,40 @@ import { Skeleton as I } from "../skeleton.js";
|
|
|
16
16
|
import { Tooltip as oe, TooltipTrigger as ie, TooltipContent as se, TooltipProvider as de } from "../tooltip.js";
|
|
17
17
|
import { useIsMobile as ne } from "../hooks/use-mobile.js";
|
|
18
18
|
var le = /* @__PURE__ */ ((e) => (e.LEFT = "left", e))(le || {}), ce = /* @__PURE__ */ ((e) => (e.SIDEBAR = "sidebar", e))(ce || {}), ue = /* @__PURE__ */ ((e) => (e.OFFCANVAS = "offcanvas", e.ICON = "icon", e.NONE = "none", e))(ue || {}), be = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.SM = "sm", e.XS = "xs", e))(be || {}), pe = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.COLLAPSIBLE = "collapsible", e.ACTION = "action", e))(pe || {}), fe = /* @__PURE__ */ ((e) => (e.SIMPLE = "simple", e.COLLAPSIBLE = "collapsible", e.DROPDOWN = "dropdown", e.TREE = "tree", e.BADGE = "badge", e.BIG_ICON = "bigIcon", e.CHECKBOX = "checkbox", e))(fe || {}), me = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.SM = "sm", e.LG = "lg", e))(me || {}), ge = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.BORDER = "border", e.INDENT = "indent", e))(ge || {}), he = /* @__PURE__ */ ((e) => (e.SM = "sm", e.MD = "md", e))(he || {}), ve = /* @__PURE__ */ ((e) => (e.CARET = "caret", e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e.UP_DOWN = "upDown", e.PLUS_MINUS = "plusMinus", e.DOTS = "dots", e))(ve || {});
|
|
19
|
-
const xe = "sidebar:state", we = 3600 * 24 * 7, Ne = "256px", Se = "288px", ye = "48px", ke = "b", T =
|
|
19
|
+
const xe = "sidebar:state", we = 3600 * 24 * 7, Ne = "256px", Se = "288px", ye = "48px", ke = "b", T = d.createContext(null);
|
|
20
20
|
function C() {
|
|
21
|
-
const e =
|
|
21
|
+
const e = d.useContext(T);
|
|
22
22
|
if (!e)
|
|
23
23
|
throw new Error("useSidebar must be used within a SidebarProvider.");
|
|
24
24
|
return e;
|
|
25
25
|
}
|
|
26
|
-
const Ce =
|
|
26
|
+
const Ce = d.forwardRef(
|
|
27
27
|
({
|
|
28
28
|
dataHook: e,
|
|
29
29
|
trackingEl: a,
|
|
30
30
|
trackingLabel: r,
|
|
31
31
|
defaultOpen: o = !0,
|
|
32
32
|
open: i,
|
|
33
|
-
onOpenChange:
|
|
33
|
+
onOpenChange: s,
|
|
34
34
|
className: l,
|
|
35
35
|
style: c,
|
|
36
36
|
children: b,
|
|
37
37
|
...m
|
|
38
38
|
}, g) => {
|
|
39
|
-
const p = ne(), [u, h] =
|
|
39
|
+
const p = ne(), [u, h] = d.useState(!1), [w, B] = d.useState(o), N = i ?? w, y = d.useCallback(
|
|
40
40
|
(f) => {
|
|
41
41
|
const v = typeof f == "function" ? f(N) : f;
|
|
42
|
-
|
|
42
|
+
s ? s(v) : B(v), document.cookie = `${xe}=${v}; path=/; max-age=${we}`;
|
|
43
43
|
},
|
|
44
|
-
[
|
|
45
|
-
), k =
|
|
46
|
-
|
|
44
|
+
[s, N]
|
|
45
|
+
), k = d.useCallback(() => p ? h((f) => !f) : y((f) => !f), [p, y, h]);
|
|
46
|
+
d.useEffect(() => {
|
|
47
47
|
const f = (v) => {
|
|
48
48
|
v.key === ke && (v.metaKey || v.ctrlKey) && (v.preventDefault(), k());
|
|
49
49
|
};
|
|
50
50
|
return window.addEventListener("keydown", f), () => window.removeEventListener("keydown", f);
|
|
51
51
|
}, [k]);
|
|
52
|
-
const M = N ? "expanded" : "collapsed", P =
|
|
52
|
+
const M = N ? "expanded" : "collapsed", P = d.useMemo(
|
|
53
53
|
() => ({
|
|
54
54
|
state: M,
|
|
55
55
|
open: N,
|
|
@@ -85,21 +85,21 @@ const Ce = s.forwardRef(
|
|
|
85
85
|
}
|
|
86
86
|
);
|
|
87
87
|
Ce.displayName = "SidebarProvider";
|
|
88
|
-
const Re =
|
|
88
|
+
const Re = d.forwardRef(
|
|
89
89
|
({
|
|
90
90
|
dataHook: e,
|
|
91
91
|
trackingEl: a,
|
|
92
92
|
trackingLabel: r,
|
|
93
93
|
side: o = "left",
|
|
94
94
|
variant: i = "sidebar",
|
|
95
|
-
collapsible:
|
|
95
|
+
collapsible: s = "offcanvas",
|
|
96
96
|
embedded: l = !1,
|
|
97
97
|
className: c,
|
|
98
98
|
children: b,
|
|
99
99
|
...m
|
|
100
100
|
}, g) => {
|
|
101
101
|
const { isMobile: p, state: u, openMobile: h, setOpenMobile: w } = C();
|
|
102
|
-
return
|
|
102
|
+
return s === "none" ? /* @__PURE__ */ t(
|
|
103
103
|
"div",
|
|
104
104
|
{
|
|
105
105
|
ref: g,
|
|
@@ -121,11 +121,11 @@ const Re = s.forwardRef(
|
|
|
121
121
|
className: n(
|
|
122
122
|
"group bg-sidebar text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",
|
|
123
123
|
u === "expanded" && "w-[var(--sidebar-width)]",
|
|
124
|
-
|
|
125
|
-
|
|
124
|
+
s === "icon" && u === "collapsed" && "w-[var(--sidebar-width-icon)]",
|
|
125
|
+
s === "offcanvas" && u === "collapsed" && "w-0",
|
|
126
126
|
c
|
|
127
127
|
),
|
|
128
|
-
"data-collapsible": u === "collapsed" ?
|
|
128
|
+
"data-collapsible": u === "collapsed" ? s : "",
|
|
129
129
|
"data-hook": e,
|
|
130
130
|
"data-side": o,
|
|
131
131
|
"data-slot": "sidebar",
|
|
@@ -154,7 +154,7 @@ const Re = s.forwardRef(
|
|
|
154
154
|
{
|
|
155
155
|
ref: g,
|
|
156
156
|
className: "group peer text-sidebar-foreground hidden md:block",
|
|
157
|
-
"data-collapsible": u === "collapsed" ?
|
|
157
|
+
"data-collapsible": u === "collapsed" ? s : "",
|
|
158
158
|
"data-hook": e,
|
|
159
159
|
"data-side": o,
|
|
160
160
|
"data-slot": "sidebar",
|
|
@@ -199,8 +199,8 @@ const Re = s.forwardRef(
|
|
|
199
199
|
}
|
|
200
200
|
);
|
|
201
201
|
Re.displayName = "Sidebar";
|
|
202
|
-
const De =
|
|
203
|
-
const { toggleSidebar:
|
|
202
|
+
const De = d.forwardRef(({ className: e, onClick: a, dataHook: r = "sidebar-trigger", ...o }, i) => {
|
|
203
|
+
const { toggleSidebar: s } = C();
|
|
204
204
|
return /* @__PURE__ */ x(
|
|
205
205
|
O,
|
|
206
206
|
{
|
|
@@ -212,7 +212,7 @@ const De = s.forwardRef(({ className: e, onClick: a, dataHook: r = "sidebar-trig
|
|
|
212
212
|
size: "sm",
|
|
213
213
|
variant: "ghost",
|
|
214
214
|
onClick: (l) => {
|
|
215
|
-
a?.(l),
|
|
215
|
+
a?.(l), s();
|
|
216
216
|
},
|
|
217
217
|
...o,
|
|
218
218
|
children: [
|
|
@@ -223,7 +223,7 @@ const De = s.forwardRef(({ className: e, onClick: a, dataHook: r = "sidebar-trig
|
|
|
223
223
|
);
|
|
224
224
|
});
|
|
225
225
|
De.displayName = "SidebarTrigger";
|
|
226
|
-
const Me =
|
|
226
|
+
const Me = d.forwardRef(
|
|
227
227
|
({ className: e, ...a }, r) => {
|
|
228
228
|
const { toggleSidebar: o } = C();
|
|
229
229
|
return /* @__PURE__ */ t(
|
|
@@ -249,11 +249,11 @@ const Me = s.forwardRef(
|
|
|
249
249
|
}
|
|
250
250
|
);
|
|
251
251
|
Me.displayName = "SidebarRail";
|
|
252
|
-
const Ie =
|
|
253
|
-
({ className: e, dataHook: a, trackingEl: r, trackingLabel: o, ...i },
|
|
252
|
+
const Ie = d.forwardRef(
|
|
253
|
+
({ className: e, dataHook: a, trackingEl: r, trackingLabel: o, ...i }, s) => /* @__PURE__ */ t(
|
|
254
254
|
"main",
|
|
255
255
|
{
|
|
256
|
-
ref:
|
|
256
|
+
ref: s,
|
|
257
257
|
className: n(
|
|
258
258
|
"bg-background relative flex min-h-svh flex-1 flex-col",
|
|
259
259
|
e
|
|
@@ -267,7 +267,7 @@ const Ie = s.forwardRef(
|
|
|
267
267
|
)
|
|
268
268
|
);
|
|
269
269
|
Ie.displayName = "SidebarInset";
|
|
270
|
-
const Ee =
|
|
270
|
+
const Ee = d.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
271
271
|
j,
|
|
272
272
|
{
|
|
273
273
|
ref: r,
|
|
@@ -281,7 +281,7 @@ const Ee = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
|
281
281
|
}
|
|
282
282
|
));
|
|
283
283
|
Ee.displayName = "SidebarInput";
|
|
284
|
-
const Ae =
|
|
284
|
+
const Ae = d.forwardRef(
|
|
285
285
|
({ className: e, dataHook: a, ...r }, o) => /* @__PURE__ */ t(
|
|
286
286
|
"div",
|
|
287
287
|
{
|
|
@@ -294,7 +294,7 @@ const Ae = s.forwardRef(
|
|
|
294
294
|
)
|
|
295
295
|
);
|
|
296
296
|
Ae.displayName = "SidebarHeader";
|
|
297
|
-
const Oe =
|
|
297
|
+
const Oe = d.forwardRef(
|
|
298
298
|
({ className: e, dataHook: a, ...r }, o) => /* @__PURE__ */ t(
|
|
299
299
|
"div",
|
|
300
300
|
{
|
|
@@ -307,7 +307,7 @@ const Oe = s.forwardRef(
|
|
|
307
307
|
)
|
|
308
308
|
);
|
|
309
309
|
Oe.displayName = "SidebarFooter";
|
|
310
|
-
const Te =
|
|
310
|
+
const Te = d.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
311
311
|
$,
|
|
312
312
|
{
|
|
313
313
|
ref: r,
|
|
@@ -320,31 +320,31 @@ const Te = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
|
320
320
|
}
|
|
321
321
|
));
|
|
322
322
|
Te.displayName = "SidebarSeparator";
|
|
323
|
-
const ze =
|
|
324
|
-
({ className: e, dataHook: a,
|
|
323
|
+
const ze = d.forwardRef(
|
|
324
|
+
({ className: e, dataHook: a, ariaLabel: r = "Sidebar", children: o, ...i }, s) => /* @__PURE__ */ t(
|
|
325
325
|
re,
|
|
326
326
|
{
|
|
327
|
-
ref:
|
|
327
|
+
ref: s,
|
|
328
328
|
className: n(
|
|
329
329
|
"min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden [&>[data-slot=scroll-area-viewport]]:p-0",
|
|
330
330
|
e
|
|
331
331
|
),
|
|
332
332
|
dataHook: a ?? "sidebar-content-scroll",
|
|
333
|
-
...
|
|
333
|
+
...i,
|
|
334
334
|
children: /* @__PURE__ */ t(
|
|
335
335
|
"nav",
|
|
336
336
|
{
|
|
337
|
-
"aria-label":
|
|
337
|
+
"aria-label": r,
|
|
338
338
|
className: "flex flex-col gap-2",
|
|
339
339
|
"data-slot": "sidebar-content",
|
|
340
|
-
children:
|
|
340
|
+
children: o
|
|
341
341
|
}
|
|
342
342
|
)
|
|
343
343
|
}
|
|
344
344
|
)
|
|
345
345
|
);
|
|
346
346
|
ze.displayName = "SidebarContent";
|
|
347
|
-
const _e =
|
|
347
|
+
const _e = d.forwardRef(
|
|
348
348
|
({ className: e, dataHook: a, ...r }, o) => /* @__PURE__ */ t(
|
|
349
349
|
"div",
|
|
350
350
|
{
|
|
@@ -377,14 +377,14 @@ const Le = D(
|
|
|
377
377
|
variant: "default"
|
|
378
378
|
}
|
|
379
379
|
}
|
|
380
|
-
), Be =
|
|
380
|
+
), Be = d.forwardRef(
|
|
381
381
|
({
|
|
382
382
|
className: e,
|
|
383
383
|
dataHook: a,
|
|
384
384
|
asChild: r = !1,
|
|
385
385
|
size: o = "sm",
|
|
386
386
|
variant: i = "default",
|
|
387
|
-
isOpen:
|
|
387
|
+
isOpen: s = !1,
|
|
388
388
|
onToggle: l,
|
|
389
389
|
onAction: c,
|
|
390
390
|
children: b,
|
|
@@ -415,7 +415,7 @@ const Le = D(
|
|
|
415
415
|
{
|
|
416
416
|
className: n(
|
|
417
417
|
"shrink-0 transition-transform duration-200",
|
|
418
|
-
|
|
418
|
+
s && "rotate-180"
|
|
419
419
|
),
|
|
420
420
|
size: 16
|
|
421
421
|
}
|
|
@@ -427,7 +427,7 @@ const Le = D(
|
|
|
427
427
|
}
|
|
428
428
|
);
|
|
429
429
|
Be.displayName = "SidebarGroupLabel";
|
|
430
|
-
const Pe =
|
|
430
|
+
const Pe = d.forwardRef(({ className: e, asChild: a = !1, ...r }, o) => /* @__PURE__ */ t(
|
|
431
431
|
a ? S : "button",
|
|
432
432
|
{
|
|
433
433
|
ref: o,
|
|
@@ -443,7 +443,7 @@ const Pe = s.forwardRef(({ className: e, asChild: a = !1, ...r }, o) => /* @__PU
|
|
|
443
443
|
}
|
|
444
444
|
));
|
|
445
445
|
Pe.displayName = "SidebarGroupAction";
|
|
446
|
-
const Fe =
|
|
446
|
+
const Fe = d.forwardRef(({ className: e, dataHook: a, ...r }, o) => /* @__PURE__ */ t(
|
|
447
447
|
"div",
|
|
448
448
|
{
|
|
449
449
|
ref: o,
|
|
@@ -454,7 +454,7 @@ const Fe = s.forwardRef(({ className: e, dataHook: a, ...r }, o) => /* @__PURE__
|
|
|
454
454
|
}
|
|
455
455
|
));
|
|
456
456
|
Fe.displayName = "SidebarGroupContent";
|
|
457
|
-
const Ge =
|
|
457
|
+
const Ge = d.forwardRef(
|
|
458
458
|
({ className: e, dataHook: a, ...r }, o) => /* @__PURE__ */ t(
|
|
459
459
|
"ul",
|
|
460
460
|
{
|
|
@@ -467,7 +467,7 @@ const Ge = s.forwardRef(
|
|
|
467
467
|
)
|
|
468
468
|
);
|
|
469
469
|
Ge.displayName = "SidebarMenu";
|
|
470
|
-
const z =
|
|
470
|
+
const z = d.forwardRef(
|
|
471
471
|
({ className: e, dataHook: a, ...r }, o) => /* @__PURE__ */ t(
|
|
472
472
|
"li",
|
|
473
473
|
{
|
|
@@ -480,14 +480,14 @@ const z = s.forwardRef(
|
|
|
480
480
|
)
|
|
481
481
|
);
|
|
482
482
|
z.displayName = "SidebarMenuItem";
|
|
483
|
-
const He =
|
|
483
|
+
const He = d.forwardRef(
|
|
484
484
|
({
|
|
485
485
|
type: e = "caret",
|
|
486
486
|
isActive: a = !1,
|
|
487
487
|
className: r,
|
|
488
488
|
...o
|
|
489
489
|
}, i) => {
|
|
490
|
-
const
|
|
490
|
+
const s = {
|
|
491
491
|
ref: i,
|
|
492
492
|
className: n(
|
|
493
493
|
"shrink-0 transition-transform",
|
|
@@ -499,17 +499,17 @@ const He = s.forwardRef(
|
|
|
499
499
|
};
|
|
500
500
|
switch (e) {
|
|
501
501
|
case "horizontal":
|
|
502
|
-
return /* @__PURE__ */ t(R, { ...
|
|
502
|
+
return /* @__PURE__ */ t(R, { ...s });
|
|
503
503
|
case "vertical":
|
|
504
|
-
return /* @__PURE__ */ t(A, { ...
|
|
504
|
+
return /* @__PURE__ */ t(A, { ...s });
|
|
505
505
|
case "upDown":
|
|
506
|
-
return /* @__PURE__ */ t(H, { ...
|
|
506
|
+
return /* @__PURE__ */ t(H, { ...s });
|
|
507
507
|
case "plusMinus":
|
|
508
|
-
return a ? /* @__PURE__ */ t(G, { ...
|
|
508
|
+
return a ? /* @__PURE__ */ t(G, { ...s }) : /* @__PURE__ */ t(E, { ...s });
|
|
509
509
|
case "dots":
|
|
510
|
-
return /* @__PURE__ */ t(F, { ...
|
|
510
|
+
return /* @__PURE__ */ t(F, { ...s });
|
|
511
511
|
default:
|
|
512
|
-
return /* @__PURE__ */ t(R, { ...
|
|
512
|
+
return /* @__PURE__ */ t(R, { ...s });
|
|
513
513
|
}
|
|
514
514
|
}
|
|
515
515
|
);
|
|
@@ -545,14 +545,14 @@ const Ke = D(
|
|
|
545
545
|
size: "default"
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
|
-
), _ =
|
|
548
|
+
), _ = d.forwardRef(
|
|
549
549
|
({
|
|
550
550
|
asChild: e = !1,
|
|
551
551
|
isActive: a = !1,
|
|
552
552
|
variant: r = "simple",
|
|
553
553
|
size: o = "default",
|
|
554
554
|
tooltip: i,
|
|
555
|
-
className:
|
|
555
|
+
className: s,
|
|
556
556
|
dataHook: l,
|
|
557
557
|
...c
|
|
558
558
|
}, b) => {
|
|
@@ -560,7 +560,7 @@ const Ke = D(
|
|
|
560
560
|
m,
|
|
561
561
|
{
|
|
562
562
|
ref: b,
|
|
563
|
-
className: n(Ke({ variant: r, size: o }),
|
|
563
|
+
className: n(Ke({ variant: r, size: o }), s),
|
|
564
564
|
"data-active": a,
|
|
565
565
|
"data-hook": l,
|
|
566
566
|
"data-size": o,
|
|
@@ -593,7 +593,7 @@ const Ke = D(
|
|
|
593
593
|
}
|
|
594
594
|
);
|
|
595
595
|
_.displayName = "SidebarMenuButton";
|
|
596
|
-
const Ue =
|
|
596
|
+
const Ue = d.forwardRef(({ className: e, asChild: a = !1, showOnHover: r = !1, ...o }, i) => /* @__PURE__ */ t(
|
|
597
597
|
a ? S : "button",
|
|
598
598
|
{
|
|
599
599
|
ref: i,
|
|
@@ -615,7 +615,7 @@ const Ue = s.forwardRef(({ className: e, asChild: a = !1, showOnHover: r = !1, .
|
|
|
615
615
|
}
|
|
616
616
|
));
|
|
617
617
|
Ue.displayName = "SidebarMenuAction";
|
|
618
|
-
const je =
|
|
618
|
+
const je = d.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
619
619
|
"div",
|
|
620
620
|
{
|
|
621
621
|
ref: r,
|
|
@@ -630,8 +630,8 @@ const je = s.forwardRef(({ className: e, ...a }, r) => /* @__PURE__ */ t(
|
|
|
630
630
|
}
|
|
631
631
|
));
|
|
632
632
|
je.displayName = "SidebarMenuBadge";
|
|
633
|
-
const $e =
|
|
634
|
-
const i =
|
|
633
|
+
const $e = d.forwardRef(({ className: e, showIcon: a = !1, ...r }, o) => {
|
|
634
|
+
const i = d.useId(), s = d.useMemo(() => {
|
|
635
635
|
let l = 0;
|
|
636
636
|
for (let c = 0; c < i.length; c++)
|
|
637
637
|
l = (l << 5) - l + i.charCodeAt(c), l |= 0;
|
|
@@ -658,7 +658,7 @@ const $e = s.forwardRef(({ className: e, showIcon: a = !1, ...r }, o) => {
|
|
|
658
658
|
className: "h-4 max-w-[--skeleton-width] flex-1",
|
|
659
659
|
"data-slot": "sidebar-menu-skeleton-text",
|
|
660
660
|
style: {
|
|
661
|
-
"--skeleton-width":
|
|
661
|
+
"--skeleton-width": s
|
|
662
662
|
}
|
|
663
663
|
}
|
|
664
664
|
)
|
|
@@ -681,7 +681,7 @@ const We = D(
|
|
|
681
681
|
variant: "border"
|
|
682
682
|
}
|
|
683
683
|
}
|
|
684
|
-
), L =
|
|
684
|
+
), L = d.forwardRef(
|
|
685
685
|
({ className: e, variant: a = "border", dataHook: r, ...o }, i) => /* @__PURE__ */ t(
|
|
686
686
|
"ul",
|
|
687
687
|
{
|
|
@@ -694,7 +694,7 @@ const We = D(
|
|
|
694
694
|
)
|
|
695
695
|
);
|
|
696
696
|
L.displayName = "SidebarMenuSub";
|
|
697
|
-
const Xe =
|
|
697
|
+
const Xe = d.forwardRef(({ dataHook: e, ...a }, r) => /* @__PURE__ */ t(
|
|
698
698
|
"li",
|
|
699
699
|
{
|
|
700
700
|
ref: r,
|
|
@@ -704,14 +704,14 @@ const Xe = s.forwardRef(({ dataHook: e, ...a }, r) => /* @__PURE__ */ t(
|
|
|
704
704
|
}
|
|
705
705
|
));
|
|
706
706
|
Xe.displayName = "SidebarMenuSubItem";
|
|
707
|
-
const qe =
|
|
707
|
+
const qe = d.forwardRef(
|
|
708
708
|
({
|
|
709
709
|
asChild: e = !1,
|
|
710
710
|
size: a = "md",
|
|
711
711
|
isActive: r,
|
|
712
712
|
className: o,
|
|
713
713
|
dataHook: i,
|
|
714
|
-
...
|
|
714
|
+
...s
|
|
715
715
|
}, l) => /* @__PURE__ */ t(
|
|
716
716
|
e ? S : "a",
|
|
717
717
|
{
|
|
@@ -728,7 +728,7 @@ const qe = s.forwardRef(
|
|
|
728
728
|
"data-hook": i,
|
|
729
729
|
"data-size": a,
|
|
730
730
|
"data-slot": "sidebar-menu-sub-button",
|
|
731
|
-
...
|
|
731
|
+
...s
|
|
732
732
|
}
|
|
733
733
|
)
|
|
734
734
|
);
|
|
@@ -739,7 +739,7 @@ function Ve({
|
|
|
739
739
|
children: r,
|
|
740
740
|
defaultOpen: o,
|
|
741
741
|
open: i,
|
|
742
|
-
onOpenChange:
|
|
742
|
+
onOpenChange: s
|
|
743
743
|
}) {
|
|
744
744
|
return /* @__PURE__ */ t(z, { children: /* @__PURE__ */ t(
|
|
745
745
|
Q,
|
|
@@ -750,13 +750,13 @@ function Ve({
|
|
|
750
750
|
defaultValue: o ? "item" : void 0,
|
|
751
751
|
type: "single",
|
|
752
752
|
value: i !== void 0 ? i ? "item" : "" : void 0,
|
|
753
|
-
onValueChange:
|
|
753
|
+
onValueChange: s ? (l) => s(l === "item") : void 0,
|
|
754
754
|
children: /* @__PURE__ */ t(ee, { className: "group/collapsible border-none", value: "item", children: r })
|
|
755
755
|
}
|
|
756
756
|
) });
|
|
757
757
|
}
|
|
758
758
|
Ve.displayName = "SidebarMenuCollapsible";
|
|
759
|
-
const Ye =
|
|
759
|
+
const Ye = d.forwardRef(({ children: e, className: a, ...r }, o) => /* @__PURE__ */ t(te.Trigger, { asChild: !0, children: /* @__PURE__ */ x(
|
|
760
760
|
_,
|
|
761
761
|
{
|
|
762
762
|
ref: o,
|
|
@@ -777,7 +777,7 @@ const Ye = s.forwardRef(({ children: e, className: a, ...r }, o) => /* @__PURE__
|
|
|
777
777
|
}
|
|
778
778
|
) }));
|
|
779
779
|
Ye.displayName = "SidebarMenuCollapsibleTrigger";
|
|
780
|
-
const Ze =
|
|
780
|
+
const Ze = d.forwardRef(({ dataHook: e, children: a, ...r }, o) => /* @__PURE__ */ t(ae, { className: "p-0", children: /* @__PURE__ */ t(L, { ref: o, dataHook: e, ...r, children: a }) }));
|
|
781
781
|
Ze.displayName = "SidebarMenuCollapsibleContent";
|
|
782
782
|
function Je({
|
|
783
783
|
dataHook: e,
|
|
@@ -785,7 +785,7 @@ function Je({
|
|
|
785
785
|
description: r = "Main navigation menu",
|
|
786
786
|
trackingEl: o,
|
|
787
787
|
trackingLabel: i,
|
|
788
|
-
children:
|
|
788
|
+
children: s,
|
|
789
789
|
className: l,
|
|
790
790
|
...c
|
|
791
791
|
}) {
|
|
@@ -812,7 +812,7 @@ function Je({
|
|
|
812
812
|
children: [
|
|
813
813
|
/* @__PURE__ */ t(Z, { className: "sr-only", children: a }),
|
|
814
814
|
/* @__PURE__ */ t(J, { className: "sr-only", children: r }),
|
|
815
|
-
/* @__PURE__ */ t("div", { className: "flex h-full flex-col p-6", children:
|
|
815
|
+
/* @__PURE__ */ t("div", { className: "flex h-full flex-col p-6", children: s })
|
|
816
816
|
]
|
|
817
817
|
}
|
|
818
818
|
)
|