@thalassic/ui 0.6.0 → 0.8.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,11 +1,18 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, model, contentChild, forwardRef, Injectable, contentChildren, DOCUMENT, RendererFactory2, PLATFORM_ID, signal, effect, makeEnvironmentProviders, provideEnvironmentInitializer } from '@angular/core';
3
- import { NgTemplateOutlet, isPlatformBrowser } from '@angular/common';
2
+ import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, ElementRef, Injectable, DestroyRef, viewChild, contentChildren, afterNextRender, forwardRef, model, contentChild, ViewContainerRef, signal, output, effect, viewChildren, TemplateRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
3
+ import { NgTemplateOutlet } from '@angular/common';
4
4
  import { RouterLink } from '@angular/router';
5
- import { rxResource } from '@angular/core/rxjs-interop';
5
+ import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
6
+ import { ThemeService } from '@thalassic/core';
7
+ import { Chart as Chart$1, BarController, BarElement, CategoryScale, LinearScale, BubbleController, PointElement, DoughnutController, ArcElement, LineController, LineElement, PieController, PolarAreaController, RadialLinearScale, RadarController, ScatterController } from 'chart.js';
8
+ import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
9
+ import { CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
10
+ 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';
11
+ import { Overlay } from '@angular/cdk/overlay';
6
12
  import { HttpClient } from '@angular/common/http';
7
13
  import { DomSanitizer } from '@angular/platform-browser';
8
14
  import { throwError, map, shareReplay } from 'rxjs';
15
+ import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
9
16
 
10
17
  const DEFAULT_ALERT_CONFIG = {
11
18
  color: 'primary',
@@ -147,6 +154,388 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
147
154
  }]
148
155
  }] });
149
156
 
157
+ const CHART_ELEMENT = new InjectionToken('CHART_ELEMENT');
158
+ class ChartElement {
159
+ dataset = input.required({ ...(ngDevMode ? { debugName: "dataset" } : {}), transform: value => ({
160
+ type: this.type,
161
+ ...value,
162
+ }) });
163
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartElement, deps: [], target: i0.ɵɵFactoryTarget.Directive });
164
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ChartElement, isStandalone: true, inputs: { dataset: { classPropertyName: "dataset", publicName: "dataset", isSignal: true, isRequired: true, transformFunction: null } }, ngImport: i0 });
165
+ }
166
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartElement, decorators: [{
167
+ type: Directive
168
+ }], propDecorators: { dataset: [{ type: i0.Input, args: [{ isSignal: true, alias: "dataset", required: true }] }] } });
169
+
170
+ const CARTESIAN_CHARTS = [
171
+ 'bar',
172
+ 'line',
173
+ 'scatter',
174
+ 'bubble',
175
+ ];
176
+ const RADIAL_CHARTS = ['polarArea', 'radar'];
177
+
178
+ class ChartService {
179
+ _elementRef = inject(ElementRef);
180
+ getColorOptions(chartElements) {
181
+ const scaleTypes = this._getScaleTypes(chartElements);
182
+ const computedStyle = getComputedStyle(this._elementRef.nativeElement);
183
+ return {
184
+ backgroundColor: computedStyle.getPropertyValue('--tls-chart-background-color'),
185
+ borderColor: computedStyle.getPropertyValue('--tls-chart-border-color'),
186
+ color: computedStyle.getPropertyValue('--tls-chart-color'),
187
+ scales: this._getScales(scaleTypes),
188
+ };
189
+ }
190
+ // Private methods
191
+ _getScales(scaleTypes) {
192
+ const scales = {};
193
+ if (scaleTypes.includes('cartesian')) {
194
+ scales['x'] = this._getCartesianScales('x');
195
+ scales['y'] = this._getCartesianScales('y');
196
+ }
197
+ if (scaleTypes.includes('radial')) {
198
+ scales['r'] = this._getRadialScales();
199
+ }
200
+ return scales;
201
+ }
202
+ _getCartesianScales(axis) {
203
+ const computedStyle = getComputedStyle(this._elementRef.nativeElement);
204
+ return {
205
+ ticks: {
206
+ color: computedStyle.getPropertyValue(`--tls-chart-${axis}-ticks-color`),
207
+ },
208
+ grid: {
209
+ color: computedStyle.getPropertyValue(`--tls-chart-${axis}-grid-color`),
210
+ },
211
+ border: {
212
+ color: computedStyle.getPropertyValue(`--tls-chart-${axis}-axis-color`),
213
+ },
214
+ };
215
+ }
216
+ _getRadialScales() {
217
+ const computedStyle = getComputedStyle(this._elementRef.nativeElement);
218
+ return {
219
+ angleLines: {
220
+ color: computedStyle.getPropertyValue('--tls-chart-r-angle-lines-color'),
221
+ },
222
+ grid: {
223
+ color: computedStyle.getPropertyValue('--tls-chart-r-grid-color'),
224
+ },
225
+ pointLabels: {
226
+ color: computedStyle.getPropertyValue('--tls-chart-r-labels-color'),
227
+ },
228
+ ticks: {
229
+ color: computedStyle.getPropertyValue('--tls-chart-r-ticks-color'),
230
+ backdropColor: computedStyle.getPropertyValue('--tls-chart-r-ticks-backdrop-color'),
231
+ },
232
+ };
233
+ }
234
+ _getScaleTypes(chartElements) {
235
+ const types = [];
236
+ if (chartElements.some(element => CARTESIAN_CHARTS.includes(element.type)))
237
+ types.push('cartesian');
238
+ if (chartElements.some(element => RADIAL_CHARTS.includes(element.type)))
239
+ types.push('radial');
240
+ return types;
241
+ }
242
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
243
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService });
244
+ }
245
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChartService, decorators: [{
246
+ type: Injectable
247
+ }] });
248
+
249
+ const DEFAULT_CHART_CONFIG = {
250
+ options: {
251
+ maintainAspectRatio: false,
252
+ },
253
+ };
254
+
255
+ const CHART_CONFIG = new InjectionToken('CHART_CONFIG', {
256
+ factory: () => DEFAULT_CHART_CONFIG,
257
+ });
258
+
259
+ class Chart {
260
+ _config = inject(CHART_CONFIG);
261
+ _chartService = inject(ChartService);
262
+ _destroyRef = inject(DestroyRef);
263
+ _themeService = inject(ThemeService, { optional: true });
264
+ canvasRef = viewChild('canvas', ...(ngDevMode ? [{ debugName: "canvasRef" }] : []));
265
+ chartElements = contentChildren(CHART_ELEMENT, ...(ngDevMode ? [{ debugName: "chartElements" }] : []));
266
+ _chart = null;
267
+ labels = input([], ...(ngDevMode ? [{ debugName: "labels" }] : []));
268
+ options = input(undefined, ...(ngDevMode ? [{ debugName: "options" }] : []));
269
+ // Computed
270
+ _options = computed(() => {
271
+ const options = this.options();
272
+ const colorOptions = this._chartService.getColorOptions(this.chartElements());
273
+ if (options)
274
+ return { ...colorOptions, ...this._config.options, ...options };
275
+ else
276
+ return { ...colorOptions, ...this._config.options };
277
+ }, ...(ngDevMode ? [{ debugName: "_options" }] : []));
278
+ _datasets = computed(() => this.chartElements().map(element => element.dataset()), ...(ngDevMode ? [{ debugName: "_datasets" }] : []));
279
+ hostClasses = computed(() => {
280
+ const className = 'tls-chart';
281
+ const array = [className];
282
+ return array;
283
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
284
+ constructor() {
285
+ afterNextRender(() => {
286
+ if (this.canvasElement) {
287
+ const config = {
288
+ options: this._options(),
289
+ data: {
290
+ labels: this.labels(),
291
+ datasets: this._datasets(),
292
+ },
293
+ };
294
+ this._chart = new Chart$1(this.canvasElement, config);
295
+ }
296
+ });
297
+ }
298
+ // Accessors
299
+ get canvasElement() {
300
+ return this.canvasRef()?.nativeElement;
301
+ }
302
+ // Private methods
303
+ _tryInitThemeListener() {
304
+ if (this._themeService) {
305
+ this._themeService.onThemeChange.pipe(takeUntilDestroyed(this._destroyRef)).subscribe(() => {
306
+ if (this._chart) {
307
+ const colorOptions = this._chartService.getColorOptions(this.chartElements());
308
+ this._chart.options = { ...this._options(), ...colorOptions };
309
+ this._chart.update('none');
310
+ }
311
+ });
312
+ }
313
+ }
314
+ // Lifecycle
315
+ ngOnInit() {
316
+ this._tryInitThemeListener();
317
+ }
318
+ ngOnDestroy() {
319
+ if (this._chart)
320
+ this._chart.destroy();
321
+ }
322
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chart, deps: [], target: i0.ɵɵFactoryTarget.Component });
323
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: Chart, isStandalone: true, selector: "tls-chart", inputs: { labels: { classPropertyName: "labels", publicName: "labels", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, providers: [ChartService], queries: [{ propertyName: "chartElements", predicate: CHART_ELEMENT, isSignal: true }], viewQueries: [{ propertyName: "canvasRef", first: true, predicate: ["canvas"], descendants: true, isSignal: true }], ngImport: i0, template: "<canvas #canvas></canvas>\n", styles: [":host{position:relative;display:block}\n"] });
324
+ }
325
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Chart, decorators: [{
326
+ type: Component,
327
+ args: [{ selector: 'tls-chart', imports: [], host: {
328
+ '[class]': 'hostClasses()',
329
+ }, providers: [ChartService], template: "<canvas #canvas></canvas>\n", styles: [":host{position:relative;display:block}\n"] }]
330
+ }], ctorParameters: () => [], propDecorators: { canvasRef: [{ type: i0.ViewChild, args: ['canvas', { isSignal: true }] }], chartElements: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => CHART_ELEMENT), { isSignal: true }] }], labels: [{ type: i0.Input, args: [{ isSignal: true, alias: "labels", required: false }] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }] } });
331
+
332
+ class BarChart extends ChartElement {
333
+ type = 'bar';
334
+ constructor() {
335
+ super();
336
+ Chart$1.register(BarController, BarElement, CategoryScale, LinearScale);
337
+ }
338
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BarChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
339
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: BarChart, isStandalone: true, selector: "tls-bar-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BarChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
340
+ }
341
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BarChart, decorators: [{
342
+ type: Component,
343
+ args: [{
344
+ selector: 'tls-bar-chart',
345
+ template: '',
346
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BarChart) }],
347
+ }]
348
+ }], ctorParameters: () => [] });
349
+
350
+ class BubbleChart extends ChartElement {
351
+ type = 'bubble';
352
+ constructor() {
353
+ super();
354
+ Chart$1.register(BubbleController, PointElement, LinearScale);
355
+ }
356
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BubbleChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
357
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: BubbleChart, isStandalone: true, selector: "tls-bubble-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BubbleChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
358
+ }
359
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: BubbleChart, decorators: [{
360
+ type: Component,
361
+ args: [{
362
+ selector: 'tls-bubble-chart',
363
+ template: '',
364
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => BubbleChart) }],
365
+ }]
366
+ }], ctorParameters: () => [] });
367
+
368
+ class DoughnutChart extends ChartElement {
369
+ type = 'doughnut';
370
+ constructor() {
371
+ super();
372
+ Chart$1.register(DoughnutController, ArcElement);
373
+ }
374
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DoughnutChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
375
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: DoughnutChart, isStandalone: true, selector: "tls-doughnut-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => DoughnutChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
376
+ }
377
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DoughnutChart, decorators: [{
378
+ type: Component,
379
+ args: [{
380
+ selector: 'tls-doughnut-chart',
381
+ template: '',
382
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => DoughnutChart) }],
383
+ }]
384
+ }], ctorParameters: () => [] });
385
+
386
+ class LineChart extends ChartElement {
387
+ type = 'line';
388
+ constructor() {
389
+ super();
390
+ Chart$1.register(LineController, LineElement, PointElement, CategoryScale, LinearScale);
391
+ }
392
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: LineChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
393
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: LineChart, isStandalone: true, selector: "tls-line-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => LineChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
394
+ }
395
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: LineChart, decorators: [{
396
+ type: Component,
397
+ args: [{
398
+ selector: 'tls-line-chart',
399
+ template: '',
400
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => LineChart) }],
401
+ }]
402
+ }], ctorParameters: () => [] });
403
+
404
+ class PieChart extends ChartElement {
405
+ type = 'pie';
406
+ constructor() {
407
+ super();
408
+ Chart$1.register(PieController, ArcElement);
409
+ }
410
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PieChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
411
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: PieChart, isStandalone: true, selector: "tls-pie-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PieChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
412
+ }
413
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PieChart, decorators: [{
414
+ type: Component,
415
+ args: [{
416
+ selector: 'tls-pie-chart',
417
+ template: '',
418
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PieChart) }],
419
+ }]
420
+ }], ctorParameters: () => [] });
421
+
422
+ class PolarAreaChart extends ChartElement {
423
+ type = 'polarArea';
424
+ constructor() {
425
+ super();
426
+ Chart$1.register(PolarAreaController, ArcElement, RadialLinearScale);
427
+ }
428
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PolarAreaChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
429
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: PolarAreaChart, isStandalone: true, selector: "tls-polar-area-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PolarAreaChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
430
+ }
431
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PolarAreaChart, decorators: [{
432
+ type: Component,
433
+ args: [{
434
+ selector: 'tls-polar-area-chart',
435
+ template: '',
436
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => PolarAreaChart) }],
437
+ }]
438
+ }], ctorParameters: () => [] });
439
+
440
+ class RadarChart extends ChartElement {
441
+ type = 'radar';
442
+ constructor() {
443
+ super();
444
+ Chart$1.register(RadarController, LineElement, PointElement, RadialLinearScale);
445
+ }
446
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadarChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
447
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: RadarChart, isStandalone: true, selector: "tls-radar-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => RadarChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
448
+ }
449
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadarChart, decorators: [{
450
+ type: Component,
451
+ args: [{
452
+ selector: 'tls-radar-chart',
453
+ template: '',
454
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => RadarChart) }],
455
+ }]
456
+ }], ctorParameters: () => [] });
457
+
458
+ class ScatterChart extends ChartElement {
459
+ type = 'scatter';
460
+ constructor() {
461
+ super();
462
+ Chart$1.register(ScatterController, PointElement, LinearScale);
463
+ }
464
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ScatterChart, deps: [], target: i0.ɵɵFactoryTarget.Component });
465
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.1", type: ScatterChart, isStandalone: true, selector: "tls-scatter-chart", providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => ScatterChart) }], usesInheritance: true, ngImport: i0, template: '', isInline: true });
466
+ }
467
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ScatterChart, decorators: [{
468
+ type: Component,
469
+ args: [{
470
+ selector: 'tls-scatter-chart',
471
+ template: '',
472
+ providers: [{ provide: CHART_ELEMENT, useExisting: forwardRef(() => ScatterChart) }],
473
+ }]
474
+ }], ctorParameters: () => [] });
475
+
476
+ const DEFAULT_DIALOG_CONFIG = {
477
+ size: 'md',
478
+ closeable: true,
479
+ backdropClose: true,
480
+ };
481
+
482
+ const DIALOG_CONFIG = new InjectionToken('DIALOG_CONFIG', {
483
+ factory: () => DEFAULT_DIALOG_CONFIG,
484
+ });
485
+
486
+ class Dialog extends CdkDialogContainer {
487
+ _tlsConfig = inject(DIALOG_CONFIG);
488
+ _dialogRef = inject(DialogRef);
489
+ hostClasses = ['tls-dialog', `tls-dialog--${this._tlsConfig.size}`];
490
+ get config() {
491
+ return this._tlsConfig;
492
+ }
493
+ close() {
494
+ this._dialogRef.close();
495
+ }
496
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Dialog, deps: null, target: i0.ɵɵFactoryTarget.Component });
497
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Dialog, isStandalone: true, selector: "tls-dialog", host: { properties: { "class": "hostClasses" } }, usesInheritance: true, ngImport: i0, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-dialog__close\" type=\"button\" aria-label=\"Close dialog\" (click)=\"close()\">\n <svg viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n", dependencies: [{ kind: "directive", type: CdkPortalOutlet, selector: "[cdkPortalOutlet]", inputs: ["cdkPortalOutlet"], outputs: ["attached"], exportAs: ["cdkPortalOutlet"] }] });
498
+ }
499
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Dialog, decorators: [{
500
+ type: Component,
501
+ args: [{ selector: 'tls-dialog', imports: [CdkPortalOutlet], host: { '[class]': 'hostClasses' }, template: "<ng-template cdkPortalOutlet />\n@if (config.closeable) {\n <button class=\"tls-dialog__close\" type=\"button\" aria-label=\"Close dialog\" (click)=\"close()\">\n <svg viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n" }]
502
+ }] });
503
+
504
+ class DialogService {
505
+ _dialog = inject(Dialog$1);
506
+ _config = inject(DIALOG_CONFIG);
507
+ open(component, config) {
508
+ const resolvedConfig = {
509
+ size: config?.size ?? this._config.size,
510
+ closeable: config?.closeable ?? this._config.closeable,
511
+ backdropClose: config?.backdropClose ?? this._config.backdropClose,
512
+ };
513
+ return this._dialog.open(component, {
514
+ container: {
515
+ type: Dialog,
516
+ providers: () => [{ provide: DIALOG_CONFIG, useValue: resolvedConfig }],
517
+ },
518
+ hasBackdrop: true,
519
+ backdropClass: 'tls-dialog-backdrop',
520
+ disableClose: !resolvedConfig.backdropClose,
521
+ role: config?.role ?? 'dialog',
522
+ ariaLabel: config?.ariaLabel ?? null,
523
+ ariaLabelledBy: config?.ariaLabelledBy ?? null,
524
+ ariaDescribedBy: config?.ariaDescribedBy ?? null,
525
+ data: config?.data,
526
+ });
527
+ }
528
+ closeAll() {
529
+ this._dialog.closeAll();
530
+ }
531
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DialogService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
532
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DialogService, providedIn: 'root' });
533
+ }
534
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DialogService, decorators: [{
535
+ type: Injectable,
536
+ args: [{ providedIn: 'root' }]
537
+ }] });
538
+
150
539
  const DEFAULT_DIVIDER_CONFIG = {
151
540
  orientation: 'horizontal',
152
541
  position: 'center',
@@ -379,6 +768,560 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
379
768
  }, 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" }]
380
769
  }], 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 }] }] } });
381
770
 
771
+ const OVERLAY_POSITION_MAP = {
772
+ top: {
773
+ originX: 'center',
774
+ originY: 'top',
775
+ overlayX: 'center',
776
+ overlayY: 'bottom',
777
+ offsetX: 0,
778
+ offsetY: -1,
779
+ },
780
+ right: {
781
+ originX: 'end',
782
+ originY: 'center',
783
+ overlayX: 'start',
784
+ overlayY: 'center',
785
+ offsetX: 1,
786
+ offsetY: 0,
787
+ },
788
+ bottom: {
789
+ originX: 'center',
790
+ originY: 'bottom',
791
+ overlayX: 'center',
792
+ overlayY: 'top',
793
+ offsetX: 1,
794
+ offsetY: 1,
795
+ },
796
+ left: {
797
+ originX: 'start',
798
+ originY: 'center',
799
+ overlayX: 'end',
800
+ overlayY: 'center',
801
+ offsetX: -1,
802
+ offsetY: 0,
803
+ },
804
+ 'top-start': {
805
+ originX: 'start',
806
+ originY: 'top',
807
+ overlayX: 'start',
808
+ overlayY: 'bottom',
809
+ offsetX: 0,
810
+ offsetY: -1,
811
+ },
812
+ 'top-end': {
813
+ originX: 'end',
814
+ originY: 'top',
815
+ overlayX: 'end',
816
+ overlayY: 'bottom',
817
+ offsetX: 0,
818
+ offsetY: -1,
819
+ },
820
+ 'right-start': {
821
+ originX: 'end',
822
+ originY: 'top',
823
+ overlayX: 'start',
824
+ overlayY: 'top',
825
+ offsetX: 1,
826
+ offsetY: 0,
827
+ },
828
+ 'right-end': {
829
+ originX: 'end',
830
+ originY: 'bottom',
831
+ overlayX: 'start',
832
+ overlayY: 'bottom',
833
+ offsetX: 1,
834
+ offsetY: 0,
835
+ },
836
+ 'bottom-start': {
837
+ originX: 'start',
838
+ originY: 'bottom',
839
+ overlayX: 'start',
840
+ overlayY: 'top',
841
+ offsetX: 0,
842
+ offsetY: 1,
843
+ },
844
+ 'bottom-end': {
845
+ originX: 'end',
846
+ originY: 'bottom',
847
+ overlayX: 'end',
848
+ overlayY: 'top',
849
+ offsetX: 0,
850
+ offsetY: 1,
851
+ },
852
+ 'left-start': {
853
+ originX: 'start',
854
+ originY: 'top',
855
+ overlayX: 'end',
856
+ overlayY: 'top',
857
+ offsetX: -1,
858
+ offsetY: 0,
859
+ },
860
+ 'left-end': {
861
+ originX: 'start',
862
+ originY: 'bottom',
863
+ overlayX: 'end',
864
+ overlayY: 'bottom',
865
+ offsetX: -1,
866
+ offsetY: 0,
867
+ },
868
+ 'top-left': {
869
+ originX: 'start',
870
+ originY: 'top',
871
+ overlayX: 'end',
872
+ overlayY: 'bottom',
873
+ offsetX: -1,
874
+ offsetY: -1,
875
+ },
876
+ 'top-right': {
877
+ originX: 'end',
878
+ originY: 'top',
879
+ overlayX: 'start',
880
+ overlayY: 'bottom',
881
+ offsetX: 1,
882
+ offsetY: -1,
883
+ },
884
+ 'bottom-left': {
885
+ originX: 'start',
886
+ originY: 'bottom',
887
+ overlayX: 'end',
888
+ overlayY: 'top',
889
+ offsetX: -1,
890
+ offsetY: 1,
891
+ },
892
+ 'bottom-right': {
893
+ originX: 'end',
894
+ originY: 'bottom',
895
+ overlayX: 'start',
896
+ overlayY: 'top',
897
+ offsetX: 1,
898
+ offsetY: 1,
899
+ },
900
+ };
901
+
902
+ const buildOverlayPositions = (position, offset) => {
903
+ const preferred = OVERLAY_POSITION_MAP[position];
904
+ const rest = Object.values(OVERLAY_POSITION_MAP).filter(p => p !== preferred);
905
+ const positions = [preferred, ...rest];
906
+ return positions.map(position => ({
907
+ ...position,
908
+ offsetX: Math.sign(position.offsetX ?? 0) * offset.x,
909
+ offsetY: Math.sign(position.offsetY ?? 0) * offset.y,
910
+ }));
911
+ };
912
+
913
+ const isPlainObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
914
+
915
+ const mergeConfig = (defaults, overrides) => {
916
+ if (!overrides)
917
+ return defaults;
918
+ const result = { ...defaults };
919
+ for (const key in overrides) {
920
+ const defaultValue = defaults[key];
921
+ const overrideValue = overrides[key];
922
+ result[key] = (isPlainObject(defaultValue) && isPlainObject(overrideValue)
923
+ ? mergeConfig(defaultValue, overrideValue)
924
+ : overrideValue);
925
+ }
926
+ return result;
927
+ };
928
+
929
+ const DEFAULT_POPOVER_CONFIG = {
930
+ position: 'bottom',
931
+ offset: { x: 0, y: 4 },
932
+ };
933
+
934
+ const POPOVER_CONFIG = new InjectionToken('POPOVER_CONFIG', {
935
+ factory: () => DEFAULT_POPOVER_CONFIG,
936
+ });
937
+
938
+ class Popover {
939
+ static _counter = 0;
940
+ _overlay = inject(Overlay);
941
+ _viewContainerRef = inject(ViewContainerRef);
942
+ _config = inject(POPOVER_CONFIG);
943
+ _destroyRef = inject(DestroyRef);
944
+ _templateRef = viewChild.required('content');
945
+ _overlayRef = null;
946
+ _isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
947
+ id = `tls-popover-${++Popover._counter}`;
948
+ isOpen = this._isOpen.asReadonly();
949
+ position = input(this._config.position, ...(ngDevMode ? [{ debugName: "position" }] : []));
950
+ offset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "offset" }] : []));
951
+ ariaLabel = input(undefined, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
952
+ _positions = computed(() => buildOverlayPositions(this.position(), this.offset()), ...(ngDevMode ? [{ debugName: "_positions" }] : []));
953
+ // Public methods
954
+ open(trigger) {
955
+ if (this._overlayRef)
956
+ return;
957
+ const origin = trigger instanceof MouseEvent ? trigger.currentTarget : trigger;
958
+ const positionStrategy = this._overlay
959
+ .position()
960
+ .flexibleConnectedTo(origin)
961
+ .withPositions(this._positions());
962
+ this._overlayRef = this._overlay.create({
963
+ positionStrategy,
964
+ scrollStrategy: this._overlay.scrollStrategies.reposition(),
965
+ hasBackdrop: true,
966
+ backdropClass: 'cdk-overlay-transparent-backdrop',
967
+ });
968
+ this._overlayRef
969
+ .backdropClick()
970
+ .pipe(takeUntilDestroyed(this._destroyRef))
971
+ .subscribe(() => this.close());
972
+ this._overlayRef.attach(new TemplatePortal(this._templateRef(), this._viewContainerRef));
973
+ this._isOpen.set(true);
974
+ }
975
+ close() {
976
+ if (!this._overlayRef)
977
+ return;
978
+ this._overlayRef.dispose();
979
+ this._overlayRef = null;
980
+ this._isOpen.set(false);
981
+ }
982
+ toggle(trigger) {
983
+ if (this._overlayRef) {
984
+ this.close();
985
+ }
986
+ else {
987
+ this.open(trigger);
988
+ }
989
+ }
990
+ // Lifecycle
991
+ ngOnDestroy() {
992
+ if (this._overlayRef)
993
+ this._overlayRef.dispose();
994
+ }
995
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Popover, deps: [], target: i0.ɵɵFactoryTarget.Component });
996
+ 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: `
997
+ <ng-template #content>
998
+ <div
999
+ class="tls-popover"
1000
+ [id]="id"
1001
+ role="dialog"
1002
+ aria-modal="false"
1003
+ [attr.aria-label]="ariaLabel() ?? null"
1004
+ >
1005
+ <ng-content></ng-content>
1006
+ </div>
1007
+ </ng-template>
1008
+ `, isInline: true });
1009
+ }
1010
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Popover, decorators: [{
1011
+ type: Component,
1012
+ args: [{
1013
+ selector: 'tls-popover',
1014
+ template: `
1015
+ <ng-template #content>
1016
+ <div
1017
+ class="tls-popover"
1018
+ [id]="id"
1019
+ role="dialog"
1020
+ aria-modal="false"
1021
+ [attr.aria-label]="ariaLabel() ?? null"
1022
+ >
1023
+ <ng-content></ng-content>
1024
+ </div>
1025
+ </ng-template>
1026
+ `,
1027
+ }]
1028
+ }], propDecorators: { _templateRef: [{ type: i0.ViewChild, args: ['content', { isSignal: true }] }], 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 }] }] } });
1029
+
1030
+ class Calendar {
1031
+ // Inputs
1032
+ viewDate = input.required(...(ngDevMode ? [{ debugName: "viewDate" }] : []));
1033
+ selectedDate = input.required(...(ngDevMode ? [{ debugName: "selectedDate" }] : []));
1034
+ weekStartsOn = input.required(...(ngDevMode ? [{ debugName: "weekStartsOn" }] : []));
1035
+ weekDays = input.required(...(ngDevMode ? [{ debugName: "weekDays" }] : []));
1036
+ // Outputs
1037
+ daySelect = output();
1038
+ viewDateChange = output();
1039
+ navigateUp = output();
1040
+ // Computed
1041
+ displayedWeekDays = computed(() => {
1042
+ const startDay = this.weekStartsOn();
1043
+ const days = this.weekDays();
1044
+ return [...days.slice(startDay), ...days.slice(0, startDay)];
1045
+ }, ...(ngDevMode ? [{ debugName: "displayedWeekDays" }] : []));
1046
+ headerLabel = computed(() => format(this.viewDate(), 'MMMM yyyy'), ...(ngDevMode ? [{ debugName: "headerLabel" }] : []));
1047
+ days = computed(() => {
1048
+ const monthStart = startOfMonth(this.viewDate());
1049
+ const monthEnd = endOfMonth(this.viewDate());
1050
+ const weekStartsOn = this.weekStartsOn();
1051
+ return eachDayOfInterval({
1052
+ start: startOfWeek(monthStart, { weekStartsOn }),
1053
+ end: endOfWeek(monthEnd, { weekStartsOn }),
1054
+ });
1055
+ }, ...(ngDevMode ? [{ debugName: "days" }] : []));
1056
+ // Protected methods
1057
+ prevMonth() {
1058
+ this.viewDateChange.emit(subMonths(this.viewDate(), 1));
1059
+ }
1060
+ nextMonth() {
1061
+ this.viewDateChange.emit(addMonths(this.viewDate(), 1));
1062
+ }
1063
+ getDayLabel(day) {
1064
+ return format(day, 'd');
1065
+ }
1066
+ isSelectedDay(day) {
1067
+ const selected = this.selectedDate();
1068
+ return selected !== null && isSameDay(day, selected);
1069
+ }
1070
+ isInCurrentMonth(day) {
1071
+ return isSameMonth(day, this.viewDate());
1072
+ }
1073
+ isTodayDay(day) {
1074
+ return isToday(day);
1075
+ }
1076
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Calendar, deps: [], target: i0.ɵɵFactoryTarget.Component });
1077
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Calendar, isStandalone: true, selector: "tls-calendar", inputs: { viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: true, transformFunction: null }, weekStartsOn: { classPropertyName: "weekStartsOn", publicName: "weekStartsOn", isSignal: true, isRequired: true, transformFunction: null }, weekDays: { classPropertyName: "weekDays", publicName: "weekDays", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { daySelect: "daySelect", viewDateChange: "viewDateChange", navigateUp: "navigateUp" }, host: { classAttribute: "tls-calendar" }, ngImport: i0, template: "<div class=\"tls-calendar__header\">\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"prevMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-calendar__header-button\" (click)=\"navigateUp.emit()\">\n {{ headerLabel() }}\n </button>\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"nextMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<div class=\"tls-calendar__grid\">\n @for (day of displayedWeekDays(); track day) {\n <span class=\"tls-calendar__weekday\">{{ day }}</span>\n }\n @for (day of days(); track day.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar__day\"\n [class.tls-calendar__day--outside]=\"!isInCurrentMonth(day)\"\n [class.tls-calendar__day--today]=\"isTodayDay(day)\"\n [class.tls-calendar__day--selected]=\"isSelectedDay(day)\"\n (click)=\"daySelect.emit(day)\"\n >\n {{ getDayLabel(day) }}\n </button>\n }\n</div>\n" });
1078
+ }
1079
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Calendar, decorators: [{
1080
+ type: Component,
1081
+ args: [{ selector: 'tls-calendar', imports: [], host: { class: 'tls-calendar' }, template: "<div class=\"tls-calendar__header\">\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"prevMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-calendar__header-button\" (click)=\"navigateUp.emit()\">\n {{ headerLabel() }}\n </button>\n <button type=\"button\" class=\"tls-calendar__nav\" (click)=\"nextMonth()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<div class=\"tls-calendar__grid\">\n @for (day of displayedWeekDays(); track day) {\n <span class=\"tls-calendar__weekday\">{{ day }}</span>\n }\n @for (day of days(); track day.getTime()) {\n <button\n type=\"button\"\n class=\"tls-calendar__day\"\n [class.tls-calendar__day--outside]=\"!isInCurrentMonth(day)\"\n [class.tls-calendar__day--today]=\"isTodayDay(day)\"\n [class.tls-calendar__day--selected]=\"isSelectedDay(day)\"\n (click)=\"daySelect.emit(day)\"\n >\n {{ getDayLabel(day) }}\n </button>\n }\n</div>\n" }]
1082
+ }], propDecorators: { viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: true }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: true }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: true }] }], daySelect: [{ type: i0.Output, args: ["daySelect"] }], viewDateChange: [{ type: i0.Output, args: ["viewDateChange"] }], navigateUp: [{ type: i0.Output, args: ["navigateUp"] }] } });
1083
+
1084
+ const DEFAULT_DATE_TIME_PICKER_CONFIG = {
1085
+ mode: 'calendar',
1086
+ inline: false,
1087
+ placeholder: '',
1088
+ size: 'md',
1089
+ yearsPerPage: 12,
1090
+ weekStartsOn: 0,
1091
+ weekDays: ['Su', 'Mo', 'Tu', 'We', 'Th', 'Fr', 'Sa'],
1092
+ };
1093
+
1094
+ const DATE_TIME_PICKER_CONFIG = new InjectionToken('DATE_TIME_PICKER_CONFIG', { factory: () => DEFAULT_DATE_TIME_PICKER_CONFIG });
1095
+
1096
+ const MONTH_INDEXES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11];
1097
+ class MonthPicker {
1098
+ // Inputs
1099
+ viewDate = input.required(...(ngDevMode ? [{ debugName: "viewDate" }] : []));
1100
+ selectedDate = input.required(...(ngDevMode ? [{ debugName: "selectedDate" }] : []));
1101
+ // Outputs
1102
+ monthSelect = output();
1103
+ viewDateChange = output();
1104
+ navigateUp = output();
1105
+ // Computed
1106
+ months = MONTH_INDEXES;
1107
+ yearLabel = computed(() => format(this.viewDate(), 'yyyy'), ...(ngDevMode ? [{ debugName: "yearLabel" }] : []));
1108
+ // Protected methods
1109
+ getMonthLabel(monthIndex) {
1110
+ return format(setMonth(new Date(2000, 0, 1), monthIndex), 'MMM');
1111
+ }
1112
+ prevYear() {
1113
+ this.viewDateChange.emit(subYears(this.viewDate(), 1));
1114
+ }
1115
+ nextYear() {
1116
+ this.viewDateChange.emit(addYears(this.viewDate(), 1));
1117
+ }
1118
+ selectMonth(monthIndex) {
1119
+ this.monthSelect.emit(setMonth(this.viewDate(), monthIndex));
1120
+ }
1121
+ isSelectedMonth(monthIndex) {
1122
+ const selected = this.selectedDate();
1123
+ return (selected !== null &&
1124
+ getYear(selected) === getYear(this.viewDate()) &&
1125
+ getMonth(selected) === monthIndex);
1126
+ }
1127
+ isCurrentMonth(monthIndex) {
1128
+ return isSameMonth(new Date(), setMonth(this.viewDate(), monthIndex));
1129
+ }
1130
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MonthPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1131
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MonthPicker, isStandalone: true, selector: "tls-month-picker", inputs: { viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { monthSelect: "monthSelect", viewDateChange: "viewDateChange", navigateUp: "navigateUp" }, host: { classAttribute: "tls-month-picker" }, ngImport: i0, template: "<div class=\"tls-month-picker__header\">\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"prevYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-month-picker__header-button\" (click)=\"navigateUp.emit()\">\n {{ yearLabel() }}\n </button>\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"nextYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-month-picker__grid\">\n @for (month of months; track month) {\n <button\n type=\"button\"\n class=\"tls-month-picker__cell\"\n [class.tls-month-picker__cell--selected]=\"isSelectedMonth(month)\"\n [class.tls-month-picker__cell--current]=\"isCurrentMonth(month)\"\n (click)=\"selectMonth(month)\"\n >\n {{ getMonthLabel(month) }}\n </button>\n }\n</div>\n" });
1132
+ }
1133
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MonthPicker, decorators: [{
1134
+ type: Component,
1135
+ args: [{ selector: 'tls-month-picker', imports: [], host: { class: 'tls-month-picker' }, template: "<div class=\"tls-month-picker__header\">\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"prevYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <button type=\"button\" class=\"tls-month-picker__header-button\" (click)=\"navigateUp.emit()\">\n {{ yearLabel() }}\n </button>\n <button type=\"button\" class=\"tls-month-picker__nav\" (click)=\"nextYear()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-month-picker__grid\">\n @for (month of months; track month) {\n <button\n type=\"button\"\n class=\"tls-month-picker__cell\"\n [class.tls-month-picker__cell--selected]=\"isSelectedMonth(month)\"\n [class.tls-month-picker__cell--current]=\"isCurrentMonth(month)\"\n (click)=\"selectMonth(month)\"\n >\n {{ getMonthLabel(month) }}\n </button>\n }\n</div>\n" }]
1136
+ }], propDecorators: { viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: true }] }], monthSelect: [{ type: i0.Output, args: ["monthSelect"] }], viewDateChange: [{ type: i0.Output, args: ["viewDateChange"] }], navigateUp: [{ type: i0.Output, args: ["navigateUp"] }] } });
1137
+
1138
+ class TimePicker {
1139
+ // Inputs
1140
+ value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
1141
+ // Outputs
1142
+ timeChange = output();
1143
+ // Computed
1144
+ hours = computed(() => {
1145
+ const date = this.value();
1146
+ return date ? getHours(date) : 0;
1147
+ }, ...(ngDevMode ? [{ debugName: "hours" }] : []));
1148
+ minutes = computed(() => {
1149
+ const date = this.value();
1150
+ return date ? getMinutes(date) : 0;
1151
+ }, ...(ngDevMode ? [{ debugName: "minutes" }] : []));
1152
+ hoursLabel = computed(() => String(this.hours()).padStart(2, '0'), ...(ngDevMode ? [{ debugName: "hoursLabel" }] : []));
1153
+ minutesLabel = computed(() => String(this.minutes()).padStart(2, '0'), ...(ngDevMode ? [{ debugName: "minutesLabel" }] : []));
1154
+ // Private accessors
1155
+ get _baseDate() {
1156
+ return this.value() ?? startOfDay(new Date());
1157
+ }
1158
+ // Protected methods
1159
+ incrementHours() {
1160
+ this.timeChange.emit(setHours(this._baseDate, (this.hours() + 1) % 24));
1161
+ }
1162
+ decrementHours() {
1163
+ this.timeChange.emit(setHours(this._baseDate, (this.hours() + 23) % 24));
1164
+ }
1165
+ incrementMinutes() {
1166
+ this.timeChange.emit(setMinutes(this._baseDate, (this.minutes() + 1) % 60));
1167
+ }
1168
+ decrementMinutes() {
1169
+ this.timeChange.emit(setMinutes(this._baseDate, (this.minutes() + 59) % 60));
1170
+ }
1171
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1172
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: TimePicker, isStandalone: true, selector: "tls-time-picker", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { timeChange: "timeChange" }, host: { classAttribute: "tls-time-picker" }, ngImport: i0, template: "<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ hoursLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<span class=\"tls-time-picker__separator\">:</span>\n\n<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ minutesLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n" });
1173
+ }
1174
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TimePicker, decorators: [{
1175
+ type: Component,
1176
+ args: [{ selector: 'tls-time-picker', imports: [], host: { class: 'tls-time-picker' }, template: "<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ hoursLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementHours()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n\n<span class=\"tls-time-picker__separator\">:</span>\n\n<div class=\"tls-time-picker__column\">\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"incrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 7L7 1L13 7\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-time-picker__value\">{{ minutesLabel() }}</span>\n <button type=\"button\" class=\"tls-time-picker__arrow\" (click)=\"decrementMinutes()\">\n <svg viewBox=\"0 0 14 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L13 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n" }]
1177
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], timeChange: [{ type: i0.Output, args: ["timeChange"] }] } });
1178
+
1179
+ class YearPicker {
1180
+ // Inputs
1181
+ viewDate = input.required(...(ngDevMode ? [{ debugName: "viewDate" }] : []));
1182
+ selectedDate = input.required(...(ngDevMode ? [{ debugName: "selectedDate" }] : []));
1183
+ yearsPerPage = input.required(...(ngDevMode ? [{ debugName: "yearsPerPage" }] : []));
1184
+ // Outputs
1185
+ yearSelect = output();
1186
+ viewDateChange = output();
1187
+ // Computed
1188
+ years = computed(() => {
1189
+ const year = getYear(this.viewDate());
1190
+ const perPage = this.yearsPerPage();
1191
+ const start = Math.floor(year / perPage) * perPage;
1192
+ return Array.from({ length: perPage }, (_, index) => start + index);
1193
+ }, ...(ngDevMode ? [{ debugName: "years" }] : []));
1194
+ rangeLabel = computed(() => {
1195
+ const yearsArray = this.years();
1196
+ return `${yearsArray[0]} – ${yearsArray[yearsArray.length - 1]}`;
1197
+ }, ...(ngDevMode ? [{ debugName: "rangeLabel" }] : []));
1198
+ // Protected methods
1199
+ prevPage() {
1200
+ this.viewDateChange.emit(subYears(this.viewDate(), this.yearsPerPage()));
1201
+ }
1202
+ nextPage() {
1203
+ this.viewDateChange.emit(addYears(this.viewDate(), this.yearsPerPage()));
1204
+ }
1205
+ selectYear(year) {
1206
+ this.yearSelect.emit(setYear(this.viewDate(), year));
1207
+ }
1208
+ isSelectedYear(year) {
1209
+ const selected = this.selectedDate();
1210
+ return selected !== null && getYear(selected) === year;
1211
+ }
1212
+ isCurrentYear(year) {
1213
+ return getYear(new Date()) === year;
1214
+ }
1215
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: YearPicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1216
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: YearPicker, isStandalone: true, selector: "tls-year-picker", inputs: { viewDate: { classPropertyName: "viewDate", publicName: "viewDate", isSignal: true, isRequired: true, transformFunction: null }, selectedDate: { classPropertyName: "selectedDate", publicName: "selectedDate", isSignal: true, isRequired: true, transformFunction: null }, yearsPerPage: { classPropertyName: "yearsPerPage", publicName: "yearsPerPage", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { yearSelect: "yearSelect", viewDateChange: "viewDateChange" }, host: { classAttribute: "tls-year-picker" }, ngImport: i0, template: "<div class=\"tls-year-picker__header\">\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"prevPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-year-picker__range\">{{ rangeLabel() }}</span>\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"nextPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-year-picker__grid\">\n @for (year of years(); track year) {\n <button\n type=\"button\"\n class=\"tls-year-picker__cell\"\n [class.tls-year-picker__cell--selected]=\"isSelectedYear(year)\"\n [class.tls-year-picker__cell--current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n</div>\n" });
1217
+ }
1218
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: YearPicker, decorators: [{
1219
+ type: Component,
1220
+ args: [{ selector: 'tls-year-picker', imports: [], host: { class: 'tls-year-picker' }, template: "<div class=\"tls-year-picker__header\">\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"prevPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M7 1L1 7L7 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n <span class=\"tls-year-picker__range\">{{ rangeLabel() }}</span>\n <button type=\"button\" class=\"tls-year-picker__nav\" (click)=\"nextPage()\">\n <svg viewBox=\"0 0 8 14\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 1L7 7L1 13\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\"/>\n </svg>\n </button>\n</div>\n<div class=\"tls-year-picker__grid\">\n @for (year of years(); track year) {\n <button\n type=\"button\"\n class=\"tls-year-picker__cell\"\n [class.tls-year-picker__cell--selected]=\"isSelectedYear(year)\"\n [class.tls-year-picker__cell--current]=\"isCurrentYear(year)\"\n (click)=\"selectYear(year)\"\n >\n {{ year }}\n </button>\n }\n</div>\n" }]
1221
+ }], propDecorators: { viewDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "viewDate", required: true }] }], selectedDate: [{ type: i0.Input, args: [{ isSignal: true, alias: "selectedDate", required: true }] }], yearsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "yearsPerPage", required: true }] }], yearSelect: [{ type: i0.Output, args: ["yearSelect"] }], viewDateChange: [{ type: i0.Output, args: ["viewDateChange"] }] } });
1222
+
1223
+ class DateTimePicker extends ValueFormControl {
1224
+ // Injections
1225
+ config = inject(DATE_TIME_PICKER_CONFIG);
1226
+ // View children
1227
+ popoverComponent = viewChild('popoverRef', ...(ngDevMode ? [{ debugName: "popoverComponent" }] : []));
1228
+ // Inputs
1229
+ value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
1230
+ mode = input(this.config.mode, ...(ngDevMode ? [{ debugName: "mode" }] : []));
1231
+ inline = input(this.config.inline, { ...(ngDevMode ? { debugName: "inline" } : {}), transform: booleanAttribute });
1232
+ placeholder = input(this.config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
1233
+ size = input(this.config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
1234
+ fluid = input(false, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
1235
+ yearsPerPage = input(this.config.yearsPerPage, ...(ngDevMode ? [{ debugName: "yearsPerPage" }] : []));
1236
+ weekStartsOn = input(this.config.weekStartsOn, ...(ngDevMode ? [{ debugName: "weekStartsOn" }] : []));
1237
+ weekDays = input(this.config.weekDays, ...(ngDevMode ? [{ debugName: "weekDays" }] : []));
1238
+ // State
1239
+ viewDate = signal(new Date(), ...(ngDevMode ? [{ debugName: "viewDate" }] : []));
1240
+ activeView = signal(this.config.mode, ...(ngDevMode ? [{ debugName: "activeView" }] : []));
1241
+ // Computed
1242
+ hostClasses = computed(() => {
1243
+ const classes = ['tls-date-time-picker'];
1244
+ if (!this.inline()) {
1245
+ classes.push(`${this.CLASS_NAME}--${this.size()}`);
1246
+ if (this.fluid())
1247
+ classes.push(`${this.CLASS_NAME}--fluid`);
1248
+ return classes.concat(this.controlClasses());
1249
+ }
1250
+ return classes;
1251
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
1252
+ triggerLabel = computed(() => {
1253
+ const value = this.value();
1254
+ if (!value)
1255
+ return this.placeholder();
1256
+ const mode = this.mode();
1257
+ if (mode === 'calendar')
1258
+ return format(value, 'MMM d, yyyy');
1259
+ if (mode === 'month-picker')
1260
+ return format(value, 'MMMM yyyy');
1261
+ if (mode === 'year-picker')
1262
+ return format(value, 'yyyy');
1263
+ if (mode === 'time-picker')
1264
+ return format(value, 'HH:mm');
1265
+ return format(value, 'MMM d, yyyy HH:mm');
1266
+ }, ...(ngDevMode ? [{ debugName: "triggerLabel" }] : []));
1267
+ constructor() {
1268
+ super();
1269
+ effect(() => {
1270
+ this.activeView.set(this.mode());
1271
+ });
1272
+ }
1273
+ // Protected methods
1274
+ onViewDateChange(date) {
1275
+ this.viewDate.set(date);
1276
+ }
1277
+ onDaySelect(date) {
1278
+ if (this.notInteractive())
1279
+ return;
1280
+ this.value.set(date);
1281
+ if (this.mode() === 'calendar') {
1282
+ this.popoverComponent()?.close();
1283
+ }
1284
+ }
1285
+ onMonthSelect(date) {
1286
+ this.viewDate.set(date);
1287
+ if (this.notInteractive())
1288
+ return;
1289
+ if (this.mode() === 'month-picker') {
1290
+ this.value.set(date);
1291
+ this.popoverComponent()?.close();
1292
+ }
1293
+ else if (this.mode() === 'date-time') {
1294
+ this.activeView.set('date-time');
1295
+ }
1296
+ else {
1297
+ this.activeView.set('calendar');
1298
+ }
1299
+ }
1300
+ onYearSelect(date) {
1301
+ this.viewDate.set(date);
1302
+ if (this.notInteractive())
1303
+ return;
1304
+ if (this.mode() === 'year-picker') {
1305
+ this.value.set(date);
1306
+ this.popoverComponent()?.close();
1307
+ }
1308
+ else {
1309
+ this.activeView.set('month-picker');
1310
+ }
1311
+ }
1312
+ onTimeChange(date) {
1313
+ if (this.notInteractive())
1314
+ return;
1315
+ this.value.set(date);
1316
+ }
1317
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, deps: [], target: i0.ɵɵFactoryTarget.Component });
1318
+ 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"] }] });
1319
+ }
1320
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: DateTimePicker, decorators: [{
1321
+ type: Component,
1322
+ 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" }]
1323
+ }], 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 }] }] } });
1324
+
382
1325
  const DEFAULT_INPUT_CONFIG = {
383
1326
  size: 'md',
384
1327
  type: 'text',
@@ -401,11 +1344,10 @@ class Input extends ValueFormControl {
401
1344
  size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
402
1345
  fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
403
1346
  classes = computed(() => {
404
- const className = 'tls-form-control';
405
- const array = [className];
406
- array.push(`${className}--${this.size()}`);
1347
+ const array = [this.CLASS_NAME];
1348
+ array.push(`${this.CLASS_NAME}--${this.size()}`);
407
1349
  if (this.fluid())
408
- array.push(`${className}--fluid`);
1350
+ array.push(`${this.CLASS_NAME}--fluid`);
409
1351
  return array.concat(this.controlClasses());
410
1352
  }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
411
1353
  // Protected methods
@@ -466,11 +1408,11 @@ class Password extends ValueFormControl {
466
1408
  size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
467
1409
  fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
468
1410
  hostClasses = computed(() => {
469
- const className = 'tls-form-control-group';
470
- const array = [className];
471
- array.push(`${className}--${this.size()}`);
1411
+ const groupClass = 'tls-form-control-group';
1412
+ const array = ['tls-password', groupClass];
1413
+ array.push(`${groupClass}--${this.size()}`);
472
1414
  if (this.fluid())
473
- array.push(`${className}--fluid`);
1415
+ array.push(`${groupClass}--fluid`);
474
1416
  return array;
475
1417
  }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
476
1418
  type = computed(() => (this.visible() ? 'text' : 'password'), ...(ngDevMode ? [{ debugName: "type" }] : []));
@@ -485,15 +1427,152 @@ class Password extends ValueFormControl {
485
1427
  this.visible.update(prev => !prev);
486
1428
  }
487
1429
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, deps: null, target: i0.ɵɵFactoryTarget.Component });
488
- 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", styles: [":host{display:inline-flex}:host .tls-password-toggle{display:grid;align-items:center}:host .tls-password-toggle__item{grid-area:1/1;text-align:center}:host .tls-password-toggle__item--hidden{visibility:hidden}\n"] });
1430
+ 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" });
489
1431
  }
490
1432
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Password, decorators: [{
491
1433
  type: Component,
492
1434
  args: [{ selector: 'tls-password', host: {
493
1435
  '[class]': 'hostClasses()',
494
- }, 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", styles: [":host{display:inline-flex}:host .tls-password-toggle{display:grid;align-items:center}:host .tls-password-toggle__item{grid-area:1/1;text-align:center}:host .tls-password-toggle__item--hidden{visibility:hidden}\n"] }]
1436
+ }, 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" }]
495
1437
  }], 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 }] }] } });
496
1438
 
1439
+ // Matches strings containing only numeric digits (0–9).
1440
+ // Ensures the entire input consists exclusively of numbers.
1441
+ const PIN_INPUT_NUMERIC_REGEX = /^[0-9]+$/;
1442
+ // Matches strings containing only alphanumeric characters (a–z, A–Z, 0–9).
1443
+ // The `i` flag makes it case-insensitive (redundant here since both cases are
1444
+ // explicitly listed, but harmless). Ensures no special characters are allowed.
1445
+ const PIN_INPUT_ALPHANUMERIC_REGEX = /^[a-zA-Z0-9]+$/i;
1446
+
1447
+ const DEFAULT_PIN_INPUT_CONFIG = {
1448
+ type: 'numeric',
1449
+ length: 4,
1450
+ placeholder: '○',
1451
+ };
1452
+
1453
+ const PIN_INPUT_CONFIG = new InjectionToken('PIN_INPUT_CONFIG', {
1454
+ factory: () => DEFAULT_PIN_INPUT_CONFIG,
1455
+ });
1456
+
1457
+ class PinInput extends ValueFormControl {
1458
+ _config = inject(PIN_INPUT_CONFIG);
1459
+ _inputs = viewChildren('cell', ...(ngDevMode ? [{ debugName: "_inputs" }] : []));
1460
+ // Inputs
1461
+ value = model('', ...(ngDevMode ? [{ debugName: "value" }] : []));
1462
+ length = input(this._config.length, ...(ngDevMode ? [{ debugName: "length" }] : []));
1463
+ type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
1464
+ placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
1465
+ CLASS_NAME = 'tls-pin-input';
1466
+ // Computed
1467
+ cells = computed(() => Array.from({ length: this.length() }, (_, index) => index), ...(ngDevMode ? [{ debugName: "cells" }] : []));
1468
+ hostClasses = computed(() => {
1469
+ const className = this.CLASS_NAME;
1470
+ const array = [className];
1471
+ return array.concat(this.controlClasses());
1472
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
1473
+ // Protected methods
1474
+ getCellValue(index) {
1475
+ return this.value()[index] ?? '';
1476
+ }
1477
+ onInput(event, index) {
1478
+ const element = event.target;
1479
+ const char = element.value;
1480
+ const allowedRegExp = this._getAllowedRegularExpression();
1481
+ if (char && !allowedRegExp.test(char)) {
1482
+ element.value = this.getCellValue(index);
1483
+ return;
1484
+ }
1485
+ this._setCell(index, char);
1486
+ element.value = this.getCellValue(index);
1487
+ if (char)
1488
+ this._focusCell(index + 1);
1489
+ }
1490
+ onKeydown(event, index) {
1491
+ const element = event.target;
1492
+ if (event.key === 'Backspace') {
1493
+ event.preventDefault();
1494
+ if (this.getCellValue(index)) {
1495
+ this._setCell(index, '');
1496
+ }
1497
+ else {
1498
+ this._setCell(index - 1, '');
1499
+ this._focusCell(index - 1);
1500
+ }
1501
+ }
1502
+ else if (event.key === 'ArrowLeft') {
1503
+ event.preventDefault();
1504
+ this._focusCell(index - 1);
1505
+ }
1506
+ else if (event.key === 'ArrowRight') {
1507
+ event.preventDefault();
1508
+ this._focusCell(index + 1);
1509
+ }
1510
+ element.value = this.getCellValue(index);
1511
+ }
1512
+ onPaste(event, index) {
1513
+ event.preventDefault();
1514
+ const clipboardData = event.clipboardData;
1515
+ if (!clipboardData)
1516
+ return;
1517
+ const text = clipboardData.getData('text');
1518
+ const allowedRegExp = this._getAllowedRegularExpression();
1519
+ if (!allowedRegExp.test(text))
1520
+ return;
1521
+ const chars = text.slice(0, this.length() - this.value().length).split('');
1522
+ if (!chars.length)
1523
+ return;
1524
+ const array = this._getValueArray();
1525
+ for (let i = 0; i < chars.length; i++) {
1526
+ array[index + i] = chars[i];
1527
+ }
1528
+ this._commitArray(array);
1529
+ this._focusCell(Math.min(this.value().length, this.length()));
1530
+ }
1531
+ onFocus(event) {
1532
+ event.target.select();
1533
+ }
1534
+ // Private methods
1535
+ _setCell(index, char) {
1536
+ if (index < 0 || index >= this.length())
1537
+ return;
1538
+ const array = this._getValueArray();
1539
+ array[index] = char[1] ?? char[0];
1540
+ this._commitArray(array);
1541
+ }
1542
+ _commitArray(array) {
1543
+ let end = array.length;
1544
+ while (end > 0 && array[end - 1] === '')
1545
+ end--;
1546
+ this.value.set(array.slice(0, end).join(''));
1547
+ }
1548
+ _focusCell(index) {
1549
+ const clamped = Math.max(0, Math.min(index, this.length() - 1));
1550
+ this._inputs()[clamped].nativeElement.focus();
1551
+ }
1552
+ _getAllowedRegularExpression() {
1553
+ const type = this.type();
1554
+ if (type instanceof RegExp)
1555
+ return type;
1556
+ switch (type) {
1557
+ case 'numeric':
1558
+ return PIN_INPUT_NUMERIC_REGEX;
1559
+ case 'alphanumeric':
1560
+ return PIN_INPUT_ALPHANUMERIC_REGEX;
1561
+ }
1562
+ }
1563
+ _getValueArray() {
1564
+ return Array.from({ length: this.length() }, (_, i) => this.value()[i] ?? '');
1565
+ }
1566
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PinInput, deps: null, target: i0.ɵɵFactoryTarget.Component });
1567
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: PinInput, isStandalone: true, selector: "tls-pin-input", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, length: { classPropertyName: "length", publicName: "length", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => PinInput) }], viewQueries: [{ propertyName: "_inputs", predicate: ["cell"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (cell of cells(); track cell; let index = $index) {\n <input\n #cell\n class=\"tls-pin-input__cell\"\n type=\"text\"\n maxlength=\"2\"\n autocomplete=\"one-time-code\"\n [placeholder]=\"placeholder()\"\n [tabindex]=\"this.value().length === index ? '0' : '-1'\"\n [value]=\"getCellValue(cell)\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [attr.inputmode]=\"type() === 'numeric' ? 'numeric' : 'text'\"\n (input)=\"onInput($event, cell)\"\n (keydown)=\"onKeydown($event, cell)\"\n (paste)=\"onPaste($event, cell)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"touched.set(true)\"\n />\n}\n\n" });
1568
+ }
1569
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: PinInput, decorators: [{
1570
+ type: Component,
1571
+ args: [{ selector: 'tls-pin-input', imports: [], host: {
1572
+ '[class]': 'hostClasses()',
1573
+ }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => PinInput) }], template: "@for (cell of cells(); track cell; let index = $index) {\n <input\n #cell\n class=\"tls-pin-input__cell\"\n type=\"text\"\n maxlength=\"2\"\n autocomplete=\"one-time-code\"\n [placeholder]=\"placeholder()\"\n [tabindex]=\"this.value().length === index ? '0' : '-1'\"\n [value]=\"getCellValue(cell)\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [attr.inputmode]=\"type() === 'numeric' ? 'numeric' : 'text'\"\n (input)=\"onInput($event, cell)\"\n (keydown)=\"onKeydown($event, cell)\"\n (paste)=\"onPaste($event, cell)\"\n (focus)=\"onFocus($event)\"\n (blur)=\"touched.set(true)\"\n />\n}\n\n" }]
1574
+ }], propDecorators: { _inputs: [{ type: i0.ViewChildren, args: ['cell', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], length: [{ type: i0.Input, args: [{ isSignal: true, alias: "length", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }] } });
1575
+
497
1576
  const DEFAULT_RADIO_BUTTON_CONFIG = {};
498
1577
 
499
1578
  const RADIO_BUTTON_CONFIG = new InjectionToken('RADIO_BUTTON_CONFIG', {
@@ -521,16 +1600,223 @@ class RadioButton extends ValueFormControl {
521
1600
  return;
522
1601
  this.value.set(this.radioValue());
523
1602
  }
524
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadioButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
525
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: RadioButton, isStandalone: true, selector: "tls-radio-button", inputs: { radioValue: { classPropertyName: "radioValue", publicName: "radioValue", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()", "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, template: "<input\n type=\"radio\"\n class=\"tls-radio-button-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [value]=\"radioValue()\"\n (change)=\"check()\"\n (blur)=\"touched.set(true)\"\n/>\n<div class=\"tls-radio-button-circle\"></div>\n" });
1603
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadioButton, deps: null, target: i0.ɵɵFactoryTarget.Component });
1604
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: RadioButton, isStandalone: true, selector: "tls-radio-button", inputs: { radioValue: { classPropertyName: "radioValue", publicName: "radioValue", isSignal: true, isRequired: true, transformFunction: null }, value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()", "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, template: "<input\n type=\"radio\"\n class=\"tls-radio-button-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [value]=\"radioValue()\"\n (change)=\"check()\"\n (blur)=\"touched.set(true)\"\n/>\n<div class=\"tls-radio-button-circle\"></div>\n" });
1605
+ }
1606
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadioButton, decorators: [{
1607
+ type: Component,
1608
+ args: [{ selector: 'tls-radio-button', imports: [], host: {
1609
+ '[class]': 'hostClasses()',
1610
+ '[tabindex]': '-1',
1611
+ }, template: "<input\n type=\"radio\"\n class=\"tls-radio-button-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [value]=\"radioValue()\"\n (change)=\"check()\"\n (blur)=\"touched.set(true)\"\n/>\n<div class=\"tls-radio-button-circle\"></div>\n" }]
1612
+ }], propDecorators: { radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: true }] }], 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 }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
1613
+
1614
+ const DEFAULT_SELECT_CONFIG = {
1615
+ size: 'md',
1616
+ placeholder: '',
1617
+ fluid: false,
1618
+ clearable: false,
1619
+ };
1620
+
1621
+ const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
1622
+ factory: () => DEFAULT_SELECT_CONFIG,
1623
+ });
1624
+
1625
+ class Select extends ValueFormControl {
1626
+ _config = inject(SELECT_CONFIG);
1627
+ _overlay = inject(Overlay);
1628
+ _viewContainerRef = inject(ViewContainerRef);
1629
+ _destroyRef = inject(DestroyRef);
1630
+ _triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "_triggerElement" }] : []));
1631
+ _panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "_panelTemplate" }] : []));
1632
+ _overlayRef = null;
1633
+ _portal = null;
1634
+ value = model(undefined, ...(ngDevMode ? [{ debugName: "value" }] : []));
1635
+ inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
1636
+ options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
1637
+ optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
1638
+ optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
1639
+ optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
1640
+ placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
1641
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
1642
+ fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
1643
+ tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
1644
+ clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
1645
+ isOpen = signal(false, ...(ngDevMode ? [{ debugName: "isOpen" }] : []));
1646
+ activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
1647
+ normalizedOptions = computed(() => {
1648
+ const options = this.options();
1649
+ const optionLabel = this.optionLabel();
1650
+ const optionValue = this.optionValue();
1651
+ const optionDisabled = this.optionDisabled();
1652
+ return options.map(option => {
1653
+ if (typeof option === 'string' || typeof option === 'number') {
1654
+ return { value: option, label: String(option), disabled: false };
1655
+ }
1656
+ const typedOption = option;
1657
+ return {
1658
+ value: (optionValue ? typedOption[optionValue] : typedOption),
1659
+ label: String(optionLabel ? typedOption[optionLabel] : typedOption),
1660
+ disabled: Boolean(optionDisabled ? typedOption[optionDisabled] : false),
1661
+ };
1662
+ });
1663
+ }, ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
1664
+ hasValue = computed(() => {
1665
+ const value = this.value();
1666
+ return value !== null && value !== undefined && value !== '';
1667
+ }, ...(ngDevMode ? [{ debugName: "hasValue" }] : []));
1668
+ selectedLabel = computed(() => {
1669
+ if (!this.hasValue())
1670
+ return '';
1671
+ return this.normalizedOptions().find(option => option.value === this.value())?.label ?? '';
1672
+ }, ...(ngDevMode ? [{ debugName: "selectedLabel" }] : []));
1673
+ // Classes
1674
+ hostClasses = computed(() => {
1675
+ const array = ['tls-select'];
1676
+ if (this.isOpen())
1677
+ array.push('tls-select--open');
1678
+ array.push(`${this.CLASS_NAME}--${this.size()}`);
1679
+ if (this.fluid())
1680
+ array.push(`${this.CLASS_NAME}--fluid`);
1681
+ return array.concat(this.controlClasses());
1682
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
1683
+ // Protected methods
1684
+ open() {
1685
+ const triggerElement = this._triggerElement();
1686
+ const panelTemplate = this._panelTemplate();
1687
+ if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
1688
+ return;
1689
+ if (!this._overlayRef) {
1690
+ this._overlayRef = this._overlay.create({
1691
+ positionStrategy: this._overlay
1692
+ .position()
1693
+ .flexibleConnectedTo(triggerElement)
1694
+ .withPositions([
1695
+ { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
1696
+ {
1697
+ originX: 'start',
1698
+ originY: 'top',
1699
+ overlayX: 'start',
1700
+ overlayY: 'bottom',
1701
+ offsetY: -4,
1702
+ },
1703
+ ])
1704
+ .withFlexibleDimensions(false)
1705
+ .withPush(false),
1706
+ scrollStrategy: this._overlay.scrollStrategies.reposition(),
1707
+ hasBackdrop: true,
1708
+ panelClass: 'tls-select-panel',
1709
+ backdropClass: 'cdk-overlay-transparent-backdrop',
1710
+ });
1711
+ this._overlayRef
1712
+ .backdropClick()
1713
+ .pipe(takeUntilDestroyed(this._destroyRef))
1714
+ .subscribe(() => this.close());
1715
+ }
1716
+ this._portal ??= new TemplatePortal(panelTemplate, this._viewContainerRef);
1717
+ this._overlayRef.updateSize({ minWidth: triggerElement.nativeElement.offsetWidth });
1718
+ this._overlayRef.attach(this._portal);
1719
+ this.isOpen.set(true);
1720
+ this.activeIndex.set(this.normalizedOptions().findIndex(option => option.value === this.value()));
1721
+ }
1722
+ close() {
1723
+ this._overlayRef?.detach();
1724
+ this.isOpen.set(false);
1725
+ this.activeIndex.set(-1);
1726
+ this._triggerElement()?.nativeElement.focus();
1727
+ }
1728
+ toggle() {
1729
+ if (this.isOpen()) {
1730
+ this.close();
1731
+ }
1732
+ else {
1733
+ this.open();
1734
+ }
1735
+ }
1736
+ select(option) {
1737
+ if (option.disabled)
1738
+ return;
1739
+ this.value.set(option.value);
1740
+ this.close();
1741
+ }
1742
+ clear() {
1743
+ this.value.set(undefined);
1744
+ }
1745
+ onOptionHover(index, disabled) {
1746
+ if (!disabled)
1747
+ this.activeIndex.set(index);
1748
+ }
1749
+ onKeydown(event) {
1750
+ if (event.key === 'ArrowDown') {
1751
+ event.preventDefault();
1752
+ if (this.isOpen()) {
1753
+ this._moveActive(1);
1754
+ }
1755
+ else {
1756
+ this.open();
1757
+ }
1758
+ }
1759
+ else if (event.key === 'ArrowUp') {
1760
+ event.preventDefault();
1761
+ if (this.isOpen()) {
1762
+ this._moveActive(-1);
1763
+ }
1764
+ else {
1765
+ this.open();
1766
+ }
1767
+ }
1768
+ else if (event.key === 'Enter' || event.key === ' ') {
1769
+ event.preventDefault();
1770
+ if (!this.isOpen()) {
1771
+ this.open();
1772
+ return;
1773
+ }
1774
+ const active = this.normalizedOptions()[this.activeIndex()];
1775
+ if (active && !active.disabled)
1776
+ this.select(active);
1777
+ }
1778
+ else if (event.key === 'Escape') {
1779
+ event.preventDefault();
1780
+ if (this.isOpen())
1781
+ this.close();
1782
+ }
1783
+ else if (event.key === 'Tab') {
1784
+ if (this.isOpen())
1785
+ this.close();
1786
+ }
1787
+ else if ((event.key === 'Delete' || event.key === 'Backspace') &&
1788
+ this.clearable() &&
1789
+ this.hasValue()) {
1790
+ event.preventDefault();
1791
+ this.clear();
1792
+ }
1793
+ }
1794
+ // Private methods
1795
+ _moveActive(direction) {
1796
+ const options = this.normalizedOptions();
1797
+ let next = this.activeIndex() + direction;
1798
+ while (next >= 0 && next < options.length) {
1799
+ if (!options[next].disabled) {
1800
+ this.activeIndex.set(next);
1801
+ return;
1802
+ }
1803
+ next += direction;
1804
+ }
1805
+ }
1806
+ // Lifecycle
1807
+ ngOnDestroy() {
1808
+ if (this._overlayRef)
1809
+ this._overlayRef.dispose();
1810
+ }
1811
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
1812
+ 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" });
526
1813
  }
527
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: RadioButton, decorators: [{
1814
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, decorators: [{
528
1815
  type: Component,
529
- args: [{ selector: 'tls-radio-button', imports: [], host: {
1816
+ args: [{ selector: 'tls-select', host: {
530
1817
  '[class]': 'hostClasses()',
531
- '[tabindex]': '-1',
532
- }, template: "<input\n type=\"radio\"\n class=\"tls-radio-button-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [tabindex]=\"tabindex()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n [value]=\"radioValue()\"\n (change)=\"check()\"\n (blur)=\"touched.set(true)\"\n/>\n<div class=\"tls-radio-button-circle\"></div>\n" }]
533
- }], propDecorators: { radioValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "radioValue", required: true }] }], 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 }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
1818
+ }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], 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" }]
1819
+ }], propDecorators: { _triggerElement: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], _panelTemplate: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], 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 }] }], 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 }] }], 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 }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }] } });
534
1820
 
535
1821
  const DEFAULT_SWITCH_CONFIG = {
536
1822
  color: 'primary',
@@ -671,6 +1957,498 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
671
1957
  args: [{ selector: 'tls-icon', imports: [], host: { class: 'tls-icon' }, template: "@if (isSvg() && iconSrc()) {\n <span [innerHTML]=\"svgContent()\" class=\"tls-svg-icon\"></span>\n} @else if (iconSrc()) {\n <img [src]=\"iconSrc()\" [alt]=\"alt()\" class=\"tls-img-icon\" />\n} @else {\n {{ iconSrc() }}\n}\n" }]
672
1958
  }], propDecorators: { iconSrc: [{ type: i0.Input, args: [{ isSignal: true, alias: "iconSrc", required: true }] }], alt: [{ type: i0.Input, args: [{ isSignal: true, alias: "alt", required: false }] }], allowedSources: [{ type: i0.Input, args: [{ isSignal: true, alias: "allowedSources", required: false }] }] } });
673
1959
 
1960
+ const DEFAULT_LOADER_CONFIG = {
1961
+ size: 'md',
1962
+ width: null,
1963
+ widthRatio: 5,
1964
+ ariaLabel: 'Loading',
1965
+ };
1966
+
1967
+ const LOADER_CONFIG = new InjectionToken('LOADER_CONFIG', {
1968
+ factory: () => DEFAULT_LOADER_CONFIG,
1969
+ });
1970
+
1971
+ /**
1972
+ * Indeterminate spinner for indicating a loading state.
1973
+ *
1974
+ * @example
1975
+ * <!-- predefined size -->
1976
+ * <tls-loader size="lg" />
1977
+ *
1978
+ * @example
1979
+ * <!-- custom size in pixels -->
1980
+ * <tls-loader [size]="64" />
1981
+ *
1982
+ * @example
1983
+ * <!-- custom size with explicit stroke width -->
1984
+ * <tls-loader [size]="64" [width]="8" />
1985
+ */
1986
+ class Loader {
1987
+ _config = inject(LOADER_CONFIG);
1988
+ /** Predefined size token or custom pixel value. */
1989
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
1990
+ /** Stroke width in pixels. Overrides the size-class default for both token and numeric sizes. */
1991
+ width = input(this._config.width, ...(ngDevMode ? [{ debugName: "width" }] : []));
1992
+ /** Divisor for auto stroke width when size is a number and width is null (`size / widthRatio`). */
1993
+ widthRatio = input(this._config.widthRatio, ...(ngDevMode ? [{ debugName: "widthRatio" }] : []));
1994
+ /** Text announced by screen readers via `aria-label`. */
1995
+ ariaLabel = input(this._config.ariaLabel, ...(ngDevMode ? [{ debugName: "ariaLabel" }] : []));
1996
+ hostClasses = computed(() => {
1997
+ const className = 'tls-loader';
1998
+ const size = this.size();
1999
+ const array = [className];
2000
+ if (typeof size === 'string') {
2001
+ array.push(`${className}--${size}`);
2002
+ }
2003
+ return array;
2004
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
2005
+ hostStyles = computed(() => {
2006
+ const size = this.size();
2007
+ const width = this.width();
2008
+ if (typeof size === 'string' && width === null) {
2009
+ return null;
2010
+ }
2011
+ const styles = {};
2012
+ if (typeof size === 'number') {
2013
+ styles['--tls-loader-size'] = `${size}px`;
2014
+ }
2015
+ if (width !== null) {
2016
+ styles['--tls-loader-width'] = `${width}px`;
2017
+ }
2018
+ else {
2019
+ styles['--tls-loader-width'] = `${size / this.widthRatio()}px`;
2020
+ }
2021
+ return styles;
2022
+ }, ...(ngDevMode ? [{ debugName: "hostStyles" }] : []));
2023
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Loader, deps: [], target: i0.ɵɵFactoryTarget.Component });
2024
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Loader, isStandalone: true, selector: "tls-loader", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, widthRatio: { classPropertyName: "widthRatio", publicName: "widthRatio", isSignal: true, isRequired: false, transformFunction: null }, ariaLabel: { classPropertyName: "ariaLabel", publicName: "ariaLabel", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "status" }, properties: { "class": "hostClasses()", "style": "hostStyles()", "attr.aria-label": "ariaLabel()" } }, ngImport: i0, template: '', isInline: true });
2025
+ }
2026
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Loader, decorators: [{
2027
+ type: Component,
2028
+ args: [{
2029
+ selector: 'tls-loader',
2030
+ imports: [],
2031
+ template: '',
2032
+ host: {
2033
+ '[class]': 'hostClasses()',
2034
+ '[style]': 'hostStyles()',
2035
+ role: 'status',
2036
+ '[attr.aria-label]': 'ariaLabel()',
2037
+ },
2038
+ }]
2039
+ }], 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 }] }] } });
2040
+
2041
+ const DEFAULT_PAGINATION_CONFIG = {
2042
+ size: 'md',
2043
+ pageSize: 10,
2044
+ boundaries: 1,
2045
+ siblings: 1,
2046
+ showFirstButton: false,
2047
+ showLastButton: false,
2048
+ };
2049
+
2050
+ const PAGINATION_CONFIG = new InjectionToken('PAGINATION_CONFIG', {
2051
+ factory: () => DEFAULT_PAGINATION_CONFIG,
2052
+ });
2053
+
2054
+ class Pagination {
2055
+ _config = inject(PAGINATION_CONFIG);
2056
+ value = model(1, ...(ngDevMode ? [{ debugName: "value" }] : []));
2057
+ pageSize = input(this._config.pageSize, ...(ngDevMode ? [{ debugName: "pageSize" }] : []));
2058
+ total = input(0, ...(ngDevMode ? [{ debugName: "total" }] : []));
2059
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
2060
+ boundaries = input(this._config.boundaries, ...(ngDevMode ? [{ debugName: "boundaries" }] : []));
2061
+ siblings = input(this._config.siblings, ...(ngDevMode ? [{ debugName: "siblings" }] : []));
2062
+ showFirstButton = input(this._config.showFirstButton, { ...(ngDevMode ? { debugName: "showFirstButton" } : {}), transform: booleanAttribute });
2063
+ showLastButton = input(this._config.showLastButton, { ...(ngDevMode ? { debugName: "showLastButton" } : {}), transform: booleanAttribute });
2064
+ pageCount = computed(() => Math.ceil(this.total() / this.pageSize()), ...(ngDevMode ? [{ debugName: "pageCount" }] : []));
2065
+ visiblePages = computed(() => this._buildPages(this.pageCount(), this.value(), this.siblings(), this.boundaries()), ...(ngDevMode ? [{ debugName: "visiblePages" }] : []));
2066
+ classes = computed(() => ['tls-pagination', `tls-pagination--${this.size()}`], ...(ngDevMode ? [{ debugName: "classes" }] : []));
2067
+ // Protected methods
2068
+ setPage(page) {
2069
+ this.value.set(page);
2070
+ }
2071
+ firstPage() {
2072
+ this.value.set(1);
2073
+ }
2074
+ prevPage() {
2075
+ this.value.update(page => Math.max(1, page - 1));
2076
+ }
2077
+ nextPage() {
2078
+ this.value.update(page => Math.min(this.pageCount(), page + 1));
2079
+ }
2080
+ lastPage() {
2081
+ this.value.set(this.pageCount());
2082
+ }
2083
+ // Private methods
2084
+ /** Returns an inclusive array of integers from start to end. Returns [] if end < start. */
2085
+ _range(start, end) {
2086
+ const length = end - start + 1;
2087
+ return length > 0 ? Array.from({ length }, (_, i) => start + i) : [];
2088
+ }
2089
+ /** Computes the visible page items, inserting 'gap' where ellipsis should appear based on boundaries and siblings. */
2090
+ _buildPages(total, current, siblings, boundaries) {
2091
+ if (total <= 0)
2092
+ return [];
2093
+ // + 3: current page + two potential gap placeholders (left and right ellipsis)
2094
+ if (siblings * 2 + boundaries * 2 + 3 >= total)
2095
+ return this._range(1, total);
2096
+ const leftSiblingIndex = Math.max(current - siblings, boundaries + 1);
2097
+ const rightSiblingIndex = Math.min(current + siblings, total - boundaries);
2098
+ const showLeftGap = leftSiblingIndex > boundaries + 2;
2099
+ const showRightGap = rightSiblingIndex < total - boundaries - 1;
2100
+ const startPages = this._range(1, boundaries);
2101
+ const endPages = this._range(total - boundaries + 1, total);
2102
+ if (!showLeftGap && showRightGap) {
2103
+ // Expand left side to compensate for the missing left gap, keeping total item count stable
2104
+ return [...this._range(1, boundaries + siblings * 2 + 2), 'gap', ...endPages];
2105
+ }
2106
+ if (showLeftGap && !showRightGap) {
2107
+ // Expand right side to compensate for the missing right gap, keeping total item count stable
2108
+ return [...startPages, 'gap', ...this._range(total - boundaries - siblings * 2 - 1, total)];
2109
+ }
2110
+ return [
2111
+ ...startPages,
2112
+ 'gap',
2113
+ ...this._range(leftSiblingIndex, rightSiblingIndex),
2114
+ 'gap',
2115
+ ...endPages,
2116
+ ];
2117
+ }
2118
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Pagination, deps: [], target: i0.ɵɵFactoryTarget.Component });
2119
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Pagination, isStandalone: true, selector: "tls-pagination", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, pageSize: { classPropertyName: "pageSize", publicName: "pageSize", isSignal: true, isRequired: false, transformFunction: null }, total: { classPropertyName: "total", publicName: "total", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, boundaries: { classPropertyName: "boundaries", publicName: "boundaries", isSignal: true, isRequired: false, transformFunction: null }, siblings: { classPropertyName: "siblings", publicName: "siblings", isSignal: true, isRequired: false, transformFunction: null }, showFirstButton: { classPropertyName: "showFirstButton", publicName: "showFirstButton", isSignal: true, isRequired: false, transformFunction: null }, showLastButton: { classPropertyName: "showLastButton", publicName: "showLastButton", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "classes()" } }, ngImport: i0, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"11 17 6 12 11 7\" />\n <polyline points=\"18 17 13 12 18 7\" />\n </svg>\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"15 18 9 12 15 6\" />\n </svg>\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"13 17 18 12 13 7\" />\n <polyline points=\"6 17 11 12 6 7\" />\n </svg>\n </span>\n </button>\n}\n" });
2120
+ }
2121
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Pagination, decorators: [{
2122
+ type: Component,
2123
+ args: [{ selector: 'tls-pagination', host: { '[class]': 'classes()' }, template: "@if (showFirstButton()) {\n <button\n id=\"tls-pagination-first\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"firstPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"11 17 6 12 11 7\" />\n <polyline points=\"18 17 13 12 18 7\" />\n </svg>\n </span>\n </button>\n}\n\n<button\n id=\"tls-pagination-prev\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === 1\"\n (click)=\"prevPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"15 18 9 12 15 6\" />\n </svg>\n </span>\n</button>\n\n<ul class=\"tls-pagination__list\">\n @for (item of visiblePages(); track $index) {\n <li class=\"tls-pagination__item\">\n @if (item === 'gap') {\n <span class=\"tls-pagination__gap\">...</span>\n } @else {\n <button\n class=\"tls-pagination__item-button\"\n [class.tls-pagination__item-button--active]=\"value() === item\"\n (click)=\"setPage(item)\"\n >\n {{ item }}\n </button>\n }\n </li>\n }\n</ul>\n\n<button\n id=\"tls-pagination-next\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"nextPage()\"\n>\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"9 18 15 12 9 6\" />\n </svg>\n </span>\n</button>\n\n@if (showLastButton()) {\n <button\n id=\"tls-pagination-last\"\n class=\"tls-pagination__button\"\n [disabled]=\"value() === pageCount()\"\n (click)=\"lastPage()\"\n >\n <span class=\"tls-pagination__button-icon\">\n <svg xmlns=\"http://www.w3.org/2000/svg\"\n width=\"16\"\n height=\"16\"\n viewBox=\"0 0 24 24\"\n fill=\"none\"\n stroke=\"currentColor\"\n stroke-width=\"2\"\n stroke-linecap=\"round\"\n stroke-linejoin=\"round\">\n <polyline points=\"13 17 18 12 13 7\" />\n <polyline points=\"6 17 11 12 6 7\" />\n </svg>\n </span>\n </button>\n}\n" }]
2124
+ }], 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 }] }] } });
2125
+
2126
+ const DEFAULT_SKELETON_CONFIG = {
2127
+ size: 40,
2128
+ width: null,
2129
+ height: null,
2130
+ radius: 8,
2131
+ duration: 2500,
2132
+ rounded: false,
2133
+ animate: true,
2134
+ };
2135
+
2136
+ const SKELETON_CONFIG = new InjectionToken('SKELETON_CONFIG', {
2137
+ factory: () => DEFAULT_SKELETON_CONFIG,
2138
+ });
2139
+
2140
+ class Skeleton {
2141
+ _config = inject(SKELETON_CONFIG);
2142
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
2143
+ width = input(this._config.width, ...(ngDevMode ? [{ debugName: "width" }] : []));
2144
+ height = input(this._config.height, ...(ngDevMode ? [{ debugName: "height" }] : []));
2145
+ radius = input(this._config.radius, ...(ngDevMode ? [{ debugName: "radius" }] : []));
2146
+ duration = input(this._config.duration, ...(ngDevMode ? [{ debugName: "duration" }] : []));
2147
+ rounded = input(this._config.rounded, { ...(ngDevMode ? { debugName: "rounded" } : {}), transform: booleanAttribute });
2148
+ animate = input(this._config.animate, { ...(ngDevMode ? { debugName: "animate" } : {}), transform: booleanAttribute });
2149
+ hostClasses = computed(() => {
2150
+ const className = 'tls-skeleton';
2151
+ const array = [className];
2152
+ if (!this.animate()) {
2153
+ array.push(`${className}--no-animate`);
2154
+ }
2155
+ return array;
2156
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
2157
+ hostStyles = computed(() => {
2158
+ const size = this.size();
2159
+ const width = this.width() ?? size;
2160
+ const height = this.height() ?? size;
2161
+ const rounded = this.rounded();
2162
+ const radius = this.radius();
2163
+ return {
2164
+ '--tls-skeleton-width': `${width}px`,
2165
+ '--tls-skeleton-height': `${height}px`,
2166
+ '--tls-skeleton-radius': rounded ? '50%' : `${radius}px`,
2167
+ '--tls-skeleton-duration': `${this.duration()}ms`,
2168
+ };
2169
+ }, ...(ngDevMode ? [{ debugName: "hostStyles" }] : []));
2170
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Skeleton, deps: [], target: i0.ɵɵFactoryTarget.Component });
2171
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.1.0", version: "21.2.1", type: Skeleton, isStandalone: true, selector: "tls-skeleton", inputs: { size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null }, height: { classPropertyName: "height", publicName: "height", isSignal: true, isRequired: false, transformFunction: null }, radius: { classPropertyName: "radius", publicName: "radius", isSignal: true, isRequired: false, transformFunction: null }, duration: { classPropertyName: "duration", publicName: "duration", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null }, animate: { classPropertyName: "animate", publicName: "animate", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "aria-hidden": "true" }, properties: { "class": "hostClasses()", "style": "hostStyles()" } }, ngImport: i0, template: '', isInline: true });
2172
+ }
2173
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Skeleton, decorators: [{
2174
+ type: Component,
2175
+ args: [{
2176
+ selector: 'tls-skeleton',
2177
+ imports: [],
2178
+ template: '',
2179
+ host: {
2180
+ '[class]': 'hostClasses()',
2181
+ '[style]': 'hostStyles()',
2182
+ 'aria-hidden': 'true',
2183
+ },
2184
+ }]
2185
+ }], propDecorators: { size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], height: [{ type: i0.Input, args: [{ isSignal: true, alias: "height", required: false }] }], radius: [{ type: i0.Input, args: [{ isSignal: true, alias: "radius", required: false }] }], duration: [{ type: i0.Input, args: [{ isSignal: true, alias: "duration", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], animate: [{ type: i0.Input, args: [{ isSignal: true, alias: "animate", required: false }] }] } });
2186
+
2187
+ class StepperService {
2188
+ active = null;
2189
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: StepperService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2190
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: StepperService });
2191
+ }
2192
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: StepperService, decorators: [{
2193
+ type: Injectable
2194
+ }] });
2195
+
2196
+ const DEFAULT_STEP_CONFIG = {
2197
+ color: 'primary',
2198
+ };
2199
+ const DEFAULT_STEPPER_CONFIG = {
2200
+ orientation: 'horizontal',
2201
+ linear: false,
2202
+ step: DEFAULT_STEP_CONFIG,
2203
+ };
2204
+
2205
+ const STEPPER_CONFIG = new InjectionToken('STEPPER_CONFIG', {
2206
+ factory: () => DEFAULT_STEPPER_CONFIG,
2207
+ });
2208
+
2209
+ class Step {
2210
+ _config = inject(STEPPER_CONFIG);
2211
+ _stepperService = inject(StepperService);
2212
+ iconTemplateRef = contentChild('stepIcon', ...(ngDevMode ? [{ debugName: "iconTemplateRef" }] : []));
2213
+ completedIconTemplateRef = contentChild('stepCompletedIcon', ...(ngDevMode ? [{ debugName: "completedIconTemplateRef" }] : []));
2214
+ // Inputs
2215
+ value = input.required(...(ngDevMode ? [{ debugName: "value" }] : []));
2216
+ label = input(...(ngDevMode ? [undefined, { debugName: "label" }] : []));
2217
+ description = input(...(ngDevMode ? [undefined, { debugName: "description" }] : []));
2218
+ color = input(this._config.step.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
2219
+ disabled = input(false, ...(ngDevMode ? [{ debugName: "disabled" }] : []));
2220
+ _active = computed(() => this._stepperService.active?.() === this.value(), ...(ngDevMode ? [{ debugName: "_active" }] : []));
2221
+ hostClasses = computed(() => {
2222
+ const className = 'tls-step';
2223
+ const array = [className];
2224
+ if (this._active())
2225
+ array.push(`${className}--active`);
2226
+ if (this.disabled())
2227
+ array.push(`${className}--disabled`);
2228
+ return array;
2229
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
2230
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Step, deps: [], target: i0.ɵɵFactoryTarget.Component });
2231
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: Step, isStandalone: true, selector: "tls-step", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: true, transformFunction: null }, label: { classPropertyName: "label", publicName: "label", isSignal: true, isRequired: false, transformFunction: null }, description: { classPropertyName: "description", publicName: "description", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, disabled: { classPropertyName: "disabled", publicName: "disabled", isSignal: true, isRequired: false, transformFunction: null } }, host: { properties: { "class": "hostClasses()" } }, queries: [{ propertyName: "iconTemplateRef", first: true, predicate: ["stepIcon"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], ngImport: i0, template: "<ng-content></ng-content>\n" });
2232
+ }
2233
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Step, decorators: [{
2234
+ type: Component,
2235
+ args: [{ selector: 'tls-step', imports: [], host: {
2236
+ '[class]': 'hostClasses()',
2237
+ }, template: "<ng-content></ng-content>\n" }]
2238
+ }], propDecorators: { iconTemplateRef: [{ type: i0.ContentChild, args: ['stepIcon', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: true }] }], label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], description: [{ type: i0.Input, args: [{ isSignal: true, alias: "description", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }] } });
2239
+
2240
+ class Stepper {
2241
+ static _counter = 0;
2242
+ panelId = `tls-stepper-panel-${++Stepper._counter}`;
2243
+ _config = inject(STEPPER_CONFIG);
2244
+ _stepperService = inject(StepperService);
2245
+ steps = contentChildren(Step, ...(ngDevMode ? [{ debugName: "steps" }] : []));
2246
+ completedTemplateRef = contentChild('completedTemplate', ...(ngDevMode ? [{ debugName: "completedTemplateRef" }] : []));
2247
+ completedIconTemplateRef = contentChild('stepCompletedIcon', ...(ngDevMode ? [{ debugName: "completedIconTemplateRef" }] : []));
2248
+ _stepButtons = viewChildren('stepButton', ...(ngDevMode ? [{ debugName: "_stepButtons" }] : []));
2249
+ active = model.required(...(ngDevMode ? [{ debugName: "active" }] : []));
2250
+ orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
2251
+ completed = input(false, ...(ngDevMode ? [{ debugName: "completed" }] : []));
2252
+ linear = input(this._config.linear, ...(ngDevMode ? [{ debugName: "linear" }] : []));
2253
+ stepSelect = output();
2254
+ hostClasses = computed(() => {
2255
+ const className = 'tls-stepper';
2256
+ const array = [className];
2257
+ array.push(`${className}--${this.orientation()}`);
2258
+ if (this.completed())
2259
+ array.push(`${className}--completed`);
2260
+ return array;
2261
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
2262
+ activeIndex = computed(() => this.steps().findIndex(step => step.value() === this.active()), ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
2263
+ constructor() {
2264
+ this._stepperService.active = this.active.asReadonly();
2265
+ }
2266
+ // Protected methods
2267
+ onSelect(step, index) {
2268
+ if (step.disabled())
2269
+ return;
2270
+ if (this.linear() && index > this.activeIndex() + 1)
2271
+ return;
2272
+ this.active.set(step.value());
2273
+ const eventData = {
2274
+ index: index,
2275
+ value: step.value(),
2276
+ };
2277
+ this.stepSelect.emit(eventData);
2278
+ }
2279
+ onKeydown(event, index) {
2280
+ const orientation = this.orientation();
2281
+ const keyNext = orientation === 'horizontal' ? 'ArrowRight' : 'ArrowDown';
2282
+ const keyPrev = orientation === 'horizontal' ? 'ArrowLeft' : 'ArrowUp';
2283
+ let target = null;
2284
+ switch (event.key) {
2285
+ case keyNext:
2286
+ target = this._nextFocusable(index, 1);
2287
+ break;
2288
+ case keyPrev:
2289
+ target = this._nextFocusable(index, -1);
2290
+ break;
2291
+ case 'Home':
2292
+ target = this._nextFocusable(-1, 1);
2293
+ break;
2294
+ case 'End':
2295
+ target = this._nextFocusable(this.steps().length, -1);
2296
+ break;
2297
+ default:
2298
+ return;
2299
+ }
2300
+ event.preventDefault();
2301
+ if (target === null)
2302
+ return;
2303
+ this._stepButtons()[target]?.nativeElement.focus();
2304
+ this.onSelect(this.steps()[target], target);
2305
+ }
2306
+ // Private methods
2307
+ _nextFocusable(from, direction) {
2308
+ const steps = this.steps();
2309
+ for (let i = from + direction; i >= 0 && i < steps.length; i += direction) {
2310
+ if (!steps[i].disabled() && !(this.linear() && i > this.activeIndex() + 1))
2311
+ return i;
2312
+ }
2313
+ return null;
2314
+ }
2315
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Stepper, deps: [], target: i0.ɵɵFactoryTarget.Component });
2316
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Stepper, isStandalone: true, selector: "tls-stepper", inputs: { active: { classPropertyName: "active", publicName: "active", isSignal: true, isRequired: true, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, completed: { classPropertyName: "completed", publicName: "completed", isSignal: true, isRequired: false, transformFunction: null }, linear: { classPropertyName: "linear", publicName: "linear", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { active: "activeChange", stepSelect: "stepSelect" }, host: { properties: { "class": "hostClasses()" } }, providers: [StepperService], queries: [{ propertyName: "steps", predicate: Step, isSignal: true }, { propertyName: "completedTemplateRef", first: true, predicate: ["completedTemplate"], descendants: true, isSignal: true }, { propertyName: "completedIconTemplateRef", first: true, predicate: ["stepCompletedIcon"], descendants: true, isSignal: true }], viewQueries: [{ propertyName: "_stepButtons", predicate: ["stepButton"], descendants: true, isSignal: true }], ngImport: i0, template: "<ul class=\"tls-stepper-header\" role=\"tablist\" [attr.aria-orientation]=\"orientation()\">\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-header--${step.color()}`\"\n [class.tls-stepper-header__item--active]=\"step.value() === active()\"\n [class.tls-stepper-header__item--disabled]=\"step.disabled()\"\n [class.tls-stepper-header__item--unreachable]=\"linear() && index > activeIndex() + 1\"\n [class.tls-stepper-header__item--completed]=\"activeIndex() > index || completed()\">\n @let id = 'tls-stepper-tab-' + step.value();\n <button\n #stepButton\n class=\"tls-stepper-header-button\"\n role=\"tab\"\n type=\"button\"\n [attr.aria-controls]=\"panelId\"\n [id]=\"id\"\n [tabindex]=\"step.value() === active() ? 0 : -1\"\n [disabled]=\"step.disabled()\"\n [attr.aria-selected]=\"step.value() === active()\"\n (click)=\"onSelect(step, index)\"\n (keydown)=\"onKeydown($event, index)\"\n >\n <span class=\"tls-stepper-header-button__index\">\n @let isCompleted = activeIndex() > index || completed();\n @if (isCompleted && step.completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (isCompleted && completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (step.iconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.iconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else {\n {{ index + 1 }}\n }\n </span>\n\n <span class=\"tls-stepper-header-button__text\">\n @if (step.label()) {\n <span class=\"tls-stepper-header-button__label\">{{ step.label() }}</span>\n }\n @if (step.description()) {\n <span class=\"tls-stepper-header-button__description\">{{ step.description() }}</span>\n }\n </span>\n </button>\n @if (!last) {\n <div class=\"tls-stepper-header__divider\"></div>\n }\n </li>\n }\n</ul>\n<div class=\"tls-stepper-content\"\n [id]=\"panelId\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"'tls-stepper-tab-' + active()\">\n <ng-content></ng-content>\n @if (completed() && completedTemplateRef()) {\n <div class=\"tls-stepper-content__template\">\n <ng-container [ngTemplateOutlet]=\"completedTemplateRef()\"></ng-container>\n </div>\n }\n</div>\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2317
+ }
2318
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Stepper, decorators: [{
2319
+ type: Component,
2320
+ args: [{ selector: 'tls-stepper', imports: [NgTemplateOutlet], host: {
2321
+ '[class]': 'hostClasses()',
2322
+ }, providers: [StepperService], template: "<ul class=\"tls-stepper-header\" role=\"tablist\" [attr.aria-orientation]=\"orientation()\">\n @for (step of steps(); track step.value(); let index = $index; let last = $last) {\n <li role=\"presentation\"\n class=\"tls-stepper-header__item\"\n [class]=\"`tls-stepper-header--${step.color()}`\"\n [class.tls-stepper-header__item--active]=\"step.value() === active()\"\n [class.tls-stepper-header__item--disabled]=\"step.disabled()\"\n [class.tls-stepper-header__item--unreachable]=\"linear() && index > activeIndex() + 1\"\n [class.tls-stepper-header__item--completed]=\"activeIndex() > index || completed()\">\n @let id = 'tls-stepper-tab-' + step.value();\n <button\n #stepButton\n class=\"tls-stepper-header-button\"\n role=\"tab\"\n type=\"button\"\n [attr.aria-controls]=\"panelId\"\n [id]=\"id\"\n [tabindex]=\"step.value() === active() ? 0 : -1\"\n [disabled]=\"step.disabled()\"\n [attr.aria-selected]=\"step.value() === active()\"\n (click)=\"onSelect(step, index)\"\n (keydown)=\"onKeydown($event, index)\"\n >\n <span class=\"tls-stepper-header-button__index\">\n @let isCompleted = activeIndex() > index || completed();\n @if (isCompleted && step.completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (isCompleted && completedIconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"completedIconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else if (step.iconTemplateRef()) {\n <ng-container [ngTemplateOutlet]=\"step.iconTemplateRef() ?? null\"\n [ngTemplateOutletContext]=\"{ $implicit: index }\"></ng-container>\n } @else {\n {{ index + 1 }}\n }\n </span>\n\n <span class=\"tls-stepper-header-button__text\">\n @if (step.label()) {\n <span class=\"tls-stepper-header-button__label\">{{ step.label() }}</span>\n }\n @if (step.description()) {\n <span class=\"tls-stepper-header-button__description\">{{ step.description() }}</span>\n }\n </span>\n </button>\n @if (!last) {\n <div class=\"tls-stepper-header__divider\"></div>\n }\n </li>\n }\n</ul>\n<div class=\"tls-stepper-content\"\n [id]=\"panelId\"\n role=\"tabpanel\"\n [attr.aria-labelledby]=\"'tls-stepper-tab-' + active()\">\n <ng-content></ng-content>\n @if (completed() && completedTemplateRef()) {\n <div class=\"tls-stepper-content__template\">\n <ng-container [ngTemplateOutlet]=\"completedTemplateRef()\"></ng-container>\n </div>\n }\n</div>\n" }]
2323
+ }], ctorParameters: () => [], propDecorators: { steps: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Step), { isSignal: true }] }], completedTemplateRef: [{ type: i0.ContentChild, args: ['completedTemplate', { isSignal: true }] }], completedIconTemplateRef: [{ type: i0.ContentChild, args: ['stepCompletedIcon', { isSignal: true }] }], _stepButtons: [{ type: i0.ViewChildren, args: ['stepButton', { isSignal: true }] }], active: [{ type: i0.Input, args: [{ isSignal: true, alias: "active", required: true }] }, { type: i0.Output, args: ["activeChange"] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], completed: [{ type: i0.Input, args: [{ isSignal: true, alias: "completed", required: false }] }], linear: [{ type: i0.Input, args: [{ isSignal: true, alias: "linear", required: false }] }], stepSelect: [{ type: i0.Output, args: ["stepSelect"] }] } });
2324
+
2325
+ class TableColumn {
2326
+ key = input.required(...(ngDevMode ? [{ debugName: "key" }] : []));
2327
+ header = input(...(ngDevMode ? [undefined, { debugName: "header" }] : []));
2328
+ hidden = input(false, { ...(ngDevMode ? { debugName: "hidden" } : {}), transform: booleanAttribute });
2329
+ alignment = input(...(ngDevMode ? [undefined, { debugName: "alignment" }] : []));
2330
+ width = input(...(ngDevMode ? [undefined, { debugName: "width" }] : []));
2331
+ template = contentChild(TemplateRef, ...(ngDevMode ? [{ debugName: "template" }] : []));
2332
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TableColumn, deps: [], target: i0.ɵɵFactoryTarget.Component });
2333
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.2.0", version: "21.2.1", type: TableColumn, isStandalone: true, selector: "tls-table-column", inputs: { key: { classPropertyName: "key", publicName: "key", isSignal: true, isRequired: true, transformFunction: null }, header: { classPropertyName: "header", publicName: "header", isSignal: true, isRequired: false, transformFunction: null }, hidden: { classPropertyName: "hidden", publicName: "hidden", isSignal: true, isRequired: false, transformFunction: null }, alignment: { classPropertyName: "alignment", publicName: "alignment", isSignal: true, isRequired: false, transformFunction: null }, width: { classPropertyName: "width", publicName: "width", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "template", first: true, predicate: TemplateRef, descendants: true, isSignal: true }], ngImport: i0, template: '', isInline: true });
2334
+ }
2335
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TableColumn, decorators: [{
2336
+ type: Component,
2337
+ args: [{
2338
+ selector: 'tls-table-column',
2339
+ imports: [],
2340
+ template: '',
2341
+ }]
2342
+ }], propDecorators: { key: [{ type: i0.Input, args: [{ isSignal: true, alias: "key", required: true }] }], header: [{ type: i0.Input, args: [{ isSignal: true, alias: "header", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], alignment: [{ type: i0.Input, args: [{ isSignal: true, alias: "alignment", required: false }] }], width: [{ type: i0.Input, args: [{ isSignal: true, alias: "width", required: false }] }], template: [{ type: i0.ContentChild, args: [i0.forwardRef(() => TemplateRef), { isSignal: true }] }] } });
2343
+
2344
+ const DEFAULT_TABLE_CONFIG = {
2345
+ hideHeader: false,
2346
+ striped: false,
2347
+ };
2348
+
2349
+ const TABLE_CONFIG = new InjectionToken('TABLE_CONFIG', {
2350
+ factory: () => DEFAULT_TABLE_CONFIG,
2351
+ });
2352
+
2353
+ class Table {
2354
+ _config = inject(TABLE_CONFIG);
2355
+ data = input.required(...(ngDevMode ? [{ debugName: "data" }] : []));
2356
+ columnDefinitions = input([], ...(ngDevMode ? [{ debugName: "columnDefinitions" }] : []));
2357
+ hideHeader = input(this._config.hideHeader, { ...(ngDevMode ? { debugName: "hideHeader" } : {}), transform: booleanAttribute });
2358
+ striped = input(this._config.striped, { ...(ngDevMode ? { debugName: "striped" } : {}), transform: booleanAttribute });
2359
+ trackBy = input(...(ngDevMode ? [undefined, { debugName: "trackBy" }] : []));
2360
+ tableColumns = contentChildren(TableColumn, ...(ngDevMode ? [{ debugName: "tableColumns" }] : []));
2361
+ // Merges columnDefinitions input and tls-table-column content children into a single list.
2362
+ // Input drives order; content children override matching keys and append unmatched columns at the end.
2363
+ // Map keyed by content column key → O(1) lookup when applying overrides to each input column.
2364
+ // Set of input keys → O(1) membership check when finding content columns absent from input (extras).
2365
+ // extras: content columns with no matching input entry, appended after the merged input columns.
2366
+ effectiveColumnDefinitions = computed(() => {
2367
+ const fromContent = this._mapContentColumns(this.tableColumns());
2368
+ const fromInput = this.columnDefinitions();
2369
+ if (fromContent.length === 0)
2370
+ return fromInput;
2371
+ if (fromInput.length === 0)
2372
+ return fromContent;
2373
+ const contentByKey = new Map(fromContent.map(definition => [definition.key, definition]));
2374
+ const inputKeys = new Set(fromInput.map(definition => definition.key));
2375
+ const merged = fromInput.map(definition => ({
2376
+ ...definition,
2377
+ ...(contentByKey.get(definition.key) ?? {}),
2378
+ }));
2379
+ const extras = fromContent.filter(definition => !inputKeys.has(definition.key));
2380
+ return [...merged, ...extras];
2381
+ }, ...(ngDevMode ? [{ debugName: "effectiveColumnDefinitions" }] : []));
2382
+ columns = computed(() => this.effectiveColumnDefinitions().reduce((filtered, columnDefinition) => {
2383
+ if (!columnDefinition.hidden)
2384
+ filtered.push(columnDefinition.key);
2385
+ return filtered;
2386
+ }, []), ...(ngDevMode ? [{ debugName: "columns" }] : []));
2387
+ resolvedTrackBy = computed(() => {
2388
+ const trackBy = this.trackBy();
2389
+ if (trackBy === undefined)
2390
+ return (_, row) => row;
2391
+ if (typeof trackBy === 'string')
2392
+ return (_, row) => row[trackBy];
2393
+ return trackBy;
2394
+ }, ...(ngDevMode ? [{ debugName: "resolvedTrackBy" }] : []));
2395
+ classes = computed(() => {
2396
+ const className = 'tls-table';
2397
+ const array = [className];
2398
+ if (this.hideHeader())
2399
+ array.push(`${className}--hide-header`);
2400
+ if (this.striped())
2401
+ array.push(`${className}--striped`);
2402
+ return array;
2403
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
2404
+ dataSource = {
2405
+ connect: () => {
2406
+ return toObservable(this.data);
2407
+ },
2408
+ disconnect: () => {
2409
+ // no operation
2410
+ },
2411
+ };
2412
+ // Private methods
2413
+ _mapContentColumns(columns) {
2414
+ return columns.map((column) => this._mapContentColumn(column));
2415
+ }
2416
+ _mapContentColumn(column) {
2417
+ const definition = { key: column.key(), hidden: column.hidden() };
2418
+ const header = column.header();
2419
+ if (header !== undefined)
2420
+ definition.header = header;
2421
+ const alignment = column.alignment();
2422
+ if (alignment !== undefined)
2423
+ definition.alignment = alignment;
2424
+ const width = column.width();
2425
+ if (width !== undefined)
2426
+ definition.width = width;
2427
+ const template = column.template();
2428
+ if (template !== undefined)
2429
+ definition.template = template;
2430
+ return definition;
2431
+ }
2432
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Table, deps: [], target: i0.ɵɵFactoryTarget.Component });
2433
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Table, isStandalone: true, selector: "tls-table", inputs: { data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: true, transformFunction: null }, columnDefinitions: { classPropertyName: "columnDefinitions", publicName: "columnDefinitions", isSignal: true, isRequired: false, transformFunction: null }, hideHeader: { classPropertyName: "hideHeader", publicName: "hideHeader", isSignal: true, isRequired: false, transformFunction: null }, striped: { classPropertyName: "striped", publicName: "striped", isSignal: true, isRequired: false, transformFunction: null }, trackBy: { classPropertyName: "trackBy", publicName: "trackBy", isSignal: true, isRequired: false, transformFunction: null } }, queries: [{ propertyName: "tableColumns", predicate: TableColumn, isSignal: true }], ngImport: i0, template: "<table cdk-table [class]=\"classes()\" [dataSource]=\"dataSource\" [trackBy]=\"resolvedTrackBy()\">\n @for (column of effectiveColumnDefinitions(); track column.key) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <!-- Header cell -->\n <th cdk-header-cell *cdkHeaderCellDef class=\"tls-table__header-cell\" [style.width]=\"column.width + 'px'\">\n {{ column.header }}\n </th>\n\n <!-- Row cell -->\n <td\n cdk-cell\n *cdkCellDef=\"let data; let index = index; let count = count; let first = first; let last = last; let even = even; let odd = odd\"\n class=\"tls-table__cell\"\n [style.text-align]=\"column.alignment\"\n >\n @if (column.template) {\n <ng-container\n [ngTemplateOutlet]=\"column.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: data[column.key],\n data: data,\n index: index,\n count: count,\n first: first,\n last: last,\n even: even,\n odd: odd\n }\"\n />\n } @else {\n {{ data[column.key] }}\n }\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row *cdkHeaderRowDef=\"columns()\" class=\"tls-table__header-row\"></tr>\n\n <tr *cdkRowDef=\"let row; columns: columns()\" cdk-row class=\"tls-table__row\"></tr>\n</table>\n", styles: [":host{display:block}\n"], dependencies: [{ kind: "component", type: CdkTable, selector: "cdk-table, table[cdk-table]", inputs: ["trackBy", "dataSource", "multiTemplateDataRows", "fixedLayout", "recycleRows"], outputs: ["contentChanged"], exportAs: ["cdkTable"] }, { kind: "directive", type: CdkHeaderCell, selector: "cdk-header-cell, th[cdk-header-cell]" }, { kind: "directive", type: CdkCell, selector: "cdk-cell, td[cdk-cell]" }, { kind: "directive", type: CdkCellDef, selector: "[cdkCellDef]" }, { kind: "directive", type: CdkHeaderCellDef, selector: "[cdkHeaderCellDef]" }, { kind: "directive", type: CdkColumnDef, selector: "[cdkColumnDef]", inputs: ["cdkColumnDef", "sticky", "stickyEnd"] }, { kind: "component", type: CdkHeaderRow, selector: "cdk-header-row, tr[cdk-header-row]" }, { kind: "directive", type: CdkHeaderRowDef, selector: "[cdkHeaderRowDef]", inputs: ["cdkHeaderRowDef", "cdkHeaderRowDefSticky"] }, { kind: "component", type: CdkRow, selector: "cdk-row, tr[cdk-row]" }, { kind: "directive", type: CdkRowDef, selector: "[cdkRowDef]", inputs: ["cdkRowDefColumns", "cdkRowDefWhen"] }, { kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2434
+ }
2435
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Table, decorators: [{
2436
+ type: Component,
2437
+ args: [{ selector: 'tls-table', imports: [
2438
+ CdkTable,
2439
+ CdkHeaderCell,
2440
+ CdkCell,
2441
+ CdkCellDef,
2442
+ CdkHeaderCellDef,
2443
+ CdkColumnDef,
2444
+ CdkHeaderRow,
2445
+ CdkHeaderRowDef,
2446
+ CdkRow,
2447
+ CdkRowDef,
2448
+ NgTemplateOutlet,
2449
+ ], host: {}, template: "<table cdk-table [class]=\"classes()\" [dataSource]=\"dataSource\" [trackBy]=\"resolvedTrackBy()\">\n @for (column of effectiveColumnDefinitions(); track column.key) {\n <ng-container [cdkColumnDef]=\"column.key\">\n <!-- Header cell -->\n <th cdk-header-cell *cdkHeaderCellDef class=\"tls-table__header-cell\" [style.width]=\"column.width + 'px'\">\n {{ column.header }}\n </th>\n\n <!-- Row cell -->\n <td\n cdk-cell\n *cdkCellDef=\"let data; let index = index; let count = count; let first = first; let last = last; let even = even; let odd = odd\"\n class=\"tls-table__cell\"\n [style.text-align]=\"column.alignment\"\n >\n @if (column.template) {\n <ng-container\n [ngTemplateOutlet]=\"column.template\"\n [ngTemplateOutletContext]=\"{\n $implicit: data[column.key],\n data: data,\n index: index,\n count: count,\n first: first,\n last: last,\n even: even,\n odd: odd\n }\"\n />\n } @else {\n {{ data[column.key] }}\n }\n </td>\n </ng-container>\n }\n\n <tr cdk-header-row *cdkHeaderRowDef=\"columns()\" class=\"tls-table__header-row\"></tr>\n\n <tr *cdkRowDef=\"let row; columns: columns()\" cdk-row class=\"tls-table__row\"></tr>\n</table>\n", styles: [":host{display:block}\n"] }]
2450
+ }], propDecorators: { data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: true }] }], columnDefinitions: [{ type: i0.Input, args: [{ isSignal: true, alias: "columnDefinitions", required: false }] }], hideHeader: [{ type: i0.Input, args: [{ isSignal: true, alias: "hideHeader", required: false }] }], striped: [{ type: i0.Input, args: [{ isSignal: true, alias: "striped", required: false }] }], trackBy: [{ type: i0.Input, args: [{ isSignal: true, alias: "trackBy", required: false }] }], tableColumns: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => TableColumn), { isSignal: true }] }] } });
2451
+
674
2452
  class TabsService {
675
2453
  selected = null;
676
2454
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TabsService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
@@ -722,7 +2500,7 @@ const TABS_CONFIG = new InjectionToken('TABS_CONFIG', {
722
2500
  class Tabs {
723
2501
  _config = inject(TABS_CONFIG);
724
2502
  _tabsService = inject(TabsService);
725
- _allTabs = contentChildren(Tab, ...(ngDevMode ? [{ debugName: "_allTabs" }] : []));
2503
+ tabs = contentChildren(Tab, ...(ngDevMode ? [{ debugName: "tabs" }] : []));
726
2504
  variant = input(this._config.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
727
2505
  selected = model(null, ...(ngDevMode ? [{ debugName: "selected" }] : []));
728
2506
  hostClasses = computed(() => {
@@ -734,158 +2512,211 @@ class Tabs {
734
2512
  constructor() {
735
2513
  this._tabsService.selected = this.selected.asReadonly();
736
2514
  }
737
- // Accessors
738
- get tabs() {
739
- return this._allTabs;
740
- }
741
2515
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tabs, deps: [], target: i0.ɵɵFactoryTarget.Component });
742
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Tabs, isStandalone: true, selector: "tls-tabs", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [TabsService], queries: [{ propertyName: "_allTabs", predicate: Tab, isSignal: true }], ngImport: i0, template: "<ul class=\"tls-tabs-header\">\n @for (tab of tabs(); track tab) {\n <li\n class=\"tls-tabs-header__item\"\n [class.tls-tabs-header__item--active]=\"tab.value() === selected()\"\n >\n <button\n class=\"tls-tabs-header__item-button\"\n role=\"tab\"\n (click)=\"selected.set(tab.value())\"\n [attr.aria-selected]=\"tab.value() === selected()\"\n >\n {{ tab.label() }}\n </button>\n </li>\n }\n</ul>\n<div class=\"tls-tabs-content\">\n <ng-content></ng-content>\n</div>\n" });
2516
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Tabs, isStandalone: true, selector: "tls-tabs", inputs: { variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, selected: { classPropertyName: "selected", publicName: "selected", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { selected: "selectedChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [TabsService], queries: [{ propertyName: "tabs", predicate: Tab, isSignal: true }], ngImport: i0, template: "<ul class=\"tls-tabs-header\">\n @for (tab of tabs(); track tab) {\n <li\n class=\"tls-tabs-header__item\"\n [class.tls-tabs-header__item--active]=\"tab.value() === selected()\"\n >\n <button\n class=\"tls-tabs-header__item-button\"\n role=\"tab\"\n (click)=\"selected.set(tab.value())\"\n [attr.aria-selected]=\"tab.value() === selected()\"\n >\n {{ tab.label() }}\n </button>\n </li>\n }\n</ul>\n<div class=\"tls-tabs-content\">\n <ng-content></ng-content>\n</div>\n" });
743
2517
  }
744
2518
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tabs, decorators: [{
745
2519
  type: Component,
746
2520
  args: [{ selector: 'tls-tabs', imports: [], host: {
747
2521
  '[class]': 'hostClasses()',
748
2522
  }, providers: [TabsService], template: "<ul class=\"tls-tabs-header\">\n @for (tab of tabs(); track tab) {\n <li\n class=\"tls-tabs-header__item\"\n [class.tls-tabs-header__item--active]=\"tab.value() === selected()\"\n >\n <button\n class=\"tls-tabs-header__item-button\"\n role=\"tab\"\n (click)=\"selected.set(tab.value())\"\n [attr.aria-selected]=\"tab.value() === selected()\"\n >\n {{ tab.label() }}\n </button>\n </li>\n }\n</ul>\n<div class=\"tls-tabs-content\">\n <ng-content></ng-content>\n</div>\n" }]
749
- }], ctorParameters: () => [], propDecorators: { _allTabs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Tab), { isSignal: true }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }] } });
2523
+ }], ctorParameters: () => [], propDecorators: { tabs: [{ type: i0.ContentChildren, args: [i0.forwardRef(() => Tab), { isSignal: true }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], selected: [{ type: i0.Input, args: [{ isSignal: true, alias: "selected", required: false }] }, { type: i0.Output, args: ["selectedChange"] }] } });
2524
+
2525
+ class Tooltip {
2526
+ static _counter = 0;
2527
+ id = `tls-tooltip-${++Tooltip._counter}`;
2528
+ content = model.required(...(ngDevMode ? [{ debugName: "content" }] : []));
2529
+ templateData = model(null, ...(ngDevMode ? [{ debugName: "templateData" }] : []));
2530
+ color = model.required(...(ngDevMode ? [{ debugName: "color" }] : []));
2531
+ isString = computed(() => typeof this.content() === 'string', ...(ngDevMode ? [{ debugName: "isString" }] : []));
2532
+ templateRef = computed(() => {
2533
+ if (this.isString())
2534
+ return null;
2535
+ return this.content();
2536
+ }, ...(ngDevMode ? [{ debugName: "templateRef" }] : []));
2537
+ hostClasses = computed(() => {
2538
+ const className = 'tls-tooltip';
2539
+ const array = [className];
2540
+ array.push(`${className}--${this.color()}`);
2541
+ return array;
2542
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
2543
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tooltip, deps: [], target: i0.ɵɵFactoryTarget.Component });
2544
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Tooltip, isStandalone: true, selector: "tls-tooltip", inputs: { content: { classPropertyName: "content", publicName: "content", isSignal: true, isRequired: true, transformFunction: null }, templateData: { classPropertyName: "templateData", publicName: "templateData", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: true, transformFunction: null } }, outputs: { content: "contentChange", templateData: "templateDataChange", color: "colorChange" }, host: { attributes: { "role": "tooltip" }, properties: { "class": "hostClasses()", "id": "id" } }, ngImport: i0, template: `
2545
+ @if (isString()) {
2546
+ {{ content() }}
2547
+ } @else {
2548
+ <ng-container
2549
+ [ngTemplateOutlet]="templateRef()"
2550
+ [ngTemplateOutletContext]="{ $implicit: templateData() }"
2551
+ ></ng-container>
2552
+ }
2553
+ `, isInline: true, dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2554
+ }
2555
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Tooltip, decorators: [{
2556
+ type: Component,
2557
+ args: [{
2558
+ selector: 'tls-tooltip',
2559
+ template: `
2560
+ @if (isString()) {
2561
+ {{ content() }}
2562
+ } @else {
2563
+ <ng-container
2564
+ [ngTemplateOutlet]="templateRef()"
2565
+ [ngTemplateOutletContext]="{ $implicit: templateData() }"
2566
+ ></ng-container>
2567
+ }
2568
+ `,
2569
+ imports: [NgTemplateOutlet],
2570
+ host: {
2571
+ '[class]': 'hostClasses()',
2572
+ 'role': 'tooltip',
2573
+ '[id]': 'id',
2574
+ },
2575
+ }]
2576
+ }], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "content", required: true }] }, { type: i0.Output, args: ["contentChange"] }], templateData: [{ type: i0.Input, args: [{ isSignal: true, alias: "templateData", required: false }] }, { type: i0.Output, args: ["templateDataChange"] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: true }] }, { type: i0.Output, args: ["colorChange"] }] } });
750
2577
 
751
- const LIGHT_THEME_CLASS = 'tls-light';
752
- const DARK_THEME_CLASS = 'tls-dark';
2578
+ class TooltipService {
2579
+ _overlay = inject(Overlay);
2580
+ _overlayRef = null;
2581
+ // Public methods
2582
+ show(origin, positions, tooltipPortal) {
2583
+ this.dispose();
2584
+ const positionStrategy = this._overlay
2585
+ .position()
2586
+ .flexibleConnectedTo(origin)
2587
+ .withPositions(positions);
2588
+ this._overlayRef = this._overlay.create({
2589
+ positionStrategy,
2590
+ scrollStrategy: this._overlay.scrollStrategies.reposition(),
2591
+ });
2592
+ return this._overlayRef.attach(tooltipPortal);
2593
+ }
2594
+ move(origin, positions) {
2595
+ if (this._overlayRef) {
2596
+ const positionStrategy = this._overlay
2597
+ .position()
2598
+ .flexibleConnectedTo(origin)
2599
+ .withPositions(positions);
2600
+ this._overlayRef.updatePositionStrategy(positionStrategy);
2601
+ }
2602
+ }
2603
+ dispose() {
2604
+ if (!this._overlayRef)
2605
+ return;
2606
+ this._overlayRef.dispose();
2607
+ this._overlayRef = null;
2608
+ }
2609
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
2610
+ static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipService });
2611
+ }
2612
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipService, decorators: [{
2613
+ type: Injectable
2614
+ }] });
753
2615
 
754
- const DEFAULT_THEME_CONFIG = {
755
- defaultTheme: 'system',
756
- localStorageKey: 'tls-theme-preference',
2616
+ const DEFAULT_TOOLTIP_CONFIG = {
2617
+ positions: undefined,
2618
+ position: 'top',
2619
+ offset: { x: 4, y: 4 },
2620
+ origin: 'element',
2621
+ color: 'secondary',
757
2622
  };
758
2623
 
759
- const THEME_CONFIG = new InjectionToken('THEME_CONFIG', {
760
- factory: () => DEFAULT_THEME_CONFIG,
2624
+ const TOOLTIP_CONFIG = new InjectionToken('TOOLTIP_CONFIG', {
2625
+ factory: () => DEFAULT_TOOLTIP_CONFIG,
761
2626
  });
762
2627
 
763
- /**
764
- * Service responsible for managing the application's theme (light/dark/system).
765
- */
766
- class ThemeService {
767
- // Injections
768
- _config = inject(THEME_CONFIG);
769
- _document = inject(DOCUMENT);
770
- _rendererFactory = inject(RendererFactory2);
771
- _platformId = inject(PLATFORM_ID);
772
- _renderer = this._rendererFactory.createRenderer(null, null);
773
- _isBrowser = isPlatformBrowser(this._platformId);
774
- LS_THEME = this._config.localStorageKey;
775
- // Private
776
- _currentTheme = signal('light', ...(ngDevMode ? [{ debugName: "_currentTheme" }] : []));
777
- _currentThemePreference = signal('light', ...(ngDevMode ? [{ debugName: "_currentThemePreference" }] : []));
778
- constructor() {
779
- this._initTheme();
780
- effect(() => {
781
- if (this._isBrowser)
782
- localStorage.setItem(this.LS_THEME, this._currentThemePreference());
783
- });
2628
+ class TooltipDirective {
2629
+ _tooltipService = inject(TooltipService);
2630
+ _elementRef = inject(ElementRef);
2631
+ _renderer = inject(Renderer2);
2632
+ _config = inject(TOOLTIP_CONFIG);
2633
+ content = input('Hello', { ...(ngDevMode ? { debugName: "content" } : {}), alias: 'tlsTooltip' });
2634
+ data = input(null, ...(ngDevMode ? [{ debugName: "data" }] : []));
2635
+ tooltipDisabled = input(false, ...(ngDevMode ? [{ debugName: "tooltipDisabled" }] : []));
2636
+ tooltipOrigin = input(this._config.origin, ...(ngDevMode ? [{ debugName: "tooltipOrigin" }] : []));
2637
+ tooltipPositions = input(this._config.positions, ...(ngDevMode ? [{ debugName: "tooltipPositions" }] : []));
2638
+ tooltipPosition = input(this._config.position, ...(ngDevMode ? [{ debugName: "tooltipPosition" }] : []));
2639
+ tooltipOffset = input(this._config.offset, ...(ngDevMode ? [{ debugName: "tooltipOffset" }] : []));
2640
+ tooltipColor = input(this._config.color, ...(ngDevMode ? [{ debugName: "tooltipColor" }] : []));
2641
+ _visible = signal(false, ...(ngDevMode ? [{ debugName: "_visible" }] : []));
2642
+ _positions = computed(() => {
2643
+ const positions = this.tooltipPositions();
2644
+ if (positions)
2645
+ return positions;
2646
+ return buildOverlayPositions(this.tooltipPosition(), this.tooltipOffset());
2647
+ }, ...(ngDevMode ? [{ debugName: "_positions" }] : []));
2648
+ // Protected methods
2649
+ onMouseEnter(event) {
2650
+ this._show(event);
784
2651
  }
785
- // Accessors
786
- /**
787
- * A readonly signal of the currently applied theme (`'light'` or `'dark'`).
788
- * Reflects the resolved theme even when the preference is `'system'`.
789
- */
790
- get currentTheme() {
791
- return this._currentTheme.asReadonly();
792
- }
793
- /**
794
- * A readonly signal of the user's selected theme preference (`'light'`, `'dark'`, or `'system'`).
795
- */
796
- get currentThemePreference() {
797
- return this._currentThemePreference.asReadonly();
2652
+ onMouseMove(event) {
2653
+ if (this.tooltipOrigin() === 'cursor') {
2654
+ this._tooltipService.move({ x: event.clientX, y: event.clientY }, this._positions());
2655
+ }
798
2656
  }
799
- // Public methods
800
- /**
801
- * Toggles between `'light'` and `'dark'` themes based on the currently applied theme.
802
- * Does not toggle to `'system'`.
803
- */
804
- toggle() {
805
- this.setTheme(this._currentTheme() === 'light' ? 'dark' : 'light');
806
- }
807
- /**
808
- * Sets the theme preference and applies the corresponding theme to the document.
809
- * When `'system'` is passed, the theme is resolved from the OS color scheme preference.
810
- *
811
- * @param preference - The desired theme preference: `'light'`, `'dark'`, or `'system'`.
812
- */
813
- setTheme(preference) {
814
- this._currentThemePreference.set(preference);
815
- if (preference === 'system') {
816
- this._applyTheme(this._detectSystemTheme());
2657
+ onMouseLeave() {
2658
+ this._tooltipService.dispose();
2659
+ }
2660
+ onTouchStart(event) {
2661
+ event.preventDefault();
2662
+ if (this._visible()) {
2663
+ this._hide();
817
2664
  }
818
2665
  else {
819
- this._applyTheme(preference);
2666
+ this._show(event.touches[0]);
820
2667
  }
821
2668
  }
822
2669
  // Private methods
823
- /**
824
- * Applies the given theme to the document root element by toggling theme CSS classes.
825
- *
826
- * @param theme - The theme to apply: `'light'` or `'dark'`.
827
- */
828
- _applyTheme(theme) {
829
- const documentElement = this._document.documentElement;
830
- if (theme === 'dark') {
831
- this._renderer.removeClass(documentElement, LIGHT_THEME_CLASS);
832
- this._renderer.addClass(documentElement, DARK_THEME_CLASS);
833
- this._currentTheme.set('dark');
834
- }
835
- else {
836
- this._renderer.removeClass(documentElement, DARK_THEME_CLASS);
837
- this._renderer.addClass(documentElement, LIGHT_THEME_CLASS);
838
- this._currentTheme.set('light');
839
- }
840
- }
841
- /**
842
- * Detects the OS-level color scheme preference using the `prefers-color-scheme` media query.
843
- *
844
- * @returns `'dark'` if the OS prefers dark mode, otherwise `'light'`.
845
- */
846
- _detectSystemTheme() {
847
- return window.matchMedia('(prefers-color-scheme: dark)').matches ? 'dark' : 'light';
848
- }
849
- /**
850
- * Initializes the theme on app startup (browser only).
851
- * Reads the stored preference from localStorage, falling back to the configured default.
852
- * Also registers a listener for OS color scheme changes to reactively update the theme
853
- * when the preference is `'system'`.
854
- */
855
- _initTheme() {
856
- if (!this._isBrowser)
2670
+ _show(event) {
2671
+ if (this.tooltipDisabled())
857
2672
  return;
858
- const stored = localStorage.getItem(this.LS_THEME);
859
- this.setTheme(stored ?? this._config.defaultTheme);
860
- window.matchMedia('(prefers-color-scheme: dark)').addEventListener('change', event => {
861
- if (this._currentThemePreference() === 'system') {
862
- this._applyTheme(event.matches ? 'dark' : 'light');
863
- }
864
- });
2673
+ this._visible.set(true);
2674
+ const tooltipPortal = new ComponentPortal(Tooltip);
2675
+ const origin = this.tooltipOrigin() === 'cursor'
2676
+ ? { x: event.clientX, y: event.clientY }
2677
+ : this._elementRef.nativeElement;
2678
+ const tooltipRef = this._tooltipService.show(origin, this._positions(), tooltipPortal);
2679
+ tooltipRef.instance.content.set(this.content());
2680
+ tooltipRef.instance.templateData.set(this.data());
2681
+ tooltipRef.instance.color.set(this.tooltipColor());
2682
+ this._renderer.setAttribute(this._elementRef.nativeElement, 'aria-describedby', tooltipRef.instance.id);
2683
+ }
2684
+ _hide() {
2685
+ this._tooltipService.dispose();
2686
+ this._visible.set(false);
2687
+ this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
865
2688
  }
866
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService, deps: [], target: i0.ɵɵFactoryTarget.Injectable });
867
- static ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService });
2689
+ // Lifecycle
2690
+ ngOnDestroy() {
2691
+ this._tooltipService.dispose();
2692
+ this._renderer.removeAttribute(this._elementRef.nativeElement, 'aria-describedby');
2693
+ }
2694
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2695
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: TooltipDirective, isStandalone: true, selector: "[tlsTooltip]", inputs: { content: { classPropertyName: "content", publicName: "tlsTooltip", isSignal: true, isRequired: false, transformFunction: null }, data: { classPropertyName: "data", publicName: "data", isSignal: true, isRequired: false, transformFunction: null }, tooltipDisabled: { classPropertyName: "tooltipDisabled", publicName: "tooltipDisabled", isSignal: true, isRequired: false, transformFunction: null }, tooltipOrigin: { classPropertyName: "tooltipOrigin", publicName: "tooltipOrigin", isSignal: true, isRequired: false, transformFunction: null }, tooltipPositions: { classPropertyName: "tooltipPositions", publicName: "tooltipPositions", isSignal: true, isRequired: false, transformFunction: null }, tooltipPosition: { classPropertyName: "tooltipPosition", publicName: "tooltipPosition", isSignal: true, isRequired: false, transformFunction: null }, tooltipOffset: { classPropertyName: "tooltipOffset", publicName: "tooltipOffset", isSignal: true, isRequired: false, transformFunction: null }, tooltipColor: { classPropertyName: "tooltipColor", publicName: "tooltipColor", isSignal: true, isRequired: false, transformFunction: null } }, host: { listeners: { "mouseenter": "onMouseEnter($event)", "mousemove": "onMouseMove($event)", "mouseleave": "onMouseLeave()", "touchstart": "onTouchStart($event)" } }, providers: [TooltipService], ngImport: i0 });
868
2696
  }
869
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ThemeService, decorators: [{
870
- type: Injectable
871
- }], ctorParameters: () => [] });
2697
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: TooltipDirective, decorators: [{
2698
+ type: Directive,
2699
+ args: [{
2700
+ selector: '[tlsTooltip]',
2701
+ providers: [TooltipService],
2702
+ host: {
2703
+ '(mouseenter)': 'onMouseEnter($event)',
2704
+ '(mousemove)': 'onMouseMove($event)',
2705
+ '(mouseleave)': 'onMouseLeave()',
2706
+ '(touchstart)': 'onTouchStart($event)',
2707
+ },
2708
+ }]
2709
+ }], propDecorators: { content: [{ type: i0.Input, args: [{ isSignal: true, alias: "tlsTooltip", required: false }] }], data: [{ type: i0.Input, args: [{ isSignal: true, alias: "data", required: false }] }], tooltipDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipDisabled", required: false }] }], tooltipOrigin: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOrigin", required: false }] }], tooltipPositions: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPositions", required: false }] }], tooltipPosition: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipPosition", required: false }] }], tooltipOffset: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipOffset", required: false }] }], tooltipColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "tooltipColor", required: false }] }] } });
872
2710
 
873
2711
  // Features
874
2712
 
875
- const isPlainObject = (value) => value !== null && typeof value === 'object' && !Array.isArray(value);
876
-
877
- const mergeConfig = (defaults, overrides) => {
878
- if (!overrides)
879
- return defaults;
880
- const result = { ...defaults };
881
- for (const key in overrides) {
882
- const defaultValue = defaults[key];
883
- const overrideValue = overrides[key];
884
- result[key] = (isPlainObject(defaultValue) && isPlainObject(overrideValue)
885
- ? mergeConfig(defaultValue, overrideValue)
886
- : overrideValue);
887
- }
888
- return result;
2713
+ const provideThalassicChartConfig = (config) => {
2714
+ return makeEnvironmentProviders([
2715
+ {
2716
+ provide: CHART_CONFIG,
2717
+ useValue: mergeConfig(DEFAULT_CHART_CONFIG, config),
2718
+ },
2719
+ ]);
889
2720
  };
890
2721
 
891
2722
  const provideThalassicUIConfig = (config) => {
@@ -899,6 +2730,14 @@ const provideThalassicUIConfig = (config) => {
899
2730
  provide: BUTTON_CONFIG,
900
2731
  useValue: mergeConfig(DEFAULT_BUTTON_CONFIG, config.components.button),
901
2732
  },
2733
+ {
2734
+ provide: DATE_TIME_PICKER_CONFIG,
2735
+ useValue: mergeConfig(DEFAULT_DATE_TIME_PICKER_CONFIG, config.components.dateTimePicker),
2736
+ },
2737
+ {
2738
+ provide: DIALOG_CONFIG,
2739
+ useValue: mergeConfig(DEFAULT_DIALOG_CONFIG, config.components.dialog),
2740
+ },
902
2741
  {
903
2742
  provide: DIVIDER_CONFIG,
904
2743
  useValue: mergeConfig(DEFAULT_DIVIDER_CONFIG, config.components.divider),
@@ -908,6 +2747,10 @@ const provideThalassicUIConfig = (config) => {
908
2747
  provide: PASSWORD_CONFIG,
909
2748
  useValue: mergeConfig(DEFAULT_PASSWORD_CONFIG, config.components.password),
910
2749
  },
2750
+ {
2751
+ provide: SELECT_CONFIG,
2752
+ useValue: mergeConfig(DEFAULT_SELECT_CONFIG, config.components.select),
2753
+ },
911
2754
  {
912
2755
  provide: SWITCH_CONFIG,
913
2756
  useValue: mergeConfig(DEFAULT_SWITCH_CONFIG, config.components.switch),
@@ -917,15 +2760,28 @@ const provideThalassicUIConfig = (config) => {
917
2760
  useValue: mergeConfig(DEFAULT_FORM_ITEM_CONFIG, config.components.formItem),
918
2761
  },
919
2762
  { provide: ICON_CONFIG, useValue: mergeConfig(DEFAULT_ICON_CONFIG, config.components.icon) },
2763
+ {
2764
+ provide: PAGINATION_CONFIG,
2765
+ useValue: mergeConfig(DEFAULT_PAGINATION_CONFIG, config.components.pagination),
2766
+ },
2767
+ {
2768
+ provide: POPOVER_CONFIG,
2769
+ useValue: mergeConfig(DEFAULT_POPOVER_CONFIG, config.components.popover),
2770
+ },
2771
+ {
2772
+ provide: SKELETON_CONFIG,
2773
+ useValue: mergeConfig(DEFAULT_SKELETON_CONFIG, config.components.skeleton),
2774
+ },
2775
+ {
2776
+ provide: STEPPER_CONFIG,
2777
+ useValue: mergeConfig(DEFAULT_STEPPER_CONFIG, config.components.stepper),
2778
+ },
2779
+ { provide: TABLE_CONFIG, useValue: mergeConfig(DEFAULT_TABLE_CONFIG, config.components.table) },
920
2780
  { provide: TABS_CONFIG, useValue: mergeConfig(DEFAULT_TABS_CONFIG, config.components.tabs) },
921
- ]);
922
- };
923
-
924
- const provideTheme = (config) => {
925
- return makeEnvironmentProviders([
926
- { provide: THEME_CONFIG, useValue: { ...DEFAULT_THEME_CONFIG, ...config } },
927
- ThemeService,
928
- provideEnvironmentInitializer(() => inject(ThemeService)),
2781
+ {
2782
+ provide: TOOLTIP_CONFIG,
2783
+ useValue: mergeConfig(DEFAULT_TOOLTIP_CONFIG, config.components.tooltip),
2784
+ },
929
2785
  ]);
930
2786
  };
931
2787
 
@@ -933,5 +2789,5 @@ const provideTheme = (config) => {
933
2789
  * Generated bundle index. Do not edit.
934
2790
  */
935
2791
 
936
- export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, Checkbox, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABS_CONFIG, DIVIDER_CONFIG, Divider, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, PASSWORD_CONFIG, Password, RADIO_BUTTON_CONFIG, RadioButton, SWITCH_CONFIG, Switch, TABS_CONFIG, Tab, Tabs, ThemeService, provideThalassicUIConfig, provideTheme };
2792
+ export { ALERT_CONFIG, Alert, BUTTON_CONFIG, BarChart, BubbleChart, Button, ButtonDirective, CHART_CONFIG, CHECKBOX_CONFIG, Chart, Checkbox, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHART_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, DoughnutChart, FORM_ITEM_CONFIG, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, LineChart, Loader, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PieChart, PinInput, PolarAreaChart, Popover, RADIO_BUTTON_CONFIG, RadarChart, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, ScatterChart, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, TooltipDirective, provideThalassicChartConfig, provideThalassicUIConfig };
937
2793
  //# sourceMappingURL=thalassic-ui.mjs.map