@aurodesignsystem/auro-formkit 3.5.0 → 4.0.0-rc-658.1.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 +41 -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 +1 -1
- package/components/select/demo/api.js +2 -0
- package/components/select/demo/api.md +96 -38
- package/components/select/demo/api.min.js +127 -210
- package/components/select/demo/index.min.js +113 -208
- package/components/select/demo/readme.md +1 -1
- package/components/select/dist/auro-select.d.ts +14 -14
- package/components/select/dist/index.js +73 -83
- package/components/select/dist/registered.js +73 -83
- 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)}`;
|
|
@@ -5454,8 +5399,9 @@ var styleCss = css`:focus:not(:focus-visible){outline:3px solid transparent}.uti
|
|
|
5454
5399
|
* @slot label - Defines the content of the label.
|
|
5455
5400
|
* @slot helpText - Defines the content of the helpText.
|
|
5456
5401
|
* @slot placeholder - Defines the content of the placeholder to be shown when there is no value
|
|
5402
|
+
* @slot valueText - Dropdown value text display.
|
|
5457
5403
|
* @event auroSelect-valueSet - Notifies that the component has a new value set.
|
|
5458
|
-
* @event input - Notifies every time the value prop of the element is changed.
|
|
5404
|
+
* @event input - Notifies every time the value prop of the element is changed. The updated `value` and `optionSelected` will be delivered in `detail` object.
|
|
5459
5405
|
* @event auroFormElement-validated - Notifies that the `validity` and `errorMessage` values have changed.
|
|
5460
5406
|
* @csspart helpText - Apply CSS to the help text.
|
|
5461
5407
|
*/
|
|
@@ -5590,7 +5536,7 @@ class AuroSelect extends LitElement {
|
|
|
5590
5536
|
|
|
5591
5537
|
/**
|
|
5592
5538
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
5593
|
-
* Otherwise, Heading 600
|
|
5539
|
+
* Otherwise, Heading 600.
|
|
5594
5540
|
*/
|
|
5595
5541
|
largeFullscreenHeadline: {
|
|
5596
5542
|
type: Boolean,
|
|
@@ -5648,12 +5594,11 @@ class AuroSelect extends LitElement {
|
|
|
5648
5594
|
},
|
|
5649
5595
|
|
|
5650
5596
|
/**
|
|
5651
|
-
* Specifies the current selected menuOption.
|
|
5597
|
+
* Specifies the current selected menuOption. Default type is `HTMLElement`, changing to `Array<HTMLElement>` when `multiSelect` is true.
|
|
5598
|
+
* @type {HTMLElement|Array<HTMLElement>}
|
|
5652
5599
|
*/
|
|
5653
5600
|
optionSelected: {
|
|
5654
|
-
|
|
5655
|
-
converter: arrayConverter,
|
|
5656
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5601
|
+
type: Object
|
|
5657
5602
|
},
|
|
5658
5603
|
|
|
5659
5604
|
/**
|
|
@@ -5723,12 +5668,11 @@ class AuroSelect extends LitElement {
|
|
|
5723
5668
|
},
|
|
5724
5669
|
|
|
5725
5670
|
/**
|
|
5726
|
-
* Value selected for the component.
|
|
5671
|
+
* Value selected for the component. Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
5672
|
+
* @type {String|Array<String>}
|
|
5727
5673
|
*/
|
|
5728
5674
|
value: {
|
|
5729
|
-
|
|
5730
|
-
converter: arrayConverter,
|
|
5731
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5675
|
+
type: Object
|
|
5732
5676
|
},
|
|
5733
5677
|
|
|
5734
5678
|
/**
|
|
@@ -5799,21 +5743,21 @@ class AuroSelect extends LitElement {
|
|
|
5799
5743
|
updateDisplayedValue() {
|
|
5800
5744
|
const triggerContentEl = this.dropdown.querySelector('#triggerFocus');
|
|
5801
5745
|
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
triggerContentEl.innerHTML = '';
|
|
5805
|
-
if (placeholder) {
|
|
5806
|
-
triggerContentEl.appendChild(placeholder);
|
|
5807
|
-
}
|
|
5746
|
+
const valueText = triggerContentEl.querySelector("#valueText");
|
|
5747
|
+
valueText.textContent = '';
|
|
5808
5748
|
|
|
5809
5749
|
// Handle selected options
|
|
5810
|
-
if (this.optionSelected
|
|
5811
|
-
|
|
5812
|
-
const displayText = this.optionSelected.map((option) => option.textContent).join(', ');
|
|
5750
|
+
if (this.optionSelected) {
|
|
5751
|
+
let displayText = '';
|
|
5813
5752
|
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5753
|
+
if (this.multiSelect && this.optionSelected.length > 0) {
|
|
5754
|
+
// Create display text from selected options
|
|
5755
|
+
displayText = this.optionSelected.map((option) => option.textContent).join(', ');
|
|
5756
|
+
} else {
|
|
5757
|
+
displayText = this.optionSelected.textContent;
|
|
5758
|
+
}
|
|
5759
|
+
|
|
5760
|
+
valueText.textContent = displayText;
|
|
5817
5761
|
}
|
|
5818
5762
|
|
|
5819
5763
|
this.dropdown.requestUpdate();
|
|
@@ -6057,6 +6001,17 @@ class AuroSelect extends LitElement {
|
|
|
6057
6001
|
}
|
|
6058
6002
|
}
|
|
6059
6003
|
|
|
6004
|
+
/**
|
|
6005
|
+
* Resets all options to their default state.
|
|
6006
|
+
* @private
|
|
6007
|
+
*/
|
|
6008
|
+
clearSelection() {
|
|
6009
|
+
this.value = undefined;
|
|
6010
|
+
this.optionSelected = undefined;
|
|
6011
|
+
|
|
6012
|
+
this.menu.multiSelect = this.multiSelect;
|
|
6013
|
+
}
|
|
6014
|
+
|
|
6060
6015
|
/**
|
|
6061
6016
|
* Handle element attributes on update.
|
|
6062
6017
|
* @private
|
|
@@ -6093,13 +6048,20 @@ class AuroSelect extends LitElement {
|
|
|
6093
6048
|
|
|
6094
6049
|
// Set the initial value in auro-menu if defined
|
|
6095
6050
|
if (this.hasAttribute('value') && this.getAttribute('value').length > 0) {
|
|
6051
|
+
this.value = this.multiSelect ? arrayConverter(this.getAttribute('value')) : this.getAttribute('value');
|
|
6096
6052
|
this.menu.value = this.value;
|
|
6097
6053
|
}
|
|
6098
6054
|
}
|
|
6099
6055
|
|
|
6100
6056
|
async updated(changedProperties) {
|
|
6057
|
+
if (changedProperties.has('multiSelect')) {
|
|
6058
|
+
this.clearSelection();
|
|
6059
|
+
}
|
|
6060
|
+
|
|
6101
6061
|
if (changedProperties.has('value')) {
|
|
6102
6062
|
if (this.value) {
|
|
6063
|
+
this.value = this.multiSelect ? arrayConverter(this.value) : this.value;
|
|
6064
|
+
|
|
6103
6065
|
this.menu.value = this.value;
|
|
6104
6066
|
|
|
6105
6067
|
// Wait for menu to finish updating its value
|
|
@@ -6124,6 +6086,10 @@ class AuroSelect extends LitElement {
|
|
|
6124
6086
|
bubbles: true,
|
|
6125
6087
|
cancelable: true,
|
|
6126
6088
|
composed: true,
|
|
6089
|
+
detail: {
|
|
6090
|
+
optionSelected: this.optionSelected,
|
|
6091
|
+
value: this.value
|
|
6092
|
+
}
|
|
6127
6093
|
}));
|
|
6128
6094
|
}
|
|
6129
6095
|
|
|
@@ -6171,8 +6137,23 @@ class AuroSelect extends LitElement {
|
|
|
6171
6137
|
_handleNativeSelectChange(event) {
|
|
6172
6138
|
const selectedOption = event.target.options[event.target.selectedIndex];
|
|
6173
6139
|
const selectedValue = selectedOption.value;
|
|
6174
|
-
|
|
6175
|
-
this.
|
|
6140
|
+
|
|
6141
|
+
if (this.multiSelect) {
|
|
6142
|
+
const currentArray = Array.isArray(this.value) ? this.value : [];
|
|
6143
|
+
|
|
6144
|
+
if (!currentArray.includes(selectedValue)) {
|
|
6145
|
+
this.value = [
|
|
6146
|
+
...currentArray,
|
|
6147
|
+
selectedValue
|
|
6148
|
+
];
|
|
6149
|
+
}
|
|
6150
|
+
} else {
|
|
6151
|
+
const currentValue = this.value;
|
|
6152
|
+
|
|
6153
|
+
if (currentValue !== selectedValue) {
|
|
6154
|
+
this.value = selectedValue;
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6176
6157
|
}
|
|
6177
6158
|
|
|
6178
6159
|
/**
|
|
@@ -6185,10 +6166,13 @@ class AuroSelect extends LitElement {
|
|
|
6185
6166
|
if (!nativeSelect) {
|
|
6186
6167
|
return;
|
|
6187
6168
|
}
|
|
6188
|
-
const [value] = this.value || [];
|
|
6189
|
-
nativeSelect.value = value || '';
|
|
6190
|
-
}
|
|
6191
6169
|
|
|
6170
|
+
if (this.multiSelect) {
|
|
6171
|
+
nativeSelect.value = this.value ? this.value[0] : '';
|
|
6172
|
+
} else {
|
|
6173
|
+
nativeSelect.value = this.value || '';
|
|
6174
|
+
}
|
|
6175
|
+
}
|
|
6192
6176
|
|
|
6193
6177
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
6194
6178
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
@@ -6234,7 +6218,13 @@ class AuroSelect extends LitElement {
|
|
|
6234
6218
|
?noFlip="${this.noFlip}"
|
|
6235
6219
|
part="dropdown">
|
|
6236
6220
|
<span slot="trigger" aria-haspopup="true" id="triggerFocus">
|
|
6237
|
-
<span id="placeholder"
|
|
6221
|
+
<span id="placeholder"
|
|
6222
|
+
class="${classMap(placeholderClass)}"
|
|
6223
|
+
?aria-hidden="${this.optionSelected && this.optionSelected.length ? 'true' : false}"
|
|
6224
|
+
>
|
|
6225
|
+
<slot name="placeholder"></slot>
|
|
6226
|
+
</span>
|
|
6227
|
+
<slot name="valueText" id="valueText"></slot>
|
|
6238
6228
|
</span>
|
|
6239
6229
|
|
|
6240
6230
|
<div class="menuWrapper">
|
|
@@ -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)}`;
|
|
@@ -5454,8 +5399,9 @@ var styleCss = css`:focus:not(:focus-visible){outline:3px solid transparent}.uti
|
|
|
5454
5399
|
* @slot label - Defines the content of the label.
|
|
5455
5400
|
* @slot helpText - Defines the content of the helpText.
|
|
5456
5401
|
* @slot placeholder - Defines the content of the placeholder to be shown when there is no value
|
|
5402
|
+
* @slot valueText - Dropdown value text display.
|
|
5457
5403
|
* @event auroSelect-valueSet - Notifies that the component has a new value set.
|
|
5458
|
-
* @event input - Notifies every time the value prop of the element is changed.
|
|
5404
|
+
* @event input - Notifies every time the value prop of the element is changed. The updated `value` and `optionSelected` will be delivered in `detail` object.
|
|
5459
5405
|
* @event auroFormElement-validated - Notifies that the `validity` and `errorMessage` values have changed.
|
|
5460
5406
|
* @csspart helpText - Apply CSS to the help text.
|
|
5461
5407
|
*/
|
|
@@ -5590,7 +5536,7 @@ class AuroSelect extends LitElement {
|
|
|
5590
5536
|
|
|
5591
5537
|
/**
|
|
5592
5538
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
5593
|
-
* Otherwise, Heading 600
|
|
5539
|
+
* Otherwise, Heading 600.
|
|
5594
5540
|
*/
|
|
5595
5541
|
largeFullscreenHeadline: {
|
|
5596
5542
|
type: Boolean,
|
|
@@ -5648,12 +5594,11 @@ class AuroSelect extends LitElement {
|
|
|
5648
5594
|
},
|
|
5649
5595
|
|
|
5650
5596
|
/**
|
|
5651
|
-
* Specifies the current selected menuOption.
|
|
5597
|
+
* Specifies the current selected menuOption. Default type is `HTMLElement`, changing to `Array<HTMLElement>` when `multiSelect` is true.
|
|
5598
|
+
* @type {HTMLElement|Array<HTMLElement>}
|
|
5652
5599
|
*/
|
|
5653
5600
|
optionSelected: {
|
|
5654
|
-
|
|
5655
|
-
converter: arrayConverter,
|
|
5656
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5601
|
+
type: Object
|
|
5657
5602
|
},
|
|
5658
5603
|
|
|
5659
5604
|
/**
|
|
@@ -5723,12 +5668,11 @@ class AuroSelect extends LitElement {
|
|
|
5723
5668
|
},
|
|
5724
5669
|
|
|
5725
5670
|
/**
|
|
5726
|
-
* Value selected for the component.
|
|
5671
|
+
* Value selected for the component. Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
5672
|
+
* @type {String|Array<String>}
|
|
5727
5673
|
*/
|
|
5728
5674
|
value: {
|
|
5729
|
-
|
|
5730
|
-
converter: arrayConverter,
|
|
5731
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
5675
|
+
type: Object
|
|
5732
5676
|
},
|
|
5733
5677
|
|
|
5734
5678
|
/**
|
|
@@ -5799,21 +5743,21 @@ class AuroSelect extends LitElement {
|
|
|
5799
5743
|
updateDisplayedValue() {
|
|
5800
5744
|
const triggerContentEl = this.dropdown.querySelector('#triggerFocus');
|
|
5801
5745
|
|
|
5802
|
-
|
|
5803
|
-
|
|
5804
|
-
triggerContentEl.innerHTML = '';
|
|
5805
|
-
if (placeholder) {
|
|
5806
|
-
triggerContentEl.appendChild(placeholder);
|
|
5807
|
-
}
|
|
5746
|
+
const valueText = triggerContentEl.querySelector("#valueText");
|
|
5747
|
+
valueText.textContent = '';
|
|
5808
5748
|
|
|
5809
5749
|
// Handle selected options
|
|
5810
|
-
if (this.optionSelected
|
|
5811
|
-
|
|
5812
|
-
const displayText = this.optionSelected.map((option) => option.textContent).join(', ');
|
|
5750
|
+
if (this.optionSelected) {
|
|
5751
|
+
let displayText = '';
|
|
5813
5752
|
|
|
5814
|
-
|
|
5815
|
-
|
|
5816
|
-
|
|
5753
|
+
if (this.multiSelect && this.optionSelected.length > 0) {
|
|
5754
|
+
// Create display text from selected options
|
|
5755
|
+
displayText = this.optionSelected.map((option) => option.textContent).join(', ');
|
|
5756
|
+
} else {
|
|
5757
|
+
displayText = this.optionSelected.textContent;
|
|
5758
|
+
}
|
|
5759
|
+
|
|
5760
|
+
valueText.textContent = displayText;
|
|
5817
5761
|
}
|
|
5818
5762
|
|
|
5819
5763
|
this.dropdown.requestUpdate();
|
|
@@ -6057,6 +6001,17 @@ class AuroSelect extends LitElement {
|
|
|
6057
6001
|
}
|
|
6058
6002
|
}
|
|
6059
6003
|
|
|
6004
|
+
/**
|
|
6005
|
+
* Resets all options to their default state.
|
|
6006
|
+
* @private
|
|
6007
|
+
*/
|
|
6008
|
+
clearSelection() {
|
|
6009
|
+
this.value = undefined;
|
|
6010
|
+
this.optionSelected = undefined;
|
|
6011
|
+
|
|
6012
|
+
this.menu.multiSelect = this.multiSelect;
|
|
6013
|
+
}
|
|
6014
|
+
|
|
6060
6015
|
/**
|
|
6061
6016
|
* Handle element attributes on update.
|
|
6062
6017
|
* @private
|
|
@@ -6093,13 +6048,20 @@ class AuroSelect extends LitElement {
|
|
|
6093
6048
|
|
|
6094
6049
|
// Set the initial value in auro-menu if defined
|
|
6095
6050
|
if (this.hasAttribute('value') && this.getAttribute('value').length > 0) {
|
|
6051
|
+
this.value = this.multiSelect ? arrayConverter(this.getAttribute('value')) : this.getAttribute('value');
|
|
6096
6052
|
this.menu.value = this.value;
|
|
6097
6053
|
}
|
|
6098
6054
|
}
|
|
6099
6055
|
|
|
6100
6056
|
async updated(changedProperties) {
|
|
6057
|
+
if (changedProperties.has('multiSelect')) {
|
|
6058
|
+
this.clearSelection();
|
|
6059
|
+
}
|
|
6060
|
+
|
|
6101
6061
|
if (changedProperties.has('value')) {
|
|
6102
6062
|
if (this.value) {
|
|
6063
|
+
this.value = this.multiSelect ? arrayConverter(this.value) : this.value;
|
|
6064
|
+
|
|
6103
6065
|
this.menu.value = this.value;
|
|
6104
6066
|
|
|
6105
6067
|
// Wait for menu to finish updating its value
|
|
@@ -6124,6 +6086,10 @@ class AuroSelect extends LitElement {
|
|
|
6124
6086
|
bubbles: true,
|
|
6125
6087
|
cancelable: true,
|
|
6126
6088
|
composed: true,
|
|
6089
|
+
detail: {
|
|
6090
|
+
optionSelected: this.optionSelected,
|
|
6091
|
+
value: this.value
|
|
6092
|
+
}
|
|
6127
6093
|
}));
|
|
6128
6094
|
}
|
|
6129
6095
|
|
|
@@ -6171,8 +6137,23 @@ class AuroSelect extends LitElement {
|
|
|
6171
6137
|
_handleNativeSelectChange(event) {
|
|
6172
6138
|
const selectedOption = event.target.options[event.target.selectedIndex];
|
|
6173
6139
|
const selectedValue = selectedOption.value;
|
|
6174
|
-
|
|
6175
|
-
this.
|
|
6140
|
+
|
|
6141
|
+
if (this.multiSelect) {
|
|
6142
|
+
const currentArray = Array.isArray(this.value) ? this.value : [];
|
|
6143
|
+
|
|
6144
|
+
if (!currentArray.includes(selectedValue)) {
|
|
6145
|
+
this.value = [
|
|
6146
|
+
...currentArray,
|
|
6147
|
+
selectedValue
|
|
6148
|
+
];
|
|
6149
|
+
}
|
|
6150
|
+
} else {
|
|
6151
|
+
const currentValue = this.value;
|
|
6152
|
+
|
|
6153
|
+
if (currentValue !== selectedValue) {
|
|
6154
|
+
this.value = selectedValue;
|
|
6155
|
+
}
|
|
6156
|
+
}
|
|
6176
6157
|
}
|
|
6177
6158
|
|
|
6178
6159
|
/**
|
|
@@ -6185,10 +6166,13 @@ class AuroSelect extends LitElement {
|
|
|
6185
6166
|
if (!nativeSelect) {
|
|
6186
6167
|
return;
|
|
6187
6168
|
}
|
|
6188
|
-
const [value] = this.value || [];
|
|
6189
|
-
nativeSelect.value = value || '';
|
|
6190
|
-
}
|
|
6191
6169
|
|
|
6170
|
+
if (this.multiSelect) {
|
|
6171
|
+
nativeSelect.value = this.value ? this.value[0] : '';
|
|
6172
|
+
} else {
|
|
6173
|
+
nativeSelect.value = this.value || '';
|
|
6174
|
+
}
|
|
6175
|
+
}
|
|
6192
6176
|
|
|
6193
6177
|
// When using auroElement, use the following attribute and function when hiding content from screen readers.
|
|
6194
6178
|
// aria-hidden="${this.hideAudible(this.hiddenAudible)}"
|
|
@@ -6234,7 +6218,13 @@ class AuroSelect extends LitElement {
|
|
|
6234
6218
|
?noFlip="${this.noFlip}"
|
|
6235
6219
|
part="dropdown">
|
|
6236
6220
|
<span slot="trigger" aria-haspopup="true" id="triggerFocus">
|
|
6237
|
-
<span id="placeholder"
|
|
6221
|
+
<span id="placeholder"
|
|
6222
|
+
class="${classMap(placeholderClass)}"
|
|
6223
|
+
?aria-hidden="${this.optionSelected && this.optionSelected.length ? 'true' : false}"
|
|
6224
|
+
>
|
|
6225
|
+
<slot name="placeholder"></slot>
|
|
6226
|
+
</span>
|
|
6227
|
+
<slot name="valueText" id="valueText"></slot>
|
|
6238
6228
|
</span>
|
|
6239
6229
|
|
|
6240
6230
|
<div class="menuWrapper">
|
package/package.json
CHANGED