orbiq-neural-ui-kit 1.1.5 → 1.1.7

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,31 +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
11511
  panelClass: ['w-full', 'h-full', 'bg-transparent', 'shadow-none', 'outline-none', 'pointer-events-none'],
11508
11512
  hasBackdrop: true,
11509
11513
  });
11510
- this.dialogRef.closed.subscribe(() => {
11511
- this.dialogRef = null;
11512
- if (this.openModel()) {
11513
- 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();
11514
11522
  }
11515
- this.onClose.emit();
11516
11523
  });
11517
11524
  }
11518
11525
  close() {
11519
- if (this.dialogRef) {
11520
- this.dialogRef.close();
11521
- }
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
11522
11540
  }
11523
11541
  ngOnDestroy() {
11524
11542
  if (this.dialogRef) {
@@ -11536,27 +11554,62 @@ class NeuralDrawerComponent {
11536
11554
  return map[this.size()] || 'w-80';
11537
11555
  }, /* @ts-ignore */
11538
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 */ []));
11539
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 });
11540
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: `
11541
11596
  <ng-template #drawerTemplate>
11542
- <div class="fixed inset-0 z-50 flex" [ngClass]="position() === 'right' ? 'justify-end' : 'justify-start'">
11543
- <div
11544
- class="h-full bg-white shadow-2xl flex flex-col outline-none border-outline-gray-2 pointer-events-auto"
11545
- [class.border-l]="position() === 'right'"
11546
- [class.border-r]="position() === 'left'"
11547
- [class]="sizeClass()"
11548
- >
11597
+ <div class="fixed inset-0 z-50 flex" [ngClass]="wrapperClasses()">
11598
+ <div [class]="panelClasses()">
11549
11599
  <!-- Header -->
11550
11600
  <div class="flex items-center justify-between px-6 py-4 border-b border-outline-gray-2 shrink-0">
11551
11601
  <h2 class="text-lg font-semibold text-ink-gray-9">{{ title() }}</h2>
11552
11602
  @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()"
11603
+ <neural-button
11604
+ variant="ghost"
11605
+ theme="gray"
11606
+ size="sm"
11607
+ [iconOnly]="true"
11608
+ icon="lucide-x"
11609
+ (clicked)="close()"
11556
11610
  title="Cerrar"
11557
- >
11558
- <i class="lucide-x size-[18px]" style="stroke-width: 1.5px;"></i>
11559
- </button>
11611
+ class="text-ink-gray-5 hover:text-ink-gray-9"
11612
+ ></neural-button>
11560
11613
  }
11561
11614
  </div>
11562
11615
 
@@ -11566,40 +11619,38 @@ class NeuralDrawerComponent {
11566
11619
  </div>
11567
11620
 
11568
11621
  <!-- Footer (Optional) -->
11569
- <div class="shrink-0">
11622
+ <div class="shrink-0 px-6 py-4 border-t border-outline-gray-2">
11570
11623
  <ng-content select="[footer]"></ng-content>
11571
11624
  </div>
11572
11625
  </div>
11573
11626
  </div>
11574
11627
  </ng-template>
11575
- `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: DialogModule }] });
11628
+ `, isInline: true, dependencies: [{ kind: "ngmodule", type: CommonModule }, { kind: "directive", type: i1$2.NgClass, selector: "[ngClass]", inputs: ["class", "ngClass"] }, { kind: "ngmodule", type: DialogModule }, { kind: "component", type: NeuralButtonComponent, selector: "neural-button", inputs: ["variant", "theme", "size", "type", "disabled", "loading", "icon", "iconLeft", "iconRight", "iconOnly"], outputs: ["clicked"] }] });
11576
11629
  }
11577
11630
  i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImport: i0, type: NeuralDrawerComponent, decorators: [{
11578
11631
  type: Component,
11579
11632
  args: [{
11580
11633
  selector: 'neural-drawer',
11581
11634
  standalone: true,
11582
- imports: [CommonModule, DialogModule],
11635
+ imports: [CommonModule, DialogModule, NeuralButtonComponent],
11583
11636
  template: `
11584
11637
  <ng-template #drawerTemplate>
11585
- <div class="fixed inset-0 z-50 flex" [ngClass]="position() === 'right' ? 'justify-end' : 'justify-start'">
11586
- <div
11587
- class="h-full bg-white shadow-2xl flex flex-col outline-none border-outline-gray-2 pointer-events-auto"
11588
- [class.border-l]="position() === 'right'"
11589
- [class.border-r]="position() === 'left'"
11590
- [class]="sizeClass()"
11591
- >
11638
+ <div class="fixed inset-0 z-50 flex" [ngClass]="wrapperClasses()">
11639
+ <div [class]="panelClasses()">
11592
11640
  <!-- Header -->
11593
11641
  <div class="flex items-center justify-between px-6 py-4 border-b border-outline-gray-2 shrink-0">
11594
11642
  <h2 class="text-lg font-semibold text-ink-gray-9">{{ title() }}</h2>
11595
11643
  @if (showCloseButton()) {
11596
- <button
11597
- 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"
11598
- (click)="close()"
11644
+ <neural-button
11645
+ variant="ghost"
11646
+ theme="gray"
11647
+ size="sm"
11648
+ [iconOnly]="true"
11649
+ icon="lucide-x"
11650
+ (clicked)="close()"
11599
11651
  title="Cerrar"
11600
- >
11601
- <i class="lucide-x size-[18px]" style="stroke-width: 1.5px;"></i>
11602
- </button>
11652
+ class="text-ink-gray-5 hover:text-ink-gray-9"
11653
+ ></neural-button>
11603
11654
  }
11604
11655
  </div>
11605
11656
 
@@ -11609,7 +11660,7 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
11609
11660
  </div>
11610
11661
 
11611
11662
  <!-- Footer (Optional) -->
11612
- <div class="shrink-0">
11663
+ <div class="shrink-0 px-6 py-4 border-t border-outline-gray-2">
11613
11664
  <ng-content select="[footer]"></ng-content>
11614
11665
  </div>
11615
11666
  </div>