@magicx-eng/ai-autocomplete-react 0.1.10 → 0.1.12
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.d.mts +2 -1
- package/dist/index.d.ts +2 -1
- package/dist/index.js +6 -55
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +6 -55
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -1,57 +1,8 @@
|
|
|
1
|
-
import{forwardRef as
|
|
1
|
+
import{forwardRef as gt,useCallback as ft,useEffect as bt,useImperativeHandle as ht,useRef as He}from"react";if(typeof document<"u"&&!document.getElementById("ac-style-cc65f4cc")){let e=document.createElement("style");e.id="ac-style-cc65f4cc",e.textContent=`.AIAutocomplete-module_container_KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
font-family: "IBM Plex Sans", sans-serif;
|
|
4
4
|
}
|
|
5
5
|
|
|
6
|
-
.AIAutocomplete-module_checkmark_CVE0Z {
|
|
7
|
-
position: absolute;
|
|
8
|
-
bottom: -130px;
|
|
9
|
-
left: 50%;
|
|
10
|
-
transform: translateX(-50%) translateY(8px) scale(0.8);
|
|
11
|
-
opacity: 0;
|
|
12
|
-
pointer-events: none;
|
|
13
|
-
z-index: 10;
|
|
14
|
-
animation: none;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
.AIAutocomplete-module_checkmarkVisible_DWYbI {
|
|
18
|
-
animation: AIAutocomplete-module_checkmarkFadeInOut_U1Oof 3s ease forwards;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
@keyframes AIAutocomplete-module_checkmarkFadeInOut_U1Oof {
|
|
22
|
-
0% {
|
|
23
|
-
opacity: 0;
|
|
24
|
-
transform: translateX(-50%) translateY(8px) scale(0.8);
|
|
25
|
-
}
|
|
26
|
-
10% {
|
|
27
|
-
opacity: 1;
|
|
28
|
-
transform: translateX(-50%) translateY(0) scale(1);
|
|
29
|
-
}
|
|
30
|
-
80% {
|
|
31
|
-
opacity: 1;
|
|
32
|
-
transform: translateX(-50%) translateY(0) scale(1);
|
|
33
|
-
}
|
|
34
|
-
100% {
|
|
35
|
-
opacity: 0;
|
|
36
|
-
transform: translateX(-50%) translateY(-8px) scale(0.8);
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
.AIAutocomplete-module_checkmarkPath_BJRUs {
|
|
41
|
-
stroke-dasharray: 30;
|
|
42
|
-
stroke-dashoffset: 30;
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
.AIAutocomplete-module_checkmarkVisible_DWYbI .AIAutocomplete-module_checkmarkPath_BJRUs {
|
|
46
|
-
animation: AIAutocomplete-module_drawCheck_je-B3 0.4s ease forwards 0.1s;
|
|
47
|
-
}
|
|
48
|
-
|
|
49
|
-
@keyframes AIAutocomplete-module_drawCheck_je-B3 {
|
|
50
|
-
to {
|
|
51
|
-
stroke-dashoffset: 0;
|
|
52
|
-
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
6
|
.AIAutocomplete-module_inputWrapper_FLq1b {
|
|
56
7
|
min-height: 60px;
|
|
57
8
|
padding: 24px;
|
|
@@ -135,7 +86,7 @@ import{forwardRef as bt,useCallback as yt,useEffect as At,useImperativeHandle as
|
|
|
135
86
|
.AIAutocomplete-module_submitButton_sl1Mi:hover {
|
|
136
87
|
opacity: 0.85;
|
|
137
88
|
}
|
|
138
|
-
`,document.head.appendChild(e)}var
|
|
89
|
+
`,document.head.appendChild(e)}var F={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",sizerContent:"AIAutocomplete-module_sizerContent_DQgmV",sizerText:"AIAutocomplete-module_sizerText_iZIMK",placeholderText:"AIAutocomplete-module_placeholderText_K3ayy",textarea:"AIAutocomplete-module_textarea_eyn6A",submitButton:"AIAutocomplete-module_submitButton_sl1Mi"};if(typeof document<"u"&&!document.getElementById("ac-style-2eef895d")){let e=document.createElement("style");e.id="ac-style-2eef895d",e.textContent=`.AIAutocompleteDropdown-module_dropdown_yz2KC {
|
|
139
90
|
position: absolute;
|
|
140
91
|
left: 0;
|
|
141
92
|
right: 0;
|
|
@@ -154,7 +105,7 @@ import{forwardRef as bt,useCallback as yt,useEffect as At,useImperativeHandle as
|
|
|
154
105
|
opacity: 1;
|
|
155
106
|
pointer-events: auto;
|
|
156
107
|
}
|
|
157
|
-
`,document.head.appendChild(e)}var
|
|
108
|
+
`,document.head.appendChild(e)}var he={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj"};if(typeof document<"u"&&!document.getElementById("ac-style-d91f2b06")){let e=document.createElement("style");e.id="ac-style-d91f2b06",e.textContent=`.SuggestionGrid-module_grid_jvaPb {
|
|
158
109
|
display: grid;
|
|
159
110
|
grid-template-columns: 1fr 1fr;
|
|
160
111
|
gap: 12px 18px;
|
|
@@ -177,7 +128,7 @@ import{forwardRef as bt,useCallback as yt,useEffect as At,useImperativeHandle as
|
|
|
177
128
|
background: rgba(255, 255, 255, 0.3);
|
|
178
129
|
border-radius: 3px;
|
|
179
130
|
}
|
|
180
|
-
`,document.head.appendChild(e)}var Oe={grid:"SuggestionGrid-module_grid_jvaPb"};if(typeof document<"u"){let e=document.createElement("style");e.textContent=`.SuggestionItem-module_item_d4vpD {
|
|
131
|
+
`,document.head.appendChild(e)}var Oe={grid:"SuggestionGrid-module_grid_jvaPb"};if(typeof document<"u"&&!document.getElementById("ac-style-f6bdc634")){let e=document.createElement("style");e.id="ac-style-f6bdc634",e.textContent=`.SuggestionItem-module_item_d4vpD {
|
|
181
132
|
display: flex;
|
|
182
133
|
align-items: center;
|
|
183
134
|
font-family: "IBM Plex Sans", sans-serif;
|
|
@@ -218,7 +169,7 @@ import{forwardRef as bt,useCallback as yt,useEffect as At,useImperativeHandle as
|
|
|
218
169
|
margin-left: 6px;
|
|
219
170
|
opacity: 0.5;
|
|
220
171
|
}
|
|
221
|
-
`,document.head.appendChild(e)}var G={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe"};import{jsx as ot,jsxs as nt}from"react/jsx-runtime";function Re({option:e,isHighlighted:r,onSelect:t,onHighlight:o,id:n}){let i=[G.item,r?G.highlighted:"",e.is_tappable?G.tappable:G.nonTappable].filter(Boolean).join(" ");return nt("div",{id:n,role:"option","aria-selected":r,className:i,tabIndex:e.is_tappable?0:-1,onClick:()=>e.is_tappable&&t(e),onKeyDown:s=>{e.is_tappable&&(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t(e))},onMouseEnter:o,children:[e.icon?`${e.icon} ${e.text}`:e.text,e.tag&&ot("span",{className:G.tag,children:e.tag})]})}import{jsx as
|
|
172
|
+
`,document.head.appendChild(e)}var G={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe"};import{jsx as ot,jsxs as nt}from"react/jsx-runtime";function Re({option:e,isHighlighted:r,onSelect:t,onHighlight:o,id:n}){let i=[G.item,r?G.highlighted:"",e.is_tappable?G.tappable:G.nonTappable].filter(Boolean).join(" ");return nt("div",{id:n,role:"option","aria-selected":r,className:i,tabIndex:e.is_tappable?0:-1,onClick:()=>e.is_tappable&&t(e),onKeyDown:s=>{e.is_tappable&&(s.key==="Enter"||s.key===" ")&&(s.preventDefault(),t(e))},onMouseEnter:o,children:[e.icon?`${e.icon} ${e.text}`:e.text,e.tag&&ot("span",{className:G.tag,children:e.tag})]})}import{jsx as ke}from"react/jsx-runtime";function Me({options:e,activeIndex:r,onSelect:t,onHighlight:o,listboxId:n}){return ke("div",{className:Oe.grid,children:e.map((i,s)=>ke(Re,{option:i,isHighlighted:s===r,onSelect:t,onHighlight:()=>o(s),id:`${n}-option-${s}`},i.text))})}import{jsx as Te}from"react/jsx-runtime";function ye({suggestions:e,activeIndex:r,onSelect:t,onHighlight:o,isOpen:n,id:i,className:s}){let p=e[0]?.options??[],g=n&&p.length>0;return Te("div",{id:i,role:"listbox",className:`${he.dropdown} ${g?he.visible:""} ${s??""}`,onMouseDown:c=>c.preventDefault(),children:p.length>0&&Te(Me,{options:p,activeIndex:r,onSelect:t,onHighlight:o,listboxId:i})})}if(typeof document<"u"&&!document.getElementById("ac-style-b745b4fb")){let e=document.createElement("style");e.id="ac-style-b745b4fb",e.textContent=`.PillList-module_list_qvLqO {
|
|
222
173
|
position: relative;
|
|
223
174
|
z-index: 1;
|
|
224
175
|
pointer-events: auto;
|
|
@@ -260,5 +211,5 @@ import{forwardRef as bt,useCallback as yt,useEffect as At,useImperativeHandle as
|
|
|
260
211
|
opacity: 0;
|
|
261
212
|
}
|
|
262
213
|
}
|
|
263
|
-
`,document.head.appendChild(e)}var re={list:"PillList-module_list_qvLqO",pill:"PillList-module_pill_osSyz",fadeIn:"PillList-module_fadeIn_Aezob",active:"PillList-module_active_Oll--"};import{jsx as Le}from"react/jsx-runtime";function rt(e){return e===0?.4:e===1?.3:.15}function Ue({pills:e,activePillIndex:r,onSelectPill:t}){return Le("span",{className:re.list,children:e.map((o,n)=>Le("button",{type:"button",className:`${re.pill} ${n===r?re.active:""}`,style:{opacity:rt(n)},onClick:()=>t(n),children:o.text},`${o.type}-${o.text}`))})}import{useCallback as J,useMemo as ae,useRef as E,useState as se}from"react";function ie(e,r){if(!e)return[];let t=r.trimStart();if(!t)return e;let o=t.toLowerCase();return e.filter(n=>!n.is_tappable||n.text.toLowerCase().includes(o))}function ee(e,r){if(!e)return null;let t=r.trim();if(!t)return null;let o=t.toLowerCase();return e.find(n=>n.is_tappable&&n.text.toLowerCase()===o)??null}function De(e,r){let t=[],o=0;for(let i of r){let s=e.indexOf(i.text,o);s!==-1&&(s>o&&t.push({type:"text",value:e.slice(o,s)}),t.push({type:"completed",value:i.text,param:i}),o=s+i.text.length)}let n=e.slice(o);return n&&t.push({type:"text",value:n}),t}function Ke(e,r){let t=[],o=[],n=0;for(let i of r){let s=e.indexOf(i.text,n);s===-1?o.push(i):(t.push(i),n=s+i.text.length)}return{valid:t,invalid:o}}import{useCallback as pt,useEffect as Ne,useRef as Z,useState as Ae}from"react";var it="0.1.10",at="/ac/suggest",je=!1;function st(e){let r=e?.apiKey||""||"";return!r&&!je&&(je=!0,console.warn("[AIAutocomplete] No API key set (MAGICX_AI_AUTOCOMPLETE_API_KEY). Requests will be sent without an Authorization header.")),r}function lt(e){return e?.authScheme?e.authScheme:""==="Basic"?"Basic":"Bearer"}function ct(){return crypto.randomUUID()}function ut(e,r){return{placeholder:e.placeholder,type:e.type,...r&&{text:e.text},kind:e.kind}}async function Fe(e,r,t){let o=t?.apiConfig,n=st(o),i=lt(o),s=!t?.maskCompletedText,p=r.find(l=>l.type==="contact"&&l.metadata?.contact_account_count)?.metadata?.contact_account_count,g=typeof p=="number"?p:void 0,f={data:{raw_query:e,completed_params:r.map(l=>ut(l,s)),...g!=null&&{contact_account_count:g}},meta:{request_id:ct(),request_at:new Date().toISOString(),language:typeof navigator<"u"?navigator.language:"en-US",client_version:it}},m={"Content-Type":"application/json","X-App-Identifier":"active-campaign-demo",...o?.headers};n&&(m.Authorization=i==="Basic"?`Basic ${btoa(n)}`:`Bearer ${n}`);let h=await fetch(o?.endpoint||at,{method:"POST",headers:m,body:JSON.stringify(f),signal:t?.signal});if(!h.ok)throw new Error(`API error: ${h.status} ${h.statusText}`);return h.json()}function Y(e,r){let t=e,o={},n=[];for(let i of r){let s=(o[i.type]??0)+1;o[i.type]=s;let g=`{{${i.type.toUpperCase().replace(/\s+/g,"_")}_${s}}}`,f=t.indexOf(i.text);f!==-1&&(t=t.slice(0,f)+g+t.slice(f+i.text.length)),n.push({...i,placeholder:g})}return{rawQuery:t,completedParams:n}}function ze(e,r){return r?e.map(t=>{let o=r[t.type];if(!o)return t;let n=o("");if(n.length===0)return t;let i=new Set(n.map(p=>p.text)),s=(t.options??[]).filter(p=>!i.has(p.text));return{...t,options:[...n,...s]}}):e}var mt=100,dt=300,gt=2;function Be({textRef:e,suggestionsRef:r,filterBaseRef:t,maskCompletedTextRef:o,apiConfigRef:n,optionOverridesRef:i,onErrorRef:s,setCompletedParams:p,setSuggestions:g,setActiveDropdownIndex:f}){let[m,h]=Ae(!1),[l,y]=Ae(null),[I,b]=Ae(!1),P=Z(0),M=Z(null),d=Z(""),c=pt(async(a,u)=>{M.current?.abort();let _=new AbortController;M.current=_;let C=++P.current,k=e.current.length;r.current.some(v=>v.type!=="placeholder")||h(!0),y(null);try{let v=await Fe(a,u,{maskCompletedText:o.current,signal:_.signal,apiConfig:n.current});if(C!==P.current)return;let U=ze(v.data.suggestions??[],i.current);b(v.data.is_ready??!1),d.current=a;let B=v.data.input??[],R=B[B.length-1],T=e.current;if(R?.state==="in_progress"){let j=T.toLowerCase().lastIndexOf(R.text.toLowerCase());j!==-1?t.current=j:t.current=k}else t.current=k;let D=U.filter(j=>j.type!=="placeholder")[0];if(D){let j=T.slice(t.current),w=ee(D.options,j);w&&(p(F=>[...F,{id:crypto.randomUUID(),placeholder:"",type:D.type,text:w.text,kind:w.kind,suggestionType:D.type,suggestionPlaceholder:D.text,options:D.options,metadata:w.metadata}]),U=U.filter(F=>F!==D))}g(U),h(!1),f(-1)}catch(v){if(C===P.current){let U=v instanceof Error?v:new Error(String(v));y(U),h(!1),s.current?.(U)}}},[e,r,t,o,n,i,s,p,g,f]);return Ne(()=>(c("",[]),()=>{M.current?.abort()}),[c]),{doFetch:c,isLoading:m,error:l,isReady:I,lastRawQueryRef:d}}function $e({text:e,completedParams:r,doFetch:t,filterBaseRef:o,skipNextFetchRef:n,suggestionsRef:i,lastRawQueryRef:s}){let p=Z(null),g=Z(null),f=Z(!0);Ne(()=>{p.current&&clearTimeout(p.current),g.current&&clearTimeout(g.current);let m=h=>{if(n.current)return n.current=!1,!1;if(!e&&r.length===0)return f.current?(t("",[]),!0):(f.current=!0,!1);let l=e.slice(o.current),b=i.current.filter(k=>k.type!=="placeholder")[0],M=(b?ie(b.options,l):[]).filter(k=>k.is_tappable),d=b?ee(b.options,l)!==null:!1,c=l.trim().length>0;if(M.length>0&&!d&&c)return!1;let{rawQuery:a,completedParams:u}=Y(e,r),_=a.length<s.current.length,C=Math.abs(a.length-s.current.length);return _||C>=h?(t(a,u),!0):!1};return p.current=setTimeout(()=>{m(gt)&&g.current&&clearTimeout(g.current)},mt),g.current=setTimeout(()=>m(1),dt),()=>{p.current&&clearTimeout(p.current),g.current&&clearTimeout(g.current)}},[e,r,t,o,n,i,s])}import{useCallback as qe}from"react";function Qe({activeDropdownIndex:e,setActiveDropdownIndex:r,filteredOptions:t,selectOption:o,onSubmitRef:n,text:i,completedParams:s,isDropdownOpen:p,hasPlaceholder:g,placeholderText:f,suggestions:m,filterBaseRef:h,columns:l,setText:y,setCompletedParams:I,setSuggestions:b}){let P=qe(()=>{let d=t.map((a,u)=>a.is_tappable?u:-1).filter(a=>a!==-1),c=Array.from({length:l},()=>[]);for(let a of d)c[a%l].push(a);return c.flat()},[t,l]);return{handleKeyDown:qe(d=>{let c=P();switch(d.key){case"ArrowDown":{if(d.preventDefault(),c.length===0)return;let a=c.indexOf(e),u=a<c.length-1?a+1:0;r(c[u]);break}case"ArrowUp":{if(d.preventDefault(),c.length===0)return;let a=c.indexOf(e),u=a>0?a-1:c.length-1;r(c[u]);break}case"ArrowRight":{if(e<0)break;if(e%l<l-1){let u=e+1;u<t.length&&t[u]?.is_tappable&&(d.preventDefault(),r(u))}break}case"ArrowLeft":{if(e<0)break;if(e%l>0){let a=e-1;a>=0&&t[a]?.is_tappable&&(d.preventDefault(),r(a))}break}case"Enter":{if(d.preventDefault(),e>=0&&t[e]?.is_tappable)o(t[e]);else if(n.current){let{rawQuery:a,completedParams:u}=Y(i,s),_={query:i.trim(),raw_query:a,completed_params:u};n.current(_)}break}case"Tab":{if(e>=0&&t[e]?.is_tappable)d.preventDefault(),o(t[e]);else if(p){let a=t.find(u=>u.is_tappable);a&&(d.preventDefault(),o(a))}else if(!i&&g){d.preventDefault();let a=m.find(u=>u.type==="placeholder");a?(y(f),h.current=f.length,I(u=>[...u,{id:crypto.randomUUID(),placeholder:"",type:a.type,text:f,kind:null,suggestionType:a.type,suggestionPlaceholder:a.text,options:a.options}]),b(u=>u.filter(_=>_!==a))):(y(f),h.current=f.length)}break}case"Escape":r(-1);break}},[e,l,s,t,h,P,g,p,n,f,o,r,I,b,y,m,i]),getTappableIndices:P}}import{useCallback as _e}from"react";function He({completedParams:e,suggestions:r,setCompletedParams:t,setSuggestions:o,setActiveDropdownIndex:n,filterBaseRef:i,pillTappedRef:s}){let p=_e(m=>{let h=r.filter(b=>b.type!=="placeholder");if(m<0||m>=h.length)return;let l=h[m],y=h.filter((b,P)=>P!==m),I=r.filter(b=>b.type==="placeholder");o([...I,l,...y]),s.current=!0,n(-1)},[r,o,n,s]),g=_e(()=>{if(e.length===0)return;let m=e[e.length-1],h={type:m.suggestionType,text:m.suggestionPlaceholder,required:!0,options:m.options};t(l=>l.slice(0,-1)),o(l=>[h,...l]),n(-1)},[e,t,o,n]),f=_e(m=>{let h={type:m.suggestionType,text:m.suggestionPlaceholder,required:!0,options:m.options};return{apply:l=>{l(y=>{let I=0;for(let b of e){let P=y.indexOf(b.text,I);if(P!==-1){if(b.id===m.id){let M=y.slice(0,P),d=y.slice(P+m.text.length),c=(M+d).replace(/ {2,}/g," ");return i.current=Math.min(i.current,c.length),c}I=P+b.text.length}}return y}),t(y=>y.filter(I=>I.id!==m.id)),o(y=>[h,...y]),n(-1),s.current=!0}}},[e,t,o,n,i,s]);return{setActivePill:p,removeLastParam:g,reEditParam:f}}var ft=0;function ht(){let e=E(null);return e.current===null&&(e.current=`:ac-${++ft}:`),e.current}function Se({onSubmit:e,onError:r,optionOverrides:t,maskCompletedText:o,placeholder:n,apiConfig:i,columns:s=2,eagerSuggestions:p=!0,value:g,completedParams:f,onChange:m,onParamsChange:h}){let l=g!==void 0,y=f!==void 0,[I,b]=se(""),[P,M]=se([]),[d,c]=se([]),[a,u]=se(-1),_=l?g:I,C=y?f:P,k=E(e);k.current=e;let q=E(m);q.current=m;let v=E(h);v.current=h;let U=E(g);U.current=g;let B=E(f);B.current=f;let R=J(A=>{if(typeof A=="function")if(l){let x=A(U.current??"");q.current?.(x)}else b(x=>{let $=A(x);return q.current?.($),$});else l||b(A),q.current?.(A)},[l]),T=J(A=>{if(typeof A=="function")if(y){let x=A(B.current??[]);v.current?.(x)}else M(x=>{let $=A(x);return v.current?.($),$});else y||M(A),v.current?.(A)},[y]),W=E(r);W.current=r;let D=E(t);D.current=t;let j=E(o);j.current=o;let w=E(i);w.current=i;let F=E(_);F.current=_;let le=E(d);le.current=d;let z=E(0),te=E(!1),Pe=E(!1),ce=ht(),{doFetch:ue,isLoading:ve,error:Ve,isReady:We,lastRawQueryRef:pe}=Be({textRef:F,suggestionsRef:le,filterBaseRef:z,maskCompletedTextRef:j,apiConfigRef:w,optionOverridesRef:D,onErrorRef:W,setCompletedParams:T,setSuggestions:c,setActiveDropdownIndex:u});$e({text:_,completedParams:C,doFetch:ue,filterBaseRef:z,skipNextFetchRef:Pe,suggestionsRef:le,lastRawQueryRef:pe});let Xe=ae(()=>De(_,C),[_,C]);z.current=Math.min(z.current,_.length);let me=_.slice(z.current),de=ae(()=>d.filter(x=>x.type==="placeholder").map(x=>x.text).join(" ")||n||"",[d,n]),oe=ae(()=>d.filter(A=>A.type!=="placeholder"),[d]),S=oe[0],Ie=S?t?.[S.type]:void 0,Ce=S?Ie?Ie(me.trim()):S.options??[]:[],ge=ae(()=>ie(Ce,me),[Ce,me]),ke=de.length>0,fe=!ve&&ge.length>0&&(!!_||te.current||!ke),we=J(A=>{if(!S)return;let x={id:crypto.randomUUID(),placeholder:"",type:S.type,text:A.text,kind:A.kind,suggestionType:S.type,suggestionPlaceholder:S.text,options:S.options,metadata:A.metadata},$=z.current,L=F.current.slice(0,$);if(L.length>0&&!L.endsWith(" ")){let O=L.split(/\s+/).pop()??"";O&&A.text.toLowerCase().startsWith(O.toLowerCase())&&(L=L.slice(0,L.length-O.length))}let he=L.length>0&&L[L.length-1]!==" ",X=L+(he?" ":"")+A.text+" ";R(X),z.current=X.length,T(O=>[...O,x]),te.current=!1,u(-1);let Q=oe.length-1;p&&Q>0?(c(O=>O.filter(H=>H!==S)),Pe.current=!0):c(O=>O.filter(H=>H.type==="placeholder"))},[S,oe,p,R,T]),Ge=J(A=>{let x=A.target.value,L=x.length>0&&!A.nativeEvent?.isComposing&&x[0]!==x[0].toUpperCase()?x[0].toUpperCase()+x.slice(1):x;R(L),te.current=!1,u(-1);let{valid:he,invalid:X}=Ke(L,C);if(X.length>0){T(()=>he);for(let Q of X)c(O=>[{type:Q.suggestionType,text:Q.suggestionPlaceholder,required:!0,options:Q.options},...O])}if(S&&X.length===0){let Q=L.slice(z.current),O=ee(S.options,Q);O&&(T(H=>[...H,{id:crypto.randomUUID(),placeholder:"",type:S.type,text:O.text,kind:O.kind,suggestionType:S.type,suggestionPlaceholder:S.text,options:S.options,metadata:O.metadata}]),c(H=>H.filter(tt=>tt!==S)))}},[C,S,R,T]),{handleKeyDown:Ye}=Qe({activeDropdownIndex:a,setActiveDropdownIndex:u,filteredOptions:ge,selectOption:we,onSubmitRef:k,text:_,completedParams:C,isDropdownOpen:fe,hasPlaceholder:ke,placeholderText:de,suggestions:d,filterBaseRef:z,columns:s,setText:R,setCompletedParams:T,setSuggestions:c}),ne=He({completedParams:C,suggestions:d,setCompletedParams:T,setSuggestions:c,setActiveDropdownIndex:u,filterBaseRef:z,pillTappedRef:te}),Ze=J(A=>{ne.reEditParam(A).apply(R)},[ne,R]),Je=J(()=>{R(""),T(()=>[]),c([]),u(-1),z.current=0,pe.current="",ue("",[])},[ue,R,T,pe]),et=a>=0?`${ce}-option-${a}`:void 0;return{completedParams:C,suggestionPills:oe,setActivePill:ne.setActivePill,removeLastParam:ne.removeLastParam,reEditParam:Ze,segments:Xe,suggestions:d,activeIndex:a,isReady:We,isLoading:ve,error:Ve,inputProps:{value:_,placeholder:de||void 0,onChange:Ge,onKeyDown:Ye,role:"combobox","aria-expanded":fe,"aria-activedescendant":et,"aria-autocomplete":"list","aria-controls":ce},reset:Je,dropdownProps:{suggestions:S?[{...S,options:ge}]:[],activeIndex:a,onSelect:we,onHighlight:u,isOpen:fe,id:ce}}}import{jsx as N,jsxs as V}from"react/jsx-runtime";var xt=bt(function({onSubmit:r,onError:t,optionOverrides:o,maskCompletedText:n,placeholder:i,className:s,apiConfig:p,columns:g,eagerSuggestions:f,value:m,completedParams:h,onChange:l,onParamsChange:y},I){let b=xe(null),[P,M]=St(!1),d=xe(()=>{}),c=xe(void 0);At(()=>(b.current?.focus(),()=>clearTimeout(c.current)),[]);let{completedParams:a,suggestionPills:u,setActivePill:_,segments:C,inputProps:k,dropdownProps:q,reset:v}=Se({onSubmit:w=>d.current(w),onError:t,optionOverrides:o,maskCompletedText:n,placeholder:i,apiConfig:p,columns:g,eagerSuggestions:f,value:m,completedParams:h,onChange:l,onParamsChange:y});_t(I,()=>({focus:()=>b.current?.focus(),reset:v}),[v]);let U=()=>{b.current?.focus()},B=!!k.value||a.length>0,R=yt(()=>{if(!B)return;let{rawQuery:w,completedParams:F}=Y(k.value,a);r({query:k.value.trim(),raw_query:w,completed_params:F}),v(),M(!0),clearTimeout(c.current),c.current=setTimeout(()=>M(!1),3e3)},[B,k.value,a,r,v]);d.current=R;let{onChange:T,placeholder:W,...D}=k,j=!k.value;return V("div",{className:`${K.container} ${s??""}`,children:[N("div",{className:`${K.checkmark} ${P?K.checkmarkVisible:""}`,children:V("svg",{width:"72",height:"72",viewBox:"0 0 24 24",fill:"none",role:"img","aria-label":"Success",children:[N("circle",{cx:"12",cy:"12",r:"12",fill:"#34C759"}),N("path",{d:"M7 12.5l3.5 3.5L17 9",stroke:"#000",strokeWidth:"2.5",strokeLinecap:"round",strokeLinejoin:"round",className:K.checkmarkPath})]})}),N(ye,{...q}),V("div",{className:K.inputWrapper,onClick:U,children:[V("div",{className:K.editorArea,children:[V("div",{className:K.sizerContent,"aria-hidden":"true",children:[j&&W?V("span",{className:K.placeholderText,children:[W," "]}):V("span",{className:K.sizerText,children:[C.map((w,F)=>N("span",{children:w.value},`${F}-${w.type}`)),C.length===0&&"\xA0"]})," ",N(Ue,{pills:u,activePillIndex:0,onSelectPill:_})]}),N("textarea",{ref:b,className:K.textarea,rows:1,onChange:T,...D})]}),N("button",{type:"button",className:K.submitButton,disabled:!B,onClick:w=>{w.stopPropagation(),R()},"aria-label":"Submit",children:N("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:N("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})});export{xt as AIAutocomplete,ye as AIAutocompleteDropdown,Se as useAIAutocomplete};
|
|
214
|
+
`,document.head.appendChild(e)}var re={list:"PillList-module_list_qvLqO",pill:"PillList-module_pill_osSyz",fadeIn:"PillList-module_fadeIn_Aezob",active:"PillList-module_active_Oll--"};import{jsx as Ee}from"react/jsx-runtime";function rt(e){return e===0?.4:e===1?.3:.15}function Le({pills:e,activePillIndex:r,onSelectPill:t}){return Ee("span",{className:re.list,children:e.map((o,n)=>Ee("button",{type:"button",className:`${re.pill} ${n===r?re.active:""}`,style:{opacity:rt(n)},onClick:()=>t(n),children:o.text},`${o.type}-${o.text}`))})}import{useCallback as J,useMemo as ae,useRef as k,useState as se}from"react";function ie(e,r){if(!e)return[];let t=r.trimStart();if(!t)return e;let o=t.toLowerCase();return e.filter(n=>!n.is_tappable||n.text.toLowerCase().includes(o))}function ee(e,r){if(!e)return null;let t=r.trim();if(!t)return null;let o=t.toLowerCase();return e.find(n=>n.is_tappable&&n.text.toLowerCase()===o)??null}function Ue(e,r){let t=[],o=0;for(let i of r){let s=e.indexOf(i.text,o);s!==-1&&(s>o&&t.push({type:"text",value:e.slice(o,s)}),t.push({type:"completed",value:i.text,param:i}),o=s+i.text.length)}let n=e.slice(o);return n&&t.push({type:"text",value:n}),t}function Ke(e,r){let t=[],o=[],n=0;for(let i of r){let s=e.indexOf(i.text,n);s===-1?o.push(i):(t.push(i),n=s+i.text.length)}return{valid:t,invalid:o}}import{useCallback as lt,useEffect as Fe,useRef as Z,useState as Se}from"react";var it="0.1.12",De=!1;function at(){return crypto.randomUUID()}function st(e,r){return{placeholder:e.placeholder,type:e.type,...r&&{text:e.text},kind:e.kind}}async function ze(e,r,t){let o=t?.apiConfig,n=o?.apiKey??"";!n&&!De&&(De=!0,console.warn("[AIAutocomplete] No apiKey in apiConfig. Requests will be sent without an Authorization header."));let i=o?.authScheme??"Bearer",s=!t?.maskCompletedText,f=r.find(u=>u.type==="contact"&&u.metadata?.contact_account_count)?.metadata?.contact_account_count,p=typeof f=="number"?f:void 0,g={data:{raw_query:e,completed_params:r.map(u=>st(u,s)),...p!=null&&{contact_account_count:p}},meta:{request_id:at(),request_at:new Date().toISOString(),language:typeof navigator<"u"?navigator.language:"en-US",client_version:it}},c={"Content-Type":"application/json",...o?.appIdentifier&&{"X-App-Identifier":o.appIdentifier},...o?.headers};n&&(c.Authorization=i==="Basic"?`Basic ${btoa(n)}`:`Bearer ${n}`);let b=await fetch(o?.endpoint??"/ac/suggest",{method:"POST",headers:c,body:JSON.stringify(g),signal:t?.signal});if(!b.ok)throw new Error(`API error: ${b.status} ${b.statusText}`);return b.json()}function X(e,r){let t=e,o={},n=[];for(let i of r){let s=(o[i.type]??0)+1;o[i.type]=s;let p=`{{${i.type.toUpperCase().replace(/\s+/g,"_")}_${s}}}`,g=t.indexOf(i.text);g!==-1&&(t=t.slice(0,g)+p+t.slice(g+i.text.length)),n.push({...i,placeholder:p})}return{rawQuery:t,completedParams:n}}function je(e,r){return r?e.map(t=>{let o=r[t.type];if(!o)return t;let n=o("");if(n.length===0)return t;let i=new Set(n.map(f=>f.text)),s=(t.options??[]).filter(f=>!i.has(f.text));return{...t,options:[...n,...s]}}):e}var ct=100,ut=300,pt=2;function qe({textRef:e,suggestionsRef:r,filterBaseRef:t,maskCompletedTextRef:o,apiConfigRef:n,optionOverridesRef:i,onErrorRef:s,setCompletedParams:f,setSuggestions:p,setActiveDropdownIndex:g}){let[c,b]=Se(!1),[u,y]=Se(null),[I,h]=Se(!1),_=Z(0),O=Z(null),m=Z(""),d=lt(async(a,l)=>{O.current?.abort();let x=new AbortController;O.current=x;let v=++_.current,K=e.current.length;r.current.some(C=>C.type!=="placeholder")||b(!0),y(null);try{let C=await ze(a,l,{maskCompletedText:o.current,signal:x.signal,apiConfig:n.current});if(v!==_.current)return;let L=je(C.data.suggestions??[],i.current);h(C.data.is_ready??!1),m.current=a;let q=C.data.input??[],M=q[q.length-1],R=e.current;if(M?.state==="in_progress"){let j=R.toLowerCase().lastIndexOf(M.text.toLowerCase());j!==-1?t.current=j:t.current=K}else t.current=K;let T=L.filter(j=>j.type!=="placeholder")[0];if(T){let j=R.slice(t.current),$=ee(T.options,j);$&&(f(B=>[...B,{id:crypto.randomUUID(),placeholder:"",type:T.type,text:$.text,kind:$.kind,suggestionType:T.type,suggestionPlaceholder:T.text,options:T.options??[],metadata:$.metadata}]),L=L.filter(B=>B!==T))}p(L),b(!1),g(-1)}catch(C){if(v===_.current){let L=C instanceof Error?C:new Error(String(C));y(L),b(!1),s.current?.(L)}}},[e,r,t,o,n,i,s,f,p,g]);return Fe(()=>(d("",[]),()=>{O.current?.abort()}),[d]),{doFetch:d,isLoading:c,error:u,isReady:I,lastRawQueryRef:m}}function Ne({text:e,completedParams:r,doFetch:t,filterBaseRef:o,skipNextFetchRef:n,suggestionsRef:i,lastRawQueryRef:s}){let f=Z(null),p=Z(null),g=Z(!0);Fe(()=>{f.current&&clearTimeout(f.current),p.current&&clearTimeout(p.current);let c=b=>{if(n.current)return n.current=!1,!1;if(!e&&r.length===0)return g.current?(t("",[]),!0):(g.current=!0,!1);let u=e.slice(o.current),h=i.current.filter(K=>K.type!=="placeholder")[0],O=(h?ie(h.options,u):[]).filter(K=>K.is_tappable),m=h?ee(h.options,u)!==null:!1,d=u.trim().length>0;if(O.length>0&&!m&&d)return!1;let{rawQuery:a,completedParams:l}=X(e,r),x=a.length<s.current.length,v=Math.abs(a.length-s.current.length);return x||v>=b?(t(a,l),!0):!1};return f.current=setTimeout(()=>{c(pt)&&p.current&&clearTimeout(p.current)},ct),p.current=setTimeout(()=>c(1),ut),()=>{f.current&&clearTimeout(f.current),p.current&&clearTimeout(p.current)}},[e,r,t,o,n,i,s])}import{useCallback as $e}from"react";function Be({activeDropdownIndex:e,setActiveDropdownIndex:r,filteredOptions:t,selectOption:o,onSubmitRef:n,text:i,completedParams:s,isDropdownOpen:f,hasPlaceholder:p,placeholderText:g,suggestions:c,filterBaseRef:b,columns:u,setText:y,setCompletedParams:I,setSuggestions:h}){let _=$e(()=>{let m=t.map((a,l)=>a.is_tappable?l:-1).filter(a=>a!==-1),d=Array.from({length:u},()=>[]);for(let a of m)d[a%u].push(a);return d.flat()},[t,u]);return{handleKeyDown:$e(m=>{let d=_();switch(m.key){case"ArrowDown":{if(m.preventDefault(),d.length===0)return;let a=d.indexOf(e),l=a<d.length-1?a+1:0;r(d[l]);break}case"ArrowUp":{if(m.preventDefault(),d.length===0)return;let a=d.indexOf(e),l=a>0?a-1:d.length-1;r(d[l]);break}case"ArrowRight":{if(e<0)break;if(e%u<u-1){let l=e+1;l<t.length&&t[l]?.is_tappable&&(m.preventDefault(),r(l))}break}case"ArrowLeft":{if(e<0)break;if(e%u>0){let a=e-1;a>=0&&t[a]?.is_tappable&&(m.preventDefault(),r(a))}break}case"Enter":{if(m.preventDefault(),e>=0&&t[e]?.is_tappable)o(t[e]);else if(n.current){let{rawQuery:a,completedParams:l}=X(i,s),x={query:i.trim(),raw_query:a,completed_params:l};n.current(x)}break}case"Tab":{if(e>=0&&t[e]?.is_tappable)m.preventDefault(),o(t[e]);else if(f){let a=t.find(l=>l.is_tappable);a&&(m.preventDefault(),o(a))}else if(!i&&p){m.preventDefault();let a=c.find(l=>l.type==="placeholder");a?(y(g),b.current=g.length,I(l=>[...l,{id:crypto.randomUUID(),placeholder:"",type:a.type,text:g,kind:null,suggestionType:a.type,suggestionPlaceholder:a.text,options:a.options??[]}]),h(l=>l.filter(x=>x!==a))):(y(g),b.current=g.length)}break}case"Escape":r(-1);break}},[e,u,s,t,b,_,p,f,n,g,o,r,I,h,y,c,i]),getTappableIndices:_}}import{useCallback as xe}from"react";function Qe({completedParams:e,suggestions:r,setCompletedParams:t,setSuggestions:o,setActiveDropdownIndex:n,filterBaseRef:i,pillTappedRef:s}){let f=xe(c=>{let b=r.filter(h=>h.type!=="placeholder");if(c<0||c>=b.length)return;let u=b[c],y=b.filter((h,_)=>_!==c),I=r.filter(h=>h.type==="placeholder");o([...I,u,...y]),s.current=!0,n(-1)},[r,o,n,s]),p=xe(()=>{if(e.length===0)return;let c=e[e.length-1],b={type:c.suggestionType,text:c.suggestionPlaceholder,required:!0,options:c.options};t(u=>u.slice(0,-1)),o(u=>[b,...u]),n(-1)},[e,t,o,n]),g=xe(c=>{let b={type:c.suggestionType,text:c.suggestionPlaceholder,required:!0,options:c.options};return{apply:u=>{u(y=>{let I=0;for(let h of e){let _=y.indexOf(h.text,I);if(_!==-1){if(h.id===c.id){let O=y.slice(0,_),m=y.slice(_+c.text.length),d=(O+m).replace(/ {2,}/g," ");return i.current=Math.min(i.current,d.length),d}I=_+h.text.length}}return y}),t(y=>y.filter(I=>I.id!==c.id)),o(y=>[b,...y]),n(-1),s.current=!0}}},[e,t,o,n,i,s]);return{setActivePill:f,removeLastParam:p,reEditParam:g}}var dt=0;function mt(){let e=k(null);return e.current===null&&(e.current=`:ac-${++dt}:`),e.current}function Ae({onSubmit:e,onError:r,optionOverrides:t,maskCompletedText:o,placeholder:n,apiConfig:i,columns:s=2,eagerSuggestions:f=!0,value:p,completedParams:g,onChange:c,onParamsChange:b}){let u=p!==void 0,y=g!==void 0,[I,h]=se(""),[_,O]=se([]),[m,d]=se([]),[a,l]=se(-1),x=u?p:I,v=y?g:_,K=k(e);K.current=e;let z=k(c);z.current=c;let C=k(b);C.current=b;let L=k(p);L.current=p;let q=k(g);q.current=g;let M=J(S=>{if(typeof S=="function")if(u){let P=S(L.current??"");z.current?.(P)}else h(P=>{let N=S(P);return z.current?.(N),N});else u||h(S),z.current?.(S)},[u]),R=J(S=>{if(typeof S=="function")if(y){let P=S(q.current??[]);C.current?.(P)}else O(P=>{let N=S(P);return C.current?.(N),N});else y||O(S),C.current?.(S)},[y]),U=k(r);U.current=r;let T=k(t);T.current=t;let j=k(o);j.current=o;let $=k(i);$.current=i;let B=k(x);B.current=x;let le=k(m);le.current=m;let D=k(0),te=k(!1),_e=k(!1),ce=mt(),{doFetch:ue,isLoading:Pe,error:We,isReady:Ve,lastRawQueryRef:pe}=qe({textRef:B,suggestionsRef:le,filterBaseRef:D,maskCompletedTextRef:j,apiConfigRef:$,optionOverridesRef:T,onErrorRef:U,setCompletedParams:R,setSuggestions:d,setActiveDropdownIndex:l});Ne({text:x,completedParams:v,doFetch:ue,filterBaseRef:D,skipNextFetchRef:_e,suggestionsRef:le,lastRawQueryRef:pe});let Ge=ae(()=>Ue(x,v),[x,v]);D.current=Math.min(D.current,x.length);let de=x.slice(D.current),me=ae(()=>m.filter(P=>P.type==="placeholder").map(P=>P.text).join(" ")||n||"",[m,n]),oe=ae(()=>m.filter(S=>S.type!=="placeholder"),[m]),A=oe[0],ve=A?t?.[A.type]:void 0,Ce=A?ve?ve(de.trim()):A.options??[]:[],ge=ae(()=>ie(Ce,de),[Ce,de]),Ie=me.length>0,fe=!Pe&&ge.length>0&&(!!x||te.current||!Ie),we=J(S=>{if(!A)return;let P={id:crypto.randomUUID(),placeholder:"",type:A.type,text:S.text,kind:S.kind,suggestionType:A.type,suggestionPlaceholder:A.text,options:A.options??[],metadata:S.metadata},N=D.current,E=B.current.slice(0,N);if(E.length>0&&!E.endsWith(" ")){let w=E.split(/\s+/).pop()??"";w&&S.text.toLowerCase().startsWith(w.toLowerCase())&&(E=E.slice(0,E.length-w.length))}let be=E.length>0&&E[E.length-1]!==" ",V=E+(be?" ":"")+S.text+" ";M(V),D.current=V.length,R(w=>[...w,P]),te.current=!1,l(-1);let Q=oe.length-1;f&&Q>0?(d(w=>w.filter(H=>H!==A)),_e.current=!0):d(w=>w.filter(H=>H.type==="placeholder"))},[A,oe,f,M,R]),Xe=J(S=>{let P=S.target.value,E=P.length>0&&!S.nativeEvent?.isComposing&&P[0]!==P[0].toUpperCase()?P[0].toUpperCase()+P.slice(1):P;M(E),te.current=!1,l(-1);let{valid:be,invalid:V}=Ke(E,v);if(V.length>0){R(()=>be);for(let Q of V)d(w=>[{type:Q.suggestionType,text:Q.suggestionPlaceholder,required:!0,options:Q.options},...w])}if(A&&V.length===0){let Q=E.slice(D.current),w=ee(A.options,Q);w&&(R(H=>[...H,{id:crypto.randomUUID(),placeholder:"",type:A.type,text:w.text,kind:w.kind,suggestionType:A.type,suggestionPlaceholder:A.text,options:A.options??[],metadata:w.metadata}]),d(H=>H.filter(tt=>tt!==A)))}},[v,A,M,R]),{handleKeyDown:Ze}=Be({activeDropdownIndex:a,setActiveDropdownIndex:l,filteredOptions:ge,selectOption:we,onSubmitRef:K,text:x,completedParams:v,isDropdownOpen:fe,hasPlaceholder:Ie,placeholderText:me,suggestions:m,filterBaseRef:D,columns:s,setText:M,setCompletedParams:R,setSuggestions:d}),ne=Qe({completedParams:v,suggestions:m,setCompletedParams:R,setSuggestions:d,setActiveDropdownIndex:l,filterBaseRef:D,pillTappedRef:te}),Je=J(S=>{ne.reEditParam(S).apply(M)},[ne,M]),Ye=J(()=>{M(""),R(()=>[]),d([]),l(-1),D.current=0,pe.current="",ue("",[])},[ue,M,R,pe]),et=a>=0?`${ce}-option-${a}`:void 0;return{completedParams:v,suggestionPills:oe,setActivePill:ne.setActivePill,removeLastParam:ne.removeLastParam,reEditParam:Je,segments:Ge,suggestions:m,activeIndex:a,isReady:Ve,isLoading:Pe,error:We,inputProps:{value:x,placeholder:me||void 0,onChange:Xe,onKeyDown:Ze,role:"combobox","aria-expanded":fe,"aria-activedescendant":et,"aria-autocomplete":"list","aria-controls":ce},reset:Ye,dropdownProps:{suggestions:A?[{...A,options:ge}]:[],activeIndex:a,onSelect:we,onHighlight:l,isOpen:fe,id:ce}}}import{jsx as W,jsxs as Y}from"react/jsx-runtime";var yt=gt(function({onSubmit:r,onError:t,optionOverrides:o,maskCompletedText:n,placeholder:i,className:s,apiConfig:f,columns:p,eagerSuggestions:g,value:c,completedParams:b,onChange:u,onParamsChange:y},I){let h=He(null),_=He(()=>{});bt(()=>{h.current?.focus()},[]);let{completedParams:O,suggestionPills:m,setActivePill:d,segments:a,inputProps:l,dropdownProps:x,reset:v}=Ae({onSubmit:U=>_.current(U),onError:t,optionOverrides:o,maskCompletedText:n,placeholder:i,apiConfig:f,columns:p,eagerSuggestions:g,value:c,completedParams:b,onChange:u,onParamsChange:y});ht(I,()=>({focus:()=>h.current?.focus(),reset:v}),[v]);let K=()=>{h.current?.focus()},z=!!l.value||O.length>0,C=ft(()=>{if(!z)return;let{rawQuery:U,completedParams:T}=X(l.value,O);r({query:l.value.trim(),raw_query:U,completed_params:T}),v()},[z,l.value,O,r,v]);_.current=C;let{onChange:L,placeholder:q,...M}=l,R=!l.value;return Y("div",{className:`${F.container} ${s??""}`,children:[W(ye,{...x}),Y("div",{className:F.inputWrapper,onClick:K,children:[Y("div",{className:F.editorArea,children:[Y("div",{className:F.sizerContent,"aria-hidden":"true",children:[R&&q?Y("span",{className:F.placeholderText,children:[q," "]}):Y("span",{className:F.sizerText,children:[a.map((U,T)=>W("span",{children:U.value},`${T}-${U.type}`)),a.length===0&&"\xA0"]})," ",W(Le,{pills:m,activePillIndex:0,onSelectPill:d})]}),W("textarea",{ref:h,className:F.textarea,rows:1,onChange:L,...M})]}),W("button",{type:"button",className:F.submitButton,disabled:!z,onClick:U=>{U.stopPropagation(),C()},"aria-label":"Submit",children:W("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:W("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})]})]})});export{yt as AIAutocomplete,ye as AIAutocompleteDropdown,Ae as useAIAutocomplete};
|
|
264
215
|
//# sourceMappingURL=index.mjs.map
|