@aurodesignsystem-dev/auro-formkit 0.0.0-pr1541.3 → 0.0.0-pr1541.5
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 +72 -21
- package/components/combobox/demo/getting-started.min.js +72 -21
- package/components/combobox/demo/index.md +1 -0
- package/components/combobox/demo/index.min.js +72 -21
- 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 +87 -32
- package/components/form/demo/getting-started.min.js +87 -32
- package/components/form/demo/index.min.js +87 -32
- package/components/form/demo/registerDemoDeps.min.js +87 -32
- 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/css-only.md +1 -1
- package/components/menu/demo/customize.md +83 -83
- package/components/menu/demo/getting-started.md +2 -2
- package/components/menu/demo/index.min.js +68 -17
- package/components/menu/demo/voiceover.md +12 -8
- package/components/menu/dist/auro-menu-utils.d.ts +19 -0
- package/components/menu/dist/auro-menu.d.ts +4 -8
- package/components/menu/dist/auro-menuoption.d.ts +1 -0
- package/components/menu/dist/index.js +68 -17
- package/components/menu/dist/registered.js +68 -17
- 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 +75 -20
- package/components/select/demo/getting-started.md +1 -1
- package/components/select/demo/getting-started.min.js +75 -20
- package/components/select/demo/index.md +2 -2
- package/components/select/demo/index.min.js +75 -20
- 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 +1832 -1783
- package/package.json +1 -1
|
@@ -241,6 +241,18 @@ function arrayConverter(value) {
|
|
|
241
241
|
throw new Error('Invalid value: Input must be an array or undefined');
|
|
242
242
|
}
|
|
243
243
|
|
|
244
|
+
/**
|
|
245
|
+
* Serializes a multi-select value array back into the String `value` property.
|
|
246
|
+
* An empty (or missing) array collapses to `undefined` so an emptied selection
|
|
247
|
+
* clears `value` rather than reflecting a `"[]"` attribute.
|
|
248
|
+
* @private
|
|
249
|
+
* @param {Array<string>|undefined} values - The selected values.
|
|
250
|
+
* @returns {string|undefined} JSON string of the values, or undefined when empty.
|
|
251
|
+
*/
|
|
252
|
+
function serializeMultiSelectValue(values) {
|
|
253
|
+
return values && values.length > 0 ? JSON.stringify(values) : undefined;
|
|
254
|
+
}
|
|
255
|
+
|
|
244
256
|
/**
|
|
245
257
|
* Validates if an option can be interacted with.
|
|
246
258
|
* @private
|
|
@@ -253,6 +265,20 @@ function isOptionInteractive(option) {
|
|
|
253
265
|
!option.hasAttribute('static');
|
|
254
266
|
}
|
|
255
267
|
|
|
268
|
+
/**
|
|
269
|
+
* Validates if an option may be selected by matching a programmatic value.
|
|
270
|
+
* Unlike `isOptionInteractive`, `hidden` is allowed: the combobox toggles
|
|
271
|
+
* `hidden` as its type-ahead filter, so a filtered-out option is still a
|
|
272
|
+
* valid programmatic selection. Only disabled and static options — which are
|
|
273
|
+
* never selectable — are rejected.
|
|
274
|
+
* @param {HTMLElement} option - The option to check.
|
|
275
|
+
* @returns {boolean} True if option can be selected by value.
|
|
276
|
+
*/
|
|
277
|
+
function isSelectableByValue(option) {
|
|
278
|
+
return !option.hasAttribute('disabled') &&
|
|
279
|
+
!option.hasAttribute('static');
|
|
280
|
+
}
|
|
281
|
+
|
|
256
282
|
/**
|
|
257
283
|
* Helper method to dispatch custom events.
|
|
258
284
|
* @param {HTMLElement} element - Element to dispatch event from.
|
|
@@ -422,22 +448,26 @@ class AuroMenu extends AuroElement {
|
|
|
422
448
|
|
|
423
449
|
/**
|
|
424
450
|
* Specifies the current active menuOption.
|
|
451
|
+
* @readonly
|
|
425
452
|
*/
|
|
426
453
|
optionActive: {
|
|
427
454
|
type: Object,
|
|
428
|
-
attribute:
|
|
455
|
+
attribute: false
|
|
429
456
|
},
|
|
430
457
|
|
|
431
458
|
/**
|
|
432
459
|
* 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.
|
|
460
|
+
* @readonly
|
|
433
461
|
*/
|
|
434
462
|
optionSelected: {
|
|
435
463
|
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
436
|
-
type: Object
|
|
464
|
+
type: Object,
|
|
465
|
+
attribute: false
|
|
437
466
|
},
|
|
438
467
|
|
|
439
468
|
/**
|
|
440
469
|
* The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
|
|
470
|
+
* 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.
|
|
441
471
|
*/
|
|
442
472
|
value: {
|
|
443
473
|
type: String,
|
|
@@ -561,7 +591,7 @@ class AuroMenu extends AuroElement {
|
|
|
561
591
|
}
|
|
562
592
|
|
|
563
593
|
/**
|
|
564
|
-
* Selects options by value.
|
|
594
|
+
* 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.
|
|
565
595
|
* @param {string|string[]|undefined|null} value - The value(s) to select.
|
|
566
596
|
* @public
|
|
567
597
|
*/
|
|
@@ -646,6 +676,11 @@ class AuroMenu extends AuroElement {
|
|
|
646
676
|
this.initItems();
|
|
647
677
|
}
|
|
648
678
|
|
|
679
|
+
// Set when reconciliation reassigns `value` below. That reassignment schedules a
|
|
680
|
+
// second updated() cycle, so the `event`-attribute dispatch is deferred to that
|
|
681
|
+
// cycle to avoid firing option custom events twice on the same selection.
|
|
682
|
+
let valueReconciled = false;
|
|
683
|
+
|
|
649
684
|
// Handle null/undefined/empty case — empty/whitespace strings clear selection
|
|
650
685
|
// consistently with selectByValue(''), and avoid downstream `.includes('')` matches.
|
|
651
686
|
if (this.value === undefined || this.value === null || (typeof this.value === 'string' && this.value.trim() === '')) {
|
|
@@ -658,11 +693,31 @@ class AuroMenu extends AuroElement {
|
|
|
658
693
|
// Defensive default: `formattedValue` can be undefined for unexpected value types,
|
|
659
694
|
// and calling `.includes` on undefined would throw during reconciliation.
|
|
660
695
|
const valueArray = this.formattedValue || [];
|
|
661
|
-
const matchingOptions = this.items ? this.items.filter((item) => valueArray.includes(item.value)) : [];
|
|
696
|
+
const matchingOptions = this.items ? this.items.filter((item) => isSelectableByValue(item) && valueArray.includes(item.value)) : [];
|
|
662
697
|
newSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
698
|
+
|
|
699
|
+
// Reconcile `value` with the selectable set. Drop only entries whose option is
|
|
700
|
+
// loaded but non-selectable (disabled/static) — leaving them would desync `value`
|
|
701
|
+
// from `optionSelected`, and the toggle handlers rebuild `value` from `formattedValue`,
|
|
702
|
+
// so the rejected entry would resurface on the next select/deselect. Entries with no
|
|
703
|
+
// matching item yet are preserved so async preselection still works once options render.
|
|
704
|
+
const rejectedValues = this.items
|
|
705
|
+
? this.items.filter((item) => !isSelectableByValue(item) && valueArray.includes(item.value)).map((item) => item.value)
|
|
706
|
+
: [];
|
|
707
|
+
if (rejectedValues.length > 0) {
|
|
708
|
+
const reconciled = valueArray.filter((val) => !rejectedValues.includes(val));
|
|
709
|
+
this.value = serializeMultiSelectValue(reconciled);
|
|
710
|
+
valueReconciled = true;
|
|
711
|
+
}
|
|
663
712
|
} else {
|
|
664
|
-
// In single-select mode, this.value should be a string
|
|
665
|
-
|
|
713
|
+
// In single-select mode, this.value should be a string. Reject
|
|
714
|
+
// disabled/static options so a programmatic value pointing at a
|
|
715
|
+
// non-selectable option falls through to the no-match path below
|
|
716
|
+
// (dispatching auroMenu-selectValueFailure) instead of pinning it.
|
|
717
|
+
// `hidden` is intentionally NOT excluded: the combobox toggles
|
|
718
|
+
// `hidden` as its type-ahead filter, so a filtered-out option is
|
|
719
|
+
// still a valid programmatic selection.
|
|
720
|
+
const matchingOption = this.items ? this.items.find((item) => isSelectableByValue(item) && item.value === this.value) : undefined;
|
|
666
721
|
|
|
667
722
|
if (matchingOption) {
|
|
668
723
|
newSelected = matchingOption;
|
|
@@ -704,8 +759,9 @@ class AuroMenu extends AuroElement {
|
|
|
704
759
|
]
|
|
705
760
|
]));
|
|
706
761
|
|
|
707
|
-
// Notify of changes
|
|
708
|
-
|
|
762
|
+
// Notify of changes. Skip when reconciliation just reassigned `value`: the
|
|
763
|
+
// follow-on update cycle re-runs this branch and fires the events exactly once.
|
|
764
|
+
if (this.optionSelected !== undefined && !valueReconciled) {
|
|
709
765
|
const selected = Array.isArray(this.optionSelected) ? this.optionSelected : [this.optionSelected];
|
|
710
766
|
selected.forEach((opt) => {
|
|
711
767
|
if (opt.hasAttribute('event')) {
|
|
@@ -918,7 +974,7 @@ class AuroMenu extends AuroElement {
|
|
|
918
974
|
const currentSelected = this.optionSelected || [];
|
|
919
975
|
|
|
920
976
|
if (!currentValue.includes(option.value)) {
|
|
921
|
-
this.value =
|
|
977
|
+
this.value = serializeMultiSelectValue([
|
|
922
978
|
...currentValue,
|
|
923
979
|
option.value
|
|
924
980
|
]);
|
|
@@ -944,15 +1000,9 @@ class AuroMenu extends AuroElement {
|
|
|
944
1000
|
*/
|
|
945
1001
|
handleDeselectState(option) {
|
|
946
1002
|
if (this.multiSelect) {
|
|
947
|
-
// Remove this option from array
|
|
1003
|
+
// Remove this option from array; an empty result collapses `value` to undefined.
|
|
948
1004
|
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
949
|
-
|
|
950
|
-
// If array is empty after removal, set back to undefined
|
|
951
|
-
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
952
|
-
this.value = undefined;
|
|
953
|
-
} else {
|
|
954
|
-
this.value = JSON.stringify(newFormattedValue);
|
|
955
|
-
}
|
|
1005
|
+
this.value = serializeMultiSelectValue(newFormattedValue);
|
|
956
1006
|
|
|
957
1007
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
958
1008
|
if (this.optionSelected.length === 0) {
|
|
@@ -1453,6 +1503,7 @@ let menuOptionIdCounter = 0;
|
|
|
1453
1503
|
* The `auro-menuoption` element provides users a way to define a menu option.
|
|
1454
1504
|
* @customElement auro-menuoption
|
|
1455
1505
|
*
|
|
1506
|
+
* @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.
|
|
1456
1507
|
* @slot default - The default slot for the menu option text.
|
|
1457
1508
|
*
|
|
1458
1509
|
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
@@ -200,6 +200,18 @@ class AuroLibraryRuntimeUtils {
|
|
|
200
200
|
// See LICENSE in the project root for license information.
|
|
201
201
|
|
|
202
202
|
|
|
203
|
+
/**
|
|
204
|
+
* Serializes a multi-select value array back into the String `value` property.
|
|
205
|
+
* An empty (or missing) array collapses to `undefined` so an emptied selection
|
|
206
|
+
* clears `value` rather than reflecting a `"[]"` attribute.
|
|
207
|
+
* @private
|
|
208
|
+
* @param {Array<string>|undefined} values - The selected values.
|
|
209
|
+
* @returns {string|undefined} JSON string of the values, or undefined when empty.
|
|
210
|
+
*/
|
|
211
|
+
function serializeMultiSelectValue(values) {
|
|
212
|
+
return values && values.length > 0 ? JSON.stringify(values) : undefined;
|
|
213
|
+
}
|
|
214
|
+
|
|
203
215
|
/**
|
|
204
216
|
* Validates if an option can be interacted with.
|
|
205
217
|
* @private
|
|
@@ -212,6 +224,20 @@ function isOptionInteractive(option) {
|
|
|
212
224
|
!option.hasAttribute('static');
|
|
213
225
|
}
|
|
214
226
|
|
|
227
|
+
/**
|
|
228
|
+
* Validates if an option may be selected by matching a programmatic value.
|
|
229
|
+
* Unlike `isOptionInteractive`, `hidden` is allowed: the combobox toggles
|
|
230
|
+
* `hidden` as its type-ahead filter, so a filtered-out option is still a
|
|
231
|
+
* valid programmatic selection. Only disabled and static options — which are
|
|
232
|
+
* never selectable — are rejected.
|
|
233
|
+
* @param {HTMLElement} option - The option to check.
|
|
234
|
+
* @returns {boolean} True if option can be selected by value.
|
|
235
|
+
*/
|
|
236
|
+
function isSelectableByValue(option) {
|
|
237
|
+
return !option.hasAttribute('disabled') &&
|
|
238
|
+
!option.hasAttribute('static');
|
|
239
|
+
}
|
|
240
|
+
|
|
215
241
|
/**
|
|
216
242
|
* Helper method to dispatch custom events.
|
|
217
243
|
* @param {HTMLElement} element - Element to dispatch event from.
|
|
@@ -381,22 +407,26 @@ class AuroMenu extends AuroElement {
|
|
|
381
407
|
|
|
382
408
|
/**
|
|
383
409
|
* Specifies the current active menuOption.
|
|
410
|
+
* @readonly
|
|
384
411
|
*/
|
|
385
412
|
optionActive: {
|
|
386
413
|
type: Object,
|
|
387
|
-
attribute:
|
|
414
|
+
attribute: false
|
|
388
415
|
},
|
|
389
416
|
|
|
390
417
|
/**
|
|
391
418
|
* 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.
|
|
419
|
+
* @readonly
|
|
392
420
|
*/
|
|
393
421
|
optionSelected: {
|
|
394
422
|
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
395
|
-
type: Object
|
|
423
|
+
type: Object,
|
|
424
|
+
attribute: false
|
|
396
425
|
},
|
|
397
426
|
|
|
398
427
|
/**
|
|
399
428
|
* The value of the selected option. In multi-select mode, this is a JSON stringified array of selected option values.
|
|
429
|
+
* 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.
|
|
400
430
|
*/
|
|
401
431
|
value: {
|
|
402
432
|
type: String,
|
|
@@ -520,7 +550,7 @@ class AuroMenu extends AuroElement {
|
|
|
520
550
|
}
|
|
521
551
|
|
|
522
552
|
/**
|
|
523
|
-
* Selects options by value.
|
|
553
|
+
* 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.
|
|
524
554
|
* @param {string|string[]|undefined|null} value - The value(s) to select.
|
|
525
555
|
* @public
|
|
526
556
|
*/
|
|
@@ -605,6 +635,11 @@ class AuroMenu extends AuroElement {
|
|
|
605
635
|
this.initItems();
|
|
606
636
|
}
|
|
607
637
|
|
|
638
|
+
// Set when reconciliation reassigns `value` below. That reassignment schedules a
|
|
639
|
+
// second updated() cycle, so the `event`-attribute dispatch is deferred to that
|
|
640
|
+
// cycle to avoid firing option custom events twice on the same selection.
|
|
641
|
+
let valueReconciled = false;
|
|
642
|
+
|
|
608
643
|
// Handle null/undefined/empty case — empty/whitespace strings clear selection
|
|
609
644
|
// consistently with selectByValue(''), and avoid downstream `.includes('')` matches.
|
|
610
645
|
if (this.value === undefined || this.value === null || (typeof this.value === 'string' && this.value.trim() === '')) {
|
|
@@ -617,11 +652,31 @@ class AuroMenu extends AuroElement {
|
|
|
617
652
|
// Defensive default: `formattedValue` can be undefined for unexpected value types,
|
|
618
653
|
// and calling `.includes` on undefined would throw during reconciliation.
|
|
619
654
|
const valueArray = this.formattedValue || [];
|
|
620
|
-
const matchingOptions = this.items ? this.items.filter((item) => valueArray.includes(item.value)) : [];
|
|
655
|
+
const matchingOptions = this.items ? this.items.filter((item) => isSelectableByValue(item) && valueArray.includes(item.value)) : [];
|
|
621
656
|
newSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
657
|
+
|
|
658
|
+
// Reconcile `value` with the selectable set. Drop only entries whose option is
|
|
659
|
+
// loaded but non-selectable (disabled/static) — leaving them would desync `value`
|
|
660
|
+
// from `optionSelected`, and the toggle handlers rebuild `value` from `formattedValue`,
|
|
661
|
+
// so the rejected entry would resurface on the next select/deselect. Entries with no
|
|
662
|
+
// matching item yet are preserved so async preselection still works once options render.
|
|
663
|
+
const rejectedValues = this.items
|
|
664
|
+
? this.items.filter((item) => !isSelectableByValue(item) && valueArray.includes(item.value)).map((item) => item.value)
|
|
665
|
+
: [];
|
|
666
|
+
if (rejectedValues.length > 0) {
|
|
667
|
+
const reconciled = valueArray.filter((val) => !rejectedValues.includes(val));
|
|
668
|
+
this.value = serializeMultiSelectValue(reconciled);
|
|
669
|
+
valueReconciled = true;
|
|
670
|
+
}
|
|
622
671
|
} else {
|
|
623
|
-
// In single-select mode, this.value should be a string
|
|
624
|
-
|
|
672
|
+
// In single-select mode, this.value should be a string. Reject
|
|
673
|
+
// disabled/static options so a programmatic value pointing at a
|
|
674
|
+
// non-selectable option falls through to the no-match path below
|
|
675
|
+
// (dispatching auroMenu-selectValueFailure) instead of pinning it.
|
|
676
|
+
// `hidden` is intentionally NOT excluded: the combobox toggles
|
|
677
|
+
// `hidden` as its type-ahead filter, so a filtered-out option is
|
|
678
|
+
// still a valid programmatic selection.
|
|
679
|
+
const matchingOption = this.items ? this.items.find((item) => isSelectableByValue(item) && item.value === this.value) : undefined;
|
|
625
680
|
|
|
626
681
|
if (matchingOption) {
|
|
627
682
|
newSelected = matchingOption;
|
|
@@ -663,8 +718,9 @@ class AuroMenu extends AuroElement {
|
|
|
663
718
|
]
|
|
664
719
|
]));
|
|
665
720
|
|
|
666
|
-
// Notify of changes
|
|
667
|
-
|
|
721
|
+
// Notify of changes. Skip when reconciliation just reassigned `value`: the
|
|
722
|
+
// follow-on update cycle re-runs this branch and fires the events exactly once.
|
|
723
|
+
if (this.optionSelected !== undefined && !valueReconciled) {
|
|
668
724
|
const selected = Array.isArray(this.optionSelected) ? this.optionSelected : [this.optionSelected];
|
|
669
725
|
selected.forEach((opt) => {
|
|
670
726
|
if (opt.hasAttribute('event')) {
|
|
@@ -877,7 +933,7 @@ class AuroMenu extends AuroElement {
|
|
|
877
933
|
const currentSelected = this.optionSelected || [];
|
|
878
934
|
|
|
879
935
|
if (!currentValue.includes(option.value)) {
|
|
880
|
-
this.value =
|
|
936
|
+
this.value = serializeMultiSelectValue([
|
|
881
937
|
...currentValue,
|
|
882
938
|
option.value
|
|
883
939
|
]);
|
|
@@ -903,15 +959,9 @@ class AuroMenu extends AuroElement {
|
|
|
903
959
|
*/
|
|
904
960
|
handleDeselectState(option) {
|
|
905
961
|
if (this.multiSelect) {
|
|
906
|
-
// Remove this option from array
|
|
962
|
+
// Remove this option from array; an empty result collapses `value` to undefined.
|
|
907
963
|
const newFormattedValue = (this.formattedValue || []).filter((val) => val !== option.value);
|
|
908
|
-
|
|
909
|
-
// If array is empty after removal, set back to undefined
|
|
910
|
-
if (newFormattedValue && newFormattedValue.length === 0) {
|
|
911
|
-
this.value = undefined;
|
|
912
|
-
} else {
|
|
913
|
-
this.value = JSON.stringify(newFormattedValue);
|
|
914
|
-
}
|
|
964
|
+
this.value = serializeMultiSelectValue(newFormattedValue);
|
|
915
965
|
|
|
916
966
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
917
967
|
if (this.optionSelected.length === 0) {
|
|
@@ -1412,6 +1462,7 @@ let menuOptionIdCounter = 0;
|
|
|
1412
1462
|
* The `auro-menuoption` element provides users a way to define a menu option.
|
|
1413
1463
|
* @customElement auro-menuoption
|
|
1414
1464
|
*
|
|
1465
|
+
* @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.
|
|
1415
1466
|
* @slot default - The default slot for the menu option text.
|
|
1416
1467
|
*
|
|
1417
1468
|
* @event auroMenuOption-mouseover - Notifies that this option has been hovered over.
|
|
@@ -1227,7 +1227,7 @@ class AuroHelpText extends i$2 {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
var formkitVersion = '
|
|
1230
|
+
var formkitVersion = '202607082148';
|
|
1231
1231
|
|
|
1232
1232
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1233
1233
|
// See LICENSE in the project root for license information.
|
|
@@ -1227,7 +1227,7 @@ class AuroHelpText extends i$2 {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
var formkitVersion = '
|
|
1230
|
+
var formkitVersion = '202607082148';
|
|
1231
1231
|
|
|
1232
1232
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1233
1233
|
// See LICENSE in the project root for license information.
|
|
@@ -1227,7 +1227,7 @@ class AuroHelpText extends i$2 {
|
|
|
1227
1227
|
}
|
|
1228
1228
|
}
|
|
1229
1229
|
|
|
1230
|
-
var formkitVersion = '
|
|
1230
|
+
var formkitVersion = '202607082148';
|
|
1231
1231
|
|
|
1232
1232
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1233
1233
|
// See LICENSE in the project root for license information.
|
|
@@ -1166,7 +1166,7 @@ class AuroHelpText extends LitElement {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
1168
|
|
|
1169
|
-
var formkitVersion = '
|
|
1169
|
+
var formkitVersion = '202607082148';
|
|
1170
1170
|
|
|
1171
1171
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1172
1172
|
// See LICENSE in the project root for license information.
|
|
@@ -1166,7 +1166,7 @@ class AuroHelpText extends LitElement {
|
|
|
1166
1166
|
}
|
|
1167
1167
|
}
|
|
1168
1168
|
|
|
1169
|
-
var formkitVersion = '
|
|
1169
|
+
var formkitVersion = '202607082148';
|
|
1170
1170
|
|
|
1171
1171
|
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1172
1172
|
// See LICENSE in the project root for license information.
|
|
@@ -40,7 +40,7 @@ The `auro-select` element is a wrapper for auro-dropdown and auro-menu to create
|
|
|
40
40
|
| `size` | `size` | `'lg' \| 'xl'` | | Determines the size of the dropdown bib. Only the `emphasized` layout supports size=`xl`, while all other layouts support size=`lg`. |
|
|
41
41
|
| `typeaheadTimeoutMs` | `typeaheadTimeoutMs` | `number` | "500" | Milliseconds of keyboard inactivity before the type-ahead buffer resets.<br />Increase for users who type slowly. |
|
|
42
42
|
| `validity` | `validity` | `string` | | Specifies the `validityState` this element is in. |
|
|
43
|
-
| `value` | `value` | `string` | | Value selected for the component.
|
|
43
|
+
| `value` | `value` | `string` | | Value selected for the component. 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` is cleared to `undefined` while `optionSelected` is cleared to `undefined` in single-select or `[]` in multiSelect. `hidden` options remain selectable by value. |
|
|
44
44
|
|
|
45
45
|
## Methods
|
|
46
46
|
|
|
@@ -48,7 +48,7 @@ The `auro-select` element is a wrapper for auro-dropdown and auro-menu to create
|
|
|
48
48
|
|----------------------|----------------------------------------|--------------------------------------------------|
|
|
49
49
|
| `hideBib` | `(): void` | Hides the dropdown bib if its open. |
|
|
50
50
|
| `reset` | `(): void` | Resets component to initial state. |
|
|
51
|
-
| `setMenuValue` | `(value:
|
|
51
|
+
| `setMenuValue` | `(value: string): void` | Sets the selected value by matching it against the menu options. Options marked `disabled` or `static` are not selectable: if the value matches one, the selection is rejected and `value` is cleared to `undefined` while `optionSelected` is cleared to `undefined` in single-select or `[]` in multiSelect. `hidden` options remain selectable.<br /><br />**value**: The value to match against the menu options. |
|
|
52
52
|
| `showBib` | `(): void` | Shows the dropdown bib if there are options to show. |
|
|
53
53
|
| `updateActiveOption` | `(index: number): void` | Updates the active option in the menu.<br /><br />**index**: Index of the option to make active. |
|
|
54
54
|
| `validate` | `(force?: boolean \| undefined): void` | Validates value.<br /><br />**force**: Whether to force validation. |
|
|
@@ -907,6 +907,9 @@
|
|
|
907
907
|
<p>The component may be rendered with one or more <code>disabled</code> options. When navigating the list of options with the keyboard or assistive technology to mark the next or previous option as active, disabled options will be skipped, jumping to the next enabled option.</p>
|
|
908
908
|
<p>While using the pointer to mark options as active, hovering over disabled options will be ignored and the previous active option will remain active.</p>
|
|
909
909
|
<p class="note">
|
|
910
|
+
<strong>Note:</strong> Setting the component <code>value</code> to one that matches a <code>disabled</code> or <code>static</code> option — whether via the <code>value</code> attribute or programmatic assignment (e.g. <code>el.value = 'x'</code>) — is rejected: <code>value</code> and <code>optionSelected</code> are cleared to <code>undefined</code>. A value matching a <code>hidden</code> option is still applied.
|
|
911
|
+
</p>
|
|
912
|
+
<p class="note">
|
|
910
913
|
<strong>Note:</strong> If the currently <code>selected</code> option is marked as <code>disabled</code>, the component value is reset to <code>undefined</code> and the component validation workflow is performed (e.g., if the component instance is <code>required</code> it will set <code>validity="valueMissing".</code>).
|
|
911
914
|
</p>
|
|
912
915
|
<p class="note">
|