@aurodesignsystem/auro-formkit 5.2.2 → 5.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (54) hide show
  1. package/CHANGELOG.md +10 -3
  2. package/components/bibtemplate/dist/buttonVersion.d.ts +1 -1
  3. package/components/bibtemplate/dist/index.js +18 -83
  4. package/components/bibtemplate/dist/registered.js +18 -83
  5. package/components/checkbox/demo/api.min.js +14 -3
  6. package/components/checkbox/demo/index.min.js +14 -3
  7. package/components/checkbox/dist/index.js +14 -3
  8. package/components/checkbox/dist/registered.js +14 -3
  9. package/components/combobox/demo/api.js +2 -0
  10. package/components/combobox/demo/api.md +117 -3
  11. package/components/combobox/demo/api.min.js +445 -343
  12. package/components/combobox/demo/index.min.js +348 -265
  13. package/components/combobox/dist/auro-combobox.d.ts +18 -0
  14. package/components/combobox/dist/index.js +275 -212
  15. package/components/combobox/dist/registered.js +275 -212
  16. package/components/counter/demo/api.md +29 -1
  17. package/components/counter/demo/api.min.js +264 -240
  18. package/components/counter/demo/index.min.js +264 -240
  19. package/components/counter/dist/auro-counter-group.d.ts +9 -0
  20. package/components/counter/dist/index.js +183 -176
  21. package/components/counter/dist/registered.js +183 -176
  22. package/components/datepicker/demo/api.md +23 -1
  23. package/components/datepicker/demo/api.min.js +420 -447
  24. package/components/datepicker/demo/index.min.js +420 -447
  25. package/components/datepicker/dist/auro-datepicker.d.ts +9 -0
  26. package/components/datepicker/dist/buttonVersion.d.ts +1 -1
  27. package/components/datepicker/dist/index.js +241 -279
  28. package/components/datepicker/dist/registered.js +241 -279
  29. package/components/dropdown/demo/api.md +46 -2
  30. package/components/dropdown/demo/api.min.js +148 -16
  31. package/components/dropdown/demo/index.min.js +148 -16
  32. package/components/dropdown/dist/auro-dropdown.d.ts +12 -0
  33. package/components/dropdown/dist/index.js +118 -3
  34. package/components/dropdown/dist/registered.js +118 -3
  35. package/components/input/demo/api.min.js +35 -89
  36. package/components/input/demo/index.min.js +35 -89
  37. package/components/input/dist/buttonVersion.d.ts +1 -1
  38. package/components/input/dist/index.js +35 -89
  39. package/components/input/dist/registered.js +35 -89
  40. package/components/menu/demo/api.min.js +11 -2
  41. package/components/menu/demo/index.min.js +11 -2
  42. package/components/menu/dist/index.js +11 -2
  43. package/components/menu/dist/registered.js +11 -2
  44. package/components/radio/demo/api.min.js +18 -7
  45. package/components/radio/demo/index.min.js +18 -7
  46. package/components/radio/dist/index.js +18 -7
  47. package/components/radio/dist/registered.js +18 -7
  48. package/components/select/demo/api.md +29 -1
  49. package/components/select/demo/api.min.js +269 -150
  50. package/components/select/demo/index.min.js +269 -150
  51. package/components/select/dist/auro-select.d.ts +11 -0
  52. package/components/select/dist/index.js +199 -106
  53. package/components/select/dist/registered.js +199 -106
  54. package/package.json +5 -5
@@ -1087,12 +1087,23 @@ class AuroFormValidation {
1087
1087
  }
1088
1088
 
1089
1089
  if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
1090
- elem.validity = this.auroInputElements[0].validity;
1091
- elem.errorMessage = this.auroInputElements[0].errorMessage;
1090
+
1091
+ const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
1092
+
1093
+ // Don't reset combobox validity if persistValue is set since we can't use the input value to validate
1094
+ if (!isCombobox || isCombobox && !elem.persistValue) {
1095
+
1096
+ // run validation on all inputs since we're going to use them to set the validity of this component
1097
+ this.auroInputElements.forEach(input => input.validate());
1098
+
1099
+ // Reset element validity to the validity of the input
1100
+ elem.validity = this.auroInputElements[0].validity;
1101
+ elem.errorMessage = this.auroInputElements[0].errorMessage;
1102
+ }
1092
1103
 
1093
1104
  // multiple input in one components (datepicker)
1094
1105
  // combobox has 2 inputs but no need to check validity on the 2nd one which is in fullscreen bib.
1095
- if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
1106
+ if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !isCombobox) {
1096
1107
  elem.validity = this.auroInputElements[1].validity;
1097
1108
  elem.errorMessage = this.auroInputElements[1].errorMessage;
1098
1109
  }
@@ -1087,12 +1087,23 @@ class AuroFormValidation {
1087
1087
  }
1088
1088
 
1089
1089
  if (this.auroInputElements?.length > 0 && elem.validity !== "valueMissing") {
1090
- elem.validity = this.auroInputElements[0].validity;
1091
- elem.errorMessage = this.auroInputElements[0].errorMessage;
1090
+
1091
+ const isCombobox = this.runtimeUtils.elementMatch(elem, 'auro-combobox');
1092
+
1093
+ // Don't reset combobox validity if persistValue is set since we can't use the input value to validate
1094
+ if (!isCombobox || isCombobox && !elem.persistValue) {
1095
+
1096
+ // run validation on all inputs since we're going to use them to set the validity of this component
1097
+ this.auroInputElements.forEach(input => input.validate());
1098
+
1099
+ // Reset element validity to the validity of the input
1100
+ elem.validity = this.auroInputElements[0].validity;
1101
+ elem.errorMessage = this.auroInputElements[0].errorMessage;
1102
+ }
1092
1103
 
1093
1104
  // multiple input in one components (datepicker)
1094
1105
  // combobox has 2 inputs but no need to check validity on the 2nd one which is in fullscreen bib.
1095
- if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !this.runtimeUtils.elementMatch(elem, 'auro-combobox')) {
1106
+ if (elem.validity === 'valid' && this.auroInputElements.length > 1 && !isCombobox) {
1096
1107
  elem.validity = this.auroInputElements[1].validity;
1097
1108
  elem.errorMessage = this.auroInputElements[1].errorMessage;
1098
1109
  }
@@ -1,6 +1,7 @@
1
1
  /* eslint-disable jsdoc/require-jsdoc, no-magic-numbers, no-param-reassign */
2
2
 
3
3
  import { dynamicMenuExample } from '../apiExamples/dynamicMenu';
4
+ import { setupExternalSelectionExample } from '../apiExamples/externalSelection.js';
4
5
  import { valueExample } from '../apiExamples/value';
5
6
  import { focusExample } from '../apiExamples/focus';
6
7
  import { inDialogExample } from '../apiExamples/inDialog';
@@ -24,6 +25,7 @@ export function initExamples(initCount) {
24
25
  inDialogExample();
25
26
  resetStateExample();
26
27
  auroMenuLoadingExample();
28
+ setupExternalSelectionExample();
27
29
  } catch (err) {
28
30
  if (initCount <= 20) {
29
31
  // setTimeout handles issue where content is sometimes loaded after the functions get called
@@ -35,6 +35,7 @@
35
35
  | [setCustomValidityCustomError](#setCustomValidityCustomError) | `setCustomValidityCustomError` | | `string` | | Custom help text message to display when validity = `customError`. |
36
36
  | [setCustomValidityValueMissing](#setCustomValidityValueMissing) | `setCustomValidityValueMissing` | | `string` | | Custom help text message to display when validity = `valueMissing`. |
37
37
  | [shape](#shape) | | | `string` | "classic" | |
38
+ | [shift](#shift) | `shift` | | `boolean` | "false" | If declared, the dropdown will shift its position to avoid being cut off by the viewport. |
38
39
  | [size](#size) | | | `string` | "xl" | |
39
40
  | [triggerIcon](#triggerIcon) | `triggerIcon` | | `boolean` | false | If set, the `icon` attribute will be applied to the trigger `auro-input` element. |
40
41
  | [type](#type) | `type` | | `string` | | Applies the defined value as the type attribute on auro-input. |
@@ -381,6 +382,92 @@ export async function dynamicMenuExample() {
381
382
  <!-- AURO-GENERATED-CONTENT:END -->
382
383
  </auro-accordion>
383
384
 
385
+ ### Updating Externally
386
+
387
+ This example demonstrates using the <code>updateActiveOption</code> method to set a specific menu option as "active."
388
+
389
+ This is useful for situations like matching IATA codes (sea -> SeaTac airport)
390
+
391
+ <div class="exampleWrapper--ondark">
392
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/externalSelection.html) -->
393
+ <!-- The below content is automatically added from ./../apiExamples/externalSelection.html -->
394
+ <p style="color: white;">
395
+ Type 'a' in the combobox for best testing results :)
396
+ </p>
397
+ <auro-combobox ondark id="externalSelectionExample" layout="classic" shape="classic" size="lg" placeholder="Placeholder content" required style="width: 249px;">
398
+ <span slot="ariaLabel.bib.close">Close combobox</span>
399
+ <span slot="ariaLabel.input.clear">Clear All</span>
400
+ <span slot="bib.fullscreen.headline">Bib Header</span>
401
+ <span slot="label">Name</span>
402
+ <auro-menu>
403
+ <auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
404
+ <auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
405
+ <auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
406
+ <auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
407
+ <auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
408
+ <auro-menuoption static nomatch>No matching option</auro-menuoption>
409
+ </auro-menu>
410
+ <span slot="helpText">
411
+ Help text - Lorem ipsum solar lorem ipsum solar
412
+ </span>
413
+ </auro-combobox>
414
+ <!-- AURO-GENERATED-CONTENT:END -->
415
+ </div>
416
+ <auro-accordion alignRight>
417
+ <span slot="trigger">See code</span>
418
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/externalSelection.html) -->
419
+ <!-- The below code snippet is automatically added from ./../apiExamples/externalSelection.html -->
420
+
421
+ ```html
422
+ <p style="color: white;">
423
+ Type 'a' in the combobox for best testing results :)
424
+ </p>
425
+ <auro-combobox ondark id="externalSelectionExample" layout="classic" shape="classic" size="lg" placeholder="Placeholder content" required style="width: 249px;">
426
+ <span slot="ariaLabel.bib.close">Close combobox</span>
427
+ <span slot="ariaLabel.input.clear">Clear All</span>
428
+ <span slot="bib.fullscreen.headline">Bib Header</span>
429
+ <span slot="label">Name</span>
430
+ <auro-menu>
431
+ <auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
432
+ <auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
433
+ <auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
434
+ <auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
435
+ <auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
436
+ <auro-menuoption static nomatch>No matching option</auro-menuoption>
437
+ </auro-menu>
438
+ <span slot="helpText">
439
+ Help text - Lorem ipsum solar lorem ipsum solar
440
+ </span>
441
+ </auro-combobox>
442
+ ```
443
+ <!-- AURO-GENERATED-CONTENT:END -->
444
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/externalSelection.js) -->
445
+ <!-- The below code snippet is automatically added from ./../apiExamples/externalSelection.js -->
446
+
447
+ ```js
448
+ import { AuroCombobox } from "../src/auro-combobox";
449
+
450
+ /**
451
+ * Demonstrates how to make external selection in the combobox.
452
+ */
453
+ export function setupExternalSelectionExample() {
454
+
455
+ /** @type {AuroCombobox} */
456
+ const combobox = document.getElementById('externalSelectionExample');
457
+
458
+ combobox.addEventListener('input', () => {
459
+ // Perform whatever matching logic you need here
460
+
461
+ // This comes from your custom code, for example matching SEA to SeaTac IATA code.
462
+ // This matches "peaches" as configured.
463
+ const matchingMenuOption = 2;
464
+ combobox.updateActiveOption(matchingMenuOption);
465
+ });
466
+ }
467
+ ```
468
+ <!-- AURO-GENERATED-CONTENT:END -->
469
+ </auro-accordion>
470
+
384
471
  ### Property Examples
385
472
 
386
473
  #### disabled
@@ -1154,8 +1241,8 @@ export function auroMenuLoadingExample() {
1154
1241
 
1155
1242
  }
1156
1243
 
1157
- combobox.addEventListener("input", (e) => {
1158
- if (e.target.value && e.target.value !== e.target.optionSelected?.textContent) {
1244
+ combobox.addEventListener("inputValue", (e) => {
1245
+ if (e.target.inputValue && e.target.value !== e.target.inputValue) {
1159
1246
  load();
1160
1247
  }
1161
1248
  });
@@ -1178,12 +1265,13 @@ export function auroMenuLoadingExample() {
1178
1265
  </auro-accordion>
1179
1266
 
1180
1267
  ### Customized bib position
1181
- The bib position can be customized with `placement`, `offset`, `flip`, `autoPlacement` attributes.
1268
+ The bib position can be customized with `placement`, `offset`, `flip`, `autoPlacement`, and `shift` attributes.
1182
1269
 
1183
1270
  - `placement` specifies the preferred position where the bib should appear relative to the trigger.
1184
1271
  - `offset` sets the distance between the trigger and the bib.
1185
1272
  - When `autoPlacement` is enabled, smart positioning logic is applied to determine the best placement for the bib. If all sides have sufficient space, the bib will appear in the position specified by `placement`.
1186
1273
  - Unless `noFlip` is enabled, if there isn't enough space for the preferred `placement`, the bib will automatically flip to an alternative position.
1274
+ - `shift` when enabled, adjusts the bib position when it would overflow the viewport boundaries, ensuring it remains visible.
1187
1275
 
1188
1276
  <div class="exampleWrapper">
1189
1277
  <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/floaterConfig.html) -->
@@ -1227,6 +1315,19 @@ The bib position can be customized with `placement`, `offset`, `flip`, `autoPlac
1227
1315
  <auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
1228
1316
  <auro-menuoption static nomatch>No matching option</auro-menuoption>
1229
1317
  </auro-menu>
1318
+ </auro-combobox>
1319
+ <auro-combobox width="350px" offset="20" noFlip placement="bottom-start" shift>
1320
+ <span slot="bib.fullscreen.headline">Bib Header</span>
1321
+ <span slot="label">Label</span>
1322
+ <span slot="helpText">bottom-start bib with 20px offset, noFlip and shift</span>
1323
+ <auro-menu>
1324
+ <auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
1325
+ <auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
1326
+ <auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
1327
+ <auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
1328
+ <auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
1329
+ <auro-menuoption static nomatch>No matching option</auro-menuoption>
1330
+ </auro-menu>
1230
1331
  </auro-combobox>
1231
1332
  </div>
1232
1333
  <!-- AURO-GENERATED-CONTENT:END -->
@@ -1276,6 +1377,19 @@ The bib position can be customized with `placement`, `offset`, `flip`, `autoPlac
1276
1377
  <auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
1277
1378
  <auro-menuoption static nomatch>No matching option</auro-menuoption>
1278
1379
  </auro-menu>
1380
+ </auro-combobox>
1381
+ <auro-combobox width="350px" offset="20" noFlip placement="bottom-start" shift>
1382
+ <span slot="bib.fullscreen.headline">Bib Header</span>
1383
+ <span slot="label">Label</span>
1384
+ <span slot="helpText">bottom-start bib with 20px offset, noFlip and shift</span>
1385
+ <auro-menu>
1386
+ <auro-menuoption value="Apples" id="option-0">Apples</auro-menuoption>
1387
+ <auro-menuoption value="Oranges" id="option-1">Oranges</auro-menuoption>
1388
+ <auro-menuoption value="Peaches" id="option-2">Peaches</auro-menuoption>
1389
+ <auro-menuoption value="Grapes" id="option-3">Grapes</auro-menuoption>
1390
+ <auro-menuoption value="Cherries" id="option-4">Cherries</auro-menuoption>
1391
+ <auro-menuoption static nomatch>No matching option</auro-menuoption>
1392
+ </auro-menu>
1279
1393
  </auro-combobox>
1280
1394
  </div>
1281
1395
  ```