@thalassic/ui 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/LICENSE.txt +21 -0
- package/features/button/button-appearance.scss +144 -0
- package/features/button/button-color.scss +41 -0
- package/features/button/button-size.scss +54 -0
- package/features/button/button.scss +59 -0
- package/features/divider/divider.scss +91 -0
- package/features/form/checkbox/checkbox.scss +95 -0
- package/features/form/input/input.scss +9 -0
- package/features/form/password/password.scss +25 -0
- package/features/form/radio-button/radio-button.scss +103 -0
- package/features/form/switch/switch-color.scss +36 -0
- package/features/form/switch/switch.scss +82 -0
- package/features/form-item/form-item.scss +79 -0
- package/features/icon/icon.scss +15 -0
- package/fesm2022/thalassic-ui.mjs +139 -39
- package/fesm2022/thalassic-ui.mjs.map +1 -1
- package/package.json +1 -1
- package/styles/components/_index.scss +1 -0
- package/styles/components/form/_form-control-addon.scss +2 -0
- package/styles/components/form/_form-control-group-size.scss +46 -0
- package/styles/components/form/_form-control-group.scss +58 -0
- package/styles/components/form/_form-control-size.scss +46 -0
- package/styles/components/form/_form-control.scss +45 -0
- package/styles/components/form/_index.scss +5 -0
- package/styles/index.scss +1 -0
- package/styles/mixins/_index.scss +1 -0
- package/styles/mixins/focus-ring.scss +4 -0
- package/types/thalassic-ui.d.ts +98 -17
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
@use '../../../styles/mixins' as mixins;
|
|
2
|
+
|
|
3
|
+
:host.tls-switch {
|
|
4
|
+
--tls-switch-width: 48px;
|
|
5
|
+
--tls-switch-height: var(--control-height-sm);
|
|
6
|
+
--tls-switch-handle-gap: 4px;
|
|
7
|
+
--tls-switch-handle-size: calc(
|
|
8
|
+
var(--tls-switch-height) - (var(--tls-switch-handle-gap) * 2) -
|
|
9
|
+
(var(--tls-switch-border-width) * 2)
|
|
10
|
+
);
|
|
11
|
+
|
|
12
|
+
--tls-switch-border-width: 1px;
|
|
13
|
+
--tls-switch-border-radius: 24px;
|
|
14
|
+
|
|
15
|
+
--tls-switch-color: var(--color-surface-variant);
|
|
16
|
+
--tls-switch-on-color: var(--color-surface);
|
|
17
|
+
--tls-switch-border-color: var(--tls-switch-color);
|
|
18
|
+
|
|
19
|
+
width: var(--tls-switch-width);
|
|
20
|
+
height: var(--tls-switch-height);
|
|
21
|
+
|
|
22
|
+
display: flex;
|
|
23
|
+
|
|
24
|
+
border: var(--tls-switch-border-width) solid var(--tls-switch-border-color);
|
|
25
|
+
border-radius: var(--tls-switch-border-radius);
|
|
26
|
+
|
|
27
|
+
background-color: var(--tls-switch-color);
|
|
28
|
+
|
|
29
|
+
cursor: pointer;
|
|
30
|
+
|
|
31
|
+
transition:
|
|
32
|
+
background-color var(--motion-fast) var(--motion-ease-in-out),
|
|
33
|
+
border-color var(--motion-fast) var(--motion-ease-in-out),
|
|
34
|
+
filter var(--motion-fast) var(--motion-ease-in-out);
|
|
35
|
+
|
|
36
|
+
&:focus-visible {
|
|
37
|
+
@include mixins.focus-ring;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
.tls-switch-input {
|
|
41
|
+
display: none;
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
.tls-switch-handle {
|
|
45
|
+
width: var(--tls-switch-handle-size);
|
|
46
|
+
height: var(--tls-switch-handle-size);
|
|
47
|
+
|
|
48
|
+
margin: calc(var(--tls-switch-handle-gap));
|
|
49
|
+
|
|
50
|
+
border-radius: 50%;
|
|
51
|
+
|
|
52
|
+
background-color: var(--tls-switch-on-color);
|
|
53
|
+
|
|
54
|
+
box-shadow: var(--shadow-xs);
|
|
55
|
+
|
|
56
|
+
transition: transform var(--motion-fast) var(--motion-ease-in-out);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
// Checked
|
|
60
|
+
&.tls-switch--checked {
|
|
61
|
+
--tls-switch-handle-gap: 3px;
|
|
62
|
+
|
|
63
|
+
.tls-switch-handle {
|
|
64
|
+
$translate-x: calc(
|
|
65
|
+
var(--tls-switch-width) - var(--tls-switch-handle-size) -
|
|
66
|
+
(var(--tls-switch-handle-gap) * 2) - (var(--tls-switch-border-width) * 2)
|
|
67
|
+
);
|
|
68
|
+
|
|
69
|
+
transform: translateX(#{$translate-x});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
// Form control
|
|
74
|
+
&.tls-switch--disabled {
|
|
75
|
+
cursor: not-allowed;
|
|
76
|
+
filter: brightness(0.9);
|
|
77
|
+
}
|
|
78
|
+
|
|
79
|
+
&:not(.tls-switch--disabled).tls-switch--touched.tls-switch--invalid {
|
|
80
|
+
--tls-switch-border-color: var(--color-danger);
|
|
81
|
+
}
|
|
82
|
+
}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
:host.tls-form-item {
|
|
2
|
+
display: flex;
|
|
3
|
+
flex-direction: column;
|
|
4
|
+
|
|
5
|
+
&.tls-form-item--invalid {
|
|
6
|
+
.form-item-label {
|
|
7
|
+
color: var(--color-danger);
|
|
8
|
+
}
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
&.tls-form-item--required {
|
|
12
|
+
.form-item-label__required {
|
|
13
|
+
display: inline;
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
&:not(.tls-form-item--error-space-reserved) {
|
|
18
|
+
.form-item-error {
|
|
19
|
+
min-height: auto;
|
|
20
|
+
|
|
21
|
+
&:empty {
|
|
22
|
+
display: none;
|
|
23
|
+
}
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
.form-item-label {
|
|
28
|
+
margin-bottom: 0.25rem;
|
|
29
|
+
|
|
30
|
+
display: flex;
|
|
31
|
+
gap: 0.25rem;
|
|
32
|
+
|
|
33
|
+
font-size: var(--font-label-medium-size);
|
|
34
|
+
font-weight: var(--font-label-medium-weight);
|
|
35
|
+
line-height: var(--font-label-medium-line-height);
|
|
36
|
+
letter-spacing: var(--font-label-medium-letter-spacing);
|
|
37
|
+
|
|
38
|
+
&:has(.form-item-label__text:empty) {
|
|
39
|
+
display: none;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
&__required {
|
|
43
|
+
display: none;
|
|
44
|
+
color: var(--color-danger);
|
|
45
|
+
|
|
46
|
+
font-size: var(--font-label-large-size);
|
|
47
|
+
font-weight: var(--font-label-large-weight);
|
|
48
|
+
letter-spacing: var(--font-label-large-letter-spacing);
|
|
49
|
+
}
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
.form-item-error {
|
|
53
|
+
min-height: var(--font-label-small-line-height);
|
|
54
|
+
margin-top: 0.125rem;
|
|
55
|
+
|
|
56
|
+
color: var(--color-danger);
|
|
57
|
+
|
|
58
|
+
font-size: var(--font-label-small-size);
|
|
59
|
+
font-weight: var(--font-label-small-weight);
|
|
60
|
+
line-height: var(--font-label-small-line-height);
|
|
61
|
+
letter-spacing: var(--font-label-small-letter-spacing);
|
|
62
|
+
|
|
63
|
+
&__text {
|
|
64
|
+
display: inline-block;
|
|
65
|
+
|
|
66
|
+
opacity: 1;
|
|
67
|
+
transform: translateY(0);
|
|
68
|
+
|
|
69
|
+
transition:
|
|
70
|
+
transform var(--motion-default) var(--motion-ease-in),
|
|
71
|
+
opacity var(--motion-default) var(--motion-ease-in);
|
|
72
|
+
|
|
73
|
+
@starting-style {
|
|
74
|
+
opacity: 0;
|
|
75
|
+
transform: translateY(-100%);
|
|
76
|
+
}
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { NgTemplateOutlet, isPlatformBrowser } from '@angular/common';
|
|
2
2
|
import * as i0 from '@angular/core';
|
|
3
|
-
import { InjectionToken, inject, Injectable, input, computed, Component, booleanAttribute, model, Directive, contentChild, forwardRef, DOCUMENT, RendererFactory2, PLATFORM_ID, signal, effect, makeEnvironmentProviders } from '@angular/core';
|
|
3
|
+
import { InjectionToken, inject, Injectable, input, computed, Component, booleanAttribute, model, Directive, contentChild, forwardRef, DOCUMENT, RendererFactory2, PLATFORM_ID, signal, effect, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';
|
|
4
4
|
import { RouterLink } from '@angular/router';
|
|
5
5
|
import { rxResource } from '@angular/core/rxjs-interop';
|
|
6
6
|
import { HttpClient } from '@angular/common/http';
|
|
@@ -101,6 +101,7 @@ const DEFAULT_BUTTON_CONFIG = {
|
|
|
101
101
|
appearance: 'filled',
|
|
102
102
|
size: 'md',
|
|
103
103
|
type: 'button',
|
|
104
|
+
fluid: false,
|
|
104
105
|
};
|
|
105
106
|
|
|
106
107
|
const BUTTON_CONFIG = new InjectionToken('BUTTON_CONFIG', {
|
|
@@ -112,9 +113,16 @@ class Button {
|
|
|
112
113
|
_routerLink = inject(RouterLink, { optional: true });
|
|
113
114
|
_config = inject(BUTTON_CONFIG);
|
|
114
115
|
// Inputs
|
|
116
|
+
/** The text label displayed inside the button. Takes priority over projected content. */
|
|
115
117
|
label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
|
|
116
118
|
type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
117
119
|
disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
|
|
120
|
+
/**
|
|
121
|
+
* Icon to display on the button. Accepts:
|
|
122
|
+
* - A string icon name to render a specific icon.
|
|
123
|
+
* - An empty string or boolean `true` to render an icon-only button (using a projected icon).
|
|
124
|
+
* - `false` to render no icon.
|
|
125
|
+
*/
|
|
118
126
|
icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : {}), transform: (value) => {
|
|
119
127
|
if (typeof value === 'string' && value === '')
|
|
120
128
|
return true;
|
|
@@ -126,6 +134,9 @@ class Button {
|
|
|
126
134
|
color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
|
|
127
135
|
appearance = input(this._config.appearance, ...(ngDevMode ? [{ debugName: "appearance" }] : []));
|
|
128
136
|
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
137
|
+
/** Whether the button stretches to fill its container's width. */
|
|
138
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
139
|
+
/** An optional URL that causes the button to render as an anchor link. */
|
|
129
140
|
href = input(null, ...(ngDevMode ? [{ debugName: "href" }] : []));
|
|
130
141
|
tabindex = input('0', ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
|
|
131
142
|
// Computed
|
|
@@ -141,18 +152,59 @@ class Button {
|
|
|
141
152
|
array.push(`${className}--disabled`);
|
|
142
153
|
if (this.icon())
|
|
143
154
|
array.push(`${className}--icon-only`);
|
|
155
|
+
if (this.fluid())
|
|
156
|
+
array.push(`${className}--fluid`);
|
|
144
157
|
return array;
|
|
145
158
|
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
146
159
|
String = String;
|
|
147
160
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Button, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
148
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Button, isStandalone: true, selector: "tls-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, 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 }, appearance: { classPropertyName: "appearance", publicName: "appearance", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", 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" } }, ngImport: i0, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [href]=\"href()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-disabled]=\"disabled()\"\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 [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 <span class=\"tls-button__content\">\n @if (icon()) {\n @if (isIconString()) {\n <tls-icon [iconSrc]=\"String(icon())\" />\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n } @else {\n @if (label()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n }\n </span>\n <div class=\"tls-button__background\"></div>\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;--tls-button-border-width: 1px}:host:focus-visible{outline:none}:host .tls-button{position:relative;display:inline-flex;justify-content:center;align-items:center;gap:.25rem;border:var(--tls-button-border-width) solid var(--tls-button-color);border-radius:var(--radius-md);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button:focus-visible{outline:var(--control-focus-ring-width) solid var(--control-focus-ring-color);outline-offset:var(--control-focus-ring-offset)}:host .tls-button__content{z-index:1;display:flex;align-items:center;transition:color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button__background{position:absolute;inset:0;border-radius:inherit;transition:background-color var(--motion-fast) var(--motion-ease-in-out),opacity var(--motion-fast) var(--motion-ease-in-out)}\n", ":host .tls-button--filled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--filled .tls-button__background{background-color:var(--tls-button-color)}:host .tls-button--filled:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--filled:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.85}:host .tls-button--filled:not(.tls-button--disabled):active .tls-button__background{opacity:.75}:host .tls-button--outlined .tls-button__content{color:var(--tls-button-color)}:host .tls-button--outlined .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--outlined:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--outlined:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--outlined:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--text{border-color:transparent}:host .tls-button--text .tls-button__content{color:var(--tls-button-color)}:host .tls-button--text .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--text:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--text:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--text:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--elevated{border:none;box-shadow:var(--shadow-sm);transition:box-shadow var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button--elevated .tls-button__content{color:var(--tls-button-color)}:host .tls-button--elevated .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--elevated:not(.tls-button--disabled){padding-inline:calc(var(--tls-button-padding-inline) + var(--tls-button-border-width))}:host .tls-button--elevated:not(.tls-button--disabled):hover,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible{box-shadow:var(--shadow-md)}:host .tls-button--elevated:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--elevated:not(.tls-button--disabled):active{box-shadow:var(--shadow-sm)}:host .tls-button--elevated:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--disabled{cursor:not-allowed;border:var(--tls-button-border-width) solid var(--color-outline);box-shadow:none}:host .tls-button--disabled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--disabled .tls-button__background{opacity:1;transition:none}\n", ":host:has(.tls-button.tls-button--primary){--tls-button-on-color: var(--color-on-primary);--tls-button-color: var(--color-primary)}:host:has(.tls-button.tls-button--secondary){--tls-button-on-color: var(--color-on-secondary);--tls-button-color: var(--color-secondary)}:host:has(.tls-button.tls-button--tertiary){--tls-button-on-color: var(--color-on-tertiary);--tls-button-color: var(--color-tertiary)}:host:has(.tls-button.tls-button--success){--tls-button-on-color: var(--color-on-success);--tls-button-color: var(--color-success)}:host:has(.tls-button.tls-button--info){--tls-button-on-color: var(--color-on-info);--tls-button-color: var(--color-info)}:host:has(.tls-button.tls-button--warning){--tls-button-on-color: var(--color-on-warning);--tls-button-color: var(--color-warning)}:host:has(.tls-button.tls-button--danger){--tls-button-on-color: var(--color-on-danger);--tls-button-color: var(--color-danger)}:host:has(.tls-button.tls-button--disabled){--tls-button-on-color: var(--color-on-surface-variant);--tls-button-color: var(--color-surface-variant)}\n", ":host .tls-button{height:var(--tls-button-height);padding-inline:var(--tls-button-padding-inline);font-size:var(--tls-button-font-size);font-weight:var(--tls-button-font-weight);line-height:var(--tls-button-line-height);letter-spacing:var(--tls-button-letter-spacing)}:host .tls-button.tls-button--icon-only{padding-inline:0;aspect-ratio:1/1}:host:has(.tls-button.tls-button--sm){--tls-button-height: var(--control-height-sm);--tls-button-padding-inline: var(--spacing-3);--tls-button-font-size: var(--font-label-small-size);--tls-button-font-weight: var(--font-label-small-weight);--tls-button-line-height: var(--font-label-small-line-height);--tls-button-letter-spacing: var(--font-label-small-letter-spacing)}:host:has(.tls-button.tls-button--md){--tls-button-height: var(--control-height-md);--tls-button-padding-inline: var(--spacing-4);--tls-button-font-size: var(--font-label-medium-size);--tls-button-font-weight: var(--font-label-medium-weight);--tls-button-line-height: var(--font-label-medium-line-height);--tls-button-letter-spacing: var(--font-label-medium-letter-spacing)}:host:has(.tls-button.tls-button--lg){--tls-button-height: var(--control-height-lg);--tls-button-padding-inline: var(--spacing-5);--tls-button-font-size: var(--font-label-large-size);--tls-button-font-weight: var(--font-label-large-weight);--tls-button-line-height: var(--font-label-large-line-height);--tls-button-letter-spacing: var(--font-label-large-letter-spacing)}\n"], dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
161
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Button, isStandalone: true, selector: "tls-button", inputs: { label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, 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 }, appearance: { classPropertyName: "appearance", publicName: "appearance", 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 }, 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" } }, ngImport: i0, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [href]=\"href()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-disabled]=\"disabled()\"\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 [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 <span class=\"tls-button__content\">\n @if (icon()) {\n @if (isIconString()) {\n <tls-icon [iconSrc]=\"String(icon())\" />\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n } @else {\n @if (label()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n }\n </span>\n <div class=\"tls-button__background\"></div>\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;--tls-button-border-width: 1px}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}:host .tls-button{position:relative;display:inline-flex;justify-content:center;align-items:center;gap:.25rem;border:var(--tls-button-border-width) solid var(--tls-button-color);border-radius:var(--radius-md);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button:focus-visible{outline:var(--control-focus-ring-width) solid var(--control-focus-ring-color);outline-offset:var(--control-focus-ring-offset)}:host .tls-button__content{z-index:1;display:flex;align-items:center;transition:color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button__background{position:absolute;inset:0;border-radius:inherit;transition:background-color var(--motion-fast) var(--motion-ease-in-out),opacity var(--motion-fast) var(--motion-ease-in-out)}\n", ":host .tls-button--filled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--filled .tls-button__background{background-color:var(--tls-button-color)}:host .tls-button--filled:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--filled:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.85}:host .tls-button--filled:not(.tls-button--disabled):active .tls-button__background{opacity:.75}:host .tls-button--outlined .tls-button__content{color:var(--tls-button-color)}:host .tls-button--outlined .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--outlined:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--outlined:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--outlined:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--text{border-color:transparent}:host .tls-button--text .tls-button__content{color:var(--tls-button-color)}:host .tls-button--text .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--text:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--text:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--text:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--elevated{border:none;box-shadow:var(--shadow-sm);transition:box-shadow var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button--elevated .tls-button__content{color:var(--tls-button-color)}:host .tls-button--elevated .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--elevated:not(.tls-button--disabled){padding-inline:calc(var(--tls-button-padding-inline) + var(--tls-button-border-width))}:host .tls-button--elevated:not(.tls-button--disabled):hover,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible{box-shadow:var(--shadow-md)}:host .tls-button--elevated:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--elevated:not(.tls-button--disabled):active{box-shadow:var(--shadow-sm)}:host .tls-button--elevated:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--disabled{cursor:not-allowed;border:var(--tls-button-border-width) solid var(--color-outline);box-shadow:none}:host .tls-button--disabled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--disabled .tls-button__background{opacity:1;transition:none}\n", ":host:has(.tls-button.tls-button--primary){--tls-button-on-color: var(--color-on-primary);--tls-button-color: var(--color-primary)}:host:has(.tls-button.tls-button--secondary){--tls-button-on-color: var(--color-on-secondary);--tls-button-color: var(--color-secondary)}:host:has(.tls-button.tls-button--tertiary){--tls-button-on-color: var(--color-on-tertiary);--tls-button-color: var(--color-tertiary)}:host:has(.tls-button.tls-button--success){--tls-button-on-color: var(--color-on-success);--tls-button-color: var(--color-success)}:host:has(.tls-button.tls-button--info){--tls-button-on-color: var(--color-on-info);--tls-button-color: var(--color-info)}:host:has(.tls-button.tls-button--warning){--tls-button-on-color: var(--color-on-warning);--tls-button-color: var(--color-warning)}:host:has(.tls-button.tls-button--danger){--tls-button-on-color: var(--color-on-danger);--tls-button-color: var(--color-danger)}:host:has(.tls-button.tls-button--disabled){--tls-button-on-color: var(--color-on-surface-variant);--tls-button-color: var(--color-surface-variant)}\n", ":host .tls-button{--tls-button-width: auto;width:var(--tls-button-width);height:var(--tls-button-height);padding-inline:var(--tls-button-padding-inline);font-size:var(--tls-button-font-size);font-weight:var(--tls-button-font-weight);line-height:var(--tls-button-line-height);letter-spacing:var(--tls-button-letter-spacing)}:host .tls-button.tls-button--icon-only{padding-inline:0;aspect-ratio:1/1}:host .tls-button.tls-button--fluid{--tls-button-width: 100%}:host:has(.tls-button.tls-button--sm){--tls-button-height: var(--control-height-sm);--tls-button-padding-inline: var(--spacing-3);--tls-button-font-size: var(--font-label-small-size);--tls-button-font-weight: var(--font-label-small-weight);--tls-button-line-height: var(--font-label-small-line-height);--tls-button-letter-spacing: var(--font-label-small-letter-spacing)}:host:has(.tls-button.tls-button--md){--tls-button-height: var(--control-height-md);--tls-button-padding-inline: var(--spacing-4);--tls-button-font-size: var(--font-label-medium-size);--tls-button-font-weight: var(--font-label-medium-weight);--tls-button-line-height: var(--font-label-medium-line-height);--tls-button-letter-spacing: var(--font-label-medium-letter-spacing)}:host:has(.tls-button.tls-button--lg){--tls-button-height: var(--control-height-lg);--tls-button-padding-inline: var(--spacing-5);--tls-button-font-size: var(--font-label-large-size);--tls-button-font-weight: var(--font-label-large-weight);--tls-button-line-height: var(--font-label-large-line-height);--tls-button-letter-spacing: var(--font-label-large-letter-spacing)}\n"], dependencies: [{ kind: "component", type: Icon, selector: "tls-icon", inputs: ["iconSrc", "alt", "allowedSources"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
|
|
149
162
|
}
|
|
150
163
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Button, decorators: [{
|
|
151
164
|
type: Component,
|
|
152
165
|
args: [{ selector: 'tls-button', imports: [Icon, NgTemplateOutlet], host: {
|
|
153
166
|
'[tabindex]': '-1',
|
|
154
|
-
}, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [href]=\"href()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-disabled]=\"disabled()\"\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 [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 <span class=\"tls-button__content\">\n @if (icon()) {\n @if (isIconString()) {\n <tls-icon [iconSrc]=\"String(icon())\" />\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n } @else {\n @if (label()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n }\n </span>\n <div class=\"tls-button__background\"></div>\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;--tls-button-border-width: 1px}:host:focus-visible{outline:none}:host .tls-button{position:relative;display:inline-flex;justify-content:center;align-items:center;gap:.25rem;border:var(--tls-button-border-width) solid var(--tls-button-color);border-radius:var(--radius-md);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button:focus-visible{outline:var(--control-focus-ring-width) solid var(--control-focus-ring-color);outline-offset:var(--control-focus-ring-offset)}:host .tls-button__content{z-index:1;display:flex;align-items:center;transition:color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button__background{position:absolute;inset:0;border-radius:inherit;transition:background-color var(--motion-fast) var(--motion-ease-in-out),opacity var(--motion-fast) var(--motion-ease-in-out)}\n", ":host .tls-button--filled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--filled .tls-button__background{background-color:var(--tls-button-color)}:host .tls-button--filled:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--filled:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.85}:host .tls-button--filled:not(.tls-button--disabled):active .tls-button__background{opacity:.75}:host .tls-button--outlined .tls-button__content{color:var(--tls-button-color)}:host .tls-button--outlined .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--outlined:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--outlined:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--outlined:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--text{border-color:transparent}:host .tls-button--text .tls-button__content{color:var(--tls-button-color)}:host .tls-button--text .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--text:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--text:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--text:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--elevated{border:none;box-shadow:var(--shadow-sm);transition:box-shadow var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button--elevated .tls-button__content{color:var(--tls-button-color)}:host .tls-button--elevated .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--elevated:not(.tls-button--disabled){padding-inline:calc(var(--tls-button-padding-inline) + var(--tls-button-border-width))}:host .tls-button--elevated:not(.tls-button--disabled):hover,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible{box-shadow:var(--shadow-md)}:host .tls-button--elevated:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--elevated:not(.tls-button--disabled):active{box-shadow:var(--shadow-sm)}:host .tls-button--elevated:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--disabled{cursor:not-allowed;border:var(--tls-button-border-width) solid var(--color-outline);box-shadow:none}:host .tls-button--disabled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--disabled .tls-button__background{opacity:1;transition:none}\n", ":host:has(.tls-button.tls-button--primary){--tls-button-on-color: var(--color-on-primary);--tls-button-color: var(--color-primary)}:host:has(.tls-button.tls-button--secondary){--tls-button-on-color: var(--color-on-secondary);--tls-button-color: var(--color-secondary)}:host:has(.tls-button.tls-button--tertiary){--tls-button-on-color: var(--color-on-tertiary);--tls-button-color: var(--color-tertiary)}:host:has(.tls-button.tls-button--success){--tls-button-on-color: var(--color-on-success);--tls-button-color: var(--color-success)}:host:has(.tls-button.tls-button--info){--tls-button-on-color: var(--color-on-info);--tls-button-color: var(--color-info)}:host:has(.tls-button.tls-button--warning){--tls-button-on-color: var(--color-on-warning);--tls-button-color: var(--color-warning)}:host:has(.tls-button.tls-button--danger){--tls-button-on-color: var(--color-on-danger);--tls-button-color: var(--color-danger)}:host:has(.tls-button.tls-button--disabled){--tls-button-on-color: var(--color-on-surface-variant);--tls-button-color: var(--color-surface-variant)}\n", ":host .tls-button{height:var(--tls-button-height);padding-inline:var(--tls-button-padding-inline);font-size:var(--tls-button-font-size);font-weight:var(--tls-button-font-weight);line-height:var(--tls-button-line-height);letter-spacing:var(--tls-button-letter-spacing)}:host .tls-button.tls-button--icon-only{padding-inline:0;aspect-ratio:1/1}:host:has(.tls-button.tls-button--sm){--tls-button-height: var(--control-height-sm);--tls-button-padding-inline: var(--spacing-3);--tls-button-font-size: var(--font-label-small-size);--tls-button-font-weight: var(--font-label-small-weight);--tls-button-line-height: var(--font-label-small-line-height);--tls-button-letter-spacing: var(--font-label-small-letter-spacing)}:host:has(.tls-button.tls-button--md){--tls-button-height: var(--control-height-md);--tls-button-padding-inline: var(--spacing-4);--tls-button-font-size: var(--font-label-medium-size);--tls-button-font-weight: var(--font-label-medium-weight);--tls-button-line-height: var(--font-label-medium-line-height);--tls-button-letter-spacing: var(--font-label-medium-letter-spacing)}:host:has(.tls-button.tls-button--lg){--tls-button-height: var(--control-height-lg);--tls-button-padding-inline: var(--spacing-5);--tls-button-font-size: var(--font-label-large-size);--tls-button-font-weight: var(--font-label-large-weight);--tls-button-line-height: var(--font-label-large-line-height);--tls-button-letter-spacing: var(--font-label-large-letter-spacing)}\n"] }]
|
|
155
|
-
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], 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 }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
167
|
+
}, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [href]=\"href()\"\n [tabindex]=\"tabindex()\"\n [attr.aria-disabled]=\"disabled()\"\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 [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 <span class=\"tls-button__content\">\n @if (icon()) {\n @if (isIconString()) {\n <tls-icon [iconSrc]=\"String(icon())\" />\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n } @else {\n @if (label()) {\n {{ label() }}\n } @else {\n <ng-container *ngTemplateOutlet=\"projectedContentTemplate\"></ng-container>\n }\n }\n </span>\n <div class=\"tls-button__background\"></div>\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;--tls-button-border-width: 1px}:host:focus-visible{outline:none}:host:has(.tls-button.tls-button--fluid){width:100%}:host .tls-button{position:relative;display:inline-flex;justify-content:center;align-items:center;gap:.25rem;border:var(--tls-button-border-width) solid var(--tls-button-color);border-radius:var(--radius-md);cursor:pointer;-webkit-user-select:none;user-select:none;transition:border-color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button:focus-visible{outline:var(--control-focus-ring-width) solid var(--control-focus-ring-color);outline-offset:var(--control-focus-ring-offset)}:host .tls-button__content{z-index:1;display:flex;align-items:center;transition:color var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button__background{position:absolute;inset:0;border-radius:inherit;transition:background-color var(--motion-fast) var(--motion-ease-in-out),opacity var(--motion-fast) var(--motion-ease-in-out)}\n", ":host .tls-button--filled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--filled .tls-button__background{background-color:var(--tls-button-color)}:host .tls-button--filled:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--filled:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.85}:host .tls-button--filled:not(.tls-button--disabled):active .tls-button__background{opacity:.75}:host .tls-button--outlined .tls-button__content{color:var(--tls-button-color)}:host .tls-button--outlined .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--outlined:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--outlined:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--outlined:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--text{border-color:transparent}:host .tls-button--text .tls-button__content{color:var(--tls-button-color)}:host .tls-button--text .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--text:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--text:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--text:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--elevated{border:none;box-shadow:var(--shadow-sm);transition:box-shadow var(--motion-fast) var(--motion-ease-in-out)}:host .tls-button--elevated .tls-button__content{color:var(--tls-button-color)}:host .tls-button--elevated .tls-button__background{background-color:var(--tls-button-color);opacity:0}:host .tls-button--elevated:not(.tls-button--disabled){padding-inline:calc(var(--tls-button-padding-inline) + var(--tls-button-border-width))}:host .tls-button--elevated:not(.tls-button--disabled):hover,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible{box-shadow:var(--shadow-md)}:host .tls-button--elevated:not(.tls-button--disabled):hover .tls-button__background,:host .tls-button--elevated:not(.tls-button--disabled):focus-visible .tls-button__background{opacity:.075}:host .tls-button--elevated:not(.tls-button--disabled):active{box-shadow:var(--shadow-sm)}:host .tls-button--elevated:not(.tls-button--disabled):active .tls-button__background{opacity:.15}:host .tls-button--disabled{cursor:not-allowed;border:var(--tls-button-border-width) solid var(--color-outline);box-shadow:none}:host .tls-button--disabled .tls-button__content{color:var(--tls-button-on-color)}:host .tls-button--disabled .tls-button__background{opacity:1;transition:none}\n", ":host:has(.tls-button.tls-button--primary){--tls-button-on-color: var(--color-on-primary);--tls-button-color: var(--color-primary)}:host:has(.tls-button.tls-button--secondary){--tls-button-on-color: var(--color-on-secondary);--tls-button-color: var(--color-secondary)}:host:has(.tls-button.tls-button--tertiary){--tls-button-on-color: var(--color-on-tertiary);--tls-button-color: var(--color-tertiary)}:host:has(.tls-button.tls-button--success){--tls-button-on-color: var(--color-on-success);--tls-button-color: var(--color-success)}:host:has(.tls-button.tls-button--info){--tls-button-on-color: var(--color-on-info);--tls-button-color: var(--color-info)}:host:has(.tls-button.tls-button--warning){--tls-button-on-color: var(--color-on-warning);--tls-button-color: var(--color-warning)}:host:has(.tls-button.tls-button--danger){--tls-button-on-color: var(--color-on-danger);--tls-button-color: var(--color-danger)}:host:has(.tls-button.tls-button--disabled){--tls-button-on-color: var(--color-on-surface-variant);--tls-button-color: var(--color-surface-variant)}\n", ":host .tls-button{--tls-button-width: auto;width:var(--tls-button-width);height:var(--tls-button-height);padding-inline:var(--tls-button-padding-inline);font-size:var(--tls-button-font-size);font-weight:var(--tls-button-font-weight);line-height:var(--tls-button-line-height);letter-spacing:var(--tls-button-letter-spacing)}:host .tls-button.tls-button--icon-only{padding-inline:0;aspect-ratio:1/1}:host .tls-button.tls-button--fluid{--tls-button-width: 100%}:host:has(.tls-button.tls-button--sm){--tls-button-height: var(--control-height-sm);--tls-button-padding-inline: var(--spacing-3);--tls-button-font-size: var(--font-label-small-size);--tls-button-font-weight: var(--font-label-small-weight);--tls-button-line-height: var(--font-label-small-line-height);--tls-button-letter-spacing: var(--font-label-small-letter-spacing)}:host:has(.tls-button.tls-button--md){--tls-button-height: var(--control-height-md);--tls-button-padding-inline: var(--spacing-4);--tls-button-font-size: var(--font-label-medium-size);--tls-button-font-weight: var(--font-label-medium-weight);--tls-button-line-height: var(--font-label-medium-line-height);--tls-button-letter-spacing: var(--font-label-medium-letter-spacing)}:host:has(.tls-button.tls-button--lg){--tls-button-height: var(--control-height-lg);--tls-button-padding-inline: var(--spacing-5);--tls-button-font-size: var(--font-label-large-size);--tls-button-font-weight: var(--font-label-large-weight);--tls-button-line-height: var(--font-label-large-line-height);--tls-button-letter-spacing: var(--font-label-large-letter-spacing)}\n"] }]
|
|
168
|
+
}], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], 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 }] }], appearance: [{ type: i0.Input, args: [{ isSignal: true, alias: "appearance", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], href: [{ type: i0.Input, args: [{ isSignal: true, alias: "href", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
|
|
169
|
+
|
|
170
|
+
const DEFAULT_DIVIDER_CONFIG = {
|
|
171
|
+
orientation: 'horizontal',
|
|
172
|
+
position: 'center',
|
|
173
|
+
variant: 'solid',
|
|
174
|
+
flush: false,
|
|
175
|
+
};
|
|
176
|
+
|
|
177
|
+
const DIVIDER_CONFIG = new InjectionToken('DIVIDER_CONFIG', {
|
|
178
|
+
factory: () => DEFAULT_DIVIDER_CONFIG,
|
|
179
|
+
});
|
|
180
|
+
|
|
181
|
+
class Divider {
|
|
182
|
+
_config = inject(DIVIDER_CONFIG);
|
|
183
|
+
orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
|
|
184
|
+
position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
|
|
185
|
+
variant = input(this._config.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
|
|
186
|
+
flush = input(this._config.flush, { ...(ngDevMode ? { debugName: "flush" } : {}), transform: booleanAttribute });
|
|
187
|
+
hostClasses = computed(() => {
|
|
188
|
+
const className = 'tls-divider';
|
|
189
|
+
const array = [className];
|
|
190
|
+
array.push(`${className}--${this.orientation()}`);
|
|
191
|
+
array.push(`${className}--${this.position()}`);
|
|
192
|
+
array.push(`${className}--${this.variant()}`);
|
|
193
|
+
if (this.flush())
|
|
194
|
+
array.push(`${className}--flush`);
|
|
195
|
+
return array;
|
|
196
|
+
}, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
|
|
197
|
+
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Divider, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
198
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Divider, isStandalone: true, selector: "tls-divider", inputs: { orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, flush: { classPropertyName: "flush", publicName: "flush", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "separator" }, properties: { "aria-orientation": "orientation()", "class": "hostClasses()" } }, ngImport: i0, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n", styles: [":host.tls-divider{--tls-divider-line-color: var(--color-outline-variant);--tls-divider-line-size: 1px;--tls-divider-content-gap: var(--spacing-3);--tls-divider-inset: 5%;display:flex;align-items:center;justify-content:center;gap:var(--tls-divider-content-gap)}:host.tls-divider .tls-divider-content{min-width:fit-content}:host.tls-divider:has(.tls-divider-content:empty) .tls-divider-content{display:none}:host.tls-divider:has(.tls-divider-content:empty) .tls-divider-line.tls-divider-line--start{display:none}:host.tls-divider.tls-divider--horizontal .tls-divider-line{border-right-width:0;border-bottom-width:var(--tls-divider-line-size)}:host.tls-divider.tls-divider--vertical{flex-direction:column}:host.tls-divider.tls-divider--vertical .tls-divider-line{border-right-width:var(--tls-divider-line-size);border-bottom-width:0}:host.tls-divider.tls-divider--start .tls-divider-line.tls-divider-line--start{flex-basis:var(--tls-divider-inset)}:host.tls-divider.tls-divider--start.tls-divider--flush .tls-divider-line.tls-divider-line--start{display:none}:host.tls-divider.tls-divider--end .tls-divider-line.tls-divider-line--end{flex-basis:var(--tls-divider-inset)}:host.tls-divider.tls-divider--end.tls-divider--flush .tls-divider-line.tls-divider-line--end{display:none}:host.tls-divider.tls-divider--dashed{--tls-divider-line-variant: dashed}:host.tls-divider.tls-divider--dotted{--tls-divider-line-variant: dotted}:host.tls-divider.tls-divider--solid{--tls-divider-line-variant: solid}:host.tls-divider .tls-divider-line{flex-basis:100%;flex-grow:1;border-top-width:0;border-left-width:0;border-style:var(--tls-divider-line-variant);border-color:var(--tls-divider-line-color)}\n"] });
|
|
199
|
+
}
|
|
200
|
+
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Divider, decorators: [{
|
|
201
|
+
type: Component,
|
|
202
|
+
args: [{ selector: 'tls-divider', imports: [], host: {
|
|
203
|
+
role: 'separator',
|
|
204
|
+
'[aria-orientation]': 'orientation()',
|
|
205
|
+
'[class]': 'hostClasses()',
|
|
206
|
+
}, template: "<span class=\"tls-divider-line tls-divider-line--start\"></span>\n<div class=\"tls-divider-content\">\n <ng-content></ng-content>\n</div>\n<span class=\"tls-divider-line tls-divider-line--end\"></span>\n", styles: [":host.tls-divider{--tls-divider-line-color: var(--color-outline-variant);--tls-divider-line-size: 1px;--tls-divider-content-gap: var(--spacing-3);--tls-divider-inset: 5%;display:flex;align-items:center;justify-content:center;gap:var(--tls-divider-content-gap)}:host.tls-divider .tls-divider-content{min-width:fit-content}:host.tls-divider:has(.tls-divider-content:empty) .tls-divider-content{display:none}:host.tls-divider:has(.tls-divider-content:empty) .tls-divider-line.tls-divider-line--start{display:none}:host.tls-divider.tls-divider--horizontal .tls-divider-line{border-right-width:0;border-bottom-width:var(--tls-divider-line-size)}:host.tls-divider.tls-divider--vertical{flex-direction:column}:host.tls-divider.tls-divider--vertical .tls-divider-line{border-right-width:var(--tls-divider-line-size);border-bottom-width:0}:host.tls-divider.tls-divider--start .tls-divider-line.tls-divider-line--start{flex-basis:var(--tls-divider-inset)}:host.tls-divider.tls-divider--start.tls-divider--flush .tls-divider-line.tls-divider-line--start{display:none}:host.tls-divider.tls-divider--end .tls-divider-line.tls-divider-line--end{flex-basis:var(--tls-divider-inset)}:host.tls-divider.tls-divider--end.tls-divider--flush .tls-divider-line.tls-divider-line--end{display:none}:host.tls-divider.tls-divider--dashed{--tls-divider-line-variant: dashed}:host.tls-divider.tls-divider--dotted{--tls-divider-line-variant: dotted}:host.tls-divider.tls-divider--solid{--tls-divider-line-variant: solid}:host.tls-divider .tls-divider-line{flex-basis:100%;flex-grow:1;border-top-width:0;border-left-width:0;border-style:var(--tls-divider-line-variant);border-color:var(--tls-divider-line-color)}\n"] }]
|
|
207
|
+
}], propDecorators: { orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], flush: [{ type: i0.Input, args: [{ isSignal: true, alias: "flush", required: false }] }] } });
|
|
156
208
|
|
|
157
209
|
const DEFAULT_FORM_ITEM_ERROR_MESSAGES = {
|
|
158
210
|
required: () => 'This field is required',
|
|
@@ -351,6 +403,7 @@ const DEFAULT_INPUT_CONFIG = {
|
|
|
351
403
|
size: 'md',
|
|
352
404
|
type: 'text',
|
|
353
405
|
placeholder: '',
|
|
406
|
+
fluid: false,
|
|
354
407
|
};
|
|
355
408
|
|
|
356
409
|
const INPUT_CONFIG = new InjectionToken('INPUT_CONFIG', {
|
|
@@ -366,10 +419,13 @@ class Input extends ValueFormControl {
|
|
|
366
419
|
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
367
420
|
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
368
421
|
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
422
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
369
423
|
classes = computed(() => {
|
|
370
424
|
const className = 'tls-form-control';
|
|
371
425
|
const array = [className];
|
|
372
426
|
array.push(`${className}--${this.size()}`);
|
|
427
|
+
if (this.fluid())
|
|
428
|
+
array.push(`${className}--fluid`);
|
|
373
429
|
return array.concat(this.controlClasses());
|
|
374
430
|
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
375
431
|
// Protected methods
|
|
@@ -378,12 +434,12 @@ class Input extends ValueFormControl {
|
|
|
378
434
|
this.value.set(target.value);
|
|
379
435
|
}
|
|
380
436
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Input, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
381
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Input, isStandalone: true, selector: "tls-input", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Input) }], usesInheritance: true, ngImport: i0, template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n", styles: [":host{display:inline-block}\n"] });
|
|
437
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Input, isStandalone: true, selector: "tls-input", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, 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" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Input) }], usesInheritance: true, ngImport: i0, template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] });
|
|
382
438
|
}
|
|
383
439
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Input, decorators: [{
|
|
384
440
|
type: Component,
|
|
385
|
-
args: [{ selector: 'tls-input', providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Input) }], template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n", styles: [":host{display:inline-block}\n"] }]
|
|
386
|
-
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
441
|
+
args: [{ selector: 'tls-input', providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Input) }], template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] }]
|
|
442
|
+
}], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], 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 }] }] } });
|
|
387
443
|
|
|
388
444
|
class InputDirective {
|
|
389
445
|
size = input('md', ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
@@ -409,6 +465,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
|
|
|
409
465
|
const DEFAULT_PASSWORD_CONFIG = {
|
|
410
466
|
size: 'md',
|
|
411
467
|
placeholder: '',
|
|
468
|
+
fluid: false,
|
|
412
469
|
};
|
|
413
470
|
|
|
414
471
|
const PASSWORD_CONFIG = new InjectionToken('PASSWORD_CONFIG', {
|
|
@@ -422,10 +479,13 @@ class Password extends ValueFormControl {
|
|
|
422
479
|
inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
|
|
423
480
|
placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
|
|
424
481
|
size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
|
|
482
|
+
fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
|
|
425
483
|
classes = computed(() => {
|
|
426
484
|
const className = 'tls-form-control-group';
|
|
427
485
|
const array = [className];
|
|
428
486
|
array.push(`${className}--${this.size()}`);
|
|
487
|
+
if (this.fluid())
|
|
488
|
+
array.push(`${className}--fluid`);
|
|
429
489
|
return array;
|
|
430
490
|
}, ...(ngDevMode ? [{ debugName: "classes" }] : []));
|
|
431
491
|
type = computed(() => (this.visible() ? 'text' : 'password'), ...(ngDevMode ? [{ debugName: "type" }] : []));
|
|
@@ -440,14 +500,14 @@ class Password extends ValueFormControl {
|
|
|
440
500
|
this.visible.update(prev => !prev);
|
|
441
501
|
}
|
|
442
502
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, deps: null, target: i0.ɵɵFactoryTarget.Component });
|
|
443
|
-
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", 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 }, inputId: { classPropertyName: "inputId", publicName: "inputId", 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 } }, outputs: { value: "valueChange", visible: "visibleChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], usesInheritance: true, ngImport: i0, template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n<button class=\"tls-password-toggle tls-form-control-addon\" (click)=\"toggle()\">\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n <span class=\"text-label-md\">Show</span>\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n <span class=\"text-label-md\">Hide</span>\n </span>\n</button>\n", styles: [":host{display:inline-flex}:host .tls-password-toggle{display:grid;align-items:center}:host .tls-password-toggle:focus-visible{outline:var(--control-focus-ring-width) solid var(--control-focus-ring-color);outline-offset:var(--control-focus-ring-offset);border-radius:var(--radius-md)}:host .tls-password-toggle__item{grid-area:1/1;text-align:center}:host .tls-password-toggle__item--hidden{visibility:hidden}\n"] });
|
|
503
|
+
static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", 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 }, inputId: { classPropertyName: "inputId", publicName: "inputId", 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: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], usesInheritance: true, ngImport: i0, template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n<button class=\"tls-password-toggle tls-form-control-addon\" (click)=\"toggle()\">\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n <span class=\"text-label-md\">Show</span>\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n <span class=\"text-label-md\">Hide</span>\n </span>\n</button>\n", styles: [":host{display:inline-flex}:host .tls-password-toggle{display:grid;align-items:center}:host .tls-password-toggle:focus-visible{outline:var(--control-focus-ring-width) solid var(--control-focus-ring-color);outline-offset:var(--control-focus-ring-offset);border-radius:var(--radius-md)}:host .tls-password-toggle__item{grid-area:1/1;text-align:center}:host .tls-password-toggle__item--hidden{visibility:hidden}\n"] });
|
|
444
504
|
}
|
|
445
505
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, decorators: [{
|
|
446
506
|
type: Component,
|
|
447
507
|
args: [{ selector: 'tls-password', host: {
|
|
448
508
|
'[class]': 'classes()',
|
|
449
509
|
}, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Password) }], template: "<input\n [type]=\"type()\"\n [name]=\"name()\"\n [class]=\"controlClasses()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n/>\n<button class=\"tls-password-toggle tls-form-control-addon\" (click)=\"toggle()\">\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"visible()\">\n <span class=\"text-label-md\">Show</span>\n </span>\n <span class=\"tls-password-toggle__item\" [class.tls-password-toggle__item--hidden]=\"!visible()\">\n <span class=\"text-label-md\">Hide</span>\n </span>\n</button>\n", styles: [":host{display:inline-flex}:host .tls-password-toggle{display:grid;align-items:center}:host .tls-password-toggle:focus-visible{outline:var(--control-focus-ring-width) solid var(--control-focus-ring-color);outline-offset:var(--control-focus-ring-offset);border-radius:var(--radius-md)}:host .tls-password-toggle__item{grid-area:1/1;text-align:center}:host .tls-password-toggle__item--hidden{visibility:hidden}\n"] }]
|
|
450
|
-
}], 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"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }] } });
|
|
510
|
+
}], 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"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], 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 }] }] } });
|
|
451
511
|
|
|
452
512
|
const DEFAULT_RADIO_BUTTON_CONFIG = {};
|
|
453
513
|
|
|
@@ -542,13 +602,16 @@ const DARK_THEME_CLASS = 'tls-dark';
|
|
|
542
602
|
|
|
543
603
|
const DEFAULT_THEME_CONFIG = {
|
|
544
604
|
defaultTheme: 'system',
|
|
545
|
-
localStorageKey: 'tls-theme',
|
|
605
|
+
localStorageKey: 'tls-theme-preference',
|
|
546
606
|
};
|
|
547
607
|
|
|
548
608
|
const THEME_CONFIG = new InjectionToken('THEME_CONFIG', {
|
|
549
609
|
factory: () => DEFAULT_THEME_CONFIG,
|
|
550
610
|
});
|
|
551
611
|
|
|
612
|
+
/**
|
|
613
|
+
* Service responsible for managing the application's theme (light/dark/system).
|
|
614
|
+
*/
|
|
552
615
|
class ThemeService {
|
|
553
616
|
// Injections
|
|
554
617
|
_config = inject(THEME_CONFIG);
|
|
@@ -560,62 +623,94 @@ class ThemeService {
|
|
|
560
623
|
LS_THEME = this._config.localStorageKey;
|
|
561
624
|
// Private
|
|
562
625
|
_currentTheme = signal('light', ...(ngDevMode ? [{ debugName: "_currentTheme" }] : []));
|
|
626
|
+
_currentThemePreference = signal('light', ...(ngDevMode ? [{ debugName: "_currentThemePreference" }] : []));
|
|
563
627
|
constructor() {
|
|
564
628
|
this._initTheme();
|
|
565
629
|
effect(() => {
|
|
566
630
|
if (this._isBrowser)
|
|
567
|
-
localStorage.setItem(this.LS_THEME, this.
|
|
631
|
+
localStorage.setItem(this.LS_THEME, this._currentThemePreference());
|
|
568
632
|
});
|
|
569
633
|
}
|
|
570
634
|
// Accessors
|
|
635
|
+
/**
|
|
636
|
+
* A readonly signal of the currently applied theme (`'light'` or `'dark'`).
|
|
637
|
+
* Reflects the resolved theme even when the preference is `'system'`.
|
|
638
|
+
*/
|
|
571
639
|
get currentTheme() {
|
|
572
640
|
return this._currentTheme.asReadonly();
|
|
573
641
|
}
|
|
642
|
+
/**
|
|
643
|
+
* A readonly signal of the user's selected theme preference (`'light'`, `'dark'`, or `'system'`).
|
|
644
|
+
*/
|
|
645
|
+
get currentThemePreference() {
|
|
646
|
+
return this._currentThemePreference.asReadonly();
|
|
647
|
+
}
|
|
574
648
|
// Public methods
|
|
649
|
+
/**
|
|
650
|
+
* Toggles between `'light'` and `'dark'` themes based on the currently applied theme.
|
|
651
|
+
* Does not toggle to `'system'`.
|
|
652
|
+
*/
|
|
575
653
|
toggle() {
|
|
576
654
|
this.setTheme(this._currentTheme() === 'light' ? 'dark' : 'light');
|
|
577
655
|
}
|
|
578
|
-
|
|
656
|
+
/**
|
|
657
|
+
* Sets the theme preference and applies the corresponding theme to the document.
|
|
658
|
+
* When `'system'` is passed, the theme is resolved from the OS color scheme preference.
|
|
659
|
+
*
|
|
660
|
+
* @param preference - The desired theme preference: `'light'`, `'dark'`, or `'system'`.
|
|
661
|
+
*/
|
|
662
|
+
setTheme(preference) {
|
|
663
|
+
this._currentThemePreference.set(preference);
|
|
664
|
+
if (preference === 'system') {
|
|
665
|
+
this._applyTheme(this._detectSystemTheme());
|
|
666
|
+
}
|
|
667
|
+
else {
|
|
668
|
+
this._applyTheme(preference);
|
|
669
|
+
}
|
|
670
|
+
}
|
|
671
|
+
// Private methods
|
|
672
|
+
/**
|
|
673
|
+
* Applies the given theme to the document root element by toggling theme CSS classes.
|
|
674
|
+
*
|
|
675
|
+
* @param theme - The theme to apply: `'light'` or `'dark'`.
|
|
676
|
+
*/
|
|
677
|
+
_applyTheme(theme) {
|
|
579
678
|
const documentElement = this._document.documentElement;
|
|
580
|
-
const lightThemeClass = LIGHT_THEME_CLASS;
|
|
581
|
-
const darkThemeClass = DARK_THEME_CLASS;
|
|
582
679
|
if (theme === 'dark') {
|
|
583
|
-
this._renderer.removeClass(documentElement,
|
|
584
|
-
this._renderer.addClass(documentElement,
|
|
680
|
+
this._renderer.removeClass(documentElement, LIGHT_THEME_CLASS);
|
|
681
|
+
this._renderer.addClass(documentElement, DARK_THEME_CLASS);
|
|
585
682
|
this._currentTheme.set('dark');
|
|
586
683
|
}
|
|
587
684
|
else {
|
|
588
|
-
this._renderer.removeClass(documentElement,
|
|
589
|
-
this._renderer.addClass(documentElement,
|
|
685
|
+
this._renderer.removeClass(documentElement, DARK_THEME_CLASS);
|
|
686
|
+
this._renderer.addClass(documentElement, LIGHT_THEME_CLASS);
|
|
590
687
|
this._currentTheme.set('light');
|
|
591
688
|
}
|
|
592
689
|
}
|
|
593
|
-
|
|
690
|
+
/**
|
|
691
|
+
* Detects the OS-level color scheme preference using the `prefers-color-scheme` media query.
|
|
692
|
+
*
|
|
693
|
+
* @returns `'dark'` if the OS prefers dark mode, otherwise `'light'`.
|
|
694
|
+
*/
|
|
594
695
|
_detectSystemTheme() {
|
|
595
696
|
return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
|
|
596
697
|
}
|
|
698
|
+
/**
|
|
699
|
+
* Initializes the theme on app startup (browser only).
|
|
700
|
+
* Reads the stored preference from localStorage, falling back to the configured default.
|
|
701
|
+
* Also registers a listener for OS color scheme changes to reactively update the theme
|
|
702
|
+
* when the preference is `'system'`.
|
|
703
|
+
*/
|
|
597
704
|
_initTheme() {
|
|
598
705
|
if (!this._isBrowser)
|
|
599
706
|
return;
|
|
600
|
-
const
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
|
|
605
|
-
|
|
606
|
-
|
|
607
|
-
_initDefaultTheme() {
|
|
608
|
-
if (this._config.defaultTheme === 'system') {
|
|
609
|
-
this.setTheme(this._detectSystemTheme());
|
|
610
|
-
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
|
611
|
-
if (!localStorage.getItem(this.LS_THEME)) {
|
|
612
|
-
this.setTheme(event.matches ? 'dark' : 'light');
|
|
613
|
-
}
|
|
614
|
-
});
|
|
615
|
-
}
|
|
616
|
-
else {
|
|
617
|
-
this.setTheme(this._config.defaultTheme);
|
|
618
|
-
}
|
|
707
|
+
const stored = localStorage.getItem(this.LS_THEME);
|
|
708
|
+
this.setTheme(stored ?? this._config.defaultTheme);
|
|
709
|
+
window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
|
|
710
|
+
if (this._currentThemePreference() === 'system') {
|
|
711
|
+
this._applyTheme(event.matches ? 'dark' : 'light');
|
|
712
|
+
}
|
|
713
|
+
});
|
|
619
714
|
}
|
|
620
715
|
static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
|
|
621
716
|
static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService });
|
|
@@ -649,6 +744,10 @@ const provideThalassicUIConfig = (config) => {
|
|
|
649
744
|
provide: BUTTON_CONFIG,
|
|
650
745
|
useValue: mergeConfig(DEFAULT_BUTTON_CONFIG, config.components.button),
|
|
651
746
|
},
|
|
747
|
+
{
|
|
748
|
+
provide: DIVIDER_CONFIG,
|
|
749
|
+
useValue: mergeConfig(DEFAULT_DIVIDER_CONFIG, config.components.divider),
|
|
750
|
+
},
|
|
652
751
|
{ provide: INPUT_CONFIG, useValue: mergeConfig(DEFAULT_INPUT_CONFIG, config.components.input) },
|
|
653
752
|
{
|
|
654
753
|
provide: PASSWORD_CONFIG,
|
|
@@ -670,6 +769,7 @@ const provideTheme = (config) => {
|
|
|
670
769
|
return makeEnvironmentProviders([
|
|
671
770
|
{ provide: THEME_CONFIG, useValue: { ...DEFAULT_THEME_CONFIG, ...config } },
|
|
672
771
|
ThemeService,
|
|
772
|
+
provideEnvironmentInitializer(() => inject(ThemeService)),
|
|
673
773
|
]);
|
|
674
774
|
};
|
|
675
775
|
|
|
@@ -677,5 +777,5 @@ const provideTheme = (config) => {
|
|
|
677
777
|
* Generated bundle index. Do not edit.
|
|
678
778
|
*/
|
|
679
779
|
|
|
680
|
-
export { BUTTON_CONFIG, Button, CHECKBOX_CONFIG, Checkbox, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SWITCH_CONFIG, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, PASSWORD_CONFIG, Password, RADIO_BUTTON_CONFIG, RadioButton, SWITCH_CONFIG, Switch, ThemeService, provideThalassicUIConfig, provideTheme };
|
|
780
|
+
export { BUTTON_CONFIG, Button, CHECKBOX_CONFIG, Checkbox, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SWITCH_CONFIG, DIVIDER_CONFIG, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, PASSWORD_CONFIG, Password, RADIO_BUTTON_CONFIG, RadioButton, SWITCH_CONFIG, Switch, ThemeService, provideThalassicUIConfig, provideTheme };
|
|
681
781
|
//# sourceMappingURL=thalassic-ui.mjs.map
|