@aurodesignsystem/auro-formkit 3.5.0-rc-627.2.1 → 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
|
@@ -12463,122 +12463,6 @@ class AuroBibtemplate extends i$2 {
|
|
|
12463
12463
|
|
|
12464
12464
|
var bibTemplateVersion = '1.0.0';
|
|
12465
12465
|
|
|
12466
|
-
i$5`:focus:not(:focus-visible){outline:3px solid transparent}:host{display:inline-block;width:100%;margin:0;padding:0;vertical-align:middle}:host ::slotted(auro-menuoption),:host ::slotted([auro-menuoption]),:host auro-menuoption[loadingplaceholder]{padding-left:calc(var(--ds-size-150, 0.75rem) + 24px + var(--ds-size-100, 0.5rem))}:host ::slotted([selected]){padding-left:0}:host ::slotted(hr){box-sizing:content-box !important;height:0 !important;overflow:visible !important;margin:var(--ds-size-100, 0.5rem) 0 !important;border-width:0 !important;border-top-width:1px !important;border-top-style:solid !important}:host([nocheckmark]) ::slotted(auro-menuoption),:host([nocheckmark]) auro-menuoption[loadingplaceholder]{padding-left:var(--ds-size-200, 1rem)}:host([root]){overflow-y:auto}[loadingplaceholder].empty{opacity:0;position:absolute}[loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;line-height:1;display:inline-block}[loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}`;
|
|
12467
|
-
|
|
12468
|
-
i$5`:host ::slotted(hr){border-top-color:var(--ds-auro-menu-divider-color)}[loadingplaceholder] slot[name=loadingIcon]{color:var(--ds-auro-menu-loader-color)}[loadingplaceholder] slot[name=loadingText]{color:var(--ds-auro-menu-loader-text-color)}`;
|
|
12469
|
-
|
|
12470
|
-
i$5`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-border-divider, rgba(0, 0, 0, 0.15));--ds-auro-menu-loader-color: var(--ds-basic-color-brand-primary, #01426a);--ds-auro-menu-loader-text-color: var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-menuoption-container-color: transparent;--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
|
|
12471
|
-
|
|
12472
|
-
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
12473
|
-
// See LICENSE in the project root for license information.
|
|
12474
|
-
|
|
12475
|
-
// ---------------------------------------------------------------------
|
|
12476
|
-
|
|
12477
|
-
/**
|
|
12478
|
-
* Converts value to an array.
|
|
12479
|
-
* If the value is a JSON string representing an array, it will be parsed.
|
|
12480
|
-
* If the value is already an array, it is returned.
|
|
12481
|
-
* If the value is undefined, it returns undefined.
|
|
12482
|
-
* @private
|
|
12483
|
-
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
12484
|
-
* @returns {Array|undefined} - The converted array or undefined.
|
|
12485
|
-
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
12486
|
-
* or if the value cannot be parsed into an array from a JSON string.
|
|
12487
|
-
*/
|
|
12488
|
-
function arrayConverter$1(value) {
|
|
12489
|
-
// Allow undefined
|
|
12490
|
-
if (value === undefined) {
|
|
12491
|
-
return undefined;
|
|
12492
|
-
}
|
|
12493
|
-
|
|
12494
|
-
// Return the value if it is already an array
|
|
12495
|
-
if (Array.isArray(value)) {
|
|
12496
|
-
return value;
|
|
12497
|
-
}
|
|
12498
|
-
|
|
12499
|
-
try {
|
|
12500
|
-
// If value is a JSON string, parse it
|
|
12501
|
-
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
12502
|
-
|
|
12503
|
-
// Check if the parsed value is an array
|
|
12504
|
-
if (Array.isArray(parsed)) {
|
|
12505
|
-
return parsed;
|
|
12506
|
-
}
|
|
12507
|
-
} catch (error) {
|
|
12508
|
-
// If JSON parsing fails, continue to throw an error below
|
|
12509
|
-
/* eslint-disable no-console */
|
|
12510
|
-
console.error('JSON parsing failed:', error);
|
|
12511
|
-
}
|
|
12512
|
-
|
|
12513
|
-
// Throw error if the input is not an array or undefined
|
|
12514
|
-
throw new Error('Invalid value: Input must be an array or undefined');
|
|
12515
|
-
}
|
|
12516
|
-
|
|
12517
|
-
/**
|
|
12518
|
-
* Compare two arrays for equality.
|
|
12519
|
-
* @private
|
|
12520
|
-
* @param {Array} arr1 - First array to compare.
|
|
12521
|
-
* @param {Array} arr2 - Second array to compare.
|
|
12522
|
-
* @returns {boolean} True if arrays are equal.
|
|
12523
|
-
*/
|
|
12524
|
-
function arraysAreEqual$1(arr1, arr2) {
|
|
12525
|
-
// If both arrays undefined, they are equal (true)
|
|
12526
|
-
if (arr1 === undefined || arr2 === undefined) {
|
|
12527
|
-
return arr1 === arr2;
|
|
12528
|
-
}
|
|
12529
|
-
|
|
12530
|
-
// If arrays have different lengths, they are not equal
|
|
12531
|
-
if (arr1.length !== arr2.length) {
|
|
12532
|
-
return false;
|
|
12533
|
-
}
|
|
12534
|
-
|
|
12535
|
-
// If every item at each index is the same, return true
|
|
12536
|
-
for (let index = 0; index < arr1.length; index += 1) {
|
|
12537
|
-
if (arr1[index] !== arr2[index]) {
|
|
12538
|
-
return false;
|
|
12539
|
-
}
|
|
12540
|
-
}
|
|
12541
|
-
return true;
|
|
12542
|
-
}
|
|
12543
|
-
|
|
12544
|
-
/**
|
|
12545
|
-
* Compares array for changes.
|
|
12546
|
-
* @private
|
|
12547
|
-
* @param {Array|any} newVal - New value to compare.
|
|
12548
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
12549
|
-
* @returns {boolean} True if arrays have changed.
|
|
12550
|
-
*/
|
|
12551
|
-
function arrayOrUndefinedHasChanged$1(newVal, oldVal) {
|
|
12552
|
-
try {
|
|
12553
|
-
// Check if values are undefined or arrays
|
|
12554
|
-
const isArrayOrUndefined = (val) => val === undefined || Array.isArray(val);
|
|
12555
|
-
|
|
12556
|
-
// If non-array or non-undefined, throw error
|
|
12557
|
-
if (!isArrayOrUndefined(newVal) || !isArrayOrUndefined(oldVal)) {
|
|
12558
|
-
const invalidValue = isArrayOrUndefined(newVal) ? oldVal : newVal;
|
|
12559
|
-
throw new Error(`Value must be an array or undefined, received ${typeof invalidValue}`);
|
|
12560
|
-
}
|
|
12561
|
-
|
|
12562
|
-
// Return true if arrays have changed, false if they are the same
|
|
12563
|
-
return !arraysAreEqual$1(newVal, oldVal);
|
|
12564
|
-
} catch (error) {
|
|
12565
|
-
/* eslint-disable no-console */
|
|
12566
|
-
console.error(error);
|
|
12567
|
-
// If validation fails, it has changed
|
|
12568
|
-
return true;
|
|
12569
|
-
}
|
|
12570
|
-
}
|
|
12571
|
-
|
|
12572
|
-
i$5`: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}`;
|
|
12573
|
-
|
|
12574
|
-
i$5`: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)}`;
|
|
12575
|
-
|
|
12576
|
-
i$5`:focus:not(:focus-visible){outline:3px solid transparent}.util_displayInline{display:inline}.util_displayInlineBlock{display:inline-block}.util_displayBlock,:host{display:block}.util_displayFlex{display:flex}.util_displayHidden,:host([hidden]:not(:focus):not(:active)){display:none}.util_displayHiddenVisually,:host([hiddenVisually]:not(:focus):not(:active)){position:absolute;overflow:hidden;clip:rect(1px, 1px, 1px, 1px);width:1px;height:1px;padding:0;border:0}.ico_squareLarge{fill:currentColor;height:var(--auro-size-lg, var(--ds-size-300, 1.5rem))}.ico_squareSmall{fill:currentColor;height:.6rem}.ico_squareMed{fill:currentColor;height:var(--auro-size-md, var(--ds-size-200, 1rem))}.ico_squareSml{fill:currentColor;height:var(--auro-size-sm, var(--ds-size-150, 0.75rem))}:host{color:currentColor;vertical-align:middle;line-height:1;display:inline-block}svg{min-width:var(--ds-auro-icon-size, 1.5rem) !important;width:var(--ds-auro-icon-size, 1.5rem) !important;height:var(--ds-auro-icon-size, 1.5rem) !important}.componentWrapper{display:flex}.svgWrapper{height:var(--ds-auro-icon-size);width:var(--ds-auro-icon-size)}.labelWrapper{margin-left:var(--ds-size-50, 0.25rem);line-height:1.8}`;
|
|
12577
|
-
|
|
12578
|
-
i$5`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-default, #2a2a2a);--ds-auro-alaska-color:#02426D;--ds-auro-icon-size:var(--ds-size-300, 1.5rem)}`;
|
|
12579
|
-
|
|
12580
|
-
i$5`:host{color:var(--ds-auro-icon-color)}:host([customColor]){color:inherit}:host(:not([onDark])[variant=accent1]){--ds-auro-icon-color:var(--ds-basic-color-texticon-accent1, #265688)}:host(:not([onDark])[variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-disabled, #d0d0d0)}:host(:not([onDark])[variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-muted, #676767)}:host(:not([onDark])[variant=statusDefault]){--ds-auro-icon-color:var(--ds-basic-color-status-default, #afb9c6)}:host(:not([onDark])[variant=statusInfo]){--ds-auro-icon-color:var(--ds-basic-color-status-info, #01426a)}:host(:not([onDark])[variant=statusSuccess]){--ds-auro-icon-color:var(--ds-basic-color-status-success, #447a1f)}:host(:not([onDark])[variant=statusWarning]){--ds-auro-icon-color:var(--ds-basic-color-status-warning, #fac200)}:host(:not([onDark])[variant=statusError]){--ds-auro-icon-color:var(--ds-basic-color-status-error, #e31f26)}:host(:not([onDark])[variant=statusInfoSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-info-subtle, #ebf3f9)}:host(:not([onDark])[variant=statusSuccessSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-success-subtle, #d6eac7)}:host(:not([onDark])[variant=statusWarningSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-warning-subtle, #fff0b2)}:host(:not([onDark])[variant=statusErrorSubtle]){--ds-auro-icon-color:var(--ds-basic-color-status-error-subtle, #fbc6c6)}:host(:not([onDark])[variant=fareBasicEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-basiceconomy, #97eaf8)}:host(:not([onDark])[variant=fareBusiness]){--ds-auro-icon-color:var(--ds-basic-color-fare-business, #01426a)}:host(:not([onDark])[variant=fareEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-economy, #0074ca)}:host(:not([onDark])[variant=fareFirst]){--ds-auro-icon-color:var(--ds-basic-color-fare-first, #00274a)}:host(:not([onDark])[variant=farePremiumEconomy]){--ds-auro-icon-color:var(--ds-basic-color-fare-premiumeconomy, #005154)}:host(:not([onDark])[variant=tierOneWorldEmerald]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-emerald, #139142)}:host(:not([onDark])[variant=tierOneWorldSapphire]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-sapphire, #015daa)}:host(:not([onDark])[variant=tierOneWorldRuby]){--ds-auro-icon-color:var(--ds-basic-color-tier-program-oneworld-ruby, #a41d4a)}:host([onDark]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse, #ffffff)}:host([onDark][variant=disabled]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-disabled, #7e8894)}:host([onDark][variant=muted]){--ds-auro-icon-color:var(--ds-basic-color-texticon-inverse-muted, #ccd2db)}`;
|
|
12581
|
-
|
|
12582
12466
|
var styleCss$3 = i$5`.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}[auro-input]{min-height:var(--ds-size-700, 3.5rem);max-height:var(--ds-size-700, 3.5rem)}[auro-input]::part(iconContainer){top:0;display:flex;height:100%;align-items:center}[auro-input]::part(accentIcon){transition:all .3s cubic-bezier(0.215, 0.61, 0.355, 1)}[auro-input]::part(helpText){display:none}[auro-input]::part(wrapper){--ds-auro-input-border-color: transparent;--ds-auro-input-container-color: transparent}[auro-input]::part(wrapper):focus-within{border-bottom-width:0 !important;box-shadow:unset !important;outline:unset !important}#slotHolder{display:none}`;
|
|
12583
12467
|
|
|
12584
12468
|
// Copyright (c) 2022 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
@@ -12770,11 +12654,10 @@ class AuroCombobox extends i$2 {
|
|
|
12770
12654
|
|
|
12771
12655
|
/**
|
|
12772
12656
|
* Specifies the current selected option.
|
|
12657
|
+
* @type {HTMLElement}
|
|
12773
12658
|
*/
|
|
12774
12659
|
optionSelected: {
|
|
12775
|
-
type: Object
|
|
12776
|
-
converter: arrayConverter$1,
|
|
12777
|
-
hasChanged: arrayOrUndefinedHasChanged$1
|
|
12660
|
+
type: Object
|
|
12778
12661
|
},
|
|
12779
12662
|
|
|
12780
12663
|
/**
|
|
@@ -12846,11 +12729,10 @@ class AuroCombobox extends i$2 {
|
|
|
12846
12729
|
|
|
12847
12730
|
/**
|
|
12848
12731
|
* Value selected for the dropdown menu.
|
|
12849
|
-
* @type {
|
|
12732
|
+
* @type {string}
|
|
12850
12733
|
*/
|
|
12851
12734
|
value: {
|
|
12852
|
-
|
|
12853
|
-
hasChanged: arrayOrUndefinedHasChanged$1
|
|
12735
|
+
type: Object
|
|
12854
12736
|
},
|
|
12855
12737
|
|
|
12856
12738
|
/**
|
|
@@ -12922,17 +12804,15 @@ class AuroCombobox extends i$2 {
|
|
|
12922
12804
|
|
|
12923
12805
|
if (this.menu.optionSelected) {
|
|
12924
12806
|
// Get first option since combobox is single-select
|
|
12925
|
-
const
|
|
12807
|
+
const selected = this.menu.optionSelected;
|
|
12926
12808
|
|
|
12927
|
-
if (!this.optionSelected || this.optionSelected
|
|
12928
|
-
|
|
12929
|
-
this.optionSelected = [selected];
|
|
12809
|
+
if (!this.optionSelected || this.optionSelected !== selected) {
|
|
12810
|
+
this.optionSelected = selected;
|
|
12930
12811
|
}
|
|
12931
12812
|
|
|
12932
|
-
if (!this.value || this.value
|
|
12933
|
-
|
|
12934
|
-
|
|
12935
|
-
// Menu already expects array
|
|
12813
|
+
if (!this.value || this.value !== selected.value) {
|
|
12814
|
+
this.value = selected.value;
|
|
12815
|
+
|
|
12936
12816
|
this.menu.value = this.value;
|
|
12937
12817
|
}
|
|
12938
12818
|
|
|
@@ -13112,14 +12992,14 @@ class AuroCombobox extends i$2 {
|
|
|
13112
12992
|
// handle the menu event for an option selection
|
|
13113
12993
|
this.menu.addEventListener('auroMenu-selectedOption', () => {
|
|
13114
12994
|
if (this.menu.optionSelected) {
|
|
13115
|
-
const
|
|
12995
|
+
const selected = this.menu.optionSelected;
|
|
13116
12996
|
|
|
13117
|
-
if (!this.optionSelected || this.optionSelected
|
|
13118
|
-
this.optionSelected =
|
|
12997
|
+
if (!this.optionSelected || this.optionSelected !== selected) {
|
|
12998
|
+
this.optionSelected = selected;
|
|
13119
12999
|
}
|
|
13120
13000
|
|
|
13121
|
-
if (!this.value || this.value
|
|
13122
|
-
this.value =
|
|
13001
|
+
if (!this.value || this.value !== this.optionSelected.value) {
|
|
13002
|
+
this.value = this.optionSelected.value;
|
|
13123
13003
|
this.menu.value = this.value;
|
|
13124
13004
|
}
|
|
13125
13005
|
|
|
@@ -13221,11 +13101,6 @@ class AuroCombobox extends i$2 {
|
|
|
13221
13101
|
if (document.activeElement !== this) {
|
|
13222
13102
|
this.validate();
|
|
13223
13103
|
}
|
|
13224
|
-
|
|
13225
|
-
// Set to undefined if empty
|
|
13226
|
-
if (this.value && this.value.length === 0) {
|
|
13227
|
-
this.value = undefined;
|
|
13228
|
-
}
|
|
13229
13104
|
});
|
|
13230
13105
|
|
|
13231
13106
|
// Handle validation messages from auroFormElement-validated event
|
|
@@ -13320,10 +13195,8 @@ class AuroCombobox extends i$2 {
|
|
|
13320
13195
|
|
|
13321
13196
|
let hasChange = false;
|
|
13322
13197
|
|
|
13323
|
-
|
|
13324
|
-
|
|
13325
|
-
// Menu expects an array
|
|
13326
|
-
this.menu.value = this.input.value ? [this.input.value] : undefined;
|
|
13198
|
+
if (!this.value || this.value !== this.input.value) {
|
|
13199
|
+
this.menu.value = this.input.value;
|
|
13327
13200
|
this.value = this.menu.value;
|
|
13328
13201
|
hasChange = true;
|
|
13329
13202
|
this.dispatchEvent(new CustomEvent('auroCombobox-valueSet', {
|
|
@@ -13333,7 +13206,7 @@ class AuroCombobox extends i$2 {
|
|
|
13333
13206
|
}));
|
|
13334
13207
|
}
|
|
13335
13208
|
|
|
13336
|
-
if (this.optionSelected && this.
|
|
13209
|
+
if (this.optionSelected && this.input.value !== this.optionSelected.textContent) {
|
|
13337
13210
|
this.optionSelected = undefined;
|
|
13338
13211
|
hasChange = true;
|
|
13339
13212
|
}
|
|
@@ -13476,15 +13349,15 @@ class AuroCombobox extends i$2 {
|
|
|
13476
13349
|
// After the component is ready, send direct value changes to auro-menu.
|
|
13477
13350
|
if (changedProperties.has('value')) {
|
|
13478
13351
|
if (this.value) {
|
|
13479
|
-
if (this.optionSelected && this.optionSelected
|
|
13352
|
+
if (this.optionSelected && this.optionSelected.value === this.value) {
|
|
13480
13353
|
// If value updates and the previously selected option already matches the new value
|
|
13481
13354
|
// just update the input value to use the textContent of the optionSelected
|
|
13482
|
-
this.input.value = this.optionSelected
|
|
13355
|
+
this.input.value = this.optionSelected.textContent;
|
|
13483
13356
|
} else {
|
|
13484
13357
|
// Otherwise just enter the value into the input
|
|
13485
13358
|
this.optionSelected = undefined;
|
|
13486
|
-
|
|
13487
|
-
const
|
|
13359
|
+
|
|
13360
|
+
const inputValue = this.value;
|
|
13488
13361
|
this.input.value = inputValue;
|
|
13489
13362
|
|
|
13490
13363
|
// Update the menu value and matchWord
|
|
@@ -13642,102 +13515,6 @@ var tokensCss$1 = i$5`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-b
|
|
|
13642
13515
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
13643
13516
|
// See LICENSE in the project root for license information.
|
|
13644
13517
|
|
|
13645
|
-
// ---------------------------------------------------------------------
|
|
13646
|
-
|
|
13647
|
-
/**
|
|
13648
|
-
* Converts value to an array.
|
|
13649
|
-
* If the value is a JSON string representing an array, it will be parsed.
|
|
13650
|
-
* If the value is already an array, it is returned.
|
|
13651
|
-
* If the value is undefined, it returns undefined.
|
|
13652
|
-
* @private
|
|
13653
|
-
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
13654
|
-
* @returns {Array|undefined} - The converted array or undefined.
|
|
13655
|
-
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
13656
|
-
* or if the value cannot be parsed into an array from a JSON string.
|
|
13657
|
-
*/
|
|
13658
|
-
function arrayConverter(value) {
|
|
13659
|
-
// Allow undefined
|
|
13660
|
-
if (value === undefined) {
|
|
13661
|
-
return undefined;
|
|
13662
|
-
}
|
|
13663
|
-
|
|
13664
|
-
// Return the value if it is already an array
|
|
13665
|
-
if (Array.isArray(value)) {
|
|
13666
|
-
return value;
|
|
13667
|
-
}
|
|
13668
|
-
|
|
13669
|
-
try {
|
|
13670
|
-
// If value is a JSON string, parse it
|
|
13671
|
-
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
13672
|
-
|
|
13673
|
-
// Check if the parsed value is an array
|
|
13674
|
-
if (Array.isArray(parsed)) {
|
|
13675
|
-
return parsed;
|
|
13676
|
-
}
|
|
13677
|
-
} catch (error) {
|
|
13678
|
-
// If JSON parsing fails, continue to throw an error below
|
|
13679
|
-
/* eslint-disable no-console */
|
|
13680
|
-
console.error('JSON parsing failed:', error);
|
|
13681
|
-
}
|
|
13682
|
-
|
|
13683
|
-
// Throw error if the input is not an array or undefined
|
|
13684
|
-
throw new Error('Invalid value: Input must be an array or undefined');
|
|
13685
|
-
}
|
|
13686
|
-
|
|
13687
|
-
/**
|
|
13688
|
-
* Compare two arrays for equality.
|
|
13689
|
-
* @private
|
|
13690
|
-
* @param {Array} arr1 - First array to compare.
|
|
13691
|
-
* @param {Array} arr2 - Second array to compare.
|
|
13692
|
-
* @returns {boolean} True if arrays are equal.
|
|
13693
|
-
*/
|
|
13694
|
-
function arraysAreEqual(arr1, arr2) {
|
|
13695
|
-
// If both arrays undefined, they are equal (true)
|
|
13696
|
-
if (arr1 === undefined || arr2 === undefined) {
|
|
13697
|
-
return arr1 === arr2;
|
|
13698
|
-
}
|
|
13699
|
-
|
|
13700
|
-
// If arrays have different lengths, they are not equal
|
|
13701
|
-
if (arr1.length !== arr2.length) {
|
|
13702
|
-
return false;
|
|
13703
|
-
}
|
|
13704
|
-
|
|
13705
|
-
// If every item at each index is the same, return true
|
|
13706
|
-
for (let index = 0; index < arr1.length; index += 1) {
|
|
13707
|
-
if (arr1[index] !== arr2[index]) {
|
|
13708
|
-
return false;
|
|
13709
|
-
}
|
|
13710
|
-
}
|
|
13711
|
-
return true;
|
|
13712
|
-
}
|
|
13713
|
-
|
|
13714
|
-
/**
|
|
13715
|
-
* Compares array for changes.
|
|
13716
|
-
* @private
|
|
13717
|
-
* @param {Array|any} newVal - New value to compare.
|
|
13718
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
13719
|
-
* @returns {boolean} True if arrays have changed.
|
|
13720
|
-
*/
|
|
13721
|
-
function arrayOrUndefinedHasChanged(newVal, oldVal) {
|
|
13722
|
-
try {
|
|
13723
|
-
// Check if values are undefined or arrays
|
|
13724
|
-
const isArrayOrUndefined = (val) => val === undefined || Array.isArray(val);
|
|
13725
|
-
|
|
13726
|
-
// If non-array or non-undefined, throw error
|
|
13727
|
-
if (!isArrayOrUndefined(newVal) || !isArrayOrUndefined(oldVal)) {
|
|
13728
|
-
const invalidValue = isArrayOrUndefined(newVal) ? oldVal : newVal;
|
|
13729
|
-
throw new Error(`Value must be an array or undefined, received ${typeof invalidValue}`);
|
|
13730
|
-
}
|
|
13731
|
-
|
|
13732
|
-
// Return true if arrays have changed, false if they are the same
|
|
13733
|
-
return !arraysAreEqual(newVal, oldVal);
|
|
13734
|
-
} catch (error) {
|
|
13735
|
-
/* eslint-disable no-console */
|
|
13736
|
-
console.error(error);
|
|
13737
|
-
// If validation fails, it has changed
|
|
13738
|
-
return true;
|
|
13739
|
-
}
|
|
13740
|
-
}
|
|
13741
13518
|
|
|
13742
13519
|
/**
|
|
13743
13520
|
* Validates if an option can be interacted with.
|
|
@@ -13771,7 +13548,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
13771
13548
|
element.dispatchEvent(new CustomEvent(eventName, eventConfig));
|
|
13772
13549
|
}
|
|
13773
13550
|
|
|
13774
|
-
// Copyright (c)
|
|
13551
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
13775
13552
|
// See LICENSE in the project root for license information.
|
|
13776
13553
|
|
|
13777
13554
|
|
|
@@ -13779,14 +13556,14 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
13779
13556
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
13780
13557
|
/**
|
|
13781
13558
|
* The auro-menu element provides users a way to select from a list of options.
|
|
13782
|
-
* @attr {Array<HTMLElement
|
|
13559
|
+
* @attr {HTMLElement|Array<HTMLElement>} optionSelected - An array of currently selected menu options, type `HTMLElement` by default. In multi-select mode, `optionSelected` is an array of HTML elements.
|
|
13783
13560
|
* @attr {object} optionactive - Specifies the current active menuOption.
|
|
13784
13561
|
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
13785
13562
|
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
13786
13563
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
13787
13564
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
13788
13565
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
13789
|
-
* @attr {Array<string
|
|
13566
|
+
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
13790
13567
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
13791
13568
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
13792
13569
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -13799,7 +13576,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
13799
13576
|
* @slot - Slot for insertion of menu options.
|
|
13800
13577
|
*/
|
|
13801
13578
|
|
|
13802
|
-
/* eslint-disable no-magic-numbers, max-lines */
|
|
13579
|
+
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
|
|
13803
13580
|
|
|
13804
13581
|
class AuroMenu extends i$2 {
|
|
13805
13582
|
constructor() {
|
|
@@ -13879,9 +13656,8 @@ class AuroMenu extends i$2 {
|
|
|
13879
13656
|
reflect: true
|
|
13880
13657
|
},
|
|
13881
13658
|
optionSelected: {
|
|
13882
|
-
// Allow HTMLElement[] arrays and undefined
|
|
13883
|
-
|
|
13884
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
13659
|
+
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
13660
|
+
type: Object
|
|
13885
13661
|
},
|
|
13886
13662
|
optionActive: {
|
|
13887
13663
|
type: Object,
|
|
@@ -13897,10 +13673,8 @@ class AuroMenu extends i$2 {
|
|
|
13897
13673
|
attribute: 'multiselect'
|
|
13898
13674
|
},
|
|
13899
13675
|
value: {
|
|
13900
|
-
// Allow string[] arrays and undefined
|
|
13901
|
-
type: Object
|
|
13902
|
-
converter: arrayConverter,
|
|
13903
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
13676
|
+
// Allow string, string[] arrays and undefined
|
|
13677
|
+
type: Object
|
|
13904
13678
|
}
|
|
13905
13679
|
};
|
|
13906
13680
|
}
|
|
@@ -13953,30 +13727,39 @@ class AuroMenu extends i$2 {
|
|
|
13953
13727
|
}
|
|
13954
13728
|
|
|
13955
13729
|
updated(changedProperties) {
|
|
13730
|
+
if (changedProperties.has('multiSelect')) {
|
|
13731
|
+
// Reset selection if multiSelect mode changes
|
|
13732
|
+
this.clearSelection();
|
|
13733
|
+
}
|
|
13734
|
+
|
|
13956
13735
|
if (changedProperties.has('value')) {
|
|
13957
13736
|
// Handle null/undefined case
|
|
13958
13737
|
if (this.value === undefined || this.value === null) {
|
|
13959
13738
|
this.optionSelected = undefined;
|
|
13960
|
-
// Reset index tracking
|
|
13961
13739
|
this.index = -1;
|
|
13962
13740
|
} else {
|
|
13963
|
-
|
|
13964
|
-
|
|
13741
|
+
if (this.multiSelect) {
|
|
13742
|
+
// In multiselect mode, this.value should be an array of strings
|
|
13743
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
13744
|
+
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
13965
13745
|
|
|
13966
|
-
|
|
13967
|
-
|
|
13746
|
+
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
13747
|
+
} else {
|
|
13748
|
+
// In single-select mode, this.value should be a string
|
|
13749
|
+
const matchingOptions = this.items.find((item) => item.value === this.value);
|
|
13968
13750
|
|
|
13969
|
-
|
|
13970
|
-
if (this.multiSelect) {
|
|
13971
|
-
// For multiselect, keep all matching options
|
|
13751
|
+
if (matchingOptions) {
|
|
13972
13752
|
this.optionSelected = matchingOptions;
|
|
13753
|
+
this.index = this.items.indexOf(matchingOptions);
|
|
13973
13754
|
} else {
|
|
13974
|
-
//
|
|
13975
|
-
this.optionSelected =
|
|
13976
|
-
this.index =
|
|
13755
|
+
// If no matching option found, reset selection
|
|
13756
|
+
this.optionSelected = undefined;
|
|
13757
|
+
this.index = -1;
|
|
13977
13758
|
}
|
|
13978
|
-
}
|
|
13979
|
-
|
|
13759
|
+
}
|
|
13760
|
+
|
|
13761
|
+
// If no matching options were found in either mode
|
|
13762
|
+
if (!this.optionSelected || (Array.isArray(this.optionSelected) && this.optionSelected.length === 0)) {
|
|
13980
13763
|
dispatchMenuEvent(this, 'auroMenu-selectValueFailure');
|
|
13981
13764
|
this.optionSelected = undefined;
|
|
13982
13765
|
this.index = -1;
|
|
@@ -14128,8 +13911,8 @@ class AuroMenu extends i$2 {
|
|
|
14128
13911
|
}
|
|
14129
13912
|
} else {
|
|
14130
13913
|
// Single select - use arrays with single values
|
|
14131
|
-
this.value =
|
|
14132
|
-
this.optionSelected =
|
|
13914
|
+
this.value = option.value;
|
|
13915
|
+
this.optionSelected = option;
|
|
14133
13916
|
}
|
|
14134
13917
|
|
|
14135
13918
|
this.index = this.items.indexOf(option);
|
|
@@ -14451,8 +14234,13 @@ class AuroMenu extends i$2 {
|
|
|
14451
14234
|
if (!this.optionSelected) {
|
|
14452
14235
|
return false;
|
|
14453
14236
|
}
|
|
14454
|
-
|
|
14455
|
-
|
|
14237
|
+
|
|
14238
|
+
if (this.multiSelect) {
|
|
14239
|
+
// In multi-select mode, check if the option is in the selected array
|
|
14240
|
+
return Array.isArray(this.optionSelected) && this.optionSelected.some((selectedOption) => selectedOption === option);
|
|
14241
|
+
}
|
|
14242
|
+
|
|
14243
|
+
return this.optionSelected === option;
|
|
14456
14244
|
}
|
|
14457
14245
|
|
|
14458
14246
|
/**
|
|
@@ -111,7 +111,7 @@ The use of any Auro custom element has a dependency on the [Auro Design Tokens](
|
|
|
111
111
|
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
|
|
112
112
|
|
|
113
113
|
```html
|
|
114
|
-
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@
|
|
114
|
+
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@latest/auro-combobox/+esm"></script>
|
|
115
115
|
```
|
|
116
116
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
117
117
|
|
|
@@ -108,12 +108,9 @@ export class AuroCombobox extends LitElement {
|
|
|
108
108
|
};
|
|
109
109
|
/**
|
|
110
110
|
* Specifies the current selected option.
|
|
111
|
+
* @type {HTMLElement}
|
|
111
112
|
*/
|
|
112
|
-
optionSelected:
|
|
113
|
-
type: ObjectConstructor;
|
|
114
|
-
converter: typeof arrayConverter;
|
|
115
|
-
hasChanged: typeof arrayOrUndefinedHasChanged;
|
|
116
|
-
};
|
|
113
|
+
optionSelected: HTMLElement;
|
|
117
114
|
/**
|
|
118
115
|
* Position where the bib should appear relative to the trigger.
|
|
119
116
|
* Accepted values:
|
|
@@ -175,9 +172,9 @@ export class AuroCombobox extends LitElement {
|
|
|
175
172
|
};
|
|
176
173
|
/**
|
|
177
174
|
* Value selected for the dropdown menu.
|
|
178
|
-
* @type {
|
|
175
|
+
* @type {string}
|
|
179
176
|
*/
|
|
180
|
-
value:
|
|
177
|
+
value: string;
|
|
181
178
|
/**
|
|
182
179
|
* If declared, make bib.fullscreen.headline in HeadingDisplay.
|
|
183
180
|
* Otherwise, Heading 600
|
|
@@ -229,7 +226,7 @@ export class AuroCombobox extends LitElement {
|
|
|
229
226
|
noFilter: boolean;
|
|
230
227
|
validity: any;
|
|
231
228
|
value: any;
|
|
232
|
-
optionSelected: any
|
|
229
|
+
optionSelected: any;
|
|
233
230
|
checkmark: boolean;
|
|
234
231
|
disabled: boolean;
|
|
235
232
|
noValidate: boolean;
|
|
@@ -380,5 +377,3 @@ export class AuroCombobox extends LitElement {
|
|
|
380
377
|
}
|
|
381
378
|
import { LitElement } from "lit";
|
|
382
379
|
import AuroFormValidation from '@auro-formkit/form-validation';
|
|
383
|
-
import { arrayConverter } from '@aurodesignsystem/auro-menu';
|
|
384
|
-
import { arrayOrUndefinedHasChanged } from '@aurodesignsystem/auro-menu';
|