@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.
Files changed (75) hide show
  1. package/components/bibtemplate/dist/auro-bibtemplate.d.ts +1 -0
  2. package/components/bibtemplate/dist/index.js +88 -6
  3. package/components/bibtemplate/dist/registered.js +88 -6
  4. package/components/checkbox/demo/api.min.js +4 -3
  5. package/components/checkbox/demo/index.min.js +4 -3
  6. package/components/checkbox/dist/index.js +4 -3
  7. package/components/checkbox/dist/registered.js +4 -3
  8. package/components/combobox/demo/api.md +30 -29
  9. package/components/combobox/demo/api.min.js +598 -428
  10. package/components/combobox/demo/index.html +0 -1
  11. package/components/combobox/demo/index.md +43 -0
  12. package/components/combobox/demo/index.min.js +596 -426
  13. package/components/combobox/dist/auro-combobox.d.ts +13 -18
  14. package/components/combobox/dist/index.js +458 -273
  15. package/components/combobox/dist/registered.js +458 -273
  16. package/components/counter/demo/api.min.js +377 -62
  17. package/components/counter/demo/index.min.js +377 -62
  18. package/components/counter/dist/index.js +377 -62
  19. package/components/counter/dist/registered.js +377 -62
  20. package/components/datepicker/demo/api.md +13 -5
  21. package/components/datepicker/demo/api.min.js +847 -324
  22. package/components/datepicker/demo/index.md +13 -0
  23. package/components/datepicker/demo/index.min.js +847 -324
  24. package/components/datepicker/dist/auro-datepicker.d.ts +21 -2
  25. package/components/datepicker/dist/index.js +677 -154
  26. package/components/datepicker/dist/registered.js +677 -154
  27. package/components/dropdown/demo/api.md +2 -2
  28. package/components/dropdown/demo/api.min.js +199 -37
  29. package/components/dropdown/demo/index.md +45 -0
  30. package/components/dropdown/demo/index.min.js +199 -37
  31. package/components/dropdown/dist/auro-dropdown.d.ts +10 -1
  32. package/components/dropdown/dist/auro-dropdownBib.d.ts +8 -0
  33. package/components/dropdown/dist/index.js +199 -37
  34. package/components/dropdown/dist/registered.js +199 -37
  35. package/components/dropdown/dist/styles/classic/color-css.d.ts +2 -0
  36. package/components/dropdown/dist/styles/classic/style-css.d.ts +2 -0
  37. package/components/input/demo/api.md +53 -49
  38. package/components/input/demo/api.min.js +121 -27
  39. package/components/input/demo/index.min.js +121 -27
  40. package/components/input/dist/auro-input.d.ts +22 -14
  41. package/components/input/dist/base-input.d.ts +1 -1
  42. package/components/input/dist/index.js +121 -27
  43. package/components/input/dist/registered.js +121 -27
  44. package/components/layoutElement/dist/index.d.ts +1 -0
  45. package/components/layoutElement/dist/index.js +95 -1
  46. package/components/menu/demo/api.md +11 -11
  47. package/components/menu/demo/api.min.js +115 -130
  48. package/components/menu/demo/index.min.js +115 -130
  49. package/components/menu/dist/auro-menu-utils.d.ts +0 -8
  50. package/components/menu/dist/auro-menu.d.ts +3 -8
  51. package/components/menu/dist/index.d.ts +1 -1
  52. package/components/menu/dist/index.js +116 -90
  53. package/components/menu/dist/registered.js +115 -130
  54. package/components/radio/demo/api.min.js +4 -3
  55. package/components/radio/demo/index.min.js +4 -3
  56. package/components/radio/dist/index.js +4 -3
  57. package/components/radio/dist/registered.js +4 -3
  58. package/components/select/demo/api.js +2 -0
  59. package/components/select/demo/api.md +108 -42
  60. package/components/select/demo/api.min.js +1264 -353
  61. package/components/select/demo/index.html +1 -0
  62. package/components/select/demo/index.md +298 -777
  63. package/components/select/demo/index.min.js +1251 -352
  64. package/components/select/dist/auro-select.d.ts +110 -18
  65. package/components/select/dist/helptextVersion.d.ts +2 -0
  66. package/components/select/dist/index.js +1105 -191
  67. package/components/select/dist/registered.js +1105 -191
  68. package/components/select/dist/styles/shapeSize-css.d.ts +2 -0
  69. package/components/select/dist/styles/tokens-css.d.ts +2 -0
  70. package/package.json +3 -3
  71. /package/components/{dropdown → datepicker}/dist/styles/default/color-css.d.ts +0 -0
  72. /package/components/{dropdown/dist/styles/default → datepicker/dist/styles/emphasized}/style-css.d.ts +0 -0
  73. /package/components/{dropdown/dist/styles/default/bibColors-css.d.ts → datepicker/dist/styles/shapeSize-css.d.ts} +0 -0
  74. /package/components/dropdown/dist/styles/{default/bibStyles-css.d.ts → classic/bibColors-css.d.ts} +0 -0
  75. /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,7 +77,7 @@ 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.
@@ -124,61 +124,6 @@ function arrayConverter(value) {
124
124
  throw new Error('Invalid value: Input must be an array or undefined');
125
125
  }
126
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
-
182
127
  /**
183
128
  * Validates if an option can be interacted with.
184
129
  * @private
@@ -211,7 +156,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
211
156
  element.dispatchEvent(new CustomEvent(eventName, eventConfig));
212
157
  }
213
158
 
214
- // Copyright (c) 2021 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
159
+ // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
215
160
  // See LICENSE in the project root for license information.
216
161
 
217
162
 
@@ -219,14 +164,14 @@ function dispatchMenuEvent(element, eventName, detail = null) {
219
164
  // See https://git.io/JJ6SJ for "How to document your components using JSDoc"
220
165
  /**
221
166
  * The auro-menu element provides users a way to select from a list of options.
222
- * @attr {Array<HTMLElement>|undefined} optionSelected - An array of currently selected menu options. In single-select mode, the array will contain only one HTMLElement. `undefined` when no options are selected.
167
+ * @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
168
  * @attr {object} optionactive - Specifies the current active menuOption.
224
169
  * @attr {string} matchword - Specifies a string used to highlight matched string parts in options.
225
170
  * @attr {boolean} disabled - When true, the entire menu and all options are disabled;
226
171
  * @attr {boolean} nocheckmark - When true, selected option will not show the checkmark.
227
172
  * @attr {boolean} loading - When true, displays a loading state using the loadingIcon and loadingText slots if provided.
228
173
  * @attr {boolean} multiselect - When true, the selected option can be multiple options.
229
- * @attr {Array<string>|undefined} value - Value selected for the menu. `undefined` when no selection has been made, otherwise an array of strings. In single-select mode, the array will contain only one value.
174
+ * @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
175
  * @prop {boolean} hasLoadingPlaceholder - Indicates whether the menu has a loadingIcon or loadingText to render when in a loading state.
231
176
  * @event {CustomEvent<Element>} auroMenu-activatedOption - Notifies that a menuoption has been made `active`.
232
177
  * @event {CustomEvent<any>} auroMenu-customEventFired - Notifies that a custom event has been fired.
@@ -239,7 +184,7 @@ function dispatchMenuEvent(element, eventName, detail = null) {
239
184
  * @slot - Slot for insertion of menu options.
240
185
  */
241
186
 
242
- /* eslint-disable no-magic-numbers, max-lines */
187
+ /* eslint-disable no-magic-numbers, max-lines, no-extra-parens */
243
188
 
244
189
  class AuroMenu extends LitElement {
245
190
  constructor() {
@@ -319,9 +264,8 @@ class AuroMenu extends LitElement {
319
264
  reflect: true
320
265
  },
321
266
  optionSelected: {
322
- // Allow HTMLElement[] arrays and undefined
323
- converter: arrayConverter,
324
- hasChanged: arrayOrUndefinedHasChanged
267
+ // Allow HTMLElement, HTMLElement[] arrays and undefined
268
+ type: Object
325
269
  },
326
270
  optionActive: {
327
271
  type: Object,
@@ -337,10 +281,8 @@ class AuroMenu extends LitElement {
337
281
  attribute: 'multiselect'
338
282
  },
339
283
  value: {
340
- // Allow string[] arrays and undefined
341
- type: Object,
342
- converter: arrayConverter,
343
- hasChanged: arrayOrUndefinedHasChanged
284
+ // Allow string, string[] arrays and undefined
285
+ type: Object
344
286
  }
345
287
  };
346
288
  }
@@ -362,7 +304,7 @@ class AuroMenu extends LitElement {
362
304
  *
363
305
  */
364
306
  static register(name = "auro-menu") {
365
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenu);
307
+ AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenu);
366
308
  }
367
309
 
368
310
  // Lifecycle Methods
@@ -386,37 +328,46 @@ class AuroMenu extends LitElement {
386
328
  }
387
329
 
388
330
  firstUpdated() {
389
- AuroLibraryRuntimeUtils.prototype.handleComponentTagRename(this, 'auro-menu');
331
+ AuroLibraryRuntimeUtils$1.prototype.handleComponentTagRename(this, 'auro-menu');
390
332
 
391
333
  this.loadingSlots = this.querySelectorAll("[slot='loadingText'], [slot='loadingIcon']");
392
334
  this.initializeMenu();
393
335
  }
394
336
 
395
337
  updated(changedProperties) {
338
+ if (changedProperties.has('multiSelect')) {
339
+ // Reset selection if multiSelect mode changes
340
+ this.clearSelection();
341
+ }
342
+
396
343
  if (changedProperties.has('value')) {
397
344
  // Handle null/undefined case
398
345
  if (this.value === undefined || this.value === null) {
399
346
  this.optionSelected = undefined;
400
- // Reset index tracking
401
347
  this.index = -1;
402
348
  } else {
403
- // Convert single values to arrays
404
- const valueArray = Array.isArray(this.value) ? this.value : [this.value];
349
+ if (this.multiSelect) {
350
+ // In multiselect mode, this.value should be an array of strings
351
+ const valueArray = Array.isArray(this.value) ? this.value : [this.value];
352
+ const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
405
353
 
406
- // Find all matching options
407
- const matchingOptions = this.items.filter((item) => valueArray.includes(item.value));
354
+ this.optionSelected = matchingOptions.length > 0 ? matchingOptions : undefined;
355
+ } else {
356
+ // In single-select mode, this.value should be a string
357
+ const matchingOptions = this.items.find((item) => item.value === this.value);
408
358
 
409
- if (matchingOptions.length > 0) {
410
- if (this.multiSelect) {
411
- // For multiselect, keep all matching options
359
+ if (matchingOptions) {
412
360
  this.optionSelected = matchingOptions;
361
+ this.index = this.items.indexOf(matchingOptions);
413
362
  } else {
414
- // For single select, only use the first match
415
- this.optionSelected = [matchingOptions[0]];
416
- this.index = this.items.indexOf(matchingOptions[0]);
363
+ // If no matching option found, reset selection
364
+ this.optionSelected = undefined;
365
+ this.index = -1;
417
366
  }
418
- } else {
419
- // No matches found - trigger failure event
367
+ }
368
+
369
+ // If no matching options were found in either mode
370
+ if (!this.optionSelected || (Array.isArray(this.optionSelected) && this.optionSelected.length === 0)) {
420
371
  dispatchMenuEvent(this, 'auroMenu-selectValueFailure');
421
372
  this.optionSelected = undefined;
422
373
  this.index = -1;
@@ -568,8 +519,8 @@ class AuroMenu extends LitElement {
568
519
  }
569
520
  } else {
570
521
  // Single select - use arrays with single values
571
- this.value = [option.value];
572
- this.optionSelected = [option];
522
+ this.value = option.value;
523
+ this.optionSelected = option;
573
524
  }
574
525
 
575
526
  this.index = this.items.indexOf(option);
@@ -891,8 +842,13 @@ class AuroMenu extends LitElement {
891
842
  if (!this.optionSelected) {
892
843
  return false;
893
844
  }
894
- // Always treat as array for both single and multi-select
895
- return Array.isArray(this.optionSelected) && this.optionSelected.includes(option);
845
+
846
+ if (this.multiSelect) {
847
+ // In multi-select mode, check if the option is in the selected array
848
+ return Array.isArray(this.optionSelected) && this.optionSelected.some((selectedOption) => selectedOption === option);
849
+ }
850
+
851
+ return this.optionSelected === option;
896
852
  }
897
853
 
898
854
  /**
@@ -1121,6 +1077,76 @@ var tokensCss = css`:host{--ds-auro-icon-color:var(--ds-basic-color-texticon-def
1121
1077
 
1122
1078
  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
1079
 
1080
+ // Copyright (c) Alaska Air. All right reserved. Licensed under the Apache-2.0 license
1081
+ // See LICENSE in the project root for license information.
1082
+
1083
+ // ---------------------------------------------------------------------
1084
+
1085
+ /* eslint-disable line-comment-position, no-inline-comments, no-confusing-arrow, no-nested-ternary, implicit-arrow-linebreak */
1086
+
1087
+ class AuroLibraryRuntimeUtils {
1088
+
1089
+ /* eslint-disable jsdoc/require-param */
1090
+
1091
+ /**
1092
+ * This will register a new custom element with the browser.
1093
+ * @param {String} name - The name of the custom element.
1094
+ * @param {Object} componentClass - The class to register as a custom element.
1095
+ * @returns {void}
1096
+ */
1097
+ registerComponent(name, componentClass) {
1098
+ if (!customElements.get(name)) {
1099
+ customElements.define(name, class extends componentClass {});
1100
+ }
1101
+ }
1102
+
1103
+ /**
1104
+ * Finds and returns the closest HTML Element based on a selector.
1105
+ * @returns {void}
1106
+ */
1107
+ closestElement(
1108
+ selector, // selector like in .closest()
1109
+ base = this, // extra functionality to skip a parent
1110
+ __Closest = (el, found = el && el.closest(selector)) =>
1111
+ !el || el === document || el === window
1112
+ ? null // standard .closest() returns null for non-found selectors also
1113
+ : found
1114
+ ? found // found a selector INside this element
1115
+ : __Closest(el.getRootNode().host) // recursion!! break out to parent DOM
1116
+ ) {
1117
+ return __Closest(base);
1118
+ }
1119
+ /* eslint-enable jsdoc/require-param */
1120
+
1121
+ /**
1122
+ * 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.
1123
+ * @param {Object} elem - The element to check.
1124
+ * @param {String} tagName - The name of the Auro component to check for or add as an attribute.
1125
+ * @returns {void}
1126
+ */
1127
+ handleComponentTagRename(elem, tagName) {
1128
+ const tag = tagName.toLowerCase();
1129
+ const elemTag = elem.tagName.toLowerCase();
1130
+
1131
+ if (elemTag !== tag) {
1132
+ elem.setAttribute(tag, true);
1133
+ }
1134
+ }
1135
+
1136
+ /**
1137
+ * Validates if an element is a specific Auro component.
1138
+ * @param {Object} elem - The element to validate.
1139
+ * @param {String} tagName - The name of the Auro component to check against.
1140
+ * @returns {Boolean} - Returns true if the element is the specified Auro component.
1141
+ */
1142
+ elementMatch(elem, tagName) {
1143
+ const tag = tagName.toLowerCase();
1144
+ const elemTag = elem.tagName.toLowerCase();
1145
+
1146
+ return elemTag === tag || elem.hasAttribute(tag);
1147
+ }
1148
+ }
1149
+
1124
1150
  // Copyright (c) 2025 Alaska Airlines. All right reserved. Licensed under the Apache-2.0 license
1125
1151
  // See LICENSE in the project root for license information.
1126
1152
 
@@ -1328,7 +1354,7 @@ class AuroMenuOption extends LitElement {
1328
1354
  /**
1329
1355
  * @private
1330
1356
  */
1331
- this.runtimeUtils = new AuroLibraryRuntimeUtils();
1357
+ this.runtimeUtils = new AuroLibraryRuntimeUtils$1();
1332
1358
  }
1333
1359
 
1334
1360
  static get properties() {
@@ -1372,7 +1398,7 @@ class AuroMenuOption extends LitElement {
1372
1398
  *
1373
1399
  */
1374
1400
  static register(name = "auro-menuoption") {
1375
- AuroLibraryRuntimeUtils.prototype.registerComponent(name, AuroMenuOption);
1401
+ AuroLibraryRuntimeUtils$1.prototype.registerComponent(name, AuroMenuOption);
1376
1402
  }
1377
1403
 
1378
1404
  firstUpdated() {
@@ -1423,4 +1449,4 @@ class AuroMenuOption extends LitElement {
1423
1449
  }
1424
1450
  }
1425
1451
 
1426
- export { AuroMenu, AuroMenuOption, arrayConverter, arrayOrUndefinedHasChanged, dispatchMenuEvent, isOptionInteractive };
1452
+ export { AuroMenu, AuroMenuOption, arrayConverter, dispatchMenuEvent, isOptionInteractive };