cerxos-ui 0.0.20 → 0.0.22

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
@@ -28,17 +28,9 @@ This command will compile your project, and the build artifacts will be placed i
28
28
 
29
29
  ### Publishing the Library
30
30
 
31
- Once the project is built, you can publish your library by following these steps:
32
-
33
- 1. Navigate to the `dist` directory:
34
- ```bash
35
- cd dist/cerxos-ui
36
- ```
37
-
38
- 2. Run the `npm publish` command to publish your library to the npm registry:
39
- ```bash
40
- npm publish
41
- ```
31
+ Publishing is triggered by a maintainer-pushed version tag. Follow the
32
+ [workspace release instructions](https://github.com/nurakmaljalil91/cerxos-ui-workspace#publishing-cerxos-ui) for the
33
+ version, tag, npm trusted publisher setup, and verification steps.
42
34
 
43
35
  ## Running unit tests
44
36
 
@@ -1,5 +1,5 @@
1
1
  import * as i0 from '@angular/core';
2
- import { Component, EventEmitter, ElementRef, HostListener, ViewChildren, ViewChild, Output, Input, ChangeDetectionStrategy, Attribute, forwardRef, Directive, ContentChildren, inject, ContentChild, HostBinding, signal, Injectable, Pipe } from '@angular/core';
2
+ import { Component, EventEmitter, ElementRef, HostListener, ViewChildren, ViewChild, Output, Input, ChangeDetectionStrategy, Attribute, forwardRef, Directive, ContentChildren, inject, ChangeDetectorRef, ContentChild, HostBinding, signal, Injectable, Pipe } from '@angular/core';
3
3
  import { NG_VALUE_ACCESSOR } from '@angular/forms';
4
4
  import * as i1 from '@angular/common';
5
5
  import { NgTemplateOutlet, CommonModule } from '@angular/common';
@@ -434,7 +434,7 @@ const VARIANT_CLASSES$8 = {
434
434
  danger: 'border-[var(--cxs-color-danger)] bg-[var(--cxs-color-surface)] ' +
435
435
  'text-[var(--cxs-color-danger)]'
436
436
  };
437
- const SIZE_CLASSES$8 = {
437
+ const SIZE_CLASSES$9 = {
438
438
  sm: 'text-[11px]',
439
439
  md: 'text-xs'
440
440
  };
@@ -442,7 +442,7 @@ class CxsBadgeComponent {
442
442
  variant = 'primary';
443
443
  size = 'md';
444
444
  get badgeClass() {
445
- return [BASE_CLASSES$a, VARIANT_CLASSES$8[this.variant], SIZE_CLASSES$8[this.size]].join(' ');
445
+ return [BASE_CLASSES$a, VARIANT_CLASSES$8[this.variant], SIZE_CLASSES$9[this.size]].join(' ');
446
446
  }
447
447
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsBadgeComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
448
448
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", type: CxsBadgeComponent, isStandalone: true, selector: "cxs-badge", inputs: { variant: "variant", size: "size" }, ngImport: i0, template: "<span [class]=\"badgeClass\">\n <ng-content></ng-content>\n</span>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
@@ -459,7 +459,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
459
459
  const BASE_CLASSES$9 = 'inline-flex items-center justify-center overflow-hidden border border-[var(--cxs-color-border)] ' +
460
460
  'bg-[var(--cxs-color-primary-ghost)] text-[var(--cxs-color-primary)] font-semibold uppercase ' +
461
461
  'select-none';
462
- const SIZE_CLASSES$7 = {
462
+ const SIZE_CLASSES$8 = {
463
463
  sm: 'h-8 w-8 text-[11px]',
464
464
  md: 'h-10 w-10 text-xs',
465
465
  lg: 'h-14 w-14 text-sm'
@@ -490,7 +490,7 @@ class CxsAvatarComponent {
490
490
  this.hostClass = hostClass;
491
491
  }
492
492
  get avatarClass() {
493
- return [BASE_CLASSES$9, SIZE_CLASSES$7[this.size], SHAPE_CLASSES[this.shape], this.hostClass]
493
+ return [BASE_CLASSES$9, SIZE_CLASSES$8[this.size], SHAPE_CLASSES[this.shape], this.hostClass]
494
494
  .filter(Boolean)
495
495
  .join(' ');
496
496
  }
@@ -566,7 +566,7 @@ const LINK_BASE_CLASSES = 'rounded-[var(--cxs-radius-md)] transition-colors focu
566
566
  const NON_LINK_CLASSES = 'text-[var(--cxs-color-on-surface-muted)]';
567
567
  const SEPARATOR_CLASSES = 'text-[var(--cxs-color-on-surface-muted)] select-none';
568
568
  const DISABLED_CLASSES = 'text-[var(--cxs-color-on-surface-muted)] opacity-60';
569
- const SIZE_CLASSES$6 = {
569
+ const SIZE_CLASSES$7 = {
570
570
  sm: 'text-xs',
571
571
  md: 'text-sm',
572
572
  lg: 'text-base'
@@ -587,7 +587,7 @@ class CxsBreadcrumbComponent {
587
587
  variant = 'default';
588
588
  disabled = false;
589
589
  get listClass() {
590
- return [BASE_CLASSES$8, SIZE_CLASSES$6[this.size], this.disabled ? 'opacity-60' : '']
590
+ return [BASE_CLASSES$8, SIZE_CLASSES$7[this.size], this.disabled ? 'opacity-60' : '']
591
591
  .filter(Boolean)
592
592
  .join(' ');
593
593
  }
@@ -649,7 +649,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
649
649
  }] } });
650
650
 
651
651
  const BASE_CLASSES$7 = 'inline-block shrink-0';
652
- const SIZE_CLASSES$5 = {
652
+ const SIZE_CLASSES$6 = {
653
653
  sm: 'h-4 w-4',
654
654
  md: 'h-5 w-5',
655
655
  lg: 'h-6 w-6'
@@ -770,7 +770,7 @@ class CxsIconComponent {
770
770
  return icon;
771
771
  }
772
772
  get iconClass() {
773
- return [BASE_CLASSES$7, SIZE_CLASSES$5[this.size], this.hostClass].filter(Boolean).join(' ');
773
+ return [BASE_CLASSES$7, SIZE_CLASSES$6[this.size], this.hostClass].filter(Boolean).join(' ');
774
774
  }
775
775
  get titleId() {
776
776
  return this.label ? `cxs-icon-title-${this.instanceId}` : null;
@@ -809,7 +809,7 @@ const VARIANT_CLASSES$7 = {
809
809
  'hover:bg-[var(--cxs-color-primary-ghost)]',
810
810
  ghost: 'bg-transparent text-[var(--cxs-color-primary)] hover:bg-[var(--cxs-color-primary-ghost)]'
811
811
  };
812
- const SIZE_CLASSES$4 = {
812
+ const SIZE_CLASSES$5 = {
813
813
  sm: 'h-8 px-3 text-sm rounded-[var(--cxs-radius-md)]',
814
814
  md: 'h-10 px-4 text-sm rounded-[var(--cxs-radius-md)]',
815
815
  lg: 'h-12 px-5 text-base rounded-[var(--cxs-radius-md)]'
@@ -860,7 +860,7 @@ class CxsButtonComponent {
860
860
  get buttonClass() {
861
861
  return [
862
862
  BASE_CLASSES$6,
863
- this.iconOnly ? ICON_ONLY_SIZE_CLASSES[this.size] : SIZE_CLASSES$4[this.size],
863
+ this.iconOnly ? ICON_ONLY_SIZE_CLASSES[this.size] : SIZE_CLASSES$5[this.size],
864
864
  VARIANT_CLASSES$7[this.variant],
865
865
  this.iconOnly ? 'gap-0' : '',
866
866
  this.hostClass
@@ -904,7 +904,7 @@ const VARIANT_CLASSES$6 = {
904
904
  muted: 'bg-[var(--cxs-color-surface-hover)]',
905
905
  outline: 'bg-transparent'
906
906
  };
907
- const SIZE_CLASSES$3 = {
907
+ const SIZE_CLASSES$4 = {
908
908
  sm: 'p-3',
909
909
  md: 'p-5',
910
910
  lg: 'p-7'
@@ -919,7 +919,7 @@ class CxsCardComponent {
919
919
  return [
920
920
  BASE_CLASSES$5,
921
921
  VARIANT_CLASSES$6[this.variant],
922
- SIZE_CLASSES$3[this.size],
922
+ SIZE_CLASSES$4[this.size],
923
923
  this.elevated ? 'shadow-[var(--cxs-shadow-sm)]' : ''
924
924
  ]
925
925
  .filter(Boolean)
@@ -1269,7 +1269,7 @@ const BODY_ROW_BASE_CLASSES$1 = 'border-b border-[var(--cxs-color-border)] last:
1269
1269
  const BODY_ROW_STRIPED_CLASSES$1 = 'odd:bg-[var(--cxs-color-surface)] even:bg-[var(--cxs-color-surface-hover)]';
1270
1270
  const BODY_CELL_BASE_CLASSES$1 = 'px-3 py-2 align-top';
1271
1271
  const BODY_CELL_COMPACT_CLASSES$1 = 'px-2 py-1.5';
1272
- const ALIGN_CLASSES$1 = {
1272
+ const ALIGN_CLASSES$2 = {
1273
1273
  left: 'text-left',
1274
1274
  center: 'text-center',
1275
1275
  right: 'text-right'
@@ -1498,7 +1498,7 @@ class CxsDataTableComponent {
1498
1498
  return [
1499
1499
  HEADER_CELL_BASE_CLASSES$1,
1500
1500
  this.columnBorders ? COLUMN_BORDER_CLASSES : '',
1501
- ALIGN_CLASSES$1[column.align ?? 'left'],
1501
+ ALIGN_CLASSES$2[column.align ?? 'left'],
1502
1502
  column.headerClass ?? ''
1503
1503
  ]
1504
1504
  .filter(Boolean)
@@ -1515,7 +1515,7 @@ class CxsDataTableComponent {
1515
1515
  BODY_CELL_BASE_CLASSES$1,
1516
1516
  this.compact ? BODY_CELL_COMPACT_CLASSES$1 : '',
1517
1517
  this.columnBorders ? COLUMN_BORDER_CLASSES : '',
1518
- ALIGN_CLASSES$1[column.align ?? 'left'],
1518
+ ALIGN_CLASSES$2[column.align ?? 'left'],
1519
1519
  column.cellClass ?? ''
1520
1520
  ]
1521
1521
  .filter(Boolean)
@@ -2045,7 +2045,7 @@ const VARIANT_CLASSES$5 = {
2045
2045
  outline: 'bg-[var(--cxs-color-surface)]',
2046
2046
  filled: 'bg-[var(--cxs-color-surface-hover)]'
2047
2047
  };
2048
- const SIZE_CLASSES$2 = {
2048
+ const SIZE_CLASSES$3 = {
2049
2049
  sm: 'h-8 px-3 text-sm',
2050
2050
  md: 'h-10 px-3 text-sm',
2051
2051
  lg: 'h-12 px-4 text-base'
@@ -2115,7 +2115,7 @@ class CxsDatepickerComponent {
2115
2115
  get inputClass() {
2116
2116
  return [
2117
2117
  BASE_CLASSES$4,
2118
- SIZE_CLASSES$2[this.size],
2118
+ SIZE_CLASSES$3[this.size],
2119
2119
  VARIANT_CLASSES$5[this.variant],
2120
2120
  this.invalid ? INVALID_CLASSES$4 : ''
2121
2121
  ]
@@ -2633,6 +2633,203 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
2633
2633
  type: Output
2634
2634
  }] } });
2635
2635
 
2636
+ const CONTENT_BASE_CLASSES = 'absolute z-50 w-80 max-w-[calc(100vw-2rem)] rounded-[var(--cxs-radius-md)] ' +
2637
+ 'border border-[var(--cxs-color-border)] bg-[var(--cxs-color-surface)] p-4 ' +
2638
+ 'text-sm text-[var(--cxs-color-on-surface)] shadow-[var(--cxs-shadow-sm)]';
2639
+ const SIDE_CLASSES = {
2640
+ top: 'bottom-full mb-2',
2641
+ right: 'left-full ml-2',
2642
+ bottom: 'top-full mt-2',
2643
+ left: 'right-full mr-2'
2644
+ };
2645
+ const ALIGN_CLASSES$1 = {
2646
+ top: { start: 'left-0', center: 'left-1/2 -translate-x-1/2', end: 'right-0' },
2647
+ bottom: { start: 'left-0', center: 'left-1/2 -translate-x-1/2', end: 'right-0' },
2648
+ left: { start: 'top-0', center: 'top-1/2 -translate-y-1/2', end: 'bottom-0' },
2649
+ right: { start: 'top-0', center: 'top-1/2 -translate-y-1/2', end: 'bottom-0' }
2650
+ };
2651
+ class CxsHoverCardComponent {
2652
+ static nextId = 0;
2653
+ openDelay = 200;
2654
+ closeDelay = 200;
2655
+ trigger;
2656
+ contentId = `cxs-hover-card-${CxsHoverCardComponent.nextId++}`;
2657
+ open = false;
2658
+ host = inject((ElementRef));
2659
+ changeDetector = inject(ChangeDetectorRef);
2660
+ openTimer;
2661
+ closeTimer;
2662
+ pointerInside = false;
2663
+ focusInside = false;
2664
+ suppressFocusOpen = false;
2665
+ onMouseEnter() {
2666
+ this.pointerInside = true;
2667
+ this.scheduleOpen();
2668
+ }
2669
+ onMouseLeave() {
2670
+ this.pointerInside = false;
2671
+ if (!this.focusInside) {
2672
+ this.scheduleClose();
2673
+ }
2674
+ }
2675
+ onFocusIn() {
2676
+ this.focusInside = true;
2677
+ if (this.suppressFocusOpen) {
2678
+ this.suppressFocusOpen = false;
2679
+ return;
2680
+ }
2681
+ this.cancelOpen();
2682
+ this.cancelClose();
2683
+ this.setOpen(true);
2684
+ }
2685
+ onFocusOut(event) {
2686
+ if (event.relatedTarget && this.host.nativeElement.contains(event.relatedTarget)) {
2687
+ return;
2688
+ }
2689
+ this.focusInside = false;
2690
+ this.suppressFocusOpen = false;
2691
+ if (!this.pointerInside) {
2692
+ this.scheduleClose();
2693
+ }
2694
+ }
2695
+ onKeydown(event) {
2696
+ if (event.key === 'Escape' && this.open) {
2697
+ event.preventDefault();
2698
+ this.cancelOpen();
2699
+ this.cancelClose();
2700
+ this.setOpen(false);
2701
+ const trigger = this.trigger?.element.nativeElement;
2702
+ if (trigger && !trigger.contains(event.target)) {
2703
+ this.suppressFocusOpen = true;
2704
+ trigger.focus();
2705
+ }
2706
+ }
2707
+ }
2708
+ ngOnDestroy() {
2709
+ this.cancelOpen();
2710
+ this.cancelClose();
2711
+ }
2712
+ scheduleOpen() {
2713
+ this.cancelClose();
2714
+ if (this.open || this.openTimer) {
2715
+ return;
2716
+ }
2717
+ this.openTimer = setTimeout(() => {
2718
+ this.openTimer = undefined;
2719
+ this.setOpen(true);
2720
+ }, Math.max(0, this.openDelay));
2721
+ }
2722
+ scheduleClose() {
2723
+ this.cancelOpen();
2724
+ if (!this.open || this.closeTimer) {
2725
+ return;
2726
+ }
2727
+ this.closeTimer = setTimeout(() => {
2728
+ this.closeTimer = undefined;
2729
+ this.setOpen(false);
2730
+ }, Math.max(0, this.closeDelay));
2731
+ }
2732
+ cancelOpen() {
2733
+ clearTimeout(this.openTimer);
2734
+ this.openTimer = undefined;
2735
+ }
2736
+ cancelClose() {
2737
+ clearTimeout(this.closeTimer);
2738
+ this.closeTimer = undefined;
2739
+ }
2740
+ setOpen(open) {
2741
+ this.open = open;
2742
+ this.changeDetector.markForCheck();
2743
+ }
2744
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsHoverCardComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2745
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "21.2.10", type: CxsHoverCardComponent, isStandalone: true, selector: "cxs-hover-card", inputs: { openDelay: "openDelay", closeDelay: "closeDelay" }, host: { listeners: { "mouseenter": "onMouseEnter()", "mouseleave": "onMouseLeave()", "focusin": "onFocusIn()", "focusout": "onFocusOut($event)", "keydown": "onKeydown($event)" }, classAttribute: "relative inline-flex" }, queries: [{ propertyName: "trigger", first: true, predicate: i0.forwardRef(() => CxsHoverCardTriggerDirective), descendants: true }], ngImport: i0, template: "<ng-content select=\"[cxsHoverCardTrigger]\"></ng-content>\n<ng-content select=\"[cxsHoverCardContent]\"></ng-content>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
2746
+ }
2747
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsHoverCardComponent, decorators: [{
2748
+ type: Component,
2749
+ args: [{ selector: 'cxs-hover-card', standalone: true, host: { class: 'relative inline-flex' }, changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-content select=\"[cxsHoverCardTrigger]\"></ng-content>\n<ng-content select=\"[cxsHoverCardContent]\"></ng-content>\n" }]
2750
+ }], propDecorators: { openDelay: [{
2751
+ type: Input
2752
+ }], closeDelay: [{
2753
+ type: Input
2754
+ }], trigger: [{
2755
+ type: ContentChild,
2756
+ args: [forwardRef(() => CxsHoverCardTriggerDirective)]
2757
+ }], onMouseEnter: [{
2758
+ type: HostListener,
2759
+ args: ['mouseenter']
2760
+ }], onMouseLeave: [{
2761
+ type: HostListener,
2762
+ args: ['mouseleave']
2763
+ }], onFocusIn: [{
2764
+ type: HostListener,
2765
+ args: ['focusin']
2766
+ }], onFocusOut: [{
2767
+ type: HostListener,
2768
+ args: ['focusout', ['$event']]
2769
+ }], onKeydown: [{
2770
+ type: HostListener,
2771
+ args: ['keydown', ['$event']]
2772
+ }] } });
2773
+ class CxsHoverCardTriggerDirective {
2774
+ card = inject(CxsHoverCardComponent);
2775
+ element = inject((ElementRef));
2776
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsHoverCardTriggerDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2777
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.10", type: CxsHoverCardTriggerDirective, isStandalone: true, selector: "[cxsHoverCardTrigger]", host: { properties: { "attr.aria-haspopup": "\"dialog\"", "attr.aria-expanded": "card.open", "attr.aria-controls": "card.contentId" }, classAttribute: "focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 focus-visible:outline-[var(--cxs-color-focus)]" }, ngImport: i0 });
2778
+ }
2779
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsHoverCardTriggerDirective, decorators: [{
2780
+ type: Directive,
2781
+ args: [{
2782
+ selector: '[cxsHoverCardTrigger]',
2783
+ standalone: true,
2784
+ host: {
2785
+ class: 'focus-visible:outline focus-visible:outline-2 focus-visible:outline-offset-2 ' +
2786
+ 'focus-visible:outline-[var(--cxs-color-focus)]',
2787
+ '[attr.aria-haspopup]': '"dialog"',
2788
+ '[attr.aria-expanded]': 'card.open',
2789
+ '[attr.aria-controls]': 'card.contentId'
2790
+ }
2791
+ }]
2792
+ }] });
2793
+ class CxsHoverCardContentDirective {
2794
+ side = 'bottom';
2795
+ align = 'center';
2796
+ ariaLabel = 'Preview';
2797
+ card = inject(CxsHoverCardComponent);
2798
+ get contentClass() {
2799
+ return [
2800
+ CONTENT_BASE_CLASSES,
2801
+ SIDE_CLASSES[this.side],
2802
+ ALIGN_CLASSES$1[this.side][this.align],
2803
+ this.card.open ? '' : 'hidden'
2804
+ ]
2805
+ .filter(Boolean)
2806
+ .join(' ');
2807
+ }
2808
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsHoverCardContentDirective, deps: [], target: i0.ɵɵFactoryTarget.Directive });
2809
+ static ɵdir = i0.ɵɵngDeclareDirective({ minVersion: "14.0.0", version: "21.2.10", type: CxsHoverCardContentDirective, isStandalone: true, selector: "[cxsHoverCardContent]", inputs: { side: "side", align: "align", ariaLabel: "ariaLabel" }, host: { properties: { "class": "contentClass", "attr.id": "card.contentId", "attr.role": "\"dialog\"", "attr.aria-label": "ariaLabel", "attr.aria-hidden": "card.open ? null : \"true\"", "attr.hidden": "card.open ? null : \"\"" } }, ngImport: i0 });
2810
+ }
2811
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsHoverCardContentDirective, decorators: [{
2812
+ type: Directive,
2813
+ args: [{
2814
+ selector: '[cxsHoverCardContent]',
2815
+ standalone: true,
2816
+ host: {
2817
+ '[class]': 'contentClass',
2818
+ '[attr.id]': 'card.contentId',
2819
+ '[attr.role]': '"dialog"',
2820
+ '[attr.aria-label]': 'ariaLabel',
2821
+ '[attr.aria-hidden]': 'card.open ? null : "true"',
2822
+ '[attr.hidden]': 'card.open ? null : ""'
2823
+ }
2824
+ }]
2825
+ }], propDecorators: { side: [{
2826
+ type: Input
2827
+ }], align: [{
2828
+ type: Input
2829
+ }], ariaLabel: [{
2830
+ type: Input
2831
+ }] } });
2832
+
2636
2833
  const BASE_CLASSES$3 = 'w-full rounded-[var(--cxs-radius-md)] border border-[var(--cxs-color-border)] ' +
2637
2834
  'bg-[var(--cxs-color-surface)] text-[var(--cxs-color-on-surface)] ' +
2638
2835
  'placeholder:text-[var(--cxs-color-on-surface-muted)] transition-colors ' +
@@ -2647,7 +2844,7 @@ const VARIANT_CLASSES$4 = {
2647
2844
  outline: 'bg-[var(--cxs-color-surface)]',
2648
2845
  filled: 'bg-[var(--cxs-color-surface-hover)]'
2649
2846
  };
2650
- const SIZE_CLASSES$1 = {
2847
+ const SIZE_CLASSES$2 = {
2651
2848
  sm: 'h-8 px-3 text-sm',
2652
2849
  md: 'h-10 px-3 text-sm',
2653
2850
  lg: 'h-12 px-4 text-base'
@@ -2695,7 +2892,7 @@ class CxsInputComponent {
2695
2892
  get inputClass() {
2696
2893
  return [
2697
2894
  BASE_CLASSES$3,
2698
- SIZE_CLASSES$1[this.size],
2895
+ SIZE_CLASSES$2[this.size],
2699
2896
  VARIANT_CLASSES$4[this.variant],
2700
2897
  this.invalid ? INVALID_CLASSES$3 : ''
2701
2898
  ]
@@ -3670,6 +3867,115 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
3670
3867
  type: Output
3671
3868
  }] } });
3672
3869
 
3870
+ const CHIP_BASE = 'inline-flex items-center gap-2 rounded-[var(--cxs-radius-md)] border ' +
3871
+ 'font-medium transition-colors cursor-pointer select-none ' +
3872
+ 'peer-focus-visible:outline peer-focus-visible:outline-2 peer-focus-visible:outline-offset-2 ' +
3873
+ 'peer-focus-visible:outline-[var(--cxs-color-focus)]';
3874
+ const TONE_CLASSES = {
3875
+ primary: 'border-[var(--cxs-color-primary)] bg-[var(--cxs-color-primary-ghost)] ' +
3876
+ 'text-[var(--cxs-color-primary)]',
3877
+ danger: 'border-[var(--cxs-color-danger)] bg-[var(--cxs-color-danger-surface)] ' +
3878
+ 'text-[var(--cxs-color-danger)]',
3879
+ neutral: 'border-[var(--cxs-color-border)] bg-[var(--cxs-color-surface)] ' +
3880
+ 'text-[var(--cxs-color-on-surface)]'
3881
+ };
3882
+ const SELECTED_CLASSES = 'ring-2 ring-offset-2 ring-current';
3883
+ const SIZE_CLASSES$1 = {
3884
+ sm: 'min-h-8 px-3 py-1 text-xs',
3885
+ md: 'min-h-10 px-4 py-2 text-sm',
3886
+ lg: 'min-h-12 px-5 py-2.5 text-base'
3887
+ };
3888
+ class CxsRadioChipGroupComponent {
3889
+ changeDetector;
3890
+ static nextId = 0;
3891
+ label = '';
3892
+ options = [];
3893
+ disabled = false;
3894
+ invalid = false;
3895
+ required = false;
3896
+ size = 'md';
3897
+ valueChange = new EventEmitter();
3898
+ groupId = `cxs-radio-chip-group-${CxsRadioChipGroupComponent.nextId++}`;
3899
+ value = null;
3900
+ disabledFromControl = false;
3901
+ onChange = () => { };
3902
+ onTouched = () => { };
3903
+ constructor(changeDetector) {
3904
+ this.changeDetector = changeDetector;
3905
+ }
3906
+ get isDisabled() {
3907
+ return this.disabled || this.disabledFromControl;
3908
+ }
3909
+ chipClass(option) {
3910
+ return [
3911
+ CHIP_BASE,
3912
+ SIZE_CLASSES$1[this.size],
3913
+ TONE_CLASSES[option.tone],
3914
+ this.value === option.value ? SELECTED_CLASSES : '',
3915
+ this.invalid ? 'outline outline-1 outline-[var(--cxs-color-danger)]' : '',
3916
+ this.isDisabled ? 'cursor-not-allowed opacity-60' : ''
3917
+ ]
3918
+ .filter(Boolean)
3919
+ .join(' ');
3920
+ }
3921
+ writeValue(value) {
3922
+ this.value = value ?? null;
3923
+ this.changeDetector.markForCheck();
3924
+ }
3925
+ registerOnChange(fn) {
3926
+ this.onChange = fn;
3927
+ }
3928
+ registerOnTouched(fn) {
3929
+ this.onTouched = fn;
3930
+ }
3931
+ setDisabledState(disabled) {
3932
+ this.disabledFromControl = disabled;
3933
+ this.changeDetector.markForCheck();
3934
+ }
3935
+ select(value) {
3936
+ if (this.isDisabled)
3937
+ return;
3938
+ this.value = value;
3939
+ this.onChange(value);
3940
+ this.valueChange.emit(value);
3941
+ }
3942
+ markTouched() {
3943
+ this.onTouched();
3944
+ }
3945
+ static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsRadioChipGroupComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
3946
+ static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "21.2.10", type: CxsRadioChipGroupComponent, isStandalone: true, selector: "cxs-radio-chip-group", inputs: { label: "label", options: "options", disabled: "disabled", invalid: "invalid", required: "required", size: "size" }, outputs: { valueChange: "valueChange" }, providers: [
3947
+ {
3948
+ provide: NG_VALUE_ACCESSOR,
3949
+ useExisting: forwardRef(() => CxsRadioChipGroupComponent),
3950
+ multi: true
3951
+ }
3952
+ ], ngImport: i0, template: "<fieldset class=\"min-w-0\" [disabled]=\"isDisabled\" [attr.aria-invalid]=\"invalid ? 'true' : null\">\n @if (label) {\n <legend class=\"mb-1 text-sm font-medium text-[var(--cxs-color-on-surface)]\">{{ label }}</legend>\n }\n <div class=\"flex flex-wrap gap-3\">\n @for (option of options; track option.value) {\n <label class=\"relative inline-flex\">\n <input\n class=\"peer sr-only\"\n type=\"radio\"\n [name]=\"groupId\"\n [value]=\"option.value\"\n [checked]=\"value === option.value\"\n [disabled]=\"isDisabled\"\n [required]=\"required\"\n [attr.aria-invalid]=\"invalid ? 'true' : null\"\n (change)=\"select(option.value)\"\n (blur)=\"markTouched()\"\n />\n <span [class]=\"chipClass(option)\">\n @if (value === option.value) {\n <span aria-hidden=\"true\">&#10003;</span>\n }\n {{ option.label }}\n </span>\n </label>\n }\n </div>\n</fieldset>\n", changeDetection: i0.ChangeDetectionStrategy.OnPush });
3953
+ }
3954
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImport: i0, type: CxsRadioChipGroupComponent, decorators: [{
3955
+ type: Component,
3956
+ args: [{ selector: 'cxs-radio-chip-group', standalone: true, changeDetection: ChangeDetectionStrategy.OnPush, providers: [
3957
+ {
3958
+ provide: NG_VALUE_ACCESSOR,
3959
+ useExisting: forwardRef(() => CxsRadioChipGroupComponent),
3960
+ multi: true
3961
+ }
3962
+ ], template: "<fieldset class=\"min-w-0\" [disabled]=\"isDisabled\" [attr.aria-invalid]=\"invalid ? 'true' : null\">\n @if (label) {\n <legend class=\"mb-1 text-sm font-medium text-[var(--cxs-color-on-surface)]\">{{ label }}</legend>\n }\n <div class=\"flex flex-wrap gap-3\">\n @for (option of options; track option.value) {\n <label class=\"relative inline-flex\">\n <input\n class=\"peer sr-only\"\n type=\"radio\"\n [name]=\"groupId\"\n [value]=\"option.value\"\n [checked]=\"value === option.value\"\n [disabled]=\"isDisabled\"\n [required]=\"required\"\n [attr.aria-invalid]=\"invalid ? 'true' : null\"\n (change)=\"select(option.value)\"\n (blur)=\"markTouched()\"\n />\n <span [class]=\"chipClass(option)\">\n @if (value === option.value) {\n <span aria-hidden=\"true\">&#10003;</span>\n }\n {{ option.label }}\n </span>\n </label>\n }\n </div>\n</fieldset>\n" }]
3963
+ }], ctorParameters: () => [{ type: i0.ChangeDetectorRef }], propDecorators: { label: [{
3964
+ type: Input
3965
+ }], options: [{
3966
+ type: Input
3967
+ }], disabled: [{
3968
+ type: Input
3969
+ }], invalid: [{
3970
+ type: Input
3971
+ }], required: [{
3972
+ type: Input
3973
+ }], size: [{
3974
+ type: Input
3975
+ }], valueChange: [{
3976
+ type: Output
3977
+ }] } });
3978
+
3673
3979
  const BASE_CLASSES$2 = 'w-full appearance-none rounded-[var(--cxs-radius-md)] border border-[var(--cxs-color-border)] ' +
3674
3980
  'bg-[var(--cxs-color-surface)] text-[var(--cxs-color-on-surface)] ' +
3675
3981
  'placeholder:text-[var(--cxs-color-on-surface-muted)] transition-colors ' +
@@ -4873,5 +5179,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
4873
5179
  * Generated bundle index. Do not edit.
4874
5180
  */
4875
5181
 
4876
- export { CXS_USER_PREFERENCE_CHANGED_EVENT, CXS_USER_SESSION_STORAGE_KEY, CerxosUi, CxsAccordionComponent, CxsAccordionItemComponent, CxsActionMenuComponent, CxsAlertComponent, CxsAvatarComponent, CxsBadgeComponent, CxsBreadcrumbComponent, CxsButtonComponent, CxsCardComponent, CxsCarouselComponent, CxsCheckboxComponent, CxsCurrencyPipe, CxsDataTableCellDirective, CxsDataTableComponent, CxsDatePipe, CxsDatepickerComponent, CxsDialogComponent, CxsHabitGridComponent, CxsIconComponent, CxsInputComponent, CxsMenubarComponent, CxsMultiSelectComponent, CxsPreferenceFormattingService, CxsProgressBarComponent, CxsRadioComponent, CxsSelectComponent, CxsSkeletonComponent, CxsSliderComponent, CxsTabLabelDirective, CxsTabPanelComponent, CxsTableComponent, CxsTabsComponent, CxsThemeDirective, CxsToastComponent, CxsToggleComponent, CxsTooltipComponent };
5182
+ export { CXS_USER_PREFERENCE_CHANGED_EVENT, CXS_USER_SESSION_STORAGE_KEY, CerxosUi, CxsAccordionComponent, CxsAccordionItemComponent, CxsActionMenuComponent, CxsAlertComponent, CxsAvatarComponent, CxsBadgeComponent, CxsBreadcrumbComponent, CxsButtonComponent, CxsCardComponent, CxsCarouselComponent, CxsCheckboxComponent, CxsCurrencyPipe, CxsDataTableCellDirective, CxsDataTableComponent, CxsDatePipe, CxsDatepickerComponent, CxsDialogComponent, CxsHabitGridComponent, CxsHoverCardComponent, CxsHoverCardContentDirective, CxsHoverCardTriggerDirective, CxsIconComponent, CxsInputComponent, CxsMenubarComponent, CxsMultiSelectComponent, CxsPreferenceFormattingService, CxsProgressBarComponent, CxsRadioChipGroupComponent, CxsRadioComponent, CxsSelectComponent, CxsSkeletonComponent, CxsSliderComponent, CxsTabLabelDirective, CxsTabPanelComponent, CxsTableComponent, CxsTabsComponent, CxsThemeDirective, CxsToastComponent, CxsToggleComponent, CxsTooltipComponent };
4877
5183
  //# sourceMappingURL=cerxos-ui.mjs.map