@tern-secure/nextjs 3.0.1 → 3.0.2

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.
@@ -4,13 +4,18 @@ export interface SignInProps {
4
4
  onError?: (error: Error) => void;
5
5
  redirectUrl?: string;
6
6
  className?: string;
7
+ style?: React.CSSProperties;
7
8
  customStyles?: {
8
- form?: string;
9
9
  container?: string;
10
+ header?: string;
11
+ title?: string;
12
+ formWrapper?: string;
13
+ formContainer?: string;
14
+ form?: string;
10
15
  input?: string;
11
16
  button?: string;
12
17
  errorText?: string;
13
18
  label?: string;
14
19
  };
15
20
  }
16
- export declare function SignIn({ onSuccess, onError, redirectUrl, className, customStyles }: SignInProps): React.JSX.Element;
21
+ export declare function SignIn({ onSuccess, onError, redirectUrl, className, style, customStyles }: SignInProps): React.JSX.Element;
@@ -2,7 +2,82 @@
2
2
  import * as React from 'react';
3
3
  import { useState } from 'react';
4
4
  import { signInWithEmail } from '../app-router/client';
5
- export function SignIn({ onSuccess, onError, redirectUrl, className = '', customStyles = {} }) {
5
+ import { createStyles } from '../utils/create-styles';
6
+ const styles = createStyles('tern', {
7
+ container: {
8
+ display: 'flex',
9
+ minHeight: '100%',
10
+ flex: '1',
11
+ flexDirection: 'column',
12
+ justifyContent: 'center',
13
+ padding: '3rem 1.5rem'
14
+ },
15
+ header: {
16
+ margin: '0 auto',
17
+ width: '100%',
18
+ maxWidth: '28rem'
19
+ },
20
+ title: {
21
+ marginTop: '1.5rem',
22
+ textAlign: 'center',
23
+ fontSize: '1.875rem',
24
+ fontWeight: '700',
25
+ lineHeight: '2.25rem',
26
+ letterSpacing: '-0.025em',
27
+ color: 'var(--tern-text-primary, #111827)'
28
+ },
29
+ formWrapper: {
30
+ marginTop: '2.5rem',
31
+ margin: '0 auto',
32
+ width: '100%',
33
+ maxWidth: '30rem'
34
+ },
35
+ formContainer: {
36
+ padding: '3rem 1.5rem',
37
+ boxShadow: '0 1px 3px 0 rgb(0 0 0 / 0.1)',
38
+ borderRadius: '0.5rem',
39
+ backgroundColor: 'var(--tern-background, white)'
40
+ },
41
+ form: {
42
+ display: 'flex',
43
+ flexDirection: 'column',
44
+ gap: '1rem'
45
+ },
46
+ label: {
47
+ display: 'block',
48
+ fontSize: '0.875rem',
49
+ fontWeight: '500',
50
+ color: 'var(--tern-text-secondary, #374151)'
51
+ },
52
+ input: {
53
+ marginTop: '0.25rem',
54
+ display: 'block',
55
+ width: '100%',
56
+ padding: '0.5rem 0.75rem',
57
+ borderRadius: '0.375rem',
58
+ border: '1px solid var(--tern-border, #D1D5DB)',
59
+ backgroundColor: 'var(--tern-input-background, white)',
60
+ color: 'var(--tern-text-primary, #111827)'
61
+ },
62
+ button: {
63
+ display: 'flex',
64
+ width: '100%',
65
+ justifyContent: 'center',
66
+ padding: '0.5rem 1rem',
67
+ fontSize: '0.875rem',
68
+ fontWeight: '500',
69
+ color: 'white',
70
+ backgroundColor: 'var(--tern-primary, #2563EB)',
71
+ border: 'none',
72
+ borderRadius: '0.375rem',
73
+ cursor: 'pointer'
74
+ },
75
+ error: {
76
+ color: 'var(--tern-error, #DC2626)',
77
+ fontSize: '0.875rem'
78
+ }
79
+ });
80
+ export function SignIn({ onSuccess, onError, redirectUrl, className = '', style, customStyles = {} }) {
6
81
  const [email, setEmail] = useState('');
7
82
  const [password, setPassword] = useState('');
8
83
  const [loading, setLoading] = useState(false);
@@ -27,35 +102,19 @@ export function SignIn({ onSuccess, onError, redirectUrl, className = '', custom
27
102
  setLoading(false);
28
103
  }
29
104
  };
30
- const defaultStyles = {
31
- form: 'space-y-4',
32
- label: 'block text-sm font-medium text-gray-700',
33
- input: 'mt-1 block w-full rounded-md border border-gray-300 px-3 py-2 shadow-sm focus:border-primary focus:outline-none focus:ring-1 focus:ring-primary',
34
- button: 'w-full flex justify-center py-2 px-4 border border-transparent rounded-md shadow-sm text-sm font-medium text-white bg-indigo-600 hover:bg-primary/90 focus:outline-none focus:ring-2 focus:ring-offset-2 focus:ring-primary disabled:opacity-50',
35
- errorText: 'text-red-500 text-sm',
36
- container: 'flex min-h-full flex-1 flex-col justify-center py-12 sm:px-6 lg:px-8'
37
- };
38
- const styles = {
39
- form: customStyles.form || defaultStyles.form,
40
- label: customStyles.label || defaultStyles.label,
41
- container: customStyles.container || defaultStyles.container,
42
- input: customStyles.input || defaultStyles.input,
43
- button: customStyles.button || defaultStyles.button,
44
- errorText: customStyles.errorText || defaultStyles.errorText
45
- };
46
- return (React.createElement("div", { className: styles.container },
47
- React.createElement("div", { className: "sm:mx-auto sm:w-full sm:max-w-md" },
48
- React.createElement("h2", { className: `mt-6 text-center text-2xl font-bold leading-9 tracking-tight text-gray-900}` }, "Sign in to your account")),
49
- React.createElement("div", { className: "mt-10 sm:mx-auto sm:w-full sm:max-w-[480px]" },
50
- React.createElement("div", { className: "px-6 py-12 shadow sm:rounded-lg sm:px-12 " },
51
- React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${className}`, role: "form", "aria-label": "Sign in form" },
52
- error && (React.createElement("div", { className: styles.errorText, role: "alert", "aria-live": "polite" }, error)),
105
+ return (React.createElement("div", { className: `${styles.container} ${customStyles.container || ''}`, style: style },
106
+ React.createElement("div", { className: `${styles.header} ${customStyles.header || ''}` },
107
+ React.createElement("h2", { className: `${styles.title} ${customStyles.title || ''}` }, "Sign in to your account")),
108
+ React.createElement("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ''}` },
109
+ React.createElement("div", { className: `${styles.formContainer} ${customStyles.formContainer || ''}` },
110
+ React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${customStyles.form || ''} ${className}`, role: "form", "aria-label": "Sign in form" },
111
+ error && (React.createElement("div", { className: `${styles.error} ${customStyles.errorText || ''}`, role: "alert", "aria-live": "polite" }, error)),
53
112
  React.createElement("div", null,
54
- React.createElement("label", { htmlFor: "email", className: styles.label }, "Email"),
55
- React.createElement("input", { id: "email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Enter your email", required: true, className: styles.input, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
113
+ React.createElement("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ''}` }, "Email"),
114
+ React.createElement("input", { id: "email", type: "email", value: email, onChange: (e) => setEmail(e.target.value), placeholder: "Enter your email", required: true, className: `${styles.input} ${customStyles.input || ''}`, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
56
115
  React.createElement("div", null,
57
- React.createElement("label", { htmlFor: "password", className: styles.label }, "Password"),
58
- React.createElement("input", { id: "password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), placeholder: "Enter your password", required: true, className: styles.input, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
59
- React.createElement("button", { type: "submit", disabled: loading, className: styles.button, "data-testid": "sign-in-submit" }, loading ? 'Signing in...' : 'Sign in'))))));
116
+ React.createElement("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ''}` }, "Password"),
117
+ React.createElement("input", { id: "password", type: "password", value: password, onChange: (e) => setPassword(e.target.value), placeholder: "Enter your password", required: true, className: `${styles.input} ${customStyles.input || ''}`, disabled: loading, "aria-required": "true", "aria-invalid": !!error })),
118
+ React.createElement("button", { type: "submit", disabled: loading, className: `${styles.button} ${customStyles.button || ''}`, "data-testid": "sign-in-submit" }, loading ? 'Signing in...' : 'Sign in'))))));
60
119
  }
61
120
  //# sourceMappingURL=sign-in.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"sign-in.js","sourceRoot":"","sources":["../../src/components/sign-in.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAA;AAEZ,OAAO,KAAK,KAAK,MAAM,OAAO,CAAA;AAC9B,OAAO,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAChC,OAAO,EAAE,eAAe,EAAE,MAAM,sBAAsB,CAAA;AAiBtD,MAAM,UAAU,MAAM,CAAC,EACrB,SAAS,EACT,OAAO,EACP,WAAW,EACX,SAAS,GAAG,EAAE,EACd,YAAY,GAAG,EAAE,E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CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EACzC,WAAW,EAAC,kBAAkB,EAC9B,QAAQ,QACR,SAAS,EAAE,GAAG,MAAM,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,IAAI,EAAE,EAAE,EACxD,QAAQ,EAAE,OAAO,mBACH,MAAM,kBACN,CAAC,CAAC,KAAK,GACrB,CACE;oBACN;wBACE,+BAAO,OAAO,EAAC,UAAU,EAAC,SAAS,EAAE,GAAG,MAAM,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,IAAI,EAAE,EAAE,eAE1E;wBACR,+BACE,EAAE,EAAC,UAAU,EACb,IAAI,EAAC,UAAU,EACf,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,WAAW,EAAC,qBAAqB,EACjC,QAAQ,QACR,SAAS,EAAE,GAAG,MAAM,CAAC,KAAK,IAAI,YAAY,CAAC,KAAK,IAAI,EAAE,EAAE,EACxD,QAAQ,EAAE,OAAO,mBACH,MAAM,kBACN,CAAC,CAAC,KAAK,GACrB,CACE;oBACN,gCACE,IAAI,EAAC,QAAQ,EACb,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,GAAG,MAAM,CAAC,MAAM,IAAI,YAAY,CAAC,MAAM,IAAI,EAAE,EAAE,iBAC9C,gBAAgB,IAE3B,OAAO,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC,CAAC,SAAS,CAC/B,CACJ,CACH,CACF,CACF,CACP,CAAA;AACH,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const createStyles: (prefix: string, styles: Record<string, React.CSSProperties>) => Record<string, string>;
@@ -0,0 +1,22 @@
1
+ let styleSheet = null;
2
+ if (typeof window !== 'undefined') {
3
+ styleSheet = document.createElement('style');
4
+ styleSheet.setAttribute('data-tern-secure', '');
5
+ document.head.appendChild(styleSheet);
6
+ }
7
+ export const createStyles = (prefix, styles) => {
8
+ if (!styleSheet)
9
+ return {};
10
+ const classNames = Object.entries(styles).reduce((acc, [key, rules]) => {
11
+ const className = `${prefix}-${key}`;
12
+ const cssRules = Object.entries(rules).map(([prop, value]) => {
13
+ const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
14
+ return `${cssProperty}: ${value};`;
15
+ }).join(' ');
16
+ const cssRule = `.${className} { ${cssRules} }`;
17
+ styleSheet.sheet?.insertRule(cssRule, styleSheet.sheet.cssRules.length);
18
+ return { ...acc, [key]: className };
19
+ }, {});
20
+ return classNames;
21
+ };
22
+ //# sourceMappingURL=create-styles.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"create-styles.js","sourceRoot":"","sources":["../../src/utils/create-styles.ts"],"names":[],"mappings":"AAAA,IAAI,UAAU,GAA4B,IAAI,CAAC;AAE/C,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;IAClC,UAAU,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC;IAC7C,UAAU,CAAC,YAAY,CAAC,kBAAkB,EAAE,EAAE,CAAC,CAAC;IAChD,QAAQ,CAAC,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,CAAC;AACxC,CAAC;AAED,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,MAAc,EAAE,MAA2C,EAAE,EAAE;IAC1F,IAAI,CAAC,UAAU;QAAE,OAAO,EAAE,CAAC;IAE3B,MAAM,UAAU,GAAG,MAAM,CAAC,OAAO,CAAC,MAAM,CAAC,CAAC,MAAM,CAAC,CAAC,GAAG,EAAE,CAAC,GAAG,EAAE,KAAK,CAAC,EAAE,EAAE;QACrE,MAAM,SAAS,GAAG,GAAG,MAAM,IAAI,GAAG,EAAE,CAAC;QACrC,MAAM,QAAQ,GAAG,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,IAAI,EAAE,KAAK,CAAC,EAAE,EAAE;YAC3D,MAAM,WAAW,GAAG,IAAI,CAAC,OAAO,CAAC,UAAU,EAAE,KAAK,CAAC,CAAC,WAAW,EAAE,CAAC;YAClE,OAAO,GAAG,WAAW,KAAK,KAAK,GAAG,CAAC;QACrC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;QAEb,MAAM,OAAO,GAAG,IAAI,SAAS,MAAM,QAAQ,IAAI,CAAC;QAChD,UAAW,CAAC,KAAK,EAAE,UAAU,CAAC,OAAO,EAAE,UAAW,CAAC,KAAK,CAAC,QAAQ,CAAC,MAAM,CAAC,CAAC;QAE1E,OAAO,EAAE,GAAG,GAAG,EAAE,CAAC,GAAG,CAAC,EAAE,SAAS,EAAE,CAAC;IACtC,CAAC,EAAE,EAA4B,CAAC,CAAC;IAEjC,OAAO,UAAU,CAAC;AACpB,CAAC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tern-secure/nextjs",
3
- "version": "3.0.1",
3
+ "version": "3.0.2",
4
4
  "publishConfig": {
5
5
  "access": "public",
6
6
  "registry": "https://registry.npmjs.org/"
@@ -16,7 +16,7 @@
16
16
  "main": "./dist/index.js",
17
17
  "module": "./dist/index.js",
18
18
  "scripts": {
19
- "build": "tsc --build && node scripts/copy-styles.js",
19
+ "build": "tsc --build",
20
20
  "clean": "tsc --build --clean",
21
21
  "dev": "tsc --watch",
22
22
  "lint": "eslint \"src/**/*.{ts,tsx}\"",
@@ -67,8 +67,7 @@
67
67
  },
68
68
  "types": "./dist/index.d.ts",
69
69
  "files": [
70
- "dist",
71
- "styles"
70
+ "dist"
72
71
  ],
73
72
  "peerDependencies": {
74
73
  "firebase": "^10.0.0",
@@ -98,6 +97,6 @@
98
97
  "import": "./dist/server/index.js",
99
98
  "require": "./dist/server/index.js"
100
99
  },
101
- "./styles": "./dist/styles/index.css"
100
+ "./styles": "./styles/index.css"
102
101
  }
103
102
  }