@aurodesignsystem/auro-formkit 5.1.0-rc-1115.1 → 5.1.0-rc-1134.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.
@@ -27948,6 +27948,7 @@ class AuroDatePicker extends AuroElement$1 {
27948
27948
 
27949
27949
  this.touched = false;
27950
27950
  this.disabled = false;
27951
+ this.dvInputOnly = false;
27951
27952
  this.required = false;
27952
27953
  this.onDark = false;
27953
27954
  this.range = false;
@@ -27990,6 +27991,26 @@ class AuroDatePicker extends AuroElement$1 {
27990
27991
  */
27991
27992
  this.dateSlotContent = [];
27992
27993
 
27994
+ /**
27995
+ * @private
27996
+ */
27997
+ this.hasDisplayValueContent = true;
27998
+
27999
+ /**
28000
+ * @private
28001
+ */
28002
+ this.hasFocus = false;
28003
+
28004
+ /**
28005
+ * @private
28006
+ */
28007
+ this.hasValue = false;
28008
+
28009
+ /**
28010
+ * @private
28011
+ */
28012
+ this.hasAllValues = false;
28013
+
27993
28014
  /**
27994
28015
  * @private
27995
28016
  */
@@ -28108,6 +28129,14 @@ class AuroDatePicker extends AuroElement$1 {
28108
28129
  reflect: true
28109
28130
  },
28110
28131
 
28132
+ /**
28133
+ * If defined, the display value slot content will only mask the HTML5 input element. The input's label will not be masked.
28134
+ */
28135
+ dvInputOnly: {
28136
+ type: Boolean,
28137
+ reflect: true
28138
+ },
28139
+
28111
28140
  /**
28112
28141
  * When defined, sets persistent validity to `customError` and sets the validation message to the attribute value.
28113
28142
  */
@@ -28129,6 +28158,14 @@ class AuroDatePicker extends AuroElement$1 {
28129
28158
  reflect: false,
28130
28159
  },
28131
28160
 
28161
+ /**
28162
+ * @private
28163
+ */
28164
+ hasAllValues: {
28165
+ type: Boolean,
28166
+ reflect: false
28167
+ },
28168
+
28132
28169
  /**
28133
28170
  * Specifies the date format. The default is `mm/dd/yyyy`.
28134
28171
  */
@@ -28418,6 +28455,88 @@ class AuroDatePicker extends AuroElement$1 {
28418
28455
  return [];
28419
28456
  }
28420
28457
 
28458
+ /**
28459
+ * Whether the label is being hidden currently based on state.
28460
+ * @returns {boolean} - Returns true if the label is hidden.
28461
+ * @private
28462
+ */
28463
+ get labelHidden() {
28464
+ return this.hasDisplayValueContent && this.dvInputOnly && !this.hasFocus && this.hasAllValues;
28465
+ }
28466
+
28467
+ /**
28468
+ * Whether the displayValue container is being hidden currently based on state.
28469
+ * @returns {boolean} - Returns true if the label is hidden.
28470
+ * @private
28471
+ */
28472
+ get dvHidden() {
28473
+ return !this.hasDisplayValueContent || this.hasFocus || !this.hasAllValues;
28474
+ }
28475
+
28476
+ /**
28477
+ * Returns the input font class based on layout and visibility state.
28478
+ * @private
28479
+ * @returns {string} - The font class for the input.
28480
+ */
28481
+ get displayValueFontClass() {
28482
+ if (this.layout.startsWith('emphasized')) {
28483
+ let typeSize = 'accent-xl';
28484
+
28485
+ if (this.hasDisplayValueContent) {
28486
+ if (!this.hasValue) {
28487
+ typeSize = 'body-sm';
28488
+ }
28489
+ } else if (this.noFocusOrValue) {
28490
+ typeSize = 'body-sm';
28491
+ }
28492
+
28493
+ return typeSize;
28494
+ }
28495
+
28496
+ if (this.layout === 'snowflake') {
28497
+ // same for both hidden and visible
28498
+ return 'body-lg';
28499
+ }
28500
+
28501
+ // edge case for enabling visual overrides in datepicker
28502
+ if (this.layout === 'classic' && this.shape === 'snowflake') {
28503
+ return 'body-lg';
28504
+ }
28505
+
28506
+ // classic layout (default) - same for both hidden and visible
28507
+ return 'body-default';
28508
+ }
28509
+
28510
+ get commonDisplayValueWrapperClasses() {
28511
+ return {
28512
+ 'displayValueWrapper': true,
28513
+ 'util_displayHiddenVisually': this.dvHidden,
28514
+ [this.displayValueFontClass]: true,
28515
+ };
28516
+ }
28517
+
28518
+ /**
28519
+ * Function to determine if there is any displayValue content to render.
28520
+ * @private
28521
+ * @returns {void}
28522
+ */
28523
+ checkDisplayValueSlotChange() {
28524
+ let nodes = this.shadowRoot.querySelector('slot[name="displayValue"]').assignedNodes();
28525
+
28526
+ // Handle when DisplayValue is multi-level slot content (e.g. combobox passing displayValue to input)
28527
+ if (nodes && nodes[0] && nodes[0].tagName === 'SLOT') {
28528
+ nodes = nodes[0].assignedNodes();
28529
+ }
28530
+
28531
+ let hasContent = false;
28532
+
28533
+ if (nodes.length > 0) {
28534
+ hasContent = true;
28535
+ }
28536
+
28537
+ this.hasDisplayValueContent = hasContent;
28538
+ }
28539
+
28421
28540
  /**
28422
28541
  * Force the calendar view to the focus date when it changes.
28423
28542
  * @private
@@ -28848,11 +28967,13 @@ class AuroDatePicker extends AuroElement$1 {
28848
28967
  setHasValue() {
28849
28968
  if (!this.range) {
28850
28969
  this.hasValue = this.value && this.value.length > 0;
28970
+ this.hasAllValues = this.hasValue;
28851
28971
  return;
28852
28972
  }
28853
28973
 
28854
28974
  // eslint-disable-next-line no-extra-parens
28855
28975
  this.hasValue = (this.value && this.value.length > 0) || (this.valueEnd && this.valueEnd.length > 0);
28976
+ this.hasAllValues = (this.value && this.value.length > 0) && (this.valueEnd && this.valueEnd.length > 0); // eslint-disable-line no-extra-parens
28856
28977
  }
28857
28978
 
28858
28979
  get hasError() {
@@ -29158,21 +29279,23 @@ class AuroDatePicker extends AuroElement$1 {
29158
29279
  */
29159
29280
  renderSnowflakeLayout() {
29160
29281
  const accentsClassMap = {
29161
- error: this.hasError
29282
+ 'error': this.hasError
29162
29283
  };
29163
29284
 
29164
29285
  const inputSectionClassMap = {
29165
- inputSection: true,
29286
+ 'inputSection': true,
29166
29287
 
29167
- hasValue: this.hasValue,
29168
- hasFocus: this.hasFocus,
29288
+ 'hasValue': this.hasValue,
29289
+ 'hasFocus': this.hasFocus,
29290
+ 'util_displayHiddenVisually': !this.dvHidden
29169
29291
  };
29170
29292
 
29171
29293
  const labelClassMap = {
29172
- mainLabel: true,
29294
+ 'mainLabel': true,
29173
29295
 
29174
- hasValue: this.hasValue,
29175
- hasFocus: this.hasFocus,
29296
+ 'hasValue': this.hasValue,
29297
+ 'hasFocus': this.hasFocus,
29298
+ 'util_displayHiddenVisually': this.labelHidden,
29176
29299
  [this.hasFocus || this.hasValue ? 'body-xs' : 'body-lg']: true,
29177
29300
  };
29178
29301
 
@@ -29190,6 +29313,13 @@ class AuroDatePicker extends AuroElement$1 {
29190
29313
  <div class="${classMap(inputSectionClassMap)}" part="inputSection">
29191
29314
  ${this.renderHtmlInputs()}
29192
29315
  </div>
29316
+ <div class="${classMap(this.commonDisplayValueWrapperClasses)}">
29317
+ <slot name="displayValue" @slotchange=${this.checkDisplayValueSlotChange}>
29318
+ <span>
29319
+ ${this.formatShortDate(this.value)}${this.range ? html$1`–${this.formatShortDate(this.valueEnd)}` : undefined}
29320
+ </span>
29321
+ </slot>
29322
+ </div>
29193
29323
  </div>
29194
29324
  <div class="accents right ${classMap(accentsClassMap)}">
29195
29325
  ${this.hasError
@@ -959,9 +959,8 @@ class AuroMenu extends AuroElement$1 {
959
959
  /**
960
960
  * Handles slot change events.
961
961
  * @private
962
- * @param {Event} evt - Event object from the browser.
963
962
  */
964
- handleSlotChange(evt) {
963
+ handleSlotChange() {
965
964
  if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
966
965
  this.rootMenu = false;
967
966
  }
@@ -976,15 +975,6 @@ class AuroMenu extends AuroElement$1 {
976
975
  ]
977
976
  ]));
978
977
  }
979
-
980
- if (this.value) {
981
- this.items.forEach((opt) => {
982
- if (opt.value === this.value || (this.multiSelect && this.formattedValue.includes(opt.value))) {
983
- this.handleSelectState(opt);
984
- this.notifySelectionChange(evt.type);
985
- }
986
- });
987
- }
988
978
  }
989
979
 
990
980
  /**
@@ -919,9 +919,8 @@ class AuroMenu extends AuroElement$1 {
919
919
  /**
920
920
  * Handles slot change events.
921
921
  * @private
922
- * @param {Event} evt - Event object from the browser.
923
922
  */
924
- handleSlotChange(evt) {
923
+ handleSlotChange() {
925
924
  if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
926
925
  this.rootMenu = false;
927
926
  }
@@ -936,15 +935,6 @@ class AuroMenu extends AuroElement$1 {
936
935
  ]
937
936
  ]));
938
937
  }
939
-
940
- if (this.value) {
941
- this.items.forEach((opt) => {
942
- if (opt.value === this.value || (this.multiSelect && this.formattedValue.includes(opt.value))) {
943
- this.handleSelectState(opt);
944
- this.notifySelectionChange(evt.type);
945
- }
946
- });
947
- }
948
938
  }
949
939
 
950
940
  /**
@@ -118,7 +118,6 @@ export class AuroMenu extends AuroElement {
118
118
  /**
119
119
  * Handles slot change events.
120
120
  * @private
121
- * @param {Event} evt - Event object from the browser.
122
121
  */
123
122
  private handleSlotChange;
124
123
  /**
@@ -926,9 +926,8 @@ class AuroMenu extends AuroElement$1 {
926
926
  /**
927
927
  * Handles slot change events.
928
928
  * @private
929
- * @param {Event} evt - Event object from the browser.
930
929
  */
931
- handleSlotChange(evt) {
930
+ handleSlotChange() {
932
931
  if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
933
932
  this.rootMenu = false;
934
933
  }
@@ -943,15 +942,6 @@ class AuroMenu extends AuroElement$1 {
943
942
  ]
944
943
  ]));
945
944
  }
946
-
947
- if (this.value) {
948
- this.items.forEach((opt) => {
949
- if (opt.value === this.value || (this.multiSelect && this.formattedValue.includes(opt.value))) {
950
- this.handleSelectState(opt);
951
- this.notifySelectionChange(evt.type);
952
- }
953
- });
954
- }
955
945
  }
956
946
 
957
947
  /**
@@ -885,9 +885,8 @@ class AuroMenu extends AuroElement$1 {
885
885
  /**
886
886
  * Handles slot change events.
887
887
  * @private
888
- * @param {Event} evt - Event object from the browser.
889
888
  */
890
- handleSlotChange(evt) {
889
+ handleSlotChange() {
891
890
  if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
892
891
  this.rootMenu = false;
893
892
  }
@@ -902,15 +901,6 @@ class AuroMenu extends AuroElement$1 {
902
901
  ]
903
902
  ]));
904
903
  }
905
-
906
- if (this.value) {
907
- this.items.forEach((opt) => {
908
- if (opt.value === this.value || (this.multiSelect && this.formattedValue.includes(opt.value))) {
909
- this.handleSelectState(opt);
910
- this.notifySelectionChange(evt.type);
911
- }
912
- });
913
- }
914
904
  }
915
905
 
916
906
  /**
@@ -9931,9 +9931,8 @@ class AuroMenu extends AuroElement$4 {
9931
9931
  /**
9932
9932
  * Handles slot change events.
9933
9933
  * @private
9934
- * @param {Event} evt - Event object from the browser.
9935
9934
  */
9936
- handleSlotChange(evt) {
9935
+ handleSlotChange() {
9937
9936
  if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
9938
9937
  this.rootMenu = false;
9939
9938
  }
@@ -9948,15 +9947,6 @@ class AuroMenu extends AuroElement$4 {
9948
9947
  ]
9949
9948
  ]));
9950
9949
  }
9951
-
9952
- if (this.value) {
9953
- this.items.forEach((opt) => {
9954
- if (opt.value === this.value || (this.multiSelect && this.formattedValue.includes(opt.value))) {
9955
- this.handleSelectState(opt);
9956
- this.notifySelectionChange(evt.type);
9957
- }
9958
- });
9959
- }
9960
9950
  }
9961
9951
 
9962
9952
  /**
@@ -9839,9 +9839,8 @@ class AuroMenu extends AuroElement$4 {
9839
9839
  /**
9840
9840
  * Handles slot change events.
9841
9841
  * @private
9842
- * @param {Event} evt - Event object from the browser.
9843
9842
  */
9844
- handleSlotChange(evt) {
9843
+ handleSlotChange() {
9845
9844
  if (this.parentElement && this.parentElement.closest('auro-menu, [auro-menu]')) {
9846
9845
  this.rootMenu = false;
9847
9846
  }
@@ -9856,15 +9855,6 @@ class AuroMenu extends AuroElement$4 {
9856
9855
  ]
9857
9856
  ]));
9858
9857
  }
9859
-
9860
- if (this.value) {
9861
- this.items.forEach((opt) => {
9862
- if (opt.value === this.value || (this.multiSelect && this.formattedValue.includes(opt.value))) {
9863
- this.handleSelectState(opt);
9864
- this.notifySelectionChange(evt.type);
9865
- }
9866
- });
9867
- }
9868
9858
  }
9869
9859
 
9870
9860
  /**
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aurodesignsystem/auro-formkit",
3
- "version": "5.1.0-rc-1115.1",
3
+ "version": "5.1.0-rc-1134.1",
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": {