@magicx-eng/ai-autocomplete-react 0.23.1 → 0.24.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 +10 -0
- package/dist/index.d.mts +27 -6
- package/dist/index.d.ts +27 -6
- package/dist/index.js +62 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +63 -13
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -359,6 +359,7 @@ function App() {
|
|
|
359
359
|
| `onChange?` | `(value: string) => void` | — | Called when text changes (controlled mode). |
|
|
360
360
|
| `onParamsChange?` | `(params: CompletedParamState[]) => void` | — | Called when params change (controlled mode). |
|
|
361
361
|
| `showProducts?` | `boolean` | `true` | Render the product strip below the options whenever there are products to show — see [Product strip](#product-strip). Set to `false` to render no strip. |
|
|
362
|
+
| `productsLayout?` | `"row" \| "list"` | `"row"` | How the strip lays its cards out: a horizontally scrolling row, or the same cards stacked as full-width rows — see [Product strip](#product-strip). |
|
|
362
363
|
| `products?` | `ProductsConfig` | — | Custom source for the product strip — see [Your own product search](#your-own-product-search-products). Omit it and the strip shows the items the `/suggest` response reports. |
|
|
363
364
|
| `onProductSelect?` | `(product: Product) => void` | — | Called when a product card is activated. The SDK never navigates. |
|
|
364
365
|
| `submitButton?` | `ReactNode` | — | Custom submit button. Pass any `ReactNode` to replace the default arrow button. Pass `null` to render no button. Clicks bubble up and trigger submit, so consumer-supplied buttons work without re-wiring `onClick`. |
|
|
@@ -394,6 +395,15 @@ exported for a hand-rolled strip that wants the same mapping.
|
|
|
394
395
|
Pass `showProducts={false}` to render no strip at all. The catalog report
|
|
395
396
|
(below) stays readable either way.
|
|
396
397
|
|
|
398
|
+
`productsLayout="list"` stacks the same cards as full-width rows — thumbnail
|
|
399
|
+
on the left, title, vendor and price on the right — for results that read as
|
|
400
|
+
a list (courses, listings, documents) rather than products on a shelf. The
|
|
401
|
+
column scrolls vertically inside `--aia-product-list-max-height` (320px by
|
|
402
|
+
default); `--aia-product-list-media-size` (44px) sizes the thumbnail and
|
|
403
|
+
`--aia-product-list-gap` (2px) the space between rows. `"row"`, the default,
|
|
404
|
+
is the horizontal strip. Changing the prop re-lays the strip out at once, and
|
|
405
|
+
`<AIAutocompleteDropdown>` takes the same prop in Tier 2.
|
|
406
|
+
|
|
397
407
|
#### The catalog report (`customFields`)
|
|
398
408
|
|
|
399
409
|
Every response that read the catalog also says what it did with the query. The
|
package/dist/index.d.mts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
2
|
-
export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductsConfig, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, isoDate, monthLabel, optionLabel, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
1
|
+
import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsLayout, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
2
|
+
export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, isoDate, monthLabel, optionLabel, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode, KeyboardEvent, ChangeEvent } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -94,6 +94,15 @@ interface AIAutocompleteProps {
|
|
|
94
94
|
* and run no custom search.
|
|
95
95
|
*/
|
|
96
96
|
showProducts?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* How the product strip lays its cards out. `"row"` (the default) is a
|
|
99
|
+
* horizontally scrolling shelf of cards. `"list"` stacks the same cards as
|
|
100
|
+
* full-width rows — thumbnail on the left, title, vendor and price on the
|
|
101
|
+
* right — for results that read as a list (courses, listings, documents)
|
|
102
|
+
* rather than products on a shelf; the column scrolls vertically inside
|
|
103
|
+
* `--aia-product-list-max-height`.
|
|
104
|
+
*/
|
|
105
|
+
productsLayout?: ProductsLayout;
|
|
97
106
|
/**
|
|
98
107
|
* Custom source for the product strip. Omit it and the strip shows the
|
|
99
108
|
* items the `/suggest` response itself reports as matching the query, with
|
|
@@ -153,9 +162,10 @@ interface UseAIAutocompleteOptions {
|
|
|
153
162
|
additionalContext?: Record<string, unknown>;
|
|
154
163
|
columns?: number;
|
|
155
164
|
/**
|
|
156
|
-
* SDK surface identifier
|
|
157
|
-
*
|
|
158
|
-
* leave this unset
|
|
165
|
+
* SDK surface identifier — sent as meta.source on both /api/suggest and
|
|
166
|
+
* telemetry events. Set automatically by the Tier 1 `<AIAutocomplete />`
|
|
167
|
+
* component. Consumers using the hook directly should leave this unset
|
|
168
|
+
* (defaults to "headless-sdk").
|
|
159
169
|
* @internal
|
|
160
170
|
*/
|
|
161
171
|
source?: "full-sdk" | "headless-sdk";
|
|
@@ -190,6 +200,15 @@ interface UseAIAutocompleteOptions {
|
|
|
190
200
|
* and run no custom search.
|
|
191
201
|
*/
|
|
192
202
|
showProducts?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* How the product strip lays its cards out. `"row"` (the default) is a
|
|
205
|
+
* horizontally scrolling shelf of cards. `"list"` stacks the same cards as
|
|
206
|
+
* full-width rows — thumbnail on the left, title, vendor and price on the
|
|
207
|
+
* right — for results that read as a list (courses, listings, documents)
|
|
208
|
+
* rather than products on a shelf; the column scrolls vertically inside
|
|
209
|
+
* `--aia-product-list-max-height`.
|
|
210
|
+
*/
|
|
211
|
+
productsLayout?: ProductsLayout;
|
|
193
212
|
/**
|
|
194
213
|
* Custom source for the product strip. Omit it and the strip shows the
|
|
195
214
|
* items the `/suggest` response itself reports as matching the query, with
|
|
@@ -396,6 +415,8 @@ interface AIAutocompleteDropdownProps {
|
|
|
396
415
|
products?: Product[];
|
|
397
416
|
/** Called when a product card is activated. Provided by `dropdownProps` from the hook. */
|
|
398
417
|
onProductSelect?: (product: Product) => void;
|
|
418
|
+
/** How the product strip lays its cards out — see the Tier 1 prop of the same name. Default: `"row"`. */
|
|
419
|
+
productsLayout?: ProductsLayout;
|
|
399
420
|
/**
|
|
400
421
|
* Called when focus moves into / out of the product strip. The panel closes
|
|
401
422
|
* on blur by default and the input blurs the instant a card takes focus, so
|
|
@@ -448,7 +469,7 @@ interface AIAutocompleteDropdownProps {
|
|
|
448
469
|
|
|
449
470
|
declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
|
|
450
471
|
|
|
451
|
-
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
472
|
+
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, productsLayout, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
452
473
|
|
|
453
474
|
declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showSkipButton, showProducts, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
454
475
|
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
2
|
-
export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductsConfig, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, isoDate, monthLabel, optionLabel, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
1
|
+
import { AutocompleteResult, OptionOverrides, APIConfig, AppearanceMode, CompletedParamState, ProductsLayout, ProductsConfig, Product, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
2
|
+
export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, isoDate, monthLabel, optionLabel, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
3
3
|
import * as react from 'react';
|
|
4
4
|
import { ReactNode, KeyboardEvent, ChangeEvent } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -94,6 +94,15 @@ interface AIAutocompleteProps {
|
|
|
94
94
|
* and run no custom search.
|
|
95
95
|
*/
|
|
96
96
|
showProducts?: boolean;
|
|
97
|
+
/**
|
|
98
|
+
* How the product strip lays its cards out. `"row"` (the default) is a
|
|
99
|
+
* horizontally scrolling shelf of cards. `"list"` stacks the same cards as
|
|
100
|
+
* full-width rows — thumbnail on the left, title, vendor and price on the
|
|
101
|
+
* right — for results that read as a list (courses, listings, documents)
|
|
102
|
+
* rather than products on a shelf; the column scrolls vertically inside
|
|
103
|
+
* `--aia-product-list-max-height`.
|
|
104
|
+
*/
|
|
105
|
+
productsLayout?: ProductsLayout;
|
|
97
106
|
/**
|
|
98
107
|
* Custom source for the product strip. Omit it and the strip shows the
|
|
99
108
|
* items the `/suggest` response itself reports as matching the query, with
|
|
@@ -153,9 +162,10 @@ interface UseAIAutocompleteOptions {
|
|
|
153
162
|
additionalContext?: Record<string, unknown>;
|
|
154
163
|
columns?: number;
|
|
155
164
|
/**
|
|
156
|
-
* SDK surface identifier
|
|
157
|
-
*
|
|
158
|
-
* leave this unset
|
|
165
|
+
* SDK surface identifier — sent as meta.source on both /api/suggest and
|
|
166
|
+
* telemetry events. Set automatically by the Tier 1 `<AIAutocomplete />`
|
|
167
|
+
* component. Consumers using the hook directly should leave this unset
|
|
168
|
+
* (defaults to "headless-sdk").
|
|
159
169
|
* @internal
|
|
160
170
|
*/
|
|
161
171
|
source?: "full-sdk" | "headless-sdk";
|
|
@@ -190,6 +200,15 @@ interface UseAIAutocompleteOptions {
|
|
|
190
200
|
* and run no custom search.
|
|
191
201
|
*/
|
|
192
202
|
showProducts?: boolean;
|
|
203
|
+
/**
|
|
204
|
+
* How the product strip lays its cards out. `"row"` (the default) is a
|
|
205
|
+
* horizontally scrolling shelf of cards. `"list"` stacks the same cards as
|
|
206
|
+
* full-width rows — thumbnail on the left, title, vendor and price on the
|
|
207
|
+
* right — for results that read as a list (courses, listings, documents)
|
|
208
|
+
* rather than products on a shelf; the column scrolls vertically inside
|
|
209
|
+
* `--aia-product-list-max-height`.
|
|
210
|
+
*/
|
|
211
|
+
productsLayout?: ProductsLayout;
|
|
193
212
|
/**
|
|
194
213
|
* Custom source for the product strip. Omit it and the strip shows the
|
|
195
214
|
* items the `/suggest` response itself reports as matching the query, with
|
|
@@ -396,6 +415,8 @@ interface AIAutocompleteDropdownProps {
|
|
|
396
415
|
products?: Product[];
|
|
397
416
|
/** Called when a product card is activated. Provided by `dropdownProps` from the hook. */
|
|
398
417
|
onProductSelect?: (product: Product) => void;
|
|
418
|
+
/** How the product strip lays its cards out — see the Tier 1 prop of the same name. Default: `"row"`. */
|
|
419
|
+
productsLayout?: ProductsLayout;
|
|
399
420
|
/**
|
|
400
421
|
* Called when focus moves into / out of the product strip. The panel closes
|
|
401
422
|
* on blur by default and the input blurs the instant a card takes focus, so
|
|
@@ -448,7 +469,7 @@ interface AIAutocompleteDropdownProps {
|
|
|
448
469
|
|
|
449
470
|
declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
|
|
450
471
|
|
|
451
|
-
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
472
|
+
declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, skipDisabled, activeSelected, isLoading, isInputEmpty, products, onProductSelect, onProductFocusChange, productsLayout, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
|
|
452
473
|
|
|
453
474
|
declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showSkipButton, showProducts, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, onProductSelect, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
|
|
454
475
|
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
"use strict";var at=Object.defineProperty;var
|
|
1
|
+
"use strict";var at=Object.defineProperty;var $t=Object.getOwnPropertyDescriptor;var Vt=Object.getOwnPropertyNames;var Qt=Object.prototype.hasOwnProperty;var Zt=(e,i)=>{for(var t in i)at(e,t,{get:i[t],enumerable:!0})},Yt=(e,i,t,r)=>{if(i&&typeof i=="object"||typeof i=="function")for(let n of Vt(i))!Qt.call(e,n)&&n!==t&&at(e,n,{get:()=>i[n],enumerable:!(r=$t(i,n))||r.enumerable});return e};var Xt=e=>Yt(at({},"__esModule",{value:!0}),e);var pa={};Zt(pa,{AIAutocomplete:()=>zt,AIAutocompleteDropdown:()=>Ve,DATE_RANGE_META_END:()=>p.DATE_RANGE_META_END,DATE_RANGE_META_START:()=>p.DATE_RANGE_META_START,PRODUCT_PATH_PREFIX:()=>p.PRODUCT_PATH_PREFIX,WEEKDAY_LABELS:()=>p.WEEKDAY_LABELS,buildSubmitResult:()=>p.buildSubmitResult,cellDay:()=>p.cellDay,cellIso:()=>p.cellIso,dateCellMarks:()=>p.dateCellMarks,formatDate:()=>p.formatDate,formatDateRange:()=>p.formatDateRange,isoDate:()=>p.isoDate,monthLabel:()=>p.monthLabel,optionLabel:()=>p.optionLabel,parseDate:()=>p.parseDate,parseLooseDate:()=>p.parseLooseDate,parseLooseDateRange:()=>p.parseLooseDateRange,productFromMatchedItem:()=>p.productFromMatchedItem,productsFromCustomFields:()=>p.productsFromCustomFields,sanitizeOptionIconSvg:()=>p.sanitizeOptionIconSvg,selectedRangeFor:()=>p.selectedRangeFor,useAIAutocomplete:()=>Ze,visibleDateRange:()=>p.visibleDateRange,withSkippedParams:()=>p.withSkippedParams});module.exports=Xt(pa);var p=require("@magicx-eng/ai-autocomplete-vanilla");var L=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
|
|
@@ -71,6 +71,19 @@
|
|
|
71
71
|
vertical-align: middle;
|
|
72
72
|
}
|
|
73
73
|
|
|
74
|
+
/* WebKit implements \`contenteditable\` as a \`-webkit-user-modify\` presentational
|
|
75
|
+
hint, and the consumer-isolation reset's \`all: revert\` rolls presentational
|
|
76
|
+
hints back \u2014 without this the editor computes to \`read-only\` there and
|
|
77
|
+
nothing can be typed into it (verified in WebKit 26.0 and 26.6; Chromium
|
|
78
|
+
keeps the attribute's effect). Pinned by class per attribute value, which
|
|
79
|
+
outranks the reset. Other engines ignore the property. */
|
|
80
|
+
.aia-input-IW-P-[contenteditable="true"] {
|
|
81
|
+
-webkit-user-modify: read-write;
|
|
82
|
+
}
|
|
83
|
+
.aia-input-IW-P-[contenteditable="plaintext-only"] {
|
|
84
|
+
-webkit-user-modify: read-write-plaintext-only;
|
|
85
|
+
}
|
|
86
|
+
|
|
74
87
|
/* Completed params render as inline pills (Figma "RichTextPill") \u2014 a compact
|
|
75
88
|
~26px chip with regular-weight primary-color text on a faint-gray fill.
|
|
76
89
|
inline-block gives the padding/radius a box while the text stays part of the
|
|
@@ -982,7 +995,7 @@
|
|
|
982
995
|
opacity: 0.25;
|
|
983
996
|
}
|
|
984
997
|
}
|
|
985
|
-
`,document.head.appendChild(e)}var
|
|
998
|
+
`,document.head.appendChild(e)}var me={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",skeletonBar:"aia-skeletonBar-O3xIx",aiaSkeletonPulse:"aia-aiaSkeletonPulse-G8W7q"};var D=require("@magicx-eng/ai-autocomplete-vanilla"),ft=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) ---
|
|
986
999
|
|
|
987
1000
|
One of three hand-maintained copies (vanilla styles.css, this file, Angular's
|
|
988
1001
|
date-grid.component.css). Only the class-naming layer differs \u2014 the
|
|
@@ -1145,7 +1158,7 @@
|
|
|
1145
1158
|
opacity: 0.8;
|
|
1146
1159
|
background: rgba(var(--aia-streak-rgb, 255, 255, 255), 0.06);
|
|
1147
1160
|
}
|
|
1148
|
-
`,document.head.appendChild(e)}var
|
|
1161
|
+
`,document.head.appendChild(e)}var A={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 H=require("react/jsx-runtime"),Jt=["sunday","monday","tuesday","wednesday","thursday","friday","saturday"];function mt({options:e,activeIndex:i,listboxId:t,view:r,selection:n,onSelect:o,onHighlight:s,onPreviousMonth:b,onNextMonth:v}){let h=(0,D.isoDate)(new Date),y=(0,D.visibleDateRange)({pendingStart:n.rangeStart,highlightedIso:(0,D.cellIso)(e[i]),selected:n.selectedRange});return(0,H.jsxs)("div",{className:A.datepicker,"data-aia-datepicker":"",children:[(0,H.jsxs)("div",{className:A.header,children:[(0,H.jsx)("button",{type:"button",tabIndex:-1,className:A.nav,"data-aia-date-prev":"","aria-label":"Previous month",onMouseDown:f=>f.preventDefault(),onClick:b,children:"\u2039"}),(0,H.jsx)("span",{className:A.month,"data-aia-date-month":"","aria-live":"polite",children:(0,D.monthLabel)(r)}),(0,H.jsx)("button",{type:"button",tabIndex:-1,className:A.nav,"data-aia-date-next":"","aria-label":"Next month",onMouseDown:f=>f.preventDefault(),onClick:v,children:"\u203A"})]}),(0,H.jsx)("div",{className:A.weekdays,"aria-hidden":"true",children:D.WEEKDAY_LABELS.map((f,k)=>(0,H.jsx)("span",{className:A.weekday,children:f},Jt[k]))}),(0,H.jsx)("div",{className:A.grid,"data-aia-date-grid":"",children:e.map((f,k)=>(0,H.jsx)(ea,{option:f,id:`${t}-option-${k}`,index:k,isHighlighted:k===i&&f.is_tappable,isToday:(0,D.cellIso)(f)===h,isPast:(0,D.cellIso)(f)!=null&&(0,D.cellIso)(f)<h,marks:(0,D.dateCellMarks)((0,D.cellIso)(f),{selectedIso:n.selectedIso,range:y}),onSelect:o,onHighlight:s},(0,D.cellIso)(f)??`pad-${k}`))})]})}function ea({option:e,id:i,index:t,isHighlighted:r,isToday:n,isPast:o,marks:s,onSelect:b,onHighlight:v}){let[h,y]=(0,ft.useState)(!1),f=(0,D.cellDay)(e);if(f==null)return(0,H.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-hidden":"true","aria-selected":!1,tabIndex:-1,className:`${A.cell} ${A.blank}`});let k=()=>{y(!0),b(e),setTimeout(()=>y(!1),170)},P=[A.cell,A.day,o?A.past:"",r?A.highlighted:"",n?A.today:"",s.inRange?A.inRange:"",s.selected?A.selected:"",h?A.pressed:""].filter(Boolean).join(" ");return(0,H.jsx)("div",{id:i,role:"option","data-aia-option":"","data-aia-date-cell":"","aria-selected":r,"aria-label":e.text,tabIndex:0,className:P,onClick:k,onKeyDown:w=>{(w.key==="Enter"||w.key===" ")&&(w.preventDefault(),k())},onMouseEnter:()=>v(t),children:(0,H.jsx)("span",{className:A.number,children:f})})}var Re=require("@magicx-eng/ai-autocomplete-vanilla"),qe=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 {
|
|
1149
1162
|
display: flex;
|
|
1150
1163
|
flex-wrap: wrap;
|
|
1151
1164
|
gap: var(--aia-cluster-gap, 0.5rem);
|
|
@@ -1185,7 +1198,7 @@
|
|
|
1185
1198
|
.aia-cluster[data-justify="around"] {
|
|
1186
1199
|
justify-content: space-around;
|
|
1187
1200
|
}
|
|
1188
|
-
`,document.head.appendChild(e)}var it=require("react/jsx-runtime");function He({gap:e,align:i="center",justify:
|
|
1201
|
+
`,document.head.appendChild(e)}var it=require("react/jsx-runtime");function He({gap:e,align:i="center",justify:t="start",noWrap:r=!1,inline:n=!1,className:o,children:s,...b}){let v=e?{"--aia-cluster-gap":e}:void 0,h={className:o?`aia-cluster ${o}`:"aia-cluster","data-align":i,"data-justify":t,"data-nowrap":r||void 0,"data-inline":n||void 0,style:v,...b};return n?(0,it.jsx)("span",{...h,children:s}):(0,it.jsx)("div",{...h,children:s})}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
|
|
1189
1202
|
dropdown's rounded edges. The top inset (--aia-footer-gap) adds breathing
|
|
1190
1203
|
room above the hint/branding row so the footer doesn't butt against the last
|
|
1191
1204
|
option row \u2014 additive to the dropdown's 8px section gap. */
|
|
@@ -1319,7 +1332,7 @@
|
|
|
1319
1332
|
justify-content: flex-end;
|
|
1320
1333
|
}
|
|
1321
1334
|
}
|
|
1322
|
-
`,document.head.appendChild(e)}var
|
|
1335
|
+
`,document.head.appendChild(e)}var ge={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 oe=require("react/jsx-runtime");function gt({isOptionHighlighted:e=!1,isInputEmpty:i=!1}){let{key:t,hint:r}=(0,Re.getFooterHint)(e,i),[n,o]=(0,qe.useState)(Re.ATTRIBUTION_URL);return(0,qe.useEffect)(()=>{o((0,Re.buildAttributionUrl)())},[]),(0,oe.jsx)("footer",{className:ge.footer,"data-aia-footer":"",children:(0,oe.jsxs)(He,{justify:"between",noWrap:!0,className:ge.row,children:[(0,oe.jsxs)(He,{gap:"5px",className:ge.hintGroup,children:[(0,oe.jsx)("kbd",{className:ge.key,children:t}),(0,oe.jsx)("span",{className:ge.hint,children:r})]}),(0,oe.jsxs)("a",{className:ge.brandLink,href:n,target:"_blank",rel:"noopener noreferrer",children:[(0,oe.jsx)("span",{className:ge.brand,children:"AI"}),(0,oe.jsx)("span",{className:ge.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,
|
|
1323
1336
|
no outline. ~28px via 6px padding + 14px text + the 1px border (border-box).
|
|
1324
1337
|
The border is kept as a 1px transparent line so the box stays the same size
|
|
1325
1338
|
as it was when the outline was dashed. */
|
|
@@ -1376,7 +1389,7 @@
|
|
|
1376
1389
|
opacity: 0;
|
|
1377
1390
|
}
|
|
1378
1391
|
}
|
|
1379
|
-
`,document.head.appendChild(e)}var
|
|
1392
|
+
`,document.head.appendChild(e)}var Pe={pill:"aia-pill-6Ga7S",fadeIn:"aia-fadeIn-Ux4eQ",rounded:"aia-rounded-y7xA9",skeleton:"aia-skeleton-57P0T",skeletonPulse:"aia-skeletonPulse-xGcUy"};var vt=require("react/jsx-runtime"),ot={selected:1,first:.7,next:.4,last:.2};function bt({label:e,state:i,rounded:t,loading:r,onClick:n}){let o=[Pe.pill,t?Pe.rounded:"",r?Pe.skeleton:""].filter(Boolean).join(" ");return(0,vt.jsx)("button",{type:"button","data-aia-pill":"","data-aia-loading":r?"":void 0,tabIndex:-1,contentEditable:!1,suppressContentEditableWarning:!0,className:o,style:{opacity:ot[i]},onMouseDown:s=>s.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=`.aia-list-qvLqO {
|
|
1380
1393
|
position: relative;
|
|
1381
1394
|
z-index: 1;
|
|
1382
1395
|
pointer-events: auto;
|
|
@@ -1386,7 +1399,7 @@
|
|
|
1386
1399
|
align-items: center;
|
|
1387
1400
|
vertical-align: middle;
|
|
1388
1401
|
}
|
|
1389
|
-
`,document.head.appendChild(e)}var nt={list:"aia-list-qvLqO"};var Be=require("react/jsx-runtime"),
|
|
1402
|
+
`,document.head.appendChild(e)}var nt={list:"aia-list-qvLqO"};var Be=require("react/jsx-runtime"),ta=[125,69];function wt(e){return e===0?"first":e===1?"next":"last"}function Ue({pills:e,activePillIndex:i,onSelectPill:t,activeSelected:r,rounded:n,loading:o}){return o&&e.length===0?(0,Be.jsx)("span",{className:nt.list,"data-aia-pill-list-loading":"",children:ta.map((s,b)=>(0,Be.jsx)("span",{"data-aia-pill-skeleton":"",className:`${Pe.pill} ${n?Pe.rounded:""} ${Pe.skeleton}`,style:{width:s,opacity:ot[wt(b)]}},`skel-${s}`))}):(0,Be.jsx)("span",{className:nt.list,"data-aia-pill-list-loading":o?"":void 0,children:e.map((s,b)=>{let v=!!r&&b===i;return(0,Be.jsx)(bt,{label:s.text,state:v?"selected":wt(b),selected:v,rounded:n,loading:o,onClick:()=>t(b)},`${s.type}-${s.text}`)})})}var xt=require("@magicx-eng/ai-autocomplete-vanilla"),je=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
|
|
1390
1403
|
(packages/vanilla/src/styles.css). Same tokens, same defaults, so a consumer
|
|
1391
1404
|
theming one package sees the same result in the other.
|
|
1392
1405
|
|
|
@@ -1567,7 +1580,44 @@
|
|
|
1567
1580
|
var(--aia-option-color-selected, var(--aia-color-text-default, #fff))
|
|
1568
1581
|
);
|
|
1569
1582
|
}
|
|
1570
|
-
|
|
1583
|
+
|
|
1584
|
+
/* --- List layout (\`productsLayout: "list"\`) ---
|
|
1585
|
+
The same cards stacked as full-width rows \u2014 thumbnail on the left, text on
|
|
1586
|
+
the right \u2014 for results that read as a list (courses, listings, documents)
|
|
1587
|
+
rather than a shelf. The column scrolls vertically inside its own cap
|
|
1588
|
+
instead of sideways; the dropdown's \`overflow: hidden\` still contains it
|
|
1589
|
+
and the hidden scrollbar chrome above carries over. Appended after the row
|
|
1590
|
+
rules on purpose: the parity test finds each base rule by its first
|
|
1591
|
+
occurrence, and these selectors contain the base selectors. */
|
|
1592
|
+
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-row-WDVBX {
|
|
1593
|
+
flex-direction: column;
|
|
1594
|
+
gap: var(--aia-product-list-gap, 2px);
|
|
1595
|
+
max-height: var(--aia-product-list-max-height, 320px);
|
|
1596
|
+
overflow-x: hidden;
|
|
1597
|
+
overflow-y: auto;
|
|
1598
|
+
overscroll-behavior-y: contain;
|
|
1599
|
+
}
|
|
1600
|
+
|
|
1601
|
+
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-card-JBGYT {
|
|
1602
|
+
flex-direction: row;
|
|
1603
|
+
align-items: center;
|
|
1604
|
+
gap: 10px;
|
|
1605
|
+
width: auto;
|
|
1606
|
+
padding: 6px 8px;
|
|
1607
|
+
}
|
|
1608
|
+
|
|
1609
|
+
/* A fixed square thumbnail: width and height together, so the row's height
|
|
1610
|
+
is the tile's, not the card width's. */
|
|
1611
|
+
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-media-RrbGe {
|
|
1612
|
+
flex: 0 0 auto;
|
|
1613
|
+
width: var(--aia-product-list-media-size, 44px);
|
|
1614
|
+
height: var(--aia-product-list-media-size, 44px);
|
|
1615
|
+
}
|
|
1616
|
+
|
|
1617
|
+
.aia-section-Hugfg[data-aia-products-layout="list"] .aia-body-ly032 {
|
|
1618
|
+
flex: 1 1 auto;
|
|
1619
|
+
}
|
|
1620
|
+
`,document.head.appendChild(e)}var Y={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 U=require("react/jsx-runtime");function yt({products:e,listboxId:i,onSelect:t,onFocusChange:r,focusable:n=!0,layout:o="row"}){let s=e.length>0,b=(0,je.useRef)(null);if((0,je.useEffect)(()=>{let h=b.current;if(!(!s||!h))return(0,xt.attachProductRowWheel)(h)},[s]),!s)return null;let v=`${i}-products-label`;return(0,U.jsxs)("section",{className:Y.section,"data-aia-products":"","data-aia-products-layout":o,role:"group","aria-labelledby":v,children:[(0,U.jsx)("div",{className:Y.label,id:v,"data-aia-products-label":"",children:"Products"}),(0,U.jsx)("div",{ref:b,className:Y.row,"data-aia-products-row":"",children:e.map((h,y)=>(0,U.jsx)(aa,{product:h,id:`${i}-product-${y}`,onSelect:t,onFocusChange:r,focusable:n},h.id))})]})}function aa({product:e,id:i,onSelect:t,onFocusChange:r,focusable:n}){let o=s=>{s.metaKey||s.ctrlKey||s.shiftKey||s.altKey||s.button!==0||(s.preventDefault(),t(e))};return(0,U.jsxs)("a",{id:i,className:Y.card,"data-aia-product":"",role:"option","aria-selected":!1,href:e.url,tabIndex:n?0:-1,onClick:o,onKeyDown:s=>{s.key!=="Enter"&&s.key!==" "||(s.preventDefault(),t(e))},onFocus:()=>r?.(!0),onBlur:s=>{s.relatedTarget?.closest("[data-aia-dropdown]")||r?.(!1)},children:[(0,U.jsx)("span",{className:Y.media,"data-aia-product-placeholder":e.imageUrl?void 0:"",children:e.imageUrl?(0,U.jsx)("img",{className:Y.image,src:e.imageUrl,alt:"",loading:"lazy",decoding:"async"}):null}),(0,U.jsxs)("span",{className:Y.body,children:[e.vendor?(0,U.jsx)("span",{className:Y.vendor,children:e.vendor}):null,(0,U.jsx)("span",{className:Y.title,children:e.title}),e.price?(0,U.jsx)("span",{className:Y.price,children:e.price}):null]})]})}var j=require("@magicx-eng/ai-autocomplete-vanilla"),ve=require("react");var kt=require("@magicx-eng/ai-autocomplete-vanilla"),$e=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 {
|
|
1571
1621
|
display: grid;
|
|
1572
1622
|
grid-template-columns: repeat(
|
|
1573
1623
|
auto-fit,
|
|
@@ -1600,7 +1650,7 @@
|
|
|
1600
1650
|
background: var(--aia-scrollbar-thumb, rgba(0, 0, 0, 0.3));
|
|
1601
1651
|
border-radius: 3px;
|
|
1602
1652
|
}
|
|
1603
|
-
`,document.head.appendChild(e)}var Pt=require("react/jsx-runtime");function Ct({min:e="16rem",max:i,gap:
|
|
1653
|
+
`,document.head.appendChild(e)}var Pt=require("react/jsx-runtime");function Ct({min:e="16rem",max:i,gap:t,scroll:r=!1,maxHeight:n,scrollResetKey:o,cols:s,template:b,innerRef:v,className:h,children:y,...f}){let k=(0,$e.useRef)(null);(0,$e.useLayoutEffect)(()=>{if(o===void 0)return;let w=k.current;w&&(w.scrollTop=0)},[o]);let P={"--aia-grid-min":e};return i&&(P["--aia-grid-max"]=i),t&&(P["--aia-grid-gap"]=t),n&&(P["--aia-grid-max-height"]=n),s&&(P.gridTemplateColumns=(0,kt.optionsGridTemplateColumns)(s)),b&&(P.gridTemplateColumns=b),(0,Pt.jsx)("div",{ref:w=>{k.current=w,v?.(w)},className:h?`aia-grid ${h}`:"aia-grid","data-scroll":r||void 0,style:P,...f,children:y})}var De=require("@magicx-eng/ai-autocomplete-vanilla"),be=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 {
|
|
1604
1654
|
position: relative;
|
|
1605
1655
|
/* Clip, not visible: the entrance rise below runs on the inner content,
|
|
1606
1656
|
and a transformed box extends its scroll container's scrollable area.
|
|
@@ -1805,7 +1855,7 @@
|
|
|
1805
1855
|
filter: brightness(0.55);
|
|
1806
1856
|
}
|
|
1807
1857
|
}
|
|
1808
|
-
`,document.head.appendChild(e)}var X={item:"aia-item-d4vpD",fadeIn:"aia-fadeIn-I8u35",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",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",icon:"aia-icon-Qw938"};var Ie=require("react/jsx-runtime");function St({option:e,isHighlighted:i,onSelect:
|
|
1858
|
+
`,document.head.appendChild(e)}var X={item:"aia-item-d4vpD",fadeIn:"aia-fadeIn-I8u35",content:"aia-content-T-Qba",riseIn:"aia-riseIn-etXZT",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",icon:"aia-icon-Qw938"};var Ie=require("react/jsx-runtime");function St({option:e,isHighlighted:i,onSelect:t,onHighlight:r,id:n,loading:o,showIcon:s=!0,scrollHint:b,enterDelayMs:v=0}){let[h]=(0,be.useState)(v),[y,f]=(0,be.useState)(!1),k=(0,be.useMemo)(()=>s&&e.icon_svg?(0,De.sanitizeOptionIconSvg)(e.icon_svg):null,[s,e.icon_svg]),P=(0,be.useRef)(void 0);(0,be.useEffect)(()=>()=>clearTimeout(P.current),[]);let w=()=>{o||!e.is_tappable||y||(f(!0),t(e),clearTimeout(P.current),P.current=setTimeout(()=>f(!1),170))},R=[X.item,i&&!o?X.highlighted:"",e.is_tappable?X.tappable:X.nonTappable,y?X.pressed:"",b?X.scrollHint:""].filter(Boolean).join(" ");return(0,Ie.jsx)("div",{id:n,role:"option","data-aia-option":"","data-aia-loading":o?"":void 0,"data-aia-icon":k&&e.icon?e.icon:void 0,"aria-selected":i,className:R,style:{[De.OPTION_ENTER_DELAY_VAR]:`${h}ms`},tabIndex:o||!e.is_tappable?-1:0,onClick:w,onKeyDown:O=>{!o&&e.is_tappable&&(O.key==="Enter"||O.key===" ")&&(O.preventDefault(),w())},onMouseEnter:!o&&e.is_tappable?r:void 0,children:(0,Ie.jsxs)("span",{className:X.content,children:[k&&(0,Ie.jsx)("span",{className:`${X.icon} magicx-aia-option-icon`,"aria-hidden":"true",dangerouslySetInnerHTML:{__html:k}}),(0,Ie.jsx)("span",{className:X.text,children:(0,De.optionLabel)(e)}),e.tag&&(0,Ie.jsx)("span",{className:X.tag,children:e.tag})]})})}var rt=require("react/jsx-runtime");function ia(){let[e,i]=(0,ve.useState)(j.isOptionsGridMobileViewport);return(0,ve.useEffect)(()=>{if(typeof window>"u"||!window.matchMedia)return;let t=window.matchMedia(j.OPTIONS_GRID_MOBILE_QUERY),r=()=>i(t.matches);return r(),t.addEventListener("change",r),()=>t.removeEventListener("change",r)},[]),e}function Et({options:e,activeIndex:i,onSelect:t,onHighlight:r,listboxId:n,loading:o,groupKey:s="",optionsPosition:b="below",showIcons:v=!0}){let h=ia(),y=(0,ve.useRef)(null),[f,k]=(0,ve.useState)(null);(0,ve.useLayoutEffect)(()=>{let w=y.current,O=w&&!o&&(0,j.needsOptionsGridMeasurement)(e.length,h)?(0,j.measureOptionsGrid)(w):null;k(O?(0,j.planOptionsGrid)(e.length,h,O.rowWidths,O.gridWidth):null)},[e,h,o]);let P=f??(0,j.planOptionsGrid)(e.length,h,null,null);return(0,rt.jsx)(Ct,{min:"250px",max:"1fr",gap:"0",scroll:!0,scrollResetKey:s,template:P.template,maxHeight:P.maxHeight,innerRef:w=>{y.current=w},"data-aia-group":s,children:e.map((w,R)=>(0,rt.jsx)(St,{option:w,isHighlighted:R===i,onSelect:t,onHighlight:()=>r(R),id:`${n}-option-${R}`,loading:o,showIcon:v,scrollHint:!o&&P.scrollHintIndices.includes(R),enterDelayMs:o?0:(0,j.optionEnterDelayMs)(R,P.cols,e.length,b)},`${s}\0${w.text}`))})}if(typeof document<"u"&&!document.getElementById("ac-style-8414cd5f")){let e=document.createElement("style");e.id="ac-style-8414cd5f",e.textContent=`.aia-stack {
|
|
1809
1859
|
display: flex;
|
|
1810
1860
|
flex-direction: column;
|
|
1811
1861
|
gap: var(--aia-stack-space, 0.5rem);
|
|
@@ -1820,7 +1870,7 @@
|
|
|
1820
1870
|
align-items: end;
|
|
1821
1871
|
}
|
|
1822
1872
|
/* data-align="stretch" is the flex default \u2014 no rule needed. */
|
|
1823
|
-
`,document.head.appendChild(e)}var Tt=require("react/jsx-runtime");function It({space:e,align:i="stretch",className:
|
|
1873
|
+
`,document.head.appendChild(e)}var Tt=require("react/jsx-runtime");function It({space:e,align:i="stretch",className:t,children:r,...n}){let o=e?{"--aia-stack-space":e}:void 0;return(0,Tt.jsx)("div",{className:t?`aia-stack ${t}`:"aia-stack","data-align":i,style:o,...n,children:r})}var z=require("react/jsx-runtime"),oa=[159,119,164],na=()=>{},At=()=>{};function ra(e){let i=()=>typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-color-scheme: dark)").matches,[t,r]=(0,J.useState)(i);if((0,J.useEffect)(()=>{if(e!=="auto"||typeof window>"u"||typeof window.matchMedia!="function")return;let n=window.matchMedia("(prefers-color-scheme: dark)"),o=()=>r(n.matches);return n.addEventListener("change",o),()=>n.removeEventListener("change",o)},[e]),e!==void 0)return e==="auto"?t?"dark":"light":e}function sa(e,i){let t=(0,J.useRef)(null);(0,J.useEffect)(()=>{let r=e.current,n=i.current;if(!r||!n)return;let o=r.querySelector(".aia-grid[data-scroll]");if(t.current&&t.current.grid!==o&&(t.current.controller.destroy(),t.current=null),o&&!t.current){t.current={grid:o,controller:(0,Le.attachScrollArrow)({dropdown:r,grid:o,button:n})};return}t.current?.controller.update()}),(0,J.useEffect)(()=>()=>{t.current?.controller.destroy(),t.current=null},[])}function Ve({suggestions:e,activeIndex:i,onSelect:t,onHighlight:r,isOpen:n,id:o,className:s,pills:b,onPillClick:v,showPills:h=!0,onSkip:y,showSkipButton:f=!0,showOptionIcons:k=!0,skipDisabled:P=!1,activeSelected:w=!1,isLoading:R=!1,isInputEmpty:O=!1,products:N,onProductSelect:B,onProductFocusChange:ne,productsLayout:F="row",formatType:I="options",dateView:te=null,selectedDateIso:we=null,selectedDateRange:re=null,dateRangeStart:u=null,onPreviousMonth:xe,onNextMonth:K,optionsPosition:se="below",mode:ye}){let le=ra(ye),ae=le!==void 0,de=(0,J.useRef)(null),ie=(0,J.useRef)(null);sa(de,ie);let ce=e[0]?.options??[],pe=!!(b&&b.length>0&&v),W=!!(N&&N.length>0),G=n&&(ce.length>0||h&&pe||R||W),Z={suggestions:e,activeIndex:i,pills:b,showPills:h,showSkipButton:f,showOptionIcons:k,skipDisabled:P,activeSelected:w,isLoading:R,isInputEmpty:O,products:N,formatType:I,dateView:te,selectedDateIso:we,selectedDateRange:re,dateRangeStart:u},c=(0,J.useRef)(Z);G&&(c.current=Z);let a=G?Z:c.current,m=a.suggestions[0],x=m?.options??[],l=a.activeIndex>=0&&!!x[a.activeIndex]?.is_tappable,T=!!(a.pills&&a.pills.length>0&&v),he=a.showPills&&T,V=a.showPills&&!T&&a.isLoading,d=he||V,ue=T&&a.showSkipButton&&!a.isInputEmpty&&!!y,Se=a.pills?.[0]?.text,ke=(0,Le.isCalendarFormat)(a.formatType)&&a.dateView!=null,Te=x.length>0&&!ke,fe=x.length>0&&ke&&!a.isLoading,ze=a.isLoading&&!Te&&!fe,_=a.products??[];return(0,z.jsxs)("div",{ref:de,id:o,role:"listbox","data-aia-dropdown":"","data-options-position":se,"data-mode":le,"data-aia-loading":a.isLoading?"":void 0,"data-aia-has-products":_.length>0?"":void 0,className:`${ae?"magicx-aia ":""}${me.dropdown} ${G?me.visible:""} ${s??""}`,onMouseDown:q=>q.preventDefault(),children:[(0,z.jsxs)(It,{space:"8px",children:[(d||ue)&&(0,z.jsxs)(He,{noWrap:!0,className:me.pillBar,"data-aia-pillbar":"",children:[d&&(0,z.jsx)("span",{className:me.pillScroll,"data-aia-pill-scroll":"",children:(0,z.jsx)(Ue,{pills:a.pills??[],activePillIndex:0,activeSelected:a.activeSelected,onSelectPill:v??(()=>{}),rounded:!0,loading:a.isLoading})}),ue&&(0,z.jsx)("button",{type:"button",tabIndex:-1,className:me.skip,"data-aia-skip":"",disabled:a.isLoading||a.skipDisabled,"aria-label":Se?`Skip ${Se}`:"Skip",onClick:y,children:"skip"})]}),Te&&(0,z.jsx)(Et,{options:x,activeIndex:a.activeIndex,onSelect:t,onHighlight:r,listboxId:o,loading:a.isLoading,groupKey:m?`${m.type} ${m.text}`:"",optionsPosition:se,showIcons:a.showOptionIcons}),fe&&a.dateView&&(0,z.jsx)(mt,{options:x,activeIndex:a.activeIndex,listboxId:o,view:a.dateView,selection:{selectedIso:a.selectedDateIso??null,selectedRange:a.selectedDateRange??null,rangeStart:a.dateRangeStart??null},onSelect:t,onHighlight:r,onPreviousMonth:xe??At,onNextMonth:K??At}),ze&&(0,z.jsx)("div",{className:me.skeletonBars,"data-aia-skeleton-bars":"",children:oa.map(q=>(0,z.jsx)("span",{className:me.skeletonBar,style:{width:q}},`bar-${q}`))}),(0,z.jsx)(yt,{products:_,listboxId:o,onSelect:B??na,onFocusChange:ne,focusable:G,layout:F}),(0,z.jsx)(gt,{isOptionHighlighted:l,isInputEmpty:a.isInputEmpty})]}),(0,z.jsx)("button",{ref:ie,type:"button",tabIndex:-1,className:me.scrollArrow,"data-aia-scroll-arrow":"","aria-label":Le.SCROLL_ARROW_LABEL,"aria-hidden":"true",children:(0,z.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,z.jsx)("path",{d:"M4 6.5 8 10.5l4-4"})})})]})}var Oe=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 {
|
|
1824
1874
|
flex-shrink: 0;
|
|
1825
1875
|
width: 32px;
|
|
1826
1876
|
height: 32px;
|
|
@@ -1873,5 +1923,5 @@
|
|
|
1873
1923
|
);
|
|
1874
1924
|
cursor: default;
|
|
1875
1925
|
}
|
|
1876
|
-
`,document.head.appendChild(e)}var Rt={submitButton:"aia-submitButton-otz7H"};var Qe=require("react/jsx-runtime");function Dt({disabled:e,onClick:i}){return(0,Qe.jsx)("button",{type:"button","data-aia-submit":"",className:Rt.submitButton,disabled:e,onClick:a=>{a.stopPropagation(),i()},"aria-label":"Submit",children:(0,Qe.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Qe.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Me=require("@magicx-eng/ai-autocomplete-vanilla"),S=require("react");var st=require("react");function Lt(e){let i=(0,st.useRef)(e);i.current=e;let a=Object.keys(e??{}).sort().join("\0"),r=(0,st.useRef)({key:"",overrides:void 0});if(r.current.key!==a){let n={};for(let o of Object.keys(e??{})){let s=(b,g,v)=>{let x=i.current?.[o];return x?x(b,g,v):[]};n[o]=s}r.current={key:a,overrides:e?n:void 0}}return{overrides:r.current.overrides,key:a}}var lt=require("react");function Mt(e){let i=(0,lt.useRef)(e);i.current=e;let a=(0,lt.useRef)(null);a.current===null&&(a.current={fetch:(n,o)=>{let s=i.current;return s?s.fetch(n,o):Promise.reject(new Error("products config removed"))},transform:n=>i.current?.transform(n)??[],get limit(){return i.current?.limit}});let r=e!==void 0;return{config:r?a.current:void 0,enabled:r}}var sa={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:[],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 Ze({onSubmit:e,onResult:i,onError:a,optionOverrides:r,maskCompletedText:n,apiConfig:o,additionalContext:s,columns:b=2,dropdownTrigger:g,optionsPosition:v,closeDropdownOnBlur:x,showNonTappableOptions:m,showOptionIcons:y,showSkipButton:P,showProducts:w,onFocus:A,onBlur:M,value:N,completedParams:G,onChange:re,onParamsChange:W,products:I,onProductSelect:te,source:ge,setCursor:se}){let h=(0,S.useRef)(null),[be,H]=(0,S.useState)(null),ve=(0,S.useRef)(e);ve.current=e;let le=(0,S.useRef)(i);le.current=i;let ae=(0,S.useRef)(a);ae.current=a;let de=(0,S.useRef)(re);de.current=re;let ie=(0,S.useRef)(W);ie.current=W;let ce=(0,S.useRef)(A);ce.current=A;let pe=(0,S.useRef)(M);pe.current=M;let _=(0,S.useRef)(se);_.current=se;let $=(0,S.useRef)(te);$.current=te;let Z=Mt(I),V=Lt(r);(0,S.useEffect)(()=>{if(typeof document>"u")return;let f=new Me.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:o,additionalContext:s,optionOverrides:V.overrides,maskCompletedText:n,columns:b,dropdownTrigger:g,optionsPosition:v,closeDropdownOnBlur:x,showNonTappableOptions:m,showProducts:w,source:ge,value:N,completedParams:G,onSubmit:(...L)=>ve.current?.(...L),onResult:(...L)=>le.current?.(...L),onError:(...L)=>ae.current?.(...L),onChange:(...L)=>de.current?.(...L),onParamsChange:(...L)=>ie.current?.(...L),onFocus:()=>ce.current?.(),onBlur:()=>pe.current?.(),onProductSelect:L=>$.current?.(L),setCursor:L=>_.current?.(L),products:Z.config});h.current=f,H(f.getState());let Q=f.subscribe(L=>H(L));return()=>{Q(),f.destroy(),h.current===f&&(h.current=null)}},[]),(0,S.useEffect)(()=>{N!==void 0&&h.current?.setValue(N)},[N]),(0,S.useEffect)(()=>{G!==void 0&&h.current?.setCompletedParams(G)},[G]);let t=JSON.stringify(o??null),p;try{p=JSON.stringify(s??null)}catch{p="[unstringifiable]"}(0,S.useEffect)(()=>{h.current?.update({apiConfig:o,additionalContext:s,optionOverrides:V.overrides,dropdownTrigger:g,optionsPosition:v,closeDropdownOnBlur:x,showNonTappableOptions:m,showProducts:w})},[t,p,V.key,g,v,x,m,w]);let u=(0,S.useRef)(!1);(0,S.useEffect)(()=>{if(!u.current){u.current=!0;return}h.current?.update({products:Z.config})},[Z.enabled]);let k=(0,S.useRef)(null);k.current===null&&(k.current={handleTextChange:f=>h.current?.handleTextChange(f),handleKeyDown:f=>{let Q="nativeEvent"in f?f.nativeEvent:f;h.current?.handleKeyDown(Q)},setFocused:f=>h.current?.setFocused(f),startEditingParam:f=>h.current?.startEditingParam(f),exitEditMode:()=>h.current?.exitEditMode(),handleCaretAfterInput:f=>h.current?.handleCaretAfterInput(f),handleCaretMove:f=>h.current?.handleCaretMove(f),replaceEditingRange:f=>h.current?.replaceEditingRange(f)??!1,setActivePill:f=>h.current?.setActivePill(f),skipActivePill:()=>h.current?.skipActivePill(),removeLastParam:()=>h.current?.removeLastParam(),clearNewParamId:()=>h.current?.clearNewParamId(),reset:()=>h.current?.reset(),selectOption:f=>h.current?.selectOption(f),selectProduct:f=>h.current?.selectProduct(f),setActiveDropdownIndex:f=>h.current?.setActiveDropdownIndex(f),showPreviousMonth:()=>h.current?.showPreviousMonth(),showNextMonth:()=>h.current?.showNextMonth(),handleFocus:()=>h.current?.setFocused(!0),handleBlur:()=>h.current?.setFocused(!1)});let l=k.current,z=(0,S.useCallback)(f=>{let Q=f.target.value,Je=Q.length>0&&!f.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;h.current?.handleTextChange(Je)},[]),oe=(0,S.useCallback)(f=>{h.current?.handleKeyDown(f.nativeEvent)},[]),B=h.current,d=be??sa,we=N!==void 0?N:d.text,Te=G!==void 0?G:d.completedParams,xe=d.actionableSuggestions,Ae=xe[0],ye=B?.listboxId??"",ke=d.activeDropdownIndex>=0&&B?`${ye}-option-${d.activeDropdownIndex}`:void 0,F=d.editingParam,Ce=d.editingIdentified,ze=F?{type:F.suggestionType,text:F.suggestionPlaceholder,required:!0,options:F.options}:Ce?{type:Ce.type,text:(0,Me.identifiedParamLabel)(Ce.type),required:!0,options:[]}:null,Fe=ze??Ae,Xe=ze?[ze]:xe,Ne=(0,Me.dateSelectionFor)(d),Ke=!B||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:Te,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:xe,setActivePill:l.setActivePill,skipActivePill:l.skipActivePill,removeLastParam:l.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:l.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Ke,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:ye,error:d.error,products:d.products,customFields:d.customFields,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:F,editingIdentified:Ce,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:we,placeholder:d.placeholderText||void 0,onChange:z,onKeyDown:oe,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":ke,"aria-autocomplete":"list","aria-controls":ye},reset:l.reset,dropdownProps:{suggestions:Fe?[{...Fe,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:ye,pills:Xe,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(P??!0)&&!F&&!Ce,showOptionIcons:y??!0,skipDisabled:d.inSelectionAnimation,isLoading:Ke,isInputEmpty:we.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Ne.selectedIso,selectedDateRange:Ne.selectedRange,dateRangeStart:Ne.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:v??"below"}}}var j=require("@magicx-eng/ai-autocomplete-vanilla"),C=require("react"),Ye;function la(){if(Ye!==void 0)return Ye;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ye=e.contentEditable==="plaintext-only",Ye}function Ot(e){let{segments:i,showChipIcons:a=!0,newParamId:r,editingParam:n,editingIdentified:o,editingAnchor:s,caretOffset:b,placeholderText:g,isFocused:v,isDropdownOpen:x,listboxId:m,activeDescendantId:y,autoFocus:P,handleTextChange:w,handleKeyDown:A,handleCaretAfterInput:M,handleCaretMove:N,startEditingParam:G,replaceEditingRange:re,setFocused:W}=e,I=(0,C.useRef)(null),te=(0,C.useRef)(!1),ge=(0,C.useRef)(""),se=(0,C.useRef)(""),h=(0,C.useRef)(null),be=(0,C.useRef)(0);h.current=b,(0,C.useEffect)(()=>{if(!P)return;let t=I.current;if(!t)return;document.activeElement===t?W(!0):t.focus();let p=t.ownerDocument??document,u=p.getSelection(),k=u&&u.rangeCount>0&&t.contains(u.anchorNode);if(u&&!k){let l=p.createRange();l.selectNodeContents(t),l.collapse(!0),u.removeAllRanges(),u.addRange(l)}},[P,W]),(0,C.useEffect)(()=>{let t=I.current;if(!t)return;let p=t.ownerDocument??document,u=()=>{let k=p.getSelection();if(!k||k.rangeCount===0||!k.anchorNode||!t.contains(k.anchorNode))return;let l=k.anchorNode,z=l.nodeType===Node.ELEMENT_NODE?l:l.parentElement,B=(k.isCollapsed?z?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,d=n?.id??o?.id??null;if(B&&B!==d){G(B);return}performance.now()-be.current<50||N((0,j.getCursorOffset)(t))};return p.addEventListener("selectionchange",u),()=>p.removeEventListener("selectionchange",u)},[n,o,G,N]),(0,C.useLayoutEffect)(()=>{let t=I.current;t&&(0,j.renderEditableContent)({input:t,segments:i,newParamId:r,editingParamId:n?.id??null,placeholderText:g??"",isFocused:v,showChipIcons:a})},[i,r,n,g,v,a]),(0,C.useLayoutEffect)(()=>{let t=ge.current,p=r??"";if(ge.current=p,!p||p===t)return;let u=I.current;if(!u)return;u.focus();let k=h.current??(0,j.plainTextLength)(u);(0,j.setCursorOffset)(u,k)},[r]),(0,C.useLayoutEffect)(()=>{let t=se.current,p=n?.id??"";if(se.current=p,!p||p===t||s==null)return;let u=I.current;u&&(0,j.setCursorOffset)(u,s)},[n,s]);let H=(0,C.useCallback)(()=>{if(te.current)return;let t=I.current;if(!t)return;let p=(0,j.extractPlainText)(t),k=p.length>0&&p[0]!==p[0].toUpperCase()?p[0].toUpperCase()+p.slice(1):p;w(k)},[w]),ve=(0,C.useCallback)(()=>{be.current=performance.now(),H();let t=I.current;t&&M((0,j.getCursorOffset)(t))},[H,M]);(0,C.useEffect)(()=>{let t=I.current;if(!t)return;let p=u=>{let k=u,l=k.inputType;if(l==="insertParagraph"||l==="insertLineBreak"||l==="insertFromDrop"){u.preventDefault();return}if(l.startsWith("insert")||l.startsWith("delete")){let z=l.startsWith("delete")?"":k.data??"";re(z)&&u.preventDefault()}};return t.addEventListener("beforeinput",p),()=>t.removeEventListener("beforeinput",p)},[re]);let le=(0,C.useCallback)(()=>{te.current=!0},[]),ae=(0,C.useCallback)(()=>{te.current=!1,H()},[H]),de=(0,C.useCallback)(t=>{t.preventDefault();let p=I.current;if(!p)return;let u=(t.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!u)return;let k=p.ownerDocument??document,l=k.getSelection();if(!l||l.rangeCount===0)return;let z=l.getRangeAt(0);if(!p.contains(z.startContainer))return;z.deleteContents();let oe=k.createTextNode(u);z.insertNode(oe),z.setStartAfter(oe),z.collapse(!0),l.removeAllRanges(),l.addRange(z),H()},[H]),ie=(0,C.useCallback)(t=>A(t),[A]),ce=(0,C.useCallback)(()=>W(!0),[W]),pe=(0,C.useCallback)(()=>W(!1),[W]),_=(0,C.useCallback)(()=>I.current?.focus(),[]),$=(0,C.useCallback)(()=>I.current?.blur(),[]),Z=(0,C.useCallback)(()=>{let t=I.current;return t?(0,j.extractPlainText)(t):""},[]),V=la()?"plaintext-only":"true";return{inputRef:I,editorProps:{ref:I,contentEditable:V,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":m,"aria-expanded":x,"aria-activedescendant":y,spellCheck:!0,enterKeyHint:"send",onInput:ve,onKeyDown:ie,onCompositionStart:le,onCompositionEnd:ae,onPaste:de,onFocus:ce,onBlur:pe},getPlainText:Z,focus:_,blur:$}}var ee=require("react/jsx-runtime");function da(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var zt=(0,D.forwardRef)(function({onSubmit:i,onResult:a,onError:r,optionOverrides:n,maskCompletedText:o,className:s,apiConfig:b,additionalContext:g,columns:v,pillPlacement:x="dropdown",mode:m="auto",optionsPosition:y="below",animations:P=!0,dropdownTrigger:w,closeDropdownOnBlur:A,showNonTappableOptions:M,showOptionIcons:N=!0,showChipIcons:G=!0,showSkipButton:re,showProducts:W,autoFocus:I=!0,onFocus:te,onBlur:ge,value:se,completedParams:h,onChange:be,onParamsChange:H,products:ve,onProductSelect:le,submitButton:ae},de){let ie=(0,D.useRef)(null),ce=(0,D.useRef)(null),pe=(0,D.useRef)(()=>{}),_=(0,D.useRef)(null),$=(0,D.useRef)(null);(0,D.useEffect)(()=>{let E=ie.current;if(E)return _.current?_.current.setMode(m):_.current=new Oe.ModeController(E,m),()=>{_.current?.destroy(),_.current=null}},[m]);let Z=(0,D.useCallback)(E=>{let Pe=$.current?.current;Pe&&(Pe.focus(),(0,Oe.setCursorOffset)(Pe,E))},[]),{completedParams:V,skippedParams:t,identifiedParams:p,isReady:u,customFields:k,suggestionPills:l,setActivePill:z,skipActivePill:oe,segments:B,newParamId:d,clearNewParamId:we,placeholderText:Te,isFocused:xe,isDropdownOpen:Ae,isActivePillSelected:ye,isLoading:ke,activeIndex:F,listboxId:Ce,handleTextChange:ze,handleKeyDown:Fe,setFocused:Xe,editingParam:Ne,editingIdentified:Ke,editingAnchor:f,caretOffset:Q,startEditingParam:L,handleCaretAfterInput:Je,handleCaretMove:Nt,replaceEditingRange:Ht,dropdownProps:Bt,reset:Ge}=Ze({onSubmit:E=>pe.current(E),onResult:a,onError:r,optionOverrides:n,maskCompletedText:o,apiConfig:b,additionalContext:g,columns:v,dropdownTrigger:w,optionsPosition:y,closeDropdownOnBlur:A,showNonTappableOptions:M,showOptionIcons:N,showSkipButton:re,showProducts:W,onFocus:te,onBlur:ge,value:se,completedParams:h,onChange:be,onParamsChange:H,products:ve,onProductSelect:le,source:"full-sdk",setCursor:Z});(0,D.useEffect)(()=>{if(!d)return;let E=window.setTimeout(()=>we(),650);return()=>window.clearTimeout(E)},[d,we]);let Ft=F>=0?`${Ce}-option-${F}`:void 0,{inputRef:et,editorProps:Kt,focus:We,blur:dt,getPlainText:ct}=Ot({segments:B,newParamId:d,editingParam:Ne,editingIdentified:Ke,editingAnchor:f,caretOffset:Q,placeholderText:Te,isFocused:xe,showChipIcons:G,isDropdownOpen:Ae,listboxId:Ce,activeDescendantId:Ft,autoFocus:I,handleTextChange:ze,handleKeyDown:Fe,handleCaretAfterInput:Je,handleCaretMove:Nt,startEditingParam:L,replaceEditingRange:Ht,setFocused:Xe});$.current=et,(0,D.useLayoutEffect)(()=>{let E=ce.current,Pe=et.current;if(!E||!Pe)return;let pt=()=>{let ut=E.firstElementChild;if(!ut)return;let qt=ut.getBoundingClientRect(),Ut=Pe.getBoundingClientRect();qt.top>=Ut.bottom-2?E.setAttribute("data-aia-pill-wrapped",""):E.removeAttribute("data-aia-pill-wrapped")};pt();let ht=new ResizeObserver(pt);return ht.observe(Pe),()=>ht.disconnect()},[B,l.length,ke,et]),(0,D.useImperativeHandle)(de,()=>({focus:We,blur:dt,reset:Ge,setMode:E=>_.current?.setMode(E),skipActivePill:oe}),[We,dt,Ge,oe]);let _e=!!B.length||V.length>0,tt=(0,D.useCallback)(()=>{if(!_e)return;let E=ct();i((0,Oe.buildSubmitResult)(E,V,t,{identifiedParams:p,isReady:u,customFields:k})),Ge()},[_e,V,t,p,u,k,i,Ge,ct]);pe.current=tt;let Gt=(0,D.useCallback)(E=>{E.target?.closest("[data-aia-pill]")||We()},[We]),Wt=x==="inline",_t=x==="dropdown";return(0,ee.jsxs)("div",{ref:ie,className:`magicx-aia ${Ee.container} ${s??""}`,"data-pill-placement":x,"data-options-position":y,"data-animations":P?"on":"off","data-mode":da(m),children:[(0,ee.jsx)(Ve,{...Bt,showPills:_t}),(0,ee.jsxs)("div",{className:Ee.inputWrapper,"data-aia-input-wrapper":"",onClick:Gt,children:[(0,ee.jsxs)("div",{className:Ee.editorArea,"data-aia-editor":"",children:[(0,ee.jsx)("div",{...Kt,className:Ee.input,"data-aia-input":""}),Wt&&(ke||l.length>0)&&(0,ee.jsx)("span",{ref:ce,className:Ee.pillListContainer,"data-aia-pill-list-container":"",children:(0,ee.jsx)(Ue,{pills:l,activePillIndex:0,activeSelected:ye,onSelectPill:z,loading:ke})})]}),ae===null?null:ae===void 0?(0,ee.jsx)(Dt,{disabled:!_e,onClick:tt}):(0,ee.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ee.submitSlot,onClick:E=>{_e&&(E.stopPropagation(),tt())},children:ae})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,isoDate,monthLabel,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
1926
|
+
`,document.head.appendChild(e)}var Rt={submitButton:"aia-submitButton-otz7H"};var Qe=require("react/jsx-runtime");function Dt({disabled:e,onClick:i}){return(0,Qe.jsx)("button",{type:"button","data-aia-submit":"",className:Rt.submitButton,disabled:e,onClick:t=>{t.stopPropagation(),i()},"aria-label":"Submit",children:(0,Qe.jsx)("svg",{width:"18",height:"18",viewBox:"0 0 18 18",fill:"none",role:"img","aria-label":"Submit",children:(0,Qe.jsx)("path",{d:"M9 14V4M9 4L4 9M9 4L14 9",stroke:"currentColor",strokeWidth:"2",strokeLinecap:"round",strokeLinejoin:"round"})})})}var Me=require("@magicx-eng/ai-autocomplete-vanilla"),S=require("react");var st=require("react");function Lt(e){let i=(0,st.useRef)(e);i.current=e;let t=Object.keys(e??{}).sort().join("\0"),r=(0,st.useRef)({key:"",overrides:void 0});if(r.current.key!==t){let n={};for(let o of Object.keys(e??{})){let s=(b,v,h)=>{let y=i.current?.[o];return y?y(b,v,h):[]};n[o]=s}r.current={key:t,overrides:e?n:void 0}}return{overrides:r.current.overrides,key:t}}var lt=require("react");function Mt(e){let i=(0,lt.useRef)(e);i.current=e;let t=(0,lt.useRef)(null);t.current===null&&(t.current={fetch:(n,o)=>{let s=i.current;return s?s.fetch(n,o):Promise.reject(new Error("products config removed"))},transform:n=>i.current?.transform(n)??[],get limit(){return i.current?.limit}});let r=e!==void 0;return{config:r?t.current:void 0,enabled:r}}var la={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:[],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 Ze({onSubmit:e,onResult:i,onError:t,optionOverrides:r,maskCompletedText:n,apiConfig:o,additionalContext:s,columns:b=2,dropdownTrigger:v,optionsPosition:h,closeDropdownOnBlur:y,showNonTappableOptions:f,showOptionIcons:k,showSkipButton:P,showProducts:w,onFocus:R,onBlur:O,value:N,completedParams:B,onChange:ne,onParamsChange:F,products:I,onProductSelect:te,source:we,setCursor:re}){let u=(0,S.useRef)(null),[xe,K]=(0,S.useState)(null),se=(0,S.useRef)(e);se.current=e;let ye=(0,S.useRef)(i);ye.current=i;let le=(0,S.useRef)(t);le.current=t;let ae=(0,S.useRef)(ne);ae.current=ne;let de=(0,S.useRef)(F);de.current=F;let ie=(0,S.useRef)(R);ie.current=R;let ce=(0,S.useRef)(O);ce.current=O;let pe=(0,S.useRef)(re);pe.current=re;let W=(0,S.useRef)(te);W.current=te;let G=Mt(I),Z=Lt(r);(0,S.useEffect)(()=>{if(typeof document>"u")return;let g=new Me.AIAutocomplete(document.createElement("div"),{renderMode:"headless",apiConfig:o,additionalContext:s,optionOverrides:Z.overrides,maskCompletedText:n,columns:b,dropdownTrigger:v,optionsPosition:h,closeDropdownOnBlur:y,showNonTappableOptions:f,showProducts:w,source:we,value:N,completedParams:B,onSubmit:(...M)=>se.current?.(...M),onResult:(...M)=>ye.current?.(...M),onError:(...M)=>le.current?.(...M),onChange:(...M)=>ae.current?.(...M),onParamsChange:(...M)=>de.current?.(...M),onFocus:()=>ie.current?.(),onBlur:()=>ce.current?.(),onProductSelect:M=>W.current?.(M),setCursor:M=>pe.current?.(M),products:G.config});u.current=g,K(g.getState());let Q=g.subscribe(M=>K(M));return()=>{Q(),g.destroy(),u.current===g&&(u.current=null)}},[]),(0,S.useEffect)(()=>{N!==void 0&&u.current?.setValue(N)},[N]),(0,S.useEffect)(()=>{B!==void 0&&u.current?.setCompletedParams(B)},[B]);let c=JSON.stringify(o??null),a;try{a=JSON.stringify(s??null)}catch{a="[unstringifiable]"}(0,S.useEffect)(()=>{u.current?.update({apiConfig:o,additionalContext:s,optionOverrides:Z.overrides,dropdownTrigger:v,optionsPosition:h,closeDropdownOnBlur:y,showNonTappableOptions:f,showProducts:w})},[c,a,Z.key,v,h,y,f,w]);let m=(0,S.useRef)(!1);(0,S.useEffect)(()=>{if(!m.current){m.current=!0;return}u.current?.update({products:G.config})},[G.enabled]);let x=(0,S.useRef)(null);x.current===null&&(x.current={handleTextChange:g=>u.current?.handleTextChange(g),handleKeyDown:g=>{let Q="nativeEvent"in g?g.nativeEvent:g;u.current?.handleKeyDown(Q)},setFocused:g=>u.current?.setFocused(g),startEditingParam:g=>u.current?.startEditingParam(g),exitEditMode:()=>u.current?.exitEditMode(),handleCaretAfterInput:g=>u.current?.handleCaretAfterInput(g),handleCaretMove:g=>u.current?.handleCaretMove(g),replaceEditingRange:g=>u.current?.replaceEditingRange(g)??!1,setActivePill:g=>u.current?.setActivePill(g),skipActivePill:()=>u.current?.skipActivePill(),removeLastParam:()=>u.current?.removeLastParam(),clearNewParamId:()=>u.current?.clearNewParamId(),reset:()=>u.current?.reset(),selectOption:g=>u.current?.selectOption(g),selectProduct:g=>u.current?.selectProduct(g),setActiveDropdownIndex:g=>u.current?.setActiveDropdownIndex(g),showPreviousMonth:()=>u.current?.showPreviousMonth(),showNextMonth:()=>u.current?.showNextMonth(),handleFocus:()=>u.current?.setFocused(!0),handleBlur:()=>u.current?.setFocused(!1)});let l=x.current,T=(0,S.useCallback)(g=>{let Q=g.target.value,Je=Q.length>0&&!g.nativeEvent?.isComposing&&Q[0]!==Q[0].toUpperCase()?Q[0].toUpperCase()+Q.slice(1):Q;u.current?.handleTextChange(Je)},[]),he=(0,S.useCallback)(g=>{u.current?.handleKeyDown(g.nativeEvent)},[]),V=u.current,d=xe??la,ue=N!==void 0?N:d.text,Se=B!==void 0?B:d.completedParams,ke=d.actionableSuggestions,Te=ke[0],fe=V?.listboxId??"",ze=d.activeDropdownIndex>=0&&V?`${fe}-option-${d.activeDropdownIndex}`:void 0,_=d.editingParam,q=d.editingIdentified,Ae=_?{type:_.suggestionType,text:_.suggestionPlaceholder,required:!0,options:_.options}:q?{type:q.type,text:(0,Me.identifiedParamLabel)(q.type),required:!0,options:[]}:null,Fe=Ae??Te,Xe=Ae?[Ae]:ke,Ne=(0,Me.dateSelectionFor)(d),Ke=!V||d.isLoading&&!d.editingParam&&!d.inSelectionAnimation||d.isSearchingOptions;return{completedParams:Se,skippedParams:d.skippedParams,identifiedParams:d.identifiedParams,suggestionPills:ke,setActivePill:l.setActivePill,skipActivePill:l.skipActivePill,removeLastParam:l.removeLastParam,segments:d.segments,newParamId:d.newParamId,clearNewParamId:l.clearNewParamId,suggestions:d.suggestions,activeIndex:d.activeDropdownIndex,isReady:d.isReady,isLoading:Ke,isFocused:d.isFocused,isDropdownOpen:d.isDropdownOpen,isActivePillSelected:d.isActivePillSelected,placeholderText:d.placeholderText,listboxId:fe,error:d.error,products:d.products,customFields:d.customFields,selectProduct:l.selectProduct,handleTextChange:l.handleTextChange,handleKeyDown:l.handleKeyDown,setFocused:l.setFocused,editingParam:_,editingIdentified:q,editingAnchor:d.editingAnchor,caretOffset:d.caretOffset,startEditingParam:l.startEditingParam,exitEditMode:l.exitEditMode,handleCaretAfterInput:l.handleCaretAfterInput,handleCaretMove:l.handleCaretMove,replaceEditingRange:l.replaceEditingRange,inputProps:{value:ue,placeholder:d.placeholderText||void 0,onChange:T,onKeyDown:he,onFocus:l.handleFocus,onBlur:l.handleBlur,role:"combobox","aria-expanded":d.isDropdownOpen,"aria-activedescendant":ze,"aria-autocomplete":"list","aria-controls":fe},reset:l.reset,dropdownProps:{suggestions:Fe?[{...Fe,options:d.filteredOptions}]:[],activeIndex:d.activeDropdownIndex,onSelect:l.selectOption,onHighlight:l.setActiveDropdownIndex,isOpen:d.isDropdownOpen,id:fe,pills:Xe,activeSelected:d.isActivePillSelected,onPillClick:l.setActivePill,onSkip:l.skipActivePill,showSkipButton:(P??!0)&&!_&&!q,showOptionIcons:k??!0,skipDisabled:d.inSelectionAnimation,isLoading:Ke,isInputEmpty:ue.trim().length===0,products:d.products,onProductSelect:l.selectProduct,onProductFocusChange:l.setFocused,formatType:d.activeFormatType,dateView:d.dateView,selectedDateIso:Ne.selectedIso,selectedDateRange:Ne.selectedRange,dateRangeStart:Ne.rangeStart,onPreviousMonth:l.showPreviousMonth,onNextMonth:l.showNextMonth,optionsPosition:h??"below"}}}var $=require("@magicx-eng/ai-autocomplete-vanilla"),C=require("react"),Ye;function da(){if(Ye!==void 0)return Ye;if(typeof document>"u")return!1;let e=document.createElement("div");return e.setAttribute("contenteditable","plaintext-only"),Ye=e.contentEditable==="plaintext-only",Ye}function Ot(e){let{segments:i,showChipIcons:t=!0,newParamId:r,editingParam:n,editingIdentified:o,editingAnchor:s,caretOffset:b,placeholderText:v,isFocused:h,isDropdownOpen:y,listboxId:f,activeDescendantId:k,autoFocus:P,handleTextChange:w,handleKeyDown:R,handleCaretAfterInput:O,handleCaretMove:N,startEditingParam:B,replaceEditingRange:ne,setFocused:F}=e,I=(0,C.useRef)(null),te=(0,C.useRef)(!1),we=(0,C.useRef)(""),re=(0,C.useRef)(""),u=(0,C.useRef)(null),xe=(0,C.useRef)(0);u.current=b,(0,C.useEffect)(()=>{if(!P)return;let c=I.current;if(!c)return;document.activeElement===c?F(!0):c.focus();let a=c.ownerDocument??document,m=a.getSelection(),x=m&&m.rangeCount>0&&c.contains(m.anchorNode);if(m&&!x){let l=a.createRange();l.selectNodeContents(c),l.collapse(!0),m.removeAllRanges(),m.addRange(l)}},[P,F]),(0,C.useEffect)(()=>{let c=I.current;if(!c)return;let a=c.ownerDocument??document,m=()=>{let x=a.getSelection();if(!x||x.rangeCount===0||!x.anchorNode||!c.contains(x.anchorNode))return;let l=x.anchorNode,T=l.nodeType===Node.ELEMENT_NODE?l:l.parentElement,V=(x.isCollapsed?T?.closest("strong[data-param-id]"):null)?.dataset.paramId??null,d=n?.id??o?.id??null;if(V&&V!==d){B(V);return}performance.now()-xe.current<50||N((0,$.getCursorOffset)(c))};return a.addEventListener("selectionchange",m),()=>a.removeEventListener("selectionchange",m)},[n,o,B,N]),(0,C.useLayoutEffect)(()=>{let c=I.current;c&&(0,$.renderEditableContent)({input:c,segments:i,newParamId:r,editingParamId:n?.id??null,placeholderText:v??"",isFocused:h,showChipIcons:t})},[i,r,n,v,h,t]),(0,C.useLayoutEffect)(()=>{let c=we.current,a=r??"";if(we.current=a,!a||a===c)return;let m=I.current;if(!m)return;m.focus();let x=u.current??(0,$.plainTextLength)(m);(0,$.setCursorOffset)(m,x)},[r]),(0,C.useLayoutEffect)(()=>{let c=re.current,a=n?.id??"";if(re.current=a,!a||a===c||s==null)return;let m=I.current;m&&(0,$.setCursorOffset)(m,s)},[n,s]);let K=(0,C.useCallback)(()=>{if(te.current)return;let c=I.current;if(!c)return;let a=(0,$.extractPlainText)(c),x=a.length>0&&a[0]!==a[0].toUpperCase()?a[0].toUpperCase()+a.slice(1):a;w(x)},[w]),se=(0,C.useCallback)(()=>{xe.current=performance.now(),K();let c=I.current;c&&O((0,$.getCursorOffset)(c))},[K,O]);(0,C.useEffect)(()=>{let c=I.current;if(!c)return;let a=m=>{let x=m,l=x.inputType;if(l==="insertParagraph"||l==="insertLineBreak"||l==="insertFromDrop"){m.preventDefault();return}if(l.startsWith("insert")||l.startsWith("delete")){let T=l.startsWith("delete")?"":x.data??"";ne(T)&&m.preventDefault()}};return c.addEventListener("beforeinput",a),()=>c.removeEventListener("beforeinput",a)},[ne]);let ye=(0,C.useCallback)(()=>{te.current=!0},[]),le=(0,C.useCallback)(()=>{te.current=!1,K()},[K]),ae=(0,C.useCallback)(c=>{c.preventDefault();let a=I.current;if(!a)return;let m=(c.clipboardData.getData("text/plain")??"").replace(/\r?\n/g," ");if(!m)return;let x=a.ownerDocument??document,l=x.getSelection();if(!l||l.rangeCount===0)return;let T=l.getRangeAt(0);if(!a.contains(T.startContainer))return;T.deleteContents();let he=x.createTextNode(m);T.insertNode(he),T.setStartAfter(he),T.collapse(!0),l.removeAllRanges(),l.addRange(T),K()},[K]),de=(0,C.useCallback)(c=>R(c),[R]),ie=(0,C.useCallback)(()=>F(!0),[F]),ce=(0,C.useCallback)(()=>F(!1),[F]),pe=(0,C.useCallback)(()=>I.current?.focus(),[]),W=(0,C.useCallback)(()=>I.current?.blur(),[]),G=(0,C.useCallback)(()=>{let c=I.current;return c?(0,$.extractPlainText)(c):""},[]),Z=da()?"plaintext-only":"true";return{inputRef:I,editorProps:{ref:I,contentEditable:Z,suppressContentEditableWarning:!0,tabIndex:0,role:"combobox","aria-autocomplete":"list","aria-haspopup":"listbox","aria-controls":f,"aria-expanded":y,"aria-activedescendant":k,spellCheck:!0,enterKeyHint:"send",onInput:se,onKeyDown:de,onCompositionStart:ye,onCompositionEnd:le,onPaste:ae,onFocus:ie,onBlur:ce},getPlainText:G,focus:pe,blur:W}}var ee=require("react/jsx-runtime");function ca(e){return e!=="auto"?e:typeof window>"u"||window.matchMedia("(prefers-color-scheme: dark)").matches?"dark":"light"}var zt=(0,L.forwardRef)(function({onSubmit:i,onResult:t,onError:r,optionOverrides:n,maskCompletedText:o,className:s,apiConfig:b,additionalContext:v,columns:h,pillPlacement:y="dropdown",mode:f="auto",optionsPosition:k="below",animations:P=!0,dropdownTrigger:w,closeDropdownOnBlur:R,showNonTappableOptions:O,showOptionIcons:N=!0,showChipIcons:B=!0,showSkipButton:ne,showProducts:F,productsLayout:I,autoFocus:te=!0,onFocus:we,onBlur:re,value:u,completedParams:xe,onChange:K,onParamsChange:se,products:ye,onProductSelect:le,submitButton:ae},de){let ie=(0,L.useRef)(null),ce=(0,L.useRef)(null),pe=(0,L.useRef)(()=>{}),W=(0,L.useRef)(null),G=(0,L.useRef)(null);(0,L.useEffect)(()=>{let E=ie.current;if(E)return W.current?W.current.setMode(f):W.current=new Oe.ModeController(E,f),()=>{W.current?.destroy(),W.current=null}},[f]);let Z=(0,L.useCallback)(E=>{let Ce=G.current?.current;Ce&&(Ce.focus(),(0,Oe.setCursorOffset)(Ce,E))},[]),{completedParams:c,skippedParams:a,identifiedParams:m,isReady:x,customFields:l,suggestionPills:T,setActivePill:he,skipActivePill:V,segments:d,newParamId:ue,clearNewParamId:Se,placeholderText:ke,isFocused:Te,isDropdownOpen:fe,isActivePillSelected:ze,isLoading:_,activeIndex:q,listboxId:Ae,handleTextChange:Fe,handleKeyDown:Xe,setFocused:Ne,editingParam:Ke,editingIdentified:g,editingAnchor:Q,caretOffset:M,startEditingParam:Je,handleCaretAfterInput:Nt,handleCaretMove:Ht,replaceEditingRange:Bt,dropdownProps:Ft,reset:We}=Ze({onSubmit:E=>pe.current(E),onResult:t,onError:r,optionOverrides:n,maskCompletedText:o,apiConfig:b,additionalContext:v,columns:h,dropdownTrigger:w,optionsPosition:k,closeDropdownOnBlur:R,showNonTappableOptions:O,showOptionIcons:N,showSkipButton:ne,showProducts:F,onFocus:we,onBlur:re,value:u,completedParams:xe,onChange:K,onParamsChange:se,products:ye,onProductSelect:le,source:"full-sdk",setCursor:Z});(0,L.useEffect)(()=>{if(!ue)return;let E=window.setTimeout(()=>Se(),650);return()=>window.clearTimeout(E)},[ue,Se]);let Kt=q>=0?`${Ae}-option-${q}`:void 0,{inputRef:et,editorProps:Wt,focus:Ge,blur:dt,getPlainText:ct}=Ot({segments:d,newParamId:ue,editingParam:Ke,editingIdentified:g,editingAnchor:Q,caretOffset:M,placeholderText:ke,isFocused:Te,showChipIcons:B,isDropdownOpen:fe,listboxId:Ae,activeDescendantId:Kt,autoFocus:te,handleTextChange:Fe,handleKeyDown:Xe,handleCaretAfterInput:Nt,handleCaretMove:Ht,startEditingParam:Je,replaceEditingRange:Bt,setFocused:Ne});G.current=et,(0,L.useLayoutEffect)(()=>{let E=ce.current,Ce=et.current;if(!E||!Ce)return;let pt=()=>{let ut=E.firstElementChild;if(!ut)return;let Ut=ut.getBoundingClientRect(),jt=Ce.getBoundingClientRect();Ut.top>=jt.bottom-2?E.setAttribute("data-aia-pill-wrapped",""):E.removeAttribute("data-aia-pill-wrapped")};pt();let ht=new ResizeObserver(pt);return ht.observe(Ce),()=>ht.disconnect()},[d,T.length,_,et]),(0,L.useImperativeHandle)(de,()=>({focus:Ge,blur:dt,reset:We,setMode:E=>W.current?.setMode(E),skipActivePill:V}),[Ge,dt,We,V]);let _e=!!d.length||c.length>0,tt=(0,L.useCallback)(()=>{if(!_e)return;let E=ct();i((0,Oe.buildSubmitResult)(E,c,a,{identifiedParams:m,isReady:x,customFields:l})),We()},[_e,c,a,m,x,l,i,We,ct]);pe.current=tt;let Gt=(0,L.useCallback)(E=>{E.target?.closest("[data-aia-pill]")||Ge()},[Ge]),_t=y==="inline",qt=y==="dropdown";return(0,ee.jsxs)("div",{ref:ie,className:`magicx-aia ${Ee.container} ${s??""}`,"data-pill-placement":y,"data-options-position":k,"data-animations":P?"on":"off","data-mode":ca(f),children:[(0,ee.jsx)(Ve,{...Ft,showPills:qt,productsLayout:I}),(0,ee.jsxs)("div",{className:Ee.inputWrapper,"data-aia-input-wrapper":"",onClick:Gt,children:[(0,ee.jsxs)("div",{className:Ee.editorArea,"data-aia-editor":"",children:[(0,ee.jsx)("div",{...Wt,className:Ee.input,"data-aia-input":""}),_t&&(_||T.length>0)&&(0,ee.jsx)("span",{ref:ce,className:Ee.pillListContainer,"data-aia-pill-list-container":"",children:(0,ee.jsx)(Ue,{pills:T,activePillIndex:0,activeSelected:ze,onSelectPill:he,loading:_})})]}),ae===null?null:ae===void 0?(0,ee.jsx)(Dt,{disabled:!_e,onClick:tt}):(0,ee.jsx)("span",{"data-aia-submit":"","data-aia-submit-slot":"",className:Ee.submitSlot,onClick:E=>{_e&&(E.stopPropagation(),tt())},children:ae})]})]})});0&&(module.exports={AIAutocomplete,AIAutocompleteDropdown,DATE_RANGE_META_END,DATE_RANGE_META_START,PRODUCT_PATH_PREFIX,WEEKDAY_LABELS,buildSubmitResult,cellDay,cellIso,dateCellMarks,formatDate,formatDateRange,isoDate,monthLabel,optionLabel,parseDate,parseLooseDate,parseLooseDateRange,productFromMatchedItem,productsFromCustomFields,sanitizeOptionIconSvg,selectedRangeFor,useAIAutocomplete,visibleDateRange,withSkippedParams});
|
|
1877
1927
|
//# sourceMappingURL=index.js.map
|