@slyxup/ui 0.1.0 → 0.2.1
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/.turbo/turbo-build.log +4 -0
- package/CHANGELOG.md +27 -0
- package/LICENSE +21 -0
- package/README.md +105 -0
- package/dist/components/BillingPortal/BillingPortal.d.ts +22 -0
- package/dist/components/BillingPortal/BillingPortal.d.ts.map +1 -0
- package/dist/components/BillingPortal/BillingPortal.js +59 -0
- package/dist/components/BillingPortal/BillingPortal.js.map +1 -0
- package/dist/components/EmailVerification/EmailVerification.d.ts +9 -0
- package/dist/components/EmailVerification/EmailVerification.d.ts.map +1 -0
- package/dist/components/EmailVerification/EmailVerification.js +72 -0
- package/dist/components/EmailVerification/EmailVerification.js.map +1 -0
- package/dist/components/ForgotPassword/ForgotPassword.d.ts +8 -0
- package/dist/components/ForgotPassword/ForgotPassword.d.ts.map +1 -0
- package/dist/components/ForgotPassword/ForgotPassword.js +43 -0
- package/dist/components/ForgotPassword/ForgotPassword.js.map +1 -0
- package/dist/components/PricingTable/PricingTable.d.ts +19 -0
- package/dist/components/PricingTable/PricingTable.d.ts.map +1 -0
- package/dist/components/PricingTable/PricingTable.js +52 -0
- package/dist/components/PricingTable/PricingTable.js.map +1 -0
- package/dist/components/ResetPassword/ResetPassword.d.ts +9 -0
- package/dist/components/ResetPassword/ResetPassword.d.ts.map +1 -0
- package/dist/components/ResetPassword/ResetPassword.js +50 -0
- package/dist/components/ResetPassword/ResetPassword.js.map +1 -0
- package/dist/components/SignIn/SignIn.d.ts +11 -0
- package/dist/components/SignIn/SignIn.d.ts.map +1 -0
- package/dist/components/SignIn/SignIn.js +53 -0
- package/dist/components/SignIn/SignIn.js.map +1 -0
- package/dist/components/SignUp/SignUp.d.ts +8 -0
- package/dist/components/SignUp/SignUp.d.ts.map +1 -0
- package/dist/components/SignUp/SignUp.js +54 -0
- package/dist/components/SignUp/SignUp.js.map +1 -0
- package/dist/components/SocialButtons/SocialButtons.d.ts +9 -0
- package/dist/components/SocialButtons/SocialButtons.d.ts.map +1 -0
- package/dist/components/SocialButtons/SocialButtons.js +16 -0
- package/dist/components/SocialButtons/SocialButtons.js.map +1 -0
- package/dist/components/UserButton/UserButton.d.ts +3 -0
- package/dist/components/UserButton/UserButton.d.ts.map +1 -0
- package/dist/components/UserButton/UserButton.js +43 -0
- package/dist/components/UserButton/UserButton.js.map +1 -0
- package/dist/components/UserProfile/UserProfile.d.ts +3 -0
- package/dist/components/UserProfile/UserProfile.d.ts.map +1 -0
- package/dist/components/UserProfile/UserProfile.js +38 -0
- package/dist/components/UserProfile/UserProfile.js.map +1 -0
- package/dist/icons.d.ts +6 -0
- package/dist/icons.d.ts.map +1 -0
- package/dist/icons.js +15 -0
- package/dist/icons.js.map +1 -0
- package/dist/index.d.ts +15 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +22 -1
- package/dist/index.js.map +1 -1
- package/dist/styles.d.ts +9 -0
- package/dist/styles.d.ts.map +1 -0
- package/dist/styles.js +219 -0
- package/dist/styles.js.map +1 -0
- package/package.json +35 -3
- package/src/components/BillingPortal/BillingPortal.tsx +182 -0
- package/src/components/EmailVerification/EmailVerification.tsx +180 -0
- package/src/components/ForgotPassword/ForgotPassword.tsx +122 -0
- package/src/components/PricingTable/PricingTable.tsx +155 -0
- package/src/components/ResetPassword/ResetPassword.tsx +120 -0
- package/src/components/SignIn/SignIn.tsx +168 -0
- package/src/components/SignUp/SignUp.tsx +181 -0
- package/src/components/SocialButtons/SocialButtons.tsx +39 -0
- package/src/components/UserButton/UserButton.tsx +89 -0
- package/src/components/UserProfile/UserProfile.tsx +93 -0
- package/src/icons.tsx +71 -0
- package/src/index.ts +37 -1
- package/src/styles.ts +221 -0
- package/test/components.test.tsx +135 -0
- package/test/icons.test.tsx +32 -0
- package/test/styles.test.ts +47 -0
- package/vitest.config.ts +2 -0
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { SlyxupError } from '@slyxup/core';
|
|
3
|
+
import { useAuth } from '@slyxup/react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { GitHubIcon, GoogleIcon, KeyholeMark } from '../../icons';
|
|
6
|
+
/** Email/password + OAuth sign-in card. */
|
|
7
|
+
export function SignIn({ social = true, onSuccess, onSignUpClick, }) {
|
|
8
|
+
const { signIn, client } = useAuth();
|
|
9
|
+
const [email, setEmail] = useState('');
|
|
10
|
+
const [password, setPassword] = useState('');
|
|
11
|
+
const [busy, setBusy] = useState(false);
|
|
12
|
+
const [error, setError] = useState(null);
|
|
13
|
+
const cardRef = useRef(null);
|
|
14
|
+
useEffect(() => {
|
|
15
|
+
if (error) {
|
|
16
|
+
const t = setTimeout(() => setError(null), 4000);
|
|
17
|
+
return () => clearTimeout(t);
|
|
18
|
+
}
|
|
19
|
+
}, [error]);
|
|
20
|
+
async function onSubmit(e) {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
setBusy(true);
|
|
23
|
+
setError(null);
|
|
24
|
+
try {
|
|
25
|
+
await signIn({ email, password });
|
|
26
|
+
onSuccess?.();
|
|
27
|
+
}
|
|
28
|
+
catch (err) {
|
|
29
|
+
setError(err instanceof SlyxupError
|
|
30
|
+
? err.message
|
|
31
|
+
: 'Something went wrong. Try again.');
|
|
32
|
+
}
|
|
33
|
+
finally {
|
|
34
|
+
setBusy(false);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
function oauth(provider) {
|
|
38
|
+
window.location.href = `/v1/oauth/${provider}`;
|
|
39
|
+
}
|
|
40
|
+
const missingKey = !client.publishableKey ||
|
|
41
|
+
client.publishableKey === 'pk_test_missing' ||
|
|
42
|
+
client.publishableKey.includes('REPLACE');
|
|
43
|
+
return (_jsxs("div", { ref: cardRef, className: `slx-card${error ? ' slx-card-error' : ''}`, children: [missingKey && (_jsxs("p", { style: {
|
|
44
|
+
fontSize: 12,
|
|
45
|
+
background: '#fff3cd',
|
|
46
|
+
border: '1px solid #ffe69c',
|
|
47
|
+
borderRadius: 8,
|
|
48
|
+
padding: '8px 10px',
|
|
49
|
+
marginBottom: 14,
|
|
50
|
+
lineHeight: 1.4,
|
|
51
|
+
}, children: [_jsx("strong", { children: "Setup:" }), " Add", ' ', _jsx("code", { children: "NEXT_PUBLIC_SLYXUP_PUBLISHABLE_KEY" }), " to", ' ', _jsx("code", { children: ".env.local" }), " \u2014 run ", _jsx("code", { children: "npx @slyxup/cli keys create" })] })), _jsx("div", { className: "slx-mark", children: _jsx(KeyholeMark, {}) }), _jsx("h1", { className: "slx-title", children: "Sign in" }), _jsx("p", { className: "slx-subtitle", children: "Welcome back. Enter your details to continue." }), social && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "slx-social", children: [_jsxs("button", { type: "button", className: "slx-social-btn", onClick: () => oauth('google'), children: [_jsx(GoogleIcon, {}), " Continue with Google"] }), _jsxs("button", { type: "button", className: "slx-social-btn", onClick: () => oauth('github'), children: [_jsx(GitHubIcon, {}), " Continue with GitHub"] })] }), _jsx("div", { className: "slx-divider", children: "or" })] })), error && (_jsx("p", { className: "slx-error-text", role: "alert", children: error })), _jsxs("form", { onSubmit: onSubmit, noValidate: false, children: [_jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-signin-email", children: "Email" }), _jsx("input", { id: "slx-signin-email", className: "slx-input", type: "email", autoComplete: "email", placeholder: "you@example.com", value: email, onChange: (e) => setEmail(e.target.value), required: true })] }), _jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-signin-password", children: "Password" }), _jsx("input", { id: "slx-signin-password", className: "slx-input", type: "password", autoComplete: "current-password", placeholder: "\u2022\u2022\u2022\u2022\u2022\u2022\u2022\u2022", value: password, onChange: (e) => setPassword(e.target.value), required: true, minLength: 8 })] }), _jsxs("button", { className: "slx-btn", type: "submit", disabled: busy, children: [busy && _jsx("span", { className: "slx-spinner", "aria-hidden": "true" }), busy ? 'Signing in…' : 'Sign in'] })] }), onSignUpClick && (_jsxs("p", { className: "slx-footer", children: ["Don't have an account?", ' ', _jsx("button", { type: "button", className: "slx-link", onClick: onSignUpClick, children: "Sign up" })] }))] }));
|
|
52
|
+
}
|
|
53
|
+
//# sourceMappingURL=SignIn.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignIn.js","sourceRoot":"","sources":["../../../src/components/SignIn/SignIn.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAWlE,2CAA2C;AAC3C,MAAM,UAAU,MAAM,CAAC,EACrB,MAAM,GAAG,IAAI,EACb,SAAS,EACT,aAAa,GACD;IACZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAGjC,CAAC;IACF,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IACvC,MAAM,CAAC,QAAQ,EAAE,WAAW,CAAC,GAAG,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC7C,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAC,KAAK,CAAC,CAAC;IACxC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,QAAQ,CAAgB,IAAI,CAAC,CAAC;IACxD,MAAM,OAAO,GAAG,MAAM,CAAiB,IAAI,CAAC,CAAC;IAE7C,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,KAAK,EAAE,CAAC;YACV,MAAM,CAAC,GAAG,UAAU,CAAC,GAAG,EAAE,CAAC,QA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ACxB,gBAAO,SAAS,EAAC,WAAW,EAAC,OAAO,EAAC,qBAAqB,yBAElD,EACR,gBACE,EAAE,EAAC,qBAAqB,EACxB,SAAS,EAAC,WAAW,EACrB,IAAI,EAAC,UAAU,EACf,YAAY,EAAC,kBAAkB,EAC/B,WAAW,EAAC,kDAAU,EACtB,KAAK,EAAE,QAAQ,EACf,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,WAAW,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,EAC5C,QAAQ,QACR,SAAS,EAAE,CAAC,GACZ,IACE,EACN,kBAAQ,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,aACrD,IAAI,IAAI,eAAM,SAAS,EAAC,aAAa,iBAAa,MAAM,GAAG,EAC3D,IAAI,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,SAAS,IAC1B,IACJ,EAEN,aAAa,IAAI,CAChB,aAAG,SAAS,EAAC,YAAY,uCACK,GAAG,EAC/B,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,UAAU,EAAC,OAAO,EAAE,aAAa,wBAExD,IACP,CACL,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export interface SignUpProps {
|
|
2
|
+
social?: boolean;
|
|
3
|
+
onSuccess?: () => void;
|
|
4
|
+
onSignInClick?: () => void;
|
|
5
|
+
}
|
|
6
|
+
/** Email/password + OAuth sign-up card. */
|
|
7
|
+
export declare function SignUp({ social, onSuccess, onSignInClick, }: SignUpProps): import("react").JSX.Element;
|
|
8
|
+
//# sourceMappingURL=SignUp.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUp.d.ts","sourceRoot":"","sources":["../../../src/components/SignUp/SignUp.tsx"],"names":[],"mappings":"AAKA,MAAM,WAAW,WAAW;IAC1B,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB,SAAS,CAAC,EAAE,MAAM,IAAI,CAAC;IACvB,aAAa,CAAC,EAAE,MAAM,IAAI,CAAC;CAC5B;AAED,2CAA2C;AAC3C,wBAAgB,MAAM,CAAC,EACrB,MAAa,EACb,SAAS,EACT,aAAa,GACd,EAAE,WAAW,+BAoKb"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { SlyxupError } from '@slyxup/core';
|
|
3
|
+
import { useAuth } from '@slyxup/react';
|
|
4
|
+
import { useEffect, useRef, useState } from 'react';
|
|
5
|
+
import { GitHubIcon, GoogleIcon, KeyholeMark } from '../../icons';
|
|
6
|
+
/** Email/password + OAuth sign-up card. */
|
|
7
|
+
export function SignUp({ social = true, onSuccess, onSignInClick, }) {
|
|
8
|
+
const { signUp, client } = useAuth();
|
|
9
|
+
const [firstName, setFirstName] = useState('');
|
|
10
|
+
const [email, setEmail] = useState('');
|
|
11
|
+
const [password, setPassword] = useState('');
|
|
12
|
+
const [busy, setBusy] = useState(false);
|
|
13
|
+
const [error, setError] = useState(null);
|
|
14
|
+
const cardRef = useRef(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
if (error) {
|
|
17
|
+
const t = setTimeout(() => setError(null), 4000);
|
|
18
|
+
return () => clearTimeout(t);
|
|
19
|
+
}
|
|
20
|
+
}, [error]);
|
|
21
|
+
async function onSubmit(e) {
|
|
22
|
+
e.preventDefault();
|
|
23
|
+
setBusy(true);
|
|
24
|
+
setError(null);
|
|
25
|
+
try {
|
|
26
|
+
await signUp({ email, password, firstName: firstName || undefined });
|
|
27
|
+
onSuccess?.();
|
|
28
|
+
}
|
|
29
|
+
catch (err) {
|
|
30
|
+
setError(err instanceof SlyxupError
|
|
31
|
+
? err.message
|
|
32
|
+
: 'Something went wrong. Try again.');
|
|
33
|
+
}
|
|
34
|
+
finally {
|
|
35
|
+
setBusy(false);
|
|
36
|
+
}
|
|
37
|
+
}
|
|
38
|
+
function oauth(provider) {
|
|
39
|
+
window.location.href = `/v1/oauth/${provider}`;
|
|
40
|
+
}
|
|
41
|
+
const missingKey = !client.publishableKey ||
|
|
42
|
+
client.publishableKey === 'pk_test_missing' ||
|
|
43
|
+
client.publishableKey.includes('REPLACE');
|
|
44
|
+
return (_jsxs("div", { ref: cardRef, className: `slx-card${error ? ' slx-card-error' : ''}`, children: [missingKey && (_jsxs("p", { style: {
|
|
45
|
+
fontSize: 12,
|
|
46
|
+
background: '#fff3cd',
|
|
47
|
+
border: '1px solid #ffe69c',
|
|
48
|
+
borderRadius: 8,
|
|
49
|
+
padding: '8px 10px',
|
|
50
|
+
marginBottom: 14,
|
|
51
|
+
lineHeight: 1.4,
|
|
52
|
+
}, children: [_jsx("strong", { children: "Setup:" }), " Add", ' ', _jsx("code", { children: "NEXT_PUBLIC_SLYXUP_PUBLISHABLE_KEY" }), " \u2014 run", ' ', _jsx("code", { children: "npx @slyxup/cli keys create" })] })), _jsx("div", { className: "slx-mark", children: _jsx(KeyholeMark, {}) }), _jsx("h1", { className: "slx-title", children: "Create your account" }), _jsx("p", { className: "slx-subtitle", children: "A minute to set up. Sign in forever after." }), social && (_jsxs(_Fragment, { children: [_jsxs("div", { className: "slx-social", children: [_jsxs("button", { type: "button", className: "slx-social-btn", onClick: () => oauth('google'), children: [_jsx(GoogleIcon, {}), " Continue with Google"] }), _jsxs("button", { type: "button", className: "slx-social-btn", onClick: () => oauth('github'), children: [_jsx(GitHubIcon, {}), " Continue with GitHub"] })] }), _jsx("div", { className: "slx-divider", children: "or" })] })), error && (_jsx("p", { className: "slx-error-text", role: "alert", children: error })), _jsxs("form", { onSubmit: onSubmit, children: [_jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-signup-name", children: "First name" }), _jsx("input", { id: "slx-signup-name", className: "slx-input", type: "text", autoComplete: "given-name", placeholder: "Ada", value: firstName, onChange: (e) => setFirstName(e.target.value) })] }), _jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-signup-email", children: "Email" }), _jsx("input", { id: "slx-signup-email", className: "slx-input", type: "email", autoComplete: "email", placeholder: "you@example.com", value: email, onChange: (e) => setEmail(e.target.value), required: true })] }), _jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-signup-password", children: "Password" }), _jsx("input", { id: "slx-signup-password", className: "slx-input", type: "password", autoComplete: "new-password", placeholder: "At least 8 characters", value: password, onChange: (e) => setPassword(e.target.value), required: true, minLength: 8 }), _jsx("p", { className: "slx-hint", children: "Use 8+ characters with a mix of letters and numbers." })] }), _jsxs("button", { className: "slx-btn", type: "submit", disabled: busy, children: [busy && _jsx("span", { className: "slx-spinner", "aria-hidden": "true" }), busy ? 'Creating account…' : 'Create account'] })] }), onSignInClick && (_jsxs("p", { className: "slx-footer", children: ["Already have an account?", ' ', _jsx("button", { type: "button", className: "slx-link", onClick: onSignInClick, children: "Sign in" })] }))] }));
|
|
53
|
+
}
|
|
54
|
+
//# sourceMappingURL=SignUp.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUp.js","sourceRoot":"","sources":["../../../src/components/SignUp/SignUp.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,cAAc,CAAC;AAC3C,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACxC,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AACpE,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AAQlE,2CAA2C;AAC3C,MAAM,UAAU,MAAM,CAAC,EACrB,MAAM,GAAG,IAAI,EACb,SAAS,EACT,aAAa,GACD;IACZ,MAAM,EAAE,MAAM,EAAE,MAAM,EAAE,GAAG,OAAO,EAGjC,CAAC;IACF,MAAM,CAAC,SAAS,EAAE,YAAY,C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,EAAE,CAAC,GACZ,EACF,YAAG,SAAS,EAAC,UAAU,qEAEnB,IACA,EACN,kBAAQ,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,aACrD,IAAI,IAAI,eAAM,SAAS,EAAC,aAAa,iBAAa,MAAM,GAAG,EAC3D,IAAI,CAAC,CAAC,CAAC,mBAAmB,CAAC,CAAC,CAAC,gBAAgB,IACvC,IACJ,EAEN,aAAa,IAAI,CAChB,aAAG,SAAS,EAAC,YAAY,yCACE,GAAG,EAC5B,iBAAQ,IAAI,EAAC,QAAQ,EAAC,SAAS,EAAC,UAAU,EAAC,OAAO,EAAE,aAAa,wBAExD,IACP,CACL,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
export interface SocialButtonsProps {
|
|
2
|
+
/** Show only these providers. Default: both */
|
|
3
|
+
providers?: Array<'google' | 'github'>;
|
|
4
|
+
/** OAuth start path base (default /v1/oauth) */
|
|
5
|
+
basePath?: string;
|
|
6
|
+
}
|
|
7
|
+
/** Provider buttons that redirect to hosted OAuth start. */
|
|
8
|
+
export declare function SocialButtons({ providers, basePath, }: SocialButtonsProps): import("react").JSX.Element;
|
|
9
|
+
//# sourceMappingURL=SocialButtons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialButtons.d.ts","sourceRoot":"","sources":["../../../src/components/SocialButtons/SocialButtons.tsx"],"names":[],"mappings":"AAEA,MAAM,WAAW,kBAAkB;IACjC,+CAA+C;IAC/C,SAAS,CAAC,EAAE,KAAK,CAAC,QAAQ,GAAG,QAAQ,CAAC,CAAC;IACvC,gDAAgD;IAChD,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB;AAOD,4DAA4D;AAC5D,wBAAgB,aAAa,CAAC,EAC5B,SAAgC,EAChC,QAAsB,GACvB,EAAE,kBAAkB,+BAoBpB"}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { GitHubIcon, GoogleIcon } from '../../icons';
|
|
3
|
+
const META = {
|
|
4
|
+
google: { label: 'Continue with Google', Icon: GoogleIcon },
|
|
5
|
+
github: { label: 'Continue with GitHub', Icon: GitHubIcon },
|
|
6
|
+
};
|
|
7
|
+
/** Provider buttons that redirect to hosted OAuth start. */
|
|
8
|
+
export function SocialButtons({ providers = ['google', 'github'], basePath = '/v1/oauth', }) {
|
|
9
|
+
return (_jsx("div", { className: "slx-social", children: providers.map((p) => {
|
|
10
|
+
const { label, Icon } = META[p];
|
|
11
|
+
return (_jsxs("button", { type: "button", className: "slx-social-btn", onClick: () => {
|
|
12
|
+
window.location.href = `${basePath}/${p}`;
|
|
13
|
+
}, children: [_jsx(Icon, {}), " ", label] }, p));
|
|
14
|
+
}) }));
|
|
15
|
+
}
|
|
16
|
+
//# sourceMappingURL=SocialButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SocialButtons.js","sourceRoot":"","sources":["../../../src/components/SocialButtons/SocialButtons.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,UAAU,EAAE,UAAU,EAAE,MAAM,aAAa,CAAC;AASrD,MAAM,IAAI,GAAG;IACX,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,UAAU,EAAE;IAC3D,MAAM,EAAE,EAAE,KAAK,EAAE,sBAAsB,EAAE,IAAI,EAAE,UAAU,EAAE;CACnD,CAAC;AAEX,4DAA4D;AAC5D,MAAM,UAAU,aAAa,CAAC,EAC5B,SAAS,GAAG,CAAC,QAAQ,EAAE,QAAQ,CAAC,EAChC,QAAQ,GAAG,WAAW,GACH;IACnB,OAAO,CACL,cAAK,SAAS,EAAC,YAAY,YACxB,SAAS,CAAC,GAAG,CAAC,CAAC,CAAC,EAAE,EAAE;YACnB,MAAM,EAAE,KAAK,EAAE,IAAI,EAAE,GAAG,IAAI,CAAC,CAAC,CAAC,CAAC;YAChC,OAAO,CACL,kBAEE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,gBAAgB,EAC1B,OAAO,EAAE,GAAG,EAAE;oBACZ,MAAM,CAAC,QAAQ,CAAC,IAAI,GAAG,GAAG,QAAQ,IAAI,CAAC,EAAE,CAAC;gBAC5C,CAAC,aAED,KAAC,IAAI,KAAG,OAAE,KAAK,KAPV,CAAC,CAQC,CACV,CAAC;QACJ,CAAC,CAAC,GACE,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserButton.d.ts","sourceRoot":"","sources":["../../../src/components/UserButton/UserButton.tsx"],"names":[],"mappings":"AAQA,2DAA2D;AAC3D,wBAAgB,UAAU,gCA+EzB"}
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAuth, useUser } from '@slyxup/react';
|
|
3
|
+
import { useEffect, useRef, useState } from 'react';
|
|
4
|
+
function initials(name, email) {
|
|
5
|
+
if (name?.trim())
|
|
6
|
+
return name.trim().slice(0, 1).toUpperCase();
|
|
7
|
+
return email.slice(0, 1).toUpperCase();
|
|
8
|
+
}
|
|
9
|
+
/** Avatar + dropdown with profile actions and sign out. */
|
|
10
|
+
export function UserButton() {
|
|
11
|
+
const { isLoaded, user } = useUser();
|
|
12
|
+
const { signOut } = useAuth();
|
|
13
|
+
const [open, setOpen] = useState(false);
|
|
14
|
+
const wrapRef = useRef(null);
|
|
15
|
+
useEffect(() => {
|
|
16
|
+
function onDocClick(e) {
|
|
17
|
+
if (wrapRef.current && !wrapRef.current.contains(e.target))
|
|
18
|
+
setOpen(false);
|
|
19
|
+
}
|
|
20
|
+
function onKey(e) {
|
|
21
|
+
if (e.key === 'Escape')
|
|
22
|
+
setOpen(false);
|
|
23
|
+
}
|
|
24
|
+
document.addEventListener('mousedown', onDocClick);
|
|
25
|
+
document.addEventListener('keydown', onKey);
|
|
26
|
+
return () => {
|
|
27
|
+
document.removeEventListener('mousedown', onDocClick);
|
|
28
|
+
document.removeEventListener('keydown', onKey);
|
|
29
|
+
};
|
|
30
|
+
}, []);
|
|
31
|
+
if (!isLoaded)
|
|
32
|
+
return _jsx("div", { className: "slx-userbtn-avatar", "aria-hidden": "true" });
|
|
33
|
+
const email = user?.email ?? '';
|
|
34
|
+
const name = user?.firstName;
|
|
35
|
+
async function onSignOut() {
|
|
36
|
+
await signOut();
|
|
37
|
+
setOpen(false);
|
|
38
|
+
}
|
|
39
|
+
return (_jsxs("div", { className: "slx-userbtn-wrap", ref: wrapRef, children: [_jsx("button", { type: "button", className: "slx-userbtn-avatar", onClick: () => setOpen((o) => !o), "aria-haspopup": "menu", "aria-expanded": open, "aria-label": "Account menu", children: user?.avatarUrl ? (_jsx("img", { src: user.avatarUrl, alt: "" })) : (initials(name, email || '?')) }), open && (_jsxs("div", { className: "slx-menu", role: "menu", children: [_jsxs("div", { className: "slx-menu-header", children: [_jsx("p", { className: "slx-menu-name", children: name
|
|
40
|
+
? `${name}${user?.lastName ? ` ${user.lastName}` : ''}`
|
|
41
|
+
: email.split('@')[0] }), _jsx("p", { className: "slx-menu-email", children: email })] }), _jsx("button", { type: "button", className: "slx-menu-item", role: "menuitem", onClick: () => setOpen(false), children: "Profile settings" }), _jsx("button", { type: "button", className: "slx-menu-item slx-menu-item-danger", role: "menuitem", onClick: onSignOut, children: "Sign out" })] }))] }));
|
|
42
|
+
}
|
|
43
|
+
//# sourceMappingURL=UserButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserButton.js","sourceRoot":"","sources":["../../../src/components/UserButton/UserButton.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AA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S,EAAC,eAAe,EACzB,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,GAAG,EAAE,CAAC,OAAO,CAAC,KAAK,CAAC,iCAGtB,EACT,iBACE,IAAI,EAAC,QAAQ,EACb,SAAS,EAAC,oCAAoC,EAC9C,IAAI,EAAC,UAAU,EACf,OAAO,EAAE,SAAS,yBAGX,IACL,CACP,IACG,CACP,CAAC;AACJ,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfile.d.ts","sourceRoot":"","sources":["../../../src/components/UserProfile/UserProfile.tsx"],"names":[],"mappings":"AAGA,yCAAyC;AACzC,wBAAgB,WAAW,gCAwF1B"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useAuth, useUser } from '@slyxup/react';
|
|
3
|
+
import { useEffect, useState } from 'react';
|
|
4
|
+
/** Edit first/last name + avatar URL. */
|
|
5
|
+
export function UserProfile() {
|
|
6
|
+
const { isLoaded, user, reload } = useUser();
|
|
7
|
+
const { client } = useAuth();
|
|
8
|
+
const [firstName, setFirstName] = useState('');
|
|
9
|
+
const [lastName, setLastName] = useState('');
|
|
10
|
+
const [avatarUrl, setAvatarUrl] = useState('');
|
|
11
|
+
const [busy, setBusy] = useState(false);
|
|
12
|
+
const [saved, setSaved] = useState(false);
|
|
13
|
+
useEffect(() => {
|
|
14
|
+
if (user) {
|
|
15
|
+
setFirstName(user.firstName ?? '');
|
|
16
|
+
setLastName(user.lastName ?? '');
|
|
17
|
+
setAvatarUrl(user.avatarUrl ?? '');
|
|
18
|
+
}
|
|
19
|
+
}, [user]);
|
|
20
|
+
async function onSubmit(e) {
|
|
21
|
+
e.preventDefault();
|
|
22
|
+
setBusy(true);
|
|
23
|
+
setSaved(false);
|
|
24
|
+
try {
|
|
25
|
+
await client.users.update({ firstName, lastName, avatarUrl });
|
|
26
|
+
await reload();
|
|
27
|
+
setSaved(true);
|
|
28
|
+
setTimeout(() => setSaved(false), 2500);
|
|
29
|
+
}
|
|
30
|
+
finally {
|
|
31
|
+
setBusy(false);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
34
|
+
if (!isLoaded)
|
|
35
|
+
return _jsx("div", { className: "slx-card", "aria-busy": "true" });
|
|
36
|
+
return (_jsxs("div", { className: "slx-card", children: [_jsx("h1", { className: "slx-title", children: "Profile" }), _jsxs("p", { className: "slx-subtitle", children: ["Signed in as ", user?.email] }), saved && (_jsx("p", { className: "slx-error-text", style: { color: '#34a853' }, children: "Profile saved." })), _jsxs("form", { onSubmit: onSubmit, children: [_jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-profile-first", children: "First name" }), _jsx("input", { id: "slx-profile-first", className: "slx-input", type: "text", value: firstName, onChange: (e) => setFirstName(e.target.value) })] }), _jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-profile-last", children: "Last name" }), _jsx("input", { id: "slx-profile-last", className: "slx-input", type: "text", value: lastName, onChange: (e) => setLastName(e.target.value) })] }), _jsxs("div", { className: "slx-field", children: [_jsx("label", { className: "slx-label", htmlFor: "slx-profile-avatar", children: "Avatar URL" }), _jsx("input", { id: "slx-profile-avatar", className: "slx-input", type: "url", placeholder: "https://\u2026", value: avatarUrl, onChange: (e) => setAvatarUrl(e.target.value) })] }), _jsx("button", { className: "slx-btn", type: "submit", disabled: busy, children: busy ? 'Saving…' : 'Save changes' })] })] }));
|
|
37
|
+
}
|
|
38
|
+
//# sourceMappingURL=UserProfile.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"UserProfile.js","sourceRoot":"","sources":["../../../src/components/UserProfile/UserProfile.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,OAAO,EAAE,OAAO,EAAE,MAAM,eAAe,CAAC;AACjD,OAAO,EAAkB,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAE5D,yCAAyC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C,oBAAoB,EACvB,SAAS,EAAC,WAAW,EACrB,IAAI,EAAC,KAAK,EACV,WAAW,EAAC,gBAAW,EACvB,KAAK,EAAE,SAAS,EAChB,QAAQ,EAAE,CAAC,CAAC,EAAE,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC,MAAM,CAAC,KAAK,CAAC,GAC7C,IACE,EACN,iBAAQ,SAAS,EAAC,SAAS,EAAC,IAAI,EAAC,QAAQ,EAAC,QAAQ,EAAE,IAAI,YACrD,IAAI,CAAC,CAAC,CAAC,SAAS,CAAC,CAAC,CAAC,cAAc,GAC3B,IACJ,IACH,CACP,CAAC;AACJ,CAAC"}
|
package/dist/icons.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
/** Shared icons (stroke = currentColor) */
|
|
2
|
+
export declare function KeyholeMark(): import("react").JSX.Element;
|
|
3
|
+
export declare function GoogleIcon(): import("react").JSX.Element;
|
|
4
|
+
export declare function GitHubIcon(): import("react").JSX.Element;
|
|
5
|
+
export declare function CheckIcon(): import("react").JSX.Element;
|
|
6
|
+
//# sourceMappingURL=icons.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.d.ts","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":"AAAA,2CAA2C;AAE3C,wBAAgB,WAAW,gCAa1B;AAED,wBAAgB,UAAU,gCAqBzB;AAED,wBAAgB,UAAU,gCAYzB;AAED,wBAAgB,SAAS,gCAgBxB"}
|
package/dist/icons.js
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
/** Shared icons (stroke = currentColor) */
|
|
3
|
+
export function KeyholeMark() {
|
|
4
|
+
return (_jsxs("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", "aria-hidden": "true", children: [_jsx("circle", { cx: "12", cy: "9", r: "3.2", fill: "white" }), _jsx("path", { d: "M10.6 11.5h2.8l.7 6h-4.2l.7-6z", fill: "white" })] }));
|
|
5
|
+
}
|
|
6
|
+
export function GoogleIcon() {
|
|
7
|
+
return (_jsxs("svg", { width: "17", height: "17", viewBox: "0 0 18 18", "aria-hidden": "true", children: [_jsx("path", { fill: "#4285F4", d: "M17.64 9.2c0-.63-.06-1.25-.16-1.84H9v3.48h4.84a4.14 4.14 0 0 1-1.8 2.72v2.26h2.92a8.78 8.78 0 0 0 2.68-6.62z" }), _jsx("path", { fill: "#34A853", d: "M9 18c2.43 0 4.47-.8 5.96-2.18l-2.91-2.26c-.81.54-1.84.86-3.05.86-2.34 0-4.33-1.58-5.04-3.71H.96v2.33A9 9 0 0 0 9 18z" }), _jsx("path", { fill: "#FBBC05", d: "M3.96 10.71a5.41 5.41 0 0 1 0-3.42V4.96H.96a9 9 0 0 0 0 8.08l3-2.33z" }), _jsx("path", { fill: "#EA4335", d: "M9 3.58c1.32 0 2.5.45 3.44 1.35l2.58-2.59A9 9 0 0 0 .96 4.96l3 2.33C4.67 5.16 6.66 3.58 9 3.58z" })] }));
|
|
8
|
+
}
|
|
9
|
+
export function GitHubIcon() {
|
|
10
|
+
return (_jsx("svg", { width: "17", height: "17", viewBox: "0 0 16 16", fill: "currentColor", "aria-hidden": "true", children: _jsx("path", { d: "M8 0C3.58 0 0 3.58 0 8c0 3.54 2.29 6.53 5.47 7.59.4.07.55-.17.55-.38 0-.19-.01-.82-.01-1.49-2.01.37-2.53-.49-2.69-.94-.09-.23-.48-.94-.82-1.13-.28-.15-.68-.52-.01-.53.63-.01 1.08.58 1.23.82.72 1.21 1.87.87 2.33.66.07-.52.28-.87.51-1.07-1.78-.2-3.64-.89-3.64-3.95 0-.87.31-1.59.82-2.15-.08-.2-.36-1.02.08-2.12 0 0 .67-.21 2.2.82.64-.18 1.32-.27 2-.27s1.36.09 2 .27c1.53-1.04 2.2-.82 2.2-.82.44 1.1.16 1.92.08 2.12.51.56.82 1.27.82 2.15 0 3.07-1.87 3.75-3.65 3.95.29.25.54.73.54 1.48 0 1.07-.01 1.93-.01 2.2 0 .21.15.46.55.38A8.01 8.01 0 0 0 16 8c0-4.42-3.58-8-8-8z" }) }));
|
|
11
|
+
}
|
|
12
|
+
export function CheckIcon() {
|
|
13
|
+
return (_jsx("svg", { width: "22", height: "22", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2.4", strokeLinecap: "round", strokeLinejoin: "round", "aria-hidden": "true", children: _jsx("path", { d: "M20 6L9 17l-5-5" }) }));
|
|
14
|
+
}
|
|
15
|
+
//# sourceMappingURL=icons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"icons.js","sourceRoot":"","sources":["../src/icons.tsx"],"names":[],"mappings":";AAAA,2CAA2C;AAE3C,MAAM,UAAU,WAAW;IACzB,OAAO,CACL,eACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,iBACC,MAAM,aAElB,iBAAQ,EAAE,EAAC,IAAI,EAAC,EAAE,EAAC,GAAG,EAAC,CAAC,EAAC,KAAK,EAAC,IAAI,EAAC,OAAO,GAAG,EAC9C,eAAM,CAAC,EAAC,gCAAgC,EAAC,IAAI,EAAC,OAAO,GAAG,IACpD,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,CACL,eAAK,KAAK,EAAC,IAAI,EAAC,MAAM,EAAC,IAAI,EAAC,OAAO,EAAC,WAAW,iBAAa,MAAM,aAChE,eACE,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,8GAA8G,GAChH,EACF,eACE,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,uHAAuH,GACzH,EACF,eACE,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,sEAAsE,GACxE,EACF,eACE,IAAI,EAAC,SAAS,EACd,CAAC,EAAC,iGAAiG,GACnG,IACE,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,UAAU;IACxB,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,cAAc,iBACP,MAAM,YAElB,eAAM,CAAC,EAAC,qjBAAqjB,GAAG,GAC5jB,CACP,CAAC;AACJ,CAAC;AAED,MAAM,UAAU,SAAS;IACvB,OAAO,CACL,cACE,KAAK,EAAC,IAAI,EACV,MAAM,EAAC,IAAI,EACX,OAAO,EAAC,WAAW,EACnB,IAAI,EAAC,MAAM,EACX,MAAM,EAAC,cAAc,EACrB,WAAW,EAAC,KAAK,EACjB,aAAa,EAAC,OAAO,EACrB,cAAc,EAAC,OAAO,iBACV,MAAM,YAElB,eAAM,CAAC,EAAC,iBAAiB,GAAG,GACxB,CACP,CAAC;AACJ,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,2 +1,16 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { injectStyles, CSS } from './styles';
|
|
2
|
+
export { KeyholeMark, GoogleIcon, GitHubIcon, CheckIcon } from './icons';
|
|
3
|
+
export { SignIn, type SignInProps } from './components/SignIn/SignIn';
|
|
4
|
+
export { SignUp, type SignUpProps } from './components/SignUp/SignUp';
|
|
5
|
+
export { UserButton } from './components/UserButton/UserButton';
|
|
6
|
+
export { UserProfile } from './components/UserProfile/UserProfile';
|
|
7
|
+
export { ForgotPassword, type ForgotPasswordProps, } from './components/ForgotPassword/ForgotPassword';
|
|
8
|
+
export { ResetPassword, type ResetPasswordProps, } from './components/ResetPassword/ResetPassword';
|
|
9
|
+
export { EmailVerification, type EmailVerificationProps, } from './components/EmailVerification/EmailVerification';
|
|
10
|
+
export { SocialButtons, type SocialButtonsProps, } from './components/SocialButtons/SocialButtons';
|
|
11
|
+
/**
|
|
12
|
+
* Inject the SlyxUp stylesheet once. Render inside your app root
|
|
13
|
+
* (or rely on any component auto-injecting on mount).
|
|
14
|
+
*/
|
|
15
|
+
export declare function SlyxUpStyles(): null;
|
|
2
16
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAE,KAAK,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EACL,cAAc,EACd,KAAK,mBAAmB,GACzB,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,iBAAiB,EACjB,KAAK,sBAAsB,GAC5B,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,aAAa,EACb,KAAK,kBAAkB,GACxB,MAAM,0CAA0C,CAAC;AAKlD;;;GAGG;AACH,wBAAgB,YAAY,IAAI,IAAI,CAKnC"}
|
package/dist/index.js
CHANGED
|
@@ -1,2 +1,23 @@
|
|
|
1
|
-
export
|
|
1
|
+
export { injectStyles, CSS } from './styles';
|
|
2
|
+
export { KeyholeMark, GoogleIcon, GitHubIcon, CheckIcon } from './icons';
|
|
3
|
+
export { SignIn } from './components/SignIn/SignIn';
|
|
4
|
+
export { SignUp } from './components/SignUp/SignUp';
|
|
5
|
+
export { UserButton } from './components/UserButton/UserButton';
|
|
6
|
+
export { UserProfile } from './components/UserProfile/UserProfile';
|
|
7
|
+
export { ForgotPassword, } from './components/ForgotPassword/ForgotPassword';
|
|
8
|
+
export { ResetPassword, } from './components/ResetPassword/ResetPassword';
|
|
9
|
+
export { EmailVerification, } from './components/EmailVerification/EmailVerification';
|
|
10
|
+
export { SocialButtons, } from './components/SocialButtons/SocialButtons';
|
|
11
|
+
import { useEffect } from 'react';
|
|
12
|
+
import { injectStyles } from './styles';
|
|
13
|
+
/**
|
|
14
|
+
* Inject the SlyxUp stylesheet once. Render inside your app root
|
|
15
|
+
* (or rely on any component auto-injecting on mount).
|
|
16
|
+
*/
|
|
17
|
+
export function SlyxUpStyles() {
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
injectStyles();
|
|
20
|
+
}, []);
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
2
23
|
//# sourceMappingURL=index.js.map
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,WAAW,GAAG,IAAI,CAAC"}
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,GAAG,EAAE,MAAM,UAAU,CAAC;AAC7C,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,SAAS,CAAC;AAEzE,OAAO,EAAE,MAAM,EAAoB,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,MAAM,EAAoB,MAAM,4BAA4B,CAAC;AACtE,OAAO,EAAE,UAAU,EAAE,MAAM,oCAAoC,CAAC;AAChE,OAAO,EAAE,WAAW,EAAE,MAAM,sCAAsC,CAAC;AACnE,OAAO,EACL,cAAc,GAEf,MAAM,4CAA4C,CAAC;AACpD,OAAO,EACL,aAAa,GAEd,MAAM,0CAA0C,CAAC;AAClD,OAAO,EACL,iBAAiB,GAElB,MAAM,kDAAkD,CAAC;AAC1D,OAAO,EACL,aAAa,GAEd,MAAM,0CAA0C,CAAC;AAElD,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAC;AAClC,OAAO,EAAE,YAAY,EAAE,MAAM,UAAU,CAAC;AAExC;;;GAGG;AACH,MAAM,UAAU,YAAY;IAC1B,SAAS,CAAC,GAAG,EAAE;QACb,YAAY,EAAE,CAAC;IACjB,CAAC,EAAE,EAAE,CAAC,CAAC;IACP,OAAO,IAAI,CAAC;AACd,CAAC"}
|
package/dist/styles.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* SlyxUp UI — design tokens + stylesheet.
|
|
3
|
+
* Injected once via <SlyxUpStyles />. Theme with CSS variables on :root or .slyxup-scope.
|
|
4
|
+
*/
|
|
5
|
+
export declare const FONT_LINK = "<link rel=\"preconnect\" href=\"https://fonts.googleapis.com\"><link rel=\"preconnect\" href=\"https://fonts.gstatic.com\" crossorigin><link href=\"https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=Space+Grotesk:wght@400;500;600;700&display=swap\" rel=\"stylesheet\">";
|
|
6
|
+
export declare const CSS = "\n@import url('https://fonts.googleapis.com/css2?family=DM+Sans:opsz,wght@9..40,300;9..40,400;9..40,500;9..40,600;9..40,700;9..40,800&family=Space+Grotesk:wght@400;500;600;700&display=swap');\n\n.slyxup-root {\n --slx-accent: #5b5bd6;\n --slx-accent-hover: #4c4cc4;\n --slx-accent-soft: rgba(91, 91, 214, 0.14);\n --slx-bg: #ffffff;\n --slx-bg-page: #e9eaf6;\n --slx-ink: #16161d;\n --slx-muted: #6f6f7b;\n --slx-border: #d8d8e8;\n --slx-danger: #d64550;\n --slx-radius: 12px;\n --slx-font: \"DM Sans\", -apple-system, BlinkMacSystemFont, \"Segoe UI\", Roboto, sans-serif;\n --slx-display: \"Space Grotesk\", \"DM Sans\", sans-serif;\n --slx-mono: ui-monospace, SFMono-Regular, Menlo, monospace;\n\n font-family: var(--slx-font);\n color: var(--slx-ink);\n -webkit-font-smoothing: antialiased;\n}\n@media (prefers-color-scheme: dark) {\n .slyxup-root:not(.slyxup-light) {\n --slx-accent: #8484f2;\n --slx-accent-hover: #9696f5;\n --slx-accent-soft: rgba(132, 132, 242, 0.14);\n --slx-bg: #191920;\n --slx-bg-page: #121218;\n --slx-ink: #f2f2f5;\n --slx-muted: #9a9aa6;\n --slx-border: #2c2c36;\n --slx-danger: #f0737d;\n }\n}\n\n@keyframes slx-shake {\n 10%, 90% { transform: translateX(-1px); }\n 20%, 80% { transform: translateX(2px); }\n 30%, 50%, 70% { transform: translateX(-4px); }\n 40%, 60% { transform: translateX(4px); }\n}\n@keyframes slx-spin { to { transform: rotate(360deg); } }\n@media (prefers-reduced-motion: reduce) {\n .slyxup-root * { animation: none !important; transition: none !important; }\n}\n\n/* \u2500\u2500 Card \u2500\u2500 */\n.slx-card {\n width: 100%;\n max-width: 380px;\n background: var(--slx-bg);\n border: 1px solid var(--slx-border);\n border-radius: calc(var(--slx-radius) + 4px);\n padding: 32px;\n box-shadow: 0 4px 12px rgba(16,16,29,.08), 0 16px 40px rgba(16,16,29,.12), 0 0 0 1px rgba(16,16,29,.04);\n box-sizing: border-box;\n}\n.slyxup-root .slx-card { background: #ffffff; }\n.slx-card-error { animation: slx-shake .45s cubic-bezier(.36,.07,.19,.97) both; }\n\n/* \u2500\u2500 Header / keyhole mark \u2500\u2500 */\n.slx-mark {\n width: 44px; height: 44px; border-radius: 12px;\n display: flex; align-items: center; justify-content: center;\n background: linear-gradient(135deg, var(--slx-accent), #9a6cf0);\n margin-bottom: 18px;\n}\n.slx-mark svg { display: block; }\n.slx-title { font-family: var(--slx-display); font-size: 20px; font-weight: 650; letter-spacing: -0.02em; margin: 0 0 6px; }\n.slx-subtitle { font-size: 13.5px; color: var(--slx-muted); margin: 0 0 22px; line-height: 1.5; }\n\n/* \u2500\u2500 Fields \u2500\u2500 */\n.slx-field { margin-bottom: 14px; }\n.slx-label { display: block; font-size: 12.5px; font-weight: 550; margin-bottom: 6px; letter-spacing: 0.01em; }\n.slx-input {\n width: 100%; box-sizing: border-box;\n font: inherit; font-size: 14px; color: var(--slx-ink);\n background: transparent;\n border: 1px solid var(--slx-border);\n border-radius: var(--slx-radius);\n padding: 10px 12px;\n outline: none;\n transition: border-color .15s, box-shadow .15s;\n}\n.slx-input::placeholder { color: var(--slx-muted); opacity: .75; }\n.slx-input:focus-visible {\n border-color: var(--slx-accent);\n box-shadow: 0 0 0 3px var(--slx-accent-soft);\n}\n.slx-hint { font-size: 12px; color: var(--slx-muted); margin-top: 5px; }\n.slx-error-text {\n font-size: 13px; color: var(--slx-danger);\n background: color-mix(in srgb, var(--slx-danger) 9%, transparent);\n border-radius: 8px; padding: 9px 11px; margin: 0 0 14px; line-height: 1.4;\n}\n\n/* \u2500\u2500 Button \u2500\u2500 */\n.slx-btn {\n width: 100%; box-sizing: border-box;\n font-family: var(--slx-font); font-size: 14px; font-weight: 600; letter-spacing: 0.01em;\n color: #fff; background: #0a0a0f;\n border: 1px solid #0a0a0f; border-radius: var(--slx-radius);\n padding: 11px 14px; cursor: pointer;\n display: inline-flex; align-items: center; justify-content: center; gap: 8px;\n transition: background .15s, transform .06s, border-color .15s;\n}\n.slx-btn:hover { background: #1a1a23; border-color: #1a1a23; }\n.slx-btn:active { transform: scale(.985); background: #000; }\n.slx-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px rgba(10,10,15,.14), 0 0 0 1px #0a0a0f; }\n.slx-btn[disabled] { opacity: .6; cursor: not-allowed; }\n@media (prefers-color-scheme: dark) {\n .slyxup-root:not(.slyxup-light) .slx-btn { background: #f2f2f5; color: #0a0a0f; border-color: #f2f2f5; }\n .slyxup-root:not(.slyxup-light) .slx-btn:hover { background: #e6e6eb; border-color: #e6e6eb; }\n}\n.slx-spinner {\n width: 15px; height: 15px; flex: none;\n border: 2px solid rgba(255,255,255,.35); border-top-color: #fff;\n border-radius: 50%; animation: slx-spin .7s linear infinite;\n}\n\n/* \u2500\u2500 Social \u2500\u2500 */\n.slx-social { display: grid; gap: 10px; margin-bottom: 16px; }\n.slx-social-btn {\n width: 100%; box-sizing: border-box;\n font: inherit; font-size: 13.5px; font-weight: 550;\n color: var(--slx-ink); background: var(--slx-bg);\n border: 1px solid var(--slx-border); border-radius: var(--slx-radius);\n padding: 10px 14px; cursor: pointer;\n display: inline-flex; align-items: center; justify-content: center; gap: 10px;\n transition: background .15s, border-color .15s;\n}\n.slx-social-btn:hover { background: color-mix(in srgb, var(--slx-ink) 4%, var(--slx-bg)); }\n.slx-social-btn:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--slx-accent-soft); }\n\n/* \u2500\u2500 Divider & footer \u2500\u2500 */\n.slx-divider {\n display: flex; align-items: center; gap: 12px;\n color: var(--slx-muted); font-size: 12px;\n margin: 18px 0;\n}\n.slx-divider::before, .slx-divider::after {\n content: \"\"; height: 1px; flex: 1; background: var(--slx-border);\n}\n.slx-footer { font-size: 13px; color: var(--slx-muted); margin-top: 20px; text-align: center; }\n.slx-link {\n color: var(--slx-accent); font-weight: 600; text-decoration: none; cursor: pointer;\n background: none; border: none; font: inherit; font-size: inherit;\n padding: 0; margin: 0;\n}\n.slx-link:hover { text-decoration: underline; color: var(--slx-accent-hover); }\n.slx-link:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--slx-accent-soft); border-radius: 4px; }\n\n/* \u2500\u2500 Success state \u2500\u2500 */\n.slx-success-icon {\n width: 46px; height: 46px; border-radius: 50%;\n display: flex; align-items: center; justify-content: center;\n background: color-mix(in srgb, #34a853 12%, transparent);\n color: #34a853; margin: 4px auto 18px;\n}\n\n/* \u2500\u2500 User button \u2500\u2500 */\n.slx-userbtn-wrap { position: relative; display: inline-block; }\n.slx-userbtn-avatar {\n width: 36px; height: 36px; border-radius: 50%;\n border: 1px solid var(--slx-border); cursor: pointer;\n display: flex; align-items: center; justify-content: center;\n font-size: 14px; font-weight: 650; color: #fff;\n background: linear-gradient(135deg, var(--slx-accent), #9a6cf0);\n padding: 0; overflow: hidden;\n}\n.slx-userbtn-avatar img { width: 100%; height: 100%; object-fit: cover; }\n.slx-userbtn-avatar:focus-visible { outline: none; box-shadow: 0 0 0 3px var(--slx-accent-soft); }\n.slx-menu {\n position: absolute; right: 0; top: calc(100% + 8px);\n min-width: 230px;\n background: var(--slx-bg);\n border: 1px solid var(--slx-border);\n border-radius: var(--slx-radius);\n box-shadow: 0 8px 30px rgba(10,10,20,.14);\n overflow: hidden; z-index: 1000;\n}\n.slx-menu-header { padding: 14px 16px; border-bottom: 1px solid var(--slx-border); }\n.slx-menu-name { font-size: 14px; font-weight: 600; margin: 0 0 2px; }\n.slx-menu-email { font-size: 12.5px; color: var(--slx-muted); margin: 0; word-break: break-all; }\n.slx-menu-item {\n display: block; width: 100%; text-align: left; box-sizing: border-box;\n font: inherit; font-size: 13.5px; color: var(--slx-ink);\n background: none; border: none; padding: 10px 16px; cursor: pointer;\n}\n.slx-menu-item:hover { background: color-mix(in srgb, var(--slx-ink) 5%, transparent); }\n.slx-menu-item:focus-visible { outline: none; box-shadow: inset 0 0 0 2px var(--slx-accent-soft); }\n.slx-menu-item-danger { color: var(--slx-danger); }\n";
|
|
7
|
+
/** Inject the SlyxUp stylesheet + DM Sans font once per document. */
|
|
8
|
+
export declare function injectStyles(): void;
|
|
9
|
+
//# sourceMappingURL=styles.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"styles.d.ts","sourceRoot":"","sources":["../src/styles.ts"],"names":[],"mappings":"AAAA;;;GAGG;AAEH,eAAO,MAAM,SAAS,4VAAgV,CAAC;AAEvW,eAAO,MAAM,GAAG,4iQAiMf,CAAC;AAIF,qEAAqE;AACrE,wBAAgB,YAAY,IAAI,IAAI,CAenC"}
|