@aurodesignsystem-dev/auro-formkit 0.0.0-pr784.0 → 0.0.0-pr785.1

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.
Files changed (41) hide show
  1. package/components/checkbox/demo/api.min.js +5 -16
  2. package/components/checkbox/demo/index.min.js +5 -16
  3. package/components/checkbox/dist/index.js +5 -16
  4. package/components/checkbox/dist/registered.js +5 -16
  5. package/components/combobox/demo/api.md +0 -1
  6. package/components/combobox/demo/api.min.js +29 -61
  7. package/components/combobox/demo/index.min.js +29 -61
  8. package/components/combobox/dist/auro-combobox.d.ts +0 -5
  9. package/components/combobox/dist/index.js +29 -61
  10. package/components/combobox/dist/registered.js +29 -61
  11. package/components/counter/demo/api.min.js +19 -24
  12. package/components/counter/demo/index.min.js +19 -24
  13. package/components/counter/dist/index.js +19 -24
  14. package/components/counter/dist/registered.js +19 -24
  15. package/components/datepicker/demo/api.md +1 -2
  16. package/components/datepicker/demo/api.min.js +87 -61
  17. package/components/datepicker/demo/index.min.js +87 -61
  18. package/components/datepicker/dist/auro-datepicker.d.ts +18 -6
  19. package/components/datepicker/dist/index.js +87 -61
  20. package/components/datepicker/dist/registered.js +87 -61
  21. package/components/dropdown/demo/api.md +7 -6
  22. package/components/dropdown/demo/api.min.js +14 -8
  23. package/components/dropdown/demo/index.min.js +14 -8
  24. package/components/dropdown/dist/auro-dropdown.d.ts +1 -0
  25. package/components/dropdown/dist/index.js +14 -8
  26. package/components/dropdown/dist/registered.js +14 -8
  27. package/components/input/demo/api.md +1 -2
  28. package/components/input/demo/api.min.js +7 -25
  29. package/components/input/demo/index.min.js +7 -25
  30. package/components/input/dist/base-input.d.ts +1 -5
  31. package/components/input/dist/index.js +7 -25
  32. package/components/input/dist/registered.js +7 -25
  33. package/components/radio/demo/api.min.js +5 -16
  34. package/components/radio/demo/index.min.js +5 -16
  35. package/components/radio/dist/index.js +5 -16
  36. package/components/radio/dist/registered.js +5 -16
  37. package/components/select/demo/api.min.js +19 -24
  38. package/components/select/demo/index.min.js +19 -24
  39. package/components/select/dist/index.js +19 -24
  40. package/components/select/dist/registered.js +19 -24
  41. package/package.json +2 -2
@@ -710,24 +710,13 @@ let AuroFormValidation$1 = class AuroFormValidation {
710
710
  this.getInputElements(elem);
711
711
  this.getAuroInputs(elem);
712
712
 
713
- // Check if validation should run
713
+ // Validate only if noValidate is not true and the input does not have focus
714
714
  let validationShouldRun =
715
-
716
- // If the validation was forced
717
715
  force ||
718
-
719
- // If the validation should run on input
720
- elem.validateOnInput ||
721
-
722
- // State-based checks
723
- (
724
- // Element is not currently focused
725
- !elem.contains(document.activeElement) && // native input is not focused directly
726
- !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
727
-
728
- // And element has been touched or is untouched but has a value
729
- ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
730
- );
716
+ (!elem.contains(document.activeElement) &&
717
+ (elem.touched ||
718
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
719
+ elem.validateOnInput;
731
720
 
732
721
  if (elem.hasAttribute('error')) {
733
722
  elem.validity = 'customError';
@@ -1268,9 +1257,9 @@ var shapeSizeCss$2 = css`.wrapper{overflow:hidden}.shape-classic-xl,.shape-class
1268
1257
 
1269
1258
  var classicLayoutColor = css``;
1270
1259
 
1271
- var snowflakeStyle = css`.accents{flex-grow:0;flex-shrink:0;display:flex;align-items:center;justify-content:center}.accents.left{padding-right:var(--ds-size-100, 0.5rem)}.accents.right{width:var(--ds-size-400, 2rem)}.mainContent{height:100%;max-height:100%;flex-grow:1;display:flex;flex-direction:column;justify-content:center;align-items:center}.inputSection{display:flex;flex-direction:row;align-items:center;width:100%;max-width:250px;margin:0 auto}.inputSection:not(:is(.disabled,.hasFocus,.hasValue)) .inputDivider{display:none}.inputContainer{display:flex;flex-direction:row;align-items:center;width:100%}.inputContainer:first-of-type{justify-content:flex-end}.inputContainer:last-of-type{justify-content:flex-start}:host([disabled]) .inputSection{display:none}:host([layout*=snowflake]) [auro-input]{flex:1;text-align:center}:host([layout*=snowflake]) [auro-input]::part(label),:host([layout*=snowflake]) [auro-input]::part(accent-left),:host([layout*=snowflake]) [auro-input]::part(accent-right){display:none}:host([layout*=snowflake]) [auro-input]::part(input){padding-bottom:unset;text-align:center;font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);transition:unset}:host([layout*=snowflake]) [auro-input]::part(wrapper){min-height:unset;max-height:unset;box-shadow:unset}:host([layout*=snowflake]) [auro-input]::part(wrapper) .mainContent{padding-bottom:unset}:host([layout*=snowflake]) [auro-input]::part(inputHelpText){display:none}:host([layout*=snowflake]) [auro-dropdown]::part(trigger){width:100%}:host([layout*=snowflake]) .dpTriggerContent{width:100%}:host([layout*=snowflake]) .wrapper{height:60px;width:calc(100% - 48px);display:flex;flex-direction:row;justify-content:space-between;padding-left:24px;padding-right:24px}:host([layout*=snowflake]) label{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);font-weight:450;letter-spacing:0}:host([layout*=snowflake]) label.hasFocus,:host([layout*=snowflake]) label.hasValue{font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:var(--ds-text-body-height-xs, 1rem)}:host([layout*=snowflake]) .inputDivider{height:18px;margin:4px 12px;width:2px}`;
1260
+ var snowflakeStyle = css`.accents{flex-grow:0;flex-shrink:0;display:flex;align-items:center;justify-content:center}.accents.left{padding-right:var(--ds-size-100, 0.5rem)}.accents.right{width:var(--ds-size-400, 2rem)}.mainContent{height:100%;max-height:100%;flex-grow:1;display:flex;flex-direction:column;justify-content:center;align-items:center}.inputSection{display:flex;flex-direction:row;align-items:center;width:100%;max-width:250px;margin:0 auto}.inputSection:not(:is(.disabled,.hasFocus,.hasValue)) .inputDivider{display:none}.inputContainer{display:flex;flex-direction:row;align-items:center;width:100%}.inputContainer:first-of-type{justify-content:flex-end}.inputContainer:last-of-type{justify-content:flex-start}:host([disabled]) .inputSection{display:none}:host([layout*=snowflake]) [auro-input]{flex:1;text-align:center}:host([layout*=snowflake]) [auro-input]::part(label),:host([layout*=snowflake]) [auro-input]::part(accent-left),:host([layout*=snowflake]) [auro-input]::part(accent-right){display:none}:host([layout*=snowflake]) [auro-input]::part(input){padding-bottom:unset;text-align:center;font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);transition:unset}:host([layout*=snowflake]) [auro-input]::part(wrapper){min-height:unset;max-height:unset;box-shadow:unset}:host([layout*=snowflake]) [auro-input]::part(wrapper) .mainContent{padding-bottom:unset}:host([layout*=snowflake]) [auro-input]::part(inputHelpText){display:none}:host([layout*=snowflake]) [auro-input]::part(displayValue){justify-content:center;font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem)}:host([layout*=snowflake]) [auro-dropdown]::part(trigger){width:100%}:host([layout*=snowflake]) .dpTriggerContent{width:100%}:host([layout*=snowflake]) .wrapper{height:60px;width:calc(100% - 48px);display:flex;flex-direction:row;justify-content:space-between;padding-left:24px;padding-right:24px}:host([layout*=snowflake]) label{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);font-weight:450;letter-spacing:0}:host([layout*=snowflake]) label.hasFocus,:host([layout*=snowflake]) label.hasValue{font-size:var(--ds-text-body-size-xs, 0.75rem);line-height:var(--ds-text-body-height-xs, 1rem)}:host([layout*=snowflake]) .inputDivider{height:18px;margin:4px 12px;width:2px}`;
1272
1261
 
1273
- var snowflakeColors = css`:host([layout=snowflake])[disabled] .mainContent label ::slotted(*){color:var(--ds-auro-icon-color)}:host([layout=snowflake]) label{color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([layout=snowflake]) .inputDivider{background-color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([layout=snowflake]) .error{color:var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host([layout=snowflake]) [auro-input]::part(input)::placeholder{color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([layout=snowflake]) [auro-dropdown]:not(:is([error],.hasFocus))::part(wrapper){--ds-auro-dropdown-trigger-border-color: transparent}`;
1262
+ var snowflakeColors = css`:host([layout=snowflake])[disabled] .mainContent label ::slotted(*){color:var(--ds-auro-icon-color)}:host([layout=snowflake]) label{color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([layout=snowflake]) .inputDivider{background-color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([layout=snowflake]) .error{color:var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host([layout=snowflake]) [auro-input]::part(input)::placeholder{color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}:host([layout=snowflake]) [auro-input]::part(displayValue){background-color:inherit}:host([layout=snowflake]) [auro-dropdown]:not(:is([error],.hasFocus))::part(wrapper){--ds-auro-dropdown-trigger-border-color: transparent}`;
1274
1263
 
1275
1264
  var styleCss$d = css`:host{--calendar-width: 336px;--mobile-footer-height: 150px;--mobile-header-height: 68px;height:100vh;height:100dvh}.calendars{display:flex;flex-direction:row}.calendarNavButtons{position:absolute;top:var(--ds-size-200, 1rem);right:var(--ds-size-50, 0.25rem);left:var(--ds-size-50, 0.25rem)}.calendarNavBtn{display:flex;width:var(--ds-size-500, 2.5rem);height:var(--ds-size-500, 2.5rem);align-items:center;justify-content:center;border-width:1px;border-style:solid;border-radius:50%;cursor:pointer}.prevMonth,.nextMonth{position:absolute;top:0}.prevMonth{left:0}.nextMonth{right:0}.headerActions{padding:0 var(--ds-size-200, 1rem)}.mobileHeader{width:100%;height:var(--mobile-header-height);z-index:1;align-items:center;flex-direction:row}.headerDateFrom{display:flex;height:var(--mobile-header-height);flex:1;flex-direction:column;justify-content:center;padding:0 var(--ds-size-150, 0.75rem) 0 var(--ds-size-200, 1rem)}.mobileDateLabel{font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}.headerDateTo{height:calc(var(--mobile-header-height) - var(--ds-size-300, 1.5rem));padding:var(--ds-size-300, 1.5rem) var(--ds-size-100, 0.5rem) 0 var(--ds-size-200, 1rem)}:host(:not([noRange])) .headerDateTo{position:relative;display:flex;flex:1;flex-direction:column;justify-content:center}:host(:not([noRange])) .headerDateTo:after{position:absolute;top:calc(50% + 10px);left:0;display:block;width:1px;height:var(--ds-size-300, 1.5rem);content:"";transform:translateY(-50%)}.mobileFooter{display:none;width:100%;align-items:flex-end;flex-direction:column;justify-content:flex-end}.mobileFooterActions{position:relative;bottom:0;left:50%;display:none;width:calc(100% - var(--ds-size-200, 1rem)*2);align-items:flex-end;flex-direction:column;justify-content:flex-end;padding:var(--ds-size-150) calc(var(--ds-size-200, 1rem));transform:translateX(-50%)}.mobileFooterActions auro-button{width:100%}:host([isfullscreen]){width:100%;max-height:100dvh;overflow:hidden}:host([isfullscreen]) .prevMonth,:host([isfullscreen]) .nextMonth{display:none}:host([isfullscreen]) .mobileHeader,:host([isfullscreen]) .mobileFooter,:host([isfullscreen]) .mobileFooterActions{display:flex}:host([isfullscreen]) .calendarWrapper{display:flex;flex-direction:column}:host([isfullscreen]) .calendars{display:flex;flex-direction:column;flex:1;align-items:center;width:100%;overscroll-behavior:contain}:host([isfullscreen]) .calendars:after{display:block;width:100%;height:var(--mobile-footer-height);content:""}`;
1276
1265
 
@@ -15806,7 +15795,7 @@ class AuroFloatingUI {
15806
15795
  */
15807
15796
  mirrorSize() {
15808
15797
  // mirror the boxsize from bibSizer
15809
- if (this.element.bibSizer) {
15798
+ if (this.element.bibSizer && this.element.matchWidth) {
15810
15799
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
15811
15800
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
15812
15801
  if (sizerStyle.width !== '0px') {
@@ -16018,7 +16007,7 @@ class AuroFloatingUI {
16018
16007
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
16019
16008
  return;
16020
16009
  }
16021
-
16010
+
16022
16011
  // if fullscreen bib is in fullscreen mode, do not close
16023
16012
  if (this.element.bib.hasAttribute('isfullscreen')) {
16024
16013
  return;
@@ -16206,7 +16195,7 @@ class AuroFloatingUI {
16206
16195
 
16207
16196
  event.preventDefault();
16208
16197
  this.handleClick();
16209
- }
16198
+ }
16210
16199
  break;
16211
16200
  case 'mouseenter':
16212
16201
  if (this.element.hoverToggle) {
@@ -17603,6 +17592,9 @@ class AuroDropdown extends AuroElement$4 {
17603
17592
 
17604
17593
  this.parentBorder = false;
17605
17594
 
17595
+ /** @private */
17596
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
17597
+
17606
17598
  this.privateDefaults();
17607
17599
  }
17608
17600
 
@@ -18036,12 +18028,14 @@ class AuroDropdown extends AuroElement$4 {
18036
18028
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
18037
18029
  this.handleTriggerContentSlotChange();
18038
18030
  }
18031
+ }
18039
18032
 
18040
- if (changedProperties.has('isPopoverVisible')) {
18041
- this.updateFocusTrap();
18042
- if (!this.isPopoverVisible && this.hasFocus) {
18043
- this.trigger.focus();
18044
- }
18033
+ handleDropdownToggle(event) {
18034
+ this.updateFocusTrap();
18035
+ this.isPopoverVisible = event.detail.expanded;
18036
+ const eventType = event.detail.eventType || "unknown";
18037
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
18038
+ this.trigger.focus();
18045
18039
  }
18046
18040
  }
18047
18041
 
@@ -18049,6 +18043,7 @@ class AuroDropdown extends AuroElement$4 {
18049
18043
 
18050
18044
  // Configure the floater to, this will generate the ID for the bib
18051
18045
  this.floater.configure(this, 'auroDropdown');
18046
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
18052
18047
 
18053
18048
  /**
18054
18049
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -23195,24 +23190,13 @@ class AuroFormValidation {
23195
23190
  this.getInputElements(elem);
23196
23191
  this.getAuroInputs(elem);
23197
23192
 
23198
- // Check if validation should run
23193
+ // Validate only if noValidate is not true and the input does not have focus
23199
23194
  let validationShouldRun =
23200
-
23201
- // If the validation was forced
23202
23195
  force ||
23203
-
23204
- // If the validation should run on input
23205
- elem.validateOnInput ||
23206
-
23207
- // State-based checks
23208
- (
23209
- // Element is not currently focused
23210
- !elem.contains(document.activeElement) && // native input is not focused directly
23211
- !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
23212
-
23213
- // And element has been touched or is untouched but has a value
23214
- ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
23215
- );
23196
+ (!elem.contains(document.activeElement) &&
23197
+ (elem.touched ||
23198
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
23199
+ elem.validateOnInput;
23216
23200
 
23217
23201
  if (elem.hasAttribute('error')) {
23218
23202
  elem.validity = 'customError';
@@ -24163,9 +24147,9 @@ class BaseInput extends AuroElement$2 {
24163
24147
  this.inputElement.value = "";
24164
24148
  this.value = "";
24165
24149
  this.labelElement.classList.remove('inputElement-label--sticky');
24166
- this.notifyValueChanged();
24167
24150
  this.focus();
24168
24151
  this.validation.validate(this);
24152
+ this.notifyValueChanged();
24169
24153
  }
24170
24154
 
24171
24155
  /**
@@ -24260,20 +24244,13 @@ class BaseInput extends AuroElement$2 {
24260
24244
  }
24261
24245
 
24262
24246
  /**
24263
- * Resets component to initial state, including resetting the touched state and validity.
24247
+ * Resets component to initial state.
24264
24248
  * @returns {void}
24265
24249
  */
24266
24250
  reset() {
24267
24251
  this.validation.reset(this);
24268
24252
  }
24269
24253
 
24270
- /**
24271
- * Clears the input value
24272
- */
24273
- clear() {
24274
- this.value = undefined;
24275
- }
24276
-
24277
24254
  /**
24278
24255
  * Sets configuration data used elsewhere based on the `type` attribute.
24279
24256
  * @private
@@ -27679,6 +27656,15 @@ class AuroDatePicker extends AuroElement$1 {
27679
27656
  this.layout = 'classic';
27680
27657
  this.shape = 'classic';
27681
27658
  this.size = 'lg';
27659
+
27660
+ /**
27661
+ * @private
27662
+ * @property {boolean} delegatesFocus - Whether the shadow root delegates focus.
27663
+ */
27664
+ this.constructor.shadowRootOptions = {
27665
+ ...LitElement.shadowRootOptions,
27666
+ delegatesFocus: true,
27667
+ };
27682
27668
  }
27683
27669
 
27684
27670
  // This function is to define props used within the scope of this component
@@ -28388,7 +28374,7 @@ class AuroDatePicker extends AuroElement$1 {
28388
28374
  */
28389
28375
  resetValues() {
28390
28376
  this.inputList.forEach((input) => {
28391
- input.clear();
28377
+ input.reset();
28392
28378
  });
28393
28379
  }
28394
28380
 
@@ -28398,15 +28384,8 @@ class AuroDatePicker extends AuroElement$1 {
28398
28384
  */
28399
28385
  reset() {
28400
28386
  this.resetValues();
28401
- this.validation.reset(this);
28402
- }
28403
28387
 
28404
- /**
28405
- * Clears the current value(s) of the datepicker.
28406
- * @returns {void}
28407
- */
28408
- clear() {
28409
- this.resetValues();
28388
+ this.validation.reset(this);
28410
28389
  }
28411
28390
 
28412
28391
  /**
@@ -28423,6 +28402,7 @@ class AuroDatePicker extends AuroElement$1 {
28423
28402
  }
28424
28403
 
28425
28404
  this.hasFocus = true;
28405
+ this.dropdown.show();
28426
28406
 
28427
28407
  // shadowroot active element is null if we focus the datepicker itself
28428
28408
  if (this.shadowRoot.activeElement === null) {
@@ -28746,6 +28726,9 @@ class AuroDatePicker extends AuroElement$1 {
28746
28726
  `;
28747
28727
  }
28748
28728
 
28729
+ /**
28730
+ * @private
28731
+ */
28749
28732
  renderLayoutFromAttributes() {
28750
28733
  switch (this.layout) {
28751
28734
  case 'snowflake':
@@ -28758,6 +28741,43 @@ class AuroDatePicker extends AuroElement$1 {
28758
28741
  }
28759
28742
  }
28760
28743
 
28744
+ // eslint-disable-next-line no-warning-comments
28745
+ // TODO: move this to date utility when time allows :(
28746
+ /**
28747
+ * Simple formatter that ONLY WORKS FOR US DATES.
28748
+ * Returns formatted date like Apr 21 or Dec 25.
28749
+ * @param date
28750
+ * @return {string}
28751
+ */
28752
+ formatShortDate(date) {
28753
+ // should render like Apr 21
28754
+ const options = {
28755
+ month: 'short',
28756
+ day: '2-digit'
28757
+ };
28758
+
28759
+ return new Date(date).toLocaleDateString('en-US', options).replace(',', '');
28760
+ }
28761
+
28762
+ /**
28763
+ * Format and render the provided date value.
28764
+ * @private
28765
+ * @param dateValue
28766
+ * @return {TemplateResult}
28767
+ */
28768
+ renderDisplayTextDate(dateValue) {
28769
+ return html$1`
28770
+ <div>
28771
+ <div class="displayValueText">
28772
+ ${dateValue && this.util.validDateStr(dateValue, this.format)
28773
+ ? this.formatShortDate(dateValue)
28774
+ : undefined
28775
+ }
28776
+ </div>
28777
+ </div>
28778
+ `;
28779
+ }
28780
+
28761
28781
  renderHtmlInputs() {
28762
28782
  const inputClasses = {
28763
28783
  "util_displayHiddenVisually": !this.hasValue && !this.hasFocus
@@ -28773,7 +28793,7 @@ class AuroDatePicker extends AuroElement$1 {
28773
28793
  .max="${this.maxDate}"
28774
28794
  .min="${this.minDate}"
28775
28795
  id="${this.generateRandomString(12)}"
28776
- placeholder="MM/DD"
28796
+ .placeholder="${this.placeholder}"
28777
28797
  simple
28778
28798
  bordered
28779
28799
  noValidate
@@ -28789,6 +28809,9 @@ class AuroDatePicker extends AuroElement$1 {
28789
28809
  setCustomValidityRangeUnderflow="${this.setCustomValidityRangeUnderflow}"
28790
28810
  inputmode="${ifDefined(this.inputmode)}"
28791
28811
  >
28812
+ <span slot="displayValue">
28813
+ ${this.renderDisplayTextDate(this.value)}
28814
+ </span>
28792
28815
  <span slot="label"><slot name="fromLabel"></slot></span>
28793
28816
  </${this.inputTag}>
28794
28817
  </div>
@@ -28819,6 +28842,9 @@ class AuroDatePicker extends AuroElement$1 {
28819
28842
  setCustomValidityRangeUnderflow="${this.setCustomValidityRangeUnderflow}"
28820
28843
  ?disabled="${this.disabled}"
28821
28844
  part="input">
28845
+ <span slot="displayValue">
28846
+ ${this.renderDisplayTextDate(this.valueEnd)}
28847
+ </span>
28822
28848
  <span slot="label"><slot name="toLabel"></slot></span>
28823
28849
  </${this.inputTag}>
28824
28850
  </div>
@@ -35,12 +35,13 @@
35
35
 
36
36
  ## Methods
37
37
 
38
- | Method | Type | Description |
39
- |------------------|------------|--------------------------------------------------|
40
- | [exposeCssParts](#exposeCssParts) | `(): void` | Exposes CSS parts for styling from parent components. |
41
- | [focus](#focus) | `(): void` | When bib is open, focus on the first element inside of bib.<br />If not, trigger element will get focus. |
42
- | [hide](#hide) | `(): void` | Public method to hide the dropdown. |
43
- | [show](#show) | `(): void` | Public method to show the dropdown. |
38
+ | Method | Type | Description |
39
+ |------------------------|----------------------|--------------------------------------------------|
40
+ | [exposeCssParts](#exposeCssParts) | `(): void` | Exposes CSS parts for styling from parent components. |
41
+ | [focus](#focus) | `(): void` | When bib is open, focus on the first element inside of bib.<br />If not, trigger element will get focus. |
42
+ | [handleDropdownToggle](#handleDropdownToggle) | `(event: any): void` | |
43
+ | [hide](#hide) | `(): void` | Public method to hide the dropdown. |
44
+ | [show](#show) | `(): void` | Public method to show the dropdown. |
44
45
 
45
46
  ## Events
46
47
 
@@ -1755,7 +1755,7 @@ class AuroFloatingUI {
1755
1755
  */
1756
1756
  mirrorSize() {
1757
1757
  // mirror the boxsize from bibSizer
1758
- if (this.element.bibSizer) {
1758
+ if (this.element.bibSizer && this.element.matchWidth) {
1759
1759
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1760
1760
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1761
1761
  if (sizerStyle.width !== '0px') {
@@ -1967,7 +1967,7 @@ class AuroFloatingUI {
1967
1967
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1968
1968
  return;
1969
1969
  }
1970
-
1970
+
1971
1971
  // if fullscreen bib is in fullscreen mode, do not close
1972
1972
  if (this.element.bib.hasAttribute('isfullscreen')) {
1973
1973
  return;
@@ -2155,7 +2155,7 @@ class AuroFloatingUI {
2155
2155
 
2156
2156
  event.preventDefault();
2157
2157
  this.handleClick();
2158
- }
2158
+ }
2159
2159
  break;
2160
2160
  case 'mouseenter':
2161
2161
  if (this.element.hoverToggle) {
@@ -3558,6 +3558,9 @@ class AuroDropdown extends AuroElement {
3558
3558
 
3559
3559
  this.parentBorder = false;
3560
3560
 
3561
+ /** @private */
3562
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3563
+
3561
3564
  this.privateDefaults();
3562
3565
  }
3563
3566
 
@@ -3991,12 +3994,14 @@ class AuroDropdown extends AuroElement {
3991
3994
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3992
3995
  this.handleTriggerContentSlotChange();
3993
3996
  }
3997
+ }
3994
3998
 
3995
- if (changedProperties.has('isPopoverVisible')) {
3996
- this.updateFocusTrap();
3997
- if (!this.isPopoverVisible && this.hasFocus) {
3998
- this.trigger.focus();
3999
- }
3999
+ handleDropdownToggle(event) {
4000
+ this.updateFocusTrap();
4001
+ this.isPopoverVisible = event.detail.expanded;
4002
+ const eventType = event.detail.eventType || "unknown";
4003
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
4004
+ this.trigger.focus();
4000
4005
  }
4001
4006
  }
4002
4007
 
@@ -4004,6 +4009,7 @@ class AuroDropdown extends AuroElement {
4004
4009
 
4005
4010
  // Configure the floater to, this will generate the ID for the bib
4006
4011
  this.floater.configure(this, 'auroDropdown');
4012
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
4007
4013
 
4008
4014
  /**
4009
4015
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -1730,7 +1730,7 @@ class AuroFloatingUI {
1730
1730
  */
1731
1731
  mirrorSize() {
1732
1732
  // mirror the boxsize from bibSizer
1733
- if (this.element.bibSizer) {
1733
+ if (this.element.bibSizer && this.element.matchWidth) {
1734
1734
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1735
1735
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1736
1736
  if (sizerStyle.width !== '0px') {
@@ -1942,7 +1942,7 @@ class AuroFloatingUI {
1942
1942
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1943
1943
  return;
1944
1944
  }
1945
-
1945
+
1946
1946
  // if fullscreen bib is in fullscreen mode, do not close
1947
1947
  if (this.element.bib.hasAttribute('isfullscreen')) {
1948
1948
  return;
@@ -2130,7 +2130,7 @@ class AuroFloatingUI {
2130
2130
 
2131
2131
  event.preventDefault();
2132
2132
  this.handleClick();
2133
- }
2133
+ }
2134
2134
  break;
2135
2135
  case 'mouseenter':
2136
2136
  if (this.element.hoverToggle) {
@@ -3533,6 +3533,9 @@ class AuroDropdown extends AuroElement {
3533
3533
 
3534
3534
  this.parentBorder = false;
3535
3535
 
3536
+ /** @private */
3537
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3538
+
3536
3539
  this.privateDefaults();
3537
3540
  }
3538
3541
 
@@ -3966,12 +3969,14 @@ class AuroDropdown extends AuroElement {
3966
3969
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3967
3970
  this.handleTriggerContentSlotChange();
3968
3971
  }
3972
+ }
3969
3973
 
3970
- if (changedProperties.has('isPopoverVisible')) {
3971
- this.updateFocusTrap();
3972
- if (!this.isPopoverVisible && this.hasFocus) {
3973
- this.trigger.focus();
3974
- }
3974
+ handleDropdownToggle(event) {
3975
+ this.updateFocusTrap();
3976
+ this.isPopoverVisible = event.detail.expanded;
3977
+ const eventType = event.detail.eventType || "unknown";
3978
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
3979
+ this.trigger.focus();
3975
3980
  }
3976
3981
  }
3977
3982
 
@@ -3979,6 +3984,7 @@ class AuroDropdown extends AuroElement {
3979
3984
 
3980
3985
  // Configure the floater to, this will generate the ID for the bib
3981
3986
  this.floater.configure(this, 'auroDropdown');
3987
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
3982
3988
 
3983
3989
  /**
3984
3990
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -220,6 +220,7 @@ export class AuroDropdown extends AuroElement {
220
220
  shape: any;
221
221
  size: any;
222
222
  parentBorder: boolean;
223
+ handleDropdownToggle(event: any): void;
223
224
  /**
224
225
  * @private
225
226
  * @returns {object} Class definition for the wrapper element.
@@ -1689,7 +1689,7 @@ class AuroFloatingUI {
1689
1689
  */
1690
1690
  mirrorSize() {
1691
1691
  // mirror the boxsize from bibSizer
1692
- if (this.element.bibSizer) {
1692
+ if (this.element.bibSizer && this.element.matchWidth) {
1693
1693
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1694
1694
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1695
1695
  if (sizerStyle.width !== '0px') {
@@ -1901,7 +1901,7 @@ class AuroFloatingUI {
1901
1901
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1902
1902
  return;
1903
1903
  }
1904
-
1904
+
1905
1905
  // if fullscreen bib is in fullscreen mode, do not close
1906
1906
  if (this.element.bib.hasAttribute('isfullscreen')) {
1907
1907
  return;
@@ -2089,7 +2089,7 @@ class AuroFloatingUI {
2089
2089
 
2090
2090
  event.preventDefault();
2091
2091
  this.handleClick();
2092
- }
2092
+ }
2093
2093
  break;
2094
2094
  case 'mouseenter':
2095
2095
  if (this.element.hoverToggle) {
@@ -3486,6 +3486,9 @@ class AuroDropdown extends AuroElement {
3486
3486
 
3487
3487
  this.parentBorder = false;
3488
3488
 
3489
+ /** @private */
3490
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3491
+
3489
3492
  this.privateDefaults();
3490
3493
  }
3491
3494
 
@@ -3919,12 +3922,14 @@ class AuroDropdown extends AuroElement {
3919
3922
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3920
3923
  this.handleTriggerContentSlotChange();
3921
3924
  }
3925
+ }
3922
3926
 
3923
- if (changedProperties.has('isPopoverVisible')) {
3924
- this.updateFocusTrap();
3925
- if (!this.isPopoverVisible && this.hasFocus) {
3926
- this.trigger.focus();
3927
- }
3927
+ handleDropdownToggle(event) {
3928
+ this.updateFocusTrap();
3929
+ this.isPopoverVisible = event.detail.expanded;
3930
+ const eventType = event.detail.eventType || "unknown";
3931
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
3932
+ this.trigger.focus();
3928
3933
  }
3929
3934
  }
3930
3935
 
@@ -3932,6 +3937,7 @@ class AuroDropdown extends AuroElement {
3932
3937
 
3933
3938
  // Configure the floater to, this will generate the ID for the bib
3934
3939
  this.floater.configure(this, 'auroDropdown');
3940
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
3935
3941
 
3936
3942
  /**
3937
3943
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -1689,7 +1689,7 @@ class AuroFloatingUI {
1689
1689
  */
1690
1690
  mirrorSize() {
1691
1691
  // mirror the boxsize from bibSizer
1692
- if (this.element.bibSizer) {
1692
+ if (this.element.bibSizer && this.element.matchWidth) {
1693
1693
  const sizerStyle = window.getComputedStyle(this.element.bibSizer);
1694
1694
  const bibContent = this.element.bib.shadowRoot.querySelector(".container");
1695
1695
  if (sizerStyle.width !== '0px') {
@@ -1901,7 +1901,7 @@ class AuroFloatingUI {
1901
1901
  if (this.element.contains(activeElement) || this.element.bib?.contains(activeElement)) {
1902
1902
  return;
1903
1903
  }
1904
-
1904
+
1905
1905
  // if fullscreen bib is in fullscreen mode, do not close
1906
1906
  if (this.element.bib.hasAttribute('isfullscreen')) {
1907
1907
  return;
@@ -2089,7 +2089,7 @@ class AuroFloatingUI {
2089
2089
 
2090
2090
  event.preventDefault();
2091
2091
  this.handleClick();
2092
- }
2092
+ }
2093
2093
  break;
2094
2094
  case 'mouseenter':
2095
2095
  if (this.element.hoverToggle) {
@@ -3486,6 +3486,9 @@ class AuroDropdown extends AuroElement {
3486
3486
 
3487
3487
  this.parentBorder = false;
3488
3488
 
3489
+ /** @private */
3490
+ this.handleDropdownToggle = this.handleDropdownToggle.bind(this);
3491
+
3489
3492
  this.privateDefaults();
3490
3493
  }
3491
3494
 
@@ -3919,12 +3922,14 @@ class AuroDropdown extends AuroElement {
3919
3922
  if (changedProperties.size === 0 || changedProperties.has('isPopoverVisible')) {
3920
3923
  this.handleTriggerContentSlotChange();
3921
3924
  }
3925
+ }
3922
3926
 
3923
- if (changedProperties.has('isPopoverVisible')) {
3924
- this.updateFocusTrap();
3925
- if (!this.isPopoverVisible && this.hasFocus) {
3926
- this.trigger.focus();
3927
- }
3927
+ handleDropdownToggle(event) {
3928
+ this.updateFocusTrap();
3929
+ this.isPopoverVisible = event.detail.expanded;
3930
+ const eventType = event.detail.eventType || "unknown";
3931
+ if (!this.isPopoverVisible && this.hasFocus && eventType === "keydown") {
3932
+ this.trigger.focus();
3928
3933
  }
3929
3934
  }
3930
3935
 
@@ -3932,6 +3937,7 @@ class AuroDropdown extends AuroElement {
3932
3937
 
3933
3938
  // Configure the floater to, this will generate the ID for the bib
3934
3939
  this.floater.configure(this, 'auroDropdown');
3940
+ this.addEventListener('auroDropdown-toggled', this.handleDropdownToggle);
3935
3941
 
3936
3942
  /**
3937
3943
  * @description Let subscribers know that the dropdown ID ha been generated and added.
@@ -60,9 +60,8 @@ Generate unique names for dependency components.
60
60
 
61
61
  | Method | Type | Description |
62
62
  |------------|----------------------------------------|--------------------------------------------------|
63
- | [clear](#clear) | `(): void` | Clears the input value |
64
63
  | [focus](#focus) | `(): void` | Function to set element focus. |
65
- | [reset](#reset) | `(): void` | Resets component to initial state, including resetting the touched state and validity. |
64
+ | [reset](#reset) | `(): void` | Resets component to initial state. |
66
65
  | [validate](#validate) | `(force?: boolean \| undefined): void` | Validates value.<br /><br />**force**: Whether to force validation. |
67
66
 
68
67
  ## Events
@@ -4847,24 +4847,13 @@ class AuroFormValidation {
4847
4847
  this.getInputElements(elem);
4848
4848
  this.getAuroInputs(elem);
4849
4849
 
4850
- // Check if validation should run
4850
+ // Validate only if noValidate is not true and the input does not have focus
4851
4851
  let validationShouldRun =
4852
-
4853
- // If the validation was forced
4854
4852
  force ||
4855
-
4856
- // If the validation should run on input
4857
- elem.validateOnInput ||
4858
-
4859
- // State-based checks
4860
- (
4861
- // Element is not currently focused
4862
- !elem.contains(document.activeElement) && // native input is not focused directly
4863
- !document.activeElement.shadowRoot?.contains(elem) && // native input is not focused in the shadow DOM of another component
4864
-
4865
- // And element has been touched or is untouched but has a value
4866
- ( elem.touched || (!elem.touched && typeof elem.value !== "undefined") )
4867
- );
4853
+ (!elem.contains(document.activeElement) &&
4854
+ (elem.touched ||
4855
+ (!elem.touched && typeof elem.value !== "undefined"))) ||
4856
+ elem.validateOnInput;
4868
4857
 
4869
4858
  if (elem.hasAttribute('error')) {
4870
4859
  elem.validity = 'customError';
@@ -5815,9 +5804,9 @@ class BaseInput extends AuroElement$2 {
5815
5804
  this.inputElement.value = "";
5816
5805
  this.value = "";
5817
5806
  this.labelElement.classList.remove('inputElement-label--sticky');
5818
- this.notifyValueChanged();
5819
5807
  this.focus();
5820
5808
  this.validation.validate(this);
5809
+ this.notifyValueChanged();
5821
5810
  }
5822
5811
 
5823
5812
  /**
@@ -5912,20 +5901,13 @@ class BaseInput extends AuroElement$2 {
5912
5901
  }
5913
5902
 
5914
5903
  /**
5915
- * Resets component to initial state, including resetting the touched state and validity.
5904
+ * Resets component to initial state.
5916
5905
  * @returns {void}
5917
5906
  */
5918
5907
  reset() {
5919
5908
  this.validation.reset(this);
5920
5909
  }
5921
5910
 
5922
- /**
5923
- * Clears the input value
5924
- */
5925
- clear() {
5926
- this.value = undefined;
5927
- }
5928
-
5929
5911
  /**
5930
5912
  * Sets configuration data used elsewhere based on the `type` attribute.
5931
5913
  * @private