pdm-ui-kit 0.1.20 → 0.1.21
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/esm2020/lib/components/button/button.component.mjs +45 -13
- package/esm2020/lib/components/icon/icon.component.mjs +3 -3
- package/fesm2015/pdm-ui-kit.mjs +46 -14
- package/fesm2015/pdm-ui-kit.mjs.map +1 -1
- package/fesm2020/pdm-ui-kit.mjs +46 -14
- package/fesm2020/pdm-ui-kit.mjs.map +1 -1
- package/lib/components/button/button.component.d.ts +8 -3
- package/package.json +1 -1
package/fesm2020/pdm-ui-kit.mjs
CHANGED
|
@@ -390,23 +390,40 @@ class PdmButtonComponent {
|
|
|
390
390
|
get isDisabled() {
|
|
391
391
|
return this.disabled || this.loading || this.variant === 'loading';
|
|
392
392
|
}
|
|
393
|
+
get resolvedVariant() {
|
|
394
|
+
return this.isValidVariant(this.variant) ? this.variant : 'default';
|
|
395
|
+
}
|
|
396
|
+
get resolvedState() {
|
|
397
|
+
return this.state === 'hover' ? 'hover' : 'default';
|
|
398
|
+
}
|
|
399
|
+
get resolvedSize() {
|
|
400
|
+
if (this.size === 'small' || this.size === 'large') {
|
|
401
|
+
return this.size;
|
|
402
|
+
}
|
|
403
|
+
return 'default';
|
|
404
|
+
}
|
|
405
|
+
get showsIconSlot() {
|
|
406
|
+
const variant = this.resolvedVariant;
|
|
407
|
+
return variant === 'with-icon' || variant === 'icon' || variant === 'icon-circle' || variant === 'rounded';
|
|
408
|
+
}
|
|
393
409
|
get rootClasses() {
|
|
394
|
-
const currentState = this.
|
|
395
|
-
const
|
|
410
|
+
const currentState = this.resolvedState;
|
|
411
|
+
const variant = this.resolvedVariant;
|
|
412
|
+
const toneClass = this.toneClassMap[variant][currentState];
|
|
396
413
|
return [
|
|
397
414
|
'inline-flex items-center justify-center gap-2 rounded-md border text-sm font-medium ring-offset-background transition-colors focus-visible:outline-none focus-visible:ring-[3px] focus-visible:ring-ring/50 focus-visible:ring-offset-2 disabled:pointer-events-none disabled:opacity-50 bg-clip-padding',
|
|
398
|
-
|
|
399
|
-
|
|
400
|
-
|
|
401
|
-
|
|
402
|
-
|
|
403
|
-
? this.
|
|
415
|
+
variant === 'link' ? 'px-4 py-2 h-9' : '',
|
|
416
|
+
variant === 'icon' ? 'h-9 w-9 p-0' : '',
|
|
417
|
+
variant === 'icon-circle' ? 'h-10 w-10 rounded-full p-0' : '',
|
|
418
|
+
variant === 'rounded' ? 'h-9 w-9 rounded-full p-0' : '',
|
|
419
|
+
variant !== 'icon' && variant !== 'icon-circle' && variant !== 'rounded'
|
|
420
|
+
? this.resolvedSize === 'small'
|
|
404
421
|
? 'h-8 px-3 text-xs'
|
|
405
|
-
: this.
|
|
422
|
+
: this.resolvedSize === 'large'
|
|
406
423
|
? 'h-10 px-8'
|
|
407
424
|
: 'h-9 px-4'
|
|
408
425
|
: '',
|
|
409
|
-
|
|
426
|
+
variant === 'link' && currentState === 'hover' ? 'underline underline-offset-4' : '',
|
|
410
427
|
toneClass,
|
|
411
428
|
this.className
|
|
412
429
|
];
|
|
@@ -416,12 +433,27 @@ class PdmButtonComponent {
|
|
|
416
433
|
this.pressed.emit(event);
|
|
417
434
|
}
|
|
418
435
|
}
|
|
436
|
+
isValidVariant(value) {
|
|
437
|
+
return (value === 'default' ||
|
|
438
|
+
value === 'primary' ||
|
|
439
|
+
value === 'destructive' ||
|
|
440
|
+
value === 'outline' ||
|
|
441
|
+
value === 'subtle' ||
|
|
442
|
+
value === 'secondary' ||
|
|
443
|
+
value === 'ghost' ||
|
|
444
|
+
value === 'link' ||
|
|
445
|
+
value === 'with-icon' ||
|
|
446
|
+
value === 'icon' ||
|
|
447
|
+
value === 'icon-circle' ||
|
|
448
|
+
value === 'rounded' ||
|
|
449
|
+
value === 'loading');
|
|
450
|
+
}
|
|
419
451
|
}
|
|
420
452
|
PdmButtonComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmButtonComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
|
|
421
|
-
PdmButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmButtonComponent, selector: "pdm-button", inputs: { type: "type", variant: "variant", state: "state", size: "size", disabled: "disabled", loading: "loading", className: "className" }, outputs: { pressed: "pressed" }, ngImport: i0, template: "<button\n [type]=\"type\"\n [disabled]=\"isDisabled\"\n [attr.aria-busy]=\"loading\"\n [ngClass]=\"rootClasses\"\n (click)=\"onClick($event)\"\n>\n <span\n *ngIf=\"loading\"\n class=\"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-r-transparent\"\n aria-hidden=\"true\"\n ></span>\n <ng-content select=\"[pdmButtonIcon]\" *ngIf=\"
|
|
453
|
+
PdmButtonComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmButtonComponent, selector: "pdm-button", inputs: { type: "type", variant: "variant", state: "state", size: "size", disabled: "disabled", loading: "loading", className: "className" }, outputs: { pressed: "pressed" }, ngImport: i0, template: "<button\n [type]=\"type\"\n [disabled]=\"isDisabled\"\n [attr.aria-busy]=\"loading\"\n [ngClass]=\"rootClasses\"\n (click)=\"onClick($event)\"\n>\n <span\n *ngIf=\"loading\"\n class=\"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-r-transparent\"\n aria-hidden=\"true\"\n ></span>\n <ng-content select=\"[pdmButtonIcon]\" *ngIf=\"showsIconSlot\"></ng-content>\n <ng-content></ng-content>\n</button>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
422
454
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmButtonComponent, decorators: [{
|
|
423
455
|
type: Component,
|
|
424
|
-
args: [{ selector: 'pdm-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n [type]=\"type\"\n [disabled]=\"isDisabled\"\n [attr.aria-busy]=\"loading\"\n [ngClass]=\"rootClasses\"\n (click)=\"onClick($event)\"\n>\n <span\n *ngIf=\"loading\"\n class=\"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-r-transparent\"\n aria-hidden=\"true\"\n ></span>\n <ng-content select=\"[pdmButtonIcon]\" *ngIf=\"
|
|
456
|
+
args: [{ selector: 'pdm-button', changeDetection: ChangeDetectionStrategy.OnPush, template: "<button\n [type]=\"type\"\n [disabled]=\"isDisabled\"\n [attr.aria-busy]=\"loading\"\n [ngClass]=\"rootClasses\"\n (click)=\"onClick($event)\"\n>\n <span\n *ngIf=\"loading\"\n class=\"inline-block h-4 w-4 animate-spin rounded-full border-2 border-current border-r-transparent\"\n aria-hidden=\"true\"\n ></span>\n <ng-content select=\"[pdmButtonIcon]\" *ngIf=\"showsIconSlot\"></ng-content>\n <ng-content></ng-content>\n</button>\n" }]
|
|
425
457
|
}], propDecorators: { type: [{
|
|
426
458
|
type: Input
|
|
427
459
|
}], variant: [{
|
|
@@ -1092,10 +1124,10 @@ class PdmIconComponent {
|
|
|
1092
1124
|
}
|
|
1093
1125
|
}
|
|
1094
1126
|
PdmIconComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmIconComponent, deps: [{ token: i1$1.DomSanitizer }], target: i0.ɵɵFactoryTarget.Component });
|
|
1095
|
-
PdmIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmIconComponent, selector: "pdm-icon", inputs: { name: "name", library: "library", assetUrl: "assetUrl", size: "size", strokeWidth: "strokeWidth", className: "className", ariaLabel: "ariaLabel", decorative: "decorative" }, ngImport: i0, template: "<ng-container *ngIf=\"assetUrl; else inlineIcon\">\n <img\n [src]=\"assetUrl\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [ngClass]=\"className\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n alt=\"\"\n />\n</ng-container>\n\n<ng-template #inlineIcon>\n <span\n [ngClass]=\"className\"\n [style.display]=\"'inline-flex'\"\n [style.align-items]=\"'center'\"\n [style.justify-content]=\"'center'\"\n [style.line-height]=\"0\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n [innerHTML]=\"svgMarkup\"\n ></span>\n</ng-template>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1127
|
+
PdmIconComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmIconComponent, selector: "pdm-icon", inputs: { name: "name", library: "library", assetUrl: "assetUrl", size: "size", strokeWidth: "strokeWidth", className: "className", ariaLabel: "ariaLabel", decorative: "decorative" }, ngImport: i0, template: "<ng-container *ngIf=\"assetUrl; else inlineIcon\">\n <img\n [src]=\"assetUrl\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [ngClass]=\"className\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n alt=\"\"\n />\n</ng-container>\n\n<ng-template #inlineIcon>\n <span\n [ngClass]=\"className\"\n [style.display]=\"'inline-flex'\"\n [style.align-items]=\"'center'\"\n [style.justify-content]=\"'center'\"\n [style.line-height]=\"0\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n [innerHTML]=\"svgMarkup\"\n ></span>\n</ng-template>\n", styles: [":host{display:inline-flex;align-items:center;justify-content:center;line-height:0;flex-shrink:0}:host svg{display:block}\n"], dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgIf, selector: "[ngIf]", inputs: ["ngIf", "ngIfThen", "ngIfElse"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
|
|
1096
1128
|
i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmIconComponent, decorators: [{
|
|
1097
1129
|
type: Component,
|
|
1098
|
-
args: [{ selector: 'pdm-icon', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"assetUrl; else inlineIcon\">\n <img\n [src]=\"assetUrl\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [ngClass]=\"className\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n alt=\"\"\n />\n</ng-container>\n\n<ng-template #inlineIcon>\n <span\n [ngClass]=\"className\"\n [style.display]=\"'inline-flex'\"\n [style.align-items]=\"'center'\"\n [style.justify-content]=\"'center'\"\n [style.line-height]=\"0\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n [innerHTML]=\"svgMarkup\"\n ></span>\n</ng-template>\n" }]
|
|
1130
|
+
args: [{ selector: 'pdm-icon', changeDetection: ChangeDetectionStrategy.OnPush, template: "<ng-container *ngIf=\"assetUrl; else inlineIcon\">\n <img\n [src]=\"assetUrl\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [ngClass]=\"className\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n alt=\"\"\n />\n</ng-container>\n\n<ng-template #inlineIcon>\n <span\n [ngClass]=\"className\"\n [style.display]=\"'inline-flex'\"\n [style.align-items]=\"'center'\"\n [style.justify-content]=\"'center'\"\n [style.line-height]=\"0\"\n [style.width.px]=\"resolvedSize\"\n [style.height.px]=\"resolvedSize\"\n [attr.role]=\"decorative ? null : 'img'\"\n [attr.aria-hidden]=\"decorative ? 'true' : null\"\n [attr.aria-label]=\"!decorative ? ariaLabel || name : null\"\n [innerHTML]=\"svgMarkup\"\n ></span>\n</ng-template>\n", styles: [":host{display:inline-flex;align-items:center;justify-content:center;line-height:0;flex-shrink:0}:host svg{display:block}\n"] }]
|
|
1099
1131
|
}], ctorParameters: function () { return [{ type: i1$1.DomSanitizer }]; }, propDecorators: { name: [{
|
|
1100
1132
|
type: Input
|
|
1101
1133
|
}], library: [{
|