@magicx-eng/ai-autocomplete-react 0.29.4 → 0.30.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +8 -0
- package/dist/index.d.mts +20 -1
- package/dist/index.d.ts +20 -1
- package/dist/index.js +13 -13
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +13 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -338,6 +338,7 @@ function App() {
|
|
|
338
338
|
| `onResult?` | `(result: AutocompleteResult) => void` | — | Called after every successful round-trip with the structured query as it now stands — see [Reading the query as it's built](#reading-the-query-as-its-built). |
|
|
339
339
|
| `onError?` | `(error: Error) => void` | — | Called when a fetch fails. |
|
|
340
340
|
| `apiConfig?` | `APIConfig` | — | Runtime API configuration (see below). |
|
|
341
|
+
| `visitorId?` | `string \| (() => string \| undefined)` | — | Stable UUID v4 for this visitor, kept across page loads, or a function returning it. See [Visitor id and submits](#visitor-id-and-submits). |
|
|
341
342
|
| `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. |
|
|
342
343
|
| `optionOverrides?` | `OptionOverrides` | — | Supply the options for a parameter yourself, per suggestion type — fixed, computed, or fetched as the user types. See [Option Overrides](#option-overrides). |
|
|
343
344
|
| `maskCompletedText?` | `boolean` | `false` | When `true`, omits completed params' literal text from API requests (for masking PII/sensitive values from the server). |
|
|
@@ -689,6 +690,7 @@ The headless hook for Tier 2 and Tier 3. Accepts the same options as `<AIAutocom
|
|
|
689
690
|
| `removeLastParam` | `() => void` | Remove the last completed param from state. The text stays in the input as plain text. |
|
|
690
691
|
| `clearNewParamId` | `() => void` | Clear shimmer animation state. |
|
|
691
692
|
| `reset` | `() => void` | Clear all state, re-fetch, and start a new session (rotates `session_id`). Call this after handling submit. |
|
|
693
|
+
| `recordSubmit` | `(result: AutocompleteResult) => void` | Record a submit from a button you render. Enter is recorded for you; call this once per button submit. |
|
|
692
694
|
| `selectProduct` | `(product: Product) => void` | Announce a product selection (fires `onProductSelect`). The built-in dropdown calls this for you; hand-rolled strips call it themselves. Never navigates. |
|
|
693
695
|
|
|
694
696
|
**Input forwarding (custom inputs)** — call these instead of spreading `inputProps` when your input isn't a `<textarea>` (contentEditable / rich-text editors):
|
|
@@ -928,6 +930,12 @@ The contract is simple: **after the user submits the query, call `reset()`**. Th
|
|
|
928
930
|
The id is a plain UUID. Log it next to your own request logs if you want to
|
|
929
931
|
correlate a user's report with the query that produced it.
|
|
930
932
|
|
|
933
|
+
### Visitor id and submits
|
|
934
|
+
|
|
935
|
+
Pass `visitorId` to tie searches to what the same visitor does later: a UUID v4 you keep across page loads (for example a first-party cookie), or a function that returns one. A function is called only when the id is needed, so it is safe to create the id lazily inside it.
|
|
936
|
+
|
|
937
|
+
Submits from Enter and from Tier 1's built-in button are recorded for you. If you render your own submit button (Tier 2 or 3), call `recordSubmit(result)` from it, once per submit, with the result you pass to your own submit handler.
|
|
938
|
+
|
|
931
939
|
## Option Overrides
|
|
932
940
|
|
|
933
941
|
Supply the options for a parameter yourself instead of taking the server's. Each entry is keyed by the suggestion `type` and is a function of the phrase the user has typed for that parameter — return an array for a fixed or computed list, or a promise for one that lives behind a request (the dropdown shows its loading skeleton until it settles):
|
package/dist/index.d.mts
CHANGED
|
@@ -45,6 +45,13 @@ interface AIAutocompleteProps {
|
|
|
45
45
|
* comparison used for `apiConfig`).
|
|
46
46
|
*/
|
|
47
47
|
additionalContext?: Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Stable id for this visitor, kept by the host across page loads. Rides on
|
|
50
|
+
* telemetry events so searches can be joined to what the visitor does
|
|
51
|
+
* afterwards. Must be a UUID v4; omit to send none. A function is called
|
|
52
|
+
* only once the server has funnel telemetry on.
|
|
53
|
+
*/
|
|
54
|
+
visitorId?: string | (() => string | undefined);
|
|
48
55
|
columns?: number;
|
|
49
56
|
/** Where to render unfilled pills. "dropdown" (default) renders them above the options grid; "inline" renders them in the input. */
|
|
50
57
|
pillPlacement?: "inline" | "dropdown" | "hidden";
|
|
@@ -180,6 +187,13 @@ interface UseAIAutocompleteOptions {
|
|
|
180
187
|
* comparison used for `apiConfig`).
|
|
181
188
|
*/
|
|
182
189
|
additionalContext?: Record<string, unknown>;
|
|
190
|
+
/**
|
|
191
|
+
* Stable id for this visitor, kept by the host across page loads. Rides on
|
|
192
|
+
* telemetry events so searches can be joined to what the visitor does
|
|
193
|
+
* afterwards. Must be a UUID v4; omit to send none. A function is called
|
|
194
|
+
* only once the server has funnel telemetry on.
|
|
195
|
+
*/
|
|
196
|
+
visitorId?: string | (() => string | undefined);
|
|
183
197
|
columns?: number;
|
|
184
198
|
/**
|
|
185
199
|
* SDK surface identifier — sent as meta.source on both /api/suggest and
|
|
@@ -315,6 +329,11 @@ interface UseAIAutocompleteReturn {
|
|
|
315
329
|
skipActivePill: () => void;
|
|
316
330
|
removeLastParam: () => void;
|
|
317
331
|
reset: () => void;
|
|
332
|
+
/**
|
|
333
|
+
* Records a submit in telemetry. Enter is recorded by the SDK; call this
|
|
334
|
+
* from a submit button you render, so each submit is counted once.
|
|
335
|
+
*/
|
|
336
|
+
recordSubmit: (result: AutocompleteResult) => void;
|
|
318
337
|
segments: Segment[];
|
|
319
338
|
newParamId: string | null;
|
|
320
339
|
clearNewParamId: () => void;
|
|
@@ -536,6 +555,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
|
|
|
536
555
|
|
|
537
556
|
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, products, onProductSelect, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
538
557
|
|
|
539
|
-
declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
558
|
+
declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
540
559
|
|
|
541
560
|
export { AIAutocomplete, AIAutocompleteDropdown, type AIAutocompleteDropdownProps, type AIAutocompleteHandle, type AIAutocompleteProps, type UseAIAutocompleteOptions, type UseAIAutocompleteReturn, useAIAutocomplete };
|
package/dist/index.d.ts
CHANGED
|
@@ -45,6 +45,13 @@ interface AIAutocompleteProps {
|
|
|
45
45
|
* comparison used for `apiConfig`).
|
|
46
46
|
*/
|
|
47
47
|
additionalContext?: Record<string, unknown>;
|
|
48
|
+
/**
|
|
49
|
+
* Stable id for this visitor, kept by the host across page loads. Rides on
|
|
50
|
+
* telemetry events so searches can be joined to what the visitor does
|
|
51
|
+
* afterwards. Must be a UUID v4; omit to send none. A function is called
|
|
52
|
+
* only once the server has funnel telemetry on.
|
|
53
|
+
*/
|
|
54
|
+
visitorId?: string | (() => string | undefined);
|
|
48
55
|
columns?: number;
|
|
49
56
|
/** Where to render unfilled pills. "dropdown" (default) renders them above the options grid; "inline" renders them in the input. */
|
|
50
57
|
pillPlacement?: "inline" | "dropdown" | "hidden";
|
|
@@ -180,6 +187,13 @@ interface UseAIAutocompleteOptions {
|
|
|
180
187
|
* comparison used for `apiConfig`).
|
|
181
188
|
*/
|
|
182
189
|
additionalContext?: Record<string, unknown>;
|
|
190
|
+
/**
|
|
191
|
+
* Stable id for this visitor, kept by the host across page loads. Rides on
|
|
192
|
+
* telemetry events so searches can be joined to what the visitor does
|
|
193
|
+
* afterwards. Must be a UUID v4; omit to send none. A function is called
|
|
194
|
+
* only once the server has funnel telemetry on.
|
|
195
|
+
*/
|
|
196
|
+
visitorId?: string | (() => string | undefined);
|
|
183
197
|
columns?: number;
|
|
184
198
|
/**
|
|
185
199
|
* SDK surface identifier — sent as meta.source on both /api/suggest and
|
|
@@ -315,6 +329,11 @@ interface UseAIAutocompleteReturn {
|
|
|
315
329
|
skipActivePill: () => void;
|
|
316
330
|
removeLastParam: () => void;
|
|
317
331
|
reset: () => void;
|
|
332
|
+
/**
|
|
333
|
+
* Records a submit in telemetry. Enter is recorded by the SDK; call this
|
|
334
|
+
* from a submit button you render, so each submit is counted once.
|
|
335
|
+
*/
|
|
336
|
+
recordSubmit: (result: AutocompleteResult) => void;
|
|
318
337
|
segments: Segment[];
|
|
319
338
|
newParamId: string | null;
|
|
320
339
|
clearNewParamId: () => void;
|
|
@@ -536,6 +555,6 @@ declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProp
|
|
|
536
555
|
|
|
537
556
|
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, products, onProductSelect, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
538
557
|
|
|
539
|
-
declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
558
|
+
declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
540
559
|
|
|
541
560
|
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 ct=Object.defineProperty;var ea=Object.getOwnPropertyDescriptor;var ta=Object.getOwnPropertyNames;var aa=Object.prototype.hasOwnProperty;var ia=(e,a)=>{for(var t in a)ct(e,t,{get:a[t],enumerable:!0})},oa=(e,a,t,n)=>{if(a&&typeof a=="object"||typeof a=="function")for(let i of ta(a))!aa.call(e,i)&&i!==t&&ct(e,i,{get:()=>a[i],enumerable:!(n=ea(a,i))||n.enumerable});return e};var na=e=>oa(ct({},"__esModule",{value:!0}),e);var wa={};ia(wa,{AIAutocomplete:()=>Wt,AIAutocompleteDropdown:()=>at,DATE_RANGE_META_END:()=>s.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>s.DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT:()=>s.DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX:()=>s.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>s.WEEKDAY_LABELS,buildSubmitResult:()=>s.buildSubmitResult,cellDay:()=>s.cellDay,cellIso:()=>s.cellIso,dateCellMarks:()=>s.dateCellMarks,formatDate:()=>s.formatDate,formatDateRange:()=>s.formatDateRange,formatOptionCount:()=>s.formatOptionCount,isoDate:()=>s.isoDate,monthLabel:()=>s.monthLabel,optionCountLabel:()=>s.optionCountLabel,optionHasImage:()=>s.optionHasImage,optionImageSrc:()=>s.optionImageSrc,optionLabel:()=>s.optionLabel,parseDate:()=>s.parseDate,parseLooseDate:()=>s.parseLooseDate,parseLooseDateRange:()=>s.parseLooseDateRange,productFromMatchedItem:()=>s.productFromMatchedItem,productsFromCustomFields:()=>s.productsFromCustomFields,sanitizeOptionIconSvg:()=>s.sanitizeOptionIconSvg,selectedRangeFor:()=>s.selectedRangeFor,useAIAutocomplete:()=>ot,visibleDateRange:()=>s.visibleDateRange,withSkippedParams:()=>s.withSkippedParams});module.exports=na(wa);var s=require("@magicx-eng/ai-autocomplete-vanilla");var N=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-67791514")){let e=document.createElement("style");e.id="ac-style-67791514",e.textContent=`.aia-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
|
|
@@ -262,7 +262,7 @@
|
|
|
262
262
|
opacity: 0;
|
|
263
263
|
}
|
|
264
264
|
}
|
|
265
|
-
`,document.head.appendChild(e)}var Me={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};var
|
|
265
|
+
`,document.head.appendChild(e)}var Me={container:"aia-container-KKjFU",inputWrapper:"aia-inputWrapper-FLq1b",editorArea:"aia-editorArea-7rBWq",input:"aia-input-IW-P-",pillListContainer:"aia-pillListContainer-h92IA",submitSlot:"aia-submitSlot-GhuCM",aiaPillReveal:"aia-aiaPillReveal-wf05b"};var Re=require("@magicx-eng/ai-autocomplete-vanilla"),ee=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-0ae03977")){let e=document.createElement("style");e.id="ac-style-0ae03977",e.textContent=`/*
|
|
266
266
|
* Built-in appearance defaults \u2014 zero specificity via :where().
|
|
267
267
|
* Consumer CSS always wins without !important.
|
|
268
268
|
*
|
|
@@ -1041,7 +1041,7 @@
|
|
|
1041
1041
|
opacity: 0.25;
|
|
1042
1042
|
}
|
|
1043
1043
|
}
|
|
1044
|
-
`,document.head.appendChild(e)}var we={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};var
|
|
1044
|
+
`,document.head.appendChild(e)}var we={dropdown:"aia-dropdown-yz2KC",visible:"aia-visible-QCoXj",scrollArrow:"aia-scrollArrow-uUzV0","magicx-aia-scroll-arrow-bob":"aia-magicx-aia-scroll-arrow-bob-z-HXC",pillBar:"aia-pillBar-pwTXe",pillScroll:"aia-pillScroll-Tpzus",skip:"aia-skip-7-olS",skeletonBars:"aia-skeletonBars-HVr9C",skeletonBarsIn:"aia-skeletonBarsIn-BdPrL",skeletonBarsOut:"aia-skeletonBarsOut-TqKeD",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};var z=require("@magicx-eng/ai-autocomplete-vanilla"),kt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-f687bd03")){let e=document.createElement("style");e.id="ac-style-f687bd03",e.textContent=`/* --- Datepicker (replaces the options grid for date suggestions) ---
|
|
1045
1045
|
|
|
1046
1046
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
1047
1047
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1204,7 +1204,7 @@
|
|
|
1204
1204
|
opacity: 0.8;
|
|
1205
1205
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1206
1206
|
}
|
|
1207
|
-
`,document.head.appendChild(e)}var M={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var
|
|
1207
|
+
`,document.head.appendChild(e)}var M={datepicker:"aia-datepicker-6RrTs",header:"aia-header-z4LRk",month:"aia-month-urB2T",nav:"aia-nav-ap4AN",weekdays:"aia-weekdays-3EA3q",grid:"aia-grid-mQCgw",weekday:"aia-weekday-3lF4B",cell:"aia-cell-59k0y",number:"aia-number-aoT01",day:"aia-day-cB3u9",blank:"aia-blank-ivgRC",past:"aia-past-CEZsj",highlighted:"aia-highlighted-YIdtK",today:"aia-today-iI3ME",inRange:"aia-inRange-r9S2q",selected:"aia-selected-28KDn",pressed:"aia-pressed-bEyyN"};var Y=require("react/jsx-runtime"),ra=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function Ct({options:e,activeIndex:a,listboxId:t,view:n,selection:i,onSelect:r,onHighlight:o,onUnhighlight:d,onPreviousMonth:k,onNextMonth:w}){let x=(0,z.isoDate)(new Date),E=(0,z.visibleDateRange)({pendingStart:i.rangeStart,highlightedIso:(0,z.cellIso)(e[a]),selected:i.selectedRange});return(0,Y.jsxs)("div",{className:M.datepicker,"data-aia-datepicker":"",children:[(0,Y.jsxs)("div",{className:M.header,children:[(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:m=>m.preventDefault(),onClick:k,children:"\u2039"}),(0,Y.jsx)("span",{className:M.month,"data-aia-date-month":"","aria-live":"polite",children:(0,z.monthLabel)(n)}),(0,Y.jsx)("button",{type:"button",tabIndex:-1,className:M.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:m=>m.preventDefault(),onClick:w,children:"\u203A"})]}),(0,Y.jsx)("div",{className:M.weekdays,"aria-hidden":"true",children:z.WEEKDAY_LABELS.map((m,y)=>(0,Y.jsx)("span",{className:M.weekday,children:m},ra[y]))}),(0,Y.jsx)("div",{className:M.grid,"data-aia-date-grid":"",children:e.map((m,y)=>(0,Y.jsx)(sa,{option:m,id:`${t}-option-${y}`,index:y,isHighlighted:y===a&&m.is_tappable,isToday:(0,z.cellIso)(m)===x,isPast:(0,z.cellIso)(m)!=null&&(0,z.cellIso)(m)<x,marks:(0,z.dateCellMarks)((0,z.cellIso)(m),{selectedIso:i.selectedIso,range:E}),onSelect:r,onHighlight:o,onUnhighlight:d},(0,z.cellIso)(m)??`pad-${y}`))})]})}function sa({option:e,id:a,index:t,isHighlighted:n,isToday:i,isPast:r,marks:o,onSelect:d,onHighlight:k,onUnhighlight:w}){let[x,E]=(0,kt.useState)(!1),m=(0,z.cellDay)(e);if(m==null)return(0,Y.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${M.cell} ${M.blank}`});let y=()=>{E(!0),d(e),setTimeout(()=>E(!1),170)},O=[M.cell,M.day,r?M.past:"",n?M.highlighted:"",i?M.today:"",o.inRange?M.inRange:"",o.selected?M.selected:"",x?M.pressed:""].filter(Boolean).join(" ");return(0,Y.jsx)("div",{id:a,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":n,"aria-label":e.text,tabIndex:0,className:O,onClick:y,onKeyDown:A=>{(A.key==="Enter"||A.key===" ")&&(A.preventDefault(),y())},onMouseEnter:()=>k(t),onMouseLeave:w?()=>w(t):void 0,children:(0,Y.jsx)("span",{className:M.number,children:m})})}var He=require("@magicx-eng/ai-autocomplete-vanilla"),Xe=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-5259a217")){let e=document.createElement("style");e.id="ac-style-5259a217",e.textContent=`.aia-cluster {
|
|
1208
1208
|
display: flex;
|
|
1209
1209
|
flex-wrap: wrap;
|
|
1210
1210
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1244,7 +1244,7 @@
|
|
|
1244
1244
|
.aia-cluster[data-justify="around"] {
|
|
1245
1245
|
justify-content: space-around;
|
|
1246
1246
|
}
|
|
1247
|
-
`,document.head.appendChild(e)}var
|
|
1247
|
+
`,document.head.appendChild(e)}var pt=require("react/jsx-runtime");function Ue({gap:e,align:a="center",justify:t="start",noWrap:n=!1,inline:i=!1,className:r,children:o,...d}){let k=e?{"--aia-cluster-gap":e}:void 0,w={className:r?`aia-cluster ${r}`:"aia-cluster","data-align":a,"data-justify":t,"data-nowrap":n||void 0,"data-inline":i||void 0,style:k,...d};return i?(0,pt.jsx)("span",{...w,children:o}):(0,pt.jsx)("div",{...w,children:o})}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
|
|
1248
1248
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1249
1249
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1250
1250
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -1378,7 +1378,7 @@
|
|
|
1378
1378
|
justify-content: flex-end;
|
|
1379
1379
|
}
|
|
1380
1380
|
}
|
|
1381
|
-
`,document.head.appendChild(e)}var xe={footer:"aia-footer-qQQ7x",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg",row:"aia-row-BgZ6Q"};var
|
|
1381
|
+
`,document.head.appendChild(e)}var xe={footer:"aia-footer-qQQ7x",hintGroup:"aia-hintGroup-ZzbPf",brandLink:"aia-brandLink-r4f3R",key:"aia-key-Bz1H-",hint:"aia-hint-GKEOH",brand:"aia-brand-Al-lR",badge:"aia-badge-Fk9vg",row:"aia-row-BgZ6Q"};var re=require("react/jsx-runtime");function Pt({isOptionHighlighted:e=!1,isInputEmpty:a=!1}){let{key:t,hint:n}=(0,He.getFooterHint)(e,a),[i,r]=(0,Xe.useState)(He.ATTRIBUTION_URL);return(0,Xe.useEffect)(()=>{r((0,He.buildAttributionUrl)())},[]),(0,re.jsx)("footer",{className:xe.footer,"data-aia-footer":"",children:(0,re.jsxs)(Ue,{justify:"between",noWrap:!0,className:xe.row,children:[(0,re.jsxs)(Ue,{gap:"5px",className:xe.hintGroup,children:[(0,re.jsx)("kbd",{className:xe.key,children:t}),(0,re.jsx)("span",{className:xe.hint,children:n})]}),(0,re.jsxs)("a",{className:xe.brandLink,href:i,target:"_blank",rel:"noopener noreferrer",children:[(0,re.jsx)("span",{className:xe.brand,children:"AI"}),(0,re.jsx)("span",{className:xe.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,
|
|
1382
1382
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
1383
1383
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
1384
1384
|
as it was when the outline was dashed. */
|
|
@@ -1454,7 +1454,7 @@
|
|
|
1454
1454
|
opacity: 0;
|
|
1455
1455
|
}
|
|
1456
1456
|
}
|
|
1457
|
-
`,document.head.appendChild(e)}var
|
|
1457
|
+
`,document.head.appendChild(e)}var Ae={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",skeleton:"aia-skeleton-57P0T",skeletonIn:"aia-skeletonIn-54kMv",skeletonPulse:"aia-skeletonPulse-xGcUy",skeletonOut:"aia-skeletonOut-1sJ-r"};var It=require("react/jsx-runtime"),ht={selected:1,first:.7,next:.4,last:.2};function St({label:e,state:a,rounded:t,loading:n,onClick:i}){let r=[Ae.pill,t?Ae.rounded:"",n?Ae.skeleton:""].filter(Boolean).join(" ");return(0,It.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":n?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:r,style:{opacity:ht[a]},onMouseDown:o=>o.preventDefault(),onClick:n?void 0:i,disabled:n,children:e})}if(typeof document<"u"&&!document.getElementById("ac-style-0fcb7940")){let e=document.createElement("style");e.id="ac-style-0fcb7940",e.textContent=`.aia-list-qvLqO {
|
|
1458
1458
|
position: relative;
|
|
1459
1459
|
z-index: 1;
|
|
1460
1460
|
pointer-events: auto;
|
|
@@ -1464,7 +1464,7 @@
|
|
|
1464
1464
|
align-items: center;
|
|
1465
1465
|
vertical-align: middle;
|
|
1466
1466
|
}
|
|
1467
|
-
`,document.head.appendChild(e)}var
|
|
1467
|
+
`,document.head.appendChild(e)}var ut={list:"aia-list-qvLqO"};var Qe=require("react/jsx-runtime"),la=[125,69];function Et(e){return e===0?"first":e===1?"next":"last"}function Je({pills:e,activePillIndex:a,onSelectPill:t,activeSelected:n,rounded:i,loading:r}){return r&&e.length===0?(0,Qe.jsx)("span",{className:ut.list,"data-aia-pill-list-loading":"",children:la.map((o,d)=>(0,Qe.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Ae.pill} ${i?Ae.rounded:""} ${Ae.skeleton}`,style:{width:o,opacity:ht[Et(d)]}},`skel-${o}`))}):(0,Qe.jsx)("span",{className:ut.list,"data-aia-pill-list-loading":r?"":void 0,children:e.map((o,d)=>{let k=!!n&&d===a;return(0,Qe.jsx)(St,{label:o.text,state:k?"selected":Et(d),selected:k,rounded:i,loading:r,onClick:()=>t(d)},`${o.type}-${o.text}`)})})}var et=require("@magicx-eng/ai-autocomplete-vanilla"),Fe=require("react");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
|
|
1468
1468
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
1469
1469
|
theming one package sees the same result in the other.
|
|
1470
1470
|
|
|
@@ -1692,7 +1692,7 @@
|
|
|
1692
1692
|
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-body-ly032 {
|
|
1693
1693
|
flex: 1 1 auto;
|
|
1694
1694
|
}
|
|
1695
|
-
`,document.head.appendChild(e)}var te={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE"};var
|
|
1695
|
+
`,document.head.appendChild(e)}var te={section:"aia-section-Hugfg",label:"aia-label-nuc93",row:"aia-row-WDVBX",card:"aia-card-JBGYT",media:"aia-media-RrbGe",image:"aia-image-5pNL7",body:"aia-body-ly032",vendor:"aia-vendor-Gvu7G",title:"aia-title-gCNmq",price:"aia-price-gULcE"};var j=require("react/jsx-runtime");function Tt({products:e,listboxId:a,onSelect:t,onFocusChange:n,focusable:i=!0,layout:r="row",imageFallback:o="image"}){let d=e.length>0,k=(0,Fe.useRef)(null);if((0,Fe.useEffect)(()=>{let x=k.current;if(!(!d||!x))return(0,et.attachProductRowWheel)(x)},[d]),!d)return null;let w=`${a}-products-label`;return(0,j.jsxs)("section",{className:te.section,"data-aia-products":"","data-aia-products-layout":r,role:"group","aria-labelledby":w,children:[(0,j.jsx)("div",{className:te.label,id:w,"data-aia-products-label":"",children:"Products"}),(0,j.jsx)("div",{ref:k,className:te.row,"data-aia-products-row":"",children:e.map((x,E)=>(0,j.jsx)(da,{product:x,id:`${a}-product-${E}`,onSelect:t,onFocusChange:n,focusable:i,imageFallback:o},x.id))})]})}function da({product:e,id:a,onSelect:t,onFocusChange:n,focusable:i,imageFallback:r}){let o=d=>{d.metaKey||d.ctrlKey||d.shiftKey||d.altKey||d.button!==0||(d.preventDefault(),t(e))};return(0,j.jsxs)("a",{id:a,className:te.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:i?0:-1,onClick:o,onKeyDown:d=>{d.key!=="Enter"&&d.key!==" "||(d.preventDefault(),t(e))},onFocus:()=>n?.(!0),onBlur:d=>{d.relatedTarget?.closest("[data-aia-dropdown]")||n?.(!1)},children:[(0,j.jsx)(ca,{src:e.imageUrl?.trim(),title:e.title,fallback:r},e.imageUrl?.trim()??""),(0,j.jsxs)("span",{className:te.body,children:[e.vendor?(0,j.jsx)("span",{className:te.vendor,children:e.vendor}):null,(0,j.jsx)("span",{className:te.title,children:e.title}),e.price?(0,j.jsx)("span",{className:te.price,children:e.price}):null]})]})}function ca({src:e,title:a,fallback:t}){let[n,i]=(0,Fe.useState)(!1),r=!!e&&!n,o=!r&&t==="initial";return(0,j.jsxs)("span",{className:te.media,"aria-hidden":"true","data-aia-product-placeholder":!r&&!o?"":void 0,"data-aia-product-initial":o?"":void 0,children:[r?(0,j.jsx)("img",{className:te.image,src:e,alt:"",loading:"lazy",decoding:"async",onError:()=>i(!0)}):null,o?(0,et.productInitial)(a):null]})}var U=require("@magicx-eng/ai-autocomplete-vanilla"),ce=require("react");var At=require("@magicx-eng/ai-autocomplete-vanilla"),tt=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-948e58da")){let e=document.createElement("style");e.id="ac-style-948e58da",e.textContent=`.aia-grid {
|
|
1696
1696
|
display: grid;
|
|
1697
1697
|
grid-template-columns: repeat(
|
|
1698
1698
|
auto-fit,
|
|
@@ -1728,7 +1728,7 @@
|
|
|
1728
1728
|
.aia-grid[data-scroll]::-webkit-scrollbar {
|
|
1729
1729
|
display: none;
|
|
1730
1730
|
}
|
|
1731
|
-
`,document.head.appendChild(e)}var
|
|
1731
|
+
`,document.head.appendChild(e)}var Ot=require("react/jsx-runtime");function Rt({min:e="16rem",max:a,gap:t,scroll:n=!1,maxHeight:i,scrollResetKey:r,cols:o,template:d,innerRef:k,className:w,children:x,...E}){let m=(0,tt.useRef)(null);(0,tt.useLayoutEffect)(()=>{if(r===void 0)return;let O=m.current;O&&(O.scrollTop=0)},[r]);let y={"--aia-grid-min":e};return a&&(y["--aia-grid-max"]=a),t&&(y["--aia-grid-gap"]=t),i&&(y["--aia-grid-max-height"]=i),o&&(y.gridTemplateColumns=(0,At.optionsGridTemplateColumns)(o)),d&&(y.gridTemplateColumns=d),(0,Ot.jsx)("div",{ref:O=>{m.current=O,k?.(O)},className:w?`aia-grid ${w}`:"aia-grid","data-scroll":n||void 0,style:y,...E,children:x})}var de=require("@magicx-eng/ai-autocomplete-vanilla"),le=require("react");if(typeof document<"u"&&!document.getElementById("ac-style-82820da7")){let e=document.createElement("style");e.id="ac-style-82820da7",e.textContent=`.aia-item-d4vpD {
|
|
1732
1732
|
position: relative;
|
|
1733
1733
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
1734
1734
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -2125,7 +2125,7 @@
|
|
|
2125
2125
|
opacity: 0;
|
|
2126
2126
|
}
|
|
2127
2127
|
}
|
|
2128
|
-
`,document.head.appendChild(e)}var
|
|
2128
|
+
`,document.head.appendChild(e)}var V={item:"aia-item-d4vpD",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",fadeIn:"aia-fadeIn-I8u35",tappable:"aia-tappable-70KcX",nonTappable:"aia-nonTappable-xSZM-",highlighted:"aia-highlighted-Hb0SU",tag:"aia-tag-e3Fwe",pressed:"aia-pressed-98o-r",pressCompress:"aia-pressCompress-ICV3q",scrollHint:"aia-scrollHint-xKXPt",skeletonPulse:"aia-skeletonPulse-plvdD",text:"aia-text-yqoh9",skeletonBarIn:"aia-skeletonBarIn-ZlEM0",icon:"aia-icon-Qw938",count:"aia-count-IpYbQ",image:"aia-image-YZAbO",skeletonOut:"aia-skeletonOut-x6NRd"};var se=require("react/jsx-runtime");function Dt({option:e,isHighlighted:a,onSelect:t,onHighlight:n,onUnhighlight:i,id:r,loading:o,showIcon:d=!0,showImage:k=!0,showCount:w=!0,scrollHint:x,enterDelayMs:E=0}){let[m]=(0,le.useState)(E),[y,O]=(0,le.useState)(!1),A=k?(0,de.optionImageSrc)(e.image_url):null,[Z,H]=(0,le.useState)(null),D=(0,le.useMemo)(()=>!A&&d&&e.icon_svg?(0,de.sanitizeOptionIconSvg)(e.icon_svg):null,[A,d,e.icon_svg]),T=w?(0,de.formatOptionCount)(e.item_count):null,F=(0,le.useRef)(void 0);(0,le.useEffect)(()=>()=>clearTimeout(F.current),[]);let R=()=>{o||!e.is_tappable||y||(O(!0),t(e),clearTimeout(F.current),F.current=setTimeout(()=>O(!1),170))},P=[V.item,a&&!o?V.highlighted:"",e.is_tappable?V.tappable:V.nonTappable,y?V.pressed:"",x?V.scrollHint:""].filter(Boolean).join(" ");return(0,se.jsx)("div",{id:r,role:"option","data-aia-option":"","data-aia-loading":o?"":void 0,"data-aia-icon":D&&e.icon?e.icon:void 0,"data-aia-image":A?"":void 0,"data-aia-item-count":T!==null?e.item_count:void 0,"aria-selected":a,className:P,style:{[de.OPTION_ENTER_DELAY_VAR]:`${m}ms`},tabIndex:o||!e.is_tappable?-1:0,onClick:R,onKeyDown:Q=>{!o&&e.is_tappable&&(Q.key==="Enter"||Q.key===" ")&&(Q.preventDefault(),R())},onMouseEnter:!o&&e.is_tappable?n:void 0,onMouseLeave:i,children:(0,se.jsxs)("span",{className:V.content,children:[A&&(0,se.jsx)("span",{className:`${V.image} magicx-aia-option-image`,"aria-hidden":"true",children:(0,se.jsx)("img",{src:A,alt:"",loading:"lazy",decoding:"async",referrerPolicy:"no-referrer",draggable:!1,hidden:Z===A,onError:()=>H(A)})}),D&&(0,se.jsx)("span",{className:`${V.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:D}}),(0,se.jsx)("span",{className:V.text,children:(0,de.optionLabel)(e)}),e.tag&&(0,se.jsx)("span",{className:V.tag,children:e.tag}),T!==null&&(0,se.jsx)("span",{className:`${V.count} magicx-aia-option-count`,children:T})]})})}var mt=require("react/jsx-runtime");function pa(){let[e,a]=(0,ce.useState)(U.isOptionsGridMobileViewport);return(0,ce.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(U.OPTIONS_GRID_MOBILE_QUERY),n=()=>a(t.matches);return n(),t.addEventListener("change",n),()=>t.removeEventListener("change",n)},[]),e}function Lt({options:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:r,loading:o,groupKey:d="",optionsPosition:k="below",showIcons:w=!0,showImages:x=!0,showCounts:E=!0}){let m=pa(),y=(0,ce.useRef)(null),[O,A]=(0,ce.useState)(null),Z=(0,ce.useRef)(null);(0,ce.useLayoutEffect)(()=>{if(o&&(0,U.sameOptionRows)(Z.current,e))return;Z.current=o?null:e;let D=y.current,F=D&&!o&&(0,U.needsOptionsGridMeasurement)(e.length,m)?(0,U.measureOptionsGrid)(D):null;A(F?(0,U.planOptionsGrid)(e.length,m,F.rowWidths,F.gridWidth):null)},[e,m,o]);let H=O??(0,U.planOptionsGrid)(e.length,m,null,null);return(0,mt.jsx)(Rt,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:d,template:H.template,maxHeight:H.maxHeight,innerRef:D=>{y.current=D},"data-aia-group":d,children:e.map((D,T)=>(0,mt.jsx)(Dt,{option:D,isHighlighted:T===a,onSelect:t,onHighlight:()=>n(T),onUnhighlight:i?()=>i(T):void 0,id:`${r}-option-${T}`,loading:o,showIcon:w,showImage:x,showCount:E,scrollHint:!o&&H.scrollHintIndices.includes(T),enterDelayMs:o?0:(0,U.optionEnterDelayMs)(T,H.cols,e.length,k)},`${d}\0${D.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
2129
2129
|
display: flex;
|
|
2130
2130
|
flex-direction: column;
|
|
2131
2131
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -2140,7 +2140,7 @@
|
|
|
2140
2140
|
align-items: end;
|
|
2141
2141
|
}
|
|
2142
2142
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
2143
|
-
`,document.head.appendChild(e)}var
|
|
2143
|
+
`,document.head.appendChild(e)}var zt=require("react/jsx-runtime");function Mt({space:e,align:a="stretch",className:t,children:n,...i}){let r=e?{"--aia-stack-space":e}:void 0;return(0,zt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":a,style:r,...i,children:n})}var K=require("react/jsx-runtime"),ha=[159,119,164],ua=()=>{},Nt=()=>{};function ma(e){let a=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,n]=(0,ee.useState)(a);if((0,ee.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let i=window.matchMedia("(prefers-color-scheme: dark)"),r=()=>n(i.matches);return i.addEventListener("change",r),()=>i.removeEventListener("change",r)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function ga(e,a){let t=(0,ee.useRef)(null);(0,ee.useEffect)(()=>{let n=e.current,i=a.current;if(!n||!i)return;let r=n.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==r&&(t.current.controller.destroy(),t.current=null),r&&!t.current){t.current={grid:r,controller:(0,Re.attachScrollArrow)({dropdown:n,grid:r,button:i})};return}t.current?.controller.update()}),(0,ee.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function at({suggestions:e,activeIndex:a,onSelect:t,onHighlight:n,onUnhighlight:i,isOpen:r,id:o,className:d,pills:k,onPillClick:w,showPills:x=!0,onSkip:E,showSkipButton:m=!0,showOptionIcons:y=!0,showOptionImages:O=!0,showOptionCounts:A=!0,skipDisabled:Z=!1,activeSelected:H=!1,isLoading:D=!1,skeletonExiting:T=!1,isInputEmpty:F=!1,products:R,onProductSelect:P,onProductFocusChange:Q,productsLayout:pe="row",productImageFallback:ye="image",formatType:he="options",dateView:ke=null,selectedDateIso:$=null,selectedDateRange:f=null,dateRangeStart:Oe=null,onPreviousMonth:Ce,onNextMonth:Pe,optionsPosition:ue="below",mode:Se}){let me=ma(Se),ie=me!==void 0,X=(0,ee.useRef)(null),ge=(0,ee.useRef)(null);ga(X,ge),(0,ee.useEffect)(()=>{if(X.current)return(0,Re.containScroll)(X.current)},[]);let fe=e[0]?.options??[],c=!!(k&&k.length>0&&w),g=!!(R&&R.length>0),u=r&&(fe.length>0||x&&c||D||g),b={suggestions:e,activeIndex:a,pills:k,showPills:x,showSkipButton:m,showOptionIcons:y,showOptionImages:O,showOptionCounts:A,skipDisabled:Z,activeSelected:H,isLoading:D,skeletonExiting:T,isInputEmpty:F,products:R,formatType:he,dateView:ke,selectedDateIso:$,selectedDateRange:f,dateRangeStart:Oe},C=(0,ee.useRef)(b);u&&(C.current=b);let l=u?b:C.current,W=l.suggestions[0],_=W?.options??[],oe=l.activeIndex>=0&&!!_[l.activeIndex]?.is_tappable,v=!!(l.pills&&l.pills.length>0&&w),De=l.showPills&&v,We=l.showPills&&!v&&l.isLoading,be=De||We,p=v&&l.showSkipButton&&!l.isInputEmpty&&!!E,ve=l.pills?.[0]?.text,Le=(0,Re.isCalendarFormat)(l.formatType)&&l.dateView!=null,Ie=_.length>0&&!Le,ze=_.length>0&&Le&&!l.isLoading,Ee=l.isLoading&&!Ie&&!ze,Ne=l.products??[];return(0,K.jsxs)("div",{ref:X,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":ue,"data-mode":me,"data-aia-loading":l.isLoading?"":void 0,"data-aia-skeleton-exiting":l.skeletonExiting?"":void 0,"data-aia-has-products":Ne.length>0?"":void 0,className:`${ie?"magicx-aia ":""}${we.dropdown} ${u?we.visible:""} ${d??""}`,onMouseDown:q=>q.preventDefault(),children:[(0,K.jsxs)(Mt,{space:"8px",children:[(be||p)&&(0,K.jsxs)(Ue,{noWrap:!0,className:we.pillBar,"data-aia-pillbar":"",children:[be&&(0,K.jsx)("span",{className:we.pillScroll,"data-aia-pill-scroll":"",children:(0,K.jsx)(Je,{pills:l.pills??[],activePillIndex:0,activeSelected:l.activeSelected,onSelectPill:w??(()=>{}),rounded:!0,loading:l.isLoading})}),p&&(0,K.jsx)("button",{type:"button",tabIndex:-1,className:we.skip,"data-aia-skip":"",disabled:l.isLoading||l.skipDisabled,"aria-label":ve?`Skip ${ve}`:"Skip",onClick:E,children:"skip"})]}),Ie&&(0,K.jsx)(Lt,{options:_,activeIndex:l.activeIndex,onSelect:t,onHighlight:n,onUnhighlight:i,listboxId:o,loading:l.isLoading,groupKey:W?`${W.type} ${W.text}`:"",optionsPosition:ue,showIcons:l.showOptionIcons,showImages:l.showOptionImages,showCounts:l.showOptionCounts}),ze&&l.dateView&&(0,K.jsx)(Ct,{options:_,activeIndex:l.activeIndex,listboxId:o,view:l.dateView,selection:{selectedIso:l.selectedDateIso??null,selectedRange:l.selectedDateRange??null,rangeStart:l.dateRangeStart??null},onSelect:t,onHighlight:n,onUnhighlight:i,onPreviousMonth:Ce??Nt,onNextMonth:Pe??Nt}),Ee&&(0,K.jsx)("div",{className:we.skeletonBars,"data-aia-skeleton-bars":"",children:ha.map(q=>(0,K.jsx)("span",{className:we.skeletonBar,style:{width:q}},`bar-${q}`))}),(0,K.jsx)(Tt,{products:Ne,listboxId:o,onSelect:P??ua,onFocusChange:Q,focusable:u,layout:pe,imageFallback:ye}),(0,K.jsx)(Pt,{isOptionHighlighted:oe,isInputEmpty:l.isInputEmpty})]}),(0,K.jsx)("button",{ref:ge,type:"button",tabIndex:-1,className:we.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Re.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,K.jsx)("svg",{viewBox:"0 0 16 16",width:"18",height:"18",fill:"none",stroke:"currentColor",strokeWidth:"1.75",strokeLinecap:"round",strokeLinejoin:"round","aria-hidden":"true",focusable:"false",children:(0,K.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Ge=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=`.aia-submitButton-otz7H {
|
|
2144
2144
|
flex-shrink: 0;
|
|
2145
2145
|
width: 32px;
|
|
2146
2146
|
height: 32px;
|
|
@@ -2193,5 +2193,5 @@
|
|
|
2193
2193
|
);
|
|
2194
2194
|
cursor: default;
|
|
2195
2195
|
}
|
|
2196
|
-
`,document.head.appendChild(e)}var Lt={submitButton:"aia-submitButton-otz7H"};var et=require("react/jsx-runtime");function zt({disabled:e,onClick:a}){return(0,et.jsx)("button",{type:"button","data-aia-submit":"",className:Lt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),a()},"aria-label":"Submit",children:(0,et.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,et.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Fe=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react");var pt=require("react");function Mt(e){let a=(0,pt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,pt.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let i={};for(let r of Object.keys(e??{})){let o=(d,x,v)=>{let w=a.current?.[r];return w?w(d,x,v):[]};i[r]=o}n.current={key:t,overrides:e?i:void 0}}return{overrides:n.current.overrides,key:t}}var ht=require("react");function Nt(e){let a=(0,ht.useRef)(e);a.current=e;let t=(0,ht.useRef)(null);t.current===null&&(t.current={fetch:(i,r)=>{let o=a.current;return o?o.fetch(i,r):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var ma={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function tt({onSubmit:e,onResult:a,onError:t,optionOverrides:n,maskCompletedText:i,apiConfig:r,additionalContext:o,columns:d=2,dropdownTrigger:x,optionsPosition:v,closeDropdownOnBlur:w,showNonTappableOptions:S,showOptionIcons:f,showOptionImages:y,showOptionCounts:O,showSkipButton:T,showProducts:K,productImageFallback:G="image",onFocus:A,onBlur:D,value:L,completedParams:R,onChange:E,onParamsChange:_,products:ye,onProductSelect:he,source:ke,setCursor:ue}){let p=(0,I.useRef)(null),[De,Ce]=(0,I.useState)(null),Pe=(0,I.useRef)(e);Pe.current=e;let Se=(0,I.useRef)(a);Se.current=a;let me=(0,I.useRef)(t);me.current=t;let Ie=(0,I.useRef)(E);Ie.current=E;let V=(0,I.useRef)(_);V.current=_;let ge=(0,I.useRef)(A);ge.current=A;let X=(0,I.useRef)(D);X.current=D;let ie=(0,I.useRef)(ue);ie.current=ue;let fe=(0,I.useRef)(he);fe.current=he;let c=Nt(ye),h=Mt(n);(0,I.useEffect)(()=>{if(typeof document>"u")return;let m=new Fe.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:o,optionOverrides:h.overrides,maskCompletedText:i,columns:d,dropdownTrigger:x,optionsPosition:v,closeDropdownOnBlur:w,showNonTappableOptions:S,showProducts:K,source:ke,value:L,completedParams:R,onSubmit:(...H)=>Pe.current?.(...H),onResult:(...H)=>Se.current?.(...H),onError:(...H)=>me.current?.(...H),onChange:(...H)=>Ie.current?.(...H),onParamsChange:(...H)=>V.current?.(...H),onFocus:()=>ge.current?.(),onBlur:()=>X.current?.(),onProductSelect:H=>fe.current?.(H),setCursor:H=>ie.current?.(H),products:c.config});p.current=m,Ce(m.getState());let Z=m.subscribe(H=>Ce(H));return()=>{Z(),m.destroy(),p.current===m&&(p.current=null)}},[]),(0,I.useEffect)(()=>{L!==void 0&&p.current?.setValue(L)},[L]),(0,I.useEffect)(()=>{R!==void 0&&p.current?.setCompletedParams(R)},[R]);let b=JSON.stringify(r??null),C;try{C=JSON.stringify(o??null)}catch{C="[unstringifiable]"}(0,I.useEffect)(()=>{p.current?.update({apiConfig:r,additionalContext:o,optionOverrides:h.overrides,dropdownTrigger:x,optionsPosition:v,closeDropdownOnBlur:w,showNonTappableOptions:S,showProducts:K})},[b,C,h.key,x,v,w,S,K]);let k=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!k.current){k.current=!0;return}p.current?.update({products:c.config})},[c.enabled]);let l=(0,I.useRef)(null);l.current===null&&(l.current={handleTextChange:m=>p.current?.handleTextChange(m),handleKeyDown:m=>{let Z="nativeEvent"in m?m.nativeEvent:m;p.current?.handleKeyDown(Z)},setFocused:m=>p.current?.setFocused(m),startEditingParam:m=>p.current?.startEditingParam(m),exitEditMode:()=>p.current?.exitEditMode(),handleCaretAfterInput:m=>p.current?.handleCaretAfterInput(m),handleCaretMove:m=>p.current?.handleCaretMove(m),replaceEditingRange:m=>p.current?.replaceEditingRange(m)??!1,setActivePill:m=>p.current?.setActivePill(m),skipActivePill:()=>p.current?.skipActivePill(),removeLastParam:()=>p.current?.removeLastParam(),clearNewParamId:()=>p.current?.clearNewParamId(),reset:()=>p.current?.reset(),selectOption:m=>p.current?.selectOption(m),selectProduct:m=>p.current?.selectProduct(m),setActiveDropdownIndex:m=>p.current?.setActiveDropdownIndex(m),clearHighlight:m=>p.current?.clearHighlight(m),showPreviousMonth:()=>p.current?.showPreviousMonth(),showNextMonth:()=>p.current?.showNextMonth(),handleFocus:()=>p.current?.setFocused(!0),handleBlur:()=>p.current?.setFocused(!1)});let g=l.current,q=(0,I.useCallback)(m=>{let Z=m.target.value,it=Z.length>0&&!m.nativeEvent?.isComposing&&Z[0]!==Z[0].toUpperCase()?Z[0].toUpperCase()+Z.slice(1):Z;p.current?.handleTextChange(it)},[]),Ee=(0,I.useCallback)(m=>{p.current?.handleKeyDown(m.nativeEvent)},[]),J=p.current,u=De??ma,Le=L!==void 0?L:u.text,Te=R!==void 0?R:u.completedParams,oe=u.actionableSuggestions,ze=oe[0],be=J?.listboxId??"",Ne=u.activeDropdownIndex>=0&&J?`${be}-option-${u.activeDropdownIndex}`:void 0,ee=u.editingParam,ve=u.editingIdentified,ne=ee?{type:ee.suggestionType,text:ee.suggestionPlaceholder,required:!0,options:ee.options}:ve?{type:ve.type,text:(0,Fe.identifiedParamLabel)(ve.type),required:!0,options:[]}:null,re=u.dropdownSuggestion??ne??ze,qe=ne?[ne]:oe,Ge=(0,Fe.dateSelectionFor)(u),Ue=!J||u.dropdownLoading;return{completedParams:Te,skippedParams:u.skippedParams,identifiedParams:u.identifiedParams,suggestionPills:oe,setActivePill:g.setActivePill,skipActivePill:g.skipActivePill,removeLastParam:g.removeLastParam,segments:u.segments,newParamId:u.newParamId,clearNewParamId:g.clearNewParamId,suggestions:u.suggestions,activeIndex:u.activeDropdownIndex,isReady:u.isReady,isLoading:Ue,isFocused:u.isFocused,isDropdownOpen:u.isDropdownOpen,isActivePillSelected:u.isActivePillSelected,placeholderText:u.placeholderText,listboxId:be,error:u.error,products:u.products,customFields:u.customFields,selectProduct:g.selectProduct,handleTextChange:g.handleTextChange,handleKeyDown:g.handleKeyDown,setFocused:g.setFocused,editingParam:ee,editingIdentified:ve,editingAnchor:u.editingAnchor,caretOffset:u.caretOffset,startEditingParam:g.startEditingParam,exitEditMode:g.exitEditMode,handleCaretAfterInput:g.handleCaretAfterInput,handleCaretMove:g.handleCaretMove,replaceEditingRange:g.replaceEditingRange,inputProps:{value:Le,placeholder:u.placeholderText||void 0,onChange:q,onKeyDown:Ee,onFocus:g.handleFocus,onBlur:g.handleBlur,role:"combobox","aria-expanded":u.isDropdownOpen,"aria-activedescendant":Ne,"aria-autocomplete":"list","aria-controls":be},reset:g.reset,dropdownProps:{suggestions:re?[{...re,options:u.dropdownOptions}]:[],activeIndex:u.activeDropdownIndex,onSelect:g.selectOption,onHighlight:g.setActiveDropdownIndex,onUnhighlight:g.clearHighlight,isOpen:u.isDropdownOpen,id:be,pills:qe,activeSelected:u.isActivePillSelected,onPillClick:g.setActivePill,onSkip:g.skipActivePill,showSkipButton:(T??!0)&&!ee&&!ve,showOptionIcons:f??!0,showOptionImages:y??!0,showOptionCounts:O??!0,skipDisabled:u.inSelectionAnimation,isLoading:Ue,skeletonExiting:u.skeletonExiting,isInputEmpty:Le.trim().length===0,products:u.products,productImageFallback:G,onProductSelect:g.selectProduct,onProductFocusChange:g.setFocused,formatType:u.activeFormatType,dateView:u.dateView,selectedDateIso:Ge.selectedIso,selectedDateRange:Ge.selectedRange,dateRangeStart:Ge.rangeStart,onPreviousMonth:g.showPreviousMonth,onNextMonth:g.showNextMonth,optionsPosition:v??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),P=require("react"),at;function ga(){if(at!==void 0)return at;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),at=e.contentEditable==="plaintext-only",at}function Bt(e){let{segments:a,showChipIcons:t=!0,showChipImages:n=!0,newParamId:i,editingParam:r,editingIdentified:o,editingAnchor:d,caretOffset:x,placeholderText:v,isFocused:w,isDropdownOpen:S,listboxId:f,activeDescendantId:y,autoFocus:O,handleTextChange:T,handleKeyDown:K,handleCaretAfterInput:G,handleCaretMove:A,startEditingParam:D,replaceEditingRange:L,setFocused:R}=e,E=(0,P.useRef)(null),_=(0,P.useRef)(!1),ye=(0,P.useRef)(""),he=(0,P.useRef)(""),ke=(0,P.useRef)(null),ue=(0,P.useRef)(0);ke.current=x,(0,P.useEffect)(()=>{if(!O)return;let c=E.current;if(!c)return;document.activeElement===c?R(!0):c.focus();let h=c.ownerDocument??document,b=h.getSelection(),C=b&&b.rangeCount>0&&c.contains(b.anchorNode);if(b&&!C){let k=h.createRange();k.selectNodeContents(c),k.collapse(!0),b.removeAllRanges(),b.addRange(k)}},[O,R]),(0,P.useEffect)(()=>{let c=E.current;if(!c)return;let h=c.ownerDocument??document,b=()=>{let C=h.getSelection();if(!C||C.rangeCount===0||!C.anchorNode||!c.contains(C.anchorNode))return;let k=C.anchorNode,l=k.nodeType===Node.ELEMENT_NODE?k:k.parentElement,q=(C.isCollapsed?l?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,Ee=r?.id??o?.id??null;if(q&&q!==Ee){D(q);return}performance.now()-ue.current<50||A((0,j.getCursorOffset)(c))};return h.addEventListener("selectionchange",b),()=>h.removeEventListener("selectionchange",b)},[r,o,D,A]),(0,P.useLayoutEffect)(()=>{let c=E.current;c&&(0,j.renderEditableContent)({input:c,segments:a,newParamId:i,editingParamId:r?.id??null,placeholderText:v??"",isFocused:w,showChipIcons:t,showChipImages:n})},[a,i,r,v,w,t,n]),(0,P.useLayoutEffect)(()=>{let c=ye.current,h=i??"";if(ye.current=h,!h||h===c)return;let b=E.current;if(!b)return;b.focus();let C=ke.current??(0,j.plainTextLength)(b);(0,j.setCursorOffset)(b,C)},[i]),(0,P.useLayoutEffect)(()=>{let c=he.current,h=r?.id??"";if(he.current=h,!h||h===c||d==null)return;let b=E.current;b&&(0,j.setCursorOffset)(b,d)},[r,d]);let p=(0,P.useCallback)(()=>{if(_.current)return;let c=E.current;if(!c)return;let h=(0,j.extractPlainText)(c),C=h.length>0&&h[0]!==h[0].toUpperCase()?h[0].toUpperCase()+h.slice(1):h;T(C)},[T]),De=(0,P.useCallback)(()=>{ue.current=performance.now(),p();let c=E.current;c&&G((0,j.getCursorOffset)(c))},[p,G]);(0,P.useEffect)(()=>{let c=E.current;if(!c)return;let h=b=>{let C=b,k=C.inputType;if(k==="insertParagraph"||k==="insertLineBreak"||k==="insertFromDrop"){b.preventDefault();return}if(k.startsWith("insert")||k.startsWith("delete")){let l=k.startsWith("delete")?"":C.data??"";L(l)&&b.preventDefault()}};return c.addEventListener("beforeinput",h),()=>c.removeEventListener("beforeinput",h)},[L]);let Ce=(0,P.useCallback)(()=>{_.current=!0},[]),Pe=(0,P.useCallback)(()=>{_.current=!1,p()},[p]),Se=(0,P.useCallback)(c=>{c.preventDefault();let h=E.current;if(!h)return;let b=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!b)return;let C=h.ownerDocument??document,k=C.getSelection();if(!k||k.rangeCount===0)return;let l=k.getRangeAt(0);if(!h.contains(l.startContainer))return;l.deleteContents();let g=C.createTextNode(b);l.insertNode(g),l.setStartAfter(g),l.collapse(!0),k.removeAllRanges(),k.addRange(l),p()},[p]),me=(0,P.useCallback)(c=>K(c),[K]),Ie=(0,P.useCallback)(()=>R(!0),[R]),V=(0,P.useCallback)(()=>R(!1),[R]),ge=(0,P.useCallback)(()=>E.current?.focus(),[]),X=(0,P.useCallback)(()=>E.current?.blur(),[]),ie=(0,P.useCallback)(()=>{let c=E.current;return c?(0,j.extractPlainText)(c):""},[]),fe=ga()?"plaintext-only":"true";return{inputRef:E,editorProps:{ref:E,contentEditable:fe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":f,"aria-expanded":S,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:De,onKeyDown:me,onCompositionStart:Ce,onCompositionEnd:Pe,onPaste:Se,onFocus:Ie,onBlur:V},getPlainText:ie,focus:ge,blur:X}}var ae=require("react/jsx-runtime");function fa(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Ht=(0,B.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,className:o,apiConfig:d,additionalContext:x,columns:v,pillPlacement:w="dropdown",mode:S="auto",optionsPosition:f="below",animations:y=!0,dropdownTrigger:O,closeDropdownOnBlur:T,showNonTappableOptions:K,showOptionIcons:G=!0,showChipIcons:A=!0,showChipImages:D=!0,showOptionImages:L=!0,showOptionCounts:R=!0,showSkipButton:E,showProducts:_,productsLayout:ye,productImageFallback:he,autoFocus:ke=!0,onFocus:ue,onBlur:p,value:De,completedParams:Ce,onChange:Pe,onParamsChange:Se,products:me,onProductSelect:Ie,submitButton:V,resetOnSubmit:ge=!0},X){let ie=(0,B.useRef)(null),fe=(0,B.useRef)(null),c=(0,B.useRef)(()=>{}),h=(0,B.useRef)(null),b=(0,B.useRef)(null);(0,B.useEffect)(()=>{let z=ie.current;if(z)return h.current?h.current.setMode(S):h.current=new Ke.ModeController(z,S),()=>{h.current?.destroy(),h.current=null}},[S]);let C=(0,B.useCallback)(z=>{let Ae=b.current?.current;Ae&&(Ae.focus(),(0,Ke.setCursorOffset)(Ae,z))},[]),{completedParams:k,skippedParams:l,identifiedParams:g,isReady:q,customFields:Ee,suggestionPills:J,setActivePill:u,skipActivePill:Le,segments:Te,newParamId:oe,clearNewParamId:ze,placeholderText:be,isFocused:Ne,isDropdownOpen:ee,isActivePillSelected:ve,isLoading:ne,activeIndex:re,listboxId:qe,handleTextChange:Ge,handleKeyDown:Ue,setFocused:m,editingParam:Z,editingIdentified:H,editingAnchor:it,caretOffset:Ft,startEditingParam:Kt,handleCaretAfterInput:Gt,handleCaretMove:Wt,replaceEditingRange:_t,dropdownProps:qt,reset:Qe}=tt({onSubmit:z=>c.current(z),onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,apiConfig:d,additionalContext:x,columns:v,dropdownTrigger:O,optionsPosition:f,closeDropdownOnBlur:T,showNonTappableOptions:K,showOptionIcons:G,showOptionImages:L,showOptionCounts:R,showSkipButton:E,showProducts:_,onFocus:ue,onBlur:p,value:De,completedParams:Ce,onChange:Pe,onParamsChange:Se,products:me,onProductSelect:Ie,source:"full-sdk",setCursor:C});(0,B.useEffect)(()=>{if(!oe)return;let z=window.setTimeout(()=>ze(),650);return()=>window.clearTimeout(z)},[oe,ze]);let Ut=re>=0?`${qe}-option-${re}`:void 0,{inputRef:ot,editorProps:Qt,focus:Ye,blur:ut,getPlainText:mt}=Bt({segments:Te,newParamId:oe,editingParam:Z,editingIdentified:H,editingAnchor:it,caretOffset:Ft,placeholderText:be,isFocused:Ne,showChipIcons:A,showChipImages:D,isDropdownOpen:ee,listboxId:qe,activeDescendantId:Ut,autoFocus:ke,handleTextChange:Ge,handleKeyDown:Ue,handleCaretAfterInput:Gt,handleCaretMove:Wt,startEditingParam:Kt,replaceEditingRange:_t,setFocused:m});b.current=ot,(0,B.useLayoutEffect)(()=>{let z=fe.current,Ae=ot.current;if(!z||!Ae)return;let gt=()=>{let bt=z.firstElementChild;if(!bt)return;let $t=bt.getBoundingClientRect(),Vt=Ae.getBoundingClientRect();$t.top>=Vt.bottom-2?z.setAttribute("data-aia-pill-wrapped",""):z.removeAttribute("data-aia-pill-wrapped")};gt();let ft=new ResizeObserver(gt);return ft.observe(Ae),()=>ft.disconnect()},[Te,J.length,ne,ot]),(0,B.useImperativeHandle)(X,()=>({focus:Ye,blur:ut,reset:Qe,setMode:z=>h.current?.setMode(z),skipActivePill:Le}),[Ye,ut,Qe,Le]);let je=!!Te.length||k.length>0,nt=(0,B.useCallback)(()=>{if(!je)return;let z=mt();a((0,Ke.buildSubmitResult)(z,k,l,{identifiedParams:g,isReady:q,customFields:Ee})),ge&&Qe()},[ge,je,k,l,g,q,Ee,a,Qe,mt]);c.current=nt;let Yt=(0,B.useCallback)(z=>{z.target?.closest("[data-aia-pill]")||Ye()},[Ye]),jt=w==="inline",Zt=w==="dropdown";return(0,ae.jsxs)("div",{ref:ie,className:`magicx-aia ${Me.container} ${o??""}`,"data-pill-placement":w,"data-options-position":f,"data-animations":y?"on":"off","data-mode":fa(S),children:[(0,ae.jsx)(Je,{...qt,showPills:Zt,productsLayout:ye,productImageFallback:he}),(0,ae.jsxs)("div",{className:Me.inputWrapper,"data-aia-input-wrapper":"",onClick:Yt,children:[(0,ae.jsxs)("div",{className:Me.editorArea,"data-aia-editor":"",children:[(0,ae.jsx)("div",{...Qt,className:Me.input,"data-aia-input":""}),jt&&(ne||J.length>0)&&(0,ae.jsx)("span",{ref:fe,className:Me.pillListContainer,"data-aia-pill-list-container":"",children:(0,ae.jsx)($e,{pills:J,activePillIndex:0,activeSelected:ve,onSelectPill:u,loading:ne})})]}),V===null?null:V===void 0?(0,ae.jsx)(zt,{disabled:!je,onClick:nt}):(0,ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Me.submitSlot,onClick:z=>{je&&(z.stopPropagation(),nt())},children:V})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSrc,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
2196
|
+
`,document.head.appendChild(e)}var Bt={submitButton:"aia-submitButton-otz7H"};var it=require("react/jsx-runtime");function Ht({disabled:e,onClick:a}){return(0,it.jsx)("button",{type:"button","data-aia-submit":"",className:Bt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),a()},"aria-label":"Submit",children:(0,it.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,it.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Ke=require("@magicx-eng/ai-autocomplete-vanilla"),I=require("react");var gt=require("react");function Ft(e){let a=(0,gt.useRef)(e);a.current=e;let t=Object.keys(e??{}).sort().join("\0"),n=(0,gt.useRef)({key:"",overrides:void 0});if(n.current.key!==t){let i={};for(let r of Object.keys(e??{})){let o=(d,k,w)=>{let x=a.current?.[r];return x?x(d,k,w):[]};i[r]=o}n.current={key:t,overrides:e?i:void 0}}return{overrides:n.current.overrides,key:t}}var ft=require("react");function Kt(e){let a=(0,ft.useRef)(e);a.current=e;let t=(0,ft.useRef)(null);t.current===null&&(t.current={fetch:(i,r)=>{let o=a.current;return o?o.fetch(i,r):Promise.reject(new Error("products config removed"))},transform:i=>a.current?.transform(i)??[],get limit(){return a.current?.limit}});let n=e!==void 0;return{config:n?t.current:void 0,enabled:n}}var fa={text:"",completedParams:[],identifiedParams:[],skippedParams:[],pendingSpan:null,suggestions:[],products:[],customFields:null,optionSearch:null,activeDropdownIndex:-1,newParamId:null,isLoading:!0,isReady:!1,error:null,segments:[],actionableSuggestions:[],filteredOptions:[],dropdownLoading:!0,dropdownOptions:[],skeletonOptions:null,skeletonSuggestion:null,dropdownSuggestion:null,skeletonRequested:!1,skeletonExiting:!1,activeFormatType:"options",dateView:null,dateRangeStart:null,placeholderText:"",optionQuery:"",isSearchingOptions:!1,isDropdownOpen:!1,isActivePillSelected:!1,filterBase:0,filterInProgress:!1,pillTapped:!1,skipNextFetch:!1,lastRawQuery:"",isFocused:!1,editingParam:null,editingIdentified:null,editingAnchor:null,editingTail:null,caretOffset:null,inSelectionAnimation:!1,dateViewMonth:null,pendingRangeStart:null};function ot({onSubmit:e,onResult:a,onError:t,optionOverrides:n,maskCompletedText:i,apiConfig:r,additionalContext:o,visitorId:d,columns:k=2,dropdownTrigger:w,optionsPosition:x,closeDropdownOnBlur:E,showNonTappableOptions:m,showOptionIcons:y,showOptionImages:O,showOptionCounts:A,showSkipButton:Z,showProducts:H,productImageFallback:D="image",onFocus:T,onBlur:F,value:R,completedParams:P,onChange:Q,onParamsChange:pe,products:ye,onProductSelect:he,source:ke,setCursor:$}){let f=(0,I.useRef)(null),[Oe,Ce]=(0,I.useState)(null),Pe=(0,I.useRef)(e);Pe.current=e;let ue=(0,I.useRef)(a);ue.current=a;let Se=(0,I.useRef)(t);Se.current=t;let me=(0,I.useRef)(Q);me.current=Q;let ie=(0,I.useRef)(pe);ie.current=pe;let X=(0,I.useRef)(T);X.current=T;let ge=(0,I.useRef)(F);ge.current=F;let fe=(0,I.useRef)($);fe.current=$;let c=(0,I.useRef)(he);c.current=he;let g=(0,I.useRef)(d);g.current=d;let u=(0,I.useRef)(()=>{let h=g.current;return typeof h=="function"?h():h}).current,b=Kt(ye),C=Ft(n);(0,I.useEffect)(()=>{if(typeof document>"u")return;let h=new Ke.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:r,additionalContext:o,visitorId:u,optionOverrides:C.overrides,maskCompletedText:i,columns:k,dropdownTrigger:w,optionsPosition:x,closeDropdownOnBlur:E,showNonTappableOptions:m,showProducts:H,source:ke,value:R,completedParams:P,onSubmit:(...B)=>Pe.current?.(...B),onResult:(...B)=>ue.current?.(...B),onError:(...B)=>Se.current?.(...B),onChange:(...B)=>me.current?.(...B),onParamsChange:(...B)=>ie.current?.(...B),onFocus:()=>X.current?.(),onBlur:()=>ge.current?.(),onProductSelect:B=>c.current?.(B),setCursor:B=>fe.current?.(B),products:b.config});f.current=h,Ce(h.getState());let J=h.subscribe(B=>Ce(B));return()=>{J(),h.destroy(),f.current===h&&(f.current=null)}},[]),(0,I.useEffect)(()=>{R!==void 0&&f.current?.setValue(R)},[R]),(0,I.useEffect)(()=>{P!==void 0&&f.current?.setCompletedParams(P)},[P]);let l=JSON.stringify(r??null),W;try{W=JSON.stringify(o??null)}catch{W="[unstringifiable]"}(0,I.useEffect)(()=>{f.current?.update({apiConfig:r,additionalContext:o,optionOverrides:C.overrides,dropdownTrigger:w,optionsPosition:x,closeDropdownOnBlur:E,showNonTappableOptions:m,showProducts:H})},[l,W,C.key,w,x,E,m,H]);let _=(0,I.useRef)(!1);(0,I.useEffect)(()=>{if(!_.current){_.current=!0;return}f.current?.update({products:b.config})},[b.enabled]);let oe=(0,I.useRef)(null);oe.current===null&&(oe.current={handleTextChange:h=>f.current?.handleTextChange(h),handleKeyDown:h=>{let J="nativeEvent"in h?h.nativeEvent:h;f.current?.handleKeyDown(J)},setFocused:h=>f.current?.setFocused(h),startEditingParam:h=>f.current?.startEditingParam(h),exitEditMode:()=>f.current?.exitEditMode(),handleCaretAfterInput:h=>f.current?.handleCaretAfterInput(h),handleCaretMove:h=>f.current?.handleCaretMove(h),replaceEditingRange:h=>f.current?.replaceEditingRange(h)??!1,setActivePill:h=>f.current?.setActivePill(h),skipActivePill:()=>f.current?.skipActivePill(),removeLastParam:()=>f.current?.removeLastParam(),clearNewParamId:()=>f.current?.clearNewParamId(),reset:()=>f.current?.reset(),recordSubmit:h=>f.current?.recordSubmit(h),selectOption:h=>f.current?.selectOption(h),selectProduct:h=>f.current?.selectProduct(h),setActiveDropdownIndex:h=>f.current?.setActiveDropdownIndex(h),clearHighlight:h=>f.current?.clearHighlight(h),showPreviousMonth:()=>f.current?.showPreviousMonth(),showNextMonth:()=>f.current?.showNextMonth(),handleFocus:()=>f.current?.setFocused(!0),handleBlur:()=>f.current?.setFocused(!1)});let v=oe.current,De=(0,I.useCallback)(h=>{let J=h.target.value,st=J.length>0&&!h.nativeEvent?.isComposing&&J[0]!==J[0].toUpperCase()?J[0].toUpperCase()+J.slice(1):J;f.current?.handleTextChange(st)},[]),We=(0,I.useCallback)(h=>{f.current?.handleKeyDown(h.nativeEvent)},[]),be=f.current,p=Oe??fa,ve=R!==void 0?R:p.text,Le=P!==void 0?P:p.completedParams,Ie=p.actionableSuggestions,ze=Ie[0],Ee=be?.listboxId??"",Ne=p.activeDropdownIndex>=0&&be?`${Ee}-option-${p.activeDropdownIndex}`:void 0,q=p.editingParam,Te=p.editingIdentified,Be=q?{type:q.suggestionType,text:q.suggestionPlaceholder,required:!0,options:q.options}:Te?{type:Te.type,text:(0,Ke.identifiedParamLabel)(Te.type),required:!0,options:[]}:null,Ye=p.dropdownSuggestion??Be??ze,rt=Be?[Be]:Ie,_e=(0,Ke.dateSelectionFor)(p),je=!be||p.dropdownLoading;return{completedParams:Le,skippedParams:p.skippedParams,identifiedParams:p.identifiedParams,suggestionPills:Ie,setActivePill:v.setActivePill,skipActivePill:v.skipActivePill,removeLastParam:v.removeLastParam,segments:p.segments,newParamId:p.newParamId,clearNewParamId:v.clearNewParamId,suggestions:p.suggestions,activeIndex:p.activeDropdownIndex,isReady:p.isReady,isLoading:je,isFocused:p.isFocused,isDropdownOpen:p.isDropdownOpen,isActivePillSelected:p.isActivePillSelected,placeholderText:p.placeholderText,listboxId:Ee,error:p.error,products:p.products,customFields:p.customFields,selectProduct:v.selectProduct,handleTextChange:v.handleTextChange,handleKeyDown:v.handleKeyDown,setFocused:v.setFocused,editingParam:q,editingIdentified:Te,editingAnchor:p.editingAnchor,caretOffset:p.caretOffset,startEditingParam:v.startEditingParam,exitEditMode:v.exitEditMode,handleCaretAfterInput:v.handleCaretAfterInput,handleCaretMove:v.handleCaretMove,replaceEditingRange:v.replaceEditingRange,inputProps:{value:ve,placeholder:p.placeholderText||void 0,onChange:De,onKeyDown:We,onFocus:v.handleFocus,onBlur:v.handleBlur,role:"combobox","aria-expanded":p.isDropdownOpen,"aria-activedescendant":Ne,"aria-autocomplete":"list","aria-controls":Ee},reset:v.reset,recordSubmit:v.recordSubmit,dropdownProps:{suggestions:Ye?[{...Ye,options:p.dropdownOptions}]:[],activeIndex:p.activeDropdownIndex,onSelect:v.selectOption,onHighlight:v.setActiveDropdownIndex,onUnhighlight:v.clearHighlight,isOpen:p.isDropdownOpen,id:Ee,pills:rt,activeSelected:p.isActivePillSelected,onPillClick:v.setActivePill,onSkip:v.skipActivePill,showSkipButton:(Z??!0)&&!q&&!Te,showOptionIcons:y??!0,showOptionImages:O??!0,showOptionCounts:A??!0,skipDisabled:p.inSelectionAnimation,isLoading:je,skeletonExiting:p.skeletonExiting,isInputEmpty:ve.trim().length===0,products:p.products,productImageFallback:D,onProductSelect:v.selectProduct,onProductFocusChange:v.setFocused,formatType:p.activeFormatType,dateView:p.dateView,selectedDateIso:_e.selectedIso,selectedDateRange:_e.selectedRange,dateRangeStart:_e.rangeStart,onPreviousMonth:v.showPreviousMonth,onNextMonth:v.showNextMonth,optionsPosition:x??"below"}}}var G=require("@magicx-eng/ai-autocomplete-vanilla"),S=require("react"),nt;function ba(){if(nt!==void 0)return nt;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),nt=e.contentEditable==="plaintext-only",nt}function Gt(e){let{segments:a,showChipIcons:t=!0,showChipImages:n=!0,newParamId:i,editingParam:r,editingIdentified:o,editingAnchor:d,caretOffset:k,placeholderText:w,isFocused:x,isDropdownOpen:E,listboxId:m,activeDescendantId:y,autoFocus:O,handleTextChange:A,handleKeyDown:Z,handleCaretAfterInput:H,handleCaretMove:D,startEditingParam:T,replaceEditingRange:F,setFocused:R}=e,P=(0,S.useRef)(null),Q=(0,S.useRef)(!1),pe=(0,S.useRef)(""),ye=(0,S.useRef)(""),he=(0,S.useRef)(null),ke=(0,S.useRef)(0);he.current=k,(0,S.useEffect)(()=>{if(!O)return;let c=P.current;if(!c)return;document.activeElement===c?R(!0):c.focus();let g=c.ownerDocument??document,u=g.getSelection(),b=u&&u.rangeCount>0&&c.contains(u.anchorNode);if(u&&!b){let C=g.createRange();C.selectNodeContents(c),C.collapse(!0),u.removeAllRanges(),u.addRange(C)}},[O,R]),(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let g=c.ownerDocument??document,u=()=>{let b=g.getSelection();if(!b||b.rangeCount===0||!b.anchorNode||!c.contains(b.anchorNode))return;let C=b.anchorNode,l=C.nodeType===Node.ELEMENT_NODE?C:C.parentElement,_=(b.isCollapsed?l?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,oe=r?.id??o?.id??null;if(_&&_!==oe){T(_);return}performance.now()-ke.current<50||D((0,G.getCursorOffset)(c))};return g.addEventListener("selectionchange",u),()=>g.removeEventListener("selectionchange",u)},[r,o,T,D]),(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let g=u=>{let b=(0,G.chipIdFromTap)(c,u.target);b&&(T(b),(0,G.keepCaretOnChip)(c,b))};return c.addEventListener("click",g),()=>c.removeEventListener("click",g)},[T]),(0,S.useLayoutEffect)(()=>{let c=P.current;c&&(0,G.renderEditableContent)({input:c,segments:a,newParamId:i,editingParamId:r?.id??null,placeholderText:w??"",isFocused:x,showChipIcons:t,showChipImages:n})},[a,i,r,w,x,t,n]),(0,S.useLayoutEffect)(()=>{let c=pe.current,g=i??"";if(pe.current=g,!g||g===c)return;let u=P.current;if(!u)return;u.focus();let b=he.current??(0,G.plainTextLength)(u);(0,G.setCursorOffset)(u,b)},[i]),(0,S.useLayoutEffect)(()=>{let c=ye.current,g=r?.id??"";if(ye.current=g,!g||g===c||d==null)return;let u=P.current;u&&(0,G.setCursorOffset)(u,d)},[r,d]);let $=(0,S.useCallback)(()=>{if(Q.current)return;let c=P.current;if(!c)return;let g=(0,G.extractPlainText)(c),b=g.length>0&&g[0]!==g[0].toUpperCase()?g[0].toUpperCase()+g.slice(1):g;A(b)},[A]),f=(0,S.useCallback)(()=>{ke.current=performance.now(),$();let c=P.current;c&&H((0,G.getCursorOffset)(c))},[$,H]);(0,S.useEffect)(()=>{let c=P.current;if(!c)return;let g=u=>{let b=u,C=b.inputType;if(C==="insertParagraph"||C==="insertLineBreak"||C==="insertFromDrop"){u.preventDefault();return}if(C.startsWith("insert")||C.startsWith("delete")){let l=C.startsWith("delete")?"":b.data??"";F(l)&&u.preventDefault()}};return c.addEventListener("beforeinput",g),()=>c.removeEventListener("beforeinput",g)},[F]);let Oe=(0,S.useCallback)(()=>{Q.current=!0},[]),Ce=(0,S.useCallback)(()=>{Q.current=!1,$()},[$]),Pe=(0,S.useCallback)(c=>{c.preventDefault();let g=P.current;if(!g)return;let u=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!u)return;let b=g.ownerDocument??document,C=b.getSelection();if(!C||C.rangeCount===0)return;let l=C.getRangeAt(0);if(!g.contains(l.startContainer))return;l.deleteContents();let W=b.createTextNode(u);l.insertNode(W),l.setStartAfter(W),l.collapse(!0),C.removeAllRanges(),C.addRange(l),$()},[$]),ue=(0,S.useCallback)(c=>Z(c),[Z]),Se=(0,S.useCallback)(()=>R(!0),[R]),me=(0,S.useCallback)(()=>R(!1),[R]),ie=(0,S.useCallback)(()=>P.current?.focus(),[]),X=(0,S.useCallback)(()=>P.current?.blur(),[]),ge=(0,S.useCallback)(()=>{let c=P.current;return c?(0,G.extractPlainText)(c):""},[]),fe=ba()?"plaintext-only":"true";return{inputRef:P,editorProps:{ref:P,contentEditable:fe,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":E,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:f,onKeyDown:ue,onCompositionStart:Oe,onCompositionEnd:Ce,onPaste:Pe,onFocus:Se,onBlur:me},getPlainText:ge,focus:ie,blur:X}}var ae=require("react/jsx-runtime");function va(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var Wt=(0,N.forwardRef)(function({onSubmit:a,onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,className:o,apiConfig:d,additionalContext:k,visitorId:w,columns:x,pillPlacement:E="dropdown",mode:m="auto",optionsPosition:y="below",animations:O=!0,dropdownTrigger:A,closeDropdownOnBlur:Z,showNonTappableOptions:H,showOptionIcons:D=!0,showChipIcons:T=!0,showChipImages:F=!0,showOptionImages:R=!0,showOptionCounts:P=!0,showSkipButton:Q,showProducts:pe,productsLayout:ye,productImageFallback:he,autoFocus:ke=!0,onFocus:$,onBlur:f,value:Oe,completedParams:Ce,onChange:Pe,onParamsChange:ue,products:Se,onProductSelect:me,submitButton:ie,resetOnSubmit:X=!0},ge){let fe=(0,N.useRef)(null),c=(0,N.useRef)(null),g=(0,N.useRef)(()=>{}),u=(0,N.useRef)(null),b=(0,N.useRef)(null);(0,N.useEffect)(()=>{let L=fe.current;if(L)return u.current?u.current.setMode(m):u.current=new Ge.ModeController(L,m),()=>{u.current?.destroy(),u.current=null}},[m]);let C=(0,N.useCallback)(L=>{let ne=b.current?.current;ne&&(ne.focus(),(0,Ge.setCursorOffset)(ne,L))},[]),{completedParams:l,skippedParams:W,identifiedParams:_,isReady:oe,customFields:v,suggestionPills:De,setActivePill:We,skipActivePill:be,segments:p,newParamId:ve,clearNewParamId:Le,placeholderText:Ie,isFocused:ze,isDropdownOpen:Ee,isActivePillSelected:Ne,isLoading:q,activeIndex:Te,listboxId:Be,handleTextChange:Ye,handleKeyDown:rt,setFocused:_e,editingParam:je,editingIdentified:h,editingAnchor:J,caretOffset:B,startEditingParam:st,handleCaretAfterInput:_t,handleCaretMove:qt,replaceEditingRange:Ut,dropdownProps:Qt,reset:Ze,recordSubmit:bt}=ot({onSubmit:L=>g.current(L),onResult:t,onError:n,optionOverrides:i,maskCompletedText:r,apiConfig:d,additionalContext:k,visitorId:w,columns:x,dropdownTrigger:A,optionsPosition:y,closeDropdownOnBlur:Z,showNonTappableOptions:H,showOptionIcons:D,showOptionImages:R,showOptionCounts:P,showSkipButton:Q,showProducts:pe,onFocus:$,onBlur:f,value:Oe,completedParams:Ce,onChange:Pe,onParamsChange:ue,products:Se,onProductSelect:me,source:"full-sdk",setCursor:C});(0,N.useEffect)(()=>{if(!ve)return;let L=window.setTimeout(()=>Le(),650);return()=>window.clearTimeout(L)},[ve,Le]);let Yt=Te>=0?`${Be}-option-${Te}`:void 0,{inputRef:lt,editorProps:jt,focus:$e,blur:vt,getPlainText:wt}=Gt({segments:p,newParamId:ve,editingParam:je,editingIdentified:h,editingAnchor:J,caretOffset:B,placeholderText:Ie,isFocused:ze,showChipIcons:T,showChipImages:F,isDropdownOpen:Ee,listboxId:Be,activeDescendantId:Yt,autoFocus:ke,handleTextChange:Ye,handleKeyDown:rt,handleCaretAfterInput:_t,handleCaretMove:qt,startEditingParam:st,replaceEditingRange:Ut,setFocused:_e});b.current=lt,(0,N.useLayoutEffect)(()=>{let L=c.current,ne=lt.current;if(!L||!ne)return;let qe=()=>{let yt=L.firstElementChild;if(!yt)return;let Xt=yt.getBoundingClientRect(),Jt=ne.getBoundingClientRect();Xt.top>=Jt.bottom-2?L.setAttribute("data-aia-pill-wrapped",""):L.removeAttribute("data-aia-pill-wrapped")};qe();let xt=new ResizeObserver(qe);return xt.observe(ne),()=>xt.disconnect()},[p,De.length,q,lt]),(0,N.useImperativeHandle)(ge,()=>({focus:$e,blur:vt,reset:Ze,setMode:L=>u.current?.setMode(L),skipActivePill:be}),[$e,vt,Ze,be]);let Ve=!!p.length||l.length>0,dt=(0,N.useCallback)(L=>{if(!Ve)return;let ne=wt(),qe=(0,Ge.buildSubmitResult)(ne,l,W,{identifiedParams:_,isReady:oe,customFields:v});L&&bt(qe),a(qe),X&&Ze()},[bt,X,Ve,l,W,_,oe,v,a,Ze,wt]);g.current=()=>dt(!1);let Zt=(0,N.useCallback)(L=>{L.target?.closest("[data-aia-pill]")||$e()},[$e]),$t=E==="inline",Vt=E==="dropdown";return(0,ae.jsxs)("div",{ref:fe,className:`magicx-aia ${Me.container} ${o??""}`,"data-pill-placement":E,"data-options-position":y,"data-animations":O?"on":"off","data-mode":va(m),children:[(0,ae.jsx)(at,{...Qt,showPills:Vt,productsLayout:ye,productImageFallback:he}),(0,ae.jsxs)("div",{className:Me.inputWrapper,"data-aia-input-wrapper":"",onClick:Zt,children:[(0,ae.jsxs)("div",{className:Me.editorArea,"data-aia-editor":"",children:[(0,ae.jsx)("div",{...jt,className:Me.input,"data-aia-input":""}),$t&&(q||De.length>0)&&(0,ae.jsx)("span",{ref:c,className:Me.pillListContainer,"data-aia-pill-list-container":"",children:(0,ae.jsx)(Je,{pills:De,activePillIndex:0,activeSelected:Ne,onSelectPill:We,loading:q})})]}),ie===null?null:ie===void 0?(0,ae.jsx)(Ht,{disabled:!Ve,onClick:()=>dt(!0)}):(0,ae.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Me.submitSlot,onClick:L=>{Ve&&(L.stopPropagation(),dt(!0))},children:ie})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,DEFAULT_OPTION_COUNT_UNIT,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,formatOptionCount,isoDate,monthLabel,optionCountLabel,optionHasImage,optionImageSrc,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
2197
2197
|
//# sourceMappingURL=index.js.map
|