@bazza-ui/react 0.0.0 → 0.1.0-canary.2
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/ListboxStore-BtcTXpzi.d.cts +351 -0
- package/dist/ListboxStore-DPqpLlAL.d.ts +351 -0
- package/dist/adapters/index.cjs +2 -0
- package/dist/adapters/index.cjs.map +1 -0
- package/dist/adapters/index.d.cts +363 -0
- package/dist/adapters/index.d.ts +363 -0
- package/dist/adapters/index.js +2 -0
- package/dist/adapters/index.js.map +1 -0
- package/dist/chunk-4C666HHU.js +2 -0
- package/dist/chunk-4C666HHU.js.map +1 -0
- package/dist/chunk-AVZ64JQ3.js +2 -0
- package/dist/chunk-AVZ64JQ3.js.map +1 -0
- package/dist/chunk-BGJJC6GX.cjs +2 -0
- package/dist/chunk-BGJJC6GX.cjs.map +1 -0
- package/dist/chunk-FWWOE2SW.cjs +2 -0
- package/dist/chunk-FWWOE2SW.cjs.map +1 -0
- package/dist/chunk-JSPKF52O.cjs +2 -0
- package/dist/chunk-JSPKF52O.cjs.map +1 -0
- package/dist/chunk-KWGD24VS.js +2 -0
- package/dist/chunk-KWGD24VS.js.map +1 -0
- package/dist/chunk-M4G6J7DP.cjs +2 -0
- package/dist/chunk-M4G6J7DP.cjs.map +1 -0
- package/dist/chunk-WKAPAKUL.js +2 -0
- package/dist/chunk-WKAPAKUL.js.map +1 -0
- package/dist/combobox/index.cjs +2 -0
- package/dist/combobox/index.cjs.map +1 -0
- package/dist/combobox/index.d.cts +1039 -0
- package/dist/combobox/index.d.ts +1039 -0
- package/dist/combobox/index.js +2 -0
- package/dist/combobox/index.js.map +1 -0
- package/dist/command-score-Dgo3ZS3Z.d.ts +36 -0
- package/dist/command-score-YjNr3ZWi.d.cts +36 -0
- package/dist/context-menu/index.cjs +2 -0
- package/dist/context-menu/index.cjs.map +1 -0
- package/dist/context-menu/index.d.cts +658 -0
- package/dist/context-menu/index.d.ts +658 -0
- package/dist/context-menu/index.js +2 -0
- package/dist/context-menu/index.js.map +1 -0
- package/dist/data-surface-B-eIGTBi.d.cts +678 -0
- package/dist/data-surface-D1OilMDu.d.ts +678 -0
- package/dist/dropdown-menu/index.cjs +2 -0
- package/dist/dropdown-menu/index.cjs.map +1 -0
- package/dist/dropdown-menu/index.d.cts +700 -0
- package/dist/dropdown-menu/index.d.ts +700 -0
- package/dist/dropdown-menu/index.js +2 -0
- package/dist/dropdown-menu/index.js.map +1 -0
- package/dist/events-BPr8sRGH.d.cts +166 -0
- package/dist/events-BPr8sRGH.d.ts +166 -0
- package/dist/input-BoIK003I.d.cts +41 -0
- package/dist/input-DF7D8YzW.d.ts +41 -0
- package/dist/internal/listbox/index.cjs +2 -0
- package/dist/internal/listbox/index.cjs.map +1 -0
- package/dist/internal/listbox/index.d.cts +269 -0
- package/dist/internal/listbox/index.d.ts +269 -0
- package/dist/internal/listbox/index.js +2 -0
- package/dist/internal/listbox/index.js.map +1 -0
- package/dist/internal/popup-menu/index.cjs +2 -0
- package/dist/internal/popup-menu/index.cjs.map +1 -0
- package/dist/internal/popup-menu/index.d.cts +846 -0
- package/dist/internal/popup-menu/index.d.ts +846 -0
- package/dist/internal/popup-menu/index.js +2 -0
- package/dist/internal/popup-menu/index.js.map +1 -0
- package/dist/item-equality-B6TbXlBT.d.cts +7 -0
- package/dist/item-equality-B6TbXlBT.d.ts +7 -0
- package/dist/loading-DphSt8MY.d.cts +27 -0
- package/dist/loading-TsgH6v92.d.ts +27 -0
- package/dist/select/index.cjs +2 -0
- package/dist/select/index.cjs.map +1 -0
- package/dist/select/index.d.cts +927 -0
- package/dist/select/index.d.ts +927 -0
- package/dist/select/index.js +2 -0
- package/dist/select/index.js.map +1 -0
- package/dist/separator-B4Ot84B0.d.ts +748 -0
- package/dist/separator-BmbUeeaT.d.cts +748 -0
- package/dist/types-9vS1uLIK.d.cts +1557 -0
- package/dist/types-lQCIvWW8.d.ts +1557 -0
- package/dist/use-listbox-item-BIi4eRPI.d.cts +182 -0
- package/dist/use-listbox-item-BIi4eRPI.d.ts +182 -0
- package/package.json +50 -12
- package/dist/index.d.ts +0 -2
- package/dist/index.js +0 -2
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import{a as Io,b as yo,c as So,d as vo}from"../chunk-AVZ64JQ3.js";import{$ as uo,L as no,N as ro,P as ao,Qa as ho,R as so,Ra as Ro,S as O,Sa as Po,T as pt,_ as lo,aa as ct,da as io,ea as po,f as to,fa as co,ha as j,ia as F,ja as mo,l as pe,oa as bo,qa as mt,sa as xo,wa as fo,xa as Co,ya as go}from"../chunk-WKAPAKUL.js";import{a as _,o as at,p as st,v as lt,w as ut,x as it}from"../chunk-KWGD24VS.js";import{a as rt}from"../chunk-4C666HHU.js";var Ho={};rt(Ho,{Arrow:()=>ro,Backdrop:()=>ao,Clear:()=>ye,Empty:()=>bo,Group:()=>ho,GroupLabel:()=>Ro,Icon:()=>mo,Input:()=>Ve,InputWrapper:()=>Me,Item:()=>Ee,ItemIndicator:()=>Le,ItemLabel:()=>we,List:()=>xo,Popup:()=>lo,Portal:()=>uo,Positioner:()=>Te,Root:()=>ke,ScrollDownArrow:()=>Co,ScrollUpArrow:()=>fo,Separator:()=>Po,Surface:()=>He,useComboboxPositionerContext:()=>Se});import{useRender as bt}from"@base-ui/react/use-render";import*as X from"react";var Vo={slot:"bazzaui-combobox-clear"};var ye=X.forwardRef(function(e,t){let{keepMounted:a=!1,disabled:n,render:r,className:c,style:d,onClick:o,...i}=e,p=O(),f=n??p.disabled,m=p.multiple?p.values.length>0:p.value!=="",y=X.useCallback(R=>{o?.(R),!R.defaultPrevented&&(p.multiple?p.onValuesChange([]):p.onValueChange(""),p.onInputValueChange(""))},[o,p]),u=X.useCallback(R=>{R.preventDefault()},[]),C=X.useMemo(()=>({hasValue:m,disabled:f}),[m,f]),b=bt({render:r,ref:t,state:C,props:{...i,[Vo.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:f||!m,className:c,style:d,onClick:y,onPointerDown:u},enabled:a||m,defaultTagName:"button"});return!a&&!m?null:b});import*as ce from"react";var me=ce.createContext(null);function Se(){return ce.useContext(me)}import{useRender as xt}from"@base-ui/react/use-render";import*as ee from"react";import*as be from"react";var ve=be.createContext(!1);function Mo(){return be.useContext(ve)}var Q={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};import*as re from"react";function dt(l,e){if(!l)return;if(Array.isArray(l)){let n=l.find(r=>r.value===e)?.label;return typeof n=="string"?n:void 0}let t=l[e];return typeof t=="string"?t:void 0}function Eo(l){let{comboboxContext:e,open:t}=l,a=e.multiple?e.values.length>0:e.value!=null,n=re.useCallback(d=>{let o=F(d,e.itemToStringValue),i=e.itemTextRegistry.get(o);if(i!==void 0)return i;let p=dt(e.items,o);if(p!==void 0)return p;let f=j(d,e.itemToStringLabel);if(f&&f!==o)return f},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),r=re.useMemo(()=>{if(!a)return"";if(e.multiple){let i=e.values.map(p=>{let f=n(p);return f!==void 0?f:j(p,e.itemToStringLabel)||F(p,e.itemToStringValue)}).filter(Boolean);return i.length<=2?i.join(", "):`${i.length} selected`}let d=e.value;if(d==null)return"";let o=n(d);return o!==void 0?o:j(d,e.itemToStringLabel)||F(d,e.itemToStringValue)},[a,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,n]),c=re.useMemo(()=>t?e.inputValue:r,[t,r,e.inputValue]);return{hasValue:a,displayValue:c,selectedLabel:r,getValueText:n}}import*as T from"react";function Lo(l){let{comboboxContext:e,store:t,focusOwnerStore:a,open:n,disabled:r,cursorBehavior:c,hasValue:d,getValueText:o,onFocus:i,onBlur:p,onClick:f,onKeyDown:m}=l,y=T.useRef(!1),u=T.useRef(!1),C=T.useRef(!1),b=T.useRef(null),R=T.useRef(null),I=T.useRef(null);T.useEffect(()=>{if(!n)return;let s=x=>{let E=e.inputRef.current,v=e.inputWrapperRef.current,L=document.getElementById(e.listId),A=x.target,P=E?.contains(A),B=v?.contains(A),G=L?.contains(A);!P&&!B&&!G&&(I.current=x)};return document.addEventListener("pointerdown",s,!0),()=>{document.removeEventListener("pointerdown",s,!0),I.current=null}},[n,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let s=e.inputRef.current;if(s&&n&&R.current){let{start:x,end:E}=R.current,v=s.selectionStart,L=s.value.length;v===L&&x!==L&&s.setSelectionRange(x,E),R.current=null}});let S=T.useRef(n);T.useLayoutEffect(()=>{if(n&&!S.current){if(y.current){y.current=!1,S.current=n;return}if(C.current){C.current=!1,u.current=!1,b.current=null,S.current=n;return}if(u.current&&c==="none"){let x=e.inputRef.current,E=b.current;x&&E!==null&&requestAnimationFrame(()=>{let v=x.value.length,L=Math.min(E,v);x.setSelectionRange(L,L)}),u.current=!1,b.current=null,S.current=n;return}d&&e.multiple&&e.onInputValueChange("");let s=e.inputRef.current;if(s){let x=s.value.length;c==="select-all"&&x>0?requestAnimationFrame(()=>{s.setSelectionRange(0,s.value.length)}):c==="end"&&x>0&&requestAnimationFrame(()=>{s.setSelectionRange(s.value.length,s.value.length)})}}S.current=n},[n,e,d,c]);let V=T.useCallback(s=>{let x=s.target,E=x.value,v=x.selectionStart,L=x.selectionEnd;v!==null&&L!==null&&(R.current={start:v,end:L}),e.onInputValueChange(E),e.setFilterActive(),t.setSearch(E),t.state.open||(y.current=!0,e.openCombobox())},[e,t]),D=T.useCallback(s=>{if(i?.(s),s.defaultPrevented)return;let x=t.state.open;if(x&&(C.current=!0),e.openOnFocus&&!r&&!x){if(d&&!e.multiple){let E=o(e.value)??j(e.value,e.itemToStringLabel);e.onInputValueChange(E)}e.openCombobox()}},[i,e,r,t,d,o]),z=T.useCallback(s=>{p?.(s),!s.defaultPrevented&&requestAnimationFrame(()=>{let x=document.activeElement,v=document.getElementById(e.listId)?.contains(x),L=x===e.inputRef.current;if(!v&&!L){C.current=!1;let A=I.current,P=A?_.outsidePress:_.focusOut;I.current=null,e.closeCombobox(P,A??void 0)}})},[p,e]),H=T.useCallback(s=>{if(f?.(s),s.defaultPrevented)return;let x=t.state.open;if(!r&&!x){let E=s.target;if(c==="none"){let v=E.selectionStart;b.current=v,u.current=!0}if(d&&!e.multiple){let v=o(e.value)??j(e.value,e.itemToStringLabel);e.onInputValueChange(v)}e.openCombobox()}else x&&(C.current=!0)},[f,e,r,t,c,d,o]),N=T.useCallback(s=>{if(m?.(s),!s.defaultPrevented){if(n&&s.key==="Escape"){s.preventDefault(),e.closeCombobox(_.escapeKey);return}if(!n&&(s.key==="ArrowDown"||s.key==="ArrowUp"||s.key==="Enter")){if(s.preventDefault(),d&&!e.multiple){let x=o(e.value)??j(e.value,e.itemToStringLabel);e.onInputValueChange(x)}e.openCombobox();return}}},[n,e,m,d,o]),{handleKeyDown:M}=co({store:t,surfaceId:"combobox-input",focusOwnerStore:a,depth:0,submenuContext:null,subpageContext:null,enabled:n,enableTypeToSearch:!1,onKeyDown:N,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:V,handleFocus:D,handleBlur:z,handleClick:H,handleKeyDown:M,selectionRef:R}}var Ve=ee.forwardRef(function(e,t){let{placeholder:a,disabled:n,cursorBehavior:r="none",render:c,className:d,style:o,onFocus:i,onBlur:p,onClick:f,onKeyDown:m,...y}=e,u=O(),C=pe(),b=to(),R=Mo(),I=(n??u.disabled)||C.disabled,S=a??u.placeholder,V=C.store.useState("open"),{hasValue:D,displayValue:z,getValueText:H}=Eo({comboboxContext:u,open:V}),{handleChange:N,handleFocus:M,handleBlur:s,handleClick:x,handleKeyDown:E}=Lo({comboboxContext:u,store:C.store,focusOwnerStore:b,open:V,disabled:I,cursorBehavior:r,hasValue:D,getValueText:H,onFocus:i,onBlur:p,onClick:f,onKeyDown:m}),v={[Q.slot]:""};V?v[Q.open]="":v[Q.closed]="",I&&(v[Q.disabled]=""),D||(v[Q.placeholder]=""),u.layout==="input-embedded"&&(v["data-input-embedded"]="");let L=ee.useCallback(G=>{u.setInputElement(G),typeof t=="function"?t(G):t&&(t.current=G)},[t,u]),A=ee.useMemo(()=>({open:V,disabled:I,placeholder:!D}),[V,I,D]),P=u.layout==="input-embedded"&&!R?{position:"relative",zIndex:1}:void 0;return xt({render:c,ref:L,state:A,props:{...y,...v,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":V,"aria-controls":u.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:I,placeholder:D?void 0:S,className:d,style:{...P,...o},value:z,onChange:N,onFocus:M,onBlur:s,onClick:x,onKeyDown:E},defaultTagName:"input"})});import{useRender as ft}from"@base-ui/react/use-render";import*as oe from"react";var de={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};import{jsx as gt}from"react/jsx-runtime";var Ct={open:l=>l?{[de.open]:""}:null},Me=oe.forwardRef(function(e,t){let{render:a,className:n,style:r,children:c,...d}=e,{store:o}=pe(),i=O(),p=o.useState("open"),f=oe.useMemo(()=>({open:p}),[p]),m=i.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},y=oe.useCallback(C=>{i.setInputWrapperElement(C),typeof t=="function"?t(C):t&&(t.current=C)},[t,i]),u=ft({render:a,ref:y,state:f,stateAttributesMapping:Ct,props:{...d,[de.slot]:"",className:n,style:{...m,...r},children:c},defaultTagName:"div"});return gt(ve.Provider,{value:!0,children:u})});import{useRender as Rt}from"@base-ui/react/use-render";import*as w from"react";var te={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected"};import*as ae from"react";var xe=ae.createContext(null);function se(){let l=ae.useContext(xe);if(!l)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return l}function ht(){return ae.useContext(xe)}import{jsx as St}from"react/jsx-runtime";var Pt={highlighted:l=>l?{[te.highlighted]:""}:null,disabled:l=>l?{[te.disabled]:""}:null,selected:l=>l?{[te.selected]:""}:null};function It(l,e){if(l)return Array.isArray(l)?l.find(a=>a.value===e)?.label:l[e]}function yt(l,e){let{value:t,textValue:a,keywords:n,disabled:r=!1,onSelect:c,forceMount:d=!1,render:o,className:i,style:p,onClick:f,onPointerDown:m,onPointerMove:y,children:u,...C}=l,b=O(),R=w.useMemo(()=>F(t,b.itemToStringValue),[t,b.itemToStringValue]),I=w.useMemo(()=>It(b.items,R),[b.items,R]),S=w.useMemo(()=>j(t,b.itemToStringLabel),[t,b.itemToStringLabel]),V=w.useMemo(()=>{if(a!==void 0)return a;if(typeof I=="string")return I;if(S&&S!==R)return S},[a,I,S,R]),D=w.useMemo(()=>{let P=typeof I=="string"?I:S&&S!==R?S:void 0;return P?n?n.includes(P)?n:[...n,P]:[P]:n},[n,I,S,R]),z=w.useRef(V),H=b.multiple?So(b.values,t,b.isItemEqualToValue):b.value!=null&&yo(b.value,t,b.isItemEqualToValue),N=b.closeOnSelect,M=po({value:R,keywords:D,disabled:r,forceMount:d,closeOnClick:N,children:u});w.useEffect(()=>{let P=()=>{if(!r){if(b.multiple){let B=H?vo(b.values,t,b.isItemEqualToValue):[...b.values,t];b.onValuesChange(B)}else b.onValueChange(t);c?.()}};return M.registerSelect(P)},[r,b,t,H,c,M]),w.useEffect(()=>{let P=z.current;if(P)return b.registerItemText(R,P)},[R,b]),w.useEffect(()=>{!V&&typeof u=="string"&&(z.current=u,b.registerItemText(R,u))},[u,V,R,b]);let s=w.useMemo(()=>({highlighted:M.isHighlighted,disabled:r,selected:H}),[M.isHighlighted,r,H]),x=w.useMemo(()=>({id:M.id,value:t,textValue:V,highlighted:M.isHighlighted,disabled:r,selected:H}),[M.id,t,V,M.isHighlighted,r,H]),E=w.useCallback(P=>{f?.(P),P.defaultPrevented||M.handlers.onClick(P)},[f,M.handlers]),v=w.useCallback(P=>{M.handlers.onPointerDown(P),m?.(P)},[M.handlers,m]),L=w.useCallback(P=>{y?.(P),P.defaultPrevented||M.handlers.onPointerMove(P)},[y,M.handlers]),A=Rt({render:o,ref:[M.ref,e],state:s,stateAttributesMapping:Pt,props:{...C,[te.slot]:"",id:M.id,role:"option",tabIndex:-1,"aria-selected":H,"aria-disabled":r||void 0,className:i,style:p,onClick:E,onPointerMove:L,onPointerDown:v,children:u},enabled:M.isVisible,defaultTagName:"div"});return M.isVisible?St(xe.Provider,{value:x,children:A}):null}var Ee=w.forwardRef(yt);import{useRender as vt}from"@base-ui/react/use-render";import*as Ce from"react";var fe={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var Vt={selected:l=>l?{[fe.selected]:""}:null},Le=Ce.forwardRef(function(e,t){let{keepMounted:a=!1,render:n,className:r,style:c,...d}=e,o=se(),i=Ce.useMemo(()=>({selected:o.selected}),[o.selected]),p=vt({render:n,ref:t,state:i,stateAttributesMapping:Vt,props:{...d,[fe.slot]:"","aria-hidden":!0,className:r,style:c},enabled:a||o.selected,defaultTagName:"span"});return!a&&!o.selected?null:p});import{useRender as Mt}from"@base-ui/react/use-render";import*as Y from"react";var wo={slot:"bazzaui-combobox-item-label"};function Et(l,e){if(l)return Array.isArray(l)?l.find(a=>a.value===e)?.label:l[e]}var we=Y.forwardRef(function(e,t){let{render:a,className:n,style:r,children:c,...d}=e,o=O(),i=se(),p=F(i.value,o.itemToStringValue),f=Y.useMemo(()=>{if(c!==void 0)return c;let y=Et(o.items,p);return y!==void 0?y:i.textValue!==void 0?i.textValue:p},[c,o.items,p,i.textValue]),m=Y.useMemo(()=>({value:p,selected:i.selected,highlighted:i.highlighted,disabled:i.disabled}),[p,i.selected,i.highlighted,i.disabled]);return Y.useEffect(()=>{if(typeof f=="string")return o.registerItemText(p,f)},[f,o,p]),Mt({render:a,ref:t,state:m,props:{...d,[wo.slot]:"",className:n,style:r,children:f},defaultTagName:"span"})});import{Popover as To}from"@base-ui/react/popover";import*as U from"react";var ge={slot:"bazzaui-combobox-positioner"};import{jsx as le}from"react/jsx-runtime";function Lt(l,e,t,a){let n=t+a*2;if(l==="top"){let d=-(e+a),o=e+a;return{width:n,marginBottom:d,paddingTop:a,paddingLeft:a,paddingRight:a,paddingBottom:o}}let r=-(e+a),c=e+a;return{width:n,marginTop:r,paddingTop:c,paddingLeft:a,paddingRight:a,paddingBottom:a}}var Te=U.forwardRef(function(e,t){let{layout:a,popupPadding:n=8,side:r="bottom",align:c,sideOffset:d=4,anchor:o,className:i,style:p,children:f,...m}=e,y=O(),u=a??y.layout,C=u==="input-embedded",b=o??y.inputWrapperRef.current?y.inputWrapperRef:y.inputRef,R=C?0:d,I=C?"center":c??"start",{inputHeight:S,inputWidth:V}=y,D=V+n*2,z={...p,...C?{zIndex:0}:{}};if(C)return le(To.Positioner,{ref:t,side:r,align:I,sideOffset:R,anchor:b,className:i,style:z,"data-input-embedded":"",[ge.slot]:"",...m,render:(s,x)=>{let E=x.side,v={layout:u,side:E,align:x.align,inputHeight:y.inputHeight},L={"--combobox-input-height":`${S}px`,"--combobox-input-width":`${V}px`,"--combobox-popup-padding":`${n}px`,"--combobox-popup-width":`${D}px`},A=Lt(E,S,V,n),P=U.Children.map(f,B=>U.isValidElement(B)?U.cloneElement(B,{style:{...A,...B.props.style},"data-side":E}):B);return le(me.Provider,{value:v,children:le("div",{...s,style:{...s.style,...L},"data-side":E,children:P})})}});let H={layout:u,side:r,align:I,inputHeight:y.inputHeight},N={"--combobox-input-height":`${S}px`,"--combobox-input-width":`${V}px`},M={...z,...N};return le(me.Provider,{value:H,children:le(To.Positioner,{ref:t,side:r,align:I,sideOffset:R,anchor:b,className:i,style:M,[ge.slot]:"",...m,children:f})})});import{Popover as wt}from"@base-ui/react/popover";import*as g from"react";import{jsx as ue,jsxs as Tt}from"react/jsx-runtime";function ke(l){let{open:e,onOpenChange:t,actionsRef:a,defaultOpen:n=!1,value:r,defaultValue:c,onValueChange:d,multiple:o=!1,values:i,defaultValues:p,onValuesChange:f,isItemEqualToValue:m=Io,itemToStringLabel:y,itemToStringValue:u,inputValue:C,defaultInputValue:b="",onInputValueChange:R,name:I,form:S,required:V,disabled:D=!1,placeholder:z="Search...",items:H,modal:N=!1,closeOnSelect:M,openOnFocus:s=!0,virtualized:x=!1,virtualItems:E,onHighlightChange:v,layout:L="floating",onOpenChangeComplete:A,debug:P,children:B,...G}=l,Ae=g.useId(),ie=g.useRef(null),he=g.useRef(null),[Oe,De]=g.useState(0),[Fe,ze]=g.useState(0),Be=g.useCallback(h=>{if(ie.current=h,h&&!he.current){let k=h.getBoundingClientRect();De(k.height),ze(k.width)}},[]),We=g.useCallback(h=>{if(he.current=h,h){let k=h.getBoundingClientRect();De(k.height),ze(k.width)}},[]),{store:W,focusOwnerStore:No,openChainStore:qo,registerSurface:Uo,closeAll:Go,virtualization:Ko,handleOpenChange:je,disabled:K,setDisabled:Ne}=no({onOpenChange:t,defaultOpen:n,virtualized:x,items:E,onHighlightChange:v,disabled:D}),Re=g.useRef(null);g.useImperativeHandle(a,()=>({close:()=>{Re.current?.close()},unmount:()=>{Re.current?.unmount()},setDisabled:Ne}),[Ne]),W.useControlledProp("open",e,n);let $o=W.useState("open"),qe=g.useCallback((h,k,q)=>{K&&k!==_.imperativeAction||!h&&ie.current&&document.activeElement===ie.current||je(h,k,q)},[je,K]),Jo=g.useCallback(h=>{!h&&W.context.clearSearchOnClose==="after-exit"&&(W.clearSearch(),W.setInputActive(!1)),A?.(h)},[W,A]),Xo=g.useCallback((h,k)=>{qe(h,k.reason,k.event)},[qe]),[Qo,Yo]=g.useState(c!==void 0?c:null),$=r!==void 0?r:Qo,Ue=g.useCallback(h=>{r===void 0&&Yo(h),d?.(h)},[r,d]),[Zo,_o]=g.useState(p??[]),ne=i!==void 0?i:Zo,Ge=g.useCallback(h=>{i===void 0&&_o(h),f?.(h)},[i,f]),[Pe,et]=g.useState(b),Ke=C!==void 0?C:Pe,$e=g.useCallback(h=>{C===void 0&&et(h),R?.(h)},[C,R]),Je=g.useRef(new Map),Xe=g.useCallback((h,k)=>(Je.current.set(h,k),()=>{}),[]),Qe=M??!o,Ie=g.useRef({type:"active"}),[,ot]=g.useState({type:"active"}),J=g.useCallback(h=>{Ie.current=h,ot(h)},[]),Ye=Ie.current,Ze=g.useCallback(()=>{J({type:"active"})},[J]),_e=g.useCallback(()=>{K||(!o&&$!=null?J({type:"showAll"}):J({type:"active"}),W.setOpen(!0))},[K,W,o,$,J]),eo=g.useCallback((h,k)=>{let q=Ie.current,oo=q.type==="active"?Pe:q.type==="showAll"?"":q.search;J({type:"frozen",search:oo}),W.setOpen(!1,h,k)},[W,J,Pe]),tt=g.useMemo(()=>({multiple:o,value:$,values:ne,onValueChange:Ue,onValuesChange:Ge,isItemEqualToValue:m,itemToStringLabel:y,itemToStringValue:u,inputValue:Ke,onInputValueChange:$e,name:I,form:S,required:V,disabled:K,placeholder:z,items:H,itemTextRegistry:Je.current,registerItemText:Xe,listId:Ae,inputRef:ie,setInputElement:Be,inputWrapperRef:he,setInputWrapperElement:We,closeOnSelect:Qe,openOnFocus:s,openCombobox:_e,closeCombobox:eo,filterMode:Ye,setFilterActive:Ze,inputHeight:Oe,inputWidth:Fe,layout:L}),[o,$,ne,Ue,Ge,m,y,u,Ke,$e,I,S,V,K,z,H,Xe,Ae,Be,We,Qe,s,_e,eo,Ye,Ze,Oe,Fe,L]),nt=g.useMemo(()=>I?o?ne.length>0?ne.map((h,k)=>{let q=F(h,u);return ue("input",{type:"hidden",name:I,value:q,form:S,required:V&&k===0},q)}):ue("input",{type:"hidden",name:I,value:"",form:S,required:V}):ue("input",{type:"hidden",name:I,value:$!=null?F($,u):"",form:S,required:V}):null,[I,S,V,o,$,ne,u]);return ue(so.Provider,{value:tt,children:Tt(io,{store:W,focusOwnerStore:No,openChainStore:qo,disabled:K,depth:0,closeAll:Go,registerSurface:Uo,virtualization:Ko,menuType:"dropdown",componentName:"combobox",debug:P,children:[nt,ue(wt.Root,{...G,open:$o,onOpenChange:Xo,onOpenChangeComplete:Jo,modal:N,actionsRef:a?Re:void 0,children:B})]})})}import*as Z from"react";var ko={slot:"bazzaui-combobox-surface"};import{jsx as kt}from"react/jsx-runtime";var He=Z.forwardRef(function(e,t){let{autoHighlightFirst:a,search:n,onSearchChange:r,onPointerMove:c,...d}=e,o=O(),i=Z.useCallback(u=>{c?.(u);let C=o.inputRef.current;C&&document.activeElement!==C&&C.focus()},[c,o.inputRef]),p=Z.useMemo(()=>{let u=a??!0;if(u==="selected"){let C=o.multiple?o.values[0]:o.value;return C!=null?F(C,o.itemToStringValue):!0}return u},[a,o.multiple,o.value,o.values,o.itemToStringValue]),{filterMode:f}=o,m=n??(f.type==="active"?o.inputValue:f.type==="showAll"?"":f.search),y=Z.useCallback(u=>{o.onInputValueChange(u),r?.(u)},[o,r]);return kt(go,{ref:t,autoHighlightFirst:p,search:m,onSearchChange:y,onPointerMove:i,skipAutoFocus:!0,[ko.slot]:"",...d})});var Ao=(c=>(c.slot="bazzaui-combobox-arrow",c.open="data-open",c.closed="data-closed",c.side="data-side",c.align="data-align",c.uncentered="data-uncentered",c))(Ao||{});var Oo=(r=>(r.slot="bazzaui-combobox-backdrop",r.open="data-open",r.closed="data-closed",r.startingStyle="data-starting-style",r.endingStyle="data-ending-style",r))(Oo||{});var Do=(e=>(e.slot="bazzaui-combobox-empty",e))(Do||{});var Fo=(e=>(e.slot="bazzaui-combobox-group",e))(Fo||{});var zo=(e=>(e.slot="bazzaui-combobox-group-label",e))(zo||{});var Ht={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var Bo=(t=>(t.slot="bazzaui-combobox-list",t.list="data-popup-menu-list",t))(Bo||{});var Wo=(m=>(m.slot="bazzaui-combobox-popup",m.open="data-open",m.closed="data-closed",m.side="data-side",m.align="data-align",m.startingStyle="data-starting-style",m.endingStyle="data-ending-style",m.instant="data-instant",m.focused="data-focused",m.hasOpenSubmenu="data-has-open-submenu",m.submenu="data-submenu",m.navigating="data-navigating",m))(Wo||{});var At={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var jo=(e=>(e.slot="bazzaui-combobox-separator",e))(jo||{});export{Ho as Combobox,Ao as ComboboxArrowDataAttributes,Oo as ComboboxBackdropDataAttributes,ye as ComboboxClear,Do as ComboboxEmptyDataAttributes,Fo as ComboboxGroupDataAttributes,zo as ComboboxGroupLabelDataAttributes,Ht as ComboboxIconDataAttributes,Ve as ComboboxInput,Q as ComboboxInputDataAttributes,Me as ComboboxInputWrapper,de as ComboboxInputWrapperDataAttributes,Ee as ComboboxItem,te as ComboboxItemDataAttributes,Le as ComboboxItemIndicator,fe as ComboboxItemIndicatorDataAttributes,we as ComboboxItemLabel,mt as ComboboxListCssVars,Bo as ComboboxListDataAttributes,Wo as ComboboxPopupDataAttributes,Te as ComboboxPositioner,ct as ComboboxPositionerCssVars,ge as ComboboxPositionerDataAttributes,ke as ComboboxRoot,At as ComboboxScrollArrowDataAttributes,jo as ComboboxSeparatorDataAttributes,it as ComboboxStore,He as ComboboxSurface,lt as commandScore,ut as defaultFilter,O as useComboboxContext,se as useComboboxItemContext,Se as useComboboxPositionerContext,pt as useMaybeComboboxContext,ht as useMaybeComboboxItemContext,st as useMaybeSurfaceContext,at as useSurfaceContext};
|
|
2
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/combobox/index.parts.ts","../../src/combobox/clear/clear.tsx","../../src/combobox/clear/clear.data-attrs.ts","../../src/combobox/contexts/combobox-positioner-context.ts","../../src/combobox/input/input.tsx","../../src/combobox/input-wrapper/input-wrapper-context.ts","../../src/combobox/input/input.data-attrs.ts","../../src/combobox/input/use-combobox-display-value.ts","../../src/combobox/input/use-combobox-input-behavior.ts","../../src/combobox/input-wrapper/input-wrapper.tsx","../../src/combobox/input-wrapper/input-wrapper.data-attrs.ts","../../src/combobox/item/item.tsx","../../src/combobox/item/item.data-attrs.ts","../../src/combobox/item/item-context.ts","../../src/combobox/item-indicator/item-indicator.tsx","../../src/combobox/item-indicator/item-indicator.data-attrs.ts","../../src/combobox/item-label/item-label.tsx","../../src/combobox/item-label/item-label.data-attrs.ts","../../src/combobox/positioner/positioner.tsx","../../src/combobox/positioner/positioner.data-attrs.ts","../../src/combobox/root/root.tsx","../../src/combobox/surface/surface.tsx","../../src/combobox/surface/surface.data-attrs.ts","../../src/combobox/arrow/arrow.data-attrs.ts","../../src/combobox/backdrop/backdrop.data-attrs.ts","../../src/combobox/empty/empty.data-attrs.ts","../../src/combobox/group/group.data-attrs.ts","../../src/combobox/group-label/group-label.data-attrs.ts","../../src/combobox/icon/icon.data-attrs.ts","../../src/combobox/list/list.data-attrs.ts","../../src/combobox/popup/popup.data-attrs.ts","../../src/combobox/scroll-arrow/scroll-arrow.data-attrs.ts","../../src/combobox/separator/separator.data-attrs.ts"],"sourcesContent":["// ============================================================================\n// Combobox Parts\n// ============================================================================\n// Re-exports shared components from internal/popup-menu with Combobox-specific\n// Root, Input, Item, ItemLabel, and ItemIndicator components.\n\n// Re-export VirtualItem type from internal/listbox\nexport type { VirtualItem } from '../internal/listbox/index.js'\n\n// Re-export shared components from internal/popup-menu\nexport {\n PopupMenuArrow as Arrow,\n PopupMenuBackdrop as Backdrop,\n PopupMenuEmpty as Empty,\n // Structure\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n // Icon\n PopupMenuIcon as Icon,\n PopupMenuList as List,\n PopupMenuPopup as Popup,\n // Positioning & Container\n PopupMenuPortal as Portal,\n // Scroll indicators\n PopupMenuScrollDownArrow as ScrollDownArrow,\n PopupMenuScrollUpArrow as ScrollUpArrow,\n PopupMenuSeparator as Separator,\n} from '../internal/popup-menu/index.js'\nexport { ComboboxClear as Clear } from './clear/clear.js'\nexport { useComboboxPositionerContext } from './contexts/combobox-positioner-context.js'\nexport { ComboboxInput as Input } from './input/input.js'\nexport { ComboboxInputWrapper as InputWrapper } from './input-wrapper/input-wrapper.js'\nexport { ComboboxItem as Item } from './item/item.js'\nexport { ComboboxItemIndicator as ItemIndicator } from './item-indicator/item-indicator.js'\nexport { ComboboxItemLabel as ItemLabel } from './item-label/item-label.js'\nexport { ComboboxPositioner as Positioner } from './positioner/positioner.js'\n// Combobox-specific components\nexport { ComboboxRoot as Root } from './root/root.js'\nexport { ComboboxSurface as Surface } from './surface/surface.js'\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxClearDataAttributes } from './clear.data-attrs.js'\n\nexport { ComboboxClearDataAttributes }\n\nexport interface ComboboxClearState extends Record<string, unknown> {\n /**\n * Whether the combobox has a value (clear button is actionable).\n */\n hasValue: boolean\n /**\n * Whether the combobox is disabled.\n */\n disabled: boolean\n}\n\nexport interface ComboboxClearProps\n extends ComponentProps<'button', ComboboxClear.State> {\n /**\n * Whether to render the button even when there's no value to clear.\n * @default false\n */\n keepMounted?: boolean\n}\n\n/**\n * A button that clears the selected value(s) when clicked.\n * Renders a `<button>` element.\n */\nexport const ComboboxClear = React.forwardRef<\n HTMLButtonElement,\n ComboboxClear.Props\n>(function ComboboxClear(props, forwardedRef) {\n const {\n keepMounted = false,\n disabled: disabledProp,\n render,\n className,\n style,\n onClick,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n\n const disabled = disabledProp ?? comboboxContext.disabled\n\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : comboboxContext.value !== ''\n\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLButtonElement>) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n\n if (comboboxContext.multiple) {\n comboboxContext.onValuesChange([])\n } else {\n comboboxContext.onValueChange('')\n }\n\n // Also clear the input value\n comboboxContext.onInputValueChange('')\n },\n [onClick, comboboxContext],\n )\n\n // Prevent pointer down from stealing focus from the input\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<HTMLButtonElement>) => {\n event.preventDefault()\n },\n [],\n )\n\n const state: ComboboxClear.State = React.useMemo(\n () => ({\n hasValue,\n disabled,\n }),\n [hasValue, disabled],\n )\n\n const element = useRender({\n render,\n ref: forwardedRef,\n state,\n props: {\n ...rest,\n [ComboboxClearDataAttributes.slot]: '',\n type: 'button',\n tabIndex: -1, // Not tabbable - use keyboard shortcuts instead\n 'aria-label': 'Clear selection',\n disabled: disabled || !hasValue,\n className,\n style,\n onClick: handleClick,\n onPointerDown: handlePointerDown,\n },\n enabled: keepMounted || hasValue,\n defaultTagName: 'button',\n })\n\n // Don't render if no value and not keepMounted\n if (!keepMounted && !hasValue) {\n return null\n }\n\n return element\n})\n\nexport namespace ComboboxClear {\n export type State = ComboboxClearState\n export interface Props extends ComboboxClearProps {}\n}\n","/**\n * Data attributes for ComboboxClear component.\n */\nexport const ComboboxClearDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-clear'}\n */\n slot: 'bazzaui-combobox-clear',\n} as const\n","'use client'\n\nimport * as React from 'react'\n\n// ============================================================================\n// Types\n// ============================================================================\n\n// Types matching Base UI's positioning types\nexport type Side = 'top' | 'bottom' | 'left' | 'right'\nexport type Align = 'start' | 'center' | 'end'\n\n/**\n * Layout mode for the combobox popup.\n * - `'floating'` - Standard dropdown positioning below/above the input\n * - `'input-embedded'` - Popup wraps around the input (macOS-style)\n */\nexport type ComboboxLayout = 'floating' | 'input-embedded'\n\n/**\n * Context value for Combobox Positioner.\n * Provides alignment state for coordinating positioning behavior.\n */\nexport interface ComboboxPositionerContextValue {\n /**\n * The layout mode being used.\n * - `'floating'` - Standard dropdown positioning\n * - `'input-embedded'` - Popup wraps around the input\n */\n layout: ComboboxLayout\n\n /**\n * The side of the popup relative to the input.\n */\n side: Side\n\n /**\n * The alignment of the popup.\n */\n align: Align\n\n /**\n * Height of the input element in pixels.\n * Use this to add appropriate padding to the popup.\n */\n inputHeight: number\n}\n\n// ============================================================================\n// Context\n// ============================================================================\n\nconst ComboboxPositionerContext =\n React.createContext<ComboboxPositionerContextValue | null>(null)\n\n/**\n * Hook to access the Combobox Positioner context.\n * Returns null if used outside a ComboboxPositioner.\n */\nexport function useComboboxPositionerContext(): ComboboxPositionerContextValue | null {\n return React.useContext(ComboboxPositionerContext)\n}\n\nexport { ComboboxPositionerContext }\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { useFocusOwner } from '../../internal/popup-menu/contexts/focus-owner-context.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { useIsInsideInputWrapper } from '../input-wrapper/input-wrapper-context.js'\nimport { ComboboxInputDataAttributes } from './input.data-attrs.js'\nimport { useComboboxDisplayValue } from './use-combobox-display-value.js'\nimport { useComboboxInputBehavior } from './use-combobox-input-behavior.js'\n\nexport { ComboboxInputDataAttributes }\n\nexport interface ComboboxInputState extends Record<string, unknown> {\n /**\n * Whether the combobox popup is open.\n */\n open: boolean\n /**\n * Whether the input is disabled.\n */\n disabled: boolean\n /**\n * Whether the input currently shows placeholder (no value selected).\n */\n placeholder: boolean\n}\n\n/**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n */\nexport type ComboboxInputCursorBehavior = 'none' | 'end' | 'select-all'\n\nexport interface ComboboxInputProps\n extends Omit<\n ComponentProps<'input', ComboboxInput.State>,\n 'value' | 'onChange' | 'type'\n > {\n /**\n * Placeholder text shown when no value is selected and input is empty.\n * Overrides the placeholder set on Combobox.Root.\n */\n placeholder?: string\n\n /**\n * Cursor behavior when the combobox popup opens.\n * - `'none'` - Don't move the cursor (cursor appears where clicked)\n * - `'end'` - Move cursor to the end of the input\n * - `'select-all'` - Move cursor to the end and select all text\n *\n * @default 'none'\n */\n cursorBehavior?: ComboboxInputCursorBehavior\n}\n\n/**\n * An input that acts as both the trigger and search field for the combobox.\n * Renders an `<input>` element with combobox ARIA semantics.\n */\nexport const ComboboxInput = React.forwardRef<\n HTMLInputElement,\n ComboboxInput.Props\n>(function ComboboxInput(props, forwardedRef) {\n const {\n placeholder: placeholderProp,\n disabled: disabledProp,\n cursorBehavior = 'none',\n render,\n className,\n style,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n const popupMenuContext = usePopupMenuContext()\n const focusOwnerStore = useFocusOwner()\n const isInsideInputWrapper = useIsInsideInputWrapper()\n\n const disabled =\n (disabledProp ?? comboboxContext.disabled) || popupMenuContext.disabled\n const placeholder = placeholderProp ?? comboboxContext.placeholder\n\n // Get open state\n const open = popupMenuContext.store.useState('open')\n\n // Use display value hook\n const { hasValue, displayValue, getValueText } = useComboboxDisplayValue({\n comboboxContext,\n open,\n })\n\n // Use input behavior hook\n const { handleChange, handleFocus, handleBlur, handleClick, handleKeyDown } =\n useComboboxInputBehavior({\n comboboxContext,\n store: popupMenuContext.store,\n focusOwnerStore,\n open,\n disabled,\n cursorBehavior,\n hasValue,\n getValueText,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n })\n\n // Build data attributes\n const dataAttrs: Record<string, string> = {\n [ComboboxInputDataAttributes.slot]: '',\n }\n if (open) {\n dataAttrs[ComboboxInputDataAttributes.open] = ''\n } else {\n dataAttrs[ComboboxInputDataAttributes.closed] = ''\n }\n if (disabled) {\n dataAttrs[ComboboxInputDataAttributes.disabled] = ''\n }\n if (!hasValue) {\n dataAttrs[ComboboxInputDataAttributes.placeholder] = ''\n }\n // Add input-embedded data attribute when layout is input-embedded\n if (comboboxContext.layout === 'input-embedded') {\n dataAttrs['data-input-embedded'] = ''\n }\n\n // Register input element for positioning\n const mergedRef = React.useCallback(\n (node: HTMLInputElement | null) => {\n comboboxContext.setInputElement(node)\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [forwardedRef, comboboxContext],\n )\n\n const state: ComboboxInput.State = React.useMemo(\n () => ({\n open,\n disabled,\n placeholder: !hasValue,\n }),\n [open, disabled, hasValue],\n )\n\n // When input-embedded layout, apply styles to position input above the popup\n // Skip z-index if inside an InputWrapper (the wrapper handles z-index)\n const inputEmbeddedStyles: React.CSSProperties | undefined =\n comboboxContext.layout === 'input-embedded' && !isInsideInputWrapper\n ? { position: 'relative', zIndex: 1 }\n : undefined\n\n const element = useRender({\n render,\n ref: mergedRef,\n state,\n props: {\n ...rest,\n ...dataAttrs,\n type: 'text',\n role: 'combobox',\n 'aria-autocomplete': 'list',\n 'aria-expanded': open,\n 'aria-controls': comboboxContext.listId,\n 'aria-haspopup': 'listbox',\n autoComplete: 'off',\n autoCorrect: 'off',\n spellCheck: false,\n disabled,\n placeholder: !hasValue ? placeholder : undefined,\n className,\n style: { ...inputEmbeddedStyles, ...style },\n value: displayValue,\n onChange: handleChange,\n onFocus: handleFocus,\n onBlur: handleBlur,\n onClick: handleClick,\n onKeyDown: handleKeyDown,\n },\n defaultTagName: 'input',\n })\n\n return element\n})\n\nexport namespace ComboboxInput {\n export interface Props extends ComboboxInputProps {}\n export type State = ComboboxInputState\n}\n","import * as React from 'react'\n\n/**\n * Context to indicate that children are inside an InputWrapper.\n * When true, Input should not apply its own z-index styles for input-embedded layout.\n */\nexport const ComboboxInputWrapperContext = React.createContext<boolean>(false)\n\n/**\n * Hook to check if component is inside a ComboboxInputWrapper.\n */\nexport function useIsInsideInputWrapper(): boolean {\n return React.useContext(ComboboxInputWrapperContext)\n}\n","/**\n * Data attributes for ComboboxInput component.\n */\nexport const ComboboxInputDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-input'}\n */\n slot: 'bazzaui-combobox-input',\n /** Present when the combobox popup is open. */\n open: 'data-open',\n /** Present when the combobox popup is closed. */\n closed: 'data-closed',\n /** Present when the input is disabled. */\n disabled: 'data-disabled',\n /** Present when no value is selected (showing placeholder). */\n placeholder: 'data-placeholder',\n} as const\n","'use client'\n\nimport * as React from 'react'\nimport {\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComboboxContextValue } from '../contexts/combobox-context.js'\n\n/**\n * Helper to resolve label from items prop\n */\nfunction resolveLabelFromItems(\n items:\n | Record<string, React.ReactNode>\n | Array<{ value: string; label: React.ReactNode }>\n | undefined,\n value: string,\n): string | undefined {\n if (!items) return undefined\n\n if (Array.isArray(items)) {\n const item = items.find((i) => i.value === value)\n const label = item?.label\n return typeof label === 'string' ? label : undefined\n }\n\n const label = items[value]\n return typeof label === 'string' ? label : undefined\n}\n\nexport interface UseComboboxDisplayValueParams<Value = unknown> {\n comboboxContext: ComboboxContextValue<Value>\n open: boolean\n}\n\nexport interface UseComboboxDisplayValueReturn<Value = unknown> {\n /** Whether a value is selected */\n hasValue: boolean\n /** The value to display in the input */\n displayValue: string\n /** The label of the selected value(s) */\n selectedLabel: string\n /** Get the display text for a value */\n getValueText: (value: Value) => string | undefined\n}\n\n/**\n * Hook to compute the display value for the combobox input.\n *\n * Handles:\n * - Determining if a value is selected (single or multi-select)\n * - Computing the display label for selected values\n * - Switching between selected label (closed) and input value (open)\n */\nexport function useComboboxDisplayValue<Value = unknown>(\n params: UseComboboxDisplayValueParams<Value>,\n): UseComboboxDisplayValueReturn<Value> {\n const { comboboxContext, open } = params\n\n // Determine if showing placeholder (no value selected)\n const hasValue = comboboxContext.multiple\n ? comboboxContext.values.length > 0\n : comboboxContext.value != null\n\n // Get the display text for selected value\n const getValueText = React.useCallback(\n (value: Value): string | undefined => {\n // Serialize for registry lookup\n const serializedValue = stringifyAsValue(\n value,\n comboboxContext.itemToStringValue,\n )\n\n // First try the registry (populated when items mount)\n const registryText = comboboxContext.itemTextRegistry.get(serializedValue)\n if (registryText !== undefined) {\n return registryText\n }\n\n // Fall back to the items prop (for initial render before popup opens)\n const itemsLabel = resolveLabelFromItems(\n comboboxContext.items,\n serializedValue,\n )\n if (itemsLabel !== undefined) {\n return itemsLabel\n }\n\n // Fall back to itemToStringLabel for object values\n const resolvedLabel = resolveLabel(\n value,\n comboboxContext.itemToStringLabel,\n )\n // Only return if it's different from the serialized value (meaning we got a real label)\n if (resolvedLabel && resolvedLabel !== serializedValue) {\n return resolvedLabel\n }\n\n return undefined\n },\n [\n comboboxContext.itemTextRegistry,\n comboboxContext.items,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n ],\n )\n\n // Get the label for the selected value (used when closed or just opened)\n const selectedLabel = React.useMemo(() => {\n if (!hasValue) {\n return ''\n }\n if (comboboxContext.multiple) {\n // For multi-select, show comma-separated values or count\n const texts = comboboxContext.values\n .map((v) => {\n const text = getValueText(v)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(v, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(v, comboboxContext.itemToStringValue)\n )\n })\n .filter(Boolean)\n if (texts.length <= 2) {\n return texts.join(', ')\n }\n return `${texts.length} selected`\n }\n // Single-select: show the value's text\n const value = comboboxContext.value\n if (value == null) return ''\n\n const text = getValueText(value)\n if (text !== undefined) return text\n // Fall back to resolved label or serialized value\n return (\n resolveLabel(value, comboboxContext.itemToStringLabel) ||\n stringifyAsValue(value, comboboxContext.itemToStringValue)\n )\n }, [\n hasValue,\n comboboxContext.multiple,\n comboboxContext.value,\n comboboxContext.values,\n comboboxContext.itemToStringLabel,\n comboboxContext.itemToStringValue,\n getValueText,\n ])\n\n // Determine the display value for the input\n // When closed: show selected value's text\n // When open: show the search/filter text (inputValue)\n const displayValue = React.useMemo(() => {\n if (!open) {\n // When closed, show the selected value's label\n return selectedLabel\n }\n // When open, use the input value for filtering\n return comboboxContext.inputValue\n }, [open, selectedLabel, comboboxContext.inputValue])\n\n return {\n hasValue,\n displayValue,\n selectedLabel,\n getValueText,\n }\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { ListboxStore } from '../../internal/listbox/index.js'\nimport { usePopupMenuKeyboard } from '../../internal/popup-menu/hooks/use-popup-menu-keyboard.js'\nimport type { FocusOwnerStore } from '../../internal/popup-menu/store/FocusOwnerStore.js'\nimport { REASONS } from '../../utils/events/index.js'\nimport { resolveLabel } from '../../utils/resolve-value-label.js'\nimport type { ComboboxContextValue } from '../contexts/combobox-context.js'\nimport type { ComboboxInputCursorBehavior } from './input.js'\n\nexport interface UseComboboxInputBehaviorParams {\n comboboxContext: ComboboxContextValue\n store: ListboxStore\n focusOwnerStore: FocusOwnerStore\n open: boolean\n disabled: boolean\n cursorBehavior: ComboboxInputCursorBehavior\n hasValue: boolean\n /** Get display text for a value - receives the raw value (possibly an object) */\n getValueText: (value: unknown) => string | undefined\n // User event handlers to chain\n onFocus?: React.FocusEventHandler<HTMLInputElement>\n onBlur?: React.FocusEventHandler<HTMLInputElement>\n onClick?: React.MouseEventHandler<HTMLInputElement>\n onKeyDown?: React.KeyboardEventHandler<HTMLInputElement>\n}\n\nexport interface UseComboboxInputBehaviorReturn {\n handleChange: React.ChangeEventHandler<HTMLInputElement>\n handleFocus: React.FocusEventHandler<HTMLInputElement>\n handleBlur: React.FocusEventHandler<HTMLInputElement>\n handleClick: React.MouseEventHandler<HTMLInputElement>\n handleKeyDown: React.KeyboardEventHandler<HTMLInputElement>\n /** Ref to track selection for controlled input restoration */\n selectionRef: React.MutableRefObject<{ start: number; end: number } | null>\n}\n\n/**\n * Hook to manage combobox input behavior including:\n * - Cursor positioning on open (cursorBehavior prop)\n * - Selection preservation for controlled inputs\n * - Focus/blur handling with popup awareness\n * - Click handling to open popup\n * - Keyboard navigation integration\n */\nexport function useComboboxInputBehavior(\n params: UseComboboxInputBehaviorParams,\n): UseComboboxInputBehaviorReturn {\n const {\n comboboxContext,\n store,\n focusOwnerStore,\n open,\n disabled,\n cursorBehavior,\n hasValue,\n getValueText,\n onFocus,\n onBlur,\n onClick,\n onKeyDown,\n } = params\n\n // Track if open was triggered by typing (to avoid overwriting typed character)\n const openedByTypingRef = React.useRef(false)\n\n // Track if open was triggered by click (to restore cursor position)\n const openedByClickRef = React.useRef(false)\n\n // Track if input was already focused when opening (skip cursor behavior if so)\n const wasAlreadyFocusedRef = React.useRef(false)\n\n // Track the click cursor position to restore after value changes\n const clickCursorPositionRef = React.useRef<number | null>(null)\n\n // Track the last selection to restore after controlled value updates\n const selectionRef = React.useRef<{ start: number; end: number } | null>(null)\n\n // Track if blur was caused by a pointer event (to distinguish outside-press from focus-out)\n // Also store the event itself so we can pass it to the close handler\n const outsidePointerEventRef = React.useRef<PointerEvent | null>(null)\n\n // Listen for pointerdown on document to detect outside clicks\n React.useEffect(() => {\n if (!open) return\n\n const handlePointerDown = (event: PointerEvent) => {\n const input = comboboxContext.inputRef.current\n const inputWrapper = comboboxContext.inputWrapperRef.current\n const listbox = document.getElementById(comboboxContext.listId)\n\n const target = event.target as Node\n\n // Check if click is inside the input, wrapper, or listbox\n const isInsideInput = input?.contains(target)\n const isInsideWrapper = inputWrapper?.contains(target)\n const isInsideListbox = listbox?.contains(target)\n\n if (!isInsideInput && !isInsideWrapper && !isInsideListbox) {\n // Pointer down outside - store the event for blur handler\n outsidePointerEventRef.current = event\n }\n }\n\n // Use capture phase so we see the event before stopPropagation can block it\n document.addEventListener('pointerdown', handlePointerDown, true)\n return () => {\n document.removeEventListener('pointerdown', handlePointerDown, true)\n outsidePointerEventRef.current = null\n }\n }, [\n open,\n comboboxContext.inputRef,\n comboboxContext.inputWrapperRef,\n comboboxContext.listId,\n ])\n\n // Restore selection after React re-renders the controlled input\n React.useLayoutEffect(() => {\n const inputElement = comboboxContext.inputRef.current\n if (inputElement && open && selectionRef.current) {\n const { start, end } = selectionRef.current\n // Only restore if the current selection is at the end (React's default reset position)\n // This avoids interfering with intentional cursor movements\n const currentPos = inputElement.selectionStart\n const valueLen = inputElement.value.length\n if (currentPos === valueLen && start !== valueLen) {\n inputElement.setSelectionRange(start, end)\n }\n selectionRef.current = null\n }\n })\n\n // When opening, apply cursor behavior based on how the combobox was opened\n const prevOpenRef = React.useRef(open)\n React.useLayoutEffect(() => {\n if (open && !prevOpenRef.current) {\n // If opened by typing, don't overwrite the typed character\n if (openedByTypingRef.current) {\n openedByTypingRef.current = false\n prevOpenRef.current = open\n return\n }\n\n // If input was already focused, skip cursor behavior entirely\n // Let the browser handle cursor positioning naturally\n if (wasAlreadyFocusedRef.current) {\n wasAlreadyFocusedRef.current = false\n openedByClickRef.current = false\n clickCursorPositionRef.current = null\n prevOpenRef.current = open\n return\n }\n\n // If opened by click with cursorBehavior='none', restore cursor to click position\n if (openedByClickRef.current && cursorBehavior === 'none') {\n const inputElement = comboboxContext.inputRef.current\n const clickPos = clickCursorPositionRef.current\n\n if (inputElement && clickPos !== null) {\n // Use requestAnimationFrame to ensure DOM has updated\n requestAnimationFrame(() => {\n // Clamp position to the current value length (in case text changed)\n const maxPos = inputElement.value.length\n const safePos = Math.min(clickPos, maxPos)\n inputElement.setSelectionRange(safePos, safePos)\n })\n }\n\n openedByClickRef.current = false\n clickCursorPositionRef.current = null\n prevOpenRef.current = open\n return\n }\n\n // For multi-select, clear input for fresh search\n if (hasValue && comboboxContext.multiple) {\n comboboxContext.onInputValueChange('')\n }\n\n // Apply cursor behavior based on prop (only when initially opening from unfocused state)\n // Note: The input value is already set by the click/focus/keyboard handlers\n const inputElement = comboboxContext.inputRef.current\n if (inputElement) {\n const valueLength = inputElement.value.length\n\n if (cursorBehavior === 'select-all' && valueLength > 0) {\n // Use requestAnimationFrame to ensure the value has been applied\n requestAnimationFrame(() => {\n inputElement.setSelectionRange(0, inputElement.value.length)\n })\n } else if (cursorBehavior === 'end' && valueLength > 0) {\n requestAnimationFrame(() => {\n inputElement.setSelectionRange(\n inputElement.value.length,\n inputElement.value.length,\n )\n })\n }\n // For cursorBehavior='none' without click tracking (e.g., focus/keyboard open),\n // cursor naturally goes to end which is acceptable\n }\n }\n prevOpenRef.current = open\n }, [open, comboboxContext, hasValue, cursorBehavior])\n\n // Handle input change\n const handleChange = React.useCallback(\n (event: React.ChangeEvent<HTMLInputElement>) => {\n const inputElement = event.target\n const newValue = inputElement.value\n\n // Save selection position to restore after React re-render\n const start = inputElement.selectionStart\n const end = inputElement.selectionEnd\n if (start !== null && end !== null) {\n selectionRef.current = { start, end }\n }\n\n comboboxContext.onInputValueChange(newValue)\n\n // Set filter mode to active (normal filtering using inputValue)\n comboboxContext.setFilterActive()\n\n // Also update the store's search state for filtering\n store.setSearch(newValue)\n\n // Open the combobox if not already open\n if (!store.state.open) {\n // Mark that we're opening by typing so the effect doesn't overwrite the value\n openedByTypingRef.current = true\n comboboxContext.openCombobox()\n }\n },\n [comboboxContext, store],\n )\n\n // Handle focus\n const handleFocus = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n onFocus?.(event)\n if (event.defaultPrevented) return\n\n const isOpen = store.state.open\n\n // If popup is already open, input is getting focus while open\n // Mark as already focused so click handler knows not to apply cursorBehavior\n if (isOpen) {\n wasAlreadyFocusedRef.current = true\n }\n\n if (comboboxContext.openOnFocus && !disabled && !isOpen) {\n // Pre-set the input value BEFORE opening to avoid the empty intermediate state\n if (hasValue && !comboboxContext.multiple) {\n const labelValue =\n getValueText(comboboxContext.value) ??\n resolveLabel(\n comboboxContext.value,\n comboboxContext.itemToStringLabel,\n )\n comboboxContext.onInputValueChange(labelValue)\n }\n comboboxContext.openCombobox()\n }\n },\n [onFocus, comboboxContext, disabled, store, hasValue, getValueText],\n )\n\n // Handle blur - close combobox when focus moves outside\n const handleBlur = React.useCallback(\n (event: React.FocusEvent<HTMLInputElement>) => {\n onBlur?.(event)\n if (event.defaultPrevented) return\n\n // Use requestAnimationFrame to check where focus moved to\n // This allows the click on an item to complete before we check\n requestAnimationFrame(() => {\n const activeElement = document.activeElement\n\n // Check if focus moved to something inside the popup\n // The popup is rendered in a portal, so we need to check if the active element\n // is inside any element with role=\"listbox\" that belongs to this combobox\n const listbox = document.getElementById(comboboxContext.listId)\n const isInsideListbox = listbox?.contains(activeElement)\n\n // Also check if focus is still on the input itself\n const isOnInput = activeElement === comboboxContext.inputRef.current\n\n if (!isInsideListbox && !isOnInput) {\n // Reset the \"already focused\" flag when closing\n wasAlreadyFocusedRef.current = false\n // Use outside-press if blur was caused by a pointer event, otherwise focus-out\n const pointerEvent = outsidePointerEventRef.current\n const reason = pointerEvent ? REASONS.outsidePress : REASONS.focusOut\n outsidePointerEventRef.current = null\n comboboxContext.closeCombobox(reason, pointerEvent ?? undefined)\n }\n })\n },\n [onBlur, comboboxContext],\n )\n\n // Handle click\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLInputElement>) => {\n onClick?.(event)\n if (event.defaultPrevented) return\n\n const isOpen = store.state.open\n\n if (!disabled && !isOpen) {\n const inputElement = event.target as HTMLInputElement\n\n // Capture cursor position before opening (for cursorBehavior='none')\n if (cursorBehavior === 'none') {\n // The browser has already calculated the click position based on current text\n const clickPosition = inputElement.selectionStart\n clickCursorPositionRef.current = clickPosition\n openedByClickRef.current = true\n }\n\n // Pre-set the input value BEFORE opening to avoid the empty intermediate state\n // This prevents the flash where displayValue goes from \"Banana\" -> \"\" -> \"Banana\"\n if (hasValue && !comboboxContext.multiple) {\n const labelValue =\n getValueText(comboboxContext.value) ??\n resolveLabel(\n comboboxContext.value,\n comboboxContext.itemToStringLabel,\n )\n comboboxContext.onInputValueChange(labelValue)\n }\n\n comboboxContext.openCombobox()\n } else if (isOpen) {\n // Clicking while already open - mark as already focused\n // This will prevent cursorBehavior from being applied if popup re-opens\n wasAlreadyFocusedRef.current = true\n }\n },\n [\n onClick,\n comboboxContext,\n disabled,\n store,\n cursorBehavior,\n hasValue,\n getValueText,\n ],\n )\n\n // Handle keyboard when popup is closed (opening it) or Escape to close\n const handleKeyDownWhenClosed = React.useCallback(\n (event: React.KeyboardEvent<HTMLInputElement>) => {\n // Let user handler run first\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n\n // Handle Escape to close popup (input stays focused)\n if (open && event.key === 'Escape') {\n event.preventDefault()\n comboboxContext.closeCombobox(REASONS.escapeKey)\n return\n }\n\n // If popup is closed, open it on arrow keys or Enter\n if (!open) {\n if (\n event.key === 'ArrowDown' ||\n event.key === 'ArrowUp' ||\n event.key === 'Enter'\n ) {\n event.preventDefault()\n // Pre-set the input value BEFORE opening to avoid the empty intermediate state\n if (hasValue && !comboboxContext.multiple) {\n const labelValue =\n getValueText(comboboxContext.value) ??\n resolveLabel(\n comboboxContext.value,\n comboboxContext.itemToStringLabel,\n )\n comboboxContext.onInputValueChange(labelValue)\n }\n comboboxContext.openCombobox()\n return\n }\n }\n },\n [open, comboboxContext, onKeyDown, hasValue, getValueText],\n )\n\n // Use centralized keyboard navigation hook for when popup is open\n // This handles Enter to select, arrow keys for navigation, Escape to close, etc.\n const { handleKeyDown: handleKeyDownFromHook } = usePopupMenuKeyboard({\n store,\n surfaceId: 'combobox-input', // Input acts as a virtual surface for keyboard handling\n focusOwnerStore,\n depth: 0,\n submenuContext: null,\n subpageContext: null,\n enabled: open, // Only enabled when popup is open\n enableTypeToSearch: false,\n onKeyDown: handleKeyDownWhenClosed, // Chain with our closed-state handler\n closeAll: comboboxContext.closeCombobox,\n // Skip focus owner check because the input is outside the Surface\n // but should still handle keyboard navigation when the popup is open\n skipFocusOwnerCheck: true,\n })\n\n return {\n handleChange,\n handleFocus,\n handleBlur,\n handleClick,\n handleKeyDown: handleKeyDownFromHook,\n selectionRef,\n }\n}\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { usePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxInputWrapperDataAttributes } from './input-wrapper.data-attrs.js'\nimport { ComboboxInputWrapperContext } from './input-wrapper-context.js'\n\nexport { ComboboxInputWrapperDataAttributes }\n\nexport interface ComboboxInputWrapperState extends Record<string, unknown> {\n /**\n * Whether the combobox popup is open.\n */\n open: boolean\n}\n\nexport interface ComboboxInputWrapperProps\n extends ComponentProps<'div', ComboboxInputWrapper.State> {}\n\nconst stateAttributesMapping = {\n open: (value: unknown): Record<string, string> | null =>\n value ? { [ComboboxInputWrapperDataAttributes.open]: '' } : null,\n}\n\n/**\n * A wrapper component for the Combobox.Input and Combobox.Icon.\n * Provides relative positioning context and manages z-index for input-embedded layouts.\n * Use this to position icons or other elements inside/over the input.\n *\n * Renders a `<div>` element with `position: relative`.\n */\nexport const ComboboxInputWrapper = React.forwardRef<\n HTMLDivElement,\n ComboboxInputWrapper.Props\n>(function ComboboxInputWrapper(props, forwardedRef) {\n const { render, className, style, children, ...rest } = props\n\n const { store } = usePopupMenuContext()\n const comboboxContext = useComboboxContext()\n const open = store.useState('open')\n\n const state: ComboboxInputWrapper.State = React.useMemo(\n () => ({ open }),\n [open],\n )\n\n // When input-embedded layout, apply higher z-index to ensure\n // the wrapper (and its children like Icon) appear above the popup\n const inputEmbeddedStyles: React.CSSProperties =\n comboboxContext.layout === 'input-embedded'\n ? { position: 'relative', zIndex: 1 }\n : { position: 'relative' }\n\n // Register wrapper element for positioning (used as anchor instead of input)\n const mergedRef = React.useCallback(\n (node: HTMLDivElement | null) => {\n comboboxContext.setInputWrapperElement(node)\n if (typeof forwardedRef === 'function') {\n forwardedRef(node)\n } else if (forwardedRef) {\n forwardedRef.current = node\n }\n },\n [forwardedRef, comboboxContext],\n )\n\n const element = useRender({\n render,\n ref: mergedRef,\n state,\n stateAttributesMapping,\n props: {\n ...rest,\n [ComboboxInputWrapperDataAttributes.slot]: '',\n className,\n style: { ...inputEmbeddedStyles, ...style },\n children,\n },\n defaultTagName: 'div',\n })\n\n return (\n <ComboboxInputWrapperContext.Provider value={true}>\n {element}\n </ComboboxInputWrapperContext.Provider>\n )\n})\n\nexport namespace ComboboxInputWrapper {\n export type State = ComboboxInputWrapperState\n export interface Props extends ComboboxInputWrapperProps {}\n}\n","/**\n * Data attributes for ComboboxInputWrapper component.\n */\nexport const ComboboxInputWrapperDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-input-wrapper'}\n */\n slot: 'bazzaui-combobox-input-wrapper',\n /** Present when the combobox popup is open. */\n open: 'data-open',\n} as const\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { usePopupMenuItem } from '../../internal/popup-menu/index.js'\nimport {\n compareItemEquality,\n itemIncludes,\n removeItem,\n} from '../../utils/item-equality.js'\nimport {\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxItemDataAttributes } from './item.data-attrs.js'\nimport {\n ComboboxItemContext,\n type ComboboxItemContextValue,\n} from './item-context.js'\n\nexport { ComboboxItemDataAttributes }\n\nexport interface ComboboxItemState extends Record<string, unknown> {\n /**\n * Whether the item is highlighted (via keyboard or pointer).\n */\n highlighted: boolean\n /**\n * Whether the item is disabled.\n */\n disabled: boolean\n /**\n * Whether the item is currently selected.\n */\n selected: boolean\n}\n\nexport interface ComboboxItemProps<Value = unknown>\n extends ComponentProps<'div', ComboboxItem.State> {\n /**\n * The value of this item. Required and must be unique within the Combobox.\n * Can be a primitive or an object.\n */\n value: Value\n\n /**\n * Text value to use for display in the input when this item is selected.\n * If not provided, the text content of the item will be used.\n * For object values, this can be auto-detected from `{ label }` shape.\n */\n textValue?: string\n\n /**\n * Additional keywords to match against when filtering.\n * Useful for aliases or synonyms.\n */\n keywords?: string[]\n\n /**\n * Whether this item is disabled.\n * Disabled items are not selectable and are skipped during keyboard navigation.\n */\n disabled?: boolean\n\n /**\n * Callback when this item is selected.\n */\n onSelect?: () => void\n\n /**\n * Whether to force render this item regardless of filter results.\n * @default false\n */\n forceMount?: boolean\n}\n\nconst stateAttributesMapping = {\n highlighted: (value: unknown): Record<string, string> | null =>\n value ? { [ComboboxItemDataAttributes.highlighted]: '' } : null,\n disabled: (value: unknown): Record<string, string> | null =>\n value ? { [ComboboxItemDataAttributes.disabled]: '' } : null,\n selected: (value: unknown): Record<string, string> | null =>\n value ? { [ComboboxItemDataAttributes.selected]: '' } : null,\n}\n\n/**\n * Helper to resolve label from items prop (for legacy string-keyed items)\n */\nfunction resolveLabelFromItems(\n items:\n | Record<string, React.ReactNode>\n | Array<{ value: string; label: React.ReactNode }>\n | undefined,\n value: string,\n): React.ReactNode | undefined {\n if (!items) return undefined\n\n if (Array.isArray(items)) {\n const item = items.find((i) => i.value === value)\n return item?.label\n }\n\n return items[value]\n}\n\n/**\n * A selectable item in the combobox dropdown.\n * Renders a `<div>` element with role=\"option\".\n *\n * @template Value - The type of the item value (can be a primitive or object)\n */\nfunction ComboboxItemImpl<Value = unknown>(\n props: ComboboxItemProps<Value>,\n forwardedRef: React.ForwardedRef<HTMLDivElement>,\n) {\n const {\n value,\n textValue: textValueProp,\n keywords: keywordsProp,\n disabled = false,\n onSelect,\n forceMount = false,\n render,\n className,\n style,\n onClick,\n onPointerDown,\n onPointerMove,\n children,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext<Value>()\n\n // Serialize value for registry key and internal lookups\n const serializedValue = React.useMemo(\n () => stringifyAsValue(value, comboboxContext.itemToStringValue),\n [value, comboboxContext.itemToStringValue],\n )\n\n // Resolve label from items prop (for auto-populating textValue and keywords)\n // This works for legacy string-keyed items\n const labelFromItems = React.useMemo(\n () => resolveLabelFromItems(comboboxContext.items, serializedValue),\n [comboboxContext.items, serializedValue],\n )\n\n // Auto-resolve label from object value shape { label }\n const labelFromObjectValue = React.useMemo(\n () => resolveLabel(value, comboboxContext.itemToStringLabel),\n [value, comboboxContext.itemToStringLabel],\n )\n\n // Auto-populate textValue: explicit prop > label from items (if string) > label from object > undefined\n const textValue = React.useMemo(() => {\n if (textValueProp !== undefined) return textValueProp\n if (typeof labelFromItems === 'string') return labelFromItems\n // For object values, use the resolved label\n if (labelFromObjectValue && labelFromObjectValue !== serializedValue) {\n return labelFromObjectValue\n }\n return undefined\n }, [textValueProp, labelFromItems, labelFromObjectValue, serializedValue])\n\n // Auto-add label to keywords for search/filter\n const keywords = React.useMemo(() => {\n const labelStr =\n typeof labelFromItems === 'string'\n ? labelFromItems\n : labelFromObjectValue && labelFromObjectValue !== serializedValue\n ? labelFromObjectValue\n : undefined\n if (!labelStr) return keywordsProp\n if (!keywordsProp) return [labelStr]\n // Only add if not already included\n if (keywordsProp.includes(labelStr)) return keywordsProp\n return [...keywordsProp, labelStr]\n }, [keywordsProp, labelFromItems, labelFromObjectValue, serializedValue])\n\n const textRef = React.useRef<string | undefined>(textValue)\n\n // Track if this item is selected using custom equality\n const selected = comboboxContext.multiple\n ? itemIncludes(\n comboboxContext.values,\n value,\n comboboxContext.isItemEqualToValue,\n )\n : comboboxContext.value != null &&\n compareItemEquality(\n comboboxContext.value,\n value,\n comboboxContext.isItemEqualToValue,\n )\n\n // Determine close behavior based on context setting\n const closeOnClick = comboboxContext.closeOnSelect\n\n const item = usePopupMenuItem({\n value: serializedValue,\n keywords,\n disabled,\n forceMount,\n closeOnClick,\n children,\n })\n\n // Register the select handler that updates the value\n React.useEffect(() => {\n const handleSelect = () => {\n if (disabled) return\n\n if (comboboxContext.multiple) {\n // Toggle value in array using custom equality\n const newValues = selected\n ? removeItem(\n comboboxContext.values,\n value,\n comboboxContext.isItemEqualToValue,\n )\n : [...comboboxContext.values, value]\n comboboxContext.onValuesChange(newValues)\n } else {\n // Set single value\n comboboxContext.onValueChange(value)\n }\n\n onSelect?.()\n }\n return item.registerSelect(handleSelect)\n }, [disabled, comboboxContext, value, selected, onSelect, item])\n\n // Register item text for input display\n React.useEffect(() => {\n // Use textValue if provided, otherwise extract from children\n const text = textRef.current\n if (text) {\n return comboboxContext.registerItemText(serializedValue, text)\n }\n }, [serializedValue, comboboxContext])\n\n // Update text ref when children might have changed (for extraction)\n React.useEffect(() => {\n if (!textValue && typeof children === 'string') {\n textRef.current = children\n comboboxContext.registerItemText(serializedValue, children)\n }\n }, [children, textValue, serializedValue, comboboxContext])\n\n const state: ComboboxItem.State = React.useMemo(\n () => ({\n highlighted: item.isHighlighted,\n disabled,\n selected,\n }),\n [item.isHighlighted, disabled, selected],\n )\n\n const itemContextValue: ComboboxItemContextValue<Value> = React.useMemo(\n () => ({\n id: item.id,\n value,\n textValue,\n highlighted: item.isHighlighted,\n disabled,\n selected,\n }),\n [item.id, value, textValue, item.isHighlighted, disabled, selected],\n )\n\n // Merge user-provided handlers with item handlers\n const handleClick = React.useCallback(\n (event: React.MouseEvent<HTMLDivElement>) => {\n onClick?.(event)\n if (!event.defaultPrevented) {\n item.handlers.onClick(event)\n }\n },\n [onClick, item.handlers],\n )\n\n const handlePointerDown = React.useCallback(\n (event: React.PointerEvent<HTMLDivElement>) => {\n item.handlers.onPointerDown(event)\n onPointerDown?.(event)\n },\n [item.handlers, onPointerDown],\n )\n\n const handlePointerMove = React.useCallback(\n (event: React.PointerEvent<HTMLDivElement>) => {\n onPointerMove?.(event)\n if (!event.defaultPrevented) {\n item.handlers.onPointerMove(event)\n }\n },\n [onPointerMove, item.handlers],\n )\n\n const element = useRender({\n render,\n ref: [item.ref, forwardedRef],\n state,\n stateAttributesMapping,\n props: {\n ...rest,\n [ComboboxItemDataAttributes.slot]: '',\n id: item.id,\n role: 'option',\n tabIndex: -1,\n 'aria-selected': selected,\n 'aria-disabled': disabled || undefined,\n className,\n style,\n onClick: handleClick,\n onPointerMove: handlePointerMove,\n onPointerDown: handlePointerDown,\n children,\n },\n enabled: item.isVisible,\n defaultTagName: 'div',\n })\n\n if (!item.isVisible) {\n return null\n }\n\n return (\n <ComboboxItemContext.Provider\n value={itemContextValue as ComboboxItemContextValue}\n >\n {element}\n </ComboboxItemContext.Provider>\n )\n}\n\nexport const ComboboxItem = React.forwardRef(ComboboxItemImpl) as <\n Value = unknown,\n>(\n props: ComboboxItemProps<Value> & React.RefAttributes<HTMLDivElement>,\n) => React.ReactElement | null\n\nexport namespace ComboboxItem {\n export type State = ComboboxItemState\n export interface Props<Value = unknown> extends ComboboxItemProps<Value> {}\n}\n","/**\n * Data attributes applied to Combobox.Item for styling.\n *\n * @example\n * ```css\n * [data-bazzaui-combobox-item][data-highlighted] {\n * background: var(--highlight-bg);\n * }\n * [data-bazzaui-combobox-item][data-selected] {\n * font-weight: bold;\n * }\n * [data-bazzaui-combobox-item][data-disabled] {\n * opacity: 0.5;\n * pointer-events: none;\n * }\n * ```\n */\nexport const ComboboxItemDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-item'}\n */\n slot: 'bazzaui-combobox-item',\n /** Present when the item is highlighted (via keyboard or pointer). */\n highlighted: 'data-highlighted',\n /** Present when the item is disabled. */\n disabled: 'data-disabled',\n /** Present when the item is currently selected. */\n selected: 'data-selected',\n} as const\n","'use client'\n\nimport * as React from 'react'\n\n/**\n * Context value for ComboboxItem.\n * Provides item state to child components like ItemIndicator.\n *\n * @template Value - The type of the item value (can be a primitive or object)\n */\nexport interface ComboboxItemContextValue<Value = unknown> {\n /** Unique ID for the item element */\n id: string\n /** The item's value */\n value: Value\n /** The text value/label for this item */\n textValue: string | undefined\n /** Whether the item is highlighted (via keyboard or pointer) */\n highlighted: boolean\n /** Whether the item is disabled */\n disabled: boolean\n /** Whether the item is selected */\n selected: boolean\n}\n\nconst ComboboxItemContext =\n React.createContext<ComboboxItemContextValue | null>(null)\n\n/**\n * Hook to access the ComboboxItem context.\n * Throws if used outside a ComboboxItem.\n */\nexport function useComboboxItemContext<\n Value = unknown,\n>(): ComboboxItemContextValue<Value> {\n const context = React.useContext(ComboboxItemContext)\n if (!context) {\n throw new Error(\n 'ComboboxItem child components must be used within a Combobox.Item',\n )\n }\n return context as ComboboxItemContextValue<Value>\n}\n\n/**\n * Hook to optionally access the ComboboxItem context.\n * Returns null if used outside a ComboboxItem.\n */\nexport function useMaybeComboboxItemContext<\n Value = unknown,\n>(): ComboboxItemContextValue<Value> | null {\n return React.useContext(\n ComboboxItemContext,\n ) as ComboboxItemContextValue<Value> | null\n}\n\nexport { ComboboxItemContext }\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxItemContext } from '../item/item-context.js'\nimport { ComboboxItemIndicatorDataAttributes } from './item-indicator.data-attrs.js'\n\nexport { ComboboxItemIndicatorDataAttributes }\n\nexport interface ComboboxItemIndicatorState extends Record<string, unknown> {\n /**\n * Whether the parent item is selected.\n */\n selected: boolean\n}\n\nexport interface ComboboxItemIndicatorProps\n extends ComponentProps<'span', ComboboxItemIndicator.State> {\n /**\n * Whether to always render the indicator regardless of selection state.\n * When false (default), only renders when the item is selected.\n * @default false\n */\n keepMounted?: boolean\n}\n\nconst stateAttributesMapping = {\n selected: (value: unknown): Record<string, string> | null =>\n value ? { [ComboboxItemIndicatorDataAttributes.selected]: '' } : null,\n}\n\n/**\n * Visual indicator for the selected state of a combobox item.\n * Only renders when the parent item is selected (unless keepMounted is true).\n * Renders a `<span>` element.\n */\nexport const ComboboxItemIndicator = React.forwardRef<\n HTMLSpanElement,\n ComboboxItemIndicator.Props\n>(function ComboboxItemIndicator(props, forwardedRef) {\n const { keepMounted = false, render, className, style, ...rest } = props\n\n const itemContext = useComboboxItemContext()\n\n const state: ComboboxItemIndicator.State = React.useMemo(\n () => ({\n selected: itemContext.selected,\n }),\n [itemContext.selected],\n )\n\n const element = useRender({\n render,\n ref: forwardedRef,\n state,\n stateAttributesMapping,\n props: {\n ...rest,\n [ComboboxItemIndicatorDataAttributes.slot]: '',\n 'aria-hidden': true,\n className,\n style,\n },\n enabled: keepMounted || itemContext.selected,\n defaultTagName: 'span',\n })\n\n // Don't render if not selected and not keepMounted\n if (!keepMounted && !itemContext.selected) {\n return null\n }\n\n return element\n})\n\nexport namespace ComboboxItemIndicator {\n export type State = ComboboxItemIndicatorState\n export interface Props extends ComboboxItemIndicatorProps {}\n}\n","/**\n * Data attributes for ComboboxItemIndicator component.\n */\nexport const ComboboxItemIndicatorDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-item-indicator'}\n */\n slot: 'bazzaui-combobox-item-indicator',\n /** Present when the item is selected. */\n selected: 'data-selected',\n} as const\n","'use client'\n\nimport { useRender } from '@base-ui/react/use-render'\nimport * as React from 'react'\nimport { stringifyAsValue } from '../../utils/resolve-value-label.js'\nimport type { ComponentProps } from '../../utils/types.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { useComboboxItemContext } from '../item/item-context.js'\nimport { ComboboxItemLabelDataAttributes } from './item-label.data-attrs.js'\n\nexport { ComboboxItemLabelDataAttributes }\n\nexport interface ComboboxItemLabelState extends Record<string, unknown> {\n /**\n * The serialized string key for the parent item's value.\n * For object values, this is the result of `itemToStringValue` or the auto-detected `.value` property.\n */\n value: string\n /**\n * Whether the parent item is selected.\n */\n selected: boolean\n /**\n * Whether the parent item is highlighted.\n */\n highlighted: boolean\n /**\n * Whether the parent item is disabled.\n */\n disabled: boolean\n}\n\nexport interface ComboboxItemLabelProps\n extends ComponentProps<'span', ComboboxItemLabel.State> {}\n\n/**\n * Helper to resolve label from items prop\n */\nfunction resolveLabelFromItems(\n items:\n | Record<string, React.ReactNode>\n | Array<{ value: string; label: React.ReactNode }>\n | undefined,\n valueKey: string,\n): React.ReactNode | undefined {\n if (!items) return undefined\n\n if (Array.isArray(items)) {\n const item = items.find((i) => i.value === valueKey)\n return item?.label\n }\n\n return items[valueKey]\n}\n\n/**\n * Renders the text label for a combobox item.\n *\n * When no children are provided, automatically renders the label from:\n * 1. The `items` prop passed to `Combobox.Root`\n * 2. The `textValue` prop on `Combobox.Item`\n * 3. Falls back to the item's value\n *\n * Also registers the text content for use in the input display.\n * Renders a `<span>` element.\n */\nexport const ComboboxItemLabel = React.forwardRef<\n HTMLSpanElement,\n ComboboxItemLabel.Props\n>(function ComboboxItemLabel(props, forwardedRef) {\n const { render, className, style, children, ...rest } = props\n\n const comboboxContext = useComboboxContext()\n const itemContext = useComboboxItemContext()\n\n // Serialize the item value to a string key for registry lookups\n const valueKey = stringifyAsValue(\n itemContext.value,\n comboboxContext.itemToStringValue,\n )\n\n // Resolve label content:\n // 1. Explicit children (override)\n // 2. Label from items prop lookup\n // 3. textValue from item context\n // 4. Fall back to the serialized value key\n const resolvedLabel = React.useMemo(() => {\n if (children !== undefined) {\n return children\n }\n\n const labelFromItems = resolveLabelFromItems(\n comboboxContext.items,\n valueKey,\n )\n if (labelFromItems !== undefined) {\n return labelFromItems\n }\n\n if (itemContext.textValue !== undefined) {\n return itemContext.textValue\n }\n\n return valueKey\n }, [children, comboboxContext.items, valueKey, itemContext.textValue])\n\n // Build state for render prop and className/style functions\n const state: ComboboxItemLabel.State = React.useMemo(\n () => ({\n value: valueKey,\n selected: itemContext.selected,\n highlighted: itemContext.highlighted,\n disabled: itemContext.disabled,\n }),\n [\n valueKey,\n itemContext.selected,\n itemContext.highlighted,\n itemContext.disabled,\n ],\n )\n\n // Register text content when mounted or resolved label changes\n React.useEffect(() => {\n if (typeof resolvedLabel === 'string') {\n return comboboxContext.registerItemText(valueKey, resolvedLabel)\n }\n }, [resolvedLabel, comboboxContext, valueKey])\n\n return useRender({\n render,\n ref: forwardedRef,\n state,\n props: {\n ...rest,\n [ComboboxItemLabelDataAttributes.slot]: '',\n className,\n style,\n children: resolvedLabel,\n },\n defaultTagName: 'span',\n })\n})\n\nexport namespace ComboboxItemLabel {\n export interface Props extends ComboboxItemLabelProps {}\n export type State = ComboboxItemLabelState\n}\n","/**\n * Data attributes for ComboboxItemLabel component.\n */\nexport const ComboboxItemLabelDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-item-label'}\n */\n slot: 'bazzaui-combobox-item-label',\n} as const\n","'use client'\n\nimport { Popover, type PopoverPositionerProps } from '@base-ui/react/popover'\nimport * as React from 'react'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport {\n type Align,\n type ComboboxLayout,\n ComboboxPositionerContext,\n type ComboboxPositionerContextValue,\n type Side,\n} from '../contexts/combobox-positioner-context.js'\nimport { ComboboxPositionerDataAttributes } from './positioner.data-attrs.js'\n\nexport { ComboboxPositionerDataAttributes }\n\n// ============================================================================\n// Types\n// ============================================================================\n\nexport interface ComboboxPositionerProps extends PopoverPositionerProps {\n /**\n * Override the layout mode for the popup.\n * If not provided, uses the `layout` from `Combobox.Root`.\n *\n * - `'floating'` - Standard dropdown positioning below/above the input\n * - `'input-embedded'` - Popup wraps around the input (macOS Spotlight-style).\n * The input appears to be inside the popup at the top.\n *\n * When `'input-embedded'`:\n * - Popup is positioned flush with the input (sideOffset=0)\n * - Alignment is centered on the input\n * - Positioning styles are automatically applied to the Popup child\n * - Use `popupPadding` to control the padding around the input\n * - `data-input-embedded` attribute is added to Input, Positioner, Popup, and List\n */\n layout?: ComboboxLayout\n\n /**\n * Padding around the popup content when `layout=\"input-embedded\"`.\n * Creates the \"encapsulated\" look where the input appears inside the popup\n * with padding on all sides.\n *\n * Only applies when `layout=\"input-embedded\"`.\n *\n * @default 8\n */\n popupPadding?: number\n}\n\n// ============================================================================\n// Helper: Get positioning styles based on actual side\n// ============================================================================\n\nfunction getInputEmbeddedStyles(\n actualSide: Side,\n inputHeight: number,\n inputWidth: number,\n popupPadding: number,\n): React.CSSProperties {\n const popupWidth = inputWidth + popupPadding * 2\n\n if (actualSide === 'top') {\n // Popup is above the input, so extend downward to wrap the input\n // Input will appear at the BOTTOM of the popup\n const popupMarginBottom = -(inputHeight + popupPadding)\n const popupPaddingBottom = inputHeight + popupPadding\n\n return {\n width: popupWidth,\n marginBottom: popupMarginBottom,\n paddingTop: popupPadding,\n paddingLeft: popupPadding,\n paddingRight: popupPadding,\n paddingBottom: popupPaddingBottom,\n }\n }\n\n // Default: side === 'bottom'\n // Popup is below the input, so extend upward to wrap the input\n // Input will appear at the TOP of the popup\n const popupMarginTop = -(inputHeight + popupPadding)\n const popupPaddingTop = inputHeight + popupPadding\n\n return {\n width: popupWidth,\n marginTop: popupMarginTop,\n paddingTop: popupPaddingTop,\n paddingLeft: popupPadding,\n paddingRight: popupPadding,\n paddingBottom: popupPadding,\n }\n}\n\n// ============================================================================\n// Component\n// ============================================================================\n\n/**\n * Positions the combobox popup against the input.\n * Uses the input element as the anchor for positioning.\n *\n * Supports `alignInputWithPopup` mode where the popup visually wraps around\n * the input, making the input appear to be inside the popup (macOS-style).\n *\n * Renders a `<div>` element.\n */\nexport const ComboboxPositioner = React.forwardRef<\n HTMLDivElement,\n ComboboxPositioner.Props\n>(function ComboboxPositioner(props, forwardedRef) {\n const {\n layout: layoutProp,\n popupPadding = 8,\n side = 'bottom',\n align: alignProp,\n sideOffset = 4,\n anchor: anchorProp,\n className,\n style,\n children,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n\n // Use prop if provided, otherwise fall back to Root's layout\n const layout = layoutProp ?? comboboxContext.layout\n const isInputEmbedded = layout === 'input-embedded'\n\n // Use the wrapper element as anchor if present, otherwise fall back to input\n // This ensures the popup aligns with the visual container (InputWrapper) when used\n const anchor =\n (anchorProp ?? comboboxContext.inputWrapperRef.current)\n ? comboboxContext.inputWrapperRef\n : comboboxContext.inputRef\n\n // When input-embedded layout is enabled:\n // - Use zero sideOffset (popup flush with input)\n // - Center align (popup centered on input)\n const effectiveSideOffset = isInputEmbedded ? 0 : sideOffset\n const effectiveAlign = isInputEmbedded ? 'center' : (alignProp ?? 'start')\n\n const { inputHeight, inputWidth } = comboboxContext\n const popupWidth = inputWidth + popupPadding * 2\n\n // When input-embedded, set z-index: 0 so the input (with z-index: 1) appears above\n const basePositionerStyles: React.CSSProperties = {\n ...style,\n ...(isInputEmbedded ? { zIndex: 0 } : {}),\n }\n\n // For input-embedded layout, we need to use a render function to access\n // the actual side after collision detection\n if (isInputEmbedded) {\n return (\n <Popover.Positioner\n ref={forwardedRef}\n side={side}\n align={effectiveAlign}\n sideOffset={effectiveSideOffset}\n anchor={anchor}\n className={className}\n style={basePositionerStyles}\n data-input-embedded=\"\"\n {...{ [ComboboxPositionerDataAttributes.slot]: '' }}\n {...rest}\n render={(renderProps, state) => {\n const actualSide = state.side as Side\n\n // Context value with actual side\n const contextValue: ComboboxPositionerContextValue = {\n layout,\n side: actualSide,\n align: state.align as Align,\n inputHeight: comboboxContext.inputHeight,\n }\n\n // CSS variables for input dimensions\n const cssVariables: React.CSSProperties = {\n '--combobox-input-height': `${inputHeight}px`,\n '--combobox-input-width': `${inputWidth}px`,\n '--combobox-popup-padding': `${popupPadding}px`,\n '--combobox-popup-width': `${popupWidth}px`,\n } as React.CSSProperties\n\n // Get positioning styles based on actual side\n const positioningStyles = getInputEmbeddedStyles(\n actualSide,\n inputHeight,\n inputWidth,\n popupPadding,\n )\n\n // Enhance children with positioning styles\n const enhancedChildren = React.Children.map(children, (child) => {\n if (!React.isValidElement(child)) {\n return child\n }\n\n return React.cloneElement(child as React.ReactElement<any>, {\n style: {\n ...positioningStyles,\n ...(child.props as any).style,\n },\n 'data-side': actualSide,\n })\n })\n\n return (\n <ComboboxPositionerContext.Provider value={contextValue}>\n <div\n {...renderProps}\n style={{ ...renderProps.style, ...cssVariables }}\n data-side={actualSide}\n >\n {enhancedChildren}\n </div>\n </ComboboxPositionerContext.Provider>\n )\n }}\n />\n )\n }\n\n // Non-input-embedded: simple rendering\n const contextValue: ComboboxPositionerContextValue = {\n layout,\n side: side as Side,\n align: effectiveAlign as Align,\n inputHeight: comboboxContext.inputHeight,\n }\n\n // CSS variables for input dimensions\n const cssVariables: React.CSSProperties = {\n '--combobox-input-height': `${inputHeight}px`,\n '--combobox-input-width': `${inputWidth}px`,\n } as React.CSSProperties\n\n const positionerStyles: React.CSSProperties = {\n ...basePositionerStyles,\n ...cssVariables,\n }\n\n return (\n <ComboboxPositionerContext.Provider value={contextValue}>\n <Popover.Positioner\n ref={forwardedRef}\n side={side}\n align={effectiveAlign}\n sideOffset={effectiveSideOffset}\n anchor={anchor}\n className={className}\n style={positionerStyles}\n {...{ [ComboboxPositionerDataAttributes.slot]: '' }}\n {...rest}\n >\n {children}\n </Popover.Positioner>\n </ComboboxPositionerContext.Provider>\n )\n})\n\nexport namespace ComboboxPositioner {\n export type Props = ComboboxPositionerProps\n export type State = Popover.Positioner.State\n}\n","/**\n * Data attributes for ComboboxPositioner component.\n */\nexport const ComboboxPositionerDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-positioner'}\n */\n slot: 'bazzaui-combobox-positioner',\n} as const\n","'use client'\n\nimport { Popover, type PopoverRootProps } from '@base-ui/react/popover'\nimport * as React from 'react'\nimport type { VirtualItem } from '../../internal/listbox/index.js'\nimport type { PopupMenuOpenChangeReason } from '../../internal/popup-menu/events.js'\nimport {\n type PopupMenuDebugOptions,\n PopupMenuProviders,\n type PopupMenuRootActions,\n type UsePopupMenuRootParams,\n usePopupMenuRoot,\n} from '../../internal/popup-menu/index.js'\nimport { REASONS } from '../../utils/events/index.js'\nimport {\n defaultItemEquality,\n type ItemEqualityComparer,\n} from '../../utils/item-equality.js'\nimport { stringifyAsValue } from '../../utils/resolve-value-label.js'\nimport {\n ComboboxContext,\n type ComboboxContextValue,\n type ComboboxFilterMode,\n type ItemTextRegistry,\n} from '../contexts/combobox-context.js'\nimport type { ComboboxLayout } from '../contexts/combobox-positioner-context.js'\nimport type {\n ComboboxHighlightChangeEventDetails,\n ComboboxOpenChangeEventDetails,\n} from '../events.js'\n\n/**\n * Helper type to determine the value type based on the multiple flag.\n */\ntype ComboboxValueType<\n Value,\n Multiple extends boolean | undefined,\n> = Multiple extends true ? Value[] : Value | null\n\nexport interface ComboboxRootProps<\n Value = unknown,\n Multiple extends boolean | undefined = false,\n> extends Omit<\n PopoverRootProps,\n 'open' | 'onOpenChange' | 'defaultOpen' | 'actionsRef'\n > {\n // ===== Open State =====\n /**\n * Whether the combobox is open.\n * Use for controlled mode.\n */\n open?: boolean\n\n /**\n * Callback when the open state changes.\n * The second parameter contains event details including the reason for the change.\n */\n onOpenChange?: (\n open: boolean,\n eventDetails: ComboboxOpenChangeEventDetails,\n ) => void\n\n /**\n * Whether the combobox is initially open.\n * Use for uncontrolled mode.\n * @default false\n */\n defaultOpen?: boolean\n\n /**\n * A ref to imperative actions.\n * - `close`: closes the menu imperatively.\n * - `unmount`: unmounts the popup imperatively (when keep-mounted mode is enabled).\n * - `setDisabled`: enables/disables the menu imperatively.\n */\n actionsRef?: React.RefObject<ComboboxRoot.Actions | null>\n\n // ===== Single Selection =====\n /**\n * Current selected value (single-select mode).\n * Use for controlled mode.\n * Can be a primitive or an object.\n */\n value?: ComboboxValueType<Value, Multiple>\n\n /**\n * Default selected value (single-select mode).\n * Use for uncontrolled mode.\n */\n defaultValue?: ComboboxValueType<Value, Multiple>\n\n /**\n * Callback when the selected value changes (single-select mode).\n */\n onValueChange?: (value: Value) => void\n\n // ===== Multi Selection =====\n /**\n * Whether multi-select mode is enabled.\n * @default false\n */\n multiple?: Multiple\n\n /**\n * Current selected values (multi-select mode).\n * Use for controlled mode.\n */\n values?: Value[]\n\n /**\n * Default selected values (multi-select mode).\n * Use for uncontrolled mode.\n */\n defaultValues?: Value[]\n\n /**\n * Callback when the selected values change (multi-select mode).\n */\n onValuesChange?: (values: Value[]) => void\n\n // ===== Object Value Support =====\n /**\n * Custom comparison logic used to determine if a combobox item value\n * matches the current selected value.\n * Useful when item values are objects without matching referentially.\n * Defaults to Object.is comparison.\n */\n isItemEqualToValue?: ItemEqualityComparer<Value>\n\n /**\n * When the item values are objects (`<Combobox.Item value={object}>`),\n * this function converts the object value to a string representation\n * for display in the input.\n * If the shape of the object is `{ value, label }`, the label will be\n * used automatically without needing to specify this prop.\n */\n itemToStringLabel?: (itemValue: Value) => string\n\n /**\n * When the item values are objects (`<Combobox.Item value={object}>`),\n * this function converts the object value to a string representation\n * for form submission.\n * If the shape of the object is `{ value, label }`, the value will be\n * used automatically without needing to specify this prop.\n */\n itemToStringValue?: (itemValue: Value) => string\n\n // ===== Input State =====\n /**\n * Current input value.\n * Use for controlled mode.\n */\n inputValue?: string\n\n /**\n * Default input value.\n * Use for uncontrolled mode.\n */\n defaultInputValue?: string\n\n /**\n * Callback when the input value changes.\n */\n onInputValueChange?: (value: string) => void\n\n // ===== Form Integration =====\n /**\n * Form field name for submission.\n * When set, hidden input(s) will be rendered for form submission.\n */\n name?: string\n\n /**\n * Associate with a form by ID.\n */\n form?: string\n\n /**\n * Whether this field is required.\n */\n required?: boolean\n\n /**\n * Whether the combobox is disabled.\n * @default false\n */\n disabled?: boolean\n\n /**\n * Placeholder text for the input.\n * @default \"Search...\"\n */\n placeholder?: string\n\n /**\n * Data structure of the items rendered in the combobox popup.\n * When specified, the input shows the label of the selected item\n * instead of the raw value.\n *\n * Can be a record mapping values to labels, or an array of { value, label } objects.\n * @example\n * ```tsx\n * // Record format\n * <Combobox.Root items={{ us: 'United States', uk: 'United Kingdom' }}>\n *\n * // Array format\n * <Combobox.Root items={[\n * { value: 'us', label: 'United States' },\n * { value: 'uk', label: 'United Kingdom' },\n * ]}>\n * ```\n */\n items?:\n | Record<string, React.ReactNode>\n | Array<{ value: string; label: React.ReactNode }>\n\n // ===== Behavior =====\n /**\n * Determines if the combobox enters a modal state when open.\n *\n * - `true`: user interaction is limited to the combobox: document page scroll\n * is locked, and pointer interactions on outside elements are disabled.\n * - `false`: user interaction with the rest of the document is allowed.\n * - `'trap-focus'`: focus is trapped inside the combobox, but document page\n * scroll is not locked and pointer interactions outside of it remain enabled.\n *\n * @default false\n */\n modal?: boolean | 'trap-focus'\n\n /**\n * Whether to close the popup after selecting an item.\n * @default true for single-select, false for multi-select\n */\n closeOnSelect?: boolean\n\n /**\n * Whether to open the popup when the input is focused.\n * @default true\n */\n openOnFocus?: boolean\n\n // ===== Virtualization =====\n /**\n * Whether virtualization mode is enabled.\n * When true, items should provide an explicit `index` prop and\n * the `virtualItems` prop should be provided for navigation to work correctly.\n * @default false\n */\n virtualized?: boolean\n\n /**\n * Pre-registered items for virtualization.\n * When provided with `virtualized={true}`, this allows navigation to work\n * for items that aren't currently mounted in the DOM.\n */\n virtualItems?: VirtualItem[]\n\n /**\n * Callback when the highlighted item changes.\n * Useful for synchronizing with a virtualizer (e.g., scrollToIndex) or other UI state.\n * The third parameter contains event details including the reason for the change.\n */\n onHighlightChange?: (\n id: string | null,\n index: number,\n eventDetails: ComboboxHighlightChangeEventDetails,\n ) => void\n\n // ===== Layout =====\n /**\n * The layout mode for the combobox popup.\n *\n * - `'floating'` (default) - Standard dropdown positioning below/above the input\n * - `'input-embedded'` - Popup wraps around the input (macOS Spotlight-style).\n * The input appears to be inside the popup at the top.\n *\n * When `'input-embedded'`:\n * - `data-input-embedded` attribute is added to Input, Positioner, Popup, and List\n * - Use CSS selectors like `[data-input-embedded]` to style components\n *\n * @default 'floating'\n */\n layout?: ComboboxLayout\n\n /**\n * Event handler called after any open/close animations have completed.\n * When `clearSearchOnClose=\"after-exit\"` is set on Surface, the search\n * will be cleared before this callback is invoked.\n */\n onOpenChangeComplete?: (open: boolean) => void\n\n /**\n * Debug visualization options for submenu interaction heuristics.\n */\n debug?: PopupMenuDebugOptions\n\n children: React.ReactNode\n}\n\n/**\n * Groups all parts of the combobox.\n * Manages open state, selection state, input state, and provides context to children.\n * Doesn't render its own HTML element.\n *\n * @template Value - The type of the combobox value (can be a primitive or object)\n * @template Multiple - Whether multiple selection is enabled\n */\nexport function ComboboxRoot<\n Value = unknown,\n Multiple extends boolean | undefined = false,\n>(props: ComboboxRootProps<Value, Multiple>): React.JSX.Element {\n const {\n // Open state\n open: openProp,\n onOpenChange,\n actionsRef,\n defaultOpen = false,\n // Single selection\n value: valueProp,\n defaultValue,\n onValueChange,\n // Multi selection\n multiple = false as Multiple,\n values: valuesProp,\n defaultValues,\n onValuesChange,\n // Object value support\n isItemEqualToValue = defaultItemEquality as ItemEqualityComparer<Value>,\n itemToStringLabel,\n itemToStringValue,\n // Input state\n inputValue: inputValueProp,\n defaultInputValue = '',\n onInputValueChange,\n // Form integration\n name,\n form,\n required,\n disabled: disabledProp = false,\n placeholder = 'Search...',\n items,\n // Behavior\n modal = false,\n closeOnSelect: closeOnSelectProp,\n openOnFocus = true,\n // Virtualization\n virtualized = false,\n virtualItems,\n onHighlightChange,\n // Layout\n layout = 'floating',\n // Animation callback\n onOpenChangeComplete: onOpenChangeCompleteProp,\n debug,\n children,\n ...rest\n } = props\n\n // Generate a unique ID for the listbox\n const listId = React.useId()\n\n // ===== Element Refs for Positioning =====\n const inputRef = React.useRef<HTMLInputElement | null>(null)\n const inputWrapperRef = React.useRef<HTMLElement | null>(null)\n const [inputHeight, setInputHeight] = React.useState(0)\n const [inputWidth, setInputWidth] = React.useState(0)\n\n const setInputElement = React.useCallback(\n (element: HTMLInputElement | null) => {\n inputRef.current = element\n // Only use input dimensions if there's no wrapper\n if (element && !inputWrapperRef.current) {\n const rect = element.getBoundingClientRect()\n setInputHeight(rect.height)\n setInputWidth(rect.width)\n }\n },\n [],\n )\n\n const setInputWrapperElement = React.useCallback(\n (element: HTMLElement | null) => {\n inputWrapperRef.current = element\n // When wrapper is present, use its dimensions instead of input\n if (element) {\n const rect = element.getBoundingClientRect()\n setInputHeight(rect.height)\n setInputWidth(rect.width)\n }\n },\n [],\n )\n\n // ===== Open State =====\n // Use shared hook to create stores and utilities\n const {\n store,\n focusOwnerStore,\n openChainStore,\n registerSurface,\n closeAll,\n virtualization,\n handleOpenChange: baseHandleOpenChange,\n disabled: menuDisabled,\n setDisabled,\n } = usePopupMenuRoot({\n // Cast to generic type - component handles type safety via narrowed types\n onOpenChange:\n onOpenChange as unknown as UsePopupMenuRootParams['onOpenChange'],\n defaultOpen,\n virtualized,\n items: virtualItems,\n onHighlightChange:\n onHighlightChange as unknown as UsePopupMenuRootParams['onHighlightChange'],\n disabled: disabledProp,\n })\n\n const popoverActionsRef = React.useRef<Popover.Root.Actions | null>(null)\n\n React.useImperativeHandle(\n actionsRef,\n () => ({\n close: () => {\n popoverActionsRef.current?.close()\n },\n unmount: () => {\n popoverActionsRef.current?.unmount()\n },\n setDisabled,\n }),\n [setDisabled],\n )\n\n // Sync controlled open prop to store\n store.useControlledProp('open', openProp, defaultOpen)\n\n // Get open state from store for Popover\n const open = store.useState('open')\n\n // Custom handleOpenChange that ignores close events when input has focus\n // This prevents base-ui's Popover from closing when clicking on the input\n const handleOpenChange = React.useCallback(\n (\n newOpen: boolean,\n reason?: ComboboxOpenChangeEventDetails['reason'],\n event?: Event,\n ) => {\n if (menuDisabled && reason !== REASONS.imperativeAction) {\n return\n }\n\n // When trying to close, check if input has focus\n if (!newOpen && inputRef.current) {\n const activeElement = document.activeElement\n // If the input has focus or will have focus, don't close\n if (activeElement === inputRef.current) {\n return\n }\n }\n // Cast reason - combobox has additional reasons beyond PopupMenu's reasons\n baseHandleOpenChange(\n newOpen,\n reason as Parameters<typeof baseHandleOpenChange>[1],\n event,\n )\n },\n [baseHandleOpenChange, menuDisabled],\n )\n\n // Handle animation complete - clear search and hide input if clearSearchOnClose is 'after-exit'\n const handleOpenChangeComplete = React.useCallback(\n (nextOpen: boolean) => {\n // Clear search and hide input after exit animation completes\n if (!nextOpen && store.context.clearSearchOnClose === 'after-exit') {\n store.clearSearch()\n store.setInputActive(false)\n }\n // Call user's callback\n onOpenChangeCompleteProp?.(nextOpen)\n },\n [store, onOpenChangeCompleteProp],\n )\n\n // Wrapper to adapt Popover's event details to our handleOpenChange\n const handlePopoverOpenChange = React.useCallback(\n (nextOpen: boolean, popoverDetails: Popover.Root.ChangeEventDetails) => {\n // Forward to our internal handler with the reason and event\n handleOpenChange(\n nextOpen,\n popoverDetails.reason as ComboboxOpenChangeEventDetails['reason'],\n popoverDetails.event,\n )\n },\n [handleOpenChange],\n )\n\n // ===== Single Selection State =====\n const [internalValue, setInternalValue] = React.useState<Value | null>(\n defaultValue !== undefined ? (defaultValue as Value | null) : null,\n )\n const value: Value | null =\n valueProp !== undefined ? (valueProp as Value | null) : internalValue\n\n const handleValueChange = React.useCallback(\n (newValue: Value) => {\n if (valueProp === undefined) {\n setInternalValue(newValue)\n }\n onValueChange?.(newValue)\n },\n [valueProp, onValueChange],\n )\n\n // ===== Multi Selection State =====\n const [internalValues, setInternalValues] = React.useState<Value[]>(\n defaultValues ?? [],\n )\n const values: Value[] = valuesProp !== undefined ? valuesProp : internalValues\n\n const handleValuesChange = React.useCallback(\n (newValues: Value[]) => {\n if (valuesProp === undefined) {\n setInternalValues(newValues)\n }\n onValuesChange?.(newValues)\n },\n [valuesProp, onValuesChange],\n )\n\n // ===== Input Value State =====\n const [internalInputValue, setInternalInputValue] =\n React.useState(defaultInputValue)\n const inputValue =\n inputValueProp !== undefined ? inputValueProp : internalInputValue\n\n const handleInputValueChange = React.useCallback(\n (newValue: string) => {\n if (inputValueProp === undefined) {\n setInternalInputValue(newValue)\n }\n onInputValueChange?.(newValue)\n },\n [inputValueProp, onInputValueChange],\n )\n\n // ===== Item Text Registry =====\n // The registry persists item text even after items unmount (popup closes).\n // This ensures the input can display the correct label for selected values.\n // Text is only overwritten when items re-mount with new text, never deleted.\n const itemTextRegistryRef = React.useRef<ItemTextRegistry>(new Map())\n\n const registerItemText = React.useCallback(\n (itemValue: string, text: string) => {\n itemTextRegistryRef.current.set(itemValue, text)\n // No cleanup - text should persist even when items unmount\n return () => {}\n },\n [],\n )\n\n // ===== Close on Select =====\n const closeOnSelect = closeOnSelectProp ?? !multiple\n\n // ===== Filter Mode State Machine =====\n // Controls how the search/filter value is determined.\n //\n // State transitions:\n // - Closed → open (no value) → { type: 'active' }\n // - Closed → open (with value) → { type: 'showAll' }\n // - Open + user types → { type: 'active' }\n // - Open → close → { type: 'frozen', search: <current> }\n //\n // We use a ref for synchronous access during close (to prevent flash of items).\n const filterModeRef = React.useRef<ComboboxFilterMode>({ type: 'active' })\n const [, setFilterModeState] = React.useState<ComboboxFilterMode>({\n type: 'active',\n })\n\n const setFilterMode = React.useCallback((mode: ComboboxFilterMode) => {\n filterModeRef.current = mode\n setFilterModeState(mode)\n }, [])\n\n // Read from ref for synchronous access\n const filterMode = filterModeRef.current\n\n const setFilterActive = React.useCallback(() => {\n // User is typing, switch to active filtering\n setFilterMode({ type: 'active' })\n }, [setFilterMode])\n\n // ===== Open/Close Helpers =====\n const openCombobox = React.useCallback(() => {\n if (!menuDisabled) {\n // If opening with a selected value (single-select), show all items initially.\n // Otherwise, use active filtering.\n if (!multiple && value != null) {\n setFilterMode({ type: 'showAll' })\n } else {\n setFilterMode({ type: 'active' })\n }\n store.setOpen(true)\n }\n }, [menuDisabled, store, multiple, value, setFilterMode])\n\n const closeCombobox = React.useCallback(\n (reason?: ComboboxOpenChangeEventDetails['reason'], event?: Event) => {\n // Freeze the current search state BEFORE closing to prevent filter changes\n // during exit animations.\n //\n // Get the effective search value based on current filter mode:\n // - 'active': freeze to current inputValue\n // - 'showAll': freeze to '' (keep showing all items)\n // - 'frozen': keep the existing frozen value (shouldn't happen, but handle it)\n const currentMode = filterModeRef.current\n const searchToFreeze =\n currentMode.type === 'active'\n ? internalInputValue\n : currentMode.type === 'showAll'\n ? ''\n : currentMode.search\n\n setFilterMode({ type: 'frozen', search: searchToFreeze })\n // Cast is safe: closeCombobox only receives close-related reasons\n // which are a subset of PopupMenuOpenChangeReason\n store.setOpen(\n false,\n reason as PopupMenuOpenChangeReason | undefined,\n event,\n )\n },\n [store, setFilterMode, internalInputValue],\n )\n\n // ===== Combobox Context =====\n const comboboxContextValue: ComboboxContextValue<Value> = React.useMemo(\n () => ({\n multiple: multiple as boolean,\n value,\n values,\n onValueChange: handleValueChange,\n onValuesChange: handleValuesChange,\n isItemEqualToValue,\n itemToStringLabel,\n itemToStringValue,\n inputValue,\n onInputValueChange: handleInputValueChange,\n name,\n form,\n required,\n disabled: menuDisabled,\n placeholder,\n items,\n itemTextRegistry: itemTextRegistryRef.current,\n registerItemText,\n listId,\n inputRef,\n setInputElement,\n inputWrapperRef,\n setInputWrapperElement,\n closeOnSelect,\n openOnFocus,\n openCombobox,\n closeCombobox,\n filterMode,\n setFilterActive,\n inputHeight,\n inputWidth,\n layout,\n }),\n [\n multiple,\n value,\n values,\n handleValueChange,\n handleValuesChange,\n isItemEqualToValue,\n itemToStringLabel,\n itemToStringValue,\n inputValue,\n handleInputValueChange,\n name,\n form,\n required,\n menuDisabled,\n placeholder,\n items,\n registerItemText,\n listId,\n setInputElement,\n setInputWrapperElement,\n closeOnSelect,\n openOnFocus,\n openCombobox,\n closeCombobox,\n filterMode,\n setFilterActive,\n inputHeight,\n inputWidth,\n layout,\n ],\n )\n\n // ===== Hidden Inputs for Form Submission =====\n const hiddenInputs = React.useMemo(() => {\n if (!name) return null\n\n if (multiple) {\n // Multiple hidden inputs for array submission\n if (values.length > 0) {\n return values.map((v, index) => {\n const serializedValue = stringifyAsValue(v, itemToStringValue)\n return (\n <input\n key={serializedValue}\n type=\"hidden\"\n name={name}\n value={serializedValue}\n form={form}\n required={required && index === 0}\n />\n )\n })\n }\n // Empty hidden input to ensure field is submitted even when empty\n return (\n <input\n type=\"hidden\"\n name={name}\n value=\"\"\n form={form}\n required={required}\n />\n )\n }\n\n // Single hidden input\n return (\n <input\n type=\"hidden\"\n name={name}\n value={value != null ? stringifyAsValue(value, itemToStringValue) : ''}\n form={form}\n required={required}\n />\n )\n }, [name, form, required, multiple, value, values, itemToStringValue])\n\n return (\n <ComboboxContext.Provider\n value={comboboxContextValue as ComboboxContextValue<unknown>}\n >\n <PopupMenuProviders\n store={store}\n focusOwnerStore={focusOwnerStore}\n openChainStore={openChainStore}\n disabled={menuDisabled}\n depth={0}\n closeAll={closeAll}\n registerSurface={registerSurface}\n virtualization={virtualization}\n menuType=\"dropdown\"\n componentName=\"combobox\"\n debug={debug}\n >\n {hiddenInputs}\n <Popover.Root\n {...rest}\n open={open}\n onOpenChange={handlePopoverOpenChange}\n onOpenChangeComplete={handleOpenChangeComplete}\n modal={modal}\n actionsRef={actionsRef ? popoverActionsRef : undefined}\n >\n {children}\n </Popover.Root>\n </PopupMenuProviders>\n </ComboboxContext.Provider>\n )\n}\n\nexport namespace ComboboxRoot {\n export interface Props<\n Value = unknown,\n Multiple extends boolean | undefined = false,\n > extends ComboboxRootProps<Value, Multiple> {}\n export type OpenChangeEventDetails = ComboboxOpenChangeEventDetails\n export type HighlightChangeEventDetails = ComboboxHighlightChangeEventDetails\n export type Actions = PopupMenuRootActions\n}\n","'use client'\n\nimport * as React from 'react'\nimport {\n PopupMenuSurface,\n type PopupMenuSurfaceProps,\n} from '../../internal/popup-menu/index.js'\nimport { stringifyAsValue } from '../../utils/resolve-value-label.js'\nimport { useComboboxContext } from '../contexts/combobox-context.js'\nimport { ComboboxSurfaceDataAttributes } from './surface.data-attrs.js'\n\nexport { ComboboxSurfaceDataAttributes }\n\nexport interface ComboboxSurfaceProps\n extends Omit<PopupMenuSurfaceProps, 'autoHighlightFirst'> {\n /**\n * Controls auto-highlighting behavior when the combobox opens.\n * - `true`: highlight the first item (default)\n * - `false`: don't auto-highlight any item\n * - `'selected'`: highlight the currently selected item, or first item if none selected\n * - `string`: highlight the item with this specific value\n * @default true\n */\n autoHighlightFirst?: boolean | 'selected' | string\n}\n\n/**\n * Provides search context and manages item registration for Combobox.\n * Automatically syncs the search state with the combobox's input value.\n *\n * Place inside Combobox.Popup to enable search functionality.\n * Renders a `<div>` element.\n */\nexport const ComboboxSurface = React.forwardRef<\n HTMLDivElement,\n ComboboxSurface.Props\n>(function ComboboxSurface(props, forwardedRef) {\n const {\n autoHighlightFirst: autoHighlightFirstProp,\n search: searchProp,\n onSearchChange: onSearchChangeProp,\n onPointerMove: onPointerMoveProp,\n ...rest\n } = props\n\n const comboboxContext = useComboboxContext()\n\n // Focus the input when cursor moves inside the popup\n // This allows users to immediately type to filter after hovering\n const handlePointerMove = React.useCallback(\n (event: React.PointerEvent<HTMLDivElement>) => {\n onPointerMoveProp?.(event)\n\n // Focus the input if it's not already focused\n const input = comboboxContext.inputRef.current\n if (input && document.activeElement !== input) {\n input.focus()\n }\n },\n [onPointerMoveProp, comboboxContext.inputRef],\n )\n\n // Resolve autoHighlightFirst:\n // - 'selected': use the current selected value (falls back to true if no selection)\n // - true/false/string: pass through as-is\n // Default to true (highlight first item)\n const autoHighlightFirst = React.useMemo(() => {\n const prop = autoHighlightFirstProp ?? true\n\n if (prop === 'selected') {\n // For single-select, use the selected value\n // For multi-select, use the first selected value\n const selectedValue = comboboxContext.multiple\n ? comboboxContext.values[0]\n : comboboxContext.value\n\n // If there's a selected value, serialize it to a string and use for highlighting\n if (selectedValue != null) {\n return stringifyAsValue(\n selectedValue,\n comboboxContext.itemToStringValue,\n )\n }\n // Otherwise highlight first\n return true\n }\n\n return prop\n }, [\n autoHighlightFirstProp,\n comboboxContext.multiple,\n comboboxContext.value,\n comboboxContext.values,\n comboboxContext.itemToStringValue,\n ])\n\n // Sync search with combobox's input value based on filter mode:\n // - 'active': use inputValue (normal filtering)\n // - 'showAll': use '' (show all items when opened with selected value)\n // - 'frozen': use frozen search value (during close animation)\n const { filterMode } = comboboxContext\n const search =\n searchProp ??\n (filterMode.type === 'active'\n ? comboboxContext.inputValue\n : filterMode.type === 'showAll'\n ? ''\n : filterMode.search)\n\n // Sync search changes back to combobox\n const handleSearchChange = React.useCallback(\n (value: string) => {\n comboboxContext.onInputValueChange(value)\n onSearchChangeProp?.(value)\n },\n [comboboxContext, onSearchChangeProp],\n )\n\n return (\n <PopupMenuSurface\n ref={forwardedRef}\n autoHighlightFirst={autoHighlightFirst}\n search={search}\n onSearchChange={handleSearchChange}\n onPointerMove={handlePointerMove}\n // Skip auto-focus because the Combobox.Input is outside the popup\n // and should retain focus while the dropdown is open\n skipAutoFocus\n {...{ [ComboboxSurfaceDataAttributes.slot]: '' }}\n {...rest}\n />\n )\n})\n\nexport namespace ComboboxSurface {\n export type State = PopupMenuSurface.State\n export interface Props extends ComboboxSurfaceProps {}\n}\n","/**\n * Data attributes for ComboboxSurface component.\n */\nexport const ComboboxSurfaceDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-surface'}\n */\n slot: 'bazzaui-combobox-surface',\n} as const\n","export enum ComboboxArrowDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-arrow'}\n */\n slot = 'bazzaui-combobox-arrow',\n /**\n * Present when the popup menu is open.\n */\n open = 'data-open',\n /**\n * Present when the popup menu is closed.\n */\n closed = 'data-closed',\n /**\n * Indicates which side the popup is positioned relative to the trigger.\n * @type {'top' | 'bottom' | 'left' | 'right' | 'inline-end' | 'inline-start'}\n */\n side = 'data-side',\n /**\n * Indicates how the popup is aligned relative to specified side.\n * @type {'start' | 'center' | 'end'}\n */\n align = 'data-align',\n /**\n * Present when the arrow is not centered due to collision avoidance.\n */\n uncentered = 'data-uncentered',\n}\n","export enum ComboboxBackdropDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-backdrop'}\n */\n slot = 'bazzaui-combobox-backdrop',\n /**\n * Present when the popup menu is open.\n */\n open = 'data-open',\n /**\n * Present when the popup menu is closed.\n */\n closed = 'data-closed',\n /**\n * Present when the popup menu is animating in.\n */\n startingStyle = 'data-starting-style',\n /**\n * Present when the popup menu is animating out.\n */\n endingStyle = 'data-ending-style',\n}\n","export enum ComboboxEmptyDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-empty'}\n */\n slot = 'bazzaui-combobox-empty',\n}\n","export enum ComboboxGroupDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-group'}\n */\n slot = 'bazzaui-combobox-group',\n}\n","export enum ComboboxGroupLabelDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-group-label'}\n */\n slot = 'bazzaui-combobox-group-label',\n}\n","export const ComboboxIconDataAttributes = {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-icon'}\n */\n slot: 'bazzaui-combobox-icon',\n /** Present when the popup is open. */\n open: 'data-popup-open',\n} as const\n","export enum ComboboxListDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-list'}\n */\n slot = 'bazzaui-combobox-list',\n /**\n * Always present on the list element.\n * Used for styling and by useStickyRowWidth to find the list container.\n */\n list = 'data-popup-menu-list',\n}\n","export enum ComboboxPopupDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-popup'}\n */\n slot = 'bazzaui-combobox-popup',\n /**\n * Present when the popup menu is open.\n */\n open = 'data-open',\n /**\n * Present when the popup menu is closed.\n */\n closed = 'data-closed',\n /**\n * Indicates which side the popup is positioned relative to the trigger.\n * @type {'top' | 'bottom' | 'left' | 'right'}\n */\n side = 'data-side',\n /**\n * Indicates how the popup is aligned relative to specified side.\n * @type {'start' | 'center' | 'end'}\n */\n align = 'data-align',\n /**\n * Present when the popup is animating in.\n */\n startingStyle = 'data-starting-style',\n /**\n * Present when the popup is animating out.\n */\n endingStyle = 'data-ending-style',\n /**\n * Present if animations should be instant.\n * @type {'click' | 'dismiss'}\n */\n instant = 'data-instant',\n /**\n * Present when this popup's surface is the focus owner.\n * Useful for styling the currently focused menu in a submenu chain.\n */\n focused = 'data-focused',\n /**\n * Present when this popup has an open submenu below it in the menu tree.\n * Useful for styling all parent menus in an open submenu chain.\n */\n hasOpenSubmenu = 'data-has-open-submenu',\n /**\n * Present when this popup is a submenu (not the root menu).\n * Useful for applying different styles to submenus vs root menus.\n */\n submenu = 'data-submenu',\n /**\n * Present while navigating between subpages in this popup.\n * Useful for temporary transition adjustments during subpage focus handoff.\n */\n navigating = 'data-navigating',\n}\n","export const ComboboxScrollArrowDataAttributes = {\n /**\n * Identifies the component part for scroll up arrow.\n * @type {'bazzaui-combobox-scroll-up-arrow'}\n */\n slotUp: 'bazzaui-combobox-scroll-up-arrow',\n /**\n * Identifies the component part for scroll down arrow.\n * @type {'bazzaui-combobox-scroll-down-arrow'}\n */\n slotDown: 'bazzaui-combobox-scroll-down-arrow',\n /**\n * Direction of the scroll arrow.\n * @type {'up' | 'down'}\n */\n direction: 'data-direction',\n /**\n * Side of the popup.\n * @type {'top' | 'bottom' | 'left' | 'right'}\n */\n side: 'data-side',\n} as const\n","export enum ComboboxSeparatorDataAttributes {\n /**\n * Identifies the component part.\n * @type {'bazzaui-combobox-separator'}\n */\n slot = 'bazzaui-combobox-separator',\n}\n"],"mappings":"4bAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,WAAAE,GAAA,aAAAC,GAAA,UAAAC,GAAA,UAAAC,GAAA,UAAAC,GAAA,eAAAC,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+BALGA,QAAA,ICAL,IAAMC,GAA6B,CAKxC,KAAM,wBAEN,KAAM,iBACR,ECRO,IAAKC,QAKVA,EAAA,KAAO,wBAKPA,EAAA,KAAO,uBAVGA,QAAA,ICAL,IAAKC,QAKVA,EAAA,KAAO,yBAIPA,EAAA,KAAO,YAIPA,EAAA,OAAS,cAKTA,EAAA,KAAO,YAKPA,EAAA,MAAQ,aAIRA,EAAA,cAAgB,sBAIhBA,EAAA,YAAc,oBAKdA,EAAA,QAAU,eAKVA,EAAA,QAAU,eAKVA,EAAA,eAAiB,wBAKjBA,EAAA,QAAU,eAKVA,EAAA,WAAa,kBAxDHA,QAAA,ICAL,IAAMC,GAAoC,CAK/C,OAAQ,mCAKR,SAAU,qCAKV,UAAW,iBAKX,KAAM,WACR,ECrBO,IAAKC,QAKVA,EAAA,KAAO,6BALGA,QAAA","names":["index_parts_exports","__export","PopupMenuArrow","PopupMenuBackdrop","ComboboxClear","PopupMenuEmpty","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuIcon","ComboboxInput","ComboboxInputWrapper","ComboboxItem","ComboboxItemIndicator","ComboboxItemLabel","PopupMenuList","PopupMenuPopup","PopupMenuPortal","ComboboxPositioner","ComboboxRoot","PopupMenuScrollDownArrow","PopupMenuScrollUpArrow","PopupMenuSeparator","ComboboxSurface","useComboboxPositionerContext","useRender","React","ComboboxClearDataAttributes","ComboboxClear","props","forwardedRef","keepMounted","disabledProp","render","className","style","onClick","rest","comboboxContext","useComboboxContext","disabled","hasValue","handleClick","event","handlePointerDown","state","element","useRender","ComboboxClearDataAttributes","React","ComboboxPositionerContext","useComboboxPositionerContext","useRender","React","React","ComboboxInputWrapperContext","useIsInsideInputWrapper","ComboboxInputDataAttributes","React","resolveLabelFromItems","items","value","label","i","useComboboxDisplayValue","params","comboboxContext","open","hasValue","getValueText","serializedValue","stringifyAsValue","registryText","itemsLabel","resolvedLabel","resolveLabel","selectedLabel","texts","v","text","displayValue","React","useComboboxInputBehavior","params","comboboxContext","store","focusOwnerStore","open","disabled","cursorBehavior","hasValue","getValueText","onFocus","onBlur","onClick","onKeyDown","openedByTypingRef","openedByClickRef","wasAlreadyFocusedRef","clickCursorPositionRef","selectionRef","outsidePointerEventRef","handlePointerDown","event","input","inputWrapper","listbox","target","isInsideInput","isInsideWrapper","isInsideListbox","inputElement","start","end","currentPos","valueLen","prevOpenRef","clickPos","maxPos","safePos","valueLength","handleChange","newValue","handleFocus","isOpen","labelValue","resolveLabel","handleBlur","activeElement","isOnInput","pointerEvent","reason","reason_parts_exports","handleClick","clickPosition","handleKeyDownWhenClosed","handleKeyDownFromHook","usePopupMenuKeyboard","ComboboxInput","props","forwardedRef","placeholderProp","disabledProp","cursorBehavior","render","className","style","onFocus","onBlur","onClick","onKeyDown","rest","comboboxContext","useComboboxContext","popupMenuContext","usePopupMenuContext","focusOwnerStore","useFocusOwner","isInsideInputWrapper","useIsInsideInputWrapper","disabled","placeholder","open","hasValue","displayValue","getValueText","useComboboxDisplayValue","handleChange","handleFocus","handleBlur","handleClick","handleKeyDown","useComboboxInputBehavior","dataAttrs","ComboboxInputDataAttributes","mergedRef","node","state","inputEmbeddedStyles","useRender","useRender","React","ComboboxInputWrapperDataAttributes","jsx","stateAttributesMapping","value","ComboboxInputWrapperDataAttributes","ComboboxInputWrapper","props","forwardedRef","render","className","style","children","rest","store","usePopupMenuContext","comboboxContext","useComboboxContext","open","state","inputEmbeddedStyles","mergedRef","node","element","useRender","jsx","ComboboxInputWrapperContext","useRender","React","ComboboxItemDataAttributes","React","ComboboxItemContext","useComboboxItemContext","context","useMaybeComboboxItemContext","jsx","stateAttributesMapping","value","ComboboxItemDataAttributes","resolveLabelFromItems","items","i","ComboboxItemImpl","props","forwardedRef","textValueProp","keywordsProp","disabled","onSelect","forceMount","render","className","style","onClick","onPointerDown","onPointerMove","children","rest","comboboxContext","useComboboxContext","serializedValue","stringifyAsValue","labelFromItems","labelFromObjectValue","resolveLabel","textValue","keywords","labelStr","textRef","selected","itemIncludes","compareItemEquality","closeOnClick","item","usePopupMenuItem","handleSelect","newValues","removeItem","text","state","itemContextValue","handleClick","event","handlePointerDown","handlePointerMove","element","useRender","jsx","ComboboxItemContext","ComboboxItem","useRender","React","ComboboxItemIndicatorDataAttributes","stateAttributesMapping","value","ComboboxItemIndicatorDataAttributes","ComboboxItemIndicator","props","forwardedRef","keepMounted","render","className","style","rest","itemContext","useComboboxItemContext","state","element","useRender","useRender","React","ComboboxItemLabelDataAttributes","resolveLabelFromItems","items","valueKey","i","ComboboxItemLabel","props","forwardedRef","render","className","style","children","rest","comboboxContext","useComboboxContext","itemContext","useComboboxItemContext","stringifyAsValue","resolvedLabel","labelFromItems","state","useRender","ComboboxItemLabelDataAttributes","Popover","React","ComboboxPositionerDataAttributes","jsx","getInputEmbeddedStyles","actualSide","inputHeight","inputWidth","popupPadding","popupWidth","popupMarginBottom","popupPaddingBottom","popupMarginTop","popupPaddingTop","ComboboxPositioner","props","forwardedRef","layoutProp","side","alignProp","sideOffset","anchorProp","className","style","children","rest","comboboxContext","useComboboxContext","layout","isInputEmbedded","anchor","effectiveSideOffset","effectiveAlign","basePositionerStyles","jsx","Popover","ComboboxPositionerDataAttributes","renderProps","state","contextValue","cssVariables","positioningStyles","enhancedChildren","child","ComboboxPositionerContext","positionerStyles","Popover","React","jsx","jsxs","ComboboxRoot","props","openProp","onOpenChange","actionsRef","defaultOpen","valueProp","defaultValue","onValueChange","multiple","valuesProp","defaultValues","onValuesChange","isItemEqualToValue","defaultItemEquality","itemToStringLabel","itemToStringValue","inputValueProp","defaultInputValue","onInputValueChange","name","form","required","disabledProp","placeholder","items","modal","closeOnSelectProp","openOnFocus","virtualized","virtualItems","onHighlightChange","layout","onOpenChangeCompleteProp","debug","children","rest","listId","inputRef","inputWrapperRef","inputHeight","setInputHeight","inputWidth","setInputWidth","setInputElement","element","rect","setInputWrapperElement","store","focusOwnerStore","openChainStore","registerSurface","closeAll","virtualization","baseHandleOpenChange","menuDisabled","setDisabled","usePopupMenuRoot","popoverActionsRef","open","handleOpenChange","newOpen","reason","event","reason_parts_exports","handleOpenChangeComplete","nextOpen","handlePopoverOpenChange","popoverDetails","internalValue","setInternalValue","value","handleValueChange","newValue","internalValues","setInternalValues","values","handleValuesChange","newValues","internalInputValue","setInternalInputValue","inputValue","handleInputValueChange","itemTextRegistryRef","registerItemText","itemValue","text","closeOnSelect","filterModeRef","setFilterModeState","setFilterMode","mode","filterMode","setFilterActive","openCombobox","closeCombobox","currentMode","searchToFreeze","comboboxContextValue","hiddenInputs","v","index","serializedValue","stringifyAsValue","ComboboxContext","PopupMenuProviders","Popover","React","ComboboxSurfaceDataAttributes","jsx","ComboboxSurface","props","forwardedRef","autoHighlightFirstProp","searchProp","onSearchChangeProp","onPointerMoveProp","rest","comboboxContext","useComboboxContext","handlePointerMove","event","input","autoHighlightFirst","prop","selectedValue","stringifyAsValue","filterMode","search","handleSearchChange","value","jsx","PopupMenuSurface","ComboboxSurfaceDataAttributes","ComboboxArrowDataAttributes","ComboboxBackdropDataAttributes","ComboboxEmptyDataAttributes","ComboboxGroupDataAttributes","ComboboxGroupLabelDataAttributes","ComboboxIconDataAttributes","ComboboxListDataAttributes","ComboboxPopupDataAttributes","ComboboxScrollArrowDataAttributes","ComboboxSeparatorDataAttributes"]}
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { b as ListboxStore } from './ListboxStore-DPqpLlAL.js';
|
|
3
|
+
|
|
4
|
+
interface SurfaceContextValue {
|
|
5
|
+
/** The Listbox store instance */
|
|
6
|
+
store: ListboxStore;
|
|
7
|
+
/** Unique identifier for this surface */
|
|
8
|
+
surfaceId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SurfaceContext: React.Context<SurfaceContextValue | null>;
|
|
11
|
+
declare function useSurfaceContext(): SurfaceContextValue;
|
|
12
|
+
declare function useMaybeSurfaceContext(): SurfaceContextValue | null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Fuzzy matching algorithm for command palette-style filtering.
|
|
16
|
+
* Vendored from cmdk (https://github.com/pacocoursey/cmdk)
|
|
17
|
+
*
|
|
18
|
+
* The scores are arranged so that a continuous match of characters will
|
|
19
|
+
* result in a total score of 1.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Calculates a fuzzy match score between a string and an abbreviation.
|
|
23
|
+
*
|
|
24
|
+
* @param string - The string to match against
|
|
25
|
+
* @param abbreviation - The search query
|
|
26
|
+
* @param keywords - Optional additional keywords to include in matching
|
|
27
|
+
* @returns A score between 0 and 1, where 1 is a perfect match and 0 is no match
|
|
28
|
+
*/
|
|
29
|
+
declare function commandScore(string: string, abbreviation: string, keywords?: string[]): number;
|
|
30
|
+
/**
|
|
31
|
+
* Default filter function for listbox items.
|
|
32
|
+
* Returns a score > 0 for matches, 0 for non-matches.
|
|
33
|
+
*/
|
|
34
|
+
declare const defaultFilter: typeof commandScore;
|
|
35
|
+
|
|
36
|
+
export { type SurfaceContextValue as S, useSurfaceContext as a, SurfaceContext as b, commandScore as c, defaultFilter as d, useMaybeSurfaceContext as u };
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { b as ListboxStore } from './ListboxStore-BtcTXpzi.cjs';
|
|
3
|
+
|
|
4
|
+
interface SurfaceContextValue {
|
|
5
|
+
/** The Listbox store instance */
|
|
6
|
+
store: ListboxStore;
|
|
7
|
+
/** Unique identifier for this surface */
|
|
8
|
+
surfaceId: string;
|
|
9
|
+
}
|
|
10
|
+
declare const SurfaceContext: React.Context<SurfaceContextValue | null>;
|
|
11
|
+
declare function useSurfaceContext(): SurfaceContextValue;
|
|
12
|
+
declare function useMaybeSurfaceContext(): SurfaceContextValue | null;
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* Fuzzy matching algorithm for command palette-style filtering.
|
|
16
|
+
* Vendored from cmdk (https://github.com/pacocoursey/cmdk)
|
|
17
|
+
*
|
|
18
|
+
* The scores are arranged so that a continuous match of characters will
|
|
19
|
+
* result in a total score of 1.
|
|
20
|
+
*/
|
|
21
|
+
/**
|
|
22
|
+
* Calculates a fuzzy match score between a string and an abbreviation.
|
|
23
|
+
*
|
|
24
|
+
* @param string - The string to match against
|
|
25
|
+
* @param abbreviation - The search query
|
|
26
|
+
* @param keywords - Optional additional keywords to include in matching
|
|
27
|
+
* @returns A score between 0 and 1, where 1 is a perfect match and 0 is no match
|
|
28
|
+
*/
|
|
29
|
+
declare function commandScore(string: string, abbreviation: string, keywords?: string[]): number;
|
|
30
|
+
/**
|
|
31
|
+
* Default filter function for listbox items.
|
|
32
|
+
* Returns a score > 0 for matches, 0 for non-matches.
|
|
33
|
+
*/
|
|
34
|
+
declare const defaultFilter: typeof commandScore;
|
|
35
|
+
|
|
36
|
+
export { type SurfaceContextValue as S, useSurfaceContext as a, SurfaceContext as b, commandScore as c, defaultFilter as d, useMaybeSurfaceContext as u };
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { newObj[key] = obj[key]; } } } newObj.default = obj; return newObj; } } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }var _chunkJSPKF52Ocjs = require('../chunk-JSPKF52O.cjs');var _chunkFWWOE2SWcjs = require('../chunk-FWWOE2SW.cjs');var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var ze={};_chunkM4G6J7DPcjs.a.call(void 0, ze,{Arrow:()=>_chunkJSPKF52Ocjs.N,Backdrop:()=>_chunkJSPKF52Ocjs.P,CheckboxItem:()=>_chunkJSPKF52Ocjs.Ca,CheckboxItemIndicator:()=>_chunkJSPKF52Ocjs.Da,DataInput:()=>_chunkJSPKF52Ocjs.pa,DataList:()=>_chunkJSPKF52Ocjs.Kb,DataSubpages:()=>_chunkJSPKF52Ocjs.Lb,DataSurface:()=>_chunkJSPKF52Ocjs.Mb,Empty:()=>_chunkJSPKF52Ocjs.oa,Group:()=>_chunkJSPKF52Ocjs.Qa,GroupLabel:()=>_chunkJSPKF52Ocjs.Ra,Icon:()=>_chunkJSPKF52Ocjs.ja,Input:()=>_chunkJSPKF52Ocjs.pa,Item:()=>_chunkJSPKF52Ocjs.Fa,List:()=>_chunkJSPKF52Ocjs.sa,Popup:()=>_chunkJSPKF52Ocjs._,Portal:()=>_chunkJSPKF52Ocjs.$,Positioner:()=>_chunkJSPKF52Ocjs.ca,RadioGroup:()=>_chunkJSPKF52Ocjs.Ja,RadioGroupValue:()=>_chunkJSPKF52Ocjs.Ka,RadioItem:()=>_chunkJSPKF52Ocjs.Oa,RadioItemIndicator:()=>_chunkJSPKF52Ocjs.Pa,Root:()=>ke,ScrollDownArrow:()=>_chunkJSPKF52Ocjs.xa,ScrollUpArrow:()=>_chunkJSPKF52Ocjs.wa,Separator:()=>_chunkJSPKF52Ocjs.Sa,Shortcut:()=>_chunkJSPKF52Ocjs.Ua,Submenu:()=>_chunkJSPKF52Ocjs.Va,SubmenuTrigger:()=>_chunkJSPKF52Ocjs.Ya,SubmenuTriggerIndicator:()=>_chunkJSPKF52Ocjs.Xa,Subpage:()=>_chunkJSPKF52Ocjs.Za,SubpageBack:()=>_chunkJSPKF52Ocjs.$a,SubpageBackItem:()=>_chunkJSPKF52Ocjs.bb,SubpageTrigger:()=>_chunkJSPKF52Ocjs.db,Surface:()=>_chunkJSPKF52Ocjs.ya,Trigger:()=>Te,useAsyncMenuCoordinator:()=>_chunkJSPKF52Ocjs.la,useMaybeAsyncMenuCoordinator:()=>_chunkJSPKF52Ocjs.ma});var _popover = require('@base-ui/react/popover');var _react = require('react'); var a = _interopRequireWildcard(_react); var u = _interopRequireWildcard(_react);var _jsxruntime = require('react/jsx-runtime');var Ie=a.createContext(null);function ye(){let l=a.useContext(Ie);if(!l)throw new Error("ContextMenu components must be used within a ContextMenu.Root");return l}function Re(l,c,p=!1){let o=p?10:0;return{getBoundingClientRect(){return DOMRect.fromRect({width:o,height:o,x:l,y:c})}}}function ke(l){let{open:c,onOpenChange:p,defaultOpen:o=!1,virtualized:d=!1,items:n,onHighlightChange:e,disabled:y=!1,modal:k=!0,closeOnOutsidePress:S="pointerdown",onOpenChangeComplete:h,actionsRef:b,getQualifiedRowId:s,debug:V,children:C}=l,{store:i,focusOwnerStore:D,openChainStore:T,registerSurface:M,closeAll:z,virtualization:f,handleOpenChange:P,disabled:r,setDisabled:m}=_chunkJSPKF52Ocjs.L.call(void 0, {onOpenChange:p,defaultOpen:o,virtualized:d,items:n,onHighlightChange:e,closeOnOutsidePress:S,disabled:y}),R=a.useRef(null);a.useImperativeHandle(b,()=>({close:()=>{_optionalChain([R, 'access', _2 => _2.current, 'optionalAccess', _3 => _3.close, 'call', _4 => _4()])},unmount:()=>{_optionalChain([R, 'access', _5 => _5.current, 'optionalAccess', _6 => _6.unmount, 'call', _7 => _7()])},setDisabled:m}),[m]),i.useControlledProp("open",c,o);let I=i.useState("open"),[B,H]=a.useState(()=>Re(0,0)),v=a.useCallback((g,O,$e=!1)=>{H(Re(g,O,$e))},[]),w=a.useCallback(()=>{r||i.setOpen(!0)},[i,r]),t=a.useCallback(()=>{P(!1)},[P]),x=a.useCallback(g=>{!g&&i.context.clearSearchOnClose==="after-exit"&&(i.clearSearch(),i.setInputActive(!1)),g||(_optionalChain([i, 'access', _8 => _8.context, 'access', _9 => _9.onCloseComplete, 'optionalCall', _10 => _10()]),_optionalChain([i, 'access', _11 => _11.context, 'access', _12 => _12.onPopupCloseComplete, 'optionalCall', _13 => _13()])),_optionalChain([h, 'optionalCall', _14 => _14(g)])},[i,h]),G=a.useCallback((g,O)=>{P(g,O.reason,O.event)},[P]),L=a.useMemo(()=>({setAnchorPosition:v,openMenu:w,closeMenu:t,disabled:r,open:I}),[v,w,t,r,I]);return _jsxruntime.jsx.call(void 0, Ie.Provider,{value:L,children:_jsxruntime.jsx.call(void 0, _chunkJSPKF52Ocjs.da,{store:i,focusOwnerStore:D,openChainStore:T,disabled:r,depth:0,closeAll:z,registerSurface:M,virtualization:f,virtualAnchor:B,menuType:"context",closeOnOutsidePress:S,componentName:"context-menu",getQualifiedRowId:s,debug:V,children:_jsxruntime.jsx.call(void 0, _popover.Popover.Root,{open:I,onOpenChange:G,onOpenChangeComplete:x,modal:k,actionsRef:b?R:void 0,children:C})})})}var _userender = require('@base-ui/react/use-render');var _=(d=>(d.slot="bazzaui-context-menu-trigger",d.popupOpen="data-popup-open",d.pressed="data-pressed",d.disabled="data-disabled",d))(_||{});var zo=500,vo=10,wo={open:l=>l?{"data-popup-open":""}:null,pressed:l=>l?{"data-pressed":""}:null,disabled:l=>l?{"data-disabled":""}:null},Te=u.forwardRef(function(c,p){let{disabled:o=!1,render:d,className:n,style:e,onContextMenu:y,onTouchStart:k,onTouchMove:S,onTouchEnd:h,onTouchCancel:b,children:s,...V}=c,{setAnchorPosition:C,openMenu:i,disabled:D,open:T}=ye(),M=o||D,[z,f]=u.useState(!1),P=u.useRef(null),r=u.useRef(null),m=u.useCallback(()=>{P.current&&(clearTimeout(P.current),P.current=null),f(!1)},[]);u.useEffect(()=>()=>{m()},[m]);let R=u.useCallback(t=>{_optionalChain([y, 'optionalCall', _15 => _15(t)]),!t.defaultPrevented&&(M||(t.preventDefault(),C(t.clientX,t.clientY,!1),i()))},[y,M,C,i]),I=u.useCallback(t=>{if(_optionalChain([k, 'optionalCall', _16 => _16(t)]),t.defaultPrevented||M)return;let x=t.touches[0];x&&(r.current={x:x.clientX,y:x.clientY},f(!0),P.current=setTimeout(()=>{r.current&&(C(r.current.x,r.current.y,!0),i(),f(!1),r.current=null)},zo))},[k,M,C,i]),B=u.useCallback(t=>{if(_optionalChain([S, 'optionalCall', _17 => _17(t)]),!r.current)return;let x=t.touches[0];if(!x)return;let G=x.clientX-r.current.x,L=x.clientY-r.current.y;Math.sqrt(G*G+L*L)>vo&&(m(),r.current=null)},[S,m]),H=u.useCallback(t=>{_optionalChain([h, 'optionalCall', _18 => _18(t)]),m(),r.current=null},[h,m]),v=u.useCallback(t=>{_optionalChain([b, 'optionalCall', _19 => _19(t)]),m(),r.current=null},[b,m]),w=u.useMemo(()=>({open:T,pressed:z,disabled:M}),[T,z,M]);return _userender.useRender.call(void 0, {render:d,ref:p,state:w,stateAttributesMapping:wo,props:{...V,"bazzaui-context-menu-trigger":"",onContextMenu:R,onTouchStart:I,onTouchMove:B,onTouchEnd:H,onTouchCancel:v,className:n,style:{WebkitTouchCallout:"none",WebkitUserSelect:"none",userSelect:"none",...e},children:s},defaultTagName:"div"})});var ve=(e=>(e.slot="bazzaui-context-menu-arrow",e.open="data-open",e.closed="data-closed",e.side="data-side",e.align="data-align",e.uncentered="data-uncentered",e))(ve||{});var we=(n=>(n.slot="bazzaui-context-menu-backdrop",n.open="data-open",n.closed="data-closed",n.startingStyle="data-starting-style",n.endingStyle="data-ending-style",n))(we||{});var Ge=(n=>(n.slot="bazzaui-context-menu-checkbox-item",n.checked="data-checked",n.unchecked="data-unchecked",n.highlighted="data-highlighted",n.disabled="data-disabled",n))(Ge||{}),Le= exports.ContextMenuCheckboxItemIndicatorDataAttributes =(o=>(o.slot="bazzaui-context-menu-checkbox-item-indicator",o.checked="data-checked",o.unchecked="data-unchecked",o))(Le||{});var Oe=(c=>(c.slot="bazzaui-context-menu-empty",c))(Oe||{});var Ee=(c=>(c.slot="bazzaui-context-menu-group",c))(Ee||{});var Ve=(c=>(c.slot="bazzaui-context-menu-group-label",c))(Ve||{});var Go={slot:"bazzaui-context-menu-icon",open:"data-popup-open"};var De=(o=>(o.slot="bazzaui-context-menu-input",o.open="data-open",o.closed="data-closed",o))(De||{});var Be=(o=>(o.slot="bazzaui-context-menu-item",o.highlighted="data-highlighted",o.disabled="data-disabled",o))(Be||{});var He=(p=>(p.slot="bazzaui-context-menu-list",p.list="data-popup-menu-list",p))(He||{});var Ne=(s=>(s.slot="bazzaui-context-menu-popup",s.open="data-open",s.closed="data-closed",s.side="data-side",s.align="data-align",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s.instant="data-instant",s.focused="data-focused",s.hasOpenSubmenu="data-has-open-submenu",s.submenu="data-submenu",s.navigating="data-navigating",s))(Ne||{});var je=(e=>(e.slot="bazzaui-context-menu-positioner",e.open="data-open",e.closed="data-closed",e.anchorHidden="data-anchor-hidden",e.side="data-side",e.align="data-align",e))(je||{});var Ue=(p=>(p.slot="bazzaui-context-menu-radio-group",p.disabled="data-disabled",p))(Ue||{});var Fe=(n=>(n.slot="bazzaui-context-menu-radio-item",n.checked="data-checked",n.unchecked="data-unchecked",n.highlighted="data-highlighted",n.disabled="data-disabled",n))(Fe||{}),Qe= exports.ContextMenuRadioItemIndicatorDataAttributes =(o=>(o.slot="bazzaui-context-menu-radio-item-indicator",o.checked="data-checked",o.unchecked="data-unchecked",o))(Qe||{});var Lo={slotUp:"bazzaui-context-menu-scroll-up-arrow",slotDown:"bazzaui-context-menu-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Ye=(c=>(c.slot="bazzaui-context-menu-separator",c))(Ye||{});var Xe=(p=>(p.slot="bazzaui-context-menu-shortcut",p.highlighted="data-highlighted",p))(Xe||{});var _e=(e=>(e.slot="bazzaui-context-menu-submenu-trigger",e.submenuTrigger="data-submenu-trigger",e.popupOpen="data-popup-open",e.popupFocused="data-popup-focused",e.highlighted="data-highlighted",e.disabled="data-disabled",e))(_e||{}),We= exports.ContextMenuSubmenuTriggerIndicatorDataAttributes =(p=>(p.slot="bazzaui-context-menu-submenu-trigger-indicator",p.popupOpen="data-popup-open",p))(We||{});var qe=(o=>(o.slot="bazzaui-context-menu-subpage-back",o.canGoBack="data-can-go-back",o.disabled="data-disabled",o))(qe||{});var Je=(d=>(d.slot="bazzaui-context-menu-subpage-back-item",d.subpageBackItem="data-subpage-back-item",d.highlighted="data-highlighted",d.disabled="data-disabled",d))(Je||{});var Ke=(e=>(e.slot="bazzaui-context-menu-subpage-trigger",e.subpageTrigger="data-subpage-trigger",e.popupOpen="data-popup-open",e.popupFocused="data-popup-focused",e.highlighted="data-highlighted",e.disabled="data-disabled",e))(Ke||{});var Ze=(c=>(c.slot="bazzaui-context-menu-surface",c))(Ze||{});exports.ContextMenu = ze; exports.ContextMenuArrowDataAttributes = ve; exports.ContextMenuBackdropDataAttributes = we; exports.ContextMenuCheckboxItemDataAttributes = Ge; exports.ContextMenuCheckboxItemIndicatorDataAttributes = Le; exports.ContextMenuDataInput = _chunkJSPKF52Ocjs.pa; exports.ContextMenuDataList = _chunkJSPKF52Ocjs.Kb; exports.ContextMenuDataSubpages = _chunkJSPKF52Ocjs.Lb; exports.ContextMenuDataSurface = _chunkJSPKF52Ocjs.Mb; exports.ContextMenuEmptyDataAttributes = Oe; exports.ContextMenuGroupDataAttributes = Ee; exports.ContextMenuGroupLabelDataAttributes = Ve; exports.ContextMenuIconDataAttributes = Go; exports.ContextMenuInputDataAttributes = De; exports.ContextMenuItemDataAttributes = Be; exports.ContextMenuListCssVars = _chunkJSPKF52Ocjs.qa; exports.ContextMenuListDataAttributes = He; exports.ContextMenuPopupDataAttributes = Ne; exports.ContextMenuPositionerCssVars = _chunkJSPKF52Ocjs.aa; exports.ContextMenuPositionerDataAttributes = je; exports.ContextMenuRadioGroupDataAttributes = Ue; exports.ContextMenuRadioGroupValue = _chunkJSPKF52Ocjs.Ka; exports.ContextMenuRadioItemDataAttributes = Fe; exports.ContextMenuRadioItemIndicatorDataAttributes = Qe; exports.ContextMenuScrollArrowDataAttributes = Lo; exports.ContextMenuSeparatorDataAttributes = Ye; exports.ContextMenuShortcutDataAttributes = Xe; exports.ContextMenuStore = _chunkFWWOE2SWcjs.x; exports.ContextMenuSubmenuTriggerDataAttributes = _e; exports.ContextMenuSubmenuTriggerIndicatorDataAttributes = We; exports.ContextMenuSubpageBackDataAttributes = qe; exports.ContextMenuSubpageBackItemDataAttributes = Je; exports.ContextMenuSubpageTriggerDataAttributes = Ke; exports.ContextMenuSurfaceDataAttributes = Ze; exports.ContextMenuTriggerDataAttributes = _; exports.DataSurfaceContext = _chunkJSPKF52Ocjs.U; exports.commandScore = _chunkFWWOE2SWcjs.v; exports.defaultFilter = _chunkFWWOE2SWcjs.w; exports.defineRadioGroup = _chunkJSPKF52Ocjs.eb; exports.isDisplayGroupNode = _chunkJSPKF52Ocjs.fb; exports.isDisplayRadioGroupNode = _chunkJSPKF52Ocjs.gb; exports.isDisplayRowNode = _chunkJSPKF52Ocjs.ib; exports.useAsyncMenuCoordinator = _chunkJSPKF52Ocjs.la; exports.useDataSurfaceContext = _chunkJSPKF52Ocjs.W; exports.useItem = _chunkJSPKF52Ocjs.ea; exports.useItemContext = _chunkFWWOE2SWcjs.f; exports.useMaybeAsyncMenuCoordinator = _chunkJSPKF52Ocjs.ma; exports.useMaybeDataSurfaceContext = _chunkJSPKF52Ocjs.X; exports.useMaybeItemContext = _chunkFWWOE2SWcjs.g; exports.useMaybeRootContext = _chunkJSPKF52Ocjs.m; exports.useMaybeSubmenuContext = _chunkJSPKF52Ocjs.u; exports.useMaybeSubpageContext = _chunkJSPKF52Ocjs.x; exports.useMaybeSubpageStack = _chunkJSPKF52Ocjs.B; exports.useMaybeSurfaceContext = _chunkFWWOE2SWcjs.p; exports.useRootContext = _chunkJSPKF52Ocjs.l; exports.useSubmenuContext = _chunkJSPKF52Ocjs.t; exports.useSubpageContext = _chunkJSPKF52Ocjs.w; exports.useSubpageStack = _chunkJSPKF52Ocjs.A; exports.useSurfaceContext = _chunkFWWOE2SWcjs.o;
|
|
2
|
+
//# sourceMappingURL=index.cjs.map
|