pdm-ui-kit 0.1.16 → 0.1.18

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.
@@ -289,6 +289,8 @@ class PdmButtonGroupComponent {
289
289
  const groupHorizontalClasses = isGroup && !isVertical && !this.separated
290
290
  ? [
291
291
  '[&>*:not(:first-child)]:-ml-px',
292
+ '[&>pdm-button]:flex',
293
+ '[&>pdm-button>button]:h-9',
292
294
  '[&>pdm-input]:flex-1',
293
295
  '[&>pdm-input>div]:w-full',
294
296
  '[&>pdm-button>button]:!rounded-none',
@@ -309,6 +311,8 @@ class PdmButtonGroupComponent {
309
311
  const groupVerticalClasses = isGroup && isVertical && !this.separated
310
312
  ? [
311
313
  '[&>*:not(:first-child)]:-mt-px',
314
+ '[&>pdm-button]:flex',
315
+ '[&>pdm-button>button]:h-9',
312
316
  '[&>pdm-button>button]:!rounded-none',
313
317
  '[&>pdm-button:first-child>button]:!rounded-t-md',
314
318
  '[&>pdm-button:last-child>button]:!rounded-b-md',
@@ -366,19 +370,19 @@ class PdmButtonComponent {
366
370
  this.className = '';
367
371
  this.pressed = new EventEmitter();
368
372
  this.toneClassMap = {
369
- default: { default: 'border-transparent bg-primary text-primary-foreground', hover: 'border-transparent bg-primary text-primary-foreground opacity-90' },
370
- primary: { default: 'border-transparent bg-primary text-primary-foreground', hover: 'border-transparent bg-primary text-primary-foreground opacity-90' },
371
- destructive: { default: 'border-transparent bg-destructive text-destructive-foreground', hover: 'border-transparent bg-destructive text-destructive-foreground opacity-90' },
373
+ default: { default: 'border-primary bg-primary text-primary-foreground', hover: 'border-primary bg-primary text-primary-foreground opacity-90' },
374
+ primary: { default: 'border-primary bg-primary text-primary-foreground', hover: 'border-primary bg-primary text-primary-foreground opacity-90' },
375
+ destructive: { default: 'border-border bg-destructive text-destructive-foreground', hover: 'border-border bg-destructive text-destructive-foreground opacity-90' },
372
376
  outline: { default: 'border-border bg-background text-foreground', hover: 'border-border bg-muted text-foreground' },
373
- subtle: { default: 'border-transparent bg-secondary text-secondary-foreground', hover: 'border-transparent bg-accent text-accent-foreground' },
374
- secondary: { default: 'border-transparent bg-secondary text-secondary-foreground', hover: 'border-transparent bg-accent text-accent-foreground' },
375
- ghost: { default: 'border-transparent bg-transparent text-foreground', hover: 'border-transparent bg-accent text-accent-foreground' },
376
- link: { default: 'border-transparent bg-transparent text-primary', hover: 'border-transparent bg-transparent text-primary underline underline-offset-4' },
377
- 'with-icon': { default: 'border-transparent bg-primary text-primary-foreground', hover: 'border-transparent bg-primary text-primary-foreground opacity-90' },
377
+ subtle: { default: 'border-secondary bg-secondary text-secondary-foreground', hover: 'border-accent bg-accent text-accent-foreground' },
378
+ secondary: { default: 'border-secondary bg-secondary text-secondary-foreground', hover: 'border-accent bg-accent text-accent-foreground' },
379
+ ghost: { default: 'border-border bg-transparent text-foreground', hover: 'border-border bg-accent text-accent-foreground' },
380
+ link: { default: 'border-border bg-transparent text-primary', hover: 'border-border bg-transparent text-primary underline underline-offset-4' },
381
+ 'with-icon': { default: 'border-primary bg-primary text-primary-foreground', hover: 'border-primary bg-primary text-primary-foreground opacity-90' },
378
382
  icon: { default: 'border-border bg-background text-foreground', hover: 'border-border bg-accent text-accent-foreground' },
379
383
  'icon-circle': { default: 'border-border bg-background text-foreground', hover: 'border-border bg-accent text-accent-foreground' },
380
384
  rounded: { default: 'border-border bg-background text-foreground', hover: 'border-border bg-accent text-accent-foreground' },
381
- loading: { default: 'border-transparent bg-primary text-primary-foreground opacity-70', hover: 'border-transparent bg-primary text-primary-foreground opacity-70' }
385
+ loading: { default: 'border-primary bg-primary text-primary-foreground opacity-70', hover: 'border-primary bg-primary text-primary-foreground opacity-70' }
382
386
  };
383
387
  }
384
388
  get isDisabled() {
@@ -2690,24 +2694,45 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2690
2694
  }] } });
2691
2695
 
2692
2696
  class PdmSwitchComponent {
2693
- constructor() {
2697
+ constructor(cdr) {
2698
+ this.cdr = cdr;
2694
2699
  this.id = '';
2695
2700
  this.checked = false;
2696
2701
  this.disabled = false;
2697
2702
  this.label = '';
2698
2703
  this.className = '';
2704
+ this.size = 'default';
2699
2705
  this.checkedChange = new EventEmitter();
2700
2706
  }
2701
- onToggle(event) {
2702
- this.checkedChange.emit(event.target.checked);
2707
+ get rootClasses() {
2708
+ return [
2709
+ 'peer relative inline-flex shrink-0 items-center rounded-full border border-transparent outline-none transition-all focus-visible:border-ring focus-visible:ring-3 focus-visible:ring-ring/50 disabled:cursor-not-allowed disabled:opacity-50',
2710
+ this.size === 'sm' ? 'h-[14px] w-[24px]' : 'h-[18.4px] w-[32px]',
2711
+ this.checked ? 'bg-primary' : 'bg-input dark:bg-input/80'
2712
+ ];
2713
+ }
2714
+ get thumbClasses() {
2715
+ return [
2716
+ 'pointer-events-none block rounded-full bg-background ring-0 transition-transform',
2717
+ this.size === 'sm' ? 'size-3' : 'size-4',
2718
+ this.checked ? 'translate-x-[calc(100%-2px)]' : 'translate-x-0'
2719
+ ];
2720
+ }
2721
+ onToggle() {
2722
+ if (this.disabled)
2723
+ return;
2724
+ const next = !this.checked;
2725
+ this.checked = next;
2726
+ this.checkedChange.emit(next);
2727
+ this.cdr.markForCheck();
2703
2728
  }
2704
2729
  }
2705
- PdmSwitchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSwitchComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2706
- PdmSwitchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmSwitchComponent, selector: "pdm-switch", inputs: { id: "id", checked: "checked", disabled: "disabled", label: "label", className: "className" }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: "<label [attr.for]=\"id\" [ngClass]=\"['inline-flex items-center gap-2', className]\">\n <input\n [id]=\"id\"\n type=\"checkbox\"\n class=\"peer sr-only\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onToggle($event)\"\n />\n <span class=\"relative inline-flex h-6 w-11 items-center rounded-full border border-transparent bg-muted transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background peer-disabled:opacity-50 peer-checked:bg-primary\">\n <span class=\"h-5 w-5 translate-x-0.5 rounded-full bg-background shadow-sm transition-transform peer-checked:translate-x-5\"></span>\n </span>\n <span *ngIf=\"label\" class=\"text-sm text-foreground\">{{ label }}</span>\n</label>\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 });
2730
+ PdmSwitchComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSwitchComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2731
+ PdmSwitchComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmSwitchComponent, selector: "pdm-switch", inputs: { id: "id", checked: "checked", disabled: "disabled", label: "label", className: "className", size: "size" }, outputs: { checkedChange: "checkedChange" }, ngImport: i0, template: "<div [ngClass]=\"['flex items-center space-x-2', className]\">\n <button\n type=\"button\"\n role=\"switch\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-disabled]=\"disabled\"\n [attr.data-state]=\"checked ? 'checked' : 'unchecked'\"\n [attr.data-disabled]=\"disabled ? 'true' : 'false'\"\n [attr.data-size]=\"size\"\n [attr.data-slot]=\"'switch'\"\n [attr.value]=\"checked ? 'on' : 'off'\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [ngClass]=\"rootClasses\"\n (click)=\"onToggle()\"\n >\n <span\n [attr.data-state]=\"checked ? 'checked' : 'unchecked'\"\n [attr.data-slot]=\"'switch-thumb'\"\n [ngClass]=\"thumbClasses\"\n ></span>\n </button>\n <label\n *ngIf=\"label\"\n [attr.for]=\"id\"\n [attr.data-slot]=\"'label'\"\n class=\"flex cursor-pointer items-center gap-2 text-sm leading-none font-medium select-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50\"\n (click)=\"onToggle()\"\n >\n {{ label }}\n </label>\n</div>\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 });
2707
2732
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmSwitchComponent, decorators: [{
2708
2733
  type: Component,
2709
- args: [{ selector: 'pdm-switch', changeDetection: ChangeDetectionStrategy.OnPush, template: "<label [attr.for]=\"id\" [ngClass]=\"['inline-flex items-center gap-2', className]\">\n <input\n [id]=\"id\"\n type=\"checkbox\"\n class=\"peer sr-only\"\n [checked]=\"checked\"\n [disabled]=\"disabled\"\n (change)=\"onToggle($event)\"\n />\n <span class=\"relative inline-flex h-6 w-11 items-center rounded-full border border-transparent bg-muted transition-colors peer-focus-visible:ring-2 peer-focus-visible:ring-ring peer-focus-visible:ring-offset-2 peer-focus-visible:ring-offset-background peer-disabled:opacity-50 peer-checked:bg-primary\">\n <span class=\"h-5 w-5 translate-x-0.5 rounded-full bg-background shadow-sm transition-transform peer-checked:translate-x-5\"></span>\n </span>\n <span *ngIf=\"label\" class=\"text-sm text-foreground\">{{ label }}</span>\n</label>\n" }]
2710
- }], propDecorators: { id: [{
2734
+ args: [{ selector: 'pdm-switch', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"['flex items-center space-x-2', className]\">\n <button\n type=\"button\"\n role=\"switch\"\n [attr.aria-checked]=\"checked\"\n [attr.aria-disabled]=\"disabled\"\n [attr.data-state]=\"checked ? 'checked' : 'unchecked'\"\n [attr.data-disabled]=\"disabled ? 'true' : 'false'\"\n [attr.data-size]=\"size\"\n [attr.data-slot]=\"'switch'\"\n [attr.value]=\"checked ? 'on' : 'off'\"\n [id]=\"id\"\n [disabled]=\"disabled\"\n [ngClass]=\"rootClasses\"\n (click)=\"onToggle()\"\n >\n <span\n [attr.data-state]=\"checked ? 'checked' : 'unchecked'\"\n [attr.data-slot]=\"'switch-thumb'\"\n [ngClass]=\"thumbClasses\"\n ></span>\n </button>\n <label\n *ngIf=\"label\"\n [attr.for]=\"id\"\n [attr.data-slot]=\"'label'\"\n class=\"flex cursor-pointer items-center gap-2 text-sm leading-none font-medium select-none peer-disabled:cursor-not-allowed peer-disabled:opacity-50\"\n (click)=\"onToggle()\"\n >\n {{ label }}\n </label>\n</div>\n" }]
2735
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { id: [{
2711
2736
  type: Input
2712
2737
  }], checked: [{
2713
2738
  type: Input
@@ -2717,6 +2742,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2717
2742
  type: Input
2718
2743
  }], className: [{
2719
2744
  type: Input
2745
+ }], size: [{
2746
+ type: Input
2720
2747
  }], checkedChange: [{
2721
2748
  type: Output
2722
2749
  }] } });