orbiq-neural-ui-kit 1.1.5 → 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,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,16 +11554,48 @@ 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>
@@ -11582,13 +11632,8 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "22.1.4", ngImpor
11582
11632
  imports: [CommonModule, DialogModule],
11583
11633
  template: `
11584
11634
  <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
- >
11635
+ <div class="fixed inset-0 z-50 flex" [ngClass]="wrapperClasses()">
11636
+ <div [class]="panelClasses()">
11592
11637
  <!-- Header -->
11593
11638
  <div class="flex items-center justify-between px-6 py-4 border-b border-outline-gray-2 shrink-0">
11594
11639
  <h2 class="text-lg font-semibold text-ink-gray-9">{{ title() }}</h2>