@ory/elements-react 1.0.0-next.22 → 1.0.0-next.24
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 +31 -2
- package/DEVELOPMENT.md +79 -0
- package/LICENSE +201 -0
- package/README.md +103 -44
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/theme/default/index.css +14 -11
- package/dist/theme/default/index.css.map +1 -1
- package/dist/theme/default/index.js +40 -19
- package/dist/theme/default/index.js.map +1 -1
- package/dist/theme/default/index.mjs +31 -10
- package/dist/theme/default/index.mjs.map +1 -1
- package/package.json +1 -1
- package/tsconfig.test.json +9 -0
- package/.vscode/i18n-ally-reviews.yml +0 -3
- package/.vscode/settings.json +0 -4
- package/api-report/elements-react-client.api.json +0 -356
- package/api-report/elements-react-client.api.md +0 -33
- package/api-report/elements-react-theme.api.json +0 -1468
- package/api-report/elements-react-theme.api.md +0 -149
- package/api-report/elements-react.api.json +0 -3759
- package/api-report/elements-react.api.md +0 -442
- package/api-report/temp/elements-react-client.api.md +0 -33
- package/api-report/temp/elements-react-theme.api.md +0 -149
- package/api-report/temp/elements-react.api.md +0 -442
- package/config/api-extractor-client.json +0 -463
- package/config/api-extractor-core.json +0 -457
- package/config/api-extractor-theme.json +0 -463
- package/jest.config.ts +0 -23
- package/postcss.config.ts +0 -7
- package/tailwind.config.ts +0 -60
- package/tsconfig.spec.json +0 -20
|
@@ -419,7 +419,8 @@ function DefaultCurrentIdentifierButton() {
|
|
|
419
419
|
);
|
|
420
420
|
const attributes = omit(nodeBackButton.attributes, [
|
|
421
421
|
"autocomplete",
|
|
422
|
-
"node_type"
|
|
422
|
+
"node_type",
|
|
423
|
+
"maxlength"
|
|
423
424
|
]);
|
|
424
425
|
return /* @__PURE__ */ jsx6(
|
|
425
426
|
"a",
|
|
@@ -721,6 +722,7 @@ var provider_logos_default = logos;
|
|
|
721
722
|
|
|
722
723
|
// src/theme/default/components/form/social.tsx
|
|
723
724
|
import { useIntl as useIntl3 } from "react-intl";
|
|
725
|
+
import { useEffect, useState } from "react";
|
|
724
726
|
import { useFormContext as useFormContext2 } from "react-hook-form";
|
|
725
727
|
|
|
726
728
|
// src/theme/default/components/form/spinner.tsx
|
|
@@ -788,6 +790,7 @@ function DefaultButtonSocial({
|
|
|
788
790
|
const {
|
|
789
791
|
flow: { ui }
|
|
790
792
|
} = useOryFlow5();
|
|
793
|
+
const [clicked, setClicked] = useState(false);
|
|
791
794
|
const intl = useIntl3();
|
|
792
795
|
const {
|
|
793
796
|
formState: { isSubmitting }
|
|
@@ -796,19 +799,29 @@ function DefaultButtonSocial({
|
|
|
796
799
|
const Logo = logos2[attributes.value];
|
|
797
800
|
const showLabel = _showLabel != null ? _showLabel : oidcNodeCount % 3 !== 0 && oidcNodeCount % 4 !== 0;
|
|
798
801
|
const provider = (_c = extractProvider((_b = node.meta.label) == null ? void 0 : _b.context)) != null ? _c : "";
|
|
802
|
+
const localOnClick = () => {
|
|
803
|
+
setClicked(true);
|
|
804
|
+
onClick == null ? void 0 : onClick();
|
|
805
|
+
};
|
|
806
|
+
useEffect(() => {
|
|
807
|
+
if (!isSubmitting) {
|
|
808
|
+
setClicked(false);
|
|
809
|
+
}
|
|
810
|
+
}, [isSubmitting]);
|
|
799
811
|
return /* @__PURE__ */ jsxs19(
|
|
800
812
|
"button",
|
|
801
813
|
{
|
|
802
|
-
className: "gap-3 border border-button-social-border-default bg-button-social-background-default hover:bg-button-social-background-hover transition-colors rounded flex items-center justify-center px-4 py-[13px]
|
|
814
|
+
className: "gap-3 border border-button-social-border-default bg-button-social-background-default hover:bg-button-social-background-hover transition-colors rounded flex items-center justify-center px-4 py-[13px] loading:bg-button-social-background-disabled loading:border-button-social-border-disabled loading:text-button-social-foreground-disabled hover:text-button-social-foreground-hover",
|
|
803
815
|
value: attributes.value,
|
|
804
816
|
type: "submit",
|
|
805
817
|
name: "provider",
|
|
806
818
|
"data-testid": `ory/form/node/input/${attributes.name}`,
|
|
807
819
|
...props,
|
|
808
|
-
onClick,
|
|
820
|
+
onClick: localOnClick,
|
|
821
|
+
"data-loading": clicked,
|
|
809
822
|
disabled: isSubmitting,
|
|
810
823
|
children: [
|
|
811
|
-
/* @__PURE__ */ jsx25("span", { className: "size-5 relative", children: !
|
|
824
|
+
/* @__PURE__ */ jsx25("span", { className: "size-5 relative", children: !clicked ? Logo ? /* @__PURE__ */ jsx25(Logo, { size: 20 }) : /* @__PURE__ */ jsx25("span", { className: "flex aspect-square items-center justify-center rounded-full border text-xs", children: provider.slice(0, 2) }) : /* @__PURE__ */ jsx25(Spinner, { className: "size-5" }) }),
|
|
812
825
|
showLabel && node.meta.label ? /* @__PURE__ */ jsx25("span", { className: "grow text-left font-medium leading-none text-button-social-foreground-default", children: uiTextToFormattedMessage(node.meta.label, intl) }) : null
|
|
813
826
|
]
|
|
814
827
|
}
|
|
@@ -976,6 +989,7 @@ import {
|
|
|
976
989
|
import { cva } from "class-variance-authority";
|
|
977
990
|
import { useFormContext as useFormContext3 } from "react-hook-form";
|
|
978
991
|
import { useIntl as useIntl6 } from "react-intl";
|
|
992
|
+
import { useEffect as useEffect2, useState as useState2 } from "react";
|
|
979
993
|
import { jsx as jsx32, jsxs as jsxs21 } from "react/jsx-runtime";
|
|
980
994
|
var buttonStyles = cva(
|
|
981
995
|
[
|
|
@@ -1026,12 +1040,18 @@ var DefaultButton = ({
|
|
|
1026
1040
|
// End of skipped attributes
|
|
1027
1041
|
...rest
|
|
1028
1042
|
} = attributes;
|
|
1043
|
+
const [clicked, setClicked] = useState2(false);
|
|
1029
1044
|
const intl = useIntl6();
|
|
1030
1045
|
const label = getNodeLabel(node);
|
|
1031
1046
|
const {
|
|
1032
1047
|
formState: { isSubmitting },
|
|
1033
1048
|
setValue
|
|
1034
1049
|
} = useFormContext3();
|
|
1050
|
+
useEffect2(() => {
|
|
1051
|
+
if (!isSubmitting) {
|
|
1052
|
+
setClicked(false);
|
|
1053
|
+
}
|
|
1054
|
+
}, [isSubmitting]);
|
|
1035
1055
|
const isPrimary = attributes.name === "method" || attributes.name.includes("passkey") || attributes.name.includes("webauthn") || attributes.name.includes("lookup_secret");
|
|
1036
1056
|
return /* @__PURE__ */ jsxs21(
|
|
1037
1057
|
"button",
|
|
@@ -1042,6 +1062,7 @@ var DefaultButton = ({
|
|
|
1042
1062
|
type: type === "button" ? "button" : "submit",
|
|
1043
1063
|
onClick: (e) => {
|
|
1044
1064
|
onClick == null ? void 0 : onClick(e);
|
|
1065
|
+
setClicked(true);
|
|
1045
1066
|
if (type !== "button") {
|
|
1046
1067
|
setValue(name, value);
|
|
1047
1068
|
}
|
|
@@ -1049,10 +1070,10 @@ var DefaultButton = ({
|
|
|
1049
1070
|
className: buttonStyles({
|
|
1050
1071
|
intent: isPrimary ? "primary" : "secondary"
|
|
1051
1072
|
}),
|
|
1052
|
-
disabled: (_a = rest.disabled) != null ? _a :
|
|
1053
|
-
"data-loading":
|
|
1073
|
+
disabled: (_a = rest.disabled) != null ? _a : isSubmitting,
|
|
1074
|
+
"data-loading": clicked,
|
|
1054
1075
|
children: [
|
|
1055
|
-
|
|
1076
|
+
clicked ? /* @__PURE__ */ jsx32(Spinner, {}) : null,
|
|
1056
1077
|
label ? /* @__PURE__ */ jsx32("span", { children: uiTextToFormattedMessage3(label, intl) }) : ""
|
|
1057
1078
|
]
|
|
1058
1079
|
}
|
|
@@ -1580,7 +1601,7 @@ import { useComponents as useComponents3 } from "@ory/elements-react";
|
|
|
1580
1601
|
|
|
1581
1602
|
// src/theme/default/components/ui/user-menu.tsx
|
|
1582
1603
|
import { DropdownMenuLabel as DropdownMenuLabel2 } from "@radix-ui/react-dropdown-menu";
|
|
1583
|
-
import { useCallback, useEffect, useState } from "react";
|
|
1604
|
+
import { useCallback, useEffect as useEffect3, useState as useState3 } from "react";
|
|
1584
1605
|
import { useOryFlow as useOryFlow10 } from "@ory/elements-react";
|
|
1585
1606
|
|
|
1586
1607
|
// src/util/client.ts
|
|
@@ -1760,12 +1781,12 @@ import { jsx as jsx50, jsxs as jsxs28 } from "react/jsx-runtime";
|
|
|
1760
1781
|
var UserMenu = ({ session }) => {
|
|
1761
1782
|
const { config } = useOryFlow10();
|
|
1762
1783
|
const initials = getUserInitials(session);
|
|
1763
|
-
const [logoutFlow, setLogoutFlow] =
|
|
1784
|
+
const [logoutFlow, setLogoutFlow] = useState3();
|
|
1764
1785
|
const fetchLogoutFlow = useCallback(async () => {
|
|
1765
1786
|
const flow = await frontendClient(config.sdk.url).createBrowserLogoutFlow();
|
|
1766
1787
|
setLogoutFlow(flow);
|
|
1767
1788
|
}, [config.sdk.url]);
|
|
1768
|
-
|
|
1789
|
+
useEffect3(() => {
|
|
1769
1790
|
void fetchLogoutFlow();
|
|
1770
1791
|
}, [fetchLogoutFlow]);
|
|
1771
1792
|
return /* @__PURE__ */ jsxs28(DropdownMenu, { children: [
|