@tolle_/tolle-ui 18.2.23 → 18.2.24

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.
@@ -3555,14 +3555,14 @@ class DatePickerComponent {
3555
3555
  formatYearFn;
3556
3556
  // Format functions for display
3557
3557
  displayFormat;
3558
- triggerContainer;
3558
+ trigger;
3559
3559
  popover;
3560
3560
  value = null;
3561
3561
  inputValue = '';
3562
3562
  isOpen = false;
3563
3563
  cleanupAutoUpdate;
3564
3564
  _outsideClickHandler = (event) => {
3565
- if (!this.triggerContainer.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
3565
+ if (!this.trigger.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
3566
3566
  this.close();
3567
3567
  }
3568
3568
  };
@@ -3645,8 +3645,11 @@ class DatePickerComponent {
3645
3645
  this.isOpen ? this.close() : this.open();
3646
3646
  }
3647
3647
  open() {
3648
+ if (this.disabled)
3649
+ return;
3648
3650
  this.isOpen = true;
3649
- setTimeout(() => {
3651
+ this.trigger.nativeElement.focus();
3652
+ requestAnimationFrame(() => {
3650
3653
  this.updatePosition();
3651
3654
  document.addEventListener('mousedown', this._outsideClickHandler);
3652
3655
  });
@@ -3665,12 +3668,12 @@ class DatePickerComponent {
3665
3668
  this.cdr.markForCheck();
3666
3669
  }
3667
3670
  updatePosition() {
3668
- if (!this.triggerContainer || !this.popover)
3671
+ if (!this.trigger || !this.popover)
3669
3672
  return;
3670
- this.cleanupAutoUpdate = autoUpdate(this.triggerContainer.nativeElement, this.popover.nativeElement, () => {
3671
- computePosition(this.triggerContainer.nativeElement, this.popover.nativeElement, {
3672
- strategy: 'fixed', // ADDED: Fixed strategy
3673
- placement: 'bottom-start', // Changed to bottom-start to align with input left edge
3673
+ this.cleanupAutoUpdate = autoUpdate(this.trigger.nativeElement, this.popover.nativeElement, () => {
3674
+ computePosition(this.trigger.nativeElement, this.popover.nativeElement, {
3675
+ strategy: 'fixed',
3676
+ placement: 'bottom-start',
3674
3677
  middleware: [
3675
3678
  offset(4),
3676
3679
  flip(),
@@ -3719,7 +3722,7 @@ class DatePickerComponent {
3719
3722
  useExisting: forwardRef(() => DatePickerComponent),
3720
3723
  multi: true
3721
3724
  }
3722
- ], viewQueries: [{ propertyName: "triggerContainer", first: true, predicate: ["triggerContainer"], descendants: true }, { propertyName: "popover", first: true, predicate: ["popover"], descendants: true }], ngImport: i0, template: `
3725
+ ], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "popover", first: true, predicate: ["popover"], descendants: true }], ngImport: i0, template: `
3723
3726
  <div class="relative w-full" #triggerContainer>
3724
3727
  <tolle-masked-input
3725
3728
  #maskInput
@@ -3729,20 +3732,26 @@ class DatePickerComponent {
3729
3732
  [(ngModel)]="inputValue"
3730
3733
  (ngModelChange)="onInputChange($event)"
3731
3734
  [class]="cn(class)">
3732
- <div suffix class="flex items-center gap-1.5 cursor-pointer">
3733
- <i
3735
+ <div suffix class="flex items-center gap-1.5">
3736
+ <button
3734
3737
  *ngIf="value && !disabled && showClear"
3738
+ type="button"
3735
3739
  (click)="clear($event)"
3736
3740
  class="ri-close-line cursor-pointer text-muted-foreground hover:text-foreground transition-colors"
3737
- ></i>
3741
+ tabindex="-1"
3742
+ ></button>
3738
3743
 
3739
- <i
3744
+ <button
3745
+ type="button"
3746
+ #trigger
3740
3747
  (click)="togglePopover($event)"
3748
+ [disabled]="disabled"
3741
3749
  [class]="cn(
3742
3750
  'cursor-pointer text-muted-foreground transition-colors',
3743
3751
  'ri-calendar-line'
3744
3752
  )"
3745
- ></i>
3753
+ tabindex="-1"
3754
+ ></button>
3746
3755
  </div>
3747
3756
  </tolle-masked-input>
3748
3757
 
@@ -3790,20 +3799,26 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
3790
3799
  [(ngModel)]="inputValue"
3791
3800
  (ngModelChange)="onInputChange($event)"
3792
3801
  [class]="cn(class)">
3793
- <div suffix class="flex items-center gap-1.5 cursor-pointer">
3794
- <i
3802
+ <div suffix class="flex items-center gap-1.5">
3803
+ <button
3795
3804
  *ngIf="value && !disabled && showClear"
3805
+ type="button"
3796
3806
  (click)="clear($event)"
3797
3807
  class="ri-close-line cursor-pointer text-muted-foreground hover:text-foreground transition-colors"
3798
- ></i>
3808
+ tabindex="-1"
3809
+ ></button>
3799
3810
 
3800
- <i
3811
+ <button
3812
+ type="button"
3813
+ #trigger
3801
3814
  (click)="togglePopover($event)"
3815
+ [disabled]="disabled"
3802
3816
  [class]="cn(
3803
3817
  'cursor-pointer text-muted-foreground transition-colors',
3804
3818
  'ri-calendar-line'
3805
3819
  )"
3806
- ></i>
3820
+ tabindex="-1"
3821
+ ></button>
3807
3822
  </div>
3808
3823
  </tolle-masked-input>
3809
3824
 
@@ -3852,9 +3867,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
3852
3867
  type: Input
3853
3868
  }], displayFormat: [{
3854
3869
  type: Input
3855
- }], triggerContainer: [{
3870
+ }], trigger: [{
3856
3871
  type: ViewChild,
3857
- args: ['triggerContainer']
3872
+ args: ['trigger']
3858
3873
  }], popover: [{
3859
3874
  type: ViewChild,
3860
3875
  args: ['popover']
@@ -5500,13 +5515,13 @@ class DateRangePickerComponent {
5500
5515
  class = '';
5501
5516
  disablePastDates = false;
5502
5517
  size = 'default';
5503
- triggerContainer;
5518
+ trigger;
5504
5519
  popover;
5505
5520
  value = { start: null, end: null };
5506
5521
  isOpen = false;
5507
5522
  cleanupAutoUpdate;
5508
5523
  _outsideClickHandler = (event) => {
5509
- if (!this.triggerContainer.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
5524
+ if (!this.trigger.nativeElement.contains(event.target) && !this.popover?.nativeElement.contains(event.target)) {
5510
5525
  this.close();
5511
5526
  }
5512
5527
  };
@@ -5538,7 +5553,11 @@ class DateRangePickerComponent {
5538
5553
  }
5539
5554
  open() {
5540
5555
  this.isOpen = true;
5541
- setTimeout(() => {
5556
+ if (this.trigger?.nativeElement) {
5557
+ this.trigger.nativeElement.focus();
5558
+ }
5559
+ const schedule = typeof requestAnimationFrame !== 'undefined' ? requestAnimationFrame : (fn) => setTimeout(fn, 0);
5560
+ schedule(() => {
5542
5561
  this.updatePosition();
5543
5562
  document.addEventListener('mousedown', this._outsideClickHandler);
5544
5563
  });
@@ -5559,10 +5578,10 @@ class DateRangePickerComponent {
5559
5578
  }
5560
5579
  // --- Floating UI Positioning with Fixed Strategy ---
5561
5580
  updatePosition() {
5562
- if (!this.triggerContainer || !this.popover)
5581
+ if (!this.trigger || !this.popover)
5563
5582
  return;
5564
- this.cleanupAutoUpdate = autoUpdate(this.triggerContainer.nativeElement, this.popover.nativeElement, () => {
5565
- computePosition(this.triggerContainer.nativeElement, this.popover.nativeElement, {
5583
+ this.cleanupAutoUpdate = autoUpdate(this.trigger.nativeElement, this.popover.nativeElement, () => {
5584
+ computePosition(this.trigger.nativeElement, this.popover.nativeElement, {
5566
5585
  placement: 'bottom-end',
5567
5586
  strategy: 'fixed', // Use fixed to escape column layout
5568
5587
  middleware: [
@@ -5635,22 +5654,25 @@ class DateRangePickerComponent {
5635
5654
  useExisting: forwardRef(() => DateRangePickerComponent),
5636
5655
  multi: true
5637
5656
  }
5638
- ], viewQueries: [{ propertyName: "triggerContainer", first: true, predicate: ["triggerContainer"], descendants: true }, { propertyName: "popover", first: true, predicate: ["popover"], descendants: true }], ngImport: i0, template: `
5639
- <div class="relative w-full" #triggerContainer>
5657
+ ], viewQueries: [{ propertyName: "trigger", first: true, predicate: ["trigger"], descendants: true }, { propertyName: "popover", first: true, predicate: ["popover"], descendants: true }], ngImport: i0, template: `
5658
+ <div class="relative w-full">
5640
5659
  <tolle-input
5641
5660
  [placeholder]="placeholder"
5642
5661
  [disabled]="disabled"
5643
5662
  [ngModel]="displayValue"
5644
5663
  [class]="class"
5645
5664
  >
5646
- <div suffix class="flex items-center gap-1.5 cursor-pointer">
5647
- <i
5665
+ <div suffix class="flex items-center gap-1.5">
5666
+ <button
5667
+ type="button"
5668
+ tabindex="-1"
5648
5669
  *ngIf="(value.start || value.end) && !disabled"
5649
5670
  (click)="clear($event)"
5650
5671
  class="ri-close-line cursor-pointer text-muted-foreground hover:text-foreground transition-colors"
5651
- ></i>
5672
+ ></button>
5652
5673
 
5653
5674
  <i
5675
+ #trigger
5654
5676
  (click)="togglePopover($event)"
5655
5677
  class="ri-calendar-line cursor-pointer text-muted-foreground hover:text-primary transition-colors"
5656
5678
  ></i>
@@ -5686,21 +5708,24 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
5686
5708
  }
5687
5709
  ],
5688
5710
  template: `
5689
- <div class="relative w-full" #triggerContainer>
5711
+ <div class="relative w-full">
5690
5712
  <tolle-input
5691
5713
  [placeholder]="placeholder"
5692
5714
  [disabled]="disabled"
5693
5715
  [ngModel]="displayValue"
5694
5716
  [class]="class"
5695
5717
  >
5696
- <div suffix class="flex items-center gap-1.5 cursor-pointer">
5697
- <i
5718
+ <div suffix class="flex items-center gap-1.5">
5719
+ <button
5720
+ type="button"
5721
+ tabindex="-1"
5698
5722
  *ngIf="(value.start || value.end) && !disabled"
5699
5723
  (click)="clear($event)"
5700
5724
  class="ri-close-line cursor-pointer text-muted-foreground hover:text-foreground transition-colors"
5701
- ></i>
5725
+ ></button>
5702
5726
 
5703
5727
  <i
5728
+ #trigger
5704
5729
  (click)="togglePopover($event)"
5705
5730
  class="ri-calendar-line cursor-pointer text-muted-foreground hover:text-primary transition-colors"
5706
5731
  ></i>
@@ -5732,9 +5757,9 @@ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.2.14", ngImpo
5732
5757
  type: Input
5733
5758
  }], size: [{
5734
5759
  type: Input
5735
- }], triggerContainer: [{
5760
+ }], trigger: [{
5736
5761
  type: ViewChild,
5737
- args: ['triggerContainer']
5762
+ args: ['trigger']
5738
5763
  }], popover: [{
5739
5764
  type: ViewChild,
5740
5765
  args: ['popover']