@brightlocal/ui-components 2.3.0 → 2.4.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/dist/combobox.cjs CHANGED
@@ -1,4 +1,4 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),re=require("react"),H=require("@brightlocal/icons"),ne=require("@tanstack/react-virtual"),se=require("class-variance-authority"),W=require("cmdk"),L=require("@brightlocal/ui-components/lib/utils"),Y=require("@brightlocal/ui-components/lib/use-dev-warning"),B=require("@brightlocal/ui-components/popover"),_=require("@brightlocal/ui-components/command");function ae(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const t=ae(re),J=t.createContext(null),K=t.createContext(null);function $(){const e=t.useContext(J);if(!e)throw new Error("Combobox components must be used within a <Combobox>");return e}function ie({value:e,onValueChange:o,open:r,onOpenChange:n,shouldFilter:u=!0,disabled:b=!1,itemToStringValue:l,children:g}){const[v,C]=t.useState(""),[F,I]=t.useState(!1),[j,R]=t.useState(()=>new Map),[w,y]=t.useState(""),[h,m]=t.useState(void 0),E=e!==void 0,D=r!==void 0,k=E?e:v,d=D?r:F,x=t.useCallback(p=>{p||y(""),D||I(p),n?.(p)},[D,n]),N=t.useCallback(p=>{E||C(p),o?.(p)},[E,o]),s=t.useRef(new Map),S=t.useRef(!1),T=t.useRef(!0);t.useEffect(()=>()=>{T.current=!1},[]);const q=t.useCallback(()=>{S.current||(S.current=!0,queueMicrotask(()=>{S.current=!1,T.current&&R(new Map(s.current))}))},[]),M=t.useCallback((p,O)=>{s.current.get(p)!==O&&(s.current.set(p,O),q())},[q]),A=t.useRef(k);t.useLayoutEffect(()=>{A.current=k},[k]);const z=t.useCallback(p=>{p!==A.current&&s.current.has(p)&&(s.current.delete(p),q())},[q]),G=t.useMemo(()=>l?(p,O,i)=>W.defaultFilter(l(p),O,i):W.defaultFilter,[l]),U=t.useMemo(()=>({open:d,setOpen:x,value:k,onValueChange:N,shouldFilter:u,disabled:b,itemLabels:j,registerItem:M,unregisterItem:z,itemToStringValue:l,filterFn:G,searchValue:w,setSearchValue:y,activeDescendantId:h,setActiveDescendantId:m}),[d,x,k,N,u,b,j,M,z,l,G,w,h,m]);return a.jsx(J.Provider,{value:U,children:a.jsx(B.Popover,{open:d,onOpenChange:x,children:g})})}const ce=se.cva(["relative flex w-full items-center justify-between gap-2","px-4 py-2 h-9","border border-input rounded-md outline-none","bg-neutral-50 shadow-xs","dark:bg-white/5 dark:border-white/15","text-sm font-normal font-sans text-foreground","data-[placeholder=true]:text-muted-foreground","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","transition-[background-color,border-color,box-shadow] duration-200 ease-out","[&_svg]:pointer-events-none [&_svg]:shrink-0"]),Q=t.forwardRef(({className:e,dataHook:o,error:r,trackingEl:n,trackingLabel:u,children:b,...l},g)=>{const{open:v,disabled:C,value:F}=$(),I=t.useId(),j=!F,R=r||l["aria-invalid"]===!0||l["aria-invalid"]==="true";return a.jsx(B.PopoverTrigger,{asChild:!0,children:a.jsxs("button",{ref:g,"aria-controls":v?I:void 0,"aria-expanded":v,"aria-haspopup":"listbox","aria-invalid":R?"true":void 0,className:L.cn(ce(),R&&"border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive",e),"data-hook":o,"data-placeholder":j,"data-slot":"combobox-trigger","data-state":v?"open":"closed","data-tracking-el":n||"combobox-trigger","data-tracking-label":u,disabled:C||l.disabled,role:"combobox",type:"button",...l,children:[b,a.jsx(H.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});Q.displayName="ComboboxTrigger";function ue({placeholder:e,className:o,displayValue:r}){const{value:n,itemLabels:u}=$(),b=n?u.get(n)||r?.(n)||n:e;return a.jsx("span",{className:L.cn("text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",o),"data-slot":"combobox-value",children:b})}function le({dataHook:e,className:o,children:r,align:n="start",side:u="bottom",sideOffset:b,avoidCollisions:l,hideList:g=!1}){const{open:v,shouldFilter:C,filterFn:F,itemToStringValue:I}=$(),[j,R]=t.useState(null),w=t.useRef(null),y=t.useCallback(m=>{if(w.current?.(),w.current=null,!m)return;let E=!1;const D=N=>{E||(N==="top"||N==="bottom")&&(E=!0,k.disconnect(),R(N))},k=new MutationObserver(()=>{D(m.getAttribute("data-side"))});k.observe(m,{attributes:!0,attributeFilter:["data-side"]});let d=0,x=0;d=requestAnimationFrame(()=>{x=requestAnimationFrame(()=>{D(m.getAttribute("data-side"))})}),w.current=()=>{E=!0,k.disconnect(),cancelAnimationFrame(d),cancelAnimationFrame(x)}},[]);t.useEffect(()=>{if(!v){w.current?.(),w.current=null;const m=setTimeout(()=>R(null),150);return()=>clearTimeout(m)}},[v]);const h=I?F:void 0;return a.jsx(B.PopoverContent,{ref:y,align:n,"aria-label":"Options",avoidCollisions:l,className:L.cn("flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",o),collisionPadding:4,"data-slot":"combobox-popover",side:j??u,sideOffset:b,children:a.jsx(_.Command,{className:L.cn("min-h-0 flex-1 border-0 shadow-none","[&_[data-slot='command-input-wrapper']]:shrink-0",g&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:e||"combobox-command",filter:h,shouldFilter:C,children:r})})}const V=t.forwardRef(({debounceMs:e,onValueChange:o,...r},n)=>{const{setSearchValue:u,shouldFilter:b,activeDescendantId:l}=$(),g=t.useRef(void 0);Y.useDevWarning(()=>!!(e&&e>0&&b),`debounceMs is set on <ComboboxInput> but shouldFilter is true (default).
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const a=require("react/jsx-runtime"),re=require("react"),H=require("@brightlocal/icons"),ne=require("@tanstack/react-virtual"),se=require("class-variance-authority"),W=require("cmdk"),L=require("@brightlocal/ui-components/lib/utils"),Y=require("@brightlocal/ui-components/lib/use-dev-warning"),B=require("@brightlocal/ui-components/popover"),_=require("@brightlocal/ui-components/command");function ae(e){const o=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const r in e)if(r!=="default"){const n=Object.getOwnPropertyDescriptor(e,r);Object.defineProperty(o,r,n.get?n:{enumerable:!0,get:()=>e[r]})}}return o.default=e,Object.freeze(o)}const t=ae(re),J=t.createContext(null),K=t.createContext(null);function $(){const e=t.useContext(J);if(!e)throw new Error("Combobox components must be used within a <Combobox>");return e}function ie({value:e,onValueChange:o,open:r,onOpenChange:n,shouldFilter:u=!0,disabled:b=!1,itemToStringValue:l,children:g}){const[v,C]=t.useState(""),[F,I]=t.useState(!1),[j,R]=t.useState(()=>new Map),[w,y]=t.useState(""),[h,m]=t.useState(void 0),E=e!==void 0,D=r!==void 0,k=E?e:v,d=D?r:F,x=t.useCallback(p=>{p||y(""),D||I(p),n?.(p)},[D,n]),N=t.useCallback(p=>{E||C(p),o?.(p)},[E,o]),s=t.useRef(new Map),S=t.useRef(!1),T=t.useRef(!0);t.useEffect(()=>()=>{T.current=!1},[]);const q=t.useCallback(()=>{S.current||(S.current=!0,queueMicrotask(()=>{S.current=!1,T.current&&R(new Map(s.current))}))},[]),M=t.useCallback((p,O)=>{s.current.get(p)!==O&&(s.current.set(p,O),q())},[q]),A=t.useRef(k);t.useLayoutEffect(()=>{A.current=k},[k]);const z=t.useCallback(p=>{p!==A.current&&s.current.has(p)&&(s.current.delete(p),q())},[q]),G=t.useMemo(()=>l?(p,O,i)=>W.defaultFilter(l(p),O,i):W.defaultFilter,[l]),U=t.useMemo(()=>({open:d,setOpen:x,value:k,onValueChange:N,shouldFilter:u,disabled:b,itemLabels:j,registerItem:M,unregisterItem:z,itemToStringValue:l,filterFn:G,searchValue:w,setSearchValue:y,activeDescendantId:h,setActiveDescendantId:m}),[d,x,k,N,u,b,j,M,z,l,G,w,h,m]);return a.jsx(J.Provider,{value:U,children:a.jsx(B.Popover,{open:d,onOpenChange:x,children:g})})}const ce=se.cva(["relative flex w-full items-center justify-between gap-2","px-4 py-2 h-9","border border-input rounded-md outline-none","bg-neutral-50 shadow-xs","dark:bg-white/5 dark:border-white/15","text-base font-normal font-sans text-foreground","data-[placeholder=true]:text-muted-foreground","focus-visible:outline-none focus-visible:border-ring dark:focus-visible:border-neutral-500 focus-visible:bg-background","focus-visible:shadow-default","data-[state=open]:border-ring","disabled:cursor-not-allowed disabled:opacity-50","transition-[background-color,border-color,box-shadow] duration-200 ease-out","[&_svg]:pointer-events-none [&_svg]:shrink-0"]),Q=t.forwardRef(({className:e,dataHook:o,error:r,trackingEl:n,trackingLabel:u,children:b,...l},g)=>{const{open:v,disabled:C,value:F}=$(),I=t.useId(),j=!F,R=r||l["aria-invalid"]===!0||l["aria-invalid"]==="true";return a.jsx(B.PopoverTrigger,{asChild:!0,children:a.jsxs("button",{ref:g,"aria-controls":v?I:void 0,"aria-expanded":v,"aria-haspopup":"listbox","aria-invalid":R?"true":void 0,className:L.cn(ce(),R&&"border-destructive-40 dark:border-destructive-40 focus-visible:border-destructive-40 dark:focus-visible:border-destructive-40 focus-visible:shadow-destructive data-[state=open]:border-destructive-40 dark:data-[state=open]:border-destructive-40 data-[state=open]:shadow-destructive",e),"data-hook":o,"data-placeholder":j,"data-slot":"combobox-trigger","data-state":v?"open":"closed","data-tracking-el":n||"combobox-trigger","data-tracking-label":u,disabled:C||l.disabled,role:"combobox",type:"button",...l,children:[b,a.jsx(H.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});Q.displayName="ComboboxTrigger";function ue({placeholder:e,className:o,displayValue:r}){const{value:n,itemLabels:u}=$(),b=n?u.get(n)||r?.(n)||n:e;return a.jsx("span",{className:L.cn("text-foreground overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",o),"data-slot":"combobox-value",children:b})}function le({dataHook:e,className:o,children:r,align:n="start",side:u="bottom",sideOffset:b,avoidCollisions:l,hideList:g=!1}){const{open:v,shouldFilter:C,filterFn:F,itemToStringValue:I}=$(),[j,R]=t.useState(null),w=t.useRef(null),y=t.useCallback(m=>{if(w.current?.(),w.current=null,!m)return;let E=!1;const D=N=>{E||(N==="top"||N==="bottom")&&(E=!0,k.disconnect(),R(N))},k=new MutationObserver(()=>{D(m.getAttribute("data-side"))});k.observe(m,{attributes:!0,attributeFilter:["data-side"]});let d=0,x=0;d=requestAnimationFrame(()=>{x=requestAnimationFrame(()=>{D(m.getAttribute("data-side"))})}),w.current=()=>{E=!0,k.disconnect(),cancelAnimationFrame(d),cancelAnimationFrame(x)}},[]);t.useEffect(()=>{if(!v){w.current?.(),w.current=null;const m=setTimeout(()=>R(null),150);return()=>clearTimeout(m)}},[v]);const h=I?F:void 0;return a.jsx(B.PopoverContent,{ref:y,align:n,"aria-label":"Options",avoidCollisions:l,className:L.cn("flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",o),collisionPadding:4,"data-slot":"combobox-popover",side:j??u,sideOffset:b,children:a.jsx(_.Command,{className:L.cn("min-h-0 flex-1 border-0 shadow-none","[&_[data-slot='command-input-wrapper']]:shrink-0",g&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:e||"combobox-command",filter:h,shouldFilter:C,children:r})})}const V=t.forwardRef(({debounceMs:e,onValueChange:o,...r},n)=>{const{setSearchValue:u,shouldFilter:b,activeDescendantId:l}=$(),g=t.useRef(void 0);Y.useDevWarning(()=>!!(e&&e>0&&b),`debounceMs is set on <ComboboxInput> but shouldFilter is true (default).
2
2
  Debounce is designed for async/server-driven search where the consumer controls the items list.
3
3
  Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`,[e,b]),Y.useDevWarning(()=>!!(e&&e>0&&r.value!==void 0),"debounceMs is set on <ComboboxInput> together with a controlled `value` prop.\nThe debounced onValueChange callback cannot update the controlled value synchronously, so the input will appear to lag behind typing.\nRemove `value` to let the input manage its own display, or remove debounceMs if you need a controlled input.",[e,r.value]),t.useEffect(()=>()=>{g.current&&clearTimeout(g.current)},[]);const v=t.useCallback(C=>{u(C),e&&e>0?(clearTimeout(g.current),g.current=setTimeout(()=>{o?.(C)},e)):o?.(C)},[e,o,u]);return a.jsx(_.CommandInput,{ref:n,"aria-activedescendant":l,"data-slot":"combobox-input",onValueChange:v,...r})});V.displayName="ComboboxInput";const X=t.forwardRef(({className:e,...o},r)=>a.jsx(_.CommandList,{ref:r,className:L.cn("min-h-0 flex-1",e),"data-slot":"combobox-list",...o}));X.displayName="ComboboxList";function de({items:e,getItemValue:o,getItemLabel:r,getItemKeywords:n,estimateSize:u=36,overscan:b=5,children:l,renderEmpty:g,className:v,dataHook:C},F){const I=t.useRef(null),{value:j,onValueChange:R,setOpen:w,shouldFilter:y,searchValue:h,filterFn:m,setActiveDescendantId:E,registerItem:D,unregisterItem:k}=$(),[d,x]=t.useState(0),N=t.useId();t.useImperativeHandle(F,()=>I.current,[]),t.useEffect(()=>{const i=r??o;for(const c of e)D(o(c),i(c));return()=>{for(const c of e)k(o(c))}},[e,o,r,D,k]);const s=t.useMemo(()=>{if(!y||!h.trim())return e;const i=[];for(const c of e){let f=r?W.defaultFilter(r(c),h):m(o(c),h);if(n)for(const P of n(c))f=Math.max(f,W.defaultFilter(P,h));f>0&&i.push({item:c,score:f})}return i.sort((c,f)=>f.score-c.score),i.map(c=>c.item)},[e,y,h,o,r,n,m]),S=ne.useVirtualizer({count:s.length,getScrollElement:()=>I.current,estimateSize:()=>u,overscan:b}),T=d>=0&&d<s.length?o(s[d]):null;t.useEffect(()=>{x(0)},[h,s.length]);const q=t.useRef(!1);t.useEffect(()=>{if(q.current||!j)return;const i=s.findIndex(c=>o(c)===j);i>=0&&(x(i),S.scrollToIndex(i,{align:"center"}),q.current=!0)},[j,s,o,S]);const M=t.useRef(!1);t.useEffect(()=>{M.current&&d>=0&&d<s.length&&S.scrollToIndex(d,{align:"auto"}),M.current=!1},[d,s.length,S]),t.useEffect(()=>{const i=I.current?.closest('[data-slot="combobox-command"]');if(!i)return;const c=f=>{switch(f.key){case"ArrowDown":f.preventDefault(),f.stopPropagation(),M.current=!0,x(P=>P<s.length-1?P+1:P);break;case"ArrowUp":f.preventDefault(),f.stopPropagation(),M.current=!0,x(P=>P>0?P-1:P);break;case"Enter":if(f.preventDefault(),f.stopPropagation(),d>=0&&d<s.length){const P=o(s[d]);R(P===j?"":P),w(!1)}break;case"Home":f.preventDefault(),f.stopPropagation(),M.current=!0,x(0);break;case"End":f.preventDefault(),f.stopPropagation(),M.current=!0,x(s.length-1);break}};return i.addEventListener("keydown",c,{capture:!0}),()=>i.removeEventListener("keydown",c,{capture:!0})},[s,d,j,R,w,o]);const A=t.useMemo(()=>{const i=new Map;return s.forEach((c,f)=>{i.set(o(c),f)}),i},[s,o]),z=t.useCallback(i=>{const c=A.get(i);c!==void 0&&x(c)},[A]),G=t.useCallback(i=>(A.get(i)??0)+1,[A]),U=s.length,p=t.useMemo(()=>({activeValue:T,onItemPointerMove:z,idPrefix:N,filteredCount:U,getItemPosition:G}),[T,z,N,U,G]),O=T!=null?`${N}item-${T}`:void 0;return t.useEffect(()=>(E(O),()=>E(void 0)),[O,E]),s.length===0?a.jsx("div",{ref:I,className:L.cn("max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",v),"data-hook":C,"data-slot":"combobox-virtual-list",role:"listbox",children:g}):a.jsx(K.Provider,{value:p,children:a.jsx("div",{ref:I,className:L.cn("max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",v),"data-hook":C,"data-slot":"combobox-virtual-list",role:"listbox",children:a.jsx("div",{className:"relative w-full",style:{height:`${S.getTotalSize()}px`},children:S.getVirtualItems().map(i=>a.jsx("div",{ref:S.measureElement,className:"absolute top-0 left-0 w-full px-2","data-index":i.index,style:{transform:`translateY(${i.start}px)`},children:l(s[i.index],i.index,h)},i.key))})})})}const fe=t.forwardRef(de),Z=t.forwardRef((e,o)=>a.jsx(_.CommandEmpty,{ref:o,"data-slot":"combobox-empty",...e}));Z.displayName="ComboboxEmpty";const ee=t.forwardRef(({children:e,...o},r)=>{const n=t.useRef(null);return Y.useDevWarning(()=>n.current?n.current.querySelectorAll('[data-slot="combobox-item"]').length>=100:!1,`ComboboxGroup contains 100+ items. Use <ComboboxVirtualList> for large datasets to avoid DOM bloat and slow renders.
4
4
  Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox"`,[e]),a.jsx(_.CommandGroup,{ref:u=>{n.current=u,typeof r=="function"?r(u):r&&(r.current=u)},"data-slot":"combobox-group",...o,children:e})});ee.displayName="ComboboxGroup";function be(e,o,r){if(!o||!o.trim())return e;const n=new RegExp(`(${o.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),u=e.split(n);return a.jsx("span",{children:u.map((b,l)=>l%2===1?a.jsx("span",{className:r,children:b},l):a.jsx(t.Fragment,{children:b},l))})}const te=t.forwardRef(({value:e,label:o,dataHook:r,children:n,className:u,highlight:b,highlightClassName:l,keywords:g,...v},C)=>{const{value:F,onValueChange:I,setOpen:j,registerItem:R,unregisterItem:w}=$(),y=t.useContext(K),h=F===e,m=t.useMemo(()=>o||(typeof n=="string"?n:typeof n=="number"?String(n):e),[o,n,e]),E=t.useRef(R),D=t.useRef(w);t.useEffect(()=>{E.current=R,D.current=w},[R,w]);const k=!!y;t.useEffect(()=>{if(!k)return E.current(e,m),()=>D.current(e)},[e,m,k]);const d=()=>{I(e===F?"":e),j(!1)},x=()=>b&&typeof n=="string"?be(n,b,l||"text-sm leading-normal font-semibold"):n;if(y){const N=y.activeValue===e,s=!!v.disabled;return a.jsxs("div",{ref:C,"aria-disabled":s||void 0,"aria-posinset":y.getItemPosition(e),"aria-selected":h,"aria-setsize":y.filteredCount,className:L.cn("data-[highlighted=true]:bg-accent data-[highlighted=true]:text-accent-foreground relative flex cursor-default items-center justify-between gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none","[&_svg]:pointer-events-none [&_svg]:shrink-0",s&&"pointer-events-none opacity-50",u),"data-highlighted":N||void 0,"data-hook":r,"data-slot":"combobox-item",id:`${y.idPrefix}item-${e}`,role:"option",tabIndex:-1,onClick:s?void 0:d,onKeyDown:s?void 0:S=>{(S.key==="Enter"||S.key===" ")&&d()},onPointerMove:s?void 0:()=>y.onItemPointerMove(e),children:[x(),h&&a.jsx(H.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})}return a.jsxs(_.CommandItem,{ref:C,className:L.cn("justify-between",u),"data-slot":"combobox-item",dataHook:r,keywords:g?[m,...g]:[m],value:e,onSelect:d,...v,children:[x(),h&&a.jsx(H.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})});te.displayName="ComboboxItem";const oe=t.forwardRef((e,o)=>a.jsx(_.CommandSeparator,{ref:o,"data-slot":"combobox-separator",...e}));oe.displayName="ComboboxSeparator";function me({className:e,children:o}){return a.jsx("div",{"aria-live":"polite",className:L.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",e),"data-slot":"combobox-loading",role:"status",children:o||a.jsxs(a.Fragment,{children:[a.jsx("div",{"aria-hidden":"true",className:"size-4 animate-spin rounded-full border-2 border-current border-t-transparent [animation-duration:0.6s]"}),"Loading..."]})})}exports.Combobox=ie;exports.ComboboxContent=le;exports.ComboboxEmpty=Z;exports.ComboboxGroup=ee;exports.ComboboxInput=V;exports.ComboboxItem=te;exports.ComboboxList=X;exports.ComboboxLoading=me;exports.ComboboxSeparator=oe;exports.ComboboxTrigger=Q;exports.ComboboxValue=ue;exports.ComboboxVirtualList=fe;
package/dist/combobox.js CHANGED
@@ -108,7 +108,7 @@ const le = Z([
108
108
  "bg-neutral-50 shadow-xs",
109
109
  "dark:bg-white/5 dark:border-white/15",
110
110
  // Typography
111
- "text-sm font-normal font-sans text-foreground",
111
+ "text-base font-normal font-sans text-foreground",
112
112
  // Placeholder state
113
113
  "data-[placeholder=true]:text-muted-foreground",
114
114
  // Focus state
@@ -181,7 +181,7 @@ function De({
181
181
  "span",
182
182
  {
183
183
  className: M(
184
- "text-foreground overflow-hidden text-sm leading-normal font-medium text-ellipsis whitespace-nowrap",
184
+ "text-foreground overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",
185
185
  o
186
186
  ),
187
187
  "data-slot": "combobox-value",
package/dist/command.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),O=require("react"),m=require("cmdk"),f=require("@brightlocal/icons"),E=require("@brightlocal/ui-components/button"),c=require("@brightlocal/ui-components/lib/utils");function G(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const d=G(O),C=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,...n},s)=>r.jsx(m.Command,{ref:s,className:c.cn("bg-popover text-popover-foreground flex w-full flex-col overflow-hidden rounded-lg border shadow-md",a),"data-hook":t,"data-slot":"command","data-tracking-el":e,"data-tracking-label":o,...n}));C.displayName="Command";const b=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,value:n,onValueChange:s,onClear:l,...i},R)=>{const u=d.useRef(null),[S,g]=d.useState("");d.useImperativeHandle(R,()=>u.current,[]);const p=n!==void 0,x=p?n:S,I=String(x).length>0,_=h=>{p||g(h),s?.(h)},q=()=>{p||g(""),s?.(""),l?.(),u.current?.focus()};return r.jsxs("div",{className:"border-base-border flex h-12 items-center gap-2 self-stretch border-b px-3","data-hook":t,"data-slot":"command-input-wrapper",children:[r.jsx(f.Search,{className:"shrink-0 opacity-50"}),r.jsx(m.Command.Input,{ref:u,className:c.cn("placeholder:text-muted-foreground flex w-full bg-transparent text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),"data-slot":"command-input","data-tracking-el":e,"data-tracking-label":o,value:x,onValueChange:_,...i}),I&&r.jsx(E.Button,{"aria-label":"Clear search",className:"text-muted-foreground hover:text-foreground",dataHook:"command-input-clear",variant:"ghost",onClick:q,children:r.jsx(f.X,{})})]})});b.displayName="CommandInput";const k=d.forwardRef(({className:a,dataHook:t,...e},o)=>r.jsx(m.Command.List,{ref:o,className:c.cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",a),"data-hook":t,"data-slot":"command-list",...e}));k.displayName="CommandList";const y=d.forwardRef(({dataHook:a,...t},e)=>{const o=d.useCallback(n=>{n?.setAttribute("role","option"),typeof e=="function"?e(n):e&&(e.current=n)},[e]);return r.jsx(m.Command.Empty,{ref:o,"aria-disabled":"true","aria-selected":"false",className:"py-6 text-center text-sm","data-hook":a,"data-slot":"command-empty",...t})});y.displayName="CommandEmpty";const v=d.forwardRef(({className:a,dataHook:t,...e},o)=>r.jsx(m.Command.Group,{ref:o,className:c.cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",a),"data-hook":t,"data-slot":"command-group",...e}));v.displayName="CommandGroup";const N=d.forwardRef(({className:a,dataHook:t,...e},o)=>r.jsx(m.Command.Separator,{ref:o,className:c.cn("bg-border -mx-1 h-px",a),"data-hook":t,"data-slot":"command-separator",...e}));N.displayName="CommandSeparator";const j=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,selected:n,children:s,...l},i)=>r.jsxs(m.Command.Item,{ref:i,className:c.cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",a),"data-hook":t,"data-selected-item":n||void 0,"data-slot":"command-item","data-tracking-el":e,"data-tracking-label":o,...l,children:[s,n&&r.jsx(f.Check,{className:"text-foreground ml-auto"})]}));j.displayName="CommandItem";const w=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,...n},s)=>r.jsx("span",{ref:s,className:c.cn("text-muted-foreground ml-auto text-xs tracking-widest",a),"data-hook":t,"data-slot":"command-shortcut","data-tracking-el":e,"data-tracking-label":o,...n}));w.displayName="CommandShortcut";exports.Command=C;exports.CommandEmpty=y;exports.CommandGroup=v;exports.CommandInput=b;exports.CommandItem=j;exports.CommandList=k;exports.CommandSeparator=N;exports.CommandShortcut=w;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const r=require("react/jsx-runtime"),O=require("react"),m=require("cmdk"),f=require("@brightlocal/icons"),E=require("@brightlocal/ui-components/button"),c=require("@brightlocal/ui-components/lib/utils");function G(a){const t=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(a){for(const e in a)if(e!=="default"){const o=Object.getOwnPropertyDescriptor(a,e);Object.defineProperty(t,e,o.get?o:{enumerable:!0,get:()=>a[e]})}}return t.default=a,Object.freeze(t)}const d=G(O),C=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,...n},s)=>r.jsx(m.Command,{ref:s,className:c.cn("bg-popover text-popover-foreground flex w-full flex-col overflow-hidden rounded-lg border shadow-md",a),"data-hook":t,"data-slot":"command","data-tracking-el":e,"data-tracking-label":o,...n}));C.displayName="Command";const b=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,value:n,onValueChange:s,onClear:l,...i},R)=>{const u=d.useRef(null),[S,g]=d.useState("");d.useImperativeHandle(R,()=>u.current,[]);const p=n!==void 0,x=p?n:S,I=String(x).length>0,_=h=>{p||g(h),s?.(h)},q=()=>{p||g(""),s?.(""),l?.(),u.current?.focus()};return r.jsxs("div",{className:"border-base-border flex h-12 items-center gap-2 self-stretch border-b px-3","data-hook":t,"data-slot":"command-input-wrapper",children:[r.jsx(f.Search,{className:"shrink-0 opacity-50"}),r.jsx(m.Command.Input,{ref:u,className:c.cn("placeholder:text-muted-foreground flex w-full bg-transparent text-base outline-hidden disabled:cursor-not-allowed disabled:opacity-50",a),"data-slot":"command-input","data-tracking-el":e,"data-tracking-label":o,value:x,onValueChange:_,...i}),I&&r.jsx(E.Button,{"aria-label":"Clear search",className:"text-muted-foreground hover:text-foreground",dataHook:"command-input-clear",variant:"ghost",onClick:q,children:r.jsx(f.X,{})})]})});b.displayName="CommandInput";const k=d.forwardRef(({className:a,dataHook:t,...e},o)=>r.jsx(m.Command.List,{ref:o,className:c.cn("max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",a),"data-hook":t,"data-slot":"command-list",...e}));k.displayName="CommandList";const y=d.forwardRef(({dataHook:a,...t},e)=>{const o=d.useCallback(n=>{n?.setAttribute("role","option"),typeof e=="function"?e(n):e&&(e.current=n)},[e]);return r.jsx(m.Command.Empty,{ref:o,"aria-disabled":"true","aria-selected":"false",className:"py-6 text-center text-sm","data-hook":a,"data-slot":"command-empty",...t})});y.displayName="CommandEmpty";const v=d.forwardRef(({className:a,dataHook:t,...e},o)=>r.jsx(m.Command.Group,{ref:o,className:c.cn("text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",a),"data-hook":t,"data-slot":"command-group",...e}));v.displayName="CommandGroup";const N=d.forwardRef(({className:a,dataHook:t,...e},o)=>r.jsx(m.Command.Separator,{ref:o,className:c.cn("bg-border -mx-1 h-px",a),"data-hook":t,"data-slot":"command-separator",...e}));N.displayName="CommandSeparator";const j=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,selected:n,children:s,...l},i)=>r.jsxs(m.Command.Item,{ref:i,className:c.cn("data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",a),"data-hook":t,"data-selected-item":n||void 0,"data-slot":"command-item","data-tracking-el":e,"data-tracking-label":o,...l,children:[s,n&&r.jsx(f.Check,{className:"text-foreground ml-auto"})]}));j.displayName="CommandItem";const w=d.forwardRef(({className:a,dataHook:t,trackingEl:e,trackingLabel:o,...n},s)=>r.jsx("span",{ref:s,className:c.cn("text-muted-foreground ml-auto text-xs tracking-widest",a),"data-hook":t,"data-slot":"command-shortcut","data-tracking-el":e,"data-tracking-label":o,...n}));w.displayName="CommandShortcut";exports.Command=C;exports.CommandEmpty=y;exports.CommandGroup=v;exports.CommandInput=b;exports.CommandItem=j;exports.CommandList=k;exports.CommandSeparator=N;exports.CommandShortcut=w;
package/dist/command.js CHANGED
@@ -4,15 +4,15 @@ import { Command as s } from "cmdk";
4
4
  import { Search as v, X as w, Check as R } from "@brightlocal/icons";
5
5
  import { Button as I } from "@brightlocal/ui-components/button";
6
6
  import { cn as l } from "@brightlocal/ui-components/lib/utils";
7
- const S = r.forwardRef(({ className: t, dataHook: e, trackingEl: a, trackingLabel: o, ...d }, m) => /* @__PURE__ */ n(
7
+ const S = r.forwardRef(({ className: e, dataHook: t, trackingEl: a, trackingLabel: o, ...d }, m) => /* @__PURE__ */ n(
8
8
  s,
9
9
  {
10
10
  ref: m,
11
11
  className: l(
12
12
  "bg-popover text-popover-foreground flex w-full flex-col overflow-hidden rounded-lg border shadow-md",
13
- t
13
+ e
14
14
  ),
15
- "data-hook": e,
15
+ "data-hook": t,
16
16
  "data-slot": "command",
17
17
  "data-tracking-el": a,
18
18
  "data-tracking-label": o,
@@ -22,8 +22,8 @@ const S = r.forwardRef(({ className: t, dataHook: e, trackingEl: a, trackingLabe
22
22
  S.displayName = "Command";
23
23
  const _ = r.forwardRef(
24
24
  ({
25
- className: t,
26
- dataHook: e,
25
+ className: e,
26
+ dataHook: t,
27
27
  trackingEl: a,
28
28
  trackingLabel: o,
29
29
  value: d,
@@ -42,7 +42,7 @@ const _ = r.forwardRef(
42
42
  "div",
43
43
  {
44
44
  className: "border-base-border flex h-12 items-center gap-2 self-stretch border-b px-3",
45
- "data-hook": e,
45
+ "data-hook": t,
46
46
  "data-slot": "command-input-wrapper",
47
47
  children: [
48
48
  /* @__PURE__ */ n(v, { className: "shrink-0 opacity-50" }),
@@ -51,8 +51,8 @@ const _ = r.forwardRef(
51
51
  {
52
52
  ref: u,
53
53
  className: l(
54
- "placeholder:text-muted-foreground flex w-full bg-transparent text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
55
- t
54
+ "placeholder:text-muted-foreground flex w-full bg-transparent text-base outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
55
+ e
56
56
  ),
57
57
  "data-slot": "command-input",
58
58
  "data-tracking-el": a,
@@ -79,21 +79,21 @@ const _ = r.forwardRef(
79
79
  }
80
80
  );
81
81
  _.displayName = "CommandInput";
82
- const E = r.forwardRef(({ className: t, dataHook: e, ...a }, o) => /* @__PURE__ */ n(
82
+ const E = r.forwardRef(({ className: e, dataHook: t, ...a }, o) => /* @__PURE__ */ n(
83
83
  s.List,
84
84
  {
85
85
  ref: o,
86
86
  className: l(
87
87
  "max-h-[300px] scroll-py-1 overflow-x-hidden overflow-y-auto",
88
- t
88
+ e
89
89
  ),
90
- "data-hook": e,
90
+ "data-hook": t,
91
91
  "data-slot": "command-list",
92
92
  ...a
93
93
  }
94
94
  ));
95
95
  E.displayName = "CommandList";
96
- const G = r.forwardRef(({ dataHook: t, ...e }, a) => {
96
+ const G = r.forwardRef(({ dataHook: e, ...t }, a) => {
97
97
  const o = r.useCallback(
98
98
  (d) => {
99
99
  d?.setAttribute("role", "option"), typeof a == "function" ? a(d) : a && (a.current = d);
@@ -107,33 +107,33 @@ const G = r.forwardRef(({ dataHook: t, ...e }, a) => {
107
107
  "aria-disabled": "true",
108
108
  "aria-selected": "false",
109
109
  className: "py-6 text-center text-sm",
110
- "data-hook": t,
110
+ "data-hook": e,
111
111
  "data-slot": "command-empty",
112
- ...e
112
+ ...t
113
113
  }
114
114
  );
115
115
  });
116
116
  G.displayName = "CommandEmpty";
117
- const L = r.forwardRef(({ className: t, dataHook: e, ...a }, o) => /* @__PURE__ */ n(
117
+ const L = r.forwardRef(({ className: e, dataHook: t, ...a }, o) => /* @__PURE__ */ n(
118
118
  s.Group,
119
119
  {
120
120
  ref: o,
121
121
  className: l(
122
122
  "text-foreground [&_[cmdk-group-heading]]:text-muted-foreground overflow-hidden px-2 py-1 [&_[cmdk-group-heading]]:px-2 [&_[cmdk-group-heading]]:py-1.5 [&_[cmdk-group-heading]]:text-xs [&_[cmdk-group-heading]]:font-medium",
123
- t
123
+ e
124
124
  ),
125
- "data-hook": e,
125
+ "data-hook": t,
126
126
  "data-slot": "command-group",
127
127
  ...a
128
128
  }
129
129
  ));
130
130
  L.displayName = "CommandGroup";
131
- const j = r.forwardRef(({ className: t, dataHook: e, ...a }, o) => /* @__PURE__ */ n(
131
+ const j = r.forwardRef(({ className: e, dataHook: t, ...a }, o) => /* @__PURE__ */ n(
132
132
  s.Separator,
133
133
  {
134
134
  ref: o,
135
- className: l("bg-border -mx-1 h-px", t),
136
- "data-hook": e,
135
+ className: l("bg-border -mx-1 h-px", e),
136
+ "data-hook": t,
137
137
  "data-slot": "command-separator",
138
138
  ...a
139
139
  }
@@ -141,8 +141,8 @@ const j = r.forwardRef(({ className: t, dataHook: e, ...a }, o) => /* @__PURE__
141
141
  j.displayName = "CommandSeparator";
142
142
  const B = r.forwardRef(
143
143
  ({
144
- className: t,
145
- dataHook: e,
144
+ className: e,
145
+ dataHook: t,
146
146
  trackingEl: a,
147
147
  trackingLabel: o,
148
148
  selected: d,
@@ -154,9 +154,9 @@ const B = r.forwardRef(
154
154
  ref: i,
155
155
  className: l(
156
156
  "data-[selected=true]:bg-accent data-[selected=true]:text-accent-foreground data-[disabled=true]:text-muted-foreground relative flex cursor-default items-center gap-2 rounded-sm px-2 py-3 text-sm outline-hidden select-none data-[disabled=true]:pointer-events-none data-[disabled=true]:opacity-50 [&_svg]:pointer-events-none [&_svg]:shrink-0",
157
- t
157
+ e
158
158
  ),
159
- "data-hook": e,
159
+ "data-hook": t,
160
160
  "data-selected-item": d || void 0,
161
161
  "data-slot": "command-item",
162
162
  "data-tracking-el": a,
@@ -171,15 +171,15 @@ const B = r.forwardRef(
171
171
  );
172
172
  B.displayName = "CommandItem";
173
173
  const H = r.forwardRef(
174
- ({ className: t, dataHook: e, trackingEl: a, trackingLabel: o, ...d }, m) => /* @__PURE__ */ n(
174
+ ({ className: e, dataHook: t, trackingEl: a, trackingLabel: o, ...d }, m) => /* @__PURE__ */ n(
175
175
  "span",
176
176
  {
177
177
  ref: m,
178
178
  className: l(
179
179
  "text-muted-foreground ml-auto text-xs tracking-widest",
180
- t
180
+ e
181
181
  ),
182
- "data-hook": e,
182
+ "data-hook": t,
183
183
  "data-slot": "command-shortcut",
184
184
  "data-tracking-el": a,
185
185
  "data-tracking-label": o,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),F=require("react"),q=require("class-variance-authority"),D=require("@brightlocal/ui-components/lib/utils"),E=require("@brightlocal/ui-components/chip");function N(s){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(f,n,a.get?a:{enumerable:!0,get:()=>s[n]})}}return f.default=s,Object.freeze(f)}const u=N(F),S=u.createContext(null);function V(){const s=u.useContext(S);if(!s)throw new Error("InputChip components must be used within an <InputChip>");return s}function O({value:s,defaultValue:f=[],onValueChange:n,disabled:a=!1,allowDuplicates:h=!1,children:d}){const[o,i]=u.useState(f),[l,v]=u.useState(""),[g,m]=u.useState(-1),t=u.useRef(null),e=u.useRef([]),c=s!==void 0,r=c?s:o;u.useEffect(()=>{e.current.length>r.length&&(e.current.length=r.length),g>=r.length&&m(-1)},[r.length,g]);const b=u.useCallback(C=>{c||i(C),n?.(C)},[c,n]),R=u.useCallback(C=>{if(a)return;const I=C.trim();I&&(h||!r.includes(I))&&(b([...r,I]),v(""))},[r,b,h,a]),y=u.useCallback(C=>{a||b(r.filter((I,p)=>p!==C))},[r,b,a]),x=u.useMemo(()=>({value:r,onValueChange:b,inputValue:l,setInputValue:v,disabled:a,addItem:R,removeItem:y,inputRef:t,focusedChipIndex:g,setFocusedChipIndex:m,chipRefs:e}),[r,b,l,v,a,R,y,t,g,m,e]);return w.jsx(S.Provider,{value:x,children:d})}const j=q.cva(["relative flex w-full flex-wrap items-center gap-1","min-h-9 rounded-sm border border-input bg-background","px-3 py-2","has-[:focus-visible]:border-ring has-[:focus-visible]:bg-background","has-[:focus-visible]:shadow-default","has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50","transition-[color,box-shadow,border-color]","duration-150","ease-in-out"],{variants:{error:{true:["border-destructive-40","has-[:focus-visible]:border-destructive-40 has-[:focus-visible]:shadow-destructive"],false:""}},defaultVariants:{error:!1}}),$=["flex-1 min-w-20","bg-transparent","border-0 outline-none","text-sm font-sans","text-foreground","placeholder:text-muted-foreground","focus:outline-none focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"],A=u.forwardRef(({className:s,error:f=!1,dataHook:n,trackingEl:a,trackingLabel:h,placeholder:d,inputId:o,"aria-label":i,"aria-labelledby":l,children:v,...g},m)=>{const{value:t,inputValue:e,setInputValue:c,disabled:r,addItem:b,inputRef:R,setFocusedChipIndex:y,chipRefs:x}=V(),C=p=>{c(p.target.value)},I=p=>{if(p.key==="Enter"&&e.trim()&&(p.preventDefault(),b(e)),p.key==="ArrowLeft"&&!e&&t.length>0){p.preventDefault();const k=t.length-1;y(k),x.current[k]?.focus()}if(p.key==="Backspace"&&!e&&t.length>0){p.preventDefault();const k=t.length-1;y(k),x.current[k]?.focus()}};return w.jsxs("div",{ref:m,className:D.cn(j({error:f}),s),"data-hook":n,"data-slot":"input-chip","data-tracking-el":a,"data-tracking-label":h,...g,children:[v,w.jsx("input",{ref:R,"aria-label":i,"aria-labelledby":l,className:D.cn($),"data-slot":"input-chip-input",disabled:r,id:o,placeholder:d,type:"text",value:e,onChange:C,onKeyDown:I})]})});A.displayName="InputChipInput";function B({className:s,dataHookPrefix:f="chip"}){const{value:n,disabled:a,removeItem:h,inputRef:d,setFocusedChipIndex:o,chipRefs:i}=V(),l=u.useRef(null);u.useEffect(()=>{if(l.current!==null){if(l.current==="input")d.current?.focus();else{const t=l.current;t>=0&&t<n.length?i.current[t]?.focus():n.length>0?i.current[n.length-1]?.focus():d.current?.focus()}l.current=null}},[n.length,d,i]);const v=(t,e)=>{if(!a)switch(t.key){case"ArrowLeft":t.preventDefault(),e>0&&(o(e-1),i.current[e-1]?.focus());break;case"ArrowRight":t.preventDefault(),e<n.length-1?(o(e+1),i.current[e+1]?.focus()):(o(-1),d.current?.focus());break;case"Backspace":case"Delete":{t.preventDefault();const c=n.length-1;if(c===0)o(-1),l.current="input",h(e);else if(e>=c){const r=c-1;o(r),l.current=r,h(e)}else o(e),l.current=e,h(e);break}case"Home":t.preventDefault(),n.length>0&&(o(0),i.current[0]?.focus());break;case"End":t.preventDefault(),o(-1),d.current?.focus();break}},g=t=>{o(t)},m=t=>{const e=t.relatedTarget;e&&(e.closest('[data-slot="chip"]')!==null||e.dataset.slot==="input-chip-input")||o(-1)};return n.length===0?null:w.jsx("div",{className:D.cn("contents",s),"data-slot":"input-chip-items",children:n.map((t,e)=>w.jsx(E.Chip,{ref:c=>{i.current[e]=c},"aria-label":`${t}, press Delete to remove`,dataHook:`${f}-${e}`,disabled:a,role:"group",tabIndex:-1,onBlur:m,onFocus:()=>g(e),onKeyDown:c=>v(c,e),onRemove:()=>h(e),children:t},`${t}-${e}`))})}const K=j;exports.InputChip=O;exports.InputChipInput=A;exports.InputChipItems=B;exports.inputChipInputVariants=j;exports.inputChipVariants=K;exports.useInputChipContext=V;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const w=require("react/jsx-runtime"),F=require("react"),q=require("class-variance-authority"),D=require("@brightlocal/ui-components/lib/utils"),E=require("@brightlocal/ui-components/chip");function N(s){const f=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(s){for(const n in s)if(n!=="default"){const a=Object.getOwnPropertyDescriptor(s,n);Object.defineProperty(f,n,a.get?a:{enumerable:!0,get:()=>s[n]})}}return f.default=s,Object.freeze(f)}const u=N(F),S=u.createContext(null);function V(){const s=u.useContext(S);if(!s)throw new Error("InputChip components must be used within an <InputChip>");return s}function O({value:s,defaultValue:f=[],onValueChange:n,disabled:a=!1,allowDuplicates:h=!1,children:d}){const[o,i]=u.useState(f),[l,v]=u.useState(""),[b,I]=u.useState(-1),t=u.useRef(null),e=u.useRef([]),c=s!==void 0,r=c?s:o;u.useEffect(()=>{e.current.length>r.length&&(e.current.length=r.length),b>=r.length&&I(-1)},[r.length,b]);const g=u.useCallback(C=>{c||i(C),n?.(C)},[c,n]),R=u.useCallback(C=>{if(a)return;const m=C.trim();m&&(h||!r.includes(m))&&(g([...r,m]),v(""))},[r,g,h,a]),y=u.useCallback(C=>{a||g(r.filter((m,p)=>p!==C))},[r,g,a]),x=u.useMemo(()=>({value:r,onValueChange:g,inputValue:l,setInputValue:v,disabled:a,addItem:R,removeItem:y,inputRef:t,focusedChipIndex:b,setFocusedChipIndex:I,chipRefs:e}),[r,g,l,v,a,R,y,t,b,I,e]);return w.jsx(S.Provider,{value:x,children:d})}const j=q.cva(["relative flex w-full flex-wrap items-center gap-1","min-h-9 rounded-sm border border-input bg-background","px-3 py-2","has-[:focus-visible]:border-ring has-[:focus-visible]:bg-background","has-[:focus-visible]:shadow-default","has-[:disabled]:cursor-not-allowed has-[:disabled]:opacity-50","transition-[color,box-shadow,border-color]","duration-150","ease-in-out"],{variants:{error:{true:["border-destructive-40","has-[:focus-visible]:border-destructive-40 has-[:focus-visible]:shadow-destructive"],false:""}},defaultVariants:{error:!1}}),$=["flex-1 min-w-20","bg-transparent","border-0 outline-none","text-base font-sans","text-foreground","placeholder:text-muted-foreground","focus:outline-none focus-visible:outline-none","disabled:cursor-not-allowed disabled:opacity-50"],A=u.forwardRef(({className:s,error:f=!1,dataHook:n,trackingEl:a,trackingLabel:h,placeholder:d,inputId:o,"aria-label":i,"aria-labelledby":l,children:v,...b},I)=>{const{value:t,inputValue:e,setInputValue:c,disabled:r,addItem:g,inputRef:R,setFocusedChipIndex:y,chipRefs:x}=V(),C=p=>{c(p.target.value)},m=p=>{if(p.key==="Enter"&&e.trim()&&(p.preventDefault(),g(e)),p.key==="ArrowLeft"&&!e&&t.length>0){p.preventDefault();const k=t.length-1;y(k),x.current[k]?.focus()}if(p.key==="Backspace"&&!e&&t.length>0){p.preventDefault();const k=t.length-1;y(k),x.current[k]?.focus()}};return w.jsxs("div",{ref:I,className:D.cn(j({error:f}),s),"data-hook":n,"data-slot":"input-chip","data-tracking-el":a,"data-tracking-label":h,...b,children:[v,w.jsx("input",{ref:R,"aria-label":i,"aria-labelledby":l,className:D.cn($),"data-slot":"input-chip-input",disabled:r,id:o,placeholder:d,type:"text",value:e,onChange:C,onKeyDown:m})]})});A.displayName="InputChipInput";function B({className:s,dataHookPrefix:f="chip"}){const{value:n,disabled:a,removeItem:h,inputRef:d,setFocusedChipIndex:o,chipRefs:i}=V(),l=u.useRef(null);u.useEffect(()=>{if(l.current!==null){if(l.current==="input")d.current?.focus();else{const t=l.current;t>=0&&t<n.length?i.current[t]?.focus():n.length>0?i.current[n.length-1]?.focus():d.current?.focus()}l.current=null}},[n.length,d,i]);const v=(t,e)=>{if(!a)switch(t.key){case"ArrowLeft":t.preventDefault(),e>0&&(o(e-1),i.current[e-1]?.focus());break;case"ArrowRight":t.preventDefault(),e<n.length-1?(o(e+1),i.current[e+1]?.focus()):(o(-1),d.current?.focus());break;case"Backspace":case"Delete":{t.preventDefault();const c=n.length-1;if(c===0)o(-1),l.current="input",h(e);else if(e>=c){const r=c-1;o(r),l.current=r,h(e)}else o(e),l.current=e,h(e);break}case"Home":t.preventDefault(),n.length>0&&(o(0),i.current[0]?.focus());break;case"End":t.preventDefault(),o(-1),d.current?.focus();break}},b=t=>{o(t)},I=t=>{const e=t.relatedTarget;e&&(e.closest('[data-slot="chip"]')!==null||e.dataset.slot==="input-chip-input")||o(-1)};return n.length===0?null:w.jsx("div",{className:D.cn("contents",s),"data-slot":"input-chip-items",children:n.map((t,e)=>w.jsx(E.Chip,{ref:c=>{i.current[e]=c},"aria-label":`${t}, press Delete to remove`,dataHook:`${f}-${e}`,disabled:a,role:"group",tabIndex:-1,onBlur:I,onFocus:()=>b(e),onKeyDown:c=>v(c,e),onRemove:()=>h(e),children:t},`${t}-${e}`))})}const K=j;exports.InputChip=O;exports.InputChipInput=A;exports.InputChipItems=B;exports.inputChipInputVariants=j;exports.inputChipVariants=K;exports.useInputChipContext=V;
@@ -108,7 +108,7 @@ const A = $(
108
108
  "bg-transparent",
109
109
  "border-0 outline-none",
110
110
  // Typography
111
- "text-sm font-sans",
111
+ "text-base font-sans",
112
112
  "text-foreground",
113
113
  // Placeholder
114
114
  "placeholder:text-muted-foreground",
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("react"),l=require("input-otp"),_=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils");function y(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const i=y(S),g=i.createContext(null);function v(){const t=i.useContext(g);if(!t)throw new Error("InputOTP components must be used within an <InputOTP>");return t}const p=i.forwardRef(({dataHook:t,trackingEl:n,trackingLabel:o,containerClassName:r,error:a,disabled:u,children:s,...c},P)=>{const O=i.useMemo(()=>({error:a,disabled:u}),[a,u]);return e.jsx(g.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:P,"aria-invalid":a?"true":void 0,className:"disabled:cursor-not-allowed",containerClassName:x.cn("group flex items-center gap-2 has-disabled:opacity-50 w-fit",r),"data-hook":t,"data-slot":"input-otp","data-tracking-el":n,"data-tracking-label":o,disabled:u,...c,children:s})})});p.displayName="InputOTP";function f({className:t,...n}){return e.jsx("div",{className:x.cn("flex items-center rounded-md shadow-xs",t),"data-slot":"input-otp-group",...n})}function d({index:t,className:n,...o}){const{error:r}=v(),a=i.useContext(l.OTPInputContext),{char:u,hasFakeCaret:s,isActive:c}=a?.slots[t]??{};return e.jsxs("div",{className:x.cn("relative flex h-9 w-9 items-center justify-center","border-input bg-background border-y border-r","text-foreground text-sm font-normal transition-[border-color,box-shadow] outline-none","first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:border-ring data-[active=true]:z-10","data-[active=true]:shadow-default",r&&"border-destructive-40",r&&"data-[active=true]:border-destructive-40 data-[active=true]:shadow-destructive","dark:bg-input/30",n),"data-active":c,"data-error":r,"data-slot":"input-otp-slot",...o,children:[u,s&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function m({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(_.Minus,{})})}const h=i.forwardRef(({maxLength:t=6,...n},o)=>e.jsx(p,{ref:o,inputMode:"numeric",maxLength:t,pasteTransformer:r=>r.replace(/\D+/g,"").slice(0,t),pattern:l.REGEXP_ONLY_DIGITS,...n,children:e.jsx(f,{children:Array.from({length:t},(r,a)=>e.jsx(d,{index:a},a))})}));h.displayName="InputOTPDigitsOnly";const T=i.forwardRef(({maxLength:t=4,...n},o)=>e.jsx(p,{ref:o,containerClassName:"gap-2",maxLength:t,...n,children:Array.from({length:t},(r,a)=>e.jsx(d,{className:"rounded-md border-l shadow-xs",index:a},a))}));T.displayName="InputOTPWithSpacing";const j=i.forwardRef(({maxLength:t=6,...n},o)=>{const r=Math.ceil(t/2),a=t-r;return e.jsxs(p,{ref:o,maxLength:t,...n,children:[e.jsx(f,{children:Array.from({length:r},(u,s)=>e.jsx(d,{index:s},s))}),e.jsx(m,{}),e.jsx(f,{children:Array.from({length:a},(u,s)=>e.jsx(d,{index:s+r},s+r))})]})});j.displayName="InputOTPSimple";const b=i.forwardRef(({maxLength:t=6,...n},o)=>{const a=Math.ceil(t/2);return e.jsx(p,{ref:o,maxLength:t,...n,children:Array.from({length:a},(u,s)=>{const c=s*2,O=Math.min(c+2,t)-c;return e.jsxs(i.Fragment,{children:[s>0&&e.jsx(m,{}),e.jsx(f,{children:Array.from({length:O},(N,I)=>e.jsx(d,{index:c+I},c+I))})]},s)})})});b.displayName="InputOTPWithSeparator";Object.defineProperty(exports,"REGEXP_ONLY_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_CHARS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS_AND_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS_AND_CHARS});exports.InputOTP=p;exports.InputOTPDigitsOnly=h;exports.InputOTPGroup=f;exports.InputOTPSeparator=m;exports.InputOTPSimple=j;exports.InputOTPSlot=d;exports.InputOTPWithSeparator=b;exports.InputOTPWithSpacing=T;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const e=require("react/jsx-runtime"),S=require("react"),l=require("input-otp"),_=require("@brightlocal/icons"),x=require("@brightlocal/ui-components/lib/utils");function y(t){const n=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const o in t)if(o!=="default"){const r=Object.getOwnPropertyDescriptor(t,o);Object.defineProperty(n,o,r.get?r:{enumerable:!0,get:()=>t[o]})}}return n.default=t,Object.freeze(n)}const i=y(S),g=i.createContext(null);function v(){const t=i.useContext(g);if(!t)throw new Error("InputOTP components must be used within an <InputOTP>");return t}const p=i.forwardRef(({dataHook:t,trackingEl:n,trackingLabel:o,containerClassName:r,error:a,disabled:u,children:s,...c},m)=>{const O=i.useMemo(()=>({error:a,disabled:u}),[a,u]);return e.jsx(g.Provider,{value:O,children:e.jsx(l.OTPInput,{ref:m,"aria-invalid":a?"true":void 0,className:"disabled:cursor-not-allowed",containerClassName:x.cn("group flex items-center gap-2 has-disabled:opacity-50 w-fit",r),"data-hook":t,"data-slot":"input-otp","data-tracking-el":n,"data-tracking-label":o,disabled:u,...c,children:s})})});p.displayName="InputOTP";function f({className:t,...n}){return e.jsx("div",{className:x.cn("flex items-center rounded-md shadow-xs",t),"data-slot":"input-otp-group",...n})}function d({index:t,className:n,...o}){const{error:r}=v(),a=i.useContext(l.OTPInputContext),{char:u,hasFakeCaret:s,isActive:c}=a?.slots[t]??{};return e.jsxs("div",{className:x.cn("relative flex h-9 w-9 items-center justify-center","border-input bg-background border-y border-r","text-foreground text-base font-normal transition-[border-color,box-shadow] outline-none","first:rounded-l-md first:border-l last:rounded-r-md","data-[active=true]:border-ring data-[active=true]:z-10","data-[active=true]:shadow-default",r&&"border-destructive-40",r&&"data-[active=true]:border-destructive-40 data-[active=true]:shadow-destructive","dark:bg-input/30",n),"data-active":c,"data-error":r,"data-slot":"input-otp-slot",...o,children:[u,s&&e.jsx("div",{className:"pointer-events-none absolute inset-0 flex items-center justify-center",children:e.jsx("div",{className:"animate-caret-blink bg-foreground h-4 w-px duration-1000"})})]})}function P({...t}){return e.jsx("div",{"data-slot":"input-otp-separator",role:"separator",...t,children:e.jsx(_.Minus,{})})}const h=i.forwardRef(({maxLength:t=6,...n},o)=>e.jsx(p,{ref:o,inputMode:"numeric",maxLength:t,pasteTransformer:r=>r.replace(/\D+/g,"").slice(0,t),pattern:l.REGEXP_ONLY_DIGITS,...n,children:e.jsx(f,{children:Array.from({length:t},(r,a)=>e.jsx(d,{index:a},a))})}));h.displayName="InputOTPDigitsOnly";const T=i.forwardRef(({maxLength:t=4,...n},o)=>e.jsx(p,{ref:o,containerClassName:"gap-2",maxLength:t,...n,children:Array.from({length:t},(r,a)=>e.jsx(d,{className:"rounded-md border-l shadow-xs",index:a},a))}));T.displayName="InputOTPWithSpacing";const j=i.forwardRef(({maxLength:t=6,...n},o)=>{const r=Math.ceil(t/2),a=t-r;return e.jsxs(p,{ref:o,maxLength:t,...n,children:[e.jsx(f,{children:Array.from({length:r},(u,s)=>e.jsx(d,{index:s},s))}),e.jsx(P,{}),e.jsx(f,{children:Array.from({length:a},(u,s)=>e.jsx(d,{index:s+r},s+r))})]})});j.displayName="InputOTPSimple";const b=i.forwardRef(({maxLength:t=6,...n},o)=>{const a=Math.ceil(t/2);return e.jsx(p,{ref:o,maxLength:t,...n,children:Array.from({length:a},(u,s)=>{const c=s*2,O=Math.min(c+2,t)-c;return e.jsxs(i.Fragment,{children:[s>0&&e.jsx(P,{}),e.jsx(f,{children:Array.from({length:O},(N,I)=>e.jsx(d,{index:c+I},c+I))})]},s)})})});b.displayName="InputOTPWithSeparator";Object.defineProperty(exports,"REGEXP_ONLY_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_CHARS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS});Object.defineProperty(exports,"REGEXP_ONLY_DIGITS_AND_CHARS",{enumerable:!0,get:()=>l.REGEXP_ONLY_DIGITS_AND_CHARS});exports.InputOTP=p;exports.InputOTPDigitsOnly=h;exports.InputOTPGroup=f;exports.InputOTPSeparator=P;exports.InputOTPSimple=j;exports.InputOTPSlot=d;exports.InputOTPWithSeparator=b;exports.InputOTPWithSpacing=T;
package/dist/input-otp.js CHANGED
@@ -1,4 +1,4 @@
1
- import { jsx as e, jsxs as f } from "react/jsx-runtime";
1
+ import { jsx as e, jsxs as m } from "react/jsx-runtime";
2
2
  import * as s from "react";
3
3
  import { OTPInput as T, REGEXP_ONLY_DIGITS as x, OTPInputContext as v } from "input-otp";
4
4
  import { REGEXP_ONLY_CHARS as M, REGEXP_ONLY_DIGITS as z, REGEXP_ONLY_DIGITS_AND_CHARS as j } from "input-otp";
@@ -22,11 +22,11 @@ const l = s.forwardRef(
22
22
  children: a,
23
23
  ...u
24
24
  }, I) => {
25
- const m = s.useMemo(
25
+ const f = s.useMemo(
26
26
  () => ({ error: n, disabled: d }),
27
27
  [n, d]
28
28
  );
29
- return /* @__PURE__ */ e(g.Provider, { value: m, children: /* @__PURE__ */ e(
29
+ return /* @__PURE__ */ e(g.Provider, { value: f, children: /* @__PURE__ */ e(
30
30
  T,
31
31
  {
32
32
  ref: I,
@@ -62,14 +62,14 @@ function c({ index: t, className: o, ...i }) {
62
62
  const { error: r } = N(), n = s.useContext(
63
63
  v
64
64
  ), { char: d, hasFakeCaret: a, isActive: u } = n?.slots[t] ?? {};
65
- return /* @__PURE__ */ f(
65
+ return /* @__PURE__ */ m(
66
66
  "div",
67
67
  {
68
68
  className: h(
69
69
  // Base styles
70
70
  "relative flex h-9 w-9 items-center justify-center",
71
71
  "border-input bg-background border-y border-r",
72
- "text-foreground text-sm font-normal transition-[border-color,box-shadow] outline-none",
72
+ "text-foreground text-base font-normal transition-[border-color,box-shadow] outline-none",
73
73
  "first:rounded-l-md first:border-l last:rounded-r-md",
74
74
  // Focus state
75
75
  "data-[active=true]:border-ring data-[active=true]:z-10",
@@ -129,7 +129,7 @@ y.displayName = "InputOTPWithSpacing";
129
129
  const S = s.forwardRef(
130
130
  ({ maxLength: t = 6, ...o }, i) => {
131
131
  const r = Math.ceil(t / 2), n = t - r;
132
- return /* @__PURE__ */ f(l, { ref: i, maxLength: t, ...o, children: [
132
+ return /* @__PURE__ */ m(l, { ref: i, maxLength: t, ...o, children: [
133
133
  /* @__PURE__ */ e(p, { children: Array.from({ length: r }, (d, a) => /* @__PURE__ */ e(c, { index: a }, a)) }),
134
134
  /* @__PURE__ */ e(P, {}),
135
135
  /* @__PURE__ */ e(p, { children: Array.from({ length: n }, (d, a) => /* @__PURE__ */ e(
@@ -146,10 +146,10 @@ S.displayName = "InputOTPSimple";
146
146
  const _ = s.forwardRef(({ maxLength: t = 6, ...o }, i) => {
147
147
  const n = Math.ceil(t / 2);
148
148
  return /* @__PURE__ */ e(l, { ref: i, maxLength: t, ...o, children: Array.from({ length: n }, (d, a) => {
149
- const u = a * 2, m = Math.min(u + 2, t) - u;
150
- return /* @__PURE__ */ f(s.Fragment, { children: [
149
+ const u = a * 2, f = Math.min(u + 2, t) - u;
150
+ return /* @__PURE__ */ m(s.Fragment, { children: [
151
151
  a > 0 && /* @__PURE__ */ e(P, {}),
152
- /* @__PURE__ */ e(p, { children: Array.from({ length: m }, (C, O) => /* @__PURE__ */ e(c, { index: u + O }, u + O)) })
152
+ /* @__PURE__ */ e(p, { children: Array.from({ length: f }, (C, O) => /* @__PURE__ */ e(c, { index: u + O }, u + O)) })
153
153
  ] }, a);
154
154
  }) });
155
155
  });
package/dist/input.cjs CHANGED
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),n=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-[border-color,box-shadow,background-color]","text-sm font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3 pb-[1px] leading-5","[&::-webkit-calendar-picker-indicator]:hidden"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),s=h.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,error:l,trackingEl:c,trackingLabel:d,...o},u)=>{const i=l||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":i?"true":void 0,className:v.cn(n({hasIcon:r,hasSecondaryIcon:t}),i&&"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",e),"data-hook":a,"data-slot":"input","data-tracking-el":c,"data-tracking-label":d,...o})});s.displayName="Input";exports.Input=s;exports.inputVariants=n;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const f=require("react/jsx-runtime"),b=require("react"),p=require("class-variance-authority"),v=require("@brightlocal/ui-components/lib/utils");function g(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const t in e)if(t!=="default"){const a=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(r,t,a.get?a:{enumerable:!0,get:()=>e[t]})}}return r.default=e,Object.freeze(r)}const h=g(b),n=p.cva(["flex w-full min-w-0 h-9","border border-input bg-background rounded-sm","outline-none transition-[border-color,box-shadow,background-color]","text-base font-sans","text-foreground","overflow-hidden text-ellipsis","focus-visible:outline-none focus-visible:border-ring focus-visible:bg-background","focus-visible:shadow-default","disabled:cursor-not-allowed disabled:opacity-50","placeholder:text-muted-foreground","placeholder:overflow-hidden placeholder:text-ellipsis","items-center px-3","[&::-webkit-calendar-picker-indicator]:hidden"],{variants:{hasIcon:{true:"pl-9",false:""},hasSecondaryIcon:{true:"pr-9",false:""}},defaultVariants:{hasIcon:!1,hasSecondaryIcon:!1}}),s=h.forwardRef(({className:e,hasIcon:r=!1,hasSecondaryIcon:t=!1,dataHook:a,error:l,trackingEl:c,trackingLabel:d,...o},u)=>{const i=l||o["aria-invalid"]===!0||o["aria-invalid"]==="true";return f.jsx("input",{ref:u,"aria-invalid":i?"true":void 0,className:v.cn(n({hasIcon:r,hasSecondaryIcon:t}),i&&"border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",e),"data-hook":a,"data-slot":"input","data-tracking-el":c,"data-tracking-label":d,...o})});s.displayName="Input";exports.Input=s;exports.inputVariants=n;
@@ -1 +1 @@
1
- {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;;GAGG;AACH,eAAO,MAAM,aAAa;;;8EAwCzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,UACf,SACE,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EACzD,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,KAAK,qFAsCjB,CAAC"}
1
+ {"version":3,"file":"input.d.ts","sourceRoot":"","sources":["../../src/components/input.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,EAAO,KAAK,YAAY,EAAE,MAAM,0BAA0B,CAAC;AAGlE;;;GAGG;AACH,eAAO,MAAM,aAAa;;;8EAuCzB,CAAC;AAEF;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,WAAW,UACf,SACE,IAAI,CAAC,KAAK,CAAC,mBAAmB,CAAC,gBAAgB,CAAC,EAAE,MAAM,CAAC,EACzD,YAAY,CAAC,OAAO,aAAa,CAAC;IACpC;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;IAChB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;CACxB;AAED,eAAO,MAAM,KAAK,qFAsCjB,CAAC"}
package/dist/input.js CHANGED
@@ -10,7 +10,7 @@ const p = f(
10
10
  "border border-input bg-background rounded-sm",
11
11
  "outline-none transition-[border-color,box-shadow,background-color]",
12
12
  // Typography
13
- "text-sm font-sans",
13
+ "text-base font-sans",
14
14
  "text-foreground",
15
15
  "overflow-hidden text-ellipsis",
16
16
  // States - Focus
@@ -21,8 +21,7 @@ const p = f(
21
21
  // Pseudo-elements
22
22
  "placeholder:text-muted-foreground",
23
23
  "placeholder:overflow-hidden placeholder:text-ellipsis",
24
- // Text input alignment - uses design token for text/sm line-height (20px)
25
- "items-center px-3 pb-[1px] leading-5",
24
+ "items-center px-3",
26
25
  // Hide default browser icons for date/time inputs
27
26
  "[&::-webkit-calendar-picker-indicator]:hidden"
28
27
  ],
@@ -46,8 +45,8 @@ const p = f(
46
45
  ({
47
46
  className: o,
48
47
  hasIcon: r = !1,
49
- hasSecondaryIcon: i = !1,
50
- dataHook: t,
48
+ hasSecondaryIcon: t = !1,
49
+ dataHook: i,
51
50
  error: s,
52
51
  trackingEl: d,
53
52
  trackingLabel: n,
@@ -60,11 +59,11 @@ const p = f(
60
59
  ref: l,
61
60
  "aria-invalid": a ? "true" : void 0,
62
61
  className: b(
63
- p({ hasIcon: r, hasSecondaryIcon: i }),
62
+ p({ hasIcon: r, hasSecondaryIcon: t }),
64
63
  a && "border-destructive-40 focus-visible:border-destructive-40 focus-visible:shadow-destructive",
65
64
  o
66
65
  ),
67
- "data-hook": t,
66
+ "data-hook": i,
68
67
  "data-slot": "input",
69
68
  "data-tracking-el": d,
70
69
  "data-tracking-label": n,
@@ -1 +1 @@
1
- "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const n=require("react/jsx-runtime"),R=require("react"),c=require("@brightlocal/ui-components/lib/utils");function k(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,l.get?l:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const o=k(R),j=o.createContext(!1),C=o.forwardRef(({className:t,dataHook:a,trackingEl:e,trackingLabel:l,left:s,right:i,children:d,...f},p)=>{const y=[],m=[],g=[],L=r=>{if(o.isValidElement(r)){if(r.type===o.Fragment){o.Children.forEach(r.props.children,L);return}r.type===h?y.push(r):r.type===u?g.push(r):m.push(r)}};o.Children.forEach(d,L);const v=s!=null||i!=null,w=m.length>0||g.length>0,S=v&&!w,N=y.length>0;return n.jsxs("div",{ref:p,className:c.cn("flex min-h-screen w-full flex-col lg:flex-row",t),"data-hook":a,"data-slot":"split-layout","data-tracking-el":e||"split-layout","data-tracking-label":l,...f,children:[n.jsx("div",{className:"bg-background flex flex-1 flex-col","data-slot":"split-layout-body",children:n.jsxs(j.Provider,{value:N,children:[y,S?s&&n.jsx(x,{children:s}):m]})}),S?i&&n.jsx(u,{children:i}):g]})});C.displayName="SplitLayout";const h=o.forwardRef(({className:t,children:a,...e},l)=>n.jsx("div",{ref:l,className:c.cn("px-section-sm pt-section-sm flex w-full items-center justify-center lg:justify-start",t),"data-slot":"split-layout-header",...e,children:a}));h.displayName="SplitLayoutHeader";const x=o.forwardRef(({className:t,children:a,...e},l)=>{const s=o.useContext(j);return n.jsx("div",{ref:l,className:c.cn("p-section-sm flex flex-1 items-center justify-center overflow-auto",s&&"pt-2",t),"data-slot":"split-layout-left",...e,children:a})});x.displayName="SplitLayoutContentLeft";const u=o.forwardRef(({className:t,flush:a=!1,children:e,...l},s)=>n.jsx("div",{ref:s,className:c.cn("bg-card hidden",a?"relative h-screen overflow-hidden lg:block lg:w-1/2 lg:shrink-0":"p-section-sm flex-1 items-center justify-center overflow-auto lg:flex",t),"data-slot":"split-layout-right",...l,children:e}));u.displayName="SplitLayoutContentRight";const b=o.forwardRef(({className:t,dataHook:a,src:e,alt:l,objectFit:s="cover",objectPosition:i="center",style:d,...f},p)=>n.jsx("img",{ref:p,alt:l,className:c.cn("absolute inset-0 h-full w-full",t),"data-hook":a,"data-slot":"split-layout-image",src:e,style:{objectFit:s,objectPosition:i,...d},...f}));b.displayName="SplitLayoutImage";exports.SplitLayout=C;exports.SplitLayoutContentLeft=x;exports.SplitLayoutContentRight=u;exports.SplitLayoutHeader=h;exports.SplitLayoutImage=b;
1
+ "use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const o=require("react/jsx-runtime"),h=require("react"),r=require("@brightlocal/ui-components/lib/utils");function S(t){const a=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(t){for(const e in t)if(e!=="default"){const l=Object.getOwnPropertyDescriptor(t,e);Object.defineProperty(a,e,l.get?l:{enumerable:!0,get:()=>t[e]})}}return a.default=t,Object.freeze(a)}const i=S(h),y=i.forwardRef(({className:t,dataHook:a,trackingEl:e,trackingLabel:l,left:s,right:n,children:u,...c},d)=>o.jsxs("div",{ref:d,className:r.cn("group/split-layout bg-background grid min-h-screen w-full grid-cols-1 grid-rows-[auto_1fr] lg:has-[[data-slot=split-layout-right]]:grid-cols-2",t),"data-hook":a,"data-slot":"split-layout","data-tracking-el":e||"split-layout","data-tracking-label":l,...c,children:[u,s&&o.jsx(p,{children:s}),n&&o.jsx(f,{children:n})]}));y.displayName="SplitLayout";const g=i.forwardRef(({className:t,children:a,...e},l)=>o.jsx("div",{ref:l,className:r.cn("px-section-sm pt-section-sm col-start-1 row-start-1 flex w-full items-center justify-center lg:justify-start",t),"data-slot":"split-layout-header",...e,children:a}));g.displayName="SplitLayoutHeader";const p=i.forwardRef(({className:t,children:a,...e},l)=>o.jsx("div",{ref:l,className:r.cn("p-section-sm col-start-1 row-start-2 flex min-h-0 items-center justify-center overflow-auto","group-has-[[data-slot=split-layout-header]]/split-layout:pt-2",t),"data-slot":"split-layout-left",...e,children:a}));p.displayName="SplitLayoutContentLeft";const f=i.forwardRef(({className:t,flush:a=!1,children:e,...l},s)=>o.jsx("div",{ref:s,className:r.cn("bg-card hidden lg:col-start-2 lg:row-span-full lg:row-start-1",a?"relative overflow-hidden lg:block":"p-section-sm min-h-0 items-center justify-center overflow-auto lg:flex",t),"data-slot":"split-layout-right",...l,children:e}));f.displayName="SplitLayoutContentRight";const m=i.forwardRef(({className:t,dataHook:a,src:e,alt:l,objectFit:s="cover",objectPosition:n="center",style:u,...c},d)=>o.jsx("img",{ref:d,alt:l,className:r.cn("absolute inset-0 h-full w-full",t),"data-hook":a,"data-slot":"split-layout-image",src:e,style:{objectFit:s,objectPosition:n,...u},...c}));m.displayName="SplitLayoutImage";exports.SplitLayout=y;exports.SplitLayoutContentLeft=p;exports.SplitLayoutContentRight=f;exports.SplitLayoutHeader=g;exports.SplitLayoutImage=m;
@@ -24,8 +24,10 @@ interface SplitLayoutProps extends React.ComponentProps<"div"> {
24
24
  * and shows only the left section on smaller screens (hiding the right/marketing section).
25
25
  * This pattern is commonly used for authentication pages where the form is prioritized on mobile.
26
26
  *
27
- * Uses a composition pattern with SplitLayoutHeader, SplitLayoutContentLeft,
28
- * and SplitLayoutContentRight sub-components.
27
+ * Uses CSS Grid for slot positioning — sub-components self-place into the correct
28
+ * grid area via their own classes, so SplitLayout renders {children} without
29
+ * inspecting them. This enables composition through any wrapping: Fragments,
30
+ * router Outlets, memoized components, or conditional renders.
29
31
  *
30
32
  * @example
31
33
  * // Basic usage
@@ -52,6 +54,15 @@ interface SplitLayoutProps extends React.ComponentProps<"div"> {
52
54
  * </SplitLayoutContentRight>
53
55
  * </SplitLayout>
54
56
  *
57
+ * @example
58
+ * // With router Outlet — slots project up through any wrapping
59
+ * <SplitLayout dataHook="auth-layout">
60
+ * <SplitLayoutHeader>
61
+ * <Header dataHook="my-header"><Logo dataHook="my-logo" /></Header>
62
+ * </SplitLayoutHeader>
63
+ * <Outlet />
64
+ * </SplitLayout>
65
+ *
55
66
  * Layout specifications:
56
67
  * - Mobile/Tablet: Stacked layout, only left section visible, content centered
57
68
  * - Desktop (≥1024px): Side-by-side, content centered within each section
@@ -70,6 +81,7 @@ interface SplitLayoutHeaderProps extends React.ComponentProps<"div"> {
70
81
  * SplitLayoutHeader component for rendering header content at the top of SplitLayout.
71
82
  * Content is centered on mobile/tablet, left-aligned from lg breakpoint onwards.
72
83
  * Uses section padding tokens for responsive horizontal and vertical padding (16px mobile, 24px desktop).
84
+ * Self-positions in the first column, first row of the grid.
73
85
  */
74
86
  declare const SplitLayoutHeader: React.ForwardRefExoticComponent<Omit<SplitLayoutHeaderProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
75
87
  interface SplitLayoutContentLeftProps extends React.ComponentProps<"div"> {
@@ -79,7 +91,8 @@ interface SplitLayoutContentLeftProps extends React.ComponentProps<"div"> {
79
91
  * SplitLayoutContentLeft - Left/primary section within a SplitLayout.
80
92
  *
81
93
  * Always visible. When a SplitLayoutHeader is present, top padding is
82
- * automatically reduced to avoid excessive spacing below the header.
94
+ * automatically reduced via CSS :has() to avoid excessive spacing below the header.
95
+ * Self-positions in the first column, second row of the grid.
83
96
  */
84
97
  declare const SplitLayoutContentLeft: React.ForwardRefExoticComponent<Omit<SplitLayoutContentLeftProps, "ref"> & React.RefAttributes<HTMLDivElement>>;
85
98
  interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
@@ -96,6 +109,7 @@ interface SplitLayoutContentRightProps extends React.ComponentProps<"div"> {
96
109
  *
97
110
  * Hidden on mobile/tablet (<1024px), visible on desktop (≥1024px).
98
111
  * Uses bg-card background color.
112
+ * Self-positions in the second column, spanning all rows of the grid.
99
113
  *
100
114
  * Set `flush` to remove padding for full-bleed content (e.g. images).
101
115
  */
@@ -1 +1 @@
1
- {"version":3,"file":"split-layout.d.ts","sourceRoot":"","sources":["../../src/components/split-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC5D,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAyCG;AACH,QAAA,MAAM,WAAW,sGA6EhB,CAAC;AAQF,UAAU,sBAAuB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAClE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;GAIG;AACH,QAAA,MAAM,iBAAiB,4GAiBrB,CAAC;AAQH,UAAU,2BAA4B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACvE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;GAKG;AACH,QAAA,MAAM,sBAAsB,iHAoB1B,CAAC;AAQH,UAAU,4BAA6B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACxE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;GAOG;AACH,QAAA,MAAM,uBAAuB,kHAoB3B,CAAC;AAQH,UAAU,qBAAsB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACjE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,gBAAgB,6GA8BrB,CAAC;AAQF,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,GAC3B,CAAC"}
1
+ {"version":3,"file":"split-layout.d.ts","sourceRoot":"","sources":["../../src/components/split-layout.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAO/B,UAAU,gBAAiB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAC5D,iDAAiD;IACjD,QAAQ,EAAE,MAAM,CAAC;IACjB,gDAAgD;IAChD,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,2CAA2C;IAC3C,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB;;;OAGG;IACH,IAAI,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IACvB;;;OAGG;IACH,KAAK,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAoDG;AACH,QAAA,MAAM,WAAW,sGAiChB,CAAC;AAQF,UAAU,sBAAuB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IAClE;;OAEG;IACH,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;GAKG;AACH,QAAA,MAAM,iBAAiB,4GAiBrB,CAAC;AAQH,UAAU,2BAA4B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACvE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED;;;;;;GAMG;AACH,QAAA,MAAM,sBAAsB,iHAkB1B,CAAC;AAQH,UAAU,4BAA6B,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACxE,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;IAC1B;;;;OAIG;IACH,KAAK,CAAC,EAAE,OAAO,CAAC;CACjB;AAED;;;;;;;;GAQG;AACH,QAAA,MAAM,uBAAuB,kHAoB3B,CAAC;AAQH,UAAU,qBAAsB,SAAQ,KAAK,CAAC,cAAc,CAAC,KAAK,CAAC;IACjE;;OAEG;IACH,QAAQ,EAAE,MAAM,CAAC;IACjB;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,GAAG,EAAE,MAAM,CAAC;IACZ;;;OAGG;IACH,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAC;IAChC;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAC;CACzB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,QAAA,MAAM,gBAAgB,6GA8BrB,CAAC;AAQF,OAAO,EACL,WAAW,EACX,iBAAiB,EACjB,sBAAsB,EACtB,uBAAuB,EACvB,gBAAgB,EAChB,KAAK,gBAAgB,EACrB,KAAK,sBAAsB,EAC3B,KAAK,2BAA2B,EAChC,KAAK,4BAA4B,EACjC,KAAK,qBAAqB,GAC3B,CAAC"}