@samline/forms 2.3.2 → 2.3.3

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/README.md CHANGED
@@ -42,10 +42,10 @@ Requires Node 20+ when bundling. Runtime target is ES2020.
42
42
  Use the browser build when you do not have a bundler and need to run the package directly in HTML, Shopify, WordPress, or any traditional template.
43
43
 
44
44
  ```html
45
- <script src="https://unpkg.com/@samline/forms@2.3.2/dist/browser/global.global.js"></script>
45
+ <script src="https://unpkg.com/@samline/forms@2.3.3/dist/browser/global.global.js"></script>
46
46
  ```
47
47
 
48
- > Pin the version in production. Replace `2.3.2` with the version you ship.
48
+ > Pin the version in production. Replace `2.3.3` with the version you ship.
49
49
 
50
50
  The browser bundle exposes a single global: `window.Forms`.
51
51
 
@@ -55,7 +55,7 @@ The browser bundle exposes a single global: `window.Forms`.
55
55
  <button type="submit">Send</button>
56
56
  </form>
57
57
 
58
- <script src="https://unpkg.com/@samline/forms@2.3.2/dist/browser/global.global.js"></script>
58
+ <script src="https://unpkg.com/@samline/forms@2.3.3/dist/browser/global.global.js"></script>
59
59
  <script>
60
60
  const contactForm = window.Forms.newForm({ id: 'contact-form' })
61
61
 
@@ -5497,11 +5497,13 @@ var Forms = (() => {
5497
5497
  const getMergedErrors = () => mergeErrors(state2.validationErrors, state2.manualErrors);
5498
5498
  const syncVisualState = (names) => {
5499
5499
  if (!state2.element) return;
5500
- const targetNames = names ?? getTrackedFieldNames();
5500
+ const sourceNames = names ?? getTrackedFieldNames();
5501
5501
  const errors = getMergedErrors();
5502
- for (const name of targetNames) {
5503
- const fields = getFieldsByName(name);
5504
- const hasError = Boolean(errors[name]?.length);
5502
+ for (const name of sourceNames) {
5503
+ const displayName = resolveDisplayNameForName(state2, name);
5504
+ const canonical = resolveCanonicalForName(state2, name) ?? name;
5505
+ const fields = getFieldsByName(displayName);
5506
+ const hasError = Boolean(errors[canonical]?.length);
5505
5507
  for (const field of fields) {
5506
5508
  applyBooleanAttribute(field, attributes.filled, isFieldFilled(field));
5507
5509
  applyBooleanAttribute(field, attributes.error, hasError);