@ory/elements-react 1.0.0-next.18 → 1.0.0-next.19

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.
@@ -601,12 +601,13 @@ var React7 = __toESM(require("react"));
601
601
  var import_jsx_runtime14 = require("react/jsx-runtime");
602
602
  var SvgFacebook = (props) => {
603
603
  var _a, _b;
604
- return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 24 24", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
605
- /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("g", { clipPath: "url(#facebook_svg__a)", children: [
606
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { fill: "#1877F2", d: "M24 12c0-6.627-5.373-12-12-12C5.372 0 0 5.374 0 12c0 5.99 4.388 10.954 10.125 11.854V15.47H7.078V12h3.047V9.357c0-3.008 1.791-4.669 4.532-4.669 1.313 0 2.686.234 2.686.234v2.953H15.83c-1.49 0-1.955.925-1.955 1.874V12h3.328l-.532 3.469h-2.796v8.385c5.736-.9 10.124-5.864 10.124-11.854" }),
607
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { fill: "#fff", d: "M16.67 15.469 17.204 12h-3.328V9.75c0-.95.465-1.875 1.955-1.875h1.513V4.922s-1.373-.234-2.686-.234c-2.74 0-4.532 1.661-4.532 4.669V12H7.078v3.469h3.047v8.385a12.1 12.1 0 0 0 3.75 0V15.47z" })
608
- ] }),
609
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("clipPath", { id: "facebook_svg__a", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("rect", { fill: "#fff" }) }) })
604
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", fill: "none", viewBox: "0 0 32 32", width: (props == null ? void 0 : props.width) ? props.width : (_a = props == null ? void 0 : props.size) != null ? _a : 20, height: (props == null ? void 0 : props.height) ? props.height : (_b = props == null ? void 0 : props.size) != null ? _b : 20, ...props, children: [
605
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("circle", { cx: 16, cy: 16, r: 14, fill: "url(#facebook_svg__a)" }),
606
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { fill: "#fff", d: "m21.214 20.282.622-3.952h-3.89v-2.563c0-1.081.542-2.136 2.284-2.136H22V8.267S20.395 8 18.86 8c-3.205 0-5.298 1.893-5.298 5.318v3.012H10v3.952h3.562v9.552q1.073.165 2.191.166 1.12 0 2.192-.166v-9.552z" }),
607
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("defs", { children: /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("linearGradient", { id: "facebook_svg__a", x1: 16, x2: 16, y1: 2, y2: 29.917, gradientUnits: "userSpaceOnUse", children: [
608
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { stopColor: "#18ACFE" }),
609
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("stop", { offset: 1, stopColor: "#0163E0" })
610
+ ] }) })
610
611
  ] });
611
612
  };
612
613
  var facebook_default = SvgFacebook;
@@ -1815,20 +1816,19 @@ function DefaultSettingsOidc({
1815
1816
  }) {
1816
1817
  const hasLinkButtons = linkButtons.length > 0;
1817
1818
  const hasUnlinkButtons = unlinkButtons.length > 0;
1818
- const { setValue } = (0, import_react_hook_form8.useFormContext)();
1819
+ const {
1820
+ formState: { isSubmitting }
1821
+ } = (0, import_react_hook_form8.useFormContext)();
1819
1822
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-8", children: [
1820
- hasLinkButtons && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "flex items-start gap-3 [&>button]:w-[79px]", children: linkButtons.map((button) => {
1823
+ hasLinkButtons && /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("div", { className: "grid items-start gap-3 grid-cols-1 sm:grid-cols-2 md:grid-cols-3", children: linkButtons.map((button) => {
1821
1824
  const attrs = button.attributes;
1822
1825
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1823
1826
  DefaultButtonSocial,
1824
1827
  {
1825
- showLabel: false,
1828
+ showLabel: true,
1826
1829
  node: button,
1827
1830
  attributes: attrs,
1828
- onClick: () => {
1829
- setValue("link", attrs.value);
1830
- setValue("method", "oidc");
1831
- }
1831
+ onClick: button.onClick
1832
1832
  },
1833
1833
  attrs.value
1834
1834
  );
@@ -1849,11 +1849,11 @@ function DefaultSettingsOidc({
1849
1849
  {
1850
1850
  ...attrs,
1851
1851
  type: "submit",
1852
- onClick: () => {
1853
- setValue("unlink", attrs.value);
1854
- setValue("method", "oidc");
1855
- },
1856
- children: /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1852
+ onClick: button.onClick,
1853
+ disabled: isSubmitting,
1854
+ className: "relative",
1855
+ title: `Unlink ${provider}`,
1856
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Spinner, { className: "relative" }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1857
1857
  trash_default,
1858
1858
  {
1859
1859
  className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
@@ -1869,11 +1869,15 @@ function DefaultSettingsOidc({
1869
1869
 
1870
1870
  // src/theme/default/components/settings/settings-passkey.tsx
1871
1871
  var import_elements_react16 = require("@ory/elements-react");
1872
+ var import_react_hook_form9 = require("react-hook-form");
1872
1873
  var import_jsx_runtime54 = require("react/jsx-runtime");
1873
1874
  function DefaultSettingsPasskey({
1874
1875
  triggerButton,
1875
1876
  removeButtons
1876
1877
  }) {
1878
+ const {
1879
+ formState: { isSubmitting }
1880
+ } = (0, import_react_hook_form9.useFormContext)();
1877
1881
  const { Node } = (0, import_elements_react16.useComponents)();
1878
1882
  const hasRemoveButtons = removeButtons.length > 0;
1879
1883
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex flex-col gap-8", children: [
@@ -1896,28 +1900,35 @@ function DefaultSettingsPasskey({
1896
1900
  return /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)(
1897
1901
  "div",
1898
1902
  {
1899
- className: "flex justify-between gap-6",
1903
+ className: "flex justify-between gap-6 md:items-center",
1900
1904
  children: [
1901
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
1902
- passkey_default,
1903
- {
1904
- size: 32,
1905
- className: "text-interface-foreground-default-primary"
1906
- }
1907
- ),
1908
- /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 flex-col", children: [
1909
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: displayName }),
1910
- /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-sm text-interface-foreground-default-tertiary", children: keyId })
1905
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex gap-2 items-center flex-1", children: [
1906
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
1907
+ passkey_default,
1908
+ {
1909
+ size: 32,
1910
+ className: "text-interface-foreground-default-primary"
1911
+ }
1912
+ ),
1913
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 flex-col md:flex-row md:items-center flex md:justify-between gap-4", children: [
1914
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsxs)("div", { className: "flex-1 flex-col", children: [
1915
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: displayName }),
1916
+ /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("span", { className: "text-sm text-interface-foreground-default-tertiary hidden sm:block", children: keyId })
1917
+ ] }),
1918
+ addedAt && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "text-sm text-interface-foreground-default-tertiary", children: new Intl.DateTimeFormat(void 0, {
1919
+ dateStyle: "long"
1920
+ }).format(new Date(addedAt)) })
1921
+ ] })
1911
1922
  ] }),
1912
- addedAt && /* @__PURE__ */ (0, import_jsx_runtime54.jsx)("p", { className: "self-center text-sm text-interface-foreground-default-tertiary", children: new Intl.DateTimeFormat(void 0, {
1913
- dateStyle: "long"
1914
- }).format(new Date(addedAt)) }),
1915
1923
  /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
1916
1924
  "button",
1917
1925
  {
1918
1926
  ...node.attributes,
1919
1927
  type: "submit",
1920
- children: /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
1928
+ onClick: node.onClick,
1929
+ disabled: isSubmitting,
1930
+ className: "relative",
1931
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(Spinner, { className: "relative" }) : /* @__PURE__ */ (0, import_jsx_runtime54.jsx)(
1921
1932
  trash_default,
1922
1933
  {
1923
1934
  className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
@@ -1928,7 +1939,7 @@ function DefaultSettingsPasskey({
1928
1939
  )
1929
1940
  ]
1930
1941
  },
1931
- `webauthn-remove-button-${i}`
1942
+ `passkey-remove-button-${i}`
1932
1943
  );
1933
1944
  }) })
1934
1945
  ] }) : null
@@ -1966,12 +1977,18 @@ var SvgRefresh = (props) => {
1966
1977
  var refresh_default = SvgRefresh;
1967
1978
 
1968
1979
  // src/theme/default/components/settings/settings-recovery-codes.tsx
1980
+ var import_react_hook_form10 = require("react-hook-form");
1969
1981
  var import_jsx_runtime58 = require("react/jsx-runtime");
1970
1982
  function DefaultSettingsRecoveryCodes({
1971
1983
  codes,
1972
1984
  regnerateButton,
1973
- revealButton
1985
+ revealButton,
1986
+ onRegenerate,
1987
+ onReveal
1974
1988
  }) {
1989
+ const {
1990
+ formState: { isSubmitting }
1991
+ } = (0, import_react_hook_form10.useFormContext)();
1975
1992
  const onDownload = () => {
1976
1993
  const element = document.createElement("a");
1977
1994
  const file = new Blob([codes.join("\n")], {
@@ -1984,49 +2001,76 @@ function DefaultSettingsRecoveryCodes({
1984
2001
  };
1985
2002
  const hasCodes = codes.length >= 1;
1986
2003
  return /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex flex-col gap-8", children: [
1987
- /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DefaultHorizontalDivider, {}),
1988
- /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex justify-end gap-4", children: [
1989
- regnerateButton && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
1990
- "button",
1991
- {
1992
- ...regnerateButton.attributes,
1993
- type: "submit",
1994
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
1995
- refresh_default,
1996
- {
1997
- size: 24,
1998
- className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
1999
- }
2000
- )
2001
- }
2002
- ),
2003
- revealButton && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2004
- "button",
2005
- {
2006
- ...revealButton.attributes,
2007
- type: "submit",
2008
- children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2009
- eye_default,
2010
- {
2011
- size: 24,
2012
- className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
2013
- }
2014
- )
2015
- }
2016
- ),
2017
- hasCodes && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("button", { onClick: onDownload, type: "button", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2018
- download_default,
2019
- {
2020
- size: 24,
2021
- className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
2022
- }
2023
- ) })
2004
+ codes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(DefaultHorizontalDivider, {}),
2005
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex gap-4 justify-between", children: [
2006
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("span", { className: "text-interface-foreground-default-tertiary", children: revealButton && "Reveal recovery codes" }),
2007
+ /* @__PURE__ */ (0, import_jsx_runtime58.jsxs)("div", { className: "flex gap-2", children: [
2008
+ regnerateButton && codes.length > 0 && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2009
+ "button",
2010
+ {
2011
+ ...regnerateButton.attributes,
2012
+ type: "submit",
2013
+ className: "ml-auto",
2014
+ onClick: onRegenerate,
2015
+ disabled: isSubmitting,
2016
+ "data-loading": isSubmitting,
2017
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2018
+ refresh_default,
2019
+ {
2020
+ size: 24,
2021
+ className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
2022
+ }
2023
+ )
2024
+ }
2025
+ ),
2026
+ revealButton && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(import_jsx_runtime58.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2027
+ "button",
2028
+ {
2029
+ ...revealButton.attributes,
2030
+ type: "submit",
2031
+ className: "ml-auto",
2032
+ onClick: onReveal,
2033
+ title: "Reveal recovery codes",
2034
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2035
+ eye_default,
2036
+ {
2037
+ size: 24,
2038
+ className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
2039
+ }
2040
+ )
2041
+ }
2042
+ ) }),
2043
+ hasCodes && /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2044
+ "button",
2045
+ {
2046
+ onClick: onDownload,
2047
+ type: "button",
2048
+ className: "ml-auto",
2049
+ "data-testid": "recovery-codes-download-button",
2050
+ title: "Download recovery codes",
2051
+ children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2052
+ download_default,
2053
+ {
2054
+ size: 24,
2055
+ className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover"
2056
+ }
2057
+ )
2058
+ }
2059
+ )
2060
+ ] })
2024
2061
  ] }),
2025
- hasCodes ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "rounded-general p-6 bg-interface-background-default-secondary border-interface-border-default-primary", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "grid grid-cols-5 flex-wrap gap-4 text-sm text-interface-foreground-default-primary", children: codes.map((code) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { children: code }, code)) }) }) : null
2062
+ hasCodes ? /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("div", { className: "rounded-general p-6 bg-interface-background-default-secondary border-interface-border-default-primary", children: /* @__PURE__ */ (0, import_jsx_runtime58.jsx)(
2063
+ "div",
2064
+ {
2065
+ className: "grid grid-cols-2 sm:grid-cols-3 md:grid-cols-5 flex-wrap gap-4 text-sm text-interface-foreground-default-primary",
2066
+ "data-testid": "recovery-codes-codes",
2067
+ children: codes.map((code) => /* @__PURE__ */ (0, import_jsx_runtime58.jsx)("p", { children: code }, code))
2068
+ }
2069
+ ) }) : null
2026
2070
  ] });
2027
2071
  }
2028
2072
 
2029
- // src/theme/default/components/settings/settings-top.tsx
2073
+ // src/theme/default/components/settings/settings-totp.tsx
2030
2074
  var import_elements_react17 = require("@ory/elements-react");
2031
2075
 
2032
2076
  // src/theme/default/assets/icons/qrcode.svg
@@ -2038,19 +2082,28 @@ var SvgQrcode = (props) => {
2038
2082
  };
2039
2083
  var qrcode_default = SvgQrcode;
2040
2084
 
2041
- // src/theme/default/components/settings/settings-top.tsx
2085
+ // src/theme/default/components/settings/settings-totp.tsx
2086
+ var import_react_hook_form11 = require("react-hook-form");
2042
2087
  var import_jsx_runtime60 = require("react/jsx-runtime");
2043
- function DefaultSettingsTotp(props) {
2044
- var _a;
2088
+ function DefaultSettingsTotp({
2089
+ totpImage,
2090
+ totpInput,
2091
+ totpSecret,
2092
+ totpUnlink,
2093
+ onUnlink
2094
+ }) {
2045
2095
  const { Node, Card } = (0, import_elements_react17.useComponents)();
2046
- if ("totpUnlink" in props && props.totpUnlink) {
2096
+ const {
2097
+ formState: { isSubmitting }
2098
+ } = (0, import_react_hook_form11.useFormContext)();
2099
+ if (totpUnlink) {
2047
2100
  const {
2048
2101
  type,
2049
2102
  autocomplete: _ignoredAutocomplete,
2050
2103
  label: _ignoredLabel,
2051
2104
  node_type: _ignoredNodeType,
2052
2105
  ...buttonAttrs
2053
- } = (_a = props.totpUnlink) == null ? void 0 : _a.attributes;
2106
+ } = totpUnlink.attributes;
2054
2107
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "grid grid-cols-1 gap-8 md:grid-cols-2", children: [
2055
2108
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "col-span-full", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Card.Divider, {}) }),
2056
2109
  /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "col-span-full flex items-center gap-6", children: [
@@ -2061,7 +2114,9 @@ function DefaultSettingsTotp(props) {
2061
2114
  {
2062
2115
  type: type === "button" ? "button" : "submit",
2063
2116
  ...buttonAttrs,
2064
- children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
2117
+ onClick: onUnlink,
2118
+ disabled: isSubmitting,
2119
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(Spinner, { className: "relative" }) : /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
2065
2120
  trash_default,
2066
2121
  {
2067
2122
  className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
@@ -2073,15 +2128,15 @@ function DefaultSettingsTotp(props) {
2073
2128
  ] })
2074
2129
  ] });
2075
2130
  }
2076
- if ("totpSecret" in props) {
2131
+ if (totpImage && totpSecret && totpInput) {
2077
2132
  return /* @__PURE__ */ (0, import_jsx_runtime60.jsxs)("div", { className: "grid grid-cols-1 gap-8 md:grid-cols-2", children: [
2078
2133
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "col-span-full", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(DefaultHorizontalDivider, {}) }),
2079
2134
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "flex justify-center rounded-cards bg-interface-background-default-secondary p-8", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "aspect-square h-44 rounded bg-[white]", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)("div", { className: "-m-3 antialiased mix-blend-multiply", children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
2080
2135
  Node.Image,
2081
2136
  {
2082
- node: props.totpImage,
2137
+ node: totpImage,
2083
2138
  attributes: {
2084
- ...props.totpImage.attributes
2139
+ ...totpImage.attributes
2085
2140
  }
2086
2141
  }
2087
2142
  ) }) }) }),
@@ -2089,18 +2144,18 @@ function DefaultSettingsTotp(props) {
2089
2144
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
2090
2145
  Node.Label,
2091
2146
  {
2092
- node: props.totpSecret,
2093
- attributes: props.totpSecret.attributes,
2147
+ node: totpSecret,
2148
+ attributes: totpSecret.attributes,
2094
2149
  children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
2095
2150
  Node.Input,
2096
2151
  {
2097
- node: props.totpSecret,
2152
+ node: totpSecret,
2098
2153
  attributes: {
2099
2154
  disabled: true,
2100
2155
  name: "totp_secret_key",
2101
2156
  node_type: "input",
2102
2157
  type: "text",
2103
- value: props.totpSecret.attributes.text.text
2158
+ value: totpSecret.attributes.text.text
2104
2159
  }
2105
2160
  }
2106
2161
  )
@@ -2109,13 +2164,13 @@ function DefaultSettingsTotp(props) {
2109
2164
  /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
2110
2165
  Node.Label,
2111
2166
  {
2112
- attributes: props.totpInput.attributes,
2113
- node: props.totpInput,
2167
+ attributes: totpInput.attributes,
2168
+ node: totpInput,
2114
2169
  children: /* @__PURE__ */ (0, import_jsx_runtime60.jsx)(
2115
- Node.Input,
2170
+ Node.CodeInput,
2116
2171
  {
2117
- node: props.totpInput,
2118
- attributes: props.totpInput.attributes
2172
+ node: totpInput,
2173
+ attributes: totpInput.attributes
2119
2174
  }
2120
2175
  )
2121
2176
  }
@@ -2138,16 +2193,20 @@ var SvgKey = (props) => {
2138
2193
  var key_default = SvgKey;
2139
2194
 
2140
2195
  // src/theme/default/components/settings/settings-webauthn.tsx
2196
+ var import_react_hook_form12 = require("react-hook-form");
2141
2197
  var import_jsx_runtime62 = require("react/jsx-runtime");
2142
2198
  function DefaultSettingsWebauthn({
2143
2199
  nameInput,
2144
2200
  triggerButton,
2145
2201
  removeButtons
2146
2202
  }) {
2203
+ const {
2204
+ formState: { isSubmitting }
2205
+ } = (0, import_react_hook_form12.useFormContext)();
2147
2206
  const { Node, Card } = (0, import_elements_react18.useComponents)();
2148
2207
  const hasRemoveButtons = removeButtons.length > 0;
2149
2208
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-col gap-8", children: [
2150
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex max-w-[60%] items-end gap-3", children: [
2209
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex md:max-w-96 sm:items-end gap-3 flex-col sm:flex-row", children: [
2151
2210
  /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex-1", children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2152
2211
  Node.Label,
2153
2212
  {
@@ -2173,37 +2232,44 @@ function DefaultSettingsWebauthn({
2173
2232
  ] }),
2174
2233
  hasRemoveButtons ? /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex flex-col gap-8", children: [
2175
2234
  /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Card.Divider, {}),
2176
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex flex-col gap-2", children: removeButtons.map((node, i) => {
2235
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("div", { className: "flex flex-col gap-4", children: removeButtons.map((node, i) => {
2177
2236
  var _a, _b;
2178
2237
  const context = (_b = (_a = node.meta.label) == null ? void 0 : _a.context) != null ? _b : {};
2179
2238
  const addedAt = "added_at" in context ? context.added_at : null;
2180
- const diaplyName = "display_name" in context ? context.display_name : null;
2239
+ const displayName = "display_name" in context ? context.display_name : null;
2181
2240
  const keyId = "value" in node.attributes ? node.attributes.value : null;
2182
2241
  return /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)(
2183
2242
  "div",
2184
2243
  {
2185
- className: "flex justify-between gap-6",
2244
+ className: "flex justify-between gap-6 md:items-center",
2186
2245
  children: [
2187
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2188
- key_default,
2189
- {
2190
- size: 32,
2191
- className: "text-interface-foreground-default-primary"
2192
- }
2193
- ),
2194
- /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex-1 flex-col", children: [
2195
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: diaplyName }),
2196
- /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "text-sm text-interface-foreground-default-tertiary", children: keyId })
2246
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex gap-2 items-center flex-1", children: [
2247
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2248
+ key_default,
2249
+ {
2250
+ size: 32,
2251
+ className: "text-interface-foreground-default-primary"
2252
+ }
2253
+ ),
2254
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex-1 flex-col md:flex-row md:items-center flex md:justify-between gap-4", children: [
2255
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsxs)("div", { className: "flex-1 flex-col", children: [
2256
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: displayName }),
2257
+ /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("span", { className: "text-sm text-interface-foreground-default-tertiary hidden sm:block", children: keyId })
2258
+ ] }),
2259
+ addedAt && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "text-sm text-interface-foreground-default-tertiary", children: new Intl.DateTimeFormat(void 0, {
2260
+ dateStyle: "long"
2261
+ }).format(new Date(addedAt)) })
2262
+ ] })
2197
2263
  ] }),
2198
- addedAt && /* @__PURE__ */ (0, import_jsx_runtime62.jsx)("p", { className: "self-center text-sm text-interface-foreground-default-tertiary", children: new Intl.DateTimeFormat(void 0, {
2199
- dateStyle: "long"
2200
- }).format(new Date(addedAt)) }),
2201
2264
  /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2202
2265
  "button",
2203
2266
  {
2204
2267
  ...node.attributes,
2205
2268
  type: "submit",
2206
- children: /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2269
+ onClick: node.onClick,
2270
+ disabled: isSubmitting,
2271
+ className: "relative",
2272
+ children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(Spinner, { className: "relative" }) : /* @__PURE__ */ (0, import_jsx_runtime62.jsx)(
2207
2273
  trash_default,
2208
2274
  {
2209
2275
  className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",