@magicx-eng/ai-autocomplete-angular 0.17.2 → 0.19.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 +96 -21
- package/esm2020/lib/ai-autocomplete/ai-autocomplete.component.mjs +16 -2
- package/esm2020/lib/controller/ai-autocomplete.controller.mjs +3 -1
- package/esm2020/lib/internal/product-strip/product-strip.component.mjs +0 -0
- package/esm2020/lib/shared/types.mjs +1 -1
- package/esm2020/public-api.mjs +6 -2
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs +30 -10
- package/fesm2015/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs +26 -6
- package/fesm2020/magicx-eng-ai-autocomplete-angular.mjs.map +1 -1
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts +14 -5
- package/lib/ai-autocomplete/ai-autocomplete.component.d.ts.map +1 -1
- package/lib/controller/ai-autocomplete.controller.d.ts +11 -4
- package/lib/controller/ai-autocomplete.controller.d.ts.map +1 -1
- package/lib/shared/types.d.ts +25 -8
- package/lib/shared/types.d.ts.map +1 -1
- package/package.json +2 -2
- package/public-api.d.ts +5 -2
- package/public-api.d.ts.map +1 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { WEEKDAY_LABELS as WEEKDAY_LABELS$1, cellIso as cellIso$1, monthLabel as monthLabel$1, cellDay as cellDay$1, isoDate as isoDate$1, dateCellMarks as dateCellMarks$1, visibleDateRange as visibleDateRange$1, optionsGridTemplateColumns, optionLabel as optionLabel$1, sanitizeOptionIconSvg as sanitizeOptionIconSvg$1, planOptionsGrid, isOptionsGridMobileViewport, needsOptionsGridMeasurement, measureOptionsGrid, optionEnterDelayMs, SCROLL_ARROW_LABEL, buildAttributionUrl, attachScrollArrow, isCalendarFormat, getFooterHint, AIAutocomplete, dateSelectionFor, identifiedParamLabel, renderEditableContent, getCursorOffset, extractPlainText, plainTextLength, setCursorOffset, ModeController, buildSubmitResult as buildSubmitResult$1, withSkippedParams as withSkippedParams$1, formatDate as formatDate$1, parseDate as parseDate$1, parseLooseDate as parseLooseDate$1, DATE_RANGE_META_END as DATE_RANGE_META_END$1, DATE_RANGE_META_START as DATE_RANGE_META_START$1, formatDateRange as formatDateRange$1, parseLooseDateRange as parseLooseDateRange$1, selectedRangeFor as selectedRangeFor$1 } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
1
|
+
import { WEEKDAY_LABELS as WEEKDAY_LABELS$1, cellIso as cellIso$1, monthLabel as monthLabel$1, cellDay as cellDay$1, isoDate as isoDate$1, dateCellMarks as dateCellMarks$1, visibleDateRange as visibleDateRange$1, optionsGridTemplateColumns, optionLabel as optionLabel$1, sanitizeOptionIconSvg as sanitizeOptionIconSvg$1, planOptionsGrid, isOptionsGridMobileViewport, needsOptionsGridMeasurement, measureOptionsGrid, optionEnterDelayMs, SCROLL_ARROW_LABEL, buildAttributionUrl, attachScrollArrow, isCalendarFormat, getFooterHint, AIAutocomplete, dateSelectionFor, identifiedParamLabel, renderEditableContent, getCursorOffset, extractPlainText, plainTextLength, setCursorOffset, ModeController, buildSubmitResult as buildSubmitResult$1, withSkippedParams as withSkippedParams$1, formatDate as formatDate$1, parseDate as parseDate$1, parseLooseDate as parseLooseDate$1, DATE_RANGE_META_END as DATE_RANGE_META_END$1, DATE_RANGE_META_START as DATE_RANGE_META_START$1, formatDateRange as formatDateRange$1, parseLooseDateRange as parseLooseDateRange$1, selectedRangeFor as selectedRangeFor$1, PRODUCT_PATH_PREFIX as PRODUCT_PATH_PREFIX$1, productFromMatchedItem as productFromMatchedItem$1, productsFromCustomFields as productsFromCustomFields$1 } from '@magicx-eng/ai-autocomplete-vanilla';
|
|
2
2
|
import * as i1 from '@angular/common';
|
|
3
3
|
import { CommonModule, isPlatformBrowser } from '@angular/common';
|
|
4
4
|
import * as i0 from '@angular/core';
|
|
@@ -324,7 +324,7 @@ class ProductStripComponent {
|
|
|
324
324
|
this.trackByProduct = (_, product) => [
|
|
325
325
|
product.id,
|
|
326
326
|
product.title,
|
|
327
|
-
product.url,
|
|
327
|
+
product.url ?? "",
|
|
328
328
|
product.imageUrl ?? "",
|
|
329
329
|
product.price ?? "",
|
|
330
330
|
product.vendor ?? "",
|
|
@@ -363,10 +363,10 @@ class ProductStripComponent {
|
|
|
363
363
|
}
|
|
364
364
|
}
|
|
365
365
|
ProductStripComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ProductStripComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
366
|
-
ProductStripComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ProductStripComponent, isStandalone: true, selector: "aia-product-strip", inputs: { products: "products", listboxId: "listboxId", focusable: "focusable" }, outputs: { select: "select", focusChange: "focusChange" }, ngImport: i0, template: "<!-- `group` is the one role a listbox accepts around a set of options, so the\n strip stays inside the listbox without breaking its content model. -->\n<section\n *ngIf=\"products.length > 0\"\n class=\"aia-products\"\n data-aia-products=\"\"\n role=\"group\"\n [attr.aria-labelledby]=\"labelId\"\n>\n <div class=\"aia-products-label\" [id]=\"labelId\">Products</div>\n\n <div class=\"aia-products-row\" data-aia-products-row=\"\">\n <!-- A real <a href> rather than a <div>: it keeps the browser's own link\n affordances \u2014 cmd/ctrl-click for a new tab, middle-click, right-click \u2192\n \"copy link address\". role=\"option\" overrides how assistive tech\n announces it, which is correct inside a listbox; the deliberate trade\n is that AT no longer calls it a link. -->\n <a\n *ngFor=\"let product of products; let i = index; trackBy: trackByProduct\"\n [id]=\"cardId(i)\"\n class=\"aia-product\"\n data-aia-product=\"\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n [href]=\"product.url\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (click)=\"onClick($event, product)\"\n (keydown)=\"onKeyDown($event, product)\"\n (focus)=\"onCardFocus()\"\n (blur)=\"onCardBlur($event)\"\n >\n <!-- Catalogues without images are common enough that the placeholder is\n a first-class state, not an error state. -->\n <span\n class=\"aia-product-media\"\n [attr.data-aia-product-placeholder]=\"product.imageUrl ? null : ''\"\n >\n <!-- alt=\"\" on purpose: the title is already the card's accessible\n name, and repeating it would have a screen reader read it twice. -->\n <img\n *ngIf=\"product.imageUrl\"\n class=\"aia-product-image\"\n [src]=\"product.imageUrl\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </span>\n\n <!-- Every field but the title is optional, so absent ones render no\n element at all \u2014 the column gap can't leave a hole for a box that\n isn't there. -->\n <span class=\"aia-product-body\">\n <span *ngIf=\"product.vendor\" class=\"aia-product-vendor\">{{ product.vendor }}</span>\n <span class=\"aia-product-title\">{{ product.title }}</span>\n <span *ngIf=\"product.price\" class=\"aia-product-price\">{{ product.price }}</span>\n </span>\n </a>\n </div>\n</section>\n", styles: [".aia-products{display:flex;flex-direction:column;gap:6px;padding:0 8px;min-width:0}.aia-products-label{font-family:inherit;font-size:var(--aia-products-label-font-size, 11px);font-weight:500;line-height:18px;letter-spacing:.02em;color:var( --aia-products-label-color, var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb)) )}.aia-products-row{display:flex;gap:var(--aia-product-gap, 8px);min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;padding-bottom:2px;scrollbar-width:none;-ms-overflow-style:none}.aia-products-row::-webkit-scrollbar{display:none}.aia-product{flex:0 0 auto;display:flex;flex-direction:column;gap:6px;width:var(--aia-product-card-width, 116px);padding:6px;border-radius:10px;background:var(--aia-product-bg, transparent);color:var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));text-decoration:none;cursor:pointer;transition:background-color .15s ease}.aia-product:hover{background:var(--aia-product-bg-active, var(--aia-option-bg, transparent))}.aia-product:focus-visible{outline:2px solid var(--aia-product-focus-ring, var(--aia-option-color-selected, currentColor));outline-offset:-2px}.aia-product-media{display:block;position:relative;width:100%;aspect-ratio:1 / 1;border-radius:8px;overflow:hidden;background:var(--aia-product-media-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, .25)))}.aia-product-image{display:block;width:100%;height:100%;object-fit:cover}.aia-product-media[data-aia-product-placeholder]:after{content:\"\";position:absolute;inset:30%;border-radius:3px;border:1.5px solid var(--aia-product-placeholder-color, var(--aia-option-color, #c1c4cb));opacity:.35}.aia-product-body{display:flex;flex-direction:column;gap:2px;min-width:0}.aia-product-vendor{font-family:inherit;font-size:var(--aia-product-vendor-font-size, 10px);line-height:14px;color:var( --aia-product-vendor-color, var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb)) );opacity:.8;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.aia-product-title{font-family:inherit;font-size:var(--aia-product-title-font-size, 12px);font-weight:400;line-height:16px;color:var( --aia-product-title-color, var(--aia-option-color-selected, var(--aia-color-text-default, #fff)) );display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.aia-product-price{font-family:inherit;font-size:var(--aia-product-price-font-size, 11px);font-weight:500;line-height:15px;color:var( --aia-product-price-color, var(--aia-option-color-selected, var(--aia-color-text-default, #fff)) )}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
366
|
+
ProductStripComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: ProductStripComponent, isStandalone: true, selector: "aia-product-strip", inputs: { products: "products", listboxId: "listboxId", focusable: "focusable" }, outputs: { select: "select", focusChange: "focusChange" }, ngImport: i0, template: "<!-- `group` is the one role a listbox accepts around a set of options, so the\n strip stays inside the listbox without breaking its content model. -->\n<section\n *ngIf=\"products.length > 0\"\n class=\"aia-products\"\n data-aia-products=\"\"\n role=\"group\"\n [attr.aria-labelledby]=\"labelId\"\n>\n <div class=\"aia-products-label\" [id]=\"labelId\">Products</div>\n\n <div class=\"aia-products-row\" data-aia-products-row=\"\">\n <!-- A real <a href> rather than a <div>: it keeps the browser's own link\n affordances \u2014 cmd/ctrl-click for a new tab, middle-click, right-click \u2192\n \"copy link address\". role=\"option\" overrides how assistive tech\n announces it, which is correct inside a listbox; the deliberate trade\n is that AT no longer calls it a link. An attribute binding, so a\n product without a url gets no href at all rather than \"null\". -->\n <a\n *ngFor=\"let product of products; let i = index; trackBy: trackByProduct\"\n [id]=\"cardId(i)\"\n class=\"aia-product\"\n data-aia-product=\"\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n [attr.href]=\"product.url ?? null\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (click)=\"onClick($event, product)\"\n (keydown)=\"onKeyDown($event, product)\"\n (focus)=\"onCardFocus()\"\n (blur)=\"onCardBlur($event)\"\n >\n <!-- Catalogues without images are common enough that the placeholder is\n a first-class state, not an error state. -->\n <span\n class=\"aia-product-media\"\n [attr.data-aia-product-placeholder]=\"product.imageUrl ? null : ''\"\n >\n <!-- alt=\"\" on purpose: the title is already the card's accessible\n name, and repeating it would have a screen reader read it twice. -->\n <img\n *ngIf=\"product.imageUrl\"\n class=\"aia-product-image\"\n [src]=\"product.imageUrl\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </span>\n\n <!-- Every field but the title is optional, so absent ones render no\n element at all \u2014 the column gap can't leave a hole for a box that\n isn't there. -->\n <span class=\"aia-product-body\">\n <span *ngIf=\"product.vendor\" class=\"aia-product-vendor\">{{ product.vendor }}</span>\n <span class=\"aia-product-title\">{{ product.title }}</span>\n <span *ngIf=\"product.price\" class=\"aia-product-price\">{{ product.price }}</span>\n </span>\n </a>\n </div>\n</section>\n", styles: [".aia-products{display:flex;flex-direction:column;gap:6px;padding:0 8px;min-width:0}.aia-products-label{font-family:inherit;font-size:var(--aia-products-label-font-size, 11px);font-weight:500;line-height:18px;letter-spacing:.02em;color:var( --aia-products-label-color, var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb)) )}.aia-products-row{display:flex;gap:var(--aia-product-gap, 8px);min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;padding-bottom:2px;scrollbar-width:none;-ms-overflow-style:none}.aia-products-row::-webkit-scrollbar{display:none}.aia-product{flex:0 0 auto;display:flex;flex-direction:column;gap:6px;width:var(--aia-product-card-width, 116px);padding:6px;border-radius:10px;background:var(--aia-product-bg, transparent);color:var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));text-decoration:none;cursor:pointer;transition:background-color .15s ease}.aia-product:hover{background:var(--aia-product-bg-active, var(--aia-option-bg, transparent))}.aia-product:focus-visible{outline:2px solid var(--aia-product-focus-ring, var(--aia-option-color-selected, currentColor));outline-offset:-2px}.aia-product-media{display:block;position:relative;width:100%;aspect-ratio:1 / 1;border-radius:8px;overflow:hidden;background:var(--aia-product-media-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, .25)))}.aia-product-image{display:block;width:100%;height:100%;object-fit:cover}.aia-product-media[data-aia-product-placeholder]:after{content:\"\";position:absolute;inset:22%;background:var( --aia-product-placeholder-image, url(\"data:image/svg+xml,%3Csvg viewBox='0 -0.5 32 32' fill-rule='evenodd' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='matrix(1,0,0,1,-384,-144)'%3E%3Cg transform='matrix(0.875,0,0,0.875,90.25,19.125)'%3E%3Cpath d='M340.924,147.74C341.224,146.789 342.107,146.143 343.104,146.143C347.705,146.143 360.491,146.143 364.985,146.143C365.965,146.143 366.836,146.768 367.15,147.697C368.119,150.386 370,155.73 370,157C370,159.208 368.208,161 366,161C363.792,161 362,159.208 362,157C362,159.208 360.208,161 358,161C355.792,161 354,159.208 354,157C354,159.208 352.208,161 350,161C347.792,161 346,159.208 346,157C346,159.208 344.208,161 342,161C340.53,161 339.244,160.205 338.549,159.022C338.057,158.185 337.944,157.179 338.236,156.254C338.787,154.507 340.172,150.121 340.924,147.74Z' fill='%2390e0ef'%3E%3C/path%3E%3C/g%3E%3Cg transform='matrix(1,0,0,1.32454,48,-56.1457)'%3E%3Cpath d='M341.026,160.675C341.026,160.675 341.01,168.196 341.003,171.488C341.002,171.889 341.213,172.273 341.588,172.557C341.963,172.841 342.472,173 343.003,173C347.188,173 356.817,173 361,173C361.53,173 362.039,172.841 362.414,172.558C362.789,172.275 363,171.891 363,171.49C363,168.2 363,160.675 363,160.675' fill='%2390e0ef'%3E%3C/path%3E%3C/g%3E%3Cg transform='matrix(1,0,0,1,48,0)'%3E%3Cpath d='M355,168C355,166.895 354.105,166 353,166C352.356,166 351.644,166 351,166C349.895,166 349,166.895 349,168C349,170.069 349,173 349,173L355,173L355,168Z' fill='%2390e0ef'%3E%3C/path%3E%3C/g%3E%3Cg transform='matrix(1.11111,0,0,1.11111,-47.2678,-87.5361)'%3E%3Ccircle cx='411.5' cy='213.5' r='4.5' fill='%2390e0ef'%3E%3C/circle%3E%3C/g%3E%3Cpath d='M405.529,146C406.628,144.773 408.225,144 410,144C413.311,144 416,146.689 416,150C416,151.549 415.412,152.962 414.446,154.027C414.775,155.15 415,156.076 415,156.5C415,158.459 413.746,160.127 411.998,160.744L411.998,171C411.998,171.796 411.682,172.559 411.119,173.121C410.557,173.684 409.794,174 408.998,174L391.002,174C390.205,174 389.441,173.683 388.879,173.119C388.316,172.555 388,171.79 388.002,170.994L388.024,160.752C387.007,160.399 386.155,159.691 385.618,158.776L385.618,158.776C385.044,157.799 384.912,156.626 385.253,155.546L387.605,148.097C387.999,146.849 389.157,146 390.466,146L405.529,146ZM409.998,160.972C408.79,160.838 407.726,160.225 407,159.327C406.175,160.347 404.913,161 403.5,161C402.087,161 400.825,160.347 400,159.327C399.175,160.347 397.913,161 396.5,161C395.087,161 393.825,160.347 393,159.327C392.278,160.219 391.222,160.831 390.023,160.97L390.002,170.998C390.002,171.263 390.107,171.518 390.294,171.706C390.482,171.894 390.736,172 391.002,172L396,172L396,168C396,166.343 397.343,165 399,165L401,165C402.657,165 404,166.343 404,168L404,172L408.998,172C409.263,172 409.517,171.895 409.705,171.707C409.893,171.52 409.998,171.265 409.998,171L409.998,160.972ZM402,172L398,172L398,168C398,167.448 398.448,167 399,167C399,167 401,167 401,167C401.552,167 402,167.448 402,168L402,172ZM404.342,148L390.466,148C390.03,148 389.644,148.283 389.512,148.699L387.16,156.148C386.99,156.688 387.056,157.275 387.342,157.763C387.777,158.503 388.581,159 389.5,159C390.88,159 392,157.88 392,156.5C392,155.003 394,155.003 394,156.5C394,157.88 395.12,159 396.5,159C397.88,159 399,157.88 399,156.5C399,155.004 401,155.004 401,156.5C401,157.88 402.12,159 403.5,159C404.88,159 406,157.88 406,156.5C406,154.986 408,154.986 408,156.5C408,157.88 409.12,159 410.5,159C411.88,159 413,157.88 413,156.5C413,156.259 412.917,155.843 412.779,155.318C411.948,155.753 411.003,156 410,156C406.689,156 404,153.311 404,150C404,149.299 404.12,148.626 404.342,148ZM410,146C412.208,146 414,147.792 414,150C414,152.208 412.208,154 410,154C407.792,154 406,152.208 406,150C406,147.792 407.792,146 410,146ZM407.543,151.207L408.546,152.21C408.733,152.397 408.988,152.503 409.253,152.503C409.519,152.503 409.773,152.397 409.961,152.209L412.458,149.706C412.848,149.316 412.847,148.682 412.456,148.292C412.066,147.902 411.432,147.903 411.042,148.294L409.252,150.088C409.252,150.088 408.957,149.793 408.957,149.793C408.567,149.403 407.933,149.403 407.543,149.793C407.153,150.183 407.153,150.817 407.543,151.207Z' fill='%231990a7'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\") ) center / contain no-repeat}.aia-product-body{display:flex;flex-direction:column;gap:2px;min-width:0}.aia-product-vendor{font-family:inherit;font-size:var(--aia-product-vendor-font-size, 10px);line-height:14px;color:var( --aia-product-vendor-color, var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb)) );opacity:.8;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.aia-product-title{font-family:inherit;font-size:var(--aia-product-title-font-size, 12px);font-weight:400;line-height:16px;color:var( --aia-product-title-color, var(--aia-option-color-selected, var(--aia-color-text-default, #fff)) );display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.aia-product-price{font-family:inherit;font-size:var(--aia-product-price-font-size, 11px);font-weight:500;line-height:15px;color:var( --aia-product-price-color, var(--aia-option-color-selected, var(--aia-color-text-default, #fff)) )}\n"], dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush, encapsulation: i0.ViewEncapsulation.None });
|
|
367
367
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: ProductStripComponent, decorators: [{
|
|
368
368
|
type: Component,
|
|
369
|
-
args: [{ selector: "aia-product-strip", standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<!-- `group` is the one role a listbox accepts around a set of options, so the\n strip stays inside the listbox without breaking its content model. -->\n<section\n *ngIf=\"products.length > 0\"\n class=\"aia-products\"\n data-aia-products=\"\"\n role=\"group\"\n [attr.aria-labelledby]=\"labelId\"\n>\n <div class=\"aia-products-label\" [id]=\"labelId\">Products</div>\n\n <div class=\"aia-products-row\" data-aia-products-row=\"\">\n <!-- A real <a href> rather than a <div>: it keeps the browser's own link\n affordances \u2014 cmd/ctrl-click for a new tab, middle-click, right-click \u2192\n \"copy link address\". role=\"option\" overrides how assistive tech\n announces it, which is correct inside a listbox; the deliberate trade\n is that AT no longer calls it a link. -->\n <a\n *ngFor=\"let product of products; let i = index; trackBy: trackByProduct\"\n [id]=\"cardId(i)\"\n class=\"aia-product\"\n data-aia-product=\"\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n [href]=\"product.url\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (click)=\"onClick($event, product)\"\n (keydown)=\"onKeyDown($event, product)\"\n (focus)=\"onCardFocus()\"\n (blur)=\"onCardBlur($event)\"\n >\n <!-- Catalogues without images are common enough that the placeholder is\n a first-class state, not an error state. -->\n <span\n class=\"aia-product-media\"\n [attr.data-aia-product-placeholder]=\"product.imageUrl ? null : ''\"\n >\n <!-- alt=\"\" on purpose: the title is already the card's accessible\n name, and repeating it would have a screen reader read it twice. -->\n <img\n *ngIf=\"product.imageUrl\"\n class=\"aia-product-image\"\n [src]=\"product.imageUrl\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </span>\n\n <!-- Every field but the title is optional, so absent ones render no\n element at all \u2014 the column gap can't leave a hole for a box that\n isn't there. -->\n <span class=\"aia-product-body\">\n <span *ngIf=\"product.vendor\" class=\"aia-product-vendor\">{{ product.vendor }}</span>\n <span class=\"aia-product-title\">{{ product.title }}</span>\n <span *ngIf=\"product.price\" class=\"aia-product-price\">{{ product.price }}</span>\n </span>\n </a>\n </div>\n</section>\n", styles: [".aia-products{display:flex;flex-direction:column;gap:6px;padding:0 8px;min-width:0}.aia-products-label{font-family:inherit;font-size:var(--aia-products-label-font-size, 11px);font-weight:500;line-height:18px;letter-spacing:.02em;color:var( --aia-products-label-color, var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb)) )}.aia-products-row{display:flex;gap:var(--aia-product-gap, 8px);min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;padding-bottom:2px;scrollbar-width:none;-ms-overflow-style:none}.aia-products-row::-webkit-scrollbar{display:none}.aia-product{flex:0 0 auto;display:flex;flex-direction:column;gap:6px;width:var(--aia-product-card-width, 116px);padding:6px;border-radius:10px;background:var(--aia-product-bg, transparent);color:var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));text-decoration:none;cursor:pointer;transition:background-color .15s ease}.aia-product:hover{background:var(--aia-product-bg-active, var(--aia-option-bg, transparent))}.aia-product:focus-visible{outline:2px solid var(--aia-product-focus-ring, var(--aia-option-color-selected, currentColor));outline-offset:-2px}.aia-product-media{display:block;position:relative;width:100%;aspect-ratio:1 / 1;border-radius:8px;overflow:hidden;background:var(--aia-product-media-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, .25)))}.aia-product-image{display:block;width:100%;height:100%;object-fit:cover}.aia-product-media[data-aia-product-placeholder]:after{content:\"\";position:absolute;inset:
|
|
369
|
+
args: [{ selector: "aia-product-strip", standalone: true, imports: [CommonModule], changeDetection: ChangeDetectionStrategy.OnPush, encapsulation: ViewEncapsulation.None, template: "<!-- `group` is the one role a listbox accepts around a set of options, so the\n strip stays inside the listbox without breaking its content model. -->\n<section\n *ngIf=\"products.length > 0\"\n class=\"aia-products\"\n data-aia-products=\"\"\n role=\"group\"\n [attr.aria-labelledby]=\"labelId\"\n>\n <div class=\"aia-products-label\" [id]=\"labelId\">Products</div>\n\n <div class=\"aia-products-row\" data-aia-products-row=\"\">\n <!-- A real <a href> rather than a <div>: it keeps the browser's own link\n affordances \u2014 cmd/ctrl-click for a new tab, middle-click, right-click \u2192\n \"copy link address\". role=\"option\" overrides how assistive tech\n announces it, which is correct inside a listbox; the deliberate trade\n is that AT no longer calls it a link. An attribute binding, so a\n product without a url gets no href at all rather than \"null\". -->\n <a\n *ngFor=\"let product of products; let i = index; trackBy: trackByProduct\"\n [id]=\"cardId(i)\"\n class=\"aia-product\"\n data-aia-product=\"\"\n role=\"option\"\n [attr.aria-selected]=\"false\"\n [attr.href]=\"product.url ?? null\"\n [attr.tabindex]=\"focusable ? 0 : -1\"\n (click)=\"onClick($event, product)\"\n (keydown)=\"onKeyDown($event, product)\"\n (focus)=\"onCardFocus()\"\n (blur)=\"onCardBlur($event)\"\n >\n <!-- Catalogues without images are common enough that the placeholder is\n a first-class state, not an error state. -->\n <span\n class=\"aia-product-media\"\n [attr.data-aia-product-placeholder]=\"product.imageUrl ? null : ''\"\n >\n <!-- alt=\"\" on purpose: the title is already the card's accessible\n name, and repeating it would have a screen reader read it twice. -->\n <img\n *ngIf=\"product.imageUrl\"\n class=\"aia-product-image\"\n [src]=\"product.imageUrl\"\n alt=\"\"\n loading=\"lazy\"\n decoding=\"async\"\n />\n </span>\n\n <!-- Every field but the title is optional, so absent ones render no\n element at all \u2014 the column gap can't leave a hole for a box that\n isn't there. -->\n <span class=\"aia-product-body\">\n <span *ngIf=\"product.vendor\" class=\"aia-product-vendor\">{{ product.vendor }}</span>\n <span class=\"aia-product-title\">{{ product.title }}</span>\n <span *ngIf=\"product.price\" class=\"aia-product-price\">{{ product.price }}</span>\n </span>\n </a>\n </div>\n</section>\n", styles: [".aia-products{display:flex;flex-direction:column;gap:6px;padding:0 8px;min-width:0}.aia-products-label{font-family:inherit;font-size:var(--aia-products-label-font-size, 11px);font-weight:500;line-height:18px;letter-spacing:.02em;color:var( --aia-products-label-color, var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb)) )}.aia-products-row{display:flex;gap:var(--aia-product-gap, 8px);min-width:0;overflow-x:auto;overflow-y:hidden;overscroll-behavior-x:contain;padding-bottom:2px;scrollbar-width:none;-ms-overflow-style:none}.aia-products-row::-webkit-scrollbar{display:none}.aia-product{flex:0 0 auto;display:flex;flex-direction:column;gap:6px;width:var(--aia-product-card-width, 116px);padding:6px;border-radius:10px;background:var(--aia-product-bg, transparent);color:var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb));text-decoration:none;cursor:pointer;transition:background-color .15s ease}.aia-product:hover{background:var(--aia-product-bg-active, var(--aia-option-bg, transparent))}.aia-product:focus-visible{outline:2px solid var(--aia-product-focus-ring, var(--aia-option-color-selected, currentColor));outline-offset:-2px}.aia-product-media{display:block;position:relative;width:100%;aspect-ratio:1 / 1;border-radius:8px;overflow:hidden;background:var(--aia-product-media-bg, var(--aia-skeleton-bg, rgba(189, 189, 189, .25)))}.aia-product-image{display:block;width:100%;height:100%;object-fit:cover}.aia-product-media[data-aia-product-placeholder]:after{content:\"\";position:absolute;inset:22%;background:var( --aia-product-placeholder-image, url(\"data:image/svg+xml,%3Csvg viewBox='0 -0.5 32 32' fill-rule='evenodd' xmlns='http://www.w3.org/2000/svg'%3E%3Cg transform='matrix(1,0,0,1,-384,-144)'%3E%3Cg transform='matrix(0.875,0,0,0.875,90.25,19.125)'%3E%3Cpath d='M340.924,147.74C341.224,146.789 342.107,146.143 343.104,146.143C347.705,146.143 360.491,146.143 364.985,146.143C365.965,146.143 366.836,146.768 367.15,147.697C368.119,150.386 370,155.73 370,157C370,159.208 368.208,161 366,161C363.792,161 362,159.208 362,157C362,159.208 360.208,161 358,161C355.792,161 354,159.208 354,157C354,159.208 352.208,161 350,161C347.792,161 346,159.208 346,157C346,159.208 344.208,161 342,161C340.53,161 339.244,160.205 338.549,159.022C338.057,158.185 337.944,157.179 338.236,156.254C338.787,154.507 340.172,150.121 340.924,147.74Z' fill='%2390e0ef'%3E%3C/path%3E%3C/g%3E%3Cg transform='matrix(1,0,0,1.32454,48,-56.1457)'%3E%3Cpath d='M341.026,160.675C341.026,160.675 341.01,168.196 341.003,171.488C341.002,171.889 341.213,172.273 341.588,172.557C341.963,172.841 342.472,173 343.003,173C347.188,173 356.817,173 361,173C361.53,173 362.039,172.841 362.414,172.558C362.789,172.275 363,171.891 363,171.49C363,168.2 363,160.675 363,160.675' fill='%2390e0ef'%3E%3C/path%3E%3C/g%3E%3Cg transform='matrix(1,0,0,1,48,0)'%3E%3Cpath d='M355,168C355,166.895 354.105,166 353,166C352.356,166 351.644,166 351,166C349.895,166 349,166.895 349,168C349,170.069 349,173 349,173L355,173L355,168Z' fill='%2390e0ef'%3E%3C/path%3E%3C/g%3E%3Cg transform='matrix(1.11111,0,0,1.11111,-47.2678,-87.5361)'%3E%3Ccircle cx='411.5' cy='213.5' r='4.5' fill='%2390e0ef'%3E%3C/circle%3E%3C/g%3E%3Cpath d='M405.529,146C406.628,144.773 408.225,144 410,144C413.311,144 416,146.689 416,150C416,151.549 415.412,152.962 414.446,154.027C414.775,155.15 415,156.076 415,156.5C415,158.459 413.746,160.127 411.998,160.744L411.998,171C411.998,171.796 411.682,172.559 411.119,173.121C410.557,173.684 409.794,174 408.998,174L391.002,174C390.205,174 389.441,173.683 388.879,173.119C388.316,172.555 388,171.79 388.002,170.994L388.024,160.752C387.007,160.399 386.155,159.691 385.618,158.776L385.618,158.776C385.044,157.799 384.912,156.626 385.253,155.546L387.605,148.097C387.999,146.849 389.157,146 390.466,146L405.529,146ZM409.998,160.972C408.79,160.838 407.726,160.225 407,159.327C406.175,160.347 404.913,161 403.5,161C402.087,161 400.825,160.347 400,159.327C399.175,160.347 397.913,161 396.5,161C395.087,161 393.825,160.347 393,159.327C392.278,160.219 391.222,160.831 390.023,160.97L390.002,170.998C390.002,171.263 390.107,171.518 390.294,171.706C390.482,171.894 390.736,172 391.002,172L396,172L396,168C396,166.343 397.343,165 399,165L401,165C402.657,165 404,166.343 404,168L404,172L408.998,172C409.263,172 409.517,171.895 409.705,171.707C409.893,171.52 409.998,171.265 409.998,171L409.998,160.972ZM402,172L398,172L398,168C398,167.448 398.448,167 399,167C399,167 401,167 401,167C401.552,167 402,167.448 402,168L402,172ZM404.342,148L390.466,148C390.03,148 389.644,148.283 389.512,148.699L387.16,156.148C386.99,156.688 387.056,157.275 387.342,157.763C387.777,158.503 388.581,159 389.5,159C390.88,159 392,157.88 392,156.5C392,155.003 394,155.003 394,156.5C394,157.88 395.12,159 396.5,159C397.88,159 399,157.88 399,156.5C399,155.004 401,155.004 401,156.5C401,157.88 402.12,159 403.5,159C404.88,159 406,157.88 406,156.5C406,154.986 408,154.986 408,156.5C408,157.88 409.12,159 410.5,159C411.88,159 413,157.88 413,156.5C413,156.259 412.917,155.843 412.779,155.318C411.948,155.753 411.003,156 410,156C406.689,156 404,153.311 404,150C404,149.299 404.12,148.626 404.342,148ZM410,146C412.208,146 414,147.792 414,150C414,152.208 412.208,154 410,154C407.792,154 406,152.208 406,150C406,147.792 407.792,146 410,146ZM407.543,151.207L408.546,152.21C408.733,152.397 408.988,152.503 409.253,152.503C409.519,152.503 409.773,152.397 409.961,152.209L412.458,149.706C412.848,149.316 412.847,148.682 412.456,148.292C412.066,147.902 411.432,147.903 411.042,148.294L409.252,150.088C409.252,150.088 408.957,149.793 408.957,149.793C408.567,149.403 407.933,149.403 407.543,149.793C407.153,150.183 407.153,150.817 407.543,151.207Z' fill='%231990a7'%3E%3C/path%3E%3C/g%3E%3C/svg%3E\") ) center / contain no-repeat}.aia-product-body{display:flex;flex-direction:column;gap:2px;min-width:0}.aia-product-vendor{font-family:inherit;font-size:var(--aia-product-vendor-font-size, 10px);line-height:14px;color:var( --aia-product-vendor-color, var(--aia-option-color, var(--aia-color-text-muted, #c1c4cb)) );opacity:.8;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}.aia-product-title{font-family:inherit;font-size:var(--aia-product-title-font-size, 12px);font-weight:400;line-height:16px;color:var( --aia-product-title-color, var(--aia-option-color-selected, var(--aia-color-text-default, #fff)) );display:-webkit-box;-webkit-line-clamp:2;line-clamp:2;-webkit-box-orient:vertical;overflow:hidden}.aia-product-price{font-family:inherit;font-size:var(--aia-product-price-font-size, 11px);font-weight:500;line-height:15px;color:var( --aia-product-price-color, var(--aia-option-color-selected, var(--aia-color-text-default, #fff)) )}\n"] }]
|
|
370
370
|
}], propDecorators: { products: [{
|
|
371
371
|
type: Input
|
|
372
372
|
}], listboxId: [{
|
|
@@ -1121,6 +1121,7 @@ class AIAutocompleteController {
|
|
|
1121
1121
|
this.newParamId$ = deriveField(this.rawState$, (s) => s.newParamId);
|
|
1122
1122
|
this.suggestions$ = deriveField(this.rawState$, (s) => s.suggestions, arrEq);
|
|
1123
1123
|
this.products$ = deriveField(this.rawState$, (s) => s.products, arrEq);
|
|
1124
|
+
this.customFields$ = deriveField(this.rawState$, (s) => s.customFields);
|
|
1124
1125
|
this.activeIndex$ = deriveField(this.rawState$, (s) => s.activeDropdownIndex);
|
|
1125
1126
|
this.isLoading$ = deriveField(this.rawState$, computeUiLoading);
|
|
1126
1127
|
this.isReady$ = deriveField(this.rawState$, (s) => s.isReady);
|
|
@@ -1382,6 +1383,7 @@ function computeState(s) {
|
|
|
1382
1383
|
newParamId: s.newParamId,
|
|
1383
1384
|
suggestions: s.suggestions,
|
|
1384
1385
|
products: s.products,
|
|
1386
|
+
customFields: s.customFields,
|
|
1385
1387
|
activeIndex: s.activeDropdownIndex,
|
|
1386
1388
|
isLoading: computeUiLoading(s),
|
|
1387
1389
|
isReady: s.isReady,
|
|
@@ -1786,6 +1788,14 @@ class AIAutocompleteComponent {
|
|
|
1786
1788
|
this.showChipIcons = true;
|
|
1787
1789
|
/** Focus the editor on mount. Default: true. */
|
|
1788
1790
|
this.autoFocus = true;
|
|
1791
|
+
/**
|
|
1792
|
+
* When true (default), the dropdown renders a horizontal row of product
|
|
1793
|
+
* cards below the options grid whenever it has products to show: by default
|
|
1794
|
+
* the items the `/suggest` response reports as matching the query, or the
|
|
1795
|
+
* results of a custom `products` search. Set to false to render no strip
|
|
1796
|
+
* and run no custom search.
|
|
1797
|
+
*/
|
|
1798
|
+
this.showProducts = true;
|
|
1789
1799
|
// === Outputs ===
|
|
1790
1800
|
/** Called on Enter or submit-button click. */
|
|
1791
1801
|
this.submitted = new EventEmitter();
|
|
@@ -1839,6 +1849,7 @@ class AIAutocompleteComponent {
|
|
|
1839
1849
|
optionsPosition: this.optionsPosition,
|
|
1840
1850
|
closeDropdownOnBlur: this.closeDropdownOnBlur,
|
|
1841
1851
|
showNonTappableOptions: this.showNonTappableOptions,
|
|
1852
|
+
showProducts: this.showProducts,
|
|
1842
1853
|
source: "full-sdk",
|
|
1843
1854
|
products: this.products,
|
|
1844
1855
|
value: this.value,
|
|
@@ -1920,6 +1931,7 @@ class AIAutocompleteComponent {
|
|
|
1920
1931
|
changes["optionsPosition"] ||
|
|
1921
1932
|
changes["closeDropdownOnBlur"] ||
|
|
1922
1933
|
changes["showNonTappableOptions"] ||
|
|
1934
|
+
changes["showProducts"] ||
|
|
1923
1935
|
changes["products"]) {
|
|
1924
1936
|
this.controller.update({
|
|
1925
1937
|
apiConfig: this.apiConfig,
|
|
@@ -1929,6 +1941,7 @@ class AIAutocompleteComponent {
|
|
|
1929
1941
|
optionsPosition: this.optionsPosition,
|
|
1930
1942
|
closeDropdownOnBlur: this.closeDropdownOnBlur,
|
|
1931
1943
|
showNonTappableOptions: this.showNonTappableOptions,
|
|
1944
|
+
showProducts: this.showProducts,
|
|
1932
1945
|
// Same reference on an unrelated change is a no-op in the core; only a
|
|
1933
1946
|
// genuinely swapped (or removed) integration clears the strip.
|
|
1934
1947
|
products: this.products,
|
|
@@ -2065,6 +2078,7 @@ class AIAutocompleteComponent {
|
|
|
2065
2078
|
this.submitted.emit(buildSubmitResult$1(text, params, state.skippedParams, {
|
|
2066
2079
|
identifiedParams: state.identifiedParams,
|
|
2067
2080
|
isReady: state.isReady,
|
|
2081
|
+
customFields: state.customFields,
|
|
2068
2082
|
}));
|
|
2069
2083
|
this.controller.reset();
|
|
2070
2084
|
}
|
|
@@ -2108,7 +2122,7 @@ class AIAutocompleteComponent {
|
|
|
2108
2122
|
}
|
|
2109
2123
|
}
|
|
2110
2124
|
AIAutocompleteComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "15.2.10", ngImport: i0, type: AIAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
2111
|
-
AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", optionOverrides: "optionOverrides", maskCompletedText: "maskCompletedText", columns: "columns", pillPlacement: "pillPlacement", mode: "mode", optionsPosition: "optionsPosition", animations: "animations", dropdownTrigger: "dropdownTrigger", closeDropdownOnBlur: "closeDropdownOnBlur", showNonTappableOptions: "showNonTappableOptions", showSkipButton: "showSkipButton", showOptionIcons: "showOptionIcons", showChipIcons: "showChipIcons", autoFocus: "autoFocus", value: "value", completedParams: "completedParams", products: "products", submitButton: "submitButton" }, outputs: { submitted: "submitted", resultChange: "resultChange", errored: "errored", valueChange: "valueChange", completedParamsChange: "completedParamsChange", focused: "focused", blurred: "blurred", productSelect: "productSelect" }, providers: [
|
|
2125
|
+
AIAutocompleteComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "15.2.10", type: AIAutocompleteComponent, isStandalone: true, selector: "ai-autocomplete", inputs: { apiConfig: "apiConfig", additionalContext: "additionalContext", optionOverrides: "optionOverrides", maskCompletedText: "maskCompletedText", columns: "columns", pillPlacement: "pillPlacement", mode: "mode", optionsPosition: "optionsPosition", animations: "animations", dropdownTrigger: "dropdownTrigger", closeDropdownOnBlur: "closeDropdownOnBlur", showNonTappableOptions: "showNonTappableOptions", showSkipButton: "showSkipButton", showOptionIcons: "showOptionIcons", showChipIcons: "showChipIcons", autoFocus: "autoFocus", value: "value", completedParams: "completedParams", showProducts: "showProducts", products: "products", submitButton: "submitButton" }, outputs: { submitted: "submitted", resultChange: "resultChange", errored: "errored", valueChange: "valueChange", completedParamsChange: "completedParamsChange", focused: "focused", blurred: "blurred", productSelect: "productSelect" }, providers: [
|
|
2112
2126
|
{
|
|
2113
2127
|
provide: NG_VALUE_ACCESSOR,
|
|
2114
2128
|
// eslint-disable-next-line @typescript-eslint/no-use-before-define
|
|
@@ -2168,6 +2182,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "15.2.10", ngImpo
|
|
|
2168
2182
|
type: Input
|
|
2169
2183
|
}], completedParams: [{
|
|
2170
2184
|
type: Input
|
|
2185
|
+
}], showProducts: [{
|
|
2186
|
+
type: Input
|
|
2171
2187
|
}], products: [{
|
|
2172
2188
|
type: Input
|
|
2173
2189
|
}], submitButton: [{
|
|
@@ -2532,10 +2548,14 @@ const visibleDateRange = visibleDateRange$1;
|
|
|
2532
2548
|
// Option icons, for a custom dropdown that draws `icon_svg` itself.
|
|
2533
2549
|
const optionLabel = optionLabel$1;
|
|
2534
2550
|
const sanitizeOptionIconSvg = sanitizeOptionIconSvg$1;
|
|
2551
|
+
// Product strip helpers, for a custom strip fed from `customFields$`.
|
|
2552
|
+
const PRODUCT_PATH_PREFIX = PRODUCT_PATH_PREFIX$1;
|
|
2553
|
+
const productFromMatchedItem = productFromMatchedItem$1;
|
|
2554
|
+
const productsFromCustomFields = productsFromCustomFields$1;
|
|
2535
2555
|
|
|
2536
2556
|
/**
|
|
2537
2557
|
* Generated bundle index. Do not edit.
|
|
2538
2558
|
*/
|
|
2539
2559
|
|
|
2540
|
-
export { AIAutocompleteComponent, AIAutocompleteController, AIAutocompleteDropdownComponent, AIAutocompleteInputDirective, AIAutocompleteModule, DATE_RANGE_META_END, DATE_RANGE_META_START, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, isoDate, monthLabel, optionLabel, parseDate, parseLooseDate, parseLooseDateRange, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams };
|
|
2560
|
+
export { AIAutocompleteComponent, AIAutocompleteController, AIAutocompleteDropdownComponent, AIAutocompleteInputDirective, AIAutocompleteModule, DATE_RANGE_META_END, DATE_RANGE_META_START, PRODUCT_PATH_PREFIX, WEEKDAY_LABELS, buildSubmitResult, cellDay, cellIso, dateCellMarks, formatDate, formatDateRange, isoDate, monthLabel, optionLabel, parseDate, parseLooseDate, parseLooseDateRange, productFromMatchedItem, productsFromCustomFields, sanitizeOptionIconSvg, selectedRangeFor, visibleDateRange, withSkippedParams };
|
|
2541
2561
|
//# sourceMappingURL=magicx-eng-ai-autocomplete-angular.mjs.map
|