@thalassic/ui 0.8.2 → 0.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.
@@ -1,15 +1,15 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, Injectable, model, contentChild, ViewContainerRef, DestroyRef, viewChild, signal, output, effect, forwardRef, viewChildren, contentChildren, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
3
- import { NgTemplateOutlet } from '@angular/common';
4
- import { RouterLink } from '@angular/router';
2
+ import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, signal, contentChild, model, effect, forwardRef, Injectable, ViewContainerRef, DestroyRef, viewChild, output, viewChildren, numberAttribute, contentChildren, isDevMode, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
3
+ import { LocationStrategy, NgTemplateOutlet } from '@angular/common';
4
+ import { RouterLink, Router } from '@angular/router';
5
5
  import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
6
6
  import { CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
7
7
  import { format, startOfMonth, endOfMonth, eachDayOfInterval, endOfWeek, startOfWeek, subMonths, addMonths, isSameDay, isSameMonth, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, startOfDay, setHours, setMinutes, setYear } from 'date-fns';
8
8
  import { Overlay } from '@angular/cdk/overlay';
9
9
  import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
10
+ import { filter, throwError, map, shareReplay } from 'rxjs';
10
11
  import { HttpClient } from '@angular/common/http';
11
12
  import { DomSanitizer } from '@angular/platform-browser';
12
- import { throwError, map, shareReplay } from 'rxjs';
13
13
  import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
14
14
  import { deepMerge } from '@thalassic/core';
15
15
 
@@ -122,6 +122,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
122
122
  class Button extends ButtonBase {
123
123
  // Injections
124
124
  _routerLink = inject(RouterLink, { optional: true });
125
+ _router = inject(Router, { optional: true });
126
+ _locationStrategy = inject(LocationStrategy, { optional: true });
125
127
  APPLY_HOST_CLASSES = false;
126
128
  // Inputs
127
129
  /** The text label displayed inside the button. Takes priority over projected content. */
@@ -132,14 +134,55 @@ class Button extends ButtonBase {
132
134
  tabindex = input('0', ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
133
135
  // Computed
134
136
  isLink = computed(() => Boolean(this._routerLink || this.href()), ...(ngDevMode ? [{ debugName: "isLink" }] : []));
137
+ /**
138
+ * Resolved URL placed on the inner anchor so the browser treats it as a real link
139
+ * (enables "Open in new tab", middle-click, status-bar preview, etc.). An explicit
140
+ * `href` wins; otherwise the URL is derived from the host `routerLink`.
141
+ */
142
+ linkHref = computed(() => {
143
+ if (this.disabled())
144
+ return null;
145
+ const explicitHref = this.href();
146
+ if (explicitHref)
147
+ return explicitHref;
148
+ const urlTree = this._routerLink?.urlTree;
149
+ if (!urlTree || !this._router)
150
+ return null;
151
+ const serialized = this._router.serializeUrl(urlTree);
152
+ return this._locationStrategy?.prepareExternalUrl(serialized) ?? serialized;
153
+ }, ...(ngDevMode ? [{ debugName: "linkHref" }] : []));
154
+ // Protected methods
155
+ /**
156
+ * Keeps navigation correct when the host carries a `routerLink` while the inner anchor
157
+ * exposes a real `href`:
158
+ * - modified / non-primary clicks bubble to the browser so it can open a new tab, and
159
+ * are stopped from reaching the host RouterLink to avoid a duplicate in-app navigation;
160
+ * - a plain left click defers to the host RouterLink for SPA navigation, so the anchor's
161
+ * own full-page navigation is prevented.
162
+ */
163
+ onLinkClick(event) {
164
+ if (this.disabled()) {
165
+ event.preventDefault();
166
+ event.stopPropagation();
167
+ return;
168
+ }
169
+ // Pure href links (no routerLink) navigate natively — nothing to coordinate.
170
+ if (!this._routerLink)
171
+ return;
172
+ if (event.button !== 0 || event.ctrlKey || event.metaKey || event.shiftKey || event.altKey) {
173
+ event.stopPropagation();
174
+ return;
175
+ }
176
+ event.preventDefault();
177
+ }
135
178
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Button, deps: null, target: i0.ɵɵFactoryTarget.Component });
136
- 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 }, 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]=\"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 @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"] }] });
179
+ 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 }, 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-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 [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"] }] });
137
180
  }
138
181
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Button, decorators: [{
139
182
  type: Component,
140
183
  args: [{ selector: 'tls-button', imports: [NgTemplateOutlet], host: {
141
184
  '[tabindex]': '-1',
142
- }, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.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 @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"] }]
185
+ }, template: "@if (isLink()) {\n <a\n role=\"link\"\n [class]=\"classes()\"\n [attr.href]=\"linkHref()\"\n [tabindex]=\"tabindex()\"\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 [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"] }]
143
186
  }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", 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 }] }] } });
144
187
 
145
188
  class ButtonDirective extends ButtonBase {
@@ -153,6 +196,204 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
153
196
  }]
154
197
  }] });
155
198
 
199
+ const DEFAULT_CHIP_CONFIG = {
200
+ color: 'primary',
201
+ variant: 'filled',
202
+ size: 'md',
203
+ };
204
+
205
+ const CHIP_CONFIG = new InjectionToken('CHIP_CONFIG', {
206
+ factory: () => DEFAULT_CHIP_CONFIG,
207
+ });
208
+
209
+ class Chip {
210
+ _config = inject(CHIP_CONFIG);
211
+ label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
212
+ color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
213
+ variant = input(this._config.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
214
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
215
+ rounded = input(false, { ...(ngDevMode ? { debugName: "rounded" } : {}), transform: booleanAttribute });
216
+ icon = input(false, { ...(ngDevMode ? { debugName: "icon" } : {}), transform: booleanAttribute });
217
+ context = signal({
218
+ checked: false,
219
+ disabled: false,
220
+ readonly: false,
221
+ touched: false,
222
+ dirty: false,
223
+ invalid: false,
224
+ pending: false,
225
+ }, ...(ngDevMode ? [{ debugName: "context" }] : []));
226
+ startIconTemplate = contentChild('startIcon', ...(ngDevMode ? [{ debugName: "startIconTemplate" }] : []));
227
+ endIconTemplate = contentChild('endIcon', ...(ngDevMode ? [{ debugName: "endIconTemplate" }] : []));
228
+ classes = computed(() => {
229
+ const className = 'tls-chip';
230
+ const array = [className];
231
+ array.push(`${className}--${this.color()}`);
232
+ array.push(`${className}--${this.variant()}`);
233
+ array.push(`${className}--${this.size()}`);
234
+ if (this.rounded())
235
+ array.push(`${className}--rounded`);
236
+ if (this.icon())
237
+ array.push(`${className}--icon`);
238
+ return array;
239
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
240
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chip, deps: [], target: i0.ɵɵFactoryTarget.Component });
241
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Chip, isStandalone: true, selector: "tls-chip", inputs: { label: { classPropertyName: "label", publicName: "label", 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 }, icon: { classPropertyName: "icon", publicName: "icon", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "classes()" } }, queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "endIconTemplate", first: true, predicate: ["endIcon"], descendants: true, isSignal: true }], ngImport: i0, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
242
+ }
243
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chip, decorators: [{
244
+ type: Component,
245
+ args: [{ selector: 'tls-chip', imports: [NgTemplateOutlet], host: {
246
+ '[class]': 'classes()',
247
+ }, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n" }]
248
+ }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", 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 }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], endIconTemplate: [{ type: i0.ContentChild, args: ['endIcon', { isSignal: true }] }] } });
249
+
250
+ const FORM_CONTROL = new InjectionToken('FORM_CONTROL');
251
+ class FormControl {
252
+ // Models
253
+ touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : []));
254
+ // Inputs
255
+ name = input('', ...(ngDevMode ? [{ debugName: "name" }] : []));
256
+ disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
257
+ readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
258
+ hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : {}), transform: booleanAttribute });
259
+ invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : {}), transform: booleanAttribute });
260
+ pending = input(false, { ...(ngDevMode ? { debugName: "pending" } : {}), transform: booleanAttribute });
261
+ dirty = input(false, { ...(ngDevMode ? { debugName: "dirty" } : {}), transform: booleanAttribute });
262
+ errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : []));
263
+ required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
264
+ CLASS_NAME = 'tls-form-control';
265
+ notInteractive = computed(() => this.disabled() || this.readonly(), ...(ngDevMode ? [{ debugName: "notInteractive" }] : []));
266
+ controlClasses = computed(() => this.baseControlClasses(), ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
267
+ // Protected methods
268
+ baseControlClasses() {
269
+ const className = this.CLASS_NAME;
270
+ const array = [className];
271
+ if (this.disabled())
272
+ array.push(`${className}--disabled`);
273
+ if (this.readonly())
274
+ array.push(`${className}--readonly`);
275
+ if (this.invalid())
276
+ array.push(`${className}--invalid`);
277
+ if (this.pending())
278
+ array.push(`${className}--pending`);
279
+ if (this.touched())
280
+ array.push(`${className}--touched`);
281
+ if (this.dirty())
282
+ array.push(`${className}--dirty`);
283
+ return array;
284
+ }
285
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
286
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: FormControl, isStandalone: true, inputs: { touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange" }, ngImport: i0 });
287
+ }
288
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, decorators: [{
289
+ type: Directive
290
+ }], propDecorators: { touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }] } });
291
+
292
+ class CheckboxFormControl extends FormControl {
293
+ controlClasses = computed(() => {
294
+ const classes = this.baseControlClasses();
295
+ if (this.checked())
296
+ classes.push(`${this.CLASS_NAME}--checked`);
297
+ return classes;
298
+ }, ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
299
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
300
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: CheckboxFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
301
+ }
302
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, decorators: [{
303
+ type: Directive
304
+ }] });
305
+
306
+ function normalizeOptions(options, keys) {
307
+ return options.map(option => {
308
+ if (typeof option === 'string' || typeof option === 'number') {
309
+ return { value: option, label: String(option), disabled: false };
310
+ }
311
+ const typed = option;
312
+ return {
313
+ value: (keys.value ? typed[keys.value] : typed),
314
+ label: String(keys.label ? typed[keys.label] : typed),
315
+ disabled: Boolean(keys.disabled ? typed[keys.disabled] : false),
316
+ };
317
+ });
318
+ }
319
+
320
+ class ValueFormControl extends FormControl {
321
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
322
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: ValueFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
323
+ }
324
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, decorators: [{
325
+ type: Directive
326
+ }] });
327
+
328
+ const DEFAULT_CHIP_CONTROL_CONFIG = {
329
+ checkedColor: undefined,
330
+ };
331
+
332
+ const CHIP_CONTROL_CONFIG = new InjectionToken('CHIP_CONTROL_CONFIG', {
333
+ factory: () => DEFAULT_CHIP_CONTROL_CONFIG,
334
+ });
335
+
336
+ class ChipControl extends CheckboxFormControl {
337
+ CLASS_NAME = 'tls-chip';
338
+ _config = inject(CHIP_CONTROL_CONFIG);
339
+ _chip = inject(Chip);
340
+ checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
341
+ checkedColor = input(this._config.checkedColor, ...(ngDevMode ? [{ debugName: "checkedColor" }] : []));
342
+ hostClasses = computed(() => {
343
+ const classes = ['tls-chip--control'];
344
+ if (this.checked()) {
345
+ classes.push('tls-chip--checked');
346
+ const color = this.checkedColor();
347
+ if (color)
348
+ classes.push(`tls-chip--checked-${color}`);
349
+ }
350
+ if (this.disabled())
351
+ classes.push('tls-chip--disabled');
352
+ return classes;
353
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
354
+ constructor() {
355
+ super();
356
+ effect(() => this._chip.context.set({
357
+ checked: this.checked(),
358
+ disabled: this.disabled(),
359
+ readonly: this.readonly(),
360
+ touched: this.touched(),
361
+ dirty: this.dirty(),
362
+ invalid: this.invalid(),
363
+ pending: this.pending(),
364
+ }));
365
+ }
366
+ toggle() {
367
+ if (this.notInteractive())
368
+ return;
369
+ this.checked.update(prev => !prev);
370
+ }
371
+ onKeyboardToggle(event) {
372
+ event.preventDefault();
373
+ this.toggle();
374
+ }
375
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
376
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ChipControl, isStandalone: true, selector: "tls-chip[tlsChipControl]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "click": "toggle()", "blur": "touched.set(true)", "keydown.space": "onKeyboardToggle($event)", "keydown.enter": "onKeyboardToggle($event)" }, properties: { "class": "hostClasses()", "tabindex": "disabled() ? -1 : 0", "attr.aria-checked": "checked()", "attr.aria-disabled": "disabled()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipControl) }], usesInheritance: true, ngImport: i0 });
377
+ }
378
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipControl, decorators: [{
379
+ type: Directive,
380
+ args: [{
381
+ selector: 'tls-chip[tlsChipControl]',
382
+ host: {
383
+ role: 'checkbox',
384
+ '[class]': 'hostClasses()',
385
+ '[tabindex]': 'disabled() ? -1 : 0',
386
+ '[attr.aria-checked]': 'checked()',
387
+ '[attr.aria-disabled]': 'disabled()',
388
+ '(click)': 'toggle()',
389
+ '(blur)': 'touched.set(true)',
390
+ '(keydown.space)': 'onKeyboardToggle($event)',
391
+ '(keydown.enter)': 'onKeyboardToggle($event)',
392
+ },
393
+ providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipControl) }],
394
+ }]
395
+ }], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], checkedColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedColor", required: false }] }] } });
396
+
156
397
  const DEFAULT_DIALOG_CONFIG = {
157
398
  size: 'md',
158
399
  closeable: true,
@@ -255,6 +496,58 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
255
496
  }, 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" }]
256
497
  }], 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 }] }] } });
257
498
 
499
+ class FormControlAddon {
500
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlAddon, deps: [], target: i0.ɵɵFactoryTarget.Component });
501
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: FormControlAddon, isStandalone: true, selector: "tls-form-control-addon", host: { classAttribute: "tls-form-control-addon" }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
502
+ }
503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlAddon, decorators: [{
504
+ type: Component,
505
+ args: [{
506
+ selector: 'tls-form-control-addon',
507
+ imports: [],
508
+ template: '<ng-content></ng-content>',
509
+ host: {
510
+ class: 'tls-form-control-addon',
511
+ },
512
+ }]
513
+ }] });
514
+
515
+ const DEFAULT_FORM_CONTROL_GROUP_CONFIG = {
516
+ size: 'md',
517
+ fluid: false,
518
+ };
519
+
520
+ const FORM_CONTROL_GROUP_CONFIG = new InjectionToken('FORM_CONTROL_GROUP_CONFIG', {
521
+ factory: () => DEFAULT_FORM_CONTROL_GROUP_CONFIG,
522
+ });
523
+
524
+ class FormControlGroup {
525
+ _config = inject(FORM_CONTROL_GROUP_CONFIG);
526
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
527
+ fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
528
+ hostClasses = computed(() => {
529
+ const className = 'tls-form-control-group';
530
+ const array = [className];
531
+ array.push(`${className}--${this.size()}`);
532
+ if (this.fluid())
533
+ array.push(`${className}--fluid`);
534
+ return array;
535
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
536
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlGroup, deps: [], target: i0.ɵɵFactoryTarget.Component });
537
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: FormControlGroup, isStandalone: true, selector: "tls-form-control-group", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, ngImport: i0, template: '<ng-content></ng-content>', isInline: true });
538
+ }
539
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControlGroup, decorators: [{
540
+ type: Component,
541
+ args: [{
542
+ selector: 'tls-form-control-group',
543
+ imports: [],
544
+ template: '<ng-content></ng-content>',
545
+ host: {
546
+ '[class]': 'hostClasses()',
547
+ },
548
+ }]
549
+ }], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }] } });
550
+
258
551
  const DEFAULT_FORM_ITEM_ERROR_MESSAGES = {
259
552
  required: () => 'This field is required',
260
553
  email: () => 'Enter a valid email address',
@@ -283,70 +576,6 @@ const DEFAULT_FORM_ITEM_CONFIG = {
283
576
  errorMessages: DEFAULT_FORM_ITEM_ERROR_MESSAGES,
284
577
  };
285
578
 
286
- const FORM_CONTROL = new InjectionToken('FORM_CONTROL');
287
- class FormControl {
288
- // Models
289
- touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : []));
290
- // Inputs
291
- name = input('', ...(ngDevMode ? [{ debugName: "name" }] : []));
292
- disabled = input(false, { ...(ngDevMode ? { debugName: "disabled" } : {}), transform: booleanAttribute });
293
- readonly = input(false, { ...(ngDevMode ? { debugName: "readonly" } : {}), transform: booleanAttribute });
294
- hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : {}), transform: booleanAttribute });
295
- invalid = input(false, { ...(ngDevMode ? { debugName: "invalid" } : {}), transform: booleanAttribute });
296
- pending = input(false, { ...(ngDevMode ? { debugName: "pending" } : {}), transform: booleanAttribute });
297
- dirty = input(false, { ...(ngDevMode ? { debugName: "dirty" } : {}), transform: booleanAttribute });
298
- errors = input([], ...(ngDevMode ? [{ debugName: "errors" }] : []));
299
- required = input(false, { ...(ngDevMode ? { debugName: "required" } : {}), transform: booleanAttribute });
300
- CLASS_NAME = 'tls-form-control';
301
- notInteractive = computed(() => this.disabled() || this.readonly(), ...(ngDevMode ? [{ debugName: "notInteractive" }] : []));
302
- controlClasses = computed(() => this.baseControlClasses(), ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
303
- // Protected methods
304
- baseControlClasses() {
305
- const className = this.CLASS_NAME;
306
- const array = [className];
307
- if (this.disabled())
308
- array.push(`${className}--disabled`);
309
- if (this.readonly())
310
- array.push(`${className}--readonly`);
311
- if (this.invalid())
312
- array.push(`${className}--invalid`);
313
- if (this.pending())
314
- array.push(`${className}--pending`);
315
- if (this.touched())
316
- array.push(`${className}--touched`);
317
- if (this.dirty())
318
- array.push(`${className}--dirty`);
319
- return array;
320
- }
321
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
322
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: FormControl, isStandalone: true, inputs: { touched: { classPropertyName: "touched", publicName: "touched", isSignal: true, isRequired: false, transformFunction: null }, name: { classPropertyName: "name", publicName: "name", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null }, readonly: { classPropertyName: "readonly", publicName: "readonly", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, invalid: { classPropertyName: "invalid", publicName: "invalid", isSignal: true, isRequired: false, transformFunction: null }, pending: { classPropertyName: "pending", publicName: "pending", isSignal: true, isRequired: false, transformFunction: null }, dirty: { classPropertyName: "dirty", publicName: "dirty", isSignal: true, isRequired: false, transformFunction: null }, errors: { classPropertyName: "errors", publicName: "errors", isSignal: true, isRequired: false, transformFunction: null }, required: { classPropertyName: "required", publicName: "required", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { touched: "touchedChange" }, ngImport: i0 });
323
- }
324
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FormControl, decorators: [{
325
- type: Directive
326
- }], propDecorators: { touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }] } });
327
-
328
- class CheckboxFormControl extends FormControl {
329
- controlClasses = computed(() => {
330
- const classes = this.baseControlClasses();
331
- if (this.checked())
332
- classes.push(`${this.CLASS_NAME}--checked`);
333
- return classes;
334
- }, ...(ngDevMode ? [{ debugName: "controlClasses" }] : []));
335
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
336
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: CheckboxFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
337
- }
338
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: CheckboxFormControl, decorators: [{
339
- type: Directive
340
- }] });
341
-
342
- class ValueFormControl extends FormControl {
343
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
344
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: ValueFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
345
- }
346
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, decorators: [{
347
- type: Directive
348
- }] });
349
-
350
579
  const FORM_ITEM_CONFIG = new InjectionToken('FORM_ITEM_CONFIG', {
351
580
  factory: () => DEFAULT_FORM_ITEM_CONFIG,
352
581
  });
@@ -448,6 +677,109 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
448
677
  }, template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\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<div class=\"tls-checkbox-icon\">\n @if (indeterminate()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M288-444v-72h384v72H288Z\" />\n </svg>\n } @else {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M400-301 240-461l51-51 109 109 269-269 51 51-320 320Z\" />\n </svg>\n }\n</div>\n" }]
449
678
  }], 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"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
450
679
 
680
+ const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
681
+ /**
682
+ * Owns the CDK-Overlay lifecycle shared by the library's connected overlay
683
+ * components (popover, menu, select): create/attach, dismissal wiring
684
+ * (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
685
+ * positional and dismissal differences between components are expressed through
686
+ * {@link ConnectedOverlayConfig} rather than duplicated per component.
687
+ *
688
+ * Create one via {@link createOverlayManager} from a component field initializer
689
+ * so it is bound to the host's injection context.
690
+ */
691
+ class OverlayManager {
692
+ _overlay = inject(Overlay);
693
+ _viewContainerRef = inject(ViewContainerRef);
694
+ _destroyRef = inject(DestroyRef);
695
+ _overlayRef = null;
696
+ _config = null;
697
+ _isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
698
+ isOpen = this._isOpen.asReadonly();
699
+ // Dispose the overlay with the host. Registered in a field initializer so no
700
+ // constructor is needed.
701
+ _teardown = this._destroyRef.onDestroy(() => this._dispose());
702
+ open(config) {
703
+ if (this._isOpen())
704
+ return;
705
+ this._config = config;
706
+ if (!this._overlayRef) {
707
+ this._overlayRef = this._overlay.create({
708
+ positionStrategy: this._buildPositionStrategy(config),
709
+ scrollStrategy: config.scrollStrategy === 'close'
710
+ ? this._overlay.scrollStrategies.close()
711
+ : this._overlay.scrollStrategies.reposition(),
712
+ hasBackdrop: config.hasBackdrop ?? true,
713
+ backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
714
+ ...(config.panelClass != null && { panelClass: config.panelClass }),
715
+ });
716
+ this._wireDismissal(this._overlayRef, config);
717
+ }
718
+ if (config.minWidth != null) {
719
+ this._overlayRef.updateSize({ minWidth: config.minWidth });
720
+ }
721
+ this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
722
+ this._isOpen.set(true);
723
+ }
724
+ close() {
725
+ if (!this._isOpen())
726
+ return;
727
+ if (this._config?.reuse) {
728
+ this._overlayRef?.detach();
729
+ }
730
+ else {
731
+ this._overlayRef?.dispose();
732
+ this._overlayRef = null;
733
+ }
734
+ this._isOpen.set(false);
735
+ this._config?.onClose?.();
736
+ }
737
+ // Private
738
+ _buildPositionStrategy(config) {
739
+ let strategy = this._overlay
740
+ .position()
741
+ .flexibleConnectedTo(config.origin)
742
+ .withPositions(config.positions);
743
+ if (config.flexibleDimensions === false)
744
+ strategy = strategy.withFlexibleDimensions(false);
745
+ if (config.push === false)
746
+ strategy = strategy.withPush(false);
747
+ return strategy;
748
+ }
749
+ _wireDismissal(overlayRef, config) {
750
+ const hasBackdrop = config.hasBackdrop ?? true;
751
+ if (config.closeOnBackdropClick ?? hasBackdrop) {
752
+ overlayRef
753
+ .backdropClick()
754
+ .pipe(takeUntilDestroyed(this._destroyRef))
755
+ .subscribe(() => this.close());
756
+ }
757
+ if (config.closeOnOutsidePointer ?? !hasBackdrop) {
758
+ overlayRef
759
+ .outsidePointerEvents()
760
+ .pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'))
761
+ .subscribe(() => this.close());
762
+ }
763
+ if (config.closeOnEscape ?? true) {
764
+ overlayRef
765
+ .keydownEvents()
766
+ .pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
767
+ .subscribe(() => this.close());
768
+ }
769
+ }
770
+ _dispose() {
771
+ this._overlayRef?.dispose();
772
+ this._overlayRef = null;
773
+ }
774
+ }
775
+ /**
776
+ * Creates an {@link OverlayManager} bound to the current injection context.
777
+ * Call from a component/directive field initializer or constructor.
778
+ */
779
+ function createOverlayManager() {
780
+ return new OverlayManager();
781
+ }
782
+
451
783
  const OVERLAY_POSITION_MAP = {
452
784
  top: {
453
785
  originX: 'center',
@@ -601,61 +933,35 @@ const POPOVER_CONFIG = new InjectionToken('POPOVER_CONFIG', {
601
933
 
602
934
  class Popover {
603
935
  static _counter = 0;
604
- _overlay = inject(Overlay);
605
- _viewContainerRef = inject(ViewContainerRef);
606
936
  _config = inject(POPOVER_CONFIG);
607
- _destroyRef = inject(DestroyRef);
937
+ _overlay = createOverlayManager();
608
938
  _templateRef = viewChild.required('content');
609
- _overlayRef = null;
610
- _isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
611
939
  id = `tls-popover-${++Popover._counter}`;
612
- isOpen = this._isOpen.asReadonly();
940
+ isOpen = this._overlay.isOpen;
613
941
  position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
614
942
  offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
615
943
  ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
616
944
  _positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
617
945
  // Public methods
618
946
  open(trigger) {
619
- if (this._overlayRef)
620
- return;
621
947
  const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
622
- const positionStrategy = this._overlay
623
- .position()
624
- .flexibleConnectedTo(origin)
625
- .withPositions(this._positions());
626
- this._overlayRef = this._overlay.create({
627
- positionStrategy,
628
- scrollStrategy: this._overlay.scrollStrategies.reposition(),
629
- hasBackdrop: true,
630
- backdropClass: 'cdk-overlay-transparent-backdrop',
948
+ this._overlay.open({
949
+ content: this._templateRef(),
950
+ origin,
951
+ positions: this._positions(),
631
952
  });
632
- this._overlayRef
633
- .backdropClick()
634
- .pipe(takeUntilDestroyed(this._destroyRef))
635
- .subscribe(() => this.close());
636
- this._overlayRef.attach(new TemplatePortal(this._templateRef(), this._viewContainerRef));
637
- this._isOpen.set(true);
638
953
  }
639
954
  close() {
640
- if (!this._overlayRef)
641
- return;
642
- this._overlayRef.dispose();
643
- this._overlayRef = null;
644
- this._isOpen.set(false);
955
+ this._overlay.close();
645
956
  }
646
957
  toggle(trigger) {
647
- if (this._overlayRef) {
958
+ if (this.isOpen()) {
648
959
  this.close();
649
960
  }
650
961
  else {
651
962
  this.open(trigger);
652
963
  }
653
964
  }
654
- // Lifecycle
655
- ngOnDestroy() {
656
- if (this._overlayRef)
657
- this._overlayRef.dispose();
658
- }
659
965
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Popover, deps: [], target: i0.ɵɵFactoryTarget.Component });
660
966
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: Popover, isStandalone: true, selector: "tls-popover", inputs: { position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, viewQueries: [{ propertyName: "_templateRef", first: true, predicate: ["content"], descendants: true, isSignal: true }], ngImport: i0, template: `
661
967
  <ng-template #content>
@@ -934,57 +1240,270 @@ class DateTimePicker extends ValueFormControl {
934
1240
  this.activeView.set(this.mode());
935
1241
  });
936
1242
  }
937
- // Protected methods
938
- onViewDateChange(date) {
939
- this.viewDate.set(date);
1243
+ // Protected methods
1244
+ onViewDateChange(date) {
1245
+ this.viewDate.set(date);
1246
+ }
1247
+ onDaySelect(date) {
1248
+ if (this.notInteractive())
1249
+ return;
1250
+ this.value.set(date);
1251
+ if (this.mode() === 'calendar') {
1252
+ this.popoverComponent()?.close();
1253
+ }
1254
+ }
1255
+ onMonthSelect(date) {
1256
+ this.viewDate.set(date);
1257
+ if (this.notInteractive())
1258
+ return;
1259
+ if (this.mode() === 'month-picker') {
1260
+ this.value.set(date);
1261
+ this.popoverComponent()?.close();
1262
+ }
1263
+ else if (this.mode() === 'date-time') {
1264
+ this.activeView.set('date-time');
1265
+ }
1266
+ else {
1267
+ this.activeView.set('calendar');
1268
+ }
1269
+ }
1270
+ onYearSelect(date) {
1271
+ this.viewDate.set(date);
1272
+ if (this.notInteractive())
1273
+ return;
1274
+ if (this.mode() === 'year-picker') {
1275
+ this.value.set(date);
1276
+ this.popoverComponent()?.close();
1277
+ }
1278
+ else {
1279
+ this.activeView.set('month-picker');
1280
+ }
1281
+ }
1282
+ onTimeChange(date) {
1283
+ if (this.notInteractive())
1284
+ return;
1285
+ this.value.set(date);
1286
+ }
1287
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1288
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: DateTimePicker, isStandalone: true, selector: "tls-date-time-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", 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 }, yearsPerPage: { classPropertyName: "yearsPerPage", publicName: "yearsPerPage", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], viewQueries: [{ propertyName: "popoverComponent", first: true, predicate: ["popoverRef"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"popoverRef.toggle($event)\"\n (blur)=\"touched.set(true)\"\n >\n <span [class.tls-form-control__placeholder]=\"!value()\">{{ triggerLabel() }}</span>\n </button>\n <tls-popover #popoverRef position=\"bottom-start\">\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n", dependencies: [{ kind: "component", type: Calendar, selector: "tls-calendar", inputs: ["viewDate", "selectedDate", "weekStartsOn", "weekDays"], outputs: ["daySelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: MonthPicker, selector: "tls-month-picker", inputs: ["viewDate", "selectedDate"], outputs: ["monthSelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: YearPicker, selector: "tls-year-picker", inputs: ["viewDate", "selectedDate", "yearsPerPage"], outputs: ["yearSelect", "viewDateChange"] }, { kind: "component", type: TimePicker, selector: "tls-time-picker", inputs: ["value"], outputs: ["timeChange"] }, { kind: "component", type: Popover, selector: "tls-popover", inputs: ["position", "offset", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
1289
+ }
1290
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, decorators: [{
1291
+ type: Component,
1292
+ args: [{ selector: 'tls-date-time-picker', imports: [Calendar, MonthPicker, YearPicker, TimePicker, Popover, NgTemplateOutlet], host: { '[class]': 'hostClasses()' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"popoverRef.toggle($event)\"\n (blur)=\"touched.set(true)\"\n >\n <span [class.tls-form-control__placeholder]=\"!value()\">{{ triggerLabel() }}</span>\n </button>\n <tls-popover #popoverRef position=\"bottom-start\">\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n" }]
1293
+ }], ctorParameters: () => [], propDecorators: { popoverComponent: [{ type: i0.ViewChild, args: ['popoverRef', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", 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 }] }], yearsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "yearsPerPage", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }] } });
1294
+
1295
+ const DEFAULT_CHIP_INPUT_CONFIG = {
1296
+ size: 'md',
1297
+ placeholder: '',
1298
+ fluid: false,
1299
+ separator: ['Enter'],
1300
+ };
1301
+
1302
+ const CHIP_INPUT_CONFIG = new InjectionToken('CHIP_INPUT_CONFIG', {
1303
+ factory: () => DEFAULT_CHIP_INPUT_CONFIG,
1304
+ });
1305
+
1306
+ class ChipInput extends ValueFormControl {
1307
+ _config = inject(CHIP_INPUT_CONFIG);
1308
+ value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
1309
+ placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
1310
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
1311
+ fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
1312
+ separator = input(this._config.separator, ...(ngDevMode ? [{ debugName: "separator" }] : []));
1313
+ inputValue = signal('', ...(ngDevMode ? [{ debugName: "inputValue" }] : []));
1314
+ classes = computed(() => {
1315
+ const className = this.CLASS_NAME;
1316
+ const array = [className, `${className}--${this.size()}`];
1317
+ if (this.fluid())
1318
+ array.push(`${className}--fluid`);
1319
+ return array.concat(this.controlClasses());
1320
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
1321
+ onKeydown(event) {
1322
+ if (this.notInteractive())
1323
+ return;
1324
+ if (this.separator().includes(event.key)) {
1325
+ event.preventDefault();
1326
+ this._addChip();
1327
+ return;
1328
+ }
1329
+ if (event.key === 'Backspace' && !this.inputValue()) {
1330
+ this.value.update(chips => chips.slice(0, -1));
1331
+ }
1332
+ }
1333
+ removeChip(index) {
1334
+ if (this.notInteractive())
1335
+ return;
1336
+ this.value.update(chips => chips.filter((_chip, chipIndex) => chipIndex !== index));
1337
+ }
1338
+ _addChip() {
1339
+ const text = this.inputValue().trim();
1340
+ if (!text || this.notInteractive())
1341
+ return;
1342
+ this.value.update(chips => [...chips, text]);
1343
+ this.inputValue.set('');
1344
+ }
1345
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
1346
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ChipInput, isStandalone: true, selector: "tls-chip-input", 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 }, separator: { classPropertyName: "separator", publicName: "separator", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], usesInheritance: true, ngImport: i0, template: "@for (chip of value(); track $index; let index = $index) {\n <tls-chip size=\"sm\" variant=\"filled\" color=\"primary\" [label]=\"chip\">\n <ng-template #endIcon>\n <button\n type=\"button\"\n class=\"tls-chip-input__remove\"\n [attr.aria-label]=\"'Remove ' + chip\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeChip(index)\"\n >\u00D7</button>\n </ng-template>\n </tls-chip>\n}\n<input\n class=\"tls-chip-input__field\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"inputValue()\"\n (input)=\"inputValue.set($any($event.target).value)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"touched.set(true)\"\n/>\n", dependencies: [{ kind: "component", type: Chip, selector: "tls-chip", inputs: ["label", "color", "variant", "size", "rounded", "icon"] }] });
1347
+ }
1348
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipInput, decorators: [{
1349
+ type: Component,
1350
+ args: [{ selector: 'tls-chip-input', imports: [Chip], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipInput) }], host: { '[class]': 'classes()' }, template: "@for (chip of value(); track $index; let index = $index) {\n <tls-chip size=\"sm\" variant=\"filled\" color=\"primary\" [label]=\"chip\">\n <ng-template #endIcon>\n <button\n type=\"button\"\n class=\"tls-chip-input__remove\"\n [attr.aria-label]=\"'Remove ' + chip\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeChip(index)\"\n >\u00D7</button>\n </ng-template>\n </tls-chip>\n}\n<input\n class=\"tls-chip-input__field\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [value]=\"inputValue()\"\n (input)=\"inputValue.set($any($event.target).value)\"\n (keydown)=\"onKeydown($event)\"\n (blur)=\"touched.set(true)\"\n/>\n" }]
1351
+ }], 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 }] }], separator: [{ type: i0.Input, args: [{ isSignal: true, alias: "separator", required: false }] }] } });
1352
+
1353
+ const DEFAULT_FILE_UPLOADER_CONFIG = {
1354
+ multiple: false,
1355
+ accept: '',
1356
+ fluid: false,
1357
+ };
1358
+
1359
+ const FILE_UPLOADER_CONFIG = new InjectionToken('FILE_UPLOADER_CONFIG', { factory: () => DEFAULT_FILE_UPLOADER_CONFIG });
1360
+
1361
+ function normalizeAccept(value) {
1362
+ return Array.isArray(value) ? value.join(',') : value;
1363
+ }
1364
+ class FileUploader extends ValueFormControl {
1365
+ _config = inject(FILE_UPLOADER_CONFIG);
1366
+ CLASS_NAME = 'tls-file-uploader';
1367
+ value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
1368
+ multiple = input(this._config.multiple, { ...(ngDevMode ? { debugName: "multiple" } : {}), transform: booleanAttribute });
1369
+ accept = input(normalizeAccept(this._config.accept), { ...(ngDevMode ? { debugName: "accept" } : {}), transform: normalizeAccept });
1370
+ fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
1371
+ fileInput = viewChild.required('fileInput');
1372
+ dragState = signal('idle', ...(ngDevMode ? [{ debugName: "dragState" }] : []));
1373
+ dropZoneTemplate = contentChild('dropZone', ...(ngDevMode ? [{ debugName: "dropZoneTemplate" }] : []));
1374
+ fileTemplate = contentChild('file', ...(ngDevMode ? [{ debugName: "fileTemplate" }] : []));
1375
+ classes = computed(() => {
1376
+ const className = this.CLASS_NAME;
1377
+ const array = [className];
1378
+ if (this.fluid())
1379
+ array.push(`${className}--fluid`);
1380
+ return array.concat(this.controlClasses());
1381
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
1382
+ acceptHint = computed(() => {
1383
+ const accept = this.accept().trim();
1384
+ if (!accept)
1385
+ return '';
1386
+ const labels = accept
1387
+ .split(',')
1388
+ .map(rule => rule.trim())
1389
+ .filter(Boolean)
1390
+ .map(rule => this._formatAcceptRule(rule));
1391
+ return [...new Set(labels)].join(', ');
1392
+ }, ...(ngDevMode ? [{ debugName: "acceptHint" }] : []));
1393
+ openFilePicker() {
1394
+ if (this.notInteractive())
1395
+ return;
1396
+ this.fileInput().nativeElement.click();
1397
+ }
1398
+ onFilesSelected(event) {
1399
+ const target = event.target;
1400
+ if (!target.files)
1401
+ return;
1402
+ this._addFiles(Array.from(target.files));
1403
+ target.value = '';
940
1404
  }
941
- onDaySelect(date) {
942
- if (this.notInteractive())
1405
+ onDropZoneKeydown(event) {
1406
+ if (event.key !== 'Enter' && event.key !== ' ')
943
1407
  return;
944
- this.value.set(date);
945
- if (this.mode() === 'calendar') {
946
- this.popoverComponent()?.close();
947
- }
1408
+ event.preventDefault();
1409
+ this.openFilePicker();
948
1410
  }
949
- onMonthSelect(date) {
950
- this.viewDate.set(date);
951
- if (this.notInteractive())
1411
+ onDragOver(event) {
1412
+ event.preventDefault();
1413
+ if (this.notInteractive() || !event.dataTransfer)
952
1414
  return;
953
- if (this.mode() === 'month-picker') {
954
- this.value.set(date);
955
- this.popoverComponent()?.close();
956
- }
957
- else if (this.mode() === 'date-time') {
958
- this.activeView.set('date-time');
959
- }
960
- else {
961
- this.activeView.set('calendar');
962
- }
1415
+ const draggedItems = Array.from(event.dataTransfer.items).filter(item => item.kind === 'file');
1416
+ const rejected = draggedItems.some(item => this._isTypeRejected(item.type));
1417
+ event.dataTransfer.dropEffect = rejected ? 'none' : 'copy';
1418
+ this.dragState.set(rejected ? 'invalid' : 'valid');
963
1419
  }
964
- onYearSelect(date) {
965
- this.viewDate.set(date);
1420
+ onDragLeave() {
1421
+ this.dragState.set('idle');
1422
+ }
1423
+ onDrop(event) {
1424
+ event.preventDefault();
1425
+ this.dragState.set('idle');
1426
+ if (this.notInteractive() || !event.dataTransfer)
1427
+ return;
1428
+ this._addFiles(Array.from(event.dataTransfer.files));
1429
+ }
1430
+ // Arrow function so it keeps `this` when passed through a custom file template context.
1431
+ removeFile = (fileIndex) => {
966
1432
  if (this.notInteractive())
967
1433
  return;
968
- if (this.mode() === 'year-picker') {
969
- this.value.set(date);
970
- this.popoverComponent()?.close();
1434
+ this.value.update(files => files.filter((_file, index) => index !== fileIndex));
1435
+ };
1436
+ // Private methods
1437
+ _addFiles(incoming) {
1438
+ const accepted = incoming.filter(file => this._acceptsFile(file));
1439
+ if (!accepted.length)
1440
+ return;
1441
+ this.touched.set(true);
1442
+ if (this.multiple()) {
1443
+ this.value.update(files => [...files, ...accepted]);
971
1444
  }
972
1445
  else {
973
- this.activeView.set('month-picker');
1446
+ this.value.set(accepted.slice(0, 1));
974
1447
  }
975
1448
  }
976
- onTimeChange(date) {
977
- if (this.notInteractive())
978
- return;
979
- this.value.set(date);
1449
+ _acceptsFile(file) {
1450
+ const accept = this.accept().trim();
1451
+ if (!accept)
1452
+ return true;
1453
+ const fileName = file.name.toLowerCase();
1454
+ const fileType = file.type.toLowerCase();
1455
+ return accept.split(',').some(rule => {
1456
+ const pattern = rule.trim().toLowerCase();
1457
+ if (!pattern)
1458
+ return false;
1459
+ if (pattern.startsWith('.'))
1460
+ return fileName.endsWith(pattern);
1461
+ if (pattern.endsWith('/*'))
1462
+ return fileType.startsWith(pattern.slice(0, -1));
1463
+ return fileType === pattern;
1464
+ });
980
1465
  }
981
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
982
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: DateTimePicker, isStandalone: true, selector: "tls-date-time-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, mode: { classPropertyName: "mode", publicName: "mode", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", 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 }, yearsPerPage: { classPropertyName: "yearsPerPage", publicName: "yearsPerPage", isSignal: true, isRequired: false, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: false, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], viewQueries: [{ propertyName: "popoverComponent", first: true, predicate: ["popoverRef"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"popoverRef.toggle($event)\"\n (blur)=\"touched.set(true)\"\n >\n <span [class.tls-form-control__placeholder]=\"!value()\">{{ triggerLabel() }}</span>\n </button>\n <tls-popover #popoverRef position=\"bottom-start\">\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n", dependencies: [{ kind: "component", type: Calendar, selector: "tls-calendar", inputs: ["viewDate", "selectedDate", "weekStartsOn", "weekDays"], outputs: ["daySelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: MonthPicker, selector: "tls-month-picker", inputs: ["viewDate", "selectedDate"], outputs: ["monthSelect", "viewDateChange", "navigateUp"] }, { kind: "component", type: YearPicker, selector: "tls-year-picker", inputs: ["viewDate", "selectedDate", "yearsPerPage"], outputs: ["yearSelect", "viewDateChange"] }, { kind: "component", type: TimePicker, selector: "tls-time-picker", inputs: ["value"], outputs: ["timeChange"] }, { kind: "component", type: Popover, selector: "tls-popover", inputs: ["position", "offset", "ariaLabel"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
1466
+ _formatAcceptRule(rule) {
1467
+ if (rule.startsWith('.'))
1468
+ return rule.slice(1).toUpperCase();
1469
+ if (rule.endsWith('/*')) {
1470
+ const category = rule.slice(0, -2);
1471
+ const categoryLabels = {
1472
+ image: 'Images',
1473
+ video: 'Videos',
1474
+ audio: 'Audio',
1475
+ };
1476
+ if (category in categoryLabels)
1477
+ return categoryLabels[category];
1478
+ return `${category.charAt(0).toUpperCase()}${category.slice(1)}`;
1479
+ }
1480
+ const subtype = rule.includes('/') ? rule.slice(rule.indexOf('/') + 1) : rule;
1481
+ return subtype.toUpperCase();
1482
+ }
1483
+ // Drag-time check: only the MIME type is exposed before drop, so reject a
1484
+ // dragged file only when we can be certain it fails purely MIME-based rules.
1485
+ _isTypeRejected(type) {
1486
+ const accept = this.accept().trim();
1487
+ if (!accept)
1488
+ return false;
1489
+ const rules = accept
1490
+ .split(',')
1491
+ .map(rule => rule.trim().toLowerCase())
1492
+ .filter(Boolean);
1493
+ const hasExtensionRule = rules.some(rule => rule.startsWith('.'));
1494
+ if (hasExtensionRule || !type)
1495
+ return false;
1496
+ const fileType = type.toLowerCase();
1497
+ const matches = rules.some(rule => rule.endsWith('/*') ? fileType.startsWith(rule.slice(0, -1)) : fileType === rule);
1498
+ return !matches;
1499
+ }
1500
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FileUploader, deps: null, target: i0.ɵɵFactoryTarget.Component });
1501
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: FileUploader, isStandalone: true, selector: "tls-file-uploader", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, multiple: { classPropertyName: "multiple", publicName: "multiple", isSignal: true, isRequired: false, transformFunction: null }, accept: { classPropertyName: "accept", publicName: "accept", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileUploader) }], queries: [{ propertyName: "dropZoneTemplate", first: true, predicate: ["dropZone"], descendants: true, isSignal: true }, { propertyName: "fileTemplate", first: true, predicate: ["file"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "fileInput", first: true, predicate: ["fileInput"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<input\n #fileInput\n class=\"tls-file-uploader__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n<div\n class=\"tls-file-uploader__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"multiple() ? 'Upload files' : 'Upload file'\"\n [class.tls-file-uploader__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-uploader__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-uploader__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n>\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-uploader__label\">\n @if (dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-uploader__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n</div>\n@if (value().length) {\n <ul class=\"tls-file-uploader__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-uploader__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-uploader__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-uploader__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
983
1502
  }
984
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, decorators: [{
1503
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: FileUploader, decorators: [{
985
1504
  type: Component,
986
- args: [{ selector: 'tls-date-time-picker', imports: [Calendar, MonthPicker, YearPicker, TimePicker, Popover, NgTemplateOutlet], host: { '[class]': 'hostClasses()' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"popoverRef.toggle($event)\"\n (blur)=\"touched.set(true)\"\n >\n <span [class.tls-form-control__placeholder]=\"!value()\">{{ triggerLabel() }}</span>\n </button>\n <tls-popover #popoverRef position=\"bottom-start\">\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n" }]
987
- }], ctorParameters: () => [], propDecorators: { popoverComponent: [{ type: i0.ViewChild, args: ['popoverRef', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", 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 }] }], yearsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "yearsPerPage", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }] } });
1505
+ args: [{ selector: 'tls-file-uploader', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => FileUploader) }], host: { '[class]': 'classes()' }, template: "<input\n #fileInput\n class=\"tls-file-uploader__input\"\n type=\"file\"\n [accept]=\"accept()\"\n [multiple]=\"multiple()\"\n [disabled]=\"disabled()\"\n (change)=\"onFilesSelected($event)\"\n/>\n<div\n class=\"tls-file-uploader__drop-zone\"\n role=\"button\"\n [attr.tabindex]=\"notInteractive() ? -1 : 0\"\n [attr.aria-label]=\"multiple() ? 'Upload files' : 'Upload file'\"\n [class.tls-file-uploader__drop-zone--dragging]=\"dragState() === 'valid'\"\n [class.tls-file-uploader__drop-zone--rejected]=\"dragState() === 'invalid'\"\n [class.tls-file-uploader__drop-zone--disabled]=\"notInteractive()\"\n (click)=\"openFilePicker()\"\n (keydown)=\"onDropZoneKeydown($event)\"\n (dragover)=\"onDragOver($event)\"\n (dragleave)=\"onDragLeave()\"\n (drop)=\"onDrop($event)\"\n>\n @if (dropZoneTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: dragState(), accept: acceptHint() }\"\n />\n } @else {\n <span class=\"tls-file-uploader__label\">\n @if (dragState() === 'invalid') {\n File type not allowed\n } @else {\n Drop files here or <strong>browse</strong>\n }\n </span>\n @if (acceptHint()) {\n <span class=\"tls-file-uploader__hint\">Allowed: {{ acceptHint() }}</span>\n }\n }\n</div>\n@if (value().length) {\n <ul class=\"tls-file-uploader__file-list\">\n @for (file of value(); track file; let fileIndex = $index) {\n <li class=\"tls-file-uploader__file\">\n @if (fileTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"{ $implicit: file, index: fileIndex, remove: removeFile }\"\n />\n } @else {\n <span class=\"tls-file-uploader__file-name\">{{ file.name }}</span>\n <button\n type=\"button\"\n class=\"tls-file-uploader__file-remove\"\n [attr.aria-label]=\"'Remove ' + file.name\"\n [disabled]=\"notInteractive()\"\n (click)=\"removeFile(fileIndex)\"\n >\u00D7</button>\n }\n </li>\n }\n </ul>\n}\n" }]
1506
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], multiple: [{ type: i0.Input, args: [{ isSignal: true, alias: "multiple", required: false }] }], accept: [{ type: i0.Input, args: [{ isSignal: true, alias: "accept", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], fileInput: [{ type: i0.ViewChild, args: ['fileInput', { isSignal: true }] }], dropZoneTemplate: [{ type: i0.ContentChild, args: ['dropZone', { isSignal: true }] }], fileTemplate: [{ type: i0.ContentChild, args: ['file', { isSignal: true }] }] } });
988
1507
 
989
1508
  const DEFAULT_INPUT_CONFIG = {
990
1509
  size: 'md',
@@ -1071,14 +1590,8 @@ class Password extends ValueFormControl {
1071
1590
  placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
1072
1591
  size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
1073
1592
  fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
1074
- hostClasses = computed(() => {
1075
- const groupClass = 'tls-form-control-group';
1076
- const array = ['tls-password', groupClass];
1077
- array.push(`${groupClass}--${this.size()}`);
1078
- if (this.fluid())
1079
- array.push(`${groupClass}--fluid`);
1080
- return array;
1081
- }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
1593
+ showIconTemplate = contentChild('showIcon', ...(ngDevMode ? [{ debugName: "showIconTemplate" }] : []));
1594
+ hideIconTemplate = contentChild('hideIcon', ...(ngDevMode ? [{ debugName: "hideIconTemplate" }] : []));
1082
1595
  type = computed(() => (this.visible() ? 'text' : 'password'), ...(ngDevMode ? [{ debugName: "type" }] : []));
1083
1596
  // Protected methods
1084
1597
  onInput(event) {
@@ -1091,14 +1604,14 @@ class Password extends ValueFormControl {
1091
1604
  this.visible.update(prev => !prev);
1092
1605
  }
1093
1606
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, deps: null, target: i0.ɵɵFactoryTarget.Component });
1094
- 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": "hostClasses()" } }, 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\" type=\"button\" (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" });
1607
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.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: { 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]=\"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\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"] }] });
1095
1608
  }
1096
1609
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, decorators: [{
1097
1610
  type: Component,
1098
- args: [{ selector: 'tls-password', host: {
1099
- '[class]': 'hostClasses()',
1100
- }, 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\" type=\"button\" (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" }]
1101
- }], 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 }] }] } });
1611
+ args: [{ selector: 'tls-password', imports: [FormControlGroup, NgTemplateOutlet], host: {
1612
+ class: 'tls-password',
1613
+ }, 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]=\"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\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" }]
1614
+ }], 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 }] }], showIconTemplate: [{ type: i0.ContentChild, args: ['showIcon', { isSignal: true }] }], hideIconTemplate: [{ type: i0.ContentChild, args: ['hideIcon', { isSignal: true }] }] } });
1102
1615
 
1103
1616
  // Matches strings containing only numeric digits (0–9).
1104
1617
  // Ensures the entire input consists exclusively of numbers.
@@ -1288,13 +1801,9 @@ const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
1288
1801
 
1289
1802
  class Select extends ValueFormControl {
1290
1803
  _config = inject(SELECT_CONFIG);
1291
- _overlay = inject(Overlay);
1292
- _viewContainerRef = inject(ViewContainerRef);
1293
- _destroyRef = inject(DestroyRef);
1804
+ _overlay = createOverlayManager();
1294
1805
  _triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "_triggerElement" }] : []));
1295
1806
  _panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "_panelTemplate" }] : []));
1296
- _overlayRef = null;
1297
- _portal = null;
1298
1807
  value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
1299
1808
  inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
1300
1809
  options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
@@ -1306,25 +1815,13 @@ class Select extends ValueFormControl {
1306
1815
  fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
1307
1816
  tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
1308
1817
  clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
1309
- isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
1818
+ isOpen = this._overlay.isOpen;
1310
1819
  activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
1311
- normalizedOptions = computed(() => {
1312
- const options = this.options();
1313
- const optionLabel = this.optionLabel();
1314
- const optionValue = this.optionValue();
1315
- const optionDisabled = this.optionDisabled();
1316
- return options.map(option => {
1317
- if (typeof option === 'string' || typeof option === 'number') {
1318
- return { value: option, label: String(option), disabled: false };
1319
- }
1320
- const typedOption = option;
1321
- return {
1322
- value: (optionValue ? typedOption[optionValue] : typedOption),
1323
- label: String(optionLabel ? typedOption[optionLabel] : typedOption),
1324
- disabled: Boolean(optionDisabled ? typedOption[optionDisabled] : false),
1325
- };
1326
- });
1327
- }, ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
1820
+ normalizedOptions = computed(() => normalizeOptions(this.options(), {
1821
+ label: this.optionLabel(),
1822
+ value: this.optionValue(),
1823
+ disabled: this.optionDisabled(),
1824
+ }), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
1328
1825
  hasValue = computed(() => {
1329
1826
  const value = this.value();
1330
1827
  return value !== null && value !== undefined && value !== '';
@@ -1350,44 +1847,29 @@ class Select extends ValueFormControl {
1350
1847
  const panelTemplate = this._panelTemplate();
1351
1848
  if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
1352
1849
  return;
1353
- if (!this._overlayRef) {
1354
- this._overlayRef = this._overlay.create({
1355
- positionStrategy: this._overlay
1356
- .position()
1357
- .flexibleConnectedTo(triggerElement)
1358
- .withPositions([
1359
- { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
1360
- {
1361
- originX: 'start',
1362
- originY: 'top',
1363
- overlayX: 'start',
1364
- overlayY: 'bottom',
1365
- offsetY: -4,
1366
- },
1367
- ])
1368
- .withFlexibleDimensions(false)
1369
- .withPush(false),
1370
- scrollStrategy: this._overlay.scrollStrategies.reposition(),
1371
- hasBackdrop: true,
1372
- panelClass: 'tls-select-panel',
1373
- backdropClass: 'cdk-overlay-transparent-backdrop',
1374
- });
1375
- this._overlayRef
1376
- .backdropClick()
1377
- .pipe(takeUntilDestroyed(this._destroyRef))
1378
- .subscribe(() => this.close());
1379
- }
1380
- this._portal ??= new TemplatePortal(panelTemplate, this._viewContainerRef);
1381
- this._overlayRef.updateSize({ minWidth: triggerElement.nativeElement.offsetWidth });
1382
- this._overlayRef.attach(this._portal);
1383
- this.isOpen.set(true);
1850
+ this._overlay.open({
1851
+ content: panelTemplate,
1852
+ origin: triggerElement,
1853
+ positions: [
1854
+ { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
1855
+ { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
1856
+ ],
1857
+ flexibleDimensions: false,
1858
+ push: false,
1859
+ panelClass: 'tls-select-panel',
1860
+ // Select handles Escape itself via the trigger's keydown handler.
1861
+ closeOnEscape: false,
1862
+ minWidth: triggerElement.nativeElement.offsetWidth,
1863
+ reuse: true,
1864
+ onClose: () => {
1865
+ this.activeIndex.set(-1);
1866
+ this._triggerElement()?.nativeElement.focus();
1867
+ },
1868
+ });
1384
1869
  this.activeIndex.set(this.normalizedOptions().findIndex(option => option.value === this.value()));
1385
1870
  }
1386
1871
  close() {
1387
- this._overlayRef?.detach();
1388
- this.isOpen.set(false);
1389
- this.activeIndex.set(-1);
1390
- this._triggerElement()?.nativeElement.focus();
1872
+ this._overlay.close();
1391
1873
  }
1392
1874
  toggle() {
1393
1875
  if (this.isOpen()) {
@@ -1467,11 +1949,6 @@ class Select extends ValueFormControl {
1467
1949
  next += direction;
1468
1950
  }
1469
1951
  }
1470
- // Lifecycle
1471
- ngOnDestroy() {
1472
- if (this._overlayRef)
1473
- this._overlayRef.dispose();
1474
- }
1475
1952
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
1476
1953
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, 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 }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", 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) }], viewQueries: [{ propertyName: "_triggerElement", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "_panelTemplate", first: true, predicate: ["panel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\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\">\n <svg class=\"tls-select__chevron\" viewBox=\"0 0 10 6\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L5 5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\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 <svg class=\"tls-select__clear-icon\" viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n\n<ng-template #panel>\n <ul class=\"tls-select__panel\" role=\"listbox\">\n @for (option of normalizedOptions(); track option.value; let i = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"i === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(i, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
1477
1954
  }
@@ -1532,6 +2009,118 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1532
2009
  }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Switch) }], template: "<input\n type=\"checkbox\"\n class=\"tls-switch-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n/>\n<div class=\"tls-switch-handle\"></div>\n" }]
1533
2010
  }], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
1534
2011
 
2012
+ const DEFAULT_TEXTAREA_CONFIG = {
2013
+ size: 'md',
2014
+ placeholder: '',
2015
+ fluid: false,
2016
+ rows: 3,
2017
+ resize: 'vertical',
2018
+ };
2019
+
2020
+ const TEXTAREA_CONFIG = new InjectionToken('TEXTAREA_CONFIG', {
2021
+ factory: () => DEFAULT_TEXTAREA_CONFIG,
2022
+ });
2023
+
2024
+ class Textarea extends ValueFormControl {
2025
+ _config = inject(TEXTAREA_CONFIG);
2026
+ value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
2027
+ inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
2028
+ placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
2029
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
2030
+ fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
2031
+ rows = input(this._config.rows, { ...(ngDevMode ? { debugName: "rows" } : {}), transform: numberAttribute });
2032
+ resize = input(this._config.resize, ...(ngDevMode ? [{ debugName: "resize" }] : []));
2033
+ classes = computed(() => {
2034
+ const array = [this.CLASS_NAME];
2035
+ array.push(`${this.CLASS_NAME}--${this.size()}`);
2036
+ if (this.fluid())
2037
+ array.push(`${this.CLASS_NAME}--fluid`);
2038
+ return array.concat(this.controlClasses());
2039
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
2040
+ // Protected methods
2041
+ onInput(event) {
2042
+ const target = event.target;
2043
+ this.value.set(target.value);
2044
+ }
2045
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Textarea, deps: null, target: i0.ɵɵFactoryTarget.Component });
2046
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Textarea, isStandalone: true, selector: "tls-textarea", inputs: { 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 }, rows: { classPropertyName: "rows", publicName: "rows", isSignal: true, isRequired: false, transformFunction: null }, resize: { classPropertyName: "resize", publicName: "resize", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { classAttribute: "tls-textarea" }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], usesInheritance: true, ngImport: i0, template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"resize()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] });
2047
+ }
2048
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Textarea, decorators: [{
2049
+ type: Component,
2050
+ args: [{ selector: 'tls-textarea', host: { class: 'tls-textarea' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Textarea) }], template: "<textarea\n [name]=\"name()\"\n [class]=\"classes()\"\n [attr.id]=\"inputId()\"\n [placeholder]=\"placeholder()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [rows]=\"rows()\"\n [style.resize]=\"resize()\"\n [value]=\"value()\"\n (input)=\"onInput($event)\"\n (blur)=\"touched.set(true)\"\n></textarea>\n", styles: [":host{width:auto;display:inline-block}:host:has(.tls-form-control.tls-form-control--fluid){width:100%}\n"] }]
2051
+ }], propDecorators: { 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 }] }], rows: [{ type: i0.Input, args: [{ isSignal: true, alias: "rows", required: false }] }], resize: [{ type: i0.Input, args: [{ isSignal: true, alias: "resize", required: false }] }] } });
2052
+
2053
+ const DEFAULT_TOGGLE_GROUP_CONFIG = {
2054
+ size: 'md',
2055
+ color: 'primary',
2056
+ orientation: 'horizontal',
2057
+ type: 'single',
2058
+ unselectable: false,
2059
+ };
2060
+
2061
+ const TOGGLE_GROUP_CONFIG = new InjectionToken('TOGGLE_GROUP_CONFIG', {
2062
+ factory: () => DEFAULT_TOGGLE_GROUP_CONFIG,
2063
+ });
2064
+
2065
+ class ToggleGroup extends ValueFormControl {
2066
+ _config = inject(TOGGLE_GROUP_CONFIG);
2067
+ CLASS_NAME = 'tls-toggle-group';
2068
+ value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
2069
+ options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
2070
+ optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
2071
+ optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
2072
+ optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
2073
+ type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
2074
+ unselectable = input(this._config.unselectable, { ...(ngDevMode ? { debugName: "unselectable" } : {}), transform: booleanAttribute });
2075
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
2076
+ color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
2077
+ orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
2078
+ optionTemplate = contentChild('option', ...(ngDevMode ? [{ debugName: "optionTemplate" }] : []));
2079
+ normalizedOptions = computed(() => normalizeOptions(this.options(), {
2080
+ label: this.optionLabel(),
2081
+ value: this.optionValue(),
2082
+ disabled: this.optionDisabled(),
2083
+ }), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
2084
+ classes = computed(() => {
2085
+ const className = this.CLASS_NAME;
2086
+ const array = [
2087
+ className,
2088
+ `${className}--${this.size()}`,
2089
+ `${className}--${this.color()}`,
2090
+ `${className}--${this.orientation()}`,
2091
+ ];
2092
+ return array.concat(this.controlClasses());
2093
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
2094
+ isSelected(optionValue) {
2095
+ return this.value().includes(optionValue);
2096
+ }
2097
+ select(option) {
2098
+ if (this.notInteractive() || option.disabled)
2099
+ return;
2100
+ if (this.type() === 'single') {
2101
+ if (this.isSelected(option.value) && !this.unselectable())
2102
+ return;
2103
+ this.value.set(this.isSelected(option.value) ? [] : [option.value]);
2104
+ return;
2105
+ }
2106
+ if (this.isSelected(option.value)) {
2107
+ this.value.update(current => current.filter(item => item !== option.value));
2108
+ }
2109
+ else {
2110
+ this.value.update(current => [...current, option.value]);
2111
+ }
2112
+ }
2113
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
2114
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", 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 }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "group" }, properties: { "class": "classes()" } }, 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) {\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]=\"{ $implicit: option }\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2115
+ }
2116
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, decorators: [{
2117
+ type: Component,
2118
+ args: [{ selector: 'tls-toggle-group', imports: [NgTemplateOutlet], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], host: {
2119
+ role: 'group',
2120
+ '[class]': 'classes()',
2121
+ }, template: "@for (option of normalizedOptions(); track option.value) {\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]=\"{ $implicit: option }\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n" }]
2122
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", 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 }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }] } });
2123
+
1535
2124
  class IconService {
1536
2125
  _http = inject(HttpClient);
1537
2126
  _sanitizer = inject(DomSanitizer);
@@ -1702,6 +2291,160 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1702
2291
  }]
1703
2292
  }], 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 }] }] } });
1704
2293
 
2294
+ class MenuItemComponent {
2295
+ key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
2296
+ templateRef = viewChild.required('template');
2297
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItemComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2298
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: MenuItemComponent, isStandalone: true, selector: "tls-menu-item", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null } }, host: { styleAttribute: "display: none" }, viewQueries: [{ propertyName: "templateRef", first: true, predicate: ["template"], descendants: true, isSignal: true }], ngImport: i0, template: `<ng-template #template><ng-content /></ng-template>`, isInline: true });
2299
+ }
2300
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuItemComponent, decorators: [{
2301
+ type: Component,
2302
+ args: [{
2303
+ selector: 'tls-menu-item',
2304
+ template: `<ng-template #template><ng-content /></ng-template>`,
2305
+ host: { style: 'display: none' },
2306
+ }]
2307
+ }], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], templateRef: [{ type: i0.ViewChild, args: ['template', { isSignal: true }] }] } });
2308
+
2309
+ const DEFAULT_MENU_CONFIG = {
2310
+ position: 'bottom-start',
2311
+ offset: { x: 0, y: 4 },
2312
+ };
2313
+
2314
+ const MENU_CONFIG = new InjectionToken('MENU_CONFIG', {
2315
+ factory: () => DEFAULT_MENU_CONFIG,
2316
+ });
2317
+
2318
+ class Menu {
2319
+ static _counter = 0;
2320
+ _config = inject(MENU_CONFIG);
2321
+ _overlay = createOverlayManager();
2322
+ _panelRef = viewChild.required('panel');
2323
+ _customItems = contentChildren(MenuItemComponent, ...(ngDevMode ? [{ debugName: "_customItems" }] : []));
2324
+ customTemplates = computed(() => {
2325
+ const map = new Map();
2326
+ for (const item of this._customItems()) {
2327
+ map.set(item.key(), item.templateRef());
2328
+ }
2329
+ return map;
2330
+ }, ...(ngDevMode ? [{ debugName: "customTemplates" }] : []));
2331
+ itemTemplate = contentChild('itemTemplate', ...(ngDevMode ? [{ debugName: "itemTemplate" }] : []));
2332
+ labelTemplate = contentChild('labelTemplate', ...(ngDevMode ? [{ debugName: "labelTemplate" }] : []));
2333
+ dividerTemplate = contentChild('dividerTemplate', ...(ngDevMode ? [{ debugName: "dividerTemplate" }] : []));
2334
+ iconTemplate = contentChild('iconTemplate', ...(ngDevMode ? [{ debugName: "iconTemplate" }] : []));
2335
+ id = `tls-menu-${++Menu._counter}`;
2336
+ // Inputs
2337
+ items = input([], ...(ngDevMode ? [{ debugName: "items" }] : []));
2338
+ position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
2339
+ offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
2340
+ ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
2341
+ inline = input(false, { ...(ngDevMode ? { debugName: "inline" } : {}), transform: booleanAttribute });
2342
+ _positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
2343
+ // An inline menu is always "open" (rendered in place); otherwise reflect the overlay.
2344
+ isOpen = computed(() => this.inline() || this._overlay.isOpen(), ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
2345
+ constructor() {
2346
+ if (isDevMode()) {
2347
+ effect(() => {
2348
+ const templates = this.customTemplates();
2349
+ for (const item of this.items()) {
2350
+ if (item.type === 'custom' && !templates.has(item.key)) {
2351
+ console.warn(`[tls-menu] No <tls-menu-item key="${item.key}"> found for custom item. The slot will be skipped.`);
2352
+ }
2353
+ }
2354
+ });
2355
+ }
2356
+ }
2357
+ // Public methods
2358
+ open(trigger) {
2359
+ if (this.inline())
2360
+ return;
2361
+ const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
2362
+ this._overlay.open({
2363
+ content: this._panelRef(),
2364
+ origin,
2365
+ positions: this._positions(),
2366
+ });
2367
+ }
2368
+ openAtPoint(x, y) {
2369
+ if (this.inline())
2370
+ return;
2371
+ this._overlay.open({
2372
+ content: this._panelRef(),
2373
+ origin: { x, y },
2374
+ positions: this._positions(),
2375
+ scrollStrategy: 'close',
2376
+ hasBackdrop: false,
2377
+ });
2378
+ }
2379
+ close() {
2380
+ this._overlay.close();
2381
+ }
2382
+ toggle(trigger) {
2383
+ if (this._overlay.isOpen()) {
2384
+ this.close();
2385
+ }
2386
+ else {
2387
+ this.open(trigger);
2388
+ }
2389
+ }
2390
+ // Protected
2391
+ onItemClick(item) {
2392
+ item.action?.();
2393
+ this.close();
2394
+ }
2395
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Menu, deps: [], target: i0.ɵɵFactoryTarget.Component });
2396
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Menu, isStandalone: true, selector: "tls-menu", inputs: { items: { classPropertyName: "items", publicName: "items", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, offset: { classPropertyName: "offset", publicName: "offset", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null }, inline: { classPropertyName: "inline", publicName: "inline", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "_customItems", predicate: MenuItemComponent, isSignal: true }, { propertyName: "itemTemplate", first: true, predicate: ["itemTemplate"], descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["labelTemplate"], descendants: true, isSignal: true }, { propertyName: "dividerTemplate", first: true, predicate: ["dividerTemplate"], descendants: true, isSignal: true }, { propertyName: "iconTemplate", first: true, predicate: ["iconTemplate"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_panelRef", first: true, predicate: ["panel"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-template #panel>\n <div\n class=\"tls-menu\"\n [id]=\"id\"\n role=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (item of items(); track $index) {\n @switch (item.type) {\n @case ('item') {\n @let actionItem = item;\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem }\" />\n } @else {\n <button\n role=\"menuitem\"\n class=\"tls-menu__item\"\n [disabled]=\"actionItem.disabled ?? false\"\n (click)=\"onItemClick(actionItem)\"\n >\n @if (actionItem.icon) {\n @if (iconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\" />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n }\n }\n <span class=\"tls-menu__item-label\">{{ actionItem.label }}</span>\n @if (actionItem.shortcut) {\n <kbd class=\"tls-menu__item-shortcut\">{{ actionItem.shortcut }}</kbd>\n }\n </button>\n }\n }\n @case ('label') {\n @let labelItem = item;\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: labelItem }\" />\n } @else {\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ labelItem.label }}</span>\n }\n }\n @case ('divider') {\n @if (dividerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" aria-hidden=\"true\" />\n }\n }\n @case ('custom') {\n @if (customTemplates().get(item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n }\n }\n }\n </div>\n</ng-template>\n\n@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"panel\" />\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Icon, selector: "tls-icon", inputs: ["iconSrc", "alt", "allowedSources"] }] });
2397
+ }
2398
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Menu, decorators: [{
2399
+ type: Component,
2400
+ args: [{ selector: 'tls-menu', imports: [NgTemplateOutlet, Icon], template: "<ng-template #panel>\n <div\n class=\"tls-menu\"\n [id]=\"id\"\n role=\"menu\"\n [attr.aria-label]=\"ariaLabel() ?? null\"\n >\n @for (item of items(); track $index) {\n @switch (item.type) {\n @case ('item') {\n @let actionItem = item;\n @if (itemTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem }\" />\n } @else {\n <button\n role=\"menuitem\"\n class=\"tls-menu__item\"\n [disabled]=\"actionItem.disabled ?? false\"\n (click)=\"onItemClick(actionItem)\"\n >\n @if (actionItem.icon) {\n @if (iconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: actionItem.icon, data: actionItem }\" />\n } @else {\n <tls-icon class=\"tls-menu__item-icon\" [iconSrc]=\"actionItem.icon\" />\n }\n }\n <span class=\"tls-menu__item-label\">{{ actionItem.label }}</span>\n @if (actionItem.shortcut) {\n <kbd class=\"tls-menu__item-shortcut\">{{ actionItem.shortcut }}</kbd>\n }\n </button>\n }\n }\n @case ('label') {\n @let labelItem = item;\n @if (labelTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: labelItem }\" />\n } @else {\n <span class=\"tls-menu__label\" aria-hidden=\"true\">{{ labelItem.label }}</span>\n }\n }\n @case ('divider') {\n @if (dividerTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: item }\" />\n } @else {\n <hr class=\"tls-menu__divider\" role=\"separator\" aria-hidden=\"true\" />\n }\n }\n @case ('custom') {\n @if (customTemplates().get(item.key); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" />\n }\n }\n }\n }\n </div>\n</ng-template>\n\n@if (inline()) {\n <ng-container [ngTemplateOutlet]=\"panel\" />\n}\n" }]
2401
+ }], ctorParameters: () => [], propDecorators: { _panelRef: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], _customItems: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => MenuItemComponent), { isSignal: true }] }], itemTemplate: [{ type: i0.ContentChild, args: ['itemTemplate', { isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: ['labelTemplate', { isSignal: true }] }], dividerTemplate: [{ type: i0.ContentChild, args: ['dividerTemplate', { isSignal: true }] }], iconTemplate: [{ type: i0.ContentChild, args: ['iconTemplate', { isSignal: true }] }], items: [{ type: i0.Input, args: [{ isSignal: true, alias: "items", required: false }] }], position: [{ type: i0.Input, args: [{ isSignal: true, alias: "position", required: false }] }], offset: [{ type: i0.Input, args: [{ isSignal: true, alias: "offset", required: false }] }], ariaLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "ariaLabel", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }] } });
2402
+
2403
+ class MenuTriggerDirective {
2404
+ menu = input.required({ ...(ngDevMode ? { debugName: "menu" } : {}), alias: 'tlsMenuTrigger' });
2405
+ isOpen = computed(() => this.menu().isOpen(), ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
2406
+ menuId = computed(() => this.menu().id, ...(ngDevMode ? [{ debugName: "menuId" }] : []));
2407
+ // Protected methods
2408
+ onClick(event) {
2409
+ this.menu().toggle(event);
2410
+ }
2411
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2412
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: MenuTriggerDirective, isStandalone: true, selector: "[tlsMenuTrigger]", inputs: { menu: { classPropertyName: "menu", publicName: "tlsMenuTrigger", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "click": "onClick($event)" }, properties: { "attr.aria-haspopup": "\"menu\"", "attr.aria-expanded": "isOpen()", "attr.aria-controls": "menuId()" } }, ngImport: i0 });
2413
+ }
2414
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MenuTriggerDirective, decorators: [{
2415
+ type: Directive,
2416
+ args: [{
2417
+ selector: '[tlsMenuTrigger]',
2418
+ host: {
2419
+ '(click)': 'onClick($event)',
2420
+ '[attr.aria-haspopup]': '"menu"',
2421
+ '[attr.aria-expanded]': 'isOpen()',
2422
+ '[attr.aria-controls]': 'menuId()',
2423
+ },
2424
+ }]
2425
+ }], propDecorators: { menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsMenuTrigger", required: true }] }] } });
2426
+
2427
+ class ContextMenuDirective {
2428
+ menu = input.required({ ...(ngDevMode ? { debugName: "menu" } : {}), alias: 'tlsContextMenu' });
2429
+ // Protected methods
2430
+ onContextMenu(event) {
2431
+ event.preventDefault();
2432
+ this.menu().close();
2433
+ this.menu().openAtPoint(event.clientX, event.clientY);
2434
+ }
2435
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ContextMenuDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2436
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ContextMenuDirective, isStandalone: true, selector: "[tlsContextMenu]", inputs: { menu: { classPropertyName: "menu", publicName: "tlsContextMenu", isSignal: true, isRequired: true, transformFunction: null } }, host: { listeners: { "contextmenu": "onContextMenu($event)" } }, ngImport: i0 });
2437
+ }
2438
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ContextMenuDirective, decorators: [{
2439
+ type: Directive,
2440
+ args: [{
2441
+ selector: '[tlsContextMenu]',
2442
+ host: {
2443
+ '(contextmenu)': 'onContextMenu($event)',
2444
+ },
2445
+ }]
2446
+ }], propDecorators: { menu: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsContextMenu", required: true }] }] } });
2447
+
1705
2448
  const DEFAULT_PAGINATION_CONFIG = {
1706
2449
  size: 'md',
1707
2450
  pageSize: 10,
@@ -1788,7 +2531,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1788
2531
  }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], pageSize: [{ type: i0.Input, args: [{ isSignal: true, alias: "pageSize", required: false }] }], total: [{ type: i0.Input, args: [{ isSignal: true, alias: "total", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], boundaries: [{ type: i0.Input, args: [{ isSignal: true, alias: "boundaries", required: false }] }], siblings: [{ type: i0.Input, args: [{ isSignal: true, alias: "siblings", required: false }] }], showFirstButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showFirstButton", required: false }] }], showLastButton: [{ type: i0.Input, args: [{ isSignal: true, alias: "showLastButton", required: false }] }] } });
1789
2532
 
1790
2533
  const DEFAULT_SKELETON_CONFIG = {
1791
- size: 40,
2534
+ size: null,
1792
2535
  width: null,
1793
2536
  height: null,
1794
2537
  radius: 8,
@@ -1825,8 +2568,8 @@ class Skeleton {
1825
2568
  const rounded = this.rounded();
1826
2569
  const radius = this.radius();
1827
2570
  return {
1828
- '--tls-skeleton-width': `${width}px`,
1829
- '--tls-skeleton-height': `${height}px`,
2571
+ '--tls-skeleton-width': width !== null ? `${width}px` : '100%',
2572
+ '--tls-skeleton-height': height !== null ? `${height}px` : '100%',
1830
2573
  '--tls-skeleton-radius': rounded ? '50%' : `${radius}px`,
1831
2574
  '--tls-skeleton-duration': `${this.duration()}ms`,
1832
2575
  };
@@ -2385,6 +3128,19 @@ const provideThalassicUIConfig = (config) => {
2385
3128
  provide: BUTTON_CONFIG,
2386
3129
  useValue: deepMerge(DEFAULT_BUTTON_CONFIG, config.components.button),
2387
3130
  },
3131
+ {
3132
+ provide: CHECKBOX_CONFIG,
3133
+ useValue: deepMerge(DEFAULT_CHECKBOX_CONFIG, config.components.checkbox),
3134
+ },
3135
+ { provide: CHIP_CONFIG, useValue: deepMerge(DEFAULT_CHIP_CONFIG, config.components.chip) },
3136
+ {
3137
+ provide: CHIP_CONTROL_CONFIG,
3138
+ useValue: deepMerge(DEFAULT_CHIP_CONTROL_CONFIG, config.components.chipControl),
3139
+ },
3140
+ {
3141
+ provide: CHIP_INPUT_CONFIG,
3142
+ useValue: deepMerge(DEFAULT_CHIP_INPUT_CONFIG, config.components.chipInput),
3143
+ },
2388
3144
  {
2389
3145
  provide: DATE_TIME_PICKER_CONFIG,
2390
3146
  useValue: deepMerge(DEFAULT_DATE_TIME_PICKER_CONFIG, config.components.dateTimePicker),
@@ -2397,32 +3153,49 @@ const provideThalassicUIConfig = (config) => {
2397
3153
  provide: DIVIDER_CONFIG,
2398
3154
  useValue: deepMerge(DEFAULT_DIVIDER_CONFIG, config.components.divider),
2399
3155
  },
2400
- { provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
2401
- {
2402
- provide: PASSWORD_CONFIG,
2403
- useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, config.components.password),
2404
- },
2405
3156
  {
2406
- provide: SELECT_CONFIG,
2407
- useValue: deepMerge(DEFAULT_SELECT_CONFIG, config.components.select),
3157
+ provide: FILE_UPLOADER_CONFIG,
3158
+ useValue: deepMerge(DEFAULT_FILE_UPLOADER_CONFIG, config.components.fileUploader),
2408
3159
  },
2409
3160
  {
2410
- provide: SWITCH_CONFIG,
2411
- useValue: deepMerge(DEFAULT_SWITCH_CONFIG, config.components.switch),
3161
+ provide: FORM_CONTROL_GROUP_CONFIG,
3162
+ useValue: deepMerge(DEFAULT_FORM_CONTROL_GROUP_CONFIG, config.components.formControlGroup),
2412
3163
  },
2413
3164
  {
2414
3165
  provide: FORM_ITEM_CONFIG,
2415
3166
  useValue: deepMerge(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
2416
3167
  },
2417
3168
  { provide: ICON_CONFIG, useValue: deepMerge(DEFAULT_ICON_CONFIG, config.components.icon) },
3169
+ { provide: INPUT_CONFIG, useValue: deepMerge(DEFAULT_INPUT_CONFIG, config.components.input) },
3170
+ {
3171
+ provide: LOADER_CONFIG,
3172
+ useValue: deepMerge(DEFAULT_LOADER_CONFIG, config.components.loader),
3173
+ },
3174
+ { provide: MENU_CONFIG, useValue: deepMerge(DEFAULT_MENU_CONFIG, config.components.menu) },
2418
3175
  {
2419
3176
  provide: PAGINATION_CONFIG,
2420
3177
  useValue: deepMerge(DEFAULT_PAGINATION_CONFIG, config.components.pagination),
2421
3178
  },
3179
+ {
3180
+ provide: PASSWORD_CONFIG,
3181
+ useValue: deepMerge(DEFAULT_PASSWORD_CONFIG, config.components.password),
3182
+ },
3183
+ {
3184
+ provide: PIN_INPUT_CONFIG,
3185
+ useValue: deepMerge(DEFAULT_PIN_INPUT_CONFIG, config.components.pinInput),
3186
+ },
2422
3187
  {
2423
3188
  provide: POPOVER_CONFIG,
2424
3189
  useValue: deepMerge(DEFAULT_POPOVER_CONFIG, config.components.popover),
2425
3190
  },
3191
+ {
3192
+ provide: RADIO_BUTTON_CONFIG,
3193
+ useValue: deepMerge(DEFAULT_RADIO_BUTTON_CONFIG, config.components.radioButton),
3194
+ },
3195
+ {
3196
+ provide: SELECT_CONFIG,
3197
+ useValue: deepMerge(DEFAULT_SELECT_CONFIG, config.components.select),
3198
+ },
2426
3199
  {
2427
3200
  provide: SKELETON_CONFIG,
2428
3201
  useValue: deepMerge(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
@@ -2431,8 +3204,20 @@ const provideThalassicUIConfig = (config) => {
2431
3204
  provide: STEPPER_CONFIG,
2432
3205
  useValue: deepMerge(DEFAULT_STEPPER_CONFIG, config.components.stepper),
2433
3206
  },
3207
+ {
3208
+ provide: SWITCH_CONFIG,
3209
+ useValue: deepMerge(DEFAULT_SWITCH_CONFIG, config.components.switch),
3210
+ },
2434
3211
  { provide: TABLE_CONFIG, useValue: deepMerge(DEFAULT_TABLE_CONFIG, config.components.table) },
2435
3212
  { provide: TABS_CONFIG, useValue: deepMerge(DEFAULT_TABS_CONFIG, config.components.tabs) },
3213
+ {
3214
+ provide: TEXTAREA_CONFIG,
3215
+ useValue: deepMerge(DEFAULT_TEXTAREA_CONFIG, config.components.textarea),
3216
+ },
3217
+ {
3218
+ provide: TOGGLE_GROUP_CONFIG,
3219
+ useValue: deepMerge(DEFAULT_TOGGLE_GROUP_CONFIG, config.components.toggleGroup),
3220
+ },
2436
3221
  {
2437
3222
  provide: TOOLTIP_CONFIG,
2438
3223
  useValue: deepMerge(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
@@ -2444,5 +3229,5 @@ const provideThalassicUIConfig = (config) => {
2444
3229
  * Generated bundle index. Do not edit.
2445
3230
  */
2446
3231
 
2447
- export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, Checkbox, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TooltipDirective, provideThalassicUIConfig };
3232
+ export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_INPUT_CONFIG, Checkbox, Chip, ChipControl, ChipInput, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FILE_UPLOADER_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FILE_UPLOADER_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileUploader, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, MENU_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TEXTAREA_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, ToggleGroup, TooltipDirective, provideThalassicUIConfig };
2448
3233
  //# sourceMappingURL=thalassic-ui.mjs.map