@ory/elements-react 1.0.0-next.24 → 1.0.0-next.25

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/CHANGELOG.md CHANGED
@@ -1,3 +1,20 @@
1
+ ## 1.0.0-next.25 (2025-01-29)
2
+
3
+ ### 🚀 Features
4
+
5
+ - expose get flow factory ([#333](https://github.com/ory/elements/pull/333))
6
+
7
+ ### 🩹 Fixes
8
+
9
+ - make OIDC remove button loading state specific ([#339](https://github.com/ory/elements/pull/339))
10
+ - only show loading indicator on clicked button ([#335](https://github.com/ory/elements/pull/335))
11
+ - don't short circuit code method selector ([#336](https://github.com/ory/elements/pull/336))
12
+
13
+ ### ❤️ Thank You
14
+
15
+ - hackerman @aeneasr
16
+ - Jonas Hungershausen
17
+
1
18
  ## 1.0.0-next.24 (2025-01-22)
2
19
 
3
20
  ### 🩹 Fixes
@@ -1854,6 +1854,7 @@ var trash_default = SvgTrash;
1854
1854
 
1855
1855
  // src/theme/default/components/settings/settings-oidc.tsx
1856
1856
  var import_react_hook_form8 = require("react-hook-form");
1857
+ var import_react7 = require("react");
1857
1858
  var import_jsx_runtime53 = require("react/jsx-runtime");
1858
1859
  function DefaultSettingsOidc({
1859
1860
  linkButtons,
@@ -1861,9 +1862,6 @@ function DefaultSettingsOidc({
1861
1862
  }) {
1862
1863
  const hasLinkButtons = linkButtons.length > 0;
1863
1864
  const hasUnlinkButtons = unlinkButtons.length > 0;
1864
- const {
1865
- formState: { isSubmitting }
1866
- } = (0, import_react_hook_form8.useFormContext)();
1867
1865
  return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex flex-col gap-8", children: [
1868
1866
  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) => {
1869
1867
  const attrs = button.attributes;
@@ -1880,36 +1878,55 @@ function DefaultSettingsOidc({
1880
1878
  }) }),
1881
1879
  hasUnlinkButtons && hasLinkButtons ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(DefaultHorizontalDivider, {}) : null,
1882
1880
  unlinkButtons.map((button) => {
1883
- var _a, _b;
1884
- const attrs = button.attributes;
1885
- const provider = (_b = extractProvider((_a = button.meta.label) == null ? void 0 : _a.context)) != null ? _b : "";
1886
- const Logo = attrs.value in provider_logos_default ? provider_logos_default[attrs.value] : provider_logos_default.generic;
1887
- return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between", children: [
1888
- /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-6", children: [
1889
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Logo, { size: 32 }),
1890
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: provider })
1891
- ] }),
1892
- /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1893
- "button",
1881
+ if (button.attributes.node_type !== "input") {
1882
+ return null;
1883
+ }
1884
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(UnlinkRow, { button }, button.attributes.value);
1885
+ })
1886
+ ] });
1887
+ }
1888
+ function UnlinkRow({ button }) {
1889
+ var _a, _b;
1890
+ const [clicked, setClicked] = (0, import_react7.useState)(false);
1891
+ const {
1892
+ formState: { isSubmitting }
1893
+ } = (0, import_react_hook_form8.useFormContext)();
1894
+ const attrs = button.attributes;
1895
+ const provider = (_b = extractProvider((_a = button.meta.label) == null ? void 0 : _a.context)) != null ? _b : "";
1896
+ const Logo = attrs.value in provider_logos_default ? provider_logos_default[attrs.value] : provider_logos_default.generic;
1897
+ const localOnClick = () => {
1898
+ setClicked(true);
1899
+ button.onClick();
1900
+ };
1901
+ (0, import_react7.useEffect)(() => {
1902
+ if (!isSubmitting) {
1903
+ setClicked(false);
1904
+ }
1905
+ }, [isSubmitting]);
1906
+ return /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex justify-between", children: [
1907
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsxs)("div", { className: "flex items-center gap-6", children: [
1908
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Logo, { size: 32 }),
1909
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)("p", { className: "text-sm font-medium text-interface-foreground-default-secondary", children: provider })
1910
+ ] }),
1911
+ /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1912
+ "button",
1913
+ {
1914
+ ...attrs,
1915
+ type: "submit",
1916
+ onClick: localOnClick,
1917
+ disabled: isSubmitting,
1918
+ className: "relative",
1919
+ title: `Unlink ${provider}`,
1920
+ children: clicked ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Spinner, { className: "relative" }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1921
+ trash_default,
1894
1922
  {
1895
- ...attrs,
1896
- type: "submit",
1897
- onClick: button.onClick,
1898
- disabled: isSubmitting,
1899
- className: "relative",
1900
- title: `Unlink ${provider}`,
1901
- children: isSubmitting ? /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(Spinner, { className: "relative" }) : /* @__PURE__ */ (0, import_jsx_runtime53.jsx)(
1902
- trash_default,
1903
- {
1904
- className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
1905
- size: 24
1906
- }
1907
- )
1923
+ className: "text-button-link-default-secondary hover:text-button-link-default-secondary-hover",
1924
+ size: 24
1908
1925
  }
1909
1926
  )
1910
- ] }, attrs.value);
1911
- })
1912
- ] });
1927
+ }
1928
+ )
1929
+ ] }, attrs.value);
1913
1930
  }
1914
1931
 
1915
1932
  // src/theme/default/components/settings/settings-passkey.tsx