pdm-ui-kit 0.1.14 → 0.1.16

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.
@@ -260,35 +260,77 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
260
260
  class PdmButtonGroupComponent {
261
261
  constructor() {
262
262
  this.variant = 'default';
263
- this.direction = 'horizontal';
264
263
  this.separated = true;
265
264
  this.className = '';
266
265
  }
267
266
  get rootClasses() {
268
- const isVertical = this.variant === 'orientation' || this.direction === 'vertical';
269
- const isAttached = this.variant !== 'default' && !this.separated;
267
+ const effectiveOrientation = this.orientation ?? this.direction ?? 'horizontal';
268
+ const isVertical = this.variant === 'orientation' || effectiveOrientation === 'vertical';
269
+ const isGroup = this.variant === 'group';
270
+ const isAttached = !this.separated && this.variant !== 'default';
270
271
  const isSeparator = this.variant === 'separator';
272
+ const attachedClasses = isAttached && !isGroup
273
+ ? isVertical
274
+ ? [
275
+ '[&>*]:rounded-none',
276
+ '[&>*:first-child]:rounded-t-md',
277
+ '[&>*:last-child]:rounded-b-md',
278
+ '[&>*:not(:first-child)]:border-t-0',
279
+ '[&>*:not(:first-child)]:-mt-px'
280
+ ].join(' ')
281
+ : [
282
+ '[&>*]:rounded-none',
283
+ '[&>*:first-child]:rounded-l-md',
284
+ '[&>*:last-child]:rounded-r-md',
285
+ '[&>*:not(:first-child)]:border-l-0',
286
+ '[&>*:not(:first-child)]:-ml-px'
287
+ ].join(' ')
288
+ : '';
289
+ const groupHorizontalClasses = isGroup && !isVertical && !this.separated
290
+ ? [
291
+ '[&>*:not(:first-child)]:-ml-px',
292
+ '[&>pdm-input]:flex-1',
293
+ '[&>pdm-input>div]:w-full',
294
+ '[&>pdm-button>button]:!rounded-none',
295
+ '[&>pdm-button:first-child>button]:!rounded-l-md',
296
+ '[&>pdm-button:last-child>button]:!rounded-r-md',
297
+ '[&>pdm-input>div>input]:!rounded-none',
298
+ '[&>pdm-input:first-child>div>input]:!rounded-l-md',
299
+ '[&>pdm-input:last-child>div>input]:!rounded-r-md',
300
+ '[&>pdm-input-group>div]:!rounded-none',
301
+ '[&>pdm-input-group:first-child>div]:!rounded-l-md',
302
+ '[&>pdm-input-group:last-child>div]:!rounded-r-md',
303
+ '[&>pdm-input>div>input]:bg-background',
304
+ '[&>pdm-input>div>input]:shadow-none',
305
+ '[&>pdm-button>button]:rounded-l-none',
306
+ '[&>pdm-button>button]:shadow-none'
307
+ ].join(' ')
308
+ : '';
309
+ const groupVerticalClasses = isGroup && isVertical && !this.separated
310
+ ? [
311
+ '[&>*:not(:first-child)]:-mt-px',
312
+ '[&>pdm-button>button]:!rounded-none',
313
+ '[&>pdm-button:first-child>button]:!rounded-t-md',
314
+ '[&>pdm-button:last-child>button]:!rounded-b-md',
315
+ '[&>pdm-input>div>input]:!rounded-none',
316
+ '[&>pdm-input:first-child>div>input]:!rounded-t-md',
317
+ '[&>pdm-input:last-child>div>input]:!rounded-b-md',
318
+ '[&>pdm-input-group>div]:!rounded-none',
319
+ '[&>pdm-input-group:first-child>div]:!rounded-t-md',
320
+ '[&>pdm-input-group:last-child>div]:!rounded-b-md',
321
+ '[&>pdm-input>div>input]:bg-background',
322
+ '[&>pdm-input>div>input]:shadow-none',
323
+ '[&>pdm-button>button]:shadow-none'
324
+ ].join(' ')
325
+ : '';
271
326
  return [
272
327
  'inline-flex w-fit',
273
328
  isVertical ? 'flex-col items-stretch' : 'items-center',
274
329
  this.variant === 'default' || this.separated ? 'gap-2' : 'gap-0',
275
- isAttached
276
- ? isVertical
277
- ? [
278
- '[&>*]:rounded-none',
279
- '[&>*:first-child]:rounded-t-md',
280
- '[&>*:last-child]:rounded-b-md',
281
- '[&>*:not(:first-child)]:border-t-0',
282
- '[&>*:not(:first-child)]:-mt-px'
283
- ].join(' ')
284
- : [
285
- '[&>*]:rounded-none',
286
- '[&>*:first-child]:rounded-l-md',
287
- '[&>*:last-child]:rounded-r-md',
288
- '[&>*:not(:first-child)]:border-l-0',
289
- '[&>*:not(:first-child)]:-ml-px'
290
- ].join(' ')
291
- : '',
330
+ isGroup ? '*:focus-visible:relative *:focus-visible:z-10' : '',
331
+ attachedClasses,
332
+ groupHorizontalClasses,
333
+ groupVerticalClasses,
292
334
  isSeparator
293
335
  ? 'overflow-hidden rounded-md border border-border bg-secondary shadow-sm'
294
336
  : '',
@@ -297,12 +339,14 @@ class PdmButtonGroupComponent {
297
339
  }
298
340
  }
299
341
  PdmButtonGroupComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmButtonGroupComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
300
- PdmButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmButtonGroupComponent, selector: "pdm-button-group", inputs: { variant: "variant", direction: "direction", separated: "separated", className: "className" }, ngImport: i0, template: "<div\n role=\"group\"\n [attr.aria-orientation]=\"variant === 'orientation' || direction === 'vertical' ? 'vertical' : 'horizontal'\"\n [ngClass]=\"rootClasses\"\n>\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
342
+ PdmButtonGroupComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmButtonGroupComponent, selector: "pdm-button-group", inputs: { variant: "variant", orientation: "orientation", direction: "direction", separated: "separated", className: "className" }, ngImport: i0, template: "<div\n role=\"group\"\n [attr.aria-orientation]=\"variant === 'orientation' || orientation === 'vertical' || direction === 'vertical' ? 'vertical' : 'horizontal'\"\n [ngClass]=\"rootClasses\"\n>\n <ng-content></ng-content>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
301
343
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmButtonGroupComponent, decorators: [{
302
344
  type: Component,
303
- args: [{ selector: 'pdm-button-group', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n role=\"group\"\n [attr.aria-orientation]=\"variant === 'orientation' || direction === 'vertical' ? 'vertical' : 'horizontal'\"\n [ngClass]=\"rootClasses\"\n>\n <ng-content></ng-content>\n</div>\n" }]
345
+ args: [{ selector: 'pdm-button-group', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div\n role=\"group\"\n [attr.aria-orientation]=\"variant === 'orientation' || orientation === 'vertical' || direction === 'vertical' ? 'vertical' : 'horizontal'\"\n [ngClass]=\"rootClasses\"\n>\n <ng-content></ng-content>\n</div>\n" }]
304
346
  }], propDecorators: { variant: [{
305
347
  type: Input
348
+ }], orientation: [{
349
+ type: Input
306
350
  }], direction: [{
307
351
  type: Input
308
352
  }], separated: [{
@@ -322,19 +366,19 @@ class PdmButtonComponent {
322
366
  this.className = '';
323
367
  this.pressed = new EventEmitter();
324
368
  this.toneClassMap = {
325
- default: { default: 'bg-primary text-primary-foreground', hover: 'bg-primary text-primary-foreground opacity-90' },
326
- primary: { default: 'bg-primary text-primary-foreground', hover: 'bg-primary text-primary-foreground opacity-90' },
327
- destructive: { default: 'bg-destructive text-destructive-foreground', hover: 'bg-destructive text-destructive-foreground opacity-90' },
328
- outline: { default: 'border border-border bg-background text-foreground', hover: 'border border-border bg-muted text-foreground' },
329
- subtle: { default: 'bg-secondary text-secondary-foreground', hover: 'bg-accent text-accent-foreground' },
330
- secondary: { default: 'bg-secondary text-secondary-foreground', hover: 'bg-accent text-accent-foreground' },
331
- ghost: { default: 'bg-transparent text-foreground', hover: 'bg-accent text-accent-foreground' },
332
- link: { default: 'bg-transparent text-primary', hover: 'bg-transparent text-primary underline underline-offset-4' },
333
- 'with-icon': { default: 'bg-primary text-primary-foreground', hover: 'bg-primary text-primary-foreground opacity-90' },
334
- icon: { default: 'border border-input bg-background text-foreground', hover: 'border border-input bg-accent text-accent-foreground' },
335
- 'icon-circle': { default: 'border border-input bg-background text-foreground', hover: 'border border-input bg-accent text-accent-foreground' },
336
- rounded: { default: 'border border-input bg-background text-foreground', hover: 'border border-input bg-accent text-accent-foreground' },
337
- loading: { default: 'bg-primary text-primary-foreground opacity-70', hover: 'bg-primary text-primary-foreground opacity-70' }
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' },
372
+ 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' },
378
+ icon: { default: 'border-border bg-background text-foreground', hover: 'border-border bg-accent text-accent-foreground' },
379
+ 'icon-circle': { default: 'border-border bg-background text-foreground', hover: 'border-border bg-accent text-accent-foreground' },
380
+ 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' }
338
382
  };
339
383
  }
340
384
  get isDisabled() {
@@ -344,7 +388,7 @@ class PdmButtonComponent {
344
388
  const currentState = this.state === 'hover' ? 'hover' : 'default';
345
389
  const toneClass = this.toneClassMap[this.variant][currentState];
346
390
  return [
347
- 'inline-flex items-center justify-center gap-2 rounded-md border border-transparent 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',
391
+ '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',
348
392
  this.variant === 'link' ? 'px-4 py-2 h-9' : '',
349
393
  this.variant === 'icon' ? 'h-9 w-9 p-0' : '',
350
394
  this.variant === 'icon-circle' ? 'h-10 w-10 rounded-full p-0' : '',
@@ -2692,7 +2736,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImpor
2692
2736
  }] } });
2693
2737
 
2694
2738
  class PdmTabsComponent {
2695
- constructor() {
2739
+ constructor(cdr) {
2740
+ this.cdr = cdr;
2696
2741
  this.items = [];
2697
2742
  this.value = '';
2698
2743
  this.className = '';
@@ -2700,16 +2745,18 @@ class PdmTabsComponent {
2700
2745
  }
2701
2746
  select(item) {
2702
2747
  if (!item.disabled) {
2748
+ this.value = item.value;
2703
2749
  this.valueChange.emit(item.value);
2750
+ this.cdr.markForCheck();
2704
2751
  }
2705
2752
  }
2706
2753
  }
2707
- PdmTabsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmTabsComponent, deps: [], target: i0.ɵɵFactoryTarget.Component });
2754
+ PdmTabsComponent.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmTabsComponent, deps: [{ token: i0.ChangeDetectorRef }], target: i0.ɵɵFactoryTarget.Component });
2708
2755
  PdmTabsComponent.ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "14.0.0", version: "14.3.0", type: PdmTabsComponent, selector: "pdm-tabs", inputs: { items: "items", value: "value", className: "className" }, outputs: { valueChange: "valueChange" }, ngImport: i0, template: "<div [ngClass]=\"['w-full', className]\">\n <div role=\"tablist\" class=\"inline-flex h-8 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground\">\n <button\n *ngFor=\"let item of items\"\n role=\"tab\"\n [attr.aria-selected]=\"value === item.value\"\n [disabled]=\"item.disabled\"\n [ngClass]=\"[\n 'relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium transition-all focus-visible:border-ring focus-visible:outline-none focus-visible:outline-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50',\n value === item.value ? 'bg-background text-foreground shadow-sm' : 'bg-transparent text-muted-foreground'\n ]\"\n (click)=\"select(item)\"\n type=\"button\"\n >\n {{ item.label }}\n </button>\n </div>\n <div class=\"mt-4\">\n <ng-content></ng-content>\n </div>\n</div>\n", dependencies: [{ kind: "directive", type: i1.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "directive", type: i1.NgForOf, selector: "[ngFor][ngForOf]", inputs: ["ngForOf", "ngForTrackBy", "ngForTemplate"] }], changeDetection: i0.ChangeDetectionStrategy.OnPush });
2709
2756
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "14.3.0", ngImport: i0, type: PdmTabsComponent, decorators: [{
2710
2757
  type: Component,
2711
2758
  args: [{ selector: 'pdm-tabs', changeDetection: ChangeDetectionStrategy.OnPush, template: "<div [ngClass]=\"['w-full', className]\">\n <div role=\"tablist\" class=\"inline-flex h-8 w-fit items-center justify-center rounded-lg bg-muted p-[3px] text-muted-foreground\">\n <button\n *ngFor=\"let item of items\"\n role=\"tab\"\n [attr.aria-selected]=\"value === item.value\"\n [disabled]=\"item.disabled\"\n [ngClass]=\"[\n 'relative inline-flex h-[calc(100%-1px)] flex-1 items-center justify-center gap-1.5 whitespace-nowrap rounded-md border border-transparent px-1.5 py-0.5 text-sm font-medium transition-all focus-visible:border-ring focus-visible:outline-none focus-visible:outline-ring focus-visible:ring-[3px] focus-visible:ring-ring/50 disabled:pointer-events-none disabled:opacity-50',\n value === item.value ? 'bg-background text-foreground shadow-sm' : 'bg-transparent text-muted-foreground'\n ]\"\n (click)=\"select(item)\"\n type=\"button\"\n >\n {{ item.label }}\n </button>\n </div>\n <div class=\"mt-4\">\n <ng-content></ng-content>\n </div>\n</div>\n" }]
2712
- }], propDecorators: { items: [{
2759
+ }], ctorParameters: function () { return [{ type: i0.ChangeDetectorRef }]; }, propDecorators: { items: [{
2713
2760
  type: Input
2714
2761
  }], value: [{
2715
2762
  type: Input