@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/README.md CHANGED
@@ -240,7 +240,7 @@ function App() {
240
240
  | `dropdownTrigger?` | `"auto" \| "manual" \| "hidden"` | `"auto"` | When the dropdown appears. `"auto"` = when options available. `"manual"` = only on pill tap, closes after selection. `"hidden"` = never shows. |
241
241
  | `closeDropdownOnBlur?` | `boolean` | `true` | When `true`, the dropdown closes if the input loses focus. Set to `false` to keep it open whenever options are available, regardless of focus. |
242
242
  | `showNonTappableOptions?` | `boolean` | `true` | When `true`, non-tappable options are rendered alongside tappable ones in the dropdown. Set to `false` to hide non-tappable options entirely. |
243
- | `showSkipButton?` | `boolean` | `true` | When `true`, the dropdown's pill bar ends in a small "skip" button that dismisses the active pill — same action as pressing <kbd>→</kbd> at the end of the input. It sits top-right when the dropdown opens below the input, bottom-right when `optionsPosition` is `"above"`. Set to `false` to hide it. |
243
+ | `showSkipButton?` | `boolean` | `true` | When `true`, the dropdown's pill bar ends in a small "skip" button that dismisses the active pill — same action as pressing <kbd>→</kbd> at the end of the input. It sits top-right when the dropdown opens below the input, bottom-right when `optionsPosition` is `"above"`, and appears once the input has text (alongside the footer's "→ to skip" hint). Set to `false` to hide it. |
244
244
  | `autoFocus?` | `boolean` | `true` | Focus the input on mount. Set to `false` to leave focus to the consumer. |
245
245
  | `onFocus?` | `() => void` | — | Called when the input gains focus. |
246
246
  | `onBlur?` | `() => void` | — | Called when the input loses focus. |
package/dist/index.d.mts CHANGED
@@ -45,8 +45,9 @@ interface AIAutocompleteProps {
45
45
  * the dropdown opens below the input, bottom-right when `optionsPosition` is
46
46
  * "above". Set to false to hide it. When pills render elsewhere
47
47
  * (`pillPlacement: "inline"` / `"hidden"`) the bar renders as a skip-only
48
- * row holding just the button; it hides during re-edit and on the loading
49
- * skeleton either way.
48
+ * row holding just the button; it hides during re-edit, on the loading
49
+ * skeleton, and while the input is empty (appearing alongside the footer's
50
+ * "→ to skip" hint once the user has typed) either way.
50
51
  */
51
52
  showSkipButton?: boolean;
52
53
  /** Focus the input on mount. Default: true. */
package/dist/index.d.ts CHANGED
@@ -45,8 +45,9 @@ interface AIAutocompleteProps {
45
45
  * the dropdown opens below the input, bottom-right when `optionsPosition` is
46
46
  * "above". Set to false to hide it. When pills render elsewhere
47
47
  * (`pillPlacement: "inline"` / `"hidden"`) the bar renders as a skip-only
48
- * row holding just the button; it hides during re-edit and on the loading
49
- * skeleton either way.
48
+ * row holding just the button; it hides during re-edit, on the loading
49
+ * skeleton, and while the input is empty (appearing alongside the footer's
50
+ * "→ to skip" hint once the user has typed) either way.
50
51
  */
51
52
  showSkipButton?: boolean;
52
53
  /** Focus the input on mount. Default: true. */
package/dist/index.js CHANGED
@@ -1473,7 +1473,7 @@
1473
1473
  }
1474
1474
  /* data-align="stretch" is the flex default \u2014 no rule needed. */
1475
1475
  }
1476
- `,document.head.appendChild(e)}var ct=require("react/jsx-runtime");function pt({space:e,align:o="stretch",className:a,children:n,...s}){let d=e?{"--aia-stack-space":e}:void 0;return(0,ct.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:d,...s,children:n})}var z=require("react/jsx-runtime"),zt=[159,119,164],Bt=()=>{};function Ft(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=(0,ve.useState)(o);if((0,ve.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),d=()=>n(s.matches);return s.addEventListener("change",d),()=>s.removeEventListener("change",d)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function ze({suggestions:e,activeIndex:o,onSelect:a,onHighlight:n,isOpen:s,id:d,className:i,pills:m,onPillClick:b,showPills:w=!0,onSkip:S,showSkipButton:y=!0,skipDisabled:F=!1,activeSelected:R=!1,isLoading:D=!1,isInputEmpty:J=!1,products:M,onProductSelect:ae,onProductFocusChange:T,optionsPosition:_="below",mode:V}){let c=Ft(V),oe=c!==void 0,X=e[0]?.options??[],Z=!!(m&&m.length>0&&b),C=!!(M&&M.length>0),N=s&&(X.length>0||w&&Z||D||C),O={suggestions:e,activeIndex:o,pills:m,showPills:w,showSkipButton:y,skipDisabled:F,activeSelected:R,isLoading:D,isInputEmpty:J,products:M},q=(0,ve.useRef)(O);N&&(q.current=O);let h=N?O:q.current,A=h.suggestions[0],H=A?.options??[],Y=h.activeIndex>=0&&!!H[h.activeIndex]?.is_tappable,G=!!(h.pills&&h.pills.length>0&&b),$=h.showPills&&G,j=h.showPills&&!G&&h.isLoading,ee=$||j,l=G&&h.showSkipButton&&!!S,t=h.pills?.[0]?.text,u=H.length>0,v=h.isLoading&&!u,g=h.products??[];return(0,z.jsx)("div",{id:d,role:"listbox","data-aia-dropdown":"","data-options-position":_,"data-mode":c,"data-aia-loading":h.isLoading?"":void 0,"data-aia-has-products":g.length>0?"":void 0,className:`${oe?"magicx-aia ":""}${se.dropdown} ${N?se.visible:""} ${i??""}`,onMouseDown:r=>r.preventDefault(),children:(0,z.jsxs)(pt,{space:"8px",children:[(ee||l)&&(0,z.jsxs)(ke,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[ee&&(0,z.jsx)("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:(0,z.jsx)(Re,{pills:h.pills??[],activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:h.isLoading})}),l&&(0,z.jsx)("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":t?`Skip ${t}`:"Skip",onClick:S,children:"skip"})]}),u&&(0,z.jsx)(dt,{options:H,activeIndex:h.activeIndex,onSelect:a,onHighlight:n,listboxId:d,loading:h.isLoading,groupKey:A?`${A.type} ${A.text}`:""}),v&&(0,z.jsx)("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:zt.map(r=>(0,z.jsx)("span",{className:se.skeletonBar,style:{width:r}},`bar-${r}`))}),(0,z.jsx)(it,{products:g,listboxId:d,onSelect:ae??Bt,onFocusChange:T,focusable:N}),(0,z.jsx)(et,{isOptionHighlighted:Y,isInputEmpty:h.isInputEmpty})]})})}var xe=require("@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)}var ct=require("react/jsx-runtime");function pt({space:e,align:o="stretch",className:a,children:n,...s}){let d=e?{"--aia-stack-space":e}:void 0;return(0,ct.jsx)("div",{className:a?`aia-stack ${a}`:"aia-stack","data-align":o,style:d,...s,children:n})}var z=require("react/jsx-runtime"),zt=[159,119,164],Bt=()=>{};function Ft(e){let o=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[a,n]=(0,ve.useState)(o);if((0,ve.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let s=window.matchMedia("(prefers-color-scheme: dark)"),d=()=>n(s.matches);return s.addEventListener("change",d),()=>s.removeEventListener("change",d)},[e]),e!==void 0)return e==="auto"?a?"dark":"light":e}function ze({suggestions:e,activeIndex:o,onSelect:a,onHighlight:n,isOpen:s,id:d,className:i,pills:m,onPillClick:b,showPills:w=!0,onSkip:S,showSkipButton:y=!0,skipDisabled:F=!1,activeSelected:R=!1,isLoading:D=!1,isInputEmpty:J=!1,products:M,onProductSelect:ae,onProductFocusChange:T,optionsPosition:_="below",mode:V}){let c=Ft(V),oe=c!==void 0,X=e[0]?.options??[],Z=!!(m&&m.length>0&&b),C=!!(M&&M.length>0),N=s&&(X.length>0||w&&Z||D||C),O={suggestions:e,activeIndex:o,pills:m,showPills:w,showSkipButton:y,skipDisabled:F,activeSelected:R,isLoading:D,isInputEmpty:J,products:M},q=(0,ve.useRef)(O);N&&(q.current=O);let h=N?O:q.current,A=h.suggestions[0],H=A?.options??[],Y=h.activeIndex>=0&&!!H[h.activeIndex]?.is_tappable,G=!!(h.pills&&h.pills.length>0&&b),$=h.showPills&&G,j=h.showPills&&!G&&h.isLoading,ee=$||j,l=G&&h.showSkipButton&&!h.isInputEmpty&&!!S,t=h.pills?.[0]?.text,u=H.length>0,v=h.isLoading&&!u,g=h.products??[];return(0,z.jsx)("div",{id:d,role:"listbox","data-aia-dropdown":"","data-options-position":_,"data-mode":c,"data-aia-loading":h.isLoading?"":void 0,"data-aia-has-products":g.length>0?"":void 0,className:`${oe?"magicx-aia ":""}${se.dropdown} ${N?se.visible:""} ${i??""}`,onMouseDown:r=>r.preventDefault(),children:(0,z.jsxs)(pt,{space:"8px",children:[(ee||l)&&(0,z.jsxs)(ke,{noWrap:!0,className:se.pillBar,"data-aia-pillbar":"",children:[ee&&(0,z.jsx)("span",{className:se.pillScroll,"data-aia-pill-scroll":"",children:(0,z.jsx)(Re,{pills:h.pills??[],activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:b??(()=>{}),rounded:!0,loading:h.isLoading})}),l&&(0,z.jsx)("button",{type:"button",tabIndex:-1,className:se.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":t?`Skip ${t}`:"Skip",onClick:S,children:"skip"})]}),u&&(0,z.jsx)(dt,{options:H,activeIndex:h.activeIndex,onSelect:a,onHighlight:n,listboxId:d,loading:h.isLoading,groupKey:A?`${A.type} ${A.text}`:""}),v&&(0,z.jsx)("div",{className:se.skeletonBars,"data-aia-skeleton-bars":"",children:zt.map(r=>(0,z.jsx)("span",{className:se.skeletonBar,style:{width:r}},`bar-${r}`))}),(0,z.jsx)(it,{products:g,listboxId:d,onSelect:ae??Bt,onFocusChange:T,focusable:N}),(0,z.jsx)(et,{isOptionHighlighted:Y,isInputEmpty:h.isInputEmpty})]})})}var xe=require("@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;