@aurodesignsystem-dev/auro-formkit 0.0.0-pr1156.1 → 0.0.0-pr1160.0

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.
@@ -14284,6 +14284,15 @@ class AuroCalendar extends RangeDatepicker {
14284
14284
  type: Object
14285
14285
  },
14286
14286
 
14287
+ /**
14288
+ * Mobile breakpoint for responsive design.
14289
+ * @private
14290
+ */
14291
+ mobileBreakpoint: {
14292
+ type: Number,
14293
+ reflect: false
14294
+ },
14295
+
14287
14296
  /**
14288
14297
  * @private
14289
14298
  */
@@ -29057,11 +29066,21 @@ class AuroDatePicker extends AuroElement$1 {
29057
29066
  this.dropdown.addEventListener('auroDropdown-toggled', () => {
29058
29067
  this.notifyDatepickerToggled();
29059
29068
 
29069
+ // This forces the calendar to render when the dropdown is opened.
29070
+ // It is not rendered by default
29060
29071
  this.calendar.visible = this.dropdown.isPopoverVisible;
29061
29072
 
29062
- if (this.dropdown.getAttribute('data-show') && this.forceScrollOnNextMobileCalendarRender) {
29063
- this.calendar.scrollMonthIntoView(this.formattedFocusDate);
29064
- this.forceScrollOnNextMobileCalendarRender = false;
29073
+ // If on mobile, and the calendar is opened, scroll the focus date into view if the flag is set
29074
+ if (this.dropdown.isPopoverVisible && this.forceScrollOnNextMobileCalendarRender) {
29075
+
29076
+ // Since the calendar is not rendered until the dropdown is opened,
29077
+ // and the auroDropdown-toggled event fires before the popover is actually open,
29078
+ // we need to wait until the next frame to ensure the calendar is fully rendered
29079
+ // and the area we're trying to scroll to is present in the DOM.
29080
+ setTimeout(() => {
29081
+ this.calendar.scrollMonthIntoView(this.formattedFocusDate);
29082
+ this.forceScrollOnNextMobileCalendarRender = false;
29083
+ }, 0);
29065
29084
  }
29066
29085
  });
29067
29086
  }
@@ -29220,10 +29239,13 @@ class AuroDatePicker extends AuroElement$1 {
29220
29239
  handleReadOnly() {
29221
29240
  // --ds-grid-breakpoint-sm
29222
29241
  const docStyle = getComputedStyle(document.documentElement);
29223
- const mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
29242
+
29243
+ // We need to store this so that we can pass it to calendar
29244
+ this.mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
29245
+ const isMobile = window.innerWidth < this.mobileBreakpoint;
29224
29246
 
29225
29247
  this.inputList.forEach((input) => {
29226
- if (window.innerWidth < mobileBreakpoint) {
29248
+ if (isMobile) {
29227
29249
  input.setAttribute('readonly', true);
29228
29250
  } else {
29229
29251
  input.removeAttribute('readonly');
@@ -29410,6 +29432,9 @@ class AuroDatePicker extends AuroElement$1 {
29410
29432
  if (!this.calendarFocusDate && this.util.validDateStr(this.value, this.format)) {
29411
29433
  if (!this.dropdown.isPopoverVisible) {
29412
29434
  this.calendarFocusDate = this.value;
29435
+
29436
+ // Let the calendar know to scroll to the focus date when it is next rendered on mobile
29437
+ this.forceScrollOnNextMobileCalendarRender = true;
29413
29438
  }
29414
29439
  }
29415
29440
 
@@ -30032,6 +30057,7 @@ class AuroDatePicker extends AuroElement$1 {
30032
30057
  .maxDate="${this.maxDate}"
30033
30058
  .minDate="${this.minDate}"
30034
30059
  .monthNames="${this.monthNames}"
30060
+ .mobileBreakpoint="${this.mobileBreakpoint}"
30035
30061
  part="calendar"
30036
30062
  >
30037
30063
  <slot name="ariaLabel.bib.close" slot="ariaLabel.close" @slotchange="${this.handleSlotToSlot}">Close</slot>
@@ -14025,6 +14025,15 @@ class AuroCalendar extends RangeDatepicker {
14025
14025
  type: Object
14026
14026
  },
14027
14027
 
14028
+ /**
14029
+ * Mobile breakpoint for responsive design.
14030
+ * @private
14031
+ */
14032
+ mobileBreakpoint: {
14033
+ type: Number,
14034
+ reflect: false
14035
+ },
14036
+
14028
14037
  /**
14029
14038
  * @private
14030
14039
  */
@@ -28798,11 +28807,21 @@ class AuroDatePicker extends AuroElement$1 {
28798
28807
  this.dropdown.addEventListener('auroDropdown-toggled', () => {
28799
28808
  this.notifyDatepickerToggled();
28800
28809
 
28810
+ // This forces the calendar to render when the dropdown is opened.
28811
+ // It is not rendered by default
28801
28812
  this.calendar.visible = this.dropdown.isPopoverVisible;
28802
28813
 
28803
- if (this.dropdown.getAttribute('data-show') && this.forceScrollOnNextMobileCalendarRender) {
28804
- this.calendar.scrollMonthIntoView(this.formattedFocusDate);
28805
- this.forceScrollOnNextMobileCalendarRender = false;
28814
+ // If on mobile, and the calendar is opened, scroll the focus date into view if the flag is set
28815
+ if (this.dropdown.isPopoverVisible && this.forceScrollOnNextMobileCalendarRender) {
28816
+
28817
+ // Since the calendar is not rendered until the dropdown is opened,
28818
+ // and the auroDropdown-toggled event fires before the popover is actually open,
28819
+ // we need to wait until the next frame to ensure the calendar is fully rendered
28820
+ // and the area we're trying to scroll to is present in the DOM.
28821
+ setTimeout(() => {
28822
+ this.calendar.scrollMonthIntoView(this.formattedFocusDate);
28823
+ this.forceScrollOnNextMobileCalendarRender = false;
28824
+ }, 0);
28806
28825
  }
28807
28826
  });
28808
28827
  }
@@ -28961,10 +28980,13 @@ class AuroDatePicker extends AuroElement$1 {
28961
28980
  handleReadOnly() {
28962
28981
  // --ds-grid-breakpoint-sm
28963
28982
  const docStyle = getComputedStyle(document.documentElement);
28964
- const mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
28983
+
28984
+ // We need to store this so that we can pass it to calendar
28985
+ this.mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
28986
+ const isMobile = window.innerWidth < this.mobileBreakpoint;
28965
28987
 
28966
28988
  this.inputList.forEach((input) => {
28967
- if (window.innerWidth < mobileBreakpoint) {
28989
+ if (isMobile) {
28968
28990
  input.setAttribute('readonly', true);
28969
28991
  } else {
28970
28992
  input.removeAttribute('readonly');
@@ -29151,6 +29173,9 @@ class AuroDatePicker extends AuroElement$1 {
29151
29173
  if (!this.calendarFocusDate && this.util.validDateStr(this.value, this.format)) {
29152
29174
  if (!this.dropdown.isPopoverVisible) {
29153
29175
  this.calendarFocusDate = this.value;
29176
+
29177
+ // Let the calendar know to scroll to the focus date when it is next rendered on mobile
29178
+ this.forceScrollOnNextMobileCalendarRender = true;
29154
29179
  }
29155
29180
  }
29156
29181
 
@@ -29773,6 +29798,7 @@ class AuroDatePicker extends AuroElement$1 {
29773
29798
  .maxDate="${this.maxDate}"
29774
29799
  .minDate="${this.minDate}"
29775
29800
  .monthNames="${this.monthNames}"
29801
+ .mobileBreakpoint="${this.mobileBreakpoint}"
29776
29802
  part="calendar"
29777
29803
  >
29778
29804
  <slot name="ariaLabel.bib.close" slot="ariaLabel.close" @slotchange="${this.handleSlotToSlot}">Close</slot>
@@ -62,6 +62,14 @@ export class AuroCalendar extends RangeDatepicker {
62
62
  dropdown: {
63
63
  type: ObjectConstructor;
64
64
  };
65
+ /**
66
+ * Mobile breakpoint for responsive design.
67
+ * @private
68
+ */
69
+ mobileBreakpoint: {
70
+ type: NumberConstructor;
71
+ reflect: boolean;
72
+ };
65
73
  /**
66
74
  * @private
67
75
  */
@@ -541,6 +541,7 @@ export class AuroDatePicker extends AuroElement {
541
541
  * @returns {void}
542
542
  */
543
543
  private handleReadOnly;
544
+ mobileBreakpoint: number;
544
545
  /**
545
546
  * Keep the datepicker in sync with the calendar's central date.
546
547
  * @private
@@ -13975,6 +13975,15 @@ class AuroCalendar extends RangeDatepicker {
13975
13975
  type: Object
13976
13976
  },
13977
13977
 
13978
+ /**
13979
+ * Mobile breakpoint for responsive design.
13980
+ * @private
13981
+ */
13982
+ mobileBreakpoint: {
13983
+ type: Number,
13984
+ reflect: false
13985
+ },
13986
+
13978
13987
  /**
13979
13988
  * @private
13980
13989
  */
@@ -28723,11 +28732,21 @@ class AuroDatePicker extends AuroElement$1 {
28723
28732
  this.dropdown.addEventListener('auroDropdown-toggled', () => {
28724
28733
  this.notifyDatepickerToggled();
28725
28734
 
28735
+ // This forces the calendar to render when the dropdown is opened.
28736
+ // It is not rendered by default
28726
28737
  this.calendar.visible = this.dropdown.isPopoverVisible;
28727
28738
 
28728
- if (this.dropdown.getAttribute('data-show') && this.forceScrollOnNextMobileCalendarRender) {
28729
- this.calendar.scrollMonthIntoView(this.formattedFocusDate);
28730
- this.forceScrollOnNextMobileCalendarRender = false;
28739
+ // If on mobile, and the calendar is opened, scroll the focus date into view if the flag is set
28740
+ if (this.dropdown.isPopoverVisible && this.forceScrollOnNextMobileCalendarRender) {
28741
+
28742
+ // Since the calendar is not rendered until the dropdown is opened,
28743
+ // and the auroDropdown-toggled event fires before the popover is actually open,
28744
+ // we need to wait until the next frame to ensure the calendar is fully rendered
28745
+ // and the area we're trying to scroll to is present in the DOM.
28746
+ setTimeout(() => {
28747
+ this.calendar.scrollMonthIntoView(this.formattedFocusDate);
28748
+ this.forceScrollOnNextMobileCalendarRender = false;
28749
+ }, 0);
28731
28750
  }
28732
28751
  });
28733
28752
  }
@@ -28886,10 +28905,13 @@ class AuroDatePicker extends AuroElement$1 {
28886
28905
  handleReadOnly() {
28887
28906
  // --ds-grid-breakpoint-sm
28888
28907
  const docStyle = getComputedStyle(document.documentElement);
28889
- const mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
28908
+
28909
+ // We need to store this so that we can pass it to calendar
28910
+ this.mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
28911
+ const isMobile = window.innerWidth < this.mobileBreakpoint;
28890
28912
 
28891
28913
  this.inputList.forEach((input) => {
28892
- if (window.innerWidth < mobileBreakpoint) {
28914
+ if (isMobile) {
28893
28915
  input.setAttribute('readonly', true);
28894
28916
  } else {
28895
28917
  input.removeAttribute('readonly');
@@ -29076,6 +29098,9 @@ class AuroDatePicker extends AuroElement$1 {
29076
29098
  if (!this.calendarFocusDate && this.util.validDateStr(this.value, this.format)) {
29077
29099
  if (!this.dropdown.isPopoverVisible) {
29078
29100
  this.calendarFocusDate = this.value;
29101
+
29102
+ // Let the calendar know to scroll to the focus date when it is next rendered on mobile
29103
+ this.forceScrollOnNextMobileCalendarRender = true;
29079
29104
  }
29080
29105
  }
29081
29106
 
@@ -29698,6 +29723,7 @@ class AuroDatePicker extends AuroElement$1 {
29698
29723
  .maxDate="${this.maxDate}"
29699
29724
  .minDate="${this.minDate}"
29700
29725
  .monthNames="${this.monthNames}"
29726
+ .mobileBreakpoint="${this.mobileBreakpoint}"
29701
29727
  part="calendar"
29702
29728
  >
29703
29729
  <slot name="ariaLabel.bib.close" slot="ariaLabel.close" @slotchange="${this.handleSlotToSlot}">Close</slot>
@@ -13975,6 +13975,15 @@ class AuroCalendar extends RangeDatepicker {
13975
13975
  type: Object
13976
13976
  },
13977
13977
 
13978
+ /**
13979
+ * Mobile breakpoint for responsive design.
13980
+ * @private
13981
+ */
13982
+ mobileBreakpoint: {
13983
+ type: Number,
13984
+ reflect: false
13985
+ },
13986
+
13978
13987
  /**
13979
13988
  * @private
13980
13989
  */
@@ -28723,11 +28732,21 @@ class AuroDatePicker extends AuroElement$1 {
28723
28732
  this.dropdown.addEventListener('auroDropdown-toggled', () => {
28724
28733
  this.notifyDatepickerToggled();
28725
28734
 
28735
+ // This forces the calendar to render when the dropdown is opened.
28736
+ // It is not rendered by default
28726
28737
  this.calendar.visible = this.dropdown.isPopoverVisible;
28727
28738
 
28728
- if (this.dropdown.getAttribute('data-show') && this.forceScrollOnNextMobileCalendarRender) {
28729
- this.calendar.scrollMonthIntoView(this.formattedFocusDate);
28730
- this.forceScrollOnNextMobileCalendarRender = false;
28739
+ // If on mobile, and the calendar is opened, scroll the focus date into view if the flag is set
28740
+ if (this.dropdown.isPopoverVisible && this.forceScrollOnNextMobileCalendarRender) {
28741
+
28742
+ // Since the calendar is not rendered until the dropdown is opened,
28743
+ // and the auroDropdown-toggled event fires before the popover is actually open,
28744
+ // we need to wait until the next frame to ensure the calendar is fully rendered
28745
+ // and the area we're trying to scroll to is present in the DOM.
28746
+ setTimeout(() => {
28747
+ this.calendar.scrollMonthIntoView(this.formattedFocusDate);
28748
+ this.forceScrollOnNextMobileCalendarRender = false;
28749
+ }, 0);
28731
28750
  }
28732
28751
  });
28733
28752
  }
@@ -28886,10 +28905,13 @@ class AuroDatePicker extends AuroElement$1 {
28886
28905
  handleReadOnly() {
28887
28906
  // --ds-grid-breakpoint-sm
28888
28907
  const docStyle = getComputedStyle(document.documentElement);
28889
- const mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
28908
+
28909
+ // We need to store this so that we can pass it to calendar
28910
+ this.mobileBreakpoint = Number(docStyle.getPropertyValue('--ds-grid-breakpoint-sm').replace("px", ""));
28911
+ const isMobile = window.innerWidth < this.mobileBreakpoint;
28890
28912
 
28891
28913
  this.inputList.forEach((input) => {
28892
- if (window.innerWidth < mobileBreakpoint) {
28914
+ if (isMobile) {
28893
28915
  input.setAttribute('readonly', true);
28894
28916
  } else {
28895
28917
  input.removeAttribute('readonly');
@@ -29076,6 +29098,9 @@ class AuroDatePicker extends AuroElement$1 {
29076
29098
  if (!this.calendarFocusDate && this.util.validDateStr(this.value, this.format)) {
29077
29099
  if (!this.dropdown.isPopoverVisible) {
29078
29100
  this.calendarFocusDate = this.value;
29101
+
29102
+ // Let the calendar know to scroll to the focus date when it is next rendered on mobile
29103
+ this.forceScrollOnNextMobileCalendarRender = true;
29079
29104
  }
29080
29105
  }
29081
29106
 
@@ -29698,6 +29723,7 @@ class AuroDatePicker extends AuroElement$1 {
29698
29723
  .maxDate="${this.maxDate}"
29699
29724
  .minDate="${this.minDate}"
29700
29725
  .monthNames="${this.monthNames}"
29726
+ .mobileBreakpoint="${this.mobileBreakpoint}"
29701
29727
  part="calendar"
29702
29728
  >
29703
29729
  <slot name="ariaLabel.bib.close" slot="ariaLabel.close" @slotchange="${this.handleSlotToSlot}">Close</slot>
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem-dev/auro-formkit",
3
- "version": "0.0.0-pr1156.1",
3
+ "version": "0.0.0-pr1160.0",
4
4
  "description": "A collection of web components used to build forms.",
5
5
  "homepage": "https://github.com/AlaskaAirlines/auro-formkit#readme",
6
6
  "bugs": {