@thunderid/react 1.11.3 → 1.13.0
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/dist/cjs/components/auth/DeviceGrant/DeviceGrant.cjs +220 -28
- package/dist/cjs/components/auth/DeviceGrant/DeviceGrant.cjs.map +1 -1
- package/dist/cjs/components/auth/SignIn/SignIn.cjs +3 -19
- package/dist/cjs/components/auth/SignIn/SignIn.cjs.map +1 -1
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs +6 -3
- package/dist/cjs/components/auth/flow/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/auth/flow/FieldFactory.cjs +2 -1
- package/dist/cjs/components/auth/flow/FieldFactory.cjs.map +1 -1
- package/dist/cjs/components/primitives/OtpField/OtpField.cjs +10 -5
- package/dist/cjs/components/primitives/OtpField/OtpField.cjs.map +1 -1
- package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs +16 -8
- package/dist/cjs/components/primitives/OtpField/OtpField.styles.cjs.map +1 -1
- package/dist/cjs/index.cjs +1 -1
- package/dist/components/auth/DeviceGrant/DeviceGrant.d.ts +2 -0
- package/dist/components/auth/DeviceGrant/DeviceGrant.d.ts.map +1 -1
- package/dist/components/auth/DeviceGrant/DeviceGrant.js +221 -29
- package/dist/components/auth/DeviceGrant/DeviceGrant.js.map +1 -1
- package/dist/components/auth/SignIn/SignIn.d.ts.map +1 -1
- package/dist/components/auth/SignIn/SignIn.js +4 -20
- package/dist/components/auth/SignIn/SignIn.js.map +1 -1
- package/dist/components/auth/flow/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/auth/flow/AuthOptionFactory.js +6 -3
- package/dist/components/auth/flow/AuthOptionFactory.js.map +1 -1
- package/dist/components/auth/flow/FieldFactory.d.ts +4 -0
- package/dist/components/auth/flow/FieldFactory.d.ts.map +1 -1
- package/dist/components/auth/flow/FieldFactory.js +2 -1
- package/dist/components/auth/flow/FieldFactory.js.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.d.ts +4 -0
- package/dist/components/primitives/OtpField/OtpField.d.ts.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.js +11 -6
- package/dist/components/primitives/OtpField/OtpField.js.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.d.ts +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.d.ts.map +1 -1
- package/dist/components/primitives/OtpField/OtpField.styles.js +16 -8
- package/dist/components/primitives/OtpField/OtpField.styles.js.map +1 -1
- package/dist/index.js +1 -1
- package/package.json +2 -2
|
@@ -11,17 +11,18 @@ import { useMemo } from "react";
|
|
|
11
11
|
* @param length - Number of OTP input fields
|
|
12
12
|
* @returns Object containing CSS class names for component styling
|
|
13
13
|
*/
|
|
14
|
-
const useStyles = (theme, colorScheme, disabled, hasError, length) => useMemo(() => {
|
|
14
|
+
const useStyles = (theme, colorScheme, disabled, hasError, length, separatorAfter) => useMemo(() => {
|
|
15
|
+
const isGrouped = separatorAfter !== void 0 && separatorAfter > 0 && separatorAfter < length;
|
|
15
16
|
const inputContainer = css`
|
|
16
17
|
display: flex;
|
|
17
|
-
gap: ${theme.vars.spacing.unit};
|
|
18
|
-
justify-content: space-between;
|
|
18
|
+
gap: calc(${theme.vars.spacing.unit} * ${isGrouped ? .5 : 1});
|
|
19
|
+
justify-content: ${isGrouped ? "center" : "space-between"};
|
|
19
20
|
align-items: center;
|
|
20
|
-
flex-wrap: wrap;
|
|
21
|
+
flex-wrap: ${isGrouped ? "nowrap" : "wrap"};
|
|
21
22
|
`;
|
|
22
23
|
const input = css`
|
|
23
|
-
width: calc(${theme.vars.spacing.unit} * 6);
|
|
24
|
-
height: calc(${theme.vars.spacing.unit} * 6);
|
|
24
|
+
width: calc(${theme.vars.spacing.unit} * ${isGrouped ? 3.5 : 6});
|
|
25
|
+
height: calc(${theme.vars.spacing.unit} * ${isGrouped ? 4.5 : 6});
|
|
25
26
|
text-align: center;
|
|
26
27
|
font-size: ${theme.vars.typography.fontSizes.xl};
|
|
27
28
|
font-family: ${theme.vars.typography.fontFamily};
|
|
@@ -66,14 +67,21 @@ const useStyles = (theme, colorScheme, disabled, hasError, length) => useMemo(()
|
|
|
66
67
|
cursor: not-allowed;
|
|
67
68
|
opacity: 0.6;
|
|
68
69
|
`,
|
|
69
|
-
inputError
|
|
70
|
+
inputError,
|
|
71
|
+
separator: css`
|
|
72
|
+
flex: none;
|
|
73
|
+
color: ${theme.vars.colors.text.secondary};
|
|
74
|
+
font-size: ${theme.vars.typography.fontSizes.xl};
|
|
75
|
+
font-weight: 500;
|
|
76
|
+
`
|
|
70
77
|
};
|
|
71
78
|
}, [
|
|
72
79
|
theme,
|
|
73
80
|
colorScheme,
|
|
74
81
|
disabled,
|
|
75
82
|
hasError,
|
|
76
|
-
length
|
|
83
|
+
length,
|
|
84
|
+
separatorAfter
|
|
77
85
|
]);
|
|
78
86
|
var OtpField_styles_default = useStyles;
|
|
79
87
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"OtpField.styles.js","names":["inputContainer: string","input: string","inputError: string"],"sources":["../../../../src/components/primitives/OtpField/OtpField.styles.ts"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\nexport type OtpFieldType = 'text' | 'number' | 'password';\n\n/**\n * Creates styles for the OtpField component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @param length - Number of OTP input fields\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n length: number,\n): Record<string, string> =>\n useMemo(() => {\n const inputContainer: string = css`\n display: flex;\n gap: ${theme.vars.spacing.unit};\n justify-content: space-between;\n align-items: center;\n flex-wrap: wrap;\n `;\n\n const input: string = css`\n width: calc(${theme.vars.spacing.unit} * 6);\n height: calc(${theme.vars.spacing.unit} * 6);\n text-align: center;\n font-size: ${theme.vars.typography.fontSizes.xl};\n font-family: ${theme.vars.typography.fontFamily};\n font-weight: 500;\n border: 2px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n opacity: 0.7;\n }\n `;\n\n const inputError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n `;\n\n const inputDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n cursor: not-allowed;\n opacity: 0.6;\n `;\n\n return {\n input,\n inputContainer,\n inputDisabled,\n inputError,\n };\n }, [theme, colorScheme, disabled, hasError, length]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,aACJ,OACA,aACA,UACA,UACA,
|
|
1
|
+
{"version":3,"file":"OtpField.styles.js","names":["inputContainer: string","input: string","inputError: string"],"sources":["../../../../src/components/primitives/OtpField/OtpField.styles.ts"],"sourcesContent":["// Copyright 2024 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {Theme} from '@thunderid/browser';\nimport {useMemo} from 'react';\nimport {css} from '../../../styles/emotion';\n\nexport type OtpFieldType = 'text' | 'number' | 'password';\n\n/**\n * Creates styles for the OtpField component using BEM methodology\n * @param theme - The theme object containing design tokens\n * @param colorScheme - The current color scheme (used for memoization)\n * @param disabled - Whether the component is disabled\n * @param hasError - Whether the component has an error\n * @param length - Number of OTP input fields\n * @returns Object containing CSS class names for component styling\n */\nconst useStyles = (\n theme: Theme,\n colorScheme: string,\n disabled: boolean,\n hasError: boolean,\n length: number,\n separatorAfter?: number,\n): Record<string, string> =>\n useMemo(() => {\n const isGrouped = separatorAfter !== undefined && separatorAfter > 0 && separatorAfter < length;\n const inputContainer: string = css`\n display: flex;\n gap: calc(${theme.vars.spacing.unit} * ${isGrouped ? 0.5 : 1});\n justify-content: ${isGrouped ? 'center' : 'space-between'};\n align-items: center;\n flex-wrap: ${isGrouped ? 'nowrap' : 'wrap'};\n `;\n\n const input: string = css`\n width: calc(${theme.vars.spacing.unit} * ${isGrouped ? 3.5 : 6});\n height: calc(${theme.vars.spacing.unit} * ${isGrouped ? 4.5 : 6});\n text-align: center;\n font-size: ${theme.vars.typography.fontSizes.xl};\n font-family: ${theme.vars.typography.fontFamily};\n font-weight: 500;\n border: 2px solid ${hasError ? theme.vars.colors.error.main : theme.vars.colors.border};\n border-radius: ${theme.vars.components?.Field?.root?.borderRadius || theme.vars.borderRadius.medium};\n color: ${theme.vars.colors.text.primary};\n background-color: ${disabled ? theme.vars.colors.background.disabled : theme.vars.colors.background.surface};\n outline: none;\n transition:\n border-color 0.2s ease,\n box-shadow 0.2s ease;\n\n &:focus {\n border-color: ${hasError ? theme.vars.colors.error.main : theme.vars.colors.primary.main};\n box-shadow: 0 0 0 2px ${hasError ? `${theme.vars.colors.error.main}20` : `${theme.vars.colors.primary.main}20`};\n }\n\n &:disabled {\n cursor: not-allowed;\n opacity: 0.6;\n }\n\n &::placeholder {\n color: ${theme.vars.colors.text.secondary};\n opacity: 0.7;\n }\n `;\n\n const inputError: string = css`\n border-color: ${theme.vars.colors.error.main};\n\n &:focus {\n border-color: ${theme.vars.colors.error.main};\n box-shadow: 0 0 0 2px ${theme.vars.colors.error.main}20;\n }\n `;\n\n const inputDisabled: string = css`\n background-color: ${theme.vars.colors.background.disabled};\n cursor: not-allowed;\n opacity: 0.6;\n `;\n\n const separator: string = css`\n flex: none;\n color: ${theme.vars.colors.text.secondary};\n font-size: ${theme.vars.typography.fontSizes.xl};\n font-weight: 500;\n `;\n\n return {\n input,\n inputContainer,\n inputDisabled,\n inputError,\n separator,\n };\n }, [theme, colorScheme, disabled, hasError, length, separatorAfter]);\n\nexport default useStyles;\n"],"mappings":";;;;;;;;;;;;;AAkBA,MAAM,aACJ,OACA,aACA,UACA,UACA,QACA,mBAEA,cAAc;CACZ,MAAM,YAAY,mBAAmB,UAAa,iBAAiB,KAAK,iBAAiB;CACzF,MAAMA,iBAAyB,GAAG;;kBAEpB,MAAM,KAAK,QAAQ,KAAK,KAAK,YAAY,KAAM,EAAE;yBAC1C,YAAY,WAAW,gBAAgB;;mBAE7C,YAAY,WAAW,OAAO;;CAG7C,MAAMC,QAAgB,GAAG;oBACT,MAAM,KAAK,QAAQ,KAAK,KAAK,YAAY,MAAM,EAAE;qBAChD,MAAM,KAAK,QAAQ,KAAK,KAAK,YAAY,MAAM,EAAE;;mBAEnD,MAAM,KAAK,WAAW,UAAU,GAAG;qBACjC,MAAM,KAAK,WAAW,WAAW;;0BAE5B,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,OAAO;uBACtE,MAAM,KAAK,YAAY,OAAO,MAAM,gBAAgB,MAAM,KAAK,aAAa,OAAO;eAC3F,MAAM,KAAK,OAAO,KAAK,QAAQ;0BACpB,WAAW,MAAM,KAAK,OAAO,WAAW,WAAW,MAAM,KAAK,OAAO,WAAW,QAAQ;;;;;;;wBAO1F,WAAW,MAAM,KAAK,OAAO,MAAM,OAAO,MAAM,KAAK,OAAO,QAAQ,KAAK;gCACjE,WAAW,GAAG,MAAM,KAAK,OAAO,MAAM,KAAK,MAAM,GAAG,MAAM,KAAK,OAAO,QAAQ,KAAK,IAAI;;;;;;;;;iBAStG,MAAM,KAAK,OAAO,KAAK,UAAU;;;;CAK9C,MAAMC,aAAqB,GAAG;sBACZ,MAAM,KAAK,OAAO,MAAM,KAAK;;;wBAG3B,MAAM,KAAK,OAAO,MAAM,KAAK;gCACrB,MAAM,KAAK,OAAO,MAAM,KAAK;;;AAiBzD,QAAO;EACL;EACA;EACA,eAhB4B,GAAG;0BACX,MAAM,KAAK,OAAO,WAAW,SAAS;;;;EAgB1D;EACA,WAZwB,GAAG;;eAElB,MAAM,KAAK,OAAO,KAAK,UAAU;mBAC7B,MAAM,KAAK,WAAW,UAAU,GAAG;;;EAUjD;GACA;CAAC;CAAO;CAAa;CAAU;CAAU;CAAQ;CAAe,CAAC;AAEtE,8BAAe"}
|
package/dist/index.js
CHANGED
|
@@ -82,8 +82,8 @@ import MicrosoftButton_default from "./components/auth/buttons/MicrosoftButton.j
|
|
|
82
82
|
import SignInWithEthereumButton_default from "./components/auth/buttons/SignInWithEthereumButton.js";
|
|
83
83
|
import BaseSignIn_default from "./components/auth/SignIn/BaseSignIn.js";
|
|
84
84
|
import BaseDeviceGrant_default from "./components/auth/DeviceGrant/BaseDeviceGrant.js";
|
|
85
|
-
import DeviceGrant_default from "./components/auth/DeviceGrant/DeviceGrant.js";
|
|
86
85
|
import { useOAuthCallback } from "./hooks/auth/useOAuthCallback.js";
|
|
86
|
+
import DeviceGrant_default from "./components/auth/DeviceGrant/DeviceGrant.js";
|
|
87
87
|
import SignIn_default from "./components/auth/SignIn/SignIn.js";
|
|
88
88
|
import Logo_default from "./components/primitives/Logo/Logo.js";
|
|
89
89
|
import BaseSignUp_default from "./components/auth/SignUp/BaseSignUp.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@thunderid/react",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "React SDK for ThunderID",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"thunderid",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@emotion/css": "11.13.5",
|
|
62
62
|
"@floating-ui/react": "0.27.12",
|
|
63
|
-
"@thunderid/browser": "^1.
|
|
63
|
+
"@thunderid/browser": "^1.10.0",
|
|
64
64
|
"dompurify": "3.4.17",
|
|
65
65
|
"tslib": "2.8.1"
|
|
66
66
|
},
|