@brightlocal/ui-components 2.20.0 → 2.22.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/AI_USAGE.md +2 -0
- package/README.md +26 -13
- package/component-meta.json +41 -14
- package/dist/blocks/data-table.cjs +1 -1
- package/dist/blocks/data-table.d.ts +35 -3
- package/dist/blocks/data-table.d.ts.map +1 -1
- package/dist/blocks/data-table.js +178 -154
- package/dist/blocks/sidebar.cjs +1 -1
- package/dist/blocks/sidebar.d.ts +2 -2
- package/dist/blocks/sidebar.js +18 -18
- package/dist/breadcrumb.cjs +1 -1
- package/dist/breadcrumb.d.ts +1 -1
- package/dist/breadcrumb.d.ts.map +1 -1
- package/dist/breadcrumb.js +9 -6
- package/dist/button.cjs +1 -1
- package/dist/button.d.ts.map +1 -1
- package/dist/button.js +12 -12
- package/dist/hover-card.cjs +1 -1
- package/dist/hover-card.d.ts.map +1 -1
- package/dist/hover-card.js +45 -45
- package/dist/index.cjs +1 -1
- package/dist/index.js +69 -68
- package/dist/lib/utils.cjs +1 -1
- package/dist/lib/utils.d.ts +1 -0
- package/dist/lib/utils.d.ts.map +1 -1
- package/dist/lib/utils.js +7 -5
- package/dist/logo.cjs +1 -1
- package/dist/logo.d.ts +1 -1
- package/dist/logo.js +2 -2
- package/dist/navigation-menu.cjs +1 -1
- package/dist/navigation-menu.d.ts +17 -0
- package/dist/navigation-menu.d.ts.map +1 -1
- package/dist/navigation-menu.js +120 -90
- package/dist/pagination.cjs +1 -1
- package/dist/pagination.d.ts +12 -8
- package/dist/pagination.d.ts.map +1 -1
- package/dist/pagination.js +117 -113
- package/dist/progress.cjs +1 -1
- package/dist/progress.d.ts +28 -2
- package/dist/progress.d.ts.map +1 -1
- package/dist/progress.js +90 -49
- package/dist/skeleton.cjs +1 -1
- package/dist/skeleton.js +1 -1
- package/dist/sonner.d.ts +1 -1
- package/dist/table.cjs +1 -1
- package/dist/table.d.ts +22 -2
- package/dist/table.d.ts.map +1 -1
- package/dist/table.js +57 -43
- package/dist/tooltip.cjs +1 -1
- package/dist/tooltip.d.ts.map +1 -1
- package/dist/tooltip.js +36 -36
- package/package.json +7 -3
- package/src/blocks/data-table.tsx +56 -4
- package/src/blocks/sidebar.tsx +5 -5
- package/src/components/breadcrumb.tsx +6 -3
- package/src/components/button.tsx +7 -1
- package/src/components/hover-card.tsx +6 -3
- package/src/components/logo.tsx +3 -3
- package/src/components/navigation-menu.tsx +113 -32
- package/src/components/pagination.tsx +47 -67
- package/src/components/progress.tsx +118 -14
- package/src/components/skeleton.tsx +1 -1
- package/src/components/sonner.tsx +1 -1
- package/src/components/table.tsx +44 -7
- package/src/components/tooltip.tsx +8 -5
- package/src/lib/utils.ts +3 -0
package/dist/blocks/sidebar.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),_e=require("react"),Pe=require("react-dom"),y=require("@radix-ui/react-slot"),T=require("class-variance-authority"),g=require("@brightlocal/icons"),l=require("@brightlocal/ui-components/lib/utils"),U=require("../button.cjs"),Te=require("../input.cjs"),z=require("../separator.cjs"),N=require("../dropdown-menu.cjs"),_=require("../popover.cjs"),R=require("../sheet.cjs"),P=require("../accordion.cjs"),ze=require("@radix-ui/react-accordion"),Be=require("../scroll-area.cjs"),G=require("../skeleton.cjs"),I=require("../tooltip.cjs"),Le=require("../hooks/use-breakpoint.cjs");function K(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=K(_e),qe=K(ze),S="focus-visible:[box-shadow:0_0_0_1px_color-mix(in_srgb,var(--color-sidebar-ring)_50%,transparent),0_0_0_3px_rgba(0,0,0,0.1)]";var V=(e=>(e.LEFT="left",e))(V||{}),$=(e=>(e.SIDEBAR="sidebar",e))($||{}),W=(e=>(e.OFFCANVAS="offcanvas",e.ICON="icon",e.NONE="none",e))(W||{}),X=(e=>(e.DEFAULT="default",e.SM="sm",e.XS="xs",e))(X||{}),Y=(e=>(e.DEFAULT="default",e.COLLAPSIBLE="collapsible",e.ACTION="action",e))(Y||{}),Z=(e=>(e.SIMPLE="simple",e.COLLAPSIBLE="collapsible",e.DROPDOWN="dropdown",e.BADGE="badge",e.BIG_ICON="bigIcon",e.CHECKBOX="checkbox",e))(Z||{}),J=(e=>(e.DEFAULT="default",e.SM="sm",e.LG="lg",e))(J||{}),Q=(e=>(e.DEFAULT="default",e.BORDER="border",e.INDENT="indent",e))(Q||{}),ee=(e=>(e.SM="sm",e.MD="md",e))(ee||{}),ae=(e=>(e.CARET="caret",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.UP_DOWN="upDown",e.PLUS_MINUS="plusMinus",e.DOTS="dots",e))(ae||{});const He="sidebar:state",Fe=3600*24*7,Ge="224px",Ue="336px",Ke="48px",Ve="b",te=i.createContext(null);function j(){const e=i.useContext(te);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const re=i.forwardRef(({dataHook:e,trackingEl:r,trackingLabel:t,defaultOpen:o=!0,open:s,onOpenChange:n,className:d,style:c,children:f,...m},p)=>{const b=Le.useIsBelowBreakpoint("lg"),[u,h]=i.useState(!1),[x,O]=i.useState(null),[E,Oe]=i.useState(o),k=s??E,C=i.useCallback(v=>{const w=typeof v=="function"?v(k):v;n?n(w):Oe(w),document.cookie=`${He}=${w}; path=/; max-age=${Fe}`},[n,k]),M=i.useCallback(()=>b?h(v=>!v):C(v=>!v),[b,C,h]);i.useEffect(()=>{const v=w=>{w.key===Ve&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),M())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[M]);const F=k?"expanded":"collapsed",Ee=i.useMemo(()=>({state:F,open:k,setOpen:C,isMobile:b,openMobile:u,setOpenMobile:h,toggleSidebar:M,footerPortalEl:x,setFooterPortalEl:O}),[F,k,C,b,u,h,M,x]);return a.jsx(te.Provider,{value:Ee,children:a.jsx(I.TooltipProvider,{delayDuration:0,children:a.jsx("div",{ref:p,className:l.cn("group/sidebar-wrapper flex min-h-svh w-full",d),"data-hook":e,"data-slot":"sidebar-provider","data-tracking-el":r||"sidebar-provider","data-tracking-label":t,style:{"--sidebar-width":Ge,"--sidebar-width-icon":Ke,...c},...m,children:f})})})});re.displayName="SidebarProvider";const oe=i.forwardRef(({dataHook:e,trackingEl:r,trackingLabel:t,side:o="left",variant:s="sidebar",collapsible:n="offcanvas",embedded:d,mobileTitle:c,mobileDescription:f,className:m,children:p,...b},u)=>{const{isMobile:h,state:x,openMobile:O,setOpenMobile:E}=j();return n==="none"?a.jsx("div",{ref:u,className:l.cn("text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",m),"data-hook":e,"data-slot":"sidebar","data-tracking-el":r||"sidebar","data-tracking-label":t,...b,children:p}):h?a.jsx(R.Sheet,{open:O,onOpenChange:E,children:a.jsxs(R.SheetContent,{className:"bg-sidebar-background text-sidebar-foreground w-(--sidebar-width) p-6","data-hook":`${e}-mobile-content`,"data-mobile":"true","data-sidebar":"sidebar",side:"left",style:{"--sidebar-width":`min(${Ue}, calc(100vw - 40px))`},children:[a.jsx(R.SheetTitle,{className:"sr-only",children:c??"Navigation"}),a.jsx(R.SheetDescription,{className:"sr-only",children:f??"Main navigation menu"}),a.jsx("div",{className:"flex h-full w-full flex-col",children:p})]})}):a.jsx("div",{ref:u,className:l.cn("group text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",x==="expanded"&&"w-(--sidebar-width)",n==="icon"&&x==="collapsed"&&"w-(--sidebar-width-icon)",n==="offcanvas"&&x==="collapsed"&&"w-0",m),"data-collapsible":x==="collapsed"?n:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":x,"data-tracking-el":r||"sidebar","data-tracking-label":t,"data-variant":s,...b,children:p})});oe.displayName="Sidebar";const B=i.forwardRef(({className:e,onClick:r,dataHook:t="sidebar-trigger",toggleAriaLabel:o,children:s,...n},d)=>{const{toggleSidebar:c}=j(),f=o??"Toggle Sidebar";return a.jsxs(U.Button,{ref:d,iconOnly:!0,"aria-label":f,className:l.cn("h-7 w-7",e),"data-slot":"sidebar-trigger",dataHook:t,size:"sm",variant:"ghost",onClick:m=>{r?.(m),c()},...n,children:[s||a.jsx(g.PanelLeft,{}),a.jsx("span",{className:"sr-only",children:f})]})});B.displayName="SidebarTrigger";const se=i.forwardRef(({className:e,toggleAriaLabel:r,...t},o)=>{const{toggleSidebar:s}=j(),n=r??"Toggle Sidebar";return a.jsx("button",{ref:o,"aria-label":n,className:l.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-0.5 sm:flex","cursor-w-resize","in-data-[state=collapsed]:cursor-e-resize","group-data-[collapsible=offcanvas]:hover:bg-sidebar-background group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","in-data-[collapsible=offcanvas]:-right-2",e),"data-slot":"sidebar-rail",tabIndex:-1,title:n,onClick:s,...t})});se.displayName="SidebarRail";const ne=i.forwardRef(({className:e,dataHook:r,trackingEl:t,trackingLabel:o,...s},n)=>a.jsx("main",{ref:n,className:l.cn("bg-background relative flex min-h-svh flex-1 flex-col",e),"data-hook":r,"data-slot":"sidebar-inset","data-tracking-el":t||"sidebar-inset","data-tracking-label":o,...s}));ne.displayName="SidebarInset";const ie=i.forwardRef(({className:e,...r},t)=>a.jsx(Te.Input,{ref:t,className:l.cn("bg-background h-8 w-full shadow-none",S,e),"data-slot":"sidebar-input",dataHook:"sidebar-input",...r}));ie.displayName="SidebarInput";const de=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("header",{ref:o,className:l.cn("pr-section-xs flex shrink-0 flex-col gap-2 pt-2 pb-9 pl-8",e),"data-hook":r,"data-slot":"sidebar-header",...t}));de.displayName="SidebarHeader";const le=i.forwardRef(({className:e,dataHook:r,separator:t=!0,...o},s)=>{const{footerPortalEl:n}=j(),d=a.jsxs(a.Fragment,{children:[t&&a.jsx(z.Separator,{className:"group-data-[collapsible=icon]:mx-0","data-slot":"sidebar-footer-separator",spacing:"md"}),a.jsx("footer",{ref:s,className:l.cn("flex shrink-0 flex-col gap-1 p-1",e),"data-hook":r,"data-slot":"sidebar-footer",...o})]});return n?Pe.createPortal(d,n):d});le.displayName="SidebarFooter";const ce=i.forwardRef(({className:e,...r},t)=>a.jsx(z.Separator,{ref:t,className:l.cn("bg-sidebar-border mx-2 my-5 w-auto group-data-[collapsible=icon]:mx-0",e),"data-slot":"sidebar-separator",...r}));ce.displayName="SidebarSeparator";const ue=i.forwardRef(({className:e,dataHook:r,ariaLabel:t="Sidebar",children:o,...s},n)=>{const{isMobile:d,setFooterPortalEl:c}=j(),f=i.useRef(null),[m,p]=i.useState(!1),b=i.useCallback(u=>{const h=u?.querySelector('[data-slot="scroll-area-viewport"]');f.current=h??null,h&&(h.tabIndex=-1),typeof n=="function"?n(u):n&&(n.current=u)},[n]);return i.useEffect(()=>{const u=f.current;if(!u)return;const h=()=>p(u.scrollHeight>u.clientHeight),x=new ResizeObserver(h);return x.observe(u),u.firstElementChild&&x.observe(u.firstElementChild),()=>x.disconnect()},[]),a.jsxs(Be.ScrollArea,{ref:b,className:l.cn("min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden **:data-[slot=scroll-area-scrollbar]:w-1.5 **:data-[slot=scroll-area-scrollbar]:border-l-0 **:data-[slot=scroll-area-scrollbar]:p-0 [&_[data-slot=scroll-area-viewport]>div]:flex! [&_[data-slot=scroll-area-viewport]>div]:min-h-full [&_[data-slot=scroll-area-viewport]>div]:flex-col",e),dataHook:r??"sidebar-content-scroll",scrollOrientation:d?"both":"vertical",...s,children:[a.jsx("nav",{"aria-label":t,className:l.cn("flex flex-col gap-2",m&&"pr-2"),"data-slot":"sidebar-content",children:o}),a.jsx("div",{ref:c,className:"mt-auto"})]})});ue.displayName="SidebarContent";const be=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("div",{ref:o,className:l.cn("relative flex w-full min-w-0 flex-col p-2",e),"data-hook":r,"data-slot":"sidebar-group",...t}));be.displayName="SidebarGroup";const $e=T.cva(["flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none transition-[margin,opacity] duration-200 ease-linear [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",S],{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"}}),pe=i.forwardRef(({className:e,dataHook:r,asChild:t=!1,size:o="sm",variant:s="default",isOpen:n=!1,onToggle:d,onAction:c,children:f,...m},p)=>{const b=t?y.Slot:"div",u=()=>{s==="collapsible"&&d?d():s==="action"&&c&&c()},h=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),u())};return a.jsxs(b,{ref:p,className:l.cn($e({size:o,variant:s}),e),"data-hook":r,"data-slot":"sidebar-group-label","data-variant":s,role:s!=="default"?"button":void 0,tabIndex:s!=="default"?0:void 0,onClick:s!=="default"?u:void 0,onKeyDown:s!=="default"?h:void 0,...m,children:[a.jsx("span",{children:f}),s==="collapsible"&&a.jsx(g.ChevronDown,{className:l.cn("shrink-0 transition-transform duration-200",n&&"rotate-180"),size:16}),s==="action"&&a.jsx(g.Plus,{className:"shrink-0",size:16})]})});pe.displayName="SidebarGroupLabel";const fe=i.forwardRef(({className:e,asChild:r=!1,...t},o)=>{const s=r?y.Slot:"button";return a.jsx(s,{ref:o,className:l.cn("text-sidebar-foreground 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 [&>svg]:shrink-0",S,"after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-group-action",...t})});fe.displayName="SidebarGroupAction";const me=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("div",{ref:o,className:l.cn("w-full text-sm",e),"data-hook":r,"data-slot":"sidebar-group-content",...t}));me.displayName="SidebarGroupContent";const xe=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("ul",{ref:o,className:l.cn("flex w-full min-w-0 flex-col gap-1",e),"data-hook":r,"data-slot":"sidebar-menu",...t}));xe.displayName="SidebarMenu";const L=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("li",{ref:o,className:l.cn("group/menu-item relative",e),"data-hook":r,"data-slot":"sidebar-menu-item",...t}));L.displayName="SidebarMenuItem";const he=i.forwardRef(({type:e="caret",isActive:r=!1,className:t,...o},s)=>{const n={ref:s,className:l.cn("shrink-0 transition-transform",r&&e==="caret"&&"rotate-90",t),"data-slot":"sidebar-collapse-icon",...o};switch(e){case"horizontal":return a.jsx(g.ChevronRight,{...n});case"vertical":return a.jsx(g.ChevronDown,{...n});case"upDown":return a.jsx(g.ChevronsUpDown,{...n});case"plusMinus":return r?a.jsx(g.Minus,{...n}):a.jsx(g.Plus,{...n});case"dots":return a.jsx(g.Ellipsis,{...n});default:return a.jsx(g.ChevronRight,{...n})}});he.displayName="SidebarCollapseIcon";const We=T.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 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 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-of-type]: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",S],{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",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-background [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar-background 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:"px-3 [&>[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=i.forwardRef(({asChild:e=!1,isActive:r=!1,variant:t="simple",size:o="default",tooltip:s,className:n,dataHook:d,...c},f)=>{const m=e?y.Slot:"button",{isMobile:p,state:b}=j(),u=a.jsx(m,{ref:f,className:l.cn(We({variant:t,size:o}),n),"data-active":r,"data-hook":d,"data-size":o,"data-slot":"sidebar-menu-button","data-variant":t,...c});return s?(typeof s=="string"&&(s={children:s,dataHook:"sidebar-menu-button-tooltip"}),a.jsxs(I.Tooltip,{children:[a.jsx(I.TooltipTrigger,{asChild:!0,children:u}),a.jsx(I.TooltipContent,{hideArrow:!0,...s,align:"center",className:l.cn("bg-foreground text-background border-none",s.className),hidden:b!=="collapsed"||p,side:"right",sideOffset:8})]})):u});A.displayName="SidebarMenuButton";const ge=i.forwardRef(({className:e,asChild:r=!1,showOnHover:t=!1,...o},s)=>{const n=r?y.Slot:"button";return a.jsx(n,{ref:s,className:l.cn("text-sidebar-foreground 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 [&>svg]:shrink-0",S,"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","group-data-[collapsible=icon]:hidden",t&&"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})});ge.displayName="SidebarMenuAction";const ve=i.forwardRef(({className:e,...r},t)=>a.jsx("div",{ref:t,className:l.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",...r}));ve.displayName="SidebarMenuBadge";const Se=i.forwardRef(({className:e,showIcon:r=!1,...t},o)=>{const s=i.useId(),n=i.useMemo(()=>{let d=0;for(let c=0;c<s.length;c++)d=(d<<5)-d+s.charCodeAt(c),d|=0;return`${Math.abs(d)%40+50}%`},[s]);return a.jsxs("div",{ref:o,className:l.cn("flex h-8 items-center gap-2 rounded-md px-2",e),"data-slot":"sidebar-menu-skeleton",...t,children:[r&&a.jsx(G.Skeleton,{className:"size-4 rounded-md","data-slot":"sidebar-menu-skeleton-icon"}),a.jsx(G.Skeleton,{className:"h-4 max-w-[--skeleton-width] flex-1","data-slot":"sidebar-menu-skeleton-text",style:{"--skeleton-width":n}})]})});Se.displayName="SidebarMenuSkeleton";const Xe=T.cva("flex min-w-0 flex-col items-start gap-1 py-1 group-data-[collapsible=icon]:hidden",{variants:{variant:{default:"px-10",border:"border-l border-sidebar-border ml-10 pl-1 pr-10",indent:"px-10"}},defaultVariants:{variant:"border"}}),q=i.forwardRef(({className:e,variant:r="border",dataHook:t,...o},s)=>a.jsx("ul",{ref:s,className:l.cn(Xe({variant:r}),e),"data-hook":t,"data-slot":"sidebar-menu-sub",...o}));q.displayName="SidebarMenuSub";const we=i.forwardRef(({dataHook:e,...r},t)=>a.jsx("li",{ref:t,"data-hook":e,"data-slot":"sidebar-menu-sub-item",...r}));we.displayName="SidebarMenuSubItem";const je=i.forwardRef(({asChild:e=!1,size:r="md",isActive:t,className:o,dataHook:s,...n},d)=>{const c=e?y.Slot:"a";return a.jsx(c,{ref:d,className:l.cn("text-sidebar-foreground 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 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-of-type]:truncate [&>svg]:shrink-0",S,"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",r==="sm"&&"text-xs",r==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),"data-active":t,"data-hook":s,"data-size":r,"data-slot":"sidebar-menu-sub-button",...n})});je.displayName="SidebarMenuSubButton";function Ne({dataHook:e,className:r,children:t,defaultOpen:o,open:s,onOpenChange:n}){return a.jsx(L,{children:a.jsx(P.Accordion,{collapsible:!0,className:r,dataHook:e??"sidebar-menu-collapsible",defaultValue:o?"item":void 0,type:"single",value:s!==void 0?s?"item":"":void 0,onValueChange:n?d=>n(d==="item"):void 0,children:a.jsx(P.AccordionItem,{className:"group/collapsible border-none",value:"item",children:t})})})}Ne.displayName="SidebarMenuCollapsible";const ke=i.forwardRef(({children:e,className:r,...t},o)=>a.jsx(qe.Trigger,{asChild:!0,children:a.jsxs(A,{ref:o,className:r,variant:"collapsible",...t,children:[e,a.jsx(g.ChevronRight,{"data-collapse-icon":!0,className:"opacity-100! transition-transform duration-200 ease-out group-data-[collapsible=icon]:hidden",size:12})]})}));ke.displayName="SidebarMenuCollapsibleTrigger";const ye=i.forwardRef(({dataHook:e,children:r,...t},o)=>a.jsx(P.AccordionContent,{className:"p-0",children:a.jsx(q,{ref:o,dataHook:e,...t,children:r})}));ye.displayName="SidebarMenuCollapsibleContent";const Ce=i.forwardRef(({className:e,dataHook:r="sidebar-drawer",trackingEl:t,trackingLabel:o,children:s,...n},d)=>a.jsx("div",{ref:d,className:e,"data-hook":r,"data-slot":"sidebar-drawer","data-tracking-el":t,"data-tracking-label":o,...n,children:a.jsx(B,{dataHook:`${r}-trigger`,children:a.jsx(g.Menu,{size:24})})}));Ce.displayName="SidebarDrawer";const Me=i.forwardRef(({className:e,dataHook:r="sidebar-header-button",children:t,...o},s)=>a.jsx(U.Button,{ref:s,...o,iconOnly:!0,className:l.cn("hover:bg-sidebar-accent hover:text-sidebar-accent-foreground size-7 rounded-md shadow-none",S,e),"data-slot":"sidebar-header-button",dataHook:r,size:"sm",variant:"ghost",children:t}));Me.displayName="SidebarHeaderButton";const H=i.forwardRef(({className:e,dataHook:r="sidebar-popover-trigger",icon:t,triggerAriaLabel:o,children:s,...n},d)=>a.jsxs("button",{ref:d,"aria-label":o??"Switch workspace",className:l.cn("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex items-center gap-2 rounded-md px-1.5 py-2 text-sm font-semibold transition-colors duration-200 ease-out outline-none",S,e),"data-hook":r,"data-slot":"sidebar-popover-trigger",type:"button",...n,children:[t&&a.jsx("span",{className:"bg-sidebar-primary text-sidebar-primary-foreground flex size-5 shrink-0 items-center justify-center rounded-md",children:t}),a.jsx("span",{className:"truncate",children:s}),a.jsx(g.ChevronDown,{className:"shrink-0 opacity-50",size:16})]}));H.displayName="SidebarPopoverTrigger";const D=i.forwardRef(({className:e,dataHook:r,icon:t,shortcut:o,children:s,...n},d)=>a.jsxs("button",{ref:d,className:l.cn("text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground flex h-10 w-full items-center gap-2 rounded-xs p-2 text-sm transition-colors duration-150 ease-in-out outline-none",S,e),"data-hook":r,"data-slot":"sidebar-popover-menu-item",type:"button",...n,children:[t&&a.jsx("span",{className:"border-border flex size-6 shrink-0 items-center justify-center rounded-xs border [&_svg]:size-4",children:t}),a.jsx("span",{className:"min-w-px flex-1 truncate text-left",children:s}),o&&a.jsx("span",{className:"text-popover-foreground/60 shrink-0 text-xs",children:o})]}));D.displayName="SidebarPopoverMenuItem";const Re=i.forwardRef(({className:e,dataHook:r="sidebar-popover-menu",groupTitle:t="Teams",items:o,addActionLabel:s,addActionIcon:n,onAddAction:d,children:c,...f},m)=>a.jsx("div",{ref:m,className:l.cn("flex flex-col",e),"data-hook":r,"data-slot":"sidebar-popover-menu",...f,children:c||a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col items-start p-1",children:[t&&a.jsx("div",{className:"flex w-full items-center px-2 py-1.5",children:a.jsx("span",{className:"text-muted-foreground flex-1 text-xs font-medium",children:t})}),o?.map((p,b)=>a.jsx(D,{icon:p.icon,shortcut:p.shortcut,onClick:p.onClick,children:p.label},b))]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(z.Separator,{}),a.jsx("div",{className:"flex flex-col items-start p-1",children:a.jsx(D,{icon:n||a.jsx(g.Plus,{size:16}),onClick:d,children:s??"Add team"})})]})]})}));Re.displayName="SidebarPopoverMenu";function Ie({dataHook:e="sidebar-switcher",icon:r,label:t,triggerAriaLabel:o,triggerClassName:s,children:n}){return a.jsxs(_.Popover,{children:[a.jsx(_.PopoverTrigger,{asChild:!0,children:a.jsx(H,{className:s,dataHook:`${e}-trigger`,icon:r,triggerAriaLabel:o,children:t})}),a.jsx(_.PopoverContent,{align:"start",className:"w-[316px] p-0",dataHook:`${e}-content`,side:"bottom",sideOffset:4,children:n})]})}Ie.displayName="SidebarSwitcher";function De({dataHook:e="sidebar-account-dropdown",name:r,email:t,avatar:o,menuGroups:s,triggerAriaLabel:n,align:d="end",side:c="top",children:f}){return a.jsxs(N.DropdownMenu,{children:[a.jsx(N.DropdownMenuTrigger,{asChild:!0,children:a.jsxs(A,{"aria-label":n??"Account menu",className:"h-auto py-1.5",dataHook:`${e}-button`,size:"lg",children:[o,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 leading-none",children:[a.jsx("span",{className:"truncate text-sm font-semibold",children:r}),a.jsx("span",{className:"truncate text-xs font-normal",children:t})]})]})}),a.jsx(N.DropdownMenuContent,{align:d,className:"w-56",dataHook:`${e}-content`,side:c,sideOffset:4,children:f||a.jsxs(a.Fragment,{children:[a.jsxs(N.DropdownMenuLabel,{className:"flex items-center gap-2 px-1 py-1.5",children:[o,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 leading-none",children:[a.jsx("span",{className:"truncate text-sm font-semibold",children:r}),a.jsx("span",{className:"truncate text-xs font-normal",children:t})]})]}),s?.map((m,p)=>a.jsxs(i.Fragment,{children:[a.jsx(N.DropdownMenuSeparator,{}),m.map((b,u)=>a.jsxs(N.DropdownMenuItem,{onClick:b.onClick,children:[b.icon,b.label]},u))]},p))]})})]})}De.displayName="SidebarAccountDropdown";const Ae=i.forwardRef(({className:e,dataHook:r,senderName:t,title:o,description:s,timestamp:n,...d},c)=>a.jsxs("button",{ref:c,className:l.cn("border-sidebar-border text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent flex w-full flex-col gap-2 border-b p-4 text-left transition-colors duration-150 ease-in-out outline-none",S,e),"data-hook":r,"data-slot":"sidebar-inbox-item",type:"button",...d,children:[a.jsxs("div",{className:"flex w-full items-center justify-between text-sm",children:[a.jsx("span",{children:t}),n&&a.jsx("span",{children:n})]}),a.jsx("p",{className:"w-full text-sm font-medium",children:o}),s&&a.jsx("p",{className:"w-full truncate text-xs",children:s})]}));Ae.displayName="SidebarInboxItem";exports.Sidebar=oe;exports.SidebarAccountDropdown=De;exports.SidebarCollapseIcon=he;exports.SidebarCollapseIconType=ae;exports.SidebarCollapsible=W;exports.SidebarContent=ue;exports.SidebarDrawer=Ce;exports.SidebarFooter=le;exports.SidebarGroup=be;exports.SidebarGroupAction=fe;exports.SidebarGroupContent=me;exports.SidebarGroupLabel=pe;exports.SidebarGroupLabelSize=X;exports.SidebarGroupLabelVariant=Y;exports.SidebarHeader=de;exports.SidebarHeaderButton=Me;exports.SidebarInboxItem=Ae;exports.SidebarInput=ie;exports.SidebarInset=ne;exports.SidebarMenu=xe;exports.SidebarMenuAction=ge;exports.SidebarMenuBadge=ve;exports.SidebarMenuButton=A;exports.SidebarMenuButtonSize=J;exports.SidebarMenuButtonVariant=Z;exports.SidebarMenuCollapsible=Ne;exports.SidebarMenuCollapsibleContent=ye;exports.SidebarMenuCollapsibleTrigger=ke;exports.SidebarMenuItem=L;exports.SidebarMenuSkeleton=Se;exports.SidebarMenuSub=q;exports.SidebarMenuSubButton=je;exports.SidebarMenuSubButtonSize=ee;exports.SidebarMenuSubItem=we;exports.SidebarMenuSubVariant=Q;exports.SidebarPopoverMenu=Re;exports.SidebarPopoverMenuItem=D;exports.SidebarPopoverTrigger=H;exports.SidebarProvider=re;exports.SidebarRail=se;exports.SidebarSeparator=ce;exports.SidebarSide=V;exports.SidebarSwitcher=Ie;exports.SidebarTrigger=B;exports.SidebarVariant=$;exports.useSidebar=j;
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),_e=require("react"),Pe=require("react-dom"),y=require("@radix-ui/react-slot"),T=require("class-variance-authority"),g=require("@brightlocal/icons"),l=require("@brightlocal/ui-components/lib/utils"),U=require("../button.cjs"),Te=require("../input.cjs"),z=require("../separator.cjs"),N=require("../dropdown-menu.cjs"),_=require("../popover.cjs"),R=require("../sheet.cjs"),P=require("../accordion.cjs"),ze=require("@radix-ui/react-accordion"),Be=require("../scroll-area.cjs"),G=require("../skeleton.cjs"),I=require("../tooltip.cjs"),Le=require("../hooks/use-breakpoint.cjs");function K(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const i=K(_e),qe=K(ze),S="focus-visible:[box-shadow:0_0_0_1px_color-mix(in_srgb,var(--color-sidebar-ring)_50%,transparent),0_0_0_3px_rgba(0,0,0,0.1)]";var V=(e=>(e.LEFT="left",e))(V||{}),$=(e=>(e.SIDEBAR="sidebar",e))($||{}),W=(e=>(e.OFFCANVAS="offcanvas",e.ICON="icon",e.NONE="none",e))(W||{}),X=(e=>(e.DEFAULT="default",e.SM="sm",e.XS="xs",e))(X||{}),Y=(e=>(e.DEFAULT="default",e.COLLAPSIBLE="collapsible",e.ACTION="action",e))(Y||{}),Z=(e=>(e.SIMPLE="simple",e.COLLAPSIBLE="collapsible",e.DROPDOWN="dropdown",e.BADGE="badge",e.BIG_ICON="bigIcon",e.CHECKBOX="checkbox",e))(Z||{}),J=(e=>(e.DEFAULT="default",e.SM="sm",e.LG="lg",e))(J||{}),Q=(e=>(e.DEFAULT="default",e.BORDER="border",e.INDENT="indent",e))(Q||{}),ee=(e=>(e.SM="sm",e.MD="md",e))(ee||{}),ae=(e=>(e.CARET="caret",e.HORIZONTAL="horizontal",e.VERTICAL="vertical",e.UP_DOWN="upDown",e.PLUS_MINUS="plusMinus",e.DOTS="dots",e))(ae||{});const He="sidebar:state",Fe=3600*24*7,Ge="224px",Ue="336px",Ke="48px",Ve="b",te=i.createContext(null);function j(){const e=i.useContext(te);if(!e)throw new Error("useSidebar must be used within a SidebarProvider.");return e}const re=i.forwardRef(({dataHook:e,trackingEl:r,trackingLabel:t,defaultOpen:o=!0,open:s,onOpenChange:n,className:d,style:c,children:f,...m},p)=>{const b=Le.useIsBelowBreakpoint("lg"),[u,h]=i.useState(!1),[x,O]=i.useState(null),[E,Oe]=i.useState(o),k=s??E,C=i.useCallback(v=>{const w=typeof v=="function"?v(k):v;n?n(w):Oe(w),document.cookie=`${He}=${w}; path=/; max-age=${Fe}`},[n,k]),M=i.useCallback(()=>b?h(v=>!v):C(v=>!v),[b,C,h]);i.useEffect(()=>{const v=w=>{w.key===Ve&&(w.metaKey||w.ctrlKey)&&(w.preventDefault(),M())};return window.addEventListener("keydown",v),()=>window.removeEventListener("keydown",v)},[M]);const F=k?"expanded":"collapsed",Ee=i.useMemo(()=>({state:F,open:k,setOpen:C,isMobile:b,openMobile:u,setOpenMobile:h,toggleSidebar:M,footerPortalEl:x,setFooterPortalEl:O}),[F,k,C,b,u,h,M,x]);return a.jsx(te.Provider,{value:Ee,children:a.jsx(I.TooltipProvider,{delayDuration:0,children:a.jsx("div",{ref:p,className:l.cn("group/sidebar-wrapper flex min-h-svh w-full",d),"data-hook":e,"data-slot":"sidebar-provider","data-tracking-el":r||"sidebar-provider","data-tracking-label":t,style:{"--sidebar-width":Ge,"--sidebar-width-icon":Ke,...c},...m,children:f})})})});re.displayName="SidebarProvider";const oe=i.forwardRef(({dataHook:e,trackingEl:r,trackingLabel:t,side:o="left",variant:s="sidebar",collapsible:n="offcanvas",embedded:d,mobileTitle:c,mobileDescription:f,className:m,children:p,...b},u)=>{const{isMobile:h,state:x,openMobile:O,setOpenMobile:E}=j();return n==="none"?a.jsx("div",{ref:u,className:l.cn("text-sidebar-foreground flex h-full w-(--sidebar-width) flex-col",m),"data-hook":e,"data-slot":"sidebar","data-tracking-el":r||"sidebar","data-tracking-label":t,...b,children:p}):h?a.jsx(R.Sheet,{open:O,onOpenChange:E,children:a.jsxs(R.SheetContent,{className:"bg-sidebar-background text-sidebar-foreground w-(--sidebar-width) p-6","data-hook":`${e}-mobile-content`,"data-mobile":"true","data-sidebar":"sidebar",side:"left",style:{"--sidebar-width":`min(${Ue}, calc(100vw - 40px))`},children:[a.jsx(R.SheetTitle,{className:"sr-only",children:c??"Navigation"}),a.jsx(R.SheetDescription,{className:"sr-only",children:f??"Main navigation menu"}),a.jsx("div",{className:"flex h-full w-full flex-col",children:p})]})}):a.jsx("div",{ref:u,className:l.cn("group text-sidebar-foreground flex h-full shrink-0 flex-col overflow-hidden transition-[width] duration-200 ease-linear",x==="expanded"&&"w-(--sidebar-width)",n==="icon"&&x==="collapsed"&&"w-(--sidebar-width-icon)",n==="offcanvas"&&x==="collapsed"&&"w-0",m),"data-collapsible":x==="collapsed"?n:"","data-hook":e,"data-side":o,"data-slot":"sidebar","data-state":x,"data-tracking-el":r||"sidebar","data-tracking-label":t,"data-variant":s,...b,children:p})});oe.displayName="Sidebar";const B=i.forwardRef(({className:e,onClick:r,dataHook:t="sidebar-trigger",toggleAriaLabel:o,children:s,...n},d)=>{const{toggleSidebar:c}=j(),f=o??"Toggle sidebar";return a.jsxs(U.Button,{ref:d,iconOnly:!0,"aria-label":f,className:l.cn("relative h-7 w-7",e),"data-slot":"sidebar-trigger",dataHook:t,size:"sm",variant:"ghost",onClick:m=>{r?.(m),c()},...n,children:[s||a.jsx(g.PanelLeft,{}),a.jsx("span",{className:"sr-only",children:f})]})});B.displayName="SidebarTrigger";const se=i.forwardRef(({className:e,toggleAriaLabel:r,...t},o)=>{const{toggleSidebar:s}=j(),n=r??"Toggle sidebar";return a.jsx("button",{ref:o,"aria-label":n,className:l.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-0.5 sm:flex","cursor-w-resize","in-data-[state=collapsed]:cursor-e-resize","group-data-[collapsible=offcanvas]:hover:bg-sidebar-background group-data-[collapsible=offcanvas]:translate-x-0 group-data-[collapsible=offcanvas]:after:left-full","in-data-[collapsible=offcanvas]:-right-2",e),"data-slot":"sidebar-rail",tabIndex:-1,title:n,onClick:s,...t})});se.displayName="SidebarRail";const ne=i.forwardRef(({className:e,dataHook:r,trackingEl:t,trackingLabel:o,...s},n)=>a.jsx("main",{ref:n,className:l.cn("bg-background relative flex min-h-svh flex-1 flex-col",e),"data-hook":r,"data-slot":"sidebar-inset","data-tracking-el":t||"sidebar-inset","data-tracking-label":o,...s}));ne.displayName="SidebarInset";const ie=i.forwardRef(({className:e,...r},t)=>a.jsx(Te.Input,{ref:t,className:l.cn("bg-background h-8 w-full shadow-none",S,e),"data-slot":"sidebar-input",dataHook:"sidebar-input",...r}));ie.displayName="SidebarInput";const de=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("header",{ref:o,className:l.cn("pr-section-xs flex shrink-0 flex-col gap-2 pt-2 pb-9 pl-8",e),"data-hook":r,"data-slot":"sidebar-header",...t}));de.displayName="SidebarHeader";const le=i.forwardRef(({className:e,dataHook:r,separator:t=!0,...o},s)=>{const{footerPortalEl:n}=j(),d=a.jsxs(a.Fragment,{children:[t&&a.jsx(z.Separator,{className:"group-data-[collapsible=icon]:mx-0","data-slot":"sidebar-footer-separator",spacing:"md"}),a.jsx("footer",{ref:s,className:l.cn("flex shrink-0 flex-col gap-1 p-1",e),"data-hook":r,"data-slot":"sidebar-footer",...o})]});return n?Pe.createPortal(d,n):d});le.displayName="SidebarFooter";const ce=i.forwardRef(({className:e,...r},t)=>a.jsx(z.Separator,{ref:t,className:l.cn("bg-sidebar-border mx-2 my-5 w-auto group-data-[collapsible=icon]:mx-0",e),"data-slot":"sidebar-separator",...r}));ce.displayName="SidebarSeparator";const ue=i.forwardRef(({className:e,dataHook:r,ariaLabel:t="Sidebar",children:o,...s},n)=>{const{isMobile:d,setFooterPortalEl:c}=j(),f=i.useRef(null),[m,p]=i.useState(!1),b=i.useCallback(u=>{const h=u?.querySelector('[data-slot="scroll-area-viewport"]');f.current=h??null,h&&(h.tabIndex=-1),typeof n=="function"?n(u):n&&(n.current=u)},[n]);return i.useEffect(()=>{const u=f.current;if(!u)return;const h=()=>p(u.scrollHeight>u.clientHeight),x=new ResizeObserver(h);return x.observe(u),u.firstElementChild&&x.observe(u.firstElementChild),()=>x.disconnect()},[]),a.jsxs(Be.ScrollArea,{ref:b,className:l.cn("min-h-0 flex-1 group-data-[collapsible=icon]:overflow-hidden **:data-[slot=scroll-area-scrollbar]:w-1.5 **:data-[slot=scroll-area-scrollbar]:border-l-0 **:data-[slot=scroll-area-scrollbar]:p-0 [&_[data-slot=scroll-area-viewport]>div]:flex! [&_[data-slot=scroll-area-viewport]>div]:min-h-full [&_[data-slot=scroll-area-viewport]>div]:flex-col",e),dataHook:r??"sidebar-content-scroll",scrollOrientation:d?"both":"vertical",...s,children:[a.jsx("nav",{"aria-label":t,className:l.cn("flex flex-col gap-2",m&&"pr-2"),"data-slot":"sidebar-content",children:o}),a.jsx("div",{ref:c,className:"mt-auto"})]})});ue.displayName="SidebarContent";const be=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("div",{ref:o,className:l.cn("relative flex w-full min-w-0 flex-col p-2",e),"data-hook":r,"data-slot":"sidebar-group",...t}));be.displayName="SidebarGroup";const $e=T.cva(["flex h-8 shrink-0 items-center rounded-md px-2 font-medium text-sidebar-foreground/70 outline-none transition-[margin,opacity] duration-200 ease-linear [&>svg]:shrink-0 group-data-[collapsible=icon]:-mt-8 group-data-[collapsible=icon]:opacity-0",S],{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"}}),pe=i.forwardRef(({className:e,dataHook:r,asChild:t=!1,size:o="sm",variant:s="default",isOpen:n=!1,onToggle:d,onAction:c,children:f,...m},p)=>{const b=t?y.Slot:"div",u=()=>{s==="collapsible"&&d?d():s==="action"&&c&&c()},h=x=>{(x.key==="Enter"||x.key===" ")&&(x.preventDefault(),u())};return a.jsxs(b,{ref:p,className:l.cn($e({size:o,variant:s}),e),"data-hook":r,"data-slot":"sidebar-group-label","data-variant":s,role:s!=="default"?"button":void 0,tabIndex:s!=="default"?0:void 0,onClick:s!=="default"?u:void 0,onKeyDown:s!=="default"?h:void 0,...m,children:[a.jsx("span",{children:f}),s==="collapsible"&&a.jsx(g.ChevronDown,{className:l.cn("shrink-0 transition-transform duration-200",n&&"rotate-180"),size:16}),s==="action"&&a.jsx(g.Plus,{className:"shrink-0",size:16})]})});pe.displayName="SidebarGroupLabel";const fe=i.forwardRef(({className:e,asChild:r=!1,...t},o)=>{const s=r?y.Slot:"button";return a.jsx(s,{ref:o,className:l.cn("text-sidebar-foreground 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 [&>svg]:shrink-0",S,"after:absolute after:-inset-2 after:md:hidden","group-data-[collapsible=icon]:hidden",e),"data-slot":"sidebar-group-action",...t})});fe.displayName="SidebarGroupAction";const me=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("div",{ref:o,className:l.cn("w-full text-sm",e),"data-hook":r,"data-slot":"sidebar-group-content",...t}));me.displayName="SidebarGroupContent";const xe=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("ul",{ref:o,className:l.cn("flex w-full min-w-0 flex-col gap-1",e),"data-hook":r,"data-slot":"sidebar-menu",...t}));xe.displayName="SidebarMenu";const L=i.forwardRef(({className:e,dataHook:r,...t},o)=>a.jsx("li",{ref:o,className:l.cn("group/menu-item relative",e),"data-hook":r,"data-slot":"sidebar-menu-item",...t}));L.displayName="SidebarMenuItem";const he=i.forwardRef(({type:e="caret",isActive:r=!1,className:t,...o},s)=>{const n={ref:s,className:l.cn("shrink-0 transition-transform",r&&e==="caret"&&"rotate-90",t),"data-slot":"sidebar-collapse-icon",...o};switch(e){case"horizontal":return a.jsx(g.ChevronRight,{...n});case"vertical":return a.jsx(g.ChevronDown,{...n});case"upDown":return a.jsx(g.ChevronsUpDown,{...n});case"plusMinus":return r?a.jsx(g.Minus,{...n}):a.jsx(g.Plus,{...n});case"dots":return a.jsx(g.Ellipsis,{...n});default:return a.jsx(g.ChevronRight,{...n})}});he.displayName="SidebarCollapseIcon";const We=T.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 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 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-of-type]: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",S],{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",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-background [&>svg]:opacity-100 hover:[&>svg]:bg-sidebar-foreground hover:[&>svg]:text-sidebar-background 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:"px-3 [&>[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=i.forwardRef(({asChild:e=!1,isActive:r=!1,variant:t="simple",size:o="default",tooltip:s,className:n,dataHook:d,...c},f)=>{const m=e?y.Slot:"button",{isMobile:p,state:b}=j(),u=a.jsx(m,{ref:f,className:l.cn(We({variant:t,size:o}),n),"data-active":r,"data-hook":d,"data-size":o,"data-slot":"sidebar-menu-button","data-variant":t,...c});return s?(typeof s=="string"&&(s={children:s,dataHook:"sidebar-menu-button-tooltip"}),a.jsxs(I.Tooltip,{children:[a.jsx(I.TooltipTrigger,{asChild:!0,children:u}),a.jsx(I.TooltipContent,{hideArrow:!0,...s,align:"center",className:l.cn("bg-foreground text-background border-none",s.className),hidden:b!=="collapsed"||p,side:"right",sideOffset:8})]})):u});A.displayName="SidebarMenuButton";const ge=i.forwardRef(({className:e,asChild:r=!1,showOnHover:t=!1,...o},s)=>{const n=r?y.Slot:"button";return a.jsx(n,{ref:s,className:l.cn("text-sidebar-foreground 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 [&>svg]:shrink-0",S,"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","group-data-[collapsible=icon]:hidden",t&&"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})});ge.displayName="SidebarMenuAction";const ve=i.forwardRef(({className:e,...r},t)=>a.jsx("div",{ref:t,className:l.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",...r}));ve.displayName="SidebarMenuBadge";const Se=i.forwardRef(({className:e,showIcon:r=!1,...t},o)=>{const s=i.useId(),n=i.useMemo(()=>{let d=0;for(let c=0;c<s.length;c++)d=(d<<5)-d+s.charCodeAt(c),d|=0;return`${Math.abs(d)%40+50}%`},[s]);return a.jsxs("div",{ref:o,className:l.cn("flex h-8 items-center gap-2 rounded-md px-2",e),"data-slot":"sidebar-menu-skeleton",...t,children:[r&&a.jsx(G.Skeleton,{className:"size-4 rounded-md","data-slot":"sidebar-menu-skeleton-icon"}),a.jsx(G.Skeleton,{className:"h-4 max-w-[--skeleton-width] flex-1","data-slot":"sidebar-menu-skeleton-text",style:{"--skeleton-width":n}})]})});Se.displayName="SidebarMenuSkeleton";const Xe=T.cva("flex min-w-0 flex-col items-start gap-1 py-1 group-data-[collapsible=icon]:hidden",{variants:{variant:{default:"px-10",border:"border-l border-sidebar-border ml-10 pl-1 pr-10",indent:"px-10"}},defaultVariants:{variant:"border"}}),q=i.forwardRef(({className:e,variant:r="border",dataHook:t,...o},s)=>a.jsx("ul",{ref:s,className:l.cn(Xe({variant:r}),e),"data-hook":t,"data-slot":"sidebar-menu-sub",...o}));q.displayName="SidebarMenuSub";const we=i.forwardRef(({dataHook:e,...r},t)=>a.jsx("li",{ref:t,"data-hook":e,"data-slot":"sidebar-menu-sub-item",...r}));we.displayName="SidebarMenuSubItem";const je=i.forwardRef(({asChild:e=!1,size:r="md",isActive:t,className:o,dataHook:s,...n},d)=>{const c=e?y.Slot:"a";return a.jsx(c,{ref:d,className:l.cn("text-sidebar-foreground 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 items-center gap-2 overflow-hidden rounded-md px-2 transition-[color,background-color,box-shadow,opacity] duration-150 ease-in-out outline-none disabled:pointer-events-none disabled:opacity-50 aria-disabled:pointer-events-none aria-disabled:opacity-50 [&>span:last-of-type]:truncate [&>svg]:shrink-0",S,"data-[active=true]:bg-sidebar-accent data-[active=true]:text-sidebar-accent-foreground",r==="sm"&&"text-xs",r==="md"&&"text-sm","group-data-[collapsible=icon]:hidden",o),"data-active":t,"data-hook":s,"data-size":r,"data-slot":"sidebar-menu-sub-button",...n})});je.displayName="SidebarMenuSubButton";function Ne({dataHook:e,className:r,children:t,defaultOpen:o,open:s,onOpenChange:n}){return a.jsx(L,{children:a.jsx(P.Accordion,{collapsible:!0,className:r,dataHook:e??"sidebar-menu-collapsible",defaultValue:o?"item":void 0,type:"single",value:s!==void 0?s?"item":"":void 0,onValueChange:n?d=>n(d==="item"):void 0,children:a.jsx(P.AccordionItem,{className:"group/collapsible border-none",value:"item",children:t})})})}Ne.displayName="SidebarMenuCollapsible";const ke=i.forwardRef(({children:e,className:r,...t},o)=>a.jsx(qe.Trigger,{asChild:!0,children:a.jsxs(A,{ref:o,className:r,variant:"collapsible",...t,children:[e,a.jsx(g.ChevronRight,{"data-collapse-icon":!0,className:"opacity-100! transition-transform duration-200 ease-out group-data-[collapsible=icon]:hidden",size:12})]})}));ke.displayName="SidebarMenuCollapsibleTrigger";const ye=i.forwardRef(({dataHook:e,children:r,...t},o)=>a.jsx(P.AccordionContent,{className:"p-0",children:a.jsx(q,{ref:o,dataHook:e,...t,children:r})}));ye.displayName="SidebarMenuCollapsibleContent";const Ce=i.forwardRef(({className:e,dataHook:r="sidebar-drawer",trackingEl:t,trackingLabel:o,children:s,...n},d)=>a.jsx("div",{ref:d,className:e,"data-hook":r,"data-slot":"sidebar-drawer","data-tracking-el":t,"data-tracking-label":o,...n,children:a.jsx(B,{dataHook:`${r}-trigger`,children:a.jsx(g.Menu,{size:24})})}));Ce.displayName="SidebarDrawer";const Me=i.forwardRef(({className:e,dataHook:r="sidebar-header-button",children:t,...o},s)=>a.jsx(U.Button,{ref:s,...o,iconOnly:!0,className:l.cn("hover:bg-sidebar-accent hover:text-sidebar-accent-foreground size-7 rounded-md shadow-none",S,e),"data-slot":"sidebar-header-button",dataHook:r,size:"sm",variant:"ghost",children:t}));Me.displayName="SidebarHeaderButton";const H=i.forwardRef(({className:e,dataHook:r="sidebar-popover-trigger",icon:t,triggerAriaLabel:o,children:s,...n},d)=>a.jsxs("button",{ref:d,"aria-label":o??"Switch workspace",className:l.cn("text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground flex items-center gap-2 rounded-md px-1.5 py-2 text-sm font-semibold transition-colors duration-200 ease-out outline-none",S,e),"data-hook":r,"data-slot":"sidebar-popover-trigger",type:"button",...n,children:[t&&a.jsx("span",{className:"bg-sidebar-primary text-sidebar-primary-foreground flex size-5 shrink-0 items-center justify-center rounded-md",children:t}),a.jsx("span",{className:"truncate",children:s}),a.jsx(g.ChevronDown,{className:"shrink-0 opacity-50",size:16})]}));H.displayName="SidebarPopoverTrigger";const D=i.forwardRef(({className:e,dataHook:r,icon:t,shortcut:o,children:s,...n},d)=>a.jsxs("button",{ref:d,className:l.cn("text-popover-foreground hover:bg-accent hover:text-accent-foreground focus-visible:bg-accent focus-visible:text-accent-foreground flex h-10 w-full items-center gap-2 rounded-xs p-2 text-sm transition-colors duration-150 ease-in-out outline-none",S,e),"data-hook":r,"data-slot":"sidebar-popover-menu-item",type:"button",...n,children:[t&&a.jsx("span",{className:"border-border flex size-6 shrink-0 items-center justify-center rounded-xs border [&_svg]:size-4",children:t}),a.jsx("span",{className:"min-w-px flex-1 truncate text-left",children:s}),o&&a.jsx("span",{className:"text-popover-foreground/60 shrink-0 text-xs",children:o})]}));D.displayName="SidebarPopoverMenuItem";const Re=i.forwardRef(({className:e,dataHook:r="sidebar-popover-menu",groupTitle:t="Teams",items:o,addActionLabel:s,addActionIcon:n,onAddAction:d,children:c,...f},m)=>a.jsx("div",{ref:m,className:l.cn("flex flex-col",e),"data-hook":r,"data-slot":"sidebar-popover-menu",...f,children:c||a.jsxs(a.Fragment,{children:[a.jsxs("div",{className:"flex flex-col items-start p-1",children:[t&&a.jsx("div",{className:"flex w-full items-center px-2 py-1.5",children:a.jsx("span",{className:"text-muted-foreground flex-1 text-xs font-medium",children:t})}),o?.map((p,b)=>a.jsx(D,{icon:p.icon,shortcut:p.shortcut,onClick:p.onClick,children:p.label},b))]}),d&&a.jsxs(a.Fragment,{children:[a.jsx(z.Separator,{}),a.jsx("div",{className:"flex flex-col items-start p-1",children:a.jsx(D,{icon:n||a.jsx(g.Plus,{size:16}),onClick:d,children:s??"Add team"})})]})]})}));Re.displayName="SidebarPopoverMenu";function Ie({dataHook:e="sidebar-switcher",icon:r,label:t,triggerAriaLabel:o,triggerClassName:s,children:n}){return a.jsxs(_.Popover,{children:[a.jsx(_.PopoverTrigger,{asChild:!0,children:a.jsx(H,{className:s,dataHook:`${e}-trigger`,icon:r,triggerAriaLabel:o,children:t})}),a.jsx(_.PopoverContent,{align:"start",className:"w-[316px] p-0",dataHook:`${e}-content`,side:"bottom",sideOffset:4,children:n})]})}Ie.displayName="SidebarSwitcher";function De({dataHook:e="sidebar-account-dropdown",name:r,email:t,avatar:o,menuGroups:s,triggerAriaLabel:n,align:d="end",side:c="top",children:f}){return a.jsxs(N.DropdownMenu,{children:[a.jsx(N.DropdownMenuTrigger,{asChild:!0,children:a.jsxs(A,{"aria-label":n??"Account menu",className:"h-auto py-1.5",dataHook:`${e}-button`,size:"lg",children:[o,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 leading-none",children:[a.jsx("span",{className:"truncate text-sm font-semibold",children:r}),a.jsx("span",{className:"truncate text-xs font-normal",children:t})]})]})}),a.jsx(N.DropdownMenuContent,{align:d,className:"w-56",dataHook:`${e}-content`,side:c,sideOffset:4,children:f||a.jsxs(a.Fragment,{children:[a.jsxs(N.DropdownMenuLabel,{className:"flex items-center gap-2 px-1 py-1.5",children:[o,a.jsxs("div",{className:"flex min-w-0 flex-1 flex-col gap-0.5 leading-none",children:[a.jsx("span",{className:"truncate text-sm font-semibold",children:r}),a.jsx("span",{className:"truncate text-xs font-normal",children:t})]})]}),s?.map((m,p)=>a.jsxs(i.Fragment,{children:[a.jsx(N.DropdownMenuSeparator,{}),m.map((b,u)=>a.jsxs(N.DropdownMenuItem,{onClick:b.onClick,children:[b.icon,b.label]},u))]},p))]})})]})}De.displayName="SidebarAccountDropdown";const Ae=i.forwardRef(({className:e,dataHook:r,senderName:t,title:o,description:s,timestamp:n,...d},c)=>a.jsxs("button",{ref:c,className:l.cn("border-sidebar-border text-sidebar-foreground hover:bg-sidebar-accent hover:text-sidebar-accent-foreground focus-visible:bg-sidebar-accent flex w-full flex-col gap-2 border-b p-4 text-left transition-colors duration-150 ease-in-out outline-none",S,e),"data-hook":r,"data-slot":"sidebar-inbox-item",type:"button",...d,children:[a.jsxs("div",{className:"flex w-full items-center justify-between text-sm",children:[a.jsx("span",{children:t}),n&&a.jsx("span",{children:n})]}),a.jsx("p",{className:"w-full text-sm font-medium",children:o}),s&&a.jsx("p",{className:"w-full truncate text-xs",children:s})]}));Ae.displayName="SidebarInboxItem";exports.Sidebar=oe;exports.SidebarAccountDropdown=De;exports.SidebarCollapseIcon=he;exports.SidebarCollapseIconType=ae;exports.SidebarCollapsible=W;exports.SidebarContent=ue;exports.SidebarDrawer=Ce;exports.SidebarFooter=le;exports.SidebarGroup=be;exports.SidebarGroupAction=fe;exports.SidebarGroupContent=me;exports.SidebarGroupLabel=pe;exports.SidebarGroupLabelSize=X;exports.SidebarGroupLabelVariant=Y;exports.SidebarHeader=de;exports.SidebarHeaderButton=Me;exports.SidebarInboxItem=Ae;exports.SidebarInput=ie;exports.SidebarInset=ne;exports.SidebarMenu=xe;exports.SidebarMenuAction=ge;exports.SidebarMenuBadge=ve;exports.SidebarMenuButton=A;exports.SidebarMenuButtonSize=J;exports.SidebarMenuButtonVariant=Z;exports.SidebarMenuCollapsible=Ne;exports.SidebarMenuCollapsibleContent=ye;exports.SidebarMenuCollapsibleTrigger=ke;exports.SidebarMenuItem=L;exports.SidebarMenuSkeleton=Se;exports.SidebarMenuSub=q;exports.SidebarMenuSubButton=je;exports.SidebarMenuSubButtonSize=ee;exports.SidebarMenuSubItem=we;exports.SidebarMenuSubVariant=Q;exports.SidebarPopoverMenu=Re;exports.SidebarPopoverMenuItem=D;exports.SidebarPopoverTrigger=H;exports.SidebarProvider=re;exports.SidebarRail=se;exports.SidebarSeparator=ce;exports.SidebarSide=V;exports.SidebarSwitcher=Ie;exports.SidebarTrigger=B;exports.SidebarVariant=$;exports.useSidebar=j;
|
package/dist/blocks/sidebar.d.ts
CHANGED
|
@@ -223,7 +223,7 @@ interface SidebarTriggerProps extends Omit<React.ComponentProps<typeof Button>,
|
|
|
223
223
|
dataHook?: string;
|
|
224
224
|
/**
|
|
225
225
|
* Accessible label for the toggle button.
|
|
226
|
-
* @default "Toggle
|
|
226
|
+
* @default "Toggle sidebar"
|
|
227
227
|
*/
|
|
228
228
|
toggleAriaLabel?: string;
|
|
229
229
|
}
|
|
@@ -234,7 +234,7 @@ declare const SidebarTrigger: React.ForwardRefExoticComponent<Omit<SidebarTrigge
|
|
|
234
234
|
interface SidebarRailProps extends React.ComponentProps<"button"> {
|
|
235
235
|
/**
|
|
236
236
|
* Accessible label and tooltip for the rail toggle.
|
|
237
|
-
* @default "Toggle
|
|
237
|
+
* @default "Toggle sidebar"
|
|
238
238
|
*/
|
|
239
239
|
toggleAriaLabel?: string;
|
|
240
240
|
}
|
package/dist/blocks/sidebar.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as a, jsxs as u, Fragment as M } from "react/jsx-runtime";
|
|
2
2
|
import * as i from "react";
|
|
3
3
|
import { createPortal as q } from "react-dom";
|
|
4
|
-
import { Slot as
|
|
4
|
+
import { Slot as S } from "@radix-ui/react-slot";
|
|
5
5
|
import { cva as O } from "class-variance-authority";
|
|
6
6
|
import { ChevronRight as E, Ellipsis as X, Minus as V, Plus as _, ChevronsUpDown as Y, ChevronDown as z, Menu as Z, PanelLeft as J } from "@brightlocal/icons";
|
|
7
7
|
import { cn as l } from "@brightlocal/ui-components/lib/utils";
|
|
@@ -18,7 +18,7 @@ import { Skeleton as B } from "../skeleton.js";
|
|
|
18
18
|
import { Tooltip as xe, TooltipTrigger as ve, TooltipContent as we, TooltipProvider as Ne } from "../tooltip.js";
|
|
19
19
|
import { useIsBelowBreakpoint as ke } from "../hooks/use-breakpoint.js";
|
|
20
20
|
const w = "focus-visible:[box-shadow:0_0_0_1px_color-mix(in_srgb,var(--color-sidebar-ring)_50%,transparent),0_0_0_3px_rgba(0,0,0,0.1)]";
|
|
21
|
-
var
|
|
21
|
+
var ye = /* @__PURE__ */ ((e) => (e.LEFT = "left", e))(ye || {}), Se = /* @__PURE__ */ ((e) => (e.SIDEBAR = "sidebar", e))(Se || {}), Ce = /* @__PURE__ */ ((e) => (e.OFFCANVAS = "offcanvas", e.ICON = "icon", e.NONE = "none", e))(Ce || {}), Re = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.SM = "sm", e.XS = "xs", e))(Re || {}), Me = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.COLLAPSIBLE = "collapsible", e.ACTION = "action", e))(Me || {}), Ie = /* @__PURE__ */ ((e) => (e.SIMPLE = "simple", e.COLLAPSIBLE = "collapsible", e.DROPDOWN = "dropdown", e.BADGE = "badge", e.BIG_ICON = "bigIcon", e.CHECKBOX = "checkbox", e))(Ie || {}), De = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.SM = "sm", e.LG = "lg", e))(De || {}), Ee = /* @__PURE__ */ ((e) => (e.DEFAULT = "default", e.BORDER = "border", e.INDENT = "indent", e))(Ee || {}), Ae = /* @__PURE__ */ ((e) => (e.SM = "sm", e.MD = "md", e))(Ae || {}), Oe = /* @__PURE__ */ ((e) => (e.CARET = "caret", e.HORIZONTAL = "horizontal", e.VERTICAL = "vertical", e.UP_DOWN = "upDown", e.PLUS_MINUS = "plusMinus", e.DOTS = "dots", e))(Oe || {});
|
|
22
22
|
const _e = "sidebar:state", ze = 3600 * 24 * 7, Pe = "224px", Te = "336px", Le = "48px", Be = "b", F = i.createContext(null);
|
|
23
23
|
function k() {
|
|
24
24
|
const e = i.useContext(F);
|
|
@@ -39,12 +39,12 @@ const He = i.forwardRef(
|
|
|
39
39
|
children: m,
|
|
40
40
|
...h
|
|
41
41
|
}, f) => {
|
|
42
|
-
const p = ke("lg"), [c, x] = i.useState(!1), [g, I] = i.useState(null), [D, K] = i.useState(o),
|
|
42
|
+
const p = ke("lg"), [c, x] = i.useState(!1), [g, I] = i.useState(null), [D, K] = i.useState(o), y = s ?? D, C = i.useCallback(
|
|
43
43
|
(v) => {
|
|
44
|
-
const N = typeof v == "function" ? v(
|
|
44
|
+
const N = typeof v == "function" ? v(y) : v;
|
|
45
45
|
n ? n(N) : K(N), document.cookie = `${_e}=${N}; path=/; max-age=${ze}`;
|
|
46
46
|
},
|
|
47
|
-
[n,
|
|
47
|
+
[n, y]
|
|
48
48
|
), R = i.useCallback(() => p ? x((v) => !v) : C((v) => !v), [p, C, x]);
|
|
49
49
|
i.useEffect(() => {
|
|
50
50
|
const v = (N) => {
|
|
@@ -52,10 +52,10 @@ const He = i.forwardRef(
|
|
|
52
52
|
};
|
|
53
53
|
return window.addEventListener("keydown", v), () => window.removeEventListener("keydown", v);
|
|
54
54
|
}, [R]);
|
|
55
|
-
const L =
|
|
55
|
+
const L = y ? "expanded" : "collapsed", W = i.useMemo(
|
|
56
56
|
() => ({
|
|
57
57
|
state: L,
|
|
58
|
-
open:
|
|
58
|
+
open: y,
|
|
59
59
|
setOpen: C,
|
|
60
60
|
isMobile: p,
|
|
61
61
|
openMobile: c,
|
|
@@ -66,7 +66,7 @@ const He = i.forwardRef(
|
|
|
66
66
|
}),
|
|
67
67
|
[
|
|
68
68
|
L,
|
|
69
|
-
|
|
69
|
+
y,
|
|
70
70
|
C,
|
|
71
71
|
p,
|
|
72
72
|
c,
|
|
@@ -183,14 +183,14 @@ const $ = i.forwardRef(
|
|
|
183
183
|
children: s,
|
|
184
184
|
...n
|
|
185
185
|
}, d) => {
|
|
186
|
-
const { toggleSidebar: b } = k(), m = o ?? "Toggle
|
|
186
|
+
const { toggleSidebar: b } = k(), m = o ?? "Toggle sidebar";
|
|
187
187
|
return /* @__PURE__ */ u(
|
|
188
188
|
H,
|
|
189
189
|
{
|
|
190
190
|
ref: d,
|
|
191
191
|
iconOnly: !0,
|
|
192
192
|
"aria-label": m,
|
|
193
|
-
className: l("h-7 w-7", e),
|
|
193
|
+
className: l("relative h-7 w-7", e),
|
|
194
194
|
"data-slot": "sidebar-trigger",
|
|
195
195
|
dataHook: r,
|
|
196
196
|
size: "sm",
|
|
@@ -210,7 +210,7 @@ const $ = i.forwardRef(
|
|
|
210
210
|
$.displayName = "SidebarTrigger";
|
|
211
211
|
const $e = i.forwardRef(
|
|
212
212
|
({ className: e, toggleAriaLabel: t, ...r }, o) => {
|
|
213
|
-
const { toggleSidebar: s } = k(), n = t ?? "Toggle
|
|
213
|
+
const { toggleSidebar: s } = k(), n = t ?? "Toggle sidebar";
|
|
214
214
|
return /* @__PURE__ */ a(
|
|
215
215
|
"button",
|
|
216
216
|
{
|
|
@@ -415,7 +415,7 @@ const Ve = O(
|
|
|
415
415
|
children: m,
|
|
416
416
|
...h
|
|
417
417
|
}, f) => {
|
|
418
|
-
const p = r ?
|
|
418
|
+
const p = r ? S : "div", c = () => {
|
|
419
419
|
s === "collapsible" && d ? d() : s === "action" && b && b();
|
|
420
420
|
}, x = (g) => {
|
|
421
421
|
(g.key === "Enter" || g.key === " ") && (g.preventDefault(), c());
|
|
@@ -453,7 +453,7 @@ const Ve = O(
|
|
|
453
453
|
);
|
|
454
454
|
Ye.displayName = "SidebarGroupLabel";
|
|
455
455
|
const Ze = i.forwardRef(({ className: e, asChild: t = !1, ...r }, o) => /* @__PURE__ */ a(
|
|
456
|
-
t ?
|
|
456
|
+
t ? S : "button",
|
|
457
457
|
{
|
|
458
458
|
ref: o,
|
|
459
459
|
className: l(
|
|
@@ -583,7 +583,7 @@ const aa = O(
|
|
|
583
583
|
dataHook: d,
|
|
584
584
|
...b
|
|
585
585
|
}, m) => {
|
|
586
|
-
const h = e ?
|
|
586
|
+
const h = e ? S : "button", { isMobile: f, state: p } = k(), c = /* @__PURE__ */ a(
|
|
587
587
|
h,
|
|
588
588
|
{
|
|
589
589
|
ref: m,
|
|
@@ -621,7 +621,7 @@ const aa = O(
|
|
|
621
621
|
);
|
|
622
622
|
T.displayName = "SidebarMenuButton";
|
|
623
623
|
const ta = i.forwardRef(({ className: e, asChild: t = !1, showOnHover: r = !1, ...o }, s) => /* @__PURE__ */ a(
|
|
624
|
-
t ?
|
|
624
|
+
t ? S : "button",
|
|
625
625
|
{
|
|
626
626
|
ref: s,
|
|
627
627
|
className: l(
|
|
@@ -740,7 +740,7 @@ const ia = i.forwardRef(
|
|
|
740
740
|
dataHook: s,
|
|
741
741
|
...n
|
|
742
742
|
}, d) => /* @__PURE__ */ a(
|
|
743
|
-
e ?
|
|
743
|
+
e ? S : "a",
|
|
744
744
|
{
|
|
745
745
|
ref: d,
|
|
746
746
|
className: l(
|
|
@@ -1119,9 +1119,9 @@ export {
|
|
|
1119
1119
|
He as SidebarProvider,
|
|
1120
1120
|
$e as SidebarRail,
|
|
1121
1121
|
We as SidebarSeparator,
|
|
1122
|
-
|
|
1122
|
+
ye as SidebarSide,
|
|
1123
1123
|
fa as SidebarSwitcher,
|
|
1124
1124
|
$ as SidebarTrigger,
|
|
1125
|
-
|
|
1125
|
+
Se as SidebarVariant,
|
|
1126
1126
|
k as useSidebar
|
|
1127
1127
|
};
|
package/dist/breadcrumb.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const s=require("react/jsx-runtime"),g=require("react"),x=require("@radix-ui/react-slot"),d=require("@brightlocal/icons"),o=require("@brightlocal/ui-components/lib/utils");function j(e){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const t=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(a,r,t.get?t:{enumerable:!0,get:()=>e[r]})}}return a.default=e,Object.freeze(a)}const c=j(g),i=c.forwardRef(({dataHook:e,trackingEl:a,trackingLabel:r,ariaLabel:t,...n},B)=>s.jsx("nav",{ref:B,"aria-label":t??"Breadcrumb","data-hook":e,"data-slot":"breadcrumb","data-tracking-el":a,"data-tracking-label":r,...n}));i.displayName="Breadcrumb";const l=c.forwardRef(({className:e,...a},r)=>s.jsx("ol",{ref:r,className:o.cn("text-muted-foreground flex flex-wrap items-center gap-1.5 text-sm break-words sm:gap-2.5",e),"data-slot":"breadcrumb-list",...a}));l.displayName="BreadcrumbList";const u=c.forwardRef(({className:e,...a},r)=>s.jsx("li",{ref:r,className:o.cn("inline-flex items-center gap-1.5",e),"data-slot":"breadcrumb-item",...a}));u.displayName="BreadcrumbItem";const m=c.forwardRef(({asChild:e,className:a,...r},t)=>{const n=e?x.Slot:"a";return s.jsx(n,{ref:t,className:o.cn("hover:text-foreground focus-visible:shadow-default rounded-sm transition-colors outline-none",a),"data-slot":"breadcrumb-link",...r})});m.displayName="BreadcrumbLink";const b=c.forwardRef(({className:e,...a},r)=>s.jsx("span",{ref:r,"aria-current":"page","aria-disabled":"true",className:o.cn("text-foreground font-normal",e),"data-slot":"breadcrumb-page",role:"link",...a}));b.displayName="BreadcrumbPage";const f=c.forwardRef(({children:e,className:a,...r},t)=>s.jsx("li",{ref:t,"aria-hidden":"true",className:a,"data-slot":"breadcrumb-separator",role:"presentation",...r,children:e??s.jsx(d.ChevronRight,{size:14})}));f.displayName="BreadcrumbSeparator";const p=c.forwardRef(({className:e,srLabel:a="More",...r},t)=>s.jsxs("span",{ref:t,"aria-hidden":"true",className:o.cn("relative flex size-9 items-center justify-center",e),"data-slot":"breadcrumb-ellipsis",role:"presentation",...r,children:[s.jsx(d.MoreHorizontal,{}),s.jsx("span",{className:"sr-only",children:a})]}));p.displayName="BreadcrumbEllipsis";exports.Breadcrumb=i;exports.BreadcrumbEllipsis=p;exports.BreadcrumbItem=u;exports.BreadcrumbLink=m;exports.BreadcrumbList=l;exports.BreadcrumbPage=b;exports.BreadcrumbSeparator=f;
|
package/dist/breadcrumb.d.ts
CHANGED
package/dist/breadcrumb.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/components/breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;GAEG;AACH,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC3D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,UAAU,kGAcf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,cAAc,2KAalB,CAAC;AAGH;;GAEG;AACH,QAAA,MAAM,cAAc,kKAUlB,CAAC;AAGH;;GAEG;AACH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC;IAC7D;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,QAAA,MAAM,cAAc,4GAgBnB,CAAC;AAGF;;;GAGG;AACH,QAAA,MAAM,cAAc,sKAalB,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,mBAAmB,kKAcvB,CAAC;AAGH;;;GAGG;AACH,UAAU,uBAAwB,SAAQ,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;IACpE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,kBAAkB,
|
|
1
|
+
{"version":3,"file":"breadcrumb.d.ts","sourceRoot":"","sources":["../../src/components/breadcrumb.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAM/B;;GAEG;AACH,UAAU,eAAgB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC3D;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AAED;;;GAGG;AACH,QAAA,MAAM,UAAU,kGAcf,CAAC;AAGF;;GAEG;AACH,QAAA,MAAM,cAAc,2KAalB,CAAC;AAGH;;GAEG;AACH,QAAA,MAAM,cAAc,kKAUlB,CAAC;AAGH;;GAEG;AACH,UAAU,mBAAoB,SAAQ,KAAK,CAAC,cAAc,CAAC,GAAG,CAAC;IAC7D;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf;AAED;;;GAGG;AACH,QAAA,MAAM,cAAc,4GAgBnB,CAAC;AAGF;;;GAGG;AACH,QAAA,MAAM,cAAc,sKAalB,CAAC;AAGH;;;GAGG;AACH,QAAA,MAAM,mBAAmB,kKAcvB,CAAC;AAGH;;;GAGG;AACH,UAAU,uBAAwB,SAAQ,KAAK,CAAC,cAAc,CAAC,MAAM,CAAC;IACpE;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB;AAED,QAAA,MAAM,kBAAkB,8GAoBtB,CAAC;AAGH,OAAO,EACL,UAAU,EACV,cAAc,EACd,cAAc,EACd,cAAc,EACd,cAAc,EACd,mBAAmB,EACnB,kBAAkB,GACnB,CAAC;AACF,YAAY,EAAE,eAAe,EAAE,mBAAmB,EAAE,uBAAuB,EAAE,CAAC"}
|
package/dist/breadcrumb.js
CHANGED
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import { jsx as t, jsxs as
|
|
1
|
+
import { jsx as t, jsxs as m } from "react/jsx-runtime";
|
|
2
2
|
import * as s from "react";
|
|
3
3
|
import { Slot as n } from "@radix-ui/react-slot";
|
|
4
4
|
import { MoreHorizontal as c, ChevronRight as u } from "@brightlocal/icons";
|
|
5
5
|
import { cn as d } from "@brightlocal/ui-components/lib/utils";
|
|
6
6
|
const b = s.forwardRef(
|
|
7
|
-
({ dataHook: r, trackingEl: a, trackingLabel: e, ariaLabel: o, ...i },
|
|
7
|
+
({ dataHook: r, trackingEl: a, trackingLabel: e, ariaLabel: o, ...i }, l) => /* @__PURE__ */ t(
|
|
8
8
|
"nav",
|
|
9
9
|
{
|
|
10
|
-
ref:
|
|
11
|
-
"aria-label": o ?? "
|
|
10
|
+
ref: l,
|
|
11
|
+
"aria-label": o ?? "Breadcrumb",
|
|
12
12
|
"data-hook": r,
|
|
13
13
|
"data-slot": "breadcrumb",
|
|
14
14
|
"data-tracking-el": a,
|
|
@@ -82,12 +82,15 @@ const N = s.forwardRef(({ children: r, className: a, ...e }, o) => /* @__PURE__
|
|
|
82
82
|
}
|
|
83
83
|
));
|
|
84
84
|
N.displayName = "BreadcrumbSeparator";
|
|
85
|
-
const x = s.forwardRef(({ className: r, srLabel: a = "More", ...e }, o) => /* @__PURE__ */
|
|
85
|
+
const x = s.forwardRef(({ className: r, srLabel: a = "More", ...e }, o) => /* @__PURE__ */ m(
|
|
86
86
|
"span",
|
|
87
87
|
{
|
|
88
88
|
ref: o,
|
|
89
89
|
"aria-hidden": "true",
|
|
90
|
-
className: d(
|
|
90
|
+
className: d(
|
|
91
|
+
"relative flex size-9 items-center justify-center",
|
|
92
|
+
r
|
|
93
|
+
),
|
|
91
94
|
"data-slot": "breadcrumb-ellipsis",
|
|
92
95
|
role: "presentation",
|
|
93
96
|
...e,
|
package/dist/button.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),O=require("react"),_=require("@radix-ui/react-slot"),z=require("class-variance-authority"),q=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils");function B(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const d=require("react/jsx-runtime"),O=require("react"),_=require("@radix-ui/react-slot"),z=require("class-variance-authority"),q=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils");function B(e){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const a in e)if(a!=="default"){const o=Object.getOwnPropertyDescriptor(e,a);Object.defineProperty(t,a,o.get?o:{enumerable:!0,get:()=>e[a]})}}return t.default=e,Object.freeze(t)}const c=B(O),P=16,b=z.cva(["rounded-full","inline-flex","font-semibold","items-center","justify-center","gap-2","whitespace-nowrap","transition-[color,background-color,border-color,box-shadow,opacity]","duration-150","ease-in-out","cursor-pointer","disabled:pointer-events-none","disabled:cursor-not-allowed","disabled:opacity-50","aria-disabled:opacity-50","[&_svg]:pointer-events-none","[&_svg]:shrink-0","shrink-0","outline-none","aria-invalid:ring-destructive/20","dark:aria-invalid:ring-destructive/40","aria-invalid:border-destructive"],{variants:{variant:{primary:["bg-primary","dark:bg-green-400","text-primary-foreground","dark:text-[var(--ds-colors-primary-foreground-light)]","hover:bg-primary/90","focus-visible:shadow-default"],secondary:["bg-secondary","text-secondary-foreground","hover:bg-secondary/80","focus-visible:shadow-default"],warning:["bg-warning-background","hover:bg-warning-background/80","text-warning-foreground","focus-visible:shadow-default"],destructive:["bg-destructive","dark:bg-red-400/90","hover:bg-destructive/80","dark:hover:bg-red-400/90","text-destructive-foreground","dark:text-red-950","focus-visible:shadow-destructive"],outline:["border","border-border","border-solid","bg-background","hover:bg-accent","hover:text-accent-foreground","dark:bg-input/30","dark:border-input","dark:hover:bg-input/80","dark:hover:border-input","focus-visible:shadow-default","focus-visible:border-ring"],ghost:["bg-transparent","text-foreground","hover:bg-accent","data-[state=open]:bg-accent","focus-visible:shadow-default"]},size:{default:"px-4 py-2 h-9 text-sm",sm:"py-2 px-3 h-8 text-xs",lg:"py-2 px-8 h-10 text-sm [&_svg:not([class*='size-'])]:size-5"},state:{default:"",loading:"pointer-events-none",disabled:"pointer-events-none opacity-50"},fullWidth:{false:"",true:"w-full"}},defaultVariants:{variant:"primary",size:"default",state:"default",fullWidth:!1}}),k=c.forwardRef(({className:e,variant:t="primary",size:a="default",fullWidth:o=!1,asChild:l=!1,dataHook:f,trackingEl:g,trackingLabel:v,iconOnly:w=!1,loading:n=!1,ariaLabel:j,disabled:p=!1,children:r,...u},y)=>{const h=l?_.Slot:"button",m=p||n;let i=w;!i&&c.Children.count(r)===1&&c.isValidElement(r)&&(i=r.props?.children==null);const S=n&&!l;let s="default";n?s="loading":p&&(s="disabled");const N=j??(n?typeof r=="string"||typeof r=="number"?`Loading: ${r}`:"Loading":void 0);return l?d.jsx(h,{ref:y,className:x.cn(b({variant:t,size:a,state:s,fullWidth:o}),i&&"size-9 p-0",e),"data-hook":f,"data-slot":"button","data-tracking-el":g||`button-${t}`,"data-tracking-label":v,...u,children:r}):d.jsxs(h,{ref:y,"aria-busy":n?"true":void 0,"aria-disabled":m?"true":void 0,"aria-label":N,className:x.cn(b({variant:t,size:a,state:s,fullWidth:o}),i&&"size-9 p-0",e),"data-hook":f,"data-slot":"button","data-tracking-el":g||`button-${t}`,"data-tracking-label":v,disabled:m,type:u.type??"button",...u,children:[S&&d.jsx("div",{className:"pointer-events-none flex items-center justify-center","data-slot":"button-loading-icon",children:d.jsx(q.Loader2,{className:"animate-spin",size:P})}),r]})});k.displayName="Button";exports.Button=k;exports.ButtonVariants=b;
|
package/dist/button.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B;;GAEG;AACH,KAAK,kBAAkB,GAAG;IACxB;;;OAGG;IACH,OAAO,CAAC,EACJ,SAAS,GACT,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,GACP,SAAS,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;AAEvE,QAAA,MAAM,cAAc;;;;;8EAqGnB,CAAC;AAEF;;GAEG;AACH,KAAK,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAEtE,KAAK,WAAW,GAAG,iBAAiB,GAClC,kBAAkB,GAAG;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEJ,QAAA,MAAM,MAAM,
|
|
1
|
+
{"version":3,"file":"button.d.ts","sourceRoot":"","sources":["../../src/components/button.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAU/B;;GAEG;AACH,KAAK,kBAAkB,GAAG;IACxB;;;OAGG;IACH,OAAO,CAAC,EACJ,SAAS,GACT,aAAa,GACb,SAAS,GACT,WAAW,GACX,OAAO,GACP,SAAS,CAAC;IACd;;;OAGG;IACH,IAAI,CAAC,EAAE,SAAS,GAAG,IAAI,GAAG,IAAI,CAAC;CAChC,CAAC;AAEF,gEAAgE;AAChE,MAAM,MAAM,aAAa,GAAG,WAAW,CAAC,kBAAkB,CAAC,SAAS,CAAC,CAAC,CAAC;AAEvE,QAAA,MAAM,cAAc;;;;;8EAqGnB,CAAC;AAEF;;GAEG;AACH,KAAK,iBAAiB,GAAG,IAAI,CAAC,KAAK,CAAC,cAAc,CAAC,QAAQ,CAAC,EAAE,MAAM,CAAC,CAAC;AAEtE,KAAK,WAAW,GAAG,iBAAiB,GAClC,kBAAkB,GAAG;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,QAAQ,EAAE,MAAM,CAAC;IACjB;;;OAGG;IACH,IAAI,CAAC,EAAE,QAAQ,GAAG,QAAQ,CAAC;IAC3B,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB,CAAC;AAEJ,QAAA,MAAM,MAAM,oGAsHX,CAAC;AAIF,OAAO,EAAE,MAAM,EAAE,cAAc,EAAE,CAAC;AAElC,YAAY,EAAE,WAAW,EAAE,CAAC"}
|
package/dist/button.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { jsx as s, jsxs as S } from "react/jsx-runtime";
|
|
2
2
|
import * as d from "react";
|
|
3
|
-
import { Slot as
|
|
4
|
-
import { cva as
|
|
5
|
-
import { Loader2 as
|
|
6
|
-
import { cn as
|
|
7
|
-
const
|
|
3
|
+
import { Slot as I } from "@radix-ui/react-slot";
|
|
4
|
+
import { cva as _ } from "class-variance-authority";
|
|
5
|
+
import { Loader2 as j } from "@brightlocal/icons";
|
|
6
|
+
import { cn as h } from "@brightlocal/ui-components/lib/utils";
|
|
7
|
+
const B = 16, x = _(
|
|
8
8
|
[
|
|
9
9
|
"rounded-full",
|
|
10
10
|
"inline-flex",
|
|
@@ -122,18 +122,18 @@ const I = 16, x = j(
|
|
|
122
122
|
children: e,
|
|
123
123
|
...n
|
|
124
124
|
}, v) => {
|
|
125
|
-
const m = i ?
|
|
125
|
+
const m = i ? I : "button", y = p || t;
|
|
126
126
|
let a = k;
|
|
127
127
|
!a && d.Children.count(e) === 1 && d.isValidElement(e) && (a = e.props?.children == null);
|
|
128
128
|
const N = t && !i;
|
|
129
129
|
let o = "default";
|
|
130
130
|
t ? o = "loading" : p && (o = "disabled");
|
|
131
|
-
const z = w ?? (t ? `Loading: ${e
|
|
131
|
+
const z = w ?? (t ? typeof e == "string" || typeof e == "number" ? `Loading: ${e}` : "Loading" : void 0);
|
|
132
132
|
return i ? /* @__PURE__ */ s(
|
|
133
133
|
m,
|
|
134
134
|
{
|
|
135
135
|
ref: v,
|
|
136
|
-
className:
|
|
136
|
+
className: h(
|
|
137
137
|
x({
|
|
138
138
|
variant: r,
|
|
139
139
|
size: u,
|
|
@@ -155,9 +155,9 @@ const I = 16, x = j(
|
|
|
155
155
|
{
|
|
156
156
|
ref: v,
|
|
157
157
|
"aria-busy": t ? "true" : void 0,
|
|
158
|
-
"aria-disabled":
|
|
158
|
+
"aria-disabled": y ? "true" : void 0,
|
|
159
159
|
"aria-label": z,
|
|
160
|
-
className:
|
|
160
|
+
className: h(
|
|
161
161
|
x({
|
|
162
162
|
variant: r,
|
|
163
163
|
size: u,
|
|
@@ -171,7 +171,7 @@ const I = 16, x = j(
|
|
|
171
171
|
"data-slot": "button",
|
|
172
172
|
"data-tracking-el": f || `button-${r}`,
|
|
173
173
|
"data-tracking-label": g,
|
|
174
|
-
disabled:
|
|
174
|
+
disabled: y,
|
|
175
175
|
type: n.type ?? "button",
|
|
176
176
|
...n,
|
|
177
177
|
children: [
|
|
@@ -180,7 +180,7 @@ const I = 16, x = j(
|
|
|
180
180
|
{
|
|
181
181
|
className: "pointer-events-none flex items-center justify-center",
|
|
182
182
|
"data-slot": "button-loading-icon",
|
|
183
|
-
children: /* @__PURE__ */ s(
|
|
183
|
+
children: /* @__PURE__ */ s(j, { className: "animate-spin", size: B })
|
|
184
184
|
}
|
|
185
185
|
),
|
|
186
186
|
e
|
package/dist/hover-card.cjs
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),f=require("react"),C=require("@radix-ui/react-hover-card"),s=require("@brightlocal/ui-components/lib/utils");function l(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const o=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,o.get?o:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const u=l(f),n=l(C);function g({openDelay:e=300,closeDelay:r=300,...t}){return a.jsx(n.Root,{closeDelay:r,openDelay:e,...t})}g.displayName="HoverCard";const m=u.forwardRef(({className:e,disabled:r,dataHook:t,trackingEl:o,trackingLabel:d,...i},c)=>a.jsx(n.Trigger,{ref:c,"aria-disabled":r,className:s.cn("text-link cursor-pointer text-sm leading-5 font-medium underline",r&&"pointer-events-none cursor-not-allowed opacity-50",e),"data-hook":t,"data-slot":"hover-card-trigger","data-tracking-el":o,"data-tracking-label":d,...i}));m.displayName="HoverCardTrigger";const v=u.forwardRef(({className:e,align:r="center",sideOffset:t=4,dataHook:o,trackingEl:d,trackingLabel:i,...c},p)=>a.jsx(n.Portal,{children:a.jsx(n.Content,{ref:p,align:r,className:s.cn("border-border bg-popover text-popover-foreground z-50 w-max max-w-sm rounded-lg border p-4 shadow-md outline-hidden",s.FLOATING_CONTENT_ANIMATION,e),"data-hook":o,"data-slot":"hover-card-content","data-tracking-el":d,"data-tracking-label":i,sideOffset:t,...c})}));v.displayName="HoverCardContent";exports.HoverCard=g;exports.HoverCardContent=v;exports.HoverCardTrigger=m;
|
package/dist/hover-card.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../src/components/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,kBAAkB,MAAM,4BAA4B,CAAC;
|
|
1
|
+
{"version":3,"file":"hover-card.d.ts","sourceRoot":"","sources":["../../src/components/hover-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,kBAAkB,MAAM,4BAA4B,CAAC;AAMjE;;GAEG;AACH,MAAM,WAAW,cAAe,SAAQ,KAAK,CAAC,cAAc,CAC1D,OAAO,kBAAkB,CAAC,IAAI,CAC/B;IACC;;;OAGG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;CACrB;AAED;;;;;;;;;GASG;AACH,iBAAS,SAAS,CAAC,EACjB,SAAe,EACf,UAAgB,EAChB,GAAG,KAAK,EACT,EAAE,cAAc,2CAUhB;kBAdQ,SAAS;;;AAkBlB,MAAM,WAAW,qBAAsB,SAAQ,KAAK,CAAC,cAAc,CACjE,OAAO,kBAAkB,CAAC,OAAO,CAClC;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,QAAA,MAAM,gBAAgB,8GAuBrB,CAAC;AAIF,MAAM,WAAW,qBAAsB,SAAQ,KAAK,CAAC,wBAAwB,CAC3E,OAAO,kBAAkB,CAAC,OAAO,CAClC;IACC;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED;;GAEG;AACH,QAAA,MAAM,gBAAgB,8FAkCrB,CAAC;AAGF,OAAO,EAAE,SAAS,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,CAAC"}
|
package/dist/hover-card.js
CHANGED
|
@@ -1,73 +1,73 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import * as
|
|
3
|
-
import * as
|
|
4
|
-
import { cn as
|
|
1
|
+
import { jsx as a } from "react/jsx-runtime";
|
|
2
|
+
import * as m from "react";
|
|
3
|
+
import * as t from "@radix-ui/react-hover-card";
|
|
4
|
+
import { cn as s, FLOATING_CONTENT_ANIMATION as g } from "@brightlocal/ui-components/lib/utils";
|
|
5
5
|
function p({
|
|
6
|
-
openDelay:
|
|
7
|
-
closeDelay:
|
|
8
|
-
...
|
|
6
|
+
openDelay: e = 300,
|
|
7
|
+
closeDelay: r = 300,
|
|
8
|
+
...o
|
|
9
9
|
}) {
|
|
10
|
-
return /* @__PURE__ */
|
|
11
|
-
|
|
10
|
+
return /* @__PURE__ */ a(
|
|
11
|
+
t.Root,
|
|
12
12
|
{
|
|
13
|
-
closeDelay:
|
|
14
|
-
openDelay:
|
|
15
|
-
...
|
|
13
|
+
closeDelay: r,
|
|
14
|
+
openDelay: e,
|
|
15
|
+
...o
|
|
16
16
|
}
|
|
17
17
|
);
|
|
18
18
|
}
|
|
19
19
|
p.displayName = "HoverCard";
|
|
20
|
-
const
|
|
21
|
-
({ className:
|
|
22
|
-
|
|
20
|
+
const v = m.forwardRef(
|
|
21
|
+
({ className: e, disabled: r, dataHook: o, trackingEl: d, trackingLabel: n, ...i }, l) => /* @__PURE__ */ a(
|
|
22
|
+
t.Trigger,
|
|
23
23
|
{
|
|
24
|
-
ref:
|
|
25
|
-
"aria-disabled":
|
|
26
|
-
className:
|
|
24
|
+
ref: l,
|
|
25
|
+
"aria-disabled": r,
|
|
26
|
+
className: s(
|
|
27
27
|
"text-link cursor-pointer text-sm leading-5 font-medium underline",
|
|
28
|
-
|
|
29
|
-
|
|
28
|
+
r && "pointer-events-none cursor-not-allowed opacity-50",
|
|
29
|
+
e
|
|
30
30
|
),
|
|
31
|
-
"data-hook":
|
|
31
|
+
"data-hook": o,
|
|
32
32
|
"data-slot": "hover-card-trigger",
|
|
33
33
|
"data-tracking-el": d,
|
|
34
|
-
"data-tracking-label":
|
|
35
|
-
...
|
|
34
|
+
"data-tracking-label": n,
|
|
35
|
+
...i
|
|
36
36
|
}
|
|
37
37
|
)
|
|
38
38
|
);
|
|
39
|
-
|
|
40
|
-
const
|
|
39
|
+
v.displayName = "HoverCardTrigger";
|
|
40
|
+
const f = m.forwardRef(
|
|
41
41
|
({
|
|
42
|
-
className:
|
|
43
|
-
align:
|
|
44
|
-
sideOffset:
|
|
42
|
+
className: e,
|
|
43
|
+
align: r = "center",
|
|
44
|
+
sideOffset: o = 4,
|
|
45
45
|
dataHook: d,
|
|
46
|
-
trackingEl:
|
|
47
|
-
trackingLabel:
|
|
48
|
-
...
|
|
49
|
-
}, c) => /* @__PURE__ */
|
|
50
|
-
|
|
46
|
+
trackingEl: n,
|
|
47
|
+
trackingLabel: i,
|
|
48
|
+
...l
|
|
49
|
+
}, c) => /* @__PURE__ */ a(t.Portal, { children: /* @__PURE__ */ a(
|
|
50
|
+
t.Content,
|
|
51
51
|
{
|
|
52
52
|
ref: c,
|
|
53
|
-
align:
|
|
54
|
-
className:
|
|
55
|
-
"border-border bg-popover text-popover-foreground z-50 w-
|
|
56
|
-
|
|
57
|
-
|
|
53
|
+
align: r,
|
|
54
|
+
className: s(
|
|
55
|
+
"border-border bg-popover text-popover-foreground z-50 w-max max-w-sm rounded-lg border p-4 shadow-md outline-hidden",
|
|
56
|
+
g,
|
|
57
|
+
e
|
|
58
58
|
),
|
|
59
59
|
"data-hook": d,
|
|
60
60
|
"data-slot": "hover-card-content",
|
|
61
|
-
"data-tracking-el":
|
|
62
|
-
"data-tracking-label":
|
|
63
|
-
sideOffset:
|
|
64
|
-
...
|
|
61
|
+
"data-tracking-el": n,
|
|
62
|
+
"data-tracking-label": i,
|
|
63
|
+
sideOffset: o,
|
|
64
|
+
...l
|
|
65
65
|
}
|
|
66
66
|
) })
|
|
67
67
|
);
|
|
68
|
-
|
|
68
|
+
f.displayName = "HoverCardContent";
|
|
69
69
|
export {
|
|
70
70
|
p as HoverCard,
|
|
71
|
-
|
|
72
|
-
|
|
71
|
+
f as HoverCardContent,
|
|
72
|
+
v as HoverCardTrigger
|
|
73
73
|
};
|