orbiq-neural-ui-kit 1.1.4 → 1.1.6

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.
@@ -11487,6 +11487,10 @@ class NeuralDrawerComponent {
11487
11487
  onClose = new EventEmitter();
11488
11488
  drawerTemplate;
11489
11489
  dialogRef = null;
11490
+ // Animation states
11491
+ isVisible = signal(false, /* @ts-ignore */
11492
+ ...(ngDevMode ? [{ debugName: "isVisible" }] : /* istanbul ignore next */ []));
11493
+ isClosing = false;
11490
11494
  constructor(dialog) {
11491
11495
  this.dialog = dialog;
11492
11496
  effect(() => {
@@ -11494,32 +11498,45 @@ class NeuralDrawerComponent {
11494
11498
  if (isOpen && !this.dialogRef && this.drawerTemplate) {
11495
11499
  this.openDrawer();
11496
11500
  }
11497
- else if (!isOpen && this.dialogRef) {
11498
- this.dialogRef.close();
11499
- this.dialogRef = null;
11501
+ else if (!isOpen && this.dialogRef && !this.isClosing) {
11502
+ this.close();
11500
11503
  }
11501
- });
11504
+ }, { allowSignalWrites: true });
11502
11505
  }
11503
11506
  openDrawer() {
11507
+ this.isClosing = false;
11504
11508
  this.dialogRef = this.dialog.open(this.drawerTemplate, {
11505
- disableClose: !this.dismissible(),
11509
+ disableClose: true, // We handle close manually for animation
11506
11510
  backdropClass: 'bg-black-overlay-200',
11507
- // Fix it to the right or left edge taking full height
11508
- panelClass: ['fixed', 'inset-y-0', this.position() === 'right' ? 'right-0' : 'left-0', 'h-full', 'bg-transparent', 'outline-none', 'z-50'],
11511
+ panelClass: ['w-full', 'h-full', 'bg-transparent', 'shadow-none', 'outline-none', 'pointer-events-none'],
11509
11512
  hasBackdrop: true,
11510
11513
  });
11511
- this.dialogRef.closed.subscribe(() => {
11512
- this.dialogRef = null;
11513
- if (this.openModel()) {
11514
- this.openModel.set(false);
11514
+ // Wait a tick so the DOM renders the translated state, then trigger transition
11515
+ setTimeout(() => {
11516
+ this.isVisible.set(true);
11517
+ }, 10);
11518
+ // Listen to backdrop clicks if dismissible
11519
+ this.dialogRef.backdropClick.subscribe(() => {
11520
+ if (this.dismissible()) {
11521
+ this.close();
11515
11522
  }
11516
- this.onClose.emit();
11517
11523
  });
11518
11524
  }
11519
11525
  close() {
11520
- if (this.dialogRef) {
11521
- this.dialogRef.close();
11522
- }
11526
+ if (!this.dialogRef || this.isClosing)
11527
+ return;
11528
+ this.isClosing = true;
11529
+ this.isVisible.set(false);
11530
+ setTimeout(() => {
11531
+ if (this.dialogRef) {
11532
+ this.dialogRef.close();
11533
+ this.dialogRef = null;
11534
+ if (this.openModel()) {
11535
+ this.openModel.set(false);
11536
+ }
11537
+ this.onClose.emit();
11538
+ }
11539
+ }, 300); // 300ms matches transition-transform duration
11523
11540
  }
11524
11541
  ngOnDestroy() {
11525
11542
  if (this.dialogRef) {
@@ -11537,41 +11554,75 @@ class NeuralDrawerComponent {
11537
11554
  return map[this.size()] || 'w-80';
11538
11555
  }, /* @ts-ignore */
11539
11556
  ...(ngDevMode ? [{ debugName: "sizeClass" }] : /* istanbul ignore next */ []));
11557
+ wrapperClasses = computed(() => {
11558
+ const p = this.position();
11559
+ if (p === 'right')
11560
+ return 'justify-end';
11561
+ if (p === 'left')
11562
+ return 'justify-start';
11563
+ if (p === 'bottom')
11564
+ return 'flex-col justify-end';
11565
+ if (p === 'top')
11566
+ return 'flex-col justify-start';
11567
+ return '';
11568
+ }, /* @ts-ignore */
11569
+ ...(ngDevMode ? [{ debugName: "wrapperClasses" }] : /* istanbul ignore next */ []));
11570
+ panelClasses = computed(() => {
11571
+ const p = this.position();
11572
+ const isVisible = this.isVisible();
11573
+ const base = 'bg-white shadow-2xl flex flex-col outline-none border-outline-gray-2 pointer-events-auto transition-transform duration-300 ease-in-out transform';
11574
+ let sizing = '';
11575
+ let borders = '';
11576
+ let translate = '';
11577
+ if (p === 'right' || p === 'left') {
11578
+ sizing = `h-full ${this.sizeClass()}`;
11579
+ borders = p === 'right' ? 'border-l' : 'border-r';
11580
+ translate = !isVisible
11581
+ ? (p === 'right' ? 'translate-x-full' : '-translate-x-full')
11582
+ : 'translate-x-0';
11583
+ }
11584
+ else {
11585
+ sizing = 'w-full max-h-[90vh]'; // Leaves a little gap at the top for bottom sheets
11586
+ borders = p === 'bottom' ? 'border-t rounded-t-xl' : 'border-b rounded-b-xl';
11587
+ translate = !isVisible
11588
+ ? (p === 'bottom' ? 'translate-y-full' : '-translate-y-full')
11589
+ : 'translate-y-0';
11590
+ }
11591
+ return `${base} ${sizing} ${borders} ${translate}`;
11592
+ }, /* @ts-ignore */
11593
+ ...(ngDevMode ? [{ debugName: "panelClasses" }] : /* istanbul ignore next */ []));
11540
11594
  static ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NeuralDrawerComponent, deps: [{ token: i1$3.Dialog }], target: i0.ɵɵFactoryTarget.Component });
11541
11595
  static ɵcmp = i0.ɵɵngDeclareComponent({ minVersion: "17.0.0", version: "22.1.4", type: NeuralDrawerComponent, isStandalone: true, selector: "neural-drawer", inputs: { openModel: { classPropertyName: "openModel", publicName: "openModel", isSignal: true, isRequired: false, transformFunction: null }, title: { classPropertyName: "title", publicName: "title", isSignal: true, isRequired: false, transformFunction: null }, position: { classPropertyName: "position", publicName: "position", isSignal: true, isRequired: false, transformFunction: null }, size: { classPropertyName: "size", publicName: "size", isSignal: true, isRequired: false, transformFunction: null }, showCloseButton: { classPropertyName: "showCloseButton", publicName: "showCloseButton", isSignal: true, isRequired: false, transformFunction: null }, dismissible: { classPropertyName: "dismissible", publicName: "dismissible", isSignal: true, isRequired: false, transformFunction: null } }, outputs: { openModel: "openModelChange", onClose: "onClose" }, viewQueries: [{ propertyName: "drawerTemplate", first: true, predicate: ["drawerTemplate"], descendants: true }], ngImport: i0, template: `
11542
11596
  <ng-template #drawerTemplate>
11543
- <div
11544
- class="h-full bg-white shadow-2xl flex flex-col outline-none border-outline-gray-2"
11545
- [class.border-l]="position() === 'right'"
11546
- [class.border-r]="position() === 'left'"
11547
- [class]="sizeClass()"
11548
- >
11549
- <!-- Header -->
11550
- <div class="flex items-center justify-between px-6 py-4 border-b border-outline-gray-2 shrink-0">
11551
- <h2 class="text-lg font-semibold text-ink-gray-9">{{ title() }}</h2>
11552
- @if (showCloseButton()) {
11553
- <button
11554
- class="flex items-center justify-center size-8 rounded-md hover:bg-surface-gray-2 text-ink-gray-5 hover:text-ink-gray-9 transition-colors"
11555
- (click)="close()"
11556
- title="Cerrar"
11557
- >
11558
- <i class="lucide-x size-[18px]" style="stroke-width: 1.5px;"></i>
11559
- </button>
11560
- }
11561
- </div>
11597
+ <div class="fixed inset-0 z-50 flex" [ngClass]="wrapperClasses()">
11598
+ <div [class]="panelClasses()">
11599
+ <!-- Header -->
11600
+ <div class="flex items-center justify-between px-6 py-4 border-b border-outline-gray-2 shrink-0">
11601
+ <h2 class="text-lg font-semibold text-ink-gray-9">{{ title() }}</h2>
11602
+ @if (showCloseButton()) {
11603
+ <button
11604
+ class="flex items-center justify-center size-8 rounded-md hover:bg-surface-gray-2 text-ink-gray-5 hover:text-ink-gray-9 transition-colors"
11605
+ (click)="close()"
11606
+ title="Cerrar"
11607
+ >
11608
+ <i class="lucide-x size-[18px]" style="stroke-width: 1.5px;"></i>
11609
+ </button>
11610
+ }
11611
+ </div>
11562
11612
 
11563
- <!-- Body -->
11564
- <div class="flex-1 overflow-y-auto p-6 text-sm font-normal text-ink-gray-7">
11565
- <ng-content></ng-content>
11566
- </div>
11613
+ <!-- Body -->
11614
+ <div class="flex-1 overflow-y-auto p-6 text-sm font-normal text-ink-gray-7">
11615
+ <ng-content></ng-content>
11616
+ </div>
11567
11617
 
11568
- <!-- Footer (Optional) -->
11569
- <div class="shrink-0">
11570
- <ng-content select="[footer]"></ng-content>
11618
+ <!-- Footer (Optional) -->
11619
+ <div class="shrink-0">
11620
+ <ng-content select="[footer]"></ng-content>
11621
+ </div>
11571
11622
  </div>
11572
11623
  </div>
11573
11624
  </ng-template>
11574
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "ngmodule", type: DialogModule }] });
11625
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: DialogModule }] });
11575
11626
  }
11576
11627
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NeuralDrawerComponent, decorators: [{
11577
11628
  type: Component,
@@ -11581,34 +11632,31 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
11581
11632
  imports: [CommonModule, DialogModule],
11582
11633
  template: `
11583
11634
  <ng-template #drawerTemplate>
11584
- <div
11585
- class="h-full bg-white shadow-2xl flex flex-col outline-none border-outline-gray-2"
11586
- [class.border-l]="position() === 'right'"
11587
- [class.border-r]="position() === 'left'"
11588
- [class]="sizeClass()"
11589
- >
11590
- <!-- Header -->
11591
- <div class="flex items-center justify-between px-6 py-4 border-b border-outline-gray-2 shrink-0">
11592
- <h2 class="text-lg font-semibold text-ink-gray-9">{{ title() }}</h2>
11593
- @if (showCloseButton()) {
11594
- <button
11595
- class="flex items-center justify-center size-8 rounded-md hover:bg-surface-gray-2 text-ink-gray-5 hover:text-ink-gray-9 transition-colors"
11596
- (click)="close()"
11597
- title="Cerrar"
11598
- >
11599
- <i class="lucide-x size-[18px]" style="stroke-width: 1.5px;"></i>
11600
- </button>
11601
- }
11602
- </div>
11635
+ <div class="fixed inset-0 z-50 flex" [ngClass]="wrapperClasses()">
11636
+ <div [class]="panelClasses()">
11637
+ <!-- Header -->
11638
+ <div class="flex items-center justify-between px-6 py-4 border-b border-outline-gray-2 shrink-0">
11639
+ <h2 class="text-lg font-semibold text-ink-gray-9">{{ title() }}</h2>
11640
+ @if (showCloseButton()) {
11641
+ <button
11642
+ class="flex items-center justify-center size-8 rounded-md hover:bg-surface-gray-2 text-ink-gray-5 hover:text-ink-gray-9 transition-colors"
11643
+ (click)="close()"
11644
+ title="Cerrar"
11645
+ >
11646
+ <i class="lucide-x size-[18px]" style="stroke-width: 1.5px;"></i>
11647
+ </button>
11648
+ }
11649
+ </div>
11603
11650
 
11604
- <!-- Body -->
11605
- <div class="flex-1 overflow-y-auto p-6 text-sm font-normal text-ink-gray-7">
11606
- <ng-content></ng-content>
11607
- </div>
11651
+ <!-- Body -->
11652
+ <div class="flex-1 overflow-y-auto p-6 text-sm font-normal text-ink-gray-7">
11653
+ <ng-content></ng-content>
11654
+ </div>
11608
11655
 
11609
- <!-- Footer (Optional) -->
11610
- <div class="shrink-0">
11611
- <ng-content select="[footer]"></ng-content>
11656
+ <!-- Footer (Optional) -->
11657
+ <div class="shrink-0">
11658
+ <ng-content select="[footer]"></ng-content>
11659
+ </div>
11612
11660
  </div>
11613
11661
  </div>
11614
11662
  </ng-template>