@ids-group-ltd/ids-design-system 0.11.3 → 0.12.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/CHANGELOG.md +253 -13
- package/components/README.md +86 -0
- package/components.md +12 -4
- package/docs/agent/INDEX.md +1 -0
- package/docs/agent/platform/body-scroll-lock-service.md +12 -0
- package/docs/agent/platform/toast-service.md +4 -6
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs +85 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-accordion.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs +70 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-alert.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs +573 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-app-layout.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs +86 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-auth-layout.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs +615 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-autocomplete.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs +30 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs +188 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-avatar.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs +59 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-badge.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs +92 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-banner.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs +204 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-bottom-sheet.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs +100 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-breadcrumbs.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs +23 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs +180 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs +78 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-calendar-day.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs +49 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-card.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs +73 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-checkbox.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs +397 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-color-picker.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs +1231 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-date-picker.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs +51 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-description-list.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs +35 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-divider.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs +109 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-drawer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs +111 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-dropzone.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs +52 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-empty-state.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs +92 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs +62 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-field-message.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs +164 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-filter-bar.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs +85 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-icon-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs +223 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-input.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs +63 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-layout.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs +53 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-list.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs +43 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-loading-overlay.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs +286 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-menu.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs +329 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-modal.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs +612 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-multi-select.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs +69 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-number-stepper.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs +191 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-otp-input.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs +23 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-footer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs +43 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-page-header.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs +85 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-pagination.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs +95 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-password-rules.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs +240 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-popover.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs +41 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-progress.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs +235 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-radio-group.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs +62 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-reserve-messages.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs +173 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-search.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs +123 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-segmented.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs +461 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-select.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs +107 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav-footer.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs +185 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-sidenav.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs +32 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-skeleton.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs +204 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-slider.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs +25 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-spinner.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs +53 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-split-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs +99 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stat.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs +26 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-status-dot.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs +74 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-stepper.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs +76 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-switch.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs +1802 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-table.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs +381 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tabs.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs +44 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tag.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs +158 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-textarea.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs +671 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-time-picker.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs +41 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-timeline.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs +547 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toast.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs +34 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-toggle-button.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs +218 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tooltip.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs +18 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-topbar.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs +153 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-tree.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs +48 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components-w3w.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs +1338 -0
- package/fesm2022/ids-group-ltd-ids-design-system-components.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs +325 -0
- package/fesm2022/ids-group-ltd-ids-design-system-core.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs +101 -0
- package/fesm2022/ids-group-ltd-ids-design-system-icons.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs +56 -0
- package/fesm2022/ids-group-ltd-ids-design-system-overlay.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs +37 -0
- package/fesm2022/ids-group-ltd-ids-design-system-theme.mjs.map +1 -0
- package/fesm2022/ids-group-ltd-ids-design-system.mjs +72 -14030
- package/fesm2022/ids-group-ltd-ids-design-system.mjs.map +1 -1
- package/migrations/0.11.0.json +0 -2
- package/migrations/0.11.1.json +2 -1
- package/migrations/0.11.2.json +2 -1
- package/migrations/0.11.3.json +3 -2
- package/migrations/0.11.4.json +247 -0
- package/migrations/0.12.0.json +22 -0
- package/migrations/0.4.0.json +2 -1
- package/migrations/0.7.1.json +2 -1
- package/migrations/0.8.0.json +6 -5
- package/package.json +573 -1
- package/styles/_control-label.scss +18 -0
- package/styles/_ds-color.scss +6 -0
- package/styles/_focus.scss +16 -0
- package/styles/_skeleton-shimmer.scss +10 -26
- package/themes/README.md +4 -4
- package/themes/_semantic.scss +11 -2
- package/types/ids-group-ltd-ids-design-system-components-accordion.d.ts +48 -0
- package/types/ids-group-ltd-ids-design-system-components-alert.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-components-app-layout.d.ts +260 -0
- package/types/ids-group-ltd-ids-design-system-components-auth-layout.d.ts +75 -0
- package/types/ids-group-ltd-ids-design-system-components-autocomplete.d.ts +226 -0
- package/types/ids-group-ltd-ids-design-system-components-avatar-group.d.ts +13 -0
- package/types/ids-group-ltd-ids-design-system-components-avatar.d.ts +99 -0
- package/types/ids-group-ltd-ids-design-system-components-badge.d.ts +25 -0
- package/types/ids-group-ltd-ids-design-system-components-banner.d.ts +41 -0
- package/types/ids-group-ltd-ids-design-system-components-bottom-sheet.d.ts +61 -0
- package/types/ids-group-ltd-ids-design-system-components-breadcrumbs.d.ts +66 -0
- package/types/ids-group-ltd-ids-design-system-components-button-group.d.ts +10 -0
- package/types/ids-group-ltd-ids-design-system-components-button.d.ts +90 -0
- package/types/ids-group-ltd-ids-design-system-components-calendar-day.d.ts +41 -0
- package/types/ids-group-ltd-ids-design-system-components-card.d.ts +24 -0
- package/types/ids-group-ltd-ids-design-system-components-checkbox.d.ts +41 -0
- package/types/ids-group-ltd-ids-design-system-components-color-picker.d.ts +79 -0
- package/types/ids-group-ltd-ids-design-system-components-date-picker.d.ts +251 -0
- package/types/ids-group-ltd-ids-design-system-components-description-list.d.ts +25 -0
- package/types/ids-group-ltd-ids-design-system-components-divider.d.ts +22 -0
- package/types/ids-group-ltd-ids-design-system-components-drawer.d.ts +38 -0
- package/types/ids-group-ltd-ids-design-system-components-dropzone.d.ts +45 -0
- package/types/ids-group-ltd-ids-design-system-components-empty-state.d.ts +22 -0
- package/types/ids-group-ltd-ids-design-system-components-field-group.d.ts +73 -0
- package/types/ids-group-ltd-ids-design-system-components-field-message.d.ts +36 -0
- package/types/ids-group-ltd-ids-design-system-components-filter-bar.d.ts +83 -0
- package/types/ids-group-ltd-ids-design-system-components-icon-button.d.ts +56 -0
- package/types/ids-group-ltd-ids-design-system-components-input.d.ts +121 -0
- package/types/ids-group-ltd-ids-design-system-components-layout.d.ts +39 -0
- package/types/ids-group-ltd-ids-design-system-components-list.d.ts +29 -0
- package/types/ids-group-ltd-ids-design-system-components-loading-overlay.d.ts +31 -0
- package/types/ids-group-ltd-ids-design-system-components-menu.d.ts +82 -0
- package/types/ids-group-ltd-ids-design-system-components-modal.d.ts +124 -0
- package/types/ids-group-ltd-ids-design-system-components-multi-select.d.ts +213 -0
- package/types/ids-group-ltd-ids-design-system-components-number-stepper.d.ts +31 -0
- package/types/ids-group-ltd-ids-design-system-components-otp-input.d.ts +52 -0
- package/types/ids-group-ltd-ids-design-system-components-page-footer.d.ts +13 -0
- package/types/ids-group-ltd-ids-design-system-components-page-header.d.ts +21 -0
- package/types/ids-group-ltd-ids-design-system-components-pagination.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-components-password-rules.d.ts +80 -0
- package/types/ids-group-ltd-ids-design-system-components-popover.d.ts +48 -0
- package/types/ids-group-ltd-ids-design-system-components-progress.d.ts +22 -0
- package/types/ids-group-ltd-ids-design-system-components-radio-group.d.ts +106 -0
- package/types/ids-group-ltd-ids-design-system-components-reserve-messages.d.ts +33 -0
- package/types/ids-group-ltd-ids-design-system-components-search.d.ts +82 -0
- package/types/ids-group-ltd-ids-design-system-components-segmented.d.ts +40 -0
- package/types/ids-group-ltd-ids-design-system-components-select.d.ts +152 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav-footer.d.ts +92 -0
- package/types/ids-group-ltd-ids-design-system-components-sidenav.d.ts +131 -0
- package/types/ids-group-ltd-ids-design-system-components-skeleton.d.ts +16 -0
- package/types/ids-group-ltd-ids-design-system-components-slider.d.ts +51 -0
- package/types/ids-group-ltd-ids-design-system-components-spinner.d.ts +11 -0
- package/types/ids-group-ltd-ids-design-system-components-split-button.d.ts +38 -0
- package/types/ids-group-ltd-ids-design-system-components-stat.d.ts +44 -0
- package/types/ids-group-ltd-ids-design-system-components-status-dot.d.ts +12 -0
- package/types/ids-group-ltd-ids-design-system-components-stepper.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-components-switch.d.ts +40 -0
- package/types/ids-group-ltd-ids-design-system-components-table.d.ts +791 -0
- package/types/ids-group-ltd-ids-design-system-components-tabs.d.ts +118 -0
- package/types/ids-group-ltd-ids-design-system-components-tag.d.ts +26 -0
- package/types/ids-group-ltd-ids-design-system-components-textarea.d.ts +85 -0
- package/types/ids-group-ltd-ids-design-system-components-time-picker.d.ts +188 -0
- package/types/ids-group-ltd-ids-design-system-components-timeline.d.ts +24 -0
- package/types/ids-group-ltd-ids-design-system-components-toast.d.ts +167 -0
- package/types/ids-group-ltd-ids-design-system-components-toggle-button.d.ts +18 -0
- package/types/ids-group-ltd-ids-design-system-components-tooltip.d.ts +66 -0
- package/types/ids-group-ltd-ids-design-system-components-topbar.d.ts +8 -0
- package/types/ids-group-ltd-ids-design-system-components-tree.d.ts +46 -0
- package/types/ids-group-ltd-ids-design-system-components-w3w.d.ts +18 -0
- package/types/ids-group-ltd-ids-design-system-components.d.ts +604 -0
- package/types/ids-group-ltd-ids-design-system-core.d.ts +428 -0
- package/types/ids-group-ltd-ids-design-system-icons.d.ts +52 -0
- package/types/ids-group-ltd-ids-design-system-overlay.d.ts +32 -0
- package/types/ids-group-ltd-ids-design-system-theme.d.ts +29 -0
- package/types/ids-group-ltd-ids-design-system.d.ts +72 -5544
- package/LICENSE +0 -21
- package/README.md +0 -73
|
@@ -0,0 +1,615 @@
|
|
|
1
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
2
|
+
import * as i0 from '@angular/core';
|
|
3
|
+
import { inject, ViewContainerRef, ElementRef, input, model, booleanAttribute, numberAttribute, output, computed, contentChild, TemplateRef, signal, viewChild, forwardRef, ViewEncapsulation, Component } from '@angular/core';
|
|
4
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
5
|
+
import { Overlay } from '@angular/cdk/overlay';
|
|
6
|
+
import { TemplatePortal } from '@angular/cdk/portal';
|
|
7
|
+
import { DsControlValueAccessor, trimmedText, resolveFieldMessage, DsOptionTemplateDirective, DsChipTemplateDirective, DsPickerTriggerDirective, DsPanelHeaderTemplateDirective, DsPanelFooterTemplateDirective, DsGroupLabelTemplateDirective, DsEmptyTemplateDirective, DsCreateTemplateDirective, chipFit, scrollActiveOptionIntoView, announceOptionCount, dropdownOverlay, prepareOverlayEnter, forwardOverlayTokens, closeOnOutsidePointer, closeOnScroll, disposeWithLeave } from '@ids-group-ltd/ids-design-system/components';
|
|
8
|
+
import { IconComponent } from '@ids-group-ltd/ids-design-system/icons';
|
|
9
|
+
import { SpinnerComponent } from '@ids-group-ltd/ids-design-system/components/spinner';
|
|
10
|
+
import { TagComponent } from '@ids-group-ltd/ids-design-system/components/tag';
|
|
11
|
+
import { FieldMessageComponent } from '@ids-group-ltd/ids-design-system/components/field-message';
|
|
12
|
+
import { resolveWithConfig, flattenDsOptions, isDsOptionGroup, lastEnabledIndex, firstEnabledIndex, nextEnabledIndex } from '@ids-group-ltd/ids-design-system/core';
|
|
13
|
+
import { inFieldGroup } from '@ids-group-ltd/ids-design-system/components/field-group';
|
|
14
|
+
|
|
15
|
+
let nextId = 0;
|
|
16
|
+
class AutocompleteComponent extends DsControlValueAccessor {
|
|
17
|
+
/** Segment of a ds-field-group: the group owns the border, radius and focus
|
|
18
|
+
* ring, so .in-group strips this control back to its bare contents. */
|
|
19
|
+
inGroup = inFieldGroup();
|
|
20
|
+
overlay = inject(Overlay);
|
|
21
|
+
vcr = inject(ViewContainerRef);
|
|
22
|
+
host = inject((ElementRef));
|
|
23
|
+
/** Public panel tokens forwarded onto the portaled overlay pane on open so
|
|
24
|
+
* a consumer's `ds-autocomplete { --ds-autocomplete-panel-*: … }` reaches it. */
|
|
25
|
+
panelTokens = [
|
|
26
|
+
'--ds-dropdown-panel-bg-color',
|
|
27
|
+
'--ds-dropdown-panel-radius',
|
|
28
|
+
'--ds-dropdown-panel-minw',
|
|
29
|
+
'--ds-dropdown-panel-maxw',
|
|
30
|
+
'--ds-option-selected-bg-color',
|
|
31
|
+
'--ds-option-selected-label-color',
|
|
32
|
+
'--ds-option-selected-bg-color-hover',
|
|
33
|
+
'--ds-option-check-color',
|
|
34
|
+
];
|
|
35
|
+
/** Options, groups, or both mixed — rendered in the order given. */
|
|
36
|
+
options = input([], ...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
37
|
+
/** Selected value, or an array of values when `multiple`. */
|
|
38
|
+
value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
39
|
+
/** Allows selecting more than one option, shown as removable tags. */
|
|
40
|
+
multiple = input(false, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
41
|
+
/** Draws the trailing chevron. Turn it off for a search field, where an arrow
|
|
42
|
+
* invites a click that would list everything instead of searching. */
|
|
43
|
+
showChevron = input(true, { ...(ngDevMode ? { debugName: "showChevron" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
44
|
+
/** How the chips collapse when they outgrow one line. `"fit"` (the default)
|
|
45
|
+
* measures and shows as many as the trigger is wide, the rest behind "+N more".
|
|
46
|
+
* A NUMBER is a CEILING, not a promise: the row still measures, so you get at
|
|
47
|
+
* most that many and fewer when the trigger is narrow. `"all"` shows every chip and
|
|
48
|
+
* lets the trigger grow a line per selection.
|
|
49
|
+
*
|
|
50
|
+
* Unset (`null`) means "not deciding", as it does on every other input in the
|
|
51
|
+
* library — it resolves to `"fit"`. It does NOT mean "show all": that is
|
|
52
|
+
* `"all"`, which is the loudest of the three modes and has to be asked for. */
|
|
53
|
+
maxVisibleChips = input(null, { ...(ngDevMode ? { debugName: "maxVisibleChips" } : /* istanbul ignore next */ {}), transform: (raw) => {
|
|
54
|
+
if (raw === 'fit' || raw === 'all') {
|
|
55
|
+
return raw;
|
|
56
|
+
}
|
|
57
|
+
return raw == null ? null : numberAttribute(raw);
|
|
58
|
+
} });
|
|
59
|
+
/** Trigger height — sm/md/lg.
|
|
60
|
+
* Unset falls back to `DS_CONFIG.control.size`, then `'md'`. */
|
|
61
|
+
size = input(null, ...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
62
|
+
sizeResolved = resolveWithConfig(this.size, (config) => config.control?.size, 'md');
|
|
63
|
+
/** Trigger width — `fill` stretches to the container, `content` hugs the value. */
|
|
64
|
+
width = input('fill', ...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
65
|
+
/** What a settled single value does when it is wider than the trigger. Defaults
|
|
66
|
+
* to `ellipsis`; `wrap` restores the pre-0.12 behaviour, where the value broke
|
|
67
|
+
* onto a second line and pushed the chevron onto a third. Multi mode is
|
|
68
|
+
* unaffected — its chips have their own measured cap. */
|
|
69
|
+
valueOverflow = input('ellipsis', ...(ngDevMode ? [{ debugName: "valueOverflow" }] : /* istanbul ignore next */ []));
|
|
70
|
+
/** Placeholder shown in the input when empty. */
|
|
71
|
+
placeholder = input('Select…', ...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
72
|
+
/** Disables the trigger and blocks all interaction. */
|
|
73
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
74
|
+
/** Confirmation text, shown when there is no error or warning — and it paints
|
|
75
|
+
* the field's success border. A string like `warning`: the text IS the state. */
|
|
76
|
+
success = input('', { ...(ngDevMode ? { debugName: "success" } : /* istanbul ignore next */ {}), transform: trimmedText });
|
|
77
|
+
/** Shows a "Create «text»" row when the typed text matches no option. */
|
|
78
|
+
allowCreate = input(false, { ...(ngDevMode ? { debugName: "allowCreate" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
79
|
+
/** Field label above the control — the same meaning it has on the other two pickers. */
|
|
80
|
+
label = input('', ...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
81
|
+
/** How two values are decided to be the same one. The default is `===`, which
|
|
82
|
+
* is reference identity — so with object values a re-fetch that returns equal
|
|
83
|
+
* data as NEW objects loses the selection. Pass a comparator keyed on whatever
|
|
84
|
+
* identifies the value: `(a, b) => a?.id === b?.id`. */
|
|
85
|
+
compareWith = input((a, b) => a === b, ...(ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []));
|
|
86
|
+
/** Native `name` attribute forwarded to the trigger. */
|
|
87
|
+
name = input(null, ...(ngDevMode ? [{ debugName: "name" }] : /* istanbul ignore next */ []));
|
|
88
|
+
/** Prevents opening the panel while still allowing focus. */
|
|
89
|
+
readOnly = input(false, { ...(ngDevMode ? { debugName: "readOnly" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
90
|
+
/**
|
|
91
|
+
* The contract spelling of `readOnly`, a second input because signal forms binds
|
|
92
|
+
* by NAME — a `readonly()` rule was reaching nothing before this existed.
|
|
93
|
+
*/
|
|
94
|
+
readonlyBinding = input(false, { ...(ngDevMode ? { debugName: "readonlyBinding" } : /* istanbul ignore next */ {}),
|
|
95
|
+
// eslint-disable-next-line @angular-eslint/no-input-rename
|
|
96
|
+
alias: 'readonly',
|
|
97
|
+
transform: booleanAttribute });
|
|
98
|
+
/** Shows a clear affordance once there is something to clear. */
|
|
99
|
+
clearable = input(false, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
100
|
+
/** Placeholder while the field is being typed in, when a value is already
|
|
101
|
+
* settled — `placeholder` is the empty-field caption and cannot be both.
|
|
102
|
+
* Empty (the default) keeps `placeholder` doing both jobs, as before. */
|
|
103
|
+
searchPlaceholder = input('', ...(ngDevMode ? [{ debugName: "searchPlaceholder" }] : /* istanbul ignore next */ []));
|
|
104
|
+
/** How the typed query narrows the list.
|
|
105
|
+
*
|
|
106
|
+
* The default matches a case-insensitive substring of `label`. Pass a predicate
|
|
107
|
+
* to match on anything else — a second field, ignoring diacritics, a fuzzy score.
|
|
108
|
+
* Pass `'none'` when the list arrives already filtered, which is what a
|
|
109
|
+
* server-side search needs: the query is reported through `filterChange` and
|
|
110
|
+
* every option given is rendered.
|
|
111
|
+
*/
|
|
112
|
+
filterWith = input((option, query) => option.label.toLowerCase().includes(query), ...(ngDevMode ? [{ debugName: "filterWith" }] : /* istanbul ignore next */ []));
|
|
113
|
+
/** The query the user typed, on every change. The input for a server-side search;
|
|
114
|
+
* pair it with `filterWith="none"` so the list is not narrowed twice. */
|
|
115
|
+
filterChange = output();
|
|
116
|
+
/** Options are still being fetched. The panel shows a spinner instead of the
|
|
117
|
+
* empty row — which would otherwise claim there are no matches — and the list
|
|
118
|
+
* reports `aria-busy`. */
|
|
119
|
+
loading = input(false, { ...(ngDevMode ? { debugName: "loading" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
120
|
+
/** The panel opened. The moment to fetch options for a picker whose list is
|
|
121
|
+
* loaded on demand. */
|
|
122
|
+
opened = output();
|
|
123
|
+
/** The panel closed, for any reason — a pick, Escape, an outside click, a scroll. */
|
|
124
|
+
closed = output();
|
|
125
|
+
/** Scrolls the keyboard cursor's row into view. On by default: a list longer
|
|
126
|
+
* than the panel otherwise walks the cursor out of sight. Set `false` only if
|
|
127
|
+
* you are driving the scroll position yourself. */
|
|
128
|
+
scrollActiveIntoView = input(true, { ...(ngDevMode ? { debugName: "scrollActiveIntoView" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
129
|
+
/** Marks the field required: a `*` beside the label and `aria-required` on the input. */
|
|
130
|
+
required = input(false, { ...(ngDevMode ? { debugName: "required" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
131
|
+
/** Marks the field optional in words, for a form where most fields are required. */
|
|
132
|
+
optional = input(false, { ...(ngDevMode ? { debugName: "optional" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
133
|
+
/** Accessible name for the input. */
|
|
134
|
+
ariaLabel = input(null, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
135
|
+
/** Fires with the typed text when the user picks the create-new option. */
|
|
136
|
+
create = output();
|
|
137
|
+
isDisabled = computed(() => this.disabled() || this.formDisabled(), ...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
138
|
+
hintId = computed(() => this.message().text ? `${this.uid}-hint` : null, ...(ngDevMode ? [{ debugName: "hintId" }] : /* istanbul ignore next */ []));
|
|
139
|
+
fieldMessage = resolveFieldMessage({
|
|
140
|
+
hint: this.hint,
|
|
141
|
+
warning: this.warning,
|
|
142
|
+
error: this.error,
|
|
143
|
+
errors: this.errors,
|
|
144
|
+
invalid: this.invalid,
|
|
145
|
+
success: this.success,
|
|
146
|
+
touchedSelf: this.touchedSelf,
|
|
147
|
+
touched: this.touched,
|
|
148
|
+
});
|
|
149
|
+
message = this.fieldMessage.message;
|
|
150
|
+
controlState = this.fieldMessage.controlState;
|
|
151
|
+
invalidResolved = this.fieldMessage.invalid;
|
|
152
|
+
optionTemplate = contentChild(DsOptionTemplateDirective, { ...(ngDevMode ? { debugName: "optionTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
153
|
+
chipTemplate = contentChild(DsChipTemplateDirective, { ...(ngDevMode ? { debugName: "chipTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
154
|
+
pickerTrigger = contentChild(DsPickerTriggerDirective, { ...(ngDevMode ? { debugName: "pickerTrigger" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
155
|
+
panelHeaderTemplate = contentChild(DsPanelHeaderTemplateDirective, { ...(ngDevMode ? { debugName: "panelHeaderTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
156
|
+
panelFooterTemplate = contentChild(DsPanelFooterTemplateDirective, { ...(ngDevMode ? { debugName: "panelFooterTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
157
|
+
groupLabelTemplate = contentChild(DsGroupLabelTemplateDirective, { ...(ngDevMode ? { debugName: "groupLabelTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
158
|
+
emptyTemplate = contentChild(DsEmptyTemplateDirective, { ...(ngDevMode ? { debugName: "emptyTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
159
|
+
createTemplate = contentChild(DsCreateTemplateDirective, { ...(ngDevMode ? { debugName: "createTemplate" } : /* istanbul ignore next */ {}), read: TemplateRef });
|
|
160
|
+
query = signal('', ...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
161
|
+
isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
162
|
+
activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
163
|
+
trigger = viewChild.required('trigger');
|
|
164
|
+
filterInput = viewChild.required('filter');
|
|
165
|
+
panelTpl = viewChild.required('panel');
|
|
166
|
+
chipRow = viewChild('chipRow', ...(ngDevMode ? [{ debugName: "chipRow" }] : /* istanbul ignore next */ []));
|
|
167
|
+
overlayRef = null;
|
|
168
|
+
uid = `ds-autocomplete-${++nextId}`;
|
|
169
|
+
listboxId = `${this.uid}-listbox`;
|
|
170
|
+
labelId = `${this.uid}-label`;
|
|
171
|
+
optionId(index) {
|
|
172
|
+
return `${this.uid}-opt-${index}`;
|
|
173
|
+
}
|
|
174
|
+
activeDescendant = computed(() => {
|
|
175
|
+
const index = this.activeIndex();
|
|
176
|
+
return this.isOpen() && index >= 0 ? this.optionId(index) : null;
|
|
177
|
+
}, ...(ngDevMode ? [{ debugName: "activeDescendant" }] : /* istanbul ignore next */ []));
|
|
178
|
+
allOptions = computed(() => flattenDsOptions(this.options()), ...(ngDevMode ? [{ debugName: "allOptions" }] : /* istanbul ignore next */ []));
|
|
179
|
+
filteredItems = computed(() => {
|
|
180
|
+
const query = this.query().toLowerCase().trim();
|
|
181
|
+
const filter = this.filterWith();
|
|
182
|
+
const matches = (option) => !query || filter === 'none' || filter(option, query);
|
|
183
|
+
const kept = [];
|
|
184
|
+
for (const item of this.options()) {
|
|
185
|
+
if (!isDsOptionGroup(item)) {
|
|
186
|
+
if (matches(item)) {
|
|
187
|
+
kept.push(item);
|
|
188
|
+
}
|
|
189
|
+
continue;
|
|
190
|
+
}
|
|
191
|
+
// A disabled group disables its options HERE, not only in the flattened
|
|
192
|
+
// list: the template renders these objects, so a group left to inherit
|
|
193
|
+
// later would paint enabled rows that refuse to be picked.
|
|
194
|
+
const options = item.options
|
|
195
|
+
.filter(matches)
|
|
196
|
+
.map((option) => item.disabled ? { ...option, disabled: true } : option);
|
|
197
|
+
if (options.length > 0) {
|
|
198
|
+
kept.push({ ...item, options });
|
|
199
|
+
}
|
|
200
|
+
}
|
|
201
|
+
return kept;
|
|
202
|
+
}, ...(ngDevMode ? [{ debugName: "filteredItems" }] : /* istanbul ignore next */ []));
|
|
203
|
+
filteredOptions = computed(() => flattenDsOptions(this.filteredItems()), ...(ngDevMode ? [{ debugName: "filteredOptions" }] : /* istanbul ignore next */ []));
|
|
204
|
+
isGroup(item) {
|
|
205
|
+
return isDsOptionGroup(item);
|
|
206
|
+
}
|
|
207
|
+
showCreateRow = computed(() => {
|
|
208
|
+
if (!this.allowCreate()) {
|
|
209
|
+
return false;
|
|
210
|
+
}
|
|
211
|
+
const text = this.query().trim();
|
|
212
|
+
if (!text) {
|
|
213
|
+
return false;
|
|
214
|
+
}
|
|
215
|
+
const lowerText = text.toLowerCase();
|
|
216
|
+
return !this.allOptions().some((option) => option.label.toLowerCase() === lowerText);
|
|
217
|
+
}, ...(ngDevMode ? [{ debugName: "showCreateRow" }] : /* istanbul ignore next */ []));
|
|
218
|
+
visibleOptions = computed(() => this.filteredOptions(), ...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
219
|
+
/** The visible label wins the accessible name when there is one — otherwise the
|
|
220
|
+
* placeholder would announce over it, and `placeholder` always carries a default. */
|
|
221
|
+
resolvedAriaLabel = computed(() => this.label() ? null : this.ariaLabel() || this.placeholder() || null, ...(ngDevMode ? [{ debugName: "resolvedAriaLabel" }] : /* istanbul ignore next */ []));
|
|
222
|
+
selectedTags = computed(() => {
|
|
223
|
+
if (!this.multiple()) {
|
|
224
|
+
return [];
|
|
225
|
+
}
|
|
226
|
+
const selectedValues = this.value() ?? [];
|
|
227
|
+
const same = this.compareWith();
|
|
228
|
+
return this.allOptions().filter((option) => selectedValues.some((selected) => same(selected, option.value)));
|
|
229
|
+
}, ...(ngDevMode ? [{ debugName: "selectedTags" }] : /* istanbul ignore next */ []));
|
|
230
|
+
chipsMode = computed(() => this.maxVisibleChips() ?? 'fit', ...(ngDevMode ? [{ debugName: "chipsMode" }] : /* istanbul ignore next */ []));
|
|
231
|
+
showsEveryChip = computed(() => this.chipsMode() === 'all', ...(ngDevMode ? [{ debugName: "showsEveryChip" }] : /* istanbul ignore next */ []));
|
|
232
|
+
/** True for a number as well as `'fit'`: a number is a ceiling, not a promise,
|
|
233
|
+
* so the row still measures. */
|
|
234
|
+
fitsChipsToWidth = computed(() => !this.showsEveryChip(), ...(ngDevMode ? [{ debugName: "fitsChipsToWidth" }] : /* istanbul ignore next */ []));
|
|
235
|
+
/** How many chips the row is ASKED to render before measuring. It has to be the
|
|
236
|
+
* ceiling and not the selection: the measurement caches chip widths from a
|
|
237
|
+
* render that holds them all, so with a numeric cap that render never happens,
|
|
238
|
+
* the cache never fills, and the fit silently falls back to showing them all. */
|
|
239
|
+
chipBudget = computed(() => {
|
|
240
|
+
const max = this.chipsMode();
|
|
241
|
+
const total = this.selectedTags().length;
|
|
242
|
+
return typeof max === 'number' ? Math.min(Math.max(max, 0), total) : total;
|
|
243
|
+
}, ...(ngDevMode ? [{ debugName: "chipBudget" }] : /* istanbul ignore next */ []));
|
|
244
|
+
chipsThatFit = chipFit(this.chipBudget, this.chipRow, this.fitsChipsToWidth, computed(() => this.selectedTags().length));
|
|
245
|
+
/** What the trigger renders. Separate from `selectedTags`, which stays the
|
|
246
|
+
* full selection: Backspace removes the last SELECTED chip, and capping the
|
|
247
|
+
* list it reads would silently make it remove the last VISIBLE one instead. */
|
|
248
|
+
visibleTags = computed(() => {
|
|
249
|
+
const tags = this.selectedTags();
|
|
250
|
+
return this.showsEveryChip() ? tags : tags.slice(0, this.chipsThatFit());
|
|
251
|
+
}, ...(ngDevMode ? [{ debugName: "visibleTags" }] : /* istanbul ignore next */ []));
|
|
252
|
+
overflowCount = computed(() => this.selectedTags().length - this.visibleTags().length, ...(ngDevMode ? [{ debugName: "overflowCount" }] : /* istanbul ignore next */ []));
|
|
253
|
+
selectedOption = computed(() => {
|
|
254
|
+
if (this.multiple()) {
|
|
255
|
+
return null;
|
|
256
|
+
}
|
|
257
|
+
const currentValue = this.value();
|
|
258
|
+
if (currentValue === null) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
return (this.allOptions().find((option) => this.compareWith()(option.value, currentValue)) ?? null);
|
|
262
|
+
}, ...(ngDevMode ? [{ debugName: "selectedOption" }] : /* istanbul ignore next */ []));
|
|
263
|
+
displayLabel = computed(() => this.selectedOption()?.label ?? '', ...(ngDevMode ? [{ debugName: "displayLabel" }] : /* istanbul ignore next */ []));
|
|
264
|
+
hasSingleValue = computed(() => this.selectedOption() !== null, ...(ngDevMode ? [{ debugName: "hasSingleValue" }] : /* istanbul ignore next */ []));
|
|
265
|
+
triggerSelection = computed(() => this.multiple() ? this.selectedTags() : this.selectedOption(), ...(ngDevMode ? [{ debugName: "triggerSelection" }] : /* istanbul ignore next */ []));
|
|
266
|
+
placeholderText = computed(() => {
|
|
267
|
+
if (this.multiple()) {
|
|
268
|
+
return '';
|
|
269
|
+
}
|
|
270
|
+
if (this.displayLabel()) {
|
|
271
|
+
return this.searchPlaceholder();
|
|
272
|
+
}
|
|
273
|
+
return this.placeholder();
|
|
274
|
+
}, ...(ngDevMode ? [{ debugName: "placeholderText" }] : /* istanbul ignore next */ []));
|
|
275
|
+
isSelected(option) {
|
|
276
|
+
if (this.multiple()) {
|
|
277
|
+
const selectedValues = this.value() ?? [];
|
|
278
|
+
const same = this.compareWith();
|
|
279
|
+
return selectedValues.some((selected) => same(selected, option.value));
|
|
280
|
+
}
|
|
281
|
+
return this.compareWith()(this.value(), option.value);
|
|
282
|
+
}
|
|
283
|
+
optionClass(option) {
|
|
284
|
+
const parts = ['option'];
|
|
285
|
+
if (this.multiple()) {
|
|
286
|
+
parts.push('multi');
|
|
287
|
+
}
|
|
288
|
+
if (option.disabled) {
|
|
289
|
+
parts.push('is-disabled');
|
|
290
|
+
}
|
|
291
|
+
// The shared panel partial paints the selected row off this class, not off
|
|
292
|
+
// `aria-selected`, so a picker that only set the attribute went unpainted.
|
|
293
|
+
if (this.isSelected(option)) {
|
|
294
|
+
parts.push('is-selected');
|
|
295
|
+
}
|
|
296
|
+
return parts.join(' ');
|
|
297
|
+
}
|
|
298
|
+
/** -1 when nothing is pickable and there is no create row to fall back on. */
|
|
299
|
+
firstEnabledIndex() {
|
|
300
|
+
const index = this.visibleOptions().findIndex((option) => !option.disabled);
|
|
301
|
+
if (index >= 0) {
|
|
302
|
+
return index;
|
|
303
|
+
}
|
|
304
|
+
// With nothing pickable the create row IS the list; a -1 cursor would leave
|
|
305
|
+
// Enter doing nothing after typing a new name, until an ArrowDown nobody knows
|
|
306
|
+
// to press.
|
|
307
|
+
return this.showCreateRow() ? this.visibleOptions().length : -1;
|
|
308
|
+
}
|
|
309
|
+
/** Steps OVER a disabled option rather than landing on it. `step` is +1/-1; the
|
|
310
|
+
* create row (past the last option) is always reachable, and -1 comes back when
|
|
311
|
+
* every option is disabled. */
|
|
312
|
+
nextEnabledIndex(from, step, slots) {
|
|
313
|
+
if (!slots) {
|
|
314
|
+
return -1;
|
|
315
|
+
}
|
|
316
|
+
const options = this.visibleOptions();
|
|
317
|
+
for (let hop = 1; hop <= slots; hop++) {
|
|
318
|
+
const candidate = (from + step * hop + slots * hop) % slots;
|
|
319
|
+
const option = options[candidate];
|
|
320
|
+
if (!option || !option.disabled) {
|
|
321
|
+
return candidate;
|
|
322
|
+
}
|
|
323
|
+
}
|
|
324
|
+
return -1;
|
|
325
|
+
}
|
|
326
|
+
flatIndexOf(option) {
|
|
327
|
+
return this.visibleOptions().findIndex((opt) => opt === option);
|
|
328
|
+
}
|
|
329
|
+
constructor() {
|
|
330
|
+
super();
|
|
331
|
+
scrollActiveOptionIntoView(this.activeDescendant, this.scrollActiveIntoView, this.cursorFromKeyboard);
|
|
332
|
+
announceOptionCount(computed(() => this.filteredOptions().length), this.isOpen);
|
|
333
|
+
}
|
|
334
|
+
setOpen(next) {
|
|
335
|
+
if (this.isOpen() === next) {
|
|
336
|
+
return;
|
|
337
|
+
}
|
|
338
|
+
this.isOpen.set(next);
|
|
339
|
+
(next ? this.opened : this.closed).emit();
|
|
340
|
+
}
|
|
341
|
+
isReadOnly = computed(() => this.readOnly() || this.readonlyBinding(), ...(ngDevMode ? [{ debugName: "isReadOnly" }] : /* istanbul ignore next */ []));
|
|
342
|
+
cursorFromKeyboard = signal(false, ...(ngDevMode ? [{ debugName: "cursorFromKeyboard" }] : /* istanbul ignore next */ []));
|
|
343
|
+
/** How far PageUp and PageDown move. Ten rows is the native `<select>` step and
|
|
344
|
+
* the APG listbox example's — a fixed number rather than a measured screenful,
|
|
345
|
+
* so the jump is the same wherever the panel happens to be clipped. */
|
|
346
|
+
static pageStep = 10;
|
|
347
|
+
cursorList() {
|
|
348
|
+
const options = this.visibleOptions();
|
|
349
|
+
return {
|
|
350
|
+
length: options.length,
|
|
351
|
+
isEnabled: (index) => !options[index].disabled,
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
onTriggerClick() {
|
|
355
|
+
if (this.isDisabled()) {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
this.filterInput().nativeElement.focus();
|
|
359
|
+
if (!this.overlayRef) {
|
|
360
|
+
this.openPanel();
|
|
361
|
+
}
|
|
362
|
+
}
|
|
363
|
+
togglePanel(event) {
|
|
364
|
+
if (this.isDisabled()) {
|
|
365
|
+
return;
|
|
366
|
+
}
|
|
367
|
+
event.stopPropagation();
|
|
368
|
+
if (this.overlayRef) {
|
|
369
|
+
this.close();
|
|
370
|
+
}
|
|
371
|
+
else {
|
|
372
|
+
this.filterInput().nativeElement.focus();
|
|
373
|
+
this.openPanel();
|
|
374
|
+
}
|
|
375
|
+
}
|
|
376
|
+
onKeydown(event) {
|
|
377
|
+
this.cursorFromKeyboard.set(true);
|
|
378
|
+
if (this.isDisabled()) {
|
|
379
|
+
return;
|
|
380
|
+
}
|
|
381
|
+
const visibleCount = this.visibleOptions().length;
|
|
382
|
+
const totalSlots = visibleCount + (this.showCreateRow() ? 1 : 0);
|
|
383
|
+
switch (event.key) {
|
|
384
|
+
case 'ArrowDown':
|
|
385
|
+
event.preventDefault();
|
|
386
|
+
if (!this.overlayRef) {
|
|
387
|
+
this.openPanel();
|
|
388
|
+
return;
|
|
389
|
+
}
|
|
390
|
+
this.activeIndex.set(this.nextEnabledIndex(this.activeIndex(), 1, totalSlots));
|
|
391
|
+
break;
|
|
392
|
+
case 'ArrowUp':
|
|
393
|
+
event.preventDefault();
|
|
394
|
+
if (!this.overlayRef) {
|
|
395
|
+
this.openPanel();
|
|
396
|
+
return;
|
|
397
|
+
}
|
|
398
|
+
this.activeIndex.set(this.nextEnabledIndex(this.activeIndex(), -1, totalSlots));
|
|
399
|
+
break;
|
|
400
|
+
case 'Enter': {
|
|
401
|
+
const index = this.activeIndex();
|
|
402
|
+
if (this.showCreateRow() && index === visibleCount) {
|
|
403
|
+
event.preventDefault();
|
|
404
|
+
this.onCreateNew();
|
|
405
|
+
break;
|
|
406
|
+
}
|
|
407
|
+
const opt = this.visibleOptions()[index];
|
|
408
|
+
if (opt) {
|
|
409
|
+
event.preventDefault();
|
|
410
|
+
this.onPick(opt);
|
|
411
|
+
}
|
|
412
|
+
break;
|
|
413
|
+
}
|
|
414
|
+
case 'PageDown':
|
|
415
|
+
event.preventDefault();
|
|
416
|
+
this.activeIndex.set(nextEnabledIndex(this.cursorList(), this.activeIndex(), AutocompleteComponent.pageStep));
|
|
417
|
+
break;
|
|
418
|
+
case 'PageUp':
|
|
419
|
+
event.preventDefault();
|
|
420
|
+
this.activeIndex.set(nextEnabledIndex(this.cursorList(), this.activeIndex(), -AutocompleteComponent.pageStep));
|
|
421
|
+
break;
|
|
422
|
+
case 'Home':
|
|
423
|
+
event.preventDefault();
|
|
424
|
+
this.activeIndex.set(firstEnabledIndex(this.cursorList()));
|
|
425
|
+
break;
|
|
426
|
+
case 'End':
|
|
427
|
+
event.preventDefault();
|
|
428
|
+
this.activeIndex.set(lastEnabledIndex(this.cursorList()));
|
|
429
|
+
break;
|
|
430
|
+
case 'Escape':
|
|
431
|
+
if (this.overlayRef) {
|
|
432
|
+
event.preventDefault();
|
|
433
|
+
this.close('dismiss');
|
|
434
|
+
}
|
|
435
|
+
break;
|
|
436
|
+
case 'Tab':
|
|
437
|
+
// Close the panel but let Tab move focus naturally (no preventDefault),
|
|
438
|
+
// else the open overlay panel lingers behind the moved focus.
|
|
439
|
+
if (this.overlayRef) {
|
|
440
|
+
this.close();
|
|
441
|
+
}
|
|
442
|
+
break;
|
|
443
|
+
case 'Backspace':
|
|
444
|
+
if (this.multiple() && !this.query()) {
|
|
445
|
+
const tags = this.selectedTags();
|
|
446
|
+
const last = tags[tags.length - 1];
|
|
447
|
+
if (last) {
|
|
448
|
+
this.remove(last.value);
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
break;
|
|
452
|
+
}
|
|
453
|
+
}
|
|
454
|
+
openPanel() {
|
|
455
|
+
if (this.isReadOnly()) {
|
|
456
|
+
return;
|
|
457
|
+
}
|
|
458
|
+
if (this.overlayRef) {
|
|
459
|
+
return;
|
|
460
|
+
}
|
|
461
|
+
const triggerElement = this.trigger().nativeElement;
|
|
462
|
+
const { positionStrategy, config: overlayConfig } = dropdownOverlay(this.overlay, triggerElement);
|
|
463
|
+
const triggerWidth = triggerElement.getBoundingClientRect().width;
|
|
464
|
+
if (this.width() === 'content') {
|
|
465
|
+
overlayConfig.minWidth = triggerWidth;
|
|
466
|
+
}
|
|
467
|
+
else {
|
|
468
|
+
overlayConfig.width = triggerWidth;
|
|
469
|
+
}
|
|
470
|
+
this.overlayRef = this.overlay.create(overlayConfig);
|
|
471
|
+
prepareOverlayEnter(this.overlayRef, this.host.nativeElement, positionStrategy);
|
|
472
|
+
forwardOverlayTokens(this.overlayRef, this.host.nativeElement, this.panelTokens);
|
|
473
|
+
closeOnOutsidePointer(this.overlayRef, (target) => this.trigger().nativeElement.contains(target), () => this.close('dismiss'));
|
|
474
|
+
const removeScrollClose = closeOnScroll(this.overlayRef, () => this.close('dismiss'));
|
|
475
|
+
const detaching = this.overlayRef;
|
|
476
|
+
this.overlayRef.detachments().subscribe(() => {
|
|
477
|
+
removeScrollClose();
|
|
478
|
+
// A deferred dispose can outlive a re-open, and then this fires for the
|
|
479
|
+
// PREVIOUS panel: clearing state here would strand the live one.
|
|
480
|
+
if (this.overlayRef !== detaching) {
|
|
481
|
+
return;
|
|
482
|
+
}
|
|
483
|
+
this.overlayRef = null;
|
|
484
|
+
this.setOpen(false);
|
|
485
|
+
});
|
|
486
|
+
this.overlayRef.attach(new TemplatePortal(this.panelTpl(), this.vcr));
|
|
487
|
+
this.setOpen(true);
|
|
488
|
+
this.activeIndex.set(this.firstEnabledIndex());
|
|
489
|
+
}
|
|
490
|
+
close(cause = 'select') {
|
|
491
|
+
disposeWithLeave(this.overlayRef, cause);
|
|
492
|
+
this.overlayRef = null;
|
|
493
|
+
this.setOpen(false);
|
|
494
|
+
this.activeIndex.set(-1);
|
|
495
|
+
// The input collapses to zero width whenever a label is on display, so
|
|
496
|
+
// anything left in `query` goes INVISIBLE while it still narrows the next
|
|
497
|
+
// open. Never in multi mode, where the input keeps its width and the text
|
|
498
|
+
// stays honest.
|
|
499
|
+
if (this.displayLabel()) {
|
|
500
|
+
this.query.set('');
|
|
501
|
+
}
|
|
502
|
+
this.markTouched();
|
|
503
|
+
}
|
|
504
|
+
clearValue(event) {
|
|
505
|
+
event.stopPropagation();
|
|
506
|
+
this.clear();
|
|
507
|
+
this.markTouched();
|
|
508
|
+
}
|
|
509
|
+
/**
|
|
510
|
+
* Empties the field — both the selected value and the text the user typed.
|
|
511
|
+
*
|
|
512
|
+
* `value.set(null)` alone is not enough from outside: the typed query is
|
|
513
|
+
* component state with no input bound to it, so the text stays on screen after
|
|
514
|
+
* the value goes.
|
|
515
|
+
*
|
|
516
|
+
* Deliberately does NOT move focus — the caller may be navigating away, and
|
|
517
|
+
* stealing focus back into a field they just left is worse than leaving it.
|
|
518
|
+
*/
|
|
519
|
+
clear() {
|
|
520
|
+
this.value.set(this.multiple() ? [] : null);
|
|
521
|
+
this.query.set('');
|
|
522
|
+
if (this.isOpen()) {
|
|
523
|
+
this.close('dismiss');
|
|
524
|
+
}
|
|
525
|
+
}
|
|
526
|
+
ngOnDestroy() {
|
|
527
|
+
this.overlayRef?.dispose();
|
|
528
|
+
this.overlayRef = null;
|
|
529
|
+
}
|
|
530
|
+
onFilter(event) {
|
|
531
|
+
const typed = event.target.value;
|
|
532
|
+
this.query.set(typed);
|
|
533
|
+
this.filterChange.emit(typed);
|
|
534
|
+
this.activeIndex.set(this.firstEnabledIndex());
|
|
535
|
+
}
|
|
536
|
+
onPick(option) {
|
|
537
|
+
if (option.disabled) {
|
|
538
|
+
return;
|
|
539
|
+
}
|
|
540
|
+
if (this.multiple()) {
|
|
541
|
+
const current = this.value() ?? [];
|
|
542
|
+
const same = this.compareWith();
|
|
543
|
+
const next = current.some((entry) => same(entry, option.value))
|
|
544
|
+
? current.filter((existing) => existing !== option.value)
|
|
545
|
+
: [...current, option.value];
|
|
546
|
+
this.value.set(next);
|
|
547
|
+
}
|
|
548
|
+
else {
|
|
549
|
+
this.value.set(option.value);
|
|
550
|
+
this.close();
|
|
551
|
+
}
|
|
552
|
+
}
|
|
553
|
+
onCreateNew() {
|
|
554
|
+
const text = this.query().trim();
|
|
555
|
+
if (!text) {
|
|
556
|
+
return;
|
|
557
|
+
}
|
|
558
|
+
this.create.emit(text);
|
|
559
|
+
this.query.set('');
|
|
560
|
+
this.close();
|
|
561
|
+
}
|
|
562
|
+
remove(target) {
|
|
563
|
+
if (!this.multiple()) {
|
|
564
|
+
return;
|
|
565
|
+
}
|
|
566
|
+
const current = this.value() ?? [];
|
|
567
|
+
this.value.set(current.filter((existing) => existing !== target));
|
|
568
|
+
}
|
|
569
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: AutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
570
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.22", type: AutocompleteComponent, isStandalone: true, selector: "ds-autocomplete", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, showChevron: { classPropertyName: "showChevron", publicName: "showChevron", isSignal: true, isRequired: false, transformFunction: null }, maxVisibleChips: { classPropertyName: "maxVisibleChips", publicName: "maxVisibleChips", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, valueOverflow: { classPropertyName: "valueOverflow", publicName: "valueOverflow", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, success: { classPropertyName: "success", publicName: "success", isSignal: true, isRequired: false, transformFunction: null }, allowCreate: { classPropertyName: "allowCreate", publicName: "allowCreate", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, readOnly: { classPropertyName: "readOnly", publicName: "readOnly", isSignal: true, isRequired: false, transformFunction: null }, readonlyBinding: { classPropertyName: "readonlyBinding", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, filterWith: { classPropertyName: "filterWith", publicName: "filterWith", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", isSignal: true, isRequired: false, transformFunction: null }, scrollActiveIntoView: { classPropertyName: "scrollActiveIntoView", publicName: "scrollActiveIntoView", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, optional: { classPropertyName: "optional", publicName: "optional", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", filterChange: "filterChange", opened: "opened", closed: "closed", create: "create" }, host: { properties: { "attr.data-field-state": "controlState()", "class.in-group": "inGroup", "class.content-width": "width() === 'content'", "class.value-wraps": "valueOverflow() === 'wrap'" } }, providers: [
|
|
571
|
+
{
|
|
572
|
+
provide: NG_VALUE_ACCESSOR,
|
|
573
|
+
useExisting: forwardRef(() => AutocompleteComponent),
|
|
574
|
+
multi: true,
|
|
575
|
+
},
|
|
576
|
+
], queries: [{ propertyName: "optionTemplate", first: true, predicate: DsOptionTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "chipTemplate", first: true, predicate: DsChipTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "pickerTrigger", first: true, predicate: DsPickerTriggerDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "panelHeaderTemplate", first: true, predicate: DsPanelHeaderTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "panelFooterTemplate", first: true, predicate: DsPanelFooterTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "groupLabelTemplate", first: true, predicate: DsGroupLabelTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "emptyTemplate", first: true, predicate: DsEmptyTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }, { propertyName: "createTemplate", first: true, predicate: DsCreateTemplateDirective, descendants: true, read: TemplateRef, isSignal: true }], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "filterInput", first: true, predicate: ["filter"], descendants: true, isSignal: true }, { propertyName: "panelTpl", first: true, predicate: ["panel"], descendants: true, isSignal: true }, { propertyName: "chipRow", first: true, predicate: ["chipRow"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@if (label()) {\n <span\n class=\"label\"\n [id]=\"labelId\"\n >\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\"\n >\n *\n </span>\n } @else if (optional()) {\n <span\n class=\"optional-marker\"\n aria-hidden=\"true\"\n >\n (optional)\n </span>\n }\n </span>\n}\n\n<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- click opens/focuses; keyboard runs through the inner <input role=\"combobox\"> (type/arrows/Enter/Esc) -->\n<div\n #trigger\n class=\"autocomplete-trigger\"\n [class]=\"sizeResolved()\"\n [class.open]=\"isOpen()\"\n [class.disabled]=\"isDisabled()\"\n [class.error]=\"invalidResolved()\"\n (click)=\"onTriggerClick()\"\n>\n <span class=\"addon-slot prefix\">\n <ng-content select=\"[dsAutocompletePrefix]\"></ng-content>\n </span>\n\n @if (pickerTrigger(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: triggerSelection(),\n selected: triggerSelection(),\n count: multiple() ? selectedTags().length : hasSingleValue() ? 1 : 0,\n open: isOpen(),\n disabled: isDisabled(),\n }\"\n />\n } @else if (multiple()) {\n <span\n #chipRow\n class=\"chip-row\"\n [class.fit]=\"fitsChipsToWidth()\"\n >\n @for (selectedOption of visibleTags(); track selectedOption.value) {\n <ds-tag\n data-chip\n [closable]=\"true\"\n [closeLabel]=\"'Remove ' + selectedOption.label\"\n (closed)=\"remove(selectedOption.value)\"\n >\n @if (chipTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: selectedOption,\n option: selectedOption,\n }\"\n />\n } @else {\n {{ selectedOption.label }}\n }\n </ds-tag>\n }\n\n @if (overflowCount() > 0) {\n <span\n class=\"overflow\"\n data-chip-overflow\n >\n +{{ overflowCount() }} more\n </span>\n }\n </span>\n } @else if (displayLabel()) {\n <span\n class=\"autocomplete-value\"\n [attr.title]=\"valueOverflow() === 'ellipsis' ? displayLabel() : null\"\n >\n {{ displayLabel() }}\n </span>\n }\n\n <input\n #filter\n type=\"text\"\n class=\"autocomplete-input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [class.collapsed]=\"displayLabel() && !isOpen()\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"listboxId\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-labelledby]=\"label() ? labelId : null\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-readonly]=\"isReadOnly() ? 'true' : null\"\n [attr.name]=\"name()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [disabled]=\"isDisabled()\"\n [value]=\"query()\"\n [placeholder]=\"placeholderText()\"\n (input)=\"onFilter($event)\"\n (focus)=\"openPanel()\"\n (blur)=\"markTouched()\"\n (keydown)=\"onKeydown($event)\"\n />\n\n <span class=\"addon-slot suffix\">\n <ng-content select=\"[dsAutocompleteSuffix]\"></ng-content>\n </span>\n\n @if (\n clearable() &&\n hasSingleValue() &&\n !isDisabled() &&\n !isReadOnly()\n ) {\n <button\n type=\"button\"\n class=\"clear-btn\"\n aria-label=\"Clear selection\"\n (click)=\"clearValue($event)\"\n >\n <ds-icon\n name=\"x\"\n [size]=\"14\"\n />\n </button>\n }\n\n @if (showChevron()) {\n <ds-icon\n name=\"chevronDown\"\n class=\"autocomplete-chevron\"\n aria-hidden=\"true\"\n [size]=\"16\"\n (click)=\"togglePanel($event)\"\n />\n }\n</div>\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\"\n/>\n\n<ng-template #panel>\n <div class=\"dropdown-panel\">\n @if (panelHeaderTemplate(); as tpl) {\n <div class=\"panel-header\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n count: filteredOptions().length,\n total: allOptions().length,\n query: query(),\n }\"\n />\n </div>\n }\n\n <ul\n class=\"dropdown-list\"\n role=\"listbox\"\n [attr.aria-busy]=\"loading() ? 'true' : null\"\n [id]=\"listboxId\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n >\n @for (item of filteredItems(); track $index; let itemIdx = $index) {\n @if (isGroup(item)) {\n <li\n class=\"optgroup\"\n role=\"group\"\n [attr.aria-label]=\"item.label\"\n >\n <span\n class=\"optgroup-label\"\n [class.is-first]=\"itemIdx === 0\"\n >\n @if (groupLabelTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: item,\n group: item,\n count: item.options.length,\n }\"\n />\n } @else {\n {{ item.label }}\n }\n </span>\n\n @for (option of item.options; track option.value) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- listbox option; activated via the combobox input + aria-activedescendant, options aren't individually focusable -->\n <div\n role=\"option\"\n [class]=\"optionClass(option)\"\n [id]=\"optionId(flatIndexOf(option))\"\n [class.is-active]=\"flatIndexOf(option) === activeIndex()\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled ? 'true' : null\"\n (click)=\"onPick(option)\"\n (mouseenter)=\"\n cursorFromKeyboard.set(false);\n option.disabled || activeIndex.set(flatIndexOf(option))\n \"\n >\n @if (multiple()) {\n <span\n class=\"check-box\"\n [class.checked]=\"isSelected(option)\"\n >\n @if (isSelected(option)) {\n <ds-icon\n name=\"check\"\n [size]=\"13\"\n />\n }\n </span>\n }\n\n @if (option.icon) {\n <ds-icon\n class=\"option-icon\"\n [name]=\"option.icon\"\n [size]=\"16\"\n />\n }\n\n <span class=\"option-label\">\n @if (optionTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: option,\n option: option,\n }\"\n />\n } @else {\n {{ option.label }}\n }\n </span>\n\n @if (!multiple() && isSelected(option)) {\n <ds-icon\n name=\"check\"\n class=\"option-check\"\n [size]=\"14\"\n />\n }\n </div>\n }\n </li>\n } @else {\n @let option = item;\n\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- listbox option; activated via the combobox input + aria-activedescendant, options aren't individually focusable -->\n <li\n role=\"option\"\n [class]=\"optionClass(option)\"\n [id]=\"optionId(flatIndexOf(option))\"\n [class.is-active]=\"flatIndexOf(option) === activeIndex()\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled ? 'true' : null\"\n (click)=\"onPick(option)\"\n (mouseenter)=\"\n cursorFromKeyboard.set(false);\n option.disabled || activeIndex.set(flatIndexOf(option))\n \"\n >\n @if (multiple()) {\n <span\n class=\"check-box\"\n [class.checked]=\"isSelected(option)\"\n >\n @if (isSelected(option)) {\n <ds-icon\n name=\"check\"\n [size]=\"13\"\n />\n }\n </span>\n }\n\n @if (option.icon) {\n <ds-icon\n class=\"option-icon\"\n [name]=\"option.icon\"\n [size]=\"16\"\n />\n }\n\n <span class=\"option-label\">\n @if (optionTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: option,\n option: option,\n }\"\n />\n } @else {\n {{ option.label }}\n }\n </span>\n\n @if (!multiple() && isSelected(option)) {\n <ds-icon\n name=\"check\"\n class=\"option-check\"\n [size]=\"14\"\n />\n }\n </li>\n }\n }\n\n @if (loading()) {\n <li\n class=\"empty t-s\"\n role=\"presentation\"\n >\n <ds-spinner size=\"sm\" />\n </li>\n } @else if (filteredOptions().length === 0 && !showCreateRow()) {\n <li\n class=\"empty t-s\"\n role=\"presentation\"\n >\n @if (emptyTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: query(), query: query() }\"\n />\n } @else {\n No matches\n }\n </li>\n }\n\n @if (showCreateRow()) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- listbox option; activated via the combobox input + aria-activedescendant, options aren't individually focusable -->\n <li\n class=\"option create-row\"\n role=\"option\"\n [id]=\"optionId(visibleOptions().length)\"\n [class.is-active]=\"activeIndex() === visibleOptions().length\"\n [attr.aria-selected]=\"false\"\n (click)=\"onCreateNew()\"\n (mouseenter)=\"\n cursorFromKeyboard.set(false);\n activeIndex.set(visibleOptions().length)\n \"\n >\n <ds-icon\n name=\"plus\"\n class=\"create-icon\"\n [size]=\"16\"\n />\n\n <span class=\"option-label\">\n @if (createTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: query().trim(),\n query: query().trim(),\n }\"\n />\n } @else {\n Create \u00AB{{ query().trim() }}\u00BB\n }\n </span>\n </li>\n }\n </ul>\n\n @if (panelFooterTemplate(); as tpl) {\n <div class=\"panel-footer\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n count: filteredOptions().length,\n total: allOptions().length,\n query: query(),\n }\"\n />\n </div>\n }\n </div>\n</ng-template>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:none;box-shadow:var(--ds-control-focus-shadow)}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=field]{--ds-control-focus-shadow: var(--focus-field);--ds-control-focus-shadow-error: var(--focus-field-error)}:root[data-focus=edge]{--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error);--ds-control-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-control-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error);--ds-control-focus-shadow: var(--focus-ring-inset);--ds-control-focus-shadow-error: var(--focus-ring-inset-error)}:root[data-focus=outline]{--ds-field-focus-shadow: none;--ds-field-focus-shadow-error: none;--ds-control-focus-shadow: none;--ds-control-focus-shadow-error: none}:root[data-focus=outline] :where(:focus-visible){outline:var(--border-width-strong) solid var(--primary);outline-offset:var(--focus-ring-offset)}@media(forced-colors:active){:where(:focus-visible){outline:var(--border-width-strong) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--ds-dropdown-panel-bg-color: var( --ds-autocomplete-panel-bg-color, var(--surface-overlay) );--ds-dropdown-panel-radius: var( --ds-autocomplete-panel-radius, var(--ds-radius-panel) );--ds-dropdown-panel-maxh: var(--ds-autocomplete-panel-maxh, var(--picker-maxh));--_autocomplete-focus-shadow: var(--ds-autocomplete-focus-shadow, var(--ds-field-focus-shadow));--_autocomplete-maxw: var(--ds-autocomplete-maxw, none);--_autocomplete-input-minw: var(--ds-autocomplete-input-minw, 80px);--_autocomplete-bg-color: var(--ds-autocomplete-bg-color, var(--surface-default));--_autocomplete-border-color: var(--ds-autocomplete-border-color, var(--border-default));--_autocomplete-radius: var(--ds-autocomplete-radius, var(--ds-radius-control));--_autocomplete-border-color-focus: var(--ds-autocomplete-border-color-focus, var(--accent));display:flex;flex-direction:column;gap:var(--field-label-gap);width:100%;max-width:var(--_autocomplete-maxw);position:relative}:host(.content-width){--_autocomplete-maxw: var(--ds-autocomplete-maxw, 100%);width:fit-content}.label{--_field-label-font-size: var(--ds-field-label-font-size, var(--font-size-xs));--_field-label-weight: var(--ds-field-label-weight, var(--font-weight-bold));--_field-label-color: var(--ds-field-label-color, var(--text-secondary));--_field-label-transform: var(--ds-field-label-transform, none);--_field-label-tracking: var(--ds-field-label-tracking, normal);display:flex;align-items:center;gap:var(--field-gap-req);font:var(--_field-label-weight) var(--_field-label-font-size)/var(--line-height-base) var(--font-sans);color:var(--_field-label-color);text-transform:var(--_field-label-transform);letter-spacing:var(--_field-label-tracking)}.label .req{color:var(--error);font-weight:var(--font-weight-semibold)}.label .optional-marker{color:var(--text-tertiary);font-weight:var(--font-weight-regular)}.autocomplete-trigger{display:flex;align-items:center;gap:var(--space-2);width:100%;--_field-box-height: var(--ds-field-height, var(--field-h-md));min-height:var(--_field-box-height);padding:var(--space-1) var(--space-2);background:var(--_autocomplete-bg-color);border:var(--border-width-default) solid var(--_autocomplete-border-color);border-radius:var(--_autocomplete-radius);cursor:text;text-align:left;flex-wrap:wrap}.autocomplete-trigger:has(>.chip-row.fit){flex-wrap:nowrap}:host(:not(.value-wraps)) .autocomplete-trigger{flex-wrap:nowrap}.autocomplete-trigger{transition:border-color var(--duration-fast) var(--ease-standard)}.autocomplete-trigger .addon-slot{display:inline-flex;align-items:center;align-self:stretch;color:var(--text-tertiary);flex-shrink:0}.autocomplete-trigger .addon-slot:empty{display:none}.autocomplete-trigger:hover:not(.disabled){border-color:var(--border-strong)}.autocomplete-trigger .autocomplete-input:where(:focus-visible){box-shadow:none}.autocomplete-trigger:focus-within:not(.disabled){border-color:var(--_autocomplete-border-color-focus);box-shadow:var(--_autocomplete-focus-shadow);outline:0}.autocomplete-trigger.disabled{background:var(--surface-disabled);border-color:var(--border-disabled);color:var(--text-disabled);cursor:not-allowed}.autocomplete-trigger.disabled .autocomplete-input{cursor:not-allowed;color:var(--text-disabled)}.autocomplete-trigger.disabled .autocomplete-value,.autocomplete-trigger.disabled .autocomplete-chevron{color:var(--text-disabled)}.autocomplete-trigger.sm{--_field-box-height: var(--ds-field-height, var(--field-h-sm));min-height:var(--_field-box-height)}.autocomplete-trigger.lg{--_field-box-height: var(--ds-field-height, var(--field-h-lg));min-height:var(--_field-box-height)}.chip-row{display:contents}.chip-row.fit{display:flex;flex-wrap:nowrap;align-items:center;min-width:0;overflow:hidden;gap:inherit}.chip-row.fit>*{flex:0 1 auto;min-width:0;white-space:nowrap}.overflow{color:var(--text-secondary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-xs)}.autocomplete-value{font:var(--font-weight-medium) var(--font-size-s)/var(--line-height-flat) var(--font-sans);color:var(--text-primary)}:host(:not(.value-wraps)) .autocomplete-value{min-width:0;overflow:clip;overflow-clip-margin:var(--space-1);text-overflow:ellipsis;white-space:nowrap}.autocomplete-input{flex:1;min-width:var(--_autocomplete-input-minw)}.autocomplete-input.collapsed{flex:0 0 0;min-width:0;width:0;padding:0}.autocomplete-input{border:0;outline:0;background:transparent;font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-flat) var(--font-sans);color:var(--text-primary)}.autocomplete-chevron{color:var(--icon-default);margin-left:auto}.dropdown-panel .option.multi{padding-left:var(--space-2)}.dropdown-panel .check-box{flex:none;display:inline-flex;align-items:center;justify-content:center;width:var(--check-size);height:var(--check-size);border:var(--border-width-strong) solid var(--border-strong);border-radius:var(--ds-radius-inner);color:var(--text-on-primary)}.dropdown-panel .check-box.checked{background-color:var(--accent);border-color:var(--accent)}.dropdown-panel .create-row{color:var(--accent)}.dropdown-panel .create-row .create-icon{flex:0 0 auto}:host(.in-group){width:auto;display:flex}:host(.in-group) .label,:host(.in-group) ds-field-message{display:none}:host(.in-group) .autocomplete-trigger{border:0;border-radius:0;background:transparent;flex:1;height:auto}:host(.in-group) .autocomplete-trigger:hover,:host(.in-group) .autocomplete-trigger:focus,:host(.in-group) .autocomplete-trigger:focus-visible,:host(.in-group) .autocomplete-trigger:focus-within{border:0;box-shadow:none;outline:0}:host([data-field-state=error]:not(.in-group)) .autocomplete-trigger{border-color:var(--error);background-color:var(--error-subtitle)}:host([data-field-state=error]:not(.in-group)) .autocomplete-trigger:focus-within,:host([data-field-state=error]:not(.in-group)) .autocomplete-trigger:focus-visible{box-shadow:var(--ds-field-focus-shadow-error)}:host([data-field-state=warning]:not(.in-group)) .autocomplete-trigger{border-color:var(--warning-text)}:host([data-field-state=success]:not(.in-group)) .autocomplete-trigger{border-color:var(--success)}\n"], dependencies: [{ kind: "component", type: IconComponent, selector: "ds-icon", inputs: ["name", "size", "stroke", "ariaLabel"] }, { kind: "component", type: SpinnerComponent, selector: "ds-spinner", inputs: ["size"] }, { kind: "component", type: TagComponent, selector: "ds-tag", inputs: ["variant", "closable", "interactive", "selected", "closeLabel"], outputs: ["closed", "toggled"] }, { kind: "component", type: FieldMessageComponent, selector: "ds-field-message", inputs: ["text", "state", "messageId", "icon", "reserve"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
577
|
+
}
|
|
578
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.22", ngImport: i0, type: AutocompleteComponent, decorators: [{
|
|
579
|
+
type: Component,
|
|
580
|
+
args: [{ selector: 'ds-autocomplete', standalone: true, imports: [
|
|
581
|
+
IconComponent,
|
|
582
|
+
SpinnerComponent,
|
|
583
|
+
TagComponent,
|
|
584
|
+
FieldMessageComponent,
|
|
585
|
+
NgTemplateOutlet,
|
|
586
|
+
], encapsulation: ViewEncapsulation.Emulated, host: {
|
|
587
|
+
'[attr.data-field-state]': 'controlState()',
|
|
588
|
+
'[class.in-group]': 'inGroup',
|
|
589
|
+
'[class.content-width]': "width() === 'content'",
|
|
590
|
+
'[class.value-wraps]': "valueOverflow() === 'wrap'",
|
|
591
|
+
}, providers: [
|
|
592
|
+
{
|
|
593
|
+
provide: NG_VALUE_ACCESSOR,
|
|
594
|
+
useExisting: forwardRef(() => AutocompleteComponent),
|
|
595
|
+
multi: true,
|
|
596
|
+
},
|
|
597
|
+
], template: "@if (label()) {\n <span\n class=\"label\"\n [id]=\"labelId\"\n >\n {{ label() }}\n @if (required()) {\n <span\n class=\"req\"\n aria-hidden=\"true\"\n >\n *\n </span>\n } @else if (optional()) {\n <span\n class=\"optional-marker\"\n aria-hidden=\"true\"\n >\n (optional)\n </span>\n }\n </span>\n}\n\n<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- click opens/focuses; keyboard runs through the inner <input role=\"combobox\"> (type/arrows/Enter/Esc) -->\n<div\n #trigger\n class=\"autocomplete-trigger\"\n [class]=\"sizeResolved()\"\n [class.open]=\"isOpen()\"\n [class.disabled]=\"isDisabled()\"\n [class.error]=\"invalidResolved()\"\n (click)=\"onTriggerClick()\"\n>\n <span class=\"addon-slot prefix\">\n <ng-content select=\"[dsAutocompletePrefix]\"></ng-content>\n </span>\n\n @if (pickerTrigger(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: triggerSelection(),\n selected: triggerSelection(),\n count: multiple() ? selectedTags().length : hasSingleValue() ? 1 : 0,\n open: isOpen(),\n disabled: isDisabled(),\n }\"\n />\n } @else if (multiple()) {\n <span\n #chipRow\n class=\"chip-row\"\n [class.fit]=\"fitsChipsToWidth()\"\n >\n @for (selectedOption of visibleTags(); track selectedOption.value) {\n <ds-tag\n data-chip\n [closable]=\"true\"\n [closeLabel]=\"'Remove ' + selectedOption.label\"\n (closed)=\"remove(selectedOption.value)\"\n >\n @if (chipTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: selectedOption,\n option: selectedOption,\n }\"\n />\n } @else {\n {{ selectedOption.label }}\n }\n </ds-tag>\n }\n\n @if (overflowCount() > 0) {\n <span\n class=\"overflow\"\n data-chip-overflow\n >\n +{{ overflowCount() }} more\n </span>\n }\n </span>\n } @else if (displayLabel()) {\n <span\n class=\"autocomplete-value\"\n [attr.title]=\"valueOverflow() === 'ellipsis' ? displayLabel() : null\"\n >\n {{ displayLabel() }}\n </span>\n }\n\n <input\n #filter\n type=\"text\"\n class=\"autocomplete-input\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [class.collapsed]=\"displayLabel() && !isOpen()\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-controls]=\"listboxId\"\n [attr.aria-activedescendant]=\"activeDescendant()\"\n [attr.aria-labelledby]=\"label() ? labelId : null\"\n [attr.aria-label]=\"resolvedAriaLabel()\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-readonly]=\"isReadOnly() ? 'true' : null\"\n [attr.name]=\"name()\"\n [attr.aria-invalid]=\"invalidResolved() ? 'true' : null\"\n [attr.aria-describedby]=\"hintId()\"\n [disabled]=\"isDisabled()\"\n [value]=\"query()\"\n [placeholder]=\"placeholderText()\"\n (input)=\"onFilter($event)\"\n (focus)=\"openPanel()\"\n (blur)=\"markTouched()\"\n (keydown)=\"onKeydown($event)\"\n />\n\n <span class=\"addon-slot suffix\">\n <ng-content select=\"[dsAutocompleteSuffix]\"></ng-content>\n </span>\n\n @if (\n clearable() &&\n hasSingleValue() &&\n !isDisabled() &&\n !isReadOnly()\n ) {\n <button\n type=\"button\"\n class=\"clear-btn\"\n aria-label=\"Clear selection\"\n (click)=\"clearValue($event)\"\n >\n <ds-icon\n name=\"x\"\n [size]=\"14\"\n />\n </button>\n }\n\n @if (showChevron()) {\n <ds-icon\n name=\"chevronDown\"\n class=\"autocomplete-chevron\"\n aria-hidden=\"true\"\n [size]=\"16\"\n (click)=\"togglePanel($event)\"\n />\n }\n</div>\n\n<ds-field-message\n [icon]=\"messageIcon()\"\n [text]=\"message().text\"\n [state]=\"message().state\"\n [messageId]=\"hintId()\"\n [reserve]=\"reserveMessageResolved()\"\n/>\n\n<ng-template #panel>\n <div class=\"dropdown-panel\">\n @if (panelHeaderTemplate(); as tpl) {\n <div class=\"panel-header\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n count: filteredOptions().length,\n total: allOptions().length,\n query: query(),\n }\"\n />\n </div>\n }\n\n <ul\n class=\"dropdown-list\"\n role=\"listbox\"\n [attr.aria-busy]=\"loading() ? 'true' : null\"\n [id]=\"listboxId\"\n [attr.aria-multiselectable]=\"multiple() ? 'true' : null\"\n >\n @for (item of filteredItems(); track $index; let itemIdx = $index) {\n @if (isGroup(item)) {\n <li\n class=\"optgroup\"\n role=\"group\"\n [attr.aria-label]=\"item.label\"\n >\n <span\n class=\"optgroup-label\"\n [class.is-first]=\"itemIdx === 0\"\n >\n @if (groupLabelTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: item,\n group: item,\n count: item.options.length,\n }\"\n />\n } @else {\n {{ item.label }}\n }\n </span>\n\n @for (option of item.options; track option.value) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- listbox option; activated via the combobox input + aria-activedescendant, options aren't individually focusable -->\n <div\n role=\"option\"\n [class]=\"optionClass(option)\"\n [id]=\"optionId(flatIndexOf(option))\"\n [class.is-active]=\"flatIndexOf(option) === activeIndex()\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled ? 'true' : null\"\n (click)=\"onPick(option)\"\n (mouseenter)=\"\n cursorFromKeyboard.set(false);\n option.disabled || activeIndex.set(flatIndexOf(option))\n \"\n >\n @if (multiple()) {\n <span\n class=\"check-box\"\n [class.checked]=\"isSelected(option)\"\n >\n @if (isSelected(option)) {\n <ds-icon\n name=\"check\"\n [size]=\"13\"\n />\n }\n </span>\n }\n\n @if (option.icon) {\n <ds-icon\n class=\"option-icon\"\n [name]=\"option.icon\"\n [size]=\"16\"\n />\n }\n\n <span class=\"option-label\">\n @if (optionTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: option,\n option: option,\n }\"\n />\n } @else {\n {{ option.label }}\n }\n </span>\n\n @if (!multiple() && isSelected(option)) {\n <ds-icon\n name=\"check\"\n class=\"option-check\"\n [size]=\"14\"\n />\n }\n </div>\n }\n </li>\n } @else {\n @let option = item;\n\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- listbox option; activated via the combobox input + aria-activedescendant, options aren't individually focusable -->\n <li\n role=\"option\"\n [class]=\"optionClass(option)\"\n [id]=\"optionId(flatIndexOf(option))\"\n [class.is-active]=\"flatIndexOf(option) === activeIndex()\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled ? 'true' : null\"\n (click)=\"onPick(option)\"\n (mouseenter)=\"\n cursorFromKeyboard.set(false);\n option.disabled || activeIndex.set(flatIndexOf(option))\n \"\n >\n @if (multiple()) {\n <span\n class=\"check-box\"\n [class.checked]=\"isSelected(option)\"\n >\n @if (isSelected(option)) {\n <ds-icon\n name=\"check\"\n [size]=\"13\"\n />\n }\n </span>\n }\n\n @if (option.icon) {\n <ds-icon\n class=\"option-icon\"\n [name]=\"option.icon\"\n [size]=\"16\"\n />\n }\n\n <span class=\"option-label\">\n @if (optionTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: option,\n option: option,\n }\"\n />\n } @else {\n {{ option.label }}\n }\n </span>\n\n @if (!multiple() && isSelected(option)) {\n <ds-icon\n name=\"check\"\n class=\"option-check\"\n [size]=\"14\"\n />\n }\n </li>\n }\n }\n\n @if (loading()) {\n <li\n class=\"empty t-s\"\n role=\"presentation\"\n >\n <ds-spinner size=\"sm\" />\n </li>\n } @else if (filteredOptions().length === 0 && !showCreateRow()) {\n <li\n class=\"empty t-s\"\n role=\"presentation\"\n >\n @if (emptyTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{ $implicit: query(), query: query() }\"\n />\n } @else {\n No matches\n }\n </li>\n }\n\n @if (showCreateRow()) {\n <!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -- listbox option; activated via the combobox input + aria-activedescendant, options aren't individually focusable -->\n <li\n class=\"option create-row\"\n role=\"option\"\n [id]=\"optionId(visibleOptions().length)\"\n [class.is-active]=\"activeIndex() === visibleOptions().length\"\n [attr.aria-selected]=\"false\"\n (click)=\"onCreateNew()\"\n (mouseenter)=\"\n cursorFromKeyboard.set(false);\n activeIndex.set(visibleOptions().length)\n \"\n >\n <ds-icon\n name=\"plus\"\n class=\"create-icon\"\n [size]=\"16\"\n />\n\n <span class=\"option-label\">\n @if (createTemplate(); as tpl) {\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n $implicit: query().trim(),\n query: query().trim(),\n }\"\n />\n } @else {\n Create \u00AB{{ query().trim() }}\u00BB\n }\n </span>\n </li>\n }\n </ul>\n\n @if (panelFooterTemplate(); as tpl) {\n <div class=\"panel-footer\">\n <ng-container\n [ngTemplateOutlet]=\"tpl\"\n [ngTemplateOutletContext]=\"{\n count: filteredOptions().length,\n total: allOptions().length,\n query: query(),\n }\"\n />\n </div>\n }\n </div>\n</ng-template>\n", styles: ["@charset \"UTF-8\";:where(:focus-visible){outline:none;box-shadow:var(--ds-control-focus-shadow)}:root[data-focus=ring]{--ds-field-focus-shadow: var(--focus-ring);--ds-field-focus-shadow-error: var(--focus-ring-error)}:root[data-focus=field]{--ds-control-focus-shadow: var(--focus-field);--ds-control-focus-shadow-error: var(--focus-field-error)}:root[data-focus=edge]{--ds-field-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-field-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error);--ds-control-focus-shadow: 0 0 0 var(--border-width-default) var(--primary);--ds-control-focus-shadow-error: 0 0 0 var(--border-width-default) var(--error)}[data-focus=inset]{--ds-field-focus-shadow: var(--focus-ring-inset);--ds-field-focus-shadow-error: var(--focus-ring-inset-error);--ds-control-focus-shadow: var(--focus-ring-inset);--ds-control-focus-shadow-error: var(--focus-ring-inset-error)}:root[data-focus=outline]{--ds-field-focus-shadow: none;--ds-field-focus-shadow-error: none;--ds-control-focus-shadow: none;--ds-control-focus-shadow-error: none}:root[data-focus=outline] :where(:focus-visible){outline:var(--border-width-strong) solid var(--primary);outline-offset:var(--focus-ring-offset)}@media(forced-colors:active){:where(:focus-visible){outline:var(--border-width-strong) solid CanvasText;outline-offset:var(--focus-ring-offset)}}:host{--ds-dropdown-panel-bg-color: var( --ds-autocomplete-panel-bg-color, var(--surface-overlay) );--ds-dropdown-panel-radius: var( --ds-autocomplete-panel-radius, var(--ds-radius-panel) );--ds-dropdown-panel-maxh: var(--ds-autocomplete-panel-maxh, var(--picker-maxh));--_autocomplete-focus-shadow: var(--ds-autocomplete-focus-shadow, var(--ds-field-focus-shadow));--_autocomplete-maxw: var(--ds-autocomplete-maxw, none);--_autocomplete-input-minw: var(--ds-autocomplete-input-minw, 80px);--_autocomplete-bg-color: var(--ds-autocomplete-bg-color, var(--surface-default));--_autocomplete-border-color: var(--ds-autocomplete-border-color, var(--border-default));--_autocomplete-radius: var(--ds-autocomplete-radius, var(--ds-radius-control));--_autocomplete-border-color-focus: var(--ds-autocomplete-border-color-focus, var(--accent));display:flex;flex-direction:column;gap:var(--field-label-gap);width:100%;max-width:var(--_autocomplete-maxw);position:relative}:host(.content-width){--_autocomplete-maxw: var(--ds-autocomplete-maxw, 100%);width:fit-content}.label{--_field-label-font-size: var(--ds-field-label-font-size, var(--font-size-xs));--_field-label-weight: var(--ds-field-label-weight, var(--font-weight-bold));--_field-label-color: var(--ds-field-label-color, var(--text-secondary));--_field-label-transform: var(--ds-field-label-transform, none);--_field-label-tracking: var(--ds-field-label-tracking, normal);display:flex;align-items:center;gap:var(--field-gap-req);font:var(--_field-label-weight) var(--_field-label-font-size)/var(--line-height-base) var(--font-sans);color:var(--_field-label-color);text-transform:var(--_field-label-transform);letter-spacing:var(--_field-label-tracking)}.label .req{color:var(--error);font-weight:var(--font-weight-semibold)}.label .optional-marker{color:var(--text-tertiary);font-weight:var(--font-weight-regular)}.autocomplete-trigger{display:flex;align-items:center;gap:var(--space-2);width:100%;--_field-box-height: var(--ds-field-height, var(--field-h-md));min-height:var(--_field-box-height);padding:var(--space-1) var(--space-2);background:var(--_autocomplete-bg-color);border:var(--border-width-default) solid var(--_autocomplete-border-color);border-radius:var(--_autocomplete-radius);cursor:text;text-align:left;flex-wrap:wrap}.autocomplete-trigger:has(>.chip-row.fit){flex-wrap:nowrap}:host(:not(.value-wraps)) .autocomplete-trigger{flex-wrap:nowrap}.autocomplete-trigger{transition:border-color var(--duration-fast) var(--ease-standard)}.autocomplete-trigger .addon-slot{display:inline-flex;align-items:center;align-self:stretch;color:var(--text-tertiary);flex-shrink:0}.autocomplete-trigger .addon-slot:empty{display:none}.autocomplete-trigger:hover:not(.disabled){border-color:var(--border-strong)}.autocomplete-trigger .autocomplete-input:where(:focus-visible){box-shadow:none}.autocomplete-trigger:focus-within:not(.disabled){border-color:var(--_autocomplete-border-color-focus);box-shadow:var(--_autocomplete-focus-shadow);outline:0}.autocomplete-trigger.disabled{background:var(--surface-disabled);border-color:var(--border-disabled);color:var(--text-disabled);cursor:not-allowed}.autocomplete-trigger.disabled .autocomplete-input{cursor:not-allowed;color:var(--text-disabled)}.autocomplete-trigger.disabled .autocomplete-value,.autocomplete-trigger.disabled .autocomplete-chevron{color:var(--text-disabled)}.autocomplete-trigger.sm{--_field-box-height: var(--ds-field-height, var(--field-h-sm));min-height:var(--_field-box-height)}.autocomplete-trigger.lg{--_field-box-height: var(--ds-field-height, var(--field-h-lg));min-height:var(--_field-box-height)}.chip-row{display:contents}.chip-row.fit{display:flex;flex-wrap:nowrap;align-items:center;min-width:0;overflow:hidden;gap:inherit}.chip-row.fit>*{flex:0 1 auto;min-width:0;white-space:nowrap}.overflow{color:var(--text-secondary);font-weight:var(--font-weight-semibold);font-size:var(--font-size-xs)}.autocomplete-value{font:var(--font-weight-medium) var(--font-size-s)/var(--line-height-flat) var(--font-sans);color:var(--text-primary)}:host(:not(.value-wraps)) .autocomplete-value{min-width:0;overflow:clip;overflow-clip-margin:var(--space-1);text-overflow:ellipsis;white-space:nowrap}.autocomplete-input{flex:1;min-width:var(--_autocomplete-input-minw)}.autocomplete-input.collapsed{flex:0 0 0;min-width:0;width:0;padding:0}.autocomplete-input{border:0;outline:0;background:transparent;font:var(--font-weight-regular) var(--font-size-s)/var(--line-height-flat) var(--font-sans);color:var(--text-primary)}.autocomplete-chevron{color:var(--icon-default);margin-left:auto}.dropdown-panel .option.multi{padding-left:var(--space-2)}.dropdown-panel .check-box{flex:none;display:inline-flex;align-items:center;justify-content:center;width:var(--check-size);height:var(--check-size);border:var(--border-width-strong) solid var(--border-strong);border-radius:var(--ds-radius-inner);color:var(--text-on-primary)}.dropdown-panel .check-box.checked{background-color:var(--accent);border-color:var(--accent)}.dropdown-panel .create-row{color:var(--accent)}.dropdown-panel .create-row .create-icon{flex:0 0 auto}:host(.in-group){width:auto;display:flex}:host(.in-group) .label,:host(.in-group) ds-field-message{display:none}:host(.in-group) .autocomplete-trigger{border:0;border-radius:0;background:transparent;flex:1;height:auto}:host(.in-group) .autocomplete-trigger:hover,:host(.in-group) .autocomplete-trigger:focus,:host(.in-group) .autocomplete-trigger:focus-visible,:host(.in-group) .autocomplete-trigger:focus-within{border:0;box-shadow:none;outline:0}:host([data-field-state=error]:not(.in-group)) .autocomplete-trigger{border-color:var(--error);background-color:var(--error-subtitle)}:host([data-field-state=error]:not(.in-group)) .autocomplete-trigger:focus-within,:host([data-field-state=error]:not(.in-group)) .autocomplete-trigger:focus-visible{box-shadow:var(--ds-field-focus-shadow-error)}:host([data-field-state=warning]:not(.in-group)) .autocomplete-trigger{border-color:var(--warning-text)}:host([data-field-state=success]:not(.in-group)) .autocomplete-trigger{border-color:var(--success)}\n"] }]
|
|
598
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], showChevron: [{ type: i0.Input, args: [{ isSignal: true, alias: "showChevron", required: false }] }], maxVisibleChips: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxVisibleChips", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], valueOverflow: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueOverflow", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], success: [{ type: i0.Input, args: [{ isSignal: true, alias: "success", required: false }] }], allowCreate: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowCreate", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], compareWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "compareWith", required: false }] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], readOnly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readOnly", required: false }] }], readonlyBinding: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], searchPlaceholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchPlaceholder", required: false }] }], filterWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterWith", required: false }] }], filterChange: [{ type: i0.Output, args: ["filterChange"] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], scrollActiveIntoView: [{ type: i0.Input, args: [{ isSignal: true, alias: "scrollActiveIntoView", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], optional: [{ type: i0.Input, args: [{ isSignal: true, alias: "optional", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], create: [{ type: i0.Output, args: ["create"] }], optionTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsOptionTemplateDirective), { ...{
|
|
599
|
+
read: TemplateRef,
|
|
600
|
+
}, isSignal: true }] }], chipTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsChipTemplateDirective), { ...{
|
|
601
|
+
read: TemplateRef,
|
|
602
|
+
}, isSignal: true }] }], pickerTrigger: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsPickerTriggerDirective), { ...{
|
|
603
|
+
read: TemplateRef,
|
|
604
|
+
}, isSignal: true }] }], panelHeaderTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsPanelHeaderTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], panelFooterTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsPanelFooterTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], groupLabelTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsGroupLabelTemplateDirective), { ...{ read: TemplateRef }, isSignal: true }] }], emptyTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsEmptyTemplateDirective), { ...{
|
|
605
|
+
read: TemplateRef,
|
|
606
|
+
}, isSignal: true }] }], createTemplate: [{ type: i0.ContentChild, args: [i0.forwardRef(() => DsCreateTemplateDirective), { ...{
|
|
607
|
+
read: TemplateRef,
|
|
608
|
+
}, isSignal: true }] }], trigger: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], filterInput: [{ type: i0.ViewChild, args: ['filter', { isSignal: true }] }], panelTpl: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], chipRow: [{ type: i0.ViewChild, args: ['chipRow', { isSignal: true }] }] } });
|
|
609
|
+
|
|
610
|
+
/**
|
|
611
|
+
* Generated bundle index. Do not edit.
|
|
612
|
+
*/
|
|
613
|
+
|
|
614
|
+
export { AutocompleteComponent };
|
|
615
|
+
//# sourceMappingURL=ids-group-ltd-ids-design-system-components-autocomplete.mjs.map
|