@cdevhub/ngx-tw 0.2.0 → 0.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +264 -49
- package/fesm2022/cdevhub-ngx-tw-accordion.mjs +11 -7
- package/fesm2022/cdevhub-ngx-tw-accordion.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-alert.mjs +43 -29
- package/fesm2022/cdevhub-ngx-tw-alert.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-aspect-ratio.mjs +103 -0
- package/fesm2022/cdevhub-ngx-tw-aspect-ratio.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-avatar.mjs +56 -31
- package/fesm2022/cdevhub-ngx-tw-avatar.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-badge.mjs +61 -35
- package/fesm2022/cdevhub-ngx-tw-badge.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs +154 -93
- package/fesm2022/cdevhub-ngx-tw-breadcrumbs.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-button.mjs +35 -22
- package/fesm2022/cdevhub-ngx-tw-button.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs +3 -3
- package/fesm2022/cdevhub-ngx-tw-calendar-luxon.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-calendar.mjs +416 -216
- package/fesm2022/cdevhub-ngx-tw-calendar.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-card.mjs +33 -24
- package/fesm2022/cdevhub-ngx-tw-card.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-carousel.mjs +152 -81
- package/fesm2022/cdevhub-ngx-tw-carousel.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-checkbox.mjs +99 -47
- package/fesm2022/cdevhub-ngx-tw-checkbox.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-code-block.mjs +42 -29
- package/fesm2022/cdevhub-ngx-tw-code-block.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-collapsible.mjs +46 -29
- package/fesm2022/cdevhub-ngx-tw-collapsible.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-combobox.mjs +205 -110
- package/fesm2022/cdevhub-ngx-tw-combobox.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-command-palette.mjs +141 -74
- package/fesm2022/cdevhub-ngx-tw-command-palette.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-core.mjs +16 -11
- package/fesm2022/cdevhub-ngx-tw-core.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-date-picker.mjs +395 -149
- package/fesm2022/cdevhub-ngx-tw-date-picker.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs +305 -150
- package/fesm2022/cdevhub-ngx-tw-date-range-picker.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs +56 -43
- package/fesm2022/cdevhub-ngx-tw-dialog.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-empty-state.mjs +51 -33
- package/fesm2022/cdevhub-ngx-tw-empty-state.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-file-upload.mjs +905 -0
- package/fesm2022/cdevhub-ngx-tw-file-upload.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-flip-card.mjs +49 -26
- package/fesm2022/cdevhub-ngx-tw-flip-card.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-form-field.mjs +133 -74
- package/fesm2022/cdevhub-ngx-tw-form-field.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs +2 -2
- package/fesm2022/cdevhub-ngx-tw-icon-lucide.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-icon.mjs +28 -17
- package/fesm2022/cdevhub-ngx-tw-icon.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-input.mjs +37 -21
- package/fesm2022/cdevhub-ngx-tw-input.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-item.mjs +33 -24
- package/fesm2022/cdevhub-ngx-tw-item.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-menu.mjs +63 -48
- package/fesm2022/cdevhub-ngx-tw-menu.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-number-input.mjs +622 -0
- package/fesm2022/cdevhub-ngx-tw-number-input.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-paginator.mjs +142 -72
- package/fesm2022/cdevhub-ngx-tw-paginator.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-popover.mjs +101 -46
- package/fesm2022/cdevhub-ngx-tw-popover.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs +57 -30
- package/fesm2022/cdevhub-ngx-tw-progress-bar.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-radio.mjs +108 -57
- package/fesm2022/cdevhub-ngx-tw-radio.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs +46 -26
- package/fesm2022/cdevhub-ngx-tw-segmented-control.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-select.mjs +227 -122
- package/fesm2022/cdevhub-ngx-tw-select.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-separator.mjs +21 -12
- package/fesm2022/cdevhub-ngx-tw-separator.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs +58 -44
- package/fesm2022/cdevhub-ngx-tw-sheet.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-skeleton.mjs +25 -14
- package/fesm2022/cdevhub-ngx-tw-skeleton.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-slider.mjs +155 -79
- package/fesm2022/cdevhub-ngx-tw-slider.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-sort.mjs +47 -25
- package/fesm2022/cdevhub-ngx-tw-sort.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-spinner.mjs +29 -16
- package/fesm2022/cdevhub-ngx-tw-spinner.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-split.mjs +72 -42
- package/fesm2022/cdevhub-ngx-tw-split.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-stat.mjs +107 -64
- package/fesm2022/cdevhub-ngx-tw-stat.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-stepper.mjs +113 -47
- package/fesm2022/cdevhub-ngx-tw-stepper.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-switch.mjs +61 -32
- package/fesm2022/cdevhub-ngx-tw-switch.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs +88 -42
- package/fesm2022/cdevhub-ngx-tw-tab-nav.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-table.mjs +266 -118
- package/fesm2022/cdevhub-ngx-tw-table.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-tabs.mjs +102 -52
- package/fesm2022/cdevhub-ngx-tw-tabs.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-tags-input.mjs +798 -0
- package/fesm2022/cdevhub-ngx-tw-tags-input.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-textarea.mjs +16 -8
- package/fesm2022/cdevhub-ngx-tw-textarea.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-theme.mjs +22 -14
- package/fesm2022/cdevhub-ngx-tw-theme.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-time-picker.mjs +243 -95
- package/fesm2022/cdevhub-ngx-tw-time-picker.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-timeline.mjs +149 -82
- package/fesm2022/cdevhub-ngx-tw-timeline.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-toast.mjs +100 -55
- package/fesm2022/cdevhub-ngx-tw-toast.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-tooltip.mjs +50 -28
- package/fesm2022/cdevhub-ngx-tw-tooltip.mjs.map +1 -1
- package/fesm2022/cdevhub-ngx-tw-transfer.mjs +1129 -0
- package/fesm2022/cdevhub-ngx-tw-transfer.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw-tree.mjs +554 -0
- package/fesm2022/cdevhub-ngx-tw-tree.mjs.map +1 -0
- package/fesm2022/cdevhub-ngx-tw.mjs +7 -0
- package/fesm2022/cdevhub-ngx-tw.mjs.map +1 -1
- package/package.json +45 -17
- package/theme/_dark.css +16 -12
- package/theme/_semantic.css +3 -2
- package/theme/index.css +10 -2
- package/types/cdevhub-ngx-tw-aspect-ratio.d.ts +40 -0
- package/types/cdevhub-ngx-tw-calendar.d.ts +39 -8
- package/types/cdevhub-ngx-tw-code-block.d.ts +8 -7
- package/types/cdevhub-ngx-tw-command-palette.d.ts +7 -0
- package/types/cdevhub-ngx-tw-date-picker.d.ts +36 -10
- package/types/cdevhub-ngx-tw-file-upload.d.ts +250 -0
- package/types/cdevhub-ngx-tw-form-field.d.ts +22 -3
- package/types/cdevhub-ngx-tw-icon-lucide.d.ts +21 -3
- package/types/cdevhub-ngx-tw-number-input.d.ts +130 -0
- package/types/cdevhub-ngx-tw-popover.d.ts +8 -0
- package/types/cdevhub-ngx-tw-select.d.ts +1 -1
- package/types/cdevhub-ngx-tw-stepper.d.ts +30 -2
- package/types/cdevhub-ngx-tw-tab-nav.d.ts +8 -0
- package/types/cdevhub-ngx-tw-table.d.ts +30 -1
- package/types/cdevhub-ngx-tw-tabs.d.ts +8 -0
- package/types/cdevhub-ngx-tw-tags-input.d.ts +217 -0
- package/types/cdevhub-ngx-tw-time-picker.d.ts +31 -6
- package/types/cdevhub-ngx-tw-toast.d.ts +1 -1
- package/types/cdevhub-ngx-tw-transfer.d.ts +330 -0
- package/types/cdevhub-ngx-tw-tree.d.ts +189 -0
- package/types/cdevhub-ngx-tw.d.ts +7 -0
|
@@ -10,7 +10,7 @@ import { takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
|
10
10
|
import { Subscription, merge } from 'rxjs';
|
|
11
11
|
import { tv } from 'tailwind-variants';
|
|
12
12
|
import { TW_ERROR_STATE_MATCHER, buildSelectLikePositions, resolveSelectScrollStrategy, consumeOverlayEscape } from '@cdevhub/ngx-tw/core';
|
|
13
|
-
import {
|
|
13
|
+
import { TW_FORM_FIELD, TW_FORM_FIELD_CONTROL } from '@cdevhub/ngx-tw/form-field';
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* Internal overlay panel for `tw-select`. Renders the header/search/listbox/empty/footer
|
|
@@ -21,76 +21,106 @@ class SelectOverlayComponent {
|
|
|
21
21
|
elementRef = inject((ElementRef));
|
|
22
22
|
// ── Config signals set by the parent component ──
|
|
23
23
|
/** @internal */
|
|
24
|
-
size = signal('md',
|
|
24
|
+
size = signal('md', /* @ts-ignore */
|
|
25
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
25
26
|
/** @internal */
|
|
26
|
-
color = signal('primary',
|
|
27
|
+
color = signal('primary', /* @ts-ignore */
|
|
28
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
27
29
|
/** @internal */
|
|
28
|
-
multiple = signal(false,
|
|
30
|
+
multiple = signal(false, /* @ts-ignore */
|
|
31
|
+
...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
29
32
|
/** @internal */
|
|
30
|
-
searchable = signal(false,
|
|
33
|
+
searchable = signal(false, /* @ts-ignore */
|
|
34
|
+
...(ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []));
|
|
31
35
|
/** @internal */
|
|
32
|
-
panelMaxHeight = signal(256,
|
|
36
|
+
panelMaxHeight = signal(256, /* @ts-ignore */
|
|
37
|
+
...(ngDevMode ? [{ debugName: "panelMaxHeight" }] : /* istanbul ignore next */ []));
|
|
33
38
|
/** @internal */
|
|
34
|
-
emptyMessage = signal('No results',
|
|
39
|
+
emptyMessage = signal('No results', /* @ts-ignore */
|
|
40
|
+
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
35
41
|
/** @internal */
|
|
36
|
-
search = signal('',
|
|
42
|
+
search = signal('', /* @ts-ignore */
|
|
43
|
+
...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
|
|
37
44
|
/** @internal */
|
|
38
|
-
activeIndex = signal(-1,
|
|
45
|
+
activeIndex = signal(-1, /* @ts-ignore */
|
|
46
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
39
47
|
/** @internal */
|
|
40
|
-
renderedRows = signal([],
|
|
48
|
+
renderedRows = signal([], /* @ts-ignore */
|
|
49
|
+
...(ngDevMode ? [{ debugName: "renderedRows" }] : /* istanbul ignore next */ []));
|
|
41
50
|
/** @internal */
|
|
42
|
-
visibleOptions = signal([],
|
|
51
|
+
visibleOptions = signal([], /* @ts-ignore */
|
|
52
|
+
...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
43
53
|
/** @internal */
|
|
44
|
-
optionTemplate = signal(undefined,
|
|
54
|
+
optionTemplate = signal(undefined, /* @ts-ignore */
|
|
55
|
+
...(ngDevMode ? [{ debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
45
56
|
/** @internal */
|
|
46
|
-
emptyTemplate = signal(undefined,
|
|
57
|
+
emptyTemplate = signal(undefined, /* @ts-ignore */
|
|
58
|
+
...(ngDevMode ? [{ debugName: "emptyTemplate" }] : /* istanbul ignore next */ []));
|
|
47
59
|
/** @internal */
|
|
48
|
-
headerTemplate = signal(undefined,
|
|
60
|
+
headerTemplate = signal(undefined, /* @ts-ignore */
|
|
61
|
+
...(ngDevMode ? [{ debugName: "headerTemplate" }] : /* istanbul ignore next */ []));
|
|
49
62
|
/** @internal */
|
|
50
|
-
footerTemplate = signal(undefined,
|
|
63
|
+
footerTemplate = signal(undefined, /* @ts-ignore */
|
|
64
|
+
...(ngDevMode ? [{ debugName: "footerTemplate" }] : /* istanbul ignore next */ []));
|
|
51
65
|
/** @internal */
|
|
52
|
-
optionLabelFn = signal(() => '',
|
|
66
|
+
optionLabelFn = signal(() => '', /* @ts-ignore */
|
|
67
|
+
...(ngDevMode ? [{ debugName: "optionLabelFn" }] : /* istanbul ignore next */ []));
|
|
53
68
|
/** @internal */
|
|
54
|
-
selectedChecker = signal(() => false,
|
|
69
|
+
selectedChecker = signal(() => false, /* @ts-ignore */
|
|
70
|
+
...(ngDevMode ? [{ debugName: "selectedChecker" }] : /* istanbul ignore next */ []));
|
|
55
71
|
/** @internal */
|
|
56
|
-
computeOptionClass = signal(() => '',
|
|
72
|
+
computeOptionClass = signal(() => '', /* @ts-ignore */
|
|
73
|
+
...(ngDevMode ? [{ debugName: "computeOptionClass" }] : /* istanbul ignore next */ []));
|
|
57
74
|
/** @internal */
|
|
58
|
-
checkmarkColorClass = signal('',
|
|
75
|
+
checkmarkColorClass = signal('', /* @ts-ignore */
|
|
76
|
+
...(ngDevMode ? [{ debugName: "checkmarkColorClass" }] : /* istanbul ignore next */ []));
|
|
59
77
|
/** @internal */
|
|
60
|
-
panelClassValue = signal('',
|
|
78
|
+
panelClassValue = signal('', /* @ts-ignore */
|
|
79
|
+
...(ngDevMode ? [{ debugName: "panelClassValue" }] : /* istanbul ignore next */ []));
|
|
61
80
|
/** @internal */
|
|
62
|
-
listboxId = signal('',
|
|
81
|
+
listboxId = signal('', /* @ts-ignore */
|
|
82
|
+
...(ngDevMode ? [{ debugName: "listboxId" }] : /* istanbul ignore next */ []));
|
|
63
83
|
/** @internal */
|
|
64
|
-
searchInputId = signal('',
|
|
84
|
+
searchInputId = signal('', /* @ts-ignore */
|
|
85
|
+
...(ngDevMode ? [{ debugName: "searchInputId" }] : /* istanbul ignore next */ []));
|
|
65
86
|
/** @internal */
|
|
66
|
-
optionIdFn = signal((i) => `option-${i}`,
|
|
87
|
+
optionIdFn = signal((i) => `option-${i}`, /* @ts-ignore */
|
|
88
|
+
...(ngDevMode ? [{ debugName: "optionIdFn" }] : /* istanbul ignore next */ []));
|
|
67
89
|
/** @internal */
|
|
68
|
-
leaving = signal(false,
|
|
90
|
+
leaving = signal(false, /* @ts-ignore */
|
|
91
|
+
...(ngDevMode ? [{ debugName: "leaving" }] : /* istanbul ignore next */ []));
|
|
69
92
|
// ── Callbacks set by the parent component ──
|
|
70
93
|
/** @internal */
|
|
71
|
-
onSearchInput = signal(() => { },
|
|
94
|
+
onSearchInput = signal(() => { }, /* @ts-ignore */
|
|
95
|
+
...(ngDevMode ? [{ debugName: "onSearchInput" }] : /* istanbul ignore next */ []));
|
|
72
96
|
/** @internal */
|
|
73
|
-
onOptionSelect = signal(() => { },
|
|
97
|
+
onOptionSelect = signal(() => { }, /* @ts-ignore */
|
|
98
|
+
...(ngDevMode ? [{ debugName: "onOptionSelect" }] : /* istanbul ignore next */ []));
|
|
74
99
|
/** @internal */
|
|
75
|
-
onOptionActivate = signal(() => { },
|
|
100
|
+
onOptionActivate = signal(() => { }, /* @ts-ignore */
|
|
101
|
+
...(ngDevMode ? [{ debugName: "onOptionActivate" }] : /* istanbul ignore next */ []));
|
|
76
102
|
/** @internal */
|
|
77
|
-
onPanelKeydown = signal(() => { },
|
|
103
|
+
onPanelKeydown = signal(() => { }, /* @ts-ignore */
|
|
104
|
+
...(ngDevMode ? [{ debugName: "onPanelKeydown" }] : /* istanbul ignore next */ []));
|
|
78
105
|
// ── View refs ──
|
|
79
|
-
searchInputRef = viewChild('searchInput',
|
|
106
|
+
searchInputRef = viewChild('searchInput', /* @ts-ignore */
|
|
107
|
+
...(ngDevMode ? [{ debugName: "searchInputRef" }] : /* istanbul ignore next */ []));
|
|
80
108
|
// ── Computed classes ──
|
|
81
109
|
/** @internal */
|
|
82
110
|
panelClasses = computed(() => {
|
|
83
111
|
const base = 'block w-full bg-surface-overlay border border-border rounded-lg shadow-md overflow-hidden flex flex-col';
|
|
84
112
|
const custom = this.panelClassValue();
|
|
85
113
|
return custom ? `${base} ${custom}` : base;
|
|
86
|
-
},
|
|
114
|
+
}, /* @ts-ignore */
|
|
115
|
+
...(ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []));
|
|
87
116
|
/** @internal */
|
|
88
117
|
checkmarkClasses = computed(() => {
|
|
89
118
|
// xs/sm densities use `size-3.5` (14px) for the checkmark — the half-step
|
|
90
119
|
// is the only icon size that aligns with the surrounding text-xs metric.
|
|
91
120
|
const size = this.size() === 'xs' || this.size() === 'sm' ? 'size-3.5' : 'size-4';
|
|
92
121
|
return `${size} shrink-0 ml-auto ${this.checkmarkColorClass()}`;
|
|
93
|
-
},
|
|
122
|
+
}, /* @ts-ignore */
|
|
123
|
+
...(ngDevMode ? [{ debugName: "checkmarkClasses" }] : /* istanbul ignore next */ []));
|
|
94
124
|
// ── Template helpers ──
|
|
95
125
|
/** @internal */
|
|
96
126
|
isOptionDisabled(visibleIndex) {
|
|
@@ -149,8 +179,8 @@ class SelectOverlayComponent {
|
|
|
149
179
|
getElement() {
|
|
150
180
|
return this.elementRef.nativeElement;
|
|
151
181
|
}
|
|
152
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
153
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
182
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectOverlayComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
183
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: SelectOverlayComponent, isStandalone: true, selector: "tw-select-overlay", host: { properties: { "class": "panelClasses()", "animate.enter": "\"scale-in\"", "animate.leave": "\"scale-out\"" } }, viewQueries: [{ propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }], ngImport: i0, template: `
|
|
154
184
|
@if (headerTemplate(); as tpl) {
|
|
155
185
|
<div class="border-b border-border p-2">
|
|
156
186
|
<ng-container *ngTemplateOutlet="tpl.templateRef" />
|
|
@@ -198,6 +228,11 @@ class SelectOverlayComponent {
|
|
|
198
228
|
</div>
|
|
199
229
|
</div>
|
|
200
230
|
} @else {
|
|
231
|
+
<!-- ARIA activedescendant listbox: keyboard navigation runs on the
|
|
232
|
+
select trigger via aria-activedescendant. Options are click-only
|
|
233
|
+
affordances and never DOM-focus, so they need no keydown handler
|
|
234
|
+
or tabindex of their own. -->
|
|
235
|
+
<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
|
|
201
236
|
<div
|
|
202
237
|
role="option"
|
|
203
238
|
[id]="optionIdFn()(row.index)"
|
|
@@ -250,7 +285,7 @@ class SelectOverlayComponent {
|
|
|
250
285
|
}
|
|
251
286
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
252
287
|
}
|
|
253
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
288
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectOverlayComponent, decorators: [{
|
|
254
289
|
type: Component,
|
|
255
290
|
args: [{
|
|
256
291
|
selector: 'tw-select-overlay',
|
|
@@ -309,6 +344,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
309
344
|
</div>
|
|
310
345
|
</div>
|
|
311
346
|
} @else {
|
|
347
|
+
<!-- ARIA activedescendant listbox: keyboard navigation runs on the
|
|
348
|
+
select trigger via aria-activedescendant. Options are click-only
|
|
349
|
+
affordances and never DOM-focus, so they need no keydown handler
|
|
350
|
+
or tabindex of their own. -->
|
|
351
|
+
<!-- eslint-disable-next-line @angular-eslint/template/click-events-have-key-events, @angular-eslint/template/interactive-supports-focus -->
|
|
312
352
|
<div
|
|
313
353
|
role="option"
|
|
314
354
|
[id]="optionIdFn()(row.index)"
|
|
@@ -463,10 +503,10 @@ class SelectOptionTemplateDirective {
|
|
|
463
503
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
464
504
|
return true;
|
|
465
505
|
}
|
|
466
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
467
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
506
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectOptionTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
507
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.7", type: SelectOptionTemplateDirective, isStandalone: true, selector: "[twSelectOption]", ngImport: i0 });
|
|
468
508
|
}
|
|
469
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
509
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectOptionTemplateDirective, decorators: [{
|
|
470
510
|
type: Directive,
|
|
471
511
|
args: [{ selector: '[twSelectOption]' }]
|
|
472
512
|
}] });
|
|
@@ -478,10 +518,10 @@ class SelectTriggerTemplateDirective {
|
|
|
478
518
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
479
519
|
return true;
|
|
480
520
|
}
|
|
481
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
482
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
521
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectTriggerTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
522
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.7", type: SelectTriggerTemplateDirective, isStandalone: true, selector: "[twSelectTrigger]", ngImport: i0 });
|
|
483
523
|
}
|
|
484
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
524
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectTriggerTemplateDirective, decorators: [{
|
|
485
525
|
type: Directive,
|
|
486
526
|
args: [{ selector: '[twSelectTrigger]' }]
|
|
487
527
|
}] });
|
|
@@ -493,10 +533,10 @@ class SelectEmptyTemplateDirective {
|
|
|
493
533
|
static ngTemplateContextGuard(_dir, _ctx) {
|
|
494
534
|
return true;
|
|
495
535
|
}
|
|
496
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
497
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
536
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectEmptyTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
537
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.7", type: SelectEmptyTemplateDirective, isStandalone: true, selector: "[twSelectEmpty]", ngImport: i0 });
|
|
498
538
|
}
|
|
499
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
539
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectEmptyTemplateDirective, decorators: [{
|
|
500
540
|
type: Directive,
|
|
501
541
|
args: [{ selector: '[twSelectEmpty]' }]
|
|
502
542
|
}] });
|
|
@@ -504,10 +544,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
504
544
|
class SelectHeaderTemplateDirective {
|
|
505
545
|
/** @internal */
|
|
506
546
|
templateRef = inject((TemplateRef));
|
|
507
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
508
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
547
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectHeaderTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
548
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.7", type: SelectHeaderTemplateDirective, isStandalone: true, selector: "[twSelectHeader]", ngImport: i0 });
|
|
509
549
|
}
|
|
510
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
550
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectHeaderTemplateDirective, decorators: [{
|
|
511
551
|
type: Directive,
|
|
512
552
|
args: [{ selector: '[twSelectHeader]' }]
|
|
513
553
|
}] });
|
|
@@ -515,10 +555,10 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.14", ngImpo
|
|
|
515
555
|
class SelectFooterTemplateDirective {
|
|
516
556
|
/** @internal */
|
|
517
557
|
templateRef = inject((TemplateRef));
|
|
518
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
519
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "
|
|
558
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectFooterTemplateDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
559
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.7", type: SelectFooterTemplateDirective, isStandalone: true, selector: "[twSelectFooter]", ngImport: i0 });
|
|
520
560
|
}
|
|
521
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
561
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectFooterTemplateDirective, decorators: [{
|
|
522
562
|
type: Directive,
|
|
523
563
|
args: [{ selector: '[twSelectFooter]' }]
|
|
524
564
|
}] });
|
|
@@ -548,50 +588,69 @@ function defaultOptionGroup(o) {
|
|
|
548
588
|
*/
|
|
549
589
|
class SelectComponent {
|
|
550
590
|
/** Array of options to render in the panel. Accepts either `TwSelectOption<T>` objects or arbitrary records read via the accessor inputs. Defaults to an empty array. */
|
|
551
|
-
options = input([],
|
|
591
|
+
options = input([], /* @ts-ignore */
|
|
592
|
+
...(ngDevMode ? [{ debugName: "options" }] : /* istanbul ignore next */ []));
|
|
552
593
|
/** Accessor returning the visible label for an option. Override when passing arbitrary objects. */
|
|
553
|
-
optionLabel = input(defaultOptionLabel,
|
|
594
|
+
optionLabel = input(defaultOptionLabel, /* @ts-ignore */
|
|
595
|
+
...(ngDevMode ? [{ debugName: "optionLabel" }] : /* istanbul ignore next */ []));
|
|
554
596
|
/** Accessor returning the value for an option. The result is what `value` / `valueChange` emit. */
|
|
555
|
-
optionValue = input(defaultOptionValue,
|
|
597
|
+
optionValue = input(defaultOptionValue, /* @ts-ignore */
|
|
598
|
+
...(ngDevMode ? [{ debugName: "optionValue" }] : /* istanbul ignore next */ []));
|
|
556
599
|
/** Accessor returning the disabled state for an option. Defaults to reading `.disabled`. */
|
|
557
|
-
optionDisabled = input(defaultOptionDisabled,
|
|
600
|
+
optionDisabled = input(defaultOptionDisabled, /* @ts-ignore */
|
|
601
|
+
...(ngDevMode ? [{ debugName: "optionDisabled" }] : /* istanbul ignore next */ []));
|
|
558
602
|
/** Accessor returning the group name for an option. Options sharing a group render under a labelled `role="group"` region. */
|
|
559
|
-
optionGroup = input(defaultOptionGroup,
|
|
603
|
+
optionGroup = input(defaultOptionGroup, /* @ts-ignore */
|
|
604
|
+
...(ngDevMode ? [{ debugName: "optionGroup" }] : /* istanbul ignore next */ []));
|
|
560
605
|
/** When true, enables multi-selection. The `value` model becomes a `T[]` and the panel renders checkable options. Defaults to `false`. */
|
|
561
|
-
multiple = input(false,
|
|
606
|
+
multiple = input(false, /* @ts-ignore */
|
|
607
|
+
...(ngDevMode ? [{ debugName: "multiple" }] : /* istanbul ignore next */ []));
|
|
562
608
|
/** When true, renders a search input at the top of the panel that filters options using `filterPredicate`. Defaults to `false`. */
|
|
563
|
-
searchable = input(false,
|
|
609
|
+
searchable = input(false, /* @ts-ignore */
|
|
610
|
+
...(ngDevMode ? [{ debugName: "searchable" }] : /* istanbul ignore next */ []));
|
|
564
611
|
/** Custom filter function for the search input. Defaults to a case-insensitive substring match on the option label. */
|
|
565
612
|
filterPredicate = input((option, search) => {
|
|
566
613
|
const label = this.optionLabel()(option);
|
|
567
614
|
return label.toLowerCase().includes(search.toLowerCase());
|
|
568
|
-
},
|
|
615
|
+
}, /* @ts-ignore */
|
|
616
|
+
...(ngDevMode ? [{ debugName: "filterPredicate" }] : /* istanbul ignore next */ []));
|
|
569
617
|
/** Placeholder text shown in the trigger when no value is selected. */
|
|
570
|
-
placeholder = input(undefined,
|
|
618
|
+
placeholder = input(undefined, /* @ts-ignore */
|
|
619
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
571
620
|
/** When true, the trigger cannot be activated and the panel cannot open. Defaults to `false`. */
|
|
572
621
|
disabledInput = input(false, { ...(ngDevMode ? { debugName: "disabledInput" } : /* istanbul ignore next */ {}), alias: 'disabled' });
|
|
573
622
|
/** When true, exposes `aria-required="true"` on the trigger. Defaults to `false`. */
|
|
574
623
|
requiredInput = input(false, { ...(ngDevMode ? { debugName: "requiredInput" } : /* istanbul ignore next */ {}), alias: 'required' });
|
|
575
624
|
/** Controls trigger padding, font size, and panel option density. Defaults to `'md'`. */
|
|
576
|
-
size = input('md',
|
|
625
|
+
size = input('md', /* @ts-ignore */
|
|
626
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
577
627
|
/** Semantic color for focused trigger border, active-option background, and checkmarks. Defaults to `'primary'`. */
|
|
578
|
-
color = input('primary',
|
|
628
|
+
color = input('primary', /* @ts-ignore */
|
|
629
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
579
630
|
/** Visual style of the trigger. When inside a `tw-form-field` and left unset, auto-resolves to `'naked'`. Otherwise defaults to `'default'`. */
|
|
580
|
-
variant = input(undefined,
|
|
631
|
+
variant = input(undefined, /* @ts-ignore */
|
|
632
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
581
633
|
/** Overlay panel width. `'trigger'` matches the trigger's measured width; `'auto'` lets content decide; a number is applied as pixels; a string is passed through as a CSS length. Defaults to `'trigger'`. */
|
|
582
|
-
panelWidth = input('trigger',
|
|
634
|
+
panelWidth = input('trigger', /* @ts-ignore */
|
|
635
|
+
...(ngDevMode ? [{ debugName: "panelWidth" }] : /* istanbul ignore next */ []));
|
|
583
636
|
/** Extra class(es) applied to the overlay panel element. */
|
|
584
|
-
panelClass = input('',
|
|
637
|
+
panelClass = input('', /* @ts-ignore */
|
|
638
|
+
...(ngDevMode ? [{ debugName: "panelClass" }] : /* istanbul ignore next */ []));
|
|
585
639
|
/** Maximum height of the listbox scroll region in pixels. Defaults to `256`. */
|
|
586
|
-
panelMaxHeight = input(256,
|
|
640
|
+
panelMaxHeight = input(256, /* @ts-ignore */
|
|
641
|
+
...(ngDevMode ? [{ debugName: "panelMaxHeight" }] : /* istanbul ignore next */ []));
|
|
587
642
|
/** Whether the panel closes after a selection is made. When unset, resolves to `true` for single-select and `false` for multi-select. */
|
|
588
|
-
closeOnSelect = input(undefined,
|
|
643
|
+
closeOnSelect = input(undefined, /* @ts-ignore */
|
|
644
|
+
...(ngDevMode ? [{ debugName: "closeOnSelect" }] : /* istanbul ignore next */ []));
|
|
589
645
|
/** CDK scroll strategy for the overlay. Defaults to `'reposition'`. */
|
|
590
|
-
scrollStrategy = input('reposition',
|
|
646
|
+
scrollStrategy = input('reposition', /* @ts-ignore */
|
|
647
|
+
...(ngDevMode ? [{ debugName: "scrollStrategy" }] : /* istanbul ignore next */ []));
|
|
591
648
|
/** Pixel distance between trigger and panel. Defaults to `4`. */
|
|
592
|
-
offset = input(4,
|
|
649
|
+
offset = input(4, /* @ts-ignore */
|
|
650
|
+
...(ngDevMode ? [{ debugName: "offset" }] : /* istanbul ignore next */ []));
|
|
593
651
|
/** Fallback message rendered when the filter yields no options and no `*twSelectEmpty` template is provided. */
|
|
594
|
-
emptyMessage = input('No results',
|
|
652
|
+
emptyMessage = input('No results', /* @ts-ignore */
|
|
653
|
+
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
595
654
|
/** Accessible name for the combobox trigger. */
|
|
596
655
|
ariaLabel = input(undefined, { ...(ngDevMode ? { debugName: "ariaLabel" } : /* istanbul ignore next */ {}), alias: 'aria-label' });
|
|
597
656
|
/** ID of an external element that labels the combobox. */
|
|
@@ -599,14 +658,18 @@ class SelectComponent {
|
|
|
599
658
|
/** ID of an external element that describes the combobox. */
|
|
600
659
|
ariaDescribedby = input(undefined, { ...(ngDevMode ? { debugName: "ariaDescribedby" } : /* istanbul ignore next */ {}), alias: 'aria-describedby' });
|
|
601
660
|
/** Per-instance override of the {@link ErrorStateMatcher}. When omitted, the select uses the `TW_ERROR_STATE_MATCHER` token's value. */
|
|
602
|
-
errorStateMatcher = input(undefined,
|
|
661
|
+
errorStateMatcher = input(undefined, /* @ts-ignore */
|
|
662
|
+
...(ngDevMode ? [{ debugName: "errorStateMatcher" }] : /* istanbul ignore next */ []));
|
|
603
663
|
/** Equality comparator for option values. Defaults to `Object.is`. */
|
|
604
|
-
compareWith = input(Object.is,
|
|
664
|
+
compareWith = input(Object.is, /* @ts-ignore */
|
|
665
|
+
...(ngDevMode ? [{ debugName: "compareWith" }] : /* istanbul ignore next */ []));
|
|
605
666
|
// ── Models (two-way) ──
|
|
606
667
|
/** Two-way bound selected value(s). Single-select: `T | null`. Multi-select: `T[]`. */
|
|
607
|
-
value = model(null,
|
|
668
|
+
value = model(null, /* @ts-ignore */
|
|
669
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
608
670
|
/** Two-way bound open state of the panel. */
|
|
609
|
-
open = model(false,
|
|
671
|
+
open = model(false, /* @ts-ignore */
|
|
672
|
+
...(ngDevMode ? [{ debugName: "open" }] : /* istanbul ignore next */ []));
|
|
610
673
|
// ── Outputs ──
|
|
611
674
|
/** Fires when the panel's visibility finishes changing. */
|
|
612
675
|
openedChange = output();
|
|
@@ -616,15 +679,20 @@ class SelectComponent {
|
|
|
616
679
|
searchChange = output();
|
|
617
680
|
// ── Content queries ──
|
|
618
681
|
/** @internal */
|
|
619
|
-
triggerTemplateChild = contentChild(SelectTriggerTemplateDirective,
|
|
682
|
+
triggerTemplateChild = contentChild(SelectTriggerTemplateDirective, /* @ts-ignore */
|
|
683
|
+
...(ngDevMode ? [{ debugName: "triggerTemplateChild" }] : /* istanbul ignore next */ []));
|
|
620
684
|
/** @internal */
|
|
621
|
-
optionTemplateChild = contentChild(SelectOptionTemplateDirective,
|
|
685
|
+
optionTemplateChild = contentChild(SelectOptionTemplateDirective, /* @ts-ignore */
|
|
686
|
+
...(ngDevMode ? [{ debugName: "optionTemplateChild" }] : /* istanbul ignore next */ []));
|
|
622
687
|
/** @internal */
|
|
623
|
-
emptyTemplateChild = contentChild(SelectEmptyTemplateDirective,
|
|
688
|
+
emptyTemplateChild = contentChild(SelectEmptyTemplateDirective, /* @ts-ignore */
|
|
689
|
+
...(ngDevMode ? [{ debugName: "emptyTemplateChild" }] : /* istanbul ignore next */ []));
|
|
624
690
|
/** @internal */
|
|
625
|
-
headerTemplateChild = contentChild(SelectHeaderTemplateDirective,
|
|
691
|
+
headerTemplateChild = contentChild(SelectHeaderTemplateDirective, /* @ts-ignore */
|
|
692
|
+
...(ngDevMode ? [{ debugName: "headerTemplateChild" }] : /* istanbul ignore next */ []));
|
|
626
693
|
/** @internal */
|
|
627
|
-
footerTemplateChild = contentChild(SelectFooterTemplateDirective,
|
|
694
|
+
footerTemplateChild = contentChild(SelectFooterTemplateDirective, /* @ts-ignore */
|
|
695
|
+
...(ngDevMode ? [{ debugName: "footerTemplateChild" }] : /* istanbul ignore next */ []));
|
|
628
696
|
// ── Injected deps ──
|
|
629
697
|
overlayService = inject(Overlay);
|
|
630
698
|
elementRef = inject((ElementRef));
|
|
@@ -634,7 +702,7 @@ class SelectComponent {
|
|
|
634
702
|
focusMonitor = inject(FocusMonitor);
|
|
635
703
|
liveAnnouncer = inject(LiveAnnouncer);
|
|
636
704
|
platform = inject(Platform);
|
|
637
|
-
formField = inject(
|
|
705
|
+
formField = inject(TW_FORM_FIELD, { optional: true });
|
|
638
706
|
ngControl = inject(NgControl, { optional: true, self: true });
|
|
639
707
|
parentForm = inject(NgForm, { optional: true });
|
|
640
708
|
parentFormGroup = inject(FormGroupDirective, { optional: true });
|
|
@@ -651,23 +719,34 @@ class SelectComponent {
|
|
|
651
719
|
optionId = (index) => `${this.hostId}-option-${index}`;
|
|
652
720
|
// ── Internal state signals ──
|
|
653
721
|
/** @internal */
|
|
654
|
-
internalValue = linkedSignal(() => this.value(),
|
|
655
|
-
|
|
656
|
-
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
/** @internal */
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
722
|
+
internalValue = linkedSignal(() => this.value(), /* @ts-ignore */
|
|
723
|
+
...(ngDevMode ? [{ debugName: "internalValue" }] : /* istanbul ignore next */ []));
|
|
724
|
+
/** @internal */
|
|
725
|
+
search = signal('', /* @ts-ignore */
|
|
726
|
+
...(ngDevMode ? [{ debugName: "search" }] : /* istanbul ignore next */ []));
|
|
727
|
+
/** @internal */
|
|
728
|
+
activeIndex = signal(-1, /* @ts-ignore */
|
|
729
|
+
...(ngDevMode ? [{ debugName: "activeIndex" }] : /* istanbul ignore next */ []));
|
|
730
|
+
/** @internal */
|
|
731
|
+
focusedSignal = signal(false, /* @ts-ignore */
|
|
732
|
+
...(ngDevMode ? [{ debugName: "focusedSignal" }] : /* istanbul ignore next */ []));
|
|
733
|
+
cvaDisabled = signal(false, /* @ts-ignore */
|
|
734
|
+
...(ngDevMode ? [{ debugName: "cvaDisabled" }] : /* istanbul ignore next */ []));
|
|
735
|
+
_ngControlRev = signal(0, /* @ts-ignore */
|
|
736
|
+
...(ngDevMode ? [{ debugName: "_ngControlRev" }] : /* istanbul ignore next */ []));
|
|
737
|
+
_formSubmitRev = signal(0, /* @ts-ignore */
|
|
738
|
+
...(ngDevMode ? [{ debugName: "_formSubmitRev" }] : /* istanbul ignore next */ []));
|
|
739
|
+
describedByIdsSignal = signal([], /* @ts-ignore */
|
|
740
|
+
...(ngDevMode ? [{ debugName: "describedByIdsSignal" }] : /* istanbul ignore next */ []));
|
|
741
|
+
labelledByIdsSignal = signal([], /* @ts-ignore */
|
|
742
|
+
...(ngDevMode ? [{ debugName: "labelledByIdsSignal" }] : /* istanbul ignore next */ []));
|
|
743
|
+
closingSignal = signal(false, /* @ts-ignore */
|
|
744
|
+
...(ngDevMode ? [{ debugName: "closingSignal" }] : /* istanbul ignore next */ []));
|
|
667
745
|
onChange = () => { };
|
|
668
746
|
onTouched = () => { };
|
|
669
747
|
overlayRef = null;
|
|
670
|
-
overlayInstanceSignal = signal(null,
|
|
748
|
+
overlayInstanceSignal = signal(null, /* @ts-ignore */
|
|
749
|
+
...(ngDevMode ? [{ debugName: "overlayInstanceSignal" }] : /* istanbul ignore next */ []));
|
|
671
750
|
perOpenSubs = null;
|
|
672
751
|
closeTimer = null;
|
|
673
752
|
resizeObserver = null;
|
|
@@ -676,16 +755,19 @@ class SelectComponent {
|
|
|
676
755
|
}
|
|
677
756
|
// ── Derived state ──
|
|
678
757
|
/** @internal */
|
|
679
|
-
isDisabled = computed(() => this.disabledInput() || this.cvaDisabled(),
|
|
758
|
+
isDisabled = computed(() => this.disabledInput() || this.cvaDisabled(), /* @ts-ignore */
|
|
759
|
+
...(ngDevMode ? [{ debugName: "isDisabled" }] : /* istanbul ignore next */ []));
|
|
680
760
|
/** @internal Effective variant — auto-naked when wrapped in tw-form-field. */
|
|
681
|
-
resolvedVariant = computed(() => this.variant() ?? (this.formField ? 'naked' : 'default'),
|
|
761
|
+
resolvedVariant = computed(() => this.variant() ?? (this.formField ? 'naked' : 'default'), /* @ts-ignore */
|
|
762
|
+
...(ngDevMode ? [{ debugName: "resolvedVariant" }] : /* istanbul ignore next */ []));
|
|
682
763
|
/** @internal */
|
|
683
764
|
isEmpty = computed(() => {
|
|
684
765
|
const v = this.internalValue();
|
|
685
766
|
if (this.multiple())
|
|
686
767
|
return !Array.isArray(v) || v.length === 0;
|
|
687
768
|
return v === null || v === undefined;
|
|
688
|
-
},
|
|
769
|
+
}, /* @ts-ignore */
|
|
770
|
+
...(ngDevMode ? [{ debugName: "isEmpty" }] : /* istanbul ignore next */ []));
|
|
689
771
|
/** @internal Visible (filtered) options with resolved view data. */
|
|
690
772
|
visibleOptions = computed(() => {
|
|
691
773
|
const opts = this.options();
|
|
@@ -703,7 +785,8 @@ class SelectComponent {
|
|
|
703
785
|
disabled: disabledFn(option),
|
|
704
786
|
group: groupFn(option),
|
|
705
787
|
}));
|
|
706
|
-
},
|
|
788
|
+
}, /* @ts-ignore */
|
|
789
|
+
...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
707
790
|
/** @internal Rows rendered in the panel (group labels + options). */
|
|
708
791
|
renderedRows = computed(() => {
|
|
709
792
|
const visible = this.visibleOptions();
|
|
@@ -719,7 +802,8 @@ class SelectComponent {
|
|
|
719
802
|
rows.push({ kind: 'option', option: v.option, index, group: v.group });
|
|
720
803
|
});
|
|
721
804
|
return rows;
|
|
722
|
-
},
|
|
805
|
+
}, /* @ts-ignore */
|
|
806
|
+
...(ngDevMode ? [{ debugName: "renderedRows" }] : /* istanbul ignore next */ []));
|
|
723
807
|
/** @internal Resolved option objects that match the current value. */
|
|
724
808
|
selectedOptions = computed(() => {
|
|
725
809
|
const v = this.internalValue();
|
|
@@ -733,7 +817,8 @@ class SelectComponent {
|
|
|
733
817
|
return opts.filter((o) => arr.some((x) => cmp(valueFn(o), x)));
|
|
734
818
|
}
|
|
735
819
|
return opts.filter((o) => cmp(valueFn(o), v));
|
|
736
|
-
},
|
|
820
|
+
}, /* @ts-ignore */
|
|
821
|
+
...(ngDevMode ? [{ debugName: "selectedOptions" }] : /* istanbul ignore next */ []));
|
|
737
822
|
/** @internal */
|
|
738
823
|
defaultTriggerText = computed(() => {
|
|
739
824
|
const opts = this.selectedOptions();
|
|
@@ -741,9 +826,11 @@ class SelectComponent {
|
|
|
741
826
|
if (opts.length === 0)
|
|
742
827
|
return '';
|
|
743
828
|
return opts.map((o) => labelFn(o)).join(', ');
|
|
744
|
-
},
|
|
829
|
+
}, /* @ts-ignore */
|
|
830
|
+
...(ngDevMode ? [{ debugName: "defaultTriggerText" }] : /* istanbul ignore next */ []));
|
|
745
831
|
/** @internal */
|
|
746
|
-
showClearButton = computed(() => !this.isDisabled() && !this.isEmpty(),
|
|
832
|
+
showClearButton = computed(() => !this.isDisabled() && !this.isEmpty(), /* @ts-ignore */
|
|
833
|
+
...(ngDevMode ? [{ debugName: "showClearButton" }] : /* istanbul ignore next */ []));
|
|
747
834
|
/** @internal */
|
|
748
835
|
activeDescendantId = computed(() => {
|
|
749
836
|
if (!this.open())
|
|
@@ -752,7 +839,8 @@ class SelectComponent {
|
|
|
752
839
|
if (idx < 0 || idx >= this.visibleOptions().length)
|
|
753
840
|
return null;
|
|
754
841
|
return this.optionId(idx);
|
|
755
|
-
},
|
|
842
|
+
}, /* @ts-ignore */
|
|
843
|
+
...(ngDevMode ? [{ debugName: "activeDescendantId" }] : /* istanbul ignore next */ []));
|
|
756
844
|
/** @internal */
|
|
757
845
|
describedBy = computed(() => {
|
|
758
846
|
const extra = this.describedByIdsSignal();
|
|
@@ -761,7 +849,8 @@ class SelectComponent {
|
|
|
761
849
|
if (user)
|
|
762
850
|
merged.push(...user.split(/\s+/).filter(Boolean));
|
|
763
851
|
return merged.length ? merged.join(' ') : '';
|
|
764
|
-
},
|
|
852
|
+
}, /* @ts-ignore */
|
|
853
|
+
...(ngDevMode ? [{ debugName: "describedBy" }] : /* istanbul ignore next */ []));
|
|
765
854
|
/** @internal Merged `aria-labelledby`: form-field-pushed label ids + consumer-supplied `aria-labelledby`. */
|
|
766
855
|
labelledBy = computed(() => {
|
|
767
856
|
const extra = this.labelledByIdsSignal();
|
|
@@ -770,14 +859,16 @@ class SelectComponent {
|
|
|
770
859
|
if (user)
|
|
771
860
|
merged.push(...user.split(/\s+/).filter(Boolean));
|
|
772
861
|
return merged.length ? merged.join(' ') : '';
|
|
773
|
-
},
|
|
862
|
+
}, /* @ts-ignore */
|
|
863
|
+
...(ngDevMode ? [{ debugName: "labelledBy" }] : /* istanbul ignore next */ []));
|
|
774
864
|
/** @internal Resolved close-on-select behaviour. */
|
|
775
865
|
resolvedCloseOnSelect = computed(() => {
|
|
776
866
|
const explicit = this.closeOnSelect();
|
|
777
867
|
if (explicit !== undefined)
|
|
778
868
|
return explicit;
|
|
779
869
|
return !this.multiple();
|
|
780
|
-
},
|
|
870
|
+
}, /* @ts-ignore */
|
|
871
|
+
...(ngDevMode ? [{ debugName: "resolvedCloseOnSelect" }] : /* istanbul ignore next */ []));
|
|
781
872
|
// ── tv() output ──
|
|
782
873
|
variantResult = computed(() => selectVariants({
|
|
783
874
|
size: this.size(),
|
|
@@ -786,19 +877,26 @@ class SelectComponent {
|
|
|
786
877
|
disabled: this.isDisabled(),
|
|
787
878
|
focused: this.focusedSignal(),
|
|
788
879
|
color: this.color(),
|
|
789
|
-
}),
|
|
880
|
+
}), /* @ts-ignore */
|
|
881
|
+
...(ngDevMode ? [{ debugName: "variantResult" }] : /* istanbul ignore next */ []));
|
|
790
882
|
/** @internal */
|
|
791
|
-
rootClasses = computed(() => this.variantResult().root(),
|
|
883
|
+
rootClasses = computed(() => this.variantResult().root(), /* @ts-ignore */
|
|
884
|
+
...(ngDevMode ? [{ debugName: "rootClasses" }] : /* istanbul ignore next */ []));
|
|
792
885
|
/** @internal */
|
|
793
|
-
triggerClasses = computed(() => this.variantResult().trigger(),
|
|
886
|
+
triggerClasses = computed(() => this.variantResult().trigger(), /* @ts-ignore */
|
|
887
|
+
...(ngDevMode ? [{ debugName: "triggerClasses" }] : /* istanbul ignore next */ []));
|
|
794
888
|
/** @internal */
|
|
795
|
-
valueTextClasses = computed(() => this.variantResult().valueText(),
|
|
889
|
+
valueTextClasses = computed(() => this.variantResult().valueText(), /* @ts-ignore */
|
|
890
|
+
...(ngDevMode ? [{ debugName: "valueTextClasses" }] : /* istanbul ignore next */ []));
|
|
796
891
|
/** @internal */
|
|
797
|
-
placeholderTextClasses = computed(() => this.variantResult().placeholderText(),
|
|
892
|
+
placeholderTextClasses = computed(() => this.variantResult().placeholderText(), /* @ts-ignore */
|
|
893
|
+
...(ngDevMode ? [{ debugName: "placeholderTextClasses" }] : /* istanbul ignore next */ []));
|
|
798
894
|
/** @internal */
|
|
799
|
-
chevronClasses = computed(() => this.variantResult().chevron(),
|
|
895
|
+
chevronClasses = computed(() => this.variantResult().chevron(), /* @ts-ignore */
|
|
896
|
+
...(ngDevMode ? [{ debugName: "chevronClasses" }] : /* istanbul ignore next */ []));
|
|
800
897
|
/** @internal */
|
|
801
|
-
clearButtonClasses = computed(() => this.variantResult().clearButton(),
|
|
898
|
+
clearButtonClasses = computed(() => this.variantResult().clearButton(), /* @ts-ignore */
|
|
899
|
+
...(ngDevMode ? [{ debugName: "clearButtonClasses" }] : /* istanbul ignore next */ []));
|
|
802
900
|
/** @internal */
|
|
803
901
|
optionSizeClass = computed(() => {
|
|
804
902
|
switch (this.size()) {
|
|
@@ -813,9 +911,11 @@ class SelectComponent {
|
|
|
813
911
|
case 'xl':
|
|
814
912
|
return 'px-4 py-3 text-base';
|
|
815
913
|
}
|
|
816
|
-
},
|
|
914
|
+
}, /* @ts-ignore */
|
|
915
|
+
...(ngDevMode ? [{ debugName: "optionSizeClass" }] : /* istanbul ignore next */ []));
|
|
817
916
|
/** @internal */
|
|
818
|
-
checkmarkColorClass = computed(() => OPTION_CHECKMARK_COLOR[this.color()],
|
|
917
|
+
checkmarkColorClass = computed(() => OPTION_CHECKMARK_COLOR[this.color()], /* @ts-ignore */
|
|
918
|
+
...(ngDevMode ? [{ debugName: "checkmarkColorClass" }] : /* istanbul ignore next */ []));
|
|
819
919
|
/** @internal Class string applied to each option row. */
|
|
820
920
|
computeOptionClass = (selected, active, disabled) => {
|
|
821
921
|
const sizeClass = this.optionSizeClass();
|
|
@@ -838,7 +938,8 @@ class SelectComponent {
|
|
|
838
938
|
};
|
|
839
939
|
// ── FormFieldControl impl (readonly signals) ──
|
|
840
940
|
/** @internal */
|
|
841
|
-
id = computed(() => this.hostId,
|
|
941
|
+
id = computed(() => this.hostId, /* @ts-ignore */
|
|
942
|
+
...(ngDevMode ? [{ debugName: "id" }] : /* istanbul ignore next */ []));
|
|
842
943
|
/** @internal */
|
|
843
944
|
focused = this.focusedSignal.asReadonly();
|
|
844
945
|
/** @internal */
|
|
@@ -846,7 +947,8 @@ class SelectComponent {
|
|
|
846
947
|
/** @internal */
|
|
847
948
|
disabled = this.isDisabled;
|
|
848
949
|
/** @internal */
|
|
849
|
-
required = computed(() => this.requiredInput(),
|
|
950
|
+
required = computed(() => this.requiredInput(), /* @ts-ignore */
|
|
951
|
+
...(ngDevMode ? [{ debugName: "required" }] : /* istanbul ignore next */ []));
|
|
850
952
|
/** @internal Error-state per the configured `ErrorStateMatcher`. Reads the bound `NgControl.invalid` through the matcher. */
|
|
851
953
|
errorState = computed(() => {
|
|
852
954
|
this._ngControlRev();
|
|
@@ -855,13 +957,16 @@ class SelectComponent {
|
|
|
855
957
|
const form = this.parentFormGroup ??
|
|
856
958
|
this.parentForm;
|
|
857
959
|
return matcher.isErrorState(this.ngControl?.control ?? null, form);
|
|
858
|
-
},
|
|
960
|
+
}, /* @ts-ignore */
|
|
961
|
+
...(ngDevMode ? [{ debugName: "errorState" }] : /* istanbul ignore next */ []));
|
|
859
962
|
/** @internal */
|
|
860
963
|
controlType = 'select';
|
|
861
964
|
/** @internal */
|
|
862
|
-
userAriaDescribedBy = computed(() => this.ariaDescribedby(),
|
|
965
|
+
userAriaDescribedBy = computed(() => this.ariaDescribedby(), /* @ts-ignore */
|
|
966
|
+
...(ngDevMode ? [{ debugName: "userAriaDescribedBy" }] : /* istanbul ignore next */ []));
|
|
863
967
|
/** @internal */
|
|
864
|
-
userAriaLabelledby = computed(() => this.ariaLabelledby(),
|
|
968
|
+
userAriaLabelledby = computed(() => this.ariaLabelledby(), /* @ts-ignore */
|
|
969
|
+
...(ngDevMode ? [{ debugName: "userAriaLabelledby" }] : /* istanbul ignore next */ []));
|
|
865
970
|
/** @internal Public read-only view of the current value for FormFieldControl. */
|
|
866
971
|
// Overriding `value` typing from the model by using an explicit computed that matches the abstract signature.
|
|
867
972
|
// (The model `value` property is a WritableSignal<T | readonly T[] | null>; FormFieldControl needs a Signal<T | readonly T[] | null>.
|
|
@@ -955,7 +1060,7 @@ class SelectComponent {
|
|
|
955
1060
|
return;
|
|
956
1061
|
const hasLabel = !!this.ariaLabel() ||
|
|
957
1062
|
!!this.ariaLabelledby() ||
|
|
958
|
-
!!this.formField?.
|
|
1063
|
+
!!this.formField?.hasLabel() ||
|
|
959
1064
|
!!this.triggerTemplateChild();
|
|
960
1065
|
if (!hasLabel) {
|
|
961
1066
|
console.warn('[tw-select] The select has no accessible name. Set aria-label, aria-labelledby, wrap in <tw-form-field> with a <label twLabel>, or project a *twSelectTrigger template.');
|
|
@@ -1545,8 +1650,8 @@ class SelectComponent {
|
|
|
1545
1650
|
.subscribe(() => this._formSubmitRev.update((n) => n + 1));
|
|
1546
1651
|
}
|
|
1547
1652
|
}
|
|
1548
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "
|
|
1549
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "
|
|
1653
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1654
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.7", type: SelectComponent, isStandalone: true, selector: "tw-select", inputs: { options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, optionGroup: { classPropertyName: "optionGroup", publicName: "optionGroup", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, searchable: { classPropertyName: "searchable", publicName: "searchable", isSignal: true, isRequired: false, transformFunction: null }, filterPredicate: { classPropertyName: "filterPredicate", publicName: "filterPredicate", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, disabledInput: { classPropertyName: "disabledInput", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, requiredInput: { classPropertyName: "requiredInput", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, panelWidth: { classPropertyName: "panelWidth", publicName: "panelWidth", isSignal: true, isRequired: false, transformFunction: null }, panelClass: { classPropertyName: "panelClass", publicName: "panelClass", isSignal: true, isRequired: false, transformFunction: null }, panelMaxHeight: { classPropertyName: "panelMaxHeight", publicName: "panelMaxHeight", isSignal: true, isRequired: false, transformFunction: null }, closeOnSelect: { classPropertyName: "closeOnSelect", publicName: "closeOnSelect", isSignal: true, isRequired: false, transformFunction: null }, scrollStrategy: { classPropertyName: "scrollStrategy", publicName: "scrollStrategy", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "aria-label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "aria-labelledby", isSignal: true, isRequired: false, transformFunction: null }, ariaDescribedby: { classPropertyName: "ariaDescribedby", publicName: "aria-describedby", isSignal: true, isRequired: false, transformFunction: null }, errorStateMatcher: { classPropertyName: "errorStateMatcher", publicName: "errorStateMatcher", isSignal: true, isRequired: false, transformFunction: null }, compareWith: { classPropertyName: "compareWith", publicName: "compareWith", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, open: { classPropertyName: "open", publicName: "open", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange", open: "openChange", openedChange: "openedChange", selectionChange: "selectionChange", searchChange: "searchChange" }, host: { properties: { "class": "rootClasses()" } }, providers: [
|
|
1550
1655
|
{
|
|
1551
1656
|
provide: TW_FORM_FIELD_CONTROL,
|
|
1552
1657
|
useExisting: forwardRef(() => SelectComponent),
|
|
@@ -1624,7 +1729,7 @@ class SelectComponent {
|
|
|
1624
1729
|
</span>
|
|
1625
1730
|
`, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1626
1731
|
}
|
|
1627
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "
|
|
1732
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.7", ngImport: i0, type: SelectComponent, decorators: [{
|
|
1628
1733
|
type: Component,
|
|
1629
1734
|
args: [{
|
|
1630
1735
|
selector: 'tw-select',
|