@aurodesignsystem/auro-formkit 5.8.1 → 5.9.1

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 (61) hide show
  1. package/CHANGELOG.md +4 -15
  2. package/README.md +4 -4
  3. package/components/bibtemplate/dist/iconVersion.d.ts +1 -1
  4. package/components/bibtemplate/dist/index.js +2 -2
  5. package/components/bibtemplate/dist/registered.js +2 -2
  6. package/components/checkbox/demo/api.min.js +1 -1
  7. package/components/checkbox/demo/index.min.js +1 -1
  8. package/components/checkbox/dist/index.js +1 -1
  9. package/components/checkbox/dist/registered.js +1 -1
  10. package/components/combobox/demo/api.md +7 -6
  11. package/components/combobox/demo/api.min.js +1698 -1038
  12. package/components/combobox/demo/index.min.js +1698 -1038
  13. package/components/combobox/dist/auro-combobox.d.ts +10 -8
  14. package/components/combobox/dist/index.js +128 -149
  15. package/components/combobox/dist/registered.js +128 -149
  16. package/components/counter/demo/api.min.js +37 -61
  17. package/components/counter/demo/index.min.js +37 -61
  18. package/components/counter/dist/index.js +37 -61
  19. package/components/counter/dist/registered.js +37 -61
  20. package/components/datepicker/demo/api.min.js +55 -148
  21. package/components/datepicker/demo/index.min.js +55 -148
  22. package/components/datepicker/dist/auro-datepicker.d.ts +1 -1
  23. package/components/datepicker/dist/iconVersion.d.ts +1 -1
  24. package/components/datepicker/dist/index.js +55 -148
  25. package/components/datepicker/dist/popoverVersion.d.ts +1 -1
  26. package/components/datepicker/dist/registered.js +55 -148
  27. package/components/dropdown/demo/api.min.js +33 -57
  28. package/components/dropdown/demo/index.min.js +33 -57
  29. package/components/dropdown/dist/iconVersion.d.ts +1 -1
  30. package/components/dropdown/dist/index.js +33 -57
  31. package/components/dropdown/dist/registered.js +33 -57
  32. package/components/form/demo/working.html +1 -1
  33. package/components/input/demo/api.min.js +5 -4
  34. package/components/input/demo/index.min.js +5 -4
  35. package/components/input/dist/base-input.d.ts +1 -1
  36. package/components/input/dist/iconVersion.d.ts +1 -1
  37. package/components/input/dist/index.js +5 -4
  38. package/components/input/dist/registered.js +5 -4
  39. package/components/menu/demo/api.js +4 -0
  40. package/components/menu/demo/api.md +271 -31
  41. package/components/menu/demo/api.min.js +1609 -863
  42. package/components/menu/demo/index.html +1 -0
  43. package/components/menu/demo/index.js +2 -0
  44. package/components/menu/demo/index.md +95 -1
  45. package/components/menu/demo/index.min.js +1544 -812
  46. package/components/menu/dist/auro-menu.context.d.ts +227 -0
  47. package/components/menu/dist/auro-menu.d.ts +98 -53
  48. package/components/menu/dist/auro-menuoption.d.ts +116 -14
  49. package/components/menu/dist/index.js +1457 -796
  50. package/components/menu/dist/registered.js +1456 -807
  51. package/components/radio/demo/api.min.js +1 -1
  52. package/components/radio/demo/index.min.js +1 -1
  53. package/components/radio/dist/index.js +1 -1
  54. package/components/radio/dist/registered.js +1 -1
  55. package/components/select/demo/api.md +8 -7
  56. package/components/select/demo/api.min.js +1617 -1056
  57. package/components/select/demo/index.min.js +1617 -1056
  58. package/components/select/dist/auro-select.d.ts +11 -35
  59. package/components/select/dist/index.js +98 -218
  60. package/components/select/dist/registered.js +98 -218
  61. package/package.json +8 -2
@@ -50,6 +50,7 @@
50
50
  </script>
51
51
 
52
52
  <script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-accordion@latest/+esm" type="module"></script>
53
+ <script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-button@latest/+esm" type="module"></script>
53
54
  <script type="module" data-demo-script="true">
54
55
  import { initExamples } from "./index.min.js"
55
56
  initExamples();
@@ -4,6 +4,7 @@
4
4
 
5
5
  import { AuroMenu } from '../src/auro-menu.js';
6
6
  import { AuroMenuOption } from '../src/auro-menuoption.js';
7
+ import { initKeysExample } from '../apiExamples/keys.js';
7
8
 
8
9
  AuroMenu.register();
9
10
  AuroMenuOption.register();
@@ -16,6 +17,7 @@ export function initExamples(initCount) {
16
17
  try {
17
18
  // javascript example function calls to be added here upon creation to test examples
18
19
  // auroMenuResetExample();
20
+ initKeysExample();
19
21
  } catch (err) {
20
22
  if (initCount <= 20) {
21
23
  // setTimeout handles issue where content is sometimes loaded after the functions get called
@@ -58,4 +58,98 @@ A basic `auro-menu` element with nested `auro-menuoption` elements to generate a
58
58
  ```
59
59
  <!-- AURO-GENERATED-CONTENT:END -->
60
60
  </auro-accordion>
61
- Having a closing statement about your example helps to really complete the thought with your reader.
61
+
62
+ ### Using Keys
63
+
64
+ When setting the `value` property, matches are actually performed on the value of the `key` property of the `auro-menuoption` and not the `value` property. By default, the value of `key` is equal to the value of the `value` property. However, for advanced use cases, the `key` value can be overriden to allow for more specific matches.
65
+
66
+ In the below example, there is a list of "popular" options at the top, with the same values repeated underneath. To allow more specific selections, we can add a `key` attribute to the top options to allow them to be more specifically selected, or to prevent them from interfering with matches on the lower options.
67
+
68
+ In the below example, setting the value of the menu `'stops'` will select the bottom-most option with the value `'stops'`, and setting the value of menu to `'stops-top'` will select the top-most option with the value `'stops'` since the key now differs from the value. In either case, the resulting value of the menu will be `'stops'` because the resulting value of the menu is based on the `value` property and not the `key` property.
69
+
70
+ Due to a limitation with Lit change detection to the `value` property, if multiple options with the same exist and one is selected, you must first clear the current value before attempting to select another option with the same value, even if the keys are unique. See code example below.
71
+
72
+ _Note: Since the value passed to the `value` property when programmatically setting it is overwritten with the proper derived value once the menu has updated, note that it will take one lifecycle before the `value` property is updated to the value that represents the actual menu state._
73
+
74
+ <div class="exampleWrapper">
75
+ <!-- AURO-GENERATED-CONTENT:START (FILE:src=./../apiExamples/keys.html) -->
76
+ <!-- The below content is automatically added from ./../apiExamples/keys.html -->
77
+ <auro-button id="stopsTopButton">Call `menu.value = 'stops-top'`</auro-button>
78
+ <auro-button id="stopsButton">Call `menu.value = 'stops'`</auro-button>
79
+ <auro-menu id="keys-menu">
80
+ <auro-menuoption value="stops" key="stops-top">Stops</auro-menuoption>
81
+ <auro-menuoption value="price" key="price-top">Price</auro-menuoption>
82
+ <hr>
83
+ <auro-menuoption value="duration">Duration</auro-menuoption>
84
+ <auro-menuoption value="departure">Departure</auro-menuoption>
85
+ <auro-menuoption value="arrival">Arrival</auro-menuoption>
86
+ <auro-menuoption value="stops">Stops</auro-menuoption>
87
+ <auro-menuoption value="price">Price</auro-menuoption>
88
+ </auro-menu>
89
+ <p id="output" class="body-sm"></p>
90
+ <!-- AURO-GENERATED-CONTENT:END -->
91
+ </div>
92
+ <auro-accordion alignRight>
93
+ <span slot="trigger">See code</span>
94
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/keys.html) -->
95
+ <!-- The below code snippet is automatically added from ./../apiExamples/keys.html -->
96
+
97
+ ```html
98
+ <auro-button id="stopsTopButton">Call `menu.value = 'stops-top'`</auro-button>
99
+ <auro-button id="stopsButton">Call `menu.value = 'stops'`</auro-button>
100
+ <auro-menu id="keys-menu">
101
+ <auro-menuoption value="stops" key="stops-top">Stops</auro-menuoption>
102
+ <auro-menuoption value="price" key="price-top">Price</auro-menuoption>
103
+ <hr>
104
+ <auro-menuoption value="duration">Duration</auro-menuoption>
105
+ <auro-menuoption value="departure">Departure</auro-menuoption>
106
+ <auro-menuoption value="arrival">Arrival</auro-menuoption>
107
+ <auro-menuoption value="stops">Stops</auro-menuoption>
108
+ <auro-menuoption value="price">Price</auro-menuoption>
109
+ </auro-menu>
110
+ <p id="output" class="body-sm"></p>
111
+ ```
112
+ <!-- AURO-GENERATED-CONTENT:END -->
113
+ <!-- AURO-GENERATED-CONTENT:START (CODE:src=./../apiExamples/keys.js) -->
114
+ <!-- The below code snippet is automatically added from ./../apiExamples/keys.js -->
115
+
116
+ ```js
117
+ export function initKeysExample() {
118
+ const menu = document.getElementById('keys-menu');
119
+ const stopsButton = document.getElementById('stopsButton');
120
+ const stopsTopButton = document.getElementById('stopsTopButton');
121
+ const output = document.getElementById('output');
122
+
123
+ const createConsoleEntry = (message) => {
124
+ const node = document.createElement('span');
125
+ node.innerHTML = message;
126
+ output.appendChild(node);
127
+ output.appendChild(document.createElement('br'));
128
+ };
129
+
130
+ const resetConsole = () => {
131
+ output.innerHTML = '';
132
+ };
133
+
134
+ const updateMenuValue = (value) => {
135
+ resetConsole();
136
+ createConsoleEntry(`Setting menu.value: <em>"${value}"</em>`);
137
+ menu.value = '';
138
+ menu.value = value;
139
+ createConsoleEntry(`menu.value before next lifecycle: <em>"${menu.value}"</em>`);
140
+ setTimeout(() => {
141
+ createConsoleEntry(`menu.value after lifecycle: <em>"${menu.value}"</em>`);
142
+ });
143
+ };
144
+
145
+ stopsButton.addEventListener('click', () => {
146
+ updateMenuValue('stops');
147
+ });
148
+
149
+ stopsTopButton.addEventListener('click', () => {
150
+ updateMenuValue('stops-top');
151
+ });
152
+ };
153
+ ```
154
+ <!-- AURO-GENERATED-CONTENT:END -->
155
+ </auro-accordion>