@aurodesignsystem/auro-formkit 3.5.0 → 4.0.0-rc-658.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.
- package/CHANGELOG.md +40 -1
- package/components/checkbox/README.md +1 -1
- package/components/checkbox/demo/api.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/demo/readme.md +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/README.md +1 -1
- package/components/combobox/demo/api.md +27 -27
- package/components/combobox/demo/api.min.js +63 -275
- package/components/combobox/demo/index.html +1 -0
- package/components/combobox/demo/index.min.js +61 -273
- package/components/combobox/demo/readme.md +1 -1
- package/components/combobox/dist/auro-combobox.d.ts +5 -10
- package/components/combobox/dist/index.js +22 -149
- package/components/combobox/dist/registered.js +22 -149
- package/components/counter/README.md +1 -1
- package/components/counter/demo/readme.md +1 -1
- package/components/datepicker/README.md +1 -1
- package/components/datepicker/demo/readme.md +1 -1
- package/components/dropdown/README.md +1 -1
- package/components/dropdown/demo/readme.md +1 -1
- package/components/form/README.md +1 -1
- package/components/form/demo/readme.md +1 -1
- package/components/input/README.md +1 -1
- package/components/input/demo/readme.md +1 -1
- package/components/menu/README.md +1 -1
- package/components/menu/demo/api.md +11 -11
- package/components/menu/demo/api.min.js +39 -124
- package/components/menu/demo/index.min.js +39 -124
- package/components/menu/demo/readme.md +1 -1
- package/components/menu/dist/auro-menu-utils.d.ts +0 -8
- package/components/menu/dist/auro-menu.d.ts +3 -8
- package/components/menu/dist/index.d.ts +1 -1
- package/components/menu/dist/index.js +40 -84
- package/components/menu/dist/registered.js +39 -124
- package/components/radio/README.md +1 -1
- package/components/radio/demo/api.md +8 -0
- package/components/radio/demo/api.min.js +13 -5
- package/components/radio/demo/index.min.js +13 -5
- package/components/radio/demo/readme.md +1 -1
- package/components/radio/dist/auro-radio.d.ts +4 -0
- package/components/radio/dist/index.js +13 -5
- package/components/radio/dist/registered.js +13 -5
- package/components/select/README.md +35 -35
- package/components/select/demo/api.md +32 -32
- package/components/select/demo/api.min.js +99 -199
- package/components/select/demo/index.min.js +97 -197
- package/components/select/demo/readme.md +1 -1
- package/components/select/dist/auro-select.d.ts +12 -13
- package/components/select/dist/index.js +57 -72
- package/components/select/dist/registered.js +57 -72
- package/package.json +1 -1
|
@@ -5374,61 +5374,6 @@ function arrayConverter(value) {
|
|
|
5374
5374
|
throw new Error('Invalid value: Input must be an array or undefined');
|
|
5375
5375
|
}
|
|
5376
5376
|
|
|
5377
|
-
/**
|
|
5378
|
-
* Compare two arrays for equality.
|
|
5379
|
-
* @private
|
|
5380
|
-
* @param {Array} arr1 - First array to compare.
|
|
5381
|
-
* @param {Array} arr2 - Second array to compare.
|
|
5382
|
-
* @returns {boolean} True if arrays are equal.
|
|
5383
|
-
*/
|
|
5384
|
-
function arraysAreEqual(arr1, arr2) {
|
|
5385
|
-
// If both arrays undefined, they are equal (true)
|
|
5386
|
-
if (arr1 === undefined || arr2 === undefined) {
|
|
5387
|
-
return arr1 === arr2;
|
|
5388
|
-
}
|
|
5389
|
-
|
|
5390
|
-
// If arrays have different lengths, they are not equal
|
|
5391
|
-
if (arr1.length !== arr2.length) {
|
|
5392
|
-
return false;
|
|
5393
|
-
}
|
|
5394
|
-
|
|
5395
|
-
// If every item at each index is the same, return true
|
|
5396
|
-
for (let index = 0; index < arr1.length; index += 1) {
|
|
5397
|
-
if (arr1[index] !== arr2[index]) {
|
|
5398
|
-
return false;
|
|
5399
|
-
}
|
|
5400
|
-
}
|
|
5401
|
-
return true;
|
|
5402
|
-
}
|
|
5403
|
-
|
|
5404
|
-
/**
|
|
5405
|
-
* Compares array for changes.
|
|
5406
|
-
* @private
|
|
5407
|
-
* @param {Array|any} newVal - New value to compare.
|
|
5408
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
5409
|
-
* @returns {boolean} True if arrays have changed.
|
|
5410
|
-
*/
|
|
5411
|
-
function arrayOrUndefinedHasChanged(newVal, oldVal) {
|
|
5412
|
-
try {
|
|
5413
|
-
// Check if values are undefined or arrays
|
|
5414
|
-
const isArrayOrUndefined = (val) => val === undefined || Array.isArray(val);
|
|
5415
|
-
|
|
5416
|
-
// If non-array or non-undefined, throw error
|
|
5417
|
-
if (!isArrayOrUndefined(newVal) || !isArrayOrUndefined(oldVal)) {
|
|
5418
|
-
const invalidValue = isArrayOrUndefined(newVal) ? oldVal : newVal;
|
|
5419
|
-
throw new Error(`Value must be an array or undefined, received ${typeof invalidValue}`);
|
|
5420
|
-
}
|
|
5421
|
-
|
|
5422
|
-
// Return true if arrays have changed, false if they are the same
|
|
5423
|
-
return !arraysAreEqual(newVal, oldVal);
|
|
5424
|
-
} catch (error) {
|
|
5425
|
-
/* eslint-disable no-console */
|
|
5426
|
-
console.error(error);
|
|
5427
|
-
// If validation fails, it has changed
|
|
5428
|
-
return true;
|
|
5429
|
-
}
|
|
5430
|
-
}
|
|
5431
|
-
|
|
5432
5377
|
css`:host{display:flex;align-items:center;padding:var(--ds-size-50, 0.25rem) var(--ds-size-200, 1rem) var(--ds-size-50, 0.25rem) 0;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}:host ::slotted(strong){font-weight:700}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
5433
5378
|
|
|
5434
5379
|
css`:host{background-color:var(--ds-auro-menuoption-container-color);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected, #01426a);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([selected]):host(:hover),:host([selected]):host(.active){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected-hover, #00274a)}`;
|
|
@@ -5590,7 +5535,7 @@ class AuroSelect extends LitElement {
|
|
|
5590
5535
|
|
|
5591
5536
|
/**
|
|
5592
5537
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
5593
|
-
* Otherwise, Heading 600
|
|
5538
|
+
* Otherwise, Heading 600.
|
|
5594
5539
|
*/
|
|
5595
5540
|
largeFullscreenHeadline: {
|
|
5596
5541
|
type: Boolean,
|
|
@@ -5648,12 +5593,11 @@ class AuroSelect extends LitElement {
|
|
|
5648
5593
|
},
|
|
5649
5594
|
|
|
5650
5595
|
/**
|
|
5651
|
-
* Specifies the current selected menuOption.
|
|
5596
|
+
* Specifies the current selected menuOption. Default type is `HTMLElement`, changing to `Array<HTMLElement>` when `multiSelect` is true.
|
|
5597
|
+
* @type {HTMLElement|Array<HTMLElement>}
|
|
5652
5598
|
*/
|
|
5653
5599
|
optionSelected: {
|
|
5654
|
-
|
|
5655
|
-
converter: arrayConverter,
|
|
5656
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5600
|
+
type: Object
|
|
5657
5601
|
},
|
|
5658
5602
|
|
|
5659
5603
|
/**
|
|
@@ -5723,12 +5667,11 @@ class AuroSelect extends LitElement {
|
|
|
5723
5667
|
},
|
|
5724
5668
|
|
|
5725
5669
|
/**
|
|
5726
|
-
* Value selected for the component.
|
|
5670
|
+
* Value selected for the component. Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
5671
|
+
* @type {String|Array<String>}
|
|
5727
5672
|
*/
|
|
5728
5673
|
value: {
|
|
5729
|
-
|
|
5730
|
-
converter: arrayConverter,
|
|
5731
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5674
|
+
type: Object
|
|
5732
5675
|
},
|
|
5733
5676
|
|
|
5734
5677
|
/**
|
|
@@ -5807,9 +5750,15 @@ class AuroSelect extends LitElement {
|
|
|
5807
5750
|
}
|
|
5808
5751
|
|
|
5809
5752
|
// Handle selected options
|
|
5810
|
-
if (this.optionSelected
|
|
5811
|
-
|
|
5812
|
-
|
|
5753
|
+
if (this.optionSelected) {
|
|
5754
|
+
let displayText = '';
|
|
5755
|
+
|
|
5756
|
+
if (this.multiSelect && this.optionSelected.length > 0) {
|
|
5757
|
+
// Create display text from selected options
|
|
5758
|
+
displayText = this.optionSelected.map((option) => option.textContent).join(', ');
|
|
5759
|
+
} else {
|
|
5760
|
+
displayText = this.optionSelected.textContent;
|
|
5761
|
+
}
|
|
5813
5762
|
|
|
5814
5763
|
const span = document.createElement('span');
|
|
5815
5764
|
span.textContent = displayText;
|
|
@@ -6057,6 +6006,17 @@ class AuroSelect extends LitElement {
|
|
|
6057
6006
|
}
|
|
6058
6007
|
}
|
|
6059
6008
|
|
|
6009
|
+
/**
|
|
6010
|
+
* Resets all options to their default state.
|
|
6011
|
+
* @private
|
|
6012
|
+
*/
|
|
6013
|
+
clearSelection() {
|
|
6014
|
+
this.value = undefined;
|
|
6015
|
+
this.optionSelected = undefined;
|
|
6016
|
+
|
|
6017
|
+
this.menu.multiSelect = this.multiSelect;
|
|
6018
|
+
}
|
|
6019
|
+
|
|
6060
6020
|
/**
|
|
6061
6021
|
* Handle element attributes on update.
|
|
6062
6022
|
* @private
|
|
@@ -6093,13 +6053,20 @@ class AuroSelect extends LitElement {
|
|
|
6093
6053
|
|
|
6094
6054
|
// Set the initial value in auro-menu if defined
|
|
6095
6055
|
if (this.hasAttribute('value') && this.getAttribute('value').length > 0) {
|
|
6056
|
+
this.value = this.multiSelect ? arrayConverter(this.getAttribute('value')) : this.getAttribute('value');
|
|
6096
6057
|
this.menu.value = this.value;
|
|
6097
6058
|
}
|
|
6098
6059
|
}
|
|
6099
6060
|
|
|
6100
6061
|
async updated(changedProperties) {
|
|
6062
|
+
if (changedProperties.has('multiSelect')) {
|
|
6063
|
+
this.clearSelection();
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6101
6066
|
if (changedProperties.has('value')) {
|
|
6102
6067
|
if (this.value) {
|
|
6068
|
+
this.value = this.multiSelect ? arrayConverter(this.value) : this.value;
|
|
6069
|
+
|
|
6103
6070
|
this.menu.value = this.value;
|
|
6104
6071
|
|
|
6105
6072
|
// Wait for menu to finish updating its value
|
|
@@ -6171,8 +6138,23 @@ class AuroSelect extends LitElement {
|
|
|
6171
6138
|
_handleNativeSelectChange(event) {
|
|
6172
6139
|
const selectedOption = event.target.options[event.target.selectedIndex];
|
|
6173
6140
|
const selectedValue = selectedOption.value;
|
|
6174
|
-
|
|
6175
|
-
this.
|
|
6141
|
+
|
|
6142
|
+
if (this.multiSelect) {
|
|
6143
|
+
const currentArray = Array.isArray(this.value) ? this.value : [];
|
|
6144
|
+
|
|
6145
|
+
if (!currentArray.includes(selectedValue)) {
|
|
6146
|
+
this.value = [
|
|
6147
|
+
...currentArray,
|
|
6148
|
+
selectedValue
|
|
6149
|
+
];
|
|
6150
|
+
}
|
|
6151
|
+
} else {
|
|
6152
|
+
const currentValue = this.value;
|
|
6153
|
+
|
|
6154
|
+
if (currentValue !== selectedValue) {
|
|
6155
|
+
this.value = selectedValue;
|
|
6156
|
+
}
|
|
6157
|
+
}
|
|
6176
6158
|
}
|
|
6177
6159
|
|
|
6178
6160
|
/**
|
|
@@ -6185,10 +6167,13 @@ class AuroSelect extends LitElement {
|
|
|
6185
6167
|
if (!nativeSelect) {
|
|
6186
6168
|
return;
|
|
6187
6169
|
}
|
|
6188
|
-
const [value] = this.value || [];
|
|
6189
|
-
nativeSelect.value = value || '';
|
|
6190
|
-
}
|
|
6191
6170
|
|
|
6171
|
+
if (this.multiSelect) {
|
|
6172
|
+
nativeSelect.value = this.value ? this.value[0] : '';
|
|
6173
|
+
} else {
|
|
6174
|
+
nativeSelect.value = this.value || '';
|
|
6175
|
+
}
|
|
6176
|
+
}
|
|
6192
6177
|
|
|
6193
6178
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
6194
6179
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
@@ -5374,61 +5374,6 @@ function arrayConverter(value) {
|
|
|
5374
5374
|
throw new Error('Invalid value: Input must be an array or undefined');
|
|
5375
5375
|
}
|
|
5376
5376
|
|
|
5377
|
-
/**
|
|
5378
|
-
* Compare two arrays for equality.
|
|
5379
|
-
* @private
|
|
5380
|
-
* @param {Array} arr1 - First array to compare.
|
|
5381
|
-
* @param {Array} arr2 - Second array to compare.
|
|
5382
|
-
* @returns {boolean} True if arrays are equal.
|
|
5383
|
-
*/
|
|
5384
|
-
function arraysAreEqual(arr1, arr2) {
|
|
5385
|
-
// If both arrays undefined, they are equal (true)
|
|
5386
|
-
if (arr1 === undefined || arr2 === undefined) {
|
|
5387
|
-
return arr1 === arr2;
|
|
5388
|
-
}
|
|
5389
|
-
|
|
5390
|
-
// If arrays have different lengths, they are not equal
|
|
5391
|
-
if (arr1.length !== arr2.length) {
|
|
5392
|
-
return false;
|
|
5393
|
-
}
|
|
5394
|
-
|
|
5395
|
-
// If every item at each index is the same, return true
|
|
5396
|
-
for (let index = 0; index < arr1.length; index += 1) {
|
|
5397
|
-
if (arr1[index] !== arr2[index]) {
|
|
5398
|
-
return false;
|
|
5399
|
-
}
|
|
5400
|
-
}
|
|
5401
|
-
return true;
|
|
5402
|
-
}
|
|
5403
|
-
|
|
5404
|
-
/**
|
|
5405
|
-
* Compares array for changes.
|
|
5406
|
-
* @private
|
|
5407
|
-
* @param {Array|any} newVal - New value to compare.
|
|
5408
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
5409
|
-
* @returns {boolean} True if arrays have changed.
|
|
5410
|
-
*/
|
|
5411
|
-
function arrayOrUndefinedHasChanged(newVal, oldVal) {
|
|
5412
|
-
try {
|
|
5413
|
-
// Check if values are undefined or arrays
|
|
5414
|
-
const isArrayOrUndefined = (val) => val === undefined || Array.isArray(val);
|
|
5415
|
-
|
|
5416
|
-
// If non-array or non-undefined, throw error
|
|
5417
|
-
if (!isArrayOrUndefined(newVal) || !isArrayOrUndefined(oldVal)) {
|
|
5418
|
-
const invalidValue = isArrayOrUndefined(newVal) ? oldVal : newVal;
|
|
5419
|
-
throw new Error(`Value must be an array or undefined, received ${typeof invalidValue}`);
|
|
5420
|
-
}
|
|
5421
|
-
|
|
5422
|
-
// Return true if arrays have changed, false if they are the same
|
|
5423
|
-
return !arraysAreEqual(newVal, oldVal);
|
|
5424
|
-
} catch (error) {
|
|
5425
|
-
/* eslint-disable no-console */
|
|
5426
|
-
console.error(error);
|
|
5427
|
-
// If validation fails, it has changed
|
|
5428
|
-
return true;
|
|
5429
|
-
}
|
|
5430
|
-
}
|
|
5431
|
-
|
|
5432
5377
|
css`:host{display:flex;align-items:center;padding:var(--ds-size-50, 0.25rem) var(--ds-size-200, 1rem) var(--ds-size-50, 0.25rem) 0;cursor:pointer;user-select:none;-webkit-tap-highlight-color:transparent}:host slot{display:block;overflow:hidden;white-space:nowrap;text-overflow:ellipsis}:host [auro-icon]{--ds-auro-icon-size: var(--ds-size-300, 1.5rem);margin-right:var(--ds-size-150, 0.75rem);margin-left:var(--ds-size-100, 0.5rem)}:host ::slotted(.nestingSpacer){display:inline-block;width:var(--ds-size-300, 1.5rem)}:host ::slotted(strong){font-weight:700}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
5433
5378
|
|
|
5434
5379
|
css`:host{background-color:var(--ds-auro-menuoption-container-color);color:var(--ds-auro-menuoption-text-color)}:host svg{fill:var(--ds-auro-menuoption-icon-color)}:host([disabled]){--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:hover),:host(.active){--ds-auro-menuoption-container-color: var(--ds-basic-color-surface-neutral-subtle, #f7f7f7)}:host([selected]){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected, #01426a);--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-inverse, #ffffff);--ds-auro-menuoption-icon-color: var(--ds-basic-color-texticon-inverse, #ffffff)}:host([selected]):host(:hover),:host([selected]):host(.active){--ds-auro-menuoption-container-color: var(--ds-advanced-color-state-selected-hover, #00274a)}`;
|
|
@@ -5590,7 +5535,7 @@ class AuroSelect extends LitElement {
|
|
|
5590
5535
|
|
|
5591
5536
|
/**
|
|
5592
5537
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
5593
|
-
* Otherwise, Heading 600
|
|
5538
|
+
* Otherwise, Heading 600.
|
|
5594
5539
|
*/
|
|
5595
5540
|
largeFullscreenHeadline: {
|
|
5596
5541
|
type: Boolean,
|
|
@@ -5648,12 +5593,11 @@ class AuroSelect extends LitElement {
|
|
|
5648
5593
|
},
|
|
5649
5594
|
|
|
5650
5595
|
/**
|
|
5651
|
-
* Specifies the current selected menuOption.
|
|
5596
|
+
* Specifies the current selected menuOption. Default type is `HTMLElement`, changing to `Array<HTMLElement>` when `multiSelect` is true.
|
|
5597
|
+
* @type {HTMLElement|Array<HTMLElement>}
|
|
5652
5598
|
*/
|
|
5653
5599
|
optionSelected: {
|
|
5654
|
-
|
|
5655
|
-
converter: arrayConverter,
|
|
5656
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5600
|
+
type: Object
|
|
5657
5601
|
},
|
|
5658
5602
|
|
|
5659
5603
|
/**
|
|
@@ -5723,12 +5667,11 @@ class AuroSelect extends LitElement {
|
|
|
5723
5667
|
},
|
|
5724
5668
|
|
|
5725
5669
|
/**
|
|
5726
|
-
* Value selected for the component.
|
|
5670
|
+
* Value selected for the component. Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
5671
|
+
* @type {String|Array<String>}
|
|
5727
5672
|
*/
|
|
5728
5673
|
value: {
|
|
5729
|
-
|
|
5730
|
-
converter: arrayConverter,
|
|
5731
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5674
|
+
type: Object
|
|
5732
5675
|
},
|
|
5733
5676
|
|
|
5734
5677
|
/**
|
|
@@ -5807,9 +5750,15 @@ class AuroSelect extends LitElement {
|
|
|
5807
5750
|
}
|
|
5808
5751
|
|
|
5809
5752
|
// Handle selected options
|
|
5810
|
-
if (this.optionSelected
|
|
5811
|
-
|
|
5812
|
-
|
|
5753
|
+
if (this.optionSelected) {
|
|
5754
|
+
let displayText = '';
|
|
5755
|
+
|
|
5756
|
+
if (this.multiSelect && this.optionSelected.length > 0) {
|
|
5757
|
+
// Create display text from selected options
|
|
5758
|
+
displayText = this.optionSelected.map((option) => option.textContent).join(', ');
|
|
5759
|
+
} else {
|
|
5760
|
+
displayText = this.optionSelected.textContent;
|
|
5761
|
+
}
|
|
5813
5762
|
|
|
5814
5763
|
const span = document.createElement('span');
|
|
5815
5764
|
span.textContent = displayText;
|
|
@@ -6057,6 +6006,17 @@ class AuroSelect extends LitElement {
|
|
|
6057
6006
|
}
|
|
6058
6007
|
}
|
|
6059
6008
|
|
|
6009
|
+
/**
|
|
6010
|
+
* Resets all options to their default state.
|
|
6011
|
+
* @private
|
|
6012
|
+
*/
|
|
6013
|
+
clearSelection() {
|
|
6014
|
+
this.value = undefined;
|
|
6015
|
+
this.optionSelected = undefined;
|
|
6016
|
+
|
|
6017
|
+
this.menu.multiSelect = this.multiSelect;
|
|
6018
|
+
}
|
|
6019
|
+
|
|
6060
6020
|
/**
|
|
6061
6021
|
* Handle element attributes on update.
|
|
6062
6022
|
* @private
|
|
@@ -6093,13 +6053,20 @@ class AuroSelect extends LitElement {
|
|
|
6093
6053
|
|
|
6094
6054
|
// Set the initial value in auro-menu if defined
|
|
6095
6055
|
if (this.hasAttribute('value') && this.getAttribute('value').length > 0) {
|
|
6056
|
+
this.value = this.multiSelect ? arrayConverter(this.getAttribute('value')) : this.getAttribute('value');
|
|
6096
6057
|
this.menu.value = this.value;
|
|
6097
6058
|
}
|
|
6098
6059
|
}
|
|
6099
6060
|
|
|
6100
6061
|
async updated(changedProperties) {
|
|
6062
|
+
if (changedProperties.has('multiSelect')) {
|
|
6063
|
+
this.clearSelection();
|
|
6064
|
+
}
|
|
6065
|
+
|
|
6101
6066
|
if (changedProperties.has('value')) {
|
|
6102
6067
|
if (this.value) {
|
|
6068
|
+
this.value = this.multiSelect ? arrayConverter(this.value) : this.value;
|
|
6069
|
+
|
|
6103
6070
|
this.menu.value = this.value;
|
|
6104
6071
|
|
|
6105
6072
|
// Wait for menu to finish updating its value
|
|
@@ -6171,8 +6138,23 @@ class AuroSelect extends LitElement {
|
|
|
6171
6138
|
_handleNativeSelectChange(event) {
|
|
6172
6139
|
const selectedOption = event.target.options[event.target.selectedIndex];
|
|
6173
6140
|
const selectedValue = selectedOption.value;
|
|
6174
|
-
|
|
6175
|
-
this.
|
|
6141
|
+
|
|
6142
|
+
if (this.multiSelect) {
|
|
6143
|
+
const currentArray = Array.isArray(this.value) ? this.value : [];
|
|
6144
|
+
|
|
6145
|
+
if (!currentArray.includes(selectedValue)) {
|
|
6146
|
+
this.value = [
|
|
6147
|
+
...currentArray,
|
|
6148
|
+
selectedValue
|
|
6149
|
+
];
|
|
6150
|
+
}
|
|
6151
|
+
} else {
|
|
6152
|
+
const currentValue = this.value;
|
|
6153
|
+
|
|
6154
|
+
if (currentValue !== selectedValue) {
|
|
6155
|
+
this.value = selectedValue;
|
|
6156
|
+
}
|
|
6157
|
+
}
|
|
6176
6158
|
}
|
|
6177
6159
|
|
|
6178
6160
|
/**
|
|
@@ -6185,10 +6167,13 @@ class AuroSelect extends LitElement {
|
|
|
6185
6167
|
if (!nativeSelect) {
|
|
6186
6168
|
return;
|
|
6187
6169
|
}
|
|
6188
|
-
const [value] = this.value || [];
|
|
6189
|
-
nativeSelect.value = value || '';
|
|
6190
|
-
}
|
|
6191
6170
|
|
|
6171
|
+
if (this.multiSelect) {
|
|
6172
|
+
nativeSelect.value = this.value ? this.value[0] : '';
|
|
6173
|
+
} else {
|
|
6174
|
+
nativeSelect.value = this.value || '';
|
|
6175
|
+
}
|
|
6176
|
+
}
|
|
6192
6177
|
|
|
6193
6178
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
6194
6179
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
package/package.json
CHANGED