@bazza-ui/react 0.0.0 → 0.1.0-canary.10

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.
Files changed (113) hide show
  1. package/dist/ListboxStore-BYBpGrOz.d.ts +453 -0
  2. package/dist/ListboxStore-nmorsoqX.d.cts +453 -0
  3. package/dist/chunk-4C666HHU.js +2 -0
  4. package/dist/chunk-4C666HHU.js.map +1 -0
  5. package/dist/chunk-5T5B5SPR.cjs +2 -0
  6. package/dist/chunk-5T5B5SPR.cjs.map +1 -0
  7. package/dist/chunk-A4Z5BY7H.js +2 -0
  8. package/dist/chunk-A4Z5BY7H.js.map +1 -0
  9. package/dist/chunk-BFOY762U.js +2 -0
  10. package/dist/chunk-BFOY762U.js.map +1 -0
  11. package/dist/chunk-IT372NHF.js +2 -0
  12. package/dist/chunk-IT372NHF.js.map +1 -0
  13. package/dist/chunk-JFEVUUPC.cjs +2 -0
  14. package/dist/chunk-JFEVUUPC.cjs.map +1 -0
  15. package/dist/chunk-KO3DXT3Y.js +2 -0
  16. package/dist/chunk-KO3DXT3Y.js.map +1 -0
  17. package/dist/chunk-LXXK4S4Q.js +2 -0
  18. package/dist/chunk-LXXK4S4Q.js.map +1 -0
  19. package/dist/chunk-M4G6J7DP.cjs +2 -0
  20. package/dist/chunk-M4G6J7DP.cjs.map +1 -0
  21. package/dist/chunk-SCDHQZFI.cjs +2 -0
  22. package/dist/chunk-SCDHQZFI.cjs.map +1 -0
  23. package/dist/chunk-W4ACKMIZ.cjs +2 -0
  24. package/dist/chunk-W4ACKMIZ.cjs.map +1 -0
  25. package/dist/chunk-XMZZ62VJ.cjs +2 -0
  26. package/dist/chunk-XMZZ62VJ.cjs.map +1 -0
  27. package/dist/combobox/index.cjs +2 -0
  28. package/dist/combobox/index.cjs.map +1 -0
  29. package/dist/combobox/index.d.cts +1066 -0
  30. package/dist/combobox/index.d.ts +1066 -0
  31. package/dist/combobox/index.js +2 -0
  32. package/dist/combobox/index.js.map +1 -0
  33. package/dist/command-menu/index.cjs +2 -0
  34. package/dist/command-menu/index.cjs.map +1 -0
  35. package/dist/command-menu/index.d.cts +154 -0
  36. package/dist/command-menu/index.d.ts +154 -0
  37. package/dist/command-menu/index.js +2 -0
  38. package/dist/command-menu/index.js.map +1 -0
  39. package/dist/command-score-CTJ9NV6n.d.cts +23 -0
  40. package/dist/command-score-CTJ9NV6n.d.ts +23 -0
  41. package/dist/context-menu/index.cjs +2 -0
  42. package/dist/context-menu/index.cjs.map +1 -0
  43. package/dist/context-menu/index.d.cts +672 -0
  44. package/dist/context-menu/index.d.ts +672 -0
  45. package/dist/context-menu/index.js +2 -0
  46. package/dist/context-menu/index.js.map +1 -0
  47. package/dist/dropdown-menu/index.cjs +2 -0
  48. package/dist/dropdown-menu/index.cjs.map +1 -0
  49. package/dist/dropdown-menu/index.d.cts +699 -0
  50. package/dist/dropdown-menu/index.d.ts +699 -0
  51. package/dist/dropdown-menu/index.js +2 -0
  52. package/dist/dropdown-menu/index.js.map +1 -0
  53. package/dist/events-DOGItflK.d.ts +1776 -0
  54. package/dist/events-DPsuhBln.d.cts +1776 -0
  55. package/dist/input-C95v6jB0.d.cts +46 -0
  56. package/dist/input-CYweYB_i.d.ts +46 -0
  57. package/dist/internal/listbox/index.cjs +2 -0
  58. package/dist/internal/listbox/index.cjs.map +1 -0
  59. package/dist/internal/listbox/index.d.cts +272 -0
  60. package/dist/internal/listbox/index.d.ts +272 -0
  61. package/dist/internal/listbox/index.js +2 -0
  62. package/dist/internal/listbox/index.js.map +1 -0
  63. package/dist/internal/popup-menu/index.cjs +2 -0
  64. package/dist/internal/popup-menu/index.cjs.map +1 -0
  65. package/dist/internal/popup-menu/index.d.cts +238 -0
  66. package/dist/internal/popup-menu/index.d.ts +238 -0
  67. package/dist/internal/popup-menu/index.js +2 -0
  68. package/dist/internal/popup-menu/index.js.map +1 -0
  69. package/dist/items-B6HeFO_8.d.cts +37 -0
  70. package/dist/items-B6HeFO_8.d.ts +37 -0
  71. package/dist/kbd/index.cjs +2 -0
  72. package/dist/kbd/index.cjs.map +1 -0
  73. package/dist/kbd/index.d.cts +61 -0
  74. package/dist/kbd/index.d.ts +61 -0
  75. package/dist/kbd/index.js +2 -0
  76. package/dist/kbd/index.js.map +1 -0
  77. package/dist/loaders/index.cjs +2 -0
  78. package/dist/loaders/index.cjs.map +1 -0
  79. package/dist/loaders/index.d.cts +363 -0
  80. package/dist/loaders/index.d.ts +363 -0
  81. package/dist/loaders/index.js +2 -0
  82. package/dist/loaders/index.js.map +1 -0
  83. package/dist/loading-C6WZGUc3.d.cts +29 -0
  84. package/dist/loading-CC4n55sR.d.ts +29 -0
  85. package/dist/resolve-BYm41YfG.d.ts +406 -0
  86. package/dist/resolve-Dk_fAKb2.d.cts +406 -0
  87. package/dist/scroll-arrow-B81wZTZ2.d.cts +544 -0
  88. package/dist/scroll-arrow-CNd0tgME.d.ts +544 -0
  89. package/dist/select/index.cjs +2 -0
  90. package/dist/select/index.cjs.map +1 -0
  91. package/dist/select/index.d.cts +985 -0
  92. package/dist/select/index.d.ts +985 -0
  93. package/dist/select/index.js +2 -0
  94. package/dist/select/index.js.map +1 -0
  95. package/dist/separator-BiySI623.d.cts +275 -0
  96. package/dist/separator-De8l8DKO.d.ts +275 -0
  97. package/dist/surface-context-ClmxshBW.d.ts +14 -0
  98. package/dist/surface-context-DF-L-30G.d.cts +14 -0
  99. package/dist/type-guards-BC2B6bVi.d.cts +350 -0
  100. package/dist/type-guards-ybcHBB3C.d.ts +350 -0
  101. package/dist/types-DT4FOOa2.d.cts +51 -0
  102. package/dist/types-DT4FOOa2.d.ts +51 -0
  103. package/dist/use-listbox-item-NzZuY34-.d.cts +212 -0
  104. package/dist/use-listbox-item-NzZuY34-.d.ts +212 -0
  105. package/dist/video-player/index.cjs +3 -0
  106. package/dist/video-player/index.cjs.map +1 -0
  107. package/dist/video-player/index.d.cts +1391 -0
  108. package/dist/video-player/index.d.ts +1391 -0
  109. package/dist/video-player/index.js +3 -0
  110. package/dist/video-player/index.js.map +1 -0
  111. package/package.json +66 -12
  112. package/dist/index.d.ts +0 -2
  113. package/dist/index.js +0 -2
@@ -0,0 +1,2 @@
1
+ import{a as vo,b as Vo,c as Mo,d as Eo,e as Lo,f as te,g as wo}from"../chunk-KO3DXT3Y.js";import{J as io,K as po,L as Ct,N as mo,O as co,P as bo,Q as xo,R as N,S as F,T as fo,U as Co,W as go,a as ro,aa as gt,ba as ho,d as de,da as Po,ea as Io,fa as Ro,pa as So,q as ao,s as so,sa as yo,t as lo,v as uo,w as D,x as ft}from"../chunk-BFOY762U.js";import{a as oe,p as mt,q as ct,w as bt,x as dt,y as xt}from"../chunk-A4Z5BY7H.js";import{a as pt}from"../chunk-4C666HHU.js";var zo={};pt(zo,{Arrow:()=>so,Backdrop:()=>lo,Clear:()=>Me,Empty:()=>Co,Group:()=>So,GroupLabel:()=>go,Icon:()=>fo,Input:()=>we,InputWrapper:()=>ke,Item:()=>Te,ItemIndicator:()=>He,ItemLabel:()=>Oe,List:()=>ho,Popup:()=>io,Portal:()=>po,Positioner:()=>De,Root:()=>Ae,ScrollDownArrow:()=>Io,ScrollUpArrow:()=>Po,Separator:()=>yo,Surface:()=>Fe,useComboboxPositionerContext:()=>Ee});import{useRender as ht}from"@base-ui/react/use-render";import*as _ from"react";var ko={slot:"bazzaui-combobox-clear"};var Me=_.forwardRef(function(e,o){let{keepMounted:i=!1,disabled:u,render:s,className:p,style:c,onClick:a,onPointerDown:t,...P}=e,m=D(),b=u??m.disabled,I=m.multiple?m.values.length>0:m.value!=="",d=_.useCallback(R=>{a?.(R),!R.defaultPrevented&&(m.multiple?m.onValuesChange([]):m.onValueChange(""),m.onInputValueChange(""))},[a,m]),g=_.useCallback(R=>{R.preventDefault(),t?.(R)},[t]),l=_.useMemo(()=>({hasValue:I,disabled:b}),[I,b]),S=ht({render:s,ref:o,state:l,props:{...P,[ko.slot]:"",type:"button",tabIndex:-1,"aria-label":"Clear selection",disabled:b||!I,className:p,style:c,onClick:d,onPointerDown:g},enabled:i||I,defaultTagName:"button"});return!i&&!I?null:S});import*as xe from"react";var fe=xe.createContext(null);function Ee(){return xe.useContext(fe)}import{useRender as Pt}from"@base-ui/react/use-render";import*as ne from"react";import*as Ce from"react";var Le=Ce.createContext(!1);function To(){return Ce.useContext(Le)}var Q={slot:"bazzaui-combobox-input",open:"data-open",closed:"data-closed",disabled:"data-disabled",placeholder:"data-placeholder"};import*as se from"react";function Ho(x){let{comboboxContext:e,open:o}=x,i=e.multiple?e.values.length>0:!xo(e.value),u=se.useCallback(c=>{let a=F(c,e.itemToStringValue),t=e.itemTextRegistry.get(a);if(t!==void 0)return t;let P=te(e.items,a);if(typeof P=="string")return P;let m=N(c,e.itemToStringLabel);if(m&&m!==a)return m},[e.itemTextRegistry,e.items,e.itemToStringLabel,e.itemToStringValue]),s=se.useMemo(()=>{if(!i)return"";if(e.multiple){let t=e.values.map(P=>{let m=u(P);return m!==void 0?m:N(P,e.itemToStringLabel)||F(P,e.itemToStringValue)}).filter(Boolean);return t.length<=2?t.join(", "):`${t.length} selected`}let c=e.value;if(c==null)return"";let a=u(c);return a!==void 0?a:N(c,e.itemToStringLabel)||F(c,e.itemToStringValue)},[i,e.multiple,e.value,e.values,e.itemToStringLabel,e.itemToStringValue,u]),p=se.useMemo(()=>o?e.inputValue:s,[o,s,e.inputValue]);return{hasValue:i,displayValue:p,selectedLabel:s,getValueText:u}}import*as T from"react";function Oo(x){let{comboboxContext:e,store:o,focusOwnerStore:i,open:u,disabled:s,cursorBehavior:p,hasValue:c,getValueText:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}=x,I=T.useRef(!1),d=T.useRef(!1),g=T.useRef(!1),l=T.useRef(null),S=T.useRef(null),R=T.useRef(null);T.useEffect(()=>{if(!u)return;let n=f=>{let r=e.inputRef.current,v=e.inputWrapperRef.current,y=document.getElementById(e.listId),O=f.target,W=r?.contains(O),z=v?.contains(O),ee=y?.contains(O);!W&&!z&&!ee&&(R.current=f)};return document.addEventListener("pointerdown",n,!0),()=>{document.removeEventListener("pointerdown",n,!0),R.current=null}},[u,e.inputRef,e.inputWrapperRef,e.listId]),T.useLayoutEffect(()=>{let n=e.inputRef.current;if(n&&u&&S.current){let{start:f,end:r}=S.current,v=n.selectionStart,y=n.value.length;v===y&&f!==y&&n.setSelectionRange(f,r),S.current=null}});let L=T.useRef(u);T.useLayoutEffect(()=>{if(u&&!L.current){if(I.current){I.current=!1,L.current=u;return}if(g.current){g.current=!1,d.current=!1,l.current=null,L.current=u;return}if(d.current&&p==="none"){let f=e.inputRef.current,r=l.current;f&&r!==null&&requestAnimationFrame(()=>{let v=f.value.length,y=Math.min(r,v);f.setSelectionRange(y,y)}),d.current=!1,l.current=null,L.current=u;return}c&&e.multiple&&e.onInputValueChange("");let n=e.inputRef.current;if(n){let f=n.value.length;p==="select-all"&&f>0?requestAnimationFrame(()=>{n.setSelectionRange(0,n.value.length)}):p==="end"&&f>0&&requestAnimationFrame(()=>{n.setSelectionRange(n.value.length,n.value.length)})}}L.current=u},[u,e,c,p]);let w=T.useCallback(n=>{let f=n.target,r=f.value,v=f.selectionStart,y=f.selectionEnd;v!==null&&y!==null&&(S.current={start:v,end:y}),e.onInputValueChange(r),e.setFilterActive(),o.setSearch(r),o.state.open||(I.current=!0,e.openCombobox())},[e,o]),k=T.useCallback(n=>{if(t?.(n),n.defaultPrevented)return;let f=o.state.open;if(f&&(g.current=!0),e.openOnFocus&&!s&&!f){if(c&&!e.multiple){let r=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(r)}e.openCombobox()}},[t,e,s,o,c,a]),V=T.useCallback(n=>{P?.(n),!n.defaultPrevented&&requestAnimationFrame(()=>{let f=document.activeElement,v=document.getElementById(e.listId)?.contains(f),y=f===e.inputRef.current;if(!v&&!y){g.current=!1;let O=R.current,W=O?oe.outsidePress:oe.focusOut;R.current=null,e.closeCombobox(W,O??void 0)}})},[P,e]),A=T.useCallback(n=>{if(m?.(n),n.defaultPrevented)return;let f=o.state.open;if(!s&&!f){let r=n.target;if(p==="none"){let v=r.selectionStart;l.current=v,d.current=!0}if(c&&!e.multiple){let v=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(v)}e.openCombobox()}else f&&(g.current=!0)},[m,e,s,o,p,c,a]),K=T.useCallback(n=>{if(b?.(n),!n.defaultPrevented){if(u&&n.key==="Escape"){n.preventDefault(),e.closeCombobox(oe.escapeKey);return}if(!u&&(n.key==="ArrowDown"||n.key==="ArrowUp"||n.key==="Enter")){if(n.preventDefault(),c&&!e.multiple){let f=a(e.value)??N(e.value,e.itemToStringLabel);e.onInputValueChange(f)}e.openCombobox();return}}},[u,e,b,c,a]),{handleKeyDown:j}=bo({store:o,surfaceId:"combobox-input",focusOwnerStore:i,depth:0,submenuContext:null,subpageContext:null,enabled:u,enableTypeToSearch:!1,onKeyDown:K,closeAll:e.closeCombobox,skipFocusOwnerCheck:!0});return{handleChange:w,handleFocus:k,handleBlur:V,handleClick:A,handleKeyDown:j,selectionRef:S}}var we=ne.forwardRef(function(e,o){let{placeholder:i,disabled:u,cursorBehavior:s="none",render:p,className:c,style:a,onFocus:t,onBlur:P,onClick:m,onKeyDown:b,...I}=e,d=D(),g=de(),l=ro(),S=To(),R=(u??d.disabled)||g.disabled,L=te(d.items,""),w=i??(typeof L=="string"?L:void 0)??d.placeholder,k=g.store.useState("open"),{hasValue:V,displayValue:A,getValueText:K}=Ho({comboboxContext:d,open:k}),{handleChange:j,handleFocus:n,handleBlur:f,handleClick:r,handleKeyDown:v}=Oo({comboboxContext:d,store:g.store,focusOwnerStore:l,open:k,disabled:R,cursorBehavior:s,hasValue:V,getValueText:K,onFocus:t,onBlur:P,onClick:m,onKeyDown:b}),y={[Q.slot]:""};k?y[Q.open]="":y[Q.closed]="",R&&(y[Q.disabled]=""),V||(y[Q.placeholder]=""),d.layout==="input-embedded"&&(y["data-input-embedded"]="");let O=ne.useCallback(M=>{d.setInputElement(M),typeof o=="function"?o(M):o&&(o.current=M)},[o,d]),W=ne.useMemo(()=>({open:k,disabled:R,placeholder:!V}),[k,R,V]),z=d.layout==="input-embedded"&&!S?{position:"relative",zIndex:1}:void 0;return Pt({render:p,ref:O,state:W,props:{...I,...y,type:"text",role:"combobox","aria-autocomplete":"list","aria-expanded":k,"aria-controls":d.listId,"aria-haspopup":"listbox",autoComplete:"off",autoCorrect:"off",spellCheck:!1,disabled:R,placeholder:V?void 0:w,className:c,style:{...z,...a},value:A,onChange:j,onFocus:n,onBlur:f,onClick:r,onKeyDown:v},defaultTagName:"input"})});import{useRender as It}from"@base-ui/react/use-render";import*as re from"react";var ge={slot:"bazzaui-combobox-input-wrapper",open:"data-open"};import{jsx as St}from"react/jsx-runtime";var Rt={open:x=>x?{[ge.open]:""}:null},ke=re.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,{store:a}=de(),t=D(),P=a.useState("open"),m=re.useMemo(()=>({open:P}),[P]),b=t.layout==="input-embedded"?{position:"relative",zIndex:1}:{position:"relative"},I=re.useCallback(g=>{t.setInputWrapperElement(g),typeof o=="function"?o(g):o&&(o.current=g)},[o,t]),d=It({render:i,ref:I,state:m,stateAttributesMapping:Rt,props:{...c,[ge.slot]:"",className:u,style:{...b,...s},children:p},defaultTagName:"div"});return St(Le.Provider,{value:!0,children:d})});import{useRender as vt}from"@base-ui/react/use-render";import*as E from"react";var q={slot:"bazzaui-combobox-item",highlighted:"data-highlighted",disabled:"data-disabled",selected:"data-selected",first:"data-first",last:"data-last",firstInGroup:"data-first-in-group",lastInGroup:"data-last-in-group"};import*as le from"react";var he=le.createContext(null);function ue(){let x=le.useContext(he);if(!x)throw new Error("ComboboxItem child components must be used within a Combobox.Item");return x}function yt(){return le.useContext(he)}import{jsx as Et}from"react/jsx-runtime";var Vt={highlighted:x=>x?{[q.highlighted]:""}:null,disabled:x=>x?{[q.disabled]:""}:null,selected:x=>x?{[q.selected]:""}:null,first:x=>x?{[q.first]:""}:null,last:x=>x?{[q.last]:""}:null,firstInGroup:x=>x?{[q.firstInGroup]:""}:null,lastInGroup:x=>x?{[q.lastInGroup]:""}:null};function Mt(x,e){let{value:o,textValue:i,keywords:u,disabled:s=!1,onSelect:p,forceMount:c=!1,render:a,className:t,style:P,onClick:m,onPointerDown:b,onPointerMove:I,children:d,...g}=x,l=D(),S=E.useMemo(()=>F(o,l.itemToStringValue),[o,l.itemToStringValue]),R=E.useId(),L=o===null?`combobox-clear-${R}`:void 0,w=E.useMemo(()=>Lo(l.items,S),[l.items,S]),k=w?.label,V=E.useMemo(()=>N(o,l.itemToStringLabel),[o,l.itemToStringLabel]),A=E.useMemo(()=>{if(i!==void 0)return i;if(typeof k=="string")return k;if(V&&V!==S)return V},[i,k,V,S]),K=E.useMemo(()=>wo(u,[typeof k=="string"?k:V&&V!==S?V:void 0,...w?.keywords??[]]),[u,k,V,S,w]),j=E.useRef(A),n=l.multiple?Mo(l.values,o,l.isItemEqualToValue):l.value!==""&&Vo(l.value,o,l.isItemEqualToValue),f=l.closeOnSelect,r=co({id:L,value:S,keywords:K,disabled:s,forceMount:c,closeOnClick:f,children:d});E.useEffect(()=>{let M=()=>{if(!s){if(l.multiple)if(o==null)l.onValuesChange([]);else{let me=n?Eo(l.values,o,l.isItemEqualToValue):[...l.values,o];l.onValuesChange(me)}else l.onValueChange(o);p?.()}};return r.registerSelect(M)},[s,l,o,n,p,r]),E.useEffect(()=>{let M=j.current;if(M)return l.registerItemText(S,M)},[S,l]),E.useEffect(()=>{!A&&typeof d=="string"&&(j.current=d,l.registerItemText(S,d))},[d,A,S,l]);let v=E.useMemo(()=>({highlighted:r.isHighlighted,disabled:s,selected:n,first:r.positional.first,last:r.positional.last,firstInGroup:r.positional.firstInGroup,lastInGroup:r.positional.lastInGroup}),[r.isHighlighted,s,n,r.positional]),y=E.useMemo(()=>({id:r.id,value:o,textValue:A,highlighted:r.isHighlighted,disabled:s,selected:n}),[r.id,o,A,r.isHighlighted,s,n]),O=E.useCallback(M=>{m?.(M),M.defaultPrevented||r.handlers.onClick(M)},[m,r.handlers]),W=E.useCallback(M=>{r.handlers.onPointerDown(M),b?.(M)},[r.handlers,b]),z=E.useCallback(M=>{I?.(M),M.defaultPrevented||r.handlers.onPointerMove(M)},[I,r.handlers]),ee=vt({render:a,ref:[r.ref,r.rowRef,e],state:v,stateAttributesMapping:Vt,props:{...g,[q.slot]:"",id:r.id,role:"option",tabIndex:-1,"aria-selected":n,"aria-disabled":s||void 0,className:t,style:P,onClick:O,onPointerMove:z,onPointerDown:W,children:d},enabled:r.isVisible,defaultTagName:"div"});return r.isVisible?Et(he.Provider,{value:y,children:ee}):null}var Te=E.forwardRef(Mt);import{useRender as Lt}from"@base-ui/react/use-render";import*as Ie from"react";var Pe={slot:"bazzaui-combobox-item-indicator",selected:"data-selected"};var wt={selected:x=>x?{[Pe.selected]:""}:null},He=Ie.forwardRef(function(e,o){let{keepMounted:i=!1,render:u,className:s,style:p,...c}=e,a=ue(),t=Ie.useMemo(()=>({selected:a.selected}),[a.selected]),P=Lt({render:u,ref:o,state:t,stateAttributesMapping:wt,props:{...c,[Pe.slot]:"","aria-hidden":!0,className:s,style:p},enabled:i||a.selected,defaultTagName:"span"});return!i&&!a.selected?null:P});import{useRender as kt}from"@base-ui/react/use-render";import*as Y from"react";var Do={slot:"bazzaui-combobox-item-label"};var Oe=Y.forwardRef(function(e,o){let{render:i,className:u,style:s,children:p,...c}=e,a=D(),t=ue(),P=F(t.value,a.itemToStringValue),m=Y.useMemo(()=>{if(p!==void 0)return p;let I=te(a.items,P);return I!==void 0?I:t.textValue!==void 0?t.textValue:P},[p,a.items,P,t.textValue]),b=Y.useMemo(()=>({value:P,selected:t.selected,highlighted:t.highlighted,disabled:t.disabled}),[P,t.selected,t.highlighted,t.disabled]);return Y.useEffect(()=>{if(typeof m=="string")return a.registerItemText(P,m)},[m,a,P]),kt({render:i,ref:o,state:b,props:{...c,[Do.slot]:"",className:u,style:s,children:m},defaultTagName:"span"})});import{Popover as Ao}from"@base-ui/react/popover";import*as U from"react";var Re={slot:"bazzaui-combobox-positioner"};import{jsx as ie}from"react/jsx-runtime";function Tt(x,e,o,i){let u=o+i*2;if(x==="top"){let c=-(e+i),a=e+i;return{width:u,marginBottom:c,paddingTop:i,paddingLeft:i,paddingRight:i,paddingBottom:a}}let s=-(e+i),p=e+i;return{width:u,marginTop:s,paddingTop:p,paddingLeft:i,paddingRight:i,paddingBottom:i}}var De=U.forwardRef(function(e,o){let{layout:i,popupPadding:u=8,side:s="bottom",align:p,sideOffset:c=4,anchor:a,className:t,style:P,children:m,...b}=e,I=D(),d=i??I.layout,g=d==="input-embedded",l=a??I.inputWrapperRef.current?I.inputWrapperRef:I.inputRef,S=g?0:c,R=g?"center":p??"start",{inputHeight:L,inputWidth:w}=I,k=w+u*2,V={...P,...g?{zIndex:0}:{}};if(g)return ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:V,"data-input-embedded":"",[Re.slot]:"",...b,render:(n,f)=>{let r=f.side,v={layout:d,side:r,align:f.align,inputHeight:I.inputHeight},y={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`,"--combobox-popup-padding":`${u}px`,"--combobox-popup-width":`${k}px`},O=Tt(r,L,w,u),W=U.Children.map(m,z=>U.isValidElement(z)?U.cloneElement(z,{style:{...O,...z.props.style},"data-side":r}):z);return ie(fe.Provider,{value:v,children:ie("div",{...n,style:{...n.style,...y},"data-side":r,children:W})})}});let A={layout:d,side:s,align:R,inputHeight:I.inputHeight},K={"--combobox-input-height":`${L}px`,"--combobox-input-width":`${w}px`},j={...V,...K};return ie(fe.Provider,{value:A,children:ie(Ao.Positioner,{ref:o,side:s,align:R,sideOffset:S,anchor:l,className:t,style:j,[Re.slot]:"",...b,children:m})})});import{Popover as Ht}from"@base-ui/react/popover";import*as h from"react";import{jsx as pe,jsxs as Ot}from"react/jsx-runtime";function Ae(x){let{open:e,onOpenChange:o,actionsRef:i,defaultOpen:u=!1,value:s,defaultValue:p,onValueChange:c,multiple:a=!1,values:t,defaultValues:P,onValuesChange:m,isItemEqualToValue:b=vo,itemToStringLabel:I,itemToStringValue:d,inputValue:g,defaultInputValue:l="",onInputValueChange:S,name:R,form:L,required:w,disabled:k=!1,placeholder:V="Search...",items:A,modal:K=!1,closeOnSelect:j,openOnFocus:n=!0,virtualized:f=!1,virtualItems:r,onHighlightChange:v,layout:y="floating",onOpenChangeComplete:O,debug:W,children:z,...ee}=x,M=h.useCallback((C,H,G,be)=>v?.(C,G,be),[v]),me=h.useId(),ce=h.useRef(null),Se=h.useRef(null),[ze,Be]=h.useState(0),[We,je]=h.useState(0),Ge=h.useCallback(C=>{if(ce.current=C,C&&!Se.current){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),Ne=h.useCallback(C=>{if(Se.current=C,C){let H=C.getBoundingClientRect();Be(H.height),je(H.width)}},[]),{store:B,focusOwnerStore:$o,openChainStore:Jo,registerSurface:Xo,closeAll:_o,virtualization:Qo,handleOpenChange:qe,disabled:$,setDisabled:Ke,menuTreeResolver:Yo}=ao({onOpenChange:o,defaultOpen:u,virtualized:f,items:r,onHighlightChange:M,disabled:k}),ye=h.useRef(null);h.useImperativeHandle(i,()=>({close:()=>{ye.current?.close()},unmount:()=>{ye.current?.unmount()},setDisabled:Ke}),[Ke]),B.useControlledProp("openProp",e);let Zo=B.useState("open"),Ue=h.useCallback((C,H,G)=>{$&&H!==oe.imperativeAction||!C&&ce.current&&document.activeElement===ce.current||qe(C,H,G)},[qe,$]),et=h.useCallback(C=>{!C&&B.context.clearSearchOnClose==="after-exit"&&(B.clearSearch(),B.setInputActive(!1)),C||B.clearHighlight(),O?.(C)},[B,O]),ot=h.useCallback((C,H)=>{Ue(C,H.reason,H.event)},[Ue]),[tt,nt]=h.useState(p!==void 0?p:null),J=s!==void 0?s:tt,$e=h.useCallback(C=>{s===void 0&&nt(C),c?.(C)},[s,c]),[rt,at]=h.useState(P??[]),ae=t!==void 0?t:rt,Je=h.useCallback(C=>{t===void 0&&at(C),m?.(C)},[t,m]),[ve,st]=h.useState(l),Xe=g!==void 0?g:ve,_e=h.useCallback(C=>{g===void 0&&st(C),S?.(C)},[g,S]),Qe=h.useRef(new Map),Ye=h.useCallback((C,H)=>(Qe.current.set(C,H),()=>{}),[]),Ze=j??!a,Ve=h.useRef({type:"active"}),[,lt]=h.useState({type:"active"}),X=h.useCallback(C=>{Ve.current=C,lt(C)},[]),eo=Ve.current,oo=h.useCallback(()=>{X({type:"active"})},[X]),to=h.useCallback(()=>{$||(!a&&J!=null?X({type:"showAll"}):X({type:"active"}),B.setOpen(!0))},[$,B,a,J,X]),no=h.useCallback((C,H)=>{let G=Ve.current,be=G.type==="active"?ve:G.type==="showAll"?"":G.search;X({type:"frozen",search:be}),B.setOpen(!1,C,H)},[B,X,ve]),ut=h.useMemo(()=>({multiple:a,value:J,values:ae,onValueChange:$e,onValuesChange:Je,isItemEqualToValue:b,itemToStringLabel:I,itemToStringValue:d,inputValue:Xe,onInputValueChange:_e,name:R,form:L,required:w,disabled:$,placeholder:V,items:A,itemTextRegistry:Qe.current,registerItemText:Ye,listId:me,inputRef:ce,setInputElement:Ge,inputWrapperRef:Se,setInputWrapperElement:Ne,closeOnSelect:Ze,openOnFocus:n,openCombobox:to,closeCombobox:no,filterMode:eo,setFilterActive:oo,inputHeight:ze,inputWidth:We,layout:y}),[a,J,ae,$e,Je,b,I,d,Xe,_e,R,L,w,$,V,A,Ye,me,Ge,Ne,Ze,n,to,no,eo,oo,ze,We,y]),it=h.useMemo(()=>R?a?ae.length>0?ae.map((C,H)=>{let G=F(C,d);return pe("input",{type:"hidden",name:R,value:G,form:L,required:w&&H===0},G)}):pe("input",{type:"hidden",name:R,value:"",form:L,required:w}):pe("input",{type:"hidden",name:R,value:J!=null?F(J,d):"",form:L,required:w}):null,[R,L,w,a,J,ae,d]);return pe(uo.Provider,{value:ut,children:Ot(mo,{menuTreeResolver:Yo,store:B,focusOwnerStore:$o,openChainStore:Jo,disabled:$,depth:0,closeAll:_o,registerSurface:Xo,virtualization:Qo,menuType:"dropdown",componentName:"combobox",debug:W,children:[it,pe(Ht.Root,{...ee,open:Zo,onOpenChange:ot,onOpenChangeComplete:et,modal:K,actionsRef:i?ye:void 0,children:z})]})})}import*as Z from"react";var Fo={slot:"bazzaui-combobox-surface"};import{jsx as Dt}from"react/jsx-runtime";var Fe=Z.forwardRef(function(e,o){let{autoHighlightFirst:i,clearSearchOnClose:u=!0,search:s,onSearchChange:p,onPointerMove:c,...a}=e,t=D(),P=Z.useCallback(g=>{c?.(g);let l=t.inputRef.current;l&&document.activeElement!==l&&l.focus()},[c,t.inputRef]),m=Z.useMemo(()=>{let g=i??!0;if(g==="selected"){let l=t.multiple?t.values[0]:t.value;return l!=null?F(l,t.itemToStringValue):!0}return g},[i,t.multiple,t.value,t.values,t.itemToStringValue]),{filterMode:b}=t,I=s??(b.type==="active"?t.inputValue:b.type==="showAll"?"":b.search),d=Z.useCallback(g=>{t.onInputValueChange(g),p?.(g)},[t,p]);return Dt(Ro,{ref:o,autoHighlightFirst:m,clearSearchOnClose:u,search:I,onSearchChange:d,onPointerMove:P,skipAutoFocus:!0,[Fo.slot]:"",...a})});var Bo=(p=>(p.slot="bazzaui-combobox-arrow",p.open="data-open",p.closed="data-closed",p.side="data-side",p.align="data-align",p.uncentered="data-uncentered",p))(Bo||{});var Wo=(s=>(s.slot="bazzaui-combobox-backdrop",s.open="data-open",s.closed="data-closed",s.startingStyle="data-starting-style",s.endingStyle="data-ending-style",s))(Wo||{});var jo=(e=>(e.slot="bazzaui-combobox-empty",e))(jo||{});var Go=(e=>(e.slot="bazzaui-combobox-group",e))(Go||{});var No=(e=>(e.slot="bazzaui-combobox-group-label",e))(No||{});var At={slot:"bazzaui-combobox-icon",open:"data-popup-open"};var qo=(o=>(o.slot="bazzaui-combobox-list",o.list="data-popup-menu-list",o))(qo||{});var Ko=(b=>(b.slot="bazzaui-combobox-popup",b.open="data-open",b.closed="data-closed",b.side="data-side",b.align="data-align",b.startingStyle="data-starting-style",b.endingStyle="data-ending-style",b.instant="data-instant",b.focused="data-focused",b.hasOpenSubmenu="data-has-open-submenu",b.submenu="data-submenu",b.navigating="data-navigating",b))(Ko||{});var Ft={slotUp:"bazzaui-combobox-scroll-up-arrow",slotDown:"bazzaui-combobox-scroll-down-arrow",direction:"data-direction",side:"data-side"};var Uo=(e=>(e.slot="bazzaui-combobox-separator",e))(Uo||{});export{zo as Combobox,Bo as ComboboxArrowDataAttributes,Wo as ComboboxBackdropDataAttributes,Me as ComboboxClear,jo as ComboboxEmptyDataAttributes,Go as ComboboxGroupDataAttributes,No as ComboboxGroupLabelDataAttributes,At as ComboboxIconDataAttributes,we as ComboboxInput,Q as ComboboxInputDataAttributes,ke as ComboboxInputWrapper,ge as ComboboxInputWrapperDataAttributes,Te as ComboboxItem,q as ComboboxItemDataAttributes,He as ComboboxItemIndicator,Pe as ComboboxItemIndicatorDataAttributes,Oe as ComboboxItemLabel,gt as ComboboxListCssVars,qo as ComboboxListDataAttributes,Ko as ComboboxPopupDataAttributes,De as ComboboxPositioner,Ct as ComboboxPositionerCssVars,Re as ComboboxPositionerDataAttributes,Ae as ComboboxRoot,Ft as ComboboxScrollArrowDataAttributes,Uo as ComboboxSeparatorDataAttributes,xt as ComboboxStore,Fe as ComboboxSurface,bt as commandScore,dt as defaultFilter,D as useComboboxContext,ue as useComboboxItemContext,Ee as useComboboxPositionerContext,ft as useMaybeComboboxContext,yt as useMaybeComboboxItemContext,ct as useMaybeSurfaceContext,mt 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 onPointerDown,\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 onPointerDown?.(event)\n },\n [onPointerDown],\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 { resolveLabelFromItems } from '../../utils/items.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\n // A `null` item's label (looked up under the empty-string key) acts as the\n // placeholder, taking precedence over the Root placeholder but not an\n // explicit `placeholder` prop on the input.\n const nullItemLabel = resolveLabelFromItems(comboboxContext.items, '')\n const placeholder =\n placeholderProp ??\n (typeof nullItemLabel === 'string' ? nullItemLabel : undefined) ??\n 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 { resolveLabelFromItems } from '../../utils/items.js'\nimport {\n isValueEmpty,\n resolveLabel,\n stringifyAsValue,\n} from '../../utils/resolve-value-label.js'\nimport type { ComboboxContextValue } from '../contexts/combobox-context.js'\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 : !isValueEmpty(comboboxContext.value)\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 // The input can only display strings, so ignore non-string labels here.\n const itemsLabel = resolveLabelFromItems(\n comboboxContext.items,\n serializedValue,\n )\n if (typeof itemsLabel === 'string') {\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 // Empty-string values are already handled by the `!hasValue` guard above;\n // this null check also narrows `Value | null` down to `Value`.\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 { mergeKeywords, resolveItemFromItems } from '../../utils/items.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 first: boolean\n last: boolean\n firstInGroup: boolean\n lastInGroup: 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 * Pass `null` to render a clearable item: selecting it clears the selection\n * and its label is used as the input placeholder (Base UI parity).\n */\n value: Value | null\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 first: (value: unknown) =>\n value ? { [ComboboxItemDataAttributes.first]: '' } : null,\n last: (value: unknown) =>\n value ? { [ComboboxItemDataAttributes.last]: '' } : null,\n firstInGroup: (value: unknown) =>\n value ? { [ComboboxItemDataAttributes.firstInGroup]: '' } : null,\n lastInGroup: (value: unknown) =>\n value ? { [ComboboxItemDataAttributes.lastInGroup]: '' } : null,\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 // A null value serializes to '' which the listbox treats as \"no id\" and skips\n // registration. Give a clearable (null) item an explicit id so it still\n // registers and is selectable; its label still feeds filtering via keywords.\n const generatedItemId = React.useId()\n const listboxId =\n value === null ? `combobox-clear-${generatedItemId}` : undefined\n\n // Resolve the item entry (label + keywords) from the items prop, for\n // auto-populating textValue and filter keywords.\n const itemFromItems = React.useMemo(\n () => resolveItemFromItems(comboboxContext.items, serializedValue),\n [comboboxContext.items, serializedValue],\n )\n const labelFromItems = itemFromItems?.label\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 the label plus any items[].keywords to the filter keywords.\n const keywords = React.useMemo(() => {\n const labelStr =\n typeof labelFromItems === 'string'\n ? labelFromItems\n : labelFromObjectValue && labelFromObjectValue !== serializedValue\n ? labelFromObjectValue\n : undefined\n return mergeKeywords(keywordsProp, [\n labelStr,\n ...(itemFromItems?.keywords ?? []),\n ])\n }, [\n keywordsProp,\n labelFromItems,\n labelFromObjectValue,\n serializedValue,\n itemFromItems,\n ])\n\n const textRef = React.useRef<string | undefined>(textValue)\n\n // Track if this item is selected using custom equality.\n // A `null` item is selected when there is no selection; an empty string is\n // still treated as \"no selection\" and never matches an item.\n const selected = comboboxContext.multiple\n ? itemIncludes(\n comboboxContext.values,\n value,\n comboboxContext.isItemEqualToValue,\n )\n : comboboxContext.value !== '' &&\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 id: listboxId,\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 // A null item clears all selections in multi-select mode.\n if (value == null) {\n comboboxContext.onValuesChange([])\n } else {\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 }\n } else {\n // Set single value (null clears the selection)\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 first: item.positional.first,\n last: item.positional.last,\n firstInGroup: item.positional.firstInGroup,\n lastInGroup: item.positional.lastInGroup,\n }),\n [item.isHighlighted, disabled, selected, item.positional],\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, item.rowRef, 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 /** Present when this row is the first visible list-level row (not inside a group). */\n first: 'data-first',\n /** Present when this row is the last visible list-level row (not inside a group). */\n last: 'data-last',\n /** Present when this row is the first visible row within its group. */\n firstInGroup: 'data-first-in-group',\n /** Present when this row is the last visible row within its group. */\n lastInGroup: 'data-last-in-group',\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 | null\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 { resolveLabelFromItems } from '../../utils/items.js'\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 * 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 type PopupMenuHighlightChangeHandler,\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 type { Items } from '../../utils/items.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 * Note: when a clearable (`null`) item is selected, this is called with\n * `null` at runtime. If you use `null` items, handle that case.\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\n * `{ value, label, keywords? }` objects. Only the array form can express\n * `keywords` (extra filter terms) or a `null` (clearable) value.\n * @example\n * ```tsx\n * // Record format\n * <Combobox.Root items={{ us: 'United States', uk: 'United Kingdom' }}>\n *\n * // Array format (supports keywords and a null clearable item)\n * <Combobox.Root items={[\n * { value: null, label: 'Select a country' },\n * { value: 'us', label: 'United States', keywords: ['america', 'usa'] },\n * { value: 'uk', label: 'United Kingdom' },\n * ]}>\n * ```\n */\n items?: Items\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 const handleHighlightChange =\n React.useCallback<PopupMenuHighlightChangeHandler>(\n (id, _node, index, details) =>\n onHighlightChange?.(\n id,\n index,\n details as ComboboxHighlightChangeEventDetails,\n ),\n [onHighlightChange],\n )\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 menuTreeResolver,\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: handleHighlightChange,\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('openProp', openProp)\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 if (!nextOpen) {\n store.clearHighlight()\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 | null) => {\n if (valueProp === undefined) {\n setInternalValue(newValue)\n }\n // `null` is only produced by a clearable item; the public onValueChange\n // type stays `(value: Value) => void` to keep `onValueChange={setState}`\n // ergonomic, so the null is forwarded through a cast at this boundary.\n onValueChange?.(newValue as Value)\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 menuTreeResolver={menuTreeResolver}\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 * Whether to clear the search query when the combobox closes.\n * - `true`: clear immediately when the combobox closes (default)\n * - `false`: preserve search when the combobox closes\n * - `'after-exit'`: clear after exit animation completes\n * @default true\n */\n clearSearchOnClose?: boolean | 'after-exit'\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 clearSearchOnClose = true,\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 clearSearchOnClose={clearSearchOnClose}\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":"odAAA,IAAAA,GAAA,GAAAC,GAAAD,GAAA,WAAAE,GAAA,aAAAC,GAAA,UAAAC,GAAA,UAAAC,GAAA,UAAAC,GAAA,eAAAC,GAAA,SAAAC,GAAA,UAAAC,GAAA,iBAAAC,GAAA,SAAAC,GAAA,kBAAAC,GAAA,cAAAC,GAAA,SAAAC,GAAA,UAAAC,GAAA,WAAAC,GAAA,eAAAC,GAAA,SAAAC,GAAA,oBAAAC,GAAA,kBAAAC,GAAA,cAAAC,GAAA,YAAAC,GAAA,iCAAAC,KCEA,OAAS,aAAAC,OAAiB,4BAC1B,UAAYC,MAAW,QCAhB,IAAMC,GAA8B,CAKzC,KAAM,wBACR,EDyBO,IAAMC,GAAsB,aAGjC,SAAuBC,EAAOC,EAAc,CAC5C,GAAM,CACJ,YAAAC,EAAc,GACd,SAAUC,EACV,OAAAC,EACA,UAAAC,EACA,MAAAC,EACA,QAAAC,EACA,cAAAC,EACA,GAAGC,CACL,EAAIT,EAEEU,EAAkBC,EAAmB,EAErCC,EAAWT,GAAgBO,EAAgB,SAE3CG,EAAWH,EAAgB,SAC7BA,EAAgB,OAAO,OAAS,EAChCA,EAAgB,QAAU,GAExBI,EAAoB,cACvBC,GAA+C,CAC9CR,IAAUQ,CAAK,EACX,CAAAA,EAAM,mBAENL,EAAgB,SAClBA,EAAgB,eAAe,CAAC,CAAC,EAEjCA,EAAgB,cAAc,EAAE,EAIlCA,EAAgB,mBAAmB,EAAE,EACvC,EACA,CAACH,EAASG,CAAe,CAC3B,EAGMM,EAA0B,cAC7BD,GAAiD,CAChDA,EAAM,eAAe,EACrBP,IAAgBO,CAAK,CACvB,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GroupLabel","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","onPointerDown","rest","comboboxContext","useComboboxContext","disabled","hasValue","handleClick","event","handlePointerDown","state","element","useRender","ComboboxClearDataAttributes","React","ComboboxPositionerContext","useComboboxPositionerContext","useRender","React","React","ComboboxInputWrapperContext","useIsInsideInputWrapper","ComboboxInputDataAttributes","React","useComboboxDisplayValue","params","comboboxContext","open","hasValue","isValueEmpty","getValueText","value","serializedValue","stringifyAsValue","registryText","itemsLabel","resolveLabelFromItems","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","nullItemLabel","resolveLabelFromItems","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","ComboboxItemImpl","props","forwardedRef","textValueProp","keywordsProp","disabled","onSelect","forceMount","render","className","style","onClick","onPointerDown","onPointerMove","children","rest","comboboxContext","useComboboxContext","serializedValue","stringifyAsValue","generatedItemId","listboxId","itemFromItems","resolveItemFromItems","labelFromItems","labelFromObjectValue","resolveLabel","textValue","keywords","mergeKeywords","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","ComboboxItemLabel","props","forwardedRef","render","className","style","children","rest","comboboxContext","useComboboxContext","itemContext","useComboboxItemContext","valueKey","stringifyAsValue","resolvedLabel","labelFromItems","resolveLabelFromItems","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","handleHighlightChange","id","_node","index","details","listId","inputRef","inputWrapperRef","inputHeight","setInputHeight","inputWidth","setInputWidth","setInputElement","element","rect","setInputWrapperElement","store","focusOwnerStore","openChainStore","registerSurface","closeAll","virtualization","baseHandleOpenChange","menuDisabled","setDisabled","menuTreeResolver","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","serializedValue","stringifyAsValue","ComboboxContext","PopupMenuProviders","Popover","React","ComboboxSurfaceDataAttributes","jsx","ComboboxSurface","props","forwardedRef","autoHighlightFirstProp","clearSearchOnClose","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,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 _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } } 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 _chunkJFEVUUPCcjs = require('../chunk-JFEVUUPC.cjs');var _chunkW4ACKMIZcjs = require('../chunk-W4ACKMIZ.cjs');var _chunkXMZZ62VJcjs = require('../chunk-XMZZ62VJ.cjs');var _chunkM4G6J7DPcjs = require('../chunk-M4G6J7DP.cjs');var fe={};_chunkM4G6J7DPcjs.a.call(void 0, fe,{Backdrop:()=>ue,CheckboxItem:()=>_chunkW4ACKMIZcjs.ga,CheckboxItemIndicator:()=>_chunkW4ACKMIZcjs.ha,Empty:()=>_chunkW4ACKMIZcjs.U,FocusZone:()=>_chunkW4ACKMIZcjs.na,Footer:()=>_chunkW4ACKMIZcjs.oa,Group:()=>_chunkW4ACKMIZcjs.pa,GroupLabel:()=>_chunkW4ACKMIZcjs.W,Header:()=>_chunkW4ACKMIZcjs.ra,Icon:()=>_chunkW4ACKMIZcjs.T,Input:()=>me,Item:()=>_chunkW4ACKMIZcjs.ia,List:()=>_chunkW4ACKMIZcjs.ba,Loading:()=>_chunkW4ACKMIZcjs.ca,Popup:()=>de,Portal:()=>ie,Root:()=>Pe,Separator:()=>_chunkW4ACKMIZcjs.sa,Shortcut:()=>_chunkW4ACKMIZcjs.ta,Subpage:()=>Me,SubpageBack:()=>_chunkW4ACKMIZcjs.Ba,SubpageBackItem:()=>_chunkW4ACKMIZcjs.Ca,SubpageTrigger:()=>_chunkW4ACKMIZcjs.Da,Surface:()=>_chunkW4ACKMIZcjs.fa,Trigger:()=>Se});var _dialog = require('@base-ui/react/dialog');var _react = require('react'); var y = _interopRequireWildcard(_react); var se = _interopRequireWildcard(_react); var s = _interopRequireWildcard(_react); var L = _interopRequireWildcard(_react); var d = _interopRequireWildcard(_react); var Ce = _interopRequireWildcard(_react);var _jsxruntime = require('react/jsx-runtime');var ue=y.forwardRef(function(o,a){let{onPointerDown:p,...r}=o,t=_chunkW4ACKMIZcjs.e.call(void 0, ),u=y.useCallback(m=>{_optionalChain([p, 'optionalCall', _2 => _2(m)]),!m.defaultPrevented&&t&&!t.disabled&&t.closeAll(_chunkXMZZ62VJcjs.a.outsidePress,m.nativeEvent)},[p,t]);return _jsxruntime.jsx.call(void 0, _dialog.Dialog.Backdrop,{ref:a,...r,onPointerDown:u,"data-command-menu-backdrop":""})});var me=se.forwardRef(function(o,a){let{backspaceGoesBack:p=!0,...r}=o;return _jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.V,{ref:a,backspaceGoesBack:p,...r})});var de=s.forwardRef(function(o,a){let{children:p,className:r,render:t,...u}=o,m=s.useId(),M=_chunkW4ACKMIZcjs.d.call(void 0, ),{subpageStackContextValue:C,isSubpageNavigating:S,hasOpenSubpage:n,subpageId:i}=_chunkW4ACKMIZcjs.r.call(void 0, {surfaceId:m,store:M.store}),[g,h]=s.useState(null),[b,f]=s.useState(null),c=s.useCallback(l=>({...l,hasOpenSubpage:n,subpageId:i}),[n,i]),k=s.useMemo(()=>typeof r=="function"?l=>r(c(l)):r,[r,c]),D=s.useMemo(()=>typeof t=="function"?(l,P)=>t(l,c(P)):t,[t,c]),v=s.useMemo(()=>({dataSurfaceContext:g,setDataSurfaceContext:h,resolvedNodes:b,setResolvedNodes:f}),[g,b]);return _jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.f.Provider,{value:m,children:_jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.k.Provider,{value:C,children:_jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.z.Provider,{value:v,children:_jsxruntime.jsxs.call(void 0, _dialog.Dialog.Popup,{ref:a,className:k,render:D,"data-command-menu-popup":"","data-navigating":S?"":void 0,"data-has-open-subpage":n?"":void 0,...u,children:[p,_jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.I,{})]})})})})});var ie=_dialog.Dialog.Portal;function Ue(e){return e instanceof HTMLInputElement||e instanceof HTMLTextAreaElement||e instanceof HTMLSelectElement||e instanceof HTMLElement&&e.isContentEditable}function Qe(e){let o=e.key.toLowerCase();return o===" "?"space":o}function qe(e,o){let a=_chunkJFEVUUPCcjs.d.call(void 0, ),p=o.meta||a&&o.mod,r=o.ctrl||!a&&o.mod;return e.metaKey===p&&e.ctrlKey===r&&e.altKey===o.alt&&e.shiftKey===o.shift}function We(e,o){return o.key===Qe(e)&&qe(e,o)}function ce(e,o,a){let p=d.useMemo(()=>_chunkJFEVUUPCcjs.a.call(void 0, e),[e]),[r]=p.chords,t=p.chords.length===1&&r!==void 0?r:null,u=p.chords.length>1,m=_optionalChain([a, 'optionalAccess', _3 => _3.enabled])!==!1,M=d.useRef(o),C=d.useRef(a);M.current=o,C.current=a,d.useEffect(()=>{u&&process.env.NODE_ENV!=="production"&&console.warn(`useHotkey only supports single-chord keybindings. Received "${e}", but sequences are not supported by useHotkey.`)},[u,e]),d.useEffect(()=>{if(!m||t===null||u||t.key===null)return;let S=n=>{let i=C.current;n.repeat||!_optionalChain([i, 'optionalAccess', _4 => _4.allowInInput])&&Ue(n.target)||We(n,t)&&(_optionalChain([i, 'optionalAccess', _5 => _5.preventDefault])!==!1&&n.preventDefault(),M.current(n))};return document.addEventListener("keydown",S),()=>{document.removeEventListener("keydown",S)}},[t,m,u])}function Pe(e){let{children:o,open:a,defaultOpen:p=!1,onOpenChange:r,onOpenChangeComplete:t,hotkey:u,modal:m=!0,disabled:M,getResolvedId:C,idScope:S="surface"}=e,{store:n,focusOwnerStore:i,openChainStore:g,registerSurface:h,closeAll:b,handleOpenChange:f,disabled:c,menuTreeResolver:k}=_chunkW4ACKMIZcjs.q.call(void 0, {onOpenChange:r,defaultOpen:p,disabled:M,closeOnOutsidePress:"pointerdown",getResolvedId:C,idScope:S});n.useControlledProp("openProp",a);let D=n.useState("open");ce(_nullishCoalesce(u, () => ("")),()=>f(!n.state.open,_chunkXMZZ62VJcjs.a.imperativeAction),{enabled:!!u&&!c,allowInInput:!0});let v=L.useCallback((P,N)=>{f(P,N.reason,N.event)},[f]),l=L.useCallback(P=>{!P&&n.context.clearSearchOnClose==="after-exit"&&(n.clearSearch(),n.setInputActive(!1)),P||(n.clearHighlight(),_optionalChain([n, 'access', _6 => _6.context, 'access', _7 => _7.onCloseComplete, 'optionalCall', _8 => _8()]),_optionalChain([n, 'access', _9 => _9.context, 'access', _10 => _10.onPopupCloseComplete, 'optionalCall', _11 => _11()])),_optionalChain([t, 'optionalCall', _12 => _12(P)])},[n,t]);return _jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.N,{menuTreeResolver:k,store:n,focusOwnerStore:i,openChainStore:g,disabled:c,depth:0,closeAll:b,explicitTabBehavior:!0,tabWithoutZones:"inert",registerSurface:h,menuType:"dropdown",closeOnOutsidePress:"pointerdown",componentName:"command-menu",children:_jsxruntime.jsx.call(void 0, _dialog.Dialog.Root,{open:D,onOpenChange:v,onOpenChangeComplete:l,modal:m,children:o})})}function Me(e){let{closeRootOnEsc:o=!0,children:a,...p}=e;return _jsxruntime.jsx.call(void 0, _chunkW4ACKMIZcjs.Aa,{closeRootOnEsc:o,...p,children:a})}var Se=Ce.forwardRef(function(o,a){let{disabled:p,...r}=o,t=_chunkW4ACKMIZcjs.e.call(void 0, ),u=p||_optionalChain([t, 'optionalAccess', _13 => _13.disabled])||!1;return _jsxruntime.jsx.call(void 0, _dialog.Dialog.Trigger,{ref:a,...r,disabled:u,"data-command-menu-trigger":""})});exports.CommandMenu = fe; exports.CommandMenuRadioGroupValue = _chunkW4ACKMIZcjs.ka; exports.DataListContext = _chunkW4ACKMIZcjs.C; exports.DataSurfaceContext = _chunkW4ACKMIZcjs.y; exports.defaultGetResolvedId = _chunkW4ACKMIZcjs.p; exports.defineRadioGroup = _chunkW4ACKMIZcjs.X; exports.isDisplayGroupNode = _chunkW4ACKMIZcjs.Y; exports.isDisplayRadioGroupNode = _chunkW4ACKMIZcjs.Z; exports.isDisplayRowNode = _chunkW4ACKMIZcjs.$; exports.isDisplaySeparatorNode = _chunkW4ACKMIZcjs._; exports.isPopupMenuNode = _chunkW4ACKMIZcjs.o; exports.useAsyncMenuCoordinator = _chunkW4ACKMIZcjs.F; exports.useDataList = _chunkW4ACKMIZcjs.D; exports.useDataSurfaceContext = _chunkW4ACKMIZcjs.A; exports.useMaybeAsyncMenuCoordinator = _chunkW4ACKMIZcjs.G; exports.useMaybeDataList = _chunkW4ACKMIZcjs.E; exports.useMaybeDataSurfaceContext = _chunkW4ACKMIZcjs.B; exports.useMaybeSurfaceContext = _chunkXMZZ62VJcjs.q; exports.useSurfaceContext = _chunkXMZZ62VJcjs.p;
2
+ //# sourceMappingURL=index.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/command-menu/index.cjs","../../src/command-menu/index.parts.ts","../../src/command-menu/backdrop/backdrop.tsx","../../src/command-menu/input/input.tsx","../../src/command-menu/popup/popup.tsx","../../src/command-menu/portal/portal.tsx","../../src/command-menu/root/root.tsx","../../src/kbd/hooks/use-hotkey.ts","../../src/command-menu/subpage/subpage.tsx","../../src/command-menu/trigger/trigger.tsx"],"names":["index_parts_exports","__export","CommandMenuBackdrop","PopupMenuCheckboxItem","PopupMenuCheckboxItemIndicator","PopupMenuEmpty","PopupMenuFocusZone","PopupMenuFooter","PopupMenuGroup","PopupMenuGroupLabel","PopupMenuHeader","PopupMenuIcon","CommandMenuInput","PopupMenuItem","PopupMenuList","PopupMenuLoading","CommandMenuPopup","CommandMenuPortal","CommandMenuRoot","PopupMenuSeparator","PopupMenuShortcut","CommandMenuSubpage","PopupMenuSubpageBack","PopupMenuSubpageBackItem","PopupMenuSubpageTrigger","PopupMenuSurface","CommandMenuTrigger","props","forwardedRef","onPointerDown","rest","popupMenuContext","useMaybePopupMenuContext","handlePointerDown","event","reason_parts_exports","jsx","Dialog","backspaceGoesBack","PopupMenuInput","children","classNameProp","renderProp","surfaceId","usePopupMenuContext","subpageStackContextValue","isSubpageNavigating","hasOpenSubpage","subpageId","useSubpageStackState","dataSurfaceContext","setDataSurfaceContext","resolvedNodes","setResolvedNodes","toPopupState","baseState","className","render","popupProps","dataPopupContextValue","PopupSurfaceIdContext","SubpageStackContext","DataPopupContext","jsxs","DataSubpagesContent","isEditableTarget","target","getEventKey","key","matchesModifiers","chord","isApple","isApplePlatform","meta","ctrl","matchesChord","useHotkey","keys","handler","options","keybinding","parseKeybinding","firstChord","isSequence","enabled","handlerRef","optionsRef","handleKeyDown","currentOptions","openProp","defaultOpen","onOpenChange","onOpenChangeComplete","hotkey","modal","disabled","getResolvedId","idScope","store","focusOwnerStore","openChainStore","registerSurface","closeAll","handleOpenChange","menuDisabled","menuTreeResolver","usePopupMenuRoot","openState","handleDialogOpenChange","nextOpen","dialogDetails","handleDialogOpenChangeComplete","PopupMenuProviders","closeRootOnEsc","PopupMenuSubpage","isDisabled"],"mappings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,CACd,oBAAA,CAAsBG,CAAAA,CACtB,KAAA,CAAOjB,CAAAA,CAEN,QAAA,CAAAtD,CAAAA,CACH,CAAA,CACF,CAEJ,CE9HI,SAJYnB,EAAAA,CAAmBM,CAAAA,CAAiC,CAClE,GAAM,CAAE,cAAA,CAAAsF,CAAAA,CAAiB,CAAA,CAAA,CAAM,QAAA,CAAAzE,CAAAA,CAAU,GAAGV,CAAK,CAAA,CAAIH,CAAAA,CAErD,OACES,6BAAAA,oBAAC8E,CAAA,CAAiB,cAAA,CAAgBD,CAAAA,CAAiB,GAAGnF,CAAAA,CACnD,QAAA,CAAAU,CAAAA,CACH,CAEJ,CClBA,IAUad,EAAAA,CAA2B,EAAA,CAAA,UAAA,CAGtC,QAAA,CAA4BC,CAAAA,CAAOC,CAAAA,CAAc,CACjD,GAAM,CAAE,QAAA,CAAAmE,CAAAA,CAAU,GAAGjE,CAAK,CAAA,CAAIH,CAAAA,CACxBI,CAAAA,CAAmBC,iCAAAA,CAAyB,CAC5CmF,CAAAA,CAAapB,CAAAA,kBAAYhE,CAAAA,+BAAkB,UAAA,EAAY,CAAA,CAAA,CAE7D,OACEK,6BAAAA,cAACC,CAAO,OAAA,CAAP,CACC,GAAA,CAAKT,CAAAA,CACJ,GAAGE,CAAAA,CACJ,QAAA,CAAUqF,CAAAA,CACV,2BAAA,CAA0B,EAAA,CAC5B,CAEJ,CAAC,CAAA,CAAA,27BAAA","file":"/Users/kianbazza/repos/bazzalabs/ui/packages/react/dist/command-menu/index.cjs","sourcesContent":[null,"// ============================================================================\n// Command Menu Parts\n// ============================================================================\n\n// Pure aliases of the canonical resolved-node model (ADR-0001): narrow the\n// alias if a family ever needs to diverge — never edit the canonical type.\nexport type {\n NodeDef,\n PopupMenuNode as Node,\n} from '../internal/popup-menu/index.js'\n\nexport {\n PopupMenuCheckboxItem as CheckboxItem,\n PopupMenuCheckboxItemIndicator as CheckboxItemIndicator,\n PopupMenuEmpty as Empty,\n PopupMenuFocusZone as FocusZone,\n PopupMenuFooter as Footer,\n PopupMenuGroup as Group,\n PopupMenuGroupLabel as GroupLabel,\n PopupMenuHeader as Header,\n PopupMenuIcon as Icon,\n PopupMenuItem as Item,\n PopupMenuList as List,\n PopupMenuLoading as Loading,\n PopupMenuSeparator as Separator,\n PopupMenuShortcut as Shortcut,\n PopupMenuSubpageBack as SubpageBack,\n PopupMenuSubpageBackItem as SubpageBackItem,\n PopupMenuSubpageTrigger as SubpageTrigger,\n PopupMenuSurface as Surface,\n} from '../internal/popup-menu/index.js'\nexport { CommandMenuBackdrop as Backdrop } from './backdrop/backdrop.js'\nexport { CommandMenuInput as Input } from './input/input.js'\nexport { CommandMenuPopup as Popup } from './popup/popup.js'\nexport { CommandMenuPortal as Portal } from './portal/portal.js'\nexport { CommandMenuRoot as Root } from './root/root.js'\nexport { CommandMenuSubpage as Subpage } from './subpage/subpage.js'\nexport { CommandMenuTrigger as Trigger } from './trigger/trigger.js'\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { useMaybePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\nimport { REASONS } from '../../utils/events/index.js'\n\nexport interface CommandMenuBackdropProps extends Dialog.Backdrop.Props {}\nexport type CommandMenuBackdropState = Dialog.Backdrop.State\n\n/**\n * An overlay displayed beneath the command menu popup.\n *\n * Pressing down on the backdrop closes the menu immediately (pointerdown),\n * matching the outside-press behavior of the other menus, instead of waiting\n * for the Dialog's click-time dismissal. Consumers can opt out by calling\n * `event.preventDefault()` in their own `onPointerDown`.\n */\nexport const CommandMenuBackdrop = React.forwardRef<\n HTMLDivElement,\n CommandMenuBackdrop.Props\n>(function CommandMenuBackdrop(props, forwardedRef) {\n const { onPointerDown, ...rest } = props\n const popupMenuContext = useMaybePopupMenuContext()\n\n const handlePointerDown = React.useCallback<\n NonNullable<Dialog.Backdrop.Props['onPointerDown']>\n >(\n (event) => {\n onPointerDown?.(event)\n\n if (event.defaultPrevented) {\n return\n }\n\n if (popupMenuContext && !popupMenuContext.disabled) {\n popupMenuContext.closeAll(REASONS.outsidePress, event.nativeEvent)\n }\n },\n [onPointerDown, popupMenuContext],\n )\n\n return (\n <Dialog.Backdrop\n ref={forwardedRef}\n {...rest}\n onPointerDown={handlePointerDown}\n data-command-menu-backdrop=\"\"\n />\n )\n})\n\nexport namespace CommandMenuBackdrop {\n export interface Props extends CommandMenuBackdropProps {}\n export type State = CommandMenuBackdropState\n}\n","'use client'\n\nimport * as React from 'react'\nimport {\n PopupMenuInput,\n type PopupMenuInputProps,\n type PopupMenuInputState,\n} from '../../internal/popup-menu/index.js'\n\nexport interface CommandMenuInputProps extends PopupMenuInputProps {}\nexport type CommandMenuInputState = PopupMenuInputState\n\n/**\n * Search input for filtering command menu items.\n */\nexport const CommandMenuInput = React.forwardRef<\n HTMLInputElement,\n CommandMenuInput.Props\n>(function CommandMenuInput(props, forwardedRef) {\n const { backspaceGoesBack = true, ...rest } = props\n\n return (\n <PopupMenuInput\n ref={forwardedRef}\n backspaceGoesBack={backspaceGoesBack}\n {...rest}\n />\n )\n})\n\nexport namespace CommandMenuInput {\n export interface Props extends CommandMenuInputProps {}\n export type State = CommandMenuInputState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { PopupSurfaceIdContext } from '../../internal/popup-menu/contexts/popup-surface-id-context.js'\nimport { SubpageStackContext } from '../../internal/popup-menu/contexts/subpage-stack-context.js'\nimport {\n DataPopupContext,\n type DataSurfaceContextValue,\n type ResolvedNodesSlot,\n} from '../../internal/popup-menu/data-first/context.js'\nimport { DataSubpagesContent } from '../../internal/popup-menu/data-first/data-subpages.js'\nimport { useSubpageStackState } from '../../internal/popup-menu/hooks/use-subpage-stack-state.js'\nimport { usePopupMenuContext } from '../../internal/popup-menu/index.js'\nimport type { ComponentRenderFn } from '../../utils/types.js'\n\nexport interface CommandMenuPopupState extends Dialog.Popup.State {\n /**\n * Whether any non-root subpage is currently open.\n */\n hasOpenSubpage: boolean\n\n /**\n * Active subpage ID, or null when the root surface is active.\n */\n subpageId: string | null\n}\n\nexport interface CommandMenuPopupProps\n extends Omit<Dialog.Popup.Props, 'className' | 'render'> {\n /**\n * CSS class applied to the element, or a function that\n * returns a class based on the component's state.\n */\n className?: string | ((state: CommandMenuPopupState) => string)\n\n /**\n * Allows replacing the popup element with a custom element.\n * The render state includes dialog popup + subpage navigation state.\n */\n render?:\n | React.ReactElement\n | ComponentRenderFn<\n React.HTMLAttributes<HTMLElement>,\n CommandMenuPopupState\n >\n}\n\n/**\n * A container for the command menu contents.\n * Wraps Dialog.Popup with popup-menu subpage and data providers.\n */\nexport const CommandMenuPopup = React.forwardRef<\n HTMLDivElement,\n CommandMenuPopup.Props\n>(function CommandMenuPopup(props, forwardedRef) {\n const {\n children,\n className: classNameProp,\n render: renderProp,\n ...rest\n } = props\n\n const surfaceId = React.useId()\n const popupMenuContext = usePopupMenuContext()\n\n const {\n subpageStackContextValue,\n isSubpageNavigating,\n hasOpenSubpage,\n subpageId,\n } = useSubpageStackState({\n surfaceId,\n store: popupMenuContext.store,\n })\n\n const [dataSurfaceContext, setDataSurfaceContext] =\n React.useState<DataSurfaceContextValue | null>(null)\n const [resolvedNodes, setResolvedNodes] =\n React.useState<ResolvedNodesSlot | null>(null)\n\n const toPopupState = React.useCallback(\n (baseState: Dialog.Popup.State): CommandMenuPopupState => ({\n ...baseState,\n hasOpenSubpage,\n subpageId,\n }),\n [hasOpenSubpage, subpageId],\n )\n\n const className = React.useMemo(() => {\n if (typeof classNameProp === 'function') {\n return (baseState: Dialog.Popup.State) => {\n return classNameProp(toPopupState(baseState))\n }\n }\n return classNameProp\n }, [classNameProp, toPopupState])\n\n const render = React.useMemo(() => {\n if (typeof renderProp === 'function') {\n return (\n popupProps: React.HTMLAttributes<HTMLElement>,\n baseState: Dialog.Popup.State,\n ) => renderProp(popupProps, toPopupState(baseState))\n }\n\n return renderProp\n }, [renderProp, toPopupState])\n\n const dataPopupContextValue = React.useMemo(\n () => ({\n dataSurfaceContext,\n setDataSurfaceContext,\n resolvedNodes,\n setResolvedNodes,\n }),\n [dataSurfaceContext, resolvedNodes],\n )\n\n return (\n <PopupSurfaceIdContext.Provider value={surfaceId}>\n <SubpageStackContext.Provider value={subpageStackContextValue}>\n <DataPopupContext.Provider value={dataPopupContextValue}>\n <Dialog.Popup\n ref={forwardedRef}\n className={className}\n render={render}\n data-command-menu-popup=\"\"\n data-navigating={isSubpageNavigating ? '' : undefined}\n data-has-open-subpage={hasOpenSubpage ? '' : undefined}\n {...rest}\n >\n {children}\n <DataSubpagesContent />\n </Dialog.Popup>\n </DataPopupContext.Provider>\n </SubpageStackContext.Provider>\n </PopupSurfaceIdContext.Provider>\n )\n})\n\nexport namespace CommandMenuPopup {\n export type Props = CommandMenuPopupProps\n export type State = CommandMenuPopupState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\n\nexport interface CommandMenuPortalProps extends Dialog.Portal.Props {}\nexport type CommandMenuPortalState = Dialog.Portal.State\n\n/**\n * A portal element that moves the command menu popup to a different part of the DOM.\n */\nexport const CommandMenuPortal = Dialog.Portal\n\nexport namespace CommandMenuPortal {\n export type Props = CommandMenuPortalProps\n export type State = CommandMenuPortalState\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport type { PopupMenuOpenChangeReason } from '../../internal/popup-menu/events.js'\nimport {\n type GetResolvedIdFn,\n type PopupMenuIdScope,\n PopupMenuProviders,\n type UsePopupMenuRootParams,\n usePopupMenuRoot,\n} from '../../internal/popup-menu/index.js'\nimport { useHotkey } from '../../kbd/hooks/use-hotkey.js'\nimport { REASONS } from '../../utils/events/index.js'\n\nexport interface CommandMenuRootProps {\n children: React.ReactNode\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n onOpenChangeComplete?: (open: boolean) => void\n hotkey?: string\n modal?: boolean\n disabled?: boolean\n /**\n * Computes canonical Resolved IDs for data-first content from the Unresolved Menu Node (definitional facts only).\n * @default encoded surface Definition Path joined with `/`; `idScope=\"menu\"` uses the Definition Key\n * Read once when the menu root mounts — later changes have no effect. To retain the old dot-path default, use `node => node.def.id ?? node.definitionPath.join('.')`. This does not recreate former tree-item ancestry; exact compatibility requires walking `node.parent` and reproducing the old slug/key lineage.\n * @example\n * <CommandMenu.Root getResolvedId={(node) => node.def.id ?? node.definitionPath.join('.')} />\n */\n getResolvedId?: GetResolvedIdFn\n /** Definition Key uniqueness scope. Read once when the menu root mounts. @default 'surface' */\n idScope?: PopupMenuIdScope\n}\n\n/**\n * Groups all parts of the command menu.\n * Manages open state and provides popup-menu context to children.\n * Doesn't render its own HTML element.\n */\nexport function CommandMenuRoot(props: CommandMenuRoot.Props) {\n const {\n children,\n open: openProp,\n defaultOpen = false,\n onOpenChange,\n onOpenChangeComplete,\n hotkey,\n modal = true,\n disabled,\n getResolvedId,\n idScope = 'surface',\n } = props\n\n const {\n store,\n focusOwnerStore,\n openChainStore,\n registerSurface,\n closeAll,\n handleOpenChange,\n disabled: menuDisabled,\n menuTreeResolver,\n } = usePopupMenuRoot({\n onOpenChange:\n onOpenChange as unknown as UsePopupMenuRootParams['onOpenChange'],\n defaultOpen,\n disabled,\n closeOnOutsidePress: 'pointerdown',\n getResolvedId,\n idScope,\n })\n\n store.useControlledProp('openProp', openProp)\n\n const openState = store.useState('open')\n\n useHotkey(\n hotkey ?? '',\n () => handleOpenChange(!store.state.open, REASONS.imperativeAction),\n // allowInInput keeps the hotkey working as a *toggle*: while the menu is\n // open, focus sits in the search input, so the close press must be allowed\n // to fire from an editable target.\n { enabled: !!hotkey && !menuDisabled, allowInInput: true },\n )\n\n const handleDialogOpenChange = React.useCallback(\n (nextOpen: boolean, dialogDetails: Dialog.Root.ChangeEventDetails) => {\n handleOpenChange(\n nextOpen,\n dialogDetails.reason as PopupMenuOpenChangeReason,\n dialogDetails.event,\n )\n },\n [handleOpenChange],\n )\n\n const handleDialogOpenChangeComplete = React.useCallback(\n (nextOpen: boolean) => {\n if (!nextOpen && store.context.clearSearchOnClose === 'after-exit') {\n store.clearSearch()\n store.setInputActive(false)\n }\n\n if (!nextOpen) {\n store.clearHighlight()\n store.context.onCloseComplete?.()\n store.context.onPopupCloseComplete?.()\n }\n\n onOpenChangeComplete?.(nextOpen)\n },\n [store, onOpenChangeComplete],\n )\n\n return (\n <PopupMenuProviders\n menuTreeResolver={menuTreeResolver}\n store={store}\n focusOwnerStore={focusOwnerStore}\n openChainStore={openChainStore}\n disabled={menuDisabled}\n depth={0}\n closeAll={closeAll}\n explicitTabBehavior\n tabWithoutZones=\"inert\"\n registerSurface={registerSurface}\n menuType=\"dropdown\"\n closeOnOutsidePress=\"pointerdown\"\n componentName=\"command-menu\"\n >\n <Dialog.Root\n open={openState}\n onOpenChange={handleDialogOpenChange}\n onOpenChangeComplete={handleDialogOpenChangeComplete}\n modal={modal}\n >\n {children}\n </Dialog.Root>\n </PopupMenuProviders>\n )\n}\n\nexport namespace CommandMenuRoot {\n export interface Props extends CommandMenuRootProps {}\n}\n","'use client'\n\nimport * as React from 'react'\nimport type { KeyChord } from '../utils/parse-keybinding.js'\nimport { parseKeybinding } from '../utils/parse-keybinding.js'\nimport { isApplePlatform } from '../utils/platform.js'\n\n/**\n * Options for the useHotkey global keydown listener.\n *\n * @internal Not part of the public API — used by CommandMenu's `hotkey` prop.\n */\nexport interface UseHotkeyOptions {\n /** @default true */\n enabled?: boolean\n /** @default true */\n preventDefault?: boolean\n /** Fire even when focus is in an input/textarea/select/contenteditable. @default false */\n allowInInput?: boolean\n}\n\nfunction isEditableTarget(target: EventTarget | null): boolean {\n return (\n target instanceof HTMLInputElement ||\n target instanceof HTMLTextAreaElement ||\n target instanceof HTMLSelectElement ||\n (target instanceof HTMLElement && target.isContentEditable)\n )\n}\n\nfunction getEventKey(event: KeyboardEvent): string {\n const key = event.key.toLowerCase()\n\n return key === ' ' ? 'space' : key\n}\n\nfunction matchesModifiers(event: KeyboardEvent, chord: KeyChord): boolean {\n const isApple = isApplePlatform()\n const meta = chord.meta || (isApple && chord.mod)\n const ctrl = chord.ctrl || (!isApple && chord.mod)\n\n return (\n event.metaKey === meta &&\n event.ctrlKey === ctrl &&\n event.altKey === chord.alt &&\n event.shiftKey === chord.shift\n )\n}\n\nfunction matchesChord(event: KeyboardEvent, chord: KeyChord): boolean {\n return chord.key === getEventKey(event) && matchesModifiers(event, chord)\n}\n\n/**\n * Calls a handler when a single-chord keybinding is pressed anywhere in the\n * document.\n *\n * @internal Not part of the public API. Deliberately unexported from\n * `kbd/index.ts` — consumers get global-shortcut behavior through\n * `CommandMenu.Root`'s `hotkey` prop instead. Import via the file path if\n * another primitive needs it.\n */\nexport function useHotkey(\n keys: string,\n handler: (event: KeyboardEvent) => void,\n options?: UseHotkeyOptions,\n): void {\n const keybinding = React.useMemo(() => parseKeybinding(keys), [keys])\n const [firstChord] = keybinding.chords\n const chord =\n keybinding.chords.length === 1 && firstChord !== undefined\n ? firstChord\n : null\n const isSequence = keybinding.chords.length > 1\n const enabled = options?.enabled !== false\n\n const handlerRef = React.useRef(handler)\n const optionsRef = React.useRef(options)\n\n handlerRef.current = handler\n optionsRef.current = options\n\n React.useEffect(() => {\n if (isSequence && process.env.NODE_ENV !== 'production') {\n console.warn(\n `useHotkey only supports single-chord keybindings. Received \"${keys}\", but sequences are not supported by useHotkey.`,\n )\n }\n }, [isSequence, keys])\n\n React.useEffect(() => {\n if (!enabled || chord === null || isSequence || chord.key === null) {\n return\n }\n\n const handleKeyDown = (event: KeyboardEvent) => {\n const currentOptions = optionsRef.current\n\n if (event.repeat) {\n return\n }\n\n if (!currentOptions?.allowInInput && isEditableTarget(event.target)) {\n return\n }\n\n if (!matchesChord(event, chord)) {\n return\n }\n\n if (currentOptions?.preventDefault !== false) {\n event.preventDefault()\n }\n\n handlerRef.current(event)\n }\n\n document.addEventListener('keydown', handleKeyDown)\n\n return () => {\n document.removeEventListener('keydown', handleKeyDown)\n }\n }, [chord, enabled, isSequence])\n}\n","'use client'\n\nimport {\n PopupMenuSubpage,\n type PopupMenuSubpageProps,\n} from '../../internal/popup-menu/index.js'\n\nexport interface CommandMenuSubpageProps extends PopupMenuSubpageProps {}\n\n/**\n * Groups all parts of a command menu subpage.\n */\nexport function CommandMenuSubpage(props: CommandMenuSubpage.Props) {\n const { closeRootOnEsc = true, children, ...rest } = props\n\n return (\n <PopupMenuSubpage closeRootOnEsc={closeRootOnEsc} {...rest}>\n {children}\n </PopupMenuSubpage>\n )\n}\n\nexport namespace CommandMenuSubpage {\n export interface Props extends CommandMenuSubpageProps {}\n}\n","'use client'\n\nimport { Dialog } from '@base-ui/react/dialog'\nimport * as React from 'react'\nimport { useMaybePopupMenuContext } from '../../internal/popup-menu/contexts/popup-menu-context.js'\n\nexport interface CommandMenuTriggerProps extends Dialog.Trigger.Props {}\nexport type CommandMenuTriggerState = Dialog.Trigger.State\n\n/**\n * A button that opens the command menu.\n */\nexport const CommandMenuTrigger = React.forwardRef<\n HTMLButtonElement,\n CommandMenuTrigger.Props\n>(function CommandMenuTrigger(props, forwardedRef) {\n const { disabled, ...rest } = props\n const popupMenuContext = useMaybePopupMenuContext()\n const isDisabled = disabled || popupMenuContext?.disabled || false\n\n return (\n <Dialog.Trigger\n ref={forwardedRef}\n {...rest}\n disabled={isDisabled}\n data-command-menu-trigger=\"\"\n />\n )\n})\n\nexport namespace CommandMenuTrigger {\n export interface Props extends CommandMenuTriggerProps {}\n export type State = CommandMenuTriggerState\n}\n"]}