@magicx-eng/ai-autocomplete-react 0.45.0 → 0.46.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -17,6 +17,7 @@ A React/TypeScript SDK that provides a guided AI-powered autocomplete experience
17
17
  - **IME-safe** — composition events are buffered so input text is committed once, after composition ends
18
18
  - **Client-side filtering** — instant substring filtering on every keystroke
19
19
  - **Datepicker** — date parameters are answered with a calendar instead of an option list. Click a day or navigate with the arrow keys; the date is committed the way it would be written — `Tuesday` for a date inside the next week, `March 23` for one later this year, `March 23 2027` for another year. Tapping a committed date re-opens the calendar on the month that text names now — for a weekday name, that is the next such day, not the one originally picked. A date-range parameter gets the same calendar answered in two clicks, committed as one range.
20
+ - **Time picker** — time parameters are answered with a time wheel instead of an option list: three wheels (hour, minutes in fives, AM/PM) and a Done button. Scroll or tap the wheels, or press ↑ / ↓ in the input to move the time five minutes; Enter or Done commits it, written as `7:30 PM`. Tapping a committed time re-opens the wheel on it.
20
21
  - **Option overrides** — supply the options for a parameter yourself: a fixed list, a computed one, or one fetched from your own search endpoint as the user types
21
22
  - **Product strip** — the dropdown renders a horizontal row of product cards below the options, filled by default with the items the `/suggest` response reports as matching the query; plug in your own product search instead with `products`, or turn the strip off with `showProducts={false}`
22
23
  - **Catalog report** — every response says which of the query's constraints the catalog applied, which it had to drop, and how many items are left, on `customFields` / `custom_fields`
@@ -225,6 +226,60 @@ the prose. Re-editing one re-opens the calendar with both ends marked.
225
226
  a new query, so suggestions refresh as the user types — useful when someone
226
227
  would rather describe what they want than pick a day.
227
228
 
229
+ ### Time picker
230
+
231
+ When the next parameter is a time, the dropdown shows a time wheel instead of a
232
+ list of options. As with dates, which parameters are times is the server's call:
233
+ one whose `type` is `time` gets the wheel, and one without it keeps its option
234
+ list, however time-like its options look.
235
+
236
+ Nothing is required to switch it on. The options the server still sends for a
237
+ time parameter are never shown, but they choose where the wheel opens: on the
238
+ middle of the times suggested (`6 PM`, `7 PM`, `8 PM` opens on 7:00 PM), or on
239
+ the next whole hour when there are none.
240
+
241
+ **What the user can do**
242
+
243
+ | Input | Result |
244
+ |---|---|
245
+ | Scroll or tap a wheel | Turns that wheel; the time on the top rows is the time. Commits nothing |
246
+ | <kbd>↓</kbd> / <kbd>↑</kbd> in the input | Moves the time 5 minutes later / earlier |
247
+ | <kbd>Enter</kbd> | Commits the time — once the wheel has been moved. Until then it is only a suggestion, and Enter submits as usual |
248
+ | Done | Commits the time |
249
+ | <kbd>Esc</kbd> | Puts a moved wheel back on its suggested time |
250
+ | <kbd>→</kbd> at the end of the input | Skips the parameter, same as any other pill |
251
+
252
+ **The committed value** is written the way a person would write it, always in
253
+ English: `7:30 PM`, `12:05 AM`. It arrives as an ordinary completed parameter
254
+ (bold in the input, in `completed_params` on submit) with the server's lead-in
255
+ before it when there is one (`at 7:30 PM`). The exact time is also recorded on
256
+ the parameter's `metadata` as 24-hour `HH:MM` under the `TIME_META_KEY` key
257
+ (`aiaTime`), so you never have to parse the prose:
258
+
259
+ ```ts
260
+ import { parseTime, TIME_META_KEY } from "@magicx-eng/ai-autocomplete-react";
261
+
262
+ const time = param.metadata?.[TIME_META_KEY]; // "19:30"
263
+ const minutes = parseTime(param.text); // 1170 — minutes since midnight, or null
264
+ ```
265
+
266
+ **Re-editing** a committed time re-opens the wheel on it.
267
+
268
+ **Typing** while the wheel is open does not filter anything. As with the
269
+ calendar, the text is treated as a new query.
270
+
271
+ ### Multiple selections
272
+
273
+ - A suggestion with `type: { kind: "multi_select" }` shows checkbox options and a Done button.
274
+ - Select rows to toggle values. Typing filters the options and keeps the current picks.
275
+ - Done joins the picks in selection order with the UI language's word for "and".
276
+ - Each value has its own `completed_params` entry. The input shows one chip for the group.
277
+ - Remove the group chip to change the answer. Group chips do not open for editing.
278
+ - Done without picks skips the question. Typing a phrase with no matching options closes the question and keeps that phrase.
279
+ - Space toggles the highlighted row when nothing is typed for the question. Enter commits the picks, or selects the highlighted row when no values are picked.
280
+ - Headless integrations can call `toggleMultiSelectOption(option)` and `commitMultiSelect()`.
281
+ - `multiSelectView.picked` contains the selected option texts. The view is null outside a multi_select question.
282
+
228
283
  ---
229
284
 
230
285
  ## Tier 2: Hook + Dropdown
@@ -280,6 +335,8 @@ Skip `<AIAutocompleteDropdown />` and render the suggestions UI yourself. `dropd
280
335
 
281
336
  > **Datepicker in a custom UI.** For a date parameter, `dropdownProps.formatType` is `"date"` and `suggestions[0].options` holds that month's day cells. Each cell's `text` is the date it commits (`"March 23"`, or `"Tuesday"` inside the next week), so rendering them as a plain list already works — `onSelect` behaves exactly as it does for an option. To draw an actual calendar, read `dateView` for the month on show, `cellDay(option)` for the number to paint, and call `onPreviousMonth` / `onNextMonth` to page. Cells that pad the start and end of the month have `is_tappable: false`. For a **range** parameter `formatType` is `"date-range"` and the same `onSelect` fires twice: the first records the start (`dropdownProps.dateRangeStart` holds it, and nothing is committed yet), the second commits the span. `dateCellMarks` and `visibleDateRange` are exported to paint the two ends and the band between them the way the built-in calendar does.
282
337
 
338
+ > **Time picker in a custom UI.** For a time parameter, `dropdownProps.formatType` is `"time"`, `suggestions[0].options` is empty, and `dropdownProps.timeView` holds `{ minutes, touched }` — the time on show, as minutes since midnight. Draw it however you like (`formatTime(minutes)` gives `"7:30 PM"`), call `onTimeChange(minutes)` to move it (snapped to 5 minutes) and `onTimeCommit()` to answer with it. The input's ↑ / ↓ / Enter keys already drive it through `inputProps`.
339
+
283
340
  > **Option icons.** An option may carry an icon: `icon_svg` is inline SVG markup and `icon` its name. The built-in dropdown draws the SVG before the option's text, in the text color, and hides it while the row shows its loading skeleton. When rendering options yourself, pass `icon_svg` through the exported `sanitizeOptionIconSvg` before inserting it — it reduces the markup to plain vector drawing and returns `null` for anything else — and use `optionLabel(option)` for the text — it is the option's `text` alone; `icon` is the icon's name and is never shown as text, even when `icon_svg` is missing or fails to draw. A picked option's `icon` / `icon_svg` are copied onto its completed parameter, and the chip in the input draws the glyph before its text. Both surfaces can be switched off: `showOptionIcons: false` renders option rows as text only and `showChipIcons: false` renders chips as text only; either way the icon element is omitted rather than hidden.
284
341
 
285
342
  > **Option pictures and counts.** An option may also carry `image_url` — a picture of the best-matching catalog item offering it — and `item_count`, how many items offer it (each is present only when the server includes it; when it includes counts, the options also arrive ordered by them, most items first; a starting state carries pictures but no counts). The built-in dropdown draws the picture as a square thumbnail before the option's text (in place of its `icon_svg`, so a row never leads with two visuals) and the count as a muted label at the row's trailing edge (`"12 items"`); a skeleton row keeps the tile's placeholder fill and hides the count. Icons and pictures are all-or-nothing per list: if any tappable option would draw neither, no row draws one, so a list never mixes rows with and without a leading visual (non-tappable rows don't count). A custom dropdown can apply the same rule with the exported `optionsShowLeadingVisuals(options, showIcons, showImages)`. The unit word after the number is a token: set `--aia-option-count-unit: "sneakers"` to name what is being counted, `--aia-option-count-unit-one: "sneaker"` for a count of 1 (it falls back to the plural token), or `--aia-option-count-unit: ""` for the number alone. When rendering options yourself, pass `image_url` through the exported `optionImageSrc` before using it as an `<img src>` — it returns the URL only when it is `http(s)` and `null` otherwise — and `formatOptionCount(option.item_count)` gives the number the built-in rows print (`null` when there is no count); `optionCountLabel(count, unit?)` appends a unit for a dropdown that prints the word itself (`"item"` / `"items"` by default; one word, a `{ one, other }` pair, or `""` for none). Both surfaces can be switched off: `showOptionImages: false` renders rows without pictures (an option's icon then draws instead) and `showOptionCounts: false` hides the counts. A picked option's `image_url` is copied onto its completed parameter too, and the chip in the input draws it as a small rounded tile before its text, in place of the icon; `showChipImages: false` renders chips without pictures (the icon then draws instead). The tile is sized by `--aia-option-image-size` (40px), rounded by `--aia-option-image-radius` (12px), spaced by `--aia-option-image-gap` (12px) and filled by `--aia-option-image-bg` (default: `--aia-skeleton-bg`) as a placeholder until its picture loads (and on skeleton rows, or if the picture fails); a loaded picture is scaled to fit rather than cropped and sits on the dropdown's background, and one narrower than the tile is rounded on its own corners by `--aia-option-picture-radius` (6px); in a grid with pictures, an icon row draws its glyph at `--aia-option-tile-icon-size` (1.5em) so it holds the picture column; the count reads `--aia-option-count-font-size` (12px), `--aia-option-count-color` and `--aia-option-count-opacity` (0.6); the chip's tile reads `--aia-chip-image-size` (1.25em of the chip's font), `--aia-chip-image-radius` (4px) and `--aia-chip-image-bg` (default: `--aia-skeleton-bg`), the placeholder fill shown until the picture loads; a loaded picture narrower than the tile narrows it to the picture's own width, so the radius rounds the picture.
@@ -931,6 +988,12 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
931
988
  | `--aia-date-today-ring` | `--aia-option-color` | `--aia-option-color` | Outline drawn around today's date. |
932
989
  | `--aia-date-selected-bg` | white at 12% | white at 12% | Fill behind the date a re-edited parameter already holds. |
933
990
  | `--aia-date-range-bg` | white at 6% | white at 6% | Band across the days between the two ends of a picked date range. The ends themselves use `--aia-date-selected-bg`. |
991
+ | `--aia-time-panel-width` | `240px` | `240px` | Max width of the whole dropdown panel while the time wheel is up. |
992
+ | `--aia-time-font-size` | `15px` | `15px` | The time wheel's numbers and its `:` separator. |
993
+ | `--aia-time-band-bg` | white at 8% | white at 8% | The band behind the wheels' top rows — the chosen time. |
994
+ | `--aia-time-done-bg` | white at 10% | white at 10% | The time wheel's Done button. |
995
+ | `--aia-time-done-bg-hover` | white at 16% | white at 16% | The Done button on hover. |
996
+ | `--aia-time-done-color` | `--aia-option-color-selected` | `--aia-option-color-selected` | The Done button's text. |
934
997
  | `--aia-skeleton-bg` | `rgba(189, 189, 189, 0.083)` | `#1a1b1d` | Fill color for the loading skeleton bars and the masked text in cached pills/options, and of the option and chip image tiles while their picture loads (unless `--aia-option-image-bg` / `--aia-chip-image-bg` are set). |
935
998
 
936
999
  Legacy `--aia-color-*` variables are still supported as fallbacks.
@@ -975,6 +1038,7 @@ For styling beyond the CSS variables, target these stable `data-aia-*` attribute
975
1038
  | `[data-aia-scroll-arrow]` | The "more below" arrow on the dropdown — carries `data-aia-visible` while shown |
976
1039
  | `[data-aia-dropdown]` | The dropdown root (listbox). Carries `data-aia-has-products` while the product strip has cards, and `data-aia-fit` while it is fitted to a short screen (see [Short screens](#short-screens)). |
977
1040
  | `[data-aia-datepicker]` | The calendar, rendered in place of the option list for a date parameter |
1041
+ | `[data-aia-time-wheel]` | The time wheel, rendered in place of the option list for a time parameter |
978
1042
  | `[data-aia-date-month]` | The "March 2026" header label |
979
1043
  | `[data-aia-date-prev]` / `[data-aia-date-next]` | The month arrows |
980
1044
  | `[data-aia-date-grid]` | The 7-column grid of day cells |
package/dist/index.d.mts CHANGED
@@ -1,5 +1,5 @@
1
- import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, CoreState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
2
- export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CurrencyOptions, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductImageFallback, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, formatOptionCount, isoDate, monthLabel, optionCountLabel, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productImageSources, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
1
+ import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, TimeView, SkippedParamState, IdentifiedParamState, CoreState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
2
+ export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CurrencyOptions, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductImageFallback, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TIME_META_KEY, TaskKind, TimeView, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, formatOptionCount, formatTime, isoDate, monthLabel, optionCountLabel, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, parseTime, productFromMatchedItem, productImageSources, 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';
@@ -379,6 +379,11 @@ interface UseAIAutocompleteOptions {
379
379
  setCursor?: (offset: number) => void;
380
380
  }
381
381
  interface UseAIAutocompleteReturn {
382
+ multiSelectView: {
383
+ picked: string[];
384
+ } | null;
385
+ toggleMultiSelectOption: (option: SuggestionOption) => void;
386
+ commitMultiSelect: () => void;
382
387
  completedParams: CompletedParamState[];
383
388
  /**
384
389
  * Suggestions the user dismissed with the skip key (→). Not rendered
@@ -629,7 +634,8 @@ interface AIAutocompleteDropdownProps {
629
634
  * carries that month's cells rather than the parameter's own options — the
630
635
  * core swaps them before they reach here. A `"date-range"` parameter is
631
636
  * answered by two taps of that calendar, a start and an end, committed as one
632
- * span. Provided by `dropdownProps` from the hook.
637
+ * span. `"time"` renders the time wheel in place of the options grid, drawn
638
+ * from `timeView`. Provided by `dropdownProps` from the hook.
633
639
  * Default: `"options"`.
634
640
  */
635
641
  formatType?: FormatType;
@@ -645,6 +651,16 @@ interface AIAutocompleteDropdownProps {
645
651
  onPreviousMonth?: () => void;
646
652
  /** Page the calendar forward a month. Provided by `dropdownProps` from the hook. */
647
653
  onNextMonth?: () => void;
654
+ /** What the time wheel shows. Null unless `formatType` is `"time"`. Provided by `dropdownProps` from the hook. */
655
+ timeView?: TimeView | null;
656
+ multiSelectView?: {
657
+ picked: string[];
658
+ } | null;
659
+ onMultiSelectCommit?: () => void;
660
+ /** The user turned the time wheel; commits nothing. Provided by `dropdownProps` from the hook. */
661
+ onTimeChange?: (minutes: number) => void;
662
+ /** The time wheel's Done — answer the pill. Provided by `dropdownProps` from the hook. */
663
+ onTimeCommit?: () => void;
648
664
  /**
649
665
  * Color mode for a **standalone** dropdown. When set, the dropdown scopes the
650
666
  * SDK's design tokens to its own root (adds the `magicx-aia` class +
@@ -660,7 +676,7 @@ interface AIAutocompleteDropdownProps {
660
676
 
661
677
  declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
662
678
 
663
- declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
679
+ declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
664
680
 
665
681
  declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, mapProducts, onProductSelect, onProductAddToCart, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
666
682
 
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, SkippedParamState, IdentifiedParamState, CoreState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
2
- export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CurrencyOptions, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductImageFallback, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TaskKind, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, formatOptionCount, isoDate, monthLabel, optionCountLabel, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productImageSources, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams } from '@magicx-eng/ai-autocomplete-vanilla';
1
+ import { AutocompleteResult, OptionOverrides, APIConfig, CurrencyOptions, AppearanceMode, CompletedParamState, ProductsLayout, ProductImageFallback, ProductsConfig, Product, MatchedItem, Suggestion, SuggestionOption, FormatType, DateMonthView, DateRange, TimeView, SkippedParamState, IdentifiedParamState, CoreState, Segment, CustomFieldsReport } from '@magicx-eng/ai-autocomplete-vanilla';
2
+ export { APIConfig, APIKeyConfig, AccessTokenConfig, AccessTokenResult, AppearanceMode, AutocompleteResult, CompletedParam, CompletedParamState, CurrencyOptions, CustomFieldsReport, DATE_RANGE_META_END, DATE_RANGE_META_START, DEFAULT_OPTION_COUNT_UNIT, DateMonthView, DateRange, ExpressedFilter, FilterOp, FormatType, IdentifiedParam, IdentifiedParamState, MatchedItem, MatchedItems, OptionOverrides, PRODUCT_PATH_PREFIX, Product, ProductImageFallback, ProductsConfig, ProductsLayout, Segment, SkippedParamState, SubmitResultExtras, Suggestion, SuggestionOption, TIME_META_KEY, TaskKind, TimeView, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, formatOptionCount, formatTime, isoDate, monthLabel, optionCountLabel, optionHasImage, optionImageSources, optionImageSrc, optionLabel, optionsShowLeadingVisuals, parseDate, parseLooseDate, parseLooseDateRange, parseTime, productFromMatchedItem, productImageSources, 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';
@@ -379,6 +379,11 @@ interface UseAIAutocompleteOptions {
379
379
  setCursor?: (offset: number) => void;
380
380
  }
381
381
  interface UseAIAutocompleteReturn {
382
+ multiSelectView: {
383
+ picked: string[];
384
+ } | null;
385
+ toggleMultiSelectOption: (option: SuggestionOption) => void;
386
+ commitMultiSelect: () => void;
382
387
  completedParams: CompletedParamState[];
383
388
  /**
384
389
  * Suggestions the user dismissed with the skip key (→). Not rendered
@@ -629,7 +634,8 @@ interface AIAutocompleteDropdownProps {
629
634
  * carries that month's cells rather than the parameter's own options — the
630
635
  * core swaps them before they reach here. A `"date-range"` parameter is
631
636
  * answered by two taps of that calendar, a start and an end, committed as one
632
- * span. Provided by `dropdownProps` from the hook.
637
+ * span. `"time"` renders the time wheel in place of the options grid, drawn
638
+ * from `timeView`. Provided by `dropdownProps` from the hook.
633
639
  * Default: `"options"`.
634
640
  */
635
641
  formatType?: FormatType;
@@ -645,6 +651,16 @@ interface AIAutocompleteDropdownProps {
645
651
  onPreviousMonth?: () => void;
646
652
  /** Page the calendar forward a month. Provided by `dropdownProps` from the hook. */
647
653
  onNextMonth?: () => void;
654
+ /** What the time wheel shows. Null unless `formatType` is `"time"`. Provided by `dropdownProps` from the hook. */
655
+ timeView?: TimeView | null;
656
+ multiSelectView?: {
657
+ picked: string[];
658
+ } | null;
659
+ onMultiSelectCommit?: () => void;
660
+ /** The user turned the time wheel; commits nothing. Provided by `dropdownProps` from the hook. */
661
+ onTimeChange?: (minutes: number) => void;
662
+ /** The time wheel's Done — answer the pill. Provided by `dropdownProps` from the hook. */
663
+ onTimeCommit?: () => void;
648
664
  /**
649
665
  * Color mode for a **standalone** dropdown. When set, the dropdown scopes the
650
666
  * SDK's design tokens to its own root (adds the `magicx-aia` class +
@@ -660,7 +676,7 @@ interface AIAutocompleteDropdownProps {
660
676
 
661
677
  declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
662
678
 
663
- declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
679
+ declare function AIAutocompleteDropdown({ suggestions, activeIndex, onSelect, onHighlight, onUnhighlight, isOpen, id, className, pills, onPillClick, showPills, onSkip, showSkipButton, showOptionIcons, showOptionImages, showOptionCounts, skipDisabled, activeSelected, isLoading, skeletonExiting, isInputEmpty, language, products, onProductSelect, onProductAddToCart, onProductFocusChange, productsLayout, productImageFallback, formatType, dateView, selectedDateIso, selectedDateRange, dateRangeStart, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
664
680
 
665
681
  declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, showNonTappableOptions, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, mapProducts, onProductSelect, onProductAddToCart, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
666
682