@magicx-eng/ai-autocomplete-react 0.9.0 → 0.9.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.js +34 -11
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +34 -11
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -248,11 +248,10 @@ import{buildSubmitResult as No,withSkippedParams as Ho}from"@magicx-eng/ai-autoc
|
|
|
248
248
|
halfway between its old value and the white behind it. */
|
|
249
249
|
--aia-dropdown-border: var(--aia-primitive-neutral-900-a50);
|
|
250
250
|
--aia-dropdown-shadow: 0 8px 12px rgba(0, 0, 0, 0.05);
|
|
251
|
-
/* Suggestion pills (Figma "ParamPill"): transparent fill
|
|
251
|
+
/* Suggestion pills (Figma "ParamPill"): transparent fill, no visible border;
|
|
252
252
|
per-pill opacity via getPillOpacity. */
|
|
253
253
|
--aia-pill-bg: var(--aia-primitive-neutral-750);
|
|
254
254
|
--aia-pill-color: var(--aia-primitive-neutral-300);
|
|
255
|
-
--aia-pill-border: var(--aia-primitive-neutral-750-a30);
|
|
256
255
|
--aia-pill-font-size: 16px;
|
|
257
256
|
|
|
258
257
|
/* Completed params (Figma "RichTextPill"): compact faint-gray chip with
|
|
@@ -305,10 +304,9 @@ import{buildSubmitResult as No,withSkippedParams as Ho}from"@magicx-eng/ai-autoc
|
|
|
305
304
|
\u03942) at 50% alpha; see the light-mode note above. */
|
|
306
305
|
--aia-dropdown-border: var(--aia-primitive-neutral-400-a50);
|
|
307
306
|
--aia-dropdown-shadow: 0 8px 12px rgba(0, 0, 0, 0.05);
|
|
308
|
-
/* Suggestion pills (Figma "ParamPill"): transparent fill
|
|
307
|
+
/* Suggestion pills (Figma "ParamPill"): transparent fill, no visible border. */
|
|
309
308
|
--aia-pill-bg: var(--aia-primitive-neutral-750);
|
|
310
309
|
--aia-pill-color: var(--aia-primitive-neutral-700);
|
|
311
|
-
--aia-pill-border: var(--aia-primitive-neutral-750-a30);
|
|
312
310
|
--aia-pill-font-size: 16px;
|
|
313
311
|
|
|
314
312
|
/* Completed params (Figma "RichTextPill") \u2014 dark theme (design source):
|
|
@@ -374,6 +372,30 @@ import{buildSubmitResult as No,withSkippedParams as Ho}from"@magicx-eng/ai-autoc
|
|
|
374
372
|
--aia-footer-fade-inset: calc(-1 * var(--aia-footer-fade-lead)) 0 0;
|
|
375
373
|
}
|
|
376
374
|
|
|
375
|
+
/* In the dropdown, the parameter label reads as a section header for the
|
|
376
|
+
options beneath it \u2014 not an outlined chip floating over them. It drops the
|
|
377
|
+
pill's inner horizontal padding and left-aligns its text with the option
|
|
378
|
+
text below, which sits 10px in from the dropdown's content edge. The label's
|
|
379
|
+
own list wrapper carries that 10px so the text lands exactly on the option
|
|
380
|
+
text's left edge.
|
|
381
|
+
|
|
382
|
+
Selector shape differs from the vanilla/Angular copies (which target the
|
|
383
|
+
\`.aia-pill-list\` / \`.aia-pill\` class names): PillList's \`.list\` class is a
|
|
384
|
+
hash-scoped CSS-module local, unreachable from this global stylesheet, so
|
|
385
|
+
the wrapper is matched as PillList's own direct child \`> span\` of the
|
|
386
|
+
pill-bar Cluster, and the pill via \`[data-aia-pill]\` (unique to ParamPill).
|
|
387
|
+
Like the sibling structural \`[data-aia-dropdown]\` rules below, this is
|
|
388
|
+
deliberately NOT \`:where()\`-wrapped \u2014 it must win over ParamPill's own
|
|
389
|
+
\`.pill\` base rule. */
|
|
390
|
+
[data-aia-dropdown] [data-aia-pillbar] > span {
|
|
391
|
+
padding-inline: 10px;
|
|
392
|
+
}
|
|
393
|
+
[data-aia-dropdown] [data-aia-pillbar] [data-aia-pill] {
|
|
394
|
+
justify-content: flex-start;
|
|
395
|
+
border-inline-width: 0;
|
|
396
|
+
padding-inline: 0;
|
|
397
|
+
}
|
|
398
|
+
|
|
377
399
|
/* The reserved band the footer overlaps, kept OUT of \`@layer layout\` on
|
|
378
400
|
purpose. A consumer reset (\`* { margin: 0; padding: 0 }\`, Tailwind's
|
|
379
401
|
preflight, \u2026) is unlayered, and an unlayered declaration beats every layered
|
|
@@ -622,7 +644,7 @@ import{buildSubmitResult as No,withSkippedParams as Ho}from"@magicx-eng/ai-autoc
|
|
|
622
644
|
justify-content: space-around;
|
|
623
645
|
}
|
|
624
646
|
}
|
|
625
|
-
`,document.head.appendChild(e)}import{jsx as
|
|
647
|
+
`,document.head.appendChild(e)}import{jsx as qe}from"react/jsx-runtime";function me({gap:e,align:n="center",justify:o="start",noWrap:r=!1,inline:l=!1,className:s,children:i,...u}){let h=e?{"--aia-cluster-gap":e}:void 0,v={className:s?`aia-cluster ${s}`:"aia-cluster","data-align":n,"data-justify":o,"data-nowrap":r||void 0,"data-inline":l||void 0,style:h,...u};return l?qe("span",{...v,children:i}):qe("div",{...v,children:i})}if(typeof document<"u"&&!document.getElementById("ac-style-56b0c577")){let e=document.createElement("style");e.id="ac-style-56b0c577",e.textContent=`/* The footer adds its own 8px horizontal inset so it stays clear of the
|
|
626
648
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
627
649
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
628
650
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -752,15 +774,16 @@ import{buildSubmitResult as No,withSkippedParams as Ho}from"@magicx-eng/ai-autoc
|
|
|
752
774
|
justify-content: flex-end;
|
|
753
775
|
}
|
|
754
776
|
}
|
|
755
|
-
`,document.head.appendChild(e)}var X={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};import{jsx as he,jsxs as Re}from"react/jsx-runtime";function
|
|
756
|
-
|
|
757
|
-
|
|
777
|
+
`,document.head.appendChild(e)}var X={footer:"DropdownFooter-module_footer_qQQ7x",hintGroup:"DropdownFooter-module_hintGroup_ZzbPf",brandLink:"DropdownFooter-module_brandLink_r4f3R",key:"DropdownFooter-module_key_Bz1H-",hint:"DropdownFooter-module_hint_GKEOH",brand:"DropdownFooter-module_brand_Al-lR",badge:"DropdownFooter-module_badge_Fk9vg",row:"DropdownFooter-module_row_BgZ6Q"};import{jsx as he,jsxs as Re}from"react/jsx-runtime";function $e({isOptionHighlighted:e=!1,isInputEmpty:n=!1}){let{key:o,hint:r}=kt(e,n),[l,s]=Pt(wt);return _t(()=>{s(yt())},[]),he("footer",{className:X.footer,"data-aia-footer":"",children:Re(me,{justify:"between",noWrap:!0,className:X.row,children:[Re(me,{gap:"5px",className:X.hintGroup,children:[he("kbd",{className:X.key,children:o}),he("span",{className:X.hint,children:r})]}),Re("a",{className:X.brandLink,href:l,target:"_blank",rel:"noopener noreferrer",children:[he("span",{className:X.brand,children:"AI"}),he("span",{className:X.badge,children:"Autocomplete"})]})]})})}if(typeof document<"u"&&!document.getElementById("ac-style-199d0432")){let e=document.createElement("style");e.id="ac-style-199d0432",e.textContent=`/* ParamPill (Figma "ParamPill") \u2014 unfilled suggestion pill: transparent fill,
|
|
778
|
+
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
779
|
+
The border is kept as a 1px transparent line so the box stays the same size
|
|
780
|
+
as it was when the outline was dashed. */
|
|
758
781
|
.ParamPill-module_pill_6Ga7S {
|
|
759
782
|
display: inline-flex;
|
|
760
783
|
align-items: center;
|
|
761
784
|
justify-content: center;
|
|
762
785
|
padding: 5px 8px;
|
|
763
|
-
border: 1px
|
|
786
|
+
border: 1px solid transparent;
|
|
764
787
|
border-radius: 7px;
|
|
765
788
|
background: transparent;
|
|
766
789
|
color: var(--aia-pill-color, var(--aia-color-text-muted, #c1c4cb));
|
|
@@ -1387,7 +1410,7 @@ import{buildSubmitResult as No,withSkippedParams as Ho}from"@magicx-eng/ai-autoc
|
|
|
1387
1410
|
}
|
|
1388
1411
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
1389
1412
|
}
|
|
1390
|
-
`,document.head.appendChild(e)}import{jsx as Gt}from"react/jsx-runtime";function at({space:e,align:n="stretch",className:o,children:r,...l}){let s=e?{"--aia-stack-space":e}:void 0;return Gt("div",{className:o?`aia-stack ${o}`:"aia-stack","data-align":n,style:s,...l,children:r})}import{jsx as ie,jsxs as jt}from"react/jsx-runtime";var Vt=[159,119,164]
|
|
1413
|
+
`,document.head.appendChild(e)}import{jsx as Gt}from"react/jsx-runtime";function at({space:e,align:n="stretch",className:o,children:r,...l}){let s=e?{"--aia-stack-space":e}:void 0;return Gt("div",{className:o?`aia-stack ${o}`:"aia-stack","data-align":n,style:s,...l,children:r})}import{jsx as ie,jsxs as jt}from"react/jsx-runtime";var Vt=[159,119,164],qt=()=>{};function $t(e){let n=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[o,r]=Ut(n);if(Kt(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let l=window.matchMedia("(prefers-color-scheme: dark)"),s=()=>r(l.matches);return l.addEventListener("change",s),()=>l.removeEventListener("change",s)},[e]),e!==void 0)return e==="auto"?o?"dark":"light":e}function ze({suggestions:e,activeIndex:n,onSelect:o,onHighlight:r,isOpen:l,id:s,className:i,pills:u,onPillClick:h,showPills:v=!0,activeSelected:k=!1,isLoading:f=!1,isInputEmpty:_=!1,products:P,onProductSelect:W,onProductFocusChange:U,optionsPosition:J="below",mode:V}){let C=$t(V),x=C!==void 0,p=e[0]?.options??[],Z=!!(u&&u.length>0&&h),q=!!(P&&P.length>0),T=l&&(p.length>0||v&&Z||f||q),E={suggestions:e,activeIndex:n,pills:u,showPills:v,activeSelected:k,isLoading:f,isInputEmpty:_,products:P},A=Wt(E);T&&(A.current=E);let g=T?E:A.current,L=g.suggestions[0],B=L?.options??[],R=g.activeIndex>=0&&!!B[g.activeIndex]?.is_tappable,H=!!(g.pills&&g.pills.length>0&&h),$=g.showPills&&H,j=g.showPills&&!H&&g.isLoading,G=$||j,F=B.length>0,Y=g.isLoading&&!F,z=g.products??[];return ie("div",{id:s,role:"listbox","data-aia-dropdown":"","data-options-position":J,"data-mode":C,"data-aia-loading":g.isLoading?"":void 0,"data-aia-has-products":z.length>0?"":void 0,className:`${x?"magicx-aia ":""}${de.dropdown} ${T?de.visible:""} ${i??""}`,onMouseDown:t=>t.preventDefault(),children:jt(at,{space:"8px",children:[G&&ie(me,{noWrap:!0,className:de.pillBar,"data-aia-pillbar":"",children:ie(_e,{pills:g.pills??[],activePillIndex:0,activeSelected:g.activeSelected,onSelectPill:h??(()=>{}),rounded:!0,loading:g.isLoading})}),F&&ie(tt,{options:B,activeIndex:g.activeIndex,onSelect:o,onHighlight:r,listboxId:s,loading:g.isLoading,groupKey:L?`${L.type} ${L.text}`:""}),Y&&ie("div",{className:de.skeletonBars,"data-aia-skeleton-bars":"",children:Vt.map(t=>ie("span",{className:de.skeletonBar,style:{width:t}},`bar-${t}`))}),ie(Xe,{products:z,listboxId:s,onSelect:W??qt,onFocusChange:U,focusable:T}),ie($e,{isOptionHighlighted:R,isInputEmpty:g.isInputEmpty})]})})}import{buildSubmitResult as ia,ModeController as ra,setCursorOffset as na}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 {
|
|
1391
1414
|
flex-shrink: 0;
|
|
1392
1415
|
width: 32px;
|
|
1393
1416
|
height: 32px;
|
|
@@ -1422,5 +1445,5 @@ import{buildSubmitResult as No,withSkippedParams as Ho}from"@magicx-eng/ai-autoc
|
|
|
1422
1445
|
);
|
|
1423
1446
|
cursor: default;
|
|
1424
1447
|
}
|
|
1425
|
-
`,document.head.appendChild(e)}var ot={submitButton:"SubmitButton-module_submitButton_otz7H"};import{jsx as Be}from"react/jsx-runtime";function it({disabled:e,onClick:n}){return Be("button",{type:"button","data-aia-submit":"",className:ot.submitButton,disabled:e,onClick:o=>{o.stopPropagation(),n()},"aria-label":"Submit",children:Be("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:Be("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Qt}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as st,useEffect as ge,useRef as D,useState as Xt}from"react";import{useRef as rt}from"react";function nt(e){let n=rt(e);n.current=e;let o=rt(null);o.current===null&&(o.current={fetch:(l,s)=>{let i=n.current;return i?i.fetch(l,s):Promise.reject(new Error("products config removed"))},transform:l=>n.current?.transform(l)??[],get limit(){return n.current?.limit}});let r=e!==void 0;return{config:r?o.current:void 0,enabled:r}}var Jt={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],placeholderText:"",isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1};function Fe({onSubmit:e,onError:n,optionOverrides:o,maskCompletedText:r,apiConfig:l,columns:s=2,dropdownTrigger:i,optionsPosition:u,closeDropdownOnBlur:h,showNonTappableOptions:v,onFocus:k,onBlur:f,value:_,completedParams:P,onChange:W,onParamsChange:U,products:J,onProductSelect:V,source:C,setCursor:x}){let c=D(null),[Z,$]=Xt(null),T=D(e);T.current=e;let E=D(n);E.current=n;let A=D(W);A.current=W;let g=D(U);g.current=U;let L=D(k);L.current=k;let B=D(f);B.current=f;let R=D(x);R.current=x;let H=D(V);H.current=V;let q=nt(J);ge(()=>{if(typeof document>"u")return;let d=new Qt(document.createElement("div"),{renderMode:"headless",apiConfig:l,optionOverrides:o,maskCompletedText:r,columns:s,dropdownTrigger:i,optionsPosition:u,closeDropdownOnBlur:h,showNonTappableOptions:v,source:C,value:_,completedParams:P,onSubmit:(...y)=>T.current?.(...y),onError:(...y)=>E.current?.(...y),onChange:(...y)=>A.current?.(...y),onParamsChange:(...y)=>g.current?.(...y),onFocus:()=>L.current?.(),onBlur:()=>B.current?.(),onProductSelect:y=>H.current?.(y),setCursor:y=>R.current?.(y),products:q.config});c.current=d,$(d.getState());let S=d.subscribe(y=>$(y));return()=>{S(),d.destroy(),c.current===d&&(c.current=null)}},[]),ge(()=>{_!==void 0&&c.current?.setValue(_)},[_]),ge(()=>{P!==void 0&&c.current?.setCompletedParams(P)},[P]);let j=JSON.stringify(l??null),G=D(o),F=D(0);if(o!==G.current){let d=G.current,S=o,y=Object.keys(d??{}),le=Object.keys(S??{});(y.length!==le.length||le.some(ee=>!d?.[ee]||S[ee]!==d[ee]))&&F.current++,G.current=o}ge(()=>{c.current?.update({apiConfig:l,optionOverrides:o,dropdownTrigger:i,optionsPosition:u,closeDropdownOnBlur:h,showNonTappableOptions:v})},[j,F.current,i,u,h,v]);let Y=D(!1);ge(()=>{if(!Y.current){Y.current=!0;return}c.current?.update({products:q.config})},[q.enabled]);let z=D(null);z.current===null&&(z.current={handleTextChange:d=>c.current?.handleTextChange(d),handleKeyDown:d=>{let S="nativeEvent"in d?d.nativeEvent:d;c.current?.handleKeyDown(S)},setFocused:d=>c.current?.setFocused(d),startEditingParam:d=>c.current?.startEditingParam(d),exitEditMode:()=>c.current?.exitEditMode(),handleCaretAfterInput:d=>c.current?.handleCaretAfterInput(d),handleCaretMove:d=>c.current?.handleCaretMove(d),replaceEditingRange:d=>c.current?.replaceEditingRange(d)??!1,setActivePill:d=>c.current?.setActivePill(d),removeLastParam:()=>c.current?.removeLastParam(),clearNewParamId:()=>c.current?.clearNewParamId(),reset:()=>c.current?.reset(),selectOption:d=>c.current?.selectOption(d),selectProduct:d=>c.current?.selectProduct(d),setActiveDropdownIndex:d=>c.current?.setActiveDropdownIndex(d),handleFocus:()=>c.current?.setFocused(!0),handleBlur:()=>c.current?.setFocused(!1)});let t=z.current,p=st(d=>{let S=d.target.value,le=S.length>0&&!d.nativeEvent?.isComposing&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;c.current?.handleTextChange(le)},[]),m=st(d=>{c.current?.handleKeyDown(d.nativeEvent)},[]),b=c.current,a=Z??Jt,I=_!==void 0?_:a.text,Q=P!==void 0?P:a.completedParams,K=a.actionableSuggestions,be=K[0],se=b?.listboxId??"",Se=a.activeDropdownIndex>=0&&b?`${se}-option-${a.activeDropdownIndex}`:void 0,re=a.editingParam,ue=re?{type:re.suggestionType,text:re.suggestionPlaceholder,required:!0,options:re.options}:null,ve=ue??be,Ae=ue?[ue]:K,xe=!b||a.isLoading&&!a.editingParam&&!a.inSelectionAnimation;return{completedParams:Q,skippedParams:a.skippedParams,suggestionPills:K,setActivePill:t.setActivePill,removeLastParam:t.removeLastParam,segments:a.segments,newParamId:a.newParamId,clearNewParamId:t.clearNewParamId,suggestions:a.suggestions,activeIndex:a.activeDropdownIndex,isReady:a.isReady,isLoading:xe,isFocused:a.isFocused,isDropdownOpen:a.isDropdownOpen,isActivePillSelected:a.isActivePillSelected,placeholderText:a.placeholderText,listboxId:se,error:a.error,products:a.products,selectProduct:t.selectProduct,handleTextChange:t.handleTextChange,handleKeyDown:t.handleKeyDown,setFocused:t.setFocused,editingParam:re,editingAnchor:a.editingAnchor,caretOffset:a.caretOffset,startEditingParam:t.startEditingParam,exitEditMode:t.exitEditMode,handleCaretAfterInput:t.handleCaretAfterInput,handleCaretMove:t.handleCaretMove,replaceEditingRange:t.replaceEditingRange,inputProps:{value:I,placeholder:a.placeholderText||void 0,onChange:p,onKeyDown:m,onFocus:t.handleFocus,onBlur:t.handleBlur,role:"combobox","aria-expanded":a.isDropdownOpen,"aria-activedescendant":Se,"aria-autocomplete":"list","aria-controls":se},reset:t.reset,dropdownProps:{suggestions:ve?[{...ve,options:a.filteredOptions}]:[],activeIndex:a.activeDropdownIndex,onSelect:t.selectOption,onHighlight:t.setActiveDropdownIndex,isOpen:a.isDropdownOpen,id:se,pills:Ae,activeSelected:a.isActivePillSelected,onPillClick:t.setActivePill,isLoading:xe,isInputEmpty:I.trim().length===0,products:a.products,onProductSelect:t.selectProduct,onProductFocusChange:t.setFocused,optionsPosition:u??"below"}}}import{extractPlainText as lt,getCursorOffset as dt,plainTextLength as Zt,renderEditableContent as Yt,setCursorOffset as ct}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as N,useEffect as Me,useLayoutEffect as Oe,useRef as ce}from"react";var Ie;function ea(){if(Ie!==void 0)return Ie;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ie=e.contentEditable==="plaintext-only",Ie}function pt(e){let{segments:n,newParamId:o,editingParam:r,editingAnchor:l,caretOffset:s,placeholderText:i,isFocused:u,isDropdownOpen:h,listboxId:v,activeDescendantId:k,autoFocus:f,handleTextChange:_,handleKeyDown:P,handleCaretAfterInput:W,handleCaretMove:U,startEditingParam:J,replaceEditingRange:V,setFocused:C}=e,x=ce(null),c=ce(!1),Z=ce(""),$=ce(""),T=ce(null),E=ce(0);T.current=s,Me(()=>{if(!f)return;let t=x.current;if(!t)return;document.activeElement===t?C(!0):t.focus();let p=t.ownerDocument??document,m=p.getSelection(),b=m&&m.rangeCount>0&&t.contains(m.anchorNode);if(m&&!b){let a=p.createRange();a.selectNodeContents(t),a.collapse(!0),m.removeAllRanges(),m.addRange(a)}},[f,C]),Me(()=>{let t=x.current;if(!t)return;let p=t.ownerDocument??document,m=()=>{let b=p.getSelection();if(!b||b.rangeCount===0||!b.anchorNode||!t.contains(b.anchorNode))return;let a=b.anchorNode,I=a.nodeType===Node.ELEMENT_NODE?a:a.parentElement,K=(b.isCollapsed?I?.closest('strong[data-seg="completed"][data-param-id]'):null)?.dataset.paramId??null;if(K&&K!==r?.id){J(K);return}performance.now()-E.current<50||U(dt(t))};return p.addEventListener("selectionchange",m),()=>p.removeEventListener("selectionchange",m)},[r,J,U]),Oe(()=>{let t=x.current;t&&Yt({input:t,segments:n,newParamId:o,editingParamId:r?.id??null,placeholderText:i??"",isFocused:u})},[n,o,r,i,u]),Oe(()=>{let t=Z.current,p=o??"";if(Z.current=p,!p||p===t)return;let m=x.current;if(!m)return;m.focus();let b=T.current??Zt(m);ct(m,b)},[o]),Oe(()=>{let t=$.current,p=r?.id??"";if($.current=p,!p||p===t||l==null)return;let m=x.current;m&&ct(m,l)},[r,l]);let A=N(()=>{if(c.current)return;let t=x.current;if(!t)return;let p=lt(t),b=p.length>0&&p[0]!==p[0].toUpperCase()?p[0].toUpperCase()+p.slice(1):p;_(b)},[_]),g=N(()=>{E.current=performance.now(),A();let t=x.current;t&&W(dt(t))},[A,W]);Me(()=>{let t=x.current;if(!t)return;let p=m=>{let b=m,a=b.inputType;if(a==="insertParagraph"||a==="insertLineBreak"||a==="insertFromDrop"){m.preventDefault();return}if(a.startsWith("insert")||a.startsWith("delete")){let I=a.startsWith("delete")?"":b.data??"";V(I)&&m.preventDefault()}};return t.addEventListener("beforeinput",p),()=>t.removeEventListener("beforeinput",p)},[V]);let L=N(()=>{c.current=!0},[]),B=N(()=>{c.current=!1,A()},[A]),R=N(t=>{t.preventDefault();let p=x.current;if(!p)return;let m=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!m)return;let b=p.ownerDocument??document,a=b.getSelection();if(!a||a.rangeCount===0)return;let I=a.getRangeAt(0);if(!p.contains(I.startContainer))return;I.deleteContents();let Q=b.createTextNode(m);I.insertNode(Q),I.setStartAfter(Q),I.collapse(!0),a.removeAllRanges(),a.addRange(I),A()},[A]),H=N(t=>P(t),[P]),q=N(()=>C(!0),[C]),j=N(()=>C(!1),[C]),G=N(()=>x.current?.focus(),[]),F=N(()=>x.current?.blur(),[]),Y=N(()=>{let t=x.current;return t?lt(t):""},[]),z=ea()?"plaintext-only":"true";return{inputRef:x,editorProps:{ref:x,contentEditable:z,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":v,"aria-expanded":h,"aria-activedescendant":k,spellCheck:!0,enterKeyHint:"send",onInput:g,onKeyDown:H,onCompositionStart:L,onCompositionEnd:B,onPaste:R,onFocus:q,onBlur:j},getPlainText:Y,focus:G,blur:F}}import{jsx as pe,jsxs as He}from"react/jsx-runtime";function sa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var la=ta(function({onSubmit:n,onError:o,optionOverrides:r,maskCompletedText:l,className:s,apiConfig:i,columns:u,pillPlacement:h="dropdown",mode:v="auto",optionsPosition:k="below",animations:f=!0,dropdownTrigger:_,closeDropdownOnBlur:P,showNonTappableOptions:W,autoFocus:U=!0,onFocus:J,onBlur:V,value:C,completedParams:x,onChange:c,onParamsChange:Z,products:$,onProductSelect:T,submitButton:E},A){let g=fe(null),L=fe(null),B=fe(()=>{}),R=fe(null),H=fe(null);ut(()=>{let w=g.current;if(w)return R.current?R.current.setMode(v):R.current=new ra(w,v),()=>{R.current?.destroy(),R.current=null}},[v]);let q=Ne(w=>{let te=H.current?.current;te&&(te.focus(),na(te,w))},[]),{completedParams:j,skippedParams:G,suggestionPills:F,setActivePill:Y,segments:z,newParamId:t,clearNewParamId:p,placeholderText:m,isFocused:b,isDropdownOpen:a,isActivePillSelected:I,isLoading:Q,activeIndex:K,listboxId:be,handleTextChange:se,handleKeyDown:Se,setFocused:re,editingParam:ue,editingAnchor:ve,caretOffset:Ae,startEditingParam:xe,handleCaretAfterInput:d,handleCaretMove:S,replaceEditingRange:y,dropdownProps:le,reset:ee}=Fe({onSubmit:w=>B.current(w),onError:o,optionOverrides:r,maskCompletedText:l,apiConfig:i,columns:u,dropdownTrigger:_,optionsPosition:k,closeDropdownOnBlur:P,showNonTappableOptions:W,onFocus:J,onBlur:V,value:C,completedParams:x,onChange:c,onParamsChange:Z,products:$,onProductSelect:T,source:"full-sdk",setCursor:q});ut(()=>{if(!t)return;let w=window.setTimeout(()=>p(),650);return()=>window.clearTimeout(w)},[t,p]);let mt=K>=0?`${be}-option-${K}`:void 0,{inputRef:Ce,editorProps:ht,focus:we,blur:Ge,getPlainText:Ke}=pt({segments:z,newParamId:t,editingParam:ue,editingAnchor:ve,caretOffset:Ae,placeholderText:m,isFocused:b,isDropdownOpen:a,listboxId:be,activeDescendantId:mt,autoFocus:U,handleTextChange:se,handleKeyDown:Se,handleCaretAfterInput:d,handleCaretMove:S,startEditingParam:xe,replaceEditingRange:y,setFocused:re});H.current=Ce,oa(()=>{let w=L.current,te=Ce.current;if(!w||!te)return;let We=()=>{let Ve=w.firstElementChild;if(!Ve)return;let vt=Ve.getBoundingClientRect(),xt=te.getBoundingClientRect();vt.top>=xt.bottom-2?w.setAttribute("data-aia-pill-wrapped",""):w.removeAttribute("data-aia-pill-wrapped")};We();let Ue=new ResizeObserver(We);return Ue.observe(te),()=>Ue.disconnect()},[z,F.length,Q,Ce]),aa(A,()=>({focus:we,blur:Ge,reset:ee,setMode:w=>R.current?.setMode(w)}),[we,Ge,ee]);let ye=!!z.length||j.length>0,Ee=Ne(()=>{if(!ye)return;let w=Ke();n(ia(w,j,G)),ee()},[ye,j,G,n,ee,Ke]);B.current=Ee;let gt=Ne(w=>{w.target?.closest("[data-aia-pill]")||we()},[we]),ft=h==="inline",bt=h==="dropdown";return He("div",{ref:g,className:`magicx-aia ${ne.container} ${s??""}`,"data-pill-placement":h,"data-options-position":k,"data-animations":f?"on":"off","data-mode":sa(v),children:[pe(ze,{...le,showPills:bt}),He("div",{className:ne.inputWrapper,onClick:gt,children:[He("div",{className:ne.editorArea,"data-aia-editor":"",children:[pe("div",{...ht,className:ne.input,"data-aia-input":""}),ft&&(Q||F.length>0)&&pe("span",{ref:L,className:ne.pillListContainer,"data-aia-pill-list-container":"",children:pe(_e,{pills:F,activePillIndex:0,activeSelected:I,onSelectPill:Y,loading:Q})})]}),E===null?null:E===void 0?pe(it,{disabled:!ye,onClick:Ee}):pe("span",{"data-aia-submit":"",className:ne.submitSlot,onClick:w=>{ye&&(w.stopPropagation(),Ee())},children:E})]})]})});export{la as AIAutocomplete,ze as AIAutocompleteDropdown,No as buildSubmitResult,Fe as useAIAutocomplete,Ho as withSkippedParams};
|
|
1448
|
+
`,document.head.appendChild(e)}var ot={submitButton:"SubmitButton-module_submitButton_otz7H"};import{jsx as Be}from"react/jsx-runtime";function it({disabled:e,onClick:n}){return Be("button",{type:"button","data-aia-submit":"",className:ot.submitButton,disabled:e,onClick:o=>{o.stopPropagation(),n()},"aria-label":"Submit",children:Be("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:Be("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}import{AIAutocomplete as Qt}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as st,useEffect as ge,useRef as D,useState as Xt}from"react";import{useRef as rt}from"react";function nt(e){let n=rt(e);n.current=e;let o=rt(null);o.current===null&&(o.current={fetch:(l,s)=>{let i=n.current;return i?i.fetch(l,s):Promise.reject(new Error("products config removed"))},transform:l=>n.current?.transform(l)??[],get limit(){return n.current?.limit}});let r=e!==void 0;return{config:r?o.current:void 0,enabled:r}}var Jt={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],placeholderText:"",isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1};function Fe({onSubmit:e,onError:n,optionOverrides:o,maskCompletedText:r,apiConfig:l,columns:s=2,dropdownTrigger:i,optionsPosition:u,closeDropdownOnBlur:h,showNonTappableOptions:v,onFocus:k,onBlur:f,value:_,completedParams:P,onChange:W,onParamsChange:U,products:J,onProductSelect:V,source:C,setCursor:x}){let p=D(null),[Z,q]=Xt(null),T=D(e);T.current=e;let E=D(n);E.current=n;let A=D(W);A.current=W;let g=D(U);g.current=U;let L=D(k);L.current=k;let B=D(f);B.current=f;let R=D(x);R.current=x;let H=D(V);H.current=V;let $=nt(J);ge(()=>{if(typeof document>"u")return;let d=new Qt(document.createElement("div"),{renderMode:"headless",apiConfig:l,optionOverrides:o,maskCompletedText:r,columns:s,dropdownTrigger:i,optionsPosition:u,closeDropdownOnBlur:h,showNonTappableOptions:v,source:C,value:_,completedParams:P,onSubmit:(...y)=>T.current?.(...y),onError:(...y)=>E.current?.(...y),onChange:(...y)=>A.current?.(...y),onParamsChange:(...y)=>g.current?.(...y),onFocus:()=>L.current?.(),onBlur:()=>B.current?.(),onProductSelect:y=>H.current?.(y),setCursor:y=>R.current?.(y),products:$.config});p.current=d,q(d.getState());let S=d.subscribe(y=>q(y));return()=>{S(),d.destroy(),p.current===d&&(p.current=null)}},[]),ge(()=>{_!==void 0&&p.current?.setValue(_)},[_]),ge(()=>{P!==void 0&&p.current?.setCompletedParams(P)},[P]);let j=JSON.stringify(l??null),G=D(o),F=D(0);if(o!==G.current){let d=G.current,S=o,y=Object.keys(d??{}),le=Object.keys(S??{});(y.length!==le.length||le.some(ee=>!d?.[ee]||S[ee]!==d[ee]))&&F.current++,G.current=o}ge(()=>{p.current?.update({apiConfig:l,optionOverrides:o,dropdownTrigger:i,optionsPosition:u,closeDropdownOnBlur:h,showNonTappableOptions:v})},[j,F.current,i,u,h,v]);let Y=D(!1);ge(()=>{if(!Y.current){Y.current=!0;return}p.current?.update({products:$.config})},[$.enabled]);let z=D(null);z.current===null&&(z.current={handleTextChange:d=>p.current?.handleTextChange(d),handleKeyDown:d=>{let S="nativeEvent"in d?d.nativeEvent:d;p.current?.handleKeyDown(S)},setFocused:d=>p.current?.setFocused(d),startEditingParam:d=>p.current?.startEditingParam(d),exitEditMode:()=>p.current?.exitEditMode(),handleCaretAfterInput:d=>p.current?.handleCaretAfterInput(d),handleCaretMove:d=>p.current?.handleCaretMove(d),replaceEditingRange:d=>p.current?.replaceEditingRange(d)??!1,setActivePill:d=>p.current?.setActivePill(d),removeLastParam:()=>p.current?.removeLastParam(),clearNewParamId:()=>p.current?.clearNewParamId(),reset:()=>p.current?.reset(),selectOption:d=>p.current?.selectOption(d),selectProduct:d=>p.current?.selectProduct(d),setActiveDropdownIndex:d=>p.current?.setActiveDropdownIndex(d),handleFocus:()=>p.current?.setFocused(!0),handleBlur:()=>p.current?.setFocused(!1)});let t=z.current,c=st(d=>{let S=d.target.value,le=S.length>0&&!d.nativeEvent?.isComposing&&S[0]!==S[0].toUpperCase()?S[0].toUpperCase()+S.slice(1):S;p.current?.handleTextChange(le)},[]),m=st(d=>{p.current?.handleKeyDown(d.nativeEvent)},[]),b=p.current,a=Z??Jt,I=_!==void 0?_:a.text,Q=P!==void 0?P:a.completedParams,K=a.actionableSuggestions,be=K[0],se=b?.listboxId??"",Se=a.activeDropdownIndex>=0&&b?`${se}-option-${a.activeDropdownIndex}`:void 0,re=a.editingParam,ue=re?{type:re.suggestionType,text:re.suggestionPlaceholder,required:!0,options:re.options}:null,ve=ue??be,Ae=ue?[ue]:K,xe=!b||a.isLoading&&!a.editingParam&&!a.inSelectionAnimation;return{completedParams:Q,skippedParams:a.skippedParams,suggestionPills:K,setActivePill:t.setActivePill,removeLastParam:t.removeLastParam,segments:a.segments,newParamId:a.newParamId,clearNewParamId:t.clearNewParamId,suggestions:a.suggestions,activeIndex:a.activeDropdownIndex,isReady:a.isReady,isLoading:xe,isFocused:a.isFocused,isDropdownOpen:a.isDropdownOpen,isActivePillSelected:a.isActivePillSelected,placeholderText:a.placeholderText,listboxId:se,error:a.error,products:a.products,selectProduct:t.selectProduct,handleTextChange:t.handleTextChange,handleKeyDown:t.handleKeyDown,setFocused:t.setFocused,editingParam:re,editingAnchor:a.editingAnchor,caretOffset:a.caretOffset,startEditingParam:t.startEditingParam,exitEditMode:t.exitEditMode,handleCaretAfterInput:t.handleCaretAfterInput,handleCaretMove:t.handleCaretMove,replaceEditingRange:t.replaceEditingRange,inputProps:{value:I,placeholder:a.placeholderText||void 0,onChange:c,onKeyDown:m,onFocus:t.handleFocus,onBlur:t.handleBlur,role:"combobox","aria-expanded":a.isDropdownOpen,"aria-activedescendant":Se,"aria-autocomplete":"list","aria-controls":se},reset:t.reset,dropdownProps:{suggestions:ve?[{...ve,options:a.filteredOptions}]:[],activeIndex:a.activeDropdownIndex,onSelect:t.selectOption,onHighlight:t.setActiveDropdownIndex,isOpen:a.isDropdownOpen,id:se,pills:Ae,activeSelected:a.isActivePillSelected,onPillClick:t.setActivePill,isLoading:xe,isInputEmpty:I.trim().length===0,products:a.products,onProductSelect:t.selectProduct,onProductFocusChange:t.setFocused,optionsPosition:u??"below"}}}import{extractPlainText as lt,getCursorOffset as dt,plainTextLength as Zt,renderEditableContent as Yt,setCursorOffset as pt}from"@magicx-eng/ai-autocomplete-vanilla";import{useCallback as N,useEffect as Me,useLayoutEffect as Oe,useRef as pe}from"react";var Ie;function ea(){if(Ie!==void 0)return Ie;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ie=e.contentEditable==="plaintext-only",Ie}function ct(e){let{segments:n,newParamId:o,editingParam:r,editingAnchor:l,caretOffset:s,placeholderText:i,isFocused:u,isDropdownOpen:h,listboxId:v,activeDescendantId:k,autoFocus:f,handleTextChange:_,handleKeyDown:P,handleCaretAfterInput:W,handleCaretMove:U,startEditingParam:J,replaceEditingRange:V,setFocused:C}=e,x=pe(null),p=pe(!1),Z=pe(""),q=pe(""),T=pe(null),E=pe(0);T.current=s,Me(()=>{if(!f)return;let t=x.current;if(!t)return;document.activeElement===t?C(!0):t.focus();let c=t.ownerDocument??document,m=c.getSelection(),b=m&&m.rangeCount>0&&t.contains(m.anchorNode);if(m&&!b){let a=c.createRange();a.selectNodeContents(t),a.collapse(!0),m.removeAllRanges(),m.addRange(a)}},[f,C]),Me(()=>{let t=x.current;if(!t)return;let c=t.ownerDocument??document,m=()=>{let b=c.getSelection();if(!b||b.rangeCount===0||!b.anchorNode||!t.contains(b.anchorNode))return;let a=b.anchorNode,I=a.nodeType===Node.ELEMENT_NODE?a:a.parentElement,K=(b.isCollapsed?I?.closest('strong[data-seg="completed"][data-param-id]'):null)?.dataset.paramId??null;if(K&&K!==r?.id){J(K);return}performance.now()-E.current<50||U(dt(t))};return c.addEventListener("selectionchange",m),()=>c.removeEventListener("selectionchange",m)},[r,J,U]),Oe(()=>{let t=x.current;t&&Yt({input:t,segments:n,newParamId:o,editingParamId:r?.id??null,placeholderText:i??"",isFocused:u})},[n,o,r,i,u]),Oe(()=>{let t=Z.current,c=o??"";if(Z.current=c,!c||c===t)return;let m=x.current;if(!m)return;m.focus();let b=T.current??Zt(m);pt(m,b)},[o]),Oe(()=>{let t=q.current,c=r?.id??"";if(q.current=c,!c||c===t||l==null)return;let m=x.current;m&&pt(m,l)},[r,l]);let A=N(()=>{if(p.current)return;let t=x.current;if(!t)return;let c=lt(t),b=c.length>0&&c[0]!==c[0].toUpperCase()?c[0].toUpperCase()+c.slice(1):c;_(b)},[_]),g=N(()=>{E.current=performance.now(),A();let t=x.current;t&&W(dt(t))},[A,W]);Me(()=>{let t=x.current;if(!t)return;let c=m=>{let b=m,a=b.inputType;if(a==="insertParagraph"||a==="insertLineBreak"||a==="insertFromDrop"){m.preventDefault();return}if(a.startsWith("insert")||a.startsWith("delete")){let I=a.startsWith("delete")?"":b.data??"";V(I)&&m.preventDefault()}};return t.addEventListener("beforeinput",c),()=>t.removeEventListener("beforeinput",c)},[V]);let L=N(()=>{p.current=!0},[]),B=N(()=>{p.current=!1,A()},[A]),R=N(t=>{t.preventDefault();let c=x.current;if(!c)return;let m=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!m)return;let b=c.ownerDocument??document,a=b.getSelection();if(!a||a.rangeCount===0)return;let I=a.getRangeAt(0);if(!c.contains(I.startContainer))return;I.deleteContents();let Q=b.createTextNode(m);I.insertNode(Q),I.setStartAfter(Q),I.collapse(!0),a.removeAllRanges(),a.addRange(I),A()},[A]),H=N(t=>P(t),[P]),$=N(()=>C(!0),[C]),j=N(()=>C(!1),[C]),G=N(()=>x.current?.focus(),[]),F=N(()=>x.current?.blur(),[]),Y=N(()=>{let t=x.current;return t?lt(t):""},[]),z=ea()?"plaintext-only":"true";return{inputRef:x,editorProps:{ref:x,contentEditable:z,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":v,"aria-expanded":h,"aria-activedescendant":k,spellCheck:!0,enterKeyHint:"send",onInput:g,onKeyDown:H,onCompositionStart:L,onCompositionEnd:B,onPaste:R,onFocus:$,onBlur:j},getPlainText:Y,focus:G,blur:F}}import{jsx as ce,jsxs as He}from"react/jsx-runtime";function sa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var la=ta(function({onSubmit:n,onError:o,optionOverrides:r,maskCompletedText:l,className:s,apiConfig:i,columns:u,pillPlacement:h="dropdown",mode:v="auto",optionsPosition:k="below",animations:f=!0,dropdownTrigger:_,closeDropdownOnBlur:P,showNonTappableOptions:W,autoFocus:U=!0,onFocus:J,onBlur:V,value:C,completedParams:x,onChange:p,onParamsChange:Z,products:q,onProductSelect:T,submitButton:E},A){let g=fe(null),L=fe(null),B=fe(()=>{}),R=fe(null),H=fe(null);ut(()=>{let w=g.current;if(w)return R.current?R.current.setMode(v):R.current=new ra(w,v),()=>{R.current?.destroy(),R.current=null}},[v]);let $=Ne(w=>{let te=H.current?.current;te&&(te.focus(),na(te,w))},[]),{completedParams:j,skippedParams:G,suggestionPills:F,setActivePill:Y,segments:z,newParamId:t,clearNewParamId:c,placeholderText:m,isFocused:b,isDropdownOpen:a,isActivePillSelected:I,isLoading:Q,activeIndex:K,listboxId:be,handleTextChange:se,handleKeyDown:Se,setFocused:re,editingParam:ue,editingAnchor:ve,caretOffset:Ae,startEditingParam:xe,handleCaretAfterInput:d,handleCaretMove:S,replaceEditingRange:y,dropdownProps:le,reset:ee}=Fe({onSubmit:w=>B.current(w),onError:o,optionOverrides:r,maskCompletedText:l,apiConfig:i,columns:u,dropdownTrigger:_,optionsPosition:k,closeDropdownOnBlur:P,showNonTappableOptions:W,onFocus:J,onBlur:V,value:C,completedParams:x,onChange:p,onParamsChange:Z,products:q,onProductSelect:T,source:"full-sdk",setCursor:$});ut(()=>{if(!t)return;let w=window.setTimeout(()=>c(),650);return()=>window.clearTimeout(w)},[t,c]);let mt=K>=0?`${be}-option-${K}`:void 0,{inputRef:Ce,editorProps:ht,focus:we,blur:Ge,getPlainText:Ke}=ct({segments:z,newParamId:t,editingParam:ue,editingAnchor:ve,caretOffset:Ae,placeholderText:m,isFocused:b,isDropdownOpen:a,listboxId:be,activeDescendantId:mt,autoFocus:U,handleTextChange:se,handleKeyDown:Se,handleCaretAfterInput:d,handleCaretMove:S,startEditingParam:xe,replaceEditingRange:y,setFocused:re});H.current=Ce,oa(()=>{let w=L.current,te=Ce.current;if(!w||!te)return;let We=()=>{let Ve=w.firstElementChild;if(!Ve)return;let vt=Ve.getBoundingClientRect(),xt=te.getBoundingClientRect();vt.top>=xt.bottom-2?w.setAttribute("data-aia-pill-wrapped",""):w.removeAttribute("data-aia-pill-wrapped")};We();let Ue=new ResizeObserver(We);return Ue.observe(te),()=>Ue.disconnect()},[z,F.length,Q,Ce]),aa(A,()=>({focus:we,blur:Ge,reset:ee,setMode:w=>R.current?.setMode(w)}),[we,Ge,ee]);let ye=!!z.length||j.length>0,Ee=Ne(()=>{if(!ye)return;let w=Ke();n(ia(w,j,G)),ee()},[ye,j,G,n,ee,Ke]);B.current=Ee;let gt=Ne(w=>{w.target?.closest("[data-aia-pill]")||we()},[we]),ft=h==="inline",bt=h==="dropdown";return He("div",{ref:g,className:`magicx-aia ${ne.container} ${s??""}`,"data-pill-placement":h,"data-options-position":k,"data-animations":f?"on":"off","data-mode":sa(v),children:[ce(ze,{...le,showPills:bt}),He("div",{className:ne.inputWrapper,onClick:gt,children:[He("div",{className:ne.editorArea,"data-aia-editor":"",children:[ce("div",{...ht,className:ne.input,"data-aia-input":""}),ft&&(Q||F.length>0)&&ce("span",{ref:L,className:ne.pillListContainer,"data-aia-pill-list-container":"",children:ce(_e,{pills:F,activePillIndex:0,activeSelected:I,onSelectPill:Y,loading:Q})})]}),E===null?null:E===void 0?ce(it,{disabled:!ye,onClick:Ee}):ce("span",{"data-aia-submit":"",className:ne.submitSlot,onClick:w=>{ye&&(w.stopPropagation(),Ee())},children:E})]})]})});export{la as AIAutocomplete,ze as AIAutocompleteDropdown,No as buildSubmitResult,Fe as useAIAutocomplete,Ho as withSkippedParams};
|
|
1426
1449
|
//# sourceMappingURL=index.mjs.map
|