@aurodesignsystem-dev/auro-formkit 0.0.0-pr754.1 → 0.0.0-pr755.0
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/api.html +16 -10
- package/components/checkbox/demo/api.min.js +2 -2
- package/components/checkbox/demo/index.html +16 -10
- package/components/checkbox/demo/index.min.js +2 -2
- package/components/checkbox/demo/readme.html +16 -9
- package/components/checkbox/dist/index.js +2 -2
- package/components/checkbox/dist/registered.js +2 -2
- package/components/combobox/demo/api.html +16 -10
- package/components/combobox/demo/api.min.js +11 -35
- package/components/combobox/demo/index.html +16 -10
- package/components/combobox/demo/index.min.js +11 -35
- package/components/combobox/demo/readme.html +16 -9
- package/components/counter/demo/api.html +16 -10
- package/components/counter/demo/index.html +16 -10
- package/components/counter/demo/readme.html +16 -9
- package/components/datepicker/demo/api.html +16 -10
- package/components/datepicker/demo/index.html +16 -10
- package/components/datepicker/demo/readme.html +16 -9
- package/components/dropdown/demo/api.html +16 -10
- package/components/dropdown/demo/index.html +16 -10
- package/components/dropdown/demo/readme.html +16 -9
- package/components/form/demo/api.html +16 -9
- package/components/form/demo/autocomplete.html +19 -3
- package/components/form/demo/index.html +16 -9
- package/components/form/demo/readme.html +16 -9
- package/components/form/demo/working.html +19 -13
- package/components/input/demo/api.html +16 -10
- package/components/input/demo/index.html +16 -10
- package/components/input/demo/readme.html +16 -9
- package/components/menu/demo/api.html +16 -32
- package/components/menu/demo/api.md +14 -15
- package/components/menu/demo/api.min.js +11 -35
- package/components/menu/demo/index.html +16 -10
- package/components/menu/demo/index.min.js +11 -35
- package/components/menu/demo/readme.html +16 -9
- package/components/menu/dist/auro-menu.d.ts +2 -12
- package/components/menu/dist/index.js +11 -35
- package/components/menu/dist/registered.js +11 -35
- package/components/radio/demo/api.html +16 -10
- package/components/radio/demo/index.html +16 -10
- package/components/radio/demo/readme.html +16 -9
- package/components/select/demo/api.html +16 -10
- package/components/select/demo/api.md +29 -30
- package/components/select/demo/api.min.js +91 -64
- package/components/select/demo/index.html +16 -11
- package/components/select/demo/index.min.js +91 -64
- package/components/select/demo/readme.html +16 -9
- package/components/select/dist/auro-select.d.ts +3 -12
- package/components/select/dist/index.js +80 -29
- package/components/select/dist/registered.js +80 -29
- package/package.json +4 -4
|
@@ -7679,6 +7679,67 @@ class AuroHelpText extends i$2 {
|
|
|
7679
7679
|
|
|
7680
7680
|
var helpTextVersion = '1.0.0';
|
|
7681
7681
|
|
|
7682
|
+
i$5`:focus:not(:focus-visible){outline:3px solid transparent}:host{display:block;vertical-align:middle}:host .wrapper{box-sizing:border-box;display:inline-block;width:100%;margin:0;padding: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 [loadingplaceholder].empty{opacity:0;position:absolute}:host [loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;line-height:1;display:inline-block}:host [loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}:host([root]){overflow-y:auto}:host([root]) .wrapper[class*=-lg]{padding:var(--ds-size-150, 0.75rem)}:host([root]) .wrapper[class*=-xl]{padding:var(--ds-size-200, 1rem)}`;
|
|
7683
|
+
|
|
7684
|
+
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)}`;
|
|
7685
|
+
|
|
7686
|
+
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-container-border-color: var(--ds-auro-menuoption-container-color);--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
|
|
7687
|
+
|
|
7688
|
+
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
7689
|
+
// See LICENSE in the project root for license information.
|
|
7690
|
+
|
|
7691
|
+
// ---------------------------------------------------------------------
|
|
7692
|
+
|
|
7693
|
+
/**
|
|
7694
|
+
* Converts value to an array.
|
|
7695
|
+
* If the value is a JSON string representing an array, it will be parsed.
|
|
7696
|
+
* If the value is already an array, it is returned.
|
|
7697
|
+
* If the value is undefined, it returns undefined.
|
|
7698
|
+
* @private
|
|
7699
|
+
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
7700
|
+
* @returns {Array|undefined} - The converted array or undefined.
|
|
7701
|
+
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
7702
|
+
* or if the value cannot be parsed into an array from a JSON string.
|
|
7703
|
+
*/
|
|
7704
|
+
function arrayConverter(value) {
|
|
7705
|
+
// Allow undefined
|
|
7706
|
+
if (value === undefined) {
|
|
7707
|
+
return undefined;
|
|
7708
|
+
}
|
|
7709
|
+
|
|
7710
|
+
// Return the value if it is already an array
|
|
7711
|
+
if (Array.isArray(value)) {
|
|
7712
|
+
return value;
|
|
7713
|
+
}
|
|
7714
|
+
|
|
7715
|
+
try {
|
|
7716
|
+
// If value is a JSON string, parse it
|
|
7717
|
+
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
7718
|
+
|
|
7719
|
+
// Check if the parsed value is an array
|
|
7720
|
+
if (Array.isArray(parsed)) {
|
|
7721
|
+
return parsed;
|
|
7722
|
+
}
|
|
7723
|
+
} catch (error) {
|
|
7724
|
+
// If JSON parsing fails, continue to throw an error below
|
|
7725
|
+
/* eslint-disable no-console */
|
|
7726
|
+
console.error('JSON parsing failed:', error);
|
|
7727
|
+
}
|
|
7728
|
+
|
|
7729
|
+
// Throw error if the input is not an array or undefined
|
|
7730
|
+
throw new Error('Invalid value: Input must be an array or undefined');
|
|
7731
|
+
}
|
|
7732
|
+
|
|
7733
|
+
i$5`:host{cursor:pointer;user-select:none}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + 24px + var(--ds-size-100, 0.5rem));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box],:host .wrapper[class*=shape-snowflake]{border-radius:unset}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem)}:host .wrapper[class*=-lg]:not(:last-child){margin-bottom:var(--ds-size-50, 0.25rem)}:host .wrapper[class*=-xl]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem)}:host .wrapper[class*=-xl]:not(:last-child){margin-bottom:var(--ds-size-100, 0.5rem)}: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([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + 24px + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
7734
|
+
|
|
7735
|
+
i$5`:host .wrapper{border:1px solid var(--ds-auro-menuoption-container-border-color);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)}`;
|
|
7736
|
+
|
|
7737
|
+
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}`;
|
|
7738
|
+
|
|
7739
|
+
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)}`;
|
|
7740
|
+
|
|
7741
|
+
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)}:host([onDark][variant=statusError]){--ds-auro-icon-color:var(--ds-advanced-color-state-error-inverse, #f9a4a8)}`;
|
|
7742
|
+
|
|
7682
7743
|
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-dropdown]{--ds-auro-dropdown-trigger-border-color: var(--ds-auro-select-border-color);--ds-auro-dropdown-trigger-background-color: var(--ds-auro-select-background-color);--ds-auro-dropdown-trigger-container-color: var(--ds-auro-select-background-color)}:host([layout*=emphasized]) [auro-dropdown],:host([layout*=snowflake]) [auro-dropdown]{--ds-auro-select-border-color: transparent}.mainContent{position:relative;display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}.valueContainer [slot=displayValue]{display:none}.accents{display:flex;flex-direction:row;align-items:center;justify-content:center}::slotted([slot=typeIcon]){margin-right:8px}.displayValue{display:block}.displayValue:not(.force){display:none}.displayValue:not(.force).hasContent:is(.withValue):not(.hasFocus){display:block}.triggerContent{display:flex;width:100%;align-items:center;justify-content:center}:host([layout*=emphasized]) .triggerContent,:host([layout*=snowflake]) .triggerContent{padding:0 8px 0 24px}:host([layout*=snowflake]) [auro-dropdown] label.withValue{font-size:var(--ds-text-body-size-xs);line-height:20px}:host([layout*=emphasized]) [auro-dropdown] label.withValue{font-size:var(--ds-text-body-size-xs);line-height:20px}:host([layout*=classic]) .triggerContent{padding:0 8px}:host([layout*=classic]) .mainContent{align-items:start}:host([layout*=classic]) label{cursor:text;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host([layout*=classic]) label.withValue{font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}:host([layout*=classic]) .value{height:auto;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host(:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error, #e31f26);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([ondark]:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error-subtle, #fbc6c6);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}#slotHolder{display:none}:host([disabled]) *{user-select:none}`;
|
|
7683
7744
|
|
|
7684
7745
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
@@ -8010,12 +8071,11 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8010
8071
|
},
|
|
8011
8072
|
|
|
8012
8073
|
/**
|
|
8013
|
-
* Value selected for the component.
|
|
8074
|
+
* Value selected for the component. Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
8075
|
+
* @type {String|Array<String>}
|
|
8014
8076
|
*/
|
|
8015
8077
|
value: {
|
|
8016
|
-
type:
|
|
8017
|
-
reflect: true,
|
|
8018
|
-
attribute: 'value'
|
|
8078
|
+
type: Object
|
|
8019
8079
|
},
|
|
8020
8080
|
|
|
8021
8081
|
/**
|
|
@@ -8067,24 +8127,6 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8067
8127
|
];
|
|
8068
8128
|
}
|
|
8069
8129
|
|
|
8070
|
-
/**
|
|
8071
|
-
* Formatted value based on `multiSelect` state.
|
|
8072
|
-
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
8073
|
-
* @returns {String|Array<String>}
|
|
8074
|
-
*/
|
|
8075
|
-
get formattedValue() {
|
|
8076
|
-
if (this.multiSelect) {
|
|
8077
|
-
if (!this.value) {
|
|
8078
|
-
return undefined;
|
|
8079
|
-
}
|
|
8080
|
-
if (this.value.startsWith("[")) {
|
|
8081
|
-
return JSON.parse(this.value);
|
|
8082
|
-
}
|
|
8083
|
-
return [this.value];
|
|
8084
|
-
}
|
|
8085
|
-
return this.value;
|
|
8086
|
-
}
|
|
8087
|
-
|
|
8088
8130
|
/**
|
|
8089
8131
|
* Returns classmap configuration for html5 input labels in all layouts.
|
|
8090
8132
|
* @private
|
|
@@ -8503,6 +8545,14 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8503
8545
|
this.configureDropdown();
|
|
8504
8546
|
this.configureMenu();
|
|
8505
8547
|
this.configureSelect();
|
|
8548
|
+
|
|
8549
|
+
// Set the initial value in auro-menu if defined
|
|
8550
|
+
if (this.hasAttribute('value') && this.getAttribute('value').length > 0) {
|
|
8551
|
+
this.value = this.multiSelect ? arrayConverter(this.getAttribute('value')) : this.getAttribute('value');
|
|
8552
|
+
if (this.menu) {
|
|
8553
|
+
this.menu.value = this.value;
|
|
8554
|
+
}
|
|
8555
|
+
}
|
|
8506
8556
|
}
|
|
8507
8557
|
|
|
8508
8558
|
/**
|
|
@@ -8514,18 +8564,19 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8514
8564
|
async updateMenuValue(value) {
|
|
8515
8565
|
if (!this.menu) return;
|
|
8516
8566
|
|
|
8517
|
-
this.menu.setAttribute('value', value);
|
|
8518
8567
|
this.menu.value = value;
|
|
8519
8568
|
await this.menu.updateComplete;
|
|
8520
8569
|
}
|
|
8521
8570
|
|
|
8522
8571
|
async updated(changedProperties) {
|
|
8523
|
-
if (changedProperties.has('multiSelect')
|
|
8572
|
+
if (changedProperties.has('multiSelect')) {
|
|
8524
8573
|
this.clearSelection();
|
|
8525
8574
|
}
|
|
8526
8575
|
|
|
8527
8576
|
if (changedProperties.has('value')) {
|
|
8528
8577
|
if (this.value) {
|
|
8578
|
+
this.value = this.multiSelect ? arrayConverter(this.value) : this.value;
|
|
8579
|
+
|
|
8529
8580
|
await this.updateMenuValue(this.value);
|
|
8530
8581
|
|
|
8531
8582
|
if (this.menu) {
|
|
@@ -8551,7 +8602,7 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8551
8602
|
composed: true,
|
|
8552
8603
|
detail: {
|
|
8553
8604
|
optionSelected: this.optionSelected,
|
|
8554
|
-
value: this.
|
|
8605
|
+
value: this.value
|
|
8555
8606
|
}
|
|
8556
8607
|
}));
|
|
8557
8608
|
}
|
|
@@ -8610,13 +8661,13 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8610
8661
|
const selectedValue = selectedOption.value;
|
|
8611
8662
|
|
|
8612
8663
|
if (this.multiSelect) {
|
|
8613
|
-
const currentArray = this.
|
|
8664
|
+
const currentArray = Array.isArray(this.value) ? this.value : [];
|
|
8614
8665
|
|
|
8615
8666
|
if (!currentArray.includes(selectedValue)) {
|
|
8616
|
-
this.value =
|
|
8667
|
+
this.value = [
|
|
8617
8668
|
...currentArray,
|
|
8618
8669
|
selectedValue
|
|
8619
|
-
]
|
|
8670
|
+
];
|
|
8620
8671
|
}
|
|
8621
8672
|
} else {
|
|
8622
8673
|
const currentValue = this.value;
|
|
@@ -8639,7 +8690,7 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8639
8690
|
}
|
|
8640
8691
|
|
|
8641
8692
|
if (this.multiSelect) {
|
|
8642
|
-
nativeSelect.value = this.
|
|
8693
|
+
nativeSelect.value = this.value ? this.value[0] : '';
|
|
8643
8694
|
} else {
|
|
8644
8695
|
nativeSelect.value = this.value || '';
|
|
8645
8696
|
}
|
|
@@ -9063,6 +9114,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
9063
9114
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
9064
9115
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
9065
9116
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
9117
|
+
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
9066
9118
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
9067
9119
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
9068
9120
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -9175,14 +9227,9 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9175
9227
|
reflect: true,
|
|
9176
9228
|
attribute: 'multiselect'
|
|
9177
9229
|
},
|
|
9178
|
-
|
|
9179
|
-
/**
|
|
9180
|
-
* Value selected for the component.
|
|
9181
|
-
*/
|
|
9182
9230
|
value: {
|
|
9183
|
-
|
|
9184
|
-
|
|
9185
|
-
attribute: 'value'
|
|
9231
|
+
// Allow string, string[] arrays and undefined
|
|
9232
|
+
type: Object
|
|
9186
9233
|
},
|
|
9187
9234
|
|
|
9188
9235
|
/**
|
|
@@ -9217,24 +9264,6 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9217
9264
|
AuroLibraryRuntimeUtils$6.prototype.registerComponent(name, AuroMenu);
|
|
9218
9265
|
}
|
|
9219
9266
|
|
|
9220
|
-
/**
|
|
9221
|
-
* Formatted value based on `multiSelect` state.
|
|
9222
|
-
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
9223
|
-
* @returns {String|Array<String>}
|
|
9224
|
-
*/
|
|
9225
|
-
get formattedValue() {
|
|
9226
|
-
if (this.multiSelect) {
|
|
9227
|
-
if (!this.value) {
|
|
9228
|
-
return undefined;
|
|
9229
|
-
}
|
|
9230
|
-
if (this.value.startsWith("[")) {
|
|
9231
|
-
return JSON.parse(this.value);
|
|
9232
|
-
}
|
|
9233
|
-
return [this.value];
|
|
9234
|
-
}
|
|
9235
|
-
return this.value;
|
|
9236
|
-
}
|
|
9237
|
-
|
|
9238
9267
|
// Lifecycle Methods
|
|
9239
9268
|
|
|
9240
9269
|
connectedCallback() {
|
|
@@ -9277,7 +9306,7 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9277
9306
|
updated(changedProperties) {
|
|
9278
9307
|
super.updated(changedProperties);
|
|
9279
9308
|
|
|
9280
|
-
if (changedProperties.has('multiSelect')
|
|
9309
|
+
if (changedProperties.has('multiSelect')) {
|
|
9281
9310
|
// Reset selection if multiSelect mode changes
|
|
9282
9311
|
this.clearSelection();
|
|
9283
9312
|
}
|
|
@@ -9291,7 +9320,7 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9291
9320
|
} else {
|
|
9292
9321
|
if (this.multiSelect) {
|
|
9293
9322
|
// In multiselect mode, this.value should be an array of strings
|
|
9294
|
-
const valueArray = this.
|
|
9323
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
9295
9324
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
9296
9325
|
|
|
9297
9326
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -9458,14 +9487,14 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9458
9487
|
*/
|
|
9459
9488
|
handleSelectState(option) {
|
|
9460
9489
|
if (this.multiSelect) {
|
|
9461
|
-
const currentValue = this.
|
|
9490
|
+
const currentValue = this.value || [];
|
|
9462
9491
|
const currentSelected = this.optionSelected || [];
|
|
9463
9492
|
|
|
9464
9493
|
if (!currentValue.includes(option.value)) {
|
|
9465
|
-
this.value =
|
|
9494
|
+
this.value = [
|
|
9466
9495
|
...currentValue,
|
|
9467
9496
|
option.value
|
|
9468
|
-
]
|
|
9497
|
+
];
|
|
9469
9498
|
}
|
|
9470
9499
|
if (!currentSelected.includes(option)) {
|
|
9471
9500
|
this.optionSelected = [
|
|
@@ -9488,15 +9517,13 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9488
9517
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
9489
9518
|
*/
|
|
9490
9519
|
handleDeselectState(option) {
|
|
9491
|
-
if (this.multiSelect) {
|
|
9520
|
+
if (this.multiSelect && Array.isArray(this.value)) {
|
|
9492
9521
|
// Remove this option from array
|
|
9493
|
-
|
|
9522
|
+
this.value = this.value.filter((val) => val !== option.value);
|
|
9494
9523
|
|
|
9495
9524
|
// If array is empty after removal, set back to undefined
|
|
9496
|
-
if (
|
|
9525
|
+
if (this.value.length === 0) {
|
|
9497
9526
|
this.value = undefined;
|
|
9498
|
-
} else {
|
|
9499
|
-
this.value = JSON.stringify(newFormattedValue);
|
|
9500
9527
|
}
|
|
9501
9528
|
|
|
9502
9529
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|
|
@@ -16,19 +16,24 @@
|
|
|
16
16
|
<head>
|
|
17
17
|
<meta charset="UTF-8" />
|
|
18
18
|
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
|
|
19
|
-
<title>Auro Web Component
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/auro-classic/CSSCustomProperties.css"
|
|
26
|
-
|
|
19
|
+
<title>Auro Web Component Demo | auro-select</title>
|
|
20
|
+
|
|
21
|
+
<!-- Prism.js Stylesheet -->
|
|
22
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/prismjs@1.24.1/themes/prism.css"/>
|
|
23
|
+
|
|
24
|
+
<!-- Legacy reference is still needed to support auro-select's use of legacy token values at this time -->
|
|
25
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/legacy/auro-classic/CSSCustomProperties.css"/>
|
|
26
|
+
|
|
27
|
+
<!-- Design Token Alaska Theme -->
|
|
28
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@latest/dist/themes/alaska/CSSCustomProperties--alaska.min.css"/>
|
|
29
|
+
|
|
30
|
+
<!-- Webcore Stylesheet Alaska Theme -->
|
|
31
|
+
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/bundled/themes/alaska.global.min.css" />
|
|
32
|
+
|
|
33
|
+
<!-- Demo Specific Styles -->
|
|
27
34
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/demoWrapper.css" />
|
|
28
35
|
<link rel="stylesheet" type="text/css" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@latest/dist/elementDemoStyles.css" />
|
|
29
|
-
|
|
30
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-icon@8.0.3/dist/auro-icon__bundled.js" type="module"></script>
|
|
31
|
-
</head>
|
|
36
|
+
</head>
|
|
32
37
|
<body class="auro-markdown">
|
|
33
38
|
<main></main>
|
|
34
39
|
|
|
@@ -7587,6 +7587,67 @@ class AuroHelpText extends i$2 {
|
|
|
7587
7587
|
|
|
7588
7588
|
var helpTextVersion = '1.0.0';
|
|
7589
7589
|
|
|
7590
|
+
i$5`:focus:not(:focus-visible){outline:3px solid transparent}:host{display:block;vertical-align:middle}:host .wrapper{box-sizing:border-box;display:inline-block;width:100%;margin:0;padding: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 [loadingplaceholder].empty{opacity:0;position:absolute}:host [loadingplaceholder] slot[name=loadingIcon]{vertical-align:middle;line-height:1;display:inline-block}:host [loadingplaceholder] slot[name=loadingIcon]::slotted(*){margin-right:var(--ds-size-150, 0.75rem)}:host([root]){overflow-y:auto}:host([root]) .wrapper[class*=-lg]{padding:var(--ds-size-150, 0.75rem)}:host([root]) .wrapper[class*=-xl]{padding:var(--ds-size-200, 1rem)}`;
|
|
7591
|
+
|
|
7592
|
+
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)}`;
|
|
7593
|
+
|
|
7594
|
+
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-container-border-color: var(--ds-auro-menuoption-container-color);--ds-auro-menuoption-icon-color: transparent;--ds-auro-menuoption-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}`;
|
|
7595
|
+
|
|
7596
|
+
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
7597
|
+
// See LICENSE in the project root for license information.
|
|
7598
|
+
|
|
7599
|
+
// ---------------------------------------------------------------------
|
|
7600
|
+
|
|
7601
|
+
/**
|
|
7602
|
+
* Converts value to an array.
|
|
7603
|
+
* If the value is a JSON string representing an array, it will be parsed.
|
|
7604
|
+
* If the value is already an array, it is returned.
|
|
7605
|
+
* If the value is undefined, it returns undefined.
|
|
7606
|
+
* @private
|
|
7607
|
+
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
7608
|
+
* @returns {Array|undefined} - The converted array or undefined.
|
|
7609
|
+
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
7610
|
+
* or if the value cannot be parsed into an array from a JSON string.
|
|
7611
|
+
*/
|
|
7612
|
+
function arrayConverter(value) {
|
|
7613
|
+
// Allow undefined
|
|
7614
|
+
if (value === undefined) {
|
|
7615
|
+
return undefined;
|
|
7616
|
+
}
|
|
7617
|
+
|
|
7618
|
+
// Return the value if it is already an array
|
|
7619
|
+
if (Array.isArray(value)) {
|
|
7620
|
+
return value;
|
|
7621
|
+
}
|
|
7622
|
+
|
|
7623
|
+
try {
|
|
7624
|
+
// If value is a JSON string, parse it
|
|
7625
|
+
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
7626
|
+
|
|
7627
|
+
// Check if the parsed value is an array
|
|
7628
|
+
if (Array.isArray(parsed)) {
|
|
7629
|
+
return parsed;
|
|
7630
|
+
}
|
|
7631
|
+
} catch (error) {
|
|
7632
|
+
// If JSON parsing fails, continue to throw an error below
|
|
7633
|
+
/* eslint-disable no-console */
|
|
7634
|
+
console.error('JSON parsing failed:', error);
|
|
7635
|
+
}
|
|
7636
|
+
|
|
7637
|
+
// Throw error if the input is not an array or undefined
|
|
7638
|
+
throw new Error('Invalid value: Input must be an array or undefined');
|
|
7639
|
+
}
|
|
7640
|
+
|
|
7641
|
+
i$5`:host{cursor:pointer;user-select:none}:host .wrapper{display:flex;align-items:center;padding-right:var(--ds-size-200, 1rem);padding-left:calc(var(--ds-size-150, 0.75rem) + 24px + var(--ds-size-100, 0.5rem));padding-top:var(--ds-size-50, 0.25rem);padding-bottom:var(--ds-size-50, 0.25rem);-webkit-tap-highlight-color:transparent}:host .wrapper[class*=shape-box],:host .wrapper[class*=shape-snowflake]{border-radius:unset}:host .wrapper[class*=shape-pill]{border-radius:30px}:host .wrapper[class*=-lg]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-75, 0.375rem);padding-bottom:var(--ds-size-75, 0.375rem);padding-right:var(--ds-size-150, 0.75rem)}:host .wrapper[class*=-lg]:not(:last-child){margin-bottom:var(--ds-size-50, 0.25rem)}:host .wrapper[class*=-xl]{font-size:var(--ds-text-body-size-lg, 1.125rem);line-height:var(--ds-text-body-height-lg, 1.625rem);padding-top:var(--ds-size-100, 0.5rem);padding-bottom:var(--ds-size-100, 0.5rem);padding-right:var(--ds-size-200, 1rem)}:host .wrapper[class*=-xl]:not(:last-child){margin-bottom:var(--ds-size-100, 0.5rem)}: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([loadingplaceholder]) .wrapper{padding-left:calc(var(--ds-size-150, 0.75rem) + 24px + var(--ds-size-100, 0.5rem))}:host([selected]) .wrapper{padding-left:0}:host([nocheckmark]) .wrapper{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-lg]{padding-left:var(--ds-size-150, 0.75rem)}:host([nocheckmark]) .wrapper[class*=-xl]{padding-left:var(--ds-size-200, 1rem)}:host([hidden]){display:none}:host([static]){pointer-events:none}:host([disabled]:hover){cursor:auto}:host([disabled]){user-select:none;pointer-events:none}`;
|
|
7642
|
+
|
|
7643
|
+
i$5`:host .wrapper{border:1px solid var(--ds-auro-menuoption-container-border-color);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)}`;
|
|
7644
|
+
|
|
7645
|
+
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}`;
|
|
7646
|
+
|
|
7647
|
+
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)}`;
|
|
7648
|
+
|
|
7649
|
+
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)}:host([onDark][variant=statusError]){--ds-auro-icon-color:var(--ds-advanced-color-state-error-inverse, #f9a4a8)}`;
|
|
7650
|
+
|
|
7590
7651
|
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-dropdown]{--ds-auro-dropdown-trigger-border-color: var(--ds-auro-select-border-color);--ds-auro-dropdown-trigger-background-color: var(--ds-auro-select-background-color);--ds-auro-dropdown-trigger-container-color: var(--ds-auro-select-background-color)}:host([layout*=emphasized]) [auro-dropdown],:host([layout*=snowflake]) [auro-dropdown]{--ds-auro-select-border-color: transparent}.mainContent{position:relative;display:flex;flex:1;flex-direction:column;align-items:center;justify-content:center}.valueContainer [slot=displayValue]{display:none}.accents{display:flex;flex-direction:row;align-items:center;justify-content:center}::slotted([slot=typeIcon]){margin-right:8px}.displayValue{display:block}.displayValue:not(.force){display:none}.displayValue:not(.force).hasContent:is(.withValue):not(.hasFocus){display:block}.triggerContent{display:flex;width:100%;align-items:center;justify-content:center}:host([layout*=emphasized]) .triggerContent,:host([layout*=snowflake]) .triggerContent{padding:0 8px 0 24px}:host([layout*=snowflake]) [auro-dropdown] label.withValue{font-size:var(--ds-text-body-size-xs);line-height:20px}:host([layout*=emphasized]) [auro-dropdown] label.withValue{font-size:var(--ds-text-body-size-xs);line-height:20px}:host([layout*=classic]) .triggerContent{padding:0 8px}:host([layout*=classic]) .mainContent{align-items:start}:host([layout*=classic]) label{cursor:text;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host([layout*=classic]) label.withValue{font-size:12px;font-weight:450;letter-spacing:0;line-height:16px}:host([layout*=classic]) .value{height:auto;font-size:16px;font-weight:450;letter-spacing:0;line-height:24px}:host(:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error, #e31f26);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-default, #2a2a2a)}:host([ondark]:is([validity]:not([validity=valid]))) [auro-dropdown]{--ds-auro-select-border-color: var(--ds-basic-color-status-error-subtle, #fbc6c6);--ds-auro-dropdown-helptext-text-color: var(--ds-basic-color-texticon-inverse, #ffffff)}#slotHolder{display:none}:host([disabled]) *{user-select:none}`;
|
|
7591
7652
|
|
|
7592
7653
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
@@ -7918,12 +7979,11 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7918
7979
|
},
|
|
7919
7980
|
|
|
7920
7981
|
/**
|
|
7921
|
-
* Value selected for the component.
|
|
7982
|
+
* Value selected for the component. Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
7983
|
+
* @type {String|Array<String>}
|
|
7922
7984
|
*/
|
|
7923
7985
|
value: {
|
|
7924
|
-
type:
|
|
7925
|
-
reflect: true,
|
|
7926
|
-
attribute: 'value'
|
|
7986
|
+
type: Object
|
|
7927
7987
|
},
|
|
7928
7988
|
|
|
7929
7989
|
/**
|
|
@@ -7975,24 +8035,6 @@ class AuroSelect extends AuroElement$4 {
|
|
|
7975
8035
|
];
|
|
7976
8036
|
}
|
|
7977
8037
|
|
|
7978
|
-
/**
|
|
7979
|
-
* Formatted value based on `multiSelect` state.
|
|
7980
|
-
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
7981
|
-
* @returns {String|Array<String>}
|
|
7982
|
-
*/
|
|
7983
|
-
get formattedValue() {
|
|
7984
|
-
if (this.multiSelect) {
|
|
7985
|
-
if (!this.value) {
|
|
7986
|
-
return undefined;
|
|
7987
|
-
}
|
|
7988
|
-
if (this.value.startsWith("[")) {
|
|
7989
|
-
return JSON.parse(this.value);
|
|
7990
|
-
}
|
|
7991
|
-
return [this.value];
|
|
7992
|
-
}
|
|
7993
|
-
return this.value;
|
|
7994
|
-
}
|
|
7995
|
-
|
|
7996
8038
|
/**
|
|
7997
8039
|
* Returns classmap configuration for html5 input labels in all layouts.
|
|
7998
8040
|
* @private
|
|
@@ -8411,6 +8453,14 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8411
8453
|
this.configureDropdown();
|
|
8412
8454
|
this.configureMenu();
|
|
8413
8455
|
this.configureSelect();
|
|
8456
|
+
|
|
8457
|
+
// Set the initial value in auro-menu if defined
|
|
8458
|
+
if (this.hasAttribute('value') && this.getAttribute('value').length > 0) {
|
|
8459
|
+
this.value = this.multiSelect ? arrayConverter(this.getAttribute('value')) : this.getAttribute('value');
|
|
8460
|
+
if (this.menu) {
|
|
8461
|
+
this.menu.value = this.value;
|
|
8462
|
+
}
|
|
8463
|
+
}
|
|
8414
8464
|
}
|
|
8415
8465
|
|
|
8416
8466
|
/**
|
|
@@ -8422,18 +8472,19 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8422
8472
|
async updateMenuValue(value) {
|
|
8423
8473
|
if (!this.menu) return;
|
|
8424
8474
|
|
|
8425
|
-
this.menu.setAttribute('value', value);
|
|
8426
8475
|
this.menu.value = value;
|
|
8427
8476
|
await this.menu.updateComplete;
|
|
8428
8477
|
}
|
|
8429
8478
|
|
|
8430
8479
|
async updated(changedProperties) {
|
|
8431
|
-
if (changedProperties.has('multiSelect')
|
|
8480
|
+
if (changedProperties.has('multiSelect')) {
|
|
8432
8481
|
this.clearSelection();
|
|
8433
8482
|
}
|
|
8434
8483
|
|
|
8435
8484
|
if (changedProperties.has('value')) {
|
|
8436
8485
|
if (this.value) {
|
|
8486
|
+
this.value = this.multiSelect ? arrayConverter(this.value) : this.value;
|
|
8487
|
+
|
|
8437
8488
|
await this.updateMenuValue(this.value);
|
|
8438
8489
|
|
|
8439
8490
|
if (this.menu) {
|
|
@@ -8459,7 +8510,7 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8459
8510
|
composed: true,
|
|
8460
8511
|
detail: {
|
|
8461
8512
|
optionSelected: this.optionSelected,
|
|
8462
|
-
value: this.
|
|
8513
|
+
value: this.value
|
|
8463
8514
|
}
|
|
8464
8515
|
}));
|
|
8465
8516
|
}
|
|
@@ -8518,13 +8569,13 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8518
8569
|
const selectedValue = selectedOption.value;
|
|
8519
8570
|
|
|
8520
8571
|
if (this.multiSelect) {
|
|
8521
|
-
const currentArray = this.
|
|
8572
|
+
const currentArray = Array.isArray(this.value) ? this.value : [];
|
|
8522
8573
|
|
|
8523
8574
|
if (!currentArray.includes(selectedValue)) {
|
|
8524
|
-
this.value =
|
|
8575
|
+
this.value = [
|
|
8525
8576
|
...currentArray,
|
|
8526
8577
|
selectedValue
|
|
8527
|
-
]
|
|
8578
|
+
];
|
|
8528
8579
|
}
|
|
8529
8580
|
} else {
|
|
8530
8581
|
const currentValue = this.value;
|
|
@@ -8547,7 +8598,7 @@ class AuroSelect extends AuroElement$4 {
|
|
|
8547
8598
|
}
|
|
8548
8599
|
|
|
8549
8600
|
if (this.multiSelect) {
|
|
8550
|
-
nativeSelect.value = this.
|
|
8601
|
+
nativeSelect.value = this.value ? this.value[0] : '';
|
|
8551
8602
|
} else {
|
|
8552
8603
|
nativeSelect.value = this.value || '';
|
|
8553
8604
|
}
|
|
@@ -8971,6 +9022,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
8971
9022
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
8972
9023
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
8973
9024
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
9025
|
+
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
8974
9026
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
8975
9027
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
8976
9028
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -9083,14 +9135,9 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9083
9135
|
reflect: true,
|
|
9084
9136
|
attribute: 'multiselect'
|
|
9085
9137
|
},
|
|
9086
|
-
|
|
9087
|
-
/**
|
|
9088
|
-
* Value selected for the component.
|
|
9089
|
-
*/
|
|
9090
9138
|
value: {
|
|
9091
|
-
|
|
9092
|
-
|
|
9093
|
-
attribute: 'value'
|
|
9139
|
+
// Allow string, string[] arrays and undefined
|
|
9140
|
+
type: Object
|
|
9094
9141
|
},
|
|
9095
9142
|
|
|
9096
9143
|
/**
|
|
@@ -9125,24 +9172,6 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9125
9172
|
AuroLibraryRuntimeUtils$6.prototype.registerComponent(name, AuroMenu);
|
|
9126
9173
|
}
|
|
9127
9174
|
|
|
9128
|
-
/**
|
|
9129
|
-
* Formatted value based on `multiSelect` state.
|
|
9130
|
-
* Default type is `String`, changing to `Array<String>` when `multiSelect` is true.
|
|
9131
|
-
* @returns {String|Array<String>}
|
|
9132
|
-
*/
|
|
9133
|
-
get formattedValue() {
|
|
9134
|
-
if (this.multiSelect) {
|
|
9135
|
-
if (!this.value) {
|
|
9136
|
-
return undefined;
|
|
9137
|
-
}
|
|
9138
|
-
if (this.value.startsWith("[")) {
|
|
9139
|
-
return JSON.parse(this.value);
|
|
9140
|
-
}
|
|
9141
|
-
return [this.value];
|
|
9142
|
-
}
|
|
9143
|
-
return this.value;
|
|
9144
|
-
}
|
|
9145
|
-
|
|
9146
9175
|
// Lifecycle Methods
|
|
9147
9176
|
|
|
9148
9177
|
connectedCallback() {
|
|
@@ -9185,7 +9214,7 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9185
9214
|
updated(changedProperties) {
|
|
9186
9215
|
super.updated(changedProperties);
|
|
9187
9216
|
|
|
9188
|
-
if (changedProperties.has('multiSelect')
|
|
9217
|
+
if (changedProperties.has('multiSelect')) {
|
|
9189
9218
|
// Reset selection if multiSelect mode changes
|
|
9190
9219
|
this.clearSelection();
|
|
9191
9220
|
}
|
|
@@ -9199,7 +9228,7 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9199
9228
|
} else {
|
|
9200
9229
|
if (this.multiSelect) {
|
|
9201
9230
|
// In multiselect mode, this.value should be an array of strings
|
|
9202
|
-
const valueArray = this.
|
|
9231
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
9203
9232
|
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
9204
9233
|
|
|
9205
9234
|
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
@@ -9366,14 +9395,14 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9366
9395
|
*/
|
|
9367
9396
|
handleSelectState(option) {
|
|
9368
9397
|
if (this.multiSelect) {
|
|
9369
|
-
const currentValue = this.
|
|
9398
|
+
const currentValue = this.value || [];
|
|
9370
9399
|
const currentSelected = this.optionSelected || [];
|
|
9371
9400
|
|
|
9372
9401
|
if (!currentValue.includes(option.value)) {
|
|
9373
|
-
this.value =
|
|
9402
|
+
this.value = [
|
|
9374
9403
|
...currentValue,
|
|
9375
9404
|
option.value
|
|
9376
|
-
]
|
|
9405
|
+
];
|
|
9377
9406
|
}
|
|
9378
9407
|
if (!currentSelected.includes(option)) {
|
|
9379
9408
|
this.optionSelected = [
|
|
@@ -9396,15 +9425,13 @@ class AuroMenu extends AuroElement$4 {
|
|
|
9396
9425
|
* @param {HTMLElement} option - The menuoption to be deselected.
|
|
9397
9426
|
*/
|
|
9398
9427
|
handleDeselectState(option) {
|
|
9399
|
-
if (this.multiSelect) {
|
|
9428
|
+
if (this.multiSelect && Array.isArray(this.value)) {
|
|
9400
9429
|
// Remove this option from array
|
|
9401
|
-
|
|
9430
|
+
this.value = this.value.filter((val) => val !== option.value);
|
|
9402
9431
|
|
|
9403
9432
|
// If array is empty after removal, set back to undefined
|
|
9404
|
-
if (
|
|
9433
|
+
if (this.value.length === 0) {
|
|
9405
9434
|
this.value = undefined;
|
|
9406
|
-
} else {
|
|
9407
|
-
this.value = JSON.stringify(newFormattedValue);
|
|
9408
9435
|
}
|
|
9409
9436
|
|
|
9410
9437
|
this.optionSelected = this.optionSelected.filter((val) => val !== option);
|