@tern-secure/nextjs 3.0.1 → 3.0.3

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;
@@ -1,8 +1,8 @@
1
- 'use client';
2
1
  import * as React from 'react';
3
2
  import { useState } from 'react';
4
3
  import { signInWithEmail } from '../app-router/client';
5
- export function SignIn({ onSuccess, onError, redirectUrl, className = '', customStyles = {} }) {
4
+ import { styles } from '../utils/create-styles';
5
+ export function SignIn({ onSuccess, onError, redirectUrl, className = '', style, customStyles = {} }) {
6
6
  const [email, setEmail] = useState('');
7
7
  const [password, setPassword] = useState('');
8
8
  const [loading, setLoading] = useState(false);
@@ -27,35 +27,19 @@ export function SignIn({ onSuccess, onError, redirectUrl, className = '', custom
27
27
  setLoading(false);
28
28
  }
29
29
  };
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)),
30
+ return (React.createElement("div", { className: `${styles.container} ${customStyles.container || ''}`, style: style },
31
+ React.createElement("div", { className: `${styles.header} ${customStyles.header || ''}` },
32
+ React.createElement("h2", { className: `${styles.title} ${customStyles.title || ''}` }, "Sign in to your account")),
33
+ React.createElement("div", { className: `${styles.formWrapper} ${customStyles.formWrapper || ''}` },
34
+ React.createElement("div", { className: `${styles.formContainer} ${customStyles.formContainer || ''}` },
35
+ React.createElement("form", { onSubmit: handleSubmit, className: `${styles.form} ${customStyles.form || ''} ${className}`, role: "form", "aria-label": "Sign in form" },
36
+ error && (React.createElement("div", { className: `${styles.error} ${customStyles.errorText || ''}`, role: "alert", "aria-live": "polite" }, error)),
53
37
  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 })),
38
+ React.createElement("label", { htmlFor: "email", className: `${styles.label} ${customStyles.label || ''}` }, "Email"),
39
+ 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
40
  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'))))));
41
+ React.createElement("label", { htmlFor: "password", className: `${styles.label} ${customStyles.label || ''}` }, "Password"),
42
+ 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 })),
43
+ React.createElement("button", { type: "submit", disabled: loading, className: `${styles.button} ${customStyles.button || ''}`, "data-testid": "sign-in-submit" }, loading ? 'Signing in...' : 'Sign in'))))));
60
44
  }
61
45
  //# 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,EACL;IACZ,MAAM,CAAC,KAAK,EAAE,QAA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IAAI,EAAE;oBACJ,IAAI,EAAE,IAAI;oBACV,OAAO,EAAE,KAAK;oBACd,KAAK,EAAE,KAAc;oBACrB,UAAU,EAAE,KAAK;iBAClB;aACF,CAAC,CAAC,CAAA;QACL,CAAC;IACH,CAAC,EAAE,EAAE,CAAC,CAAA,CAAC,yBAAyB;IAEhC,OAAO,KAAK,CAAC,IAAI,CAAA;AACnB,CAAC"}
@@ -1,5 +1,5 @@
1
1
  import type { ReactNode } from 'react';
2
- import { User } from 'firebase/auth';
2
+ import { User, Auth } from 'firebase/auth';
3
3
  export interface TernSecureConfig {
4
4
  apiKey: string;
5
5
  authDomain: string;
@@ -30,7 +30,7 @@ export interface AuthState {
30
30
  export interface TernSecureContextValue {
31
31
  _contextKey: symbol;
32
32
  authState: AuthState;
33
- auth: any;
33
+ auth: Auth;
34
34
  }
35
35
  export interface TernSecureContextType {
36
36
  authState: AuthState;
@@ -0,0 +1,78 @@
1
+ export declare const defaultClassNames: {
2
+ readonly container: "tern-container";
3
+ readonly header: "tern-header";
4
+ readonly title: "tern-title";
5
+ readonly formWrapper: "tern-formWrapper";
6
+ readonly formContainer: "tern-formContainer";
7
+ readonly form: "tern-form";
8
+ readonly label: "tern-label";
9
+ readonly input: "tern-input";
10
+ readonly button: "tern-button";
11
+ readonly error: "tern-error";
12
+ };
13
+ export declare const styleConfig: {
14
+ readonly container: {
15
+ readonly display: "flex";
16
+ readonly minHeight: "100%";
17
+ readonly flex: "1";
18
+ readonly flexDirection: "column";
19
+ readonly justifyContent: "center";
20
+ readonly padding: "3rem 1.5rem";
21
+ };
22
+ readonly header: {
23
+ readonly marginBottom: "2rem";
24
+ };
25
+ readonly title: {
26
+ readonly fontSize: "2rem";
27
+ readonly fontWeight: "bold";
28
+ readonly marginBottom: "1rem";
29
+ };
30
+ readonly formWrapper: {
31
+ readonly display: "flex";
32
+ readonly flexDirection: "column";
33
+ readonly gap: "1rem";
34
+ };
35
+ readonly formContainer: {
36
+ readonly display: "flex";
37
+ readonly flexDirection: "column";
38
+ readonly gap: "0.5rem";
39
+ };
40
+ readonly form: {
41
+ readonly display: "flex";
42
+ readonly flexDirection: "column";
43
+ readonly gap: "0.5rem";
44
+ };
45
+ readonly label: {
46
+ readonly fontSize: "1rem";
47
+ readonly fontWeight: "bold";
48
+ };
49
+ readonly input: {
50
+ readonly padding: "0.5rem";
51
+ readonly border: "1px solid #ccc";
52
+ readonly borderRadius: "4px";
53
+ };
54
+ readonly button: {
55
+ readonly padding: "0.5rem 1rem";
56
+ readonly backgroundColor: "#007bff";
57
+ readonly color: "#fff";
58
+ readonly border: "none";
59
+ readonly borderRadius: "4px";
60
+ readonly cursor: "pointer";
61
+ };
62
+ readonly error: {
63
+ readonly color: "red";
64
+ readonly fontSize: "0.8rem";
65
+ };
66
+ };
67
+ export declare const styles: {
68
+ readonly container: "tern-container";
69
+ readonly header: "tern-header";
70
+ readonly title: "tern-title";
71
+ readonly formWrapper: "tern-formWrapper";
72
+ readonly formContainer: "tern-formContainer";
73
+ readonly form: "tern-form";
74
+ readonly label: "tern-label";
75
+ readonly input: "tern-input";
76
+ readonly button: "tern-button";
77
+ readonly error: "tern-error";
78
+ };
@@ -0,0 +1,107 @@
1
+ 'use client';
2
+ const PREFIX = 'tern';
3
+ // Singleton to track style injection
4
+ const styleInjection = {
5
+ isInjected: false,
6
+ styleElement: null
7
+ };
8
+ export const defaultClassNames = {
9
+ container: `${PREFIX}-container`,
10
+ header: `${PREFIX}-header`,
11
+ title: `${PREFIX}-title`,
12
+ formWrapper: `${PREFIX}-formWrapper`,
13
+ formContainer: `${PREFIX}-formContainer`,
14
+ form: `${PREFIX}-form`,
15
+ label: `${PREFIX}-label`,
16
+ input: `${PREFIX}-input`,
17
+ button: `${PREFIX}-button`,
18
+ error: `${PREFIX}-error`
19
+ };
20
+ // Create styles once and cache them
21
+ function createStyleSheet(styles) {
22
+ if (typeof window === 'undefined')
23
+ return defaultClassNames;
24
+ // Return early if styles are already injected
25
+ if (styleInjection.isInjected) {
26
+ return defaultClassNames;
27
+ }
28
+ // Find existing style element or create new one
29
+ let styleElement = document.querySelector('[data-tern-secure]');
30
+ if (!styleElement) {
31
+ styleElement = document.createElement('style');
32
+ styleElement.setAttribute('data-tern-secure', '');
33
+ document.head.appendChild(styleElement);
34
+ styleInjection.styleElement = styleElement;
35
+ }
36
+ // Create CSS rules
37
+ const cssRules = Object.entries(styles).map(([key, rules]) => {
38
+ const className = defaultClassNames[key];
39
+ const cssProperties = Object.entries(rules).map(([prop, value]) => {
40
+ const cssProperty = prop.replace(/([A-Z])/g, '-$1').toLowerCase();
41
+ return `${cssProperty}: ${value};`;
42
+ }).join(' ');
43
+ return `.${className} { ${cssProperties} }`;
44
+ }).join('\n');
45
+ // Insert styles only once
46
+ styleElement.textContent = cssRules;
47
+ styleInjection.isInjected = true;
48
+ return defaultClassNames;
49
+ }
50
+ // Style configuration
51
+ export const styleConfig = {
52
+ container: {
53
+ display: 'flex',
54
+ minHeight: '100%',
55
+ flex: '1',
56
+ flexDirection: 'column',
57
+ justifyContent: 'center',
58
+ padding: '3rem 1.5rem'
59
+ },
60
+ header: {
61
+ marginBottom: '2rem'
62
+ },
63
+ title: {
64
+ fontSize: '2rem',
65
+ fontWeight: 'bold',
66
+ marginBottom: '1rem'
67
+ },
68
+ formWrapper: {
69
+ display: 'flex',
70
+ flexDirection: 'column',
71
+ gap: '1rem'
72
+ },
73
+ formContainer: {
74
+ display: 'flex',
75
+ flexDirection: 'column',
76
+ gap: '0.5rem'
77
+ },
78
+ form: {
79
+ display: 'flex',
80
+ flexDirection: 'column',
81
+ gap: '0.5rem'
82
+ },
83
+ label: {
84
+ fontSize: '1rem',
85
+ fontWeight: 'bold'
86
+ },
87
+ input: {
88
+ padding: '0.5rem',
89
+ border: '1px solid #ccc',
90
+ borderRadius: '4px'
91
+ },
92
+ button: {
93
+ padding: '0.5rem 1rem',
94
+ backgroundColor: '#007bff',
95
+ color: '#fff',
96
+ border: 'none',
97
+ borderRadius: '4px',
98
+ cursor: 'pointer'
99
+ },
100
+ error: {
101
+ color: 'red',
102
+ fontSize: '0.8rem'
103
+ }
104
+ };
105
+ // Export pre-created styles
106
+ export const styles = createStyleSheet(styleConfig);
107
+ //# 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,YAAY,CAAA;AAEZ,MAAM,MAAM,GAAG,MAAM,CAAA;AAErB,qCAAqC;AACrC,MAAM,cAAc,GAAG;IACrB,UAAU,EAAE,KAAK;IACjB,YAAY,EAAE,IAA+B;CAC9C,CAAA;AAED,MAAM,CAAC,MAAM,iBAAiB,GAAG;IAC/B,SAAS,EAAE,GAAG,MAAM,YAAY;IAChC,MAAM,EAAE,GAAG,MAAM,SAAS;IAC1B,KAAK,EAAE,GAAG,MAAM,QAAQ;IACxB,WAAW,EAAE,GAAG,MAAM,cAAc;IACpC,aAAa,EAAE,GAAG,MAAM,gBAAgB;IACxC,IAAI,EAAE,GAAG,MAAM,OAAO;IACtB,KAAK,EAAE,GAAG,MAAM,QAAQ;IACxB,KAAK,EAAE,GAAG,MAAM,QAAQ;IACxB,MAAM,EAAE,GAAG,MAAM,SAAS;IAC1B,KAAK,EAAE,GAAG,MAAM,QAAQ;CAChB,CAAA;AAEV,oCAAoC;AACpC,SAAS,gBAAgB,CAAC,MAA2C;IACnE,IAAI,OAAO,MAAM,KAAK,WAAW;QAAE,OAAO,iBAAiB,CAAA;IAE3D,8CAA8C;IAC9C,IAAI,cAAc,CAAC,UAAU,EAAE,CAAC;QAC9B,OAAO,iBAAiB,CAAA;IAC1B,CAAC;IAED,gDAAgD;IAChD,IAAI,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAmB,oBAAoB,CAAC,CAAA;IAEjF,IAAI,CAAC,YAAY,EAAE,CAAC;QAClB,YAAY,GAAG,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAA;QAC9C,YAAY,CAAC,YA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M;QAChB,UAAU,EAAE,MAAM;QAClB,YAAY,EAAE,MAAM;KACrB;IACD,WAAW,EAAE;QACX,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,QAAQ;QACvB,GAAG,EAAE,MAAM;KACZ;IACD,aAAa,EAAE;QACb,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,QAAQ;QACvB,GAAG,EAAE,QAAQ;KACd;IACD,IAAI,EAAE;QACJ,OAAO,EAAE,MAAM;QACf,aAAa,EAAE,QAAQ;QACvB,GAAG,EAAE,QAAQ;KACd;IACD,KAAK,EAAE;QACL,QAAQ,EAAE,MAAM;QAChB,UAAU,EAAE,MAAM;KACnB;IACD,KAAK,EAAE;QACL,OAAO,EAAE,QAAQ;QACjB,MAAM,EAAE,gBAAgB;QACxB,YAAY,EAAE,KAAK;KACpB;IACD,MAAM,EAAE;QACN,OAAO,EAAE,aAAa;QACtB,eAAe,EAAE,SAAS;QAC1B,KAAK,EAAE,MAAM;QACb,MAAM,EAAE,MAAM;QACd,YAAY,EAAE,KAAK;QACnB,MAAM,EAAE,SAAS;KAClB;IACD,KAAK,EAAE;QACL,KAAK,EAAE,KAAK;QACZ,QAAQ,EAAE,QAAQ;KACnB;CACO,CAAA;AAEV,4BAA4B;AAC5B,MAAM,CAAC,MAAM,MAAM,GAAG,gBAAgB,CAAC,WAAW,CAAC,CAAA"}
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.3",
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
  }