@aurodesignsystem-dev/auro-formkit 0.0.0-pr624.0 → 0.0.0-pr624.10
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/bibtemplate/dist/auro-bibtemplate.d.ts +1 -0
- package/components/bibtemplate/dist/index.js +88 -6
- package/components/bibtemplate/dist/registered.js +88 -6
- package/components/checkbox/demo/api.min.js +4 -3
- package/components/checkbox/demo/index.min.js +4 -3
- package/components/checkbox/dist/index.js +4 -3
- package/components/checkbox/dist/registered.js +4 -3
- package/components/combobox/demo/api.md +30 -29
- package/components/combobox/demo/api.min.js +609 -532
- package/components/combobox/demo/index.html +0 -1
- package/components/combobox/demo/index.md +43 -0
- package/components/combobox/demo/index.min.js +607 -530
- package/components/combobox/dist/auro-combobox.d.ts +13 -18
- package/components/combobox/dist/index.js +479 -387
- package/components/combobox/dist/registered.js +479 -387
- package/components/counter/demo/api.min.js +377 -62
- package/components/counter/demo/index.min.js +377 -62
- package/components/counter/dist/index.js +377 -62
- package/components/counter/dist/registered.js +377 -62
- package/components/datepicker/demo/api.md +13 -5
- package/components/datepicker/demo/api.min.js +868 -438
- package/components/datepicker/demo/index.md +13 -0
- package/components/datepicker/demo/index.min.js +868 -438
- package/components/datepicker/dist/auro-datepicker.d.ts +21 -2
- package/components/datepicker/dist/index.js +710 -280
- package/components/datepicker/dist/registered.js +710 -280
- package/components/dropdown/demo/api.md +2 -2
- package/components/dropdown/demo/api.min.js +199 -37
- package/components/dropdown/demo/index.md +45 -0
- package/components/dropdown/demo/index.min.js +199 -37
- package/components/dropdown/dist/auro-dropdown.d.ts +10 -1
- package/components/dropdown/dist/auro-dropdownBib.d.ts +8 -0
- package/components/dropdown/dist/index.js +199 -37
- package/components/dropdown/dist/registered.js +199 -37
- package/components/dropdown/dist/styles/classic/color-css.d.ts +2 -0
- package/components/dropdown/dist/styles/classic/style-css.d.ts +2 -0
- package/components/input/README.md +1 -1
- package/components/input/demo/api.md +57 -53
- package/components/input/demo/api.min.js +142 -141
- package/components/input/demo/index.md +4 -4
- package/components/input/demo/index.min.js +142 -141
- package/components/input/demo/readme.md +1 -1
- package/components/input/dist/auro-input.d.ts +22 -13
- package/components/input/dist/base-input.d.ts +1 -1
- package/components/input/dist/index.js +142 -141
- package/components/input/dist/registered.js +142 -141
- package/components/input/dist/styles/classic/color-css.d.ts +2 -0
- package/components/input/dist/styles/classic/style-css.d.ts +2 -0
- package/components/layoutElement/dist/index.d.ts +1 -0
- package/components/layoutElement/dist/index.js +95 -1
- package/components/menu/demo/api.md +11 -11
- package/components/menu/demo/api.min.js +115 -130
- package/components/menu/demo/index.min.js +115 -130
- 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 +116 -90
- package/components/menu/dist/registered.js +115 -130
- package/components/radio/demo/api.min.js +4 -3
- package/components/radio/demo/index.min.js +4 -3
- package/components/radio/dist/index.js +4 -3
- package/components/radio/dist/registered.js +4 -3
- package/components/select/demo/api.js +2 -0
- package/components/select/demo/api.md +108 -42
- package/components/select/demo/api.min.js +1264 -352
- package/components/select/demo/index.html +1 -0
- package/components/select/demo/index.md +298 -777
- package/components/select/demo/index.min.js +1251 -351
- package/components/select/dist/auro-select.d.ts +110 -18
- package/components/select/dist/helptextVersion.d.ts +2 -0
- package/components/select/dist/index.js +1105 -190
- package/components/select/dist/registered.js +1105 -190
- package/components/select/dist/styles/shapeSize-css.d.ts +2 -0
- package/components/select/dist/styles/tokens-css.d.ts +2 -0
- package/package.json +3 -3
- /package/components/{dropdown → datepicker}/dist/styles/default/color-css.d.ts +0 -0
- /package/components/{dropdown/dist/styles/default → datepicker/dist/styles/emphasized}/style-css.d.ts +0 -0
- /package/components/{dropdown/dist/styles/default/bibColors-css.d.ts → datepicker/dist/styles/shapeSize-css.d.ts} +0 -0
- /package/components/dropdown/dist/styles/{default/bibStyles-css.d.ts → classic/bibColors-css.d.ts} +0 -0
- /package/components/dropdown/dist/styles/{style-css.d.ts → classic/bibStyles-css.d.ts} +0 -0
|
@@ -77,7 +77,7 @@ var tokensCss$1 = i$5`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-b
|
|
|
77
77
|
|
|
78
78
|
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
79
79
|
|
|
80
|
-
class AuroLibraryRuntimeUtils {
|
|
80
|
+
let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
81
81
|
|
|
82
82
|
/* eslint-disable jsdoc/require-param */
|
|
83
83
|
|
|
@@ -138,107 +138,11 @@ class AuroLibraryRuntimeUtils {
|
|
|
138
138
|
|
|
139
139
|
return elemTag === tag || elem.hasAttribute(tag);
|
|
140
140
|
}
|
|
141
|
-
}
|
|
141
|
+
};
|
|
142
142
|
|
|
143
143
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
144
144
|
// See LICENSE in the project root for license information.
|
|
145
145
|
|
|
146
|
-
// ---------------------------------------------------------------------
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Converts value to an array.
|
|
150
|
-
* If the value is a JSON string representing an array, it will be parsed.
|
|
151
|
-
* If the value is already an array, it is returned.
|
|
152
|
-
* If the value is undefined, it returns undefined.
|
|
153
|
-
* @private
|
|
154
|
-
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
155
|
-
* @returns {Array|undefined} - The converted array or undefined.
|
|
156
|
-
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
157
|
-
* or if the value cannot be parsed into an array from a JSON string.
|
|
158
|
-
*/
|
|
159
|
-
function arrayConverter(value) {
|
|
160
|
-
// Allow undefined
|
|
161
|
-
if (value === undefined) {
|
|
162
|
-
return undefined;
|
|
163
|
-
}
|
|
164
|
-
|
|
165
|
-
// Return the value if it is already an array
|
|
166
|
-
if (Array.isArray(value)) {
|
|
167
|
-
return value;
|
|
168
|
-
}
|
|
169
|
-
|
|
170
|
-
try {
|
|
171
|
-
// If value is a JSON string, parse it
|
|
172
|
-
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
173
|
-
|
|
174
|
-
// Check if the parsed value is an array
|
|
175
|
-
if (Array.isArray(parsed)) {
|
|
176
|
-
return parsed;
|
|
177
|
-
}
|
|
178
|
-
} catch (error) {
|
|
179
|
-
// If JSON parsing fails, continue to throw an error below
|
|
180
|
-
/* eslint-disable no-console */
|
|
181
|
-
console.error('JSON parsing failed:', error);
|
|
182
|
-
}
|
|
183
|
-
|
|
184
|
-
// Throw error if the input is not an array or undefined
|
|
185
|
-
throw new Error('Invalid value: Input must be an array or undefined');
|
|
186
|
-
}
|
|
187
|
-
|
|
188
|
-
/**
|
|
189
|
-
* Compare two arrays for equality.
|
|
190
|
-
* @private
|
|
191
|
-
* @param {Array} arr1 - First array to compare.
|
|
192
|
-
* @param {Array} arr2 - Second array to compare.
|
|
193
|
-
* @returns {boolean} True if arrays are equal.
|
|
194
|
-
*/
|
|
195
|
-
function arraysAreEqual(arr1, arr2) {
|
|
196
|
-
// If both arrays undefined, they are equal (true)
|
|
197
|
-
if (arr1 === undefined || arr2 === undefined) {
|
|
198
|
-
return arr1 === arr2;
|
|
199
|
-
}
|
|
200
|
-
|
|
201
|
-
// If arrays have different lengths, they are not equal
|
|
202
|
-
if (arr1.length !== arr2.length) {
|
|
203
|
-
return false;
|
|
204
|
-
}
|
|
205
|
-
|
|
206
|
-
// If every item at each index is the same, return true
|
|
207
|
-
for (let index = 0; index < arr1.length; index += 1) {
|
|
208
|
-
if (arr1[index] !== arr2[index]) {
|
|
209
|
-
return false;
|
|
210
|
-
}
|
|
211
|
-
}
|
|
212
|
-
return true;
|
|
213
|
-
}
|
|
214
|
-
|
|
215
|
-
/**
|
|
216
|
-
* Compares array for changes.
|
|
217
|
-
* @private
|
|
218
|
-
* @param {Array|any} newVal - New value to compare.
|
|
219
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
220
|
-
* @returns {boolean} True if arrays have changed.
|
|
221
|
-
*/
|
|
222
|
-
function arrayOrUndefinedHasChanged(newVal, oldVal) {
|
|
223
|
-
try {
|
|
224
|
-
// Check if values are undefined or arrays
|
|
225
|
-
const isArrayOrUndefined = (val) => val === undefined || Array.isArray(val);
|
|
226
|
-
|
|
227
|
-
// If non-array or non-undefined, throw error
|
|
228
|
-
if (!isArrayOrUndefined(newVal) || !isArrayOrUndefined(oldVal)) {
|
|
229
|
-
const invalidValue = isArrayOrUndefined(newVal) ? oldVal : newVal;
|
|
230
|
-
throw new Error(`Value must be an array or undefined, received ${typeof invalidValue}`);
|
|
231
|
-
}
|
|
232
|
-
|
|
233
|
-
// Return true if arrays have changed, false if they are the same
|
|
234
|
-
return !arraysAreEqual(newVal, oldVal);
|
|
235
|
-
} catch (error) {
|
|
236
|
-
/* eslint-disable no-console */
|
|
237
|
-
console.error(error);
|
|
238
|
-
// If validation fails, it has changed
|
|
239
|
-
return true;
|
|
240
|
-
}
|
|
241
|
-
}
|
|
242
146
|
|
|
243
147
|
/**
|
|
244
148
|
* Validates if an option can be interacted with.
|
|
@@ -272,7 +176,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
272
176
|
element.dispatchEvent(new CustomEvent(eventName, eventConfig));
|
|
273
177
|
}
|
|
274
178
|
|
|
275
|
-
// Copyright (c)
|
|
179
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
276
180
|
// See LICENSE in the project root for license information.
|
|
277
181
|
|
|
278
182
|
|
|
@@ -280,14 +184,14 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
280
184
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
281
185
|
/**
|
|
282
186
|
* The auro-menu element provides users a way to select from a list of options.
|
|
283
|
-
* @attr {Array<HTMLElement
|
|
187
|
+
* @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.
|
|
284
188
|
* @attr {object} optionactive - Specifies the current active menuOption.
|
|
285
189
|
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
286
190
|
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
287
191
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
288
192
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
289
193
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
290
|
-
* @attr {Array<string
|
|
194
|
+
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
291
195
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
292
196
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
293
197
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -300,7 +204,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
300
204
|
* @slot - Slot for insertion of menu options.
|
|
301
205
|
*/
|
|
302
206
|
|
|
303
|
-
/* eslint-disable no-magic-numbers, max-lines */
|
|
207
|
+
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
|
|
304
208
|
|
|
305
209
|
class AuroMenu extends i$2 {
|
|
306
210
|
constructor() {
|
|
@@ -380,9 +284,8 @@ class AuroMenu extends i$2 {
|
|
|
380
284
|
reflect: true
|
|
381
285
|
},
|
|
382
286
|
optionSelected: {
|
|
383
|
-
// Allow HTMLElement[] arrays and undefined
|
|
384
|
-
|
|
385
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
287
|
+
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
288
|
+
type: Object
|
|
386
289
|
},
|
|
387
290
|
optionActive: {
|
|
388
291
|
type: Object,
|
|
@@ -398,10 +301,8 @@ class AuroMenu extends i$2 {
|
|
|
398
301
|
attribute: 'multiselect'
|
|
399
302
|
},
|
|
400
303
|
value: {
|
|
401
|
-
// Allow string[] arrays and undefined
|
|
402
|
-
type: Object
|
|
403
|
-
converter: arrayConverter,
|
|
404
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
304
|
+
// Allow string, string[] arrays and undefined
|
|
305
|
+
type: Object
|
|
405
306
|
}
|
|
406
307
|
};
|
|
407
308
|
}
|
|
@@ -423,7 +324,7 @@ class AuroMenu extends i$2 {
|
|
|
423
324
|
*
|
|
424
325
|
*/
|
|
425
326
|
static register(name = "auro-menu") {
|
|
426
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
|
|
327
|
+
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
427
328
|
}
|
|
428
329
|
|
|
429
330
|
// Lifecycle Methods
|
|
@@ -447,37 +348,46 @@ class AuroMenu extends i$2 {
|
|
|
447
348
|
}
|
|
448
349
|
|
|
449
350
|
firstUpdated() {
|
|
450
|
-
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-menu');
|
|
351
|
+
AuroLibraryRuntimeUtils$1.prototype.handleComponentTagRename(this, 'auro-menu');
|
|
451
352
|
|
|
452
353
|
this.loadingSlots = this.querySelectorAll("[slot='loadingText'], [slot='loadingIcon']");
|
|
453
354
|
this.initializeMenu();
|
|
454
355
|
}
|
|
455
356
|
|
|
456
357
|
updated(changedProperties) {
|
|
358
|
+
if (changedProperties.has('multiSelect')) {
|
|
359
|
+
// Reset selection if multiSelect mode changes
|
|
360
|
+
this.clearSelection();
|
|
361
|
+
}
|
|
362
|
+
|
|
457
363
|
if (changedProperties.has('value')) {
|
|
458
364
|
// Handle null/undefined case
|
|
459
365
|
if (this.value === undefined || this.value === null) {
|
|
460
366
|
this.optionSelected = undefined;
|
|
461
|
-
// Reset index tracking
|
|
462
367
|
this.index = -1;
|
|
463
368
|
} else {
|
|
464
|
-
|
|
465
|
-
|
|
369
|
+
if (this.multiSelect) {
|
|
370
|
+
// In multiselect mode, this.value should be an array of strings
|
|
371
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
372
|
+
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
466
373
|
|
|
467
|
-
|
|
468
|
-
|
|
374
|
+
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
375
|
+
} else {
|
|
376
|
+
// In single-select mode, this.value should be a string
|
|
377
|
+
const matchingOptions = this.items.find((item) => item.value === this.value);
|
|
469
378
|
|
|
470
|
-
|
|
471
|
-
if (this.multiSelect) {
|
|
472
|
-
// For multiselect, keep all matching options
|
|
379
|
+
if (matchingOptions) {
|
|
473
380
|
this.optionSelected = matchingOptions;
|
|
381
|
+
this.index = this.items.indexOf(matchingOptions);
|
|
474
382
|
} else {
|
|
475
|
-
//
|
|
476
|
-
this.optionSelected =
|
|
477
|
-
this.index =
|
|
383
|
+
// If no matching option found, reset selection
|
|
384
|
+
this.optionSelected = undefined;
|
|
385
|
+
this.index = -1;
|
|
478
386
|
}
|
|
479
|
-
}
|
|
480
|
-
|
|
387
|
+
}
|
|
388
|
+
|
|
389
|
+
// If no matching options were found in either mode
|
|
390
|
+
if (!this.optionSelected || (Array.isArray(this.optionSelected) && this.optionSelected.length === 0)) {
|
|
481
391
|
dispatchMenuEvent(this, 'auroMenu-selectValueFailure');
|
|
482
392
|
this.optionSelected = undefined;
|
|
483
393
|
this.index = -1;
|
|
@@ -629,8 +539,8 @@ class AuroMenu extends i$2 {
|
|
|
629
539
|
}
|
|
630
540
|
} else {
|
|
631
541
|
// Single select - use arrays with single values
|
|
632
|
-
this.value =
|
|
633
|
-
this.optionSelected =
|
|
542
|
+
this.value = option.value;
|
|
543
|
+
this.optionSelected = option;
|
|
634
544
|
}
|
|
635
545
|
|
|
636
546
|
this.index = this.items.indexOf(option);
|
|
@@ -952,8 +862,13 @@ class AuroMenu extends i$2 {
|
|
|
952
862
|
if (!this.optionSelected) {
|
|
953
863
|
return false;
|
|
954
864
|
}
|
|
955
|
-
|
|
956
|
-
|
|
865
|
+
|
|
866
|
+
if (this.multiSelect) {
|
|
867
|
+
// In multi-select mode, check if the option is in the selected array
|
|
868
|
+
return Array.isArray(this.optionSelected) && this.optionSelected.some((selectedOption) => selectedOption === option);
|
|
869
|
+
}
|
|
870
|
+
|
|
871
|
+
return this.optionSelected === option;
|
|
957
872
|
}
|
|
958
873
|
|
|
959
874
|
/**
|
|
@@ -1208,6 +1123,76 @@ var tokensCss = i$5`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-def
|
|
|
1208
1123
|
|
|
1209
1124
|
var colorCss = 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)}`;
|
|
1210
1125
|
|
|
1126
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1127
|
+
// See LICENSE in the project root for license information.
|
|
1128
|
+
|
|
1129
|
+
// ---------------------------------------------------------------------
|
|
1130
|
+
|
|
1131
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
1132
|
+
|
|
1133
|
+
class AuroLibraryRuntimeUtils {
|
|
1134
|
+
|
|
1135
|
+
/* eslint-disable jsdoc/require-param */
|
|
1136
|
+
|
|
1137
|
+
/**
|
|
1138
|
+
* This will register a new custom element with the browser.
|
|
1139
|
+
* @param {String} name - The name of the custom element.
|
|
1140
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
1141
|
+
* @returns {void}
|
|
1142
|
+
*/
|
|
1143
|
+
registerComponent(name, componentClass) {
|
|
1144
|
+
if (!customElements.get(name)) {
|
|
1145
|
+
customElements.define(name, class extends componentClass {});
|
|
1146
|
+
}
|
|
1147
|
+
}
|
|
1148
|
+
|
|
1149
|
+
/**
|
|
1150
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
1151
|
+
* @returns {void}
|
|
1152
|
+
*/
|
|
1153
|
+
closestElement(
|
|
1154
|
+
selector, // selector like in .closest()
|
|
1155
|
+
base = this, // extra functionality to skip a parent
|
|
1156
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
1157
|
+
!el || el === document || el === window
|
|
1158
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
1159
|
+
: found
|
|
1160
|
+
? found // found a selector INside this element
|
|
1161
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
1162
|
+
) {
|
|
1163
|
+
return __Closest(base);
|
|
1164
|
+
}
|
|
1165
|
+
/* eslint-enable jsdoc/require-param */
|
|
1166
|
+
|
|
1167
|
+
/**
|
|
1168
|
+
* If the element passed is registered with a different tag name than what is passed in, the tag name is added as an attribute to the element.
|
|
1169
|
+
* @param {Object} elem - The element to check.
|
|
1170
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
1171
|
+
* @returns {void}
|
|
1172
|
+
*/
|
|
1173
|
+
handleComponentTagRename(elem, tagName) {
|
|
1174
|
+
const tag = tagName.toLowerCase();
|
|
1175
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
1176
|
+
|
|
1177
|
+
if (elemTag !== tag) {
|
|
1178
|
+
elem.setAttribute(tag, true);
|
|
1179
|
+
}
|
|
1180
|
+
}
|
|
1181
|
+
|
|
1182
|
+
/**
|
|
1183
|
+
* Validates if an element is a specific Auro component.
|
|
1184
|
+
* @param {Object} elem - The element to validate.
|
|
1185
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
1186
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
1187
|
+
*/
|
|
1188
|
+
elementMatch(elem, tagName) {
|
|
1189
|
+
const tag = tagName.toLowerCase();
|
|
1190
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
1191
|
+
|
|
1192
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
1193
|
+
}
|
|
1194
|
+
}
|
|
1195
|
+
|
|
1211
1196
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1212
1197
|
// See LICENSE in the project root for license information.
|
|
1213
1198
|
|
|
@@ -1415,7 +1400,7 @@ class AuroMenuOption extends i$2 {
|
|
|
1415
1400
|
/**
|
|
1416
1401
|
* @private
|
|
1417
1402
|
*/
|
|
1418
|
-
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
1403
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
|
|
1419
1404
|
}
|
|
1420
1405
|
|
|
1421
1406
|
static get properties() {
|
|
@@ -1459,7 +1444,7 @@ class AuroMenuOption extends i$2 {
|
|
|
1459
1444
|
*
|
|
1460
1445
|
*/
|
|
1461
1446
|
static register(name = "auro-menuoption") {
|
|
1462
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenuOption);
|
|
1447
|
+
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenuOption);
|
|
1463
1448
|
}
|
|
1464
1449
|
|
|
1465
1450
|
firstUpdated() {
|