@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
|
@@ -16,7 +16,7 @@ var tokensCss$1 = css`:host{--ds-auro-menu-divider-color: var(--ds-basic-color-b
|
|
|
16
16
|
|
|
17
17
|
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
18
18
|
|
|
19
|
-
class AuroLibraryRuntimeUtils {
|
|
19
|
+
let AuroLibraryRuntimeUtils$1 = class AuroLibraryRuntimeUtils {
|
|
20
20
|
|
|
21
21
|
/* eslint-disable jsdoc/require-param */
|
|
22
22
|
|
|
@@ -77,107 +77,11 @@ class AuroLibraryRuntimeUtils {
|
|
|
77
77
|
|
|
78
78
|
return elemTag === tag || elem.hasAttribute(tag);
|
|
79
79
|
}
|
|
80
|
-
}
|
|
80
|
+
};
|
|
81
81
|
|
|
82
82
|
// Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
83
83
|
// See LICENSE in the project root for license information.
|
|
84
84
|
|
|
85
|
-
// ---------------------------------------------------------------------
|
|
86
|
-
|
|
87
|
-
/**
|
|
88
|
-
* Converts value to an array.
|
|
89
|
-
* If the value is a JSON string representing an array, it will be parsed.
|
|
90
|
-
* If the value is already an array, it is returned.
|
|
91
|
-
* If the value is undefined, it returns undefined.
|
|
92
|
-
* @private
|
|
93
|
-
* @param {any} value - The value to be converted. Can be a string, array, or undefined.
|
|
94
|
-
* @returns {Array|undefined} - The converted array or undefined.
|
|
95
|
-
* @throws {Error} - Throws an error if the value is not an array, undefined,
|
|
96
|
-
* or if the value cannot be parsed into an array from a JSON string.
|
|
97
|
-
*/
|
|
98
|
-
function arrayConverter(value) {
|
|
99
|
-
// Allow undefined
|
|
100
|
-
if (value === undefined) {
|
|
101
|
-
return undefined;
|
|
102
|
-
}
|
|
103
|
-
|
|
104
|
-
// Return the value if it is already an array
|
|
105
|
-
if (Array.isArray(value)) {
|
|
106
|
-
return value;
|
|
107
|
-
}
|
|
108
|
-
|
|
109
|
-
try {
|
|
110
|
-
// If value is a JSON string, parse it
|
|
111
|
-
const parsed = typeof value === 'string' ? JSON.parse(value) : value;
|
|
112
|
-
|
|
113
|
-
// Check if the parsed value is an array
|
|
114
|
-
if (Array.isArray(parsed)) {
|
|
115
|
-
return parsed;
|
|
116
|
-
}
|
|
117
|
-
} catch (error) {
|
|
118
|
-
// If JSON parsing fails, continue to throw an error below
|
|
119
|
-
/* eslint-disable no-console */
|
|
120
|
-
console.error('JSON parsing failed:', error);
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Throw error if the input is not an array or undefined
|
|
124
|
-
throw new Error('Invalid value: Input must be an array or undefined');
|
|
125
|
-
}
|
|
126
|
-
|
|
127
|
-
/**
|
|
128
|
-
* Compare two arrays for equality.
|
|
129
|
-
* @private
|
|
130
|
-
* @param {Array} arr1 - First array to compare.
|
|
131
|
-
* @param {Array} arr2 - Second array to compare.
|
|
132
|
-
* @returns {boolean} True if arrays are equal.
|
|
133
|
-
*/
|
|
134
|
-
function arraysAreEqual(arr1, arr2) {
|
|
135
|
-
// If both arrays undefined, they are equal (true)
|
|
136
|
-
if (arr1 === undefined || arr2 === undefined) {
|
|
137
|
-
return arr1 === arr2;
|
|
138
|
-
}
|
|
139
|
-
|
|
140
|
-
// If arrays have different lengths, they are not equal
|
|
141
|
-
if (arr1.length !== arr2.length) {
|
|
142
|
-
return false;
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
// If every item at each index is the same, return true
|
|
146
|
-
for (let index = 0; index < arr1.length; index += 1) {
|
|
147
|
-
if (arr1[index] !== arr2[index]) {
|
|
148
|
-
return false;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
return true;
|
|
152
|
-
}
|
|
153
|
-
|
|
154
|
-
/**
|
|
155
|
-
* Compares array for changes.
|
|
156
|
-
* @private
|
|
157
|
-
* @param {Array|any} newVal - New value to compare.
|
|
158
|
-
* @param {Array|any} oldVal - Old value to compare.
|
|
159
|
-
* @returns {boolean} True if arrays have changed.
|
|
160
|
-
*/
|
|
161
|
-
function arrayOrUndefinedHasChanged(newVal, oldVal) {
|
|
162
|
-
try {
|
|
163
|
-
// Check if values are undefined or arrays
|
|
164
|
-
const isArrayOrUndefined = (val) => val === undefined || Array.isArray(val);
|
|
165
|
-
|
|
166
|
-
// If non-array or non-undefined, throw error
|
|
167
|
-
if (!isArrayOrUndefined(newVal) || !isArrayOrUndefined(oldVal)) {
|
|
168
|
-
const invalidValue = isArrayOrUndefined(newVal) ? oldVal : newVal;
|
|
169
|
-
throw new Error(`Value must be an array or undefined, received ${typeof invalidValue}`);
|
|
170
|
-
}
|
|
171
|
-
|
|
172
|
-
// Return true if arrays have changed, false if they are the same
|
|
173
|
-
return !arraysAreEqual(newVal, oldVal);
|
|
174
|
-
} catch (error) {
|
|
175
|
-
/* eslint-disable no-console */
|
|
176
|
-
console.error(error);
|
|
177
|
-
// If validation fails, it has changed
|
|
178
|
-
return true;
|
|
179
|
-
}
|
|
180
|
-
}
|
|
181
85
|
|
|
182
86
|
/**
|
|
183
87
|
* Validates if an option can be interacted with.
|
|
@@ -211,7 +115,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
211
115
|
element.dispatchEvent(new CustomEvent(eventName, eventConfig));
|
|
212
116
|
}
|
|
213
117
|
|
|
214
|
-
// Copyright (c)
|
|
118
|
+
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
215
119
|
// See LICENSE in the project root for license information.
|
|
216
120
|
|
|
217
121
|
|
|
@@ -219,14 +123,14 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
219
123
|
// See https://git.io/JJ6SJ for "How to document your components using JSDoc"
|
|
220
124
|
/**
|
|
221
125
|
* The auro-menu element provides users a way to select from a list of options.
|
|
222
|
-
* @attr {Array<HTMLElement
|
|
126
|
+
* @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.
|
|
223
127
|
* @attr {object} optionactive - Specifies the current active menuOption.
|
|
224
128
|
* @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
|
|
225
129
|
* @attr {boolean} disabled - When true, the entire menu and all options are disabled;
|
|
226
130
|
* @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
|
|
227
131
|
* @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
|
|
228
132
|
* @attr {boolean} multiselect - When true, the selected option can be multiple options.
|
|
229
|
-
* @attr {Array<string
|
|
133
|
+
* @attr {String|Array<string>} value - Value selected for the menu, type `string` by default. In multi-select mode, `value` is an array of strings.
|
|
230
134
|
* @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
|
|
231
135
|
* @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
|
|
232
136
|
* @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
|
|
@@ -239,7 +143,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
|
|
|
239
143
|
* @slot - Slot for insertion of menu options.
|
|
240
144
|
*/
|
|
241
145
|
|
|
242
|
-
/* eslint-disable no-magic-numbers, max-lines */
|
|
146
|
+
/* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
|
|
243
147
|
|
|
244
148
|
class AuroMenu extends LitElement {
|
|
245
149
|
constructor() {
|
|
@@ -319,9 +223,8 @@ class AuroMenu extends LitElement {
|
|
|
319
223
|
reflect: true
|
|
320
224
|
},
|
|
321
225
|
optionSelected: {
|
|
322
|
-
// Allow HTMLElement[] arrays and undefined
|
|
323
|
-
|
|
324
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
226
|
+
// Allow HTMLElement, HTMLElement[] arrays and undefined
|
|
227
|
+
type: Object
|
|
325
228
|
},
|
|
326
229
|
optionActive: {
|
|
327
230
|
type: Object,
|
|
@@ -337,10 +240,8 @@ class AuroMenu extends LitElement {
|
|
|
337
240
|
attribute: 'multiselect'
|
|
338
241
|
},
|
|
339
242
|
value: {
|
|
340
|
-
// Allow string[] arrays and undefined
|
|
341
|
-
type: Object
|
|
342
|
-
converter: arrayConverter,
|
|
343
|
-
hasChanged: arrayOrUndefinedHasChanged
|
|
243
|
+
// Allow string, string[] arrays and undefined
|
|
244
|
+
type: Object
|
|
344
245
|
}
|
|
345
246
|
};
|
|
346
247
|
}
|
|
@@ -362,7 +263,7 @@ class AuroMenu extends LitElement {
|
|
|
362
263
|
*
|
|
363
264
|
*/
|
|
364
265
|
static register(name = "auro-menu") {
|
|
365
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
|
|
266
|
+
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
|
|
366
267
|
}
|
|
367
268
|
|
|
368
269
|
// Lifecycle Methods
|
|
@@ -386,37 +287,46 @@ class AuroMenu extends LitElement {
|
|
|
386
287
|
}
|
|
387
288
|
|
|
388
289
|
firstUpdated() {
|
|
389
|
-
AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-menu');
|
|
290
|
+
AuroLibraryRuntimeUtils$1.prototype.handleComponentTagRename(this, 'auro-menu');
|
|
390
291
|
|
|
391
292
|
this.loadingSlots = this.querySelectorAll("[slot='loadingText'], [slot='loadingIcon']");
|
|
392
293
|
this.initializeMenu();
|
|
393
294
|
}
|
|
394
295
|
|
|
395
296
|
updated(changedProperties) {
|
|
297
|
+
if (changedProperties.has('multiSelect')) {
|
|
298
|
+
// Reset selection if multiSelect mode changes
|
|
299
|
+
this.clearSelection();
|
|
300
|
+
}
|
|
301
|
+
|
|
396
302
|
if (changedProperties.has('value')) {
|
|
397
303
|
// Handle null/undefined case
|
|
398
304
|
if (this.value === undefined || this.value === null) {
|
|
399
305
|
this.optionSelected = undefined;
|
|
400
|
-
// Reset index tracking
|
|
401
306
|
this.index = -1;
|
|
402
307
|
} else {
|
|
403
|
-
|
|
404
|
-
|
|
308
|
+
if (this.multiSelect) {
|
|
309
|
+
// In multiselect mode, this.value should be an array of strings
|
|
310
|
+
const valueArray = Array.isArray(this.value) ? this.value : [this.value];
|
|
311
|
+
const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
|
|
405
312
|
|
|
406
|
-
|
|
407
|
-
|
|
313
|
+
this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
|
|
314
|
+
} else {
|
|
315
|
+
// In single-select mode, this.value should be a string
|
|
316
|
+
const matchingOptions = this.items.find((item) => item.value === this.value);
|
|
408
317
|
|
|
409
|
-
|
|
410
|
-
if (this.multiSelect) {
|
|
411
|
-
// For multiselect, keep all matching options
|
|
318
|
+
if (matchingOptions) {
|
|
412
319
|
this.optionSelected = matchingOptions;
|
|
320
|
+
this.index = this.items.indexOf(matchingOptions);
|
|
413
321
|
} else {
|
|
414
|
-
//
|
|
415
|
-
this.optionSelected =
|
|
416
|
-
this.index =
|
|
322
|
+
// If no matching option found, reset selection
|
|
323
|
+
this.optionSelected = undefined;
|
|
324
|
+
this.index = -1;
|
|
417
325
|
}
|
|
418
|
-
}
|
|
419
|
-
|
|
326
|
+
}
|
|
327
|
+
|
|
328
|
+
// If no matching options were found in either mode
|
|
329
|
+
if (!this.optionSelected || (Array.isArray(this.optionSelected) && this.optionSelected.length === 0)) {
|
|
420
330
|
dispatchMenuEvent(this, 'auroMenu-selectValueFailure');
|
|
421
331
|
this.optionSelected = undefined;
|
|
422
332
|
this.index = -1;
|
|
@@ -568,8 +478,8 @@ class AuroMenu extends LitElement {
|
|
|
568
478
|
}
|
|
569
479
|
} else {
|
|
570
480
|
// Single select - use arrays with single values
|
|
571
|
-
this.value =
|
|
572
|
-
this.optionSelected =
|
|
481
|
+
this.value = option.value;
|
|
482
|
+
this.optionSelected = option;
|
|
573
483
|
}
|
|
574
484
|
|
|
575
485
|
this.index = this.items.indexOf(option);
|
|
@@ -891,8 +801,13 @@ class AuroMenu extends LitElement {
|
|
|
891
801
|
if (!this.optionSelected) {
|
|
892
802
|
return false;
|
|
893
803
|
}
|
|
894
|
-
|
|
895
|
-
|
|
804
|
+
|
|
805
|
+
if (this.multiSelect) {
|
|
806
|
+
// In multi-select mode, check if the option is in the selected array
|
|
807
|
+
return Array.isArray(this.optionSelected) && this.optionSelected.some((selectedOption) => selectedOption === option);
|
|
808
|
+
}
|
|
809
|
+
|
|
810
|
+
return this.optionSelected === option;
|
|
896
811
|
}
|
|
897
812
|
|
|
898
813
|
/**
|
|
@@ -1121,6 +1036,76 @@ var tokensCss = css`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-def
|
|
|
1121
1036
|
|
|
1122
1037
|
var colorCss = css`: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)}`;
|
|
1123
1038
|
|
|
1039
|
+
// Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
|
|
1040
|
+
// See LICENSE in the project root for license information.
|
|
1041
|
+
|
|
1042
|
+
// ---------------------------------------------------------------------
|
|
1043
|
+
|
|
1044
|
+
/* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
|
|
1045
|
+
|
|
1046
|
+
class AuroLibraryRuntimeUtils {
|
|
1047
|
+
|
|
1048
|
+
/* eslint-disable jsdoc/require-param */
|
|
1049
|
+
|
|
1050
|
+
/**
|
|
1051
|
+
* This will register a new custom element with the browser.
|
|
1052
|
+
* @param {String} name - The name of the custom element.
|
|
1053
|
+
* @param {Object} componentClass - The class to register as a custom element.
|
|
1054
|
+
* @returns {void}
|
|
1055
|
+
*/
|
|
1056
|
+
registerComponent(name, componentClass) {
|
|
1057
|
+
if (!customElements.get(name)) {
|
|
1058
|
+
customElements.define(name, class extends componentClass {});
|
|
1059
|
+
}
|
|
1060
|
+
}
|
|
1061
|
+
|
|
1062
|
+
/**
|
|
1063
|
+
* Finds and returns the closest HTML Element based on a selector.
|
|
1064
|
+
* @returns {void}
|
|
1065
|
+
*/
|
|
1066
|
+
closestElement(
|
|
1067
|
+
selector, // selector like in .closest()
|
|
1068
|
+
base = this, // extra functionality to skip a parent
|
|
1069
|
+
__Closest = (el, found = el && el.closest(selector)) =>
|
|
1070
|
+
!el || el === document || el === window
|
|
1071
|
+
? null // standard .closest() returns null for non-found selectors also
|
|
1072
|
+
: found
|
|
1073
|
+
? found // found a selector INside this element
|
|
1074
|
+
: __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
|
|
1075
|
+
) {
|
|
1076
|
+
return __Closest(base);
|
|
1077
|
+
}
|
|
1078
|
+
/* eslint-enable jsdoc/require-param */
|
|
1079
|
+
|
|
1080
|
+
/**
|
|
1081
|
+
* 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.
|
|
1082
|
+
* @param {Object} elem - The element to check.
|
|
1083
|
+
* @param {String} tagName - The name of the Auro component to check for or add as an attribute.
|
|
1084
|
+
* @returns {void}
|
|
1085
|
+
*/
|
|
1086
|
+
handleComponentTagRename(elem, tagName) {
|
|
1087
|
+
const tag = tagName.toLowerCase();
|
|
1088
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
1089
|
+
|
|
1090
|
+
if (elemTag !== tag) {
|
|
1091
|
+
elem.setAttribute(tag, true);
|
|
1092
|
+
}
|
|
1093
|
+
}
|
|
1094
|
+
|
|
1095
|
+
/**
|
|
1096
|
+
* Validates if an element is a specific Auro component.
|
|
1097
|
+
* @param {Object} elem - The element to validate.
|
|
1098
|
+
* @param {String} tagName - The name of the Auro component to check against.
|
|
1099
|
+
* @returns {Boolean} - Returns true if the element is the specified Auro component.
|
|
1100
|
+
*/
|
|
1101
|
+
elementMatch(elem, tagName) {
|
|
1102
|
+
const tag = tagName.toLowerCase();
|
|
1103
|
+
const elemTag = elem.tagName.toLowerCase();
|
|
1104
|
+
|
|
1105
|
+
return elemTag === tag || elem.hasAttribute(tag);
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1108
|
+
|
|
1124
1109
|
// Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
|
|
1125
1110
|
// See LICENSE in the project root for license information.
|
|
1126
1111
|
|
|
@@ -1328,7 +1313,7 @@ class AuroMenuOption extends LitElement {
|
|
|
1328
1313
|
/**
|
|
1329
1314
|
* @private
|
|
1330
1315
|
*/
|
|
1331
|
-
this.runtimeUtils = new AuroLibraryRuntimeUtils();
|
|
1316
|
+
this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
|
|
1332
1317
|
}
|
|
1333
1318
|
|
|
1334
1319
|
static get properties() {
|
|
@@ -1372,7 +1357,7 @@ class AuroMenuOption extends LitElement {
|
|
|
1372
1357
|
*
|
|
1373
1358
|
*/
|
|
1374
1359
|
static register(name = "auro-menuoption") {
|
|
1375
|
-
AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenuOption);
|
|
1360
|
+
AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenuOption);
|
|
1376
1361
|
}
|
|
1377
1362
|
|
|
1378
1363
|
firstUpdated() {
|
|
@@ -497,9 +497,10 @@ class DateFormatter {
|
|
|
497
497
|
/**
|
|
498
498
|
* Convert a date object to string format.
|
|
499
499
|
* @param {Object} date - Date to convert to string.
|
|
500
|
-
* @
|
|
500
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
501
|
+
* @returns {String} Returns the date as a string.
|
|
501
502
|
*/
|
|
502
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
503
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
503
504
|
year: "numeric",
|
|
504
505
|
month: "2-digit",
|
|
505
506
|
day: "2-digit",
|
|
@@ -691,7 +692,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
691
692
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
692
693
|
|
|
693
694
|
// Get the date string of the date object we created from the string date
|
|
694
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
695
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
695
696
|
|
|
696
697
|
// Guard Clause: Generated date matches date string input
|
|
697
698
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -472,9 +472,10 @@ class DateFormatter {
|
|
|
472
472
|
/**
|
|
473
473
|
* Convert a date object to string format.
|
|
474
474
|
* @param {Object} date - Date to convert to string.
|
|
475
|
-
* @
|
|
475
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
476
|
+
* @returns {String} Returns the date as a string.
|
|
476
477
|
*/
|
|
477
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
478
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
478
479
|
year: "numeric",
|
|
479
480
|
month: "2-digit",
|
|
480
481
|
day: "2-digit",
|
|
@@ -666,7 +667,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
666
667
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
667
668
|
|
|
668
669
|
// Get the date string of the date object we created from the string date
|
|
669
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
670
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
670
671
|
|
|
671
672
|
// Guard Clause: Generated date matches date string input
|
|
672
673
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -425,9 +425,10 @@ class DateFormatter {
|
|
|
425
425
|
/**
|
|
426
426
|
* Convert a date object to string format.
|
|
427
427
|
* @param {Object} date - Date to convert to string.
|
|
428
|
-
* @
|
|
428
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
429
|
+
* @returns {String} Returns the date as a string.
|
|
429
430
|
*/
|
|
430
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
431
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
431
432
|
year: "numeric",
|
|
432
433
|
month: "2-digit",
|
|
433
434
|
day: "2-digit",
|
|
@@ -619,7 +620,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
619
620
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
620
621
|
|
|
621
622
|
// Get the date string of the date object we created from the string date
|
|
622
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
623
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
623
624
|
|
|
624
625
|
// Guard Clause: Generated date matches date string input
|
|
625
626
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -425,9 +425,10 @@ class DateFormatter {
|
|
|
425
425
|
/**
|
|
426
426
|
* Convert a date object to string format.
|
|
427
427
|
* @param {Object} date - Date to convert to string.
|
|
428
|
-
* @
|
|
428
|
+
* @param {String} locale - Optional locale to use for the date string. Defaults to user's locale.
|
|
429
|
+
* @returns {String} Returns the date as a string.
|
|
429
430
|
*/
|
|
430
|
-
this.getDateAsString = (date) => date.toLocaleDateString(
|
|
431
|
+
this.getDateAsString = (date, locale = undefined) => date.toLocaleDateString(locale, {
|
|
431
432
|
year: "numeric",
|
|
432
433
|
month: "2-digit",
|
|
433
434
|
day: "2-digit",
|
|
@@ -619,7 +620,7 @@ class AuroDateUtilities extends AuroDateUtilitiesBase {
|
|
|
619
620
|
const dateObj = new Date(this.getFourDigitYear(dateParts.year), dateParts.month - 1, dateParts.day || 1);
|
|
620
621
|
|
|
621
622
|
// Get the date string of the date object we created from the string date
|
|
622
|
-
const actualDateStr = dateFormatter.getDateAsString(dateObj);
|
|
623
|
+
const actualDateStr = dateFormatter.getDateAsString(dateObj, "en-US");
|
|
623
624
|
|
|
624
625
|
// Guard Clause: Generated date matches date string input
|
|
625
626
|
if (expectedDateStr !== actualDateStr) {
|
|
@@ -5,6 +5,7 @@ import { valueAlertExample } from "../apiExamples/valueAlert.js";
|
|
|
5
5
|
import { inDialogExample } from '../apiExamples/inDialog';
|
|
6
6
|
import { resetStateExample } from "../apiExamples/resetState";
|
|
7
7
|
import { auroMenuLoadingExample } from "../apiExamples/loading";
|
|
8
|
+
import { valueTextExample } from '../apiExamples/valueText.js';
|
|
8
9
|
|
|
9
10
|
/* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
|
|
10
11
|
import { AuroSelect } from '../src/auro-select.js';
|
|
@@ -24,6 +25,7 @@ export function initExamples(initCount) {
|
|
|
24
25
|
inDialogExample();
|
|
25
26
|
resetStateExample();
|
|
26
27
|
auroMenuLoadingExample();
|
|
28
|
+
valueTextExample();
|
|
27
29
|
} catch (err) {
|
|
28
30
|
if (initCount <= 20) {
|
|
29
31
|
// setTimeout handles issue where content is sometimes loaded after the functions get called
|