@magicx-eng/ai-autocomplete-react 0.10.0 → 0.10.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -1473,7 +1473,7 @@ import{buildSubmitResult as Go,withSkippedParams as Ko}from"@magicx-eng/ai-autoc
1473
1473
  }
1474
1474
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
1475
1475
  }
1476
- `,document.head.appendChild(e)}import{jsx as Ut}from"react/jsx-runtime";function it({space:e,align:s="stretch",className:a,children:n,...d}){let l=e?{"--aia-stack-space":e}:void 0;return Ut("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":s,style:l,...d,children:n})}import{jsx as J,jsxs as rt}from"react/jsx-runtime";var jt=[159,119,164],Qt=()=>{};function Jt(e){let s=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=$t(s);if(Vt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let d=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>n(d.matches);return d.addEventListener("change",l),()=>d.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Fe({suggestions:e,activeIndex:s,onSelect:a,onHighlight:n,isOpen:d,id:l,className:o,pills:m,onPillClick:f,showPills:v=!0,onSkip:_,showSkipButton:x=!0,skipDisabled:R=!1,activeSelected:C=!1,isLoading:A=!1,isInputEmpty:U=!1,products:T,onProductSelect:X,onProductFocusChange:E,optionsPosition:y="below",mode:H}){let c=Jt(H),Z=c!==void 0,V=e[0]?.options??[],q=!!(m&&m.length>0&&f),I=!!(T&&T.length>0),L=d&&(V.length>0||v&&q||A||I),z={suggestions:e,activeIndex:s,pills:m,showPills:v,showSkipButton:x,skipDisabled:R,activeSelected:C,isLoading:A,isInputEmpty:U,products:T},G=qt(z);L&&(G.current=z);let h=L?z:G.current,P=h.suggestions[0],B=P?.options??[],$=h.activeIndex>=0&&!!B[h.activeIndex]?.is_tappable,F=!!(h.pills&&h.pills.length>0&&f),K=h.showPills&&F,W=h.showPills&&!F&&h.isLoading,j=K||W,r=F&&h.showSkipButton&&!!_,t=h.pills?.[0]?.text,u=B.length>0,b=h.isLoading&&!u,g=h.products??[];return J("div",{id:l,role:"listbox","data-aia-dropdown":"","data-options-position":y,"data-mode":c,"data-aia-loading":h.isLoading?"":void 0,"data-aia-has-products":g.length>0?"":void 0,className:`${Z?"magicx-aia ":""}${ae.dropdown} ${L?ae.visible:""} ${o??""}`,onMouseDown:i=>i.preventDefault(),children:rt(it,{space:"8px",children:[(j||r)&&rt(he,{noWrap:!0,className:ae.pillBar,"data-aia-pillbar":"",children:[j&&J("span",{className:ae.pillScroll,"data-aia-pill-scroll":"",children:J(Ie,{pills:h.pills??[],activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:f??(()=>{}),rounded:!0,loading:h.isLoading})}),r&&J("button",{type:"button",tabIndex:-1,className:ae.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":t?`Skip ${t}`:"Skip",onClick:_,children:"skip"})]}),u&&J(ot,{options:B,activeIndex:h.activeIndex,onSelect:a,onHighlight:n,listboxId:l,loading:h.isLoading,groupKey:P?`${P.type} ${P.text}`:""}),b&&J("div",{className:ae.skeletonBars,"data-aia-skeleton-bars":"",children:jt.map(i=>J("span",{className:ae.skeletonBar,style:{width:i}},`bar-${i}`))}),J(Ze,{products:g,listboxId:l,onSelect:X??Qt,onFocusChange:E,focusable:L}),J(Qe,{isOptionHighlighted:$,isInputEmpty:h.isInputEmpty})]})})}import{buildSubmitResult as na,ModeController as sa,setCursorOffset as la}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.SubmitButton-module_submitButton_otz7H {
1476
+ `,document.head.appendChild(e)}import{jsx as Ut}from"react/jsx-runtime";function it({space:e,align:s="stretch",className:a,children:n,...d}){let l=e?{"--aia-stack-space":e}:void 0;return Ut("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":s,style:l,...d,children:n})}import{jsx as J,jsxs as rt}from"react/jsx-runtime";var jt=[159,119,164],Qt=()=>{};function Jt(e){let s=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=$t(s);if(Vt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let d=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>n(d.matches);return d.addEventListener("change",l),()=>d.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Fe({suggestions:e,activeIndex:s,onSelect:a,onHighlight:n,isOpen:d,id:l,className:o,pills:m,onPillClick:f,showPills:v=!0,onSkip:_,showSkipButton:x=!0,skipDisabled:R=!1,activeSelected:C=!1,isLoading:A=!1,isInputEmpty:U=!1,products:T,onProductSelect:X,onProductFocusChange:E,optionsPosition:y="below",mode:H}){let c=Jt(H),Z=c!==void 0,V=e[0]?.options??[],q=!!(m&&m.length>0&&f),I=!!(T&&T.length>0),L=d&&(V.length>0||v&&q||A||I),z={suggestions:e,activeIndex:s,pills:m,showPills:v,showSkipButton:x,skipDisabled:R,activeSelected:C,isLoading:A,isInputEmpty:U,products:T},G=qt(z);L&&(G.current=z);let h=L?z:G.current,P=h.suggestions[0],B=P?.options??[],$=h.activeIndex>=0&&!!B[h.activeIndex]?.is_tappable,F=!!(h.pills&&h.pills.length>0&&f),K=h.showPills&&F,W=h.showPills&&!F&&h.isLoading,j=K||W,r=F&&h.showSkipButton&&!h.isInputEmpty&&!!_,t=h.pills?.[0]?.text,u=B.length>0,b=h.isLoading&&!u,g=h.products??[];return J("div",{id:l,role:"listbox","data-aia-dropdown":"","data-options-position":y,"data-mode":c,"data-aia-loading":h.isLoading?"":void 0,"data-aia-has-products":g.length>0?"":void 0,className:`${Z?"magicx-aia ":""}${ae.dropdown} ${L?ae.visible:""} ${o??""}`,onMouseDown:i=>i.preventDefault(),children:rt(it,{space:"8px",children:[(j||r)&&rt(he,{noWrap:!0,className:ae.pillBar,"data-aia-pillbar":"",children:[j&&J("span",{className:ae.pillScroll,"data-aia-pill-scroll":"",children:J(Ie,{pills:h.pills??[],activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:f??(()=>{}),rounded:!0,loading:h.isLoading})}),r&&J("button",{type:"button",tabIndex:-1,className:ae.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":t?`Skip ${t}`:"Skip",onClick:_,children:"skip"})]}),u&&J(ot,{options:B,activeIndex:h.activeIndex,onSelect:a,onHighlight:n,listboxId:l,loading:h.isLoading,groupKey:P?`${P.type} ${P.text}`:""}),b&&J("div",{className:ae.skeletonBars,"data-aia-skeleton-bars":"",children:jt.map(i=>J("span",{className:ae.skeletonBar,style:{width:i}},`bar-${i}`))}),J(Ze,{products:g,listboxId:l,onSelect:X??Qt,onFocusChange:E,focusable:L}),J(Qe,{isOptionHighlighted:$,isInputEmpty:h.isInputEmpty})]})})}import{buildSubmitResult as na,ModeController as sa,setCursorOffset as la}from"@magicx-eng/ai-autocomplete-vanilla";if(typeof document<"u"&&!document.getElementById("ac-style-fdee06e6")){let e=document.createElement("style");e.id="ac-style-fdee06e6",e.textContent=`.SubmitButton-module_submitButton_otz7H {
1477
1477
  flex-shrink: 0;
1478
1478
  width: 32px;
1479
1479
  height: 32px;