@sixbell-telco/sdk 4.8.0 → 4.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +53 -0
- package/components/accordion/README.md +1 -1
- package/components/accordion/src/accordion.component.d.ts +4 -0
- package/components/alert/src/alert.component.d.ts +8 -1
- package/components/data-table/README.md +1 -0
- package/components/data-table/src/data-table.component.d.ts +2 -24
- package/components/dialog/README.md +4 -3
- package/components/dialog/dialog-actions/dialog-actions.component.d.ts +2 -1
- package/components/dialog/src/dialog.component.d.ts +10 -5
- package/components/dropdown-menu/bar/dropdown-menu-bar-item/dropdown-menu-bar-item.component.d.ts +1 -1
- package/components/dropdown-menu/src/dropdown-menu-item/dropdown-menu-item.component.d.ts +3 -2
- package/components/file-upload/file-dropzone/file-dropzone.component.d.ts +12 -0
- package/components/file-upload/file-uploader/file-uploader.component.d.ts +6 -0
- package/components/forms/combobox/README.md +49 -0
- package/components/forms/combobox/src/combobox.component.d.ts +178 -3
- package/components/forms/date-picker/README.md +3 -1
- package/components/forms/date-picker/src/date-picker.component.d.ts +8 -1
- package/components/forms/form-error/README.md +2 -0
- package/components/forms/form-error/src/form-error.component.d.ts +17 -0
- package/components/forms/form-hint/README.md +2 -2
- package/components/forms/form-item/README.md +1 -0
- package/components/forms/form-item/src/form-item.component.d.ts +38 -6
- package/components/forms/input/README.md +7 -0
- package/components/forms/input/src/input.component.d.ts +11 -1
- package/components/forms/select/README.md +48 -0
- package/components/forms/select/src/select.component.d.ts +157 -2
- package/components/forms/textarea/README.md +1 -0
- package/components/forms/textarea/src/textarea.component.d.ts +6 -1
- package/components/paginator/README.md +3 -0
- package/components/paginator/components/pagination-item/pagination-item.component.d.ts +8 -3
- package/components/paginator/src/paginator.component.d.ts +2 -1
- package/components/progress/src/progress.component.d.ts +17 -3
- package/components/table/README.md +2 -0
- package/components/table/src/table.component.d.ts +16 -23
- package/directives/only-numbers/src/only-numbers.directive.d.ts +27 -1
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs +6 -1
- package/fesm2022/sixbell-telco-sdk-components-accordion.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-alert.mjs +12 -5
- package/fesm2022/sixbell-telco-sdk-components-alert.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-data-table.mjs +5 -2
- package/fesm2022/sixbell-telco-sdk-components-data-table.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs +30 -13
- package/fesm2022/sixbell-telco-sdk-components-dialog.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs +2 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu-bar.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs +10 -4
- package/fesm2022/sixbell-telco-sdk-components-dropdown-menu.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs +1 -1
- package/fesm2022/sixbell-telco-sdk-components-dual-list.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs +32 -6
- package/fesm2022/sixbell-telco-sdk-components-file-upload.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs +272 -23
- package/fesm2022/sixbell-telco-sdk-components-forms-combobox.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs +17 -4
- package/fesm2022/sixbell-telco-sdk-components-forms-date-picker.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs +32 -4
- package/fesm2022/sixbell-telco-sdk-components-forms-form-error.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-form-item.mjs +74 -10
- package/fesm2022/sixbell-telco-sdk-components-forms-form-item.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs +13 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-input.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs +258 -18
- package/fesm2022/sixbell-telco-sdk-components-forms-select.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs +2 -2
- package/fesm2022/sixbell-telco-sdk-components-forms-switch.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs +11 -3
- package/fesm2022/sixbell-telco-sdk-components-forms-textarea.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs +15 -11
- package/fesm2022/sixbell-telco-sdk-components-paginator.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs +22 -4
- package/fesm2022/sixbell-telco-sdk-components-progress.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-components-table.mjs +42 -5
- package/fesm2022/sixbell-telco-sdk-components-table.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs +49 -4
- package/fesm2022/sixbell-telco-sdk-directives-only-numbers.mjs.map +1 -1
- package/fesm2022/sixbell-telco-sdk-layouts.mjs +1 -1
- package/fesm2022/sixbell-telco-sdk-layouts.mjs.map +1 -1
- package/i18n/sdk/en.json +14 -4
- package/i18n/sdk/es.json +14 -4
- package/i18n/sdk/pt.json +14 -4
- package/manifest.json +185 -19
- package/package.json +1 -1
- package/src/_index.css +19 -0
|
@@ -2,6 +2,7 @@ import { CdkListbox, CdkOption } from '@angular/cdk/listbox';
|
|
|
2
2
|
import * as i1 from '@angular/cdk/overlay';
|
|
3
3
|
import { OverlayModule } from '@angular/cdk/overlay';
|
|
4
4
|
import { PortalModule } from '@angular/cdk/portal';
|
|
5
|
+
import { NgTemplateOutlet } from '@angular/common';
|
|
5
6
|
import * as i0 from '@angular/core';
|
|
6
7
|
import { inject, computed, input, booleanAttribute, model, output, signal, viewChild, effect, afterRenderEffect, untracked, ChangeDetectionStrategy, Component } from '@angular/core';
|
|
7
8
|
import { toObservable, toSignal, takeUntilDestroyed } from '@angular/core/rxjs-interop';
|
|
@@ -39,6 +40,11 @@ import { Subject, switchMap, startWith, debounceTime, distinctUntilChanged } fro
|
|
|
39
40
|
// ==============================================================================
|
|
40
41
|
// COMPONENT STYLES
|
|
41
42
|
// ==============================================================================
|
|
43
|
+
/**
|
|
44
|
+
* @internal
|
|
45
|
+
* Classes of an option row; the option sizer uses them too, so it measures what the panel shows
|
|
46
|
+
*/
|
|
47
|
+
const OPTION_ROW_CLASS = 'group-[.cdk-option-active]:bg-base-300 font-body flex w-full items-center justify-between rounded-none px-4 py-2 text-left leading-normal font-normal text-pretty transition-colors duration-150 ease-in-out group-data-disabled:cursor-not-allowed group-data-disabled:bg-transparent group-data-disabled:text-(--color-disabled-content) group-data-disabled:hover:bg-transparent';
|
|
42
48
|
/**
|
|
43
49
|
* Class variance authority configuration for combobox styling
|
|
44
50
|
*/
|
|
@@ -183,6 +189,14 @@ class ComboboxComponent {
|
|
|
183
189
|
generatedId = `st-combobox-${nextComboboxId++}`;
|
|
184
190
|
/** @internal Id applied to the focusable control and referenced by its label */
|
|
185
191
|
resolvedId = computed(() => this.inputId() || this.generatedId);
|
|
192
|
+
/** @internal Id of the options listbox, referenced by the trigger's `aria-controls` */
|
|
193
|
+
listboxId = `${this.generatedId}-listbox`;
|
|
194
|
+
/** @internal Id of the visually hidden label, which names the listbox */
|
|
195
|
+
labelId = `${this.generatedId}-label`;
|
|
196
|
+
/** @internal Id of the option at `index` in the filtered list */
|
|
197
|
+
optionId(index) {
|
|
198
|
+
return `${this.listboxId}-option-${index}`;
|
|
199
|
+
}
|
|
186
200
|
/**
|
|
187
201
|
* Placeholder text displayed when no option is selected
|
|
188
202
|
*/
|
|
@@ -216,6 +230,25 @@ class ComboboxComponent {
|
|
|
216
230
|
* @default true
|
|
217
231
|
*/
|
|
218
232
|
allowClearAll = input(true, { transform: booleanAttribute });
|
|
233
|
+
/**
|
|
234
|
+
* Width of the options panel.
|
|
235
|
+
* - `'trigger'`: as wide as the control; a long option wraps onto more lines.
|
|
236
|
+
* - `'content'`: at least as wide as the control and wider when an option needs it, up to
|
|
237
|
+
* `min(28rem, 100vw - 2rem)`. The width is measured over every option, so searching never resizes the
|
|
238
|
+
* panel. Options stay on one line; past that cap the description, then the label, end in an ellipsis and
|
|
239
|
+
* the row shows its full text as a tooltip. Near the viewport edge the panel aligns to the control's end
|
|
240
|
+
* instead of overflowing.
|
|
241
|
+
* @defaultValue 'trigger'
|
|
242
|
+
*/
|
|
243
|
+
panelWidth = input('trigger');
|
|
244
|
+
/**
|
|
245
|
+
* Size the closed control to its widest option or the placeholder, measured with the option row's own
|
|
246
|
+
* font, padding and check icon for the current `size`. A selected value never truncates and the control
|
|
247
|
+
* keeps its width between selections. The panel then follows its options as with `panelWidth="content"`.
|
|
248
|
+
* The control does not shrink in a flex row (`shrink-0`); `min-w-*` and `w-*` classes on the element still apply.
|
|
249
|
+
* @defaultValue false
|
|
250
|
+
*/
|
|
251
|
+
fitOptions = input(false, { transform: booleanAttribute });
|
|
219
252
|
/**
|
|
220
253
|
* Placeholder text for the search input field
|
|
221
254
|
* @default 'Search...'
|
|
@@ -246,6 +279,34 @@ class ComboboxComponent {
|
|
|
246
279
|
* Uses the entire object if not specified
|
|
247
280
|
*/
|
|
248
281
|
valueKey = input('');
|
|
282
|
+
/**
|
|
283
|
+
* The object property that marks an option as disabled when truthy.
|
|
284
|
+
* A disabled option stays in the list (and in search results), is dimmed,
|
|
285
|
+
* carries `aria-disabled="true"` and cannot be chosen by click or keyboard.
|
|
286
|
+
* Leave empty to keep every option enabled.
|
|
287
|
+
*/
|
|
288
|
+
disabledKey = input('');
|
|
289
|
+
/**
|
|
290
|
+
* The object property holding a secondary text shown right-aligned on the option row
|
|
291
|
+
* (for example why it is disabled: "Already added"). It is part of the
|
|
292
|
+
* option's accessible name.
|
|
293
|
+
*/
|
|
294
|
+
descriptionKey = input('');
|
|
295
|
+
/**
|
|
296
|
+
* The object property naming the group an option belongs to. Options that share a value are listed
|
|
297
|
+
* together under one header showing that value, groups in the order they first appear, each group
|
|
298
|
+
* named by its header for assistive technology. Options without the property are listed first,
|
|
299
|
+
* ungrouped. A group whose options are all filtered out by the search hides its header. Headers
|
|
300
|
+
* cannot be chosen and the arrow keys skip them. Leave empty for a flat list.
|
|
301
|
+
*/
|
|
302
|
+
groupKey = input('');
|
|
303
|
+
/**
|
|
304
|
+
* The object property that marks an option as already taken outside this field when truthy (for
|
|
305
|
+
* example a country added earlier). The option shows the check icon, in the option's own color, but
|
|
306
|
+
* it is not part of the value and never appears in the trigger. Pair it with `disabledKey` so it is
|
|
307
|
+
* dimmed, check included, and cannot be chosen again.
|
|
308
|
+
*/
|
|
309
|
+
checkedKey = input('');
|
|
249
310
|
/**
|
|
250
311
|
* Selection mode: 'single' for single selection, 'multiple' for multi-select
|
|
251
312
|
* @default 'single'
|
|
@@ -347,6 +408,40 @@ class ComboboxComponent {
|
|
|
347
408
|
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
348
409
|
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
349
410
|
];
|
|
411
|
+
/** @internal Content-width panel positions: a panel wider than the control aligns to its end near the viewport edge */
|
|
412
|
+
contentOverlayPositions = [
|
|
413
|
+
{ originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
|
|
414
|
+
{ originX: 'end', originY: 'bottom', overlayX: 'end', overlayY: 'top', offsetY: 4 },
|
|
415
|
+
{ originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
|
|
416
|
+
{ originX: 'end', originY: 'top', overlayX: 'end', overlayY: 'bottom', offsetY: -4 },
|
|
417
|
+
];
|
|
418
|
+
/** @internal Whether the panel sizes to its options (`panelWidth="content"` or `fitOptions`) */
|
|
419
|
+
contentPanel = computed(() => this.fitOptions() || this.panelWidth() === 'content');
|
|
420
|
+
/** @internal Positions bound to the overlay */
|
|
421
|
+
activeOverlayPositions = computed(() => (this.contentPanel() ? this.contentOverlayPositions : this.overlayPositions));
|
|
422
|
+
/** @internal Fixed overlay width: the trigger width, or none when the panel sizes to its options */
|
|
423
|
+
overlayWidth = computed(() => (this.contentPanel() ? '' : this.triggerWidth()));
|
|
424
|
+
/** @internal Classes of the panel box */
|
|
425
|
+
panelClass = computed(() => cn('rounded-box shadow-overlay', this.contentPanel() ? 'w-max max-w-[min(28rem,calc(100vw-2rem))] min-w-full' : 'w-full', this.animationClasses()));
|
|
426
|
+
/**
|
|
427
|
+
* @internal
|
|
428
|
+
* Classes of the hidden option sizer: the panel's menu size, so rows measure alike, plus a reserved scrollbar
|
|
429
|
+
* gutter, so a list that scrolls keeps the width of one that does not; capped like the panel, so a long
|
|
430
|
+
* option cannot widen the control past the panel
|
|
431
|
+
*/
|
|
432
|
+
optionSizerClass = computed(() => cn('menu pointer-events-none invisible h-0 max-w-[min(28rem,calc(100vw-2rem))] scrollbar-gutter-stable flex-nowrap overflow-hidden p-0', this.menuSizeClass()));
|
|
433
|
+
/** @internal Classes of an option row */
|
|
434
|
+
optionRowClass = OPTION_ROW_CLASS;
|
|
435
|
+
/** @internal Texts the closed control must fit with `fitOptions`: the placeholder and every option label */
|
|
436
|
+
valueSizerLabels = computed(() => [
|
|
437
|
+
this.translatedPlaceholder(),
|
|
438
|
+
...this.options().map((option) => this.getDisplayValue(option)),
|
|
439
|
+
]);
|
|
440
|
+
/**
|
|
441
|
+
* @internal
|
|
442
|
+
* Every option in sections, ignoring the search, so the content-width panel keeps its width while filtering
|
|
443
|
+
*/
|
|
444
|
+
allOptionSections = computed(() => this.groupOptions(this.options()));
|
|
350
445
|
/** Real placement of the open panel, bound to `data-side` / `data-align`; null until the CDK places it */
|
|
351
446
|
placement = computed(() => {
|
|
352
447
|
const position = this.currentPosition();
|
|
@@ -416,6 +511,16 @@ class ComboboxComponent {
|
|
|
416
511
|
return displayValue.includes(search);
|
|
417
512
|
});
|
|
418
513
|
});
|
|
514
|
+
/**
|
|
515
|
+
* @internal
|
|
516
|
+
* Filtered options in the order they are listed: ungrouped first, then each `groupKey` group
|
|
517
|
+
*/
|
|
518
|
+
optionSections = computed(() => this.groupOptions(this.filteredOptions()));
|
|
519
|
+
/**
|
|
520
|
+
* @internal
|
|
521
|
+
* Filtered options in the order they are listed, which keyboard navigation, `data-option-index` and the option ids follow
|
|
522
|
+
*/
|
|
523
|
+
orderedOptions = computed(() => this.groupKey() ? this.optionSections().flatMap((section) => section.options.map((entry) => entry.option)) : this.filteredOptions());
|
|
419
524
|
/**
|
|
420
525
|
* Whether the overlay is currently open or in the process of opening/closing
|
|
421
526
|
* @returns True if overlay is visible or animating
|
|
@@ -574,13 +679,12 @@ class ComboboxComponent {
|
|
|
574
679
|
* @internal
|
|
575
680
|
*/
|
|
576
681
|
menuClass = computed(() => {
|
|
577
|
-
return cn('menu max-h-72 w-full flex-nowrap overflow-y-auto overscroll-contain p-0 focus-within:outline-hidden focus:outline-hidden focus-visible:outline-hidden',
|
|
578
|
-
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
582
|
-
|
|
583
|
-
});
|
|
682
|
+
return cn('menu scroll-fade-y max-h-72 w-full flex-nowrap overflow-y-auto overscroll-contain p-0 focus-within:outline-hidden focus:outline-hidden focus-visible:outline-hidden', this.menuSizeClass());
|
|
683
|
+
});
|
|
684
|
+
/** @internal Menu size modifier shared by the options list and the option sizer */
|
|
685
|
+
menuSizeClass = computed(() => {
|
|
686
|
+
const size = this.size();
|
|
687
|
+
return size ? `menu-${size}` : '';
|
|
584
688
|
});
|
|
585
689
|
/**
|
|
586
690
|
* CSS classes for the badge
|
|
@@ -624,7 +728,15 @@ class ComboboxComponent {
|
|
|
624
728
|
*/
|
|
625
729
|
translatedNoResultsText = computed(() => {
|
|
626
730
|
const customNoResults = this.noResultsText();
|
|
627
|
-
return customNoResults || this.
|
|
731
|
+
return customNoResults || this.translateLabel({ key: 'sdk.combobox.noResultsFound', fallback: 'No results found' });
|
|
732
|
+
});
|
|
733
|
+
/**
|
|
734
|
+
* @internal
|
|
735
|
+
* Id of the active option, for the search input's `aria-activedescendant`, or `null` when none is active.
|
|
736
|
+
*/
|
|
737
|
+
activeOptionId = computed(() => {
|
|
738
|
+
const index = this.activeOptionIndex();
|
|
739
|
+
return index >= 0 && index < this.orderedOptions().length ? this.optionId(index) : null;
|
|
628
740
|
});
|
|
629
741
|
/**
|
|
630
742
|
* Current search input value for template binding
|
|
@@ -738,8 +850,8 @@ class ComboboxComponent {
|
|
|
738
850
|
if (this.animationState() !== 'opening' && this.animationState() !== 'open')
|
|
739
851
|
return;
|
|
740
852
|
this.searchInputRef()?.nativeElement?.focus();
|
|
741
|
-
//
|
|
742
|
-
this.setDefaultActiveOption();
|
|
853
|
+
// The selected option starts active in single mode; otherwise the first enabled one
|
|
854
|
+
this.setDefaultActiveOption(true);
|
|
743
855
|
}, 100);
|
|
744
856
|
}
|
|
745
857
|
else if (currentState === 'open') {
|
|
@@ -853,7 +965,7 @@ class ComboboxComponent {
|
|
|
853
965
|
* @param option - The selected option
|
|
854
966
|
*/
|
|
855
967
|
handleOptionSelect(option) {
|
|
856
|
-
if (this.disabled())
|
|
968
|
+
if (this.disabled() || this.isOptionDisabled(option))
|
|
857
969
|
return;
|
|
858
970
|
const selectionType = this.selectionType();
|
|
859
971
|
const currentValue = this.value();
|
|
@@ -906,7 +1018,7 @@ class ComboboxComponent {
|
|
|
906
1018
|
const focusedOption = this.optionsList()?.nativeElement.querySelector('.cdk-option-active');
|
|
907
1019
|
if (focusedOption) {
|
|
908
1020
|
const optionIndex = parseInt(focusedOption.getAttribute('data-option-index') || '0');
|
|
909
|
-
const filteredOptions = this.
|
|
1021
|
+
const filteredOptions = this.orderedOptions();
|
|
910
1022
|
if (optionIndex >= 0 && optionIndex < filteredOptions.length) {
|
|
911
1023
|
this.handleOptionSelect(filteredOptions[optionIndex]);
|
|
912
1024
|
}
|
|
@@ -920,7 +1032,7 @@ class ComboboxComponent {
|
|
|
920
1032
|
handleSearchKeydown(event) {
|
|
921
1033
|
if (this.disabled())
|
|
922
1034
|
return;
|
|
923
|
-
const filteredOptions = this.
|
|
1035
|
+
const filteredOptions = this.orderedOptions();
|
|
924
1036
|
const currentIndex = this.activeOptionIndex();
|
|
925
1037
|
switch (event.key) {
|
|
926
1038
|
case 'ArrowDown': {
|
|
@@ -928,7 +1040,7 @@ class ComboboxComponent {
|
|
|
928
1040
|
if (this.stopPropagation()) {
|
|
929
1041
|
event.stopPropagation();
|
|
930
1042
|
}
|
|
931
|
-
const nextIndex = currentIndex < filteredOptions.length - 1 ? currentIndex
|
|
1043
|
+
const nextIndex = this.findEnabledIndex(filteredOptions, currentIndex < filteredOptions.length - 1 ? currentIndex : -1, 1);
|
|
932
1044
|
this.setActiveOption(nextIndex);
|
|
933
1045
|
break;
|
|
934
1046
|
}
|
|
@@ -937,7 +1049,7 @@ class ComboboxComponent {
|
|
|
937
1049
|
if (this.stopPropagation()) {
|
|
938
1050
|
event.stopPropagation();
|
|
939
1051
|
}
|
|
940
|
-
const prevIndex = currentIndex > 0 ? currentIndex
|
|
1052
|
+
const prevIndex = this.findEnabledIndex(filteredOptions, currentIndex > 0 ? currentIndex : filteredOptions.length, -1);
|
|
941
1053
|
this.setActiveOption(prevIndex);
|
|
942
1054
|
break;
|
|
943
1055
|
}
|
|
@@ -1105,6 +1217,36 @@ class ComboboxComponent {
|
|
|
1105
1217
|
isActiveOption(index) {
|
|
1106
1218
|
return this.activeOptionIndex() === index;
|
|
1107
1219
|
}
|
|
1220
|
+
/**
|
|
1221
|
+
* Whether an option is disabled through `disabledKey`
|
|
1222
|
+
* @param option - The option to check
|
|
1223
|
+
* @returns True if the option cannot be chosen
|
|
1224
|
+
*/
|
|
1225
|
+
isOptionDisabled(option) {
|
|
1226
|
+
const disabledKey = this.disabledKey();
|
|
1227
|
+
return !!disabledKey && !!option && typeof option === 'object' && !!option[disabledKey];
|
|
1228
|
+
}
|
|
1229
|
+
/**
|
|
1230
|
+
* Whether an option is marked as already taken through `checkedKey`
|
|
1231
|
+
* @param option - The option to check
|
|
1232
|
+
* @returns True if the option shows the check without being part of the value
|
|
1233
|
+
*/
|
|
1234
|
+
isOptionChecked(option) {
|
|
1235
|
+
const checkedKey = this.checkedKey();
|
|
1236
|
+
return !!checkedKey && !!option && typeof option === 'object' && !!option[checkedKey];
|
|
1237
|
+
}
|
|
1238
|
+
/**
|
|
1239
|
+
* Gets the secondary text for an option through `descriptionKey`
|
|
1240
|
+
* @param option - The option to read
|
|
1241
|
+
* @returns The secondary text, or an empty string
|
|
1242
|
+
*/
|
|
1243
|
+
getOptionDescription(option) {
|
|
1244
|
+
const descriptionKey = this.descriptionKey();
|
|
1245
|
+
if (!descriptionKey || !option || typeof option !== 'object')
|
|
1246
|
+
return '';
|
|
1247
|
+
const description = option[descriptionKey];
|
|
1248
|
+
return description === undefined || description === null ? '' : String(description);
|
|
1249
|
+
}
|
|
1108
1250
|
/**
|
|
1109
1251
|
* Gets the display value for an option
|
|
1110
1252
|
* @param option - The option to get display value for
|
|
@@ -1150,11 +1292,47 @@ class ComboboxComponent {
|
|
|
1150
1292
|
* Updates the trigger button width for overlay positioning
|
|
1151
1293
|
*/
|
|
1152
1294
|
updateTriggerWidth() {
|
|
1153
|
-
|
|
1295
|
+
// Fractional widths round up: rounding down would make an option that exactly fills the control wrap
|
|
1296
|
+
const width = Math.ceil(this.fieldRef()?.nativeElement.getBoundingClientRect().width ?? 0);
|
|
1154
1297
|
if (!width)
|
|
1155
1298
|
return;
|
|
1156
1299
|
this.triggerWidth.set(width);
|
|
1157
1300
|
}
|
|
1301
|
+
/**
|
|
1302
|
+
* @internal
|
|
1303
|
+
* On hover of a single-line option, shows its full text as a tooltip when its label or description is cut off
|
|
1304
|
+
* @param event - The pointer event on the option row
|
|
1305
|
+
* @param option - The option the row shows
|
|
1306
|
+
*/
|
|
1307
|
+
syncOptionTitle(event, option) {
|
|
1308
|
+
this.syncRowTitle(event.currentTarget, option);
|
|
1309
|
+
}
|
|
1310
|
+
/**
|
|
1311
|
+
* Sets the full-text tooltip of an option row when its label or description is cut off, or removes it;
|
|
1312
|
+
* runs on hover and when the row becomes the keyboard-active one
|
|
1313
|
+
* @param row - The option row
|
|
1314
|
+
* @param option - The option the row shows
|
|
1315
|
+
*/
|
|
1316
|
+
syncRowTitle(row, option) {
|
|
1317
|
+
const parts = row.querySelectorAll('[data-st-option-label], [data-st-option-description]');
|
|
1318
|
+
const truncated = Array.from(parts).some((part) => part.scrollWidth > part.clientWidth);
|
|
1319
|
+
if (truncated) {
|
|
1320
|
+
row.setAttribute('title', this.getOptionFullText(option));
|
|
1321
|
+
}
|
|
1322
|
+
else {
|
|
1323
|
+
row.removeAttribute('title');
|
|
1324
|
+
}
|
|
1325
|
+
}
|
|
1326
|
+
/**
|
|
1327
|
+
* Gets the full text of an option: its label, then its description when it has one
|
|
1328
|
+
* @param option - The option to read
|
|
1329
|
+
* @returns The text shown as the tooltip of a truncated option
|
|
1330
|
+
*/
|
|
1331
|
+
getOptionFullText(option) {
|
|
1332
|
+
const description = this.getOptionDescription(option);
|
|
1333
|
+
const label = this.getDisplayValue(option);
|
|
1334
|
+
return description ? `${label}, ${description}` : label;
|
|
1335
|
+
}
|
|
1158
1336
|
/**
|
|
1159
1337
|
* Gets the value property from an option
|
|
1160
1338
|
* @param option - The option to get value from
|
|
@@ -1185,6 +1363,48 @@ class ComboboxComponent {
|
|
|
1185
1363
|
return optionValue === currentValue || option === value;
|
|
1186
1364
|
});
|
|
1187
1365
|
}
|
|
1366
|
+
/**
|
|
1367
|
+
* Gets the group an option belongs to through `groupKey`
|
|
1368
|
+
* @param option - The option to read
|
|
1369
|
+
* @returns The group name, or null when the option is ungrouped
|
|
1370
|
+
*/
|
|
1371
|
+
getOptionGroup(option) {
|
|
1372
|
+
const groupKey = this.groupKey();
|
|
1373
|
+
if (!groupKey || !option || typeof option !== 'object')
|
|
1374
|
+
return null;
|
|
1375
|
+
const group = option[groupKey];
|
|
1376
|
+
return group === undefined || group === null || group === '' ? null : String(group);
|
|
1377
|
+
}
|
|
1378
|
+
/**
|
|
1379
|
+
* Splits options into the ungrouped run, listed first, and one section per group in first-appearance order.
|
|
1380
|
+
* `index` is the option's position in the listed order; `headerId` is unique per instance.
|
|
1381
|
+
* @param options - The options to list
|
|
1382
|
+
* @returns The sections to render
|
|
1383
|
+
*/
|
|
1384
|
+
groupOptions(options) {
|
|
1385
|
+
const ungrouped = [];
|
|
1386
|
+
const groups = new Map();
|
|
1387
|
+
for (const option of options) {
|
|
1388
|
+
const group = this.getOptionGroup(option);
|
|
1389
|
+
if (group === null) {
|
|
1390
|
+
ungrouped.push(option);
|
|
1391
|
+
}
|
|
1392
|
+
else {
|
|
1393
|
+
groups.set(group, [...(groups.get(group) ?? []), option]);
|
|
1394
|
+
}
|
|
1395
|
+
}
|
|
1396
|
+
let index = 0;
|
|
1397
|
+
const entries = (list) => list.map((option) => ({ option, index: index++ }));
|
|
1398
|
+
const sections = [];
|
|
1399
|
+
if (ungrouped.length > 0) {
|
|
1400
|
+
sections.push({ label: null, headerId: null, options: entries(ungrouped) });
|
|
1401
|
+
}
|
|
1402
|
+
let groupIndex = 0;
|
|
1403
|
+
for (const [label, list] of groups) {
|
|
1404
|
+
sections.push({ label, headerId: `${this.listboxId}-group-${groupIndex++}`, options: entries(list) });
|
|
1405
|
+
}
|
|
1406
|
+
return sections;
|
|
1407
|
+
}
|
|
1188
1408
|
/**
|
|
1189
1409
|
* Triggers blur event for form validation
|
|
1190
1410
|
*/
|
|
@@ -1217,6 +1437,22 @@ class ComboboxComponent {
|
|
|
1217
1437
|
setTimeout(() => this.setDefaultActiveOption(), 0);
|
|
1218
1438
|
});
|
|
1219
1439
|
}
|
|
1440
|
+
/**
|
|
1441
|
+
* Finds the next enabled option index, wrapping around the list
|
|
1442
|
+
* @param options - The options being navigated
|
|
1443
|
+
* @param from - The index to start from (exclusive)
|
|
1444
|
+
* @param step - 1 to move down, -1 to move up
|
|
1445
|
+
* @returns The index of the next enabled option, or -1 if every option is disabled
|
|
1446
|
+
*/
|
|
1447
|
+
findEnabledIndex(options, from, step) {
|
|
1448
|
+
const count = options.length;
|
|
1449
|
+
for (let offset = 1; offset <= count; offset++) {
|
|
1450
|
+
const index = (((from + step * offset) % count) + count) % count;
|
|
1451
|
+
if (!this.isOptionDisabled(options[index]))
|
|
1452
|
+
return index;
|
|
1453
|
+
}
|
|
1454
|
+
return -1;
|
|
1455
|
+
}
|
|
1220
1456
|
/**
|
|
1221
1457
|
* Sets the active option for keyboard navigation
|
|
1222
1458
|
* @param index - The index of the option to make active
|
|
@@ -1226,12 +1462,17 @@ class ComboboxComponent {
|
|
|
1226
1462
|
this.updateActiveOptionVisually();
|
|
1227
1463
|
}
|
|
1228
1464
|
/**
|
|
1229
|
-
* Sets the first option as active
|
|
1465
|
+
* Sets the first enabled option as active; on open in single mode, the selected option, so the highlight and
|
|
1466
|
+
* the check sit on the same row. A search keeps the first match.
|
|
1467
|
+
* @param preferSelected - Whether an enabled selected option wins over the first one
|
|
1230
1468
|
*/
|
|
1231
|
-
setDefaultActiveOption() {
|
|
1232
|
-
const filteredOptions = this.
|
|
1469
|
+
setDefaultActiveOption(preferSelected = false) {
|
|
1470
|
+
const filteredOptions = this.orderedOptions();
|
|
1233
1471
|
if (filteredOptions.length > 0) {
|
|
1234
|
-
this.
|
|
1472
|
+
const selectedIndex = preferSelected && this.selectionType() !== 'multiple'
|
|
1473
|
+
? filteredOptions.findIndex((option) => this.isOptionSelected(option) && !this.isOptionDisabled(option))
|
|
1474
|
+
: -1;
|
|
1475
|
+
this.setActiveOption(selectedIndex >= 0 ? selectedIndex : this.findEnabledIndex(filteredOptions, -1, 1));
|
|
1235
1476
|
}
|
|
1236
1477
|
}
|
|
1237
1478
|
/**
|
|
@@ -1253,6 +1494,9 @@ class ComboboxComponent {
|
|
|
1253
1494
|
const activeOption = this.optionsList()?.nativeElement.querySelector(`[data-option-index="${currentIndex}"]`);
|
|
1254
1495
|
if (activeOption) {
|
|
1255
1496
|
activeOption.classList.add('cdk-option-active');
|
|
1497
|
+
const row = activeOption.querySelector(':scope > button');
|
|
1498
|
+
if (row && this.contentPanel())
|
|
1499
|
+
this.syncRowTitle(row, this.orderedOptions()[currentIndex]);
|
|
1256
1500
|
// Scroll into view if needed
|
|
1257
1501
|
activeOption.scrollIntoView({ block: 'nearest' });
|
|
1258
1502
|
}
|
|
@@ -1271,19 +1515,20 @@ class ComboboxComponent {
|
|
|
1271
1515
|
});
|
|
1272
1516
|
}
|
|
1273
1517
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ComboboxComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1274
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ComboboxComponent, isStandalone: true, selector: "st-combobox", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showOptional: { classPropertyName: "showOptional", publicName: "showOptional", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, ghost: { classPropertyName: "ghost", publicName: "ghost", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", 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 }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, allowClearAll: { classPropertyName: "allowClearAll", publicName: "allowClearAll", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, noResultsText: { classPropertyName: "noResultsText", publicName: "noResultsText", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, displayKey: { classPropertyName: "displayKey", publicName: "displayKey", isSignal: true, isRequired: false, transformFunction: null }, valueKey: { classPropertyName: "valueKey", publicName: "valueKey", isSignal: true, isRequired: false, transformFunction: null }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: true, isRequired: false, transformFunction: null }, searchDebounced: { classPropertyName: "searchDebounced", publicName: "searchDebounced", isSignal: true, isRequired: false, transformFunction: null }, searchDebounceTime: { classPropertyName: "searchDebounceTime", publicName: "searchDebounceTime", isSignal: true, isRequired: false, transformFunction: null }, stopPropagation: { classPropertyName: "stopPropagation", publicName: "stopPropagation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", value: "valueChange", blurred: "blurred", valueUpdated: "valueUpdated", clicked: "clicked", keyDownEnter: "keyDownEnter", keyDownSpace: "keyDownSpace", triggered: "triggered", searchQuery: "searchQuery" }, providers: [
|
|
1518
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "19.2.25", type: ComboboxComponent, isStandalone: true, selector: "st-combobox", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showOptional: { classPropertyName: "showOptional", publicName: "showOptional", isSignal: true, isRequired: false, transformFunction: null }, optionalText: { classPropertyName: "optionalText", publicName: "optionalText", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null }, ghost: { classPropertyName: "ghost", publicName: "ghost", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", 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 }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, parentForm: { classPropertyName: "parentForm", publicName: "parentForm", isSignal: true, isRequired: false, transformFunction: null }, formControlName: { classPropertyName: "formControlName", publicName: "formControlName", isSignal: true, isRequired: false, transformFunction: null }, allowClear: { classPropertyName: "allowClear", publicName: "allowClear", isSignal: true, isRequired: false, transformFunction: null }, allowClearAll: { classPropertyName: "allowClearAll", publicName: "allowClearAll", isSignal: true, isRequired: false, transformFunction: null }, panelWidth: { classPropertyName: "panelWidth", publicName: "panelWidth", isSignal: true, isRequired: false, transformFunction: null }, fitOptions: { classPropertyName: "fitOptions", publicName: "fitOptions", isSignal: true, isRequired: false, transformFunction: null }, searchPlaceholder: { classPropertyName: "searchPlaceholder", publicName: "searchPlaceholder", isSignal: true, isRequired: false, transformFunction: null }, noResultsText: { classPropertyName: "noResultsText", publicName: "noResultsText", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, displayKey: { classPropertyName: "displayKey", publicName: "displayKey", isSignal: true, isRequired: false, transformFunction: null }, valueKey: { classPropertyName: "valueKey", publicName: "valueKey", isSignal: true, isRequired: false, transformFunction: null }, disabledKey: { classPropertyName: "disabledKey", publicName: "disabledKey", isSignal: true, isRequired: false, transformFunction: null }, descriptionKey: { classPropertyName: "descriptionKey", publicName: "descriptionKey", isSignal: true, isRequired: false, transformFunction: null }, groupKey: { classPropertyName: "groupKey", publicName: "groupKey", isSignal: true, isRequired: false, transformFunction: null }, checkedKey: { classPropertyName: "checkedKey", publicName: "checkedKey", isSignal: true, isRequired: false, transformFunction: null }, selectionType: { classPropertyName: "selectionType", publicName: "selectionType", isSignal: true, isRequired: false, transformFunction: null }, searchDebounced: { classPropertyName: "searchDebounced", publicName: "searchDebounced", isSignal: true, isRequired: false, transformFunction: null }, searchDebounceTime: { classPropertyName: "searchDebounceTime", publicName: "searchDebounceTime", isSignal: true, isRequired: false, transformFunction: null }, stopPropagation: { classPropertyName: "stopPropagation", publicName: "stopPropagation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { disabled: "disabledChange", value: "valueChange", blurred: "blurred", valueUpdated: "valueUpdated", clicked: "clicked", keyDownEnter: "keyDownEnter", keyDownSpace: "keyDownSpace", triggered: "triggered", searchQuery: "searchQuery" }, host: { properties: { "class.inline-block": "fitOptions()", "class.align-top": "fitOptions()", "class.shrink-0": "fitOptions()" } }, providers: [
|
|
1275
1519
|
{
|
|
1276
1520
|
provide: NG_VALUE_ACCESSOR,
|
|
1277
1521
|
useExisting: ComboboxComponent,
|
|
1278
1522
|
multi: true,
|
|
1279
1523
|
},
|
|
1280
|
-
], viewQueries: [{ propertyName: "fieldRef", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "triggerRef", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "optionsList", first: true, predicate: ["optionsList"], descendants: true, isSignal: true }, { propertyName: "listbox", first: true, predicate: ["listbox"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- Field chrome click is pointer-only sugar; keyboard access is the focusable trigger button inside. -->\n@let isOpen = this.isOpen(); @let triggerWidth = this.triggerWidth(); @let dataState = this.dataState();\n@let filteredOptions = this.filteredOptions(); @let displayValue = this.displayValue(); @let multipleDisplayInfo = this.multipleDisplayInfo();\n@let label = this.label();\n\n<fieldset class=\"fieldset p-0\">\n\t@if (label) {\n\t\t<legend class=\"fieldset-legend font-body w-full items-center justify-between gap-2 pt-0 font-normal text-pretty\">\n\t\t\t<span\n\t\t\t\t>{{ label }}\n\t\t\t\t@if (fieldA11y.required()) {\n\t\t\t\t\t<span aria-hidden=\"true\" data-st-required-marker class=\"text-error-strong ms-0.5\">*</span>\n\t\t\t\t}\n\t\t\t</span>\n\t\t\t@if (showOptional()) {\n\t\t\t\t<span class=\"label font-body text-xs font-normal\">{{ optionalText() | translate }}</span>\n\t\t\t}\n\t\t</legend>\n\t}\n\n\t<div\n\t\t#field\n\t\tcdkOverlayOrigin\n\t\t#overlayOrigin=\"cdkOverlayOrigin\"\n\t\t[class]=\"validationClass()\"\n\t\t[attr.data-open]=\"isOpen ? '' : null\"\n\t\t(click)=\"handleFieldChromeClick($event)\"\n\t>\n\t\t<button\n\t\t\t#trigger\n\t\t\t[id]=\"resolvedId()\"\n\t\t\t[attr.aria-required]=\"fieldA11y.required() || null\"\n\t\t\t[attr.aria-describedby]=\"fieldA11y.describedBy()\"\n\t\t\tclass=\"min-w-0 flex-1 grow cursor-pointer bg-transparent p-0 text-left outline-hidden\"\n\t\t\t(click)=\"handleClick($event)\"\n\t\t\t(keydown)=\"handleTriggerKeydown($event)\"\n\t\t\ttype=\"button\"\n\t\t\taria-haspopup=\"true\"\n\t\t\trole=\"combobox\"\n\t\t\t[attr.aria-controls]=\"'combobox-list'\"\n\t\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t\t[disabled]=\"disabled()\"\n\t\t>\n\t\t\t<span class=\"block min-w-0 truncate text-left\">\n\t\t\t\t@if (selectionType() === 'multiple' && multipleDisplayInfo) {\n\t\t\t\t\t<span class=\"inline-flex items-center gap-2\">\n\t\t\t\t\t\t<span class=\"truncate\">{{ multipleDisplayInfo.firstItem }}</span>\n\t\t\t\t\t\t@if (multipleDisplayInfo.additionalCount > 0) {\n\t\t\t\t\t\t\t<st-badge variant=\"primary\" [soft]=\"true\" [size]=\"badgeClass()\">+{{ multipleDisplayInfo.additionalCount }}</st-badge>\n\t\t\t\t\t\t}\n\t\t\t\t\t</span>\n\t\t\t\t} @else {\n\t\t\t\t\t{{ displayValue }}\n\t\t\t\t}\n\t\t\t</span>\n\t\t</button>\n\t\t@if (showClearButton()) {\n\t\t\t<button\n\t\t\t\ttype=\"button\"\n\t\t\t\tdata-st-clear\n\t\t\t\tclass=\"btn btn-ghost btn-square shrink-0 cursor-pointer [--fontsize:1em] [--size:1.25em]\"\n\t\t\t\t(click)=\"handleClearSelection($event)\"\n\t\t\t\t(keydown.enter)=\"handleClearSelection($event)\"\n\t\t\t\t(keydown.space)=\"handleClearSelection($event)\"\n\t\t\t\t[attr.aria-label]=\"clearSelectionLabel()\"\n\t\t\t>\n\t\t\t\t<st-icon [icon]=\"iconClose\"></st-icon>\n\t\t\t</button>\n\t\t}\n\t\t<span data-st-chevron class=\"pointer-events-none inline-flex size-[1em] shrink-0 items-center justify-center\" aria-hidden=\"true\">\n\t\t\t<st-icon [icon]=\"iconChevronDown\"></st-icon>\n\t\t</span>\n\t</div>\n\n\t<ng-template\n\t\tcdkConnectedOverlay\n\t\t[cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n\t\t[cdkConnectedOverlayOpen]=\"isOpen\"\n\t\t[cdkConnectedOverlayPositions]=\"overlayPositions\"\n\t\t[cdkConnectedOverlayDisableClose]=\"true\"\n\t\t[cdkConnectedOverlayWidth]=\"triggerWidth\"\n\t\t[cdkConnectedOverlayMinWidth]=\"triggerWidth\"\n\t\t(detach)=\"handleDetach()\"\n\t\t(overlayOutsideClick)=\"handleClickOutside($event)\"\n\t\t(positionChange)=\"onPositionChange($event)\"\n\t>\n\t\t<div class=\"contents\" [attr.data-theme]=\"themeDomService.themeOf(field)\">\n\t\t\t<div\n\t\t\t\t[class]=\"'rounded-box shadow-overlay w-full ' + animationClasses()\"\n\t\t\t\t(animationend)=\"onAnimationEnd($event)\"\n\t\t\t\t[attr.data-state]=\"dataState\"\n\t\t\t\t[attr.data-side]=\"placement()?.side\"\n\t\t\t\t[attr.data-align]=\"placement()?.align\"\n\t\t\t>\n\t\t\t\t<div class=\"bg-base-200 rounded-box border-neutral overflow-hidden border border-solid\">\n\t\t\t\t\t<!-- Search Input -->\n\t\t\t\t\t<div class=\"border-neutral border-b\">\n\t\t\t\t\t\t@let searchInputClass = this.searchInputClass();\n\t\t\t\t\t\t<div [class]=\"searchInputClass\">\n\t\t\t\t\t\t\t<st-icon class=\"text-base-content-muted\" [icon]=\"iconSearch\"></st-icon>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t#searchInput\n\t\t\t\t\t\t\t\tclass=\"placeholder:text-base-content-muted w-full border-transparent py-0 focus-within:outline-hidden focus:border-transparent focus:outline-hidden\"\n\t\t\t\t\t\t\t\t[value]=\"currentSearchValue\"\n\t\t\t\t\t\t\t\t(input)=\"handleSearchInput($event)\"\n\t\t\t\t\t\t\t\t(keydown)=\"handleSearchKeydown($event)\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t[placeholder]=\"translatedSearchPlaceholder()\"\n\t\t\t\t\t\t\t\t[attr.aria-label]=\"searchOptionsLabel()\"\n\t\t\t\t\t\t\t\t[disabled]=\"!isOpen\"\n\t\t\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<!-- Options List -->\n\t\t\t\t\t@let menuClass = this.menuClass();\n\t\t\t\t\t<ul\n\t\t\t\t\t\t[class]=\"menuClass\"\n\t\t\t\t\t\tcdkListbox\n\t\t\t\t\t\tcdkListboxUseActiveDescendant\n\t\t\t\t\t\t[cdkListboxMultiple]=\"selectionType() === 'multiple'\"\n\t\t\t\t\t\taria-labelledby=\"Combobox options\"\n\t\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\t\t#optionsList\n\t\t\t\t\t\t[tabindex]=\"-1\"\n\t\t\t\t\t\t(keydown)=\"handleListboxKeydown($event)\"\n\t\t\t\t\t\t(selectionChange)=\"handleSelectionChange($event)\"\n\t\t\t\t\t>\n\t\t\t\t\t\t@for (option of filteredOptions; track $index) {\n\t\t\t\t\t\t\t<li [cdkOption]=\"option\" class=\"group\" [attr.data-option-index]=\"$index\" [class.cdk-option-active]=\"isActiveOption($index)\">\n\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\tclass=\"group-[.cdk-option-active]:bg-base-300 font-body flex w-full items-center justify-between rounded-none px-4 py-2 text-left leading-normal font-normal text-pretty transition-colors duration-150 ease-in-out\"\n\t\t\t\t\t\t\t\t\t(click)=\"handleOptionSelect(option)\"\n\t\t\t\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t<span class=\"min-w-0 flex-1 wrap-break-word whitespace-normal\">{{ getDisplayValue(option) }}</span>\n\n\t\t\t\t\t\t\t\t\t@if (isOptionSelected(option)) {\n\t\t\t\t\t\t\t\t\t\t<st-icon class=\"h-4 w-4 shrink-0\" [icon]=\"iconCheck\"></st-icon>\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t<!-- Empty state -->\n\t\t\t\t\t\t@if (filteredOptions.length === 0) {\n\t\t\t\t\t\t\t<li class=\"text-base-content-muted px-4 py-2 text-center\">\n\t\t\t\t\t\t\t\t<span>{{ translatedNoResultsText() }}</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t}\n\t\t\t\t\t</ul>\n\n\t\t\t\t\t<!-- Clear All button for multiple selection -->\n\t\t\t\t\t@if (selectionType() === 'multiple' && allowClearAll() && value() && isArray(value()) && value().length > 0) {\n\t\t\t\t\t\t<div class=\"border-base-300 border-t p-2\">\n\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t[block]=\"true\"\n\t\t\t\t\t\t\t\t(clicked)=\"clearSelection()\"\n\t\t\t\t\t\t\t\t(keydown)=\"handleClearButtonKeydown($event)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{{ clearAllLabel() }}\n\t\t\t\t\t\t\t</st-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</ng-template>\n\n\t@if (label) {\n\t\t<label class=\"sr-only\" [for]=\"resolvedId()\">{{ label }}</label>\n\t}\n\n\t<!-- Additional content -->\n\t<ng-content></ng-content>\n</fieldset>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "ngmodule", type: PortalModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: CdkListbox, selector: "[cdkListbox]", inputs: ["id", "tabindex", "cdkListboxValue", "cdkListboxMultiple", "cdkListboxDisabled", "cdkListboxUseActiveDescendant", "cdkListboxOrientation", "cdkListboxCompareWith", "cdkListboxNavigationWrapDisabled", "cdkListboxNavigatesDisabledOptions"], outputs: ["cdkListboxValueChange"], exportAs: ["cdkListbox"] }, { kind: "directive", type: CdkOption, selector: "[cdkOption]", inputs: ["id", "cdkOption", "cdkOptionTypeaheadLabel", "cdkOptionDisabled", "tabindex"], exportAs: ["cdkOption"] }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon", "ariaLabel"] }, { kind: "component", type: BadgeComponent, selector: "st-badge", inputs: ["variant", "size", "outline", "soft", "dash", "ghost", "icon", "iconPosition", "truncate"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled", "stopPropagation", "ariaLabel", "ariaExpanded", "ariaPressed", "ariaDescribedBy", "ariaControls"], outputs: ["clicked", "pointerDown", "keyDownEnter", "keyDownSpace", "triggered"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1524
|
+
], viewQueries: [{ propertyName: "fieldRef", first: true, predicate: ["field"], descendants: true, isSignal: true }, { propertyName: "triggerRef", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "searchInputRef", first: true, predicate: ["searchInput"], descendants: true, isSignal: true }, { propertyName: "optionsList", first: true, predicate: ["optionsList"], descendants: true, isSignal: true }, { propertyName: "listbox", first: true, predicate: ["listbox"], descendants: true, isSignal: true }], ngImport: i0, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- Field chrome click is pointer-only sugar; keyboard access is the focusable trigger button inside. -->\n@let isOpen = this.isOpen(); @let triggerWidth = this.triggerWidth(); @let dataState = this.dataState();\n@let filteredOptions = this.filteredOptions(); @let displayValue = this.displayValue(); @let multipleDisplayInfo = this.multipleDisplayInfo();\n@let label = this.label();\n@let fitOptions = this.fitOptions(); @let contentPanel = this.contentPanel();\n\n<!-- One option on a single line (content-width panel and option sizer): label, description, check slot (always 16px in the sizer) -->\n<ng-template #optionLine let-option let-sizer=\"sizer\">\n\t@let lineDescription = getOptionDescription(option);\n\t<span class=\"flex min-w-0 grow items-center\">\n\t\t<span data-st-option-label [class]=\"lineDescription ? 'max-w-[calc(100%-1.25rem)] shrink-0 truncate' : 'max-w-full shrink-0 truncate'\">{{\n\t\t\tgetDisplayValue(option)\n\t\t}}</span>\n\t\t@if (lineDescription) {\n\t\t\t<span class=\"sr-only\">, </span>\n\t\t\t<span\n\t\t\t\tdata-st-option-description\n\t\t\t\tclass=\"text-base-content-muted ms-3 me-2 min-w-0 grow truncate text-end text-sm group-data-disabled:text-(--color-disabled-content)\"\n\t\t\t\t>{{ lineDescription }}</span\n\t\t\t>\n\t\t}\n\t</span>\n\t@if (sizer) {\n\t\t<span class=\"size-4 shrink-0\"></span>\n\t} @else if (isOptionSelected(option)) {\n\t\t<st-icon class=\"h-4 w-4 shrink-0\" [icon]=\"iconCheck\"></st-icon>\n\t} @else if (isOptionChecked(option)) {\n\t\t<st-icon data-st-option-checked class=\"h-4 w-4 shrink-0 group-data-disabled:text-(--color-disabled-content)\" [icon]=\"iconCheck\"></st-icon>\n\t} @else {\n\t\t<span aria-hidden=\"true\" class=\"size-4 shrink-0\"></span>\n\t}\n</ng-template>\n\n<!-- Hidden stack of every option row (search ignored), so CSS takes the widest as the width -->\n<ng-template #optionSizer let-placement>\n\t<ul aria-hidden=\"true\" data-st-option-sizer [class]=\"optionSizerClass() + ' ' + placement\">\n\t\t@for (section of allOptionSections(); track section.label) {\n\t\t\t@if (section.label) {\n\t\t\t\t<li class=\"menu-title px-4 font-semibold whitespace-nowrap\">{{ section.label }}</li>\n\t\t\t}\n\t\t\t@for (entry of section.options; track entry.index) {\n\t\t\t\t<li>\n\t\t\t\t\t<div [class]=\"optionRowClass + ' whitespace-nowrap'\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionLine; context: { $implicit: entry.option, sizer: true }\" />\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t}\n\t\t}\n\t</ul>\n</ng-template>\n\n<fieldset class=\"fieldset p-0\">\n\t@if (label) {\n\t\t<legend class=\"fieldset-legend font-body w-full items-center justify-between gap-2 pt-0 font-normal text-pretty\">\n\t\t\t<span\n\t\t\t\t>{{ label }}\n\t\t\t\t@if (fieldA11y.required()) {\n\t\t\t\t\t<span aria-hidden=\"true\" data-st-required-marker class=\"text-error-strong ms-0.5\">*</span>\n\t\t\t\t}\n\t\t\t</span>\n\t\t\t@if (showOptional()) {\n\t\t\t\t<span class=\"label font-body text-xs font-normal\">{{ optionalText() | translate }}</span>\n\t\t\t}\n\t\t</legend>\n\t}\n\n\t<div [class]=\"fitOptions ? 'grid' : 'contents'\">\n\t\t@if (fitOptions) {\n\t\t\t<ng-container *ngTemplateOutlet=\"optionSizer; context: { $implicit: 'col-start-1 row-start-1 border-x border-solid border-transparent' }\" />\n\t\t}\n\t\t<div\n\t\t\t#field\n\t\t\tcdkOverlayOrigin\n\t\t\t#overlayOrigin=\"cdkOverlayOrigin\"\n\t\t\t[class]=\"validationClass()\"\n\t\t\t[class.col-start-1]=\"fitOptions\"\n\t\t\t[class.row-start-1]=\"fitOptions\"\n\t\t\t[attr.data-open]=\"isOpen ? '' : null\"\n\t\t\t(click)=\"handleFieldChromeClick($event)\"\n\t\t>\n\t\t\t<button\n\t\t\t\t#trigger\n\t\t\t\t[id]=\"resolvedId()\"\n\t\t\t\t[attr.aria-required]=\"fieldA11y.required() || null\"\n\t\t\t\t[attr.aria-invalid]=\"fieldA11y.invalid() || null\"\n\t\t\t\t[attr.aria-describedby]=\"fieldA11y.describedBy()\"\n\t\t\t\tclass=\"min-w-0 flex-1 grow cursor-pointer bg-transparent p-0 text-left outline-hidden\"\n\t\t\t\t(click)=\"handleClick($event)\"\n\t\t\t\t(keydown)=\"handleTriggerKeydown($event)\"\n\t\t\t\ttype=\"button\"\n\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\trole=\"combobox\"\n\t\t\t\t[attr.aria-controls]=\"listboxId\"\n\t\t\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t\t\t[disabled]=\"disabled()\"\n\t\t\t>\n\t\t\t\t<ng-template #triggerValue>\n\t\t\t\t\t@if (selectionType() === 'multiple' && multipleDisplayInfo) {\n\t\t\t\t\t\t<span class=\"inline-flex items-center gap-2\">\n\t\t\t\t\t\t\t<span class=\"truncate\">{{ multipleDisplayInfo.firstItem }}</span>\n\t\t\t\t\t\t\t@if (multipleDisplayInfo.additionalCount > 0) {\n\t\t\t\t\t\t\t\t<st-badge variant=\"primary\" [soft]=\"true\" [size]=\"badgeClass()\">+{{ multipleDisplayInfo.additionalCount }}</st-badge>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t} @else {\n\t\t\t\t\t\t{{ displayValue }}\n\t\t\t\t\t}\n\t\t\t\t</ng-template>\n\t\t\t\t@if (fitOptions) {\n\t\t\t\t\t<span class=\"grid min-w-0\">\n\t\t\t\t\t\t<span class=\"col-start-1 row-start-1 block min-w-0 truncate text-left\">\n\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"triggerValue\" />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span aria-hidden=\"true\" data-st-value-sizer class=\"invisible col-start-1 row-start-1 h-0 overflow-hidden\">\n\t\t\t\t\t\t\t@for (text of valueSizerLabels(); track $index) {\n\t\t\t\t\t\t\t\t<span class=\"block whitespace-nowrap\">{{ text }}</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t} @else {\n\t\t\t\t\t<span class=\"block min-w-0 truncate text-left\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"triggerValue\" />\n\t\t\t\t\t</span>\n\t\t\t\t}\n\t\t\t</button>\n\t\t\t@if (showClearButton()) {\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tdata-st-clear\n\t\t\t\t\tclass=\"btn btn-ghost btn-square shrink-0 cursor-pointer [--fontsize:1em] [--size:1.25em]\"\n\t\t\t\t\t(click)=\"handleClearSelection($event)\"\n\t\t\t\t\t(keydown.enter)=\"handleClearSelection($event)\"\n\t\t\t\t\t(keydown.space)=\"handleClearSelection($event)\"\n\t\t\t\t\t[attr.aria-label]=\"clearSelectionLabel()\"\n\t\t\t\t>\n\t\t\t\t\t<st-icon [icon]=\"iconClose\"></st-icon>\n\t\t\t\t</button>\n\t\t\t} @else if (fitOptions && allowClear()) {\n\t\t\t\t<!-- Keeps the clear button's room so the fitted control does not change width when a value is chosen -->\n\t\t\t\t<span aria-hidden=\"true\" data-st-clear-spacer class=\"w-[1.25em] shrink-0\"></span>\n\t\t\t}\n\t\t\t<span data-st-chevron class=\"pointer-events-none inline-flex size-[1em] shrink-0 items-center justify-center\" aria-hidden=\"true\">\n\t\t\t\t<st-icon [icon]=\"iconChevronDown\"></st-icon>\n\t\t\t</span>\n\t\t</div>\n\t</div>\n\n\t<ng-template\n\t\tcdkConnectedOverlay\n\t\t[cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n\t\t[cdkConnectedOverlayOpen]=\"isOpen\"\n\t\t[cdkConnectedOverlayPositions]=\"activeOverlayPositions()\"\n\t\t[cdkConnectedOverlayDisableClose]=\"true\"\n\t\t[cdkConnectedOverlayWidth]=\"overlayWidth()\"\n\t\t[cdkConnectedOverlayMinWidth]=\"triggerWidth\"\n\t\t(detach)=\"handleDetach()\"\n\t\t(overlayOutsideClick)=\"handleClickOutside($event)\"\n\t\t(positionChange)=\"onPositionChange($event)\"\n\t>\n\t\t<div class=\"contents\" [attr.data-theme]=\"themeDomService.themeOf(field)\">\n\t\t\t<div\n\t\t\t\t[class]=\"panelClass()\"\n\t\t\t\t(animationend)=\"onAnimationEnd($event)\"\n\t\t\t\t[attr.data-state]=\"dataState\"\n\t\t\t\t[attr.data-side]=\"placement()?.side\"\n\t\t\t\t[attr.data-align]=\"placement()?.align\"\n\t\t\t>\n\t\t\t\t<div class=\"bg-base-200 rounded-box border-neutral overflow-hidden border border-solid\">\n\t\t\t\t\t@if (contentPanel) {\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionSizer; context: { $implicit: '' }\" />\n\t\t\t\t\t}\n\t\t\t\t\t<!-- Search Input: in a content-width panel it takes the panel's width and never sets it -->\n\t\t\t\t\t<div class=\"border-neutral border-b\" [class.w-0]=\"contentPanel\" [class.min-w-full]=\"contentPanel\">\n\t\t\t\t\t\t@let searchInputClass = this.searchInputClass();\n\t\t\t\t\t\t<div [class]=\"searchInputClass\">\n\t\t\t\t\t\t\t<st-icon class=\"text-base-content-muted\" [icon]=\"iconSearch\"></st-icon>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t#searchInput\n\t\t\t\t\t\t\t\tclass=\"placeholder:text-base-content-muted w-full border-transparent py-0 focus-within:outline-hidden focus:border-transparent focus:outline-hidden\"\n\t\t\t\t\t\t\t\t[value]=\"currentSearchValue\"\n\t\t\t\t\t\t\t\t(input)=\"handleSearchInput($event)\"\n\t\t\t\t\t\t\t\t(keydown)=\"handleSearchKeydown($event)\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t[placeholder]=\"translatedSearchPlaceholder()\"\n\t\t\t\t\t\t\t\t[attr.aria-label]=\"searchOptionsLabel()\"\n\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t\t\t\t\t\t\t[attr.aria-controls]=\"listboxId\"\n\t\t\t\t\t\t\t\t[attr.aria-activedescendant]=\"activeOptionId()\"\n\t\t\t\t\t\t\t\t[disabled]=\"!isOpen\"\n\t\t\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<!-- Options List -->\n\t\t\t\t\t@let menuClass = this.menuClass();\n\t\t\t\t\t<ul\n\t\t\t\t\t\t[class]=\"menuClass\"\n\t\t\t\t\t\tcdkListbox\n\t\t\t\t\t\tcdkListboxUseActiveDescendant\n\t\t\t\t\t\t[cdkListboxMultiple]=\"selectionType() === 'multiple'\"\n\t\t\t\t\t\t[id]=\"listboxId\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"label ? labelId : resolvedId()\"\n\t\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\t\t#optionsList\n\t\t\t\t\t\t[tabindex]=\"-1\"\n\t\t\t\t\t\t(keydown)=\"handleListboxKeydown($event)\"\n\t\t\t\t\t\t(selectionChange)=\"handleSelectionChange($event)\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<ng-template #optionTemplate let-option let-index=\"index\">\n\t\t\t\t\t\t\t@let optionDisabled = isOptionDisabled(option);\n\t\t\t\t\t\t\t@let optionDescription = getOptionDescription(option);\n\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t[cdkOption]=\"option\"\n\t\t\t\t\t\t\t\t[id]=\"optionId(index)\"\n\t\t\t\t\t\t\t\t[cdkOptionDisabled]=\"optionDisabled\"\n\t\t\t\t\t\t\t\tclass=\"group\"\n\t\t\t\t\t\t\t\t[attr.data-option-index]=\"index\"\n\t\t\t\t\t\t\t\t[attr.data-disabled]=\"optionDisabled ? '' : null\"\n\t\t\t\t\t\t\t\t[class.cdk-option-active]=\"isActiveOption(index)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t@if (contentPanel) {\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t[class]=\"optionRowClass + ' whitespace-nowrap'\"\n\t\t\t\t\t\t\t\t\t\t(click)=\"handleOptionSelect(option)\"\n\t\t\t\t\t\t\t\t\t\t(mouseenter)=\"syncOptionTitle($event, option)\"\n\t\t\t\t\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionLine; context: { $implicit: option }\" />\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t\t<button type=\"button\" [class]=\"optionRowClass\" (click)=\"handleOptionSelect(option)\" tabindex=\"-1\">\n\t\t\t\t\t\t\t\t\t\t<span class=\"min-w-min flex-1 wrap-break-word whitespace-normal\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"block\">{{ getDisplayValue(option) }}</span>\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t@if (optionDescription) {\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"sr-only\">, </span>\n\t\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\tdata-st-option-description\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-base-content-muted ms-3 min-w-0 truncate text-end text-sm not-last:me-2 group-data-disabled:text-(--color-disabled-content)\"\n\t\t\t\t\t\t\t\t\t\t\t\t>{{ optionDescription }}</span\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t@if (isOptionSelected(option)) {\n\t\t\t\t\t\t\t\t\t\t\t<st-icon class=\"h-4 w-4 shrink-0\" [icon]=\"iconCheck\"></st-icon>\n\t\t\t\t\t\t\t\t\t\t} @else if (isOptionChecked(option)) {\n\t\t\t\t\t\t\t\t\t\t\t<st-icon\n\t\t\t\t\t\t\t\t\t\t\t\tdata-st-option-checked\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"h-4 w-4 shrink-0 group-data-disabled:text-(--color-disabled-content)\"\n\t\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconCheck\"\n\t\t\t\t\t\t\t\t\t\t\t></st-icon>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ng-template>\n\n\t\t\t\t\t\t@for (section of optionSections(); track section.label; let firstSection = $first) {\n\t\t\t\t\t\t\t@if (section.headerId) {\n\t\t\t\t\t\t\t\t@if (!firstSection) {\n\t\t\t\t\t\t\t\t\t<li role=\"none\" data-st-option-group-separator class=\"pointer-events-none top-0 left-0 mx-0 my-1 w-full p-0\"></li>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t<li role=\"none\" data-st-option-group>\n\t\t\t\t\t\t\t\t\t<ul role=\"group\" class=\"ms-0 ps-0 whitespace-normal before:hidden\" [attr.aria-labelledby]=\"section.headerId\">\n\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\t\t\t\t\tdata-st-option-group-header\n\t\t\t\t\t\t\t\t\t\t\tclass=\"menu-title text-base-content-secondary px-4 font-semibold\"\n\t\t\t\t\t\t\t\t\t\t\t[id]=\"section.headerId\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{{ section.label }}\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t@for (entry of section.options; track entry.index) {\n\t\t\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionTemplate; context: { $implicit: entry.option, index: entry.index }\" />\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t@for (entry of section.options; track entry.index) {\n\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionTemplate; context: { $implicit: entry.option, index: entry.index }\" />\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t<!-- Empty state -->\n\t\t\t\t\t\t@if (filteredOptions.length === 0) {\n\t\t\t\t\t\t\t<li class=\"text-base-content-muted px-4 py-2 text-center\" [class.w-0]=\"contentPanel\" [class.min-w-full]=\"contentPanel\">\n\t\t\t\t\t\t\t\t<span>{{ translatedNoResultsText() }}</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t}\n\t\t\t\t\t</ul>\n\n\t\t\t\t\t<!-- Clear All button for multiple selection -->\n\t\t\t\t\t@if (selectionType() === 'multiple' && allowClearAll() && value() && isArray(value()) && value().length > 0) {\n\t\t\t\t\t\t<div class=\"border-base-300 border-t p-2\" [class.w-0]=\"contentPanel\" [class.min-w-full]=\"contentPanel\">\n\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t[block]=\"true\"\n\t\t\t\t\t\t\t\t(clicked)=\"clearSelection()\"\n\t\t\t\t\t\t\t\t(keydown)=\"handleClearButtonKeydown($event)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{{ clearAllLabel() }}\n\t\t\t\t\t\t\t</st-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</ng-template>\n\n\t@if (label) {\n\t\t<label class=\"sr-only\" [id]=\"labelId\" [for]=\"resolvedId()\">{{ label }}</label>\n\t}\n\n\t<!-- Additional content -->\n\t<ng-content></ng-content>\n</fieldset>\n", dependencies: [{ kind: "ngmodule", type: FormsModule }, { kind: "ngmodule", type: ReactiveFormsModule }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "ngmodule", type: PortalModule }, { kind: "ngmodule", type: OverlayModule }, { kind: "directive", type: i1.CdkConnectedOverlay, selector: "[cdk-connected-overlay], [connected-overlay], [cdkConnectedOverlay]", inputs: ["cdkConnectedOverlayOrigin", "cdkConnectedOverlayPositions", "cdkConnectedOverlayPositionStrategy", "cdkConnectedOverlayOffsetX", "cdkConnectedOverlayOffsetY", "cdkConnectedOverlayWidth", "cdkConnectedOverlayHeight", "cdkConnectedOverlayMinWidth", "cdkConnectedOverlayMinHeight", "cdkConnectedOverlayBackdropClass", "cdkConnectedOverlayPanelClass", "cdkConnectedOverlayViewportMargin", "cdkConnectedOverlayScrollStrategy", "cdkConnectedOverlayOpen", "cdkConnectedOverlayDisableClose", "cdkConnectedOverlayTransformOriginOn", "cdkConnectedOverlayHasBackdrop", "cdkConnectedOverlayLockPosition", "cdkConnectedOverlayFlexibleDimensions", "cdkConnectedOverlayGrowAfterOpen", "cdkConnectedOverlayPush", "cdkConnectedOverlayDisposeOnNavigation"], outputs: ["backdropClick", "positionChange", "attach", "detach", "overlayKeydown", "overlayOutsideClick"], exportAs: ["cdkConnectedOverlay"] }, { kind: "directive", type: i1.CdkOverlayOrigin, selector: "[cdk-overlay-origin], [overlay-origin], [cdkOverlayOrigin]", exportAs: ["cdkOverlayOrigin"] }, { kind: "directive", type: CdkListbox, selector: "[cdkListbox]", inputs: ["id", "tabindex", "cdkListboxValue", "cdkListboxMultiple", "cdkListboxDisabled", "cdkListboxUseActiveDescendant", "cdkListboxOrientation", "cdkListboxCompareWith", "cdkListboxNavigationWrapDisabled", "cdkListboxNavigatesDisabledOptions"], outputs: ["cdkListboxValueChange"], exportAs: ["cdkListbox"] }, { kind: "directive", type: CdkOption, selector: "[cdkOption]", inputs: ["id", "cdkOption", "cdkOptionTypeaheadLabel", "cdkOptionDisabled", "tabindex"], exportAs: ["cdkOption"] }, { kind: "component", type: IconComponent, selector: "st-icon", inputs: ["color", "size", "icon", "ariaLabel"] }, { kind: "component", type: BadgeComponent, selector: "st-badge", inputs: ["variant", "size", "outline", "soft", "dash", "ghost", "icon", "iconPosition", "truncate"] }, { kind: "component", type: ButtonComponent, selector: "st-button", inputs: ["variant", "ghost", "outline", "link", "soft", "dash", "wide", "circle", "square", "glass", "block", "loader", "size", "shadow", "focusable", "icon", "iconPosition", "type", "disabled", "stopPropagation", "ariaLabel", "ariaExpanded", "ariaPressed", "ariaDescribedBy", "ariaControls"], outputs: ["clicked", "pointerDown", "keyDownEnter", "keyDownSpace", "triggered"] }, { kind: "pipe", type: TranslatePipe, name: "translate" }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1281
1525
|
}
|
|
1282
1526
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImport: i0, type: ComboboxComponent, decorators: [{
|
|
1283
1527
|
type: Component,
|
|
1284
1528
|
args: [{ selector: 'st-combobox', imports: [
|
|
1285
1529
|
FormsModule,
|
|
1286
1530
|
ReactiveFormsModule,
|
|
1531
|
+
NgTemplateOutlet,
|
|
1287
1532
|
PortalModule,
|
|
1288
1533
|
OverlayModule,
|
|
1289
1534
|
CdkListbox,
|
|
@@ -1298,7 +1543,11 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "19.2.25", ngImpo
|
|
|
1298
1543
|
useExisting: ComboboxComponent,
|
|
1299
1544
|
multi: true,
|
|
1300
1545
|
},
|
|
1301
|
-
], changeDetection: ChangeDetectionStrategy.OnPush,
|
|
1546
|
+
], changeDetection: ChangeDetectionStrategy.OnPush, host: {
|
|
1547
|
+
'[class.inline-block]': 'fitOptions()',
|
|
1548
|
+
'[class.align-top]': 'fitOptions()',
|
|
1549
|
+
'[class.shrink-0]': 'fitOptions()',
|
|
1550
|
+
}, template: "<!-- eslint-disable @angular-eslint/template/interactive-supports-focus -->\n<!-- eslint-disable @angular-eslint/template/click-events-have-key-events -->\n<!-- Field chrome click is pointer-only sugar; keyboard access is the focusable trigger button inside. -->\n@let isOpen = this.isOpen(); @let triggerWidth = this.triggerWidth(); @let dataState = this.dataState();\n@let filteredOptions = this.filteredOptions(); @let displayValue = this.displayValue(); @let multipleDisplayInfo = this.multipleDisplayInfo();\n@let label = this.label();\n@let fitOptions = this.fitOptions(); @let contentPanel = this.contentPanel();\n\n<!-- One option on a single line (content-width panel and option sizer): label, description, check slot (always 16px in the sizer) -->\n<ng-template #optionLine let-option let-sizer=\"sizer\">\n\t@let lineDescription = getOptionDescription(option);\n\t<span class=\"flex min-w-0 grow items-center\">\n\t\t<span data-st-option-label [class]=\"lineDescription ? 'max-w-[calc(100%-1.25rem)] shrink-0 truncate' : 'max-w-full shrink-0 truncate'\">{{\n\t\t\tgetDisplayValue(option)\n\t\t}}</span>\n\t\t@if (lineDescription) {\n\t\t\t<span class=\"sr-only\">, </span>\n\t\t\t<span\n\t\t\t\tdata-st-option-description\n\t\t\t\tclass=\"text-base-content-muted ms-3 me-2 min-w-0 grow truncate text-end text-sm group-data-disabled:text-(--color-disabled-content)\"\n\t\t\t\t>{{ lineDescription }}</span\n\t\t\t>\n\t\t}\n\t</span>\n\t@if (sizer) {\n\t\t<span class=\"size-4 shrink-0\"></span>\n\t} @else if (isOptionSelected(option)) {\n\t\t<st-icon class=\"h-4 w-4 shrink-0\" [icon]=\"iconCheck\"></st-icon>\n\t} @else if (isOptionChecked(option)) {\n\t\t<st-icon data-st-option-checked class=\"h-4 w-4 shrink-0 group-data-disabled:text-(--color-disabled-content)\" [icon]=\"iconCheck\"></st-icon>\n\t} @else {\n\t\t<span aria-hidden=\"true\" class=\"size-4 shrink-0\"></span>\n\t}\n</ng-template>\n\n<!-- Hidden stack of every option row (search ignored), so CSS takes the widest as the width -->\n<ng-template #optionSizer let-placement>\n\t<ul aria-hidden=\"true\" data-st-option-sizer [class]=\"optionSizerClass() + ' ' + placement\">\n\t\t@for (section of allOptionSections(); track section.label) {\n\t\t\t@if (section.label) {\n\t\t\t\t<li class=\"menu-title px-4 font-semibold whitespace-nowrap\">{{ section.label }}</li>\n\t\t\t}\n\t\t\t@for (entry of section.options; track entry.index) {\n\t\t\t\t<li>\n\t\t\t\t\t<div [class]=\"optionRowClass + ' whitespace-nowrap'\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionLine; context: { $implicit: entry.option, sizer: true }\" />\n\t\t\t\t\t</div>\n\t\t\t\t</li>\n\t\t\t}\n\t\t}\n\t</ul>\n</ng-template>\n\n<fieldset class=\"fieldset p-0\">\n\t@if (label) {\n\t\t<legend class=\"fieldset-legend font-body w-full items-center justify-between gap-2 pt-0 font-normal text-pretty\">\n\t\t\t<span\n\t\t\t\t>{{ label }}\n\t\t\t\t@if (fieldA11y.required()) {\n\t\t\t\t\t<span aria-hidden=\"true\" data-st-required-marker class=\"text-error-strong ms-0.5\">*</span>\n\t\t\t\t}\n\t\t\t</span>\n\t\t\t@if (showOptional()) {\n\t\t\t\t<span class=\"label font-body text-xs font-normal\">{{ optionalText() | translate }}</span>\n\t\t\t}\n\t\t</legend>\n\t}\n\n\t<div [class]=\"fitOptions ? 'grid' : 'contents'\">\n\t\t@if (fitOptions) {\n\t\t\t<ng-container *ngTemplateOutlet=\"optionSizer; context: { $implicit: 'col-start-1 row-start-1 border-x border-solid border-transparent' }\" />\n\t\t}\n\t\t<div\n\t\t\t#field\n\t\t\tcdkOverlayOrigin\n\t\t\t#overlayOrigin=\"cdkOverlayOrigin\"\n\t\t\t[class]=\"validationClass()\"\n\t\t\t[class.col-start-1]=\"fitOptions\"\n\t\t\t[class.row-start-1]=\"fitOptions\"\n\t\t\t[attr.data-open]=\"isOpen ? '' : null\"\n\t\t\t(click)=\"handleFieldChromeClick($event)\"\n\t\t>\n\t\t\t<button\n\t\t\t\t#trigger\n\t\t\t\t[id]=\"resolvedId()\"\n\t\t\t\t[attr.aria-required]=\"fieldA11y.required() || null\"\n\t\t\t\t[attr.aria-invalid]=\"fieldA11y.invalid() || null\"\n\t\t\t\t[attr.aria-describedby]=\"fieldA11y.describedBy()\"\n\t\t\t\tclass=\"min-w-0 flex-1 grow cursor-pointer bg-transparent p-0 text-left outline-hidden\"\n\t\t\t\t(click)=\"handleClick($event)\"\n\t\t\t\t(keydown)=\"handleTriggerKeydown($event)\"\n\t\t\t\ttype=\"button\"\n\t\t\t\taria-haspopup=\"listbox\"\n\t\t\t\trole=\"combobox\"\n\t\t\t\t[attr.aria-controls]=\"listboxId\"\n\t\t\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t\t\t[disabled]=\"disabled()\"\n\t\t\t>\n\t\t\t\t<ng-template #triggerValue>\n\t\t\t\t\t@if (selectionType() === 'multiple' && multipleDisplayInfo) {\n\t\t\t\t\t\t<span class=\"inline-flex items-center gap-2\">\n\t\t\t\t\t\t\t<span class=\"truncate\">{{ multipleDisplayInfo.firstItem }}</span>\n\t\t\t\t\t\t\t@if (multipleDisplayInfo.additionalCount > 0) {\n\t\t\t\t\t\t\t\t<st-badge variant=\"primary\" [soft]=\"true\" [size]=\"badgeClass()\">+{{ multipleDisplayInfo.additionalCount }}</st-badge>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t} @else {\n\t\t\t\t\t\t{{ displayValue }}\n\t\t\t\t\t}\n\t\t\t\t</ng-template>\n\t\t\t\t@if (fitOptions) {\n\t\t\t\t\t<span class=\"grid min-w-0\">\n\t\t\t\t\t\t<span class=\"col-start-1 row-start-1 block min-w-0 truncate text-left\">\n\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"triggerValue\" />\n\t\t\t\t\t\t</span>\n\t\t\t\t\t\t<span aria-hidden=\"true\" data-st-value-sizer class=\"invisible col-start-1 row-start-1 h-0 overflow-hidden\">\n\t\t\t\t\t\t\t@for (text of valueSizerLabels(); track $index) {\n\t\t\t\t\t\t\t\t<span class=\"block whitespace-nowrap\">{{ text }}</span>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</span>\n\t\t\t\t\t</span>\n\t\t\t\t} @else {\n\t\t\t\t\t<span class=\"block min-w-0 truncate text-left\">\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"triggerValue\" />\n\t\t\t\t\t</span>\n\t\t\t\t}\n\t\t\t</button>\n\t\t\t@if (showClearButton()) {\n\t\t\t\t<button\n\t\t\t\t\ttype=\"button\"\n\t\t\t\t\tdata-st-clear\n\t\t\t\t\tclass=\"btn btn-ghost btn-square shrink-0 cursor-pointer [--fontsize:1em] [--size:1.25em]\"\n\t\t\t\t\t(click)=\"handleClearSelection($event)\"\n\t\t\t\t\t(keydown.enter)=\"handleClearSelection($event)\"\n\t\t\t\t\t(keydown.space)=\"handleClearSelection($event)\"\n\t\t\t\t\t[attr.aria-label]=\"clearSelectionLabel()\"\n\t\t\t\t>\n\t\t\t\t\t<st-icon [icon]=\"iconClose\"></st-icon>\n\t\t\t\t</button>\n\t\t\t} @else if (fitOptions && allowClear()) {\n\t\t\t\t<!-- Keeps the clear button's room so the fitted control does not change width when a value is chosen -->\n\t\t\t\t<span aria-hidden=\"true\" data-st-clear-spacer class=\"w-[1.25em] shrink-0\"></span>\n\t\t\t}\n\t\t\t<span data-st-chevron class=\"pointer-events-none inline-flex size-[1em] shrink-0 items-center justify-center\" aria-hidden=\"true\">\n\t\t\t\t<st-icon [icon]=\"iconChevronDown\"></st-icon>\n\t\t\t</span>\n\t\t</div>\n\t</div>\n\n\t<ng-template\n\t\tcdkConnectedOverlay\n\t\t[cdkConnectedOverlayOrigin]=\"overlayOrigin\"\n\t\t[cdkConnectedOverlayOpen]=\"isOpen\"\n\t\t[cdkConnectedOverlayPositions]=\"activeOverlayPositions()\"\n\t\t[cdkConnectedOverlayDisableClose]=\"true\"\n\t\t[cdkConnectedOverlayWidth]=\"overlayWidth()\"\n\t\t[cdkConnectedOverlayMinWidth]=\"triggerWidth\"\n\t\t(detach)=\"handleDetach()\"\n\t\t(overlayOutsideClick)=\"handleClickOutside($event)\"\n\t\t(positionChange)=\"onPositionChange($event)\"\n\t>\n\t\t<div class=\"contents\" [attr.data-theme]=\"themeDomService.themeOf(field)\">\n\t\t\t<div\n\t\t\t\t[class]=\"panelClass()\"\n\t\t\t\t(animationend)=\"onAnimationEnd($event)\"\n\t\t\t\t[attr.data-state]=\"dataState\"\n\t\t\t\t[attr.data-side]=\"placement()?.side\"\n\t\t\t\t[attr.data-align]=\"placement()?.align\"\n\t\t\t>\n\t\t\t\t<div class=\"bg-base-200 rounded-box border-neutral overflow-hidden border border-solid\">\n\t\t\t\t\t@if (contentPanel) {\n\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionSizer; context: { $implicit: '' }\" />\n\t\t\t\t\t}\n\t\t\t\t\t<!-- Search Input: in a content-width panel it takes the panel's width and never sets it -->\n\t\t\t\t\t<div class=\"border-neutral border-b\" [class.w-0]=\"contentPanel\" [class.min-w-full]=\"contentPanel\">\n\t\t\t\t\t\t@let searchInputClass = this.searchInputClass();\n\t\t\t\t\t\t<div [class]=\"searchInputClass\">\n\t\t\t\t\t\t\t<st-icon class=\"text-base-content-muted\" [icon]=\"iconSearch\"></st-icon>\n\t\t\t\t\t\t\t<input\n\t\t\t\t\t\t\t\t#searchInput\n\t\t\t\t\t\t\t\tclass=\"placeholder:text-base-content-muted w-full border-transparent py-0 focus-within:outline-hidden focus:border-transparent focus:outline-hidden\"\n\t\t\t\t\t\t\t\t[value]=\"currentSearchValue\"\n\t\t\t\t\t\t\t\t(input)=\"handleSearchInput($event)\"\n\t\t\t\t\t\t\t\t(keydown)=\"handleSearchKeydown($event)\"\n\t\t\t\t\t\t\t\ttype=\"text\"\n\t\t\t\t\t\t\t\t[placeholder]=\"translatedSearchPlaceholder()\"\n\t\t\t\t\t\t\t\t[attr.aria-label]=\"searchOptionsLabel()\"\n\t\t\t\t\t\t\t\trole=\"combobox\"\n\t\t\t\t\t\t\t\taria-autocomplete=\"list\"\n\t\t\t\t\t\t\t\t[attr.aria-expanded]=\"isOpen\"\n\t\t\t\t\t\t\t\t[attr.aria-controls]=\"listboxId\"\n\t\t\t\t\t\t\t\t[attr.aria-activedescendant]=\"activeOptionId()\"\n\t\t\t\t\t\t\t\t[disabled]=\"!isOpen\"\n\t\t\t\t\t\t\t\tautocomplete=\"off\"\n\t\t\t\t\t\t\t/>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t</div>\n\n\t\t\t\t\t<!-- Options List -->\n\t\t\t\t\t@let menuClass = this.menuClass();\n\t\t\t\t\t<ul\n\t\t\t\t\t\t[class]=\"menuClass\"\n\t\t\t\t\t\tcdkListbox\n\t\t\t\t\t\tcdkListboxUseActiveDescendant\n\t\t\t\t\t\t[cdkListboxMultiple]=\"selectionType() === 'multiple'\"\n\t\t\t\t\t\t[id]=\"listboxId\"\n\t\t\t\t\t\t[attr.aria-labelledby]=\"label ? labelId : resolvedId()\"\n\t\t\t\t\t\trole=\"listbox\"\n\t\t\t\t\t\t#optionsList\n\t\t\t\t\t\t[tabindex]=\"-1\"\n\t\t\t\t\t\t(keydown)=\"handleListboxKeydown($event)\"\n\t\t\t\t\t\t(selectionChange)=\"handleSelectionChange($event)\"\n\t\t\t\t\t>\n\t\t\t\t\t\t<ng-template #optionTemplate let-option let-index=\"index\">\n\t\t\t\t\t\t\t@let optionDisabled = isOptionDisabled(option);\n\t\t\t\t\t\t\t@let optionDescription = getOptionDescription(option);\n\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t[cdkOption]=\"option\"\n\t\t\t\t\t\t\t\t[id]=\"optionId(index)\"\n\t\t\t\t\t\t\t\t[cdkOptionDisabled]=\"optionDisabled\"\n\t\t\t\t\t\t\t\tclass=\"group\"\n\t\t\t\t\t\t\t\t[attr.data-option-index]=\"index\"\n\t\t\t\t\t\t\t\t[attr.data-disabled]=\"optionDisabled ? '' : null\"\n\t\t\t\t\t\t\t\t[class.cdk-option-active]=\"isActiveOption(index)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t@if (contentPanel) {\n\t\t\t\t\t\t\t\t\t<button\n\t\t\t\t\t\t\t\t\t\ttype=\"button\"\n\t\t\t\t\t\t\t\t\t\t[class]=\"optionRowClass + ' whitespace-nowrap'\"\n\t\t\t\t\t\t\t\t\t\t(click)=\"handleOptionSelect(option)\"\n\t\t\t\t\t\t\t\t\t\t(mouseenter)=\"syncOptionTitle($event, option)\"\n\t\t\t\t\t\t\t\t\t\ttabindex=\"-1\"\n\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionLine; context: { $implicit: option }\" />\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t\t<button type=\"button\" [class]=\"optionRowClass\" (click)=\"handleOptionSelect(option)\" tabindex=\"-1\">\n\t\t\t\t\t\t\t\t\t\t<span class=\"min-w-min flex-1 wrap-break-word whitespace-normal\">\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"block\">{{ getDisplayValue(option) }}</span>\n\t\t\t\t\t\t\t\t\t\t</span>\n\t\t\t\t\t\t\t\t\t\t@if (optionDescription) {\n\t\t\t\t\t\t\t\t\t\t\t<span class=\"sr-only\">, </span>\n\t\t\t\t\t\t\t\t\t\t\t<span\n\t\t\t\t\t\t\t\t\t\t\t\tdata-st-option-description\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"text-base-content-muted ms-3 min-w-0 truncate text-end text-sm not-last:me-2 group-data-disabled:text-(--color-disabled-content)\"\n\t\t\t\t\t\t\t\t\t\t\t\t>{{ optionDescription }}</span\n\t\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\t\t\t@if (isOptionSelected(option)) {\n\t\t\t\t\t\t\t\t\t\t\t<st-icon class=\"h-4 w-4 shrink-0\" [icon]=\"iconCheck\"></st-icon>\n\t\t\t\t\t\t\t\t\t\t} @else if (isOptionChecked(option)) {\n\t\t\t\t\t\t\t\t\t\t\t<st-icon\n\t\t\t\t\t\t\t\t\t\t\t\tdata-st-option-checked\n\t\t\t\t\t\t\t\t\t\t\t\tclass=\"h-4 w-4 shrink-0 group-data-disabled:text-(--color-disabled-content)\"\n\t\t\t\t\t\t\t\t\t\t\t\t[icon]=\"iconCheck\"\n\t\t\t\t\t\t\t\t\t\t\t></st-icon>\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</button>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t</ng-template>\n\n\t\t\t\t\t\t@for (section of optionSections(); track section.label; let firstSection = $first) {\n\t\t\t\t\t\t\t@if (section.headerId) {\n\t\t\t\t\t\t\t\t@if (!firstSection) {\n\t\t\t\t\t\t\t\t\t<li role=\"none\" data-st-option-group-separator class=\"pointer-events-none top-0 left-0 mx-0 my-1 w-full p-0\"></li>\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t<li role=\"none\" data-st-option-group>\n\t\t\t\t\t\t\t\t\t<ul role=\"group\" class=\"ms-0 ps-0 whitespace-normal before:hidden\" [attr.aria-labelledby]=\"section.headerId\">\n\t\t\t\t\t\t\t\t\t\t<li\n\t\t\t\t\t\t\t\t\t\t\trole=\"presentation\"\n\t\t\t\t\t\t\t\t\t\t\tdata-st-option-group-header\n\t\t\t\t\t\t\t\t\t\t\tclass=\"menu-title text-base-content-secondary px-4 font-semibold\"\n\t\t\t\t\t\t\t\t\t\t\t[id]=\"section.headerId\"\n\t\t\t\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t\t\t\t{{ section.label }}\n\t\t\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t\t\t\t@for (entry of section.options; track entry.index) {\n\t\t\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionTemplate; context: { $implicit: entry.option, index: entry.index }\" />\n\t\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t\t</ul>\n\t\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t\t} @else {\n\t\t\t\t\t\t\t\t@for (entry of section.options; track entry.index) {\n\t\t\t\t\t\t\t\t\t<ng-container *ngTemplateOutlet=\"optionTemplate; context: { $implicit: entry.option, index: entry.index }\" />\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\t<!-- Empty state -->\n\t\t\t\t\t\t@if (filteredOptions.length === 0) {\n\t\t\t\t\t\t\t<li class=\"text-base-content-muted px-4 py-2 text-center\" [class.w-0]=\"contentPanel\" [class.min-w-full]=\"contentPanel\">\n\t\t\t\t\t\t\t\t<span>{{ translatedNoResultsText() }}</span>\n\t\t\t\t\t\t\t</li>\n\t\t\t\t\t\t}\n\t\t\t\t\t</ul>\n\n\t\t\t\t\t<!-- Clear All button for multiple selection -->\n\t\t\t\t\t@if (selectionType() === 'multiple' && allowClearAll() && value() && isArray(value()) && value().length > 0) {\n\t\t\t\t\t\t<div class=\"border-base-300 border-t p-2\" [class.w-0]=\"contentPanel\" [class.min-w-full]=\"contentPanel\">\n\t\t\t\t\t\t\t<st-button\n\t\t\t\t\t\t\t\tvariant=\"primary\"\n\t\t\t\t\t\t\t\tsize=\"sm\"\n\t\t\t\t\t\t\t\t[ghost]=\"true\"\n\t\t\t\t\t\t\t\t[block]=\"true\"\n\t\t\t\t\t\t\t\t(clicked)=\"clearSelection()\"\n\t\t\t\t\t\t\t\t(keydown)=\"handleClearButtonKeydown($event)\"\n\t\t\t\t\t\t\t>\n\t\t\t\t\t\t\t\t{{ clearAllLabel() }}\n\t\t\t\t\t\t\t</st-button>\n\t\t\t\t\t\t</div>\n\t\t\t\t\t}\n\t\t\t\t</div>\n\t\t\t</div>\n\t\t</div>\n\t</ng-template>\n\n\t@if (label) {\n\t\t<label class=\"sr-only\" [id]=\"labelId\" [for]=\"resolvedId()\">{{ label }}</label>\n\t}\n\n\t<!-- Additional content -->\n\t<ng-content></ng-content>\n</fieldset>\n" }]
|
|
1302
1551
|
}], ctorParameters: () => [] });
|
|
1303
1552
|
|
|
1304
1553
|
/**
|