@pixpilot/shadcn-auth 0.0.3 → 0.0.5

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.
@@ -0,0 +1 @@
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./ResetPasswordForm.cjs`),n=require(`./SignInForm.cjs`),r=require(`./SignUpForm.cjs`);let i=require(`react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`);a=e.__toESM(a);function o({handleSignIn:e,handleSignUp:o,handleResetPassword:s,authLoadingState:c,authErrorData:l}){let[u,d]=(0,i.useState)(`signin`);return(0,a.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-4`,children:(0,a.jsxs)(`div`,{className:`w-full max-w-md`,children:[(0,a.jsx)(`h1`,{className:`mb-6 text-center text-3xl font-bold`,children:`Job Hunter`}),u===`signin`&&(0,a.jsx)(n.SignInForm,{onSignIn:e,isLoading:c.isLoading,error:l?.error??null,onSwitchToSignUp:()=>d(`signup`),onSwitchToReset:()=>d(`reset`)}),u===`signup`&&(0,a.jsx)(r.SignUpForm,{onSignUp:o,isLoading:c.isLoading,error:l?.error??null,onSwitchToSignIn:()=>d(`signin`)}),u===`reset`&&(0,a.jsx)(t.ResetPasswordForm,{onResetPassword:s,isLoading:c.isLoading,error:l?.error??null,onSwitchToSignIn:()=>d(`signin`)})]})})}exports.AuthForms=o;
@@ -0,0 +1,23 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+
3
+ //#region src/AuthForms.d.ts
4
+ interface AuthFormsProps {
5
+ handleSignIn: (email: string, password: string) => Promise<void>;
6
+ handleSignUp: (email: string, password: string) => Promise<void>;
7
+ handleResetPassword: (email: string) => Promise<void>;
8
+ authLoadingState: {
9
+ isLoading: boolean;
10
+ };
11
+ authErrorData?: {
12
+ error: string;
13
+ } | null;
14
+ }
15
+ declare function AuthForms({
16
+ handleSignIn,
17
+ handleSignUp,
18
+ handleResetPassword,
19
+ authLoadingState,
20
+ authErrorData
21
+ }: AuthFormsProps): react_jsx_runtime0.JSX.Element;
22
+ //#endregion
23
+ export { AuthForms };
@@ -0,0 +1,23 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+
3
+ //#region src/AuthForms.d.ts
4
+ interface AuthFormsProps {
5
+ handleSignIn: (email: string, password: string) => Promise<void>;
6
+ handleSignUp: (email: string, password: string) => Promise<void>;
7
+ handleResetPassword: (email: string) => Promise<void>;
8
+ authLoadingState: {
9
+ isLoading: boolean;
10
+ };
11
+ authErrorData?: {
12
+ error: string;
13
+ } | null;
14
+ }
15
+ declare function AuthForms({
16
+ handleSignIn,
17
+ handleSignUp,
18
+ handleResetPassword,
19
+ authLoadingState,
20
+ authErrorData
21
+ }: AuthFormsProps): react_jsx_runtime0.JSX.Element;
22
+ //#endregion
23
+ export { AuthForms };
@@ -0,0 +1 @@
1
+ import{ResetPasswordForm as e}from"./ResetPasswordForm.js";import{SignInForm as t}from"./SignInForm.js";import{SignUpForm as n}from"./SignUpForm.js";import r,{useState as i}from"react";import{jsx as a,jsxs as o}from"react/jsx-runtime";function s({handleSignIn:r,handleSignUp:s,handleResetPassword:c,authLoadingState:l,authErrorData:u}){let[d,f]=i(`signin`);return a(`div`,{className:`flex min-h-screen items-center justify-center p-4`,children:o(`div`,{className:`w-full max-w-md`,children:[a(`h1`,{className:`mb-6 text-center text-3xl font-bold`,children:`Job Hunter`}),d===`signin`&&a(t,{onSignIn:r,isLoading:l.isLoading,error:u?.error??null,onSwitchToSignUp:()=>f(`signup`),onSwitchToReset:()=>f(`reset`)}),d===`signup`&&a(n,{onSignUp:s,isLoading:l.isLoading,error:u?.error??null,onSwitchToSignIn:()=>f(`signin`)}),d===`reset`&&a(e,{onResetPassword:c,isLoading:l.isLoading,error:u?.error??null,onSwitchToSignIn:()=>f(`signin`)})]})})}export{s as AuthForms};
@@ -0,0 +1 @@
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`react`);t=e.__toESM(t);let n=require(`@pixpilot/shadcn-ui`);n=e.__toESM(n);let r=require(`react/jsx-runtime`);r=e.__toESM(r);const i=({onGoogleSignIn:e,isLoading:t})=>(0,r.jsxs)(n.Button,{type:`button`,variant:`outline`,className:`w-full`,disabled:t,onClick:()=>{e().catch(console.error)},children:[(0,r.jsxs)(`svg`,{className:`mr-2 h-4 w-4`,viewBox:`0 0 24 24`,children:[(0,r.jsx)(`path`,{fill:`currentColor`,d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`}),(0,r.jsx)(`path`,{fill:`currentColor`,d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`}),(0,r.jsx)(`path`,{fill:`currentColor`,d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`}),(0,r.jsx)(`path`,{fill:`currentColor`,d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`})]}),`Sign in with Google`]});i.displayName=`GoogleSignIn`,exports.GoogleSignIn=i;
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+
3
+ //#region src/GoogleSignIn.d.ts
4
+ interface GoogleSignInProps {
5
+ onGoogleSignIn: () => Promise<void>;
6
+ isLoading?: boolean;
7
+ }
8
+ declare const GoogleSignIn: React.FC<GoogleSignInProps>;
9
+ //#endregion
10
+ export { GoogleSignIn, GoogleSignInProps };
@@ -0,0 +1,10 @@
1
+ import React from "react";
2
+
3
+ //#region src/GoogleSignIn.d.ts
4
+ interface GoogleSignInProps {
5
+ onGoogleSignIn: () => Promise<void>;
6
+ isLoading?: boolean;
7
+ }
8
+ declare const GoogleSignIn: React.FC<GoogleSignInProps>;
9
+ //#endregion
10
+ export { GoogleSignIn, GoogleSignInProps };
@@ -0,0 +1 @@
1
+ import e from"react";import{Button as t}from"@pixpilot/shadcn-ui";import{jsx as n,jsxs as r}from"react/jsx-runtime";const i=({onGoogleSignIn:e,isLoading:i})=>r(t,{type:`button`,variant:`outline`,className:`w-full`,disabled:i,onClick:()=>{e().catch(console.error)},children:[r(`svg`,{className:`mr-2 h-4 w-4`,viewBox:`0 0 24 24`,children:[n(`path`,{fill:`currentColor`,d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`}),n(`path`,{fill:`currentColor`,d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`}),n(`path`,{fill:`currentColor`,d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`}),n(`path`,{fill:`currentColor`,d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`})]}),`Sign in with Google`]});i.displayName=`GoogleSignIn`;export{i as GoogleSignIn};
@@ -0,0 +1 @@
1
+ "use client";const e=require(`./_virtual/rolldown_runtime.cjs`);let t=require(`react`);t=e.__toESM(t);let n=require(`@pixpilot/shadcn`);n=e.__toESM(n);let r=require(`@pixpilot/shadcn-ui`);r=e.__toESM(r);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`);a=e.__toESM(a);function o({onResetPassword:e,isLoading:o,error:s,onSwitchToSignIn:c}){let[l,u]=(0,t.useState)(``),[d,f]=(0,t.useState)(``),p=e=>{if(!e.trim())return f(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(f(``),!0):(f(`Please enter a valid email address`),!1)};return(0,a.jsx)(n.Card,{className:`mx-auto w-full max-w-md`,children:(0,a.jsxs)(n.CardContent,{className:`p-6`,children:[(0,a.jsx)(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Reset Password`}),s!=null&&s.trim()!==``&&(0,a.jsx)(r.Alert,{variant:`error`,description:s}),(0,a.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),p(l)&&e(l).catch(console.error)},className:`space-y-4`,children:[(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsx)(n.Label,{htmlFor:`email`,children:`Email`}),(0,a.jsx)(n.Input,{id:`email`,type:`email`,value:l,onChange:e=>{u(e.target.value),d&&f(``)},disabled:o,required:!0}),d&&(0,a.jsx)(`p`,{className:`text-destructive text-sm`,children:d})]}),(0,a.jsxs)(n.Button,{type:`submit`,className:`mt-6 w-full`,disabled:o,children:[o&&(0,a.jsx)(i.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),o?`Sending Reset Email...`:`Send Reset Email`]})]}),(0,a.jsx)(`div`,{className:`mt-4 text-center`,children:c&&(0,a.jsx)(`p`,{className:`text-sm`,children:(0,a.jsx)(n.Button,{variant:`link`,size:`sm`,onClick:c,disabled:o,className:`min-w-0 p-0 font-medium`,children:`Back to sign in`})})})]})})}exports.ResetPasswordForm=o;
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+
3
+ //#region src/ResetPasswordForm.d.ts
4
+ interface ResetPasswordFormProps {
5
+ onResetPassword: (email: string) => Promise<void>;
6
+ isLoading: boolean;
7
+ error: string | null;
8
+ onSwitchToSignIn?: () => void;
9
+ }
10
+ declare function ResetPasswordForm({
11
+ onResetPassword,
12
+ isLoading,
13
+ error,
14
+ onSwitchToSignIn
15
+ }: ResetPasswordFormProps): react_jsx_runtime0.JSX.Element;
16
+ //#endregion
17
+ export { ResetPasswordForm };
@@ -0,0 +1,17 @@
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+
3
+ //#region src/ResetPasswordForm.d.ts
4
+ interface ResetPasswordFormProps {
5
+ onResetPassword: (email: string) => Promise<void>;
6
+ isLoading: boolean;
7
+ error: string | null;
8
+ onSwitchToSignIn?: () => void;
9
+ }
10
+ declare function ResetPasswordForm({
11
+ onResetPassword,
12
+ isLoading,
13
+ error,
14
+ onSwitchToSignIn
15
+ }: ResetPasswordFormProps): react_jsx_runtime1.JSX.Element;
16
+ //#endregion
17
+ export { ResetPasswordForm };
@@ -0,0 +1 @@
1
+ "use client";import e,{useState as t}from"react";import{Button as n,Card as r,CardContent as i,Input as a,Label as o}from"@pixpilot/shadcn";import{Alert as s}from"@pixpilot/shadcn-ui";import{Loader2 as c}from"lucide-react";import{jsx as l,jsxs as u}from"react/jsx-runtime";function d({onResetPassword:e,isLoading:d,error:f,onSwitchToSignIn:p}){let[m,h]=t(``),[g,_]=t(``),v=e=>{if(!e.trim())return _(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(_(``),!0):(_(`Please enter a valid email address`),!1)};return l(r,{className:`mx-auto w-full max-w-md`,children:u(i,{className:`p-6`,children:[l(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Reset Password`}),f!=null&&f.trim()!==``&&l(s,{variant:`error`,description:f}),u(`form`,{onSubmit:t=>{t.preventDefault(),v(m)&&e(m).catch(console.error)},className:`space-y-4`,children:[u(`div`,{className:`space-y-2`,children:[l(o,{htmlFor:`email`,children:`Email`}),l(a,{id:`email`,type:`email`,value:m,onChange:e=>{h(e.target.value),g&&_(``)},disabled:d,required:!0}),g&&l(`p`,{className:`text-destructive text-sm`,children:g})]}),u(n,{type:`submit`,className:`mt-6 w-full`,disabled:d,children:[d&&l(c,{className:`mr-2 h-4 w-4 animate-spin`}),d?`Sending Reset Email...`:`Send Reset Email`]})]}),l(`div`,{className:`mt-4 text-center`,children:p&&l(`p`,{className:`text-sm`,children:l(n,{variant:`link`,size:`sm`,onClick:p,disabled:d,className:`min-w-0 p-0 font-medium`,children:`Back to sign in`})})})]})})}export{d as ResetPasswordForm};
@@ -0,0 +1 @@
1
+ "use client";const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./GoogleSignIn.cjs`);let n=require(`react`);n=e.__toESM(n);let r=require(`@pixpilot/shadcn`);r=e.__toESM(r);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`);a=e.__toESM(a);const o=6;function s({onSignIn:e,onGoogleSignIn:o,isLoading:s,error:c,onSwitchToSignUp:l,onSwitchToReset:u}){let[d,f]=(0,n.useState)(``),[p,m]=(0,n.useState)(``),[h,g]=(0,n.useState)(``),[_,v]=(0,n.useState)(``),y=e=>{if(!e.trim())return g(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(g(``),!0):(g(`Please enter a valid email address`),!1)},b=e=>e.trim()?e.length<6?(v(`Password must be at least 6 characters long`),!1):(v(``),!0):(v(`Password is required`),!1);return(0,a.jsx)(r.Card,{className:`mx-auto w-full max-w-md`,children:(0,a.jsxs)(r.CardContent,{className:`p-6`,children:[(0,a.jsx)(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign In`}),c!=null&&c.trim()!==``&&(0,a.jsx)(r.Alert,{variant:`destructive`,className:`mb-4`,children:(0,a.jsx)(r.AlertDescription,{children:c})}),(0,a.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),y(d)&&b(p)&&e(d,p).catch(console.error)},className:`space-y-4`,children:[(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsx)(r.Label,{htmlFor:`email`,children:`Email`}),(0,a.jsx)(r.Input,{id:`email`,type:`email`,value:d,onChange:e=>{f(e.target.value),h&&g(``)},disabled:s,required:!0,className:h?`border-destructive`:``}),h&&(0,a.jsx)(`p`,{className:`text-destructive text-sm`,children:h})]}),(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsx)(r.Label,{htmlFor:`password`,children:`Password`}),(0,a.jsx)(r.Input,{id:`password`,type:`password`,value:p,onChange:e=>{m(e.target.value),_&&v(``)},disabled:s,required:!0,className:_?`border-destructive`:``}),_&&(0,a.jsx)(`p`,{className:`text-destructive text-sm`,children:_})]}),(0,a.jsxs)(r.Button,{type:`submit`,className:`mt-6 w-full`,disabled:s,children:[s&&(0,a.jsx)(i.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),s?`Signing In...`:`Sign In`]})]}),o!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.OrContinueWithSeparator,{}),(0,a.jsx)(t.GoogleSignIn,{onGoogleSignIn:o,isLoading:s})]}),(0,a.jsx)(r.Separator,{className:`my-4`}),(0,a.jsxs)(`div`,{className:`space-y-2 text-center text-sm`,children:[l&&(0,a.jsxs)(`p`,{children:[`Don't have an account?`,` `,(0,a.jsx)(r.Button,{variant:`link`,size:`sm`,onClick:l,disabled:s,className:`h-auto p-0`,children:`Sign up`})]}),u&&(0,a.jsx)(`p`,{children:(0,a.jsx)(r.Button,{variant:`link`,size:`sm`,onClick:u,disabled:s,className:`h-auto p-0`,children:`Forgot your password?`})})]})]})})}exports.SignInForm=s;
@@ -0,0 +1,21 @@
1
+ import * as react_jsx_runtime1 from "react/jsx-runtime";
2
+
3
+ //#region src/SignInForm.d.ts
4
+ interface SignInFormProps {
5
+ onSignIn: (email: string, password: string) => Promise<void>;
6
+ onGoogleSignIn?: () => Promise<void>;
7
+ isLoading: boolean;
8
+ error: string | null;
9
+ onSwitchToSignUp?: () => void;
10
+ onSwitchToReset?: () => void;
11
+ }
12
+ declare function SignInForm({
13
+ onSignIn,
14
+ onGoogleSignIn,
15
+ isLoading,
16
+ error,
17
+ onSwitchToSignUp,
18
+ onSwitchToReset
19
+ }: SignInFormProps): react_jsx_runtime1.JSX.Element;
20
+ //#endregion
21
+ export { SignInForm };
@@ -0,0 +1,21 @@
1
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+
3
+ //#region src/SignInForm.d.ts
4
+ interface SignInFormProps {
5
+ onSignIn: (email: string, password: string) => Promise<void>;
6
+ onGoogleSignIn?: () => Promise<void>;
7
+ isLoading: boolean;
8
+ error: string | null;
9
+ onSwitchToSignUp?: () => void;
10
+ onSwitchToReset?: () => void;
11
+ }
12
+ declare function SignInForm({
13
+ onSignIn,
14
+ onGoogleSignIn,
15
+ isLoading,
16
+ error,
17
+ onSwitchToSignUp,
18
+ onSwitchToReset
19
+ }: SignInFormProps): react_jsx_runtime2.JSX.Element;
20
+ //#endregion
21
+ export { SignInForm };
@@ -0,0 +1 @@
1
+ "use client";import{GoogleSignIn as e}from"./GoogleSignIn.js";import t,{useState as n}from"react";import{Alert as r,AlertDescription as i,Button as a,Card as o,CardContent as s,Input as c,Label as l,OrContinueWithSeparator as u,Separator as d}from"@pixpilot/shadcn";import{Loader2 as f}from"lucide-react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";function g({onSignIn:t,onGoogleSignIn:g,isLoading:_,error:v,onSwitchToSignUp:y,onSwitchToReset:b}){let[x,S]=n(``),[C,w]=n(``),[T,E]=n(``),[D,O]=n(``),k=e=>{if(!e.trim())return E(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(E(``),!0):(E(`Please enter a valid email address`),!1)},A=e=>e.trim()?e.length<6?(O(`Password must be at least 6 characters long`),!1):(O(``),!0):(O(`Password is required`),!1);return m(o,{className:`mx-auto w-full max-w-md`,children:h(s,{className:`p-6`,children:[m(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign In`}),v!=null&&v.trim()!==``&&m(r,{variant:`destructive`,className:`mb-4`,children:m(i,{children:v})}),h(`form`,{onSubmit:e=>{e.preventDefault(),k(x)&&A(C)&&t(x,C).catch(console.error)},className:`space-y-4`,children:[h(`div`,{className:`space-y-2`,children:[m(l,{htmlFor:`email`,children:`Email`}),m(c,{id:`email`,type:`email`,value:x,onChange:e=>{S(e.target.value),T&&E(``)},disabled:_,required:!0,className:T?`border-destructive`:``}),T&&m(`p`,{className:`text-destructive text-sm`,children:T})]}),h(`div`,{className:`space-y-2`,children:[m(l,{htmlFor:`password`,children:`Password`}),m(c,{id:`password`,type:`password`,value:C,onChange:e=>{w(e.target.value),D&&O(``)},disabled:_,required:!0,className:D?`border-destructive`:``}),D&&m(`p`,{className:`text-destructive text-sm`,children:D})]}),h(a,{type:`submit`,className:`mt-6 w-full`,disabled:_,children:[_&&m(f,{className:`mr-2 h-4 w-4 animate-spin`}),_?`Signing In...`:`Sign In`]})]}),g!=null&&h(p,{children:[m(u,{}),m(e,{onGoogleSignIn:g,isLoading:_})]}),m(d,{className:`my-4`}),h(`div`,{className:`space-y-2 text-center text-sm`,children:[y&&h(`p`,{children:[`Don't have an account?`,` `,m(a,{variant:`link`,size:`sm`,onClick:y,disabled:_,className:`h-auto p-0`,children:`Sign up`})]}),b&&m(`p`,{children:m(a,{variant:`link`,size:`sm`,onClick:b,disabled:_,className:`h-auto p-0`,children:`Forgot your password?`})})]})]})})}export{g as SignInForm};
@@ -0,0 +1 @@
1
+ const e=require(`./_virtual/rolldown_runtime.cjs`),t=require(`./GoogleSignIn.cjs`);let n=require(`react`);n=e.__toESM(n);let r=require(`@pixpilot/shadcn`);r=e.__toESM(r);let i=require(`lucide-react`);i=e.__toESM(i);let a=require(`react/jsx-runtime`);a=e.__toESM(a);const o=6;function s({onSignUp:e,onGoogleSignIn:o,isLoading:s,error:c,onSwitchToSignIn:l}){let[u,d]=(0,n.useState)(``),[f,p]=(0,n.useState)(``),[m,h]=(0,n.useState)(``),[g,_]=(0,n.useState)(``),v=e=>{if(!e.trim())return h(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(h(``),!0):(h(`Please enter a valid email address`),!1)},y=e=>e.trim()?e.length<6?(_(`Password must be at least 6 characters long`),!1):(_(``),!0):(_(`Password is required`),!1);return(0,a.jsx)(r.Card,{className:`mx-auto w-full max-w-md`,children:(0,a.jsxs)(r.CardContent,{className:`p-6`,children:[(0,a.jsx)(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign Up`}),c!=null&&c.trim()!==``&&(0,a.jsx)(r.Alert,{variant:`destructive`,className:`mb-4`,children:(0,a.jsx)(r.AlertDescription,{children:c})}),(0,a.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),v(u)&&y(f)&&e(u,f).catch(console.error)},className:`space-y-4`,children:[(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsx)(r.Label,{htmlFor:`email`,children:`Email`}),(0,a.jsx)(r.Input,{id:`email`,type:`email`,value:u,onChange:e=>{d(e.target.value),m&&h(``)},disabled:s,required:!0,className:m?`border-destructive`:``}),m&&(0,a.jsx)(`p`,{className:`text-destructive text-sm`,children:m})]}),(0,a.jsxs)(`div`,{className:`space-y-2`,children:[(0,a.jsx)(r.Label,{htmlFor:`password`,children:`Password`}),(0,a.jsx)(r.Input,{id:`password`,type:`password`,value:f,onChange:e=>{p(e.target.value),g&&_(``)},disabled:s,required:!0,className:g?`border-destructive`:``}),g&&(0,a.jsx)(`p`,{className:`text-destructive text-sm`,children:g})]}),(0,a.jsxs)(r.Button,{type:`submit`,className:`mt-6 w-full`,disabled:s,children:[s&&(0,a.jsx)(i.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),s?`Signing Up...`:`Sign Up`]})]}),o!=null&&(0,a.jsxs)(a.Fragment,{children:[(0,a.jsx)(r.OrContinueWithSeparator,{}),(0,a.jsx)(t.GoogleSignIn,{onGoogleSignIn:o,isLoading:s})]}),(0,a.jsx)(r.Separator,{className:`my-4`}),(0,a.jsx)(`div`,{className:`text-center text-sm`,children:l&&(0,a.jsxs)(`p`,{children:[`Already have an account?`,` `,(0,a.jsx)(r.Button,{variant:`link`,size:`sm`,onClick:l,disabled:s,className:`h-auto p-0`,children:`Sign in`})]})})]})})}exports.SignUpForm=s;
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime2 from "react/jsx-runtime";
2
+
3
+ //#region src/SignUpForm.d.ts
4
+ interface SignUpFormProps {
5
+ onSignUp: (email: string, password: string) => Promise<void>;
6
+ onGoogleSignIn?: () => Promise<void>;
7
+ isLoading: boolean;
8
+ error: string | null;
9
+ onSwitchToSignIn?: () => void;
10
+ }
11
+ declare function SignUpForm({
12
+ onSignUp,
13
+ onGoogleSignIn,
14
+ isLoading,
15
+ error,
16
+ onSwitchToSignIn
17
+ }: SignUpFormProps): react_jsx_runtime2.JSX.Element;
18
+ //#endregion
19
+ export { SignUpForm };
@@ -0,0 +1,19 @@
1
+ import * as react_jsx_runtime0 from "react/jsx-runtime";
2
+
3
+ //#region src/SignUpForm.d.ts
4
+ interface SignUpFormProps {
5
+ onSignUp: (email: string, password: string) => Promise<void>;
6
+ onGoogleSignIn?: () => Promise<void>;
7
+ isLoading: boolean;
8
+ error: string | null;
9
+ onSwitchToSignIn?: () => void;
10
+ }
11
+ declare function SignUpForm({
12
+ onSignUp,
13
+ onGoogleSignIn,
14
+ isLoading,
15
+ error,
16
+ onSwitchToSignIn
17
+ }: SignUpFormProps): react_jsx_runtime0.JSX.Element;
18
+ //#endregion
19
+ export { SignUpForm };
@@ -0,0 +1 @@
1
+ import{GoogleSignIn as e}from"./GoogleSignIn.js";import t,{useState as n}from"react";import{Alert as r,AlertDescription as i,Button as a,Card as o,CardContent as s,Input as c,Label as l,OrContinueWithSeparator as u,Separator as d}from"@pixpilot/shadcn";import{Loader2 as f}from"lucide-react";import{Fragment as p,jsx as m,jsxs as h}from"react/jsx-runtime";function g({onSignUp:t,onGoogleSignIn:g,isLoading:_,error:v,onSwitchToSignIn:y}){let[b,x]=n(``),[S,C]=n(``),[w,T]=n(``),[E,D]=n(``),O=e=>{if(!e.trim())return T(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(T(``),!0):(T(`Please enter a valid email address`),!1)},k=e=>e.trim()?e.length<6?(D(`Password must be at least 6 characters long`),!1):(D(``),!0):(D(`Password is required`),!1);return m(o,{className:`mx-auto w-full max-w-md`,children:h(s,{className:`p-6`,children:[m(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign Up`}),v!=null&&v.trim()!==``&&m(r,{variant:`destructive`,className:`mb-4`,children:m(i,{children:v})}),h(`form`,{onSubmit:e=>{e.preventDefault(),O(b)&&k(S)&&t(b,S).catch(console.error)},className:`space-y-4`,children:[h(`div`,{className:`space-y-2`,children:[m(l,{htmlFor:`email`,children:`Email`}),m(c,{id:`email`,type:`email`,value:b,onChange:e=>{x(e.target.value),w&&T(``)},disabled:_,required:!0,className:w?`border-destructive`:``}),w&&m(`p`,{className:`text-destructive text-sm`,children:w})]}),h(`div`,{className:`space-y-2`,children:[m(l,{htmlFor:`password`,children:`Password`}),m(c,{id:`password`,type:`password`,value:S,onChange:e=>{C(e.target.value),E&&D(``)},disabled:_,required:!0,className:E?`border-destructive`:``}),E&&m(`p`,{className:`text-destructive text-sm`,children:E})]}),h(a,{type:`submit`,className:`mt-6 w-full`,disabled:_,children:[_&&m(f,{className:`mr-2 h-4 w-4 animate-spin`}),_?`Signing Up...`:`Sign Up`]})]}),g!=null&&h(p,{children:[m(u,{}),m(e,{onGoogleSignIn:g,isLoading:_})]}),m(d,{className:`my-4`}),m(`div`,{className:`text-center text-sm`,children:y&&h(`p`,{children:[`Already have an account?`,` `,m(a,{variant:`link`,size:`sm`,onClick:y,disabled:_,className:`h-auto p-0`,children:`Sign in`})]})})]})})}export{g as SignUpForm};
@@ -0,0 +1 @@
1
+ var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));exports.__toESM=s;
@@ -0,0 +1 @@
1
+ const e=require(`./ResetPasswordForm.cjs`),t=require(`./GoogleSignIn.cjs`),n=require(`./SignInForm.cjs`),r=require(`./SignUpForm.cjs`),i=require(`./AuthForms.cjs`);
@@ -0,0 +1,5 @@
1
+ import { AuthForms } from "./AuthForms.cjs";
2
+ import { GoogleSignIn, GoogleSignInProps } from "./GoogleSignIn.cjs";
3
+ import { ResetPasswordForm } from "./ResetPasswordForm.cjs";
4
+ import { SignInForm } from "./SignInForm.cjs";
5
+ import { SignUpForm } from "./SignUpForm.cjs";
@@ -0,0 +1,5 @@
1
+ import { AuthForms } from "./AuthForms.js";
2
+ import { GoogleSignIn, GoogleSignInProps } from "./GoogleSignIn.js";
3
+ import { ResetPasswordForm } from "./ResetPasswordForm.js";
4
+ import { SignInForm } from "./SignInForm.js";
5
+ import { SignUpForm } from "./SignUpForm.js";
@@ -0,0 +1 @@
1
+ import{ResetPasswordForm as e}from"./ResetPasswordForm.js";import{GoogleSignIn as t}from"./GoogleSignIn.js";import{SignInForm as n}from"./SignInForm.js";import{SignUpForm as r}from"./SignUpForm.js";import{AuthForms as i}from"./AuthForms.js";
package/dist/index.cjs CHANGED
@@ -1 +1 @@
1
- var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},s=(n,r,a)=>(a=n==null?{}:e(i(n)),o(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let c=require(`react`);c=s(c);let l=require(`@pixpilot/shadcn`),u=require(`@pixpilot/shadcn-ui`),d=require(`lucide-react`),f=require(`react/jsx-runtime`);function p({onResetPassword:e,isLoading:t,error:n,onSwitchToSignIn:r}){let[i,a]=(0,c.useState)(``),[o,s]=(0,c.useState)(``),p=e=>{if(!e.trim())return s(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(s(``),!0):(s(`Please enter a valid email address`),!1)};return(0,f.jsx)(l.Card,{className:`mx-auto w-full max-w-md`,children:(0,f.jsxs)(l.CardContent,{className:`p-6`,children:[(0,f.jsx)(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Reset Password`}),n!=null&&n.trim()!==``&&(0,f.jsx)(u.Alert,{variant:`error`,description:n}),(0,f.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),p(i)&&e(i).catch(console.error)},className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(l.Label,{htmlFor:`email`,children:`Email`}),(0,f.jsx)(l.Input,{id:`email`,type:`email`,value:i,onChange:e=>{a(e.target.value),o&&s(``)},disabled:t,required:!0}),o&&(0,f.jsx)(`p`,{className:`text-destructive text-sm`,children:o})]}),(0,f.jsxs)(l.Button,{type:`submit`,className:`mt-6 w-full`,disabled:t,children:[t&&(0,f.jsx)(d.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),t?`Sending Reset Email...`:`Send Reset Email`]})]}),(0,f.jsx)(`div`,{className:`mt-4 text-center`,children:r&&(0,f.jsx)(`p`,{className:`text-sm`,children:(0,f.jsx)(l.Button,{variant:`link`,size:`sm`,onClick:r,disabled:t,className:`min-w-0 p-0 font-medium`,children:`Back to sign in`})})})]})})}const m=({onGoogleSignIn:e,isLoading:t})=>(0,f.jsxs)(u.Button,{type:`button`,variant:`outline`,className:`w-full`,disabled:t,onClick:()=>{e().catch(console.error)},children:[(0,f.jsxs)(`svg`,{className:`mr-2 h-4 w-4`,viewBox:`0 0 24 24`,children:[(0,f.jsx)(`path`,{fill:`currentColor`,d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`}),(0,f.jsx)(`path`,{fill:`currentColor`,d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`})]}),`Sign in with Google`]});m.displayName=`GoogleSignIn`;const h=6;function g({onSignIn:e,onGoogleSignIn:t,isLoading:n,error:r,onSwitchToSignUp:i,onSwitchToReset:a}){let[o,s]=(0,c.useState)(``),[u,p]=(0,c.useState)(``),[h,g]=(0,c.useState)(``),[_,v]=(0,c.useState)(``),y=e=>{if(!e.trim())return g(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(g(``),!0):(g(`Please enter a valid email address`),!1)},b=e=>e.trim()?e.length<6?(v(`Password must be at least 6 characters long`),!1):(v(``),!0):(v(`Password is required`),!1);return(0,f.jsx)(l.Card,{className:`mx-auto w-full max-w-md`,children:(0,f.jsxs)(l.CardContent,{className:`p-6`,children:[(0,f.jsx)(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign In`}),r!=null&&r.trim()!==``&&(0,f.jsx)(l.Alert,{variant:`destructive`,className:`mb-4`,children:(0,f.jsx)(l.AlertDescription,{children:r})}),(0,f.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),y(o)&&b(u)&&e(o,u).catch(console.error)},className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(l.Label,{htmlFor:`email`,children:`Email`}),(0,f.jsx)(l.Input,{id:`email`,type:`email`,value:o,onChange:e=>{s(e.target.value),h&&g(``)},disabled:n,required:!0,className:h?`border-destructive`:``}),h&&(0,f.jsx)(`p`,{className:`text-destructive text-sm`,children:h})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(l.Label,{htmlFor:`password`,children:`Password`}),(0,f.jsx)(l.Input,{id:`password`,type:`password`,value:u,onChange:e=>{p(e.target.value),_&&v(``)},disabled:n,required:!0,className:_?`border-destructive`:``}),_&&(0,f.jsx)(`p`,{className:`text-destructive text-sm`,children:_})]}),(0,f.jsxs)(l.Button,{type:`submit`,className:`mt-6 w-full`,disabled:n,children:[n&&(0,f.jsx)(d.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),n?`Signing In...`:`Sign In`]})]}),t!=null&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.OrContinueWithSeparator,{}),(0,f.jsx)(m,{onGoogleSignIn:t,isLoading:n})]}),(0,f.jsx)(l.Separator,{className:`my-4`}),(0,f.jsxs)(`div`,{className:`space-y-2 text-center text-sm`,children:[i&&(0,f.jsxs)(`p`,{children:[`Don't have an account?`,` `,(0,f.jsx)(l.Button,{variant:`link`,size:`sm`,onClick:i,disabled:n,className:`h-auto p-0`,children:`Sign up`})]}),a&&(0,f.jsx)(`p`,{children:(0,f.jsx)(l.Button,{variant:`link`,size:`sm`,onClick:a,disabled:n,className:`h-auto p-0`,children:`Forgot your password?`})})]})]})})}const _=6;function v({onSignUp:e,onGoogleSignIn:t,isLoading:n,error:r,onSwitchToSignIn:i}){let[a,o]=(0,c.useState)(``),[s,u]=(0,c.useState)(``),[p,h]=(0,c.useState)(``),[g,_]=(0,c.useState)(``),v=e=>{if(!e.trim())return h(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(h(``),!0):(h(`Please enter a valid email address`),!1)},y=e=>e.trim()?e.length<6?(_(`Password must be at least 6 characters long`),!1):(_(``),!0):(_(`Password is required`),!1);return(0,f.jsx)(l.Card,{className:`mx-auto w-full max-w-md`,children:(0,f.jsxs)(l.CardContent,{className:`p-6`,children:[(0,f.jsx)(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign Up`}),r!=null&&r.trim()!==``&&(0,f.jsx)(l.Alert,{variant:`destructive`,className:`mb-4`,children:(0,f.jsx)(l.AlertDescription,{children:r})}),(0,f.jsxs)(`form`,{onSubmit:t=>{t.preventDefault(),v(a)&&y(s)&&e(a,s).catch(console.error)},className:`space-y-4`,children:[(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(l.Label,{htmlFor:`email`,children:`Email`}),(0,f.jsx)(l.Input,{id:`email`,type:`email`,value:a,onChange:e=>{o(e.target.value),p&&h(``)},disabled:n,required:!0,className:p?`border-destructive`:``}),p&&(0,f.jsx)(`p`,{className:`text-destructive text-sm`,children:p})]}),(0,f.jsxs)(`div`,{className:`space-y-2`,children:[(0,f.jsx)(l.Label,{htmlFor:`password`,children:`Password`}),(0,f.jsx)(l.Input,{id:`password`,type:`password`,value:s,onChange:e=>{u(e.target.value),g&&_(``)},disabled:n,required:!0,className:g?`border-destructive`:``}),g&&(0,f.jsx)(`p`,{className:`text-destructive text-sm`,children:g})]}),(0,f.jsxs)(l.Button,{type:`submit`,className:`mt-6 w-full`,disabled:n,children:[n&&(0,f.jsx)(d.Loader2,{className:`mr-2 h-4 w-4 animate-spin`}),n?`Signing Up...`:`Sign Up`]})]}),t!=null&&(0,f.jsxs)(f.Fragment,{children:[(0,f.jsx)(l.OrContinueWithSeparator,{}),(0,f.jsx)(m,{onGoogleSignIn:t,isLoading:n})]}),(0,f.jsx)(l.Separator,{className:`my-4`}),(0,f.jsx)(`div`,{className:`text-center text-sm`,children:i&&(0,f.jsxs)(`p`,{children:[`Already have an account?`,` `,(0,f.jsx)(l.Button,{variant:`link`,size:`sm`,onClick:i,disabled:n,className:`h-auto p-0`,children:`Sign in`})]})})]})})}function y({handleSignIn:e,handleSignUp:t,handleResetPassword:n,authLoadingState:r,authErrorData:i}){let[a,o]=(0,c.useState)(`signin`);return(0,f.jsx)(`div`,{className:`flex min-h-screen items-center justify-center p-4`,children:(0,f.jsxs)(`div`,{className:`w-full max-w-md`,children:[(0,f.jsx)(`h1`,{className:`mb-6 text-center text-3xl font-bold`,children:`Job Hunter`}),a===`signin`&&(0,f.jsx)(g,{onSignIn:e,isLoading:r.isLoading,error:i?.error??null,onSwitchToSignUp:()=>o(`signup`),onSwitchToReset:()=>o(`reset`)}),a===`signup`&&(0,f.jsx)(v,{onSignUp:t,isLoading:r.isLoading,error:i?.error??null,onSwitchToSignIn:()=>o(`signin`)}),a===`reset`&&(0,f.jsx)(p,{onResetPassword:n,isLoading:r.isLoading,error:i?.error??null,onSwitchToSignIn:()=>o(`signin`)})]})})}exports.AuthForms=y,exports.GoogleSignIn=m,exports.ResetPasswordForm=p,exports.SignInForm=g,exports.SignUpForm=v;
1
+ const e=require(`./ResetPasswordForm.cjs`),t=require(`./GoogleSignIn.cjs`),n=require(`./SignInForm.cjs`),r=require(`./SignUpForm.cjs`),i=require(`./AuthForms.cjs`);require(`./index copy.cjs`),exports.AuthForms=i.AuthForms,exports.GoogleSignIn=t.GoogleSignIn,exports.ResetPasswordForm=e.ResetPasswordForm,exports.SignInForm=n.SignInForm,exports.SignUpForm=r.SignUpForm;
@@ -0,0 +1,7 @@
1
+ import { AuthForms } from "./AuthForms.cjs";
2
+ import { GoogleSignIn, GoogleSignInProps } from "./GoogleSignIn.cjs";
3
+ import { ResetPasswordForm } from "./ResetPasswordForm.cjs";
4
+ import { SignInForm } from "./SignInForm.cjs";
5
+ import { SignUpForm } from "./SignUpForm.cjs";
6
+ import "./index copy.cjs";
7
+ export { AuthForms, GoogleSignIn, GoogleSignInProps, ResetPasswordForm, SignInForm, SignUpForm };
@@ -0,0 +1,7 @@
1
+ import { AuthForms } from "./AuthForms.js";
2
+ import { GoogleSignIn, GoogleSignInProps } from "./GoogleSignIn.js";
3
+ import { ResetPasswordForm } from "./ResetPasswordForm.js";
4
+ import { SignInForm } from "./SignInForm.js";
5
+ import { SignUpForm } from "./SignUpForm.js";
6
+ import "./index copy.js";
7
+ export { AuthForms, GoogleSignIn, GoogleSignInProps, ResetPasswordForm, SignInForm, SignUpForm };
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import e,{useState as t}from"react";import{Alert as n,AlertDescription as r,Button as i,Card as a,CardContent as o,Input as s,Label as c,OrContinueWithSeparator as l,Separator as u}from"@pixpilot/shadcn";import{Alert as d,Button as f}from"@pixpilot/shadcn-ui";import{Loader2 as p}from"lucide-react";import{Fragment as m,jsx as h,jsxs as g}from"react/jsx-runtime";function _({onResetPassword:e,isLoading:n,error:r,onSwitchToSignIn:l}){let[u,f]=t(``),[m,_]=t(``),v=e=>{if(!e.trim())return _(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(_(``),!0):(_(`Please enter a valid email address`),!1)};return h(a,{className:`mx-auto w-full max-w-md`,children:g(o,{className:`p-6`,children:[h(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Reset Password`}),r!=null&&r.trim()!==``&&h(d,{variant:`error`,description:r}),g(`form`,{onSubmit:t=>{t.preventDefault(),v(u)&&e(u).catch(console.error)},className:`space-y-4`,children:[g(`div`,{className:`space-y-2`,children:[h(c,{htmlFor:`email`,children:`Email`}),h(s,{id:`email`,type:`email`,value:u,onChange:e=>{f(e.target.value),m&&_(``)},disabled:n,required:!0}),m&&h(`p`,{className:`text-destructive text-sm`,children:m})]}),g(i,{type:`submit`,className:`mt-6 w-full`,disabled:n,children:[n&&h(p,{className:`mr-2 h-4 w-4 animate-spin`}),n?`Sending Reset Email...`:`Send Reset Email`]})]}),h(`div`,{className:`mt-4 text-center`,children:l&&h(`p`,{className:`text-sm`,children:h(i,{variant:`link`,size:`sm`,onClick:l,disabled:n,className:`min-w-0 p-0 font-medium`,children:`Back to sign in`})})})]})})}const v=({onGoogleSignIn:e,isLoading:t})=>g(f,{type:`button`,variant:`outline`,className:`w-full`,disabled:t,onClick:()=>{e().catch(console.error)},children:[g(`svg`,{className:`mr-2 h-4 w-4`,viewBox:`0 0 24 24`,children:[h(`path`,{fill:`currentColor`,d:`M22.56 12.25c0-.78-.07-1.53-.2-2.25H12v4.26h5.92c-.26 1.37-1.04 2.53-2.21 3.31v2.77h3.57c2.08-1.92 3.28-4.74 3.28-8.09z`}),h(`path`,{fill:`currentColor`,d:`M12 23c2.97 0 5.46-.98 7.28-2.66l-3.57-2.77c-.98.66-2.23 1.06-3.71 1.06-2.86 0-5.29-1.93-6.16-4.53H2.18v2.84C3.99 20.53 7.7 23 12 23z`}),h(`path`,{fill:`currentColor`,d:`M5.84 14.09c-.22-.66-.35-1.36-.35-2.09s.13-1.43.35-2.09V7.07H2.18C1.43 8.55 1 10.22 1 12s.43 3.45 1.18 4.93l2.85-2.22.81-.62z`}),h(`path`,{fill:`currentColor`,d:`M12 5.38c1.62 0 3.06.56 4.21 1.64l3.15-3.15C17.45 2.09 14.97 1 12 1 7.7 1 3.99 3.47 2.18 7.07l3.66 2.84c.87-2.6 3.3-4.53 6.16-4.53z`})]}),`Sign in with Google`]});v.displayName=`GoogleSignIn`;function y({onSignIn:e,onGoogleSignIn:d,isLoading:f,error:_,onSwitchToSignUp:y,onSwitchToReset:b}){let[x,S]=t(``),[C,w]=t(``),[T,E]=t(``),[D,O]=t(``),k=e=>{if(!e.trim())return E(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(E(``),!0):(E(`Please enter a valid email address`),!1)},A=e=>e.trim()?e.length<6?(O(`Password must be at least 6 characters long`),!1):(O(``),!0):(O(`Password is required`),!1);return h(a,{className:`mx-auto w-full max-w-md`,children:g(o,{className:`p-6`,children:[h(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign In`}),_!=null&&_.trim()!==``&&h(n,{variant:`destructive`,className:`mb-4`,children:h(r,{children:_})}),g(`form`,{onSubmit:t=>{t.preventDefault(),k(x)&&A(C)&&e(x,C).catch(console.error)},className:`space-y-4`,children:[g(`div`,{className:`space-y-2`,children:[h(c,{htmlFor:`email`,children:`Email`}),h(s,{id:`email`,type:`email`,value:x,onChange:e=>{S(e.target.value),T&&E(``)},disabled:f,required:!0,className:T?`border-destructive`:``}),T&&h(`p`,{className:`text-destructive text-sm`,children:T})]}),g(`div`,{className:`space-y-2`,children:[h(c,{htmlFor:`password`,children:`Password`}),h(s,{id:`password`,type:`password`,value:C,onChange:e=>{w(e.target.value),D&&O(``)},disabled:f,required:!0,className:D?`border-destructive`:``}),D&&h(`p`,{className:`text-destructive text-sm`,children:D})]}),g(i,{type:`submit`,className:`mt-6 w-full`,disabled:f,children:[f&&h(p,{className:`mr-2 h-4 w-4 animate-spin`}),f?`Signing In...`:`Sign In`]})]}),d!=null&&g(m,{children:[h(l,{}),h(v,{onGoogleSignIn:d,isLoading:f})]}),h(u,{className:`my-4`}),g(`div`,{className:`space-y-2 text-center text-sm`,children:[y&&g(`p`,{children:[`Don't have an account?`,` `,h(i,{variant:`link`,size:`sm`,onClick:y,disabled:f,className:`h-auto p-0`,children:`Sign up`})]}),b&&h(`p`,{children:h(i,{variant:`link`,size:`sm`,onClick:b,disabled:f,className:`h-auto p-0`,children:`Forgot your password?`})})]})]})})}function b({onSignUp:e,onGoogleSignIn:d,isLoading:f,error:_,onSwitchToSignIn:y}){let[b,x]=t(``),[S,C]=t(``),[w,T]=t(``),[E,D]=t(``),O=e=>{if(!e.trim())return T(`Email is required`),!1;let t=document.createElement(`input`);return t.type=`email`,t.value=e,t.validity.valid?(T(``),!0):(T(`Please enter a valid email address`),!1)},k=e=>e.trim()?e.length<6?(D(`Password must be at least 6 characters long`),!1):(D(``),!0):(D(`Password is required`),!1);return h(a,{className:`mx-auto w-full max-w-md`,children:g(o,{className:`p-6`,children:[h(`h2`,{className:`mb-4 text-center text-2xl font-bold`,children:`Sign Up`}),_!=null&&_.trim()!==``&&h(n,{variant:`destructive`,className:`mb-4`,children:h(r,{children:_})}),g(`form`,{onSubmit:t=>{t.preventDefault(),O(b)&&k(S)&&e(b,S).catch(console.error)},className:`space-y-4`,children:[g(`div`,{className:`space-y-2`,children:[h(c,{htmlFor:`email`,children:`Email`}),h(s,{id:`email`,type:`email`,value:b,onChange:e=>{x(e.target.value),w&&T(``)},disabled:f,required:!0,className:w?`border-destructive`:``}),w&&h(`p`,{className:`text-destructive text-sm`,children:w})]}),g(`div`,{className:`space-y-2`,children:[h(c,{htmlFor:`password`,children:`Password`}),h(s,{id:`password`,type:`password`,value:S,onChange:e=>{C(e.target.value),E&&D(``)},disabled:f,required:!0,className:E?`border-destructive`:``}),E&&h(`p`,{className:`text-destructive text-sm`,children:E})]}),g(i,{type:`submit`,className:`mt-6 w-full`,disabled:f,children:[f&&h(p,{className:`mr-2 h-4 w-4 animate-spin`}),f?`Signing Up...`:`Sign Up`]})]}),d!=null&&g(m,{children:[h(l,{}),h(v,{onGoogleSignIn:d,isLoading:f})]}),h(u,{className:`my-4`}),h(`div`,{className:`text-center text-sm`,children:y&&g(`p`,{children:[`Already have an account?`,` `,h(i,{variant:`link`,size:`sm`,onClick:y,disabled:f,className:`h-auto p-0`,children:`Sign in`})]})})]})})}function x({handleSignIn:e,handleSignUp:n,handleResetPassword:r,authLoadingState:i,authErrorData:a}){let[o,s]=t(`signin`);return h(`div`,{className:`flex min-h-screen items-center justify-center p-4`,children:g(`div`,{className:`w-full max-w-md`,children:[h(`h1`,{className:`mb-6 text-center text-3xl font-bold`,children:`Job Hunter`}),o===`signin`&&h(y,{onSignIn:e,isLoading:i.isLoading,error:a?.error??null,onSwitchToSignUp:()=>s(`signup`),onSwitchToReset:()=>s(`reset`)}),o===`signup`&&h(b,{onSignUp:n,isLoading:i.isLoading,error:a?.error??null,onSwitchToSignIn:()=>s(`signin`)}),o===`reset`&&h(_,{onResetPassword:r,isLoading:i.isLoading,error:a?.error??null,onSwitchToSignIn:()=>s(`signin`)})]})})}export{x as AuthForms,v as GoogleSignIn,_ as ResetPasswordForm,y as SignInForm,b as SignUpForm};
1
+ import{ResetPasswordForm as e}from"./ResetPasswordForm.js";import{GoogleSignIn as t}from"./GoogleSignIn.js";import{SignInForm as n}from"./SignInForm.js";import{SignUpForm as r}from"./SignUpForm.js";import{AuthForms as i}from"./AuthForms.js";import"./index copy.js";export{i as AuthForms,t as GoogleSignIn,e as ResetPasswordForm,n as SignInForm,r as SignUpForm};
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@pixpilot/shadcn-auth",
3
3
  "type": "module",
4
- "version": "0.0.3",
4
+ "version": "0.0.5",
5
5
  "description": "Authentication forms and components built with shadcn/ui.",
6
6
  "author": "m.doaie <m.doaie@hotmail.com>",
7
7
  "license": "MIT",
@@ -30,8 +30,8 @@
30
30
  },
31
31
  "dependencies": {
32
32
  "lucide-react": "0.553.0",
33
- "@pixpilot/shadcn": "0.1.7",
34
- "@pixpilot/shadcn-ui": "0.0.3"
33
+ "@pixpilot/shadcn": "0.1.9",
34
+ "@pixpilot/shadcn-ui": "0.0.5"
35
35
  },
36
36
  "devDependencies": {
37
37
  "@storybook/react": "^8.5.3",
@@ -44,11 +44,11 @@
44
44
  "tsdown": "^0.15.8",
45
45
  "typescript": "^5.9.3",
46
46
  "typescript-eslint": "^8.46.3",
47
- "@internal/prettier-config": "0.0.1",
48
47
  "@internal/eslint-config": "0.3.0",
49
- "@internal/tsconfig": "0.1.0",
48
+ "@internal/prettier-config": "0.0.1",
50
49
  "@internal/tsdown-config": "0.1.0",
51
- "@internal/vitest-config": "0.1.0"
50
+ "@internal/vitest-config": "0.1.0",
51
+ "@internal/tsconfig": "0.1.0"
52
52
  },
53
53
  "prettier": "@internal/prettier-config",
54
54
  "scripts": {
@@ -1,79 +0,0 @@
1
- import * as react_jsx_runtime0 from "react/jsx-runtime";
2
- import React from "react";
3
-
4
- //#region src/AuthForms.d.ts
5
- interface AuthFormsProps {
6
- handleSignIn: (email: string, password: string) => Promise<void>;
7
- handleSignUp: (email: string, password: string) => Promise<void>;
8
- handleResetPassword: (email: string) => Promise<void>;
9
- authLoadingState: {
10
- isLoading: boolean;
11
- };
12
- authErrorData?: {
13
- error: string;
14
- } | null;
15
- }
16
- declare function AuthForms({
17
- handleSignIn,
18
- handleSignUp,
19
- handleResetPassword,
20
- authLoadingState,
21
- authErrorData
22
- }: AuthFormsProps): react_jsx_runtime0.JSX.Element;
23
- //#endregion
24
- //#region src/GoogleSignIn.d.ts
25
- interface GoogleSignInProps {
26
- onGoogleSignIn: () => Promise<void>;
27
- isLoading?: boolean;
28
- }
29
- declare const GoogleSignIn: React.FC<GoogleSignInProps>;
30
- //#endregion
31
- //#region src/ResetPasswordForm.d.ts
32
- interface ResetPasswordFormProps {
33
- onResetPassword: (email: string) => Promise<void>;
34
- isLoading: boolean;
35
- error: string | null;
36
- onSwitchToSignIn?: () => void;
37
- }
38
- declare function ResetPasswordForm({
39
- onResetPassword,
40
- isLoading,
41
- error,
42
- onSwitchToSignIn
43
- }: ResetPasswordFormProps): react_jsx_runtime0.JSX.Element;
44
- //#endregion
45
- //#region src/SignInForm.d.ts
46
- interface SignInFormProps {
47
- onSignIn: (email: string, password: string) => Promise<void>;
48
- onGoogleSignIn?: () => Promise<void>;
49
- isLoading: boolean;
50
- error: string | null;
51
- onSwitchToSignUp?: () => void;
52
- onSwitchToReset?: () => void;
53
- }
54
- declare function SignInForm({
55
- onSignIn,
56
- onGoogleSignIn,
57
- isLoading,
58
- error,
59
- onSwitchToSignUp,
60
- onSwitchToReset
61
- }: SignInFormProps): react_jsx_runtime0.JSX.Element;
62
- //#endregion
63
- //#region src/SignUpForm.d.ts
64
- interface SignUpFormProps {
65
- onSignUp: (email: string, password: string) => Promise<void>;
66
- onGoogleSignIn?: () => Promise<void>;
67
- isLoading: boolean;
68
- error: string | null;
69
- onSwitchToSignIn?: () => void;
70
- }
71
- declare function SignUpForm({
72
- onSignUp,
73
- onGoogleSignIn,
74
- isLoading,
75
- error,
76
- onSwitchToSignIn
77
- }: SignUpFormProps): react_jsx_runtime0.JSX.Element;
78
- //#endregion
79
- export { AuthForms, GoogleSignIn, GoogleSignInProps, ResetPasswordForm, SignInForm, SignUpForm };
@@ -1,79 +0,0 @@
1
- import React from "react";
2
- import * as react_jsx_runtime0 from "react/jsx-runtime";
3
-
4
- //#region src/AuthForms.d.ts
5
- interface AuthFormsProps {
6
- handleSignIn: (email: string, password: string) => Promise<void>;
7
- handleSignUp: (email: string, password: string) => Promise<void>;
8
- handleResetPassword: (email: string) => Promise<void>;
9
- authLoadingState: {
10
- isLoading: boolean;
11
- };
12
- authErrorData?: {
13
- error: string;
14
- } | null;
15
- }
16
- declare function AuthForms({
17
- handleSignIn,
18
- handleSignUp,
19
- handleResetPassword,
20
- authLoadingState,
21
- authErrorData
22
- }: AuthFormsProps): react_jsx_runtime0.JSX.Element;
23
- //#endregion
24
- //#region src/GoogleSignIn.d.ts
25
- interface GoogleSignInProps {
26
- onGoogleSignIn: () => Promise<void>;
27
- isLoading?: boolean;
28
- }
29
- declare const GoogleSignIn: React.FC<GoogleSignInProps>;
30
- //#endregion
31
- //#region src/ResetPasswordForm.d.ts
32
- interface ResetPasswordFormProps {
33
- onResetPassword: (email: string) => Promise<void>;
34
- isLoading: boolean;
35
- error: string | null;
36
- onSwitchToSignIn?: () => void;
37
- }
38
- declare function ResetPasswordForm({
39
- onResetPassword,
40
- isLoading,
41
- error,
42
- onSwitchToSignIn
43
- }: ResetPasswordFormProps): react_jsx_runtime0.JSX.Element;
44
- //#endregion
45
- //#region src/SignInForm.d.ts
46
- interface SignInFormProps {
47
- onSignIn: (email: string, password: string) => Promise<void>;
48
- onGoogleSignIn?: () => Promise<void>;
49
- isLoading: boolean;
50
- error: string | null;
51
- onSwitchToSignUp?: () => void;
52
- onSwitchToReset?: () => void;
53
- }
54
- declare function SignInForm({
55
- onSignIn,
56
- onGoogleSignIn,
57
- isLoading,
58
- error,
59
- onSwitchToSignUp,
60
- onSwitchToReset
61
- }: SignInFormProps): react_jsx_runtime0.JSX.Element;
62
- //#endregion
63
- //#region src/SignUpForm.d.ts
64
- interface SignUpFormProps {
65
- onSignUp: (email: string, password: string) => Promise<void>;
66
- onGoogleSignIn?: () => Promise<void>;
67
- isLoading: boolean;
68
- error: string | null;
69
- onSwitchToSignIn?: () => void;
70
- }
71
- declare function SignUpForm({
72
- onSignUp,
73
- onGoogleSignIn,
74
- isLoading,
75
- error,
76
- onSwitchToSignIn
77
- }: SignUpFormProps): react_jsx_runtime0.JSX.Element;
78
- //#endregion
79
- export { AuthForms, GoogleSignIn, GoogleSignInProps, ResetPasswordForm, SignInForm, SignUpForm };