@thalassic/ui 0.10.0 → 0.12.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,13 +1,13 @@
1
1
  import * as i0 from '@angular/core';
2
- import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, signal, contentChild, model, effect, forwardRef, Injectable, ViewContainerRef, DestroyRef, viewChild, output, viewChildren, numberAttribute, contentChildren, isDevMode, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
2
+ import { InjectionToken, inject, input, booleanAttribute, computed, Component, Directive, signal, contentChild, model, ViewContainerRef, DestroyRef, viewChild, effect, forwardRef, Injectable, output, viewChildren, numberAttribute, contentChildren, isDevMode, TemplateRef, ElementRef, Renderer2, makeEnvironmentProviders } from '@angular/core';
3
3
  import { LocationStrategy, NgTemplateOutlet } from '@angular/common';
4
4
  import { RouterLink, Router } from '@angular/router';
5
- import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
6
- import { CdkPortalOutlet, TemplatePortal, ComponentPortal } from '@angular/cdk/portal';
7
- import { format, startOfMonth, endOfMonth, eachDayOfInterval, endOfWeek, startOfWeek, subMonths, addMonths, isSameDay, isSameMonth, isToday, setMonth, subYears, addYears, getYear, getMonth, getHours, getMinutes, startOfDay, setHours, setMinutes, setYear } from 'date-fns';
8
5
  import { Overlay } from '@angular/cdk/overlay';
6
+ import { TemplatePortal, CdkPortalOutlet, ComponentPortal } from '@angular/cdk/portal';
9
7
  import { takeUntilDestroyed, rxResource, toObservable } from '@angular/core/rxjs-interop';
10
8
  import { filter, throwError, map, shareReplay } from 'rxjs';
9
+ import { CdkDialogContainer, DialogRef, Dialog as Dialog$1 } from '@angular/cdk/dialog';
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
11
  import { HttpClient } from '@angular/common/http';
12
12
  import { DomSanitizer } from '@angular/platform-browser';
13
13
  import { CdkTable, CdkHeaderCell, CdkCell, CdkCellDef, CdkHeaderCellDef, CdkColumnDef, CdkHeaderRow, CdkHeaderRowDef, CdkRow, CdkRowDef } from '@angular/cdk/table';
@@ -247,7 +247,6 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
247
247
  }, template: "@if (startIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n\n@if (label()) {\n {{ label() }}\n} @else {\n <ng-content></ng-content>\n}\n\n@if (endIconTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: context() }\" />\n}\n" }]
248
248
  }], propDecorators: { label: [{ type: i0.Input, args: [{ isSignal: true, alias: "label", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], icon: [{ type: i0.Input, args: [{ isSignal: true, alias: "icon", required: false }] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], endIconTemplate: [{ type: i0.ContentChild, args: ['endIcon', { isSignal: true }] }] } });
249
249
 
250
- const FORM_CONTROL = new InjectionToken('FORM_CONTROL');
251
250
  class FormControl {
252
251
  // Models
253
252
  touched = model(false, ...(ngDevMode ? [{ debugName: "touched" }] : []));
@@ -289,6 +288,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
289
288
  type: Directive
290
289
  }], propDecorators: { touched: [{ type: i0.Input, args: [{ isSignal: true, alias: "touched", required: false }] }, { type: i0.Output, args: ["touchedChange"] }], name: [{ type: i0.Input, args: [{ isSignal: true, alias: "name", required: false }] }], disabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "disabled", required: false }] }], readonly: [{ type: i0.Input, args: [{ isSignal: true, alias: "readonly", required: false }] }], hidden: [{ type: i0.Input, args: [{ isSignal: true, alias: "hidden", required: false }] }], invalid: [{ type: i0.Input, args: [{ isSignal: true, alias: "invalid", required: false }] }], pending: [{ type: i0.Input, args: [{ isSignal: true, alias: "pending", required: false }] }], dirty: [{ type: i0.Input, args: [{ isSignal: true, alias: "dirty", required: false }] }], errors: [{ type: i0.Input, args: [{ isSignal: true, alias: "errors", required: false }] }], required: [{ type: i0.Input, args: [{ isSignal: true, alias: "required", required: false }] }] } });
291
290
 
291
+ const FORM_CONTROL = new InjectionToken('FORM_CONTROL');
292
+
293
+ class ValueFormControl extends FormControl {
294
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
295
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: ValueFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
296
+ }
297
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, decorators: [{
298
+ type: Directive
299
+ }] });
300
+
292
301
  class CheckboxFormControl extends FormControl {
293
302
  controlClasses = computed(() => {
294
303
  const classes = this.baseControlClasses();
@@ -317,16 +326,341 @@ function normalizeOptions(options, keys) {
317
326
  });
318
327
  }
319
328
 
320
- class ValueFormControl extends FormControl {
321
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, deps: null, target: i0.ɵɵFactoryTarget.Directive });
322
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.1", type: ValueFormControl, isStandalone: true, usesInheritance: true, ngImport: i0 });
329
+ /**
330
+ * Shared base for controls that present a list of options and store the
331
+ * selected option values as an array (e.g. toggle group, chip group).
332
+ *
333
+ * Subclasses provide the visual shell plus the `type`/`unselectable` inputs
334
+ * (their defaults differ per component), while this base owns the selection
335
+ * state machine: value model, option normalization, and the toggle logic.
336
+ */
337
+ class SelectionGroup extends ValueFormControl {
338
+ value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
339
+ options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
340
+ optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
341
+ optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
342
+ optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
343
+ normalizedOptions = computed(() => normalizeOptions(this.options(), {
344
+ label: this.optionLabel(),
345
+ value: this.optionValue(),
346
+ disabled: this.optionDisabled(),
347
+ }), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
348
+ isSelected(optionValue) {
349
+ return this.value().includes(optionValue);
350
+ }
351
+ select(option) {
352
+ if (this.notInteractive() || option.disabled)
353
+ return;
354
+ if (this.type() === 'single') {
355
+ if (this.isSelected(option.value) && !this.unselectable())
356
+ return;
357
+ this.value.set(this.isSelected(option.value) ? [] : [option.value]);
358
+ return;
359
+ }
360
+ if (this.isSelected(option.value)) {
361
+ this.value.update(current => current.filter(item => item !== option.value));
362
+ }
363
+ else {
364
+ this.value.update(current => [...current, option.value]);
365
+ }
366
+ }
367
+ onKeyboardSelect(event, option) {
368
+ event.preventDefault();
369
+ this.select(option);
370
+ }
371
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: SelectionGroup, deps: null, target: i0.ɵɵFactoryTarget.Directive });
372
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: SelectionGroup, isStandalone: true, inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, usesInheritance: true, ngImport: i0 });
323
373
  }
324
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ValueFormControl, decorators: [{
374
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: SelectionGroup, decorators: [{
325
375
  type: Directive
326
- }] });
376
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }] } });
377
+
378
+ const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
379
+ /**
380
+ * Owns the CDK-Overlay lifecycle shared by the library's connected overlay
381
+ * components (popover, menu, select): create/attach, dismissal wiring
382
+ * (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
383
+ * positional and dismissal differences between components are expressed through
384
+ * {@link ConnectedOverlayConfig} rather than duplicated per component.
385
+ *
386
+ * Create one via {@link createOverlayManager} from a component field initializer
387
+ * so it is bound to the host's injection context.
388
+ */
389
+ class OverlayManager {
390
+ _overlay = inject(Overlay);
391
+ _viewContainerRef = inject(ViewContainerRef);
392
+ _destroyRef = inject(DestroyRef);
393
+ _overlayRef = null;
394
+ _config = null;
395
+ _isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
396
+ isOpen = this._isOpen.asReadonly();
397
+ // Dispose the overlay with the host. Registered in a field initializer so no
398
+ // constructor is needed.
399
+ _teardown = this._destroyRef.onDestroy(() => this._dispose());
400
+ open(config) {
401
+ if (this._isOpen())
402
+ return;
403
+ this._config = config;
404
+ if (!this._overlayRef) {
405
+ this._overlayRef = this._overlay.create({
406
+ positionStrategy: this._buildPositionStrategy(config),
407
+ scrollStrategy: config.scrollStrategy === 'close'
408
+ ? this._overlay.scrollStrategies.close()
409
+ : this._overlay.scrollStrategies.reposition(),
410
+ hasBackdrop: config.hasBackdrop ?? true,
411
+ backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
412
+ ...(config.panelClass != null && { panelClass: config.panelClass }),
413
+ });
414
+ this._wireDismissal(this._overlayRef, config);
415
+ }
416
+ if (config.minWidth != null) {
417
+ this._overlayRef.updateSize({ minWidth: config.minWidth });
418
+ }
419
+ this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
420
+ this._isOpen.set(true);
421
+ }
422
+ close() {
423
+ if (!this._isOpen())
424
+ return;
425
+ if (this._config?.reuse) {
426
+ this._overlayRef?.detach();
427
+ }
428
+ else {
429
+ this._overlayRef?.dispose();
430
+ this._overlayRef = null;
431
+ }
432
+ this._isOpen.set(false);
433
+ this._config?.onClose?.();
434
+ }
435
+ // Private
436
+ _buildPositionStrategy(config) {
437
+ let strategy = this._overlay
438
+ .position()
439
+ .flexibleConnectedTo(config.origin)
440
+ .withPositions(config.positions);
441
+ if (config.flexibleDimensions === false)
442
+ strategy = strategy.withFlexibleDimensions(false);
443
+ if (config.push === false)
444
+ strategy = strategy.withPush(false);
445
+ return strategy;
446
+ }
447
+ _wireDismissal(overlayRef, config) {
448
+ const hasBackdrop = config.hasBackdrop ?? true;
449
+ if (config.closeOnBackdropClick ?? hasBackdrop) {
450
+ overlayRef
451
+ .backdropClick()
452
+ .pipe(takeUntilDestroyed(this._destroyRef))
453
+ .subscribe(() => this.close());
454
+ }
455
+ if (config.closeOnOutsidePointer ?? !hasBackdrop) {
456
+ overlayRef
457
+ .outsidePointerEvents()
458
+ .pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'))
459
+ .subscribe(() => this.close());
460
+ }
461
+ if (config.closeOnEscape ?? true) {
462
+ overlayRef
463
+ .keydownEvents()
464
+ .pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
465
+ .subscribe(() => this.close());
466
+ }
467
+ }
468
+ _dispose() {
469
+ this._overlayRef?.dispose();
470
+ this._overlayRef = null;
471
+ }
472
+ }
473
+ /**
474
+ * Creates an {@link OverlayManager} bound to the current injection context.
475
+ * Call from a component/directive field initializer or constructor.
476
+ */
477
+ function createOverlayManager() {
478
+ return new OverlayManager();
479
+ }
480
+
481
+ /**
482
+ * Shared base for the single {@link Select} and {@link MultiSelect} controls.
483
+ * Owns everything the two listbox-combobox controls have in common: the option
484
+ * inputs, the connected overlay lifecycle, roving `aria-activedescendant`
485
+ * navigation, and the keyboard handler. The per-control differences (the value
486
+ * shape, the selected-state check, how the trigger label is built and what a
487
+ * commit does) are expressed through the abstract members below.
488
+ */
489
+ class AbstractSelect extends ValueFormControl {
490
+ overlay = createOverlayManager();
491
+ triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "triggerElement" }] : []));
492
+ panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "panelTemplate" }] : []));
493
+ // Shared inputs (config-independent)
494
+ inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
495
+ options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
496
+ optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
497
+ optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
498
+ optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
499
+ tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
500
+ isOpen = this.overlay.isOpen;
501
+ activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
502
+ normalizedOptions = computed(() => normalizeOptions(this.options(), {
503
+ label: this.optionLabel(),
504
+ value: this.optionValue(),
505
+ disabled: this.optionDisabled(),
506
+ }), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
507
+ activeDescendantId = computed(() => {
508
+ const index = this.activeIndex();
509
+ if (index < 0)
510
+ return null;
511
+ return this.optionId(index);
512
+ }, ...(ngDevMode ? [{ debugName: "activeDescendantId" }] : []));
513
+ hostClasses = computed(() => {
514
+ const array = [this.hostClassBase];
515
+ if (this.isOpen())
516
+ array.push(`${this.hostClassBase}--open`);
517
+ array.push(`${this.CLASS_NAME}--${this.size()}`);
518
+ if (this.fluid())
519
+ array.push(`${this.CLASS_NAME}--fluid`);
520
+ return array.concat(this.controlClasses());
521
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
522
+ get listboxId() {
523
+ return `${this.uniqueId}-listbox`;
524
+ }
525
+ // Protected methods
526
+ open() {
527
+ const triggerElement = this.triggerElement();
528
+ const panelTemplate = this.panelTemplate();
529
+ if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
530
+ return;
531
+ this.overlay.open({
532
+ content: panelTemplate,
533
+ origin: triggerElement,
534
+ positions: [
535
+ { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
536
+ { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
537
+ ],
538
+ flexibleDimensions: false,
539
+ push: false,
540
+ panelClass: this.panelClass,
541
+ // The control handles Escape itself via the trigger's keydown handler.
542
+ closeOnEscape: false,
543
+ minWidth: triggerElement.nativeElement.offsetWidth,
544
+ reuse: true,
545
+ onClose: () => {
546
+ this.activeIndex.set(-1);
547
+ const trigger = this.triggerElement();
548
+ if (trigger)
549
+ trigger.nativeElement.focus();
550
+ },
551
+ });
552
+ this.activeIndex.set(this.getInitialActiveIndex());
553
+ }
554
+ close() {
555
+ this.overlay.close();
556
+ }
557
+ toggle() {
558
+ if (this.isOpen()) {
559
+ this.close();
560
+ }
561
+ else {
562
+ this.open();
563
+ }
564
+ }
565
+ onOptionHover(index, disabled) {
566
+ if (!disabled)
567
+ this.activeIndex.set(index);
568
+ }
569
+ onKeydown(event) {
570
+ if (event.key === 'ArrowDown') {
571
+ event.preventDefault();
572
+ if (this.isOpen()) {
573
+ this.moveActive(1);
574
+ }
575
+ else {
576
+ this.open();
577
+ }
578
+ }
579
+ else if (event.key === 'ArrowUp') {
580
+ event.preventDefault();
581
+ if (this.isOpen()) {
582
+ this.moveActive(-1);
583
+ }
584
+ else {
585
+ this.open();
586
+ }
587
+ }
588
+ else if (event.key === 'Enter' || event.key === ' ') {
589
+ event.preventDefault();
590
+ if (!this.isOpen()) {
591
+ this.open();
592
+ return;
593
+ }
594
+ const active = this.normalizedOptions()[this.activeIndex()];
595
+ if (active && !active.disabled)
596
+ this.commitActiveOption(active);
597
+ }
598
+ else if (event.key === 'Home') {
599
+ if (!this.isOpen())
600
+ return;
601
+ event.preventDefault();
602
+ this.moveActiveToEdge(1);
603
+ }
604
+ else if (event.key === 'End') {
605
+ if (!this.isOpen())
606
+ return;
607
+ event.preventDefault();
608
+ this.moveActiveToEdge(-1);
609
+ }
610
+ else if (event.key === 'Escape') {
611
+ event.preventDefault();
612
+ if (this.isOpen())
613
+ this.close();
614
+ }
615
+ else if (event.key === 'Tab') {
616
+ if (this.isOpen())
617
+ this.close();
618
+ }
619
+ else if ((event.key === 'Delete' || event.key === 'Backspace') &&
620
+ this.clearable() &&
621
+ this.hasValue()) {
622
+ event.preventDefault();
623
+ this.clear();
624
+ }
625
+ }
626
+ optionId(index) {
627
+ return `${this.uniqueId}-option-${index}`;
628
+ }
629
+ // Private methods
630
+ moveActive(direction) {
631
+ const options = this.normalizedOptions();
632
+ let next = this.activeIndex() + direction;
633
+ while (next >= 0 && next < options.length) {
634
+ if (!options[next].disabled) {
635
+ this.activeIndex.set(next);
636
+ return;
637
+ }
638
+ next += direction;
639
+ }
640
+ }
641
+ moveActiveToEdge(direction) {
642
+ const options = this.normalizedOptions();
643
+ let next = direction === 1 ? 0 : options.length - 1;
644
+ while (next >= 0 && next < options.length) {
645
+ if (!options[next].disabled) {
646
+ this.activeIndex.set(next);
647
+ return;
648
+ }
649
+ next += direction;
650
+ }
651
+ }
652
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AbstractSelect, deps: null, target: i0.ɵɵFactoryTarget.Directive });
653
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.2.0", version: "21.2.1", type: AbstractSelect, isStandalone: true, inputs: { 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 }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, 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 });
654
+ }
655
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: AbstractSelect, decorators: [{
656
+ type: Directive
657
+ }], propDecorators: { triggerElement: [{ type: i0.ViewChild, args: ['trigger', { isSignal: true }] }], panelTemplate: [{ type: i0.ViewChild, args: ['panel', { isSignal: true }] }], 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 }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
658
+
659
+ // Form control base classes
327
660
 
328
661
  const DEFAULT_CHIP_CONTROL_CONFIG = {
329
662
  checkedColor: undefined,
663
+ checkedVariant: undefined,
330
664
  };
331
665
 
332
666
  const CHIP_CONTROL_CONFIG = new InjectionToken('CHIP_CONTROL_CONFIG', {
@@ -339,6 +673,7 @@ class ChipControl extends CheckboxFormControl {
339
673
  _chip = inject(Chip);
340
674
  checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
341
675
  checkedColor = input(this._config.checkedColor, ...(ngDevMode ? [{ debugName: "checkedColor" }] : []));
676
+ checkedVariant = input(this._config.checkedVariant, ...(ngDevMode ? [{ debugName: "checkedVariant" }] : []));
342
677
  hostClasses = computed(() => {
343
678
  const classes = ['tls-chip--control'];
344
679
  if (this.checked()) {
@@ -346,6 +681,9 @@ class ChipControl extends CheckboxFormControl {
346
681
  const color = this.checkedColor();
347
682
  if (color)
348
683
  classes.push(`tls-chip--checked-${color}`);
684
+ const variant = this.checkedVariant();
685
+ if (variant)
686
+ classes.push(`tls-chip--checked-${variant}`);
349
687
  }
350
688
  if (this.disabled())
351
689
  classes.push('tls-chip--disabled');
@@ -373,7 +711,7 @@ class ChipControl extends CheckboxFormControl {
373
711
  this.toggle();
374
712
  }
375
713
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipControl, deps: [], target: i0.ɵɵFactoryTarget.Directive });
376
- static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ChipControl, isStandalone: true, selector: "tls-chip[tlsChipControl]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "click": "toggle()", "blur": "touched.set(true)", "keydown.space": "onKeyboardToggle($event)", "keydown.enter": "onKeyboardToggle($event)" }, properties: { "class": "hostClasses()", "tabindex": "disabled() ? -1 : 0", "attr.aria-checked": "checked()", "attr.aria-disabled": "disabled()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipControl) }], usesInheritance: true, ngImport: i0 });
714
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "17.1.0", version: "21.2.1", type: ChipControl, isStandalone: true, selector: "tls-chip[tlsChipControl]", inputs: { checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null }, checkedVariant: { classPropertyName: "checkedVariant", publicName: "checkedVariant", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, listeners: { "click": "toggle()", "blur": "touched.set(true)", "keydown.space": "onKeyboardToggle($event)", "keydown.enter": "onKeyboardToggle($event)" }, properties: { "class": "hostClasses()", "tabindex": "disabled() ? -1 : 0", "attr.aria-checked": "checked()", "attr.aria-disabled": "disabled()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipControl) }], usesInheritance: true, ngImport: i0 });
377
715
  }
378
716
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipControl, decorators: [{
379
717
  type: Directive,
@@ -392,7 +730,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
392
730
  },
393
731
  providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipControl) }],
394
732
  }]
395
- }], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], checkedColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedColor", required: false }] }] } });
733
+ }], ctorParameters: () => [], propDecorators: { checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], checkedColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedColor", required: false }] }], checkedVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedVariant", required: false }] }] } });
396
734
 
397
735
  const DEFAULT_DIALOG_CONFIG = {
398
736
  size: 'md',
@@ -641,144 +979,41 @@ const CHECKBOX_CONFIG = new InjectionToken('CHECKBOX_CONFIG', {
641
979
  factory: () => DEFAULT_CHECKBOX_CONFIG,
642
980
  });
643
981
 
644
- class Checkbox extends CheckboxFormControl {
645
- _config = inject(CHECKBOX_CONFIG);
646
- CLASS_NAME = 'tls-checkbox';
647
- indeterminate = model(false, ...(ngDevMode ? [{ debugName: "indeterminate" }] : []));
648
- checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
649
- inputId = input(...(ngDevMode ? [undefined, { debugName: "inputId" }] : []));
650
- tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
651
- hostClasses = computed(() => {
652
- const className = this.CLASS_NAME;
653
- const array = [className];
654
- if (this.indeterminate())
655
- array.push(`${className}--indeterminate`);
656
- return array.concat(this.controlClasses());
657
- }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
658
- // Protected methods
659
- toggle() {
660
- if (this.notInteractive())
661
- return;
662
- this.checked.update(prev => !prev);
663
- }
664
- onKeyboardToggle(event) {
665
- event.preventDefault();
666
- this.toggle();
667
- }
668
- static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Checkbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
669
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Checkbox, isStandalone: true, selector: "tls-checkbox", inputs: { indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indeterminate: "indeterminateChange", checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, properties: { "class": "hostClasses()", "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, 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" });
670
- }
671
- i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Checkbox, decorators: [{
672
- type: Component,
673
- args: [{ selector: 'tls-checkbox', imports: [], host: {
674
- role: 'checkbox',
675
- '[class]': 'hostClasses()',
676
- '[tabindex]': '-1',
677
- }, template: "<input\n type=\"checkbox\"\n class=\"tls-checkbox-input\"\n [id]=\"inputId()\"\n [name]=\"name()\"\n [disabled]=\"disabled()\"\n [readonly]=\"readonly()\"\n [checked]=\"checked()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardToggle($event)\"\n (keydown.enter)=\"onKeyboardToggle($event)\"\n/>\n<div class=\"tls-checkbox-icon\">\n @if (indeterminate()) {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M288-444v-72h384v72H288Z\" />\n </svg>\n } @else {\n <svg\n xmlns=\"http://www.w3.org/2000/svg\"\n height=\"20px\"\n viewBox=\"0 -960 960 960\"\n width=\"20px\"\n fill=\"currentColor\"\n >\n <path d=\"M400-301 240-461l51-51 109 109 269-269 51 51-320 320Z\" />\n </svg>\n }\n</div>\n" }]
678
- }], propDecorators: { indeterminate: [{ type: i0.Input, args: [{ isSignal: true, alias: "indeterminate", required: false }] }, { type: i0.Output, args: ["indeterminateChange"] }], checked: [{ type: i0.Input, args: [{ isSignal: true, alias: "checked", required: false }] }, { type: i0.Output, args: ["checkedChange"] }], inputId: [{ type: i0.Input, args: [{ isSignal: true, alias: "inputId", required: false }] }], tabindex: [{ type: i0.Input, args: [{ isSignal: true, alias: "tabindex", required: false }] }] } });
679
-
680
- const TRANSPARENT_BACKDROP_CLASS = 'cdk-overlay-transparent-backdrop';
681
- /**
682
- * Owns the CDK-Overlay lifecycle shared by the library's connected overlay
683
- * components (popover, menu, select): create/attach, dismissal wiring
684
- * (backdrop / outside-pointer / Escape), `isOpen` state, and disposal. The
685
- * positional and dismissal differences between components are expressed through
686
- * {@link ConnectedOverlayConfig} rather than duplicated per component.
687
- *
688
- * Create one via {@link createOverlayManager} from a component field initializer
689
- * so it is bound to the host's injection context.
690
- */
691
- class OverlayManager {
692
- _overlay = inject(Overlay);
693
- _viewContainerRef = inject(ViewContainerRef);
694
- _destroyRef = inject(DestroyRef);
695
- _overlayRef = null;
696
- _config = null;
697
- _isOpen = signal(false, ...(ngDevMode ? [{ debugName: "_isOpen" }] : []));
698
- isOpen = this._isOpen.asReadonly();
699
- // Dispose the overlay with the host. Registered in a field initializer so no
700
- // constructor is needed.
701
- _teardown = this._destroyRef.onDestroy(() => this._dispose());
702
- open(config) {
703
- if (this._isOpen())
704
- return;
705
- this._config = config;
706
- if (!this._overlayRef) {
707
- this._overlayRef = this._overlay.create({
708
- positionStrategy: this._buildPositionStrategy(config),
709
- scrollStrategy: config.scrollStrategy === 'close'
710
- ? this._overlay.scrollStrategies.close()
711
- : this._overlay.scrollStrategies.reposition(),
712
- hasBackdrop: config.hasBackdrop ?? true,
713
- backdropClass: config.backdropClass ?? TRANSPARENT_BACKDROP_CLASS,
714
- ...(config.panelClass != null && { panelClass: config.panelClass }),
715
- });
716
- this._wireDismissal(this._overlayRef, config);
717
- }
718
- if (config.minWidth != null) {
719
- this._overlayRef.updateSize({ minWidth: config.minWidth });
720
- }
721
- this._overlayRef.attach(new TemplatePortal(config.content, this._viewContainerRef));
722
- this._isOpen.set(true);
723
- }
724
- close() {
725
- if (!this._isOpen())
726
- return;
727
- if (this._config?.reuse) {
728
- this._overlayRef?.detach();
729
- }
730
- else {
731
- this._overlayRef?.dispose();
732
- this._overlayRef = null;
733
- }
734
- this._isOpen.set(false);
735
- this._config?.onClose?.();
736
- }
737
- // Private
738
- _buildPositionStrategy(config) {
739
- let strategy = this._overlay
740
- .position()
741
- .flexibleConnectedTo(config.origin)
742
- .withPositions(config.positions);
743
- if (config.flexibleDimensions === false)
744
- strategy = strategy.withFlexibleDimensions(false);
745
- if (config.push === false)
746
- strategy = strategy.withPush(false);
747
- return strategy;
748
- }
749
- _wireDismissal(overlayRef, config) {
750
- const hasBackdrop = config.hasBackdrop ?? true;
751
- if (config.closeOnBackdropClick ?? hasBackdrop) {
752
- overlayRef
753
- .backdropClick()
754
- .pipe(takeUntilDestroyed(this._destroyRef))
755
- .subscribe(() => this.close());
756
- }
757
- if (config.closeOnOutsidePointer ?? !hasBackdrop) {
758
- overlayRef
759
- .outsidePointerEvents()
760
- .pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.type === 'click' || event.type === 'auxclick'))
761
- .subscribe(() => this.close());
762
- }
763
- if (config.closeOnEscape ?? true) {
764
- overlayRef
765
- .keydownEvents()
766
- .pipe(takeUntilDestroyed(this._destroyRef), filter(event => event.key === 'Escape'))
767
- .subscribe(() => this.close());
768
- }
982
+ class Checkbox extends CheckboxFormControl {
983
+ _config = inject(CHECKBOX_CONFIG);
984
+ CLASS_NAME = 'tls-checkbox';
985
+ indeterminate = model(false, ...(ngDevMode ? [{ debugName: "indeterminate" }] : []));
986
+ checked = model(false, ...(ngDevMode ? [{ debugName: "checked" }] : []));
987
+ inputId = input(...(ngDevMode ? [undefined, { debugName: "inputId" }] : []));
988
+ tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
989
+ hostClasses = computed(() => {
990
+ const className = this.CLASS_NAME;
991
+ const array = [className];
992
+ if (this.indeterminate())
993
+ array.push(`${className}--indeterminate`);
994
+ return array.concat(this.controlClasses());
995
+ }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
996
+ // Protected methods
997
+ toggle() {
998
+ if (this.notInteractive())
999
+ return;
1000
+ this.checked.update(prev => !prev);
769
1001
  }
770
- _dispose() {
771
- this._overlayRef?.dispose();
772
- this._overlayRef = null;
1002
+ onKeyboardToggle(event) {
1003
+ event.preventDefault();
1004
+ this.toggle();
773
1005
  }
1006
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Checkbox, deps: null, target: i0.ɵɵFactoryTarget.Component });
1007
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Checkbox, isStandalone: true, selector: "tls-checkbox", inputs: { indeterminate: { classPropertyName: "indeterminate", publicName: "indeterminate", isSignal: true, isRequired: false, transformFunction: null }, checked: { classPropertyName: "checked", publicName: "checked", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { indeterminate: "indeterminateChange", checked: "checkedChange" }, host: { attributes: { "role": "checkbox" }, properties: { "class": "hostClasses()", "tabindex": "-1" } }, usesInheritance: true, ngImport: i0, 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" });
774
1008
  }
775
- /**
776
- * Creates an {@link OverlayManager} bound to the current injection context.
777
- * Call from a component/directive field initializer or constructor.
778
- */
779
- function createOverlayManager() {
780
- return new OverlayManager();
781
- }
1009
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Checkbox, decorators: [{
1010
+ type: Component,
1011
+ args: [{ selector: 'tls-checkbox', imports: [], host: {
1012
+ role: 'checkbox',
1013
+ '[class]': 'hostClasses()',
1014
+ '[tabindex]': '-1',
1015
+ }, 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" }]
1016
+ }], 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 }] }] } });
782
1017
 
783
1018
  const OVERLAY_POSITION_MAP = {
784
1019
  top: {
@@ -1292,6 +1527,81 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1292
1527
  args: [{ selector: 'tls-date-time-picker', imports: [Calendar, MonthPicker, YearPicker, TimePicker, Popover, NgTemplateOutlet], host: { '[class]': 'hostClasses()' }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => DateTimePicker) }], template: "<ng-template #pickerTemplate>\n @switch (activeView()) {\n @case ('calendar') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n }\n @case ('month-picker') {\n <tls-month-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n (monthSelect)=\"onMonthSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('year-picker')\"\n />\n }\n @case ('year-picker') {\n <tls-year-picker\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [yearsPerPage]=\"yearsPerPage()\"\n (yearSelect)=\"onYearSelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n />\n }\n @case ('time-picker') {\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n @case ('date-time') {\n <tls-calendar\n [viewDate]=\"viewDate()\"\n [selectedDate]=\"value()\"\n [weekStartsOn]=\"weekStartsOn()\"\n [weekDays]=\"weekDays()\"\n (daySelect)=\"onDaySelect($event)\"\n (viewDateChange)=\"onViewDateChange($event)\"\n (navigateUp)=\"activeView.set('month-picker')\"\n />\n <tls-time-picker\n [value]=\"value()\"\n (timeChange)=\"onTimeChange($event)\"\n />\n }\n }\n</ng-template>\n\n@if (inline()) {\n <div\n class=\"tls-date-time-picker__panel\"\n [class.tls-date-time-picker__panel--disabled]=\"disabled()\"\n [class.tls-date-time-picker__panel--readonly]=\"readonly()\"\n [class.tls-date-time-picker__panel--invalid]=\"invalid()\"\n >\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </div>\n} @else {\n <button\n type=\"button\"\n class=\"tls-date-time-picker__trigger\"\n aria-haspopup=\"dialog\"\n [attr.aria-expanded]=\"popoverRef.isOpen()\"\n [disabled]=\"disabled()\"\n (click)=\"popoverRef.toggle($event)\"\n (blur)=\"touched.set(true)\"\n >\n <span [class.tls-form-control__placeholder]=\"!value()\">{{ triggerLabel() }}</span>\n </button>\n <tls-popover #popoverRef position=\"bottom-start\">\n <ng-container [ngTemplateOutlet]=\"pickerTemplate\" />\n </tls-popover>\n}\n" }]
1293
1528
  }], ctorParameters: () => [], propDecorators: { popoverComponent: [{ type: i0.ViewChild, args: ['popoverRef', { isSignal: true }] }], value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], mode: [{ type: i0.Input, args: [{ isSignal: true, alias: "mode", required: false }] }], inline: [{ type: i0.Input, args: [{ isSignal: true, alias: "inline", required: false }] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], yearsPerPage: [{ type: i0.Input, args: [{ isSignal: true, alias: "yearsPerPage", required: false }] }], weekStartsOn: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekStartsOn", required: false }] }], weekDays: [{ type: i0.Input, args: [{ isSignal: true, alias: "weekDays", required: false }] }] } });
1294
1529
 
1530
+ const DEFAULT_CHIP_GROUP_CONFIG = {
1531
+ size: 'md',
1532
+ color: 'primary',
1533
+ checkedColor: undefined,
1534
+ variant: 'outlined',
1535
+ checkedVariant: undefined,
1536
+ orientation: 'horizontal',
1537
+ type: 'multiple',
1538
+ unselectable: false,
1539
+ rounded: false,
1540
+ };
1541
+
1542
+ const CHIP_GROUP_CONFIG = new InjectionToken('CHIP_GROUP_CONFIG', {
1543
+ factory: () => DEFAULT_CHIP_GROUP_CONFIG,
1544
+ });
1545
+
1546
+ class ChipGroup extends SelectionGroup {
1547
+ _config = inject(CHIP_GROUP_CONFIG);
1548
+ CLASS_NAME = 'tls-chip-group';
1549
+ type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
1550
+ unselectable = input(this._config.unselectable, { ...(ngDevMode ? { debugName: "unselectable" } : {}), transform: booleanAttribute });
1551
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
1552
+ color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
1553
+ checkedColor = input(this._config.checkedColor, ...(ngDevMode ? [{ debugName: "checkedColor" }] : []));
1554
+ variant = input(this._config.variant, ...(ngDevMode ? [{ debugName: "variant" }] : []));
1555
+ checkedVariant = input(this._config.checkedVariant, ...(ngDevMode ? [{ debugName: "checkedVariant" }] : []));
1556
+ orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
1557
+ rounded = input(this._config.rounded, { ...(ngDevMode ? { debugName: "rounded" } : {}), transform: booleanAttribute });
1558
+ startIconTemplate = contentChild('startIcon', ...(ngDevMode ? [{ debugName: "startIconTemplate" }] : []));
1559
+ endIconTemplate = contentChild('endIcon', ...(ngDevMode ? [{ debugName: "endIconTemplate" }] : []));
1560
+ labelTemplate = contentChild('label', ...(ngDevMode ? [{ debugName: "labelTemplate" }] : []));
1561
+ classes = computed(() => {
1562
+ const className = this.CLASS_NAME;
1563
+ const array = [className, `${className}--${this.orientation()}`];
1564
+ return array.concat(this.controlClasses());
1565
+ }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
1566
+ isDisabled(option) {
1567
+ return this.disabled() || option.disabled;
1568
+ }
1569
+ optionClasses(option) {
1570
+ const classes = ['tls-chip--control'];
1571
+ if (this.isSelected(option.value)) {
1572
+ classes.push('tls-chip--checked');
1573
+ const checkedColor = this.checkedColor();
1574
+ if (checkedColor)
1575
+ classes.push(`tls-chip--checked-${checkedColor}`);
1576
+ const checkedVariant = this.checkedVariant();
1577
+ if (checkedVariant)
1578
+ classes.push(`tls-chip--checked-${checkedVariant}`);
1579
+ }
1580
+ if (this.isDisabled(option))
1581
+ classes.push('tls-chip--disabled');
1582
+ return classes;
1583
+ }
1584
+ optionContext(option, index) {
1585
+ return {
1586
+ $implicit: {
1587
+ option,
1588
+ index,
1589
+ selected: this.isSelected(option.value),
1590
+ disabled: this.isDisabled(option),
1591
+ },
1592
+ };
1593
+ }
1594
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
1595
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ChipGroup, isStandalone: true, selector: "tls-chip-group", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, checkedColor: { classPropertyName: "checkedColor", publicName: "checkedColor", isSignal: true, isRequired: false, transformFunction: null }, variant: { classPropertyName: "variant", publicName: "variant", isSignal: true, isRequired: false, transformFunction: null }, checkedVariant: { classPropertyName: "checkedVariant", publicName: "checkedVariant", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null }, rounded: { classPropertyName: "rounded", publicName: "rounded", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipGroup) }], queries: [{ propertyName: "startIconTemplate", first: true, predicate: ["startIcon"], descendants: true, isSignal: true }, { propertyName: "endIconTemplate", first: true, predicate: ["endIcon"], descendants: true, isSignal: true }, { propertyName: "labelTemplate", first: true, predicate: ["label"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <tls-chip\n [color]=\"color()\"\n [variant]=\"variant()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [class]=\"optionClasses(option)\"\n role=\"checkbox\"\n [attr.aria-checked]=\"isSelected(option.value)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n [tabindex]=\"isDisabled(option) ? -1 : 0\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardSelect($event, option)\"\n (keydown.enter)=\"onKeyboardSelect($event, option)\"\n >\n @if (startIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n\n @if (labelTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n } @else {\n {{ option.label }}\n }\n\n @if (endIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n </tls-chip>\n}\n\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: Chip, selector: "tls-chip", inputs: ["label", "color", "variant", "size", "rounded", "icon"] }] });
1596
+ }
1597
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ChipGroup, decorators: [{
1598
+ type: Component,
1599
+ args: [{ selector: 'tls-chip-group', imports: [NgTemplateOutlet, Chip], providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ChipGroup) }], host: {
1600
+ role: 'group',
1601
+ '[class]': 'classes()',
1602
+ }, template: "@for (option of normalizedOptions(); track option.value; let index = $index) {\n <tls-chip\n [color]=\"color()\"\n [variant]=\"variant()\"\n [size]=\"size()\"\n [rounded]=\"rounded()\"\n [class]=\"optionClasses(option)\"\n role=\"checkbox\"\n [attr.aria-checked]=\"isSelected(option.value)\"\n [attr.aria-disabled]=\"isDisabled(option)\"\n [tabindex]=\"isDisabled(option) ? -1 : 0\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n (keydown.space)=\"onKeyboardSelect($event, option)\"\n (keydown.enter)=\"onKeyboardSelect($event, option)\"\n >\n @if (startIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n\n @if (labelTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n } @else {\n {{ option.label }}\n }\n\n @if (endIconTemplate(); as template) {\n <ng-container\n [ngTemplateOutlet]=\"template\"\n [ngTemplateOutletContext]=\"optionContext(option, index)\"\n />\n }\n </tls-chip>\n}\n\n" }]
1603
+ }], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], checkedColor: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedColor", required: false }] }], variant: [{ type: i0.Input, args: [{ isSignal: true, alias: "variant", required: false }] }], checkedVariant: [{ type: i0.Input, args: [{ isSignal: true, alias: "checkedVariant", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], rounded: [{ type: i0.Input, args: [{ isSignal: true, alias: "rounded", required: false }] }], startIconTemplate: [{ type: i0.ContentChild, args: ['startIcon', { isSignal: true }] }], endIconTemplate: [{ type: i0.ContentChild, args: ['endIcon', { isSignal: true }] }], labelTemplate: [{ type: i0.ContentChild, args: ['label', { isSignal: true }] }] } });
1604
+
1295
1605
  const DEFAULT_CHIP_INPUT_CONFIG = {
1296
1606
  size: 'md',
1297
1607
  placeholder: '',
@@ -1788,6 +2098,79 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
1788
2098
  }, 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" }]
1789
2099
  }], 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 }] }] } });
1790
2100
 
2101
+ const DEFAULT_MULTI_SELECT_CONFIG = {
2102
+ size: 'md',
2103
+ placeholder: '',
2104
+ fluid: false,
2105
+ clearable: false,
2106
+ maxLabels: 2,
2107
+ };
2108
+
2109
+ const MULTI_SELECT_CONFIG = new InjectionToken('MULTI_SELECT_CONFIG', {
2110
+ factory: () => DEFAULT_MULTI_SELECT_CONFIG,
2111
+ });
2112
+
2113
+ class MultiSelect extends AbstractSelect {
2114
+ static _nextUniqueId = 0;
2115
+ _config = inject(MULTI_SELECT_CONFIG);
2116
+ uniqueId = `tls-multi-select-${MultiSelect._nextUniqueId++}`;
2117
+ hostClassBase = 'tls-multi-select';
2118
+ panelClass = 'tls-multi-select-panel';
2119
+ value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
2120
+ placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
2121
+ size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
2122
+ fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
2123
+ clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
2124
+ maxLabels = input(this._config.maxLabels, ...(ngDevMode ? [{ debugName: "maxLabels" }] : []));
2125
+ hasValue = computed(() => this.value().length > 0, ...(ngDevMode ? [{ debugName: "hasValue" }] : []));
2126
+ selectedValues = computed(() => new Set(this.value()), ...(ngDevMode ? [{ debugName: "selectedValues" }] : []));
2127
+ triggerLabel = computed(() => {
2128
+ const selected = this.value();
2129
+ if (selected.length === 0)
2130
+ return '';
2131
+ const max = this.maxLabels();
2132
+ if (selected.length > max)
2133
+ return `${selected.length} selected`;
2134
+ const optionMap = new Map(this.normalizedOptions().map(option => [option.value, option.label]));
2135
+ return selected.map(value => optionMap.get(value) ?? String(value)).join(', ');
2136
+ }, ...(ngDevMode ? [{ debugName: "triggerLabel" }] : []));
2137
+ isSelected(option) {
2138
+ return this.selectedValues().has(option.value);
2139
+ }
2140
+ toggleOption(option) {
2141
+ if (option.disabled)
2142
+ return;
2143
+ if (this.isSelected(option)) {
2144
+ this.value.update(current => current.filter(item => item !== option.value));
2145
+ }
2146
+ else {
2147
+ this.value.update(current => [...current, option.value]);
2148
+ }
2149
+ }
2150
+ clear() {
2151
+ this.value.set([]);
2152
+ }
2153
+ getInitialActiveIndex() {
2154
+ const options = this.normalizedOptions();
2155
+ const selected = this.selectedValues();
2156
+ const firstSelected = options.findIndex(option => !option.disabled && selected.has(option.value));
2157
+ if (firstSelected !== -1)
2158
+ return firstSelected;
2159
+ return options.findIndex(option => !option.disabled);
2160
+ }
2161
+ commitActiveOption(option) {
2162
+ this.toggleOption(option);
2163
+ }
2164
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MultiSelect, deps: null, target: i0.ɵɵFactoryTarget.Component });
2165
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: MultiSelect, isStandalone: true, selector: "tls-multi-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null }, maxLabels: { classPropertyName: "maxLabels", publicName: "maxLabels", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-multi-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-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-multi-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-multi-select__panel\" role=\"listbox\" aria-multiselectable=\"true\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">{{ option.label }}</span>\n @if (isSelected(option)) {\n <svg class=\"tls-multi-select__option-check\" viewBox=\"0 0 10 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 4L3.5 6.5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n }\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
2166
+ }
2167
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: MultiSelect, decorators: [{
2168
+ type: Component,
2169
+ args: [{ selector: 'tls-multi-select', host: {
2170
+ '[class]': 'hostClasses()',
2171
+ }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => MultiSelect) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-multi-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-multi-select__value\" [class.tls-form-control__placeholder]=\"!triggerLabel()\">\n {{ triggerLabel() || placeholder() }}\n </span>\n <div class=\"tls-multi-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-multi-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-multi-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-multi-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-multi-select__panel\" role=\"listbox\" aria-multiselectable=\"true\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-multi-select__option\"\n [class.tls-multi-select__option--selected]=\"isSelected(option)\"\n [class.tls-multi-select__option--active]=\"index === activeIndex()\"\n [class.tls-multi-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-multi-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"isSelected(option)\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"toggleOption(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >\n <span class=\"tls-multi-select__option-label\">{{ option.label }}</span>\n @if (isSelected(option)) {\n <svg class=\"tls-multi-select__option-check\" viewBox=\"0 0 10 8\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\" aria-hidden=\"true\">\n <path d=\"M1 4L3.5 6.5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n }\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" }]
2172
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }], maxLabels: [{ type: i0.Input, args: [{ isSignal: true, alias: "maxLabels", required: false }] }] } });
2173
+
1791
2174
  const DEFAULT_SELECT_CONFIG = {
1792
2175
  size: 'md',
1793
2176
  placeholder: '',
@@ -1799,29 +2182,17 @@ const SELECT_CONFIG = new InjectionToken('SELECT_CONFIG', {
1799
2182
  factory: () => DEFAULT_SELECT_CONFIG,
1800
2183
  });
1801
2184
 
1802
- class Select extends ValueFormControl {
2185
+ class Select extends AbstractSelect {
2186
+ static _nextUniqueId = 0;
1803
2187
  _config = inject(SELECT_CONFIG);
1804
- _overlay = createOverlayManager();
1805
- _triggerElement = viewChild('trigger', ...(ngDevMode ? [{ debugName: "_triggerElement" }] : []));
1806
- _panelTemplate = viewChild('panel', ...(ngDevMode ? [{ debugName: "_panelTemplate" }] : []));
2188
+ uniqueId = `tls-select-${Select._nextUniqueId++}`;
2189
+ hostClassBase = 'tls-select';
2190
+ panelClass = 'tls-select-panel';
1807
2191
  value = model(null, ...(ngDevMode ? [{ debugName: "value" }] : []));
1808
- inputId = input(null, ...(ngDevMode ? [{ debugName: "inputId" }] : []));
1809
- options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
1810
- optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
1811
- optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
1812
- optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
1813
2192
  placeholder = input(this._config.placeholder, ...(ngDevMode ? [{ debugName: "placeholder" }] : []));
1814
2193
  size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
1815
2194
  fluid = input(this._config.fluid, { ...(ngDevMode ? { debugName: "fluid" } : {}), transform: booleanAttribute });
1816
- tabindex = input(0, ...(ngDevMode ? [{ debugName: "tabindex" }] : []));
1817
2195
  clearable = input(this._config.clearable, { ...(ngDevMode ? { debugName: "clearable" } : {}), transform: booleanAttribute });
1818
- isOpen = this._overlay.isOpen;
1819
- activeIndex = signal(-1, ...(ngDevMode ? [{ debugName: "activeIndex" }] : []));
1820
- normalizedOptions = computed(() => normalizeOptions(this.options(), {
1821
- label: this.optionLabel(),
1822
- value: this.optionValue(),
1823
- disabled: this.optionDisabled(),
1824
- }), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
1825
2196
  hasValue = computed(() => {
1826
2197
  const value = this.value();
1827
2198
  return value !== null && value !== undefined && value !== '';
@@ -1829,56 +2200,11 @@ class Select extends ValueFormControl {
1829
2200
  selectedLabel = computed(() => {
1830
2201
  if (!this.hasValue())
1831
2202
  return '';
1832
- return this.normalizedOptions().find(option => option.value === this.value())?.label ?? '';
2203
+ const selected = this.normalizedOptions().find(option => option.value === this.value());
2204
+ if (!selected)
2205
+ return '';
2206
+ return selected.label;
1833
2207
  }, ...(ngDevMode ? [{ debugName: "selectedLabel" }] : []));
1834
- // Classes
1835
- hostClasses = computed(() => {
1836
- const array = ['tls-select'];
1837
- if (this.isOpen())
1838
- array.push('tls-select--open');
1839
- array.push(`${this.CLASS_NAME}--${this.size()}`);
1840
- if (this.fluid())
1841
- array.push(`${this.CLASS_NAME}--fluid`);
1842
- return array.concat(this.controlClasses());
1843
- }, ...(ngDevMode ? [{ debugName: "hostClasses" }] : []));
1844
- // Protected methods
1845
- open() {
1846
- const triggerElement = this._triggerElement();
1847
- const panelTemplate = this._panelTemplate();
1848
- if (this.notInteractive() || this.isOpen() || !triggerElement || !panelTemplate)
1849
- return;
1850
- this._overlay.open({
1851
- content: panelTemplate,
1852
- origin: triggerElement,
1853
- positions: [
1854
- { originX: 'start', originY: 'bottom', overlayX: 'start', overlayY: 'top', offsetY: 4 },
1855
- { originX: 'start', originY: 'top', overlayX: 'start', overlayY: 'bottom', offsetY: -4 },
1856
- ],
1857
- flexibleDimensions: false,
1858
- push: false,
1859
- panelClass: 'tls-select-panel',
1860
- // Select handles Escape itself via the trigger's keydown handler.
1861
- closeOnEscape: false,
1862
- minWidth: triggerElement.nativeElement.offsetWidth,
1863
- reuse: true,
1864
- onClose: () => {
1865
- this.activeIndex.set(-1);
1866
- this._triggerElement()?.nativeElement.focus();
1867
- },
1868
- });
1869
- this.activeIndex.set(this.normalizedOptions().findIndex(option => option.value === this.value()));
1870
- }
1871
- close() {
1872
- this._overlay.close();
1873
- }
1874
- toggle() {
1875
- if (this.isOpen()) {
1876
- this.close();
1877
- }
1878
- else {
1879
- this.open();
1880
- }
1881
- }
1882
2208
  select(option) {
1883
2209
  if (option.disabled)
1884
2210
  return;
@@ -1888,76 +2214,21 @@ class Select extends ValueFormControl {
1888
2214
  clear() {
1889
2215
  this.value.set(null);
1890
2216
  }
1891
- onOptionHover(index, disabled) {
1892
- if (!disabled)
1893
- this.activeIndex.set(index);
1894
- }
1895
- onKeydown(event) {
1896
- if (event.key === 'ArrowDown') {
1897
- event.preventDefault();
1898
- if (this.isOpen()) {
1899
- this._moveActive(1);
1900
- }
1901
- else {
1902
- this.open();
1903
- }
1904
- }
1905
- else if (event.key === 'ArrowUp') {
1906
- event.preventDefault();
1907
- if (this.isOpen()) {
1908
- this._moveActive(-1);
1909
- }
1910
- else {
1911
- this.open();
1912
- }
1913
- }
1914
- else if (event.key === 'Enter' || event.key === ' ') {
1915
- event.preventDefault();
1916
- if (!this.isOpen()) {
1917
- this.open();
1918
- return;
1919
- }
1920
- const active = this.normalizedOptions()[this.activeIndex()];
1921
- if (active && !active.disabled)
1922
- this.select(active);
1923
- }
1924
- else if (event.key === 'Escape') {
1925
- event.preventDefault();
1926
- if (this.isOpen())
1927
- this.close();
1928
- }
1929
- else if (event.key === 'Tab') {
1930
- if (this.isOpen())
1931
- this.close();
1932
- }
1933
- else if ((event.key === 'Delete' || event.key === 'Backspace') &&
1934
- this.clearable() &&
1935
- this.hasValue()) {
1936
- event.preventDefault();
1937
- this.clear();
1938
- }
2217
+ getInitialActiveIndex() {
2218
+ return this.normalizedOptions().findIndex(option => option.value === this.value());
1939
2219
  }
1940
- // Private methods
1941
- _moveActive(direction) {
1942
- const options = this.normalizedOptions();
1943
- let next = this.activeIndex() + direction;
1944
- while (next >= 0 && next < options.length) {
1945
- if (!options[next].disabled) {
1946
- this.activeIndex.set(next);
1947
- return;
1948
- }
1949
- next += direction;
1950
- }
2220
+ commitActiveOption(option) {
2221
+ this.select(option);
1951
2222
  }
1952
2223
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, deps: null, target: i0.ɵɵFactoryTarget.Component });
1953
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: Select, isStandalone: true, selector: "tls-select", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, inputId: { classPropertyName: "inputId", publicName: "inputId", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, tabindex: { classPropertyName: "tabindex", publicName: "tabindex", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], viewQueries: [{ propertyName: "_triggerElement", first: true, predicate: ["trigger"], descendants: true, isSignal: true }, { propertyName: "_panelTemplate", first: true, predicate: ["panel"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\">\n <svg class=\"tls-select__chevron\" viewBox=\"0 0 10 6\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L5 5L9 1\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" stroke-linejoin=\"round\" />\n </svg>\n </div>\n</button>\n@if (clearable() && hasValue()) {\n <button\n type=\"button\"\n class=\"tls-select__clear\"\n tabindex=\"-1\"\n aria-label=\"Clear\"\n (click)=\"clear()\"\n >\n <svg class=\"tls-select__clear-icon\" viewBox=\"0 0 10 10\" fill=\"none\" xmlns=\"http://www.w3.org/2000/svg\">\n <path d=\"M1 1L9 9M9 1L1 9\" stroke=\"currentColor\" stroke-width=\"1.5\" stroke-linecap=\"round\" />\n </svg>\n </button>\n}\n\n<ng-template #panel>\n <ul class=\"tls-select__panel\" role=\"listbox\">\n @for (option of normalizedOptions(); track option.value; let i = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"i === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(i, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
2224
+ 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 }, placeholder: { classPropertyName: "placeholder", publicName: "placeholder", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, fluid: { classPropertyName: "fluid", publicName: "fluid", isSignal: true, isRequired: false, transformFunction: null }, clearable: { classPropertyName: "clearable", publicName: "clearable", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { properties: { "class": "hostClasses()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], usesInheritance: true, ngImport: i0, template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\">\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\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" });
1954
2225
  }
1955
2226
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: Select, decorators: [{
1956
2227
  type: Component,
1957
2228
  args: [{ selector: 'tls-select', host: {
1958
2229
  '[class]': 'hostClasses()',
1959
- }, 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" }]
1960
- }], 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 }] }] } });
2230
+ }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => Select) }], template: "<button\n #trigger\n type=\"button\"\n class=\"tls-select__trigger\"\n role=\"combobox\"\n [attr.id]=\"inputId()\"\n [attr.name]=\"name()\"\n aria-haspopup=\"listbox\"\n [attr.aria-controls]=\"isOpen() ? listboxId : null\"\n [attr.aria-activedescendant]=\"activeDescendantId()\"\n [tabindex]=\"disabled() ? -1 : tabindex()\"\n [disabled]=\"disabled()\"\n [attr.aria-expanded]=\"isOpen()\"\n (click)=\"toggle()\"\n (blur)=\"touched.set(true)\"\n (keydown)=\"onKeydown($event)\"\n>\n <span class=\"tls-select__value\" [class.tls-form-control__placeholder]=\"!selectedLabel()\">\n {{ selectedLabel() || placeholder() }}\n </span>\n <div class=\"tls-select__icon\" aria-hidden=\"true\">\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\" [id]=\"listboxId\">\n @for (option of normalizedOptions(); track option.value; let index = $index) {\n <li\n class=\"tls-select__option\"\n [class.tls-select__option--selected]=\"option.value === value()\"\n [class.tls-select__option--active]=\"index === activeIndex()\"\n [class.tls-select__option--disabled]=\"option.disabled\"\n >\n <button\n class=\"tls-select__option-button\"\n role=\"option\"\n [id]=\"optionId(index)\"\n [disabled]=\"option.disabled\"\n [attr.aria-selected]=\"option.value === value()\"\n [attr.aria-disabled]=\"option.disabled\"\n (click)=\"select(option)\"\n (mouseenter)=\"onOptionHover(index, option.disabled)\"\n >{{ option.label }}\n </button>\n </li>\n }\n </ul>\n</ng-template>\n" }]
2231
+ }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], placeholder: [{ type: i0.Input, args: [{ isSignal: true, alias: "placeholder", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], fluid: [{ type: i0.Input, args: [{ isSignal: true, alias: "fluid", required: false }] }], clearable: [{ type: i0.Input, args: [{ isSignal: true, alias: "clearable", required: false }] }] } });
1961
2232
 
1962
2233
  const DEFAULT_SWITCH_CONFIG = {
1963
2234
  color: 'primary',
@@ -2062,25 +2333,15 @@ const TOGGLE_GROUP_CONFIG = new InjectionToken('TOGGLE_GROUP_CONFIG', {
2062
2333
  factory: () => DEFAULT_TOGGLE_GROUP_CONFIG,
2063
2334
  });
2064
2335
 
2065
- class ToggleGroup extends ValueFormControl {
2336
+ class ToggleGroup extends SelectionGroup {
2066
2337
  _config = inject(TOGGLE_GROUP_CONFIG);
2067
2338
  CLASS_NAME = 'tls-toggle-group';
2068
- value = model([], ...(ngDevMode ? [{ debugName: "value" }] : []));
2069
- options = input([], ...(ngDevMode ? [{ debugName: "options" }] : []));
2070
- optionLabel = input(undefined, ...(ngDevMode ? [{ debugName: "optionLabel" }] : []));
2071
- optionValue = input(undefined, ...(ngDevMode ? [{ debugName: "optionValue" }] : []));
2072
- optionDisabled = input(undefined, ...(ngDevMode ? [{ debugName: "optionDisabled" }] : []));
2073
2339
  type = input(this._config.type, ...(ngDevMode ? [{ debugName: "type" }] : []));
2074
2340
  unselectable = input(this._config.unselectable, { ...(ngDevMode ? { debugName: "unselectable" } : {}), transform: booleanAttribute });
2075
2341
  size = input(this._config.size, ...(ngDevMode ? [{ debugName: "size" }] : []));
2076
2342
  color = input(this._config.color, ...(ngDevMode ? [{ debugName: "color" }] : []));
2077
2343
  orientation = input(this._config.orientation, ...(ngDevMode ? [{ debugName: "orientation" }] : []));
2078
2344
  optionTemplate = contentChild('option', ...(ngDevMode ? [{ debugName: "optionTemplate" }] : []));
2079
- normalizedOptions = computed(() => normalizeOptions(this.options(), {
2080
- label: this.optionLabel(),
2081
- value: this.optionValue(),
2082
- disabled: this.optionDisabled(),
2083
- }), ...(ngDevMode ? [{ debugName: "normalizedOptions" }] : []));
2084
2345
  classes = computed(() => {
2085
2346
  const className = this.CLASS_NAME;
2086
2347
  const array = [
@@ -2091,27 +2352,8 @@ class ToggleGroup extends ValueFormControl {
2091
2352
  ];
2092
2353
  return array.concat(this.controlClasses());
2093
2354
  }, ...(ngDevMode ? [{ debugName: "classes" }] : []));
2094
- isSelected(optionValue) {
2095
- return this.value().includes(optionValue);
2096
- }
2097
- select(option) {
2098
- if (this.notInteractive() || option.disabled)
2099
- return;
2100
- if (this.type() === 'single') {
2101
- if (this.isSelected(option.value) && !this.unselectable())
2102
- return;
2103
- this.value.set(this.isSelected(option.value) ? [] : [option.value]);
2104
- return;
2105
- }
2106
- if (this.isSelected(option.value)) {
2107
- this.value.update(current => current.filter(item => item !== option.value));
2108
- }
2109
- else {
2110
- this.value.update(current => [...current, option.value]);
2111
- }
2112
- }
2113
2355
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, deps: null, target: i0.ɵɵFactoryTarget.Component });
2114
- static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { value: { classPropertyName: "value", publicName: "value", isSignal: true, isRequired: false, transformFunction: null }, options: { classPropertyName: "options", publicName: "options", isSignal: true, isRequired: false, transformFunction: null }, optionLabel: { classPropertyName: "optionLabel", publicName: "optionLabel", isSignal: true, isRequired: false, transformFunction: null }, optionValue: { classPropertyName: "optionValue", publicName: "optionValue", isSignal: true, isRequired: false, transformFunction: null }, optionDisabled: { classPropertyName: "optionDisabled", publicName: "optionDisabled", isSignal: true, isRequired: false, transformFunction: null }, type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { value: "valueChange" }, host: { attributes: { "role": "group" }, properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: option }\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2356
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.1", type: ToggleGroup, isStandalone: true, selector: "tls-toggle-group", inputs: { type: { classPropertyName: "type", publicName: "type", isSignal: true, isRequired: false, transformFunction: null }, unselectable: { classPropertyName: "unselectable", publicName: "unselectable", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, color: { classPropertyName: "color", publicName: "color", isSignal: true, isRequired: false, transformFunction: null }, orientation: { classPropertyName: "orientation", publicName: "orientation", isSignal: true, isRequired: false, transformFunction: null } }, host: { attributes: { "role": "group" }, properties: { "class": "classes()" } }, providers: [{ provide: FORM_CONTROL, useExisting: forwardRef(() => ToggleGroup) }], queries: [{ propertyName: "optionTemplate", first: true, predicate: ["option"], descendants: true, isSignal: true }], usesInheritance: true, ngImport: i0, template: "@for (option of normalizedOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: option }\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n", dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }] });
2115
2357
  }
2116
2358
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImport: i0, type: ToggleGroup, decorators: [{
2117
2359
  type: Component,
@@ -2119,7 +2361,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.1", ngImpor
2119
2361
  role: 'group',
2120
2362
  '[class]': 'classes()',
2121
2363
  }, template: "@for (option of normalizedOptions(); track option.value) {\n <button\n type=\"button\"\n class=\"tls-toggle-group__option\"\n [class.tls-toggle-group__option--selected]=\"isSelected(option.value)\"\n [class.tls-toggle-group__option--disabled]=\"option.disabled\"\n [attr.aria-pressed]=\"isSelected(option.value)\"\n [disabled]=\"disabled() || option.disabled\"\n (click)=\"select(option)\"\n (blur)=\"touched.set(true)\"\n >\n @if (optionTemplate(); as template) {\n <ng-container [ngTemplateOutlet]=\"template\" [ngTemplateOutletContext]=\"{ $implicit: option }\" />\n } @else {\n {{ option.label }}\n }\n </button>\n}\n" }]
2122
- }], propDecorators: { value: [{ type: i0.Input, args: [{ isSignal: true, alias: "value", required: false }] }, { type: i0.Output, args: ["valueChange"] }], options: [{ type: i0.Input, args: [{ isSignal: true, alias: "options", required: false }] }], optionLabel: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionLabel", required: false }] }], optionValue: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionValue", required: false }] }], optionDisabled: [{ type: i0.Input, args: [{ isSignal: true, alias: "optionDisabled", required: false }] }], type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }] } });
2364
+ }], propDecorators: { type: [{ type: i0.Input, args: [{ isSignal: true, alias: "type", required: false }] }], unselectable: [{ type: i0.Input, args: [{ isSignal: true, alias: "unselectable", required: false }] }], size: [{ type: i0.Input, args: [{ isSignal: true, alias: "size", required: false }] }], color: [{ type: i0.Input, args: [{ isSignal: true, alias: "color", required: false }] }], orientation: [{ type: i0.Input, args: [{ isSignal: true, alias: "orientation", required: false }] }], optionTemplate: [{ type: i0.ContentChild, args: ['option', { isSignal: true }] }] } });
2123
2365
 
2124
2366
  class IconService {
2125
2367
  _http = inject(HttpClient);
@@ -3172,6 +3414,10 @@ const provideThalassicUIConfig = (config) => {
3172
3414
  useValue: deepMerge(DEFAULT_LOADER_CONFIG, config.components.loader),
3173
3415
  },
3174
3416
  { provide: MENU_CONFIG, useValue: deepMerge(DEFAULT_MENU_CONFIG, config.components.menu) },
3417
+ {
3418
+ provide: MULTI_SELECT_CONFIG,
3419
+ useValue: deepMerge(DEFAULT_MULTI_SELECT_CONFIG, config.components.multiSelect),
3420
+ },
3175
3421
  {
3176
3422
  provide: PAGINATION_CONFIG,
3177
3423
  useValue: deepMerge(DEFAULT_PAGINATION_CONFIG, config.components.pagination),
@@ -3229,5 +3475,5 @@ const provideThalassicUIConfig = (config) => {
3229
3475
  * Generated bundle index. Do not edit.
3230
3476
  */
3231
3477
 
3232
- export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_INPUT_CONFIG, Checkbox, Chip, ChipControl, ChipInput, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FILE_UPLOADER_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FILE_UPLOADER_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileUploader, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, MENU_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TEXTAREA_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, ToggleGroup, TooltipDirective, provideThalassicUIConfig };
3478
+ export { ALERT_CONFIG, Alert, BUTTON_CONFIG, Button, ButtonDirective, CHECKBOX_CONFIG, CHIP_CONFIG, CHIP_CONTROL_CONFIG, CHIP_GROUP_CONFIG, CHIP_INPUT_CONFIG, Checkbox, Chip, ChipControl, ChipGroup, ChipInput, ContextMenuDirective, DATE_TIME_PICKER_CONFIG, DEFAULT_ALERT_CONFIG, DEFAULT_BUTTON_CONFIG, DEFAULT_CHECKBOX_CONFIG, DEFAULT_CHIP_CONFIG, DEFAULT_CHIP_CONTROL_CONFIG, DEFAULT_CHIP_GROUP_CONFIG, DEFAULT_CHIP_INPUT_CONFIG, DEFAULT_DATE_TIME_PICKER_CONFIG, DEFAULT_DIALOG_CONFIG, DEFAULT_DIVIDER_CONFIG, DEFAULT_FILE_UPLOADER_CONFIG, DEFAULT_FORM_CONTROL_GROUP_CONFIG, DEFAULT_FORM_ITEM_CONFIG, DEFAULT_ICON_CONFIG, DEFAULT_INPUT_CONFIG, DEFAULT_LOADER_CONFIG, DEFAULT_MENU_CONFIG, DEFAULT_MULTI_SELECT_CONFIG, DEFAULT_PAGINATION_CONFIG, DEFAULT_PASSWORD_CONFIG, DEFAULT_PIN_INPUT_CONFIG, DEFAULT_POPOVER_CONFIG, DEFAULT_RADIO_BUTTON_CONFIG, DEFAULT_SELECT_CONFIG, DEFAULT_SKELETON_CONFIG, DEFAULT_STEPPER_CONFIG, DEFAULT_STEP_CONFIG, DEFAULT_SWITCH_CONFIG, DEFAULT_TABLE_CONFIG, DEFAULT_TABS_CONFIG, DEFAULT_TEXTAREA_CONFIG, DEFAULT_TOGGLE_GROUP_CONFIG, DEFAULT_TOOLTIP_CONFIG, DIALOG_CONFIG, DIVIDER_CONFIG, DateTimePicker, Dialog, DialogService, Divider, FILE_UPLOADER_CONFIG, FORM_CONTROL_GROUP_CONFIG, FORM_ITEM_CONFIG, FileUploader, FormControlAddon, FormControlGroup, FormItem, ICON_CONFIG, INPUT_CONFIG, Icon, Input, InputDirective, LOADER_CONFIG, Loader, MENU_CONFIG, MULTI_SELECT_CONFIG, Menu, MenuItemComponent, MenuTriggerDirective, MultiSelect, PAGINATION_CONFIG, PASSWORD_CONFIG, PIN_INPUT_CONFIG, POPOVER_CONFIG, Pagination, Password, PinInput, Popover, RADIO_BUTTON_CONFIG, RadioButton, SELECT_CONFIG, SKELETON_CONFIG, STEPPER_CONFIG, SWITCH_CONFIG, Select, Skeleton, Step, Stepper, Switch, TABLE_CONFIG, TABS_CONFIG, TEXTAREA_CONFIG, TOGGLE_GROUP_CONFIG, TOOLTIP_CONFIG, Tab, Table, TableColumn, Tabs, Textarea, ToggleGroup, TooltipDirective, provideThalassicUIConfig };
3233
3479
  //# sourceMappingURL=thalassic-ui.mjs.map