@aurodesignsystem/auro-formkit 2.0.0-beta.26 → 2.0.0-beta.28
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/.turbo/cache/01837d45e23cd116-meta.json +1 -0
- package/.turbo/cache/01c730e29850df0e-meta.json +1 -0
- package/.turbo/cache/01c730e29850df0e.tar.zst +0 -0
- package/.turbo/cache/07e4aea841b5c179-meta.json +1 -0
- package/.turbo/cache/0fc7683b19b36011-meta.json +1 -0
- package/.turbo/cache/16a509b204dcbdb0-meta.json +1 -0
- package/.turbo/cache/16a509b204dcbdb0.tar.zst +0 -0
- package/.turbo/cache/186b768ac1b98f78-meta.json +1 -0
- package/.turbo/cache/1bce84fdc42802d2-meta.json +1 -0
- package/.turbo/cache/1c255bf1aa2eafce-meta.json +1 -0
- package/.turbo/cache/249d1d43631f5e4f-meta.json +1 -0
- package/.turbo/cache/249d1d43631f5e4f.tar.zst +0 -0
- package/.turbo/cache/275c3e7a5ca37cf1-meta.json +1 -0
- package/.turbo/cache/275c3e7a5ca37cf1.tar.zst +0 -0
- package/.turbo/cache/27ebfe2b553fe1ac-meta.json +1 -0
- package/.turbo/cache/2a6f0845cefd9b00-meta.json +1 -0
- package/.turbo/cache/{795fb6b1062f5c2c.tar.zst → 2a6f0845cefd9b00.tar.zst} +0 -0
- package/.turbo/cache/322ccd8a22ec9970-meta.json +1 -0
- package/.turbo/cache/343025281930ba78-meta.json +1 -0
- package/.turbo/cache/343025281930ba78.tar.zst +0 -0
- package/.turbo/cache/3da42d6d4786724b-meta.json +1 -0
- package/.turbo/cache/{2a734759c3764cf9.tar.zst → 3da42d6d4786724b.tar.zst} +0 -0
- package/.turbo/cache/404405300073400d-meta.json +1 -0
- package/.turbo/cache/4107ba68b8e8ebcf-meta.json +1 -0
- package/.turbo/cache/487b1fee94d973bd-meta.json +1 -0
- package/.turbo/cache/490641dad66a5370-meta.json +1 -0
- package/.turbo/cache/4d2f4072e8936a9f-meta.json +1 -0
- package/.turbo/cache/5737e8d759ed51ff-meta.json +1 -0
- package/.turbo/cache/58a5790c21b99cda-meta.json +1 -0
- package/.turbo/cache/591529d76be34703-meta.json +1 -0
- package/.turbo/cache/6b0479ed69bd2065-meta.json +1 -0
- package/.turbo/cache/6f11f141e7fafacc-meta.json +1 -0
- package/.turbo/cache/6fb9e9bba51b6840-meta.json +1 -0
- package/.turbo/cache/6ff997921af9fb59-meta.json +1 -0
- package/.turbo/cache/70875e34db93847e-meta.json +1 -0
- package/.turbo/cache/71d0a5c0510249dc-meta.json +1 -0
- package/.turbo/cache/73752d5facada01a-meta.json +1 -0
- package/.turbo/cache/7408be1f1775d1c8-meta.json +1 -0
- package/.turbo/cache/7811c51b140b1749-meta.json +1 -0
- package/.turbo/cache/{ef061b1229f730a2.tar.zst → 7811c51b140b1749.tar.zst} +0 -0
- package/.turbo/cache/7ebc152219ff9567-meta.json +1 -0
- package/.turbo/cache/7fd42eb47038ad9a-meta.json +1 -0
- package/.turbo/cache/86bc86f3d68ea7b8-meta.json +1 -0
- package/.turbo/cache/96bbdde6d7af7a07-meta.json +1 -0
- package/.turbo/cache/987f6417dd39ab07-meta.json +1 -0
- package/.turbo/cache/99124fc7a6f04d50-meta.json +1 -0
- package/.turbo/cache/a35fd59a026ba05d-meta.json +1 -0
- package/.turbo/cache/a35fd59a026ba05d.tar.zst +0 -0
- package/.turbo/cache/a37f52c3a0711fb1-meta.json +1 -0
- package/.turbo/cache/a41d8d5c41883f90-meta.json +1 -0
- package/.turbo/cache/b9afda223ab019c0-meta.json +1 -0
- package/.turbo/cache/b9afda223ab019c0.tar.zst +0 -0
- package/.turbo/cache/bfc67af529cca6db-meta.json +1 -0
- package/.turbo/cache/bfdd5050193d8d7f-meta.json +1 -0
- package/.turbo/cache/bfdd5050193d8d7f.tar.zst +0 -0
- package/.turbo/cache/c4979afcbb735507-meta.json +1 -0
- package/.turbo/cache/{0dadcfb927606339.tar.zst → c4979afcbb735507.tar.zst} +0 -0
- package/.turbo/cache/cc0b63f78cad3f03-meta.json +1 -0
- package/.turbo/cache/d3a14c4caef9ac61-meta.json +1 -0
- package/.turbo/cache/d3a14c4caef9ac61.tar.zst +0 -0
- package/.turbo/cache/d4cf163d2e264a1c-meta.json +1 -0
- package/.turbo/cache/d6be9726dcdd22a3-meta.json +1 -0
- package/.turbo/cache/d817f099573f0c19-meta.json +1 -0
- package/.turbo/cache/d817f099573f0c19.tar.zst +0 -0
- package/.turbo/cache/dcc61c2e2c1d2d88-meta.json +1 -0
- package/.turbo/cache/e3244db4001289f3-meta.json +1 -0
- package/.turbo/cache/{0cb0e897283636be.tar.zst → e3244db4001289f3.tar.zst} +0 -0
- package/.turbo/cache/e7eabc578e94771c-meta.json +1 -0
- package/.turbo/cache/e90b218494bb23ed-meta.json +1 -0
- package/.turbo/cache/ee84ef9ff72212fa-meta.json +1 -0
- package/.turbo/cache/ee84ef9ff72212fa.tar.zst +0 -0
- package/.turbo/cache/ef71fdeaac2feb85-meta.json +1 -0
- package/.turbo/cache/{f68b45287d9667ee.tar.zst → ef71fdeaac2feb85.tar.zst} +0 -0
- package/.turbo/cache/f17caf2bbe9bc89a-meta.json +1 -0
- package/.turbo/cache/f5449eabca32be65-meta.json +1 -0
- package/.turbo/cache/f5449eabca32be65.tar.zst +0 -0
- package/.turbo/cache/ff343641ff2ba157-meta.json +1 -0
- package/CHANGELOG.md +26 -0
- package/components/checkbox/.turbo/turbo-build.log +3 -3
- package/components/checkbox/.turbo/turbo-bundler.log +3 -3
- package/components/checkbox/README.md +1 -1
- package/components/combobox/.turbo/turbo-build.log +3 -3
- package/components/combobox/README.md +4 -4
- package/components/counter/.turbo/turbo-build.log +2 -2
- package/components/counter/.turbo/turbo-bundler.log +6 -3
- package/components/counter/README.md +1 -1
- package/components/datepicker/README.md +4 -4
- package/components/dropdown/.turbo/turbo-build.log +3 -3
- package/components/dropdown/.turbo/turbo-bundler.log +3 -3
- package/components/dropdown/README.md +1 -1
- package/components/form/.turbo/turbo-build.log +3 -3
- package/components/form/.turbo/turbo-bundler.log +3 -3
- package/components/form/README.md +1 -1
- package/components/form/demo/api.min.js +62 -14
- package/components/form/demo/index.min.js +62 -14
- package/components/form/dist/auro-form.d.ts +19 -4
- package/components/form/dist/auro-form.d.ts.map +1 -1
- package/components/form/dist/index.js +62 -14
- package/components/form/src/auro-form.js +62 -14
- package/components/input/.turbo/turbo-build.log +3 -3
- package/components/input/.turbo/turbo-bundler.log +2 -2
- package/components/input/README.md +1 -1
- package/components/menu/.turbo/turbo-build.log +3 -3
- package/components/menu/.turbo/turbo-bundler.log +3 -3
- package/components/menu/README.md +1 -1
- package/components/radio/.turbo/turbo-build.log +3 -3
- package/components/radio/.turbo/turbo-bundler.log +3 -3
- package/components/radio/README.md +1 -1
- package/components/select/.turbo/turbo-build.log +3 -3
- package/components/select/README.md +3 -3
- package/package.json +5 -2
- package/packages/build-tools/src/postinstall.mjs +8 -0
- package/.turbo/cache/0982a6a331e9d978-meta.json +0 -1
- package/.turbo/cache/0c0a0bc31b8aab59-meta.json +0 -1
- package/.turbo/cache/0cb0e897283636be-meta.json +0 -1
- package/.turbo/cache/0cbb56c99e650fa0-meta.json +0 -1
- package/.turbo/cache/0dadcfb927606339-meta.json +0 -1
- package/.turbo/cache/163b3258a0fedac8-meta.json +0 -1
- package/.turbo/cache/1920aa7bd5dfd909-meta.json +0 -1
- package/.turbo/cache/1920aa7bd5dfd909.tar.zst +0 -0
- package/.turbo/cache/1a77868d72e26a1b-meta.json +0 -1
- package/.turbo/cache/1c11ba692862df62-meta.json +0 -1
- package/.turbo/cache/1c11ba692862df62.tar.zst +0 -0
- package/.turbo/cache/2394bb03567093b4-meta.json +0 -1
- package/.turbo/cache/24e6ff23d01407d9-meta.json +0 -1
- package/.turbo/cache/267a4d6654311f2b-meta.json +0 -1
- package/.turbo/cache/2a734759c3764cf9-meta.json +0 -1
- package/.turbo/cache/2ba7a43f8468390a-meta.json +0 -1
- package/.turbo/cache/2e1456ec1a7873f7-meta.json +0 -1
- package/.turbo/cache/2e4e2a1831bef749-meta.json +0 -1
- package/.turbo/cache/312d240246abd107-meta.json +0 -1
- package/.turbo/cache/312d240246abd107.tar.zst +0 -0
- package/.turbo/cache/351f58d5c3cae34e-meta.json +0 -1
- package/.turbo/cache/39dc2793eb573623-meta.json +0 -1
- package/.turbo/cache/4225d94a40fc6659-meta.json +0 -1
- package/.turbo/cache/4593ddca752e19c8-meta.json +0 -1
- package/.turbo/cache/4593ddca752e19c8.tar.zst +0 -0
- package/.turbo/cache/4e4992ed3be45c2f-meta.json +0 -1
- package/.turbo/cache/4fb77e22ffd90112-meta.json +0 -1
- package/.turbo/cache/558b31cc05ccc960-meta.json +0 -1
- package/.turbo/cache/64424afa661a9d52-meta.json +0 -1
- package/.turbo/cache/67c3255b202e500b-meta.json +0 -1
- package/.turbo/cache/6c9f48c7e69a2ec0-meta.json +0 -1
- package/.turbo/cache/755e6ec0dc4d34ef-meta.json +0 -1
- package/.turbo/cache/755e6ec0dc4d34ef.tar.zst +0 -0
- package/.turbo/cache/766995ed5805f011-meta.json +0 -1
- package/.turbo/cache/782ea8bf6bfd8203-meta.json +0 -1
- package/.turbo/cache/78e014dddc2d6125-meta.json +0 -1
- package/.turbo/cache/795fb6b1062f5c2c-meta.json +0 -1
- package/.turbo/cache/8c6d632132b58f2a-meta.json +0 -1
- package/.turbo/cache/92a5d8ee533c39d3-meta.json +0 -1
- package/.turbo/cache/92a5d8ee533c39d3.tar.zst +0 -0
- package/.turbo/cache/939b09d0d5a44a8e-meta.json +0 -1
- package/.turbo/cache/951037a4bb464cc3-meta.json +0 -1
- package/.turbo/cache/972125b3b011cd6f-meta.json +0 -1
- package/.turbo/cache/abfe0e87025ae648-meta.json +0 -1
- package/.turbo/cache/adf5dd445bd30a8e-meta.json +0 -1
- package/.turbo/cache/ae377925e5f7a6cf-meta.json +0 -1
- package/.turbo/cache/b49dd5629527427d-meta.json +0 -1
- package/.turbo/cache/b4f52173b5cc9dd9-meta.json +0 -1
- package/.turbo/cache/b4f52173b5cc9dd9.tar.zst +0 -0
- package/.turbo/cache/b9b3700e26eea28f-meta.json +0 -1
- package/.turbo/cache/bb6d6b63cf8fe7de-meta.json +0 -1
- package/.turbo/cache/bb6d6b63cf8fe7de.tar.zst +0 -0
- package/.turbo/cache/be2163f79158c78f-meta.json +0 -1
- package/.turbo/cache/c33622caa04077f5-meta.json +0 -1
- package/.turbo/cache/c3d8dc6e45d0331b-meta.json +0 -1
- package/.turbo/cache/c5350d3c0aa231ee-meta.json +0 -1
- package/.turbo/cache/c54ab6310e620bb2-meta.json +0 -1
- package/.turbo/cache/c54ab6310e620bb2.tar.zst +0 -0
- package/.turbo/cache/c77c96d6a2d1be7d-meta.json +0 -1
- package/.turbo/cache/ccaf1a2accea911b-meta.json +0 -1
- package/.turbo/cache/dbb2303f337ef2e8-meta.json +0 -1
- package/.turbo/cache/dbb2303f337ef2e8.tar.zst +0 -0
- package/.turbo/cache/e0b8e8b5d16c8b2a-meta.json +0 -1
- package/.turbo/cache/e0b8e8b5d16c8b2a.tar.zst +0 -0
- package/.turbo/cache/ef061b1229f730a2-meta.json +0 -1
- package/.turbo/cache/f070f6118998c549-meta.json +0 -1
- package/.turbo/cache/f070f6118998c549.tar.zst +0 -0
- package/.turbo/cache/f244006073c65834-meta.json +0 -1
- package/.turbo/cache/f68b45287d9667ee-meta.json +0 -1
- package/.turbo/cache/f8cd1b0abd6d17db-meta.json +0 -1
- package/.turbo/cache/f90d7f40233634c8-meta.json +0 -1
- /package/.turbo/cache/{267a4d6654311f2b.tar.zst → 01837d45e23cd116.tar.zst} +0 -0
- /package/.turbo/cache/{6c9f48c7e69a2ec0.tar.zst → 07e4aea841b5c179.tar.zst} +0 -0
- /package/.turbo/cache/{939b09d0d5a44a8e.tar.zst → 0fc7683b19b36011.tar.zst} +0 -0
- /package/.turbo/cache/{4e4992ed3be45c2f.tar.zst → 186b768ac1b98f78.tar.zst} +0 -0
- /package/.turbo/cache/{24e6ff23d01407d9.tar.zst → 1bce84fdc42802d2.tar.zst} +0 -0
- /package/.turbo/cache/{782ea8bf6bfd8203.tar.zst → 1c255bf1aa2eafce.tar.zst} +0 -0
- /package/.turbo/cache/{558b31cc05ccc960.tar.zst → 27ebfe2b553fe1ac.tar.zst} +0 -0
- /package/.turbo/cache/{c3d8dc6e45d0331b.tar.zst → 322ccd8a22ec9970.tar.zst} +0 -0
- /package/.turbo/cache/{ae377925e5f7a6cf.tar.zst → 404405300073400d.tar.zst} +0 -0
- /package/.turbo/cache/{c5350d3c0aa231ee.tar.zst → 4107ba68b8e8ebcf.tar.zst} +0 -0
- /package/.turbo/cache/{2e4e2a1831bef749.tar.zst → 487b1fee94d973bd.tar.zst} +0 -0
- /package/.turbo/cache/{4fb77e22ffd90112.tar.zst → 490641dad66a5370.tar.zst} +0 -0
- /package/.turbo/cache/{972125b3b011cd6f.tar.zst → 4d2f4072e8936a9f.tar.zst} +0 -0
- /package/.turbo/cache/{adf5dd445bd30a8e.tar.zst → 5737e8d759ed51ff.tar.zst} +0 -0
- /package/.turbo/cache/{c33622caa04077f5.tar.zst → 58a5790c21b99cda.tar.zst} +0 -0
- /package/.turbo/cache/{f90d7f40233634c8.tar.zst → 591529d76be34703.tar.zst} +0 -0
- /package/.turbo/cache/{1a77868d72e26a1b.tar.zst → 6b0479ed69bd2065.tar.zst} +0 -0
- /package/.turbo/cache/{b9b3700e26eea28f.tar.zst → 6f11f141e7fafacc.tar.zst} +0 -0
- /package/.turbo/cache/{f244006073c65834.tar.zst → 6fb9e9bba51b6840.tar.zst} +0 -0
- /package/.turbo/cache/{951037a4bb464cc3.tar.zst → 6ff997921af9fb59.tar.zst} +0 -0
- /package/.turbo/cache/{b49dd5629527427d.tar.zst → 70875e34db93847e.tar.zst} +0 -0
- /package/.turbo/cache/{0982a6a331e9d978.tar.zst → 71d0a5c0510249dc.tar.zst} +0 -0
- /package/.turbo/cache/{2e1456ec1a7873f7.tar.zst → 73752d5facada01a.tar.zst} +0 -0
- /package/.turbo/cache/{4225d94a40fc6659.tar.zst → 7408be1f1775d1c8.tar.zst} +0 -0
- /package/.turbo/cache/{163b3258a0fedac8.tar.zst → 7ebc152219ff9567.tar.zst} +0 -0
- /package/.turbo/cache/{2394bb03567093b4.tar.zst → 7fd42eb47038ad9a.tar.zst} +0 -0
- /package/.turbo/cache/{0cbb56c99e650fa0.tar.zst → 86bc86f3d68ea7b8.tar.zst} +0 -0
- /package/.turbo/cache/{78e014dddc2d6125.tar.zst → 96bbdde6d7af7a07.tar.zst} +0 -0
- /package/.turbo/cache/{f8cd1b0abd6d17db.tar.zst → 987f6417dd39ab07.tar.zst} +0 -0
- /package/.turbo/cache/{be2163f79158c78f.tar.zst → 99124fc7a6f04d50.tar.zst} +0 -0
- /package/.turbo/cache/{39dc2793eb573623.tar.zst → a37f52c3a0711fb1.tar.zst} +0 -0
- /package/.turbo/cache/{64424afa661a9d52.tar.zst → a41d8d5c41883f90.tar.zst} +0 -0
- /package/.turbo/cache/{abfe0e87025ae648.tar.zst → bfc67af529cca6db.tar.zst} +0 -0
- /package/.turbo/cache/{ccaf1a2accea911b.tar.zst → cc0b63f78cad3f03.tar.zst} +0 -0
- /package/.turbo/cache/{351f58d5c3cae34e.tar.zst → d4cf163d2e264a1c.tar.zst} +0 -0
- /package/.turbo/cache/{67c3255b202e500b.tar.zst → d6be9726dcdd22a3.tar.zst} +0 -0
- /package/.turbo/cache/{2ba7a43f8468390a.tar.zst → dcc61c2e2c1d2d88.tar.zst} +0 -0
- /package/.turbo/cache/{0c0a0bc31b8aab59.tar.zst → e7eabc578e94771c.tar.zst} +0 -0
- /package/.turbo/cache/{766995ed5805f011.tar.zst → e90b218494bb23ed.tar.zst} +0 -0
- /package/.turbo/cache/{8c6d632132b58f2a.tar.zst → f17caf2bbe9bc89a.tar.zst} +0 -0
- /package/.turbo/cache/{c77c96d6a2d1be7d.tar.zst → ff343641ff2ba157.tar.zst} +0 -0
|
@@ -235,6 +235,22 @@ class AuroForm extends r {
|
|
|
235
235
|
}, {});
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Getter for internal _submitElements.
|
|
240
|
+
* @returns {HTMLButtonElement[]}
|
|
241
|
+
*/
|
|
242
|
+
get submitElements() {
|
|
243
|
+
return this._submitelements;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Getter for internal _resetElements.
|
|
248
|
+
* @returns {HTMLButtonElement[]}
|
|
249
|
+
*/
|
|
250
|
+
get resetElements() {
|
|
251
|
+
return this._resetElements;
|
|
252
|
+
}
|
|
253
|
+
|
|
238
254
|
/**
|
|
239
255
|
* Infer validity status based on current formState.
|
|
240
256
|
* @private
|
|
@@ -260,6 +276,9 @@ class AuroForm extends r {
|
|
|
260
276
|
* @returns {"valid" | "invalid"}
|
|
261
277
|
*/
|
|
262
278
|
get validity() {
|
|
279
|
+
// Force calculate, as sometimes validity won't reflect
|
|
280
|
+
// the latest value while in-between renders.
|
|
281
|
+
this._calculateValidity();
|
|
263
282
|
return this._validity;
|
|
264
283
|
}
|
|
265
284
|
|
|
@@ -327,6 +346,27 @@ class AuroForm extends r {
|
|
|
327
346
|
]) => tags.map((tag) => `${tag}${extraAttributes}, [${tag}]${extraAttributes}`)).join(', '));
|
|
328
347
|
}
|
|
329
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Store an element in state and on the _elements array.
|
|
351
|
+
* @param {HTMLElement} element - The element to add to our state.
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
_addElementToState(element) {
|
|
355
|
+
const targetName = element.getAttribute('name');
|
|
356
|
+
if (this.formState[targetName]) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
this.formState[targetName] = {
|
|
361
|
+
value: element.getAttribute('value'),
|
|
362
|
+
validity: element.validity || null,
|
|
363
|
+
required: element.hasAttribute('required'),
|
|
364
|
+
// element
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
this._elements.push(element);
|
|
368
|
+
}
|
|
369
|
+
|
|
330
370
|
/**
|
|
331
371
|
* Initialize (or reinitialize) the form state.
|
|
332
372
|
*/
|
|
@@ -338,14 +378,7 @@ class AuroForm extends r {
|
|
|
338
378
|
|
|
339
379
|
this.queryAuroElements().forEach((element) => {
|
|
340
380
|
if (this.isFormElement(element)) {
|
|
341
|
-
this.
|
|
342
|
-
value: element.getAttribute('value'),
|
|
343
|
-
validity: element.getAttribute('validity'),
|
|
344
|
-
required: element.hasAttribute('required'),
|
|
345
|
-
// element
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
this._elements.push(element);
|
|
381
|
+
this._addElementToState(element);
|
|
349
382
|
}
|
|
350
383
|
|
|
351
384
|
if (this.isButtonElement(element) && element.getAttribute('type') === 'submit') {
|
|
@@ -369,7 +402,11 @@ class AuroForm extends r {
|
|
|
369
402
|
this.setDisabledStateOnButtons();
|
|
370
403
|
}
|
|
371
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Reset fires an event called `reset` - just as you would expect from a normal form.
|
|
407
|
+
*/
|
|
372
408
|
reset() {
|
|
409
|
+
const previousValue = this.value;
|
|
373
410
|
this._elements.forEach((element) => element.reset());
|
|
374
411
|
|
|
375
412
|
this.updateComplete.then(() => {
|
|
@@ -381,16 +418,20 @@ class AuroForm extends r {
|
|
|
381
418
|
// Wait for the above changes to run through, then disable submit/reset
|
|
382
419
|
this.updateComplete.then(() => {
|
|
383
420
|
this.setDisabledStateOnButtons();
|
|
421
|
+
|
|
422
|
+
this.dispatchEvent(new CustomEvent('reset', {
|
|
423
|
+
bubbles: true,
|
|
424
|
+
composed: true,
|
|
425
|
+
detail: {
|
|
426
|
+
previousValue
|
|
427
|
+
}
|
|
428
|
+
}));
|
|
384
429
|
});
|
|
385
430
|
});
|
|
386
431
|
}
|
|
387
432
|
|
|
388
433
|
/**
|
|
389
434
|
* Submit fires an event called `submit` - just as you would expect from a normal form.
|
|
390
|
-
*
|
|
391
|
-
* @example ```
|
|
392
|
-
* const form = document.querySelector('auro-
|
|
393
|
-
* ```
|
|
394
435
|
*/
|
|
395
436
|
submit() {
|
|
396
437
|
// Steps required to get out of beta:
|
|
@@ -437,13 +478,16 @@ class AuroForm extends r {
|
|
|
437
478
|
return;
|
|
438
479
|
}
|
|
439
480
|
|
|
481
|
+
// Occasionally, a form element will emit their event before the form can read data about the form element.
|
|
482
|
+
if (!this.formState[targetName] && this.isFormElement(event.target)) {
|
|
483
|
+
this._addElementToState(event.target);
|
|
484
|
+
}
|
|
485
|
+
|
|
440
486
|
// Check special input types and handle their edge cases
|
|
441
487
|
if (this._isElementTag('auro-datepicker', event.target) && event.target.hasAttribute('range')) {
|
|
442
488
|
this.formState[targetName].value = event.target.values;
|
|
443
|
-
|
|
444
489
|
this.requestUpdate('formState');
|
|
445
490
|
} else {
|
|
446
|
-
// "Normal" input value handling, just assign the value
|
|
447
491
|
this.formState[targetName].value = event.target.value;
|
|
448
492
|
this.requestUpdate('formState');
|
|
449
493
|
}
|
|
@@ -455,6 +499,10 @@ class AuroForm extends r {
|
|
|
455
499
|
return;
|
|
456
500
|
}
|
|
457
501
|
|
|
502
|
+
if (!this.formState[targetName]) {
|
|
503
|
+
this._addElementToState(event.target);
|
|
504
|
+
}
|
|
505
|
+
|
|
458
506
|
this.formState[targetName].validity = event.detail.validity;
|
|
459
507
|
this._calculateValidity();
|
|
460
508
|
});
|
|
@@ -235,6 +235,22 @@ class AuroForm extends r {
|
|
|
235
235
|
}, {});
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Getter for internal _submitElements.
|
|
240
|
+
* @returns {HTMLButtonElement[]}
|
|
241
|
+
*/
|
|
242
|
+
get submitElements() {
|
|
243
|
+
return this._submitelements;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Getter for internal _resetElements.
|
|
248
|
+
* @returns {HTMLButtonElement[]}
|
|
249
|
+
*/
|
|
250
|
+
get resetElements() {
|
|
251
|
+
return this._resetElements;
|
|
252
|
+
}
|
|
253
|
+
|
|
238
254
|
/**
|
|
239
255
|
* Infer validity status based on current formState.
|
|
240
256
|
* @private
|
|
@@ -260,6 +276,9 @@ class AuroForm extends r {
|
|
|
260
276
|
* @returns {"valid" | "invalid"}
|
|
261
277
|
*/
|
|
262
278
|
get validity() {
|
|
279
|
+
// Force calculate, as sometimes validity won't reflect
|
|
280
|
+
// the latest value while in-between renders.
|
|
281
|
+
this._calculateValidity();
|
|
263
282
|
return this._validity;
|
|
264
283
|
}
|
|
265
284
|
|
|
@@ -327,6 +346,27 @@ class AuroForm extends r {
|
|
|
327
346
|
]) => tags.map((tag) => `${tag}${extraAttributes}, [${tag}]${extraAttributes}`)).join(', '));
|
|
328
347
|
}
|
|
329
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Store an element in state and on the _elements array.
|
|
351
|
+
* @param {HTMLElement} element - The element to add to our state.
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
_addElementToState(element) {
|
|
355
|
+
const targetName = element.getAttribute('name');
|
|
356
|
+
if (this.formState[targetName]) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
this.formState[targetName] = {
|
|
361
|
+
value: element.getAttribute('value'),
|
|
362
|
+
validity: element.validity || null,
|
|
363
|
+
required: element.hasAttribute('required'),
|
|
364
|
+
// element
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
this._elements.push(element);
|
|
368
|
+
}
|
|
369
|
+
|
|
330
370
|
/**
|
|
331
371
|
* Initialize (or reinitialize) the form state.
|
|
332
372
|
*/
|
|
@@ -338,14 +378,7 @@ class AuroForm extends r {
|
|
|
338
378
|
|
|
339
379
|
this.queryAuroElements().forEach((element) => {
|
|
340
380
|
if (this.isFormElement(element)) {
|
|
341
|
-
this.
|
|
342
|
-
value: element.getAttribute('value'),
|
|
343
|
-
validity: element.getAttribute('validity'),
|
|
344
|
-
required: element.hasAttribute('required'),
|
|
345
|
-
// element
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
this._elements.push(element);
|
|
381
|
+
this._addElementToState(element);
|
|
349
382
|
}
|
|
350
383
|
|
|
351
384
|
if (this.isButtonElement(element) && element.getAttribute('type') === 'submit') {
|
|
@@ -369,7 +402,11 @@ class AuroForm extends r {
|
|
|
369
402
|
this.setDisabledStateOnButtons();
|
|
370
403
|
}
|
|
371
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Reset fires an event called `reset` - just as you would expect from a normal form.
|
|
407
|
+
*/
|
|
372
408
|
reset() {
|
|
409
|
+
const previousValue = this.value;
|
|
373
410
|
this._elements.forEach((element) => element.reset());
|
|
374
411
|
|
|
375
412
|
this.updateComplete.then(() => {
|
|
@@ -381,16 +418,20 @@ class AuroForm extends r {
|
|
|
381
418
|
// Wait for the above changes to run through, then disable submit/reset
|
|
382
419
|
this.updateComplete.then(() => {
|
|
383
420
|
this.setDisabledStateOnButtons();
|
|
421
|
+
|
|
422
|
+
this.dispatchEvent(new CustomEvent('reset', {
|
|
423
|
+
bubbles: true,
|
|
424
|
+
composed: true,
|
|
425
|
+
detail: {
|
|
426
|
+
previousValue
|
|
427
|
+
}
|
|
428
|
+
}));
|
|
384
429
|
});
|
|
385
430
|
});
|
|
386
431
|
}
|
|
387
432
|
|
|
388
433
|
/**
|
|
389
434
|
* Submit fires an event called `submit` - just as you would expect from a normal form.
|
|
390
|
-
*
|
|
391
|
-
* @example ```
|
|
392
|
-
* const form = document.querySelector('auro-
|
|
393
|
-
* ```
|
|
394
435
|
*/
|
|
395
436
|
submit() {
|
|
396
437
|
// Steps required to get out of beta:
|
|
@@ -437,13 +478,16 @@ class AuroForm extends r {
|
|
|
437
478
|
return;
|
|
438
479
|
}
|
|
439
480
|
|
|
481
|
+
// Occasionally, a form element will emit their event before the form can read data about the form element.
|
|
482
|
+
if (!this.formState[targetName] && this.isFormElement(event.target)) {
|
|
483
|
+
this._addElementToState(event.target);
|
|
484
|
+
}
|
|
485
|
+
|
|
440
486
|
// Check special input types and handle their edge cases
|
|
441
487
|
if (this._isElementTag('auro-datepicker', event.target) && event.target.hasAttribute('range')) {
|
|
442
488
|
this.formState[targetName].value = event.target.values;
|
|
443
|
-
|
|
444
489
|
this.requestUpdate('formState');
|
|
445
490
|
} else {
|
|
446
|
-
// "Normal" input value handling, just assign the value
|
|
447
491
|
this.formState[targetName].value = event.target.value;
|
|
448
492
|
this.requestUpdate('formState');
|
|
449
493
|
}
|
|
@@ -455,6 +499,10 @@ class AuroForm extends r {
|
|
|
455
499
|
return;
|
|
456
500
|
}
|
|
457
501
|
|
|
502
|
+
if (!this.formState[targetName]) {
|
|
503
|
+
this._addElementToState(event.target);
|
|
504
|
+
}
|
|
505
|
+
|
|
458
506
|
this.formState[targetName].validity = event.detail.validity;
|
|
459
507
|
this._calculateValidity();
|
|
460
508
|
});
|
|
@@ -60,13 +60,12 @@ export class AuroForm extends LitElement {
|
|
|
60
60
|
_submitelements: HTMLButtonElement[];
|
|
61
61
|
/** @type {HTMLButtonElement[]} */
|
|
62
62
|
_resetElements: HTMLButtonElement[];
|
|
63
|
+
/**
|
|
64
|
+
* Reset fires an event called `reset` - just as you would expect from a normal form.
|
|
65
|
+
*/
|
|
63
66
|
reset(): void;
|
|
64
67
|
/**
|
|
65
68
|
* Submit fires an event called `submit` - just as you would expect from a normal form.
|
|
66
|
-
*
|
|
67
|
-
* @example ```
|
|
68
|
-
* const form = document.querySelector('auro-
|
|
69
|
-
* ```
|
|
70
69
|
*/
|
|
71
70
|
submit(): void;
|
|
72
71
|
/**
|
|
@@ -107,6 +106,16 @@ export class AuroForm extends LitElement {
|
|
|
107
106
|
* @returns {Record<string, string | number | boolean | string[] | null>} The form value.
|
|
108
107
|
*/
|
|
109
108
|
get value(): Record<string, string | number | boolean | string[] | null>;
|
|
109
|
+
/**
|
|
110
|
+
* Getter for internal _submitElements.
|
|
111
|
+
* @returns {HTMLButtonElement[]}
|
|
112
|
+
*/
|
|
113
|
+
get submitElements(): HTMLButtonElement[];
|
|
114
|
+
/**
|
|
115
|
+
* Getter for internal _resetElements.
|
|
116
|
+
* @returns {HTMLButtonElement[]}
|
|
117
|
+
*/
|
|
118
|
+
get resetElements(): HTMLButtonElement[];
|
|
110
119
|
/**
|
|
111
120
|
* Infer validity status based on current formState.
|
|
112
121
|
* @private
|
|
@@ -129,6 +138,12 @@ export class AuroForm extends LitElement {
|
|
|
129
138
|
* @returns {NodeList}
|
|
130
139
|
*/
|
|
131
140
|
queryAuroElements(): NodeList;
|
|
141
|
+
/**
|
|
142
|
+
* Store an element in state and on the _elements array.
|
|
143
|
+
* @param {HTMLElement} element - The element to add to our state.
|
|
144
|
+
* @private
|
|
145
|
+
*/
|
|
146
|
+
private _addElementToState;
|
|
132
147
|
/**
|
|
133
148
|
* Initialize (or reinitialize) the form state.
|
|
134
149
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"auro-form.d.ts","sourceRoot":"","sources":["../src/auro-form.js"],"names":[],"mappings":"AAcA;;;;;;GAMG;AAEH;;GAEG;AAIH;;;;;GAKG;AAGH;IACE;;;;;;;;;;;;;;;;;;;MASC;IA4BD,uCAOC;IAiCD,yCAKC;IAWD,+CAEC;
|
|
1
|
+
{"version":3,"file":"auro-form.d.ts","sourceRoot":"","sources":["../src/auro-form.js"],"names":[],"mappings":"AAcA;;;;;;GAMG;AAEH;;GAEG;AAIH;;;;;GAKG;AAGH;IACE;;;;;;;;;;;;;;;;;;;MASC;IA4BD,uCAOC;IAiCD,yCAKC;IAWD,+CAEC;IA6OD;;;;;;;OAOG;IACH,uBANW,MAAM,QAQhB;IAxUC,wBAAwB;IACxB,WADW,SAAS,CACD;IAEnB,yCAAyC;IACzC,WADW,OAAO,GAAG,SAAS,GAAG,IAAI,CAChB;IACrB,yBAA2B;IAE3B,oDAAoD;IACpD,WADW,CAAC,WAAW,GAAG;QAAC,KAAK,EAAE,MAAM,IAAI,CAAA;KAAC,CAAC,EAAE,CAC7B;IAEnB,kCAAkC;IAClC,iBADW,iBAAiB,EAAE,CACL;IAEzB,kCAAkC;IAClC,gBADW,iBAAiB,EAAE,CACN;IA4P1B;;OAEG;IACH,cAuBC;IAED;;OAEG;IACH,eAmBC;IA5RD;;;;;;OAMG;IACH,sBAEC;IAED;;;;;;OAMG;IACH,+BAEC;IAED;;;;OAIG;IACH,uBAHW,WAAW,GACT,OAAO,CAInB;IASD;;;;OAIG;IACH,yBAHW,WAAW,GACT,OAAO,CAInB;IAMD;;;;;;;;OAQG;IACH,aAFa,MAAM,CAAC,MAAM,EAAE,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI,CAAC,CAOvE;IAED;;;OAGG;IACH,sBAFa,iBAAiB,EAAE,CAI/B;IAED;;;OAGG;IACH,qBAFa,iBAAiB,EAAE,CAI/B;IAED;;;OAGG;IACH,2BAcC;IAED;;;OAGG;IACH,gBAFa,OAAO,GAAG,SAAS,CAO/B;IAED,yBAUC;IAED;;;OAGG;IACH,sBAFa,OAAO,CAInB;IAED,kCAgBC;IAED;;;OAGG;IACH,qBAFa,QAAQ,CAsBpB;IAED;;;;OAIG;IACH,2BAcC;IAED;;OAEG;IACH,wBA8BC;IAkED,4CAwCC;IAED,uCAaC;IAED,qBAEC;IAGD,+CAMC;CACF;;;;;;;;WAlba,MAAM,GAAG,MAAM,GAAG,OAAO,GAAG,MAAM,EAAE,GAAG,IAAI;;;;cAC3C,aAAa;;;;cACb,OAAO;;;;aACP,WAAW;;;;;;;;2BAXQ,KAAK"}
|
|
@@ -235,6 +235,22 @@ class AuroForm extends r {
|
|
|
235
235
|
}, {});
|
|
236
236
|
}
|
|
237
237
|
|
|
238
|
+
/**
|
|
239
|
+
* Getter for internal _submitElements.
|
|
240
|
+
* @returns {HTMLButtonElement[]}
|
|
241
|
+
*/
|
|
242
|
+
get submitElements() {
|
|
243
|
+
return this._submitelements;
|
|
244
|
+
}
|
|
245
|
+
|
|
246
|
+
/**
|
|
247
|
+
* Getter for internal _resetElements.
|
|
248
|
+
* @returns {HTMLButtonElement[]}
|
|
249
|
+
*/
|
|
250
|
+
get resetElements() {
|
|
251
|
+
return this._resetElements;
|
|
252
|
+
}
|
|
253
|
+
|
|
238
254
|
/**
|
|
239
255
|
* Infer validity status based on current formState.
|
|
240
256
|
* @private
|
|
@@ -260,6 +276,9 @@ class AuroForm extends r {
|
|
|
260
276
|
* @returns {"valid" | "invalid"}
|
|
261
277
|
*/
|
|
262
278
|
get validity() {
|
|
279
|
+
// Force calculate, as sometimes validity won't reflect
|
|
280
|
+
// the latest value while in-between renders.
|
|
281
|
+
this._calculateValidity();
|
|
263
282
|
return this._validity;
|
|
264
283
|
}
|
|
265
284
|
|
|
@@ -327,6 +346,27 @@ class AuroForm extends r {
|
|
|
327
346
|
]) => tags.map((tag) => `${tag}${extraAttributes}, [${tag}]${extraAttributes}`)).join(', '));
|
|
328
347
|
}
|
|
329
348
|
|
|
349
|
+
/**
|
|
350
|
+
* Store an element in state and on the _elements array.
|
|
351
|
+
* @param {HTMLElement} element - The element to add to our state.
|
|
352
|
+
* @private
|
|
353
|
+
*/
|
|
354
|
+
_addElementToState(element) {
|
|
355
|
+
const targetName = element.getAttribute('name');
|
|
356
|
+
if (this.formState[targetName]) {
|
|
357
|
+
return;
|
|
358
|
+
}
|
|
359
|
+
|
|
360
|
+
this.formState[targetName] = {
|
|
361
|
+
value: element.getAttribute('value'),
|
|
362
|
+
validity: element.validity || null,
|
|
363
|
+
required: element.hasAttribute('required'),
|
|
364
|
+
// element
|
|
365
|
+
};
|
|
366
|
+
|
|
367
|
+
this._elements.push(element);
|
|
368
|
+
}
|
|
369
|
+
|
|
330
370
|
/**
|
|
331
371
|
* Initialize (or reinitialize) the form state.
|
|
332
372
|
*/
|
|
@@ -338,14 +378,7 @@ class AuroForm extends r {
|
|
|
338
378
|
|
|
339
379
|
this.queryAuroElements().forEach((element) => {
|
|
340
380
|
if (this.isFormElement(element)) {
|
|
341
|
-
this.
|
|
342
|
-
value: element.getAttribute('value'),
|
|
343
|
-
validity: element.getAttribute('validity'),
|
|
344
|
-
required: element.hasAttribute('required'),
|
|
345
|
-
// element
|
|
346
|
-
};
|
|
347
|
-
|
|
348
|
-
this._elements.push(element);
|
|
381
|
+
this._addElementToState(element);
|
|
349
382
|
}
|
|
350
383
|
|
|
351
384
|
if (this.isButtonElement(element) && element.getAttribute('type') === 'submit') {
|
|
@@ -369,7 +402,11 @@ class AuroForm extends r {
|
|
|
369
402
|
this.setDisabledStateOnButtons();
|
|
370
403
|
}
|
|
371
404
|
|
|
405
|
+
/**
|
|
406
|
+
* Reset fires an event called `reset` - just as you would expect from a normal form.
|
|
407
|
+
*/
|
|
372
408
|
reset() {
|
|
409
|
+
const previousValue = this.value;
|
|
373
410
|
this._elements.forEach((element) => element.reset());
|
|
374
411
|
|
|
375
412
|
this.updateComplete.then(() => {
|
|
@@ -381,16 +418,20 @@ class AuroForm extends r {
|
|
|
381
418
|
// Wait for the above changes to run through, then disable submit/reset
|
|
382
419
|
this.updateComplete.then(() => {
|
|
383
420
|
this.setDisabledStateOnButtons();
|
|
421
|
+
|
|
422
|
+
this.dispatchEvent(new CustomEvent('reset', {
|
|
423
|
+
bubbles: true,
|
|
424
|
+
composed: true,
|
|
425
|
+
detail: {
|
|
426
|
+
previousValue
|
|
427
|
+
}
|
|
428
|
+
}));
|
|
384
429
|
});
|
|
385
430
|
});
|
|
386
431
|
}
|
|
387
432
|
|
|
388
433
|
/**
|
|
389
434
|
* Submit fires an event called `submit` - just as you would expect from a normal form.
|
|
390
|
-
*
|
|
391
|
-
* @example ```
|
|
392
|
-
* const form = document.querySelector('auro-
|
|
393
|
-
* ```
|
|
394
435
|
*/
|
|
395
436
|
submit() {
|
|
396
437
|
// Steps required to get out of beta:
|
|
@@ -437,13 +478,16 @@ class AuroForm extends r {
|
|
|
437
478
|
return;
|
|
438
479
|
}
|
|
439
480
|
|
|
481
|
+
// Occasionally, a form element will emit their event before the form can read data about the form element.
|
|
482
|
+
if (!this.formState[targetName] && this.isFormElement(event.target)) {
|
|
483
|
+
this._addElementToState(event.target);
|
|
484
|
+
}
|
|
485
|
+
|
|
440
486
|
// Check special input types and handle their edge cases
|
|
441
487
|
if (this._isElementTag('auro-datepicker', event.target) && event.target.hasAttribute('range')) {
|
|
442
488
|
this.formState[targetName].value = event.target.values;
|
|
443
|
-
|
|
444
489
|
this.requestUpdate('formState');
|
|
445
490
|
} else {
|
|
446
|
-
// "Normal" input value handling, just assign the value
|
|
447
491
|
this.formState[targetName].value = event.target.value;
|
|
448
492
|
this.requestUpdate('formState');
|
|
449
493
|
}
|
|
@@ -455,6 +499,10 @@ class AuroForm extends r {
|
|
|
455
499
|
return;
|
|
456
500
|
}
|
|
457
501
|
|
|
502
|
+
if (!this.formState[targetName]) {
|
|
503
|
+
this._addElementToState(event.target);
|
|
504
|
+
}
|
|
505
|
+
|
|
458
506
|
this.formState[targetName].validity = event.detail.validity;
|
|
459
507
|
this._calculateValidity();
|
|
460
508
|
});
|
|
@@ -148,6 +148,22 @@ export class AuroForm extends LitElement {
|
|
|
148
148
|
}, {});
|
|
149
149
|
}
|
|
150
150
|
|
|
151
|
+
/**
|
|
152
|
+
* Getter for internal _submitElements.
|
|
153
|
+
* @returns {HTMLButtonElement[]}
|
|
154
|
+
*/
|
|
155
|
+
get submitElements() {
|
|
156
|
+
return this._submitelements;
|
|
157
|
+
}
|
|
158
|
+
|
|
159
|
+
/**
|
|
160
|
+
* Getter for internal _resetElements.
|
|
161
|
+
* @returns {HTMLButtonElement[]}
|
|
162
|
+
*/
|
|
163
|
+
get resetElements() {
|
|
164
|
+
return this._resetElements;
|
|
165
|
+
}
|
|
166
|
+
|
|
151
167
|
/**
|
|
152
168
|
* Infer validity status based on current formState.
|
|
153
169
|
* @private
|
|
@@ -173,6 +189,9 @@ export class AuroForm extends LitElement {
|
|
|
173
189
|
* @returns {"valid" | "invalid"}
|
|
174
190
|
*/
|
|
175
191
|
get validity() {
|
|
192
|
+
// Force calculate, as sometimes validity won't reflect
|
|
193
|
+
// the latest value while in-between renders.
|
|
194
|
+
this._calculateValidity();
|
|
176
195
|
return this._validity;
|
|
177
196
|
}
|
|
178
197
|
|
|
@@ -240,6 +259,27 @@ export class AuroForm extends LitElement {
|
|
|
240
259
|
]) => tags.map((tag) => `${tag}${extraAttributes}, [${tag}]${extraAttributes}`)).join(', '));
|
|
241
260
|
}
|
|
242
261
|
|
|
262
|
+
/**
|
|
263
|
+
* Store an element in state and on the _elements array.
|
|
264
|
+
* @param {HTMLElement} element - The element to add to our state.
|
|
265
|
+
* @private
|
|
266
|
+
*/
|
|
267
|
+
_addElementToState(element) {
|
|
268
|
+
const targetName = element.getAttribute('name');
|
|
269
|
+
if (this.formState[targetName]) {
|
|
270
|
+
return;
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
this.formState[targetName] = {
|
|
274
|
+
value: element.getAttribute('value'),
|
|
275
|
+
validity: element.validity || null,
|
|
276
|
+
required: element.hasAttribute('required'),
|
|
277
|
+
// element
|
|
278
|
+
};
|
|
279
|
+
|
|
280
|
+
this._elements.push(element);
|
|
281
|
+
}
|
|
282
|
+
|
|
243
283
|
/**
|
|
244
284
|
* Initialize (or reinitialize) the form state.
|
|
245
285
|
*/
|
|
@@ -251,14 +291,7 @@ export class AuroForm extends LitElement {
|
|
|
251
291
|
|
|
252
292
|
this.queryAuroElements().forEach((element) => {
|
|
253
293
|
if (this.isFormElement(element)) {
|
|
254
|
-
this.
|
|
255
|
-
value: element.getAttribute('value'),
|
|
256
|
-
validity: element.getAttribute('validity'),
|
|
257
|
-
required: element.hasAttribute('required'),
|
|
258
|
-
// element
|
|
259
|
-
};
|
|
260
|
-
|
|
261
|
-
this._elements.push(element);
|
|
294
|
+
this._addElementToState(element);
|
|
262
295
|
}
|
|
263
296
|
|
|
264
297
|
if (this.isButtonElement(element) && element.getAttribute('type') === 'submit') {
|
|
@@ -282,7 +315,11 @@ export class AuroForm extends LitElement {
|
|
|
282
315
|
this.setDisabledStateOnButtons();
|
|
283
316
|
}
|
|
284
317
|
|
|
318
|
+
/**
|
|
319
|
+
* Reset fires an event called `reset` - just as you would expect from a normal form.
|
|
320
|
+
*/
|
|
285
321
|
reset() {
|
|
322
|
+
const previousValue = this.value;
|
|
286
323
|
this._elements.forEach((element) => element.reset());
|
|
287
324
|
|
|
288
325
|
this.updateComplete.then(() => {
|
|
@@ -294,16 +331,20 @@ export class AuroForm extends LitElement {
|
|
|
294
331
|
// Wait for the above changes to run through, then disable submit/reset
|
|
295
332
|
this.updateComplete.then(() => {
|
|
296
333
|
this.setDisabledStateOnButtons();
|
|
334
|
+
|
|
335
|
+
this.dispatchEvent(new CustomEvent('reset', {
|
|
336
|
+
bubbles: true,
|
|
337
|
+
composed: true,
|
|
338
|
+
detail: {
|
|
339
|
+
previousValue
|
|
340
|
+
}
|
|
341
|
+
}));
|
|
297
342
|
});
|
|
298
343
|
});
|
|
299
344
|
}
|
|
300
345
|
|
|
301
346
|
/**
|
|
302
347
|
* Submit fires an event called `submit` - just as you would expect from a normal form.
|
|
303
|
-
*
|
|
304
|
-
* @example ```
|
|
305
|
-
* const form = document.querySelector('auro-
|
|
306
|
-
* ```
|
|
307
348
|
*/
|
|
308
349
|
submit() {
|
|
309
350
|
// Steps required to get out of beta:
|
|
@@ -350,13 +391,16 @@ export class AuroForm extends LitElement {
|
|
|
350
391
|
return;
|
|
351
392
|
}
|
|
352
393
|
|
|
394
|
+
// Occasionally, a form element will emit their event before the form can read data about the form element.
|
|
395
|
+
if (!this.formState[targetName] && this.isFormElement(event.target)) {
|
|
396
|
+
this._addElementToState(event.target);
|
|
397
|
+
}
|
|
398
|
+
|
|
353
399
|
// Check special input types and handle their edge cases
|
|
354
400
|
if (this._isElementTag('auro-datepicker', event.target) && event.target.hasAttribute('range')) {
|
|
355
401
|
this.formState[targetName].value = event.target.values;
|
|
356
|
-
|
|
357
402
|
this.requestUpdate('formState');
|
|
358
403
|
} else {
|
|
359
|
-
// "Normal" input value handling, just assign the value
|
|
360
404
|
this.formState[targetName].value = event.target.value;
|
|
361
405
|
this.requestUpdate('formState');
|
|
362
406
|
}
|
|
@@ -368,6 +412,10 @@ export class AuroForm extends LitElement {
|
|
|
368
412
|
return;
|
|
369
413
|
}
|
|
370
414
|
|
|
415
|
+
if (!this.formState[targetName]) {
|
|
416
|
+
this._addElementToState(event.target);
|
|
417
|
+
}
|
|
418
|
+
|
|
371
419
|
this.formState[targetName].validity = event.detail.validity;
|
|
372
420
|
this._calculateValidity();
|
|
373
421
|
});
|
|
@@ -216,13 +216,13 @@ More info and automated migrator: https://sass-lang.com/d/import
|
|
|
216
216
|
|
|
217
217
|
[36m
|
|
218
218
|
[1m./src/index.js[22m → [1mdist[22m...[39m
|
|
219
|
-
[32mcreated [1mdist[22m in [1m1.
|
|
219
|
+
[32mcreated [1mdist[22m in [1m1.2s[22m[39m
|
|
220
220
|
[36m
|
|
221
221
|
[1m./demo/index.js[22m → [1m./demo/[22m...[39m
|
|
222
|
-
[32mcreated [1m./demo/[22m in [
|
|
222
|
+
[32mcreated [1m./demo/[22m in [1m1.1s[22m[39m
|
|
223
223
|
[36m
|
|
224
224
|
[1m./demo/api.js[22m → [1m./demo/[22m...[39m
|
|
225
|
-
[32mcreated [1m./demo/[22m in [
|
|
225
|
+
[32mcreated [1m./demo/[22m in [1m1s[22m[39m
|
|
226
226
|
|
|
227
227
|
> @aurodesignsystem/auro-input@4.2.0 build:docs
|
|
228
228
|
> wca analyze 'scripts/wca/*.js' --outFiles docs/api.md; node ../../packages/build-tools/src/docProcessor.mjs --component input
|
|
@@ -7,7 +7,7 @@
|
|
|
7
7
|
[32mcreated [1mdist[22m in [1m1.4s[22m[39m
|
|
8
8
|
[36m
|
|
9
9
|
[1m./demo/index.js[22m → [1m./demo/[22m...[39m
|
|
10
|
-
[32mcreated [1m./demo/[22m in [
|
|
10
|
+
[32mcreated [1m./demo/[22m in [1m952ms[22m[39m
|
|
11
11
|
[36m
|
|
12
12
|
[1m./demo/api.js[22m → [1m./demo/[22m...[39m
|
|
13
|
-
[32mcreated [1m./demo/[22m in [
|
|
13
|
+
[32mcreated [1m./demo/[22m in [1m934ms[22m[39m
|
|
@@ -89,7 +89,7 @@ In cases where the project is not able to process JS assets, there are pre-proce
|
|
|
89
89
|
<!-- The below content is automatically added from ../../docs/templates/componentBundleUseModBrowsers.md -->
|
|
90
90
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/design-tokens@4.12.1/dist/tokens/CSSCustomProperties.css" />
|
|
91
91
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@aurodesignsystem/webcorestylesheets@5.1.2/dist/bundled/essentials.css" />
|
|
92
|
-
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-input@2.0.0-beta.
|
|
92
|
+
<script src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit/auro-input@2.0.0-beta.27/dist/auro-input__bundled.js" type="module"></script>
|
|
93
93
|
<!-- AURO-GENERATED-CONTENT:END -->
|
|
94
94
|
|
|
95
95
|
## auro-input use cases
|
|
@@ -101,13 +101,13 @@ More info and automated migrator: https://sass-lang.com/d/import
|
|
|
101
101
|
|
|
102
102
|
[36m
|
|
103
103
|
[1m./src/index.js[22m → [1mdist[22m...[39m
|
|
104
|
-
[32mcreated [1mdist[22m in [
|
|
104
|
+
[32mcreated [1mdist[22m in [1m996ms[22m[39m
|
|
105
105
|
[36m
|
|
106
106
|
[1m./demo/index.js[22m → [1m./demo/[22m...[39m
|
|
107
|
-
[32mcreated [1m./demo/[22m in [
|
|
107
|
+
[32mcreated [1m./demo/[22m in [1m784ms[22m[39m
|
|
108
108
|
[36m
|
|
109
109
|
[1m./demo/api.js[22m → [1m./demo/[22m...[39m
|
|
110
|
-
[32mcreated [1m./demo/[22m in [
|
|
110
|
+
[32mcreated [1m./demo/[22m in [1m539ms[22m[39m
|
|
111
111
|
|
|
112
112
|
> @aurodesignsystem/auro-menu@4.1.4 build:docs
|
|
113
113
|
> wca analyze 'scripts/wca/*.js' --outFiles docs/api.md; node ../../packages/build-tools/src/docProcessor.mjs --component menu
|
|
@@ -4,10 +4,10 @@
|
|
|
4
4
|
|
|
5
5
|
[36m
|
|
6
6
|
[1m./src/index.js[22m → [1mdist[22m...[39m
|
|
7
|
-
[32mcreated [1mdist[22m in [
|
|
7
|
+
[32mcreated [1mdist[22m in [1m838ms[22m[39m
|
|
8
8
|
[36m
|
|
9
9
|
[1m./demo/index.js[22m → [1m./demo/[22m...[39m
|
|
10
|
-
[32mcreated [1m./demo/[22m in [
|
|
10
|
+
[32mcreated [1m./demo/[22m in [1m722ms[22m[39m
|
|
11
11
|
[36m
|
|
12
12
|
[1m./demo/api.js[22m → [1m./demo/[22m...[39m
|
|
13
|
-
[32mcreated [1m./demo/[22m in [
|
|
13
|
+
[32mcreated [1m./demo/[22m in [1m583ms[22m[39m
|