@thalassic/ui 22.7.0 → 22.9.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/fesm2022/thalassic-ui.mjs +429 -61
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +170 -5
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, ViewContainerRef, DestroyRef, viewChild, Component, contentChild, forwardRef, Injectable, makeEnvironmentProviders, output, effect, ElementRef, afterNextRender, numberAttribute, viewChildren, contentChildren, isDevMode, untracked, TemplateRef, Renderer2 } from '@angular/core';
|
|
2
|
+
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, ViewContainerRef, DestroyRef, viewChild, Component, contentChild, forwardRef, Injectable, makeEnvironmentProviders, output, effect, ElementRef, afterNextRender, linkedSignal, numberAttribute, viewChildren, contentChildren, isDevMode, untracked, TemplateRef, Renderer2, provideEnvironmentInitializer, PLATFORM_ID, DOCUMENT } from '@angular/core';
|
|
3
3
|
import { Overlay } from '@angular/cdk/overlay';
|
|
4
4
|
import { TemplatePortal, ComponentPortal, CdkPortalOutlet } from '@angular/cdk/portal';
|
|
5
5
|
import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { filter, throwError, map, shareReplay, of, Subscription, takeUntil } from 'rxjs';
|
|
7
7
|
import { Router, ActivatedRoute, RouterLink, NavigationStart } from '@angular/router';
|
|
8
|
-
import { LocationStrategy, NgTemplateOutlet, NgComponentOutlet } from '@angular/common';
|
|
8
|
+
import { LocationStrategy, NgTemplateOutlet, NgComponentOutlet, isPlatformBrowser } from '@angular/common';
|
|
9
9
|
import { startOfWeek, startOfMonth, endOfWeek, endOfMonth, addDays, eachDayOfInterval, format, startOfDay, isBefore, isAfter, isToday, differenceInCalendarDays, isSameMonth, addHours, differenceInMinutes, isSameDay, isSameWeek, addMonths, addWeeks, subMonths, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, setHours, setMinutes, setYear } from 'date-fns';
|
|
10
10
|
import { HttpClient } from '@angular/common/http';
|
|
11
11
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
@@ -21,6 +21,14 @@ import { TabPanel, TabList, Tab as Tab$1, Tabs as Tabs$1 } from '@angular/aria/t
|
|
|
21
21
|
import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
|
|
22
22
|
import { deepMerge } from '@thalassic/core';
|
|
23
23
|
|
|
24
|
+
const DEFAULT_ACCESSIBILITY_CONFIG = {
|
|
25
|
+
expandTouchTargets: true,
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
const ACCESSIBILITY_CONFIG = new InjectionToken('ACCESSIBILITY_CONFIG', {
|
|
29
|
+
factory: () => DEFAULT_ACCESSIBILITY_CONFIG,
|
|
30
|
+
});
|
|
31
|
+
|
|
24
32
|
const DEFAULT_FORM_CONTROL_CONFIG = {
|
|
25
33
|
errorTrigger: 'touched',
|
|
26
34
|
};
|
|
@@ -472,6 +480,13 @@ class AbstractSelect extends ValueFormControl {
|
|
|
472
480
|
disabled: this.optionDisabled(),
|
|
473
481
|
}), /* @ts-ignore */
|
|
474
482
|
...(ngDevMode ? [{ debugName: "normalizedOptions" }] : /* istanbul ignore next */ []));
|
|
483
|
+
/**
|
|
484
|
+
* Options actually shown in the panel and traversed by keyboard navigation. Defaults to the full
|
|
485
|
+
* normalized list; a filtering control (an editable combobox) narrows it via
|
|
486
|
+
* {@link filterVisibleOptions}. `activeIndex` always indexes into this list, never the raw one.
|
|
487
|
+
*/
|
|
488
|
+
visibleOptions = computed(() => this.filterVisibleOptions(this.normalizedOptions()), /* @ts-ignore */
|
|
489
|
+
...(ngDevMode ? [{ debugName: "visibleOptions" }] : /* istanbul ignore next */ []));
|
|
475
490
|
activeDescendantId = computed(() => {
|
|
476
491
|
const index = this.activeIndex();
|
|
477
492
|
if (index < 0)
|
|
@@ -492,6 +507,17 @@ class AbstractSelect extends ValueFormControl {
|
|
|
492
507
|
get listboxId() {
|
|
493
508
|
return `${this.uniqueId}-listbox`;
|
|
494
509
|
}
|
|
510
|
+
/**
|
|
511
|
+
* Narrows the option list shown in the panel. The listbox controls show every option; an editable
|
|
512
|
+
* combobox overrides this to filter by the typed query.
|
|
513
|
+
*/
|
|
514
|
+
filterVisibleOptions(options) {
|
|
515
|
+
return options;
|
|
516
|
+
}
|
|
517
|
+
/** Hook invoked after the panel has closed, once the trigger has regained focus. */
|
|
518
|
+
onClosed() {
|
|
519
|
+
// No-op by default; an editable combobox overrides this to reconcile its text.
|
|
520
|
+
}
|
|
495
521
|
// Protected methods
|
|
496
522
|
open() {
|
|
497
523
|
const triggerElement = this.triggerElement();
|
|
@@ -517,6 +543,7 @@ class AbstractSelect extends ValueFormControl {
|
|
|
517
543
|
const trigger = this.triggerElement();
|
|
518
544
|
if (trigger)
|
|
519
545
|
trigger.nativeElement.focus();
|
|
546
|
+
this.onClosed();
|
|
520
547
|
},
|
|
521
548
|
});
|
|
522
549
|
this.activeIndex.set(this.getInitialActiveIndex());
|
|
@@ -561,7 +588,7 @@ class AbstractSelect extends ValueFormControl {
|
|
|
561
588
|
this.open();
|
|
562
589
|
return;
|
|
563
590
|
}
|
|
564
|
-
const active = this.
|
|
591
|
+
const active = this.visibleOptions()[this.activeIndex()];
|
|
565
592
|
if (active && !active.disabled)
|
|
566
593
|
this.commitActiveOption(active);
|
|
567
594
|
}
|
|
@@ -596,9 +623,8 @@ class AbstractSelect extends ValueFormControl {
|
|
|
596
623
|
optionId(index) {
|
|
597
624
|
return `${this.uniqueId}-option-${index}`;
|
|
598
625
|
}
|
|
599
|
-
// Private methods
|
|
600
626
|
moveActive(direction) {
|
|
601
|
-
const options = this.
|
|
627
|
+
const options = this.visibleOptions();
|
|
602
628
|
let next = this.activeIndex() + direction;
|
|
603
629
|
while (next >= 0 && next < options.length) {
|
|
604
630
|
if (!options[next].disabled) {
|
|
@@ -608,8 +634,9 @@ class AbstractSelect extends ValueFormControl {
|
|
|
608
634
|
next += direction;
|
|
609
635
|
}
|
|
610
636
|
}
|
|
637
|
+
// Private methods
|
|
611
638
|
moveActiveToEdge(direction) {
|
|
612
|
-
const options = this.
|
|
639
|
+
const options = this.visibleOptions();
|
|
613
640
|
let next = direction === 1 ? 0 : options.length - 1;
|
|
614
641
|
while (next >= 0 && next < options.length) {
|
|
615
642
|
if (!options[next].disabled) {
|
|
@@ -740,6 +767,7 @@ class Badge {
|
|
|
740
767
|
showZero = input(false, { ...(ngDevMode ? { debugName: "showZero" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
741
768
|
hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
742
769
|
inset = input(false, { ...(ngDevMode ? { debugName: "inset" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
770
|
+
bordered = input(false, { ...(ngDevMode ? { debugName: "bordered" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
743
771
|
ariaLabel = input(undefined, /* @ts-ignore */
|
|
744
772
|
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
745
773
|
// Computed
|
|
@@ -784,18 +812,20 @@ class Badge {
|
|
|
784
812
|
array.push(`${className}--dot`);
|
|
785
813
|
if (this.inset())
|
|
786
814
|
array.push(`${className}--inset`);
|
|
815
|
+
if (this.bordered())
|
|
816
|
+
array.push(`${className}--bordered`);
|
|
787
817
|
return array;
|
|
788
818
|
}, /* @ts-ignore */
|
|
789
819
|
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
790
820
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
791
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", 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 }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
821
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Badge, isStandalone: true, selector: "tls-badge", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, max: { classPropertyName: "max", publicName: "max", 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 }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, dot: { classPropertyName: "dot", publicName: "dot", isSignal: true, isRequired: false, transformFunction: null }, showZero: { classPropertyName: "showZero", publicName: "showZero", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, inset: { classPropertyName: "inset", publicName: "inset", isSignal: true, isRequired: false, transformFunction: null }, bordered: { classPropertyName: "bordered", publicName: "bordered", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" });
|
|
792
822
|
}
|
|
793
823
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Badge, decorators: [{
|
|
794
824
|
type: Component,
|
|
795
825
|
args: [{ selector: 'tls-badge', imports: [], host: {
|
|
796
826
|
'[class]': 'hostClasses()',
|
|
797
827
|
}, template: "<ng-content />\n\n@if (visible()) {\n <span\n class=\"tls-badge__indicator\"\n role=\"status\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-hidden]=\"decorative() ? 'true' : null\"\n animate.enter=\"tls-badge__indicator--enter\"\n animate.leave=\"tls-badge__indicator--leave\"\n >\n @if (!dot()) {\n {{ displayValue() }}\n }\n </span>\n}\n" }]
|
|
798
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
828
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], dot: [{ type: i0.Input, args: [{ isSignal: true, alias: "dot", required: false }] }], showZero: [{ type: i0.Input, args: [{ isSignal: true, alias: "showZero", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], inset: [{ type: i0.Input, args: [{ isSignal: true, alias: "inset", required: false }] }], bordered: [{ type: i0.Input, args: [{ isSignal: true, alias: "bordered", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
799
829
|
|
|
800
830
|
const DEFAULT_BUTTON_CONFIG = {
|
|
801
831
|
color: 'primary',
|
|
@@ -3118,52 +3148,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3118
3148
|
args: [{ selector: 'tls-form-item', imports: [], host: { '[class]': 'hostClasses()' }, template: "<div class=\"form-item-main\">\n @if (label() || reserveLabelSpace()) {\n <label class=\"form-item-label\" [id]=\"labelId\" [attr.for]=\"labelFor()\">\n <span class=\"form-item-label__text\">{{ label() }}</span>\n @if (showRequired()) {\n <span class=\"form-item-label__required\">*</span>\n } @else if (showOptional()) {\n <span class=\"form-item-label__optional\">{{ optionalText() }}</span>\n }\n </label>\n }\n <div class=\"form-item-control\">\n <ng-content></ng-content>\n </div>\n</div>\n@if (displayErrors()) {\n <small class=\"form-item-error\">\n @if (isInvalid()) {\n <span class=\"form-item-error__text\" [id]=\"errorId\">\n {{ firstErrorMessage() }}\n </span>\n }\n </small>\n}\n" }]
|
|
3119
3149
|
}], ctorParameters: () => [], propDecorators: { control: [{ type: i0.ContentChild, args: [i0.forwardRef(() => FORM_CONTROL), { isSignal: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], labelPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "labelPosition", required: false }] }], spread: [{ type: i0.Input, args: [{ isSignal: true, alias: "spread", required: false }] }], reserveErrorSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveErrorSpace", required: false }] }], reserveLabelSpace: [{ type: i0.Input, args: [{ isSignal: true, alias: "reserveLabelSpace", required: false }] }], displayErrors: [{ type: i0.Input, args: [{ isSignal: true, alias: "displayErrors", required: false }] }], showRequiredMarker: [{ type: i0.Input, args: [{ isSignal: true, alias: "showRequiredMarker", required: false }] }], optionalText: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionalText", required: false }] }] } });
|
|
3120
3150
|
|
|
3121
|
-
const DEFAULT_CHECKBOX_CONFIG = {};
|
|
3122
|
-
|
|
3123
|
-
const CHECKBOX_CONFIG = new InjectionToken('CHECKBOX_CONFIG', {
|
|
3124
|
-
factory: () => DEFAULT_CHECKBOX_CONFIG,
|
|
3125
|
-
});
|
|
3126
|
-
|
|
3127
|
-
class Checkbox extends CheckboxFormControl {
|
|
3128
|
-
_config = inject(CHECKBOX_CONFIG);
|
|
3129
|
-
CLASS_NAME = 'tls-checkbox';
|
|
3130
|
-
supportsLabelFor = true;
|
|
3131
|
-
indeterminate = model(false, /* @ts-ignore */
|
|
3132
|
-
...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
3133
|
-
checked = model(false, /* @ts-ignore */
|
|
3134
|
-
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
3135
|
-
tabindex = input(0, /* @ts-ignore */
|
|
3136
|
-
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
3137
|
-
hostClasses = computed(() => {
|
|
3138
|
-
const className = this.CLASS_NAME;
|
|
3139
|
-
const array = [className];
|
|
3140
|
-
if (this.indeterminate())
|
|
3141
|
-
array.push(`${className}--indeterminate`);
|
|
3142
|
-
return array.concat(this.controlClasses());
|
|
3143
|
-
}, /* @ts-ignore */
|
|
3144
|
-
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3145
|
-
// Protected methods
|
|
3146
|
-
toggle() {
|
|
3147
|
-
if (this.notInteractive())
|
|
3148
|
-
return;
|
|
3149
|
-
this.checked.update(prev => !prev);
|
|
3150
|
-
}
|
|
3151
|
-
onKeyboardToggle(event) {
|
|
3152
|
-
event.preventDefault();
|
|
3153
|
-
this.toggle();
|
|
3154
|
-
}
|
|
3155
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Checkbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3156
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Checkbox, isStandalone: true, selector: "tls-checkbox", inputs: { indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indeterminate: "indeterminateChange", checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, properties: { "class": "hostClasses()", "tabindex": "-1" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Checkbox) }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [attr.id]=\"effectiveInputId()\"\n [name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<tls-icon\n class=\"tls-checkbox-icon\"\n [name]=\"indeterminate() ? 'indeterminate' : 'check'\"\n aria-hidden=\"true\"\n/>\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
3157
|
-
}
|
|
3158
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Checkbox, decorators: [{
|
|
3159
|
-
type: Component,
|
|
3160
|
-
args: [{ selector: 'tls-checkbox', imports: [Icon], host: {
|
|
3161
|
-
role: 'checkbox',
|
|
3162
|
-
'[class]': 'hostClasses()',
|
|
3163
|
-
'[tabindex]': '-1',
|
|
3164
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Checkbox) }], template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [attr.id]=\"effectiveInputId()\"\n [name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<tls-icon\n class=\"tls-checkbox-icon\"\n [name]=\"indeterminate() ? 'indeterminate' : 'check'\"\n aria-hidden=\"true\"\n/>\n" }]
|
|
3165
|
-
}], propDecorators: { indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
3166
|
-
|
|
3167
3151
|
const DEFAULT_LOADER_CONFIG = {
|
|
3168
3152
|
size: 'md',
|
|
3169
3153
|
width: null,
|
|
@@ -3251,6 +3235,199 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3251
3235
|
}]
|
|
3252
3236
|
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], widthRatio: [{ type: i0.Input, args: [{ isSignal: true, alias: "widthRatio", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }] } });
|
|
3253
3237
|
|
|
3238
|
+
const DEFAULT_AUTOCOMPLETE_CONFIG = {
|
|
3239
|
+
size: 'md',
|
|
3240
|
+
placeholder: '',
|
|
3241
|
+
fluid: false,
|
|
3242
|
+
clearable: false,
|
|
3243
|
+
filterMode: 'contains',
|
|
3244
|
+
emptyMessage: 'No results',
|
|
3245
|
+
};
|
|
3246
|
+
|
|
3247
|
+
const AUTOCOMPLETE_CONFIG = new InjectionToken('AUTOCOMPLETE_CONFIG', {
|
|
3248
|
+
factory: () => DEFAULT_AUTOCOMPLETE_CONFIG,
|
|
3249
|
+
});
|
|
3250
|
+
|
|
3251
|
+
class Autocomplete extends AbstractSelect {
|
|
3252
|
+
static _nextUniqueId = 0;
|
|
3253
|
+
_config = inject(AUTOCOMPLETE_CONFIG);
|
|
3254
|
+
supportsLabelFor = true;
|
|
3255
|
+
uniqueId = `tls-autocomplete-${Autocomplete._nextUniqueId++}`;
|
|
3256
|
+
hostClassBase = 'tls-autocomplete';
|
|
3257
|
+
panelClass = 'tls-autocomplete-panel';
|
|
3258
|
+
value = model(null, /* @ts-ignore */
|
|
3259
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3260
|
+
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
3261
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
3262
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
3263
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3264
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3265
|
+
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3266
|
+
filterMode = input(this._config.filterMode, /* @ts-ignore */
|
|
3267
|
+
...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
|
|
3268
|
+
emptyMessage = input(this._config.emptyMessage, /* @ts-ignore */
|
|
3269
|
+
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
3270
|
+
hasValue = computed(() => {
|
|
3271
|
+
const value = this.value();
|
|
3272
|
+
return value !== null && value !== undefined;
|
|
3273
|
+
}, /* @ts-ignore */
|
|
3274
|
+
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
3275
|
+
selectedLabel = computed(() => {
|
|
3276
|
+
if (!this.hasValue())
|
|
3277
|
+
return '';
|
|
3278
|
+
const selected = this.normalizedOptions().find(option => option.value === this.value());
|
|
3279
|
+
if (!selected)
|
|
3280
|
+
return '';
|
|
3281
|
+
return selected.label;
|
|
3282
|
+
}, /* @ts-ignore */
|
|
3283
|
+
...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
|
|
3284
|
+
/**
|
|
3285
|
+
* The text shown in the field: the committed selection's label by default, overwritten with a
|
|
3286
|
+
* free-text query as the user types. Re-derives from the label whenever the committed value
|
|
3287
|
+
* changes (a selection, a clear, or an external model update), so the field always reflects it.
|
|
3288
|
+
*/
|
|
3289
|
+
query = linkedSignal(() => this.selectedLabel(), /* @ts-ignore */
|
|
3290
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
3291
|
+
select(option) {
|
|
3292
|
+
if (option.disabled)
|
|
3293
|
+
return;
|
|
3294
|
+
this.value.set(option.value);
|
|
3295
|
+
this.close();
|
|
3296
|
+
}
|
|
3297
|
+
onInput(event) {
|
|
3298
|
+
const target = event.target;
|
|
3299
|
+
this.query.set(target.value);
|
|
3300
|
+
this.open();
|
|
3301
|
+
this.activeIndex.set(this.getInitialActiveIndex());
|
|
3302
|
+
}
|
|
3303
|
+
onKeydown(event) {
|
|
3304
|
+
if (event.key === 'ArrowDown') {
|
|
3305
|
+
event.preventDefault();
|
|
3306
|
+
if (this.isOpen()) {
|
|
3307
|
+
this.moveActive(1);
|
|
3308
|
+
}
|
|
3309
|
+
else {
|
|
3310
|
+
this.open();
|
|
3311
|
+
}
|
|
3312
|
+
}
|
|
3313
|
+
else if (event.key === 'ArrowUp') {
|
|
3314
|
+
event.preventDefault();
|
|
3315
|
+
if (this.isOpen()) {
|
|
3316
|
+
this.moveActive(-1);
|
|
3317
|
+
}
|
|
3318
|
+
else {
|
|
3319
|
+
this.open();
|
|
3320
|
+
}
|
|
3321
|
+
}
|
|
3322
|
+
else if (event.key === 'Enter') {
|
|
3323
|
+
// While the panel is open the combobox owns Enter: commit the active option, and always
|
|
3324
|
+
// swallow the key so it can't submit a surrounding form with the list still showing.
|
|
3325
|
+
if (!this.isOpen())
|
|
3326
|
+
return;
|
|
3327
|
+
event.preventDefault();
|
|
3328
|
+
const active = this.visibleOptions()[this.activeIndex()];
|
|
3329
|
+
if (active && !active.disabled)
|
|
3330
|
+
this.commitActiveOption(active);
|
|
3331
|
+
}
|
|
3332
|
+
else if (event.key === 'Escape') {
|
|
3333
|
+
if (this.isOpen()) {
|
|
3334
|
+
event.preventDefault();
|
|
3335
|
+
this.close();
|
|
3336
|
+
}
|
|
3337
|
+
}
|
|
3338
|
+
else if (event.key === 'Tab') {
|
|
3339
|
+
if (this.isOpen())
|
|
3340
|
+
this.close();
|
|
3341
|
+
}
|
|
3342
|
+
}
|
|
3343
|
+
filterVisibleOptions(options) {
|
|
3344
|
+
const query = this.query().trim().toLowerCase();
|
|
3345
|
+
if (!query)
|
|
3346
|
+
return options;
|
|
3347
|
+
// While the field shows the committed selection's label (not an active search), list everything.
|
|
3348
|
+
if (this.hasValue() && this.query() === this.selectedLabel())
|
|
3349
|
+
return options;
|
|
3350
|
+
if (this.filterMode() === 'startsWith') {
|
|
3351
|
+
return options.filter(option => option.label.toLowerCase().startsWith(query));
|
|
3352
|
+
}
|
|
3353
|
+
return options.filter(option => option.label.toLowerCase().includes(query));
|
|
3354
|
+
}
|
|
3355
|
+
onClosed() {
|
|
3356
|
+
// Discard an unmatched free-text query, restoring the committed selection's label (or empty).
|
|
3357
|
+
this.query.set(this.selectedLabel());
|
|
3358
|
+
}
|
|
3359
|
+
clear() {
|
|
3360
|
+
this.value.set(null);
|
|
3361
|
+
this.query.set('');
|
|
3362
|
+
}
|
|
3363
|
+
getInitialActiveIndex() {
|
|
3364
|
+
const options = this.visibleOptions();
|
|
3365
|
+
if (this.hasValue()) {
|
|
3366
|
+
const selectedIndex = options.findIndex(option => !option.disabled && option.value === this.value());
|
|
3367
|
+
if (selectedIndex !== -1)
|
|
3368
|
+
return selectedIndex;
|
|
3369
|
+
}
|
|
3370
|
+
return options.findIndex(option => !option.disabled);
|
|
3371
|
+
}
|
|
3372
|
+
commitActiveOption(option) {
|
|
3373
|
+
this.select(option);
|
|
3374
|
+
}
|
|
3375
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3376
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Autocomplete, isStandalone: true, selector: "tls-autocomplete", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, filterMode: { classPropertyName: "filterMode", publicName: "filterMode", isSignal: true, isRequired: false, transformFunction: null }, emptyMessage: { classPropertyName: "emptyMessage", publicName: "emptyMessage", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], usesInheritance: true, ngImport: i0, template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-autocomplete__panel\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
3377
|
+
}
|
|
3378
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, decorators: [{
|
|
3379
|
+
type: Component,
|
|
3380
|
+
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon], host: {
|
|
3381
|
+
'[class]': 'hostClasses()',
|
|
3382
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Autocomplete) }], template: "<input\n #trigger\n type=\"text\"\n class=\"tls-autocomplete__trigger\"\n role=\"combobox\"\n autocomplete=\"off\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n aria-autocomplete=\"list\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [attr.aria-expanded]=\"isOpen()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [value]=\"query()\"\n (input)=\"onInput($event)\"\n (click)=\"open()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n/>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-autocomplete__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-autocomplete__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-autocomplete__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-autocomplete__panel\"\n animate.enter=\"tls-autocomplete__panel--enter\"\n animate.leave=\"tls-autocomplete__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-autocomplete__option\"\n [class.tls-autocomplete__option--selected]=\"option.value === value()\"\n [class.tls-autocomplete__option--active]=\"index === activeIndex()\"\n [class.tls-autocomplete__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-autocomplete__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n } @empty {\n <li class=\"tls-autocomplete__empty\" role=\"presentation\">{{ emptyMessage() }}</li>\n }\n </ul>\n</ng-template>\n" }]
|
|
3383
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], filterMode: [{ type: i0.Input, args: [{ isSignal: true, alias: "filterMode", required: false }] }], emptyMessage: [{ type: i0.Input, args: [{ isSignal: true, alias: "emptyMessage", required: false }] }] } });
|
|
3384
|
+
|
|
3385
|
+
const DEFAULT_CHECKBOX_CONFIG = {};
|
|
3386
|
+
|
|
3387
|
+
const CHECKBOX_CONFIG = new InjectionToken('CHECKBOX_CONFIG', {
|
|
3388
|
+
factory: () => DEFAULT_CHECKBOX_CONFIG,
|
|
3389
|
+
});
|
|
3390
|
+
|
|
3391
|
+
class Checkbox extends CheckboxFormControl {
|
|
3392
|
+
_config = inject(CHECKBOX_CONFIG);
|
|
3393
|
+
CLASS_NAME = 'tls-checkbox';
|
|
3394
|
+
supportsLabelFor = true;
|
|
3395
|
+
indeterminate = model(false, /* @ts-ignore */
|
|
3396
|
+
...(ngDevMode ? [{ debugName: "indeterminate" }] : /* istanbul ignore next */ []));
|
|
3397
|
+
checked = model(false, /* @ts-ignore */
|
|
3398
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
3399
|
+
tabindex = input(0, /* @ts-ignore */
|
|
3400
|
+
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
3401
|
+
hostClasses = computed(() => {
|
|
3402
|
+
const className = this.CLASS_NAME;
|
|
3403
|
+
const array = [className];
|
|
3404
|
+
if (this.indeterminate())
|
|
3405
|
+
array.push(`${className}--indeterminate`);
|
|
3406
|
+
return array.concat(this.controlClasses());
|
|
3407
|
+
}, /* @ts-ignore */
|
|
3408
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3409
|
+
// Protected methods
|
|
3410
|
+
toggle() {
|
|
3411
|
+
if (this.notInteractive())
|
|
3412
|
+
return;
|
|
3413
|
+
this.checked.update(prev => !prev);
|
|
3414
|
+
}
|
|
3415
|
+
onKeyboardToggle(event) {
|
|
3416
|
+
event.preventDefault();
|
|
3417
|
+
this.toggle();
|
|
3418
|
+
}
|
|
3419
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Checkbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3420
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Checkbox, isStandalone: true, selector: "tls-checkbox", inputs: { indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indeterminate: "indeterminateChange", checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, properties: { "class": "hostClasses()", "tabindex": "-1" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Checkbox) }], usesInheritance: true, ngImport: i0, template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [attr.id]=\"effectiveInputId()\"\n [name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<tls-icon\n class=\"tls-checkbox-icon\"\n [name]=\"indeterminate() ? 'indeterminate' : 'check'\"\n aria-hidden=\"true\"\n/>\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
3421
|
+
}
|
|
3422
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Checkbox, decorators: [{
|
|
3423
|
+
type: Component,
|
|
3424
|
+
args: [{ selector: 'tls-checkbox', imports: [Icon], host: {
|
|
3425
|
+
role: 'checkbox',
|
|
3426
|
+
'[class]': 'hostClasses()',
|
|
3427
|
+
'[tabindex]': '-1',
|
|
3428
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Checkbox) }], template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [attr.id]=\"effectiveInputId()\"\n [name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<tls-icon\n class=\"tls-checkbox-icon\"\n [name]=\"indeterminate() ? 'indeterminate' : 'check'\"\n aria-hidden=\"true\"\n/>\n" }]
|
|
3429
|
+
}], propDecorators: { indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
3430
|
+
|
|
3254
3431
|
const DEFAULT_POPOVER_CONFIG = {
|
|
3255
3432
|
position: 'bottom',
|
|
3256
3433
|
offset: { x: 0, y: 4 },
|
|
@@ -4420,7 +4597,7 @@ class MultiSelect extends AbstractSelect {
|
|
|
4420
4597
|
this.value.set([]);
|
|
4421
4598
|
}
|
|
4422
4599
|
getInitialActiveIndex() {
|
|
4423
|
-
const options = this.
|
|
4600
|
+
const options = this.visibleOptions();
|
|
4424
4601
|
const selected = this.selectedValues();
|
|
4425
4602
|
const firstSelected = options.findIndex(option => !option.disabled && selected.has(option.value));
|
|
4426
4603
|
if (firstSelected !== -1)
|
|
@@ -4431,13 +4608,13 @@ class MultiSelect extends AbstractSelect {
|
|
|
4431
4608
|
this.toggleOption(option);
|
|
4432
4609
|
}
|
|
4433
4610
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4434
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-multi-select__panel\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [id]=\"listboxId\"\n >\n @for (option of
|
|
4611
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-multi-select__panel\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">{{ option.label }}</span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </li>\n }\n </ul>\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
4435
4612
|
}
|
|
4436
4613
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, decorators: [{
|
|
4437
4614
|
type: Component,
|
|
4438
4615
|
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon], host: {
|
|
4439
4616
|
'[class]': 'hostClasses()',
|
|
4440
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-multi-select__panel\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [id]=\"listboxId\"\n >\n @for (option of
|
|
4617
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\" [class.tls-multi-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-multi-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-multi-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-multi-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-multi-select__panel\"\n animate.enter=\"tls-multi-select__panel--enter\"\n animate.leave=\"tls-multi-select__panel--leave\"\n role=\"listbox\"\n aria-multiselectable=\"true\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">{{ option.label }}</span>\n @if (isSelected(option)) {\n <tls-icon class=\"tls-multi-select__option-check\" name=\"check\" aria-hidden=\"true\" />\n }\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" }]
|
|
4441
4618
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLabels", required: false }] }] } });
|
|
4442
4619
|
|
|
4443
4620
|
const DEFAULT_SELECT_CONFIG = {
|
|
@@ -4490,19 +4667,19 @@ class Select extends AbstractSelect {
|
|
|
4490
4667
|
this.value.set(null);
|
|
4491
4668
|
}
|
|
4492
4669
|
getInitialActiveIndex() {
|
|
4493
|
-
return this.
|
|
4670
|
+
return this.visibleOptions().findIndex(option => option.value === this.value());
|
|
4494
4671
|
}
|
|
4495
4672
|
commitActiveOption(option) {
|
|
4496
4673
|
this.select(option);
|
|
4497
4674
|
}
|
|
4498
4675
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4499
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-select__panel\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of
|
|
4676
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-select__panel\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n", dependencies: [{ kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }] });
|
|
4500
4677
|
}
|
|
4501
4678
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, decorators: [{
|
|
4502
4679
|
type: Component,
|
|
4503
4680
|
args: [{ selector: 'tls-select', imports: [Loader, Icon], host: {
|
|
4504
4681
|
'[class]': 'hostClasses()',
|
|
4505
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-select__panel\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of
|
|
4682
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"effectiveInputId()\"\n [attr.name]=\"name()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\" [class.tls-select__icon--hidden]=\"pending()\">\n <tls-icon class=\"tls-select__chevron\" name=\"chevron-down\" aria-hidden=\"true\" />\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <tls-icon class=\"tls-select__clear-icon\" name=\"close\" aria-hidden=\"true\" />\n </button>\n}\n@if (pending()) {\n <tls-loader class=\"tls-select__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n\n<ng-template #panel>\n <ul\n class=\"tls-select__panel\"\n animate.enter=\"tls-select__panel--enter\"\n animate.leave=\"tls-select__panel--leave\"\n role=\"listbox\"\n [id]=\"listboxId\"\n >\n @for (option of visibleOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" }]
|
|
4506
4683
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }] } });
|
|
4507
4684
|
|
|
4508
4685
|
const DEFAULT_SWITCH_CONFIG = {
|
|
@@ -4617,6 +4794,147 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4617
4794
|
args: [{ selector: 'tls-textarea', imports: [CdkTextareaAutosize, Loader], host: { class: 'tls-textarea' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"effectiveInputId()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"labelledBy()\"\n [attr.aria-invalid]=\"invalid() ? 'true' : null\"\n [attr.aria-required]=\"required() ? 'true' : null\"\n [attr.aria-busy]=\"pending() ? 'true' : null\"\n [attr.aria-describedby]=\"describedBy()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"effectiveResize()\"\n [value]=\"value()\"\n [cdkTextareaAutosize]=\"autosize()\"\n [cdkAutosizeMinRows]=\"rows()\"\n [cdkAutosizeMaxRows]=\"maxRows()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-textarea-width: 200px;position:relative;display:inline-block;width:var(--tls-textarea-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block-start:var(--spacing-2);inset-inline-end:var(--spacing-3);pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-textarea-width: 100%}\n"] }]
|
|
4618
4795
|
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }], autosize: [{ type: i0.Input, args: [{ isSignal: true, alias: "autosize", required: false }] }], maxRows: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxRows", required: false }] }] } });
|
|
4619
4796
|
|
|
4797
|
+
const DEFAULT_TOGGLE_BUTTON_CONFIG = {
|
|
4798
|
+
color: 'primary',
|
|
4799
|
+
variant: 'outlined',
|
|
4800
|
+
size: 'md',
|
|
4801
|
+
fluid: false,
|
|
4802
|
+
checkedColor: undefined,
|
|
4803
|
+
checkedVariant: undefined,
|
|
4804
|
+
};
|
|
4805
|
+
|
|
4806
|
+
const TOGGLE_BUTTON_CONFIG = new InjectionToken('TOGGLE_BUTTON_CONFIG', {
|
|
4807
|
+
factory: () => DEFAULT_TOGGLE_BUTTON_CONFIG,
|
|
4808
|
+
});
|
|
4809
|
+
|
|
4810
|
+
/**
|
|
4811
|
+
* A standalone two-state button following the WAI-ARIA toggle-button pattern
|
|
4812
|
+
* (`role="button"` + `aria-pressed`). The host element is the control itself.
|
|
4813
|
+
* For a set of mutually related options use `tls-toggle-group` instead.
|
|
4814
|
+
*
|
|
4815
|
+
* `color`/`variant` style the resting (unpressed) state. The pressed state
|
|
4816
|
+
* defaults to the filled treatment of the base hue and can be restyled
|
|
4817
|
+
* independently via `checkedColor`/`checkedVariant`, mirroring `tlsChipControl`.
|
|
4818
|
+
*/
|
|
4819
|
+
class ToggleButton extends CheckboxFormControl {
|
|
4820
|
+
// Injections
|
|
4821
|
+
_config = inject(TOGGLE_BUTTON_CONFIG);
|
|
4822
|
+
CLASS_NAME = 'tls-toggle-button';
|
|
4823
|
+
// Inputs
|
|
4824
|
+
/** Whether the button is in the pressed (on) state. */
|
|
4825
|
+
checked = model(false, /* @ts-ignore */
|
|
4826
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
4827
|
+
/** The text label displayed inside the button. Takes priority over projected content. */
|
|
4828
|
+
label = input(/* @ts-ignore */
|
|
4829
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
4830
|
+
/**
|
|
4831
|
+
* Label displayed instead of `label` while pressed (e.g. "Mute" / "Muted").
|
|
4832
|
+
* Providing it also switches the announcement strategy: the state is conveyed
|
|
4833
|
+
* by the changing accessible name alone and `aria-pressed` is omitted, per the
|
|
4834
|
+
* WAI-ARIA toggle-button pattern (a name that changes with state must not be
|
|
4835
|
+
* combined with `aria-pressed`, or screen readers announce both).
|
|
4836
|
+
*/
|
|
4837
|
+
checkedLabel = input(/* @ts-ignore */
|
|
4838
|
+
...(ngDevMode ? [undefined, { debugName: "checkedLabel" }] : /* istanbul ignore next */ []));
|
|
4839
|
+
/**
|
|
4840
|
+
* Keeps the button's width constant across states by reserving space for the
|
|
4841
|
+
* wider of `label` / `checkedLabel`, so toggling never shifts the surrounding
|
|
4842
|
+
* layout. Applies only when both labels are provided.
|
|
4843
|
+
*/
|
|
4844
|
+
staticWidth = input(false, { ...(ngDevMode ? { debugName: "staticWidth" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4845
|
+
/**
|
|
4846
|
+
* Marks the content as icon-only: the button becomes square with centered
|
|
4847
|
+
* content. Provide an accessible name via `ariaLabel`/`ariaLabelledby`, since
|
|
4848
|
+
* there is no visible text for screen readers to announce.
|
|
4849
|
+
*/
|
|
4850
|
+
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4851
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
4852
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
4853
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
4854
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
4855
|
+
variant = input(this._config.variant, /* @ts-ignore */
|
|
4856
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
4857
|
+
/** Hue of the pressed state; `undefined` keeps the base `color`. */
|
|
4858
|
+
checkedColor = input(this._config.checkedColor, /* @ts-ignore */
|
|
4859
|
+
...(ngDevMode ? [{ debugName: "checkedColor" }] : /* istanbul ignore next */ []));
|
|
4860
|
+
/** Treatment of the pressed state; `undefined` uses the filled treatment. */
|
|
4861
|
+
checkedVariant = input(this._config.checkedVariant, /* @ts-ignore */
|
|
4862
|
+
...(ngDevMode ? [{ debugName: "checkedVariant" }] : /* istanbul ignore next */ []));
|
|
4863
|
+
/** Whether the button stretches to fill its container's width. */
|
|
4864
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4865
|
+
tabindex = input(0, /* @ts-ignore */
|
|
4866
|
+
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
4867
|
+
// Computed
|
|
4868
|
+
/** Label for the current state: `checkedLabel` while pressed (when provided), `label` otherwise. */
|
|
4869
|
+
displayedLabel = computed(() => {
|
|
4870
|
+
const checkedLabel = this.checkedLabel();
|
|
4871
|
+
if (this.checked() && checkedLabel)
|
|
4872
|
+
return checkedLabel;
|
|
4873
|
+
return this.label();
|
|
4874
|
+
}, /* @ts-ignore */
|
|
4875
|
+
...(ngDevMode ? [{ debugName: "displayedLabel" }] : /* istanbul ignore next */ []));
|
|
4876
|
+
/** Whether both state labels render stacked in one cell, sizing the button to the wider one. */
|
|
4877
|
+
stackedLabels = computed(() => Boolean(this.staticWidth() && this.label() && this.checkedLabel()), /* @ts-ignore */
|
|
4878
|
+
...(ngDevMode ? [{ debugName: "stackedLabels" }] : /* istanbul ignore next */ []));
|
|
4879
|
+
/** `aria-pressed` value; omitted entirely when `checkedLabel` makes the name carry the state. */
|
|
4880
|
+
ariaPressed = computed(() => this.checkedLabel() ? null : this.checked(), /* @ts-ignore */
|
|
4881
|
+
...(ngDevMode ? [{ debugName: "ariaPressed" }] : /* istanbul ignore next */ []));
|
|
4882
|
+
hostClasses = computed(() => {
|
|
4883
|
+
const className = this.CLASS_NAME;
|
|
4884
|
+
const array = [
|
|
4885
|
+
className,
|
|
4886
|
+
`${className}--${this.color()}`,
|
|
4887
|
+
`${className}--${this.size()}`,
|
|
4888
|
+
`${className}--${this.variant()}`,
|
|
4889
|
+
];
|
|
4890
|
+
if (this.fluid())
|
|
4891
|
+
array.push(`${className}--fluid`);
|
|
4892
|
+
if (this.icon())
|
|
4893
|
+
array.push(`${className}--icon-only`);
|
|
4894
|
+
if (this.checked()) {
|
|
4895
|
+
const checkedColor = this.checkedColor();
|
|
4896
|
+
if (checkedColor)
|
|
4897
|
+
array.push(`${className}--checked-${checkedColor}`);
|
|
4898
|
+
const checkedVariant = this.checkedVariant();
|
|
4899
|
+
if (checkedVariant)
|
|
4900
|
+
array.push(`${className}--checked-${checkedVariant}`);
|
|
4901
|
+
}
|
|
4902
|
+
return array.concat(this.controlClasses());
|
|
4903
|
+
}, /* @ts-ignore */
|
|
4904
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
4905
|
+
// Protected methods
|
|
4906
|
+
toggle() {
|
|
4907
|
+
if (this.notInteractive())
|
|
4908
|
+
return;
|
|
4909
|
+
this.checked.update(previous => !previous);
|
|
4910
|
+
}
|
|
4911
|
+
onKeyboardToggle(event) {
|
|
4912
|
+
event.preventDefault();
|
|
4913
|
+
this.toggle();
|
|
4914
|
+
}
|
|
4915
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4916
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ToggleButton, isStandalone: true, selector: "tls-toggle-button", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, checkedLabel: { classPropertyName: "checkedLabel", publicName: "checkedLabel", isSignal: true, isRequired: false, transformFunction: null }, staticWidth: { classPropertyName: "staticWidth", publicName: "staticWidth", isSignal: true, isRequired: false, transformFunction: null }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null }, checkedVariant: { classPropertyName: "checkedVariant", publicName: "checkedVariant", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { attributes: { "role": "button" }, listeners: { "click": "toggle()", "blur": "touched.set(true)", "keydown.space": "onKeyboardToggle($event)", "keydown.enter": "onKeyboardToggle($event)" }, properties: { "class": "hostClasses()", "tabindex": "disabled() ? -1 : tabindex()", "attr.id": "effectiveInputId()", "attr.aria-pressed": "ariaPressed()", "attr.aria-disabled": "disabled()", "attr.aria-label": "ariaLabel() ?? null", "attr.aria-labelledby": "labelledBy()", "attr.aria-describedby": "describedBy()", "attr.aria-invalid": "invalid() ? 'true' : null" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleButton) }], usesInheritance: true, ngImport: i0, template: "@if (stackedLabels()) {\n <span class=\"tls-toggle-button__labels\">\n <span\n class=\"tls-toggle-button__label\"\n [class.tls-toggle-button__label--hidden]=\"checked()\"\n >{{ label() }}</span>\n <span\n class=\"tls-toggle-button__label\"\n [class.tls-toggle-button__label--hidden]=\"!checked()\"\n >{{ checkedLabel() }}</span>\n </span>\n} @else if (displayedLabel()) {\n {{ displayedLabel() }}\n} @else {\n <ng-content></ng-content>\n}\n" });
|
|
4917
|
+
}
|
|
4918
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleButton, decorators: [{
|
|
4919
|
+
type: Component,
|
|
4920
|
+
args: [{ selector: 'tls-toggle-button', host: {
|
|
4921
|
+
role: 'button',
|
|
4922
|
+
'[class]': 'hostClasses()',
|
|
4923
|
+
'[tabindex]': 'disabled() ? -1 : tabindex()',
|
|
4924
|
+
'[attr.id]': 'effectiveInputId()',
|
|
4925
|
+
'[attr.aria-pressed]': 'ariaPressed()',
|
|
4926
|
+
'[attr.aria-disabled]': 'disabled()',
|
|
4927
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
4928
|
+
'[attr.aria-labelledby]': 'labelledBy()',
|
|
4929
|
+
'[attr.aria-describedby]': 'describedBy()',
|
|
4930
|
+
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
4931
|
+
'(click)': 'toggle()',
|
|
4932
|
+
'(blur)': 'touched.set(true)',
|
|
4933
|
+
'(keydown.space)': 'onKeyboardToggle($event)',
|
|
4934
|
+
'(keydown.enter)': 'onKeyboardToggle($event)',
|
|
4935
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleButton) }], template: "@if (stackedLabels()) {\n <span class=\"tls-toggle-button__labels\">\n <span\n class=\"tls-toggle-button__label\"\n [class.tls-toggle-button__label--hidden]=\"checked()\"\n >{{ label() }}</span>\n <span\n class=\"tls-toggle-button__label\"\n [class.tls-toggle-button__label--hidden]=\"!checked()\"\n >{{ checkedLabel() }}</span>\n </span>\n} @else if (displayedLabel()) {\n {{ displayedLabel() }}\n} @else {\n <ng-content></ng-content>\n}\n" }]
|
|
4936
|
+
}], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], checkedLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedLabel", required: false }] }], staticWidth: [{ type: i0.Input, args: [{ isSignal: true, alias: "staticWidth", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], checkedColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedColor", required: false }] }], checkedVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedVariant", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
4937
|
+
|
|
4620
4938
|
const DEFAULT_IMAGE_COMPARE_CONFIG = {
|
|
4621
4939
|
orientation: 'horizontal',
|
|
4622
4940
|
position: 50,
|
|
@@ -4784,6 +5102,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4784
5102
|
}, template: "<div class=\"tls-image-compare__layer tls-image-compare__after\">\n <ng-content select=\"[after]\"></ng-content>\n</div>\n\n<div class=\"tls-image-compare__layer tls-image-compare__before\" [style.clip-path]=\"clipPath()\">\n <ng-content select=\"[before]\"></ng-content>\n</div>\n\n<div\n #handle\n class=\"tls-image-compare__handle\"\n role=\"slider\"\n tabindex=\"0\"\n [attr.aria-orientation]=\"orientation()\"\n [attr.aria-valuenow]=\"valueNow()\"\n [attr.aria-valuemin]=\"0\"\n [attr.aria-valuemax]=\"100\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [style.inset-inline-start.%]=\"isHorizontal() ? clampedPosition() : null\"\n [style.inset-block-start.%]=\"isHorizontal() ? null : clampedPosition()\"\n (keydown)=\"onHandleKeydown($event)\"\n>\n <span class=\"tls-image-compare__grip\" aria-hidden=\"true\"></span>\n</div>\n" }]
|
|
4785
5103
|
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], keyboardStep: [{ type: i0.Input, args: [{ isSignal: true, alias: "keyboardStep", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }, { type: i0.Output, args: ["positionChange"] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], _handle: [{ type: i0.ViewChild, args: ['handle', { isSignal: true }] }] } });
|
|
4786
5104
|
|
|
5105
|
+
const DEFAULT_KBD_CONFIG = {
|
|
5106
|
+
size: 'md',
|
|
5107
|
+
};
|
|
5108
|
+
|
|
5109
|
+
const KBD_CONFIG = new InjectionToken('KBD_CONFIG', {
|
|
5110
|
+
factory: () => DEFAULT_KBD_CONFIG,
|
|
5111
|
+
});
|
|
5112
|
+
|
|
5113
|
+
class Kbd {
|
|
5114
|
+
// Injections
|
|
5115
|
+
_config = inject(KBD_CONFIG);
|
|
5116
|
+
// Inputs
|
|
5117
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
5118
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
5119
|
+
// Computed
|
|
5120
|
+
hostClasses = computed(() => {
|
|
5121
|
+
const className = 'tls-kbd';
|
|
5122
|
+
return [className, `${className}--${this.size()}`];
|
|
5123
|
+
}, /* @ts-ignore */
|
|
5124
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
5125
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Kbd, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5126
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: Kbd, isStandalone: true, selector: "kbd[tlsKbd]", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0 });
|
|
5127
|
+
}
|
|
5128
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Kbd, decorators: [{
|
|
5129
|
+
type: Directive,
|
|
5130
|
+
args: [{
|
|
5131
|
+
selector: 'kbd[tlsKbd]',
|
|
5132
|
+
host: {
|
|
5133
|
+
'[class]': 'hostClasses()',
|
|
5134
|
+
},
|
|
5135
|
+
}]
|
|
5136
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
5137
|
+
|
|
4787
5138
|
class MenuItemComponent {
|
|
4788
5139
|
key = input.required(/* @ts-ignore */
|
|
4789
5140
|
...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
@@ -6813,7 +7164,20 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6813
7164
|
// separate DI tokens, so split the nested `querySync` off from the component's own config.
|
|
6814
7165
|
const { querySync: paginationQuerySync, ...pagination } = config.components.pagination ?? {};
|
|
6815
7166
|
const { querySync: tabsQuerySync, ...tabs } = config.components.tabs ?? {};
|
|
7167
|
+
const accessibility = deepMerge(DEFAULT_ACCESSIBILITY_CONFIG, config.accessibility);
|
|
6816
7168
|
return makeEnvironmentProviders([
|
|
7169
|
+
// Cross-cutting accessibility policy
|
|
7170
|
+
{ provide: ACCESSIBILITY_CONFIG, useValue: accessibility },
|
|
7171
|
+
// Reflect the touch-target opt-out onto the document root. Absent the attribute the
|
|
7172
|
+
// expansion is active (accessible by default); this only disables it. The overflow is
|
|
7173
|
+
// transparent, so a late (browser-only) reflection causes no visual flash.
|
|
7174
|
+
provideEnvironmentInitializer(() => {
|
|
7175
|
+
if (accessibility.expandTouchTargets)
|
|
7176
|
+
return;
|
|
7177
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
7178
|
+
return;
|
|
7179
|
+
inject(DOCUMENT).documentElement.setAttribute('data-touch-targets', 'off');
|
|
7180
|
+
}),
|
|
6817
7181
|
// Cross-cutting form defaults
|
|
6818
7182
|
{
|
|
6819
7183
|
provide: FORM_CONTROL_CONFIG,
|
|
@@ -6824,6 +7188,10 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6824
7188
|
provide: ALERT_CONFIG,
|
|
6825
7189
|
useValue: deepMerge(DEFAULT_ALERT_CONFIG, config.components.alert),
|
|
6826
7190
|
},
|
|
7191
|
+
{
|
|
7192
|
+
provide: AUTOCOMPLETE_CONFIG,
|
|
7193
|
+
useValue: deepMerge(DEFAULT_AUTOCOMPLETE_CONFIG, config.components.autocomplete),
|
|
7194
|
+
},
|
|
6827
7195
|
{
|
|
6828
7196
|
provide: BUTTON_CONFIG,
|
|
6829
7197
|
useValue: deepMerge(DEFAULT_BUTTON_CONFIG, config.components.button),
|
|
@@ -6963,5 +7331,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6963
7331
|
* Generated bundle index. Do not edit.
|
|
6964
7332
|
*/
|
|
6965
7333
|
|
|
6966
|
-
export { ALERT_CONFIG, Alert, BADGE_CONFIG, BUTTON_CONFIG, Badge, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, Input, InputDirective, InputNumber, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, SPLITTER_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Splitter, SplitterPanel, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleGroup, TooltipDirective, ValueFormControl, provideThalassicIcons, provideThalassicUIConfig };
|
|
7334
|
+
export { ALERT_CONFIG, AUTOCOMPLETE_CONFIG, Alert, Autocomplete, BADGE_CONFIG, BUTTON_CONFIG, Badge, Button, ButtonDirective, CALENDAR_CONFIG, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, CONFIRM_CONFIG, Calendar, CalendarAgendaView, CalendarEventItem, CalendarMonthView, CalendarTimeGrid, Checkbox, CheckboxFormControl, Chip, ChipControl, ChipGroup, ChipInput, Confirm, ConfirmPanel, ConfirmService, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_AUTOCOMPLETE_CONFIG, DEFAULT_BADGE_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CALENDAR_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_CONFIRM_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_DRAWER_CONFIG, DEFAULT_FILE_INPUT_CONFIG, DEFAULT_FORM_CONTROL_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICONS, DEFAULT_ICON_CONFIG, DEFAULT_IMAGE_COMPARE_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_INPUT_NUMBER_CONFIG, DEFAULT_KBD_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_ODOMETER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PAGINATION_QUERY_SYNC_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_SPLITTER_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TABS_QUERY_SYNC_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOAST_CONFIG, DEFAULT_TOGGLE_BUTTON_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DRAWER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, Drawer, DrawerRef, DrawerService, FILE_INPUT_CONFIG, FORM_CONTROL_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileInput, FormControl, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, ICON_REGISTRY, IMAGE_COMPARE_CONFIG, INPUT_CONFIG, INPUT_NUMBER_CONFIG, Icon, IconRegistry, IconService, ImageCompare, Input, InputDirective, InputNumber, KBD_CONFIG, Kbd, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, ODOMETER_CONFIG, Odometer, PAGINATION_CONFIG, PAGINATION_QUERY_SYNC_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, PaginationQuerySyncDirective, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, SPLITTER_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Splitter, SplitterPanel, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TABS_QUERY_SYNC_CONFIG, TEXTAREA_CONFIG, TOAST_CONFIG, TOGGLE_BUTTON_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TabsQuerySyncDirective, Textarea, Toast, ToastOutlet, ToastService, ToggleButton, ToggleGroup, TooltipDirective, ValueFormControl, provideThalassicIcons, provideThalassicUIConfig };
|
|
6967
7335
|
//# sourceMappingURL=thalassic-ui.mjs.map
|