@magicx-eng/ai-autocomplete-angular 0.48.2 → 0.50.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
@@ -325,7 +325,7 @@ export class SearchComponent implements OnInit, OnDestroy {
325
325
 
326
326
  > **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.
327
327
 
328
- > **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.
328
+ > **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` (28px), rounded by `--aia-option-image-radius` (8.4px), spaced by `--aia-option-image-gap` (8.4px) 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` (4.2px); 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` (8.4px), `--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.
329
329
 
330
330
  ## Convenience NgModule
331
331
 
@@ -363,9 +363,10 @@ Standalone-first apps don't need this — import the components/directive direct
363
363
  | `animations` | `boolean` | `true` | Enable/disable all SDK animations (press + shimmer, the typed-in starting-state placeholder, the option rows' staggered entrance, and the "more below" arrow's slide). `prefers-reduced-motion` also switches the last three off. |
364
364
  | `dropdownTrigger` | `"auto" \| "manual" \| "hidden"` | `"auto"` | When the dropdown appears. `"auto"` = when options available. `"manual"` = only on pill tap, closes after selection. `"hidden"` = never shows. |
365
365
  | `closeDropdownOnBlur` | `boolean` | `true` | When `true`, the dropdown closes if the input loses focus. Set to `false` to keep it open whenever options are available, regardless of focus. |
366
+ | `prependPlaceholder` | `boolean` | `true` | `false`: hint only. |
366
367
  | `showNonTappableOptions` | `boolean` | `true` | When `true`, non-tappable options are rendered alongside tappable ones in the dropdown. Set to `false` to hide non-tappable options entirely. |
367
368
  | `locationSearch` | `boolean` | `true` | When `true`, a location parameter without options searches places as the user types in its field. Set to `false` to take typed text only. See [Location search](#location-search). |
368
- | `showSkipButton` | `boolean` | `true` | When `true`, the dropdown's pill bar ends in a small "skip" button that dismisses the active pill — same action as pressing <kbd>→</kbd> at the end of the input. It sits top-right when the dropdown opens below the input, bottom-right when `optionsPosition` is `"above"`, and appears once the input has text (alongside the footer's "→ to skip" hint). Set to `false` to hide it. |
369
+ | `showSkipButton` | `boolean` | `true` | When `true`, the dropdown's pill bar ends in a small "skip" button that dismisses the active pill — same action as pressing <kbd>→</kbd> at the end of the input. It follows the parameter label behind a thin rule ("Gender \| skip") once the input has text. Set to `false` to hide it. |
369
370
  | `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. |
370
371
  | `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. |
371
372
  | `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. |
@@ -682,7 +683,7 @@ Every variable, with its default, is listed in [REFERENCE.md](https://unpkg.com/
682
683
 
683
684
  ### Short screens
684
685
 
685
- When the open dropdown would run past the edge of the visible screen — most often a phone with its on-screen keyboard up, or a short browser window — it shrinks to the space that is left and scrolls as one: the options, the product strip and the footer move together, so scrolling down past the last option brings the products into view. The pill bar scrolls with them. Each time the dropdown opens it checks again, and while it is open it follows the keyboard opening and closing and the page scrolling.
686
+ When the open dropdown would run past the edge of the visible screen — most often a phone with its on-screen keyboard up, or a short browser window — it shrinks to the space that is left and scrolls as one: the options and the product strip move together, so scrolling down past the last option brings the products into view. The pill bar scrolls with them. Each time the dropdown opens it checks again, and while it is open it follows the keyboard opening and closing and the page scrolling.
686
687
 
687
688
  While fitted, the dropdown root carries `data-aia-fit`, and the height it is capped at is in its `--aia-dropdown-fit-height` property. Every option shows in that one scroll, so the option list's usual limit of visible rows does not apply.
688
689
 
@@ -704,7 +705,7 @@ For styling beyond the CSS variables, target these stable `data-aia-*` attribute
704
705
  | `[data-aia-pill]` | Each unfilled-suggestion pill |
705
706
  | `[data-aia-pillbar]` | Pill bar container inside the dropdown |
706
707
  | `[data-aia-pill-scroll]` | Scrollable pill region inside the bar — carries the horizontal scroll and right-edge fade mask |
707
- | `[data-aia-skip]` | The pill bar's trailing "skip" button. Tune via `--aia-skip-font-size` / `--aia-skip-color` / `--aia-skip-color-hover` / `--aia-skip-hover-bg` |
708
+ | `[data-aia-skip]` | The pill bar's "skip" button: after the label behind a thin rule, or alone at the end of a skip-only row. Tune via `--aia-skip-font-size` / `--aia-skip-color` / `--aia-skip-color-hover` / `--aia-skip-hover-bg` |
708
709
  | `[data-aia-option]` | Each suggestion option |
709
710
  | `[data-aia-scroll-arrow]` | The "more below" arrow on the dropdown — carries `data-aia-visible` while shown |
710
711
  | `[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)). |
package/REFERENCE.md CHANGED
@@ -47,9 +47,9 @@ Bind `[showProducts]="false"` to render no strip at all. The catalog report
47
47
  `[productsLayout]="'list'"` stacks the same cards as full-width rows (thumbnail
48
48
  on the left, title, vendor and price on the right) for results that read as
49
49
  a list (courses, listings, documents) rather than products on a shelf. The
50
- column scrolls vertically inside `--aia-product-list-max-height` (320px by
51
- default); `--aia-product-list-media-size` (44px) sizes the thumbnail and
52
- `--aia-product-list-gap` (2px) the space between rows. `"row"`, the default,
50
+ column scrolls vertically inside `--aia-product-list-max-height` (224px by
51
+ default); `--aia-product-list-media-size` (30.8px) sizes the thumbnail and
52
+ `--aia-product-list-gap` (1.4px) the space between rows. `"row"`, the default,
53
53
  is the horizontal strip. Changing the binding re-lays the strip out at once, and
54
54
  `<ai-autocomplete-dropdown>` takes the same input in Tier 2.
55
55
 
@@ -278,7 +278,7 @@ and ignores further presses; once it resolves the cart turns into a check
278
278
  through "adding" to "added". A rejection puts the button back at rest — show your own error. A function that returns nothing goes
279
279
  straight to "added". The button is labelled "Add to cart: {title}" in the
280
280
  widget language, reachable by Tab and pressed with Enter or Space. Theme it
281
- with `--aia-product-cart-size` (28px), `--aia-product-cart-bg` and
281
+ with `--aia-product-cart-size` (19.6px), `--aia-product-cart-bg` and
282
282
  `--aia-product-cart-color`; its focus ring uses `--aia-product-focus-ring`.
283
283
  The button is a `[data-aia-product-cart]` element, and a card that has one
284
284
  carries `data-aia-product-has-cart`.
@@ -534,10 +534,11 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
534
534
  | `--aia-pill-bg` | `#bdbdbd` | `#bdbdbd` | Pill background |
535
535
  | `--aia-pill-color` | `#000000` | `#ffffff` | Pill text |
536
536
  | `--aia-pill-font-size` | `19px` | `19px` | Pill font size |
537
+ | `--aia-param-label-font-size` | `9.45px` | `9.45px` | Font size of the options box's header label: the parameter the options answer, the pill marked `[data-aia-pill-active]`. Style that label through `[data-aia-pill][data-aia-pill-active]`. |
537
538
  | `--aia-option-bg` | `transparent` | `transparent` | Highlighted option background |
538
539
  | `--aia-option-color` | `#000000` | `#ffffff` | Option text |
539
540
  | `--aia-option-color-selected` | `#000000` | `#ffffff` | Highlighted option text |
540
- | `--aia-option-font-size` | `19px` | `19px` | Option font size |
541
+ | `--aia-option-font-size` | `11.2px` | `11.2px` | Option font size |
541
542
  | `--aia-written-text-color` | `#000000` | `#ffffff` | Input text |
542
543
  | `--aia-written-text-font-size` | `19px` | `19px` | Input text font size |
543
544
  | `--aia-input-radius` | `10px` | `10px` | Full input corner radius. Set `0` for square corners. |
@@ -550,14 +551,14 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
550
551
  | `--aia-dropdown-bg` | — | — | Optional bg color the dropdown's "glass" rim shadow tints toward. Set this to the page background behind the dropdown so the bottom-corner glow blends seamlessly. |
551
552
  | `--aia-scrollbar-thumb` | `rgba(0, 0, 0, 0.3)` | `rgba(0, 0, 0, 0.3)` | No longer used: the option list hides its scrollbar in every browser. Kept so existing overrides don't break. |
552
553
  | `--aia-streak-rgb` | `99, 102, 241` | `255, 255, 255` | Comma-separated RGB triplet tinting the datepicker's pressed cell, and its selected cell when `--aia-date-selected-bg` is unset. The today ring uses `--aia-date-today-ring`, not this. |
553
- | `--aia-product-card-width` | `116px` | `116px` | Width of a product card in the strip. The media tile is square, so this also sets its height. |
554
- | `--aia-product-gap` | `8px` | `8px` | Gap between product cards. |
554
+ | `--aia-product-card-width` | `81.2px` | `81.2px` | Width of a product card in the strip. The media tile is square, so this also sets its height. |
555
+ | `--aia-product-gap` | `5.6px` | `5.6px` | Gap between product cards. |
555
556
  | `--aia-product-bg` | `transparent` | `transparent` | Product card background. |
556
557
  | `--aia-product-bg-active` | `--aia-option-bg` | `--aia-option-bg` | Product card background on hover. |
557
558
  | `--aia-product-media-bg` | `--aia-skeleton-bg` | `--aia-skeleton-bg` | Placeholder fill of the product tile: shown until the photo loads, and behind both fallback tiles (placeholder pictogram or title initial) used when an image URL is missing, blank or fails to load. Once a photo loads the tile is transparent. |
558
559
  | `--aia-scroll-arrow-color` | `--aia-option-color` | `--aia-option-color` | Chevron color of the arrow (`--aia-scroll-arrow-color-hover` on hover). |
559
560
  | `--aia-placeholder-fade` | `120ms` | `120ms` | Fade-out of the outgoing placeholder phrase when the starting-state placeholder changes (the incoming one types itself in). |
560
- | `--aia-product-image-radius` | `8px` | `8px` | Corner radius of a product photo narrower than its square tile (a tall one), which is scaled to fit rather than cropped. A photo that fills the tile takes the tile's own 8px corners. |
561
+ | `--aia-product-image-radius` | `5.6px` | `5.6px` | Corner radius of a product photo narrower than its square tile (a tall one), which is scaled to fit rather than cropped. A photo that fills the tile takes the tile's own 5.6px corners. |
561
562
  | `--aia-product-placeholder-image` | storefront pictogram | storefront pictogram | The pictogram used by `productImageFallback: "image"` (the default) when an image URL is missing, blank or fails to load. Defaults to a two-tone storefront inlined as a data URI. Set any `url(...)` to swap it; it is centered and contained over `--aia-product-media-bg`. Does not affect `"initial"` tiles. |
562
563
  | `--aia-product-title-color` | `--aia-option-color-selected` | `--aia-option-color-selected` | Product title text. Follows the option colors by default, so theming the panel moves suggestions and products together. |
563
564
  | `--aia-product-price-color` | `--aia-option-color-selected` | `--aia-option-color-selected` | Product price text. |
@@ -566,10 +567,10 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
566
567
  | `--aia-product-vendor-color` | `--aia-option-color` | `--aia-option-color` | Product vendor line. |
567
568
  | `--aia-product-focus-ring` | `--aia-option-color-selected` | `--aia-option-color-selected` | Focus ring drawn on a keyboard-focused card. |
568
569
  | `--aia-products-label-color` | `--aia-option-color` | `--aia-option-color` | "Best match" section label. |
569
- | `--aia-product-title-font-size` | `12px` | `12px` | Product title font size. |
570
- | `--aia-product-price-font-size` | `11px` | `11px` | Product price font size. |
571
- | `--aia-product-vendor-font-size` | `10px` | `10px` | Product vendor font size. |
572
- | `--aia-products-label-font-size` | `11px` | `11px` | Section label font size. |
570
+ | `--aia-product-title-font-size` | `8.4px` | `8.4px` | Product title font size. |
571
+ | `--aia-product-price-font-size` | `7.7px` | `7.7px` | Product price font size. |
572
+ | `--aia-product-vendor-font-size` | `7px` | `7px` | Product vendor font size. |
573
+ | `--aia-products-label-font-size` | `7.7px` | `7.7px` | Section label font size. |
573
574
  | `--aia-date-panel-width` | `312px` | `312px` | Max width of the whole dropdown panel while the calendar is up — the panel narrows to calendar size. |
574
575
  | `--aia-date-cell-size` | `26px` | `26px` | Size of a day's square — the box that carries the highlight, the today ring and the selected fill. |
575
576
  | `--aia-date-row-height` | `28px` | `28px` | Height of one week row. Lower it to fit a 6-week month in a shorter dropdown. |
@@ -583,11 +584,14 @@ The full input also accepts `--aia-input-radius` and `--aia-written-text-font-we
583
584
  | `--aia-time-panel-width` | `240px` | `240px` | Max width of the whole dropdown panel while the time wheel is up. |
584
585
  | `--aia-time-font-size` | `15px` | `15px` | The time wheel's numbers and its `:` separator. |
585
586
  | `--aia-time-band-bg` | white at 8% | white at 8% | The band behind the wheels' top rows — the chosen time. |
586
- | `--aia-confirm-bg` | `#262626` | `#a6a6a6` | The solid fill shared by the Done buttons (multi-select and time wheel) and a checked multi-select checkbox. |
587
- | `--aia-confirm-bg-hover` | `#404040` | `#b8b8b8` | The Done buttons on hover. |
588
- | `--aia-confirm-color` | `#ffffff` | `#000000` | The Done buttons' text and the checkbox's checkmark. |
589
- | `--aia-multi-done-bg` / `--aia-multi-done-bg-hover` / `--aia-multi-done-color` | `--aia-confirm-*` | `--aia-confirm-*` | Override the multi-select Done button alone. |
590
- | `--aia-time-done-bg` / `--aia-time-done-bg-hover` / `--aia-time-done-color` | `--aia-confirm-*` | `--aia-confirm-*` | Override the time wheel's Done button alone. |
587
+ | `--aia-confirm-bg` | `#262626` | `#a6a6a6` | The solid fill of a checked multi-select checkbox (and, in dark mode, of the Done buttons). |
588
+ | `--aia-confirm-bg-hover` | `#404040` | `#b8b8b8` | The Done buttons on hover in dark mode. |
589
+ | `--aia-confirm-color` | `#ffffff` | `#000000` | The checkbox's checkmark (and, in dark mode, the Done buttons' text). |
590
+ | `--aia-done-bg` / `--aia-done-bg-hover` / `--aia-done-color` | `#e4e8f0` / `#d8dde8` / `#2a3150` | `--aia-confirm-*` | The Done buttons (multi-select and time wheel). |
591
+ | `--aia-multi-done-bg` / `--aia-multi-done-bg-hover` / `--aia-multi-done-color` | `--aia-done-*` | `--aia-done-*` | Override the multi-select Done button alone. |
592
+ | `--aia-multi-done-width` | as wide as the widest option | same | Width of the multi-select Done button; set `100%` for full width. |
593
+ | `--aia-multi-done-min-width` | `120px` | `120px` | Narrowest the multi-select Done button gets. |
594
+ | `--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. |
591
595
  | `--aia-location-field-bg` | `--aia-streak-rgb` at 6% (indigo) | `--aia-streak-rgb` at 6% (white) | The location search field. |
592
596
  | `--aia-location-field-radius` | `10px` | `10px` | Corner radius of the location search field. |
593
597
  | `--aia-location-font-size` | `15px` | `15px` | The location field's text and the place names. |