@limetech/lime-elements 37.65.11 → 37.65.12

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ ## [37.65.12](https://github.com/Lundalogik/lime-elements/compare/v37.65.11...v37.65.12) (2024-11-12)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+
7
+ * **date-picker:** avoid creating flatpickr instance while hidden ([7bd6f8a](https://github.com/Lundalogik/lime-elements/commit/7bd6f8a7f37d9920c832dc3513632927d0ae5365))
8
+ * **flatpickr-adapter:** create flatpickr again after disconnected ([737178a](https://github.com/Lundalogik/lime-elements/commit/737178a62b8958c9f9b7d2af23764e7ec150fb6d))
9
+
1
10
  ## [37.65.11](https://github.com/Lundalogik/lime-elements/compare/v37.65.10...v37.65.11) (2024-11-11)
2
11
 
3
12
 
@@ -7624,28 +7624,6 @@ const DatePickerCalendar = class {
7624
7624
  else if (!this.isOpen) {
7625
7625
  this.picker.setValue(this.value);
7626
7626
  }
7627
- this.tryFixConfusingWidthBug();
7628
- }
7629
- tryFixConfusingWidthBug() {
7630
- // Sometimes the datepickr renders with the width set to 1px.
7631
- // We've not been able to understand why but believe it has
7632
- // to do with the internal implementation of flatpickr.
7633
- // The fix below is an ugly fix that seems to solve this
7634
- // issue for us.
7635
- const ONE_SECOND = 1000;
7636
- const TEN_PIXELS = 10;
7637
- if (this.isOpen) {
7638
- setTimeout(() => {
7639
- if (this.isOpen) {
7640
- const flatpickrElement = this.container.querySelector('div.flatpickr-calendar');
7641
- const { width } = flatpickrElement.getBoundingClientRect();
7642
- if (width < TEN_PIXELS) {
7643
- this.destroyFlatpickr();
7644
- this.createFlatpickr();
7645
- }
7646
- }
7647
- }, ONE_SECOND);
7648
- }
7649
7627
  }
7650
7628
  createFlatpickr() {
7651
7629
  if (!this.inputElement) {
@@ -7653,14 +7631,15 @@ const DatePickerCalendar = class {
7653
7631
  // after its been rendered.
7654
7632
  return;
7655
7633
  }
7634
+ if (!this.isOpen || !this.container.checkVisibility()) {
7635
+ return;
7636
+ }
7656
7637
  this.picker.init(this.inputElement, this.container, this.value);
7657
7638
  this.flatPickrCreated = true;
7658
7639
  }
7659
- destroyFlatpickr() {
7660
- this.picker.destroy();
7661
- }
7662
7640
  disconnectedCallback() {
7663
7641
  this.picker.destroy();
7642
+ this.flatPickrCreated = false;
7664
7643
  }
7665
7644
  render() {
7666
7645
  return (index.h("div", { class: "container", ref: (el) => (this.container = el), style: {