@thalassic/ui 22.8.0 → 22.10.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/fesm2022/thalassic-ui.mjs +918 -334
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/types/thalassic-ui.d.ts +361 -107
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import * as i0 from '@angular/core';
|
|
2
|
-
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, ViewContainerRef, DestroyRef, viewChild, Component,
|
|
2
|
+
import { InjectionToken, inject, model, input, signal, computed, booleanAttribute, Directive, ViewContainerRef, DestroyRef, viewChild, Component, Injectable, makeEnvironmentProviders, contentChild, forwardRef, output, effect, ElementRef, afterNextRender, linkedSignal, numberAttribute, Renderer2, viewChildren, contentChildren, isDevMode, untracked, TemplateRef, 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 {
|
|
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';
|
|
8
|
+
import { NgComponentOutlet, NgTemplateOutlet, LocationStrategy, isPlatformBrowser } from '@angular/common';
|
|
10
9
|
import { HttpClient } from '@angular/common/http';
|
|
11
10
|
import { DomSanitizer } from '@angular/platform-browser';
|
|
11
|
+
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';
|
|
12
12
|
import { Grid, GridRow, GridCell } from '@angular/aria/grid';
|
|
13
13
|
import { ConfigurableFocusTrapFactory } from '@angular/cdk/a11y';
|
|
14
14
|
import { filter as filter$1 } from 'rxjs/operators';
|
|
@@ -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,234 +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 }] }] } });
|
|
799
|
-
|
|
800
|
-
const DEFAULT_BUTTON_CONFIG = {
|
|
801
|
-
color: 'primary',
|
|
802
|
-
variant: 'filled',
|
|
803
|
-
size: 'md',
|
|
804
|
-
type: 'button',
|
|
805
|
-
fluid: false,
|
|
806
|
-
};
|
|
807
|
-
|
|
808
|
-
const BUTTON_CONFIG = new InjectionToken('BUTTON_CONFIG', {
|
|
809
|
-
factory: () => DEFAULT_BUTTON_CONFIG,
|
|
810
|
-
});
|
|
811
|
-
|
|
812
|
-
class ButtonBase {
|
|
813
|
-
// Injections
|
|
814
|
-
_config = inject(BUTTON_CONFIG);
|
|
815
|
-
APPLY_HOST_CLASSES = true;
|
|
816
|
-
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
817
|
-
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
818
|
-
color = input(this._config.color, /* @ts-ignore */
|
|
819
|
-
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
820
|
-
variant = input(this._config.variant, /* @ts-ignore */
|
|
821
|
-
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
822
|
-
size = input(this._config.size, /* @ts-ignore */
|
|
823
|
-
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
824
|
-
rounded = input(false, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
825
|
-
/** Whether the button stretches to fill its container's width. */
|
|
826
|
-
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
827
|
-
classes = computed(() => {
|
|
828
|
-
const className = 'tls-button';
|
|
829
|
-
const array = [className];
|
|
830
|
-
array.push(`${className}--${this.color()}`);
|
|
831
|
-
array.push(`${className}--${this.variant()}`);
|
|
832
|
-
array.push(`${className}--${this.size()}`);
|
|
833
|
-
if (this.disabled())
|
|
834
|
-
array.push(`${className}--disabled`);
|
|
835
|
-
if (this.icon())
|
|
836
|
-
array.push(`${className}--icon-only`);
|
|
837
|
-
if (this.fluid())
|
|
838
|
-
array.push(`${className}--fluid`);
|
|
839
|
-
if (this.rounded())
|
|
840
|
-
array.push(`${className}--rounded`);
|
|
841
|
-
return array;
|
|
842
|
-
}, /* @ts-ignore */
|
|
843
|
-
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
844
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
845
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: ButtonBase, isStandalone: true, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", 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 }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "APPLY_HOST_CLASSES ? classes() : null" } }, ngImport: i0 });
|
|
846
|
-
}
|
|
847
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonBase, decorators: [{
|
|
848
|
-
type: Directive,
|
|
849
|
-
args: [{
|
|
850
|
-
host: {
|
|
851
|
-
'[class]': 'APPLY_HOST_CLASSES ? classes() : null',
|
|
852
|
-
},
|
|
853
|
-
}]
|
|
854
|
-
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }] } });
|
|
855
|
-
|
|
856
|
-
class Button extends ButtonBase {
|
|
857
|
-
// Injections
|
|
858
|
-
_routerLink = inject(RouterLink, { optional: true });
|
|
859
|
-
_router = inject(Router, { optional: true });
|
|
860
|
-
_locationStrategy = inject(LocationStrategy, { optional: true });
|
|
861
|
-
APPLY_HOST_CLASSES = false;
|
|
862
|
-
// Inputs
|
|
863
|
-
/** The text label displayed inside the button. Takes priority over projected content. */
|
|
864
|
-
label = input(/* @ts-ignore */
|
|
865
|
-
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
866
|
-
/**
|
|
867
|
-
* Accessible name forwarded to the inner `<button>`/`<a>`. Required for icon-only buttons,
|
|
868
|
-
* where there is no visible text for screen readers to announce. Placed on the inner control
|
|
869
|
-
* because the host `tls-button` element is a non-interactive wrapper.
|
|
870
|
-
*/
|
|
871
|
-
ariaLabel = input(undefined, /* @ts-ignore */
|
|
872
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
873
|
-
/**
|
|
874
|
-
* `id` of an element whose text names the inner `<button>`/`<a>`, for when the accessible
|
|
875
|
-
* name already exists as visible text. Takes precedence over `ariaLabel` per the ARIA spec.
|
|
876
|
-
*/
|
|
877
|
-
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
878
|
-
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
879
|
-
type = input(this._config.type, /* @ts-ignore */
|
|
880
|
-
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
881
|
-
/** An optional URL that causes the button to render as an anchor link. */
|
|
882
|
-
href = input(null, /* @ts-ignore */
|
|
883
|
-
...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
|
|
884
|
-
tabindex = input('0', /* @ts-ignore */
|
|
885
|
-
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
886
|
-
// Computed
|
|
887
|
-
isLink = computed(() => Boolean(this._routerLink || this.href()), /* @ts-ignore */
|
|
888
|
-
...(ngDevMode ? [{ debugName: "isLink" }] : /* istanbul ignore next */ []));
|
|
889
|
-
/**
|
|
890
|
-
* Resolved URL placed on the inner anchor so the browser treats it as a real link
|
|
891
|
-
* (enables "Open in new tab", middle-click, status-bar preview, etc.). An explicit
|
|
892
|
-
* `href` wins; otherwise the URL is derived from the host `routerLink`.
|
|
893
|
-
*/
|
|
894
|
-
linkHref = computed(() => {
|
|
895
|
-
if (this.disabled())
|
|
896
|
-
return null;
|
|
897
|
-
const explicitHref = this.href();
|
|
898
|
-
if (explicitHref)
|
|
899
|
-
return explicitHref;
|
|
900
|
-
const urlTree = this._routerLink?.urlTree;
|
|
901
|
-
if (!urlTree || !this._router)
|
|
902
|
-
return null;
|
|
903
|
-
const serialized = this._router.serializeUrl(urlTree);
|
|
904
|
-
return this._locationStrategy?.prepareExternalUrl(serialized) ?? serialized;
|
|
905
|
-
}, /* @ts-ignore */
|
|
906
|
-
...(ngDevMode ? [{ debugName: "linkHref" }] : /* istanbul ignore next */ []));
|
|
907
|
-
// Protected methods
|
|
908
|
-
/**
|
|
909
|
-
* Keeps navigation correct when the host carries a `routerLink` while the inner anchor
|
|
910
|
-
* exposes a real `href`:
|
|
911
|
-
* - modified / non-primary clicks bubble to the browser so it can open a new tab, and
|
|
912
|
-
* are stopped from reaching the host RouterLink to avoid a duplicate in-app navigation;
|
|
913
|
-
* - a plain left click defers to the host RouterLink for SPA navigation, so the anchor's
|
|
914
|
-
* own full-page navigation is prevented.
|
|
915
|
-
*/
|
|
916
|
-
onLinkClick(event) {
|
|
917
|
-
if (this.disabled()) {
|
|
918
|
-
event.preventDefault();
|
|
919
|
-
event.stopPropagation();
|
|
920
|
-
return;
|
|
921
|
-
}
|
|
922
|
-
// Pure href links (no routerLink) navigate natively — nothing to coordinate.
|
|
923
|
-
if (!this._routerLink)
|
|
924
|
-
return;
|
|
925
|
-
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
|
|
926
|
-
event.stopPropagation();
|
|
927
|
-
return;
|
|
928
|
-
}
|
|
929
|
-
event.preventDefault();
|
|
930
|
-
}
|
|
931
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Button, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
932
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Button, isStandalone: true, selector: "tls-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"linkHref()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-disabled]=\"disabled()\"\n (click)=\"onLinkClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </a>\n} @else {\n <button\n role=\"button\"\n [class]=\"classes()\"\n [type]=\"type()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled()\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </button>\n}\n\n<!-- Content -->\n<ng-template #contentTemplate>\n @if (label() && !icon()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n</ng-template>\n\n<ng-template #projectedContentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:fit-content;display:inline-block}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
933
|
-
}
|
|
934
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Button, decorators: [{
|
|
935
|
-
type: Component,
|
|
936
|
-
args: [{ selector: 'tls-button', imports: [NgTemplateOutlet], host: {
|
|
937
|
-
'[tabindex]': '-1',
|
|
938
|
-
}, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"linkHref()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-disabled]=\"disabled()\"\n (click)=\"onLinkClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </a>\n} @else {\n <button\n role=\"button\"\n [class]=\"classes()\"\n [type]=\"type()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled()\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </button>\n}\n\n<!-- Content -->\n<ng-template #contentTemplate>\n @if (label() && !icon()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n</ng-template>\n\n<ng-template #projectedContentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:fit-content;display:inline-block}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}\n"] }]
|
|
939
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
940
|
-
|
|
941
|
-
class ButtonDirective extends ButtonBase {
|
|
942
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
943
|
-
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: ButtonDirective, isStandalone: true, selector: "[tlsButton]", usesInheritance: true, ngImport: i0 });
|
|
944
|
-
}
|
|
945
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonDirective, decorators: [{
|
|
946
|
-
type: Directive,
|
|
947
|
-
args: [{
|
|
948
|
-
selector: '[tlsButton]',
|
|
949
|
-
}]
|
|
950
|
-
}] });
|
|
951
|
-
|
|
952
|
-
const DEFAULT_TOGGLE_GROUP_CONFIG = {
|
|
953
|
-
size: 'md',
|
|
954
|
-
color: 'primary',
|
|
955
|
-
variant: 'filled',
|
|
956
|
-
orientation: 'horizontal',
|
|
957
|
-
multiple: false,
|
|
958
|
-
unselectable: false,
|
|
959
|
-
fluid: false,
|
|
960
|
-
};
|
|
961
|
-
|
|
962
|
-
const TOGGLE_GROUP_CONFIG = new InjectionToken('TOGGLE_GROUP_CONFIG', {
|
|
963
|
-
factory: () => DEFAULT_TOGGLE_GROUP_CONFIG,
|
|
964
|
-
});
|
|
965
|
-
|
|
966
|
-
/**
|
|
967
|
-
* `value` is always an array — in single mode (`multiple = false`) it holds 0 or
|
|
968
|
-
* 1 items, read it as `value()[0]`. See {@link SelectionGroup} for the contract.
|
|
969
|
-
*/
|
|
970
|
-
class ToggleGroup extends SelectionGroup {
|
|
971
|
-
_config = inject(TOGGLE_GROUP_CONFIG);
|
|
972
|
-
CLASS_NAME = 'tls-toggle-group';
|
|
973
|
-
multiple = input(this._config.multiple, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
974
|
-
unselectable = input(this._config.unselectable, { ...(ngDevMode ? { debugName: "unselectable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
975
|
-
size = input(this._config.size, /* @ts-ignore */
|
|
976
|
-
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
977
|
-
color = input(this._config.color, /* @ts-ignore */
|
|
978
|
-
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
979
|
-
variant = input(this._config.variant, /* @ts-ignore */
|
|
980
|
-
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
981
|
-
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
982
|
-
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
983
|
-
/** Whether the group stretches to fill its container's width with equal-width options. */
|
|
984
|
-
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
985
|
-
optionTemplate = contentChild('option', /* @ts-ignore */
|
|
986
|
-
...(ngDevMode ? [{ debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
987
|
-
classes = computed(() => {
|
|
988
|
-
const className = this.CLASS_NAME;
|
|
989
|
-
const array = [
|
|
990
|
-
className,
|
|
991
|
-
`${className}--${this.size()}`,
|
|
992
|
-
`${className}--${this.color()}`,
|
|
993
|
-
`${className}--${this.variant()}`,
|
|
994
|
-
`${className}--${this.orientation()}`,
|
|
995
|
-
];
|
|
996
|
-
if (this.fluid())
|
|
997
|
-
array.push(`${className}--fluid`);
|
|
998
|
-
return array.concat(this.controlClasses());
|
|
999
|
-
}, /* @ts-ignore */
|
|
1000
|
-
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
1001
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1002
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()", "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(() => ToggleGroup) }], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1003
|
-
}
|
|
1004
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleGroup, decorators: [{
|
|
1005
|
-
type: Component,
|
|
1006
|
-
args: [{ selector: 'tls-toggle-group', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], host: {
|
|
1007
|
-
role: 'group',
|
|
1008
|
-
'[class]': 'classes()',
|
|
1009
|
-
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
1010
|
-
'[attr.aria-labelledby]': 'labelledBy()',
|
|
1011
|
-
'[attr.aria-describedby]': 'describedBy()',
|
|
1012
|
-
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
1013
|
-
}, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n" }]
|
|
1014
|
-
}], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }] } });
|
|
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 }] }] } });
|
|
1015
829
|
|
|
1016
830
|
/**
|
|
1017
831
|
* Built-in SVG for every {@link systemIcon}. A coherent 24×24 stroked set drawn
|
|
@@ -1204,20 +1018,270 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
1204
1018
|
}], propDecorators: { name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], iconSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconSrc", required: false }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], allowedSources: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowedSources", required: false }] }] } });
|
|
1205
1019
|
|
|
1206
1020
|
/**
|
|
1207
|
-
* Override any of the library's built-in {@link systemIcon}s with your own kit.
|
|
1208
|
-
* Each entry is raw SVG markup or a component class; names left unset keep the
|
|
1209
|
-
* library defaults. Register once in the application config:
|
|
1210
|
-
*
|
|
1211
|
-
* ```ts
|
|
1212
|
-
* provideThalassicIcons({
|
|
1213
|
-
* close: '<svg>…</svg>',
|
|
1214
|
-
* 'chevron-down': MyChevronComponent,
|
|
1215
|
-
* })
|
|
1216
|
-
* ```
|
|
1021
|
+
* Override any of the library's built-in {@link systemIcon}s with your own kit.
|
|
1022
|
+
* Each entry is raw SVG markup or a component class; names left unset keep the
|
|
1023
|
+
* library defaults. Register once in the application config:
|
|
1024
|
+
*
|
|
1025
|
+
* ```ts
|
|
1026
|
+
* provideThalassicIcons({
|
|
1027
|
+
* close: '<svg>…</svg>',
|
|
1028
|
+
* 'chevron-down': MyChevronComponent,
|
|
1029
|
+
* })
|
|
1030
|
+
* ```
|
|
1031
|
+
*/
|
|
1032
|
+
function provideThalassicIcons(icons) {
|
|
1033
|
+
return makeEnvironmentProviders([{ provide: ICON_REGISTRY, useValue: icons }]);
|
|
1034
|
+
}
|
|
1035
|
+
|
|
1036
|
+
const DEFAULT_BREADCRUMBS_CONFIG = {
|
|
1037
|
+
separatorIcon: 'chevron-right',
|
|
1038
|
+
};
|
|
1039
|
+
|
|
1040
|
+
const BREADCRUMBS_CONFIG = new InjectionToken('BREADCRUMBS_CONFIG', {
|
|
1041
|
+
factory: () => DEFAULT_BREADCRUMBS_CONFIG,
|
|
1042
|
+
});
|
|
1043
|
+
|
|
1044
|
+
class Breadcrumbs {
|
|
1045
|
+
// Injections
|
|
1046
|
+
_config = inject(BREADCRUMBS_CONFIG);
|
|
1047
|
+
// Inputs
|
|
1048
|
+
items = input([], /* @ts-ignore */
|
|
1049
|
+
...(ngDevMode ? [{ debugName: "items" }] : /* istanbul ignore next */ []));
|
|
1050
|
+
separatorIcon = input(this._config.separatorIcon, /* @ts-ignore */
|
|
1051
|
+
...(ngDevMode ? [{ debugName: "separatorIcon" }] : /* istanbul ignore next */ []));
|
|
1052
|
+
/** Accessible name for the breadcrumb navigation landmark. */
|
|
1053
|
+
ariaLabel = input('Breadcrumb', /* @ts-ignore */
|
|
1054
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1055
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
1056
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
1057
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Breadcrumbs, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
1058
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Breadcrumbs, isStandalone: true, selector: "tls-breadcrumbs", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, separatorIcon: { classPropertyName: "separatorIcon", publicName: "separatorIcon", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "navigation" }, properties: { "attr.aria-label": "ariaLabelledby() ? null : ariaLabel()", "attr.aria-labelledby": "ariaLabelledby() ?? null" }, classAttribute: "tls-breadcrumbs" }, ngImport: i0, template: "<ol class=\"tls-breadcrumbs__list\">\n @for (item of items(); track $index; let isLastItem = $last) {\n <li class=\"tls-breadcrumbs__item\">\n @if (item.link !== undefined) {\n <a\n class=\"tls-breadcrumbs__link\"\n [routerLink]=\"item.link\"\n [attr.aria-current]=\"isLastItem ? 'page' : null\"\n >\n <ng-container\n [ngTemplateOutlet]=\"itemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n </a>\n } @else {\n <span class=\"tls-breadcrumbs__text\" [attr.aria-current]=\"isLastItem ? 'page' : null\">\n <ng-container\n [ngTemplateOutlet]=\"itemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n </span>\n }\n\n @if (!isLastItem) {\n <span class=\"tls-breadcrumbs__separator\" aria-hidden=\"true\">\n <tls-icon [name]=\"separatorIcon()\" />\n </span>\n }\n </li>\n }\n</ol>\n\n<ng-template #itemContent let-item>\n @if (item.icon) {\n <tls-icon class=\"tls-breadcrumbs__item-icon\" [iconSrc]=\"item.icon\" />\n }\n <span class=\"tls-breadcrumbs__label\">{{ item.label }}</span>\n</ng-template>\n", dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["name", "iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "directive", type: RouterLink, selector: "[routerLink]", inputs: ["target", "queryParams", "fragment", "queryParamsHandling", "state", "info", "relativeTo", "preserveFragment", "skipLocationChange", "replaceUrl", "browserUrl", "routerLink"] }] });
|
|
1059
|
+
}
|
|
1060
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Breadcrumbs, decorators: [{
|
|
1061
|
+
type: Component,
|
|
1062
|
+
args: [{ selector: 'tls-breadcrumbs', imports: [Icon, NgTemplateOutlet, RouterLink], host: {
|
|
1063
|
+
role: 'navigation',
|
|
1064
|
+
class: 'tls-breadcrumbs',
|
|
1065
|
+
'[attr.aria-label]': 'ariaLabelledby() ? null : ariaLabel()',
|
|
1066
|
+
'[attr.aria-labelledby]': 'ariaLabelledby() ?? null',
|
|
1067
|
+
}, template: "<ol class=\"tls-breadcrumbs__list\">\n @for (item of items(); track $index; let isLastItem = $last) {\n <li class=\"tls-breadcrumbs__item\">\n @if (item.link !== undefined) {\n <a\n class=\"tls-breadcrumbs__link\"\n [routerLink]=\"item.link\"\n [attr.aria-current]=\"isLastItem ? 'page' : null\"\n >\n <ng-container\n [ngTemplateOutlet]=\"itemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n </a>\n } @else {\n <span class=\"tls-breadcrumbs__text\" [attr.aria-current]=\"isLastItem ? 'page' : null\">\n <ng-container\n [ngTemplateOutlet]=\"itemContent\"\n [ngTemplateOutletContext]=\"{ $implicit: item }\"\n />\n </span>\n }\n\n @if (!isLastItem) {\n <span class=\"tls-breadcrumbs__separator\" aria-hidden=\"true\">\n <tls-icon [name]=\"separatorIcon()\" />\n </span>\n }\n </li>\n }\n</ol>\n\n<ng-template #itemContent let-item>\n @if (item.icon) {\n <tls-icon class=\"tls-breadcrumbs__item-icon\" [iconSrc]=\"item.icon\" />\n }\n <span class=\"tls-breadcrumbs__label\">{{ item.label }}</span>\n</ng-template>\n" }]
|
|
1068
|
+
}], propDecorators: { items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], separatorIcon: [{ type: i0.Input, args: [{ isSignal: true, alias: "separatorIcon", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }] } });
|
|
1069
|
+
|
|
1070
|
+
const DEFAULT_BUTTON_CONFIG = {
|
|
1071
|
+
color: 'primary',
|
|
1072
|
+
variant: 'filled',
|
|
1073
|
+
size: 'md',
|
|
1074
|
+
type: 'button',
|
|
1075
|
+
fluid: false,
|
|
1076
|
+
};
|
|
1077
|
+
|
|
1078
|
+
const BUTTON_CONFIG = new InjectionToken('BUTTON_CONFIG', {
|
|
1079
|
+
factory: () => DEFAULT_BUTTON_CONFIG,
|
|
1080
|
+
});
|
|
1081
|
+
|
|
1082
|
+
class ButtonBase {
|
|
1083
|
+
// Injections
|
|
1084
|
+
_config = inject(BUTTON_CONFIG);
|
|
1085
|
+
APPLY_HOST_CLASSES = true;
|
|
1086
|
+
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1087
|
+
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1088
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
1089
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1090
|
+
variant = input(this._config.variant, /* @ts-ignore */
|
|
1091
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
1092
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
1093
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1094
|
+
rounded = input(false, { ...(ngDevMode ? { debugName: "rounded" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1095
|
+
/** Whether the button stretches to fill its container's width. */
|
|
1096
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1097
|
+
classes = computed(() => {
|
|
1098
|
+
const className = 'tls-button';
|
|
1099
|
+
const array = [className];
|
|
1100
|
+
array.push(`${className}--${this.color()}`);
|
|
1101
|
+
array.push(`${className}--${this.variant()}`);
|
|
1102
|
+
array.push(`${className}--${this.size()}`);
|
|
1103
|
+
if (this.disabled())
|
|
1104
|
+
array.push(`${className}--disabled`);
|
|
1105
|
+
if (this.icon())
|
|
1106
|
+
array.push(`${className}--icon-only`);
|
|
1107
|
+
if (this.fluid())
|
|
1108
|
+
array.push(`${className}--fluid`);
|
|
1109
|
+
if (this.rounded())
|
|
1110
|
+
array.push(`${className}--rounded`);
|
|
1111
|
+
return array;
|
|
1112
|
+
}, /* @ts-ignore */
|
|
1113
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
1114
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonBase, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
1115
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: ButtonBase, isStandalone: true, inputs: { disabled: { classPropertyName: "disabled", publicName: "disabled", 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 }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "APPLY_HOST_CLASSES ? classes() : null" } }, ngImport: i0 });
|
|
1116
|
+
}
|
|
1117
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonBase, decorators: [{
|
|
1118
|
+
type: Directive,
|
|
1119
|
+
args: [{
|
|
1120
|
+
host: {
|
|
1121
|
+
'[class]': 'APPLY_HOST_CLASSES ? classes() : null',
|
|
1122
|
+
},
|
|
1123
|
+
}]
|
|
1124
|
+
}], propDecorators: { disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }] } });
|
|
1125
|
+
|
|
1126
|
+
class Button extends ButtonBase {
|
|
1127
|
+
// Injections
|
|
1128
|
+
_routerLink = inject(RouterLink, { optional: true });
|
|
1129
|
+
_router = inject(Router, { optional: true });
|
|
1130
|
+
_locationStrategy = inject(LocationStrategy, { optional: true });
|
|
1131
|
+
APPLY_HOST_CLASSES = false;
|
|
1132
|
+
// Inputs
|
|
1133
|
+
/** The text label displayed inside the button. Takes priority over projected content. */
|
|
1134
|
+
label = input(/* @ts-ignore */
|
|
1135
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
1136
|
+
/**
|
|
1137
|
+
* Accessible name forwarded to the inner `<button>`/`<a>`. Required for icon-only buttons,
|
|
1138
|
+
* where there is no visible text for screen readers to announce. Placed on the inner control
|
|
1139
|
+
* because the host `tls-button` element is a non-interactive wrapper.
|
|
1140
|
+
*/
|
|
1141
|
+
ariaLabel = input(undefined, /* @ts-ignore */
|
|
1142
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
1143
|
+
/**
|
|
1144
|
+
* `id` of an element whose text names the inner `<button>`/`<a>`, for when the accessible
|
|
1145
|
+
* name already exists as visible text. Takes precedence over `ariaLabel` per the ARIA spec.
|
|
1146
|
+
*/
|
|
1147
|
+
ariaLabelledby = input(undefined, /* @ts-ignore */
|
|
1148
|
+
...(ngDevMode ? [{ debugName: "ariaLabelledby" }] : /* istanbul ignore next */ []));
|
|
1149
|
+
type = input(this._config.type, /* @ts-ignore */
|
|
1150
|
+
...(ngDevMode ? [{ debugName: "type" }] : /* istanbul ignore next */ []));
|
|
1151
|
+
/** An optional URL that causes the button to render as an anchor link. */
|
|
1152
|
+
href = input(null, /* @ts-ignore */
|
|
1153
|
+
...(ngDevMode ? [{ debugName: "href" }] : /* istanbul ignore next */ []));
|
|
1154
|
+
tabindex = input('0', /* @ts-ignore */
|
|
1155
|
+
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
1156
|
+
// Computed
|
|
1157
|
+
isLink = computed(() => Boolean(this._routerLink || this.href()), /* @ts-ignore */
|
|
1158
|
+
...(ngDevMode ? [{ debugName: "isLink" }] : /* istanbul ignore next */ []));
|
|
1159
|
+
/**
|
|
1160
|
+
* Resolved URL placed on the inner anchor so the browser treats it as a real link
|
|
1161
|
+
* (enables "Open in new tab", middle-click, status-bar preview, etc.). An explicit
|
|
1162
|
+
* `href` wins; otherwise the URL is derived from the host `routerLink`.
|
|
1163
|
+
*/
|
|
1164
|
+
linkHref = computed(() => {
|
|
1165
|
+
if (this.disabled())
|
|
1166
|
+
return null;
|
|
1167
|
+
const explicitHref = this.href();
|
|
1168
|
+
if (explicitHref)
|
|
1169
|
+
return explicitHref;
|
|
1170
|
+
const urlTree = this._routerLink?.urlTree;
|
|
1171
|
+
if (!urlTree || !this._router)
|
|
1172
|
+
return null;
|
|
1173
|
+
const serialized = this._router.serializeUrl(urlTree);
|
|
1174
|
+
return this._locationStrategy?.prepareExternalUrl(serialized) ?? serialized;
|
|
1175
|
+
}, /* @ts-ignore */
|
|
1176
|
+
...(ngDevMode ? [{ debugName: "linkHref" }] : /* istanbul ignore next */ []));
|
|
1177
|
+
// Protected methods
|
|
1178
|
+
/**
|
|
1179
|
+
* Keeps navigation correct when the host carries a `routerLink` while the inner anchor
|
|
1180
|
+
* exposes a real `href`:
|
|
1181
|
+
* - modified / non-primary clicks bubble to the browser so it can open a new tab, and
|
|
1182
|
+
* are stopped from reaching the host RouterLink to avoid a duplicate in-app navigation;
|
|
1183
|
+
* - a plain left click defers to the host RouterLink for SPA navigation, so the anchor's
|
|
1184
|
+
* own full-page navigation is prevented.
|
|
1185
|
+
*/
|
|
1186
|
+
onLinkClick(event) {
|
|
1187
|
+
if (this.disabled()) {
|
|
1188
|
+
event.preventDefault();
|
|
1189
|
+
event.stopPropagation();
|
|
1190
|
+
return;
|
|
1191
|
+
}
|
|
1192
|
+
// Pure href links (no routerLink) navigate natively — nothing to coordinate.
|
|
1193
|
+
if (!this._routerLink)
|
|
1194
|
+
return;
|
|
1195
|
+
if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
|
|
1196
|
+
event.stopPropagation();
|
|
1197
|
+
return;
|
|
1198
|
+
}
|
|
1199
|
+
event.preventDefault();
|
|
1200
|
+
}
|
|
1201
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Button, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1202
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Button, isStandalone: true, selector: "tls-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, ariaLabelledby: { classPropertyName: "ariaLabelledby", publicName: "ariaLabelledby", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, href: { classPropertyName: "href", publicName: "href", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"linkHref()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-disabled]=\"disabled()\"\n (click)=\"onLinkClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </a>\n} @else {\n <button\n role=\"button\"\n [class]=\"classes()\"\n [type]=\"type()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled()\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </button>\n}\n\n<!-- Content -->\n<ng-template #contentTemplate>\n @if (label() && !icon()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n</ng-template>\n\n<ng-template #projectedContentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:fit-content;display:inline-block}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1203
|
+
}
|
|
1204
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Button, decorators: [{
|
|
1205
|
+
type: Component,
|
|
1206
|
+
args: [{ selector: 'tls-button', imports: [NgTemplateOutlet], host: {
|
|
1207
|
+
'[tabindex]': '-1',
|
|
1208
|
+
}, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"linkHref()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [attr.aria-disabled]=\"disabled()\"\n (click)=\"onLinkClick($event)\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </a>\n} @else {\n <button\n role=\"button\"\n [class]=\"classes()\"\n [type]=\"type()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n [attr.aria-labelledby]=\"ariaLabelledby() ?? null\"\n [disabled]=\"disabled()\"\n [attr.aria-disabled]=\"disabled()\"\n >\n <ng-container [ngTemplateOutlet]=\"contentTemplate\"></ng-container>\n </button>\n}\n\n<!-- Content -->\n<ng-template #contentTemplate>\n @if (label() && !icon()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n</ng-template>\n\n<ng-template #projectedContentTemplate>\n <ng-content></ng-content>\n</ng-template>\n", styles: [":host{width:fit-content;display:inline-block}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}\n"] }]
|
|
1209
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], ariaLabelledby: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabelledby", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
1210
|
+
|
|
1211
|
+
class ButtonDirective extends ButtonBase {
|
|
1212
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonDirective, deps: null, target: i0.ɵɵFactoryTarget.Directive });
|
|
1213
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "22.0.5", type: ButtonDirective, isStandalone: true, selector: "[tlsButton]", usesInheritance: true, ngImport: i0 });
|
|
1214
|
+
}
|
|
1215
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ButtonDirective, decorators: [{
|
|
1216
|
+
type: Directive,
|
|
1217
|
+
args: [{
|
|
1218
|
+
selector: '[tlsButton]',
|
|
1219
|
+
}]
|
|
1220
|
+
}] });
|
|
1221
|
+
|
|
1222
|
+
const DEFAULT_TOGGLE_GROUP_CONFIG = {
|
|
1223
|
+
size: 'md',
|
|
1224
|
+
color: 'primary',
|
|
1225
|
+
variant: 'filled',
|
|
1226
|
+
orientation: 'horizontal',
|
|
1227
|
+
multiple: false,
|
|
1228
|
+
unselectable: false,
|
|
1229
|
+
fluid: false,
|
|
1230
|
+
};
|
|
1231
|
+
|
|
1232
|
+
const TOGGLE_GROUP_CONFIG = new InjectionToken('TOGGLE_GROUP_CONFIG', {
|
|
1233
|
+
factory: () => DEFAULT_TOGGLE_GROUP_CONFIG,
|
|
1234
|
+
});
|
|
1235
|
+
|
|
1236
|
+
/**
|
|
1237
|
+
* `value` is always an array — in single mode (`multiple = false`) it holds 0 or
|
|
1238
|
+
* 1 items, read it as `value()[0]`. See {@link SelectionGroup} for the contract.
|
|
1217
1239
|
*/
|
|
1218
|
-
|
|
1219
|
-
|
|
1240
|
+
class ToggleGroup extends SelectionGroup {
|
|
1241
|
+
_config = inject(TOGGLE_GROUP_CONFIG);
|
|
1242
|
+
CLASS_NAME = 'tls-toggle-group';
|
|
1243
|
+
multiple = input(this._config.multiple, { ...(ngDevMode ? { debugName: "multiple" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1244
|
+
unselectable = input(this._config.unselectable, { ...(ngDevMode ? { debugName: "unselectable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1245
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
1246
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
1247
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
1248
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
1249
|
+
variant = input(this._config.variant, /* @ts-ignore */
|
|
1250
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
1251
|
+
orientation = input(this._config.orientation, /* @ts-ignore */
|
|
1252
|
+
...(ngDevMode ? [{ debugName: "orientation" }] : /* istanbul ignore next */ []));
|
|
1253
|
+
/** Whether the group stretches to fill its container's width with equal-width options. */
|
|
1254
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
1255
|
+
optionTemplate = contentChild('option', /* @ts-ignore */
|
|
1256
|
+
...(ngDevMode ? [{ debugName: "optionTemplate" }] : /* istanbul ignore next */ []));
|
|
1257
|
+
classes = computed(() => {
|
|
1258
|
+
const className = this.CLASS_NAME;
|
|
1259
|
+
const array = [
|
|
1260
|
+
className,
|
|
1261
|
+
`${className}--${this.size()}`,
|
|
1262
|
+
`${className}--${this.color()}`,
|
|
1263
|
+
`${className}--${this.variant()}`,
|
|
1264
|
+
`${className}--${this.orientation()}`,
|
|
1265
|
+
];
|
|
1266
|
+
if (this.fluid())
|
|
1267
|
+
array.push(`${className}--fluid`);
|
|
1268
|
+
return array.concat(this.controlClasses());
|
|
1269
|
+
}, /* @ts-ignore */
|
|
1270
|
+
...(ngDevMode ? [{ debugName: "classes" }] : /* istanbul ignore next */ []));
|
|
1271
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
1272
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()", "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(() => ToggleGroup) }], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
1220
1273
|
}
|
|
1274
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleGroup, decorators: [{
|
|
1275
|
+
type: Component,
|
|
1276
|
+
args: [{ selector: 'tls-toggle-group', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], host: {
|
|
1277
|
+
role: 'group',
|
|
1278
|
+
'[class]': 'classes()',
|
|
1279
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
1280
|
+
'[attr.aria-labelledby]': 'labelledBy()',
|
|
1281
|
+
'[attr.aria-describedby]': 'describedBy()',
|
|
1282
|
+
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
1283
|
+
}, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"optionContext(option, index)\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n" }]
|
|
1284
|
+
}], propDecorators: { multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }] } });
|
|
1221
1285
|
|
|
1222
1286
|
const DAYS_IN_WEEK = 7;
|
|
1223
1287
|
/**
|
|
@@ -3118,6 +3182,240 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3118
3182
|
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
3183
|
}], 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
3184
|
|
|
3185
|
+
const DEFAULT_LOADER_CONFIG = {
|
|
3186
|
+
size: 'md',
|
|
3187
|
+
width: null,
|
|
3188
|
+
widthRatio: 5,
|
|
3189
|
+
ariaLabel: 'Loading',
|
|
3190
|
+
};
|
|
3191
|
+
|
|
3192
|
+
const LOADER_CONFIG = new InjectionToken('LOADER_CONFIG', {
|
|
3193
|
+
factory: () => DEFAULT_LOADER_CONFIG,
|
|
3194
|
+
});
|
|
3195
|
+
|
|
3196
|
+
/**
|
|
3197
|
+
* Indeterminate spinner for indicating a loading state.
|
|
3198
|
+
*
|
|
3199
|
+
* @example
|
|
3200
|
+
* <!-- predefined size -->
|
|
3201
|
+
* <tls-loader size="lg" />
|
|
3202
|
+
*
|
|
3203
|
+
* @example
|
|
3204
|
+
* <!-- custom size in pixels -->
|
|
3205
|
+
* <tls-loader [size]="64" />
|
|
3206
|
+
*
|
|
3207
|
+
* @example
|
|
3208
|
+
* <!-- custom size with explicit stroke width -->
|
|
3209
|
+
* <tls-loader [size]="64" [width]="8" />
|
|
3210
|
+
*/
|
|
3211
|
+
class Loader {
|
|
3212
|
+
_config = inject(LOADER_CONFIG);
|
|
3213
|
+
/** Predefined size token or custom pixel value. */
|
|
3214
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
3215
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3216
|
+
/** Stroke width in pixels. Overrides the size-class default for both token and numeric sizes. */
|
|
3217
|
+
width = input(this._config.width, /* @ts-ignore */
|
|
3218
|
+
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
3219
|
+
/** Divisor for auto stroke width when size is a number and width is null (`size / widthRatio`). */
|
|
3220
|
+
widthRatio = input(this._config.widthRatio, /* @ts-ignore */
|
|
3221
|
+
...(ngDevMode ? [{ debugName: "widthRatio" }] : /* istanbul ignore next */ []));
|
|
3222
|
+
/** Text announced by screen readers via `aria-label`. */
|
|
3223
|
+
ariaLabel = input(this._config.ariaLabel, /* @ts-ignore */
|
|
3224
|
+
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
3225
|
+
hostClasses = computed(() => {
|
|
3226
|
+
const className = 'tls-loader';
|
|
3227
|
+
const size = this.size();
|
|
3228
|
+
const array = [className];
|
|
3229
|
+
if (typeof size === 'string') {
|
|
3230
|
+
array.push(`${className}--${size}`);
|
|
3231
|
+
}
|
|
3232
|
+
return array;
|
|
3233
|
+
}, /* @ts-ignore */
|
|
3234
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3235
|
+
hostStyles = computed(() => {
|
|
3236
|
+
const size = this.size();
|
|
3237
|
+
const width = this.width();
|
|
3238
|
+
if (typeof size === 'string' && width === null) {
|
|
3239
|
+
return null;
|
|
3240
|
+
}
|
|
3241
|
+
const styles = {};
|
|
3242
|
+
if (typeof size === 'number') {
|
|
3243
|
+
styles['--tls-loader-size'] = `${size}px`;
|
|
3244
|
+
}
|
|
3245
|
+
if (width !== null) {
|
|
3246
|
+
styles['--tls-loader-width'] = `${width}px`;
|
|
3247
|
+
}
|
|
3248
|
+
else {
|
|
3249
|
+
styles['--tls-loader-width'] = `${size / this.widthRatio()}px`;
|
|
3250
|
+
}
|
|
3251
|
+
return styles;
|
|
3252
|
+
}, /* @ts-ignore */
|
|
3253
|
+
...(ngDevMode ? [{ debugName: "hostStyles" }] : /* istanbul ignore next */ []));
|
|
3254
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Loader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3255
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Loader, isStandalone: true, selector: "tls-loader", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, widthRatio: { classPropertyName: "widthRatio", publicName: "widthRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "class": "hostClasses()", "style": "hostStyles()", "attr.aria-label": "ariaLabel()" } }, ngImport: i0, template: '', isInline: true });
|
|
3256
|
+
}
|
|
3257
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Loader, decorators: [{
|
|
3258
|
+
type: Component,
|
|
3259
|
+
args: [{
|
|
3260
|
+
selector: 'tls-loader',
|
|
3261
|
+
imports: [],
|
|
3262
|
+
template: '',
|
|
3263
|
+
host: {
|
|
3264
|
+
'[class]': 'hostClasses()',
|
|
3265
|
+
'[style]': 'hostStyles()',
|
|
3266
|
+
role: 'status',
|
|
3267
|
+
'[attr.aria-label]': 'ariaLabel()',
|
|
3268
|
+
},
|
|
3269
|
+
}]
|
|
3270
|
+
}], 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 }] }] } });
|
|
3271
|
+
|
|
3272
|
+
const DEFAULT_AUTOCOMPLETE_CONFIG = {
|
|
3273
|
+
size: 'md',
|
|
3274
|
+
placeholder: '',
|
|
3275
|
+
fluid: false,
|
|
3276
|
+
clearable: false,
|
|
3277
|
+
filterMode: 'contains',
|
|
3278
|
+
emptyMessage: 'No results',
|
|
3279
|
+
};
|
|
3280
|
+
|
|
3281
|
+
const AUTOCOMPLETE_CONFIG = new InjectionToken('AUTOCOMPLETE_CONFIG', {
|
|
3282
|
+
factory: () => DEFAULT_AUTOCOMPLETE_CONFIG,
|
|
3283
|
+
});
|
|
3284
|
+
|
|
3285
|
+
class Autocomplete extends AbstractSelect {
|
|
3286
|
+
static _nextUniqueId = 0;
|
|
3287
|
+
_config = inject(AUTOCOMPLETE_CONFIG);
|
|
3288
|
+
supportsLabelFor = true;
|
|
3289
|
+
uniqueId = `tls-autocomplete-${Autocomplete._nextUniqueId++}`;
|
|
3290
|
+
hostClassBase = 'tls-autocomplete';
|
|
3291
|
+
panelClass = 'tls-autocomplete-panel';
|
|
3292
|
+
value = model(null, /* @ts-ignore */
|
|
3293
|
+
...(ngDevMode ? [{ debugName: "value" }] : /* istanbul ignore next */ []));
|
|
3294
|
+
placeholder = input(this._config.placeholder, /* @ts-ignore */
|
|
3295
|
+
...(ngDevMode ? [{ debugName: "placeholder" }] : /* istanbul ignore next */ []));
|
|
3296
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
3297
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3298
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3299
|
+
clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
3300
|
+
filterMode = input(this._config.filterMode, /* @ts-ignore */
|
|
3301
|
+
...(ngDevMode ? [{ debugName: "filterMode" }] : /* istanbul ignore next */ []));
|
|
3302
|
+
emptyMessage = input(this._config.emptyMessage, /* @ts-ignore */
|
|
3303
|
+
...(ngDevMode ? [{ debugName: "emptyMessage" }] : /* istanbul ignore next */ []));
|
|
3304
|
+
hasValue = computed(() => {
|
|
3305
|
+
const value = this.value();
|
|
3306
|
+
return value !== null && value !== undefined;
|
|
3307
|
+
}, /* @ts-ignore */
|
|
3308
|
+
...(ngDevMode ? [{ debugName: "hasValue" }] : /* istanbul ignore next */ []));
|
|
3309
|
+
selectedLabel = computed(() => {
|
|
3310
|
+
if (!this.hasValue())
|
|
3311
|
+
return '';
|
|
3312
|
+
const selected = this.normalizedOptions().find(option => option.value === this.value());
|
|
3313
|
+
if (!selected)
|
|
3314
|
+
return '';
|
|
3315
|
+
return selected.label;
|
|
3316
|
+
}, /* @ts-ignore */
|
|
3317
|
+
...(ngDevMode ? [{ debugName: "selectedLabel" }] : /* istanbul ignore next */ []));
|
|
3318
|
+
/**
|
|
3319
|
+
* The text shown in the field: the committed selection's label by default, overwritten with a
|
|
3320
|
+
* free-text query as the user types. Re-derives from the label whenever the committed value
|
|
3321
|
+
* changes (a selection, a clear, or an external model update), so the field always reflects it.
|
|
3322
|
+
*/
|
|
3323
|
+
query = linkedSignal(() => this.selectedLabel(), /* @ts-ignore */
|
|
3324
|
+
...(ngDevMode ? [{ debugName: "query" }] : /* istanbul ignore next */ []));
|
|
3325
|
+
select(option) {
|
|
3326
|
+
if (option.disabled)
|
|
3327
|
+
return;
|
|
3328
|
+
this.value.set(option.value);
|
|
3329
|
+
this.close();
|
|
3330
|
+
}
|
|
3331
|
+
onInput(event) {
|
|
3332
|
+
const target = event.target;
|
|
3333
|
+
this.query.set(target.value);
|
|
3334
|
+
this.open();
|
|
3335
|
+
this.activeIndex.set(this.getInitialActiveIndex());
|
|
3336
|
+
}
|
|
3337
|
+
onKeydown(event) {
|
|
3338
|
+
if (event.key === 'ArrowDown') {
|
|
3339
|
+
event.preventDefault();
|
|
3340
|
+
if (this.isOpen()) {
|
|
3341
|
+
this.moveActive(1);
|
|
3342
|
+
}
|
|
3343
|
+
else {
|
|
3344
|
+
this.open();
|
|
3345
|
+
}
|
|
3346
|
+
}
|
|
3347
|
+
else if (event.key === 'ArrowUp') {
|
|
3348
|
+
event.preventDefault();
|
|
3349
|
+
if (this.isOpen()) {
|
|
3350
|
+
this.moveActive(-1);
|
|
3351
|
+
}
|
|
3352
|
+
else {
|
|
3353
|
+
this.open();
|
|
3354
|
+
}
|
|
3355
|
+
}
|
|
3356
|
+
else if (event.key === 'Enter') {
|
|
3357
|
+
// While the panel is open the combobox owns Enter: commit the active option, and always
|
|
3358
|
+
// swallow the key so it can't submit a surrounding form with the list still showing.
|
|
3359
|
+
if (!this.isOpen())
|
|
3360
|
+
return;
|
|
3361
|
+
event.preventDefault();
|
|
3362
|
+
const active = this.visibleOptions()[this.activeIndex()];
|
|
3363
|
+
if (active && !active.disabled)
|
|
3364
|
+
this.commitActiveOption(active);
|
|
3365
|
+
}
|
|
3366
|
+
else if (event.key === 'Escape') {
|
|
3367
|
+
if (this.isOpen()) {
|
|
3368
|
+
event.preventDefault();
|
|
3369
|
+
this.close();
|
|
3370
|
+
}
|
|
3371
|
+
}
|
|
3372
|
+
else if (event.key === 'Tab') {
|
|
3373
|
+
if (this.isOpen())
|
|
3374
|
+
this.close();
|
|
3375
|
+
}
|
|
3376
|
+
}
|
|
3377
|
+
filterVisibleOptions(options) {
|
|
3378
|
+
const query = this.query().trim().toLowerCase();
|
|
3379
|
+
if (!query)
|
|
3380
|
+
return options;
|
|
3381
|
+
// While the field shows the committed selection's label (not an active search), list everything.
|
|
3382
|
+
if (this.hasValue() && this.query() === this.selectedLabel())
|
|
3383
|
+
return options;
|
|
3384
|
+
if (this.filterMode() === 'startsWith') {
|
|
3385
|
+
return options.filter(option => option.label.toLowerCase().startsWith(query));
|
|
3386
|
+
}
|
|
3387
|
+
return options.filter(option => option.label.toLowerCase().includes(query));
|
|
3388
|
+
}
|
|
3389
|
+
onClosed() {
|
|
3390
|
+
// Discard an unmatched free-text query, restoring the committed selection's label (or empty).
|
|
3391
|
+
this.query.set(this.selectedLabel());
|
|
3392
|
+
}
|
|
3393
|
+
clear() {
|
|
3394
|
+
this.value.set(null);
|
|
3395
|
+
this.query.set('');
|
|
3396
|
+
}
|
|
3397
|
+
getInitialActiveIndex() {
|
|
3398
|
+
const options = this.visibleOptions();
|
|
3399
|
+
if (this.hasValue()) {
|
|
3400
|
+
const selectedIndex = options.findIndex(option => !option.disabled && option.value === this.value());
|
|
3401
|
+
if (selectedIndex !== -1)
|
|
3402
|
+
return selectedIndex;
|
|
3403
|
+
}
|
|
3404
|
+
return options.findIndex(option => !option.disabled);
|
|
3405
|
+
}
|
|
3406
|
+
commitActiveOption(option) {
|
|
3407
|
+
this.select(option);
|
|
3408
|
+
}
|
|
3409
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
3410
|
+
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"] }] });
|
|
3411
|
+
}
|
|
3412
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Autocomplete, decorators: [{
|
|
3413
|
+
type: Component,
|
|
3414
|
+
args: [{ selector: 'tls-autocomplete', imports: [Loader, Icon], host: {
|
|
3415
|
+
'[class]': 'hostClasses()',
|
|
3416
|
+
}, 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" }]
|
|
3417
|
+
}], 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 }] }] } });
|
|
3418
|
+
|
|
3121
3419
|
const DEFAULT_CHECKBOX_CONFIG = {};
|
|
3122
3420
|
|
|
3123
3421
|
const CHECKBOX_CONFIG = new InjectionToken('CHECKBOX_CONFIG', {
|
|
@@ -3164,93 +3462,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
3164
3462
|
}, 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
3463
|
}], 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
3464
|
|
|
3167
|
-
const DEFAULT_LOADER_CONFIG = {
|
|
3168
|
-
size: 'md',
|
|
3169
|
-
width: null,
|
|
3170
|
-
widthRatio: 5,
|
|
3171
|
-
ariaLabel: 'Loading',
|
|
3172
|
-
};
|
|
3173
|
-
|
|
3174
|
-
const LOADER_CONFIG = new InjectionToken('LOADER_CONFIG', {
|
|
3175
|
-
factory: () => DEFAULT_LOADER_CONFIG,
|
|
3176
|
-
});
|
|
3177
|
-
|
|
3178
|
-
/**
|
|
3179
|
-
* Indeterminate spinner for indicating a loading state.
|
|
3180
|
-
*
|
|
3181
|
-
* @example
|
|
3182
|
-
* <!-- predefined size -->
|
|
3183
|
-
* <tls-loader size="lg" />
|
|
3184
|
-
*
|
|
3185
|
-
* @example
|
|
3186
|
-
* <!-- custom size in pixels -->
|
|
3187
|
-
* <tls-loader [size]="64" />
|
|
3188
|
-
*
|
|
3189
|
-
* @example
|
|
3190
|
-
* <!-- custom size with explicit stroke width -->
|
|
3191
|
-
* <tls-loader [size]="64" [width]="8" />
|
|
3192
|
-
*/
|
|
3193
|
-
class Loader {
|
|
3194
|
-
_config = inject(LOADER_CONFIG);
|
|
3195
|
-
/** Predefined size token or custom pixel value. */
|
|
3196
|
-
size = input(this._config.size, /* @ts-ignore */
|
|
3197
|
-
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
3198
|
-
/** Stroke width in pixels. Overrides the size-class default for both token and numeric sizes. */
|
|
3199
|
-
width = input(this._config.width, /* @ts-ignore */
|
|
3200
|
-
...(ngDevMode ? [{ debugName: "width" }] : /* istanbul ignore next */ []));
|
|
3201
|
-
/** Divisor for auto stroke width when size is a number and width is null (`size / widthRatio`). */
|
|
3202
|
-
widthRatio = input(this._config.widthRatio, /* @ts-ignore */
|
|
3203
|
-
...(ngDevMode ? [{ debugName: "widthRatio" }] : /* istanbul ignore next */ []));
|
|
3204
|
-
/** Text announced by screen readers via `aria-label`. */
|
|
3205
|
-
ariaLabel = input(this._config.ariaLabel, /* @ts-ignore */
|
|
3206
|
-
...(ngDevMode ? [{ debugName: "ariaLabel" }] : /* istanbul ignore next */ []));
|
|
3207
|
-
hostClasses = computed(() => {
|
|
3208
|
-
const className = 'tls-loader';
|
|
3209
|
-
const size = this.size();
|
|
3210
|
-
const array = [className];
|
|
3211
|
-
if (typeof size === 'string') {
|
|
3212
|
-
array.push(`${className}--${size}`);
|
|
3213
|
-
}
|
|
3214
|
-
return array;
|
|
3215
|
-
}, /* @ts-ignore */
|
|
3216
|
-
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
3217
|
-
hostStyles = computed(() => {
|
|
3218
|
-
const size = this.size();
|
|
3219
|
-
const width = this.width();
|
|
3220
|
-
if (typeof size === 'string' && width === null) {
|
|
3221
|
-
return null;
|
|
3222
|
-
}
|
|
3223
|
-
const styles = {};
|
|
3224
|
-
if (typeof size === 'number') {
|
|
3225
|
-
styles['--tls-loader-size'] = `${size}px`;
|
|
3226
|
-
}
|
|
3227
|
-
if (width !== null) {
|
|
3228
|
-
styles['--tls-loader-width'] = `${width}px`;
|
|
3229
|
-
}
|
|
3230
|
-
else {
|
|
3231
|
-
styles['--tls-loader-width'] = `${size / this.widthRatio()}px`;
|
|
3232
|
-
}
|
|
3233
|
-
return styles;
|
|
3234
|
-
}, /* @ts-ignore */
|
|
3235
|
-
...(ngDevMode ? [{ debugName: "hostStyles" }] : /* istanbul ignore next */ []));
|
|
3236
|
-
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Loader, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
3237
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "22.0.5", type: Loader, isStandalone: true, selector: "tls-loader", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, widthRatio: { classPropertyName: "widthRatio", publicName: "widthRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "class": "hostClasses()", "style": "hostStyles()", "attr.aria-label": "ariaLabel()" } }, ngImport: i0, template: '', isInline: true });
|
|
3238
|
-
}
|
|
3239
|
-
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Loader, decorators: [{
|
|
3240
|
-
type: Component,
|
|
3241
|
-
args: [{
|
|
3242
|
-
selector: 'tls-loader',
|
|
3243
|
-
imports: [],
|
|
3244
|
-
template: '',
|
|
3245
|
-
host: {
|
|
3246
|
-
'[class]': 'hostClasses()',
|
|
3247
|
-
'[style]': 'hostStyles()',
|
|
3248
|
-
role: 'status',
|
|
3249
|
-
'[attr.aria-label]': 'ariaLabel()',
|
|
3250
|
-
},
|
|
3251
|
-
}]
|
|
3252
|
-
}], 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
|
-
|
|
3254
3465
|
const DEFAULT_POPOVER_CONFIG = {
|
|
3255
3466
|
position: 'bottom',
|
|
3256
3467
|
offset: { x: 0, y: 4 },
|
|
@@ -4119,6 +4330,186 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4119
4330
|
args: [{ selector: 'tls-input-number', imports: [Loader], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => InputNumber) }], template: "<input\n type=\"number\"\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 [value]=\"value() ?? ''\"\n [attr.min]=\"min() ?? null\"\n [attr.max]=\"max() ?? null\"\n [step]=\"step()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n@if (pending()) {\n <tls-loader class=\"tls-form-control__spinner\" size=\"xs\" aria-hidden=\"true\" />\n}\n", styles: [":host{--tls-input-number-width: 200px;position:relative;display:inline-block;width:var(--tls-input-number-width)}:host .tls-form-control{width:100%}:host .tls-form-control__spinner{position:absolute;inset-block:0;inset-inline-end:var(--spacing-3);margin-block:auto;pointer-events:none}:host .tls-form-control--pending{padding-inline-end:var(--spacing-8)}:host:has(.tls-form-control--fluid){--tls-input-number-width: 100%}\n"] }]
|
|
4120
4331
|
}], 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 }] }], min: [{ type: i0.Input, args: [{ isSignal: true, alias: "min", required: false }] }], max: [{ type: i0.Input, args: [{ isSignal: true, alias: "max", required: false }] }], step: [{ type: i0.Input, args: [{ isSignal: true, alias: "step", required: false }] }], hideArrows: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideArrows", required: false }] }] } });
|
|
4121
4332
|
|
|
4333
|
+
// Token characters recognised inside a mask pattern; every other character is a
|
|
4334
|
+
// literal rendered verbatim. Each token maps to the RegExp a raw character must
|
|
4335
|
+
// satisfy to fill that slot.
|
|
4336
|
+
const MASK_TOKENS = {
|
|
4337
|
+
'0': /\d/, // digit
|
|
4338
|
+
A: /[a-zA-Z]/, // letter
|
|
4339
|
+
'*': /[a-zA-Z0-9]/, // alphanumeric
|
|
4340
|
+
};
|
|
4341
|
+
|
|
4342
|
+
/**
|
|
4343
|
+
* Formats `rawText` against a token `pattern` (`0` digit, `A` letter, `*`
|
|
4344
|
+
* alphanumeric; every other character is a literal) and computes where the caret
|
|
4345
|
+
* should land. `rawText` may itself already contain literals (the previously
|
|
4346
|
+
* masked value plus the latest keystroke) — literals are absorbed and any
|
|
4347
|
+
* character that does not satisfy the current slot's token is skipped.
|
|
4348
|
+
*
|
|
4349
|
+
* A separator is inserted only once the value character that follows it arrives,
|
|
4350
|
+
* so an in-progress value never shows a dangling separator. The caret is derived
|
|
4351
|
+
* by formatting only the portion of `rawText` before `caretPosition`.
|
|
4352
|
+
*/
|
|
4353
|
+
function applyMask(pattern, rawText, caretPosition) {
|
|
4354
|
+
const full = conform(pattern, rawText);
|
|
4355
|
+
const prefix = conform(pattern, rawText.slice(0, caretPosition));
|
|
4356
|
+
return {
|
|
4357
|
+
maskedValue: full.masked,
|
|
4358
|
+
unmaskedValue: full.unmasked,
|
|
4359
|
+
caret: prefix.masked.length,
|
|
4360
|
+
};
|
|
4361
|
+
}
|
|
4362
|
+
/** Walks `pattern` and `rawText` in parallel, emitting the masked and unmasked strings. */
|
|
4363
|
+
function conform(pattern, rawText) {
|
|
4364
|
+
let masked = '';
|
|
4365
|
+
let unmasked = '';
|
|
4366
|
+
let pendingLiterals = '';
|
|
4367
|
+
let rawIndex = 0;
|
|
4368
|
+
for (const patternChar of pattern) {
|
|
4369
|
+
const token = MASK_TOKENS[patternChar];
|
|
4370
|
+
if (token) {
|
|
4371
|
+
// Skip raw characters that don't satisfy this slot's token.
|
|
4372
|
+
while (rawIndex < rawText.length && !token.test(rawText[rawIndex]))
|
|
4373
|
+
rawIndex++;
|
|
4374
|
+
if (rawIndex >= rawText.length)
|
|
4375
|
+
break;
|
|
4376
|
+
// Flush literals only once a value character actually fills the slot after
|
|
4377
|
+
// them, so a rejected character never leaves a dangling separator behind.
|
|
4378
|
+
masked += pendingLiterals + rawText[rawIndex];
|
|
4379
|
+
pendingLiterals = '';
|
|
4380
|
+
unmasked += rawText[rawIndex];
|
|
4381
|
+
rawIndex++;
|
|
4382
|
+
}
|
|
4383
|
+
else if (rawIndex < rawText.length && rawText[rawIndex] === patternChar) {
|
|
4384
|
+
// Literal the user typed explicitly — absorb it rather than doubling it.
|
|
4385
|
+
masked += pendingLiterals + patternChar;
|
|
4386
|
+
pendingLiterals = '';
|
|
4387
|
+
rawIndex++;
|
|
4388
|
+
}
|
|
4389
|
+
else if (rawIndex < rawText.length) {
|
|
4390
|
+
// Hold the literal until the value character that follows it arrives.
|
|
4391
|
+
pendingLiterals += patternChar;
|
|
4392
|
+
}
|
|
4393
|
+
else {
|
|
4394
|
+
break;
|
|
4395
|
+
}
|
|
4396
|
+
}
|
|
4397
|
+
return { masked, unmasked };
|
|
4398
|
+
}
|
|
4399
|
+
|
|
4400
|
+
/**
|
|
4401
|
+
* Formats a native `<input>` as the user types against a token pattern
|
|
4402
|
+
* (`0` digit, `A` letter, `*` alphanumeric; any other character is a literal).
|
|
4403
|
+
*
|
|
4404
|
+
* Works both directly on a native `<input>` and on the `tls-input` component: it
|
|
4405
|
+
* operates purely at the DOM level, resolving the native control (the host, or
|
|
4406
|
+
* the `<input>` nested inside it) and re-dispatching a native `input` event so
|
|
4407
|
+
* the host's own value handling captures the masked string. Programmatic
|
|
4408
|
+
* `element.value = …` writes (a form `setValue`, a direct DOM assignment) are
|
|
4409
|
+
* intercepted and masked as well, and the value is reformatted whenever the
|
|
4410
|
+
* pattern changes at runtime. The field value therefore holds the masked text;
|
|
4411
|
+
* the separator-free value is exposed via the `unmasked` signal (through
|
|
4412
|
+
* `exportAs: 'tlsMask'`) and the `unmaskedChange` output.
|
|
4413
|
+
*
|
|
4414
|
+
* Deleting a separator is a no-op (the reformat re-inserts it); delete a value
|
|
4415
|
+
* character instead.
|
|
4416
|
+
*/
|
|
4417
|
+
class MaskDirective {
|
|
4418
|
+
// Injections
|
|
4419
|
+
_elementRef = inject(ElementRef);
|
|
4420
|
+
_renderer = inject(Renderer2);
|
|
4421
|
+
_destroyRef = inject(DestroyRef);
|
|
4422
|
+
// Inputs
|
|
4423
|
+
pattern = input('', { ...(ngDevMode ? { debugName: "pattern" } : /* istanbul ignore next */ {}), alias: 'tlsMask' });
|
|
4424
|
+
// Outputs
|
|
4425
|
+
unmaskedChange = output();
|
|
4426
|
+
// State
|
|
4427
|
+
_masked = signal('', /* @ts-ignore */
|
|
4428
|
+
...(ngDevMode ? [{ debugName: "_masked" }] : /* istanbul ignore next */ []));
|
|
4429
|
+
_unmasked = signal('', /* @ts-ignore */
|
|
4430
|
+
...(ngDevMode ? [{ debugName: "_unmasked" }] : /* istanbul ignore next */ []));
|
|
4431
|
+
masked = this._masked.asReadonly();
|
|
4432
|
+
unmasked = this._unmasked.asReadonly();
|
|
4433
|
+
_input = null;
|
|
4434
|
+
_isFormatting = false;
|
|
4435
|
+
// Constructor
|
|
4436
|
+
constructor() {
|
|
4437
|
+
afterNextRender(() => {
|
|
4438
|
+
const host = this._elementRef.nativeElement;
|
|
4439
|
+
this._input = host instanceof HTMLInputElement ? host : host.querySelector('input');
|
|
4440
|
+
if (!this._input)
|
|
4441
|
+
return;
|
|
4442
|
+
this._renderer.listen(this._input, 'input', () => this._format());
|
|
4443
|
+
this._interceptValueWrites(this._input);
|
|
4444
|
+
// Mask any value already present at mount (e.g. a pre-filled raw value).
|
|
4445
|
+
if (this._input.value)
|
|
4446
|
+
this._format();
|
|
4447
|
+
});
|
|
4448
|
+
// Reformat the current value whenever the pattern changes at runtime.
|
|
4449
|
+
effect(() => {
|
|
4450
|
+
this.pattern();
|
|
4451
|
+
if (this._input)
|
|
4452
|
+
this._format();
|
|
4453
|
+
});
|
|
4454
|
+
}
|
|
4455
|
+
// Private methods
|
|
4456
|
+
_format() {
|
|
4457
|
+
if (this._isFormatting)
|
|
4458
|
+
return;
|
|
4459
|
+
const element = this._input;
|
|
4460
|
+
if (!element)
|
|
4461
|
+
return;
|
|
4462
|
+
const caretPosition = element.selectionStart ?? element.value.length;
|
|
4463
|
+
const { maskedValue, unmaskedValue, caret } = applyMask(this.pattern(), element.value, caretPosition);
|
|
4464
|
+
this._isFormatting = true;
|
|
4465
|
+
if (element.value !== maskedValue) {
|
|
4466
|
+
element.value = maskedValue;
|
|
4467
|
+
element.setSelectionRange(caret, caret);
|
|
4468
|
+
// Re-dispatch so the host's own `input` handler (tls-input's `onInput`, or
|
|
4469
|
+
// a native signal-forms control) captures the masked value. The re-entry
|
|
4470
|
+
// is swallowed by the `_isFormatting` guard above.
|
|
4471
|
+
element.dispatchEvent(new Event('input', { bubbles: true }));
|
|
4472
|
+
}
|
|
4473
|
+
this._masked.set(maskedValue);
|
|
4474
|
+
if (unmaskedValue !== this._unmasked()) {
|
|
4475
|
+
this._unmasked.set(unmaskedValue);
|
|
4476
|
+
this.unmaskedChange.emit(unmaskedValue);
|
|
4477
|
+
}
|
|
4478
|
+
this._isFormatting = false;
|
|
4479
|
+
}
|
|
4480
|
+
/**
|
|
4481
|
+
* Programmatic `element.value = …` writes fire no `input` event, so masking
|
|
4482
|
+
* would otherwise be bypassed. Redefining the instance's `value` property
|
|
4483
|
+
* routes every write through the formatter; the instance override is removed
|
|
4484
|
+
* on destroy, falling back to the prototype accessor.
|
|
4485
|
+
*/
|
|
4486
|
+
_interceptValueWrites(element) {
|
|
4487
|
+
const descriptor = Object.getOwnPropertyDescriptor(HTMLInputElement.prototype, 'value');
|
|
4488
|
+
if (!descriptor)
|
|
4489
|
+
return;
|
|
4490
|
+
const setter = descriptor.set;
|
|
4491
|
+
if (!setter)
|
|
4492
|
+
return;
|
|
4493
|
+
Object.defineProperty(element, 'value', {
|
|
4494
|
+
...descriptor,
|
|
4495
|
+
set: (value) => {
|
|
4496
|
+
setter.call(element, value);
|
|
4497
|
+
this._format();
|
|
4498
|
+
},
|
|
4499
|
+
});
|
|
4500
|
+
this._destroyRef.onDestroy(() => Reflect.deleteProperty(element, 'value'));
|
|
4501
|
+
}
|
|
4502
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MaskDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
4503
|
+
static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "22.0.5", type: MaskDirective, isStandalone: true, selector: "[tlsMask]", inputs: { pattern: { classPropertyName: "pattern", publicName: "tlsMask", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { unmaskedChange: "unmaskedChange" }, exportAs: ["tlsMask"], ngImport: i0 });
|
|
4504
|
+
}
|
|
4505
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MaskDirective, decorators: [{
|
|
4506
|
+
type: Directive,
|
|
4507
|
+
args: [{
|
|
4508
|
+
selector: '[tlsMask]',
|
|
4509
|
+
exportAs: 'tlsMask',
|
|
4510
|
+
}]
|
|
4511
|
+
}], ctorParameters: () => [], propDecorators: { pattern: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsMask", required: false }] }], unmaskedChange: [{ type: i0.Output, args: ["unmaskedChange"] }] } });
|
|
4512
|
+
|
|
4122
4513
|
const DEFAULT_PASSWORD_CONFIG = {
|
|
4123
4514
|
size: 'md',
|
|
4124
4515
|
placeholder: '',
|
|
@@ -4141,6 +4532,8 @@ class Password extends ValueFormControl {
|
|
|
4141
4532
|
size = input(this._config.size, /* @ts-ignore */
|
|
4142
4533
|
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
4143
4534
|
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
4535
|
+
startIconTemplate = contentChild('startIcon', /* @ts-ignore */
|
|
4536
|
+
...(ngDevMode ? [{ debugName: "startIconTemplate" }] : /* istanbul ignore next */ []));
|
|
4144
4537
|
showIconTemplate = contentChild('showIcon', /* @ts-ignore */
|
|
4145
4538
|
...(ngDevMode ? [{ debugName: "showIconTemplate" }] : /* istanbul ignore next */ []));
|
|
4146
4539
|
hideIconTemplate = contentChild('hideIcon', /* @ts-ignore */
|
|
@@ -4158,14 +4551,14 @@ class Password extends ValueFormControl {
|
|
|
4158
4551
|
this.visible.update(prev => !prev);
|
|
4159
4552
|
}
|
|
4160
4553
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Password, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
4161
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Password, isStandalone: true, selector: "tls-password", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", 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 } }, outputs: { value: "valueChange", visible: "visibleChange" }, host: { classAttribute: "tls-password" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], queries: [{ propertyName: "showIconTemplate", first: true, predicate: ["showIcon"], descendants: true, isSignal: true }, { propertyName: "hideIconTemplate", first: true, predicate: ["hideIcon"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\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 [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Show</span>\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Hide</span>\n }\n </span>\n </button>\n</tls-form-control-group>\n", dependencies: [{ kind: "component", type: FormControlGroup, selector: "tls-form-control-group", inputs: ["size", "fluid"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
4554
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.0.5", type: Password, isStandalone: true, selector: "tls-password", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, visible: { classPropertyName: "visible", publicName: "visible", 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 } }, outputs: { value: "valueChange", visible: "visibleChange" }, host: { classAttribute: "tls-password" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "showIconTemplate", first: true, predicate: ["showIcon"], descendants: true, isSignal: true }, { propertyName: "hideIconTemplate", first: true, predicate: ["hideIcon"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n @if (startIconTemplate(); as icon) {\n <span class=\"tls-form-control-addon\" aria-hidden=\"true\">\n <ng-container [ngTemplateOutlet]=\"icon\" />\n </span>\n }\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\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 [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Show</span>\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Hide</span>\n }\n </span>\n </button>\n</tls-form-control-group>\n", dependencies: [{ kind: "component", type: FormControlGroup, selector: "tls-form-control-group", inputs: ["size", "fluid"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Loader, selector: "tls-loader", inputs: ["size", "width", "widthRatio", "ariaLabel"] }] });
|
|
4162
4555
|
}
|
|
4163
4556
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Password, decorators: [{
|
|
4164
4557
|
type: Component,
|
|
4165
4558
|
args: [{ selector: 'tls-password', imports: [FormControlGroup, NgTemplateOutlet, Loader], host: {
|
|
4166
4559
|
class: 'tls-password',
|
|
4167
|
-
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\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 [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Show</span>\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Hide</span>\n }\n </span>\n </button>\n</tls-form-control-group>\n" }]
|
|
4168
|
-
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], 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 }] }], showIconTemplate: [{ type: i0.ContentChild, args: ['showIcon', { isSignal: true }] }], hideIconTemplate: [{ type: i0.ContentChild, args: ['hideIcon', { isSignal: true }] }] } });
|
|
4560
|
+
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<tls-form-control-group [size]=\"size()\" [fluid]=\"fluid()\">\n @if (startIconTemplate(); as icon) {\n <span class=\"tls-form-control-addon\" aria-hidden=\"true\">\n <ng-container [ngTemplateOutlet]=\"icon\" />\n </span>\n }\n <input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\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 [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n />\n @if (pending()) {\n <tls-loader class=\"tls-form-control-addon\" size=\"xs\" aria-hidden=\"true\" />\n }\n <button\n class=\"tls-password-toggle tls-form-control-addon\"\n type=\"button\"\n [attr.aria-label]=\"visible() ? 'Hide password' : 'Show password'\"\n [attr.aria-pressed]=\"visible()\"\n (click)=\"toggle()\"\n >\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n @if (showIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Show</span>\n }\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n @if (hideIconTemplate(); as icon) {\n <ng-container [ngTemplateOutlet]=\"icon\" />\n } @else {\n <span class=\"text-label-md\">Hide</span>\n }\n </span>\n </button>\n</tls-form-control-group>\n" }]
|
|
4561
|
+
}], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], visible: [{ type: i0.Input, args: [{ isSignal: true, alias: "visible", required: false }] }, { type: i0.Output, args: ["visibleChange"] }], 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 }] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], showIconTemplate: [{ type: i0.ContentChild, args: ['showIcon', { isSignal: true }] }], hideIconTemplate: [{ type: i0.ContentChild, args: ['hideIcon', { isSignal: true }] }] } });
|
|
4169
4562
|
|
|
4170
4563
|
// Matches strings containing only numeric digits (0–9).
|
|
4171
4564
|
// Ensures the entire input consists exclusively of numbers.
|
|
@@ -4420,7 +4813,7 @@ class MultiSelect extends AbstractSelect {
|
|
|
4420
4813
|
this.value.set([]);
|
|
4421
4814
|
}
|
|
4422
4815
|
getInitialActiveIndex() {
|
|
4423
|
-
const options = this.
|
|
4816
|
+
const options = this.visibleOptions();
|
|
4424
4817
|
const selected = this.selectedValues();
|
|
4425
4818
|
const firstSelected = options.findIndex(option => !option.disabled && selected.has(option.value));
|
|
4426
4819
|
if (firstSelected !== -1)
|
|
@@ -4431,13 +4824,13 @@ class MultiSelect extends AbstractSelect {
|
|
|
4431
4824
|
this.toggleOption(option);
|
|
4432
4825
|
}
|
|
4433
4826
|
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
|
|
4827
|
+
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
4828
|
}
|
|
4436
4829
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: MultiSelect, decorators: [{
|
|
4437
4830
|
type: Component,
|
|
4438
4831
|
args: [{ selector: 'tls-multi-select', imports: [Loader, Icon], host: {
|
|
4439
4832
|
'[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
|
|
4833
|
+
}, 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
4834
|
}], 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
4835
|
|
|
4443
4836
|
const DEFAULT_SELECT_CONFIG = {
|
|
@@ -4490,19 +4883,19 @@ class Select extends AbstractSelect {
|
|
|
4490
4883
|
this.value.set(null);
|
|
4491
4884
|
}
|
|
4492
4885
|
getInitialActiveIndex() {
|
|
4493
|
-
return this.
|
|
4886
|
+
return this.visibleOptions().findIndex(option => option.value === this.value());
|
|
4494
4887
|
}
|
|
4495
4888
|
commitActiveOption(option) {
|
|
4496
4889
|
this.select(option);
|
|
4497
4890
|
}
|
|
4498
4891
|
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
|
|
4892
|
+
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
4893
|
}
|
|
4501
4894
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Select, decorators: [{
|
|
4502
4895
|
type: Component,
|
|
4503
4896
|
args: [{ selector: 'tls-select', imports: [Loader, Icon], host: {
|
|
4504
4897
|
'[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
|
|
4898
|
+
}, 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
4899
|
}], 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
4900
|
|
|
4508
4901
|
const DEFAULT_SWITCH_CONFIG = {
|
|
@@ -4617,6 +5010,147 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4617
5010
|
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
5011
|
}], 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
5012
|
|
|
5013
|
+
const DEFAULT_TOGGLE_BUTTON_CONFIG = {
|
|
5014
|
+
color: 'primary',
|
|
5015
|
+
variant: 'outlined',
|
|
5016
|
+
size: 'md',
|
|
5017
|
+
fluid: false,
|
|
5018
|
+
checkedColor: undefined,
|
|
5019
|
+
checkedVariant: undefined,
|
|
5020
|
+
};
|
|
5021
|
+
|
|
5022
|
+
const TOGGLE_BUTTON_CONFIG = new InjectionToken('TOGGLE_BUTTON_CONFIG', {
|
|
5023
|
+
factory: () => DEFAULT_TOGGLE_BUTTON_CONFIG,
|
|
5024
|
+
});
|
|
5025
|
+
|
|
5026
|
+
/**
|
|
5027
|
+
* A standalone two-state button following the WAI-ARIA toggle-button pattern
|
|
5028
|
+
* (`role="button"` + `aria-pressed`). The host element is the control itself.
|
|
5029
|
+
* For a set of mutually related options use `tls-toggle-group` instead.
|
|
5030
|
+
*
|
|
5031
|
+
* `color`/`variant` style the resting (unpressed) state. The pressed state
|
|
5032
|
+
* defaults to the filled treatment of the base hue and can be restyled
|
|
5033
|
+
* independently via `checkedColor`/`checkedVariant`, mirroring `tlsChipControl`.
|
|
5034
|
+
*/
|
|
5035
|
+
class ToggleButton extends CheckboxFormControl {
|
|
5036
|
+
// Injections
|
|
5037
|
+
_config = inject(TOGGLE_BUTTON_CONFIG);
|
|
5038
|
+
CLASS_NAME = 'tls-toggle-button';
|
|
5039
|
+
// Inputs
|
|
5040
|
+
/** Whether the button is in the pressed (on) state. */
|
|
5041
|
+
checked = model(false, /* @ts-ignore */
|
|
5042
|
+
...(ngDevMode ? [{ debugName: "checked" }] : /* istanbul ignore next */ []));
|
|
5043
|
+
/** The text label displayed inside the button. Takes priority over projected content. */
|
|
5044
|
+
label = input(/* @ts-ignore */
|
|
5045
|
+
...(ngDevMode ? [undefined, { debugName: "label" }] : /* istanbul ignore next */ []));
|
|
5046
|
+
/**
|
|
5047
|
+
* Label displayed instead of `label` while pressed (e.g. "Mute" / "Muted").
|
|
5048
|
+
* Providing it also switches the announcement strategy: the state is conveyed
|
|
5049
|
+
* by the changing accessible name alone and `aria-pressed` is omitted, per the
|
|
5050
|
+
* WAI-ARIA toggle-button pattern (a name that changes with state must not be
|
|
5051
|
+
* combined with `aria-pressed`, or screen readers announce both).
|
|
5052
|
+
*/
|
|
5053
|
+
checkedLabel = input(/* @ts-ignore */
|
|
5054
|
+
...(ngDevMode ? [undefined, { debugName: "checkedLabel" }] : /* istanbul ignore next */ []));
|
|
5055
|
+
/**
|
|
5056
|
+
* Keeps the button's width constant across states by reserving space for the
|
|
5057
|
+
* wider of `label` / `checkedLabel`, so toggling never shifts the surrounding
|
|
5058
|
+
* layout. Applies only when both labels are provided.
|
|
5059
|
+
*/
|
|
5060
|
+
staticWidth = input(false, { ...(ngDevMode ? { debugName: "staticWidth" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5061
|
+
/**
|
|
5062
|
+
* Marks the content as icon-only: the button becomes square with centered
|
|
5063
|
+
* content. Provide an accessible name via `ariaLabel`/`ariaLabelledby`, since
|
|
5064
|
+
* there is no visible text for screen readers to announce.
|
|
5065
|
+
*/
|
|
5066
|
+
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5067
|
+
color = input(this._config.color, /* @ts-ignore */
|
|
5068
|
+
...(ngDevMode ? [{ debugName: "color" }] : /* istanbul ignore next */ []));
|
|
5069
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
5070
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
5071
|
+
variant = input(this._config.variant, /* @ts-ignore */
|
|
5072
|
+
...(ngDevMode ? [{ debugName: "variant" }] : /* istanbul ignore next */ []));
|
|
5073
|
+
/** Hue of the pressed state; `undefined` keeps the base `color`. */
|
|
5074
|
+
checkedColor = input(this._config.checkedColor, /* @ts-ignore */
|
|
5075
|
+
...(ngDevMode ? [{ debugName: "checkedColor" }] : /* istanbul ignore next */ []));
|
|
5076
|
+
/** Treatment of the pressed state; `undefined` uses the filled treatment. */
|
|
5077
|
+
checkedVariant = input(this._config.checkedVariant, /* @ts-ignore */
|
|
5078
|
+
...(ngDevMode ? [{ debugName: "checkedVariant" }] : /* istanbul ignore next */ []));
|
|
5079
|
+
/** Whether the button stretches to fill its container's width. */
|
|
5080
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : /* istanbul ignore next */ {}), transform: booleanAttribute });
|
|
5081
|
+
tabindex = input(0, /* @ts-ignore */
|
|
5082
|
+
...(ngDevMode ? [{ debugName: "tabindex" }] : /* istanbul ignore next */ []));
|
|
5083
|
+
// Computed
|
|
5084
|
+
/** Label for the current state: `checkedLabel` while pressed (when provided), `label` otherwise. */
|
|
5085
|
+
displayedLabel = computed(() => {
|
|
5086
|
+
const checkedLabel = this.checkedLabel();
|
|
5087
|
+
if (this.checked() && checkedLabel)
|
|
5088
|
+
return checkedLabel;
|
|
5089
|
+
return this.label();
|
|
5090
|
+
}, /* @ts-ignore */
|
|
5091
|
+
...(ngDevMode ? [{ debugName: "displayedLabel" }] : /* istanbul ignore next */ []));
|
|
5092
|
+
/** Whether both state labels render stacked in one cell, sizing the button to the wider one. */
|
|
5093
|
+
stackedLabels = computed(() => Boolean(this.staticWidth() && this.label() && this.checkedLabel()), /* @ts-ignore */
|
|
5094
|
+
...(ngDevMode ? [{ debugName: "stackedLabels" }] : /* istanbul ignore next */ []));
|
|
5095
|
+
/** `aria-pressed` value; omitted entirely when `checkedLabel` makes the name carry the state. */
|
|
5096
|
+
ariaPressed = computed(() => this.checkedLabel() ? null : this.checked(), /* @ts-ignore */
|
|
5097
|
+
...(ngDevMode ? [{ debugName: "ariaPressed" }] : /* istanbul ignore next */ []));
|
|
5098
|
+
hostClasses = computed(() => {
|
|
5099
|
+
const className = this.CLASS_NAME;
|
|
5100
|
+
const array = [
|
|
5101
|
+
className,
|
|
5102
|
+
`${className}--${this.color()}`,
|
|
5103
|
+
`${className}--${this.size()}`,
|
|
5104
|
+
`${className}--${this.variant()}`,
|
|
5105
|
+
];
|
|
5106
|
+
if (this.fluid())
|
|
5107
|
+
array.push(`${className}--fluid`);
|
|
5108
|
+
if (this.icon())
|
|
5109
|
+
array.push(`${className}--icon-only`);
|
|
5110
|
+
if (this.checked()) {
|
|
5111
|
+
const checkedColor = this.checkedColor();
|
|
5112
|
+
if (checkedColor)
|
|
5113
|
+
array.push(`${className}--checked-${checkedColor}`);
|
|
5114
|
+
const checkedVariant = this.checkedVariant();
|
|
5115
|
+
if (checkedVariant)
|
|
5116
|
+
array.push(`${className}--checked-${checkedVariant}`);
|
|
5117
|
+
}
|
|
5118
|
+
return array.concat(this.controlClasses());
|
|
5119
|
+
}, /* @ts-ignore */
|
|
5120
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
5121
|
+
// Protected methods
|
|
5122
|
+
toggle() {
|
|
5123
|
+
if (this.notInteractive())
|
|
5124
|
+
return;
|
|
5125
|
+
this.checked.update(previous => !previous);
|
|
5126
|
+
}
|
|
5127
|
+
onKeyboardToggle(event) {
|
|
5128
|
+
event.preventDefault();
|
|
5129
|
+
this.toggle();
|
|
5130
|
+
}
|
|
5131
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
5132
|
+
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" });
|
|
5133
|
+
}
|
|
5134
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: ToggleButton, decorators: [{
|
|
5135
|
+
type: Component,
|
|
5136
|
+
args: [{ selector: 'tls-toggle-button', host: {
|
|
5137
|
+
role: 'button',
|
|
5138
|
+
'[class]': 'hostClasses()',
|
|
5139
|
+
'[tabindex]': 'disabled() ? -1 : tabindex()',
|
|
5140
|
+
'[attr.id]': 'effectiveInputId()',
|
|
5141
|
+
'[attr.aria-pressed]': 'ariaPressed()',
|
|
5142
|
+
'[attr.aria-disabled]': 'disabled()',
|
|
5143
|
+
'[attr.aria-label]': 'ariaLabel() ?? null',
|
|
5144
|
+
'[attr.aria-labelledby]': 'labelledBy()',
|
|
5145
|
+
'[attr.aria-describedby]': 'describedBy()',
|
|
5146
|
+
'[attr.aria-invalid]': "invalid() ? 'true' : null",
|
|
5147
|
+
'(click)': 'toggle()',
|
|
5148
|
+
'(blur)': 'touched.set(true)',
|
|
5149
|
+
'(keydown.space)': 'onKeyboardToggle($event)',
|
|
5150
|
+
'(keydown.enter)': 'onKeyboardToggle($event)',
|
|
5151
|
+
}, 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" }]
|
|
5152
|
+
}], 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 }] }] } });
|
|
5153
|
+
|
|
4620
5154
|
const DEFAULT_IMAGE_COMPARE_CONFIG = {
|
|
4621
5155
|
orientation: 'horizontal',
|
|
4622
5156
|
position: 50,
|
|
@@ -4784,6 +5318,39 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImpor
|
|
|
4784
5318
|
}, 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
5319
|
}], 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
5320
|
|
|
5321
|
+
const DEFAULT_KBD_CONFIG = {
|
|
5322
|
+
size: 'md',
|
|
5323
|
+
};
|
|
5324
|
+
|
|
5325
|
+
const KBD_CONFIG = new InjectionToken('KBD_CONFIG', {
|
|
5326
|
+
factory: () => DEFAULT_KBD_CONFIG,
|
|
5327
|
+
});
|
|
5328
|
+
|
|
5329
|
+
class Kbd {
|
|
5330
|
+
// Injections
|
|
5331
|
+
_config = inject(KBD_CONFIG);
|
|
5332
|
+
// Inputs
|
|
5333
|
+
size = input(this._config.size, /* @ts-ignore */
|
|
5334
|
+
...(ngDevMode ? [{ debugName: "size" }] : /* istanbul ignore next */ []));
|
|
5335
|
+
// Computed
|
|
5336
|
+
hostClasses = computed(() => {
|
|
5337
|
+
const className = 'tls-kbd';
|
|
5338
|
+
return [className, `${className}--${this.size()}`];
|
|
5339
|
+
}, /* @ts-ignore */
|
|
5340
|
+
...(ngDevMode ? [{ debugName: "hostClasses" }] : /* istanbul ignore next */ []));
|
|
5341
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Kbd, deps: [], target: i0.ɵɵFactoryTarget.Directive });
|
|
5342
|
+
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 });
|
|
5343
|
+
}
|
|
5344
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.0.5", ngImport: i0, type: Kbd, decorators: [{
|
|
5345
|
+
type: Directive,
|
|
5346
|
+
args: [{
|
|
5347
|
+
selector: 'kbd[tlsKbd]',
|
|
5348
|
+
host: {
|
|
5349
|
+
'[class]': 'hostClasses()',
|
|
5350
|
+
},
|
|
5351
|
+
}]
|
|
5352
|
+
}], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
5353
|
+
|
|
4787
5354
|
class MenuItemComponent {
|
|
4788
5355
|
key = input.required(/* @ts-ignore */
|
|
4789
5356
|
...(ngDevMode ? [{ debugName: "key" }] : /* istanbul ignore next */ []));
|
|
@@ -6813,7 +7380,20 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6813
7380
|
// separate DI tokens, so split the nested `querySync` off from the component's own config.
|
|
6814
7381
|
const { querySync: paginationQuerySync, ...pagination } = config.components.pagination ?? {};
|
|
6815
7382
|
const { querySync: tabsQuerySync, ...tabs } = config.components.tabs ?? {};
|
|
7383
|
+
const accessibility = deepMerge(DEFAULT_ACCESSIBILITY_CONFIG, config.accessibility);
|
|
6816
7384
|
return makeEnvironmentProviders([
|
|
7385
|
+
// Cross-cutting accessibility policy
|
|
7386
|
+
{ provide: ACCESSIBILITY_CONFIG, useValue: accessibility },
|
|
7387
|
+
// Reflect the touch-target opt-out onto the document root. Absent the attribute the
|
|
7388
|
+
// expansion is active (accessible by default); this only disables it. The overflow is
|
|
7389
|
+
// transparent, so a late (browser-only) reflection causes no visual flash.
|
|
7390
|
+
provideEnvironmentInitializer(() => {
|
|
7391
|
+
if (accessibility.expandTouchTargets)
|
|
7392
|
+
return;
|
|
7393
|
+
if (!isPlatformBrowser(inject(PLATFORM_ID)))
|
|
7394
|
+
return;
|
|
7395
|
+
inject(DOCUMENT).documentElement.setAttribute('data-touch-targets', 'off');
|
|
7396
|
+
}),
|
|
6817
7397
|
// Cross-cutting form defaults
|
|
6818
7398
|
{
|
|
6819
7399
|
provide: FORM_CONTROL_CONFIG,
|
|
@@ -6824,6 +7404,10 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6824
7404
|
provide: ALERT_CONFIG,
|
|
6825
7405
|
useValue: deepMerge(DEFAULT_ALERT_CONFIG, config.components.alert),
|
|
6826
7406
|
},
|
|
7407
|
+
{
|
|
7408
|
+
provide: AUTOCOMPLETE_CONFIG,
|
|
7409
|
+
useValue: deepMerge(DEFAULT_AUTOCOMPLETE_CONFIG, config.components.autocomplete),
|
|
7410
|
+
},
|
|
6827
7411
|
{
|
|
6828
7412
|
provide: BUTTON_CONFIG,
|
|
6829
7413
|
useValue: deepMerge(DEFAULT_BUTTON_CONFIG, config.components.button),
|
|
@@ -6963,5 +7547,5 @@ const provideThalassicUIConfig = (config) => {
|
|
|
6963
7547
|
* Generated bundle index. Do not edit.
|
|
6964
7548
|
*/
|
|
6965
7549
|
|
|
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 };
|
|
7550
|
+
export { ALERT_CONFIG, AUTOCOMPLETE_CONFIG, Alert, Autocomplete, BADGE_CONFIG, BREADCRUMBS_CONFIG, BUTTON_CONFIG, Badge, Breadcrumbs, 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_BREADCRUMBS_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, MASK_TOKENS, MENU_CONFIG, MULTI_SELECT_CONFIG, MaskDirective, 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, applyMask, provideThalassicIcons, provideThalassicUIConfig };
|
|
6967
7551
|
//# sourceMappingURL=thalassic-ui.mjs.map
|