@magicx-eng/ai-autocomplete-react 0.11.0 → 0.12.0
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 +1 -0
- package/dist/index.d.mts +15 -1
- package/dist/index.d.ts +15 -1
- package/dist/index.js +12 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -230,6 +230,7 @@ function App() {
|
|
|
230
230
|
| `onError?` | `(error: Error) => void` | — | Called when a fetch fails. |
|
|
231
231
|
| `apiConfig?` | `APIConfig` | — | Runtime API configuration (see below). |
|
|
232
232
|
| `additionalContext?` | `Record<string, unknown>` | — | Optional user context. Include whatever you know about the user (a profile, preferences, workspace, anything) to personalize suggested parameters and options to them. |
|
|
233
|
+
| `generateStartingStateOptions?` | `boolean` | `false` | When `true`, each time the query is empty, the initial suggestions are generated fresh — personalized to `additionalContext` when set — instead of the fixed defaults. The initial placeholder text itself is unchanged. |
|
|
233
234
|
| `optionOverrides?` | `Record<string, (query: string) => SuggestionOption[]>` | — | Override options per suggestion type. |
|
|
234
235
|
| `maskCompletedText?` | `boolean` | `false` | When `true`, omits completed params' literal text from API requests (for masking PII/sensitive values from the server). |
|
|
235
236
|
| `className?` | `string` | — | CSS class applied to the container. |
|
package/dist/index.d.mts
CHANGED
|
@@ -31,6 +31,13 @@ interface AIAutocompleteProps {
|
|
|
31
31
|
* comparison used for `apiConfig`).
|
|
32
32
|
*/
|
|
33
33
|
additionalContext?: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* When true, each time the query is empty, the initial suggestions are
|
|
36
|
+
* generated fresh — personalized to `additionalContext` when set —
|
|
37
|
+
* instead of the fixed defaults. The initial placeholder text itself is
|
|
38
|
+
* unchanged. Default: false.
|
|
39
|
+
*/
|
|
40
|
+
generateStartingStateOptions?: boolean;
|
|
34
41
|
columns?: number;
|
|
35
42
|
/** Where to render unfilled pills. "dropdown" (default) renders them above the options grid; "inline" renders them in the input. */
|
|
36
43
|
pillPlacement?: "inline" | "dropdown" | "hidden";
|
|
@@ -115,6 +122,13 @@ interface UseAIAutocompleteOptions {
|
|
|
115
122
|
* comparison used for `apiConfig`).
|
|
116
123
|
*/
|
|
117
124
|
additionalContext?: Record<string, unknown>;
|
|
125
|
+
/**
|
|
126
|
+
* When true, each time the query is empty, the initial suggestions are
|
|
127
|
+
* generated fresh — personalized to `additionalContext` when set —
|
|
128
|
+
* instead of the fixed defaults. The initial placeholder text itself is
|
|
129
|
+
* unchanged. Default: false.
|
|
130
|
+
*/
|
|
131
|
+
generateStartingStateOptions?: boolean;
|
|
118
132
|
columns?: number;
|
|
119
133
|
/**
|
|
120
134
|
* SDK surface identifier for telemetry. Set automatically by the Tier 1
|
|
@@ -346,6 +360,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
|
|
|
346
360
|
|
|
347
361
|
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
348
362
|
|
|
349
|
-
declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
363
|
+
declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, generateStartingStateOptions, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
350
364
|
|
|
351
365
|
export { AIAutocomplete, AIAutocompleteDropdown, type AIAutocompleteDropdownProps, type AIAutocompleteHandle, type AIAutocompleteProps, type UseAIAutocompleteOptions, type UseAIAutocompleteReturn, useAIAutocomplete };
|
package/dist/index.d.ts
CHANGED
|
@@ -31,6 +31,13 @@ interface AIAutocompleteProps {
|
|
|
31
31
|
* comparison used for `apiConfig`).
|
|
32
32
|
*/
|
|
33
33
|
additionalContext?: Record<string, unknown>;
|
|
34
|
+
/**
|
|
35
|
+
* When true, each time the query is empty, the initial suggestions are
|
|
36
|
+
* generated fresh — personalized to `additionalContext` when set —
|
|
37
|
+
* instead of the fixed defaults. The initial placeholder text itself is
|
|
38
|
+
* unchanged. Default: false.
|
|
39
|
+
*/
|
|
40
|
+
generateStartingStateOptions?: boolean;
|
|
34
41
|
columns?: number;
|
|
35
42
|
/** Where to render unfilled pills. "dropdown" (default) renders them above the options grid; "inline" renders them in the input. */
|
|
36
43
|
pillPlacement?: "inline" | "dropdown" | "hidden";
|
|
@@ -115,6 +122,13 @@ interface UseAIAutocompleteOptions {
|
|
|
115
122
|
* comparison used for `apiConfig`).
|
|
116
123
|
*/
|
|
117
124
|
additionalContext?: Record<string, unknown>;
|
|
125
|
+
/**
|
|
126
|
+
* When true, each time the query is empty, the initial suggestions are
|
|
127
|
+
* generated fresh — personalized to `additionalContext` when set —
|
|
128
|
+
* instead of the fixed defaults. The initial placeholder text itself is
|
|
129
|
+
* unchanged. Default: false.
|
|
130
|
+
*/
|
|
131
|
+
generateStartingStateOptions?: boolean;
|
|
118
132
|
columns?: number;
|
|
119
133
|
/**
|
|
120
134
|
* SDK surface identifier for telemetry. Set automatically by the Tier 1
|
|
@@ -346,6 +360,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
|
|
|
346
360
|
|
|
347
361
|
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
348
362
|
|
|
349
|
-
declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
363
|
+
declare function useAIAutocomplete({ onSubmit, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, generateStartingStateOptions, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showSkipButton, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
350
364
|
|
|
351
365
|
export { AIAutocomplete, AIAutocompleteDropdown, type AIAutocompleteDropdownProps, type AIAutocompleteHandle, type AIAutocompleteProps, type UseAIAutocompleteOptions, type UseAIAutocompleteReturn, useAIAutocomplete };
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var
|
|
1
|
+
"use strict";var Ve=Object.defineProperty;var At=Object.getOwnPropertyDescriptor;var Ct=Object.getOwnPropertyNames;var Et=Object.prototype.hasOwnProperty;var Dt=(e,a)=>{for(var t in a)Ve(e,t,{get:a[t],enumerable:!0})},Rt=(e,a,t,r)=>{if(a&&typeof a=="object"||typeof a=="function")for(let n of Ct(a))!Et.call(e,n)&&n!==t&&Ve(e,n,{get:()=>a[n],enumerable:!(r=At(a,n))||r.enumerable});return e};var Tt=e=>Rt(Ve({},"__esModule",{value:!0}),e);var Kt={};Dt(Kt,{AIAutocomplete:()=>xt,AIAutocompleteDropdown:()=>Fe,buildSubmitResult:()=>He.buildSubmitResult,useAIAutocomplete:()=>Ne,withSkippedParams:()=>He.withSkippedParams});module.exports=Tt(Kt);var He=require("@magicx-eng/ai-autocomplete-vanilla");var S=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.AIAutocomplete-module_container_KKjFU {
|
|
2
2
|
position: relative;
|
|
3
3
|
/* Inherits the host page's font by default. Consumers can pin a specific
|
|
4
4
|
font on the library via \`--aia-font-family: 'Custom Font'\` without
|
|
@@ -179,7 +179,7 @@
|
|
|
179
179
|
opacity: 0;
|
|
180
180
|
}
|
|
181
181
|
}
|
|
182
|
-
`,document.head.appendChild(e)}var
|
|
182
|
+
`,document.head.appendChild(e)}var me={container:"AIAutocomplete-module_container_KKjFU",inputWrapper:"AIAutocomplete-module_inputWrapper_FLq1b",editorArea:"AIAutocomplete-module_editorArea_7rBWq",input:"AIAutocomplete-module_input_IW-P-",pillListContainer:"AIAutocomplete-module_pillListContainer_h92IA",submitSlot:"AIAutocomplete-module_submitSlot_GhuCM",aiaPillReveal:"AIAutocomplete-module_aiaPillReveal_wf05b"};var we=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
183
183
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
184
184
|
* Consumer CSS always wins without !important.
|
|
185
185
|
*
|
|
@@ -665,7 +665,7 @@
|
|
|
665
665
|
opacity: 0.25;
|
|
666
666
|
}
|
|
667
667
|
}
|
|
668
|
-
`,document.head.appendChild(e)}var de={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var
|
|
668
|
+
`,document.head.appendChild(e)}var de={dropdown:"AIAutocompleteDropdown-module_dropdown_yz2KC",visible:"AIAutocompleteDropdown-module_visible_QCoXj",pillBar:"AIAutocompleteDropdown-module_pillBar_pwTXe",pillScroll:"AIAutocompleteDropdown-module_pillScroll_Tpzus",skip:"AIAutocompleteDropdown-module_skip_7-olS",skeletonBars:"AIAutocompleteDropdown-module_skeletonBars_HVr9C",skeletonBar:"AIAutocompleteDropdown-module_skeletonBar_O3xIx",aiaSkeletonPulse:"AIAutocompleteDropdown-module_aiaSkeletonPulse_G8W7q"};var be=require("@magicx-eng/ai-autocomplete-vanilla"),Te=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`@layer layout {
|
|
669
669
|
.aia-cluster {
|
|
670
670
|
display: flex;
|
|
671
671
|
flex-wrap: wrap;
|
|
@@ -707,7 +707,7 @@
|
|
|
707
707
|
justify-content: space-around;
|
|
708
708
|
}
|
|
709
709
|
}
|
|
710
|
-
`,document.head.appendChild(e)}var
|
|
710
|
+
`,document.head.appendChild(e)}var qe=require("react/jsx-runtime");function Pe({gap:e,align:a="center",justify:t="start",noWrap:r=!1,inline:n=!1,className:l,children:i,...g}){let w=e?{"--aia-cluster-gap":e}:void 0,y={className:l?`aia-cluster ${l}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":r||void 0,"data-inline":n||void 0,style:w,...g};return n?(0,qe.jsx)("span",{...y,children:i}):(0,qe.jsx)("div",{...y,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
|
|
711
711
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
712
712
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
713
713
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -837,7 +837,7 @@
|
|
|
837
837
|
justify-content: flex-end;
|
|
838
838
|
}
|
|
839
839
|
}
|
|
840
|
-
`,document.head.appendChild(e)}var ie={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"};var
|
|
840
|
+
`,document.head.appendChild(e)}var ie={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"};var Q=require("react/jsx-runtime");function at({isOptionHighlighted:e=!1,isInputEmpty:a=!1}){let{key:t,hint:r}=(0,be.getFooterHint)(e,a),[n,l]=(0,Te.useState)(be.ATTRIBUTION_URL);return(0,Te.useEffect)(()=>{l((0,be.buildAttributionUrl)())},[]),(0,Q.jsx)("footer",{className:ie.footer,"data-aia-footer":"",children:(0,Q.jsxs)(Pe,{justify:"between",noWrap:!0,className:ie.row,children:[(0,Q.jsxs)(Pe,{gap:"5px",className:ie.hintGroup,children:[(0,Q.jsx)("kbd",{className:ie.key,children:t}),(0,Q.jsx)("span",{className:ie.hint,children:r})]}),(0,Q.jsxs)("a",{className:ie.brandLink,href:n,target:"_blank",rel:"noopener noreferrer",children:[(0,Q.jsx)("span",{className:ie.brand,children:"AI"}),(0,Q.jsx)("span",{className:ie.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,
|
|
841
841
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
842
842
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
843
843
|
as it was when the outline was dashed. */
|
|
@@ -894,7 +894,7 @@
|
|
|
894
894
|
opacity: 0;
|
|
895
895
|
}
|
|
896
896
|
}
|
|
897
|
-
`,document.head.appendChild(e)}var pe={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var
|
|
897
|
+
`,document.head.appendChild(e)}var pe={pill:"ParamPill-module_pill_6Ga7S",fadeIn:"ParamPill-module_fadeIn_Ux4eQ",rounded:"ParamPill-module_rounded_y7xA9",skeleton:"ParamPill-module_skeleton_57P0T",skeletonPulse:"ParamPill-module_skeletonPulse_xGcUy"};var it=require("react/jsx-runtime"),$e={selected:1,first:.7,next:.4,last:.2};function ot({label:e,state:a,rounded:t,loading:r,onClick:n}){let l=[pe.pill,t?pe.rounded:"",r?pe.skeleton:""].filter(Boolean).join(" ");return(0,it.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":r?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:l,style:{opacity:$e[a]},onMouseDown:i=>i.preventDefault(),onClick:r?void 0:n,disabled:r,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.PillList-module_list_qvLqO {
|
|
898
898
|
position: relative;
|
|
899
899
|
z-index: 1;
|
|
900
900
|
pointer-events: auto;
|
|
@@ -904,7 +904,7 @@
|
|
|
904
904
|
align-items: center;
|
|
905
905
|
vertical-align: middle;
|
|
906
906
|
}
|
|
907
|
-
`,document.head.appendChild(e)}var
|
|
907
|
+
`,document.head.appendChild(e)}var je={list:"PillList-module_list_qvLqO"};var Ie=require("react/jsx-runtime"),Lt=[125,69];function rt(e){return e===0?"first":e===1?"next":"last"}function Le({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:r,rounded:n,loading:l}){return l&&e.length===0?(0,Ie.jsx)("span",{className:je.list,"data-aia-pill-list-loading":"",children:Lt.map((i,g)=>(0,Ie.jsx)("span",{"data-aia-pill-skeleton":"",className:`${pe.pill} ${n?pe.rounded:""} ${pe.skeleton}`,style:{width:i,opacity:$e[rt(g)]}},`skel-${i}`))}):(0,Ie.jsx)("span",{className:je.list,"data-aia-pill-list-loading":l?"":void 0,children:e.map((i,g)=>{let w=!!r&&g===a;return(0,Ie.jsx)(ot,{label:i.text,state:w?"selected":rt(g),selected:w,rounded:n,loading:l,onClick:()=>t(g)},`${i.type}-${i.text}`)})})}if(typeof document<"u"&&!document.getElementById("ac-style-fef1688d")){let e=document.createElement("style");e.id="ac-style-fef1688d",e.textContent=`/* Product strip \u2014 the React counterpart of the vanilla core's strip rules
|
|
908
908
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
909
909
|
theming one package sees the same result in the other.
|
|
910
910
|
|
|
@@ -1071,7 +1071,7 @@
|
|
|
1071
1071
|
var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
|
|
1072
1072
|
);
|
|
1073
1073
|
}
|
|
1074
|
-
`,document.head.appendChild(e)}var
|
|
1074
|
+
`,document.head.appendChild(e)}var U={section:"ProductStrip-module_section_Hugfg",label:"ProductStrip-module_label_nuc93",row:"ProductStrip-module_row_WDVBX",card:"ProductStrip-module_card_JBGYT",media:"ProductStrip-module_media_RrbGe",image:"ProductStrip-module_image_5pNL7",body:"ProductStrip-module_body_ly032",vendor:"ProductStrip-module_vendor_Gvu7G",title:"ProductStrip-module_title_gCNmq",price:"ProductStrip-module_price_gULcE"};var z=require("react/jsx-runtime");function nt({products:e,listboxId:a,onSelect:t,onFocusChange:r,focusable:n=!0}){if(e.length===0)return null;let l=`${a}-products-label`;return(0,z.jsxs)("section",{className:U.section,"data-aia-products":"",role:"group","aria-labelledby":l,children:[(0,z.jsx)("div",{className:U.label,id:l,children:"Products"}),(0,z.jsx)("div",{className:U.row,"data-aia-products-row":"",children:e.map((i,g)=>(0,z.jsx)(zt,{product:i,id:`${a}-product-${g}`,onSelect:t,onFocusChange:r,focusable:n},i.id))})]})}function zt({product:e,id:a,onSelect:t,onFocusChange:r,focusable:n}){let l=i=>{i.metaKey||i.ctrlKey||i.shiftKey||i.altKey||i.button!==0||(i.preventDefault(),t(e))};return(0,z.jsxs)("a",{id:a,className:U.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:n?0:-1,onClick:l,onKeyDown:i=>{i.key!=="Enter"&&i.key!==" "||(i.preventDefault(),t(e))},onFocus:()=>r?.(!0),onBlur:i=>{i.relatedTarget?.closest("[data-aia-dropdown]")||r?.(!1)},children:[(0,z.jsx)("span",{className:U.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,z.jsx)("img",{className:U.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,z.jsxs)("span",{className:U.body,children:[e.vendor?(0,z.jsx)("span",{className:U.vendor,children:e.vendor}):null,(0,z.jsx)("span",{className:U.title,children:e.title}),e.price?(0,z.jsx)("span",{className:U.price,children:e.price}):null]})]})}var xe=require("@magicx-eng/ai-autocomplete-vanilla"),Be=require("react");var st=require("@magicx-eng/ai-autocomplete-vanilla"),ze=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`@layer layout {
|
|
1075
1075
|
.aia-grid {
|
|
1076
1076
|
display: grid;
|
|
1077
1077
|
grid-template-columns: repeat(
|
|
@@ -1106,7 +1106,7 @@
|
|
|
1106
1106
|
border-radius: 3px;
|
|
1107
1107
|
}
|
|
1108
1108
|
}
|
|
1109
|
-
`,document.head.appendChild(e)}var
|
|
1109
|
+
`,document.head.appendChild(e)}var dt=require("react/jsx-runtime");function lt({min:e="16rem",max:a,gap:t,scroll:r=!1,maxHeight:n,scrollResetKey:l,cols:i,className:g,children:w,...y}){let _=(0,ze.useRef)(null);(0,ze.useLayoutEffect)(()=>{if(l===void 0)return;let M=_.current;M&&(M.scrollTop=0)},[l]);let b={"--aia-grid-min":e};return a&&(b["--aia-grid-max"]=a),t&&(b["--aia-grid-gap"]=t),n&&(b["--aia-grid-max-height"]=n),i&&(b.gridTemplateColumns=(0,st.optionsGridTemplateColumns)(i)),(0,dt.jsx)("div",{ref:_,className:g?`aia-grid ${g}`:"aia-grid","data-scroll":r||void 0,style:b,...y,children:w})}var ve=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.SuggestionItem-module_item_d4vpD {
|
|
1110
1110
|
position: relative;
|
|
1111
1111
|
overflow: visible;
|
|
1112
1112
|
display: flex;
|
|
@@ -1456,7 +1456,7 @@
|
|
|
1456
1456
|
filter: brightness(0.55);
|
|
1457
1457
|
}
|
|
1458
1458
|
}
|
|
1459
|
-
`,document.head.appendChild(e)}var
|
|
1459
|
+
`,document.head.appendChild(e)}var V={item:"SuggestionItem-module_item_d4vpD",fadeIn:"SuggestionItem-module_fadeIn_I8u35",content:"SuggestionItem-module_content_T-Qba",tappable:"SuggestionItem-module_tappable_70KcX",nonTappable:"SuggestionItem-module_nonTappable_xSZM-",highlighted:"SuggestionItem-module_highlighted_Hb0SU",tag:"SuggestionItem-module_tag_e3Fwe",pressed:"SuggestionItem-module_pressed_98o-r",glassFade:"SuggestionItem-module_glassFade_oyiSj",tapDown:"SuggestionItem-module_tapDown_G3WGz",streaks:"SuggestionItem-module_streaks_d9PEB",streaksVert:"SuggestionItem-module_streaksVert_ERlV1",streakHorizRight:"SuggestionItem-module_streakHorizRight_aboGz",streakHorizLeft:"SuggestionItem-module_streakHorizLeft_BreWJ",streakVertUp:"SuggestionItem-module_streakVertUp_to1GD",streakVertDown:"SuggestionItem-module_streakVertDown_OrcLh",skeletonPulse:"SuggestionItem-module_skeletonPulse_plvdD",text:"SuggestionItem-module_text_yqoh9"};var ce=require("react/jsx-runtime");function pt({option:e,isHighlighted:a,onSelect:t,onHighlight:r,id:n,loading:l}){let[i,g]=(0,ve.useState)(!1),w=(0,ve.useRef)(void 0);(0,ve.useEffect)(()=>()=>clearTimeout(w.current),[]);let y=()=>{l||!e.is_tappable||i||(g(!0),t(e),clearTimeout(w.current),w.current=setTimeout(()=>g(!1),500))},_=[V.item,a&&!l?V.highlighted:"",e.is_tappable?V.tappable:V.nonTappable,i?V.pressed:""].filter(Boolean).join(" ");return(0,ce.jsxs)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":l?"":void 0,"aria-selected":a,className:_,tabIndex:l||!e.is_tappable?-1:0,onClick:y,onKeyDown:b=>{!l&&e.is_tappable&&(b.key==="Enter"||b.key===" ")&&(b.preventDefault(),y())},onMouseEnter:!l&&e.is_tappable?r:void 0,children:[(0,ce.jsx)("div",{className:V.streaks}),(0,ce.jsx)("div",{className:V.streaksVert}),(0,ce.jsxs)("span",{className:V.content,children:[(0,ce.jsx)("span",{className:V.text,children:e.icon?`${e.icon} ${e.text}`:e.text}),e.tag&&(0,ce.jsx)("span",{className:V.tag,children:e.tag})]})]})}var Qe=require("react/jsx-runtime");function Bt(){let[e,a]=(0,Be.useState)(xe.isOptionsGridMobileViewport);return(0,Be.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(xe.OPTIONS_GRID_MOBILE_QUERY),r=()=>a(t.matches);return r(),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e}function ct({options:e,activeIndex:a,onSelect:t,onHighlight:r,listboxId:n,loading:l,groupKey:i}){let g=Bt(),{cols:w,maxHeight:y}=(0,xe.computeOptionsGridLayout)(e.length,g);return(0,Qe.jsx)(lt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:i,cols:w,maxHeight:y,children:e.map((_,b)=>(0,Qe.jsx)(pt,{option:_,isHighlighted:b===a,onSelect:t,onHighlight:()=>r(b),id:`${n}-option-${b}`,loading:l},_.text))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`@layer layout {
|
|
1460
1460
|
.aia-stack {
|
|
1461
1461
|
display: flex;
|
|
1462
1462
|
flex-direction: column;
|
|
@@ -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
|
|
1476
|
+
`,document.head.appendChild(e)}var mt=require("react/jsx-runtime");function ut({space:e,align:a="stretch",className:t,children:r,...n}){let l=e?{"--aia-stack-space":e}:void 0;return(0,mt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:l,...n,children:r})}var B=require("react/jsx-runtime"),Ft=[159,119,164],Mt=()=>{};function Nt(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,r]=(0,we.useState)(a);if((0,we.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),l=()=>r(n.matches);return n.addEventListener("change",l),()=>n.removeEventListener("change",l)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function Fe({suggestions:e,activeIndex:a,onSelect:t,onHighlight:r,isOpen:n,id:l,className:i,pills:g,onPillClick:w,showPills:y=!0,onSkip:_,showSkipButton:b=!0,skipDisabled:M=!1,activeSelected:J=!1,isLoading:$=!1,isInputEmpty:D=!1,products:C,onProductSelect:X,onProductFocusChange:R,optionsPosition:P="below",mode:j}){let Z=Nt(j),Y=Z!==void 0,c=e[0]?.options??[],re=!!(g&&g.length>0&&w),T=!!(C&&C.length>0),H=n&&(c.length>0||y&&re||$||T),N={suggestions:e,activeIndex:a,pills:g,showPills:y,showSkipButton:b,skipDisabled:M,activeSelected:J,isLoading:$,isInputEmpty:D,products:C},ee=(0,we.useRef)(N);H&&(ee.current=N);let h=H?N:ee.current,O=h.suggestions[0],G=O?.options??[],L=h.activeIndex>=0&&!!G[h.activeIndex]?.is_tappable,K=!!(h.pills&&h.pills.length>0&&w),te=h.showPills&&K,ae=h.showPills&&!K&&h.isLoading,W=te||ae,s=K&&h.showSkipButton&&!h.isInputEmpty&&!!_,p=h.pills?.[0]?.text,u=G.length>0,f=h.isLoading&&!u,o=h.products??[];return(0,B.jsx)("div",{id:l,role:"listbox","data-aia-dropdown":"","data-options-position":P,"data-mode":Z,"data-aia-loading":h.isLoading?"":void 0,"data-aia-has-products":o.length>0?"":void 0,className:`${Y?"magicx-aia ":""}${de.dropdown} ${H?de.visible:""} ${i??""}`,onMouseDown:I=>I.preventDefault(),children:(0,B.jsxs)(ut,{space:"8px",children:[(W||s)&&(0,B.jsxs)(Pe,{noWrap:!0,className:de.pillBar,"data-aia-pillbar":"",children:[W&&(0,B.jsx)("span",{className:de.pillScroll,"data-aia-pill-scroll":"",children:(0,B.jsx)(Le,{pills:h.pills??[],activePillIndex:0,activeSelected:h.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:h.isLoading})}),s&&(0,B.jsx)("button",{type:"button",tabIndex:-1,className:de.skip,"data-aia-skip":"",disabled:h.isLoading||h.skipDisabled,"aria-label":p?`Skip ${p}`:"Skip",onClick:_,children:"skip"})]}),u&&(0,B.jsx)(ct,{options:G,activeIndex:h.activeIndex,onSelect:t,onHighlight:r,listboxId:l,loading:h.isLoading,groupKey:O?`${O.type} ${O.text}`:""}),f&&(0,B.jsx)("div",{className:de.skeletonBars,"data-aia-skeleton-bars":"",children:Ft.map(I=>(0,B.jsx)("span",{className:de.skeletonBar,style:{width:I}},`bar-${I}`))}),(0,B.jsx)(nt,{products:o,listboxId:l,onSelect:X??Mt,onFocusChange:R,focusable:H}),(0,B.jsx)(at,{isOptionHighlighted:L,isInputEmpty:h.isInputEmpty})]})})}var ye=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;
|
|
@@ -1508,5 +1508,5 @@
|
|
|
1508
1508
|
);
|
|
1509
1509
|
cursor: default;
|
|
1510
1510
|
}
|
|
1511
|
-
`,document.head.appendChild(e)}var mt={submitButton:"SubmitButton-module_submitButton_otz7H"};var Fe=require("react/jsx-runtime");function ht({disabled:e,onClick:a}){return(0,Fe.jsx)("button",{type:"button","data-aia-submit":"",className:mt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),a()},"aria-label":"Submit",children:(0,Fe.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Fe.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var ft=require("@magicx-eng/ai-autocomplete-vanilla"),x=require("react");var Qe=require("react");function gt(e){let a=(0,Qe.useRef)(e);a.current=e;let t=(0,Qe.useRef)(null);t.current===null&&(t.current={fetch:(i,s)=>{let r=a.current;return r?r.fetch(i,s):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let o=e!==void 0;return{config:o?t.current:void 0,enabled:o}}var Nt={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 Me({onSubmit:e,onError:a,optionOverrides:t,maskCompletedText:o,apiConfig:i,additionalContext:s,columns:r=2,dropdownTrigger:h,optionsPosition:v,closeDropdownOnBlur:y,showNonTappableOptions:k,showSkipButton:w,onFocus:M,onBlur:X,value:D,completedParams:R,onChange:G,onParamsChange:Z,products:N,onProductSelect:_,source:Y,setCursor:q}){let m=(0,x.useRef)(null),[re,ee]=(0,x.useState)(null),T=(0,x.useRef)(e);T.current=e;let L=(0,x.useRef)(a);L.current=a;let $=(0,x.useRef)(G);$.current=G;let j=(0,x.useRef)(Z);j.current=Z;let g=(0,x.useRef)(M);g.current=M;let O=(0,x.useRef)(X);O.current=X;let C=(0,x.useRef)(q);C.current=q;let te=(0,x.useRef)(_);te.current=_;let K=gt(N);(0,x.useEffect)(()=>{if(typeof document>"u")return;let d=new ft.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:i,additionalContext:s,optionOverrides:t,maskCompletedText:o,columns:r,dropdownTrigger:h,optionsPosition:v,closeDropdownOnBlur:y,showNonTappableOptions:k,source:Y,value:D,completedParams:R,onSubmit:(...A)=>T.current?.(...A),onError:(...A)=>L.current?.(...A),onChange:(...A)=>$.current?.(...A),onParamsChange:(...A)=>j.current?.(...A),onFocus:()=>g.current?.(),onBlur:()=>O.current?.(),onProductSelect:A=>te.current?.(A),setCursor:A=>C.current?.(A),products:K.config});m.current=d,ee(d.getState());let E=d.subscribe(A=>ee(A));return()=>{E(),d.destroy(),m.current===d&&(m.current=null)}},[]),(0,x.useEffect)(()=>{D!==void 0&&m.current?.setValue(D)},[D]),(0,x.useEffect)(()=>{R!==void 0&&m.current?.setCompletedParams(R)},[R]);let ae=JSON.stringify(i??null),Q;try{Q=JSON.stringify(s??null)}catch{Q="[unstringifiable]"}let H=(0,x.useRef)(t),l=(0,x.useRef)(0);if(t!==H.current){let d=H.current,E=t,A=Object.keys(d??{}),ge=Object.keys(E??{});(A.length!==ge.length||ge.some(se=>!d?.[se]||E[se]!==d[se]))&&l.current++,H.current=t}(0,x.useEffect)(()=>{m.current?.update({apiConfig:i,additionalContext:s,optionOverrides:t,dropdownTrigger:h,optionsPosition:v,closeDropdownOnBlur:y,showNonTappableOptions:k})},[ae,Q,l.current,h,v,y,k]);let p=(0,x.useRef)(!1);(0,x.useEffect)(()=>{if(!p.current){p.current=!0;return}m.current?.update({products:K.config})},[K.enabled]);let u=(0,x.useRef)(null);u.current===null&&(u.current={handleTextChange:d=>m.current?.handleTextChange(d),handleKeyDown:d=>{let E="nativeEvent"in d?d.nativeEvent:d;m.current?.handleKeyDown(E)},setFocused:d=>m.current?.setFocused(d),startEditingParam:d=>m.current?.startEditingParam(d),exitEditMode:()=>m.current?.exitEditMode(),handleCaretAfterInput:d=>m.current?.handleCaretAfterInput(d),handleCaretMove:d=>m.current?.handleCaretMove(d),replaceEditingRange:d=>m.current?.replaceEditingRange(d)??!1,setActivePill:d=>m.current?.setActivePill(d),skipActivePill:()=>m.current?.skipActivePill(),removeLastParam:()=>m.current?.removeLastParam(),clearNewParamId:()=>m.current?.clearNewParamId(),reset:()=>m.current?.reset(),selectOption:d=>m.current?.selectOption(d),selectProduct:d=>m.current?.selectProduct(d),setActiveDropdownIndex:d=>m.current?.setActiveDropdownIndex(d),handleFocus:()=>m.current?.setFocused(!0),handleBlur:()=>m.current?.setFocused(!1)});let n=u.current,f=(0,x.useCallback)(d=>{let E=d.target.value,ge=E.length>0&&!d.nativeEvent?.isComposing&&E[0]!==E[0].toUpperCase()?E[0].toUpperCase()+E.slice(1):E;m.current?.handleTextChange(ge)},[]),I=(0,x.useCallback)(d=>{m.current?.handleKeyDown(d.nativeEvent)},[]),oe=m.current,c=re??Nt,Ie=D!==void 0?D:c.text,ye=R!==void 0?R:c.completedParams,me=c.actionableSuggestions,Se=me[0],he=oe?.listboxId??"",He=c.activeDropdownIndex>=0&&oe?`${he}-option-${c.activeDropdownIndex}`:void 0,ne=c.editingParam,ke=ne?{type:ne.suggestionType,text:ne.suggestionPlaceholder,required:!0,options:ne.options}:null,Ae=ke??Se,Ge=ke?[ke]:me,Ce=!oe||c.isLoading&&!c.editingParam&&!c.inSelectionAnimation;return{completedParams:ye,skippedParams:c.skippedParams,suggestionPills:me,setActivePill:n.setActivePill,skipActivePill:n.skipActivePill,removeLastParam:n.removeLastParam,segments:c.segments,newParamId:c.newParamId,clearNewParamId:n.clearNewParamId,suggestions:c.suggestions,activeIndex:c.activeDropdownIndex,isReady:c.isReady,isLoading:Ce,isFocused:c.isFocused,isDropdownOpen:c.isDropdownOpen,isActivePillSelected:c.isActivePillSelected,placeholderText:c.placeholderText,listboxId:he,error:c.error,products:c.products,selectProduct:n.selectProduct,handleTextChange:n.handleTextChange,handleKeyDown:n.handleKeyDown,setFocused:n.setFocused,editingParam:ne,editingAnchor:c.editingAnchor,caretOffset:c.caretOffset,startEditingParam:n.startEditingParam,exitEditMode:n.exitEditMode,handleCaretAfterInput:n.handleCaretAfterInput,handleCaretMove:n.handleCaretMove,replaceEditingRange:n.replaceEditingRange,inputProps:{value:Ie,placeholder:c.placeholderText||void 0,onChange:f,onKeyDown:I,onFocus:n.handleFocus,onBlur:n.handleBlur,role:"combobox","aria-expanded":c.isDropdownOpen,"aria-activedescendant":He,"aria-autocomplete":"list","aria-controls":he},reset:n.reset,dropdownProps:{suggestions:Ae?[{...Ae,options:c.filteredOptions}]:[],activeIndex:c.activeDropdownIndex,onSelect:n.selectOption,onHighlight:n.setActiveDropdownIndex,isOpen:c.isDropdownOpen,id:he,pills:Ge,activeSelected:c.isActivePillSelected,onPillClick:n.setActivePill,onSkip:n.skipActivePill,showSkipButton:(w??!0)&&!ne,skipDisabled:c.inSelectionAnimation,isLoading:Ce,isInputEmpty:Ie.trim().length===0,products:c.products,onProductSelect:n.selectProduct,onProductFocusChange:n.setFocused,optionsPosition:v??"below"}}}var F=require("@magicx-eng/ai-autocomplete-vanilla"),b=require("react"),Ne;function Ot(){if(Ne!==void 0)return Ne;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ne=e.contentEditable==="plaintext-only",Ne}function bt(e){let{segments:a,newParamId:t,editingParam:o,editingAnchor:i,caretOffset:s,placeholderText:r,isFocused:h,isDropdownOpen:v,listboxId:y,activeDescendantId:k,autoFocus:w,handleTextChange:M,handleKeyDown:X,handleCaretAfterInput:D,handleCaretMove:R,startEditingParam:G,replaceEditingRange:Z,setFocused:N}=e,_=(0,b.useRef)(null),Y=(0,b.useRef)(!1),q=(0,b.useRef)(""),m=(0,b.useRef)(""),re=(0,b.useRef)(null),ee=(0,b.useRef)(0);re.current=s,(0,b.useEffect)(()=>{if(!w)return;let l=_.current;if(!l)return;document.activeElement===l?N(!0):l.focus();let p=l.ownerDocument??document,u=p.getSelection(),n=u&&u.rangeCount>0&&l.contains(u.anchorNode);if(u&&!n){let f=p.createRange();f.selectNodeContents(l),f.collapse(!0),u.removeAllRanges(),u.addRange(f)}},[w,N]),(0,b.useEffect)(()=>{let l=_.current;if(!l)return;let p=l.ownerDocument??document,u=()=>{let n=p.getSelection();if(!n||n.rangeCount===0||!n.anchorNode||!l.contains(n.anchorNode))return;let f=n.anchorNode,I=f.nodeType===Node.ELEMENT_NODE?f:f.parentElement,c=(n.isCollapsed?I?.closest('strong[data-seg="completed"][data-param-id]'):null)?.dataset.paramId??null;if(c&&c!==o?.id){G(c);return}performance.now()-ee.current<50||R((0,F.getCursorOffset)(l))};return p.addEventListener("selectionchange",u),()=>p.removeEventListener("selectionchange",u)},[o,G,R]),(0,b.useLayoutEffect)(()=>{let l=_.current;l&&(0,F.renderEditableContent)({input:l,segments:a,newParamId:t,editingParamId:o?.id??null,placeholderText:r??"",isFocused:h})},[a,t,o,r,h]),(0,b.useLayoutEffect)(()=>{let l=q.current,p=t??"";if(q.current=p,!p||p===l)return;let u=_.current;if(!u)return;u.focus();let n=re.current??(0,F.plainTextLength)(u);(0,F.setCursorOffset)(u,n)},[t]),(0,b.useLayoutEffect)(()=>{let l=m.current,p=o?.id??"";if(m.current=p,!p||p===l||i==null)return;let u=_.current;u&&(0,F.setCursorOffset)(u,i)},[o,i]);let T=(0,b.useCallback)(()=>{if(Y.current)return;let l=_.current;if(!l)return;let p=(0,F.extractPlainText)(l),n=p.length>0&&p[0]!==p[0].toUpperCase()?p[0].toUpperCase()+p.slice(1):p;M(n)},[M]),L=(0,b.useCallback)(()=>{ee.current=performance.now(),T();let l=_.current;l&&D((0,F.getCursorOffset)(l))},[T,D]);(0,b.useEffect)(()=>{let l=_.current;if(!l)return;let p=u=>{let n=u,f=n.inputType;if(f==="insertParagraph"||f==="insertLineBreak"||f==="insertFromDrop"){u.preventDefault();return}if(f.startsWith("insert")||f.startsWith("delete")){let I=f.startsWith("delete")?"":n.data??"";Z(I)&&u.preventDefault()}};return l.addEventListener("beforeinput",p),()=>l.removeEventListener("beforeinput",p)},[Z]);let $=(0,b.useCallback)(()=>{Y.current=!0},[]),j=(0,b.useCallback)(()=>{Y.current=!1,T()},[T]),g=(0,b.useCallback)(l=>{l.preventDefault();let p=_.current;if(!p)return;let u=(l.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!u)return;let n=p.ownerDocument??document,f=n.getSelection();if(!f||f.rangeCount===0)return;let I=f.getRangeAt(0);if(!p.contains(I.startContainer))return;I.deleteContents();let oe=n.createTextNode(u);I.insertNode(oe),I.setStartAfter(oe),I.collapse(!0),f.removeAllRanges(),f.addRange(I),T()},[T]),O=(0,b.useCallback)(l=>X(l),[X]),C=(0,b.useCallback)(()=>N(!0),[N]),te=(0,b.useCallback)(()=>N(!1),[N]),K=(0,b.useCallback)(()=>_.current?.focus(),[]),ae=(0,b.useCallback)(()=>_.current?.blur(),[]),Q=(0,b.useCallback)(()=>{let l=_.current;return l?(0,F.extractPlainText)(l):""},[]),H=Ot()?"plaintext-only":"true";return{inputRef:_,editorProps:{ref:_,contentEditable:H,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":y,"aria-expanded":v,"aria-activedescendant":k,spellCheck:!0,enterKeyHint:"send",onInput:L,onKeyDown:O,onCompositionStart:$,onCompositionEnd:j,onPaste:g,onFocus:C,onBlur:te},getPlainText:Q,focus:K,blur:ae}}var V=require("react/jsx-runtime");function Ht(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var vt=(0,S.forwardRef)(function({onSubmit:a,onError:t,optionOverrides:o,maskCompletedText:i,className:s,apiConfig:r,additionalContext:h,columns:v,pillPlacement:y="dropdown",mode:k="auto",optionsPosition:w="below",animations:M=!0,dropdownTrigger:X,closeDropdownOnBlur:D,showNonTappableOptions:R,showSkipButton:G,autoFocus:Z=!0,onFocus:N,onBlur:_,value:Y,completedParams:q,onChange:m,onParamsChange:re,products:ee,onProductSelect:T,submitButton:L},$){let j=(0,S.useRef)(null),g=(0,S.useRef)(null),O=(0,S.useRef)(()=>{}),C=(0,S.useRef)(null),te=(0,S.useRef)(null);(0,S.useEffect)(()=>{let P=j.current;if(P)return C.current?C.current.setMode(k):C.current=new we.ModeController(P,k),()=>{C.current?.destroy(),C.current=null}},[k]);let K=(0,S.useCallback)(P=>{let le=te.current?.current;le&&(le.focus(),(0,we.setCursorOffset)(le,P))},[]),{completedParams:ae,skippedParams:Q,suggestionPills:H,setActivePill:l,skipActivePill:p,segments:u,newParamId:n,clearNewParamId:f,placeholderText:I,isFocused:oe,isDropdownOpen:c,isActivePillSelected:Ie,isLoading:ye,activeIndex:me,listboxId:Se,handleTextChange:he,handleKeyDown:He,setFocused:ne,editingParam:ke,editingAnchor:Ae,caretOffset:Ge,startEditingParam:Ce,handleCaretAfterInput:d,handleCaretMove:E,replaceEditingRange:A,dropdownProps:ge,reset:se}=Me({onSubmit:P=>O.current(P),onError:t,optionOverrides:o,maskCompletedText:i,apiConfig:r,additionalContext:h,columns:v,dropdownTrigger:X,optionsPosition:w,closeDropdownOnBlur:D,showNonTappableOptions:R,showSkipButton:G,onFocus:N,onBlur:_,value:Y,completedParams:q,onChange:m,onParamsChange:re,products:ee,onProductSelect:T,source:"full-sdk",setCursor:K});(0,S.useEffect)(()=>{if(!n)return;let P=window.setTimeout(()=>f(),650);return()=>window.clearTimeout(P)},[n,f]);let xt=me>=0?`${Se}-option-${me}`:void 0,{inputRef:Ke,editorProps:wt,focus:Ee,blur:Je,getPlainText:Xe}=bt({segments:u,newParamId:n,editingParam:ke,editingAnchor:Ae,caretOffset:Ge,placeholderText:I,isFocused:oe,isDropdownOpen:c,listboxId:Se,activeDescendantId:xt,autoFocus:Z,handleTextChange:he,handleKeyDown:He,handleCaretAfterInput:d,handleCaretMove:E,startEditingParam:Ce,replaceEditingRange:A,setFocused:ne});te.current=Ke,(0,S.useLayoutEffect)(()=>{let P=g.current,le=Ke.current;if(!P||!le)return;let Ze=()=>{let et=P.firstElementChild;if(!et)return;let Pt=et.getBoundingClientRect(),It=le.getBoundingClientRect();Pt.top>=It.bottom-2?P.setAttribute("data-aia-pill-wrapped",""):P.removeAttribute("data-aia-pill-wrapped")};Ze();let Ye=new ResizeObserver(Ze);return Ye.observe(le),()=>Ye.disconnect()},[u,H.length,ye,Ke]),(0,S.useImperativeHandle)($,()=>({focus:Ee,blur:Je,reset:se,setMode:P=>C.current?.setMode(P),skipActivePill:p}),[Ee,Je,se,p]);let De=!!u.length||ae.length>0,We=(0,S.useCallback)(()=>{if(!De)return;let P=Xe();a((0,we.buildSubmitResult)(P,ae,Q)),se()},[De,ae,Q,a,se,Xe]);O.current=We;let yt=(0,S.useCallback)(P=>{P.target?.closest("[data-aia-pill]")||Ee()},[Ee]),kt=y==="inline",_t=y==="dropdown";return(0,V.jsxs)("div",{ref:j,className:`magicx-aia ${ue.container} ${s??""}`,"data-pill-placement":y,"data-options-position":w,"data-animations":M?"on":"off","data-mode":Ht(k),children:[(0,V.jsx)(Be,{...ge,showPills:_t}),(0,V.jsxs)("div",{className:ue.inputWrapper,onClick:yt,children:[(0,V.jsxs)("div",{className:ue.editorArea,"data-aia-editor":"",children:[(0,V.jsx)("div",{...wt,className:ue.input,"data-aia-input":""}),kt&&(ye||H.length>0)&&(0,V.jsx)("span",{ref:g,className:ue.pillListContainer,"data-aia-pill-list-container":"",children:(0,V.jsx)(Te,{pills:H,activePillIndex:0,activeSelected:Ie,onSelectPill:l,loading:ye})})]}),L===null?null:L===void 0?(0,V.jsx)(ht,{disabled:!De,onClick:We}):(0,V.jsx)("span",{"data-aia-submit":"",className:ue.submitSlot,onClick:P=>{De&&(P.stopPropagation(),We())},children:L})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,buildSubmitResult,useAIAutocomplete,withSkippedParams});
|
|
1511
|
+
`,document.head.appendChild(e)}var ht={submitButton:"SubmitButton-module_submitButton_otz7H"};var Me=require("react/jsx-runtime");function gt({disabled:e,onClick:a}){return(0,Me.jsx)("button",{type:"button","data-aia-submit":"",className:ht.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),a()},"aria-label":"Submit",children:(0,Me.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Me.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var bt=require("@magicx-eng/ai-autocomplete-vanilla"),x=require("react");var Je=require("react");function ft(e){let a=(0,Je.useRef)(e);a.current=e;let t=(0,Je.useRef)(null);t.current===null&&(t.current={fetch:(n,l)=>{let i=a.current;return i?i.fetch(n,l):Promise.reject(new Error("products config removed"))},transform:n=>a.current?.transform(n)??[],get limit(){return a.current?.limit}});let r=e!==void 0;return{config:r?t.current:void 0,enabled:r}}var Ot={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 Ne({onSubmit:e,onError:a,optionOverrides:t,maskCompletedText:r,apiConfig:n,additionalContext:l,generateStartingStateOptions:i,columns:g=2,dropdownTrigger:w,optionsPosition:y,closeDropdownOnBlur:_,showNonTappableOptions:b,showSkipButton:M,onFocus:J,onBlur:$,value:D,completedParams:C,onChange:X,onParamsChange:R,products:P,onProductSelect:j,source:Z,setCursor:Y}){let c=(0,x.useRef)(null),[re,T]=(0,x.useState)(null),H=(0,x.useRef)(e);H.current=e;let N=(0,x.useRef)(a);N.current=a;let ee=(0,x.useRef)(X);ee.current=X;let h=(0,x.useRef)(R);h.current=R;let O=(0,x.useRef)(J);O.current=J;let G=(0,x.useRef)($);G.current=$;let L=(0,x.useRef)(Y);L.current=Y;let K=(0,x.useRef)(j);K.current=j;let te=ft(P);(0,x.useEffect)(()=>{if(typeof document>"u")return;let d=new bt.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:n,additionalContext:l,generateStartingStateOptions:i,optionOverrides:t,maskCompletedText:r,columns:g,dropdownTrigger:w,optionsPosition:y,closeDropdownOnBlur:_,showNonTappableOptions:b,source:Z,value:D,completedParams:C,onSubmit:(...A)=>H.current?.(...A),onError:(...A)=>N.current?.(...A),onChange:(...A)=>ee.current?.(...A),onParamsChange:(...A)=>h.current?.(...A),onFocus:()=>O.current?.(),onBlur:()=>G.current?.(),onProductSelect:A=>K.current?.(A),setCursor:A=>L.current?.(A),products:te.config});c.current=d,T(d.getState());let E=d.subscribe(A=>T(A));return()=>{E(),d.destroy(),c.current===d&&(c.current=null)}},[]),(0,x.useEffect)(()=>{D!==void 0&&c.current?.setValue(D)},[D]),(0,x.useEffect)(()=>{C!==void 0&&c.current?.setCompletedParams(C)},[C]);let ae=JSON.stringify(n??null),W;try{W=JSON.stringify(l??null)}catch{W="[unstringifiable]"}let s=(0,x.useRef)(t),p=(0,x.useRef)(0);if(t!==s.current){let d=s.current,E=t,A=Object.keys(d??{}),fe=Object.keys(E??{});(A.length!==fe.length||fe.some(se=>!d?.[se]||E[se]!==d[se]))&&p.current++,s.current=t}(0,x.useEffect)(()=>{c.current?.update({apiConfig:n,additionalContext:l,generateStartingStateOptions:i,optionOverrides:t,dropdownTrigger:w,optionsPosition:y,closeDropdownOnBlur:_,showNonTappableOptions:b})},[ae,W,i,p.current,w,y,_,b]);let u=(0,x.useRef)(!1);(0,x.useEffect)(()=>{if(!u.current){u.current=!0;return}c.current?.update({products:te.config})},[te.enabled]);let f=(0,x.useRef)(null);f.current===null&&(f.current={handleTextChange:d=>c.current?.handleTextChange(d),handleKeyDown:d=>{let E="nativeEvent"in d?d.nativeEvent:d;c.current?.handleKeyDown(E)},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),skipActivePill:()=>c.current?.skipActivePill(),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 o=f.current,I=(0,x.useCallback)(d=>{let E=d.target.value,fe=E.length>0&&!d.nativeEvent?.isComposing&&E[0]!==E[0].toUpperCase()?E[0].toUpperCase()+E.slice(1):E;c.current?.handleTextChange(fe)},[]),ue=(0,x.useCallback)(d=>{c.current?.handleKeyDown(d.nativeEvent)},[]),oe=c.current,m=re??Ot,Se=D!==void 0?D:m.text,ke=C!==void 0?C:m.completedParams,he=m.actionableSuggestions,Ae=he[0],ge=oe?.listboxId??"",Ge=m.activeDropdownIndex>=0&&oe?`${ge}-option-${m.activeDropdownIndex}`:void 0,ne=m.editingParam,_e=ne?{type:ne.suggestionType,text:ne.suggestionPlaceholder,required:!0,options:ne.options}:null,Ce=_e??Ae,Ke=_e?[_e]:he,Ee=!oe||m.isLoading&&!m.editingParam&&!m.inSelectionAnimation;return{completedParams:ke,skippedParams:m.skippedParams,suggestionPills:he,setActivePill:o.setActivePill,skipActivePill:o.skipActivePill,removeLastParam:o.removeLastParam,segments:m.segments,newParamId:m.newParamId,clearNewParamId:o.clearNewParamId,suggestions:m.suggestions,activeIndex:m.activeDropdownIndex,isReady:m.isReady,isLoading:Ee,isFocused:m.isFocused,isDropdownOpen:m.isDropdownOpen,isActivePillSelected:m.isActivePillSelected,placeholderText:m.placeholderText,listboxId:ge,error:m.error,products:m.products,selectProduct:o.selectProduct,handleTextChange:o.handleTextChange,handleKeyDown:o.handleKeyDown,setFocused:o.setFocused,editingParam:ne,editingAnchor:m.editingAnchor,caretOffset:m.caretOffset,startEditingParam:o.startEditingParam,exitEditMode:o.exitEditMode,handleCaretAfterInput:o.handleCaretAfterInput,handleCaretMove:o.handleCaretMove,replaceEditingRange:o.replaceEditingRange,inputProps:{value:Se,placeholder:m.placeholderText||void 0,onChange:I,onKeyDown:ue,onFocus:o.handleFocus,onBlur:o.handleBlur,role:"combobox","aria-expanded":m.isDropdownOpen,"aria-activedescendant":Ge,"aria-autocomplete":"list","aria-controls":ge},reset:o.reset,dropdownProps:{suggestions:Ce?[{...Ce,options:m.filteredOptions}]:[],activeIndex:m.activeDropdownIndex,onSelect:o.selectOption,onHighlight:o.setActiveDropdownIndex,isOpen:m.isDropdownOpen,id:ge,pills:Ke,activeSelected:m.isActivePillSelected,onPillClick:o.setActivePill,onSkip:o.skipActivePill,showSkipButton:(M??!0)&&!ne,skipDisabled:m.inSelectionAnimation,isLoading:Ee,isInputEmpty:Se.trim().length===0,products:m.products,onProductSelect:o.selectProduct,onProductFocusChange:o.setFocused,optionsPosition:y??"below"}}}var F=require("@magicx-eng/ai-autocomplete-vanilla"),v=require("react"),Oe;function Ht(){if(Oe!==void 0)return Oe;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Oe=e.contentEditable==="plaintext-only",Oe}function vt(e){let{segments:a,newParamId:t,editingParam:r,editingAnchor:n,caretOffset:l,placeholderText:i,isFocused:g,isDropdownOpen:w,listboxId:y,activeDescendantId:_,autoFocus:b,handleTextChange:M,handleKeyDown:J,handleCaretAfterInput:$,handleCaretMove:D,startEditingParam:C,replaceEditingRange:X,setFocused:R}=e,P=(0,v.useRef)(null),j=(0,v.useRef)(!1),Z=(0,v.useRef)(""),Y=(0,v.useRef)(""),c=(0,v.useRef)(null),re=(0,v.useRef)(0);c.current=l,(0,v.useEffect)(()=>{if(!b)return;let s=P.current;if(!s)return;document.activeElement===s?R(!0):s.focus();let p=s.ownerDocument??document,u=p.getSelection(),f=u&&u.rangeCount>0&&s.contains(u.anchorNode);if(u&&!f){let o=p.createRange();o.selectNodeContents(s),o.collapse(!0),u.removeAllRanges(),u.addRange(o)}},[b,R]),(0,v.useEffect)(()=>{let s=P.current;if(!s)return;let p=s.ownerDocument??document,u=()=>{let f=p.getSelection();if(!f||f.rangeCount===0||!f.anchorNode||!s.contains(f.anchorNode))return;let o=f.anchorNode,I=o.nodeType===Node.ELEMENT_NODE?o:o.parentElement,oe=(f.isCollapsed?I?.closest('strong[data-seg="completed"][data-param-id]'):null)?.dataset.paramId??null;if(oe&&oe!==r?.id){C(oe);return}performance.now()-re.current<50||D((0,F.getCursorOffset)(s))};return p.addEventListener("selectionchange",u),()=>p.removeEventListener("selectionchange",u)},[r,C,D]),(0,v.useLayoutEffect)(()=>{let s=P.current;s&&(0,F.renderEditableContent)({input:s,segments:a,newParamId:t,editingParamId:r?.id??null,placeholderText:i??"",isFocused:g})},[a,t,r,i,g]),(0,v.useLayoutEffect)(()=>{let s=Z.current,p=t??"";if(Z.current=p,!p||p===s)return;let u=P.current;if(!u)return;u.focus();let f=c.current??(0,F.plainTextLength)(u);(0,F.setCursorOffset)(u,f)},[t]),(0,v.useLayoutEffect)(()=>{let s=Y.current,p=r?.id??"";if(Y.current=p,!p||p===s||n==null)return;let u=P.current;u&&(0,F.setCursorOffset)(u,n)},[r,n]);let T=(0,v.useCallback)(()=>{if(j.current)return;let s=P.current;if(!s)return;let p=(0,F.extractPlainText)(s),f=p.length>0&&p[0]!==p[0].toUpperCase()?p[0].toUpperCase()+p.slice(1):p;M(f)},[M]),H=(0,v.useCallback)(()=>{re.current=performance.now(),T();let s=P.current;s&&$((0,F.getCursorOffset)(s))},[T,$]);(0,v.useEffect)(()=>{let s=P.current;if(!s)return;let p=u=>{let f=u,o=f.inputType;if(o==="insertParagraph"||o==="insertLineBreak"||o==="insertFromDrop"){u.preventDefault();return}if(o.startsWith("insert")||o.startsWith("delete")){let I=o.startsWith("delete")?"":f.data??"";X(I)&&u.preventDefault()}};return s.addEventListener("beforeinput",p),()=>s.removeEventListener("beforeinput",p)},[X]);let N=(0,v.useCallback)(()=>{j.current=!0},[]),ee=(0,v.useCallback)(()=>{j.current=!1,T()},[T]),h=(0,v.useCallback)(s=>{s.preventDefault();let p=P.current;if(!p)return;let u=(s.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!u)return;let f=p.ownerDocument??document,o=f.getSelection();if(!o||o.rangeCount===0)return;let I=o.getRangeAt(0);if(!p.contains(I.startContainer))return;I.deleteContents();let ue=f.createTextNode(u);I.insertNode(ue),I.setStartAfter(ue),I.collapse(!0),o.removeAllRanges(),o.addRange(I),T()},[T]),O=(0,v.useCallback)(s=>J(s),[J]),G=(0,v.useCallback)(()=>R(!0),[R]),L=(0,v.useCallback)(()=>R(!1),[R]),K=(0,v.useCallback)(()=>P.current?.focus(),[]),te=(0,v.useCallback)(()=>P.current?.blur(),[]),ae=(0,v.useCallback)(()=>{let s=P.current;return s?(0,F.extractPlainText)(s):""},[]),W=Ht()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:W,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":y,"aria-expanded":w,"aria-activedescendant":_,spellCheck:!0,enterKeyHint:"send",onInput:H,onKeyDown:O,onCompositionStart:N,onCompositionEnd:ee,onPaste:h,onFocus:G,onBlur:L},getPlainText:ae,focus:K,blur:te}}var q=require("react/jsx-runtime");function Gt(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var xt=(0,S.forwardRef)(function({onSubmit:a,onError:t,optionOverrides:r,maskCompletedText:n,className:l,apiConfig:i,additionalContext:g,generateStartingStateOptions:w,columns:y,pillPlacement:_="dropdown",mode:b="auto",optionsPosition:M="below",animations:J=!0,dropdownTrigger:$,closeDropdownOnBlur:D,showNonTappableOptions:C,showSkipButton:X,autoFocus:R=!0,onFocus:P,onBlur:j,value:Z,completedParams:Y,onChange:c,onParamsChange:re,products:T,onProductSelect:H,submitButton:N},ee){let h=(0,S.useRef)(null),O=(0,S.useRef)(null),G=(0,S.useRef)(()=>{}),L=(0,S.useRef)(null),K=(0,S.useRef)(null);(0,S.useEffect)(()=>{let k=h.current;if(k)return L.current?L.current.setMode(b):L.current=new ye.ModeController(k,b),()=>{L.current?.destroy(),L.current=null}},[b]);let te=(0,S.useCallback)(k=>{let le=K.current?.current;le&&(le.focus(),(0,ye.setCursorOffset)(le,k))},[]),{completedParams:ae,skippedParams:W,suggestionPills:s,setActivePill:p,skipActivePill:u,segments:f,newParamId:o,clearNewParamId:I,placeholderText:ue,isFocused:oe,isDropdownOpen:m,isActivePillSelected:Se,isLoading:ke,activeIndex:he,listboxId:Ae,handleTextChange:ge,handleKeyDown:Ge,setFocused:ne,editingParam:_e,editingAnchor:Ce,caretOffset:Ke,startEditingParam:Ee,handleCaretAfterInput:d,handleCaretMove:E,replaceEditingRange:A,dropdownProps:fe,reset:se}=Ne({onSubmit:k=>G.current(k),onError:t,optionOverrides:r,maskCompletedText:n,apiConfig:i,additionalContext:g,generateStartingStateOptions:w,columns:y,dropdownTrigger:$,optionsPosition:M,closeDropdownOnBlur:D,showNonTappableOptions:C,showSkipButton:X,onFocus:P,onBlur:j,value:Z,completedParams:Y,onChange:c,onParamsChange:re,products:T,onProductSelect:H,source:"full-sdk",setCursor:te});(0,S.useEffect)(()=>{if(!o)return;let k=window.setTimeout(()=>I(),650);return()=>window.clearTimeout(k)},[o,I]);let wt=he>=0?`${Ae}-option-${he}`:void 0,{inputRef:We,editorProps:yt,focus:De,blur:Xe,getPlainText:Ze}=vt({segments:f,newParamId:o,editingParam:_e,editingAnchor:Ce,caretOffset:Ke,placeholderText:ue,isFocused:oe,isDropdownOpen:m,listboxId:Ae,activeDescendantId:wt,autoFocus:R,handleTextChange:ge,handleKeyDown:Ge,handleCaretAfterInput:d,handleCaretMove:E,startEditingParam:Ee,replaceEditingRange:A,setFocused:ne});K.current=We,(0,S.useLayoutEffect)(()=>{let k=O.current,le=We.current;if(!k||!le)return;let Ye=()=>{let tt=k.firstElementChild;if(!tt)return;let It=tt.getBoundingClientRect(),St=le.getBoundingClientRect();It.top>=St.bottom-2?k.setAttribute("data-aia-pill-wrapped",""):k.removeAttribute("data-aia-pill-wrapped")};Ye();let et=new ResizeObserver(Ye);return et.observe(le),()=>et.disconnect()},[f,s.length,ke,We]),(0,S.useImperativeHandle)(ee,()=>({focus:De,blur:Xe,reset:se,setMode:k=>L.current?.setMode(k),skipActivePill:u}),[De,Xe,se,u]);let Re=!!f.length||ae.length>0,Ue=(0,S.useCallback)(()=>{if(!Re)return;let k=Ze();a((0,ye.buildSubmitResult)(k,ae,W)),se()},[Re,ae,W,a,se,Ze]);G.current=Ue;let kt=(0,S.useCallback)(k=>{k.target?.closest("[data-aia-pill]")||De()},[De]),_t=_==="inline",Pt=_==="dropdown";return(0,q.jsxs)("div",{ref:h,className:`magicx-aia ${me.container} ${l??""}`,"data-pill-placement":_,"data-options-position":M,"data-animations":J?"on":"off","data-mode":Gt(b),children:[(0,q.jsx)(Fe,{...fe,showPills:Pt}),(0,q.jsxs)("div",{className:me.inputWrapper,onClick:kt,children:[(0,q.jsxs)("div",{className:me.editorArea,"data-aia-editor":"",children:[(0,q.jsx)("div",{...yt,className:me.input,"data-aia-input":""}),_t&&(ke||s.length>0)&&(0,q.jsx)("span",{ref:O,className:me.pillListContainer,"data-aia-pill-list-container":"",children:(0,q.jsx)(Le,{pills:s,activePillIndex:0,activeSelected:Se,onSelectPill:p,loading:ke})})]}),N===null?null:N===void 0?(0,q.jsx)(gt,{disabled:!Re,onClick:Ue}):(0,q.jsx)("span",{"data-aia-submit":"",className:me.submitSlot,onClick:k=>{Re&&(k.stopPropagation(),Ue())},children:N})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,buildSubmitResult,useAIAutocomplete,withSkippedParams});
|
|
1512
1512
|
//# sourceMappingURL=index.js.map
|