@brightlocal/ui-components 2.9.1 → 2.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/component-meta.json +1 -1
- package/dist/browser-entry.d.ts +17 -0
- package/dist/browser-entry.d.ts.map +1 -0
- package/dist/combobox.cjs +3 -3
- package/dist/combobox.d.ts +3 -3
- package/dist/combobox.d.ts.map +1 -1
- package/dist/combobox.js +480 -440
- package/dist/global-layout.cjs +1 -1
- package/dist/global-layout.d.ts.map +1 -1
- package/dist/global-layout.js +17 -16
- package/package.json +6 -3
- package/src/browser-entry.ts +89 -0
- package/src/browser-tokens.css +1 -0
- package/src/components/combobox.tsx +106 -28
- package/src/components/global-layout.tsx +7 -6
package/component-meta.json
CHANGED
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import * as React from "react";
|
|
2
|
+
import * as ReactDOM from "react-dom";
|
|
3
|
+
export * from './index';
|
|
4
|
+
export { React, ReactDOM };
|
|
5
|
+
export declare const h: typeof React.createElement;
|
|
6
|
+
export declare const useState: typeof React.useState;
|
|
7
|
+
export declare const useEffect: typeof React.useEffect;
|
|
8
|
+
export declare const useMemo: typeof React.useMemo;
|
|
9
|
+
export declare const useCallback: typeof React.useCallback;
|
|
10
|
+
export declare const useRef: typeof React.useRef;
|
|
11
|
+
export declare const useContext: typeof React.useContext;
|
|
12
|
+
export declare const useReducer: typeof React.useReducer;
|
|
13
|
+
export declare const useLayoutEffect: typeof React.useLayoutEffect;
|
|
14
|
+
export declare const Fragment: React.ExoticComponent<React.FragmentProps>;
|
|
15
|
+
export declare function mount(name: string, container: HTMLElement, props?: Record<string, unknown>): () => void;
|
|
16
|
+
export declare function render(element: React.ReactNode, container: HTMLElement): () => void;
|
|
17
|
+
//# sourceMappingURL=browser-entry.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"browser-entry.d.ts","sourceRoot":"","sources":["../src/browser-entry.ts"],"names":[],"mappings":"AAAA,OAAO,sBAAsB,CAAC;AAE9B,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAC/B,OAAO,KAAK,QAAQ,MAAM,WAAW,CAAC;AAKtC,cAAc,SAAS,CAAC;AAExB,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,CAAC;AAE3B,eAAO,MAAM,CAAC,4BAAsB,CAAC;AACrC,eAAO,MAAM,QAAQ,uBAAiB,CAAC;AACvC,eAAO,MAAM,SAAS,wBAAkB,CAAC;AACzC,eAAO,MAAM,OAAO,sBAAgB,CAAC;AACrC,eAAO,MAAM,WAAW,0BAAoB,CAAC;AAC7C,eAAO,MAAM,MAAM,qBAAe,CAAC;AACnC,eAAO,MAAM,UAAU,yBAAmB,CAAC;AAC3C,eAAO,MAAM,UAAU,yBAAmB,CAAC;AAC3C,eAAO,MAAM,eAAe,8BAAwB,CAAC;AACrD,eAAO,MAAM,QAAQ,4CAAiB,CAAC;AAmBvC,wBAAgB,KAAK,CACnB,IAAI,EAAE,MAAM,EACZ,SAAS,EAAE,WAAW,EACtB,KAAK,GAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAM,GAClC,MAAM,IAAI,CA0BZ;AAED,wBAAgB,MAAM,CACpB,OAAO,EAAE,KAAK,CAAC,SAAS,EACxB,SAAS,EAAE,WAAW,GACrB,MAAM,IAAI,CAaZ"}
|
package/dist/combobox.cjs
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),
|
|
1
|
+
"use strict";Object.defineProperty(exports,Symbol.toStringTag,{value:"Module"});const i=require("react/jsx-runtime"),ie=require("react"),K=require("@brightlocal/icons"),le=require("@tanstack/react-virtual"),ue=require("class-variance-authority"),B=require("cmdk"),F=require("@brightlocal/ui-components/lib/utils"),U=require("@brightlocal/ui-components/lib/use-dev-warning"),Y=require("@brightlocal/ui-components/popover"),_=require("@brightlocal/ui-components/command");function ce(e){const r=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(e){for(const n in e)if(n!=="default"){const o=Object.getOwnPropertyDescriptor(e,n);Object.defineProperty(r,n,o.get?o:{enumerable:!0,get:()=>e[n]})}}return r.default=e,Object.freeze(r)}const t=ce(ie),Q=t.createContext(null),X=t.createContext(null);function z(){const e=t.useContext(Q);if(!e)throw new Error("Combobox components must be used within a <Combobox>");return e}function de({value:e,onValueChange:r,open:n,onOpenChange:o,shouldFilter:l=!0,disabled:c=!1,itemToStringValue:a,children:x}){const[d,y]=t.useState(""),[D,h]=t.useState(!1),[b,w]=t.useState(()=>new Map),[v,C]=t.useState(""),[V,k]=t.useState(void 0),S=e!==void 0,I=n!==void 0,j=S?e:d,R=I?n:D,E=t.useCallback(p=>{p||C(""),I||h(p),o?.(p)},[I,o]),M=t.useCallback(p=>{S||y(p),r?.(p)},[S,r]),u=t.useRef(new Map),L=t.useRef(!1),$=t.useRef(!0);t.useEffect(()=>()=>{$.current=!1},[]);const f=t.useCallback(()=>{L.current||(L.current=!0,queueMicrotask(()=>{L.current=!1,$.current&&w(new Map(u.current))}))},[]),P=t.useCallback((p,q)=>{u.current.get(p)!==q&&(u.current.set(p,q),f())},[f]),A=t.useCallback(p=>{for(const[q,G]of p)u.current.set(q,G);w(new Map(u.current))},[]),W=t.useRef(j);t.useLayoutEffect(()=>{W.current=j},[j]);const T=t.useCallback(p=>{p!==W.current&&u.current.has(p)&&(u.current.delete(p),f())},[f]),O=t.useMemo(()=>a?(p,q,G)=>B.defaultFilter(a(p),q,G):B.defaultFilter,[a]),H=t.useMemo(()=>({open:R,setOpen:E,value:j,onValueChange:M,shouldFilter:l,disabled:c,itemLabels:b,registerItem:P,registerItemsSync:A,unregisterItem:T,itemToStringValue:a,filterFn:O,searchValue:v,setSearchValue:C,activeDescendantId:V,setActiveDescendantId:k}),[R,E,j,M,l,c,b,P,A,T,a,O,v,V,k]);return i.jsx(Q.Provider,{value:H,children:i.jsx(Y.Popover,{open:R,onOpenChange:E,children:x})})}const be=ue.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"]),Z=t.forwardRef(({className:e,dataHook:r,error:n,trackingEl:o,trackingLabel:l,children:c,...a},x)=>{const{open:d,disabled:y,value:D}=z(),h=t.useId(),b=!D,w=n||a["aria-invalid"]===!0||a["aria-invalid"]==="true";return i.jsx(Y.PopoverTrigger,{asChild:!0,children:i.jsxs("button",{ref:x,"aria-controls":d?h:void 0,"aria-expanded":d,"aria-haspopup":"listbox","aria-invalid":w?"true":void 0,className:F.cn(be(),w&&"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":r,"data-placeholder":b,"data-slot":"combobox-trigger","data-state":d?"open":"closed","data-tracking-el":o||"combobox-trigger","data-tracking-label":l,disabled:y||a.disabled,role:"combobox",type:"button",...a,children:[c,i.jsx(K.ChevronsUpDown,{"aria-hidden":"true",className:"text-muted-foreground ml-auto shrink-0"})]})})});Z.displayName="ComboboxTrigger";function fe(e){return e!=null&&typeof e=="object"&&"value"in e&&typeof e.value=="string"}function ee(e,r,n){if(r)return{getValue:r,getLabel:n??r,hasDistinctLabel:!!n};const o=e[0];if(!fe(o))return null;const l=x=>x.value,c="label"in o&&typeof o.label=="string";return{getValue:l,getLabel:n??(c?x=>String(x.label):l),hasDistinctLabel:c||!!n}}function me({placeholder:e,className:r,displayValue:n,items:o,getItemValue:l,getItemLabel:c}){const{value:a,itemLabels:x}=z(),d=t.useMemo(()=>o?ee(o,l,c):null,[o,l,c]);U.useDevWarning(()=>!!o&&o.length>0&&!d,"ComboboxValue: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",[o,d]);const y=t.useMemo(()=>!o||!d?null:new Map(o.map(h=>[d.getValue(h),d.getLabel(h)])),[o,d]),D=a?y?.get(a)||x.get(a)||n?.(a)||a:e;return i.jsx("span",{className:F.cn("text-foreground overflow-hidden text-base leading-normal font-medium text-ellipsis whitespace-nowrap",r),"data-slot":"combobox-value",children:D})}function xe({dataHook:e,className:r,children:n,align:o="start",side:l="bottom",sideOffset:c,avoidCollisions:a,hideList:x=!1}){const{open:d,shouldFilter:y,filterFn:D,itemToStringValue:h}=z(),[b,w]=t.useState(null),v=t.useRef(null),C=t.useCallback(k=>{if(v.current?.(),v.current=null,!k)return;let S=!1;const I=M=>{S||(M==="top"||M==="bottom")&&(S=!0,j.disconnect(),w(M))},j=new MutationObserver(()=>{I(k.getAttribute("data-side"))});j.observe(k,{attributes:!0,attributeFilter:["data-side"]});let R=0,E=0;R=requestAnimationFrame(()=>{E=requestAnimationFrame(()=>{I(k.getAttribute("data-side"))})}),v.current=()=>{S=!0,j.disconnect(),cancelAnimationFrame(R),cancelAnimationFrame(E)}},[]);t.useEffect(()=>{if(!d){v.current?.(),v.current=null;const k=setTimeout(()=>w(null),150);return()=>clearTimeout(k)}},[d]);const V=h?D:void 0;return i.jsx(Y.PopoverContent,{ref:C,align:o,"aria-label":"Options",avoidCollisions:a,className:F.cn("flex max-h-[var(--radix-popover-content-available-height)] w-[var(--radix-popover-trigger-width)] flex-col overflow-hidden p-0",r),collisionPadding:4,"data-slot":"combobox-popover",side:b??l,sideOffset:c,children:i.jsx(_.Command,{className:F.cn("min-h-0 flex-1 border-0 shadow-none","[&_[data-slot='command-input-wrapper']]:shrink-0",x&&"[&_[data-slot='command-input-wrapper']]:border-b-0"),"data-slot":"combobox-command",dataHook:e||"combobox-command",filter:V,shouldFilter:y,children:n})})}const te=t.forwardRef(({debounceMs:e,onValueChange:r,...n},o)=>{const{setSearchValue:l,shouldFilter:c,activeDescendantId:a}=z(),x=t.useRef(void 0);U.useDevWarning(()=>!!(e&&e>0&&c),`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
|
-
Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`,[
|
|
4
|
-
Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox"`,[
|
|
3
|
+
Set shouldFilter={false} on <Combobox> for async search, or remove debounceMs for client-side filtering.`,[e,c]),U.useDevWarning(()=>!!(e&&e>0&&n.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,n.value]),t.useEffect(()=>()=>{x.current&&clearTimeout(x.current)},[]);const d=t.useCallback(y=>{l(y),e&&e>0?(clearTimeout(x.current),x.current=setTimeout(()=>{r?.(y)},e)):r?.(y)},[e,r,l]);return i.jsx(_.CommandInput,{ref:o,"aria-activedescendant":a,"data-slot":"combobox-input",onValueChange:d,...n})});te.displayName="ComboboxInput";const oe=t.forwardRef(({className:e,...r},n)=>i.jsx(_.CommandList,{ref:n,className:F.cn("scrollbar min-h-0 flex-1",e),"data-slot":"combobox-list",...r}));oe.displayName="ComboboxList";function pe({items:e,getItemValue:r,getItemLabel:n,getItemKeywords:o,estimateSize:l=36,overscan:c=5,children:a,renderEmpty:x,className:d,dataHook:y},D){const h=t.useMemo(()=>ee(e,r,n),[e,r,n]),b=t.useMemo(()=>h?.getValue??(s=>{if(typeof s=="string"||typeof s=="number")return String(s);throw new Error("[BrightLocal DS] ComboboxVirtualList: `getItemValue` is required for non-primitive items without a `value` property.")}),[h]),w=t.useMemo(()=>h?.getLabel??b,[h,b]);U.useDevWarning(()=>!h&&e.length>0,"ComboboxVirtualList: could not infer `getItemValue` from item shape. Pass `getItemValue` explicitly, or use items with a `value` string property.",[h,e.length]);const v=t.useRef(null),{value:C,onValueChange:V,setOpen:k,shouldFilter:S,searchValue:I,filterFn:j,setActiveDescendantId:R,registerItemsSync:E,unregisterItem:M}=z(),[u,L]=t.useState(0),$=t.useId();t.useImperativeHandle(D,()=>v.current,[]),t.useLayoutEffect(()=>{const s=e.map(m=>[b(m),w(m)]);return E(s),()=>{for(const m of e)M(b(m))}},[e,b,w,E,M]);const f=t.useMemo(()=>{if(!S||!I.trim())return e;const s=[];for(const m of e){let g=h?.hasDistinctLabel?B.defaultFilter(w(m),I):j(b(m),I);if(o)for(const N of o(m))g=Math.max(g,B.defaultFilter(N,I));g>0&&s.push({item:m,score:g})}return s.sort((m,g)=>g.score-m.score),s.map(m=>m.item)},[e,S,I,b,w,o,j,h?.hasDistinctLabel]),P=le.useVirtualizer({count:f.length,getScrollElement:()=>v.current,estimateSize:()=>l,overscan:c}),A=u>=0&&u<f.length?b(f[u]):null;t.useEffect(()=>{L(0)},[I,f.length]);const W=t.useRef(!1);t.useEffect(()=>{if(W.current||!C)return;const s=f.findIndex(m=>b(m)===C);s>=0&&(L(s),P.scrollToIndex(s,{align:"center"}),W.current=!0)},[C,f,b,P]);const T=t.useRef(!1);t.useEffect(()=>{T.current&&u>=0&&u<f.length&&P.scrollToIndex(u,{align:"auto"}),T.current=!1},[u,f.length,P]),t.useEffect(()=>{const s=v.current?.closest('[data-slot="combobox-command"]');if(!s)return;const m=g=>{switch(g.key){case"ArrowDown":g.preventDefault(),g.stopPropagation(),T.current=!0,L(N=>N<f.length-1?N+1:N);break;case"ArrowUp":g.preventDefault(),g.stopPropagation(),T.current=!0,L(N=>N>0?N-1:N);break;case"Enter":if(g.preventDefault(),g.stopPropagation(),u>=0&&u<f.length){const N=b(f[u]);V(N===C?"":N),k(!1)}break;case"Home":g.preventDefault(),g.stopPropagation(),T.current=!0,L(0);break;case"End":g.preventDefault(),g.stopPropagation(),T.current=!0,L(f.length-1);break}};return s.addEventListener("keydown",m,{capture:!0}),()=>s.removeEventListener("keydown",m,{capture:!0})},[f,u,C,V,k,b]);const O=t.useMemo(()=>{const s=new Map;return f.forEach((m,g)=>{s.set(b(m),g)}),s},[f,b]),H=t.useCallback(s=>{const m=O.get(s);m!==void 0&&L(m)},[O]),p=t.useCallback(s=>(O.get(s)??0)+1,[O]),q=f.length,G=t.useMemo(()=>({activeValue:A,onItemPointerMove:H,idPrefix:$,filteredCount:q,getItemPosition:p}),[A,H,$,q,p]),J=A!=null?`${$}item-${A}`:void 0;return t.useEffect(()=>(R(J),()=>R(void 0)),[J,R]),f.length===0?i.jsx("div",{ref:v,className:F.cn("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",d),"data-hook":y,"data-slot":"combobox-virtual-list",role:"listbox",children:x}):i.jsx(X.Provider,{value:G,children:i.jsx("div",{ref:v,className:F.cn("scrollbar max-h-[300px] min-h-0 flex-1 scroll-py-1 overflow-x-hidden overflow-y-auto py-1",d),"data-hook":y,"data-slot":"combobox-virtual-list",role:"listbox",children:i.jsx("div",{className:"relative w-full",style:{height:`${P.getTotalSize()}px`},children:P.getVirtualItems().map(s=>i.jsx("div",{ref:P.measureElement,className:"absolute top-0 left-0 w-full px-2","data-index":s.index,style:{transform:`translateY(${s.start}px)`},children:a(f[s.index],s.index,I)},s.key))})})})}const ge=t.forwardRef(pe),re=t.forwardRef((e,r)=>i.jsx(_.CommandEmpty,{ref:r,"data-slot":"combobox-empty",...e}));re.displayName="ComboboxEmpty";const ne=t.forwardRef(({children:e,...r},n)=>{const o=t.useRef(null);return U.useDevWarning(()=>o.current?o.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
|
+
Import: import { ComboboxVirtualList } from "@brightlocal/ui-components/combobox"`,[e]),i.jsx(_.CommandGroup,{ref:l=>{o.current=l,typeof n=="function"?n(l):n&&(n.current=l)},"data-slot":"combobox-group",...r,children:e})});ne.displayName="ComboboxGroup";function he(e,r,n){if(!r||!r.trim())return e;const o=new RegExp(`(${r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&")})`,"gi"),l=e.split(o);return i.jsx("span",{children:l.map((c,a)=>a%2===1?i.jsx("span",{className:n,children:c},a):i.jsx(t.Fragment,{children:c},a))})}const se=t.forwardRef(({value:e,label:r,dataHook:n,children:o,className:l,highlight:c,highlightClassName:a,keywords:x,...d},y)=>{const{value:D,onValueChange:h,setOpen:b,registerItem:w,unregisterItem:v}=z(),C=t.useContext(X),V=D===e,k=t.useMemo(()=>r||(typeof o=="string"?o:typeof o=="number"?String(o):e),[r,o,e]),S=t.useRef(w),I=t.useRef(v);t.useEffect(()=>{S.current=w,I.current=v},[w,v]);const j=!!C;t.useEffect(()=>{if(!j)return S.current(e,k),()=>I.current(e)},[e,k,j]);const R=()=>{h(e===D?"":e),b(!1)},E=()=>c&&typeof o=="string"?he(o,c,a||"text-sm leading-normal font-semibold"):o;if(C){const M=C.activeValue===e,u=!!d.disabled;return i.jsxs("div",{ref:y,"aria-disabled":u||void 0,"aria-posinset":C.getItemPosition(e),"aria-selected":V,"aria-setsize":C.filteredCount,className:F.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",u&&"pointer-events-none opacity-50",l),"data-highlighted":M||void 0,"data-hook":n,"data-slot":"combobox-item",id:`${C.idPrefix}item-${e}`,role:"option",tabIndex:-1,onClick:u?void 0:R,onKeyDown:u?void 0:L=>{(L.key==="Enter"||L.key===" ")&&R()},onPointerMove:u?void 0:()=>C.onItemPointerMove(e),children:[E(),V&&i.jsx(K.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})}return i.jsxs(_.CommandItem,{ref:y,className:F.cn("justify-between",l),"data-slot":"combobox-item",dataHook:n,keywords:x?[k,...x]:[k],value:e,onSelect:R,...d,children:[E(),V&&i.jsx(K.Check,{"aria-hidden":"true",className:"text-muted-foreground shrink-0"})]})});se.displayName="ComboboxItem";const ae=t.forwardRef((e,r)=>i.jsx(_.CommandSeparator,{ref:r,"data-slot":"combobox-separator",...e}));ae.displayName="ComboboxSeparator";function ve({className:e,children:r}){return i.jsx("div",{"aria-live":"polite",className:F.cn("text-muted-foreground flex items-center justify-center gap-2 py-6 text-sm",e),"data-slot":"combobox-loading",role:"status",children:r||i.jsxs(i.Fragment,{children:[i.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=de;exports.ComboboxContent=xe;exports.ComboboxEmpty=re;exports.ComboboxGroup=ne;exports.ComboboxInput=te;exports.ComboboxItem=se;exports.ComboboxList=oe;exports.ComboboxLoading=ve;exports.ComboboxSeparator=ae;exports.ComboboxTrigger=Z;exports.ComboboxValue=me;exports.ComboboxVirtualList=ge;
|
package/dist/combobox.d.ts
CHANGED
|
@@ -109,7 +109,7 @@ export interface ComboboxValueProps<T = unknown> {
|
|
|
109
109
|
* ```
|
|
110
110
|
*/
|
|
111
111
|
items?: readonly T[];
|
|
112
|
-
/** Extract the value string from an item.
|
|
112
|
+
/** Extract the value string from an item. Auto-inferred for items with a `value` string property. */
|
|
113
113
|
getItemValue?: (item: T) => string;
|
|
114
114
|
/** Extract the display label from an item. Falls back to `getItemValue` when not provided. */
|
|
115
115
|
getItemLabel?: (item: T) => string;
|
|
@@ -161,8 +161,8 @@ declare const ComboboxList: React.ForwardRefExoticComponent<Omit<Omit<import('@b
|
|
|
161
161
|
export interface ComboboxVirtualListProps<T> {
|
|
162
162
|
/** Array of items to virtualise. Memoize with useMemo to avoid re-registering labels on every render. */
|
|
163
163
|
items: readonly T[];
|
|
164
|
-
/** Extract the string value for each item (used for selection and keyboard navigation) */
|
|
165
|
-
getItemValue
|
|
164
|
+
/** Extract the string value for each item (used for selection and keyboard navigation). Auto-inferred for items with a `value` string property. */
|
|
165
|
+
getItemValue?: (item: T) => string;
|
|
166
166
|
/**
|
|
167
167
|
* Extract a display label for filtering and trigger display. Defaults to `getItemValue`.
|
|
168
168
|
* Only used when `shouldFilter` is true on the parent Combobox.
|
package/dist/combobox.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"combobox.d.ts","sourceRoot":"","sources":["../../src/components/combobox.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,KAAK,MAAM,OAAO,CAAC;AAa/B,OAAO,EAEL,YAAY,EACZ,YAAY,EACZ,YAAY,EACZ,WAAW,EACX,WAAW,EACX,gBAAgB,EACjB,MAAM,oCAAoC,CAAC;AA0E5C;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAiCG;AACH,MAAM,WAAW,aAAa;IAC5B,gCAAgC;IAChC,KAAK,CAAC,EAAE,MAAM,CAAC;IACf,kCAAkC;IAClC,aAAa,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IACxC,4BAA4B;IAC5B,IAAI,CAAC,EAAE,OAAO,CAAC;IACf,uCAAuC;IACvC,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC;;;;;OAKG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB,qBAAqB;IACrB,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,kHAAkH;IAClH,iBAAiB,CAAC,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,MAAM,CAAC;IAC9C,eAAe;IACf,QAAQ,EAAE,KAAK,CAAC,SAAS,CAAC;CAC3B;AAED,iBAAS,QAAQ,CAAC,EAChB,KAAK,EAAE,eAAe,EACtB,aAAa,EAAE,uBAAuB,EACt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