@magicx-eng/ai-autocomplete-react 0.56.0 → 0.57.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 CHANGED
@@ -294,6 +294,7 @@ function App() {
294
294
  | `showOptionIcons?` | `boolean` | `true` | When `true`, an option that carries an `icon_svg` draws its icon before its text in the dropdown. Set to `false` to render option rows as text only. |
295
295
  | `showChipIcons?` | `boolean` | `true` | When `true`, a completed chip in the input draws the icon of the option that answered it. Set to `false` to render chips as text only. |
296
296
  | `showChipImages?` | `boolean` | `true` | When `true`, a completed chip in the input draws the picture (`image_url`) of the option that answered it, in place of its icon. Set to `false` to render chips without pictures. |
297
+ | `showChipRemove?` | `boolean` | `false` | When `true`, every completed chip in the input ends in a small, faint "×" that removes that chip in one tap or click, the same result as Backspace at the chip's trailing edge. Only completed chips get one; values the server merely identified in typed text do not. The × reads `--aia-chip-remove-opacity` (0.32) and `--aia-chip-remove-opacity-hover` (0.7). |
297
298
  | `showOptionImages?` | `boolean` | `true` | When `true`, an option that carries an `image_url` draws it as a square thumbnail before its text in the dropdown, in place of its icon. Set to `false` to render option rows without pictures. |
298
299
  | `showOptionCounts?` | `boolean` | `true` | When `true`, an option that carries an `item_count` shows it as a muted label at the row's trailing edge (`"12 items"`). Set to `false` to hide the counts. |
299
300
  | `autoFocus?` | `boolean` | `true` | Focus the input on mount. Set to `false` to leave focus to the consumer. |
@@ -421,6 +422,7 @@ The headless hook for Tier 2 and Tier 3. Accepts the same options as `<AIAutocom
421
422
  | `setActivePill` | `(index: number) => void` | Move pill at `index` to front (active). |
422
423
  | `skipActivePill` | `() => void` | Skip the active pill — same action as → / the dropdown's skip button. Records it in `skippedParams`; no-ops during re-edit and the post-selection window. Already wired into `dropdownProps.onSkip`; call it directly for a custom skip affordance (e.g. with `showSkipButton: false`). Also exposed on the Tier 1 imperative handle. |
423
424
  | `removeLastParam` | `() => void` | Remove the last completed param from state. The text stays in the input as plain text. |
425
+ | `removeParam` | `(paramId: string) => boolean` | Remove the completed chip with that id, the same result as Backspace at the chip's trailing edge; the chip's × (`showChipRemove`) calls it. Any value's id of one multi-select answer removes its joined chip. Returns `false`, changing nothing, when no completed chip has that id. |
424
426
  | `clearNewParamId` | `() => void` | Clear shimmer animation state. |
425
427
  | `reset` | `() => void` | Clear all state, re-fetch, and start a new session (rotates `session_id`). Call this after handling submit. |
426
428
  | `recordSubmit` | `(result: AutocompleteResult) => void` | Record a submit from a button you render. Enter is recorded for you; call this once per button submit. |
package/REFERENCE.md CHANGED
@@ -587,7 +587,7 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
587
587
  | `--aia-date-today-ring` | `--aia-option-color` | `--aia-option-color` | Outline drawn around today's date. |
588
588
  | `--aia-date-selected-bg` | white at 12% | white at 12% | Fill behind the date a re-edited parameter already holds. |
589
589
  | `--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`. |
590
- | `--aia-date-reference-bg` | white at 7% | white at 7% | Soft fill behind a day another answer already holds (the pickup date while the return date is asked), shown for reference; the day stays pickable. |
590
+ | `--aia-date-reference-bg` | the day's text colour at 14% | the day's text colour at 14% | Fill behind a day another answer already holds (the pickup date while the return date is asked), shown for reference with the number in the selected text colour and a heavier weight; the day stays pickable. |
591
591
  | `--aia-time-panel-width` | `240px` | `240px` | Max width of the whole dropdown panel while the time wheel is up. |
592
592
  | `--aia-time-font-size` | `15px` | `15px` | The time wheel's numbers and its `:` separator. |
593
593
  | `--aia-time-band-bg` | white at 8% | white at 8% | The band behind the wheels' top rows — the chosen time. |
@@ -606,5 +606,7 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
606
606
  | `--aia-location-font-size` | `15px` | `15px` | The location field's text and the place names. |
607
607
  | `--aia-location-row-bg-highlighted` | `--aia-streak-rgb` at 8% (indigo) | `--aia-streak-rgb` at 8% (white) | The highlighted (or hovered) place. |
608
608
  | `--aia-skeleton-bg` | `rgba(189, 189, 189, 0.083)` | `#1a1b1d` | Fill color of the option and chip image tiles while their picture loads (unless `--aia-option-image-bg` / `--aia-chip-image-bg` are set). |
609
+ | `--aia-chip-remove-opacity` | `0.32` | `0.32` | Opacity of a completed chip's remove × (`showChipRemove`). The × is for a mouse or a tap and is hidden from assistive technology; from the keyboard, Backspace at the end of a chip removes it. |
610
+ | `--aia-chip-remove-opacity-hover` | `0.7` | `0.7` | Opacity of that × under a hovering pointer (never on touch). |
609
611
 
610
612
  Legacy `--aia-color-*` variables are still supported as fallbacks.
package/dist/index.d.mts CHANGED
@@ -110,6 +110,8 @@ interface AIAutocompleteProps {
110
110
  showChipIcons?: boolean;
111
111
  /** When true (default), a completed chip in the input draws the picture (`image_url`) of the option that answered it, in place of its icon. Set to false to render chips without pictures. */
112
112
  showChipImages?: boolean;
113
+ /** When true, every completed chip in the input ends in a small, faint "×" that removes the chip in one tap (the same result as Backspace at the chip's trailing edge). Default: false. */
114
+ showChipRemove?: boolean;
113
115
  /** When true (default), an option that carries an `image_url` draws it as a square thumbnail before its text in the dropdown (in place of its `icon_svg`). Set to false to render option rows without pictures. */
114
116
  showOptionImages?: boolean;
115
117
  /** When true (default), an option that carries an `item_count` shows it as a muted label at the row's trailing edge ("12 items"). Set to false to hide the counts. */
@@ -524,6 +526,8 @@ interface UseAIAutocompleteReturn {
524
526
  caretOffset: number | null;
525
527
  /** Tier 1 re-edit: enter re-edit mode for the bold param with the given id. */
526
528
  startEditingParam: (paramId: string) => void;
529
+ /** Remove the completed chip with the given id (the chip's "×", `showChipRemove`); the same result as Backspace at the chip's trailing edge. Returns false when no completed chip has that id. */
530
+ removeParam: (paramId: string) => boolean;
527
531
  /** Tier 1 re-edit: exit re-edit mode. */
528
532
  exitEditMode: () => void;
529
533
  /** Tier 1 re-edit: update caret tracking after a text-input event (extends edit tail). */
package/dist/index.d.ts CHANGED
@@ -110,6 +110,8 @@ interface AIAutocompleteProps {
110
110
  showChipIcons?: boolean;
111
111
  /** When true (default), a completed chip in the input draws the picture (`image_url`) of the option that answered it, in place of its icon. Set to false to render chips without pictures. */
112
112
  showChipImages?: boolean;
113
+ /** When true, every completed chip in the input ends in a small, faint "×" that removes the chip in one tap (the same result as Backspace at the chip's trailing edge). Default: false. */
114
+ showChipRemove?: boolean;
113
115
  /** When true (default), an option that carries an `image_url` draws it as a square thumbnail before its text in the dropdown (in place of its `icon_svg`). Set to false to render option rows without pictures. */
114
116
  showOptionImages?: boolean;
115
117
  /** When true (default), an option that carries an `item_count` shows it as a muted label at the row's trailing edge ("12 items"). Set to false to hide the counts. */
@@ -524,6 +526,8 @@ interface UseAIAutocompleteReturn {
524
526
  caretOffset: number | null;
525
527
  /** Tier 1 re-edit: enter re-edit mode for the bold param with the given id. */
526
528
  startEditingParam: (paramId: string) => void;
529
+ /** Remove the completed chip with the given id (the chip's "×", `showChipRemove`); the same result as Backspace at the chip's trailing edge. Returns false when no completed chip has that id. */
530
+ removeParam: (paramId: string) => boolean;
527
531
  /** Tier 1 re-edit: exit re-edit mode. */
528
532
  exitEditMode: () => void;
529
533
  /** Tier 1 re-edit: update caret tracking after a text-input event (extends edit tail). */