@telcomdev/ui 0.0.5 → 0.0.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -37,6 +37,22 @@ El comportamiento predeterminado durante el scroll es `reposition`, por lo que
37
37
  el panel permanece unido al control. Puede cambiarse con
38
38
  `scrollBehavior="close"`.
39
39
 
40
+ ## Tabs
41
+
42
+ ```html
43
+ <td-tabs [(selectedIndex)]="indice">
44
+ <td-tab label="General" icon="settings">
45
+ <app-general />
46
+ </td-tab>
47
+ <td-tab label="Usuarios" icon="people" [badge]="12">
48
+ <app-usuarios />
49
+ </td-tab>
50
+ </td-tabs>
51
+ ```
52
+
53
+ Incluye las variantes `linea`, `pastilla` y `contenida`, además de navegación
54
+ con flechas, Home y End.
55
+
40
56
  Para usar componentes basados en Overlay, como `TdDialog`, agrega el estilo
41
57
  estructural del CDK en `angular.json`:
42
58
 
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, Injectable, inject, HostBinding, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, HostListener, Directive, ChangeDetectorRef, forwardRef, DestroyRef, signal } from '@angular/core';
2
+ import { Component, Injectable, inject, HostBinding, Input, ChangeDetectionStrategy, EventEmitter, Output, ViewChild, InjectionToken, HostListener, Directive, ChangeDetectorRef, forwardRef, DestroyRef, signal, TemplateRef, ViewChildren, ContentChildren } from '@angular/core';
3
3
  import * as i2 from '@angular/cdk/scrolling';
4
4
  import { ScrollingModule, CdkVirtualScrollViewport } from '@angular/cdk/scrolling';
5
5
  import * as i1 from '@angular/forms';
@@ -468,7 +468,138 @@ const TD_ICONOS = {
468
468
  path: 'M4 3h16l3 11v7H1v-7L4 3Zm1.5 2L3 14h5l1 2h6l1-2h5l-2.5-9h-13Z',
469
469
  },
470
470
  pdf: {
471
- path: 'M6 2h9l5 5v15H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 1.5V8h4.5L14 3.5ZM8 12v7h2v-2h1.2a2.5 2.5 0 0 0 0-5H8Zm2 2h1.2a.5.5 0 0 1 0 1H10v-1Zm4-2v7h2v-2h1v-2h-1v-1h2v-2h-4Z',
471
+ path: 'M6.5 2.75h8l4.75 4.75v13.75H6.5a1.75 1.75 0 0 1-1.75-1.75v-15A1.75 1.75 0 0 1 6.5 2.75Zm8 0V7.5h4.75M7.1 20v-6.5m0 1.1c.45-.75 1.25-1.15 2.05-1.05 1.25.15 1.85 1.25 1.7 2.65-.15 1.35-.9 2.2-2.05 2.15-.75-.05-1.35-.4-1.7-.95m7.85-5.9V18.4m0-3.8c-.45-.75-1.25-1.15-2.05-1.05-1.25.15-1.85 1.25-1.7 2.65.15 1.35.9 2.2 2.05 2.15.75-.05 1.35-.4 1.7-.95m2.15 1v-5.65c0-1.15.55-1.75 1.65-1.75.35 0 .65.05.9.15m-2.5 3.05h2.1',
472
+ estilo: 'linea',
473
+ grosor: 1.65,
474
+ },
475
+ save: {
476
+ path: 'M5 3h12l4 4v14H3V5a2 2 0 0 1 2-2Zm1 2a1 1 0 0 0-1 1v13h14V8h-4V5H6Zm2 0v5h7V5H8Zm1 8h6a2 2 0 0 1 2 2v4H7v-4a2 2 0 0 1 2-2Z',
477
+ },
478
+ copy: {
479
+ path: 'M8 3h11a2 2 0 0 1 2 2v11h-2V5H8V3ZM5 7h10a2 2 0 0 1 2 2v10a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V9a2 2 0 0 1 2-2Zm0 2v10h10V9H5Z',
480
+ },
481
+ download: {
482
+ path: 'M11 3h2v10.17l3.59-3.58L18 11l-6 6-6-6 1.41-1.41L11 13.17V3ZM4 19h16v2H4v-2Z',
483
+ },
484
+ upload: {
485
+ path: 'm12 3 6 6-1.41 1.41L13 6.83V17h-2V6.83l-3.59 3.58L6 9l6-6ZM4 19h16v2H4v-2Z',
486
+ },
487
+ print: {
488
+ path: 'M7 3h10v4H7V3Zm10 12v6H7v-6h10Zm2-7a3 3 0 0 1 3 3v6h-3v-4H5v4H2v-6a3 3 0 0 1 3-3h14Zm-4 9H9v2h6v-2Zm4-7a1 1 0 1 0 0 2 1 1 0 0 0 0-2Z',
489
+ },
490
+ excel: {
491
+ path: 'M6.5 2.75h8l4.75 4.75v13.75H6.5a1.75 1.75 0 0 1-1.75-1.75v-15A1.75 1.75 0 0 1 6.5 2.75Zm8 0V7.5h4.75M8 11h8v7.5H8V11Zm0 3.75h8M11.9 11v7.5',
492
+ estilo: 'linea',
493
+ grosor: 1.65,
494
+ },
495
+ xml: {
496
+ path: 'M6.5 2.75h8l4.75 4.75v13.75H6.5a1.75 1.75 0 0 1-1.75-1.75v-15A1.75 1.75 0 0 1 6.5 2.75Zm8 0V7.5h4.75M9.25 12l-2.5 3 2.5 3m5.5-6 2.5 3-2.5 3m-1.5-7-2.5 8',
497
+ estilo: 'linea',
498
+ grosor: 1.65,
499
+ },
500
+ zip: {
501
+ path: 'M6.5 2.75h8l4.75 4.75v13.75H6.5a1.75 1.75 0 0 1-1.75-1.75v-15A1.75 1.75 0 0 1 6.5 2.75Zm8 0V7.5h4.75M10.25 2.75h3.5m-3.5 2.25h3.5m-3.5 2.25h3.5m-3.5 2.25h3.5m-3.5 2.25h3.5M12 11.75v3m-1.75 0h3.5v3.5h-3.5v-3.5Z',
502
+ estilo: 'linea',
503
+ grosor: 1.65,
504
+ },
505
+ file: {
506
+ path: 'M6 2h9l5 5v13a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2Zm8 2H6v16h12V8h-4V4Zm2 2 2 2h-2V6Z',
507
+ },
508
+ image: {
509
+ path: 'M4 3h16a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm0 2v14h16V5H4Zm3.5 2A2.5 2.5 0 1 1 5 9.5 2.5 2.5 0 0 1 7.5 7Zm12 10-4.5-5-3.2 3.5-2.3-2.5L4.5 18h15v-1Z',
510
+ },
511
+ calendar: {
512
+ path: 'M7 2h2v2h6V2h2v2h2a2 2 0 0 1 2 2v14a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2h2V2ZM5 9v11h14V9H5Zm0-3v1h14V6H5Z',
513
+ },
514
+ clock: {
515
+ path: 'M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-1 3h2v4.59l3.2 3.2-1.41 1.42L11 12.41V7Z',
516
+ },
517
+ history: {
518
+ path: 'M12 4a8 8 0 1 1-7.45 5H2l3.5-4L9 9H6.67A6 6 0 1 0 12 6V4Zm-1 3h2v4.59l3.2 3.2-1.41 1.42L11 12.41V7Z',
519
+ },
520
+ filter: {
521
+ path: 'M3 4h18l-7 8v6l-4 2v-8L3 4Zm4.41 2L12 11.25 16.59 6H7.41Z',
522
+ },
523
+ refresh: {
524
+ path: 'M17.65 6.35A7.95 7.95 0 0 0 12 4a8 8 0 1 0 7.75 10h-2.08A6 6 0 1 1 16.2 7.8L13 11h8V3l-3.35 3.35Z',
525
+ },
526
+ sort: {
527
+ path: 'M7 3 3 7h3v11H3l4 4 4-4H8V7h3L7 3Zm10 0-4 4h3v11h-3l4 4 4-4h-3V7h3l-4-4Z',
528
+ },
529
+ more_vertical: {
530
+ path: 'M12 8a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm0 6a2 2 0 1 0 0-4 2 2 0 0 0 0 4Zm0 6a2 2 0 1 0 0-4 2 2 0 0 0 0 4Z',
531
+ },
532
+ more_horizontal: {
533
+ path: 'M8 12a2 2 0 1 0-4 0 2 2 0 0 0 4 0Zm6 0a2 2 0 1 0-4 0 2 2 0 0 0 4 0Zm6 0a2 2 0 1 0-4 0 2 2 0 0 0 4 0Z',
534
+ },
535
+ arrow_back: {
536
+ path: 'm11 5-7 7 7 7 1.41-1.41L7.83 13H21v-2H7.83l4.58-4.59L11 5Z',
537
+ },
538
+ arrow_forward: {
539
+ path: 'm13 5-1.41 1.41L16.17 11H3v2h13.17l-4.58 4.59L13 19l7-7-7-7Z',
540
+ },
541
+ login: {
542
+ path: 'M4 3h9a2 2 0 0 1 2 2v4h-2V5H4v14h9v-4h2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm13 5 4 4-4 4v-3H8v-2h9V8Z',
543
+ },
544
+ logout: {
545
+ path: 'M4 3h9a2 2 0 0 1 2 2v4h-2V5H4v14h9v-4h2v4a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2Zm13 5 4 4-4 4v-3H8v-2h9V8Z',
546
+ },
547
+ lock: {
548
+ path: 'M7 10V7a5 5 0 0 1 10 0v3h1a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h1Zm2 0h6V7a3 3 0 0 0-6 0v3Zm3 4a2 2 0 0 0-1 3.73V19h2v-1.27A2 2 0 0 0 12 14Z',
549
+ },
550
+ lock_open: {
551
+ path: 'M7 10V7a5 5 0 0 1 9.9-1H14.8A3 3 0 0 0 9 7v3h9a2 2 0 0 1 2 2v8a2 2 0 0 1-2 2H6a2 2 0 0 1-2-2v-8a2 2 0 0 1 2-2h1Zm5 4a2 2 0 0 0-1 3.73V19h2v-1.27A2 2 0 0 0 12 14Z',
552
+ },
553
+ mail: {
554
+ path: 'M4 4h16a2 2 0 0 1 2 2v12a2 2 0 0 1-2 2H4a2 2 0 0 1-2-2V6a2 2 0 0 1 2-2Zm0 3.24V18h16V7.24l-8 5-8-5ZM18.53 6H5.47L12 10.08 18.53 6Z',
555
+ },
556
+ phone: {
557
+ path: 'M6.62 2.5 10 6.2 7.9 8.3a15.5 15.5 0 0 0 7.8 7.8l2.1-2.1 3.7 3.38V20a2 2 0 0 1-2 2C9.84 22 2 14.16 2 4.5a2 2 0 0 1 2-2h2.62Z',
558
+ },
559
+ send: {
560
+ path: 'm3 3 19 9-19 9 2-7 10-2-10-2-2-7Zm3.62 5.55.57 2L12 12l-4.81 1.45-.57 2L17.53 12 6.62 8.55Z',
561
+ },
562
+ location: {
563
+ path: 'M12 2a8 8 0 0 1 8 8c0 5.5-8 12-8 12S4 15.5 4 10a8 8 0 0 1 8-8Zm0 2a6 6 0 0 0-6 6c0 3.55 3.92 7.68 6 9.65 2.08-1.97 6-6.1 6-9.65a6 6 0 0 0-6-6Zm0 3a3 3 0 1 1 0 6 3 3 0 0 1 0-6Z',
564
+ },
565
+ language: {
566
+ path: 'M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm6.92 6h-3.08a15.7 15.7 0 0 0-1.38-3.18A8.05 8.05 0 0 1 18.92 8ZM12 4c-.83 1.2-1.5 2.53-1.84 4h3.68A13.7 13.7 0 0 0 12 4ZM9.54 4.82A15.7 15.7 0 0 0 8.16 8H5.08a8.05 8.05 0 0 1 4.46-3.18ZM4.26 10A8.3 8.3 0 0 0 4 12c0 .69.09 1.36.26 2h3.55a17 17 0 0 1 0-4H4.26Zm5.57 0a14.6 14.6 0 0 0 0 4h4.34a14.6 14.6 0 0 0 0-4H9.83Zm6.36 0a17 17 0 0 1 0 4h3.55A8.3 8.3 0 0 0 20 12c0-.69-.09-1.36-.26-2h-3.55ZM5.08 16h3.08c.3 1.14.77 2.2 1.38 3.18A8.05 8.05 0 0 1 5.08 16Zm5.08 0c.34 1.47 1.01 2.8 1.84 4 .83-1.2 1.5-2.53 1.84-4h-3.68Zm4.3 3.18A15.7 15.7 0 0 0 15.84 16h3.08a8.05 8.05 0 0 1-4.46 3.18Z',
567
+ },
568
+ info: {
569
+ path: 'M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-1 6h2v7h-2v-7Zm0-3h2v2h-2V7Z',
570
+ },
571
+ warning: {
572
+ path: 'M12 2 1 21h22L12 2Zm0 4.03L19.53 19H4.47L12 6.03ZM11 10v5h2v-5h-2Zm0 6v2h2v-2h-2Z',
573
+ },
574
+ error: {
575
+ path: 'M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-1 3h2v7h-2V7Zm0 9h2v2h-2v-2Z',
576
+ },
577
+ check_circle: {
578
+ path: 'M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-1.5 11.5-3-3 1.41-1.41 1.59 1.58 4.59-4.58 1.41 1.41-6 6Z',
579
+ },
580
+ cancel: {
581
+ path: 'M12 2a10 10 0 1 1 0 20 10 10 0 0 1 0-20Zm0 2a8 8 0 1 0 0 16 8 8 0 0 0 0-16Zm-3.3 3.3L12 10.59l3.3-3.3 1.4 1.42-3.29 3.29 3.3 3.3-1.42 1.4L12 13.41l-3.3 3.3-1.4-1.42 3.29-3.29-3.3-3.3L8.7 7.3Z',
582
+ },
583
+ star: {
584
+ path: 'm12 2.5 2.94 5.96 6.58.96-4.76 4.64 1.12 6.56L12 17.53l-5.88 3.09 1.12-6.56-4.76-4.64 6.58-.96L12 2.5Z',
585
+ },
586
+ favorite: {
587
+ path: 'M12 21s-9-5.4-9-12a5 5 0 0 1 9-3 5 5 0 0 1 9 3c0 6.6-9 12-9 12Z',
588
+ },
589
+ database: {
590
+ path: 'M12 2C6.48 2 2 3.79 2 6v12c0 2.21 4.48 4 10 4s10-1.79 10-4V6c0-2.21-4.48-4-10-4Zm0 2c4.42 0 8 1.12 8 2s-3.58 2-8 2-8-1.12-8-2 3.58-2 8-2ZM4 9.2c1.83.82 4.69 1.3 8 1.3s6.17-.48 8-1.3V12c0 .88-3.58 2-8 2s-8-1.12-8-2V9.2Zm0 6c1.83.82 4.69 1.3 8 1.3s6.17-.48 8-1.3V18c0 .88-3.58 2-8 2s-8-1.12-8-2v-2.8Z',
591
+ },
592
+ cloud: {
593
+ path: 'M7.5 20A5.5 5.5 0 0 1 6.3 9.13 7 7 0 0 1 19 11.5h.5a4.25 4.25 0 0 1 0 8.5h-12Zm0-2h12a2.25 2.25 0 0 0 0-4.5h-2.4l-.05-1.2A5 5 0 0 0 7.9 10.1l-.42 1.05-1.12.17A3.5 3.5 0 0 0 7.5 18Z',
594
+ },
595
+ camera: {
596
+ path: 'M8 4h8l1.5 2H21a2 2 0 0 1 2 2v11a2 2 0 0 1-2 2H3a2 2 0 0 1-2-2V8a2 2 0 0 1 2-2h3.5L8 4Zm4 4a5 5 0 1 0 0 10 5 5 0 0 0 0-10Zm0 2a3 3 0 1 1 0 6 3 3 0 0 1 0-6Z',
597
+ },
598
+ link: {
599
+ path: 'M10.59 13.41a2 2 0 0 0 2.82 0l3-3a2 2 0 0 0-2.82-2.82l-1.3 1.29-1.41-1.41 1.3-1.3a4 4 0 1 1 5.65 5.66l-3 3a4 4 0 0 1-5.66 0l-.7-.71 1.41-1.41.71.7Zm2.82-2.82a2 2 0 0 0-2.82 0l-3 3a2 2 0 0 0 2.82 2.82l1.3-1.29 1.41 1.41-1.3 1.3a4 4 0 1 1-5.65-5.66l3-3a4 4 0 0 1 5.66 0l.7.71-1.41 1.41-.71-.7Z',
600
+ },
601
+ external_link: {
602
+ path: 'M14 3h7v7h-2V6.41l-8.29 8.3-1.42-1.42L17.59 5H14V3ZM5 5h6v2H5v12h12v-6h2v6a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2V7a2 2 0 0 1 2-2Z',
472
603
  },
473
604
  };
474
605
  const TD_ICONOS_NOMBRES = Object.freeze(Object.keys(TD_ICONOS));
@@ -526,9 +657,16 @@ class TdIcon {
526
657
  [attr.role]="titulo ? 'img' : null"
527
658
  focusable="false"
528
659
  >
529
- <path [attr.d]="definicion().path" />
660
+ <path
661
+ [attr.d]="definicion().path"
662
+ [attr.fill]="definicion().estilo === 'linea' ? 'none' : 'currentColor'"
663
+ [attr.stroke]="definicion().estilo === 'linea' ? 'currentColor' : 'none'"
664
+ [attr.stroke-width]="definicion().grosor || null"
665
+ [attr.stroke-linecap]="definicion().estilo === 'linea' ? 'round' : null"
666
+ [attr.stroke-linejoin]="definicion().estilo === 'linea' ? 'round' : null"
667
+ />
530
668
  </svg>
531
- `, isInline: true, styles: [":host{display:inline-flex;width:var(--td-icon-size, 1.25rem);height:var(--td-icon-size, 1.25rem);flex:0 0 auto;color:inherit;line-height:0;vertical-align:middle}svg{width:100%;height:100%;fill:currentColor}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
669
+ `, isInline: true, styles: [":host{display:inline-flex;width:var(--td-icon-size, 1.25rem);height:var(--td-icon-size, 1.25rem);flex:0 0 auto;color:inherit;line-height:0;vertical-align:middle}svg{width:100%;height:100%}\n"], changeDetection: i0.ChangeDetectionStrategy.OnPush });
532
670
  }
533
671
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdIcon, decorators: [{
534
672
  type: Component,
@@ -540,9 +678,16 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
540
678
  [attr.role]="titulo ? 'img' : null"
541
679
  focusable="false"
542
680
  >
543
- <path [attr.d]="definicion().path" />
681
+ <path
682
+ [attr.d]="definicion().path"
683
+ [attr.fill]="definicion().estilo === 'linea' ? 'none' : 'currentColor'"
684
+ [attr.stroke]="definicion().estilo === 'linea' ? 'currentColor' : 'none'"
685
+ [attr.stroke-width]="definicion().grosor || null"
686
+ [attr.stroke-linecap]="definicion().estilo === 'linea' ? 'round' : null"
687
+ [attr.stroke-linejoin]="definicion().estilo === 'linea' ? 'round' : null"
688
+ />
544
689
  </svg>
545
- `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:inline-flex;width:var(--td-icon-size, 1.25rem);height:var(--td-icon-size, 1.25rem);flex:0 0 auto;color:inherit;line-height:0;vertical-align:middle}svg{width:100%;height:100%;fill:currentColor}\n"] }]
690
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:inline-flex;width:var(--td-icon-size, 1.25rem);height:var(--td-icon-size, 1.25rem);flex:0 0 auto;color:inherit;line-height:0;vertical-align:middle}svg{width:100%;height:100%}\n"] }]
546
691
  }], propDecorators: { nombre: [{
547
692
  type: Input
548
693
  }], titulo: [{
@@ -2222,6 +2367,297 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
2222
2367
  type: Output
2223
2368
  }] } });
2224
2369
 
2370
+ let tabSequence = 0;
2371
+ class TdTab {
2372
+ generatedId = `td-tab-${++tabSequence}`;
2373
+ id = '';
2374
+ label = 'Tab';
2375
+ icon = '';
2376
+ disabled = false;
2377
+ badge = null;
2378
+ content;
2379
+ get resolvedId() {
2380
+ return this.id || this.generatedId;
2381
+ }
2382
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdTab, deps: [], target: i0.ɵɵFactoryTarget.Component });
2383
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.17", type: TdTab, isStandalone: true, selector: "td-tab", inputs: { id: "id", label: "label", icon: "icon", disabled: "disabled", badge: "badge" }, viewQueries: [{ propertyName: "content", first: true, predicate: TemplateRef, descendants: true, static: true }], ngImport: i0, template: `
2384
+ <ng-template>
2385
+ <ng-content />
2386
+ </ng-template>
2387
+ `, isInline: true, changeDetection: i0.ChangeDetectionStrategy.OnPush });
2388
+ }
2389
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdTab, decorators: [{
2390
+ type: Component,
2391
+ args: [{
2392
+ selector: 'td-tab',
2393
+ template: `
2394
+ <ng-template>
2395
+ <ng-content />
2396
+ </ng-template>
2397
+ `,
2398
+ changeDetection: ChangeDetectionStrategy.OnPush,
2399
+ }]
2400
+ }], propDecorators: { id: [{
2401
+ type: Input
2402
+ }], label: [{
2403
+ type: Input
2404
+ }], icon: [{
2405
+ type: Input
2406
+ }], disabled: [{
2407
+ type: Input
2408
+ }], badge: [{
2409
+ type: Input
2410
+ }], content: [{
2411
+ type: ViewChild,
2412
+ args: [TemplateRef, { static: true }]
2413
+ }] } });
2414
+
2415
+ class TdTabs {
2416
+ cdr = inject(ChangeDetectorRef);
2417
+ tabsChange;
2418
+ requestedIndex = 0;
2419
+ tabQuery;
2420
+ tabButtons;
2421
+ set selectedIndex(value) {
2422
+ this.requestedIndex = Number.isFinite(value) ? Math.max(0, Math.trunc(value)) : 0;
2423
+ if (this.tabQuery)
2424
+ this.applyRequestedIndex();
2425
+ }
2426
+ get selectedIndex() {
2427
+ return this.activeIndex;
2428
+ }
2429
+ variant = 'linea';
2430
+ alignment = 'inicio';
2431
+ stretch = false;
2432
+ dark = false;
2433
+ ariaLabel = 'Pestañas';
2434
+ panelFocusable = false;
2435
+ selectedIndexChange = new EventEmitter();
2436
+ tabChange = new EventEmitter();
2437
+ tabs = [];
2438
+ activeIndex = 0;
2439
+ get activeTab() {
2440
+ return this.tabs[this.activeIndex] ?? null;
2441
+ }
2442
+ ngAfterContentInit() {
2443
+ this.syncTabs();
2444
+ this.tabsChange = this.tabQuery.changes.subscribe(() => this.syncTabs());
2445
+ }
2446
+ ngOnDestroy() {
2447
+ this.tabsChange?.unsubscribe();
2448
+ }
2449
+ select(index, focus = false) {
2450
+ const tab = this.tabs[index];
2451
+ if (!tab || tab.disabled || index === this.activeIndex) {
2452
+ if (focus && tab && !tab.disabled)
2453
+ this.focusButton(index);
2454
+ return;
2455
+ }
2456
+ this.activeIndex = index;
2457
+ this.requestedIndex = index;
2458
+ this.selectedIndexChange.emit(index);
2459
+ this.tabChange.emit(tab);
2460
+ this.cdr.markForCheck();
2461
+ if (focus)
2462
+ queueMicrotask(() => this.focusButton(index));
2463
+ }
2464
+ handleKeydown(event) {
2465
+ const horizontalKeys = ['ArrowLeft', 'ArrowRight'];
2466
+ if (!horizontalKeys.includes(event.key) && !['Home', 'End'].includes(event.key))
2467
+ return;
2468
+ event.preventDefault();
2469
+ if (event.key === 'Home') {
2470
+ this.select(this.firstEnabledIndex(), true);
2471
+ return;
2472
+ }
2473
+ if (event.key === 'End') {
2474
+ this.select(this.lastEnabledIndex(), true);
2475
+ return;
2476
+ }
2477
+ this.select(this.nextEnabledIndex(event.key === 'ArrowRight' ? 1 : -1), true);
2478
+ }
2479
+ tabId(tab) {
2480
+ return `${tab.resolvedId}-trigger`;
2481
+ }
2482
+ panelId(tab) {
2483
+ return `${tab.resolvedId}-panel`;
2484
+ }
2485
+ syncTabs() {
2486
+ this.tabs = this.tabQuery.toArray();
2487
+ this.applyRequestedIndex();
2488
+ this.cdr.markForCheck();
2489
+ }
2490
+ applyRequestedIndex() {
2491
+ if (!this.tabs.length) {
2492
+ this.activeIndex = 0;
2493
+ return;
2494
+ }
2495
+ const requested = Math.min(this.requestedIndex, this.tabs.length - 1);
2496
+ if (!this.tabs[requested]?.disabled) {
2497
+ this.activeIndex = requested;
2498
+ return;
2499
+ }
2500
+ const firstEnabled = this.firstEnabledIndex();
2501
+ this.activeIndex = firstEnabled >= 0 ? firstEnabled : 0;
2502
+ }
2503
+ nextEnabledIndex(direction) {
2504
+ if (!this.tabs.length)
2505
+ return 0;
2506
+ let next = this.activeIndex;
2507
+ for (let index = 0; index < this.tabs.length; index++) {
2508
+ next = (next + direction + this.tabs.length) % this.tabs.length;
2509
+ if (!this.tabs[next]?.disabled)
2510
+ return next;
2511
+ }
2512
+ return this.activeIndex;
2513
+ }
2514
+ firstEnabledIndex() {
2515
+ return this.tabs.findIndex((tab) => !tab.disabled);
2516
+ }
2517
+ lastEnabledIndex() {
2518
+ for (let index = this.tabs.length - 1; index >= 0; index--) {
2519
+ if (!this.tabs[index]?.disabled)
2520
+ return index;
2521
+ }
2522
+ return this.activeIndex;
2523
+ }
2524
+ focusButton(index) {
2525
+ this.tabButtons.get(index)?.nativeElement.focus();
2526
+ }
2527
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdTabs, deps: [], target: i0.ɵɵFactoryTarget.Component });
2528
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.17", type: TdTabs, isStandalone: true, selector: "td-tabs", inputs: { selectedIndex: "selectedIndex", variant: "variant", alignment: "alignment", stretch: "stretch", dark: "dark", ariaLabel: "ariaLabel", panelFocusable: "panelFocusable" }, outputs: { selectedIndexChange: "selectedIndexChange", tabChange: "tabChange" }, queries: [{ propertyName: "tabQuery", predicate: TdTab }], viewQueries: [{ propertyName: "tabButtons", predicate: ["tabButton"], descendants: true }], ngImport: i0, template: `
2529
+ <section
2530
+ class="td-tabs"
2531
+ [class.td-tabs--dark]="dark"
2532
+ [class.td-tabs--stretch]="stretch"
2533
+ [class]="'td-tabs td-tabs--' + variant + ' td-tabs--align-' + alignment +
2534
+ (dark ? ' td-tabs--dark' : '') + (stretch ? ' td-tabs--stretch' : '')"
2535
+ >
2536
+ <div
2537
+ class="td-tabs__list"
2538
+ role="tablist"
2539
+ [attr.aria-label]="ariaLabel"
2540
+ (keydown)="handleKeydown($event)"
2541
+ >
2542
+ @for (tab of tabs; track tab.resolvedId; let index = $index) {
2543
+ <button
2544
+ #tabButton
2545
+ type="button"
2546
+ class="td-tabs__tab"
2547
+ role="tab"
2548
+ [id]="tabId(tab)"
2549
+ [class.td-tabs__tab--active]="index === activeIndex"
2550
+ [disabled]="tab.disabled"
2551
+ [attr.tabindex]="index === activeIndex ? 0 : -1"
2552
+ [attr.aria-selected]="index === activeIndex"
2553
+ [attr.aria-controls]="panelId(tab)"
2554
+ (click)="select(index)"
2555
+ >
2556
+ @if (tab.icon) {
2557
+ <td-icon [nombre]="tab.icon" />
2558
+ }
2559
+ <span>{{ tab.label }}</span>
2560
+ @if (tab.badge !== null) {
2561
+ <small>{{ tab.badge }}</small>
2562
+ }
2563
+ </button>
2564
+ }
2565
+ </div>
2566
+
2567
+ @if (activeTab; as tab) {
2568
+ <div
2569
+ class="td-tabs__panel"
2570
+ role="tabpanel"
2571
+ [id]="panelId(tab)"
2572
+ [attr.aria-labelledby]="tabId(tab)"
2573
+ [attr.tabindex]="panelFocusable ? 0 : null"
2574
+ >
2575
+ <ng-container [ngTemplateOutlet]="tab.content" />
2576
+ </div>
2577
+ }
2578
+ </section>
2579
+ `, isInline: true, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-tabs{--td-tabs-bg: #fff;--td-tabs-soft: #f7f8fb;--td-tabs-border: #e3e7ef;--td-tabs-text: #263147;--td-tabs-muted: #748096;--td-tabs-accent: #5746d8;min-width:0;color:var(--td-tabs-text)}.td-tabs--dark{--td-tabs-bg: #19191f;--td-tabs-soft: #202028;--td-tabs-border: #303039;--td-tabs-text: #ededf0;--td-tabs-muted: #a1a1aa;--td-tabs-accent: #b9b0fa}.td-tabs__list{display:flex;min-width:0;overflow-x:auto;scrollbar-width:none}.td-tabs__list::-webkit-scrollbar{display:none}.td-tabs--align-centro .td-tabs__list{justify-content:center}.td-tabs--align-fin .td-tabs__list{justify-content:flex-end}.td-tabs__tab{position:relative;display:inline-flex;min-height:2.85rem;flex:0 0 auto;align-items:center;justify-content:center;gap:.45rem;border:0;padding:.7rem .95rem;color:var(--td-tabs-muted);background:transparent;font:750 .72rem/1 system-ui,sans-serif;white-space:nowrap;cursor:pointer;transition:color .13s ease,background .13s ease}.td-tabs--stretch .td-tabs__tab{min-width:0;flex:1 1 0}.td-tabs__tab:hover:not(:disabled){color:var(--td-tabs-accent)}.td-tabs__tab:focus-visible{outline:2px solid var(--td-tabs-accent);outline-offset:-2px}.td-tabs__tab:disabled{opacity:.42;cursor:not-allowed}.td-tabs__tab small{min-width:1.25rem;border-radius:999px;padding:.22rem .38rem;color:var(--td-tabs-muted);background:var(--td-tabs-soft);font-size:.58rem}.td-tabs--linea .td-tabs__list{border-bottom:1px solid var(--td-tabs-border)}.td-tabs--linea .td-tabs__tab:after{position:absolute;right:.65rem;bottom:-1px;left:.65rem;height:2px;border-radius:999px 999px 0 0;background:transparent;content:\"\"}.td-tabs--linea .td-tabs__tab--active{color:var(--td-tabs-accent)}.td-tabs--linea .td-tabs__tab--active:after{background:var(--td-tabs-accent)}.td-tabs--pastilla .td-tabs__list{gap:.3rem;border:1px solid var(--td-tabs-border);border-radius:.8rem;padding:.28rem;background:var(--td-tabs-soft)}.td-tabs--pastilla .td-tabs__tab{min-height:2.35rem;border-radius:.58rem}.td-tabs--pastilla .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg);box-shadow:0 3px 10px #0f172a14}.td-tabs--contenida{overflow:hidden;border:1px solid var(--td-tabs-border);border-radius:.9rem;background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__list{border-bottom:1px solid var(--td-tabs-border);padding:0 .45rem;background:var(--td-tabs-soft)}.td-tabs--contenida .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__panel{padding:1.25rem}.td-tabs__panel{min-width:0;padding-top:1.15rem;animation:td-tabs-panel-in .14s ease-out}@keyframes td-tabs-panel-in{0%{opacity:0;transform:translateY(.18rem)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.td-tabs__panel{animation:none}}\n"], dependencies: [{ kind: "directive", type: NgTemplateOutlet, selector: "[ngTemplateOutlet]", inputs: ["ngTemplateOutletContext", "ngTemplateOutlet", "ngTemplateOutletInjector"] }, { kind: "component", type: TdIcon, selector: "td-icon", inputs: ["nombre", "titulo", "tamano"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2580
+ }
2581
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImport: i0, type: TdTabs, decorators: [{
2582
+ type: Component,
2583
+ args: [{ selector: 'td-tabs', imports: [NgTemplateOutlet, TdIcon], template: `
2584
+ <section
2585
+ class="td-tabs"
2586
+ [class.td-tabs--dark]="dark"
2587
+ [class.td-tabs--stretch]="stretch"
2588
+ [class]="'td-tabs td-tabs--' + variant + ' td-tabs--align-' + alignment +
2589
+ (dark ? ' td-tabs--dark' : '') + (stretch ? ' td-tabs--stretch' : '')"
2590
+ >
2591
+ <div
2592
+ class="td-tabs__list"
2593
+ role="tablist"
2594
+ [attr.aria-label]="ariaLabel"
2595
+ (keydown)="handleKeydown($event)"
2596
+ >
2597
+ @for (tab of tabs; track tab.resolvedId; let index = $index) {
2598
+ <button
2599
+ #tabButton
2600
+ type="button"
2601
+ class="td-tabs__tab"
2602
+ role="tab"
2603
+ [id]="tabId(tab)"
2604
+ [class.td-tabs__tab--active]="index === activeIndex"
2605
+ [disabled]="tab.disabled"
2606
+ [attr.tabindex]="index === activeIndex ? 0 : -1"
2607
+ [attr.aria-selected]="index === activeIndex"
2608
+ [attr.aria-controls]="panelId(tab)"
2609
+ (click)="select(index)"
2610
+ >
2611
+ @if (tab.icon) {
2612
+ <td-icon [nombre]="tab.icon" />
2613
+ }
2614
+ <span>{{ tab.label }}</span>
2615
+ @if (tab.badge !== null) {
2616
+ <small>{{ tab.badge }}</small>
2617
+ }
2618
+ </button>
2619
+ }
2620
+ </div>
2621
+
2622
+ @if (activeTab; as tab) {
2623
+ <div
2624
+ class="td-tabs__panel"
2625
+ role="tabpanel"
2626
+ [id]="panelId(tab)"
2627
+ [attr.aria-labelledby]="tabId(tab)"
2628
+ [attr.tabindex]="panelFocusable ? 0 : null"
2629
+ >
2630
+ <ng-container [ngTemplateOutlet]="tab.content" />
2631
+ </div>
2632
+ }
2633
+ </section>
2634
+ `, changeDetection: ChangeDetectionStrategy.OnPush, styles: [":host{display:block;min-width:0;font-family:Inter,ui-sans-serif,system-ui,sans-serif}*{box-sizing:border-box}.td-tabs{--td-tabs-bg: #fff;--td-tabs-soft: #f7f8fb;--td-tabs-border: #e3e7ef;--td-tabs-text: #263147;--td-tabs-muted: #748096;--td-tabs-accent: #5746d8;min-width:0;color:var(--td-tabs-text)}.td-tabs--dark{--td-tabs-bg: #19191f;--td-tabs-soft: #202028;--td-tabs-border: #303039;--td-tabs-text: #ededf0;--td-tabs-muted: #a1a1aa;--td-tabs-accent: #b9b0fa}.td-tabs__list{display:flex;min-width:0;overflow-x:auto;scrollbar-width:none}.td-tabs__list::-webkit-scrollbar{display:none}.td-tabs--align-centro .td-tabs__list{justify-content:center}.td-tabs--align-fin .td-tabs__list{justify-content:flex-end}.td-tabs__tab{position:relative;display:inline-flex;min-height:2.85rem;flex:0 0 auto;align-items:center;justify-content:center;gap:.45rem;border:0;padding:.7rem .95rem;color:var(--td-tabs-muted);background:transparent;font:750 .72rem/1 system-ui,sans-serif;white-space:nowrap;cursor:pointer;transition:color .13s ease,background .13s ease}.td-tabs--stretch .td-tabs__tab{min-width:0;flex:1 1 0}.td-tabs__tab:hover:not(:disabled){color:var(--td-tabs-accent)}.td-tabs__tab:focus-visible{outline:2px solid var(--td-tabs-accent);outline-offset:-2px}.td-tabs__tab:disabled{opacity:.42;cursor:not-allowed}.td-tabs__tab small{min-width:1.25rem;border-radius:999px;padding:.22rem .38rem;color:var(--td-tabs-muted);background:var(--td-tabs-soft);font-size:.58rem}.td-tabs--linea .td-tabs__list{border-bottom:1px solid var(--td-tabs-border)}.td-tabs--linea .td-tabs__tab:after{position:absolute;right:.65rem;bottom:-1px;left:.65rem;height:2px;border-radius:999px 999px 0 0;background:transparent;content:\"\"}.td-tabs--linea .td-tabs__tab--active{color:var(--td-tabs-accent)}.td-tabs--linea .td-tabs__tab--active:after{background:var(--td-tabs-accent)}.td-tabs--pastilla .td-tabs__list{gap:.3rem;border:1px solid var(--td-tabs-border);border-radius:.8rem;padding:.28rem;background:var(--td-tabs-soft)}.td-tabs--pastilla .td-tabs__tab{min-height:2.35rem;border-radius:.58rem}.td-tabs--pastilla .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg);box-shadow:0 3px 10px #0f172a14}.td-tabs--contenida{overflow:hidden;border:1px solid var(--td-tabs-border);border-radius:.9rem;background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__list{border-bottom:1px solid var(--td-tabs-border);padding:0 .45rem;background:var(--td-tabs-soft)}.td-tabs--contenida .td-tabs__tab--active{color:var(--td-tabs-accent);background:var(--td-tabs-bg)}.td-tabs--contenida .td-tabs__panel{padding:1.25rem}.td-tabs__panel{min-width:0;padding-top:1.15rem;animation:td-tabs-panel-in .14s ease-out}@keyframes td-tabs-panel-in{0%{opacity:0;transform:translateY(.18rem)}to{opacity:1;transform:translateY(0)}}@media(prefers-reduced-motion:reduce){.td-tabs__panel{animation:none}}\n"] }]
2635
+ }], propDecorators: { tabQuery: [{
2636
+ type: ContentChildren,
2637
+ args: [TdTab]
2638
+ }], tabButtons: [{
2639
+ type: ViewChildren,
2640
+ args: ['tabButton']
2641
+ }], selectedIndex: [{
2642
+ type: Input
2643
+ }], variant: [{
2644
+ type: Input
2645
+ }], alignment: [{
2646
+ type: Input
2647
+ }], stretch: [{
2648
+ type: Input
2649
+ }], dark: [{
2650
+ type: Input
2651
+ }], ariaLabel: [{
2652
+ type: Input
2653
+ }], panelFocusable: [{
2654
+ type: Input
2655
+ }], selectedIndexChange: [{
2656
+ type: Output
2657
+ }], tabChange: [{
2658
+ type: Output
2659
+ }] } });
2660
+
2225
2661
  /*
2226
2662
  * Public API Surface of telcomdev-ui
2227
2663
  */
@@ -2230,5 +2666,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.17", ngImpo
2230
2666
  * Generated bundle index. Do not edit.
2231
2667
  */
2232
2668
 
2233
- export { TD_DIALOG_CONFIG, TD_DIALOG_DATA, TD_ICONOS, TD_ICONOS_NOMBRES, TdAlerta, TdAutocompleteSelect, TdDataTable, TdDialog, TdDialogActions, TdDialogClose, TdDialogPrimary, TdDialogRef, TdFooter, TdHeader, TdIcon, TdIconoRegistry, TdInput, TdSelect, TdSidebar, TelcomdevUi };
2669
+ export { TD_DIALOG_CONFIG, TD_DIALOG_DATA, TD_ICONOS, TD_ICONOS_NOMBRES, TdAlerta, TdAutocompleteSelect, TdDataTable, TdDialog, TdDialogActions, TdDialogClose, TdDialogPrimary, TdDialogRef, TdFooter, TdHeader, TdIcon, TdIconoRegistry, TdInput, TdSelect, TdSidebar, TdTab, TdTabs, TelcomdevUi };
2234
2670
  //# sourceMappingURL=telcomdev-ui.mjs.map