@magicx-eng/ai-autocomplete-react 0.58.0 → 0.59.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
@@ -312,6 +312,7 @@ function App() {
312
312
  | `onProductSelect?` | `(product: Product) => void` | — | Called when a product card is activated. The SDK never navigates. |
313
313
  | `onProductAddToCart?` | `(product: Product) => void \| PromiseLike<unknown>` | — | When set, every card that isn't sold out shows an add-to-cart button; pressing it calls this instead of `onProductSelect`. Return a promise to show progress. See [Product strip](#product-strip). |
314
314
  | `resetOnSubmit?` | `boolean` | `true` | Clear the input and start a new session after `onSubmit` runs. Set to `false` to keep the query in place — e.g. when `onSubmit` navigates away — and call the handle's `reset()` yourself. |
315
+ | `seeAllResults?` | `boolean` | `false` | End the dropdown in a "See all results" button that submits like Enter (`onSubmit`, then `resetOnSubmit`), shown while there is typed text. Style it with the `--aia-see-all-*` tokens. |
315
316
  | `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`. |
316
317
  | `ref?` | `Ref<AIAutocompleteHandle>` | — | Imperative handle with `focus()`, `blur()`, `reset()`, and `setMode()`. |
317
318
 
package/REFERENCE.md CHANGED
@@ -596,10 +596,13 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
596
596
  | `--aia-confirm-color` | `#ffffff` | `#000000` | The checkbox's checkmark (and, in dark mode, the Done buttons' text). |
597
597
  | `--aia-done-bg` / `--aia-done-bg-hover` / `--aia-done-color` | `#e4e8f0` / `#d8dde8` / `#2a3150` | `--aia-confirm-*` | The Done buttons (multi-select and time wheel). |
598
598
  | `--aia-multi-done-bg` / `--aia-multi-done-bg-hover` / `--aia-multi-done-color` | `--aia-done-*` | `--aia-done-*` | Override the multi-select Done button alone. |
599
+ | `--aia-multi-done-bg-beside-see-all` / `--aia-multi-done-color-beside-see-all` | `transparent` / `--aia-option-color-selected` | `transparent` / `--aia-option-color-selected` | The multi-select Done button's fill and label colour at rest while "See all results" is shown under it, so the two do not compete (hover keeps `--aia-multi-done-bg-hover` and the Done colour). `--aia-multi-done-bg` and `--aia-done-bg` do not apply in this state. |
599
600
  | `--aia-multi-done-width` | `100%` (classic: as wide as the widest option) | same | Width of the multi-select Done button. |
600
601
  | `--aia-panel-min-width` | `160px` | same | Narrowest the floating options box gets when it hugs its options (desktop). |
601
602
  | `--aia-multi-done-min-width` | `120px` | `120px` | Narrowest the multi-select Done button gets. |
602
603
  | `--aia-time-done-bg` / `--aia-time-done-bg-hover` / `--aia-time-done-color` | `--aia-done-*` | `--aia-done-*` | Override the time wheel's Done button alone. |
604
+ | `--aia-see-all-bg` / `--aia-see-all-bg-hover` / `--aia-see-all-color` | `#2b2b2b` / `#3d3d3d` / `#ffffff` | `--aia-confirm-*` | The "See all results" button (`seeAllResults`). |
605
+ | `--aia-see-all-height` / `--aia-see-all-radius` / `--aia-see-all-font-size` | `48px` / `12px` / `16px` | same | Its minimum height, corner radius and text size. |
603
606
  | `--aia-location-field-bg-idle` | `transparent` | `transparent` | The location search field at rest. |
604
607
  | `--aia-location-field-bg` | `--aia-streak-rgb` at 6% (indigo) | `--aia-streak-rgb` at 6% (white) | The location search field on hover or focus. |
605
608
  | `--aia-location-field-radius` | `10px` | `10px` | Corner radius of the location search field. |
package/dist/index.d.mts CHANGED
@@ -230,6 +230,14 @@ interface AIAutocompleteProps {
230
230
  * yourself when you want a fresh session.
231
231
  */
232
232
  resetOnSubmit?: boolean;
233
+ /**
234
+ * When true, the dropdown ends in a full-width "See all results" button,
235
+ * shown while the field holds typed text. A click submits the query exactly
236
+ * as Enter and the submit button do (`onSubmit` runs, then `resetOnSubmit`
237
+ * applies), so an `onSubmit` that opens your results page takes the shopper
238
+ * there. Style it with the `--aia-see-all-*` custom properties. Default: false.
239
+ */
240
+ seeAllResults?: boolean;
233
241
  }
234
242
  interface UseAIAutocompleteOptions {
235
243
  /** Called on Enter with the final structured query. */
@@ -712,6 +720,12 @@ interface AIAutocompleteDropdownProps {
712
720
  picked: string[];
713
721
  } | null;
714
722
  onMultiSelectCommit?: () => void;
723
+ /**
724
+ * Set to draw the full-width "See all results" button below the products;
725
+ * a click calls it. `<AIAutocomplete seeAllResults>` sets it to its own
726
+ * submit while the field holds typed text. Omitted → no button.
727
+ */
728
+ onSeeAllResults?: () => void;
715
729
  /** The user turned the time wheel; commits nothing. Provided by `dropdownProps` from the hook. */
716
730
  onTimeChange?: (minutes: number) => void;
717
731
  /** The time wheel's Done — answer the pill. Provided by `dropdownProps` from the hook. */
@@ -748,7 +762,7 @@ interface AIAutocompleteDropdownProps {
748
762
 
749
763
  declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
750
764
 
751
- 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, dateReferences, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
765
+ 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, dateReferences, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onSeeAllResults, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
752
766
 
753
767
  declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, prependPlaceholder, allOption, showNonTappableOptions, locationSearch, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, mapProducts, onProductSelect, onProductAddToCart, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
754
768
 
package/dist/index.d.ts CHANGED
@@ -230,6 +230,14 @@ interface AIAutocompleteProps {
230
230
  * yourself when you want a fresh session.
231
231
  */
232
232
  resetOnSubmit?: boolean;
233
+ /**
234
+ * When true, the dropdown ends in a full-width "See all results" button,
235
+ * shown while the field holds typed text. A click submits the query exactly
236
+ * as Enter and the submit button do (`onSubmit` runs, then `resetOnSubmit`
237
+ * applies), so an `onSubmit` that opens your results page takes the shopper
238
+ * there. Style it with the `--aia-see-all-*` custom properties. Default: false.
239
+ */
240
+ seeAllResults?: boolean;
233
241
  }
234
242
  interface UseAIAutocompleteOptions {
235
243
  /** Called on Enter with the final structured query. */
@@ -712,6 +720,12 @@ interface AIAutocompleteDropdownProps {
712
720
  picked: string[];
713
721
  } | null;
714
722
  onMultiSelectCommit?: () => void;
723
+ /**
724
+ * Set to draw the full-width "See all results" button below the products;
725
+ * a click calls it. `<AIAutocomplete seeAllResults>` sets it to its own
726
+ * submit while the field holds typed text. Omitted → no button.
727
+ */
728
+ onSeeAllResults?: () => void;
715
729
  /** The user turned the time wheel; commits nothing. Provided by `dropdownProps` from the hook. */
716
730
  onTimeChange?: (minutes: number) => void;
717
731
  /** The time wheel's Done — answer the pill. Provided by `dropdownProps` from the hook. */
@@ -748,7 +762,7 @@ interface AIAutocompleteDropdownProps {
748
762
 
749
763
  declare const AIAutocomplete: react.ForwardRefExoticComponent<AIAutocompleteProps & react.RefAttributes<AIAutocompleteHandle>>;
750
764
 
751
- 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, dateReferences, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
765
+ 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, dateReferences, onPreviousMonth, onNextMonth, timeView, multiSelectView, onMultiSelectCommit, onSeeAllResults, onTimeChange, onTimeCommit, locationView, isReediting, onLocationQuery, onLocationMove, onLocationCommit, onLocationFocusChange, isFocused, optionsPosition, mode, }: AIAutocompleteDropdownProps): react_jsx_runtime.JSX.Element;
752
766
 
753
767
  declare function useAIAutocomplete({ onSubmit, onResult, onError, optionOverrides, maskCompletedText, apiConfig, additionalContext, language, currency, productId, visitorId, columns, dropdownTrigger, optionsPosition, closeDropdownOnBlur, prependPlaceholder, allOption, showNonTappableOptions, locationSearch, showOptionIcons, showOptionImages, showOptionCounts, showSkipButton, showProducts, productImageFallback, onFocus, onBlur, value: controlledValue, completedParams: controlledParams, onChange: onChangeProp, onParamsChange, products, mapProducts, onProductSelect, onProductAddToCart, source, setCursor, }: UseAIAutocompleteOptions): UseAIAutocompleteReturn;
754
768