@magicx-eng/ai-autocomplete-react 0.17.2 → 0.17.3

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
@@ -1558,7 +1558,7 @@ import{buildSubmitResult as Li,cellDay as Oi,cellIso as Mi,DATE_RANGE_META_END a
1558
1558
  }
1559
1559
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
1560
1560
  }
1561
- `,document.head.appendChild(e)}import{jsx as xa}from"react/jsx-runtime";function vt({space:e,align:r="stretch",className:a,children:i,...s}){let o=e?{"--aia-stack-space":e}:void 0;return xa("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":r,style:o,...s,children:i})}import{jsx as B,jsxs as qe}from"react/jsx-runtime";var Ia=[159,119,164],Aa=()=>{},wt=()=>{};function Sa(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=Pa(r);if(Ue(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>i(s.matches);return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Da(e,r){let a=Le(null);Ue(()=>{let i=e.current,s=r.current;if(!i||!s)return;let o=i.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==o&&(a.current.controller.destroy(),a.current=null),o&&!a.current){a.current={grid:o,controller:ya({dropdown:i,grid:o,button:s})};return}a.current?.controller.update()}),Ue(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function je({suggestions:e,activeIndex:r,onSelect:a,onHighlight:i,isOpen:s,id:o,className:n,pills:f,onPillClick:g,showPills:v=!0,onSkip:_,showSkipButton:p=!0,skipDisabled:w=!1,activeSelected:y=!1,isLoading:b=!1,isInputEmpty:D=!1,products:C,onProductSelect:Q,onProductFocusChange:Y,formatType:L="options",dateView:k=null,selectedDateIso:X=null,selectedDateRange:Z=null,dateRangeStart:u=null,onPreviousMonth:se,onNextMonth:J,optionsPosition:E="below",mode:W}){let ee=Sa(W),te=ee!==void 0,q=Le(null),U=Le(null);Da(q,U);let R=e[0]?.options??[],ae=!!(f&&f.length>0&&g),le=!!(C&&C.length>0),T=s&&(R.length>0||v&&ae||b||le),O={suggestions:e,activeIndex:r,pills:f,showPills:v,showSkipButton:p,skipDisabled:w,activeSelected:y,isLoading:b,isInputEmpty:D,products:C,formatType:L,dateView:k,selectedDateIso:X,selectedDateRange:Z,dateRangeStart:u},oe=Le(O);T&&(oe.current=O);let t=T?O:oe.current,c=t.suggestions[0],h=c?.options??[],l=t.activeIndex>=0&&!!h[t.activeIndex]?.is_tappable,x=!!(t.pills&&t.pills.length>0&&g),A=t.showPills&&x,M=t.showPills&&!x&&t.isLoading,d=A||M,ie=x&&t.showSkipButton&&!t.isInputEmpty&&!!_,fe=t.pills?.[0]?.text,de=_a(t.formatType)&&t.dateView!=null,ce=h.length>0&&!de,j=h.length>0&&de,ge=t.isLoading&&!ce&&!j,F=t.products??[];return qe("div",{ref:q,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":E,"data-mode":ee,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":F.length>0?"":void 0,className:`${te?"magicx-aia ":""}${ne.dropdown} ${T?ne.visible:""} ${n??""}`,onMouseDown:N=>N.preventDefault(),children:[qe(vt,{space:"8px",children:[(d||ie)&&qe(_e,{noWrap:!0,className:ne.pillBar,"data-aia-pillbar":"",children:[d&&B("span",{className:ne.pillScroll,"data-aia-pill-scroll":"",children:B(Re,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:g??(()=>{}),rounded:!0,loading:t.isLoading})}),ie&&B("button",{type:"button",tabIndex:-1,className:ne.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":fe?`Skip ${fe}`:"Skip",onClick:_,children:"skip"})]}),ce&&B(bt,{options:h,activeIndex:t.activeIndex,onSelect:a,onHighlight:i,listboxId:o,loading:t.isLoading,groupKey:c?`${c.type} ${c.text}`:"",optionsPosition:E}),j&&t.dateView&&B(nt,{options:h,activeIndex:t.activeIndex,listboxId:o,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:i,onPreviousMonth:se??wt,onNextMonth:J??wt}),ge&&B("div",{className:ne.skeletonBars,"data-aia-skeleton-bars":"",children:Ia.map(N=>B("span",{className:ne.skeletonBar,style:{width:N}},`bar-${N}`))}),B(ct,{products:F,listboxId:o,onSelect:Q??Aa,onFocusChange:Y,focusable:T}),B(st,{isOptionHighlighted:l,isInputEmpty:t.isInputEmpty})]}),B("button",{ref:U,type:"button",tabIndex:-1,className:ne.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ka,"aria-hidden":"true",children:B("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:B("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Fa,ModeController as Ha,setCursorOffset as Ka}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 {
1561
+ `,document.head.appendChild(e)}import{jsx as xa}from"react/jsx-runtime";function vt({space:e,align:r="stretch",className:a,children:i,...s}){let o=e?{"--aia-stack-space":e}:void 0;return xa("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":r,style:o,...s,children:i})}import{jsx as B,jsxs as qe}from"react/jsx-runtime";var Ia=[159,119,164],Aa=()=>{},wt=()=>{};function Sa(e){let r=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,i]=Pa(r);if(Ue(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>i(s.matches);return s.addEventListener("change",o),()=>s.removeEventListener("change",o)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function Da(e,r){let a=Le(null);Ue(()=>{let i=e.current,s=r.current;if(!i||!s)return;let o=i.querySelector(".aia-grid[data-scroll]");if(a.current&&a.current.grid!==o&&(a.current.controller.destroy(),a.current=null),o&&!a.current){a.current={grid:o,controller:ya({dropdown:i,grid:o,button:s})};return}a.current?.controller.update()}),Ue(()=>()=>{a.current?.controller.destroy(),a.current=null},[])}function je({suggestions:e,activeIndex:r,onSelect:a,onHighlight:i,isOpen:s,id:o,className:n,pills:f,onPillClick:g,showPills:v=!0,onSkip:_,showSkipButton:p=!0,skipDisabled:w=!1,activeSelected:y=!1,isLoading:b=!1,isInputEmpty:D=!1,products:C,onProductSelect:Q,onProductFocusChange:Y,formatType:L="options",dateView:k=null,selectedDateIso:X=null,selectedDateRange:Z=null,dateRangeStart:u=null,onPreviousMonth:se,onNextMonth:J,optionsPosition:E="below",mode:W}){let ee=Sa(W),te=ee!==void 0,q=Le(null),U=Le(null);Da(q,U);let R=e[0]?.options??[],ae=!!(f&&f.length>0&&g),le=!!(C&&C.length>0),T=s&&(R.length>0||v&&ae||b||le),O={suggestions:e,activeIndex:r,pills:f,showPills:v,showSkipButton:p,skipDisabled:w,activeSelected:y,isLoading:b,isInputEmpty:D,products:C,formatType:L,dateView:k,selectedDateIso:X,selectedDateRange:Z,dateRangeStart:u},oe=Le(O);T&&(oe.current=O);let t=T?O:oe.current,c=t.suggestions[0],h=c?.options??[],l=t.activeIndex>=0&&!!h[t.activeIndex]?.is_tappable,x=!!(t.pills&&t.pills.length>0&&g),A=t.showPills&&x,M=t.showPills&&!x&&t.isLoading,d=A||M,ie=x&&t.showSkipButton&&!t.isInputEmpty&&!!_,fe=t.pills?.[0]?.text,de=_a(t.formatType)&&t.dateView!=null,ce=h.length>0&&!de,j=h.length>0&&de&&!t.isLoading,ge=t.isLoading&&!ce&&!j,F=t.products??[];return qe("div",{ref:q,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":E,"data-mode":ee,"data-aia-loading":t.isLoading?"":void 0,"data-aia-has-products":F.length>0?"":void 0,className:`${te?"magicx-aia ":""}${ne.dropdown} ${T?ne.visible:""} ${n??""}`,onMouseDown:N=>N.preventDefault(),children:[qe(vt,{space:"8px",children:[(d||ie)&&qe(_e,{noWrap:!0,className:ne.pillBar,"data-aia-pillbar":"",children:[d&&B("span",{className:ne.pillScroll,"data-aia-pill-scroll":"",children:B(Re,{pills:t.pills??[],activePillIndex:0,activeSelected:t.activeSelected,onSelectPill:g??(()=>{}),rounded:!0,loading:t.isLoading})}),ie&&B("button",{type:"button",tabIndex:-1,className:ne.skip,"data-aia-skip":"",disabled:t.isLoading||t.skipDisabled,"aria-label":fe?`Skip ${fe}`:"Skip",onClick:_,children:"skip"})]}),ce&&B(bt,{options:h,activeIndex:t.activeIndex,onSelect:a,onHighlight:i,listboxId:o,loading:t.isLoading,groupKey:c?`${c.type} ${c.text}`:"",optionsPosition:E}),j&&t.dateView&&B(nt,{options:h,activeIndex:t.activeIndex,listboxId:o,view:t.dateView,selection:{selectedIso:t.selectedDateIso??null,selectedRange:t.selectedDateRange??null,rangeStart:t.dateRangeStart??null},onSelect:a,onHighlight:i,onPreviousMonth:se??wt,onNextMonth:J??wt}),ge&&B("div",{className:ne.skeletonBars,"data-aia-skeleton-bars":"",children:Ia.map(N=>B("span",{className:ne.skeletonBar,style:{width:N}},`bar-${N}`))}),B(ct,{products:F,listboxId:o,onSelect:Q??Aa,onFocusChange:Y,focusable:T}),B(st,{isOptionHighlighted:l,isInputEmpty:t.isInputEmpty})]}),B("button",{ref:U,type:"button",tabIndex:-1,className:ne.scrollArrow,"data-aia-scroll-arrow":"","aria-label":ka,"aria-hidden":"true",children:B("svg",{viewBox:"0 0 16 16",width:"14",height:"14",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:B("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}import{buildSubmitResult as Fa,ModeController as Ha,setCursorOffset as Ka}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 {
1562
1562
  flex-shrink: 0;
1563
1563
  width: 32px;
1564
1564
  height: 32px;