@aurodesignsystem-dev/auro-formkit 0.0.0-pr1541.3 → 0.0.0-pr1541.4
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/components/checkbox/demo/customize.min.js +1 -1
- package/components/checkbox/demo/getting-started.min.js +1 -1
- package/components/checkbox/demo/index.min.js +1 -1
- package/components/checkbox/dist/index.js +1 -1
- package/components/checkbox/dist/registered.js +1 -1
- package/components/combobox/demo/api.md +1 -1
- package/components/combobox/demo/customize.min.js +71 -20
- package/components/combobox/demo/getting-started.min.js +71 -20
- package/components/combobox/demo/index.md +1 -0
- package/components/combobox/demo/index.min.js +71 -20
- package/components/combobox/dist/auro-combobox.d.ts +1 -1
- package/components/combobox/dist/index.js +4 -4
- package/components/combobox/dist/registered.js +4 -4
- package/components/counter/demo/customize.min.js +2 -2
- package/components/counter/demo/index.min.js +2 -2
- package/components/counter/dist/index.js +2 -2
- package/components/counter/dist/registered.js +2 -2
- package/components/datepicker/demo/customize.min.js +3 -3
- package/components/datepicker/demo/index.min.js +3 -3
- package/components/datepicker/dist/index.js +3 -3
- package/components/datepicker/dist/registered.js +3 -3
- package/components/dropdown/demo/customize.min.js +1 -1
- package/components/dropdown/demo/getting-started.min.js +1 -1
- package/components/dropdown/demo/index.min.js +1 -1
- package/components/dropdown/dist/index.js +1 -1
- package/components/dropdown/dist/registered.js +1 -1
- package/components/form/demo/customize.min.js +86 -31
- package/components/form/demo/getting-started.min.js +86 -31
- package/components/form/demo/index.min.js +86 -31
- package/components/form/demo/registerDemoDeps.min.js +86 -31
- package/components/input/demo/customize.min.js +1 -1
- package/components/input/demo/getting-started.min.js +1 -1
- package/components/input/demo/index.min.js +1 -1
- package/components/input/dist/index.js +1 -1
- package/components/input/dist/registered.js +1 -1
- package/components/menu/demo/api.md +24 -18
- package/components/menu/demo/customize.md +1 -1
- package/components/menu/demo/getting-started.md +2 -2
- package/components/menu/demo/index.min.js +67 -16
- package/components/menu/dist/auro-menu-utils.d.ts +19 -0
- package/components/menu/dist/auro-menu.d.ts +3 -7
- package/components/menu/dist/auro-menuoption.d.ts +1 -0
- package/components/menu/dist/index.js +67 -16
- package/components/menu/dist/registered.js +67 -16
- package/components/radio/demo/customize.min.js +1 -1
- package/components/radio/demo/getting-started.min.js +1 -1
- package/components/radio/demo/index.min.js +1 -1
- package/components/radio/dist/index.js +1 -1
- package/components/radio/dist/registered.js +1 -1
- package/components/select/demo/api.md +2 -2
- package/components/select/demo/customize.md +3 -0
- package/components/select/demo/customize.min.js +74 -19
- package/components/select/demo/getting-started.md +1 -1
- package/components/select/demo/getting-started.min.js +74 -19
- package/components/select/demo/index.md +2 -2
- package/components/select/demo/index.min.js +74 -19
- package/components/select/dist/auro-select.d.ts +6 -2
- package/components/select/dist/index.js +7 -3
- package/components/select/dist/registered.js +7 -3
- package/custom-elements.json +1836 -1776
- package/package.json +1 -1
|
@@ -1275,7 +1275,7 @@ class AuroHelpText extends i$2 {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
|
-
var formkitVersion = '
|
|
1278
|
+
var formkitVersion = '202607082038';
|
|
1279
1279
|
|
|
1280
1280
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1281
1281
|
// See LICENSE in the project root for license information.
|
|
@@ -1275,7 +1275,7 @@ class AuroHelpText extends i$2 {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
|
-
var formkitVersion = '
|
|
1278
|
+
var formkitVersion = '202607082038';
|
|
1279
1279
|
|
|
1280
1280
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1281
1281
|
// See LICENSE in the project root for license information.
|
|
@@ -1275,7 +1275,7 @@ class AuroHelpText extends i$2 {
|
|
|
1275
1275
|
}
|
|
1276
1276
|
}
|
|
1277
1277
|
|
|
1278
|
-
var formkitVersion = '
|
|
1278
|
+
var formkitVersion = '202607082038';
|
|
1279
1279
|
|
|
1280
1280
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1281
1281
|
// See LICENSE in the project root for license information.
|
|
@@ -1228,7 +1228,7 @@ class AuroHelpText extends LitElement {
|
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
1230
1230
|
|
|
1231
|
-
var formkitVersion = '
|
|
1231
|
+
var formkitVersion = '202607082038';
|
|
1232
1232
|
|
|
1233
1233
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1234
1234
|
// See LICENSE in the project root for license information.
|
|
@@ -1228,7 +1228,7 @@ class AuroHelpText extends LitElement {
|
|
|
1228
1228
|
}
|
|
1229
1229
|
}
|
|
1230
1230
|
|
|
1231
|
-
var formkitVersion = '
|
|
1231
|
+
var formkitVersion = '202607082038';
|
|
1232
1232
|
|
|
1233
1233
|
// Copyright (c) 2026 Alaska Airlines. All rights reserved. Licensed under the Apache-2.0 license
|
|
1234
1234
|
// See LICENSE in the project root for license information.
|
|
@@ -42,7 +42,7 @@ The `auro-combobox` element provides users with a way to select an option from a
|
|
|
42
42
|
| `type` | `type` | | `string` | | Applies the defined value as the type attribute on `auro-input`. |
|
|
43
43
|
| `typedValue` | `typedValue` | | `string` | | Specifies the value of the input element within the combobox. |
|
|
44
44
|
| `validity` | `validity` | | `string` | | Specifies the `validityState` this element is in. |
|
|
45
|
-
| `value` | `value` | | `string` | | Value selected for the dropdown menu.
|
|
45
|
+
| `value` | `value` | | `string` | | Value selected for the dropdown menu. When set programmatically or as a preset attribute, the value must match a selectable option. If it matches an option marked `disabled` or `static`, the selection is rejected: `value` and `optionSelected` are cleared to `undefined`. `hidden` options (including those filtered out by type-ahead) remain selectable by value. |
|
|
46
46
|
|
|
47
47
|
## Methods
|
|
48
48
|
|
|
@@ -4879,7 +4879,7 @@ let AuroHelpText$2 = class AuroHelpText extends i$3 {
|
|
|
4879
4879
|
}
|
|
4880
4880
|
};
|
|
4881
4881
|
|
|
4882
|
-
var formkitVersion$2 = '
|
|
4882
|
+
var formkitVersion$2 = '202607082038';
|
|
4883
4883
|
|
|
4884
4884
|
let AuroElement$2 = class AuroElement extends i$3 {
|
|
4885
4885
|
static get properties() {
|
|
@@ -18504,7 +18504,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$3 {
|
|
|
18504
18504
|
}
|
|
18505
18505
|
};
|
|
18506
18506
|
|
|
18507
|
-
var formkitVersion$1 = '
|
|
18507
|
+
var formkitVersion$1 = '202607082038';
|
|
18508
18508
|
|
|
18509
18509
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
18510
18510
|
// See LICENSE in the project root for license information.
|
|
@@ -19625,7 +19625,7 @@ class AuroBibtemplate extends i$3 {
|
|
|
19625
19625
|
}
|
|
19626
19626
|
}
|
|
19627
19627
|
|
|
19628
|
-
var formkitVersion = '
|
|
19628
|
+
var formkitVersion = '202607082038';
|
|
19629
19629
|
|
|
19630
19630
|
var styleCss$3 = i$6`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;text-align:left}:host [auro-dropdown]{--ds-auro-dropdown-trigger-background-color: transparent}:host #inputInBib::part(wrapper){box-shadow:none}:host #inputInBib::part(accent-left){display:none}:host([layout*=classic]) [auro-input]{width:100%}:host([layout*=classic]) [auro-input]::part(helpText){display:none}:host([layout*=classic]) #slotHolder{display:none}`;
|
|
19631
19631
|
|
|
@@ -20439,7 +20439,7 @@ class AuroCombobox extends AuroElement {
|
|
|
20439
20439
|
},
|
|
20440
20440
|
|
|
20441
20441
|
/**
|
|
20442
|
-
* Value selected for the dropdown menu.
|
|
20442
|
+
* Value selected for the dropdown menu. When set programmatically or as a preset attribute, the value must match a selectable option. If it matches an option marked `disabled` or `static`, the selection is rejected: `value` and `optionSelected` are cleared to `undefined`. `hidden` options (including those filtered out by type-ahead) remain selectable by value.
|
|
20443
20443
|
*/
|
|
20444
20444
|
value: {
|
|
20445
20445
|
type: String
|
|
@@ -21957,6 +21957,18 @@ var tokensCss = i$6`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-bor
|
|
|
21957
21957
|
// See LICENSE in the project root for license information.
|
|
21958
21958
|
|
|
21959
21959
|
|
|
21960
|
+
/**
|
|
21961
|
+
* Serializes a multi-select value array back into the String `value` property.
|
|
21962
|
+
* An empty (or missing) array collapses to `undefined` so an emptied selection
|
|
21963
|
+
* clears `value` rather than reflecting a `"[]"` attribute.
|
|
21964
|
+
* @private
|
|
21965
|
+
* @param {Array<string>|undefined} values - The selected values.
|
|
21966
|
+
* @returns {string|undefined} JSON string of the values, or undefined when empty.
|
|
21967
|
+
*/
|
|
21968
|
+
function serializeMultiSelectValue(values) {
|
|
21969
|
+
return values && values.length > 0 ? JSON.stringify(values) : undefined;
|
|
21970
|
+
}
|
|
21971
|
+
|
|
21960
21972
|
/**
|
|
21961
21973
|
* Validates if an option can be interacted with.
|
|
21962
21974
|
* @private
|
|
@@ -21969,6 +21981,20 @@ function isOptionInteractive(option) {
|
|
|
21969
21981
|
!option.hasAttribute('static');
|
|
21970
21982
|
}
|
|
21971
21983
|
|
|
21984
|
+
/**
|
|
21985
|
+
* Validates if an option may be selected by matching a programmatic value.
|
|
21986
|
+
* Unlike `isOptionInteractive`, `hidden` is allowed: the combobox toggles
|
|
21987
|
+
* `hidden` as its type-ahead filter, so a filtered-out option is still a
|
|
21988
|
+
* valid programmatic selection. Only disabled and static options — which are
|
|
21989
|
+
* never selectable — are rejected.
|
|
21990
|
+
* @param {HTMLElement} option - The option to check.
|
|
21991
|
+
* @returns {boolean} True if option can be selected by value.
|
|
21992
|
+
*/
|
|
21993
|
+
function isSelectableByValue(option) {
|
|
21994
|
+
return !option.hasAttribute('disabled') &&
|
|
21995
|
+
!option.hasAttribute('static');
|
|
21996
|
+
}
|
|
21997
|
+
|
|
21972
21998
|
/**
|
|
21973
21999
|
* Helper method to dispatch custom events.
|
|
21974
22000
|
* @param {HTMLElement} element - Element to dispatch event from.
|
|
@@ -22138,6 +22164,7 @@ class AuroMenu extends AuroElement {
|
|
|
22138
22164
|
|
|
22139
22165
|
/**
|
|
22140
22166
|
* Specifies the current active menuOption.
|
|
22167
|
+
* @readonly
|
|
22141
22168
|
*/
|
|
22142
22169
|
optionActive: {
|
|
22143
22170
|
type: Object,
|
|
@@ -22146,14 +22173,17 @@ class AuroMenu extends AuroElement {
|
|
|
22146
22173
|
|
|
22147
22174
|
/**
|
|
22148
22175
|
* The currently selected menu option(s). In single-select mode this is a single `HTMLElement` (or `undefined` when nothing is selected). In multi-select mode this is an array of `HTMLElement`s.
|
|
22176
|
+
* @readonly
|
|
22149
22177
|
*/
|
|
22150
22178
|
optionSelected: {
|
|
22151
22179
|
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
22152
|
-
type: Object
|
|
22180
|
+
type: Object,
|
|
22181
|
+
attribute: false
|
|
22153
22182
|
},
|
|
22154
22183
|
|
|
22155
22184
|
/**
|
|
22156
22185
|
* The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
|
|
22186
|
+
* Options marked `disabled` or `static` are not selectable by value; `hidden` options remain selectable. In single-select mode, if the value matches a non-selectable option the selection is cleared (`optionSelected` becomes `undefined`) and `auroMenu-selectValueFailure` is dispatched. In multi-select mode, non-selectable entries are dropped from the value and the remaining selectable entries are selected; `auroMenu-selectValueFailure` is dispatched only when none of the entries match a selectable option.
|
|
22157
22187
|
*/
|
|
22158
22188
|
value: {
|
|
22159
22189
|
type: String,
|
|
@@ -22277,7 +22307,7 @@ class AuroMenu extends AuroElement {
|
|
|
22277
22307
|
}
|
|
22278
22308
|
|
|
22279
22309
|
/**
|
|
22280
|
-
* Selects options by value.
|
|
22310
|
+
* Selects options by value. Options marked `disabled` or `static` are not selectable; `hidden` options remain selectable. In single-select mode, if the value matches a non-selectable option the selection is cleared and `auroMenu-selectValueFailure` is dispatched. In multi-select mode, non-selectable entries are dropped and the remaining selectable entries are selected; `auroMenu-selectValueFailure` is dispatched only when none of the entries match a selectable option. Passing `undefined`, `null`, an empty string, or an empty array clears the selection without dispatching a failure.
|
|
22281
22311
|
* @param {string|string[]|undefined|null} value - The value(s) to select.
|
|
22282
22312
|
* @public
|
|
22283
22313
|
*/
|
|
@@ -22362,6 +22392,11 @@ class AuroMenu extends AuroElement {
|
|
|
22362
22392
|
this.initItems();
|
|
22363
22393
|
}
|
|
22364
22394
|
|
|
22395
|
+
// Set when reconciliation reassigns `value` below. That reassignment schedules a
|
|
22396
|
+
// second updated() cycle, so the `event`-attribute dispatch is deferred to that
|
|
22397
|
+
// cycle to avoid firing option custom events twice on the same selection.
|
|
22398
|
+
let valueReconciled = false;
|
|
22399
|
+
|
|
22365
22400
|
// Handle null/undefined/empty case — empty/whitespace strings clear selection
|
|
22366
22401
|
// consistently with selectByValue(''), and avoid downstream `.includes('')` matches.
|
|
22367
22402
|
if (this.value === undefined || this.value === null || (typeof this.value === 'string' && this.value.trim() === '')) {
|
|
@@ -22374,11 +22409,31 @@ class AuroMenu extends AuroElement {
|
|
|
22374
22409
|
// Defensive default: `formattedValue` can be undefined for unexpected value types,
|
|
22375
22410
|
// and calling `.includes` on undefined would throw during reconciliation.
|
|
22376
22411
|
const valueArray = this.formattedValue || [];
|
|
22377
|
-
const matchingOptions = this.items ? this.items.filter((item) => valueArray.includes(item.value)) : [];
|
|
22412
|
+
const matchingOptions = this.items ? this.items.filter((item) => isSelectableByValue(item) && valueArray.includes(item.value)) : [];
|
|
22378
22413
|
newSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
22414
|
+
|
|
22415
|
+
// Reconcile `value` with the selectable set. Drop only entries whose option is
|
|
22416
|
+
// loaded but non-selectable (disabled/static) — leaving them would desync `value`
|
|
22417
|
+
// from `optionSelected`, and the toggle handlers rebuild `value` from `formattedValue`,
|
|
22418
|
+
// so the rejected entry would resurface on the next select/deselect. Entries with no
|
|
22419
|
+
// matching item yet are preserved so async preselection still works once options render.
|
|
22420
|
+
const rejectedValues = this.items
|
|
22421
|
+
? this.items.filter((item) => !isSelectableByValue(item) && valueArray.includes(item.value)).map((item) => item.value)
|
|
22422
|
+
: [];
|
|
22423
|
+
if (rejectedValues.length > 0) {
|
|
22424
|
+
const reconciled = valueArray.filter((val) => !rejectedValues.includes(val));
|
|
22425
|
+
this.value = serializeMultiSelectValue(reconciled);
|
|
22426
|
+
valueReconciled = true;
|
|
22427
|
+
}
|
|
22379
22428
|
} else {
|
|
22380
|
-
// In single-select mode, this.value should be a string
|
|
22381
|
-
|
|
22429
|
+
// In single-select mode, this.value should be a string. Reject
|
|
22430
|
+
// disabled/static options so a programmatic value pointing at a
|
|
22431
|
+
// non-selectable option falls through to the no-match path below
|
|
22432
|
+
// (dispatching auroMenu-selectValueFailure) instead of pinning it.
|
|
22433
|
+
// `hidden` is intentionally NOT excluded: the combobox toggles
|
|
22434
|
+
// `hidden` as its type-ahead filter, so a filtered-out option is
|
|
22435
|
+
// still a valid programmatic selection.
|
|
22436
|
+
const matchingOption = this.items ? this.items.find((item) => isSelectableByValue(item) && item.value === this.value) : undefined;
|
|
22382
22437
|
|
|
22383
22438
|
if (matchingOption) {
|
|
22384
22439
|
newSelected = matchingOption;
|
|
@@ -22420,8 +22475,9 @@ class AuroMenu extends AuroElement {
|
|
|
22420
22475
|
]
|
|
22421
22476
|
]));
|
|
22422
22477
|
|
|
22423
|
-
// Notify of changes
|
|
22424
|
-
|
|
22478
|
+
// Notify of changes. Skip when reconciliation just reassigned `value`: the
|
|
22479
|
+
// follow-on update cycle re-runs this branch and fires the events exactly once.
|
|
22480
|
+
if (this.optionSelected !== undefined && !valueReconciled) {
|
|
22425
22481
|
const selected = Array.isArray(this.optionSelected) ? this.optionSelected : [this.optionSelected];
|
|
22426
22482
|
selected.forEach((opt) => {
|
|
22427
22483
|
if (opt.hasAttribute('event')) {
|
|
@@ -22634,7 +22690,7 @@ class AuroMenu extends AuroElement {
|
|
|
22634
22690
|
const currentSelected = this.optionSelected || [];
|
|
22635
22691
|
|
|
22636
22692
|
if (!currentValue.includes(option.value)) {
|
|
22637
|
-
this.value =
|
|
22693
|
+
this.value = serializeMultiSelectValue([
|
|
22638
22694
|
...currentValue,
|
|
22639
22695
|
option.value
|
|
22640
22696
|
]);
|
|
@@ -22660,15 +22716,9 @@ class AuroMenu extends AuroElement {
|
|
|
22660
22716
|
*/
|
|
22661
22717
|
handleDeselectState(option) {
|
|
22662
22718
|
if (this.multiSelect) {
|
|
22663
|
-
// Remove this option from array
|
|
22719
|
+
// Remove this option from array; an empty result collapses `value` to undefined.
|
|
22664
22720
|
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
22665
|
-
|
|
22666
|
-
// If array is empty after removal, set back to undefined
|
|
22667
|
-
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
22668
|
-
this.value = undefined;
|
|
22669
|
-
} else {
|
|
22670
|
-
this.value = JSON.stringify(newFormattedValue);
|
|
22671
|
-
}
|
|
22721
|
+
this.value = serializeMultiSelectValue(newFormattedValue);
|
|
22672
22722
|
|
|
22673
22723
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
22674
22724
|
if (this.optionSelected.length === 0) {
|
|
@@ -23129,6 +23179,7 @@ let menuOptionIdCounter = 0;
|
|
|
23129
23179
|
* The `auro-menuoption` element provides users a way to define a menu option.
|
|
23130
23180
|
* @customElement auro-menuoption
|
|
23131
23181
|
*
|
|
23182
|
+
* @attr {Boolean} static - When present, marks the option as non-interactive — it renders but is skipped during keyboard navigation and cannot be selected. Useful for section headers, informational rows inside a menu, or attaching event listeners.
|
|
23132
23183
|
* @slot default - The default slot for the menu option text.
|
|
23133
23184
|
*
|
|
23134
23185
|
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
@@ -4879,7 +4879,7 @@ let AuroHelpText$2 = class AuroHelpText extends i$3 {
|
|
|
4879
4879
|
}
|
|
4880
4880
|
};
|
|
4881
4881
|
|
|
4882
|
-
var formkitVersion$2 = '
|
|
4882
|
+
var formkitVersion$2 = '202607082038';
|
|
4883
4883
|
|
|
4884
4884
|
let AuroElement$2 = class AuroElement extends i$3 {
|
|
4885
4885
|
static get properties() {
|
|
@@ -18504,7 +18504,7 @@ let AuroHelpText$1 = class AuroHelpText extends i$3 {
|
|
|
18504
18504
|
}
|
|
18505
18505
|
};
|
|
18506
18506
|
|
|
18507
|
-
var formkitVersion$1 = '
|
|
18507
|
+
var formkitVersion$1 = '202607082038';
|
|
18508
18508
|
|
|
18509
18509
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
18510
18510
|
// See LICENSE in the project root for license information.
|
|
@@ -19625,7 +19625,7 @@ class AuroBibtemplate extends i$3 {
|
|
|
19625
19625
|
}
|
|
19626
19626
|
}
|
|
19627
19627
|
|
|
19628
|
-
var formkitVersion = '
|
|
19628
|
+
var formkitVersion = '202607082038';
|
|
19629
19629
|
|
|
19630
19630
|
var styleCss$3 = i$6`.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock{display:block}.util_displayFlex{display:flex}.util_displayHidden{display:none}.util_displayHiddenVisually{position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}:host{display:block;text-align:left}:host [auro-dropdown]{--ds-auro-dropdown-trigger-background-color: transparent}:host #inputInBib::part(wrapper){box-shadow:none}:host #inputInBib::part(accent-left){display:none}:host([layout*=classic]) [auro-input]{width:100%}:host([layout*=classic]) [auro-input]::part(helpText){display:none}:host([layout*=classic]) #slotHolder{display:none}`;
|
|
19631
19631
|
|
|
@@ -20439,7 +20439,7 @@ class AuroCombobox extends AuroElement {
|
|
|
20439
20439
|
},
|
|
20440
20440
|
|
|
20441
20441
|
/**
|
|
20442
|
-
* Value selected for the dropdown menu.
|
|
20442
|
+
* Value selected for the dropdown menu. When set programmatically or as a preset attribute, the value must match a selectable option. If it matches an option marked `disabled` or `static`, the selection is rejected: `value` and `optionSelected` are cleared to `undefined`. `hidden` options (including those filtered out by type-ahead) remain selectable by value.
|
|
20443
20443
|
*/
|
|
20444
20444
|
value: {
|
|
20445
20445
|
type: String
|
|
@@ -21957,6 +21957,18 @@ var tokensCss = i$6`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-bor
|
|
|
21957
21957
|
// See LICENSE in the project root for license information.
|
|
21958
21958
|
|
|
21959
21959
|
|
|
21960
|
+
/**
|
|
21961
|
+
* Serializes a multi-select value array back into the String `value` property.
|
|
21962
|
+
* An empty (or missing) array collapses to `undefined` so an emptied selection
|
|
21963
|
+
* clears `value` rather than reflecting a `"[]"` attribute.
|
|
21964
|
+
* @private
|
|
21965
|
+
* @param {Array<string>|undefined} values - The selected values.
|
|
21966
|
+
* @returns {string|undefined} JSON string of the values, or undefined when empty.
|
|
21967
|
+
*/
|
|
21968
|
+
function serializeMultiSelectValue(values) {
|
|
21969
|
+
return values && values.length > 0 ? JSON.stringify(values) : undefined;
|
|
21970
|
+
}
|
|
21971
|
+
|
|
21960
21972
|
/**
|
|
21961
21973
|
* Validates if an option can be interacted with.
|
|
21962
21974
|
* @private
|
|
@@ -21969,6 +21981,20 @@ function isOptionInteractive(option) {
|
|
|
21969
21981
|
!option.hasAttribute('static');
|
|
21970
21982
|
}
|
|
21971
21983
|
|
|
21984
|
+
/**
|
|
21985
|
+
* Validates if an option may be selected by matching a programmatic value.
|
|
21986
|
+
* Unlike `isOptionInteractive`, `hidden` is allowed: the combobox toggles
|
|
21987
|
+
* `hidden` as its type-ahead filter, so a filtered-out option is still a
|
|
21988
|
+
* valid programmatic selection. Only disabled and static options — which are
|
|
21989
|
+
* never selectable — are rejected.
|
|
21990
|
+
* @param {HTMLElement} option - The option to check.
|
|
21991
|
+
* @returns {boolean} True if option can be selected by value.
|
|
21992
|
+
*/
|
|
21993
|
+
function isSelectableByValue(option) {
|
|
21994
|
+
return !option.hasAttribute('disabled') &&
|
|
21995
|
+
!option.hasAttribute('static');
|
|
21996
|
+
}
|
|
21997
|
+
|
|
21972
21998
|
/**
|
|
21973
21999
|
* Helper method to dispatch custom events.
|
|
21974
22000
|
* @param {HTMLElement} element - Element to dispatch event from.
|
|
@@ -22138,6 +22164,7 @@ class AuroMenu extends AuroElement {
|
|
|
22138
22164
|
|
|
22139
22165
|
/**
|
|
22140
22166
|
* Specifies the current active menuOption.
|
|
22167
|
+
* @readonly
|
|
22141
22168
|
*/
|
|
22142
22169
|
optionActive: {
|
|
22143
22170
|
type: Object,
|
|
@@ -22146,14 +22173,17 @@ class AuroMenu extends AuroElement {
|
|
|
22146
22173
|
|
|
22147
22174
|
/**
|
|
22148
22175
|
* The currently selected menu option(s). In single-select mode this is a single `HTMLElement` (or `undefined` when nothing is selected). In multi-select mode this is an array of `HTMLElement`s.
|
|
22176
|
+
* @readonly
|
|
22149
22177
|
*/
|
|
22150
22178
|
optionSelected: {
|
|
22151
22179
|
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
22152
|
-
type: Object
|
|
22180
|
+
type: Object,
|
|
22181
|
+
attribute: false
|
|
22153
22182
|
},
|
|
22154
22183
|
|
|
22155
22184
|
/**
|
|
22156
22185
|
* The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
|
|
22186
|
+
* Options marked `disabled` or `static` are not selectable by value; `hidden` options remain selectable. In single-select mode, if the value matches a non-selectable option the selection is cleared (`optionSelected` becomes `undefined`) and `auroMenu-selectValueFailure` is dispatched. In multi-select mode, non-selectable entries are dropped from the value and the remaining selectable entries are selected; `auroMenu-selectValueFailure` is dispatched only when none of the entries match a selectable option.
|
|
22157
22187
|
*/
|
|
22158
22188
|
value: {
|
|
22159
22189
|
type: String,
|
|
@@ -22277,7 +22307,7 @@ class AuroMenu extends AuroElement {
|
|
|
22277
22307
|
}
|
|
22278
22308
|
|
|
22279
22309
|
/**
|
|
22280
|
-
* Selects options by value.
|
|
22310
|
+
* Selects options by value. Options marked `disabled` or `static` are not selectable; `hidden` options remain selectable. In single-select mode, if the value matches a non-selectable option the selection is cleared and `auroMenu-selectValueFailure` is dispatched. In multi-select mode, non-selectable entries are dropped and the remaining selectable entries are selected; `auroMenu-selectValueFailure` is dispatched only when none of the entries match a selectable option. Passing `undefined`, `null`, an empty string, or an empty array clears the selection without dispatching a failure.
|
|
22281
22311
|
* @param {string|string[]|undefined|null} value - The value(s) to select.
|
|
22282
22312
|
* @public
|
|
22283
22313
|
*/
|
|
@@ -22362,6 +22392,11 @@ class AuroMenu extends AuroElement {
|
|
|
22362
22392
|
this.initItems();
|
|
22363
22393
|
}
|
|
22364
22394
|
|
|
22395
|
+
// Set when reconciliation reassigns `value` below. That reassignment schedules a
|
|
22396
|
+
// second updated() cycle, so the `event`-attribute dispatch is deferred to that
|
|
22397
|
+
// cycle to avoid firing option custom events twice on the same selection.
|
|
22398
|
+
let valueReconciled = false;
|
|
22399
|
+
|
|
22365
22400
|
// Handle null/undefined/empty case — empty/whitespace strings clear selection
|
|
22366
22401
|
// consistently with selectByValue(''), and avoid downstream `.includes('')` matches.
|
|
22367
22402
|
if (this.value === undefined || this.value === null || (typeof this.value === 'string' && this.value.trim() === '')) {
|
|
@@ -22374,11 +22409,31 @@ class AuroMenu extends AuroElement {
|
|
|
22374
22409
|
// Defensive default: `formattedValue` can be undefined for unexpected value types,
|
|
22375
22410
|
// and calling `.includes` on undefined would throw during reconciliation.
|
|
22376
22411
|
const valueArray = this.formattedValue || [];
|
|
22377
|
-
const matchingOptions = this.items ? this.items.filter((item) => valueArray.includes(item.value)) : [];
|
|
22412
|
+
const matchingOptions = this.items ? this.items.filter((item) => isSelectableByValue(item) && valueArray.includes(item.value)) : [];
|
|
22378
22413
|
newSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
22414
|
+
|
|
22415
|
+
// Reconcile `value` with the selectable set. Drop only entries whose option is
|
|
22416
|
+
// loaded but non-selectable (disabled/static) — leaving them would desync `value`
|
|
22417
|
+
// from `optionSelected`, and the toggle handlers rebuild `value` from `formattedValue`,
|
|
22418
|
+
// so the rejected entry would resurface on the next select/deselect. Entries with no
|
|
22419
|
+
// matching item yet are preserved so async preselection still works once options render.
|
|
22420
|
+
const rejectedValues = this.items
|
|
22421
|
+
? this.items.filter((item) => !isSelectableByValue(item) && valueArray.includes(item.value)).map((item) => item.value)
|
|
22422
|
+
: [];
|
|
22423
|
+
if (rejectedValues.length > 0) {
|
|
22424
|
+
const reconciled = valueArray.filter((val) => !rejectedValues.includes(val));
|
|
22425
|
+
this.value = serializeMultiSelectValue(reconciled);
|
|
22426
|
+
valueReconciled = true;
|
|
22427
|
+
}
|
|
22379
22428
|
} else {
|
|
22380
|
-
// In single-select mode, this.value should be a string
|
|
22381
|
-
|
|
22429
|
+
// In single-select mode, this.value should be a string. Reject
|
|
22430
|
+
// disabled/static options so a programmatic value pointing at a
|
|
22431
|
+
// non-selectable option falls through to the no-match path below
|
|
22432
|
+
// (dispatching auroMenu-selectValueFailure) instead of pinning it.
|
|
22433
|
+
// `hidden` is intentionally NOT excluded: the combobox toggles
|
|
22434
|
+
// `hidden` as its type-ahead filter, so a filtered-out option is
|
|
22435
|
+
// still a valid programmatic selection.
|
|
22436
|
+
const matchingOption = this.items ? this.items.find((item) => isSelectableByValue(item) && item.value === this.value) : undefined;
|
|
22382
22437
|
|
|
22383
22438
|
if (matchingOption) {
|
|
22384
22439
|
newSelected = matchingOption;
|
|
@@ -22420,8 +22475,9 @@ class AuroMenu extends AuroElement {
|
|
|
22420
22475
|
]
|
|
22421
22476
|
]));
|
|
22422
22477
|
|
|
22423
|
-
// Notify of changes
|
|
22424
|
-
|
|
22478
|
+
// Notify of changes. Skip when reconciliation just reassigned `value`: the
|
|
22479
|
+
// follow-on update cycle re-runs this branch and fires the events exactly once.
|
|
22480
|
+
if (this.optionSelected !== undefined && !valueReconciled) {
|
|
22425
22481
|
const selected = Array.isArray(this.optionSelected) ? this.optionSelected : [this.optionSelected];
|
|
22426
22482
|
selected.forEach((opt) => {
|
|
22427
22483
|
if (opt.hasAttribute('event')) {
|
|
@@ -22634,7 +22690,7 @@ class AuroMenu extends AuroElement {
|
|
|
22634
22690
|
const currentSelected = this.optionSelected || [];
|
|
22635
22691
|
|
|
22636
22692
|
if (!currentValue.includes(option.value)) {
|
|
22637
|
-
this.value =
|
|
22693
|
+
this.value = serializeMultiSelectValue([
|
|
22638
22694
|
...currentValue,
|
|
22639
22695
|
option.value
|
|
22640
22696
|
]);
|
|
@@ -22660,15 +22716,9 @@ class AuroMenu extends AuroElement {
|
|
|
22660
22716
|
*/
|
|
22661
22717
|
handleDeselectState(option) {
|
|
22662
22718
|
if (this.multiSelect) {
|
|
22663
|
-
// Remove this option from array
|
|
22719
|
+
// Remove this option from array; an empty result collapses `value` to undefined.
|
|
22664
22720
|
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
22665
|
-
|
|
22666
|
-
// If array is empty after removal, set back to undefined
|
|
22667
|
-
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
22668
|
-
this.value = undefined;
|
|
22669
|
-
} else {
|
|
22670
|
-
this.value = JSON.stringify(newFormattedValue);
|
|
22671
|
-
}
|
|
22721
|
+
this.value = serializeMultiSelectValue(newFormattedValue);
|
|
22672
22722
|
|
|
22673
22723
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
22674
22724
|
if (this.optionSelected.length === 0) {
|
|
@@ -23129,6 +23179,7 @@ let menuOptionIdCounter = 0;
|
|
|
23129
23179
|
* The `auro-menuoption` element provides users a way to define a menu option.
|
|
23130
23180
|
* @customElement auro-menuoption
|
|
23131
23181
|
*
|
|
23182
|
+
* @attr {Boolean} static - When present, marks the option as non-interactive — it renders but is skipped during keyboard navigation and cannot be selected. Useful for section headers, informational rows inside a menu, or attaching event listeners.
|
|
23132
23183
|
* @slot default - The default slot for the menu option text.
|
|
23133
23184
|
*
|
|
23134
23185
|
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
@@ -136,6 +136,7 @@
|
|
|
136
136
|
<auro-header level="3" id="presetValue">Preset the value</auro-header>
|
|
137
137
|
<p>In some cases it is necessary to preset the value of the component as part of the initial render.</p>
|
|
138
138
|
<p>When a value is preset, the matching option in the menu will be marked as both <code>active</code> and <code>selected</code>, and the input will display the corresponding text.</p>
|
|
139
|
+
<p>If a preset value matches an option marked <code>disabled</code> or <code>static</code>, the selection is rejected: <code>value</code> and <code>optionSelected</code> are cleared to <code>undefined</code>. A value that matches a <code>hidden</code> option is still applied.</p>
|
|
139
140
|
<p>If a preset value does not match any option, the component value is preserved and displayed in the input, but no menu option will be marked as selected. In suggestion mode, this value is treated as valid freeform input. In filter mode, the value will fail validation if the component is <code>required</code>.</p>
|
|
140
141
|
<auro-header level="3" id="autocomplete">Autocomplete</auro-header>
|
|
141
142
|
<p>The component supports the use of <auro-hyperlink href="https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Attributes/autocomplete">autocomplete</auro-hyperlink> configuration through HTML attributes.</p>
|