@aurodesignsystem-dev/auro-formkit 0.0.0-pr624.1 → 0.0.0-pr624.11
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 +598 -428
- package/components/combobox/demo/index.html +0 -1
- package/components/combobox/demo/index.md +43 -0
- package/components/combobox/demo/index.min.js +596 -426
- package/components/combobox/dist/auro-combobox.d.ts +13 -18
- package/components/combobox/dist/index.js +458 -273
- package/components/combobox/dist/registered.js +458 -273
- 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 +847 -324
- package/components/datepicker/demo/index.md +13 -0
- package/components/datepicker/demo/index.min.js +847 -324
- package/components/datepicker/dist/auro-datepicker.d.ts +21 -2
- package/components/datepicker/dist/index.js +677 -154
- package/components/datepicker/dist/registered.js +677 -154
- 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/demo/api.md +53 -49
- package/components/input/demo/api.min.js +121 -27
- package/components/input/demo/index.min.js +121 -27
- package/components/input/dist/auro-input.d.ts +22 -14
- package/components/input/dist/base-input.d.ts +1 -1
- package/components/input/dist/index.js +121 -27
- package/components/input/dist/registered.js +121 -27
- 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 -353
- package/components/select/demo/index.html +1 -0
- package/components/select/demo/index.md +298 -777
- package/components/select/demo/index.min.js +1251 -352
- 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 -191
- package/components/select/dist/registered.js +1105 -191
- 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
|
@@ -37,7 +37,7 @@ var tokensCss$1 = i$5`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-b
|
|
|
37
37
|
|
|
38
38
|
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
39
39
|
|
|
40
|
-
class AuroLibraryRuntimeUtils {
|
|
40
|
+
let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
41
41
|
|
|
42
42
|
/* eslint-disable jsdoc/require-param */
|
|
43
43
|
|
|
@@ -98,107 +98,11 @@ class AuroLibraryRuntimeUtils {
|
|
|
98
98
|
|
|
99
99
|
return elemTag === tag || elem.hasAttribute(tag);
|
|
100
100
|
}
|
|
101
|
-
}
|
|
101
|
+
};
|
|
102
102
|
|
|
103
103
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
104
104
|
// See LICENSE in the project root for license information.
|
|
105
105
|
|
|
106
|
-
// ---------------------------------------------------------------------
|
|
107
|
-
|
|
108
|
-
/**
|
|
109
|
-
* Converts value to an array.
|
|
110
|
-
* If the value is a JSON string representing an array, it will be parsed.
|
|
111
|
-
* If the value is already an array, it is returned.
|
|
112
|
-
* If the value is undefined, it returns undefined.
|
|
113
|
-
* @private
|
|
114
|
-
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
115
|
-
* @returns {Array|undefined} - The converted array or undefined.
|
|
116
|
-
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
117
|
-
* or if the value cannot be parsed into an array from a JSON string.
|
|
118
|
-
*/
|
|
119
|
-
function arrayConverter(value) {
|
|
120
|
-
// Allow undefined
|
|
121
|
-
if (value === undefined) {
|
|
122
|
-
return undefined;
|
|
123
|
-
}
|
|
124
|
-
|
|
125
|
-
// Return the value if it is already an array
|
|
126
|
-
if (Array.isArray(value)) {
|
|
127
|
-
return value;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
try {
|
|
131
|
-
// If value is a JSON string, parse it
|
|
132
|
-
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
133
|
-
|
|
134
|
-
// Check if the parsed value is an array
|
|
135
|
-
if (Array.isArray(parsed)) {
|
|
136
|
-
return parsed;
|
|
137
|
-
}
|
|
138
|
-
} catch (error) {
|
|
139
|
-
// If JSON parsing fails, continue to throw an error below
|
|
140
|
-
/* eslint-disable no-console */
|
|
141
|
-
console.error('JSON parsing failed:', error);
|
|
142
|
-
}
|
|
143
|
-
|
|
144
|
-
// Throw error if the input is not an array or undefined
|
|
145
|
-
throw new Error('Invalid value: Input must be an array or undefined');
|
|
146
|
-
}
|
|
147
|
-
|
|
148
|
-
/**
|
|
149
|
-
* Compare two arrays for equality.
|
|
150
|
-
* @private
|
|
151
|
-
* @param {Array} arr1 - First array to compare.
|
|
152
|
-
* @param {Array} arr2 - Second array to compare.
|
|
153
|
-
* @returns {boolean} True if arrays are equal.
|
|
154
|
-
*/
|
|
155
|
-
function arraysAreEqual(arr1, arr2) {
|
|
156
|
-
// If both arrays undefined, they are equal (true)
|
|
157
|
-
if (arr1 === undefined || arr2 === undefined) {
|
|
158
|
-
return arr1 === arr2;
|
|
159
|
-
}
|
|
160
|
-
|
|
161
|
-
// If arrays have different lengths, they are not equal
|
|
162
|
-
if (arr1.length !== arr2.length) {
|
|
163
|
-
return false;
|
|
164
|
-
}
|
|
165
|
-
|
|
166
|
-
// If every item at each index is the same, return true
|
|
167
|
-
for (let index = 0; index < arr1.length; index += 1) {
|
|
168
|
-
if (arr1[index] !== arr2[index]) {
|
|
169
|
-
return false;
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return true;
|
|
173
|
-
}
|
|
174
|
-
|
|
175
|
-
/**
|
|
176
|
-
* Compares array for changes.
|
|
177
|
-
* @private
|
|
178
|
-
* @param {Array|any} newVal - New value to compare.
|
|
179
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
180
|
-
* @returns {boolean} True if arrays have changed.
|
|
181
|
-
*/
|
|
182
|
-
function arrayOrUndefinedHasChanged(newVal, oldVal) {
|
|
183
|
-
try {
|
|
184
|
-
// Check if values are undefined or arrays
|
|
185
|
-
const isArrayOrUndefined = (val) => val === undefined || Array.isArray(val);
|
|
186
|
-
|
|
187
|
-
// If non-array or non-undefined, throw error
|
|
188
|
-
if (!isArrayOrUndefined(newVal) || !isArrayOrUndefined(oldVal)) {
|
|
189
|
-
const invalidValue = isArrayOrUndefined(newVal) ? oldVal : newVal;
|
|
190
|
-
throw new Error(`Value must be an array or undefined, received ${typeof invalidValue}`);
|
|
191
|
-
}
|
|
192
|
-
|
|
193
|
-
// Return true if arrays have changed, false if they are the same
|
|
194
|
-
return !arraysAreEqual(newVal, oldVal);
|
|
195
|
-
} catch (error) {
|
|
196
|
-
/* eslint-disable no-console */
|
|
197
|
-
console.error(error);
|
|
198
|
-
// If validation fails, it has changed
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
106
|
|
|
203
107
|
/**
|
|
204
108
|
* Validates if an option can be interacted with.
|
|
@@ -232,7 +136,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
232
136
|
element.dispatchEvent(new CustomEvent(eventName, eventConfig));
|
|
233
137
|
}
|
|
234
138
|
|
|
235
|
-
// Copyright (c)
|
|
139
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
236
140
|
// See LICENSE in the project root for license information.
|
|
237
141
|
|
|
238
142
|
|
|
@@ -240,14 +144,14 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
240
144
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
241
145
|
/**
|
|
242
146
|
* The auro-menu element provides users a way to select from a list of options.
|
|
243
|
-
* @attr {Array<HTMLElement
|
|
147
|
+
* @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.
|
|
244
148
|
* @attr {object} optionactive - Specifies the current active menuOption.
|
|
245
149
|
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
246
150
|
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
247
151
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
248
152
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
249
153
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
250
|
-
* @attr {Array<string
|
|
154
|
+
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
251
155
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
252
156
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
253
157
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -260,7 +164,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
260
164
|
* @slot - Slot for insertion of menu options.
|
|
261
165
|
*/
|
|
262
166
|
|
|
263
|
-
/* eslint-disable no-magic-numbers, max-lines */
|
|
167
|
+
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
|
|
264
168
|
|
|
265
169
|
class AuroMenu extends i$2 {
|
|
266
170
|
constructor() {
|
|
@@ -340,9 +244,8 @@ class AuroMenu extends i$2 {
|
|
|
340
244
|
reflect: true
|
|
341
245
|
},
|
|
342
246
|
optionSelected: {
|
|
343
|
-
// Allow HTMLElement[] arrays and undefined
|
|
344
|
-
|
|
345
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
247
|
+
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
248
|
+
type: Object
|
|
346
249
|
},
|
|
347
250
|
optionActive: {
|
|
348
251
|
type: Object,
|
|
@@ -358,10 +261,8 @@ class AuroMenu extends i$2 {
|
|
|
358
261
|
attribute: 'multiselect'
|
|
359
262
|
},
|
|
360
263
|
value: {
|
|
361
|
-
// Allow string[] arrays and undefined
|
|
362
|
-
type: Object
|
|
363
|
-
converter: arrayConverter,
|
|
364
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
264
|
+
// Allow string, string[] arrays and undefined
|
|
265
|
+
type: Object
|
|
365
266
|
}
|
|
366
267
|
};
|
|
367
268
|
}
|
|
@@ -383,7 +284,7 @@ class AuroMenu extends i$2 {
|
|
|
383
284
|
*
|
|
384
285
|
*/
|
|
385
286
|
static register(name = "auro-menu") {
|
|
386
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
|
|
287
|
+
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
387
288
|
}
|
|
388
289
|
|
|
389
290
|
// Lifecycle Methods
|
|
@@ -407,37 +308,46 @@ class AuroMenu extends i$2 {
|
|
|
407
308
|
}
|
|
408
309
|
|
|
409
310
|
firstUpdated() {
|
|
410
|
-
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-menu');
|
|
311
|
+
AuroLibraryRuntimeUtils$1.prototype.handleComponentTagRename(this, 'auro-menu');
|
|
411
312
|
|
|
412
313
|
this.loadingSlots = this.querySelectorAll("[slot='loadingText'], [slot='loadingIcon']");
|
|
413
314
|
this.initializeMenu();
|
|
414
315
|
}
|
|
415
316
|
|
|
416
317
|
updated(changedProperties) {
|
|
318
|
+
if (changedProperties.has('multiSelect')) {
|
|
319
|
+
// Reset selection if multiSelect mode changes
|
|
320
|
+
this.clearSelection();
|
|
321
|
+
}
|
|
322
|
+
|
|
417
323
|
if (changedProperties.has('value')) {
|
|
418
324
|
// Handle null/undefined case
|
|
419
325
|
if (this.value === undefined || this.value === null) {
|
|
420
326
|
this.optionSelected = undefined;
|
|
421
|
-
// Reset index tracking
|
|
422
327
|
this.index = -1;
|
|
423
328
|
} else {
|
|
424
|
-
|
|
425
|
-
|
|
329
|
+
if (this.multiSelect) {
|
|
330
|
+
// In multiselect mode, this.value should be an array of strings
|
|
331
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
332
|
+
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
426
333
|
|
|
427
|
-
|
|
428
|
-
|
|
334
|
+
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
335
|
+
} else {
|
|
336
|
+
// In single-select mode, this.value should be a string
|
|
337
|
+
const matchingOptions = this.items.find((item) => item.value === this.value);
|
|
429
338
|
|
|
430
|
-
|
|
431
|
-
if (this.multiSelect) {
|
|
432
|
-
// For multiselect, keep all matching options
|
|
339
|
+
if (matchingOptions) {
|
|
433
340
|
this.optionSelected = matchingOptions;
|
|
341
|
+
this.index = this.items.indexOf(matchingOptions);
|
|
434
342
|
} else {
|
|
435
|
-
//
|
|
436
|
-
this.optionSelected =
|
|
437
|
-
this.index =
|
|
343
|
+
// If no matching option found, reset selection
|
|
344
|
+
this.optionSelected = undefined;
|
|
345
|
+
this.index = -1;
|
|
438
346
|
}
|
|
439
|
-
}
|
|
440
|
-
|
|
347
|
+
}
|
|
348
|
+
|
|
349
|
+
// If no matching options were found in either mode
|
|
350
|
+
if (!this.optionSelected || (Array.isArray(this.optionSelected) && this.optionSelected.length === 0)) {
|
|
441
351
|
dispatchMenuEvent(this, 'auroMenu-selectValueFailure');
|
|
442
352
|
this.optionSelected = undefined;
|
|
443
353
|
this.index = -1;
|
|
@@ -589,8 +499,8 @@ class AuroMenu extends i$2 {
|
|
|
589
499
|
}
|
|
590
500
|
} else {
|
|
591
501
|
// Single select - use arrays with single values
|
|
592
|
-
this.value =
|
|
593
|
-
this.optionSelected =
|
|
502
|
+
this.value = option.value;
|
|
503
|
+
this.optionSelected = option;
|
|
594
504
|
}
|
|
595
505
|
|
|
596
506
|
this.index = this.items.indexOf(option);
|
|
@@ -912,8 +822,13 @@ class AuroMenu extends i$2 {
|
|
|
912
822
|
if (!this.optionSelected) {
|
|
913
823
|
return false;
|
|
914
824
|
}
|
|
915
|
-
|
|
916
|
-
|
|
825
|
+
|
|
826
|
+
if (this.multiSelect) {
|
|
827
|
+
// In multi-select mode, check if the option is in the selected array
|
|
828
|
+
return Array.isArray(this.optionSelected) && this.optionSelected.some((selectedOption) => selectedOption === option);
|
|
829
|
+
}
|
|
830
|
+
|
|
831
|
+
return this.optionSelected === option;
|
|
917
832
|
}
|
|
918
833
|
|
|
919
834
|
/**
|
|
@@ -1168,6 +1083,76 @@ var tokensCss = i$5`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-def
|
|
|
1168
1083
|
|
|
1169
1084
|
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)}`;
|
|
1170
1085
|
|
|
1086
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1087
|
+
// See LICENSE in the project root for license information.
|
|
1088
|
+
|
|
1089
|
+
// ---------------------------------------------------------------------
|
|
1090
|
+
|
|
1091
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
1092
|
+
|
|
1093
|
+
class AuroLibraryRuntimeUtils {
|
|
1094
|
+
|
|
1095
|
+
/* eslint-disable jsdoc/require-param */
|
|
1096
|
+
|
|
1097
|
+
/**
|
|
1098
|
+
* This will register a new custom element with the browser.
|
|
1099
|
+
* @param {String} name - The name of the custom element.
|
|
1100
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
1101
|
+
* @returns {void}
|
|
1102
|
+
*/
|
|
1103
|
+
registerComponent(name, componentClass) {
|
|
1104
|
+
if (!customElements.get(name)) {
|
|
1105
|
+
customElements.define(name, class extends componentClass {});
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1109
|
+
/**
|
|
1110
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
1111
|
+
* @returns {void}
|
|
1112
|
+
*/
|
|
1113
|
+
closestElement(
|
|
1114
|
+
selector, // selector like in .closest()
|
|
1115
|
+
base = this, // extra functionality to skip a parent
|
|
1116
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
1117
|
+
!el || el === document || el === window
|
|
1118
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
1119
|
+
: found
|
|
1120
|
+
? found // found a selector INside this element
|
|
1121
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
1122
|
+
) {
|
|
1123
|
+
return __Closest(base);
|
|
1124
|
+
}
|
|
1125
|
+
/* eslint-enable jsdoc/require-param */
|
|
1126
|
+
|
|
1127
|
+
/**
|
|
1128
|
+
* 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.
|
|
1129
|
+
* @param {Object} elem - The element to check.
|
|
1130
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
1131
|
+
* @returns {void}
|
|
1132
|
+
*/
|
|
1133
|
+
handleComponentTagRename(elem, tagName) {
|
|
1134
|
+
const tag = tagName.toLowerCase();
|
|
1135
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
1136
|
+
|
|
1137
|
+
if (elemTag !== tag) {
|
|
1138
|
+
elem.setAttribute(tag, true);
|
|
1139
|
+
}
|
|
1140
|
+
}
|
|
1141
|
+
|
|
1142
|
+
/**
|
|
1143
|
+
* Validates if an element is a specific Auro component.
|
|
1144
|
+
* @param {Object} elem - The element to validate.
|
|
1145
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
1146
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
1147
|
+
*/
|
|
1148
|
+
elementMatch(elem, tagName) {
|
|
1149
|
+
const tag = tagName.toLowerCase();
|
|
1150
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
1151
|
+
|
|
1152
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
1153
|
+
}
|
|
1154
|
+
}
|
|
1155
|
+
|
|
1171
1156
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1172
1157
|
// See LICENSE in the project root for license information.
|
|
1173
1158
|
|
|
@@ -1375,7 +1360,7 @@ class AuroMenuOption extends i$2 {
|
|
|
1375
1360
|
/**
|
|
1376
1361
|
* @private
|
|
1377
1362
|
*/
|
|
1378
|
-
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
1363
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
|
|
1379
1364
|
}
|
|
1380
1365
|
|
|
1381
1366
|
static get properties() {
|
|
@@ -1419,7 +1404,7 @@ class AuroMenuOption extends i$2 {
|
|
|
1419
1404
|
*
|
|
1420
1405
|
*/
|
|
1421
1406
|
static register(name = "auro-menuoption") {
|
|
1422
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenuOption);
|
|
1407
|
+
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenuOption);
|
|
1423
1408
|
}
|
|
1424
1409
|
|
|
1425
1410
|
firstUpdated() {
|
|
@@ -18,14 +18,6 @@ export function arrayConverter(value: any): any[] | undefined;
|
|
|
18
18
|
* @returns {boolean} True if arrays are equal.
|
|
19
19
|
*/
|
|
20
20
|
export function arraysAreEqual(arr1: any[], arr2: any[]): boolean;
|
|
21
|
-
/**
|
|
22
|
-
* Compares array for changes.
|
|
23
|
-
* @private
|
|
24
|
-
* @param {Array|any} newVal - New value to compare.
|
|
25
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
26
|
-
* @returns {boolean} True if arrays have changed.
|
|
27
|
-
*/
|
|
28
|
-
export function arrayOrUndefinedHasChanged(newVal: any[] | any, oldVal: any[] | any): boolean;
|
|
29
21
|
/**
|
|
30
22
|
* Validates if an option can be interacted with.
|
|
31
23
|
* @private
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* The auro-menu element provides users a way to select from a list of options.
|
|
3
|
-
* @attr {Array<HTMLElement
|
|
3
|
+
* @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.
|
|
4
4
|
* @attr {object} optionactive - Specifies the current active menuOption.
|
|
5
5
|
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
6
6
|
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
7
7
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
8
8
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
9
9
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
10
|
-
* @attr {Array<string
|
|
10
|
+
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
11
11
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
12
12
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
13
13
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -35,8 +35,7 @@ export class AuroMenu extends LitElement {
|
|
|
35
35
|
reflect: boolean;
|
|
36
36
|
};
|
|
37
37
|
optionSelected: {
|
|
38
|
-
|
|
39
|
-
hasChanged: typeof arrayOrUndefinedHasChanged;
|
|
38
|
+
type: ObjectConstructor;
|
|
40
39
|
};
|
|
41
40
|
optionActive: {
|
|
42
41
|
type: ObjectConstructor;
|
|
@@ -53,8 +52,6 @@ export class AuroMenu extends LitElement {
|
|
|
53
52
|
};
|
|
54
53
|
value: {
|
|
55
54
|
type: ObjectConstructor;
|
|
56
|
-
converter: typeof arrayConverter;
|
|
57
|
-
hasChanged: typeof arrayOrUndefinedHasChanged;
|
|
58
55
|
};
|
|
59
56
|
};
|
|
60
57
|
static get styles(): import("lit").CSSResult[];
|
|
@@ -201,5 +198,3 @@ export class AuroMenu extends LitElement {
|
|
|
201
198
|
render(): boolean;
|
|
202
199
|
}
|
|
203
200
|
import { LitElement } from "lit";
|
|
204
|
-
import { arrayConverter } from './auro-menu-utils.js';
|
|
205
|
-
import { arrayOrUndefinedHasChanged } from './auro-menu-utils.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
1
|
import { AuroMenu } from './auro-menu.js';
|
|
2
2
|
import { AuroMenuOption } from './auro-menuoption.js';
|
|
3
3
|
export { AuroMenu, AuroMenuOption };
|
|
4
|
-
export { arrayConverter,
|
|
4
|
+
export { arrayConverter, isOptionInteractive, dispatchMenuEvent } from "./auro-menu-utils.js";
|