cerxos-ui 0.0.21 → 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 +3 -11
- package/fesm2022/cerxos-ui.mjs +202 -5
- package/fesm2022/cerxos-ui.mjs.map +1 -1
- package/package.json +5 -1
- package/types/cerxos-ui.d.ts +48 -2
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
|
-
|
|
32
|
-
|
|
33
|
-
|
|
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
|
|
package/fesm2022/cerxos-ui.mjs
CHANGED
|
@@ -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';
|
|
@@ -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$
|
|
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$
|
|
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$
|
|
1518
|
+
ALIGN_CLASSES$2[column.align ?? 'left'],
|
|
1519
1519
|
column.cellClass ?? ''
|
|
1520
1520
|
]
|
|
1521
1521
|
.filter(Boolean)
|
|
@@ -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 ' +
|
|
@@ -4982,5 +5179,5 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "21.2.10", ngImpo
|
|
|
4982
5179
|
* Generated bundle index. Do not edit.
|
|
4983
5180
|
*/
|
|
4984
5181
|
|
|
4985
|
-
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, CxsRadioChipGroupComponent, 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 };
|
|
4986
5183
|
//# sourceMappingURL=cerxos-ui.mjs.map
|