@magicx-eng/ai-autocomplete-vanilla 0.74.4 → 0.75.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 +4 -1
- package/REFERENCE.md +6 -0
- package/dist/index.d.mts +6 -0
- package/dist/index.d.ts +6 -0
- package/dist/index.js +2 -2
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +2 -2
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -136,6 +136,8 @@ const ac = new AIAutocomplete(container, {
|
|
|
136
136
|
productsLayout: "row",
|
|
137
137
|
// Missing/blank URL or load error: "image" (default) or the title initial.
|
|
138
138
|
productImageFallback: "image",
|
|
139
|
+
// The vendor line above each card's title; false leaves it off.
|
|
140
|
+
showProductVendor: true,
|
|
139
141
|
// Custom source for the strip. Omit it and the server's items are shown.
|
|
140
142
|
products: {
|
|
141
143
|
fetch: (query, signal) => myPlatform.search(query, { signal }),
|
|
@@ -179,6 +181,7 @@ Product display options apply to both `renderMode: "full"` and
|
|
|
179
181
|
| `productsLayout?` | `"row" \| "list"` | `"row"` | Lay out cards as a scrolling row or a vertical list. |
|
|
180
182
|
| `seeAllResults?` | `boolean` | `false` | Tier 1 only (React's `<AIAutocomplete>` has it too). End the dropdown in a "See all results" button that submits like Enter, shown while there is typed text. The dropdown then keeps its full width at every step. |
|
|
181
183
|
| `productImageFallback?` | `"image" \| "initial"` | `"image"` | Fallback for a missing or blank product image URL, or an image load error. `"image"` shows the placeholder pictogram; `"initial"` shows the title initial. A working image still takes priority. See [Product strip](#product-strip). |
|
|
184
|
+
| `showProductVendor?` | `boolean` | `true` | Whether product cards draw the product's `vendor` as a line above the title. Set to `false` when your product titles already name the brand, so a card does not show it twice. See [Product strip](#product-strip). |
|
|
182
185
|
|
|
183
186
|
### Methods
|
|
184
187
|
|
|
@@ -290,7 +293,7 @@ input.addEventListener("blur", () => ac.setFocused(false));
|
|
|
290
293
|
|
|
291
294
|
Pills always render inside the dropdown in this mode. The library creates the dropdown DOM inside your container — you just provide the element and wire up your input's events.
|
|
292
295
|
|
|
293
|
-
The [product strip](#product-strip) works here too: it renders inside the dropdown the library owns, from the server's items by default, and `products` / `showProducts` / `productImageFallback` / `onProductSelect` behave exactly as in Tier 1.
|
|
296
|
+
The [product strip](#product-strip) works here too: it renders inside the dropdown the library owns, from the server's items by default, and `products` / `showProducts` / `productImageFallback` / `showProductVendor` / `onProductSelect` behave exactly as in Tier 1.
|
|
294
297
|
|
|
295
298
|
> Focus/blur wiring is required when `dropdownTrigger` is `"auto"` (the default) — the dropdown only opens while the input is focused. Without `setFocused()`, the dropdown will never open.
|
|
296
299
|
|
package/REFERENCE.md
CHANGED
|
@@ -56,6 +56,12 @@ default); `--aia-product-list-media-size` (44px) sizes the thumbnail and
|
|
|
56
56
|
is the horizontal strip. `update({ productsLayout })` re-lays the strip out at
|
|
57
57
|
once.
|
|
58
58
|
|
|
59
|
+
**Vendor line.** A product with a `vendor` shows it as a line above the
|
|
60
|
+
title. Set `showProductVendor: false` to leave that line off every card, for a
|
|
61
|
+
catalog whose titles already start with the brand. The card's other lines are
|
|
62
|
+
unchanged, and so is a product without a `vendor`. `update({ showProductVendor })`
|
|
63
|
+
applies to the cards on screen at once, in both rendered tiers.
|
|
64
|
+
|
|
59
65
|
**Product image fallback.** A product's image takes priority when its
|
|
60
66
|
`imageUrl` loads successfully. A missing or blank URL, or an image load error,
|
|
61
67
|
uses `productImageFallback`: `"image"` (the default) shows the existing
|
package/dist/index.d.mts
CHANGED
|
@@ -1537,6 +1537,12 @@ interface CoreOptions {
|
|
|
1537
1537
|
* Style initial tiles with `[data-aia-product-initial]` in CSS.
|
|
1538
1538
|
*/
|
|
1539
1539
|
productImageFallback?: ProductImageFallback;
|
|
1540
|
+
/**
|
|
1541
|
+
* Whether product cards draw the product's `vendor` as a line above the
|
|
1542
|
+
* title. Default: true. Set to false when your product titles already name
|
|
1543
|
+
* the brand, so a card does not show it twice.
|
|
1544
|
+
*/
|
|
1545
|
+
showProductVendor?: boolean;
|
|
1540
1546
|
/**
|
|
1541
1547
|
* Custom source for the product strip. Omit it and the strip shows the items
|
|
1542
1548
|
* the `/suggest` response itself reports (`custom_fields.items`), with no
|
package/dist/index.d.ts
CHANGED
|
@@ -1537,6 +1537,12 @@ interface CoreOptions {
|
|
|
1537
1537
|
* Style initial tiles with `[data-aia-product-initial]` in CSS.
|
|
1538
1538
|
*/
|
|
1539
1539
|
productImageFallback?: ProductImageFallback;
|
|
1540
|
+
/**
|
|
1541
|
+
* Whether product cards draw the product's `vendor` as a line above the
|
|
1542
|
+
* title. Default: true. Set to false when your product titles already name
|
|
1543
|
+
* the brand, so a card does not show it twice.
|
|
1544
|
+
*/
|
|
1545
|
+
showProductVendor?: boolean;
|
|
1540
1546
|
/**
|
|
1541
1547
|
* Custom source for the product strip. Omit it and the strip shows the items
|
|
1542
1548
|
* the `/suggest` response itself reports (`custom_fields.items`), with no
|