@zitadel/components 0.1.0-alpha.3 → 0.1.0-alpha.4

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.
@@ -1561,6 +1561,13 @@ let ZlButton = class ZlButton extends i$2 {
1561
1561
  set label(value) {
1562
1562
  this.#_label_accessor_storage = value;
1563
1563
  }
1564
+ #_testId_accessor_storage = void 0;
1565
+ get testId() {
1566
+ return this.#_testId_accessor_storage;
1567
+ }
1568
+ set testId(value) {
1569
+ this.#_testId_accessor_storage = value;
1570
+ }
1564
1571
  #_forcedState_accessor_storage = null;
1565
1572
  get forcedState() {
1566
1573
  return this.#_forcedState_accessor_storage;
@@ -1573,50 +1580,97 @@ let ZlButton = class ZlButton extends i$2 {
1573
1580
  super();
1574
1581
  this.internals = this.attachInternals();
1575
1582
  }
1583
+ connectedCallback() {
1584
+ super.connectedCallback();
1585
+ this.addEventListener("click", this.handleHostClick);
1586
+ }
1587
+ disconnectedCallback() {
1588
+ this.removeEventListener("click", this.handleHostClick);
1589
+ super.disconnectedCallback();
1590
+ }
1576
1591
  focus(options) {
1577
1592
  this.shadowRoot?.querySelector("button")?.focus(options);
1578
1593
  }
1579
1594
  render() {
1580
- const blocked = this.disabled || this.loading;
1581
- const body = this.label !== void 0 ? b`<span>${this.label}</span>` : b`<slot></slot>`;
1595
+ const hierarchy = this.stringOption("hierarchy", this.hierarchy, "primary");
1596
+ const size = this.stringOption("size", this.size, "medium");
1597
+ const type = this.buttonType();
1598
+ const loading = this.booleanOption("loading", this.loading);
1599
+ const disabled = this.booleanOption("disabled", this.disabled);
1600
+ const block = this.booleanOption("block", this.block);
1601
+ const label = this.stringOption("label", this.label);
1602
+ const blocked = disabled || loading;
1603
+ const body = label !== void 0 ? b`<span>${label}</span>` : b`<slot></slot>`;
1582
1604
  return b`
1583
1605
  <button
1584
1606
  class=${e$2({
1585
1607
  root: true,
1586
1608
  "zr-btn": true,
1587
- [`zr-btn--${this.hierarchy}`]: true,
1588
- [`zr-btn--${this.size}`]: true,
1589
- "zr-btn--block": this.block
1609
+ [`zr-btn--${hierarchy}`]: true,
1610
+ [`zr-btn--${size}`]: true,
1611
+ "zr-btn--block": block
1590
1612
  })}
1591
1613
  part="root"
1592
- type=${this.type}
1614
+ type=${type}
1593
1615
  ?disabled=${blocked}
1594
- aria-busy=${this.loading ? "true" : "false"}
1616
+ aria-busy=${loading ? "true" : "false"}
1617
+ data-testid=${this.nativeButtonTestId() ?? A}
1595
1618
  data-state=${this.forcedState ?? A}
1596
1619
  @click=${this.handleClick}
1597
1620
  >
1598
1621
  <slot name="leading"></slot>
1599
1622
  ${body}
1600
- ${this.loading ? b`<span class="spinner" part="spinner"><zl-icon name="spinner" size=${this.size === "small" ? "16" : "24"} spin decorative></zl-icon></span>` : b`<slot name="trailing"></slot>`}
1623
+ ${loading ? b`<span class="spinner" part="spinner"><zl-icon name="spinner" size=${size === "small" ? "16" : "24"} spin decorative></zl-icon></span>` : b`<slot name="trailing"></slot>`}
1601
1624
  </button>
1602
1625
  `;
1603
1626
  }
1604
1627
  handleClick = (event) => {
1605
- if (this.disabled || this.loading) {
1628
+ this.activate(event);
1629
+ };
1630
+ handleHostClick = (event) => {
1631
+ if (event.composedPath()[0] !== this) return;
1632
+ this.activate(event);
1633
+ };
1634
+ nativeButtonTestId() {
1635
+ const testId = this.stringOption("data-testid", this.testId);
1636
+ if (testId) return `${testId}-button`;
1637
+ const action = this.buttonAction();
1638
+ return action ? `zitadel-action-${action}` : void 0;
1639
+ }
1640
+ buttonType() {
1641
+ const type = this.stringOption("type", this.type, "button");
1642
+ return type === "submit" || type === "reset" ? type : "button";
1643
+ }
1644
+ buttonAction() {
1645
+ return this.stringOption("action", this.action);
1646
+ }
1647
+ activate(event) {
1648
+ const type = this.buttonType();
1649
+ const action = this.buttonAction();
1650
+ if (this.booleanOption("disabled", this.disabled) || this.booleanOption("loading", this.loading)) {
1606
1651
  event.preventDefault();
1607
1652
  event.stopImmediatePropagation();
1608
1653
  return;
1609
1654
  }
1610
1655
  const form = this.internals.form;
1611
- if (this.type === "submit" && form) {
1656
+ if (type === "submit" && form) {
1612
1657
  event.preventDefault();
1613
1658
  form.requestSubmit();
1614
- } else if (this.type === "reset" && form) {
1659
+ } else if (type === "reset" && form) {
1615
1660
  event.preventDefault();
1616
1661
  form.reset();
1617
1662
  }
1618
- emit(this, "zl-submit", { action: this.action ?? null });
1619
- };
1663
+ emit(this, "zl-submit", { action: action ?? null });
1664
+ }
1665
+ stringOption(attribute, value, fallback) {
1666
+ if (typeof value === "string" && value.length > 0) return value;
1667
+ const attr = this.getAttribute(attribute);
1668
+ if (attr !== null && attr.length > 0) return attr;
1669
+ return fallback;
1670
+ }
1671
+ booleanOption(attribute, value) {
1672
+ return value === true || this.hasAttribute(attribute);
1673
+ }
1620
1674
  };
1621
1675
  __decorate([n$1({ reflect: true })], ZlButton.prototype, "hierarchy", null);
1622
1676
  __decorate([n$1({ reflect: true })], ZlButton.prototype, "size", null);
@@ -1632,6 +1686,7 @@ __decorate([n$1({
1632
1686
  reflect: true
1633
1687
  })], ZlButton.prototype, "block", null);
1634
1688
  __decorate([n$1()], ZlButton.prototype, "label", null);
1689
+ __decorate([n$1({ attribute: "data-testid" })], ZlButton.prototype, "testId", null);
1635
1690
  __decorate([n$1({ attribute: "data-state" })], ZlButton.prototype, "forcedState", null);
1636
1691
  ZlButton = __decorate([t$4("zl-button")], ZlButton);
1637
1692
  const zlButtonManifest = {
@@ -1648,7 +1703,8 @@ const zlButtonManifest = {
1648
1703
  "loading",
1649
1704
  "disabled",
1650
1705
  "block",
1651
- "label"
1706
+ "label",
1707
+ "data-testid"
1652
1708
  ],
1653
1709
  parts: ["root", "spinner"],
1654
1710
  slots: [
@@ -1857,6 +1913,13 @@ let ZlField = class ZlField extends i$2 {
1857
1913
  set success(value) {
1858
1914
  this.#_success_accessor_storage = value;
1859
1915
  }
1916
+ #_testId_accessor_storage = void 0;
1917
+ get testId() {
1918
+ return this.#_testId_accessor_storage;
1919
+ }
1920
+ set testId(value) {
1921
+ this.#_testId_accessor_storage = value;
1922
+ }
1860
1923
  #_forgotPasswordHref_accessor_storage = void 0;
1861
1924
  get forgotPasswordHref() {
1862
1925
  return this.#_forgotPasswordHref_accessor_storage;
@@ -1975,6 +2038,7 @@ let ZlField = class ZlField extends i$2 {
1975
2038
  class="zr-field__input"
1976
2039
  part="input"
1977
2040
  id=${this.inputId}
2041
+ data-testid=${o(this.nativeInputTestId())}
1978
2042
  name=${this.name}
1979
2043
  type=${this.type}
1980
2044
  .value=${l(this.value)}
@@ -2081,23 +2145,26 @@ let ZlField = class ZlField extends i$2 {
2081
2145
  value: this.value
2082
2146
  });
2083
2147
  this.syncFormState();
2148
+ this.dispatchNativeInput();
2084
2149
  this.inputEl?.focus();
2085
2150
  };
2086
2151
  handleInput = (event) => {
2152
+ event.stopPropagation();
2087
2153
  const input = event.target;
2088
2154
  this.value = input.value;
2155
+ this.syncFormState();
2089
2156
  emit(this, "zl-input", {
2090
2157
  name: this.name,
2091
2158
  value: this.value
2092
2159
  });
2160
+ this.dispatchNativeInput(event);
2093
2161
  };
2094
2162
  handleChange = (event) => {
2163
+ event.stopPropagation();
2095
2164
  const input = event.target;
2096
2165
  this.value = input.value;
2097
- this.dispatchEvent(new Event("change", {
2098
- bubbles: true,
2099
- composed: true
2100
- }));
2166
+ this.syncFormState();
2167
+ this.dispatchNativeChange();
2101
2168
  };
2102
2169
  handleKeyDown = (event) => {
2103
2170
  if (event.key === "Enter" && !event.isComposing && !event.shiftKey && !event.altKey && !event.metaKey && !event.ctrlKey) {
@@ -2108,6 +2175,33 @@ let ZlField = class ZlField extends i$2 {
2108
2175
  }
2109
2176
  }
2110
2177
  };
2178
+ nativeInputTestId() {
2179
+ if (this.testId) return `${this.testId}-input`;
2180
+ return this.name ? `zitadel-input-${this.name}` : void 0;
2181
+ }
2182
+ dispatchNativeInput(source) {
2183
+ if (typeof InputEvent === "function") {
2184
+ const input = source instanceof InputEvent ? source : void 0;
2185
+ this.dispatchEvent(new InputEvent("input", {
2186
+ bubbles: true,
2187
+ composed: true,
2188
+ data: input?.data ?? null,
2189
+ inputType: input?.inputType ?? "",
2190
+ isComposing: input?.isComposing ?? false
2191
+ }));
2192
+ return;
2193
+ }
2194
+ this.dispatchEvent(new Event("input", {
2195
+ bubbles: true,
2196
+ composed: true
2197
+ }));
2198
+ }
2199
+ dispatchNativeChange() {
2200
+ this.dispatchEvent(new Event("change", {
2201
+ bubbles: true,
2202
+ composed: true
2203
+ }));
2204
+ }
2111
2205
  };
2112
2206
  __decorate([n$1()], ZlField.prototype, "label", null);
2113
2207
  __decorate([n$1()], ZlField.prototype, "type", null);
@@ -2117,6 +2211,7 @@ __decorate([n$1()], ZlField.prototype, "autocomplete", null);
2117
2211
  __decorate([n$1()], ZlField.prototype, "pattern", null);
2118
2212
  __decorate([n$1()], ZlField.prototype, "error", null);
2119
2213
  __decorate([n$1()], ZlField.prototype, "success", null);
2214
+ __decorate([n$1({ attribute: "data-testid" })], ZlField.prototype, "testId", null);
2120
2215
  __decorate([n$1({ attribute: "forgot-password-href" })], ZlField.prototype, "forgotPasswordHref", null);
2121
2216
  __decorate([n$1({ attribute: "forgot-password-label" })], ZlField.prototype, "forgotPasswordLabel", null);
2122
2217
  __decorate([n$1({
@@ -2147,6 +2242,7 @@ const zlFieldManifest = {
2147
2242
  "placeholder",
2148
2243
  "autocomplete",
2149
2244
  "pattern",
2245
+ "data-testid",
2150
2246
  "required",
2151
2247
  "disabled",
2152
2248
  "invalid",
@@ -8677,7 +8773,7 @@ function lookup(locale, key) {
8677
8773
  }
8678
8774
  //#endregion
8679
8775
  //#region src/orchestrator/templates/default.liquid
8680
- var default_default = "<zl-page-shell data-zl-template-root>\n {% if branding.logo_url %}\n <img slot=\"header\" class=\"zl-card-logo\" src=\"{{ branding.logo_url }}\" alt=\"\" />\n {% endif %}\n <zl-card>\n <h1 slot=\"header\" class=\"zl-card-title\">{{ step.texts.title_key | t: identity.display_name }}</h1>\n {% if step.texts.description_key %}\n <p slot=\"header\" class=\"zl-card-subtitle\">{{ step.texts.description_key | t: identity.display_name }}</p>\n {% endif %}\n\n {% if errors and errors.size > 0 %}\n {% for err in errors %}\n {% if err | formLevelError %}\n {% assign alert_heading = err.text_key | alertHeading %}\n {% assign alert_body = err.text_key | alertBody %}\n <zl-alert severity=\"error\"{% if alert_heading != \"\" %} heading=\"{{ alert_heading | t }}\"{% endif %}>\n {% if alert_body != \"\" %}{{ alert_body | t }}{% elsif err.text_key %}{{ err.text_key | t }}{% else %}{{ err.message }}{% endif %}\n </zl-alert>\n {% endif %}\n {% endfor %}\n {% endif %}\n\n {% for entry in fields %}\n {% assign field_placeholder = entry[1].text_key | fieldPlaceholder %}\n {% assign field_help = entry[1].text_key | fieldHelp %}\n {% assign field_err = entry[0] | fieldError: errors %}\n {% assign autocomplete_val = '' %}\n {% if entry[0] == 'email' %}\n {% assign autocomplete_val = 'email' %}\n {% elsif entry[1].type == 'password' and step.name contains 'register' %}\n {% assign autocomplete_val = 'new-password' %}\n {% elsif entry[1].type == 'password' %}\n {% assign autocomplete_val = 'current-password' %}\n {% endif %}\n <zl-field\n name=\"{{ entry[0] }}\"\n label=\"{{ entry[1].text_key | t }}\"\n type=\"{{ entry[1].type }}\"\n value=\"{{ entry[1].value }}\"\n {% if autocomplete_val != '' %}autocomplete=\"{{ autocomplete_val }}\"{% endif %}\n {% if entry[1].required %}required{% endif %}\n {% if field_placeholder != \"\" %}placeholder=\"{{ field_placeholder }}\"{% endif %}\n {% if field_err != \"\" %}invalid error=\"{{ field_err }}\"{% endif %}\n >\n {% if field_help != \"\" %}\n <span slot=\"help\">{{ field_help }}</span>\n {% endif %}\n </zl-field>\n {% endfor %}\n\n {% if fields.email and fields.password and step.name == 'identifier' %}\n <p class=\"zl-card-forgot\">\n <a href=\"#\" class=\"zl-card-forgot__link\" data-action=\"recover\">{{ 'action.forgot_password' | t }}</a>\n </p>\n {% endif %}\n\n {% for entry in actions %}\n {% if entry[1].primary %}\n <zl-button\n hierarchy=\"primary\"\n size=\"medium\"\n type=\"submit\"\n block\n action=\"{{ entry[0] }}\"\n label=\"{{ entry[1].text_key | t }}\"\n {% if loading %}loading{% endif %}\n ></zl-button>\n {% endif %}\n {% endfor %}\n\n {% for entry in actions %}\n {% unless entry[1].primary or entry[0] == 'passkey' or entry[0] == 'register' or entry[0] == 'sign_in' %}\n <zl-button\n hierarchy=\"secondary\"\n size=\"medium\"\n type=\"button\"\n block\n action=\"{{ entry[0] }}\"\n label=\"{{ entry[1].text_key | t }}\"\n ></zl-button>\n {% endunless %}\n {% endfor %}\n\n {% if actions.passkey %}\n <zl-button\n hierarchy=\"secondary\"\n size=\"medium\"\n block\n action=\"passkey\"\n label=\"{{ actions.passkey.text_key | t }}\"\n ></zl-button>\n {% endif %}\n\n\n {% if actions.register %}\n <p class=\"zl-card-nav\">\n {{ 'identifier.action.register.lead' | t }}<a href=\"#\" class=\"zl-card-nav__link\" data-action=\"register\">{{ 'identifier.action.register.link' | t }}</a>\n </p>\n {% endif %}\n\n {% if actions.sign_in %}\n <p class=\"zl-card-nav\">\n {{ 'register.action.sign_in.lead' | t }}<a href=\"#\" class=\"zl-card-nav__link\" data-action=\"sign_in\">{{ 'register.action.sign_in.link' | t }}</a>\n </p>\n {% endif %}\n\n {% if challenge %}\n {% if challenge.method == \"passkey\" or challenge.method == \"passkey_register\" %}\n {% assign ceremony = \"authenticate\" %}\n {% if challenge.method == \"passkey_register\" %}{% assign ceremony = \"register\" %}{% endif %}\n <zl-passkey\n ceremony=\"{{ ceremony }}\"\n method=\"{{ challenge.method }}\"\n challenge-id=\"{{ challenge.challenge_id }}\"\n options='{{ challenge.options | json }}'\n ></zl-passkey>\n {% endif %}\n {% endif %}\n\n {% mandatory_gates %}\n </zl-card>\n</zl-page-shell>\n";
8776
+ var default_default = "<zl-page-shell data-zl-template-root>\n {% if branding.logo_url %}\n <img slot=\"header\" class=\"zl-card-logo\" src=\"{{ branding.logo_url }}\" alt=\"\" />\n {% endif %}\n <zl-card>\n <h1 slot=\"header\" class=\"zl-card-title\">{{ step.texts.title_key | t: identity.display_name }}</h1>\n {% if step.texts.description_key %}\n <p slot=\"header\" class=\"zl-card-subtitle\">{{ step.texts.description_key | t: identity.display_name }}</p>\n {% endif %}\n\n {% if errors and errors.size > 0 %}\n {% for err in errors %}\n {% if err | formLevelError %}\n {% assign alert_heading = err.text_key | alertHeading %}\n {% assign alert_body = err.text_key | alertBody %}\n <zl-alert severity=\"error\"{% if alert_heading != \"\" %} heading=\"{{ alert_heading | t }}\"{% endif %}>\n {% if alert_body != \"\" %}{{ alert_body | t }}{% elsif err.text_key %}{{ err.text_key | t }}{% else %}{{ err.message }}{% endif %}\n </zl-alert>\n {% endif %}\n {% endfor %}\n {% endif %}\n\n {% for entry in fields %}\n {% assign field_placeholder = entry[1].text_key | fieldPlaceholder %}\n {% assign field_help = entry[1].text_key | fieldHelp %}\n {% assign field_err = entry[0] | fieldError: errors %}\n {% assign autocomplete_val = '' %}\n {% if entry[0] == 'email' %}\n {% assign autocomplete_val = 'email' %}\n {% elsif entry[1].type == 'password' and step.name contains 'register' %}\n {% assign autocomplete_val = 'new-password' %}\n {% elsif entry[1].type == 'password' %}\n {% assign autocomplete_val = 'current-password' %}\n {% endif %}\n <zl-field\n name=\"{{ entry[0] }}\"\n data-testid=\"zitadel-field-{{ entry[0] }}\"\n label=\"{{ entry[1].text_key | t }}\"\n type=\"{{ entry[1].type }}\"\n value=\"{{ entry[1].value }}\"\n {% if autocomplete_val != '' %}autocomplete=\"{{ autocomplete_val }}\"{% endif %}\n {% if entry[1].required %}required{% endif %}\n {% if field_placeholder != \"\" %}placeholder=\"{{ field_placeholder }}\"{% endif %}\n {% if field_err != \"\" %}invalid error=\"{{ field_err }}\"{% endif %}\n >\n {% if field_help != \"\" %}\n <span slot=\"help\">{{ field_help }}</span>\n {% endif %}\n </zl-field>\n {% endfor %}\n\n {% if fields.email and fields.password and step.name == 'identifier' %}\n <p class=\"zl-card-forgot\">\n <a href=\"#\" class=\"zl-card-forgot__link\" data-action=\"recover\">{{ 'action.forgot_password' | t }}</a>\n </p>\n {% endif %}\n\n {% for entry in actions %}\n {% if entry[1].primary %}\n <zl-button\n hierarchy=\"primary\"\n size=\"medium\"\n type=\"submit\"\n block\n action=\"{{ entry[0] }}\"\n data-testid=\"zitadel-action-{{ entry[0] }}\"\n label=\"{{ entry[1].text_key | t }}\"\n {% if loading %}loading{% endif %}\n ></zl-button>\n {% endif %}\n {% endfor %}\n\n {% for entry in actions %}\n {% unless entry[1].primary or entry[0] == 'passkey' or entry[0] == 'register' or entry[0] == 'sign_in' %}\n <zl-button\n hierarchy=\"secondary\"\n size=\"medium\"\n type=\"button\"\n block\n action=\"{{ entry[0] }}\"\n data-testid=\"zitadel-action-{{ entry[0] }}\"\n label=\"{{ entry[1].text_key | t }}\"\n ></zl-button>\n {% endunless %}\n {% endfor %}\n\n {% if actions.passkey %}\n <zl-button\n hierarchy=\"secondary\"\n size=\"medium\"\n block\n action=\"passkey\"\n data-testid=\"zitadel-action-passkey\"\n label=\"{{ actions.passkey.text_key | t }}\"\n ></zl-button>\n {% endif %}\n\n\n {% if actions.register %}\n <p class=\"zl-card-nav\">\n {{ 'identifier.action.register.lead' | t }}<a href=\"#\" class=\"zl-card-nav__link\" data-action=\"register\" data-testid=\"zitadel-action-register-link\">{{ 'identifier.action.register.link' | t }}</a>\n </p>\n {% endif %}\n\n {% if actions.sign_in %}\n <p class=\"zl-card-nav\">\n {{ 'register.action.sign_in.lead' | t }}<a href=\"#\" class=\"zl-card-nav__link\" data-action=\"sign_in\" data-testid=\"zitadel-action-sign_in-link\">{{ 'register.action.sign_in.link' | t }}</a>\n </p>\n {% endif %}\n\n {% if challenge %}\n {% if challenge.method == \"passkey\" or challenge.method == \"passkey_register\" %}\n {% assign ceremony = \"authenticate\" %}\n {% if challenge.method == \"passkey_register\" %}{% assign ceremony = \"register\" %}{% endif %}\n <zl-passkey\n ceremony=\"{{ ceremony }}\"\n method=\"{{ challenge.method }}\"\n challenge-id=\"{{ challenge.challenge_id }}\"\n options='{{ challenge.options | json }}'\n ></zl-passkey>\n {% endif %}\n {% endif %}\n\n {% mandatory_gates %}\n </zl-card>\n</zl-page-shell>\n";
8681
8777
  //#endregion
8682
8778
  //#region src/orchestrator/liquid.ts
8683
8779
  /**
@@ -10898,6 +10994,7 @@ const COMMON_ATTRS = [
10898
10994
  "style",
10899
10995
  "name",
10900
10996
  "for",
10997
+ "data-testid",
10901
10998
  "data-theme",
10902
10999
  "hidden"
10903
11000
  ];
@@ -11405,6 +11502,31 @@ let ZitadelLogin = class ZitadelLogin extends i$2 {
11405
11502
  if (field.value !== next) field.value = next;
11406
11503
  }
11407
11504
  }
11505
+ captureValuesFromFields() {
11506
+ const root = this.shadowRoot;
11507
+ if (!root) return this.formValues;
11508
+ const fields = root.querySelectorAll("zl-field");
11509
+ if (fields.length === 0) return this.formValues;
11510
+ const next = { ...this.formValues };
11511
+ let changed = false;
11512
+ for (const field of fields) {
11513
+ const name = field.getAttribute("name");
11514
+ const value = this.currentFieldValue(field);
11515
+ if (!name || value === void 0) continue;
11516
+ if (field.value !== value) field.value = value;
11517
+ if (next[name] !== value) {
11518
+ next[name] = value;
11519
+ changed = true;
11520
+ }
11521
+ }
11522
+ if (changed) this.formValues = next;
11523
+ return next;
11524
+ }
11525
+ currentFieldValue(field) {
11526
+ const native = field.shadowRoot?.querySelector("input");
11527
+ if (native && native.value !== field.value) return native.value;
11528
+ return typeof field.value === "string" ? field.value : void 0;
11529
+ }
11408
11530
  handleAtomInput = (event) => {
11409
11531
  if (!event.detail) return;
11410
11532
  const { name, value } = event.detail;
@@ -11413,11 +11535,23 @@ let ZitadelLogin = class ZitadelLogin extends i$2 {
11413
11535
  ...this.formValues,
11414
11536
  [name]: value
11415
11537
  };
11538
+ this.syncFieldElementValue(name, value);
11416
11539
  emit(this, "zitadel-flow-input", {
11417
11540
  name,
11418
11541
  value
11419
11542
  });
11420
11543
  };
11544
+ syncFieldElementValue(name, value) {
11545
+ const root = this.shadowRoot;
11546
+ if (!root) return;
11547
+ const fields = root.querySelectorAll("zl-field");
11548
+ for (const field of fields) {
11549
+ if (field.getAttribute("name") !== name) continue;
11550
+ if (field.value !== value) field.value = value;
11551
+ const native = field.shadowRoot?.querySelector("input");
11552
+ if (native && native.value !== value) native.value = value;
11553
+ }
11554
+ }
11421
11555
  handleAtomSubmit = (event) => {
11422
11556
  if (this.loading) return;
11423
11557
  this.submit(event.detail?.action ?? null);
@@ -11495,10 +11629,11 @@ let ZitadelLogin = class ZitadelLogin extends i$2 {
11495
11629
  const { id, session_token } = this.response;
11496
11630
  this.loading = true;
11497
11631
  try {
11632
+ const formValues = this.captureValuesFromFields();
11498
11633
  const stepFieldKeys = Object.keys(this.response.step.fields ?? {});
11499
11634
  const fields = {};
11500
11635
  for (const key of stepFieldKeys) {
11501
- const value = this.formValues[key];
11636
+ const value = formValues[key];
11502
11637
  if (value !== void 0) fields[key] = value;
11503
11638
  }
11504
11639
  const body = {