@aurodesignsystem-dev/auro-formkit 0.0.0-pr1503.3 → 0.0.0-pr1503.5

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 (190) hide show
  1. package/components/bibtemplate/dist/index.js +1 -1
  2. package/components/bibtemplate/dist/registered.js +1 -1
  3. package/components/checkbox/demo/accessibility.md +1 -1
  4. package/components/checkbox/demo/customize.html +1 -2
  5. package/components/checkbox/demo/customize.min.js +23 -8
  6. package/components/checkbox/demo/getting-started.min.js +23 -8
  7. package/components/checkbox/demo/index.min.js +23 -8
  8. package/components/checkbox/dist/index.js +23 -8
  9. package/components/checkbox/dist/registered.js +23 -8
  10. package/components/combobox/README.md +1 -1
  11. package/components/combobox/demo/accessibility.md +1 -1
  12. package/components/combobox/demo/api.md +2 -2
  13. package/components/combobox/demo/customize.html +1 -2
  14. package/components/combobox/demo/customize.md +166 -142
  15. package/components/combobox/demo/customize.min.js +2515 -2316
  16. package/components/combobox/demo/getting-started.min.js +2515 -2312
  17. package/components/combobox/demo/index.md +2 -1
  18. package/components/combobox/demo/index.min.js +2515 -2312
  19. package/components/combobox/demo/keyboard-behavior.md +3 -146
  20. package/components/combobox/demo/readme.md +1 -1
  21. package/components/combobox/demo/why-combobox.md +2 -2
  22. package/components/combobox/dist/auro-combobox.d.ts +49 -15
  23. package/components/combobox/dist/index.js +1462 -753
  24. package/components/combobox/dist/registered.js +1462 -753
  25. package/components/counter/demo/customize.min.js +188 -244
  26. package/components/counter/demo/index.min.js +188 -244
  27. package/components/counter/dist/auro-counter.d.ts +0 -8
  28. package/components/counter/dist/index.js +188 -244
  29. package/components/counter/dist/registered.js +188 -244
  30. package/components/datepicker/demo/accessibility.md +20 -10
  31. package/components/datepicker/demo/api.md +65 -62
  32. package/components/datepicker/demo/customize.md +180 -40
  33. package/components/datepicker/demo/customize.min.js +1690 -777
  34. package/components/datepicker/demo/getting-started.md +118 -2
  35. package/components/datepicker/demo/index.min.js +1690 -759
  36. package/components/datepicker/demo/keyboard-behavior.md +3 -3
  37. package/components/datepicker/demo/voiceover.md +4 -4
  38. package/components/datepicker/demo/why-datepicker.md +2 -2
  39. package/components/datepicker/dist/{src/auro-calendar-cell.d.ts → auro-calendar-cell.d.ts} +48 -3
  40. package/components/datepicker/dist/{src/auro-calendar.d.ts → auro-calendar.d.ts} +188 -10
  41. package/components/datepicker/dist/{src/auro-datepicker.d.ts → auro-datepicker.d.ts} +89 -6
  42. package/components/datepicker/dist/blackoutUtils.d.ts +43 -0
  43. package/components/datepicker/dist/index.js +1690 -759
  44. package/components/datepicker/dist/registered.js +1690 -759
  45. package/components/dropdown/demo/customize.html +3 -0
  46. package/components/dropdown/demo/customize.min.js +142 -208
  47. package/components/dropdown/demo/getting-started.min.js +131 -207
  48. package/components/dropdown/demo/index.min.js +131 -207
  49. package/components/dropdown/dist/auro-dropdown.d.ts +17 -1
  50. package/components/dropdown/dist/index.js +131 -207
  51. package/components/dropdown/dist/registered.js +131 -207
  52. package/components/form/demo/api.md +3 -3
  53. package/components/form/demo/customize.html +6 -6
  54. package/components/form/demo/customize.md +535 -135
  55. package/components/form/demo/customize.min.js +6307 -4378
  56. package/components/form/demo/getting-started.md +344 -96
  57. package/components/form/demo/getting-started.min.js +6255 -4378
  58. package/components/form/demo/index.min.js +6206 -4378
  59. package/components/form/demo/registerDemoDeps.min.js +5827 -4333
  60. package/components/form/dist/auro-form.d.ts +128 -10
  61. package/components/form/dist/index.js +377 -43
  62. package/components/form/dist/registered.js +377 -43
  63. package/components/input/demo/accessibility.md +1 -1
  64. package/components/input/demo/api.md +58 -57
  65. package/components/input/demo/customize.html +1 -2
  66. package/components/input/demo/customize.md +62 -61
  67. package/components/input/demo/customize.min.js +396 -275
  68. package/components/input/demo/getting-started.min.js +396 -275
  69. package/components/input/demo/index.min.js +396 -275
  70. package/components/input/dist/auro-input.d.ts +1 -1
  71. package/components/input/dist/base-input.d.ts +60 -81
  72. package/components/input/dist/index.js +409 -276
  73. package/components/input/dist/registered.js +396 -275
  74. package/components/input/dist/utilities.d.ts +10 -1
  75. package/components/menu/demo/accessibility.md +9 -4
  76. package/components/menu/demo/api.md +48 -45
  77. package/components/menu/demo/css-only.md +26 -19
  78. package/components/menu/demo/customize.md +307 -75
  79. package/components/menu/demo/design.md +1 -1
  80. package/components/menu/demo/getting-started.md +144 -7
  81. package/components/menu/demo/index.min.js +961 -1341
  82. package/components/menu/demo/keyboard-behavior.md +83 -4
  83. package/components/menu/demo/voiceover.md +21 -14
  84. package/components/menu/demo/why-menu.md +8 -9
  85. package/components/menu/dist/auro-menu-utils.d.ts +19 -0
  86. package/components/menu/dist/auro-menu.d.ts +97 -116
  87. package/components/menu/dist/auro-menuoption.d.ts +39 -133
  88. package/components/menu/dist/index.js +823 -1309
  89. package/components/menu/dist/registered.js +835 -1309
  90. package/components/radio/demo/accessibility.md +1 -1
  91. package/components/radio/demo/customize.min.js +23 -8
  92. package/components/radio/demo/getting-started.min.js +23 -8
  93. package/components/radio/demo/index.min.js +23 -8
  94. package/components/radio/dist/index.js +23 -8
  95. package/components/radio/dist/registered.js +23 -8
  96. package/components/select/demo/accessibility.md +6 -1
  97. package/components/select/demo/api.md +3 -2
  98. package/components/select/demo/customize.html +1 -2
  99. package/components/select/demo/customize.md +210 -5
  100. package/components/select/demo/customize.min.js +1613 -1854
  101. package/components/select/demo/design.md +10 -10
  102. package/components/select/demo/getting-started.md +1 -1
  103. package/components/select/demo/getting-started.min.js +1617 -1903
  104. package/components/select/demo/index.md +2 -2
  105. package/components/select/demo/index.min.js +1613 -1854
  106. package/components/select/demo/keyboard-behavior.md +81 -54
  107. package/components/select/demo/voiceover.md +28 -15
  108. package/components/select/dist/auro-select.d.ts +70 -12
  109. package/components/select/dist/index.js +580 -315
  110. package/components/select/dist/registered.js +580 -315
  111. package/components/select/dist/selectUtils.d.ts +24 -0
  112. package/custom-elements.json +8071 -7919
  113. package/package.json +7 -3
  114. package/components/checkbox/demo/customize.js +0 -22
  115. package/components/checkbox/demo/demo-support.js +0 -1
  116. package/components/checkbox/demo/getting-started.js +0 -22
  117. package/components/checkbox/demo/index.js +0 -8
  118. package/components/checkbox/demo/styles.scss +0 -1
  119. package/components/combobox/demo/customize.js +0 -24
  120. package/components/combobox/demo/demo-support.js +0 -1
  121. package/components/combobox/demo/getting-started.js +0 -21
  122. package/components/combobox/demo/index.js +0 -23
  123. package/components/combobox/demo/styles.scss +0 -1
  124. package/components/counter/demo/customize.js +0 -21
  125. package/components/counter/demo/demo-support.js +0 -1
  126. package/components/counter/demo/index.js +0 -21
  127. package/components/counter/demo/styles.scss +0 -1
  128. package/components/datepicker/demo/customize.js +0 -19
  129. package/components/datepicker/demo/demo-support.js +0 -1
  130. package/components/datepicker/demo/index.js +0 -23
  131. package/components/datepicker/demo/styles.scss +0 -1
  132. package/components/dropdown/demo/customize.js +0 -9
  133. package/components/dropdown/demo/demo-support.js +0 -1
  134. package/components/dropdown/demo/getting-started.js +0 -9
  135. package/components/dropdown/demo/index.js +0 -16
  136. package/components/dropdown/demo/styles.scss +0 -1
  137. package/components/form/demo/customize.js +0 -9
  138. package/components/form/demo/demo-support.js +0 -1
  139. package/components/form/demo/getting-started.js +0 -9
  140. package/components/form/demo/index.js +0 -5
  141. package/components/form/demo/registerDemoDeps.js +0 -23
  142. package/components/form/demo/styles.scss +0 -1
  143. package/components/input/demo/customize.js +0 -25
  144. package/components/input/demo/demo-support.js +0 -1
  145. package/components/input/demo/getting-started.js +0 -8
  146. package/components/input/demo/index.js +0 -8
  147. package/components/input/demo/styles.css +0 -974
  148. package/components/input/demo/styles.scss +0 -1
  149. package/components/menu/demo/demo-support.js +0 -1
  150. package/components/menu/demo/index.js +0 -25
  151. package/components/menu/demo/styles.scss +0 -1
  152. package/components/menu/dist/auro-menu.context.d.ts +0 -238
  153. package/components/radio/demo/customize.js +0 -22
  154. package/components/radio/demo/demo-support.js +0 -1
  155. package/components/radio/demo/getting-started.js +0 -24
  156. package/components/radio/demo/index.js +0 -8
  157. package/components/radio/demo/styles.scss +0 -1
  158. package/components/select/demo/customize.js +0 -11
  159. package/components/select/demo/demo-support.js +0 -1
  160. package/components/select/demo/getting-started.js +0 -26
  161. package/components/select/demo/index.js +0 -11
  162. package/components/select/demo/styles.scss +0 -1
  163. /package/components/counter/dist/styles/{counter-wrapper-color-css.d.ts → counter-group-color-css.d.ts} +0 -0
  164. /package/components/datepicker/dist/{src/auro-calendar-month.d.ts → auro-calendar-month.d.ts} +0 -0
  165. /package/components/datepicker/dist/{src/buttonVersion.d.ts → buttonVersion.d.ts} +0 -0
  166. /package/components/datepicker/dist/{src/datepickerKeyboardStrategy.d.ts → datepickerKeyboardStrategy.d.ts} +0 -0
  167. /package/components/datepicker/dist/{src/iconVersion.d.ts → iconVersion.d.ts} +0 -0
  168. /package/components/datepicker/dist/{src/index.d.ts → index.d.ts} +0 -0
  169. /package/components/datepicker/dist/{src/popoverVersion.d.ts → popoverVersion.d.ts} +0 -0
  170. /package/components/datepicker/dist/{src/styles → styles}/classic/color-css.d.ts +0 -0
  171. /package/components/datepicker/dist/{src/styles → styles}/classic/style-css.d.ts +0 -0
  172. /package/components/datepicker/dist/{src/styles → styles}/color-calendar-css.d.ts +0 -0
  173. /package/components/datepicker/dist/{src/styles → styles}/color-cell-css.d.ts +0 -0
  174. /package/components/datepicker/dist/{src/styles → styles}/color-css.d.ts +0 -0
  175. /package/components/datepicker/dist/{src/styles → styles}/color-month-css.d.ts +0 -0
  176. /package/components/datepicker/dist/{src/styles → styles}/shapeSize-css.d.ts +0 -0
  177. /package/components/datepicker/dist/{src/styles → styles}/snowflake/color-css.d.ts +0 -0
  178. /package/components/datepicker/dist/{src/styles → styles}/snowflake/style-css.d.ts +0 -0
  179. /package/components/datepicker/dist/{src/styles → styles}/style-auro-calendar-cell-css.d.ts +0 -0
  180. /package/components/datepicker/dist/{src/styles → styles}/style-auro-calendar-css.d.ts +0 -0
  181. /package/components/datepicker/dist/{src/styles → styles}/style-auro-calendar-month-css.d.ts +0 -0
  182. /package/components/datepicker/dist/{src/styles → styles}/style-css.d.ts +0 -0
  183. /package/components/datepicker/dist/{src/styles → styles}/tokens-css.d.ts +0 -0
  184. /package/components/datepicker/dist/{src/utilities.d.ts → utilities.d.ts} +0 -0
  185. /package/components/datepicker/dist/{src/utilitiesCalendar.d.ts → utilitiesCalendar.d.ts} +0 -0
  186. /package/components/datepicker/dist/{src/utilitiesCalendarRender.d.ts → utilitiesCalendarRender.d.ts} +0 -0
  187. /package/components/datepicker/dist/{src/vendor → vendor}/wc-range-datepicker/day.d.ts +0 -0
  188. /package/components/datepicker/dist/{src/vendor → vendor}/wc-range-datepicker/range-datepicker-calendar.d.ts +0 -0
  189. /package/components/datepicker/dist/{src/vendor → vendor}/wc-range-datepicker/range-datepicker-cell.d.ts +0 -0
  190. /package/components/datepicker/dist/{src/vendor → vendor}/wc-range-datepicker/range-datepicker.d.ts +0 -0
@@ -1,9 +1,9 @@
1
1
  /**
2
2
  * @typedef {Object} FormStateMember - The form state member.
3
- * @property {string | number | boolean | string[] | null} value - The value of the form element.
3
+ * @property {string | number | boolean | string[] | Record<string, number> | null} value - The value of the form element. Mirrors the child component's own `.value`, so the shape varies by element type (e.g. an array for `auro-checkbox-group`, an object keyed by counter name for `auro-counter-group`). A `range` `auro-datepicker` is the one form-specific case: its `.values` array is stored rather than its single `.value` string.
4
4
  * @property {ValidityState} validity - The validity state of the form element, stored when fired from the form element.
5
5
  * @property {boolean} required - Whether the form element is required or not.
6
- * @property {HTMLElement} element - Whether the form element is required or not.
6
+ * @property {boolean} disabled - Whether the form element is currently disabled. Cached from the live attribute via the MutationObserver in `connectedCallback` and refreshed from `_handleAttributeMutations`.
7
7
  */
8
8
  /**
9
9
  * @typedef {Object.<string, FormStateMember>} FormState - The form state.
@@ -95,6 +95,32 @@ export class AuroForm extends LitElement {
95
95
  * @type {MutationObserver[]}
96
96
  */
97
97
  private mutationObservers;
98
+ /**
99
+ * Captured initial (default) value per field `name`. Populated on first
100
+ * sight of each name in `_addElementToState` and preserved across
101
+ * subsequent `initializeState` cycles (slot change, rename, reset) so
102
+ * `_setInitialState` can detect user edits as `current !== initial`,
103
+ * matching HTML's `dirtyValueFlag` semantics.
104
+ * @private
105
+ * @type {Record<string, string | number | boolean | string[] | Record<string, number> | null | undefined>}
106
+ */
107
+ private _initialValues;
108
+ /**
109
+ * @private
110
+ * @type {MutationObserver | null}
111
+ */
112
+ private _attributeObserver;
113
+ /**
114
+ * Handle batched MutationObserver records for `disabled` and `name`
115
+ * attribute changes on tracked form elements. A `name` change invalidates
116
+ * the formState keying — we resolve it by re-initializing state. A `disabled`
117
+ * change simply needs a re-render (so `value` / `validity` getters re-evaluate)
118
+ * and a refresh of the submit/reset button enablement.
119
+ * @param {MutationRecord[]} mutations - The batched mutation records.
120
+ * @returns {void}
121
+ * @private
122
+ */
123
+ private _handleAttributeMutations;
98
124
  /**
99
125
  * Resets all form elements to their initial state and fires a `reset` event. The event's `detail.previousValue` contains the form values captured immediately before the reset.
100
126
  * @returns {void}
@@ -155,6 +181,39 @@ export class AuroForm extends LitElement {
155
181
  * @private
156
182
  */
157
183
  private isFormElement;
184
+ /**
185
+ * Whether a given element is currently disabled. Disabled controls are excluded
186
+ * from submission, validity, and initial-state checks per the HTML spec
187
+ * (section 4.10.19.2 "Enabling and disabling form controls":
188
+ * https://www.w3.org/TR/2011/WD-html5-20110113/association-of-controls-and-forms.html).
189
+ *
190
+ * Implementation note: we deliberately read only the attribute. Every Auro
191
+ * form element in `formElementTags` declares `disabled` with `reflect: true`,
192
+ * so the attribute and property stay in sync. Reading the attribute also
193
+ * lets the MutationObserver in `connectedCallback` (which is filtered to
194
+ * `['disabled', 'name']`) be the single source of truth for re-renders.
195
+ * If a future form-element type ships without attribute reflection, expand
196
+ * this helper to also read `element.disabled`.
197
+ * @param {HTMLElement | undefined | null} element - The element to check.
198
+ * @returns {boolean}
199
+ * @private
200
+ */
201
+ private _isDisabled;
202
+ /**
203
+ * Whether the tracked form element registered under `name` is currently disabled.
204
+ * See `_isDisabled` for the HTML-spec rationale behind excluding disabled
205
+ * controls from form state.
206
+ *
207
+ * Reads a cached flag on `formState[name]` populated by `_addElementToState`
208
+ * at registration and refreshed by `_handleAttributeMutations` whenever the
209
+ * element's `disabled` attribute toggles. The cache is fed by the same
210
+ * `hasAttribute('disabled')` read as `_isDisabled`, so the "future form-element
211
+ * type without attribute reflection" caveat documented there applies here too.
212
+ * @param {string} name - The `name` attribute used to register the element.
213
+ * @returns {boolean}
214
+ * @private
215
+ */
216
+ private _isNameDisabled;
158
217
  /**
159
218
  * Validates if an event is from a valid form element with a name.
160
219
  * @param {Event} event - The event to validate.
@@ -170,10 +229,10 @@ export class AuroForm extends LitElement {
170
229
  */
171
230
  private isButtonElement;
172
231
  /**
173
- * Returns the current values of all named form elements as a key-value object, keyed by each element's `name` attribute.
174
- * @returns {Record<string, string | number | boolean | string[] | null>} The current form values.
232
+ * Returns the current values of all named, enabled form elements as a key-value object, keyed by each element's `name` attribute. Each value is the child component's own `.value`, so the shape depends on the element type — see that component's documentation for its exact shape (for example, `auro-checkbox-group` yields an array, `auro-counter-group` yields an object keyed by counter name, and `auro-select` with `multiSelect` yields a JSON-encoded string). The one form-specific exception is a `range` `auro-datepicker`, whose `.values` array (`[start, end]`) is stored instead of its single `.value` string.
233
+ * @returns {Record<string, string | number | boolean | string[] | Record<string, number> | null>} The current form values.
175
234
  */
176
- get value(): Record<string, string | number | boolean | string[] | null>;
235
+ get value(): Record<string, string | number | boolean | string[] | Record<string, number> | null>;
177
236
  /**
178
237
  * Getter for internal _submitElements.
179
238
  * @returns {HTMLButtonElement[]}
@@ -186,8 +245,57 @@ export class AuroForm extends LitElement {
186
245
  * @private
187
246
  */
188
247
  private get resetElements();
248
+ /**
249
+ * Raw constraint-validation check. Returns `true` when no enabled field
250
+ * has a validity error. Unlike the public `validity` getter, this does
251
+ * NOT gate on `isInitialState` — callers that need to make a decision
252
+ * based on the actual constraint state (submit-button enablement, the
253
+ * internal `submit()` gate) read this so a pre-filled valid form is
254
+ * correctly recognized as submittable at first render.
255
+ * @returns {boolean}
256
+ * @private
257
+ */
258
+ private _isFormValid;
259
+ /**
260
+ * Whether the reset button should be enabled. True when the form has
261
+ * diverged from its initial state (so the user can always return to
262
+ * defaults — even if the dirty value lives behind a now-disabled field),
263
+ * OR when any non-disabled field has a current value or captured initial
264
+ * value (covers pre-filled forms and user-cleared-back-to-empty cases).
265
+ * @returns {boolean}
266
+ * @private
267
+ */
268
+ private _hasResetableState;
269
+ /**
270
+ * Collapse empty representations to a single canonical `null`.
271
+ *
272
+ * `_addElementToState` captures `null` for a field that mounts without a
273
+ * `value` attribute (`element.value || element.getAttribute('value')` is
274
+ * falsy → resolves to `null`), but `sharedInputListener` later stores the
275
+ * raw `event.target.value` — which is `''` for a user-cleared text input.
276
+ * Without this normalization, backspacing back to empty would taint the
277
+ * form forever (`'' !== null`) and Reset would stay enabled with nothing
278
+ * to actually reset.
279
+ *
280
+ * `''`, `undefined`, and `[]` all collapse to `null`. The empty-array case
281
+ * covers checkbox-group, radio-group, and multiselect, where `[]` means
282
+ * "no selection" — semantically the same as `null`/`''`. Genuine values
283
+ * — including `0`, `false`, non-empty strings, and non-empty arrays —
284
+ * pass through unchanged so number, boolean, and populated multi-value
285
+ * fields still compare correctly.
286
+ * @param {*} value - Value to normalize.
287
+ * @returns {*}
288
+ * @private
289
+ */
290
+ private _normalizeEmpty;
189
291
  /**
190
292
  * Infer validity status based on current formState.
293
+ *
294
+ * Validity stays `null` while the form is in its initial state — this is
295
+ * the "stay quiet until the user interacts" UX contract that consumers
296
+ * depend on to delay error indicators. Code that needs the raw
297
+ * constraint-validation result regardless of interaction (e.g.,
298
+ * submit-button enablement) should call `_isFormValid()` directly.
191
299
  * @private
192
300
  */
193
301
  private _calculateValidity;
@@ -197,7 +305,17 @@ export class AuroForm extends LitElement {
197
305
  */
198
306
  get validity(): "valid" | "invalid" | null;
199
307
  /**
200
- * Determines whether the form is in its initial (untouched) state and updates `_isInitialState` accordingly.
308
+ * Determines whether the form is in its initial (untouched) state.
309
+ *
310
+ * A field is tainted if either:
311
+ * - its value differs from the value captured on first render, OR
312
+ * - its validity is failing (anything other than `null` or `'valid'`).
313
+ *
314
+ * Validity acts as a backup signal: it catches users who interact with a
315
+ * field without changing its value (e.g., focusing and blurring a required
316
+ * field). We skip `null` (not yet validated) and `'valid'` (the default
317
+ * after Auro's auto-validation on mount) because neither proves the user
318
+ * touched anything.
201
319
  * @returns {void}
202
320
  * @private
203
321
  */
@@ -255,9 +373,9 @@ export class AuroForm extends LitElement {
255
373
  */
256
374
  export type FormStateMember = {
257
375
  /**
258
- * - The value of the form element.
376
+ * - The value of the form element. Mirrors the child component's own `.value`, so the shape varies by element type (e.g. an array for `auro-checkbox-group`, an object keyed by counter name for `auro-counter-group`). A `range` `auro-datepicker` is the one form-specific case: its `.values` array is stored rather than its single `.value` string.
259
377
  */
260
- value: string | number | boolean | string[] | null;
378
+ value: string | number | boolean | string[] | Record<string, number> | null;
261
379
  /**
262
380
  * - The validity state of the form element, stored when fired from the form element.
263
381
  */
@@ -267,9 +385,9 @@ export type FormStateMember = {
267
385
  */
268
386
  required: boolean;
269
387
  /**
270
- * - Whether the form element is required or not.
388
+ * - Whether the form element is currently disabled. Cached from the live attribute via the MutationObserver in `connectedCallback` and refreshed from `_handleAttributeMutations`.
271
389
  */
272
- element: HTMLElement;
390
+ disabled: boolean;
273
391
  };
274
392
  /**
275
393
  * - The form state.