@weeehaoooz/talos-ui 0.1.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/LICENSE +21 -0
- package/README.md +85 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button-group.mjs +237 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button-group.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button.mjs +93 -0
- package/fesm2022/weeehaoooz-talos-ui-button-button.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-core.mjs +438 -0
- package/fesm2022/weeehaoooz-talos-ui-core.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-badge.mjs +233 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-badge.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-status-tag.mjs +361 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-status-tag.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-timeline.mjs +312 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-timeline.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-trend-indicator.mjs +235 -0
- package/fesm2022/weeehaoooz-talos-ui-data-display-trend-indicator.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-category-bar.mjs +462 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-category-bar.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-heatmap.mjs +805 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-heatmap.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-donut.mjs +267 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-donut.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-gauge.mjs +351 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-mini-gauge.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-sparkline.mjs +566 -0
- package/fesm2022/weeehaoooz-talos-ui-data-viz-sparkline.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-alert.mjs +534 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-alert.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-dialog.mjs +446 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-dialog.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-snackbar.mjs +376 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-snackbar.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-tooltip.mjs +147 -0
- package/fesm2022/weeehaoooz-talos-ui-feedback-tooltip.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-affix.mjs +242 -0
- package/fesm2022/weeehaoooz-talos-ui-form-affix.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-autocomplete.mjs +514 -0
- package/fesm2022/weeehaoooz-talos-ui-form-autocomplete.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-checkbox.mjs +548 -0
- package/fesm2022/weeehaoooz-talos-ui-form-checkbox.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-chips.mjs +692 -0
- package/fesm2022/weeehaoooz-talos-ui-form-chips.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-color-picker.mjs +761 -0
- package/fesm2022/weeehaoooz-talos-ui-form-color-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-picker.mjs +896 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-range-picker.mjs +872 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-range-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-picker.mjs +119 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-range-picker.mjs +135 -0
- package/fesm2022/weeehaoooz-talos-ui-form-date-time-range-picker.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-drop-zone.mjs +666 -0
- package/fesm2022/weeehaoooz-talos-ui-form-drop-zone.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-form-field.mjs +147 -0
- package/fesm2022/weeehaoooz-talos-ui-form-form-field.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-input.mjs +33 -0
- package/fesm2022/weeehaoooz-talos-ui-form-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-otp.mjs +455 -0
- package/fesm2022/weeehaoooz-talos-ui-form-otp.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-password-input.mjs +379 -0
- package/fesm2022/weeehaoooz-talos-ui-form-password-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-radio.mjs +297 -0
- package/fesm2022/weeehaoooz-talos-ui-form-radio.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-range-input.mjs +661 -0
- package/fesm2022/weeehaoooz-talos-ui-form-range-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-rating.mjs +346 -0
- package/fesm2022/weeehaoooz-talos-ui-form-rating.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-select-input.mjs +896 -0
- package/fesm2022/weeehaoooz-talos-ui-form-select-input.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-slide-toggle.mjs +252 -0
- package/fesm2022/weeehaoooz-talos-ui-form-slide-toggle.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-form-transfer-list.mjs +916 -0
- package/fesm2022/weeehaoooz-talos-ui-form-transfer-list.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-layout.mjs +851 -0
- package/fesm2022/weeehaoooz-talos-ui-layout.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui-nav.mjs +897 -0
- package/fesm2022/weeehaoooz-talos-ui-nav.mjs.map +1 -0
- package/fesm2022/weeehaoooz-talos-ui.mjs +17058 -0
- package/fesm2022/weeehaoooz-talos-ui.mjs.map +1 -0
- package/package.json +203 -0
- package/schematics/collection.json +10 -0
- package/schematics/ng-add/index.d.ts +3 -0
- package/schematics/ng-add/index.js +99 -0
- package/schematics/ng-add/schema.d.ts +10 -0
- package/schematics/ng-add/schema.js +2 -0
- package/schematics/ng-add/schema.json +52 -0
- package/styles/_alert.scss +56 -0
- package/styles/_badge.scss +279 -0
- package/styles/_button-group.scss +470 -0
- package/styles/_buttons.scss +442 -0
- package/styles/_card.scss +18 -0
- package/styles/_dialog.scss +116 -0
- package/styles/_drop-zone.scss +19 -0
- package/styles/_form-controls.scss +660 -0
- package/styles/_slide-toggle.scss +171 -0
- package/styles/_status-tag.scss +108 -0
- package/styles/_timeline.scss +19 -0
- package/styles/_tooltip.scss +32 -0
- package/styles/_typography.scss +279 -0
- package/styles/_variables.scss +590 -0
- package/styles/index.scss +15 -0
- package/types/weeehaoooz-talos-ui-button-button-group.d.ts +59 -0
- package/types/weeehaoooz-talos-ui-button-button-group.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-button-button.d.ts +38 -0
- package/types/weeehaoooz-talos-ui-button-button.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-core.d.ts +95 -0
- package/types/weeehaoooz-talos-ui-core.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-badge.d.ts +119 -0
- package/types/weeehaoooz-talos-ui-data-display-badge.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-status-tag.d.ts +135 -0
- package/types/weeehaoooz-talos-ui-data-display-status-tag.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-timeline.d.ts +144 -0
- package/types/weeehaoooz-talos-ui-data-display-timeline.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-display-trend-indicator.d.ts +83 -0
- package/types/weeehaoooz-talos-ui-data-display-trend-indicator.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-category-bar.d.ts +255 -0
- package/types/weeehaoooz-talos-ui-data-viz-category-bar.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-heatmap.d.ts +204 -0
- package/types/weeehaoooz-talos-ui-data-viz-heatmap.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-donut.d.ts +101 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-donut.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-gauge.d.ts +138 -0
- package/types/weeehaoooz-talos-ui-data-viz-mini-gauge.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-data-viz-sparkline.d.ts +161 -0
- package/types/weeehaoooz-talos-ui-data-viz-sparkline.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-alert.d.ts +212 -0
- package/types/weeehaoooz-talos-ui-feedback-alert.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-dialog.d.ts +259 -0
- package/types/weeehaoooz-talos-ui-feedback-dialog.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-snackbar.d.ts +147 -0
- package/types/weeehaoooz-talos-ui-feedback-snackbar.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-feedback-tooltip.d.ts +32 -0
- package/types/weeehaoooz-talos-ui-feedback-tooltip.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-affix.d.ts +88 -0
- package/types/weeehaoooz-talos-ui-form-affix.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-autocomplete.d.ts +113 -0
- package/types/weeehaoooz-talos-ui-form-autocomplete.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-checkbox.d.ts +165 -0
- package/types/weeehaoooz-talos-ui-form-checkbox.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-chips.d.ts +152 -0
- package/types/weeehaoooz-talos-ui-form-chips.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-color-picker.d.ts +144 -0
- package/types/weeehaoooz-talos-ui-form-color-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-picker.d.ts +138 -0
- package/types/weeehaoooz-talos-ui-form-date-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-range-picker.d.ts +148 -0
- package/types/weeehaoooz-talos-ui-form-date-range-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-time-picker.d.ts +44 -0
- package/types/weeehaoooz-talos-ui-form-date-time-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-date-time-range-picker.d.ts +48 -0
- package/types/weeehaoooz-talos-ui-form-date-time-range-picker.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-drop-zone.d.ts +227 -0
- package/types/weeehaoooz-talos-ui-form-drop-zone.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-form-field.d.ts +42 -0
- package/types/weeehaoooz-talos-ui-form-form-field.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-input.d.ts +15 -0
- package/types/weeehaoooz-talos-ui-form-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-otp.d.ts +111 -0
- package/types/weeehaoooz-talos-ui-form-otp.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-password-input.d.ts +145 -0
- package/types/weeehaoooz-talos-ui-form-password-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-radio.d.ts +84 -0
- package/types/weeehaoooz-talos-ui-form-radio.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-range-input.d.ts +181 -0
- package/types/weeehaoooz-talos-ui-form-range-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-rating.d.ts +110 -0
- package/types/weeehaoooz-talos-ui-form-rating.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-select-input.d.ts +195 -0
- package/types/weeehaoooz-talos-ui-form-select-input.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-slide-toggle.d.ts +79 -0
- package/types/weeehaoooz-talos-ui-form-slide-toggle.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-form-transfer-list.d.ts +192 -0
- package/types/weeehaoooz-talos-ui-form-transfer-list.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-layout.d.ts +286 -0
- package/types/weeehaoooz-talos-ui-layout.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui-nav.d.ts +384 -0
- package/types/weeehaoooz-talos-ui-nav.d.ts.map +1 -0
- package/types/weeehaoooz-talos-ui.d.ts +5050 -0
- package/types/weeehaoooz-talos-ui.d.ts.map +1 -0
|
@@ -0,0 +1,514 @@
|
|
|
1
|
+
import * as i0 from '@angular/core';
|
|
2
|
+
import { inject, ElementRef, input, output, computed, signal, effect, forwardRef, ViewChild, Component, NgModule } from '@angular/core';
|
|
3
|
+
import { NG_VALUE_ACCESSOR } from '@angular/forms';
|
|
4
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
5
|
+
|
|
6
|
+
let uniqueAutocompleteIdCounter = 0;
|
|
7
|
+
class TalosAutocompleteComponent {
|
|
8
|
+
elementRef = inject((ElementRef));
|
|
9
|
+
// Signal Inputs
|
|
10
|
+
options = input([], /* @ts-ignore */
|
|
11
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
12
|
+
label = input('', /* @ts-ignore */
|
|
13
|
+
...(ngDevMode ? [{ debugName: "label" }] : /* istanbul ignore next */ []));
|
|
14
|
+
floatingLabel = input(false, /* @ts-ignore */
|
|
15
|
+
...(ngDevMode ? [{ debugName: "floatingLabel" }] : /* istanbul ignore next */ []));
|
|
16
|
+
floating = input(false, /* @ts-ignore */
|
|
17
|
+
...(ngDevMode ? [{ debugName: "floating" }] : /* istanbul ignore next */ []));
|
|
18
|
+
required = input(false, /* @ts-ignore */
|
|
19
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
20
|
+
searching = input(false, /* @ts-ignore */
|
|
21
|
+
...(ngDevMode ? [{ debugName: "searching" }] : /* istanbul ignore next */ []));
|
|
22
|
+
loading = input(false, /* @ts-ignore */
|
|
23
|
+
...(ngDevMode ? [{ debugName: "loading" }] : /* istanbul ignore next */ []));
|
|
24
|
+
placeholder = input('Search...', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
26
|
+
disabled = input(false, /* @ts-ignore */
|
|
27
|
+
...(ngDevMode ? [{ debugName: "disabled" }] : /* istanbul ignore next */ []));
|
|
28
|
+
clearable = input(true, /* @ts-ignore */
|
|
29
|
+
...(ngDevMode ? [{ debugName: "clearable" }] : /* istanbul ignore next */ []));
|
|
30
|
+
size = input('sm', /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
32
|
+
minChars = input(0, /* @ts-ignore */
|
|
33
|
+
...(ngDevMode ? [{ debugName: "minChars" }] : /* istanbul ignore next */ []));
|
|
34
|
+
displayWith = input(null, /* @ts-ignore */
|
|
35
|
+
...(ngDevMode ? [{ debugName: "displayWith" }] : /* istanbul ignore next */ []));
|
|
36
|
+
valueWith = input(null, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "valueWith" }] : /* istanbul ignore next */ []));
|
|
38
|
+
filterFn = input(undefined, /* @ts-ignore */
|
|
39
|
+
...(ngDevMode ? [{ debugName: "filterFn" }] : /* istanbul ignore next */ []));
|
|
40
|
+
highlightMatch = input(true, /* @ts-ignore */
|
|
41
|
+
...(ngDevMode ? [{ debugName: "highlightMatch" }] : /* istanbul ignore next */ []));
|
|
42
|
+
noResultsText = input('No matching results', /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "noResultsText" }] : /* istanbul ignore next */ []));
|
|
44
|
+
searchingText = input('Searching...', /* @ts-ignore */
|
|
45
|
+
...(ngDevMode ? [{ debugName: "searchingText" }] : /* istanbul ignore next */ []));
|
|
46
|
+
itemTemplate = input(null, /* @ts-ignore */
|
|
47
|
+
...(ngDevMode ? [{ debugName: "itemTemplate" }] : /* istanbul ignore next */ []));
|
|
48
|
+
openOnFocus = input(true, /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "openOnFocus" }] : /* istanbul ignore next */ []));
|
|
50
|
+
id = input('', /* @ts-ignore */
|
|
51
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
52
|
+
// Signal Outputs
|
|
53
|
+
searchChange = output();
|
|
54
|
+
selectionChange = output();
|
|
55
|
+
opened = output();
|
|
56
|
+
closed = output();
|
|
57
|
+
cleared = output();
|
|
58
|
+
// View Children
|
|
59
|
+
inputEl;
|
|
60
|
+
dropdownEl;
|
|
61
|
+
// Component IDs for ARIA attributes
|
|
62
|
+
autoId = `talos-autocomplete-${uniqueAutocompleteIdCounter++}`;
|
|
63
|
+
componentId = computed(() => this.id() || this.autoId, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "componentId" }] : /* istanbul ignore next */ []));
|
|
65
|
+
inputId = computed(() => `${this.componentId()}-input`, /* @ts-ignore */
|
|
66
|
+
...(ngDevMode ? [{ debugName: "inputId" }] : /* istanbul ignore next */ []));
|
|
67
|
+
listboxId = computed(() => `${this.componentId()}-listbox`, /* @ts-ignore */
|
|
68
|
+
...(ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []));
|
|
69
|
+
// Internal Reactive State
|
|
70
|
+
inputValue = signal('', /* @ts-ignore */
|
|
71
|
+
...(ngDevMode ? [{ debugName: "inputValue" }] : /* istanbul ignore next */ []));
|
|
72
|
+
selectedItem = signal(null, /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "selectedItem" }] : /* istanbul ignore next */ []));
|
|
74
|
+
isOpen = signal(false, /* @ts-ignore */
|
|
75
|
+
...(ngDevMode ? [{ debugName: "isOpen" }] : /* istanbul ignore next */ []));
|
|
76
|
+
isFocused = signal(false, /* @ts-ignore */
|
|
77
|
+
...(ngDevMode ? [{ debugName: "isFocused" }] : /* istanbul ignore next */ []));
|
|
78
|
+
focusedIndex = signal(-1, /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "focusedIndex" }] : /* istanbul ignore next */ []));
|
|
80
|
+
isCvaDisabled = signal(false, /* @ts-ignore */
|
|
81
|
+
...(ngDevMode ? [{ debugName: "isCvaDisabled" }] : /* istanbul ignore next */ []));
|
|
82
|
+
isTouched = signal(false, /* @ts-ignore */
|
|
83
|
+
...(ngDevMode ? [{ debugName: "isTouched" }] : /* istanbul ignore next */ []));
|
|
84
|
+
// Computed state
|
|
85
|
+
isFloatingMode = computed(() => this.floatingLabel() || this.floating(), /* @ts-ignore */
|
|
86
|
+
...(ngDevMode ? [{ debugName: "isFloatingMode" }] : /* istanbul ignore next */ []));
|
|
87
|
+
isFloated = computed(() => {
|
|
88
|
+
if (!this.isFloatingMode())
|
|
89
|
+
return false;
|
|
90
|
+
return this.isOpen() || this.isFocused() || !!this.inputValue() || !!this.selectedItem();
|
|
91
|
+
}, /* @ts-ignore */
|
|
92
|
+
...(ngDevMode ? [{ debugName: "isFloated" }] : /* istanbul ignore next */ []));
|
|
93
|
+
effectiveDisabled = computed(() => this.disabled() || this.isCvaDisabled(), /* @ts-ignore */
|
|
94
|
+
...(ngDevMode ? [{ debugName: "effectiveDisabled" }] : /* istanbul ignore next */ []));
|
|
95
|
+
effectiveSearching = computed(() => this.searching() || this.loading(), /* @ts-ignore */
|
|
96
|
+
...(ngDevMode ? [{ debugName: "effectiveSearching" }] : /* istanbul ignore next */ []));
|
|
97
|
+
// Formatted and Filtered Options
|
|
98
|
+
formattedOptions = computed(() => {
|
|
99
|
+
const rawOptions = this.options() || [];
|
|
100
|
+
const query = this.inputValue().trim();
|
|
101
|
+
const minCharCount = this.minChars();
|
|
102
|
+
const customFilter = this.filterFn();
|
|
103
|
+
const isHighlight = this.highlightMatch();
|
|
104
|
+
// If query is below minChars threshold, return empty
|
|
105
|
+
if (query.length < minCharCount) {
|
|
106
|
+
return [];
|
|
107
|
+
}
|
|
108
|
+
// Filter raw items
|
|
109
|
+
let filteredList;
|
|
110
|
+
if (customFilter === null) {
|
|
111
|
+
// Bypasses internal filtering (user controls search results completely, e.g. remote API)
|
|
112
|
+
filteredList = [...rawOptions];
|
|
113
|
+
}
|
|
114
|
+
else if (typeof customFilter === 'function') {
|
|
115
|
+
filteredList = rawOptions.filter((item) => customFilter(item, query));
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
// Default label text filtering
|
|
119
|
+
if (!query) {
|
|
120
|
+
filteredList = [...rawOptions];
|
|
121
|
+
}
|
|
122
|
+
else {
|
|
123
|
+
const lowerQuery = query.toLowerCase();
|
|
124
|
+
filteredList = rawOptions.filter((item) => {
|
|
125
|
+
const label = this.getDisplayLabel(item);
|
|
126
|
+
return label.toLowerCase().includes(lowerQuery);
|
|
127
|
+
});
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
// Map to formatted structure with highlight parts
|
|
131
|
+
return filteredList.map((item, index) => {
|
|
132
|
+
const label = this.getDisplayLabel(item);
|
|
133
|
+
const val = this.extractValue(item);
|
|
134
|
+
const parts = isHighlight && query ? this.computeHighlightParts(label, query) : [{ text: label, isMatch: false }];
|
|
135
|
+
return {
|
|
136
|
+
id: `${this.componentId()}-opt-${index}`,
|
|
137
|
+
label,
|
|
138
|
+
value: val,
|
|
139
|
+
raw: item,
|
|
140
|
+
highlightParts: parts
|
|
141
|
+
};
|
|
142
|
+
});
|
|
143
|
+
}, /* @ts-ignore */
|
|
144
|
+
...(ngDevMode ? [{ debugName: "formattedOptions" }] : /* istanbul ignore next */ []));
|
|
145
|
+
activeOptionId = computed(() => {
|
|
146
|
+
const index = this.focusedIndex();
|
|
147
|
+
const options = this.formattedOptions();
|
|
148
|
+
if (index >= 0 && index < options.length) {
|
|
149
|
+
return options[index].id;
|
|
150
|
+
}
|
|
151
|
+
return undefined;
|
|
152
|
+
}, /* @ts-ignore */
|
|
153
|
+
...(ngDevMode ? [{ debugName: "activeOptionId" }] : /* istanbul ignore next */ []));
|
|
154
|
+
// ControlValueAccessor Callbacks
|
|
155
|
+
onChange = () => { };
|
|
156
|
+
onTouched = () => { };
|
|
157
|
+
constructor() {
|
|
158
|
+
// Reset focused index when formatted options change
|
|
159
|
+
effect(() => {
|
|
160
|
+
this.formattedOptions();
|
|
161
|
+
this.focusedIndex.set(-1);
|
|
162
|
+
});
|
|
163
|
+
}
|
|
164
|
+
// Label & Value Helpers
|
|
165
|
+
getDisplayLabel(item) {
|
|
166
|
+
if (item === null || item === undefined) {
|
|
167
|
+
return '';
|
|
168
|
+
}
|
|
169
|
+
if (typeof item === 'string' || typeof item === 'number') {
|
|
170
|
+
return String(item);
|
|
171
|
+
}
|
|
172
|
+
const displayWithFn = this.displayWith();
|
|
173
|
+
if (typeof displayWithFn === 'function') {
|
|
174
|
+
return displayWithFn(item);
|
|
175
|
+
}
|
|
176
|
+
if (typeof displayWithFn === 'string' && item && typeof item === 'object' && displayWithFn in item) {
|
|
177
|
+
return String(item[displayWithFn] ?? '');
|
|
178
|
+
}
|
|
179
|
+
if (item && typeof item === 'object') {
|
|
180
|
+
const record = item;
|
|
181
|
+
if ('label' in record)
|
|
182
|
+
return String(record['label'] ?? '');
|
|
183
|
+
if ('name' in record)
|
|
184
|
+
return String(record['name'] ?? '');
|
|
185
|
+
if ('title' in record)
|
|
186
|
+
return String(record['title'] ?? '');
|
|
187
|
+
if ('text' in record)
|
|
188
|
+
return String(record['text'] ?? '');
|
|
189
|
+
}
|
|
190
|
+
return String(item);
|
|
191
|
+
}
|
|
192
|
+
extractValue(item) {
|
|
193
|
+
if (item === null || item === undefined) {
|
|
194
|
+
return null;
|
|
195
|
+
}
|
|
196
|
+
const valueWithFn = this.valueWith();
|
|
197
|
+
if (typeof valueWithFn === 'function') {
|
|
198
|
+
return valueWithFn(item);
|
|
199
|
+
}
|
|
200
|
+
if (typeof valueWithFn === 'string' && item && typeof item === 'object' && valueWithFn in item) {
|
|
201
|
+
return item[valueWithFn];
|
|
202
|
+
}
|
|
203
|
+
if (item && typeof item === 'object') {
|
|
204
|
+
const record = item;
|
|
205
|
+
if ('value' in record)
|
|
206
|
+
return record['value'];
|
|
207
|
+
if ('id' in record)
|
|
208
|
+
return record['id'];
|
|
209
|
+
if ('key' in record)
|
|
210
|
+
return record['key'];
|
|
211
|
+
}
|
|
212
|
+
return item;
|
|
213
|
+
}
|
|
214
|
+
computeHighlightParts(text, query) {
|
|
215
|
+
if (!text || !query) {
|
|
216
|
+
return [{ text, isMatch: false }];
|
|
217
|
+
}
|
|
218
|
+
const parts = [];
|
|
219
|
+
const lowerText = text.toLowerCase();
|
|
220
|
+
const lowerQuery = query.toLowerCase();
|
|
221
|
+
let startIndex = 0;
|
|
222
|
+
while (startIndex < text.length) {
|
|
223
|
+
const matchIndex = lowerText.indexOf(lowerQuery, startIndex);
|
|
224
|
+
if (matchIndex === -1) {
|
|
225
|
+
parts.push({ text: text.substring(startIndex), isMatch: false });
|
|
226
|
+
break;
|
|
227
|
+
}
|
|
228
|
+
if (matchIndex > startIndex) {
|
|
229
|
+
parts.push({ text: text.substring(startIndex, matchIndex), isMatch: false });
|
|
230
|
+
}
|
|
231
|
+
const matchEnd = matchIndex + query.length;
|
|
232
|
+
parts.push({ text: text.substring(matchIndex, matchEnd), isMatch: true });
|
|
233
|
+
startIndex = matchEnd;
|
|
234
|
+
}
|
|
235
|
+
return parts;
|
|
236
|
+
}
|
|
237
|
+
// Input & Event Handlers
|
|
238
|
+
onInput(event) {
|
|
239
|
+
if (this.effectiveDisabled())
|
|
240
|
+
return;
|
|
241
|
+
const value = event.target.value;
|
|
242
|
+
this.inputValue.set(value);
|
|
243
|
+
// If typing doesn't match selected item label, clear selected reference
|
|
244
|
+
if (this.selectedItem()) {
|
|
245
|
+
const currentLabel = this.getDisplayLabel(this.selectedItem());
|
|
246
|
+
if (value !== currentLabel) {
|
|
247
|
+
this.selectedItem.set(null);
|
|
248
|
+
this.onChange(null);
|
|
249
|
+
this.selectionChange.emit(null);
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
if (!this.isOpen() && value.length >= this.minChars()) {
|
|
253
|
+
this.openDropdown();
|
|
254
|
+
}
|
|
255
|
+
this.searchChange.emit(value);
|
|
256
|
+
}
|
|
257
|
+
onFocus() {
|
|
258
|
+
this.isFocused.set(true);
|
|
259
|
+
if (this.effectiveDisabled())
|
|
260
|
+
return;
|
|
261
|
+
if (this.openOnFocus() && this.inputValue().length >= this.minChars()) {
|
|
262
|
+
this.openDropdown();
|
|
263
|
+
}
|
|
264
|
+
}
|
|
265
|
+
onBlur() {
|
|
266
|
+
this.isFocused.set(false);
|
|
267
|
+
this.markAsTouched();
|
|
268
|
+
}
|
|
269
|
+
onInputClick() {
|
|
270
|
+
if (this.effectiveDisabled())
|
|
271
|
+
return;
|
|
272
|
+
if (!this.isOpen() && this.inputValue().length >= this.minChars()) {
|
|
273
|
+
this.openDropdown();
|
|
274
|
+
}
|
|
275
|
+
}
|
|
276
|
+
onTriggerClick() {
|
|
277
|
+
if (this.effectiveDisabled())
|
|
278
|
+
return;
|
|
279
|
+
if (this.isOpen()) {
|
|
280
|
+
this.closeDropdown();
|
|
281
|
+
}
|
|
282
|
+
else {
|
|
283
|
+
this.openDropdown();
|
|
284
|
+
this.inputEl?.nativeElement.focus();
|
|
285
|
+
}
|
|
286
|
+
}
|
|
287
|
+
onClear(event) {
|
|
288
|
+
event.stopPropagation();
|
|
289
|
+
event.preventDefault();
|
|
290
|
+
if (this.effectiveDisabled())
|
|
291
|
+
return;
|
|
292
|
+
this.inputValue.set('');
|
|
293
|
+
this.selectedItem.set(null);
|
|
294
|
+
this.focusedIndex.set(-1);
|
|
295
|
+
this.onChange(null);
|
|
296
|
+
this.selectionChange.emit(null);
|
|
297
|
+
this.searchChange.emit('');
|
|
298
|
+
this.cleared.emit();
|
|
299
|
+
if (this.inputEl) {
|
|
300
|
+
this.inputEl.nativeElement.value = '';
|
|
301
|
+
this.inputEl.nativeElement.focus();
|
|
302
|
+
}
|
|
303
|
+
if (this.minChars() > 0) {
|
|
304
|
+
this.closeDropdown();
|
|
305
|
+
}
|
|
306
|
+
}
|
|
307
|
+
selectOption(opt, event) {
|
|
308
|
+
if (event) {
|
|
309
|
+
event.preventDefault();
|
|
310
|
+
event.stopPropagation();
|
|
311
|
+
}
|
|
312
|
+
this.selectedItem.set(opt.raw);
|
|
313
|
+
this.inputValue.set(opt.label);
|
|
314
|
+
if (this.inputEl) {
|
|
315
|
+
this.inputEl.nativeElement.value = opt.label;
|
|
316
|
+
}
|
|
317
|
+
this.onChange(opt.value);
|
|
318
|
+
this.selectionChange.emit(opt.raw);
|
|
319
|
+
this.closeDropdown();
|
|
320
|
+
}
|
|
321
|
+
onKeyDown(event) {
|
|
322
|
+
if (this.effectiveDisabled())
|
|
323
|
+
return;
|
|
324
|
+
const options = this.formattedOptions();
|
|
325
|
+
const optionCount = options.length;
|
|
326
|
+
switch (event.key) {
|
|
327
|
+
case 'ArrowDown': {
|
|
328
|
+
event.preventDefault();
|
|
329
|
+
if (!this.isOpen()) {
|
|
330
|
+
this.openDropdown();
|
|
331
|
+
this.focusedIndex.set(0);
|
|
332
|
+
}
|
|
333
|
+
else if (optionCount > 0) {
|
|
334
|
+
const nextIndex = (this.focusedIndex() + 1) % optionCount;
|
|
335
|
+
this.focusedIndex.set(nextIndex);
|
|
336
|
+
this.scrollToFocusedOption(nextIndex);
|
|
337
|
+
}
|
|
338
|
+
break;
|
|
339
|
+
}
|
|
340
|
+
case 'ArrowUp': {
|
|
341
|
+
event.preventDefault();
|
|
342
|
+
if (!this.isOpen()) {
|
|
343
|
+
this.openDropdown();
|
|
344
|
+
this.focusedIndex.set(optionCount - 1);
|
|
345
|
+
}
|
|
346
|
+
else if (optionCount > 0) {
|
|
347
|
+
const prevIndex = this.focusedIndex() <= 0 ? optionCount - 1 : this.focusedIndex() - 1;
|
|
348
|
+
this.focusedIndex.set(prevIndex);
|
|
349
|
+
this.scrollToFocusedOption(prevIndex);
|
|
350
|
+
}
|
|
351
|
+
break;
|
|
352
|
+
}
|
|
353
|
+
case 'Enter': {
|
|
354
|
+
if (this.isOpen() && this.focusedIndex() >= 0 && this.focusedIndex() < optionCount) {
|
|
355
|
+
event.preventDefault();
|
|
356
|
+
this.selectOption(options[this.focusedIndex()]);
|
|
357
|
+
}
|
|
358
|
+
break;
|
|
359
|
+
}
|
|
360
|
+
case 'Escape': {
|
|
361
|
+
if (this.isOpen()) {
|
|
362
|
+
event.preventDefault();
|
|
363
|
+
this.closeDropdown();
|
|
364
|
+
}
|
|
365
|
+
break;
|
|
366
|
+
}
|
|
367
|
+
case 'Tab': {
|
|
368
|
+
if (this.isOpen()) {
|
|
369
|
+
this.closeDropdown();
|
|
370
|
+
}
|
|
371
|
+
break;
|
|
372
|
+
}
|
|
373
|
+
}
|
|
374
|
+
}
|
|
375
|
+
scrollToFocusedOption(index) {
|
|
376
|
+
if (!this.dropdownEl)
|
|
377
|
+
return;
|
|
378
|
+
const optionEls = this.dropdownEl.nativeElement.querySelectorAll('.autocomplete-option');
|
|
379
|
+
if (optionEls[index] && typeof optionEls[index].scrollIntoView === 'function') {
|
|
380
|
+
optionEls[index].scrollIntoView({ block: 'nearest' });
|
|
381
|
+
}
|
|
382
|
+
}
|
|
383
|
+
openDropdown() {
|
|
384
|
+
if (this.effectiveDisabled() || this.isOpen())
|
|
385
|
+
return;
|
|
386
|
+
this.isOpen.set(true);
|
|
387
|
+
this.opened.emit();
|
|
388
|
+
}
|
|
389
|
+
closeDropdown() {
|
|
390
|
+
if (!this.isOpen())
|
|
391
|
+
return;
|
|
392
|
+
this.isOpen.set(false);
|
|
393
|
+
this.focusedIndex.set(-1);
|
|
394
|
+
this.closed.emit();
|
|
395
|
+
}
|
|
396
|
+
onDocumentClick(event) {
|
|
397
|
+
const target = event.target;
|
|
398
|
+
if (!this.elementRef.nativeElement.contains(target)) {
|
|
399
|
+
this.closeDropdown();
|
|
400
|
+
}
|
|
401
|
+
}
|
|
402
|
+
markAsTouched() {
|
|
403
|
+
if (!this.isTouched()) {
|
|
404
|
+
this.isTouched.set(true);
|
|
405
|
+
this.onTouched();
|
|
406
|
+
}
|
|
407
|
+
}
|
|
408
|
+
// ControlValueAccessor Implementation
|
|
409
|
+
writeValue(value) {
|
|
410
|
+
if (value === null || value === undefined || value === '') {
|
|
411
|
+
this.selectedItem.set(null);
|
|
412
|
+
this.inputValue.set('');
|
|
413
|
+
if (this.inputEl) {
|
|
414
|
+
this.inputEl.nativeElement.value = '';
|
|
415
|
+
}
|
|
416
|
+
return;
|
|
417
|
+
}
|
|
418
|
+
// Try matching among options
|
|
419
|
+
const rawOptions = this.options() || [];
|
|
420
|
+
const matched = rawOptions.find((opt) => {
|
|
421
|
+
const extracted = this.extractValue(opt);
|
|
422
|
+
return extracted === value || opt === value;
|
|
423
|
+
});
|
|
424
|
+
if (matched !== undefined) {
|
|
425
|
+
this.selectedItem.set(matched);
|
|
426
|
+
const label = this.getDisplayLabel(matched);
|
|
427
|
+
this.inputValue.set(label);
|
|
428
|
+
if (this.inputEl) {
|
|
429
|
+
this.inputEl.nativeElement.value = label;
|
|
430
|
+
}
|
|
431
|
+
}
|
|
432
|
+
else {
|
|
433
|
+
// If primitive string value provided directly
|
|
434
|
+
if (typeof value === 'string' || typeof value === 'number') {
|
|
435
|
+
this.selectedItem.set(value);
|
|
436
|
+
this.inputValue.set(String(value));
|
|
437
|
+
if (this.inputEl) {
|
|
438
|
+
this.inputEl.nativeElement.value = String(value);
|
|
439
|
+
}
|
|
440
|
+
}
|
|
441
|
+
}
|
|
442
|
+
}
|
|
443
|
+
registerOnChange(fn) {
|
|
444
|
+
this.onChange = fn;
|
|
445
|
+
}
|
|
446
|
+
registerOnTouched(fn) {
|
|
447
|
+
this.onTouched = fn;
|
|
448
|
+
}
|
|
449
|
+
setDisabledState(isDisabled) {
|
|
450
|
+
this.isCvaDisabled.set(isDisabled);
|
|
451
|
+
if (isDisabled) {
|
|
452
|
+
this.closeDropdown();
|
|
453
|
+
}
|
|
454
|
+
}
|
|
455
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosAutocompleteComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
456
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.1", type: TalosAutocompleteComponent, isStandalone: true, selector: "talos-autocomplete", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, floatingLabel: { classPropertyName: "floatingLabel", publicName: "floatingLabel", isSignal: true, isRequired: false, transformFunction: null }, floating: { classPropertyName: "floating", publicName: "floating", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, searching: { classPropertyName: "searching", publicName: "searching", isSignal: true, isRequired: false, transformFunction: null }, loading: { classPropertyName: "loading", publicName: "loading", 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 }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, minChars: { classPropertyName: "minChars", publicName: "minChars", isSignal: true, isRequired: false, transformFunction: null }, displayWith: { classPropertyName: "displayWith", publicName: "displayWith", isSignal: true, isRequired: false, transformFunction: null }, valueWith: { classPropertyName: "valueWith", publicName: "valueWith", isSignal: true, isRequired: false, transformFunction: null }, filterFn: { classPropertyName: "filterFn", publicName: "filterFn", isSignal: true, isRequired: false, transformFunction: null }, highlightMatch: { classPropertyName: "highlightMatch", publicName: "highlightMatch", isSignal: true, isRequired: false, transformFunction: null }, noResultsText: { classPropertyName: "noResultsText", publicName: "noResultsText", isSignal: true, isRequired: false, transformFunction: null }, searchingText: { classPropertyName: "searchingText", publicName: "searchingText", isSignal: true, isRequired: false, transformFunction: null }, itemTemplate: { classPropertyName: "itemTemplate", publicName: "itemTemplate", isSignal: true, isRequired: false, transformFunction: null }, openOnFocus: { classPropertyName: "openOnFocus", publicName: "openOnFocus", isSignal: true, isRequired: false, transformFunction: null }, id: { classPropertyName: "id", publicName: "id", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { searchChange: "searchChange", selectionChange: "selectionChange", opened: "opened", closed: "closed", cleared: "cleared" }, host: { listeners: { "document:click": "onDocumentClick($event)" }, properties: { "class.is-open": "isOpen()", "class.is-disabled": "effectiveDisabled()", "class.is-searching": "effectiveSearching()", "class.has-label": "!!label()", "class.is-floating": "isFloatingMode()", "class.is-floated": "isFloated()", "class.autocomplete-sm": "size() === \"sm\"", "class.autocomplete-md": "size() === \"md\"", "class.autocomplete-lg": "size() === \"lg\"" }, classAttribute: "talos-autocomplete-host" }, providers: [
|
|
457
|
+
{
|
|
458
|
+
provide: NG_VALUE_ACCESSOR,
|
|
459
|
+
useExisting: forwardRef(() => TalosAutocompleteComponent),
|
|
460
|
+
multi: true
|
|
461
|
+
}
|
|
462
|
+
], viewQueries: [{ propertyName: "inputEl", first: true, predicate: ["inputEl"], descendants: true }, { propertyName: "dropdownEl", first: true, predicate: ["dropdownEl"], descendants: true }], ngImport: i0, template: "@if (label() && !isFloatingMode()) {\n <label class=\"talos-field-label\" [attr.for]=\"inputId()\" (click)=\"onTriggerClick()\">\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n}\n\n<div class=\"autocomplete-wrapper\" [class.has-floating-label]=\"isFloatingMode()\">\n <!-- Autocomplete Input Container -->\n <div class=\"autocomplete-control\" [class.is-focused]=\"isOpen()\">\n <!-- Leading Search Icon -->\n <span class=\"autocomplete-icon leading-icon\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n </svg>\n </span>\n\n <!-- Editable Input Field -->\n <input\n #inputEl\n type=\"text\"\n class=\"autocomplete-input\"\n [id]=\"inputId()\"\n [placeholder]=\"isFloatingMode() && !isFloated() ? '' : placeholder()\"\n [value]=\"inputValue()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (click)=\"onInputClick()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeOptionId()\"\n [attr.aria-disabled]=\"effectiveDisabled()\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n\n @if (label() && isFloatingMode()) {\n <label\n class=\"talos-floating-label\"\n [class.is-floated]=\"isFloated()\"\n [attr.for]=\"inputId()\"\n (click)=\"onTriggerClick()\"\n >\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n\n <!-- Trailing Actions Container -->\n <div class=\"autocomplete-actions\">\n <!-- Searching Spinner -->\n @if (effectiveSearching()) {\n <span class=\"autocomplete-spinner\" aria-label=\"Searching...\" title=\"Searching...\">\n <svg class=\"spinner-svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n </span>\n }\n\n <!-- Clear Selection / Text Button -->\n @if (clearable() && inputValue() && !effectiveDisabled() && !effectiveSearching()) {\n <button\n type=\"button\"\n class=\"autocomplete-clear-btn\"\n aria-label=\"Clear search\"\n title=\"Clear search\"\n (click)=\"onClear($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n }\n\n <!-- Dropdown Arrow Indicator -->\n <button\n type=\"button\"\n class=\"autocomplete-arrow-btn\"\n [class.is-open]=\"isOpen()\"\n [disabled]=\"effectiveDisabled()\"\n aria-label=\"Toggle options\"\n tabindex=\"-1\"\n (click)=\"onTriggerClick()\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n </button>\n </div>\n</div>\n\n<!-- Dropdown Panel -->\n@if (isOpen()) {\n <div #dropdownEl class=\"autocomplete-dropdown-panel\" [id]=\"listboxId()\" role=\"listbox\">\n <!-- Searching State inside Dropdown -->\n @if (effectiveSearching()) {\n <div class=\"autocomplete-searching-state\" aria-live=\"polite\">\n <span class=\"dropdown-spinner\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n </span>\n <span class=\"searching-text\">{{ searchingText() }}</span>\n </div>\n }\n\n <!-- Options List -->\n <div class=\"autocomplete-options-list\">\n @for (opt of formattedOptions(); track opt.id; let idx = $index) {\n <div\n class=\"autocomplete-option\"\n [id]=\"opt.id\"\n role=\"option\"\n [attr.aria-selected]=\"selectedItem() === opt.raw\"\n [class.is-focused]=\"focusedIndex() === idx\"\n [class.is-selected]=\"selectedItem() === opt.raw\"\n (mousedown)=\"selectOption(opt, $event)\"\n >\n @if (itemTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate()!; context: {\n $implicit: opt.raw,\n index: idx,\n selected: selectedItem() === opt.raw,\n active: focusedIndex() === idx,\n highlightParts: opt.highlightParts\n }\"\n ></ng-container>\n } @else {\n <div class=\"option-default-content\">\n @if (highlightMatch() && opt.highlightParts.length > 0) {\n <span class=\"option-label\">\n @for (part of opt.highlightParts; track $index) {\n @if (part.isMatch) {\n <mark class=\"highlight-match\">{{ part.text }}</mark>\n } @else {\n <span>{{ part.text }}</span>\n }\n }\n </span>\n } @else {\n <span class=\"option-label\">{{ opt.label }}</span>\n }\n </div>\n }\n </div>\n }\n\n <!-- No Results State -->\n @if (!effectiveSearching() && formattedOptions().length === 0) {\n <div class=\"autocomplete-no-options\" role=\"status\">\n <svg class=\"no-options-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n <line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line>\n </svg>\n <span>{{ noResultsText() }}</span>\n </div>\n }\n </div>\n </div>\n}\n</div>\n", styles: [":host{display:inline-block;position:relative;width:100%;box-sizing:border-box;font-family:inherit;--auto-bg: var(--talos-card-bg, var(--card-bg, #ffffff));--auto-border: var(--talos-border-color, var(--border-color, #cbd5e1));--auto-border-hover: var(--talos-border-hover, var(--border-hover, #64748b));--auto-border-focus: var(--talos-border-focus, var(--border-focus, #2563eb));--auto-shadow-focus: var(--talos-focus-ring, var(--focus-ring, 0 0 0 3px rgba(37, 99, 235, .15)));--auto-color: var(--talos-text-color, var(--text-color, #0f172a));--auto-muted: var(--talos-text-muted, var(--text-muted, #64748b));--auto-placeholder-color: #94a3b8;--auto-radius: var(--talos-border-radius, var(--border-radius, .375rem));--auto-primary: var(--talos-primary-color, var(--primary-color, #2563eb));--auto-primary-light: var(--talos-primary-light, var(--primary-light, #eff6ff));--auto-primary-light-hover: var(--talos-primary-light-hover, var(--primary-light-hover, #dbeafe));--auto-height: var(--talos-control-height, var(--control-height, 2.25rem));--auto-padding-x: var(--talos-control-padding-x, var(--control-padding-x, .625rem));--auto-font-size: var(--talos-control-font-size, var(--control-font-size, .8125rem));--auto-icon-size: 1rem;--talos-affix-btn-size: var(--talos-affix-btn-size-md, 1.5rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-md, .875rem);--auto-dropdown-bg: var(--talos-dropdown-bg, var(--talos-card-bg, var(--card-bg, #ffffff)));--auto-dropdown-border: var(--talos-dropdown-border, var(--talos-border-color, #e2e8f0));--auto-dropdown-shadow: var(--talos-dropdown-shadow, 0 10px 25px -5px rgba(0, 0, 0, .08), 0 4px 6px -2px rgba(0, 0, 0, .04))}:host.autocomplete-sm{--auto-height: 2rem;--auto-padding-x: .5rem;--auto-font-size: .8125rem;--auto-radius: .25rem;--auto-icon-size: .875rem;--talos-affix-btn-size: var(--talos-affix-btn-size-sm, 1.375rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-sm, .8125rem)}:host.autocomplete-md{--auto-height: 2.25rem;--auto-padding-x: .625rem;--auto-font-size: .8125rem;--auto-radius: .375rem;--auto-icon-size: 1rem;--talos-affix-btn-size: var(--talos-affix-btn-size-md, 1.5rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-md, .875rem)}:host.autocomplete-lg{--auto-height: 2.625rem;--auto-padding-x: .75rem;--auto-font-size: .875rem;--auto-radius: .375rem;--auto-icon-size: 1.125rem;--talos-affix-btn-size: var(--talos-affix-btn-size-lg, 1.75rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-lg, 1rem)}:host.is-disabled{opacity:.6;pointer-events:none}:host.is-disabled .autocomplete-control{background-color:var(--talos-input-disabled-bg, var(--talos-bg-color, var(--bg-color, #f8fafc)));border-color:var(--talos-input-disabled-border, #e2e8f0);cursor:not-allowed}:host.is-disabled .autocomplete-input{color:var(--talos-input-disabled-color, #94a3b8);cursor:not-allowed}.talos-field-label{display:inline-flex;align-items:center;font-size:var(--talos-control-font-size, .8125rem);font-weight:600;color:var(--talos-text-color, #0f172a);margin-bottom:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none;transition:color .15s ease}.talos-field-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.25rem}.autocomplete-wrapper{position:relative;width:100%;display:flex;flex-direction:column}.talos-floating-label{position:absolute;left:calc(var(--auto-padding-x, .625rem) + var(--auto-icon-size, 1rem) + .5rem);top:calc(var(--auto-height) / 2);transform:translateY(-50%);font-size:var(--auto-font-size, .8125rem);font-weight:500;color:var(--auto-placeholder-color, #94a3b8);pointer-events:none;-webkit-user-select:none;user-select:none;background-color:var(--auto-bg, #ffffff);padding:0 .25rem;border-radius:.25rem;line-height:1;z-index:2;transition:transform .18s cubic-bezier(.4,0,.2,1),font-size .18s cubic-bezier(.4,0,.2,1),color .18s cubic-bezier(.4,0,.2,1),top .18s cubic-bezier(.4,0,.2,1),left .18s cubic-bezier(.4,0,.2,1)}.talos-floating-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.25rem}.talos-floating-label.is-floated{top:0;left:var(--auto-padding-x, .625rem);transform:translateY(-50%) scale(.85);font-size:.75rem;font-weight:600;color:var(--auto-muted, #64748b)}:host(.is-open) .talos-floating-label.is-floated,:host(.is-focused) .talos-floating-label.is-floated{color:var(--auto-primary, #2563eb)}.autocomplete-control{display:flex;align-items:center;position:relative;width:100%;height:var(--auto-height);min-height:var(--auto-height);padding:0 var(--auto-padding-x);background-color:var(--auto-bg);border:1px solid var(--auto-border);border-radius:var(--auto-radius);transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease;box-sizing:border-box;gap:.375rem}.autocomplete-control:hover:not(.is-disabled){border-color:var(--auto-border-hover)}.autocomplete-control:focus-within,.autocomplete-control.is-focused{border-color:var(--auto-border-focus);box-shadow:var(--auto-shadow-focus)}:host(.is-open) .autocomplete-control{border-color:var(--auto-border-focus);box-shadow:var(--auto-shadow-focus)}.autocomplete-icon.leading-icon{display:flex;align-items:center;justify-content:center;color:var(--auto-muted);flex-shrink:0;pointer-events:none}.autocomplete-icon.leading-icon svg{width:var(--auto-icon-size);height:var(--auto-icon-size)}.autocomplete-input{flex:1;min-width:0;height:100%;border:none;background:transparent;padding:0;margin:0;font-family:inherit;font-size:var(--auto-font-size);color:var(--auto-color);line-height:1.25rem;outline:none}.autocomplete-input::placeholder{color:var(--auto-placeholder-color);opacity:1}.autocomplete-actions{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.autocomplete-spinner{display:flex;align-items:center;justify-content:center;color:var(--auto-primary)}.autocomplete-spinner .spinner-svg{width:var(--auto-icon-size);height:var(--auto-icon-size);animation:talos-spinner-rotate .75s linear infinite}.autocomplete-spinner .spinner-track{color:var(--auto-muted)}.autocomplete-spinner .spinner-head{color:var(--auto-primary)}.autocomplete-clear-btn{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--talos-affix-btn-size, 1.5rem);height:var(--talos-affix-btn-size, 1.5rem);min-width:var(--talos-affix-btn-size, 1.5rem);padding:0;background:transparent;border:none;outline:none;border-radius:var(--talos-affix-btn-radius, var(--talos-radius-sm, .25rem));color:var(--talos-affix-btn-color, var(--talos-text-muted, #94a3b8));cursor:pointer;flex-shrink:0;transition:color .15s ease,background-color .15s ease,box-shadow .15s ease}.autocomplete-clear-btn:hover{color:var(--talos-error-color, #ef4444);background-color:#ef444426}.autocomplete-clear-btn:focus-visible{box-shadow:var(--talos-focus-ring, 0 0 0 2px rgba(37, 99, 235, .25))}.autocomplete-clear-btn svg{width:var(--talos-affix-btn-icon-size, .875rem);height:var(--talos-affix-btn-icon-size, .875rem)}.autocomplete-arrow-btn{display:flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;padding:0;border:none;background:transparent;color:var(--talos-text-muted, #64748b);cursor:pointer;outline:none;transition:transform .2s cubic-bezier(.4,0,.2,1),color .15s ease}.autocomplete-arrow-btn svg{width:.875rem;height:.875rem}.autocomplete-arrow-btn.is-open{transform:rotate(180deg);color:var(--auto-primary)}.autocomplete-arrow-btn:hover:not(:disabled){color:var(--auto-color)}.autocomplete-dropdown-panel{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background-color:var(--auto-dropdown-bg);border:1px solid var(--auto-dropdown-border);border-radius:var(--auto-radius);box-shadow:var(--auto-dropdown-shadow);padding:.25rem 0;box-sizing:border-box;max-height:280px;overflow-y:auto;animation:talos-dropdown-fade .15s cubic-bezier(0,0,.2,1)}.autocomplete-dropdown-panel::-webkit-scrollbar{width:5px}.autocomplete-dropdown-panel::-webkit-scrollbar-track{background:transparent}.autocomplete-dropdown-panel::-webkit-scrollbar-thumb{background:var(--talos-border-color, #cbd5e1);border-radius:4px}.autocomplete-dropdown-panel::-webkit-scrollbar-thumb:hover{background:var(--talos-border-hover, #94a3b8)}.autocomplete-searching-state{display:flex;align-items:center;gap:.5rem;padding:.625rem .875rem;font-size:var(--auto-font-size);color:var(--auto-muted);background-color:var(--auto-primary-light);border-bottom:1px solid var(--talos-border-color, #dbeafe);margin-bottom:.25rem}.autocomplete-searching-state .dropdown-spinner{display:flex;align-items:center;color:var(--auto-primary)}.autocomplete-searching-state .dropdown-spinner svg{width:.9375rem;height:.9375rem;animation:talos-spinner-rotate .75s linear infinite}.autocomplete-searching-state .searching-text{font-weight:500;color:var(--auto-primary)}.autocomplete-options-list{display:flex;flex-direction:column}.autocomplete-option{display:flex;align-items:center;padding:.5rem var(--auto-padding-x);font-size:var(--auto-font-size);color:var(--auto-color);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color .12s ease,color .12s ease;line-height:1.25rem}.autocomplete-option:hover,.autocomplete-option.is-focused{background-color:var(--auto-primary-light);color:var(--auto-primary)}.autocomplete-option.is-selected{background-color:var(--auto-primary-light-hover);color:var(--auto-primary);font-weight:600}.autocomplete-option .option-default-content{display:flex;align-items:center;width:100%}.autocomplete-option .option-label{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.autocomplete-option mark.highlight-match{background-color:#2563eb24;color:var(--auto-primary);font-weight:700;padding:0 .125rem;border-radius:.125rem}.autocomplete-no-options{display:flex;align-items:center;justify-content:center;gap:.5rem;padding:1.25rem .875rem;font-size:var(--auto-font-size);color:var(--auto-muted);text-align:center}.autocomplete-no-options .no-options-icon{width:1rem;height:1rem;opacity:.7}@keyframes talos-spinner-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes talos-dropdown-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
463
|
+
}
|
|
464
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosAutocompleteComponent, decorators: [{
|
|
465
|
+
type: Component,
|
|
466
|
+
args: [{ selector: 'talos-autocomplete', imports: [NgTemplateOutlet], providers: [
|
|
467
|
+
{
|
|
468
|
+
provide: NG_VALUE_ACCESSOR,
|
|
469
|
+
useExisting: forwardRef(() => TalosAutocompleteComponent),
|
|
470
|
+
multi: true
|
|
471
|
+
}
|
|
472
|
+
], host: {
|
|
473
|
+
'class': 'talos-autocomplete-host',
|
|
474
|
+
'[class.is-open]': 'isOpen()',
|
|
475
|
+
'[class.is-disabled]': 'effectiveDisabled()',
|
|
476
|
+
'[class.is-searching]': 'effectiveSearching()',
|
|
477
|
+
'[class.has-label]': '!!label()',
|
|
478
|
+
'[class.is-floating]': 'isFloatingMode()',
|
|
479
|
+
'[class.is-floated]': 'isFloated()',
|
|
480
|
+
'[class.autocomplete-sm]': 'size() === "sm"',
|
|
481
|
+
'[class.autocomplete-md]': 'size() === "md"',
|
|
482
|
+
'[class.autocomplete-lg]': 'size() === "lg"',
|
|
483
|
+
'(document:click)': 'onDocumentClick($event)'
|
|
484
|
+
}, template: "@if (label() && !isFloatingMode()) {\n <label class=\"talos-field-label\" [attr.for]=\"inputId()\" (click)=\"onTriggerClick()\">\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n}\n\n<div class=\"autocomplete-wrapper\" [class.has-floating-label]=\"isFloatingMode()\">\n <!-- Autocomplete Input Container -->\n <div class=\"autocomplete-control\" [class.is-focused]=\"isOpen()\">\n <!-- Leading Search Icon -->\n <span class=\"autocomplete-icon leading-icon\" aria-hidden=\"true\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n </svg>\n </span>\n\n <!-- Editable Input Field -->\n <input\n #inputEl\n type=\"text\"\n class=\"autocomplete-input\"\n [id]=\"inputId()\"\n [placeholder]=\"isFloatingMode() && !isFloated() ? '' : placeholder()\"\n [value]=\"inputValue()\"\n [disabled]=\"effectiveDisabled()\"\n (input)=\"onInput($event)\"\n (focus)=\"onFocus()\"\n (blur)=\"onBlur()\"\n (click)=\"onInputClick()\"\n (keydown)=\"onKeyDown($event)\"\n role=\"combobox\"\n aria-autocomplete=\"list\"\n [attr.aria-expanded]=\"isOpen()\"\n [attr.aria-haspopup]=\"'listbox'\"\n [attr.aria-controls]=\"listboxId()\"\n [attr.aria-activedescendant]=\"activeOptionId()\"\n [attr.aria-disabled]=\"effectiveDisabled()\"\n autocomplete=\"off\"\n autocapitalize=\"off\"\n spellcheck=\"false\"\n />\n\n @if (label() && isFloatingMode()) {\n <label\n class=\"talos-floating-label\"\n [class.is-floated]=\"isFloated()\"\n [attr.for]=\"inputId()\"\n (click)=\"onTriggerClick()\"\n >\n {{ label() }}\n @if (required()) {\n <span class=\"required-star\" aria-hidden=\"true\">*</span>\n }\n </label>\n }\n\n <!-- Trailing Actions Container -->\n <div class=\"autocomplete-actions\">\n <!-- Searching Spinner -->\n @if (effectiveSearching()) {\n <span class=\"autocomplete-spinner\" aria-label=\"Searching...\" title=\"Searching...\">\n <svg class=\"spinner-svg\" viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n </span>\n }\n\n <!-- Clear Selection / Text Button -->\n @if (clearable() && inputValue() && !effectiveDisabled() && !effectiveSearching()) {\n <button\n type=\"button\"\n class=\"autocomplete-clear-btn\"\n aria-label=\"Clear search\"\n title=\"Clear search\"\n (click)=\"onClear($event)\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <line x1=\"18\" y1=\"6\" x2=\"6\" y2=\"18\"></line>\n <line x1=\"6\" y1=\"6\" x2=\"18\" y2=\"18\"></line>\n </svg>\n </button>\n }\n\n <!-- Dropdown Arrow Indicator -->\n <button\n type=\"button\"\n class=\"autocomplete-arrow-btn\"\n [class.is-open]=\"isOpen()\"\n [disabled]=\"effectiveDisabled()\"\n aria-label=\"Toggle options\"\n tabindex=\"-1\"\n (click)=\"onTriggerClick()\"\n >\n <svg viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <polyline points=\"6 9 12 15 18 9\"></polyline>\n </svg>\n </button>\n </div>\n</div>\n\n<!-- Dropdown Panel -->\n@if (isOpen()) {\n <div #dropdownEl class=\"autocomplete-dropdown-panel\" [id]=\"listboxId()\" role=\"listbox\">\n <!-- Searching State inside Dropdown -->\n @if (effectiveSearching()) {\n <div class=\"autocomplete-searching-state\" aria-live=\"polite\">\n <span class=\"dropdown-spinner\">\n <svg viewBox=\"0 0 24 24\" fill=\"none\" aria-hidden=\"true\">\n <circle class=\"spinner-track\" cx=\"12\" cy=\"12\" r=\"9\" stroke=\"currentColor\" stroke-width=\"2.5\" opacity=\"0.25\"></circle>\n <path class=\"spinner-head\" d=\"M12 3a9 9 0 0 1 9 9\" stroke=\"currentColor\" stroke-width=\"2.5\" stroke-linecap=\"round\"></path>\n </svg>\n </span>\n <span class=\"searching-text\">{{ searchingText() }}</span>\n </div>\n }\n\n <!-- Options List -->\n <div class=\"autocomplete-options-list\">\n @for (opt of formattedOptions(); track opt.id; let idx = $index) {\n <div\n class=\"autocomplete-option\"\n [id]=\"opt.id\"\n role=\"option\"\n [attr.aria-selected]=\"selectedItem() === opt.raw\"\n [class.is-focused]=\"focusedIndex() === idx\"\n [class.is-selected]=\"selectedItem() === opt.raw\"\n (mousedown)=\"selectOption(opt, $event)\"\n >\n @if (itemTemplate()) {\n <ng-container\n *ngTemplateOutlet=\"itemTemplate()!; context: {\n $implicit: opt.raw,\n index: idx,\n selected: selectedItem() === opt.raw,\n active: focusedIndex() === idx,\n highlightParts: opt.highlightParts\n }\"\n ></ng-container>\n } @else {\n <div class=\"option-default-content\">\n @if (highlightMatch() && opt.highlightParts.length > 0) {\n <span class=\"option-label\">\n @for (part of opt.highlightParts; track $index) {\n @if (part.isMatch) {\n <mark class=\"highlight-match\">{{ part.text }}</mark>\n } @else {\n <span>{{ part.text }}</span>\n }\n }\n </span>\n } @else {\n <span class=\"option-label\">{{ opt.label }}</span>\n }\n </div>\n }\n </div>\n }\n\n <!-- No Results State -->\n @if (!effectiveSearching() && formattedOptions().length === 0) {\n <div class=\"autocomplete-no-options\" role=\"status\">\n <svg class=\"no-options-icon\" viewBox=\"0 0 24 24\" fill=\"none\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" aria-hidden=\"true\">\n <circle cx=\"11\" cy=\"11\" r=\"8\"></circle>\n <line x1=\"21\" y1=\"21\" x2=\"16.65\" y2=\"16.65\"></line>\n <line x1=\"8\" y1=\"11\" x2=\"14\" y2=\"11\"></line>\n </svg>\n <span>{{ noResultsText() }}</span>\n </div>\n }\n </div>\n </div>\n}\n</div>\n", styles: [":host{display:inline-block;position:relative;width:100%;box-sizing:border-box;font-family:inherit;--auto-bg: var(--talos-card-bg, var(--card-bg, #ffffff));--auto-border: var(--talos-border-color, var(--border-color, #cbd5e1));--auto-border-hover: var(--talos-border-hover, var(--border-hover, #64748b));--auto-border-focus: var(--talos-border-focus, var(--border-focus, #2563eb));--auto-shadow-focus: var(--talos-focus-ring, var(--focus-ring, 0 0 0 3px rgba(37, 99, 235, .15)));--auto-color: var(--talos-text-color, var(--text-color, #0f172a));--auto-muted: var(--talos-text-muted, var(--text-muted, #64748b));--auto-placeholder-color: #94a3b8;--auto-radius: var(--talos-border-radius, var(--border-radius, .375rem));--auto-primary: var(--talos-primary-color, var(--primary-color, #2563eb));--auto-primary-light: var(--talos-primary-light, var(--primary-light, #eff6ff));--auto-primary-light-hover: var(--talos-primary-light-hover, var(--primary-light-hover, #dbeafe));--auto-height: var(--talos-control-height, var(--control-height, 2.25rem));--auto-padding-x: var(--talos-control-padding-x, var(--control-padding-x, .625rem));--auto-font-size: var(--talos-control-font-size, var(--control-font-size, .8125rem));--auto-icon-size: 1rem;--talos-affix-btn-size: var(--talos-affix-btn-size-md, 1.5rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-md, .875rem);--auto-dropdown-bg: var(--talos-dropdown-bg, var(--talos-card-bg, var(--card-bg, #ffffff)));--auto-dropdown-border: var(--talos-dropdown-border, var(--talos-border-color, #e2e8f0));--auto-dropdown-shadow: var(--talos-dropdown-shadow, 0 10px 25px -5px rgba(0, 0, 0, .08), 0 4px 6px -2px rgba(0, 0, 0, .04))}:host.autocomplete-sm{--auto-height: 2rem;--auto-padding-x: .5rem;--auto-font-size: .8125rem;--auto-radius: .25rem;--auto-icon-size: .875rem;--talos-affix-btn-size: var(--talos-affix-btn-size-sm, 1.375rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-sm, .8125rem)}:host.autocomplete-md{--auto-height: 2.25rem;--auto-padding-x: .625rem;--auto-font-size: .8125rem;--auto-radius: .375rem;--auto-icon-size: 1rem;--talos-affix-btn-size: var(--talos-affix-btn-size-md, 1.5rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-md, .875rem)}:host.autocomplete-lg{--auto-height: 2.625rem;--auto-padding-x: .75rem;--auto-font-size: .875rem;--auto-radius: .375rem;--auto-icon-size: 1.125rem;--talos-affix-btn-size: var(--talos-affix-btn-size-lg, 1.75rem);--talos-affix-btn-icon-size: var(--talos-affix-btn-icon-size-lg, 1rem)}:host.is-disabled{opacity:.6;pointer-events:none}:host.is-disabled .autocomplete-control{background-color:var(--talos-input-disabled-bg, var(--talos-bg-color, var(--bg-color, #f8fafc)));border-color:var(--talos-input-disabled-border, #e2e8f0);cursor:not-allowed}:host.is-disabled .autocomplete-input{color:var(--talos-input-disabled-color, #94a3b8);cursor:not-allowed}.talos-field-label{display:inline-flex;align-items:center;font-size:var(--talos-control-font-size, .8125rem);font-weight:600;color:var(--talos-text-color, #0f172a);margin-bottom:.375rem;cursor:pointer;-webkit-user-select:none;user-select:none;transition:color .15s ease}.talos-field-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.25rem}.autocomplete-wrapper{position:relative;width:100%;display:flex;flex-direction:column}.talos-floating-label{position:absolute;left:calc(var(--auto-padding-x, .625rem) + var(--auto-icon-size, 1rem) + .5rem);top:calc(var(--auto-height) / 2);transform:translateY(-50%);font-size:var(--auto-font-size, .8125rem);font-weight:500;color:var(--auto-placeholder-color, #94a3b8);pointer-events:none;-webkit-user-select:none;user-select:none;background-color:var(--auto-bg, #ffffff);padding:0 .25rem;border-radius:.25rem;line-height:1;z-index:2;transition:transform .18s cubic-bezier(.4,0,.2,1),font-size .18s cubic-bezier(.4,0,.2,1),color .18s cubic-bezier(.4,0,.2,1),top .18s cubic-bezier(.4,0,.2,1),left .18s cubic-bezier(.4,0,.2,1)}.talos-floating-label .required-star{color:var(--talos-error-color, #ef4444);margin-left:.25rem}.talos-floating-label.is-floated{top:0;left:var(--auto-padding-x, .625rem);transform:translateY(-50%) scale(.85);font-size:.75rem;font-weight:600;color:var(--auto-muted, #64748b)}:host(.is-open) .talos-floating-label.is-floated,:host(.is-focused) .talos-floating-label.is-floated{color:var(--auto-primary, #2563eb)}.autocomplete-control{display:flex;align-items:center;position:relative;width:100%;height:var(--auto-height);min-height:var(--auto-height);padding:0 var(--auto-padding-x);background-color:var(--auto-bg);border:1px solid var(--auto-border);border-radius:var(--auto-radius);transition:border-color .15s ease,box-shadow .15s ease,background-color .15s ease;box-sizing:border-box;gap:.375rem}.autocomplete-control:hover:not(.is-disabled){border-color:var(--auto-border-hover)}.autocomplete-control:focus-within,.autocomplete-control.is-focused{border-color:var(--auto-border-focus);box-shadow:var(--auto-shadow-focus)}:host(.is-open) .autocomplete-control{border-color:var(--auto-border-focus);box-shadow:var(--auto-shadow-focus)}.autocomplete-icon.leading-icon{display:flex;align-items:center;justify-content:center;color:var(--auto-muted);flex-shrink:0;pointer-events:none}.autocomplete-icon.leading-icon svg{width:var(--auto-icon-size);height:var(--auto-icon-size)}.autocomplete-input{flex:1;min-width:0;height:100%;border:none;background:transparent;padding:0;margin:0;font-family:inherit;font-size:var(--auto-font-size);color:var(--auto-color);line-height:1.25rem;outline:none}.autocomplete-input::placeholder{color:var(--auto-placeholder-color);opacity:1}.autocomplete-actions{display:flex;align-items:center;gap:.25rem;flex-shrink:0}.autocomplete-spinner{display:flex;align-items:center;justify-content:center;color:var(--auto-primary)}.autocomplete-spinner .spinner-svg{width:var(--auto-icon-size);height:var(--auto-icon-size);animation:talos-spinner-rotate .75s linear infinite}.autocomplete-spinner .spinner-track{color:var(--auto-muted)}.autocomplete-spinner .spinner-head{color:var(--auto-primary)}.autocomplete-clear-btn{display:inline-flex;align-items:center;justify-content:center;box-sizing:border-box;width:var(--talos-affix-btn-size, 1.5rem);height:var(--talos-affix-btn-size, 1.5rem);min-width:var(--talos-affix-btn-size, 1.5rem);padding:0;background:transparent;border:none;outline:none;border-radius:var(--talos-affix-btn-radius, var(--talos-radius-sm, .25rem));color:var(--talos-affix-btn-color, var(--talos-text-muted, #94a3b8));cursor:pointer;flex-shrink:0;transition:color .15s ease,background-color .15s ease,box-shadow .15s ease}.autocomplete-clear-btn:hover{color:var(--talos-error-color, #ef4444);background-color:#ef444426}.autocomplete-clear-btn:focus-visible{box-shadow:var(--talos-focus-ring, 0 0 0 2px rgba(37, 99, 235, .25))}.autocomplete-clear-btn svg{width:var(--talos-affix-btn-icon-size, .875rem);height:var(--talos-affix-btn-icon-size, .875rem)}.autocomplete-arrow-btn{display:flex;align-items:center;justify-content:center;width:1.125rem;height:1.125rem;padding:0;border:none;background:transparent;color:var(--talos-text-muted, #64748b);cursor:pointer;outline:none;transition:transform .2s cubic-bezier(.4,0,.2,1),color .15s ease}.autocomplete-arrow-btn svg{width:.875rem;height:.875rem}.autocomplete-arrow-btn.is-open{transform:rotate(180deg);color:var(--auto-primary)}.autocomplete-arrow-btn:hover:not(:disabled){color:var(--auto-color)}.autocomplete-dropdown-panel{position:absolute;top:calc(100% + 4px);left:0;right:0;z-index:1000;background-color:var(--auto-dropdown-bg);border:1px solid var(--auto-dropdown-border);border-radius:var(--auto-radius);box-shadow:var(--auto-dropdown-shadow);padding:.25rem 0;box-sizing:border-box;max-height:280px;overflow-y:auto;animation:talos-dropdown-fade .15s cubic-bezier(0,0,.2,1)}.autocomplete-dropdown-panel::-webkit-scrollbar{width:5px}.autocomplete-dropdown-panel::-webkit-scrollbar-track{background:transparent}.autocomplete-dropdown-panel::-webkit-scrollbar-thumb{background:var(--talos-border-color, #cbd5e1);border-radius:4px}.autocomplete-dropdown-panel::-webkit-scrollbar-thumb:hover{background:var(--talos-border-hover, #94a3b8)}.autocomplete-searching-state{display:flex;align-items:center;gap:.5rem;padding:.625rem .875rem;font-size:var(--auto-font-size);color:var(--auto-muted);background-color:var(--auto-primary-light);border-bottom:1px solid var(--talos-border-color, #dbeafe);margin-bottom:.25rem}.autocomplete-searching-state .dropdown-spinner{display:flex;align-items:center;color:var(--auto-primary)}.autocomplete-searching-state .dropdown-spinner svg{width:.9375rem;height:.9375rem;animation:talos-spinner-rotate .75s linear infinite}.autocomplete-searching-state .searching-text{font-weight:500;color:var(--auto-primary)}.autocomplete-options-list{display:flex;flex-direction:column}.autocomplete-option{display:flex;align-items:center;padding:.5rem var(--auto-padding-x);font-size:var(--auto-font-size);color:var(--auto-color);cursor:pointer;-webkit-user-select:none;user-select:none;transition:background-color .12s ease,color .12s ease;line-height:1.25rem}.autocomplete-option:hover,.autocomplete-option.is-focused{background-color:var(--auto-primary-light);color:var(--auto-primary)}.autocomplete-option.is-selected{background-color:var(--auto-primary-light-hover);color:var(--auto-primary);font-weight:600}.autocomplete-option .option-default-content{display:flex;align-items:center;width:100%}.autocomplete-option .option-label{flex:1;min-width:0;white-space:nowrap;overflow:hidden;text-overflow:ellipsis}.autocomplete-option mark.highlight-match{background-color:#2563eb24;color:var(--auto-primary);font-weight:700;padding:0 .125rem;border-radius:.125rem}.autocomplete-no-options{display:flex;align-items:center;justify-content:center;gap:.5rem;padding:1.25rem .875rem;font-size:var(--auto-font-size);color:var(--auto-muted);text-align:center}.autocomplete-no-options .no-options-icon{width:1rem;height:1rem;opacity:.7}@keyframes talos-spinner-rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}@keyframes talos-dropdown-fade{0%{opacity:0;transform:translateY(-4px)}to{opacity:1;transform:translateY(0)}}\n"] }]
|
|
485
|
+
}], ctorParameters: () => [], propDecorators: { options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], floatingLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "floatingLabel", required: false }] }], floating: [{ type: i0.Input, args: [{ isSignal: true, alias: "floating", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }], searching: [{ type: i0.Input, args: [{ isSignal: true, alias: "searching", required: false }] }], loading: [{ type: i0.Input, args: [{ isSignal: true, alias: "loading", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], minChars: [{ type: i0.Input, args: [{ isSignal: true, alias: "minChars", required: false }] }], displayWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayWith", required: false }] }], valueWith: [{ type: i0.Input, args: [{ isSignal: true, alias: "valueWith", required: false }] }], filterFn: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterFn", required: false }] }], highlightMatch: [{ type: i0.Input, args: [{ isSignal: true, alias: "highlightMatch", required: false }] }], noResultsText: [{ type: i0.Input, args: [{ isSignal: true, alias: "noResultsText", required: false }] }], searchingText: [{ type: i0.Input, args: [{ isSignal: true, alias: "searchingText", required: false }] }], itemTemplate: [{ type: i0.Input, args: [{ isSignal: true, alias: "itemTemplate", required: false }] }], openOnFocus: [{ type: i0.Input, args: [{ isSignal: true, alias: "openOnFocus", required: false }] }], id: [{ type: i0.Input, args: [{ isSignal: true, alias: "id", required: false }] }], searchChange: [{ type: i0.Output, args: ["searchChange"] }], selectionChange: [{ type: i0.Output, args: ["selectionChange"] }], opened: [{ type: i0.Output, args: ["opened"] }], closed: [{ type: i0.Output, args: ["closed"] }], cleared: [{ type: i0.Output, args: ["cleared"] }], inputEl: [{
|
|
486
|
+
type: ViewChild,
|
|
487
|
+
args: ['inputEl']
|
|
488
|
+
}], dropdownEl: [{
|
|
489
|
+
type: ViewChild,
|
|
490
|
+
args: ['dropdownEl']
|
|
491
|
+
}] } });
|
|
492
|
+
|
|
493
|
+
/**
|
|
494
|
+
* Convenience NgModule wrapping the standalone TalosAutocompleteComponent.
|
|
495
|
+
*/
|
|
496
|
+
class TalosAutocompleteModule {
|
|
497
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosAutocompleteModule, deps: [], target: i0.ɵɵFactoryTarget.NgModule });
|
|
498
|
+
static ɵmod = i0.ɵɵngDeclareNgModule({ minVersion: "14.0.0", version: "22.1.1", ngImport: i0, type: TalosAutocompleteModule, imports: [TalosAutocompleteComponent], exports: [TalosAutocompleteComponent] });
|
|
499
|
+
static ɵinj = i0.ɵɵngDeclareInjector({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosAutocompleteModule });
|
|
500
|
+
}
|
|
501
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.1", ngImport: i0, type: TalosAutocompleteModule, decorators: [{
|
|
502
|
+
type: NgModule,
|
|
503
|
+
args: [{
|
|
504
|
+
imports: [TalosAutocompleteComponent],
|
|
505
|
+
exports: [TalosAutocompleteComponent]
|
|
506
|
+
}]
|
|
507
|
+
}] });
|
|
508
|
+
|
|
509
|
+
/**
|
|
510
|
+
* Generated bundle index. Do not edit.
|
|
511
|
+
*/
|
|
512
|
+
|
|
513
|
+
export { TalosAutocompleteComponent, TalosAutocompleteModule };
|
|
514
|
+
//# sourceMappingURL=weeehaoooz-talos-ui-form-autocomplete.mjs.map
|