@stackframe/stack 2.0.0 → 2.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/components/card-frame.d.ts +7 -0
- package/dist/components/card-frame.d.ts.map +1 -0
- package/dist/components/card-frame.js +24 -0
- package/dist/{elements/CardHeader.d.ts → components/card-header.d.ts} +1 -0
- package/dist/components/card-header.d.ts.map +1 -0
- package/dist/components/card-header.js +5 -0
- package/dist/{elements/CredentialSignIn.d.ts → components/credential-sign-in.d.ts} +1 -0
- package/dist/components/credential-sign-in.d.ts.map +1 -0
- package/dist/components/credential-sign-in.js +56 -0
- package/dist/{elements/CredentialSignUp.d.ts → components/credential-sign-up.d.ts} +1 -0
- package/dist/components/credential-sign-up.d.ts.map +1 -0
- package/dist/{elements/CredentialSignUp.js → components/credential-sign-up.js} +15 -15
- package/dist/{elements/DividerWithText.d.ts → components/divider-with-text.d.ts} +1 -0
- package/dist/components/divider-with-text.d.ts.map +1 -0
- package/dist/components/divider-with-text.js +6 -0
- package/dist/components/email-verification.d.ts +5 -0
- package/dist/components/email-verification.d.ts.map +1 -0
- package/dist/components/{EmailVerification.js → email-verification.js} +2 -2
- package/dist/{elements/ForgotPassword.d.ts → components/forgot-password.d.ts} +1 -0
- package/dist/components/forgot-password.d.ts.map +1 -0
- package/dist/components/forgot-password.js +32 -0
- package/dist/components/form-warning.d.ts +4 -0
- package/dist/components/form-warning.d.ts.map +1 -0
- package/dist/components/form-warning.js +9 -0
- package/dist/{elements/MessageCard.d.ts → components/message-card.d.ts} +1 -0
- package/dist/components/message-card.d.ts.map +1 -0
- package/dist/components/message-card.js +7 -0
- package/dist/{elements/OAuthButton.d.ts → components/oauth-button.d.ts} +1 -0
- package/dist/components/oauth-button.d.ts.map +1 -0
- package/dist/components/oauth-button.js +66 -0
- package/dist/components/oauth-callback.d.ts +2 -0
- package/dist/components/oauth-callback.d.ts.map +1 -0
- package/dist/components/{OAuthCallback.js → oauth-callback.js} +1 -1
- package/dist/{elements/OAuthGroup.d.ts → components/oauth-group.d.ts} +1 -0
- package/dist/components/oauth-group.d.ts.map +1 -0
- package/dist/components/oauth-group.js +9 -0
- package/dist/components/password-field.d.ts +4 -0
- package/dist/components/password-field.d.ts.map +1 -0
- package/dist/components/password-field.js +41 -0
- package/dist/{elements/PasswordResetInner.d.ts → components/password-reset-inner.d.ts} +1 -0
- package/dist/components/password-reset-inner.d.ts.map +1 -0
- package/dist/{elements/PasswordResetInner.js → components/password-reset-inner.js} +18 -16
- package/dist/components/password-reset.d.ts +5 -0
- package/dist/components/password-reset.d.ts.map +1 -0
- package/dist/components/{PasswordReset.js → password-reset.js} +6 -5
- package/dist/{elements/RedirectMessageCard.d.ts → components/redirect-message-card.d.ts} +1 -0
- package/dist/components/redirect-message-card.d.ts.map +1 -0
- package/dist/{elements/RedirectMessageCard.js → components/redirect-message-card.js} +3 -4
- package/dist/components/sign-in.d.ts +4 -0
- package/dist/components/sign-in.d.ts.map +1 -0
- package/dist/components/sign-in.js +20 -0
- package/dist/components/sign-out.d.ts +2 -0
- package/dist/components/sign-out.d.ts.map +1 -0
- package/dist/components/{SignOut.js → sign-out.js} +1 -1
- package/dist/components/sign-up.d.ts +4 -0
- package/dist/components/sign-up.d.ts.map +1 -0
- package/dist/components/sign-up.js +20 -0
- package/dist/components/stack-handler.d.ts +9 -0
- package/dist/components/stack-handler.d.ts.map +1 -0
- package/dist/components/{StackHandler.js → stack-handler.js} +7 -7
- package/dist/components-core/button.d.ts +10 -0
- package/dist/components-core/button.d.ts.map +1 -0
- package/dist/components-core/button.js +115 -0
- package/dist/components-core/container.d.ts +6 -0
- package/dist/components-core/container.d.ts.map +1 -0
- package/dist/components-core/container.js +19 -0
- package/dist/components-core/divider.d.ts +7 -0
- package/dist/components-core/divider.d.ts.map +1 -0
- package/dist/components-core/divider.js +17 -0
- package/dist/components-core/index.d.ts +17 -0
- package/dist/components-core/index.d.ts.map +1 -0
- package/dist/components-core/index.js +32 -0
- package/dist/components-core/input.d.ts +5 -0
- package/dist/components-core/input.d.ts.map +1 -0
- package/dist/components-core/input.js +45 -0
- package/dist/components-core/label.d.ts +6 -0
- package/dist/components-core/label.d.ts.map +1 -0
- package/dist/components-core/label.js +22 -0
- package/dist/components-core/link.d.ts +9 -0
- package/dist/components-core/link.d.ts.map +1 -0
- package/dist/components-core/link.js +18 -0
- package/dist/components-core/text.d.ts +9 -0
- package/dist/components-core/text.d.ts.map +1 -0
- package/dist/components-core/text.js +42 -0
- package/dist/components-core-joy/button.d.ts +3 -0
- package/dist/components-core-joy/button.d.ts.map +1 -0
- package/dist/components-core-joy/button.js +26 -0
- package/dist/components-core-joy/divider.d.ts +3 -0
- package/dist/components-core-joy/divider.d.ts.map +1 -0
- package/dist/components-core-joy/divider.js +7 -0
- package/dist/components-core-joy/input.d.ts +3 -0
- package/dist/components-core-joy/input.d.ts.map +1 -0
- package/dist/components-core-joy/input.js +7 -0
- package/dist/components-core-joy/text.d.ts +3 -0
- package/dist/components-core-joy/text.d.ts.map +1 -0
- package/dist/components-core-joy/text.js +28 -0
- package/dist/{components/EmailVerification.d.ts → components-page/email-verification.d.ts} +1 -0
- package/dist/components-page/email-verification.d.ts.map +1 -0
- package/dist/components-page/email-verification.js +29 -0
- package/dist/{components/ForgotPassword.d.ts → components-page/forgot-password.d.ts} +1 -0
- package/dist/components-page/forgot-password.d.ts.map +1 -0
- package/dist/{components/ForgotPassword.js → components-page/forgot-password.js} +6 -6
- package/dist/{components/OAuthCallback.d.ts → components-page/oauth-callback.d.ts} +1 -0
- package/dist/components-page/oauth-callback.d.ts.map +1 -0
- package/dist/components-page/oauth-callback.js +17 -0
- package/dist/{components/PasswordReset.d.ts → components-page/password-reset.d.ts} +1 -0
- package/dist/components-page/password-reset.d.ts.map +1 -0
- package/dist/components-page/password-reset.js +37 -0
- package/dist/{components/SignIn.d.ts → components-page/sign-in.d.ts} +1 -0
- package/dist/components-page/sign-in.d.ts.map +1 -0
- package/dist/components-page/sign-in.js +20 -0
- package/dist/{components/SignOut.d.ts → components-page/sign-out.d.ts} +1 -0
- package/dist/components-page/sign-out.d.ts.map +1 -0
- package/dist/components-page/sign-out.js +13 -0
- package/dist/{components/SignUp.d.ts → components-page/sign-up.d.ts} +1 -0
- package/dist/components-page/sign-up.d.ts.map +1 -0
- package/dist/components-page/sign-up.js +20 -0
- package/dist/{components/StackHandler.d.ts → components-page/stack-handler.d.ts} +1 -0
- package/dist/components-page/stack-handler.d.ts.map +1 -0
- package/dist/components-page/stack-handler.js +58 -0
- package/dist/elements/card-frame.d.ts +7 -0
- package/dist/elements/card-frame.d.ts.map +1 -0
- package/dist/elements/card-frame.js +24 -0
- package/dist/elements/card-header.d.ts +6 -0
- package/dist/elements/card-header.d.ts.map +1 -0
- package/dist/elements/card-header.js +5 -0
- package/dist/elements/credential-sign-in.d.ts +2 -0
- package/dist/elements/credential-sign-in.d.ts.map +1 -0
- package/dist/elements/{CredentialSignIn.js → credential-sign-in.js} +10 -11
- package/dist/elements/credential-sign-up.d.ts +2 -0
- package/dist/elements/credential-sign-up.d.ts.map +1 -0
- package/dist/elements/credential-sign-up.js +73 -0
- package/dist/elements/divider-with-text.d.ts +4 -0
- package/dist/elements/divider-with-text.d.ts.map +1 -0
- package/dist/elements/divider-with-text.js +6 -0
- package/dist/elements/forgot-password.d.ts +4 -0
- package/dist/elements/forgot-password.d.ts.map +1 -0
- package/dist/elements/forgot-password.js +32 -0
- package/dist/elements/{FormWarning.d.ts → form-warning.d.ts} +1 -0
- package/dist/elements/form-warning.d.ts.map +1 -0
- package/dist/elements/{FormWarning.js → form-warning.js} +2 -1
- package/dist/elements/message-card.d.ts +7 -0
- package/dist/elements/message-card.d.ts.map +1 -0
- package/dist/elements/message-card.js +7 -0
- package/dist/elements/oauth-button.d.ts +5 -0
- package/dist/elements/oauth-button.d.ts.map +1 -0
- package/dist/elements/{OAuthButton.js → oauth-button.js} +7 -9
- package/dist/elements/oauth-group.d.ts +4 -0
- package/dist/elements/oauth-group.d.ts.map +1 -0
- package/dist/elements/oauth-group.js +8 -0
- package/dist/elements/{PasswordField.d.ts → password-field.d.ts} +1 -0
- package/dist/elements/password-field.d.ts.map +1 -0
- package/dist/elements/password-field.js +38 -0
- package/dist/elements/password-reset-inner.d.ts +5 -0
- package/dist/elements/password-reset-inner.d.ts.map +1 -0
- package/dist/elements/password-reset-inner.js +63 -0
- package/dist/elements/redirect-message-card.d.ts +5 -0
- package/dist/elements/redirect-message-card.d.ts.map +1 -0
- package/dist/elements/redirect-message-card.js +54 -0
- package/dist/index.d.ts +18 -8
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +17 -9
- package/dist/lib/auth.d.ts +1 -0
- package/dist/lib/cookie.d.ts +1 -0
- package/dist/lib/hooks.d.ts +1 -0
- package/dist/lib/hooks.js +1 -1
- package/dist/lib/stack-app.d.ts +1 -0
- package/dist/providers/component-provider.d.ts +25 -0
- package/dist/providers/component-provider.d.ts.map +1 -0
- package/dist/providers/component-provider.js +29 -0
- package/dist/providers/design-provider.d.ts +41 -0
- package/dist/providers/design-provider.d.ts.map +1 -0
- package/dist/providers/design-provider.js +65 -0
- package/dist/providers/joy-provider.d.ts +17 -0
- package/dist/providers/joy-provider.d.ts.map +1 -0
- package/dist/providers/joy-provider.js +27 -0
- package/dist/providers/{StackProviderClient.d.ts → stack-provider-client.d.ts} +1 -0
- package/dist/providers/stack-provider-client.d.ts.map +1 -0
- package/dist/providers/{StackProvider.d.ts → stack-provider.d.ts} +3 -2
- package/dist/providers/stack-provider.d.ts.map +1 -0
- package/dist/providers/{StackProvider.js → stack-provider.js} +1 -1
- package/dist/providers/styled-components-registry.d.ts +5 -0
- package/dist/providers/styled-components-registry.d.ts.map +1 -0
- package/dist/providers/styled-components-registry.js +18 -0
- package/dist/providers/theme-provider.d.ts +11 -0
- package/dist/providers/theme-provider.d.ts.map +1 -0
- package/dist/providers/theme-provider.js +20 -0
- package/dist/providers/ui-provider.d.ts +10 -0
- package/dist/providers/ui-provider.js +20 -0
- package/dist/utils/constants.d.ts +41 -0
- package/dist/utils/constants.d.ts.map +1 -0
- package/dist/utils/constants.js +22 -0
- package/dist/utils/email.d.ts +1 -0
- package/dist/utils/email.d.ts.map +1 -1
- package/dist/utils/next.d.ts +1 -0
- package/dist/utils/next.d.ts.map +1 -1
- package/dist/utils/react.d.ts +1 -0
- package/dist/utils/react.d.ts.map +1 -1
- package/dist/utils/results.d.ts +1 -0
- package/dist/utils/results.d.ts.map +1 -1
- package/dist/utils/url.d.ts +1 -0
- package/dist/utils/url.d.ts.map +1 -1
- package/package.json +19 -24
- package/dist/components/EmailVerification.d.ts.map +0 -1
- package/dist/components/ForgotPassword.d.ts.map +0 -1
- package/dist/components/OAuthCallback.d.ts.map +0 -1
- package/dist/components/PasswordReset.d.ts.map +0 -1
- package/dist/components/SignIn.d.ts.map +0 -1
- package/dist/components/SignIn.js +0 -20
- package/dist/components/SignOut.d.ts.map +0 -1
- package/dist/components/SignUp.d.ts.map +0 -1
- package/dist/components/SignUp.js +0 -19
- package/dist/components/StackHandler.d.ts.map +0 -1
- package/dist/elements/Button.d.ts +0 -10
- package/dist/elements/Button.d.ts.map +0 -1
- package/dist/elements/Button.js +0 -18
- package/dist/elements/CardFrame.d.ts +0 -5
- package/dist/elements/CardFrame.d.ts.map +0 -1
- package/dist/elements/CardFrame.js +0 -10
- package/dist/elements/CardHeader.d.ts.map +0 -1
- package/dist/elements/CardHeader.js +0 -4
- package/dist/elements/CredentialSignIn.d.ts.map +0 -1
- package/dist/elements/CredentialSignUp.d.ts.map +0 -1
- package/dist/elements/DividerWithText.d.ts.map +0 -1
- package/dist/elements/DividerWithText.js +0 -5
- package/dist/elements/ForgotPassword.d.ts.map +0 -1
- package/dist/elements/ForgotPassword.js +0 -32
- package/dist/elements/FormWarning.d.ts.map +0 -1
- package/dist/elements/MessageCard.d.ts.map +0 -1
- package/dist/elements/MessageCard.js +0 -5
- package/dist/elements/OAuthButton.d.ts.map +0 -1
- package/dist/elements/OAuthGroup.d.ts.map +0 -1
- package/dist/elements/OAuthGroup.js +0 -8
- package/dist/elements/PasswordField.d.ts.map +0 -1
- package/dist/elements/PasswordField.js +0 -27
- package/dist/elements/PasswordResetInner.d.ts.map +0 -1
- package/dist/elements/RedirectMessageCard.d.ts.map +0 -1
- package/dist/providers/StackProvider.d.ts.map +0 -1
- package/dist/providers/StackProviderClient.d.ts.map +0 -1
- package/dist/tailwind.css +0 -1299
- package/dist/utils/types.d.ts +0 -4
- package/dist/utils/types.d.ts.map +0 -1
- package/dist/utils/types.js +0 -1
- /package/dist/providers/{StackProviderClient.js → stack-provider-client.js} +0 -0
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { FormWarningText } from "./form-warning";
|
|
5
|
+
import { validateEmail } from "../utils/email";
|
|
6
|
+
import { useStackApp } from "..";
|
|
7
|
+
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
|
|
8
|
+
import { Button, Input, Label } from "@stackframe/stack-ui";
|
|
9
|
+
export default function ForgotPassword({ onSent }) {
|
|
10
|
+
const [email, setEmail] = useState('');
|
|
11
|
+
const [emailError, setEmailError] = useState('');
|
|
12
|
+
const [sending, setSending] = useState(false);
|
|
13
|
+
const stackApp = useStackApp();
|
|
14
|
+
const onSubmit = async () => {
|
|
15
|
+
if (!email) {
|
|
16
|
+
setEmailError('Please enter your email');
|
|
17
|
+
return;
|
|
18
|
+
}
|
|
19
|
+
if (!validateEmail(email)) {
|
|
20
|
+
setEmailError('Please enter a valid email');
|
|
21
|
+
return;
|
|
22
|
+
}
|
|
23
|
+
setSending(true);
|
|
24
|
+
await stackApp.sendForgotPasswordEmail(email);
|
|
25
|
+
setSending(false);
|
|
26
|
+
onSent?.();
|
|
27
|
+
};
|
|
28
|
+
return (_jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: [_jsx(Label, { htmlFor: "email", children: "Your Email" }), _jsx(Input, { id: "email", type: "email", name: "email", value: email, onChange: (e) => {
|
|
29
|
+
setEmail(e.target.value);
|
|
30
|
+
setEmailError('');
|
|
31
|
+
} }), _jsx(FormWarningText, { text: emailError }), _jsx(Button, { style: { marginTop: '1.5rem' }, onClick: () => runAsynchronously(onSubmit()), loading: sending, children: "Send Email" })] }));
|
|
32
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"form-warning.d.ts","sourceRoot":"","sources":["../../src/elements/form-warning.tsx"],"names":[],"mappings":"AAEA,wBAAgB,eAAe,CAAC,EAAE,IAAI,EAAE,EAAE;IAAE,IAAI,CAAC,EAAE,MAAM,CAAA;CAAE,kDAS1D"}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Text } from "@stackframe/stack-ui";
|
|
2
3
|
export function FormWarningText({ text }) {
|
|
3
4
|
if (!text) {
|
|
4
5
|
return null;
|
|
5
6
|
}
|
|
6
|
-
return (_jsx(
|
|
7
|
+
return (_jsx(Text, { size: "sm", variant: "warning", children: text }));
|
|
7
8
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"message-card.d.ts","sourceRoot":"","sources":["../../src/elements/message-card.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAI1B,MAAM,CAAC,OAAO,UAAU,WAAW,CACjC,EAAE,QAAQ,EAAE,KAAK,EAAE,QAAc,EAAE,EACnC;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAC;IAAC,KAAK,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAC,2CAUjE"}
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import CardFrame from "./card-frame";
|
|
4
|
+
import { Text } from "@stackframe/stack-ui";
|
|
5
|
+
export default function MessageCard({ children, title, fullPage = false }) {
|
|
6
|
+
return (_jsx(CardFrame, { fullPage: fullPage, children: _jsxs("div", { style: { textAlign: 'center' }, children: [_jsx(Text, { size: "xl", as: 'h2', style: { marginBottom: '24px' }, children: title }), children] }) }));
|
|
7
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-button.d.ts","sourceRoot":"","sources":["../../src/elements/oauth-button.tsx"],"names":[],"mappings":"AAUA,MAAM,CAAC,OAAO,UAAU,WAAW,CAAC,EAClC,QAAQ,EACR,IAAI,GACL,EAAE;IACD,QAAQ,EAAE,MAAM,CAAC;IACjB,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B,2CA6GA"}
|
|
@@ -3,17 +3,19 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
3
3
|
import { FaGithub, FaFacebook, FaApple } from 'react-icons/fa';
|
|
4
4
|
import { useStackApp } from '..';
|
|
5
5
|
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
|
|
6
|
-
import Button from '
|
|
7
|
-
|
|
6
|
+
import { Button, useDesign } from '@stackframe/stack-ui';
|
|
7
|
+
import Color from 'color';
|
|
8
|
+
const iconSize = 22;
|
|
8
9
|
export default function OAuthButton({ provider, type, }) {
|
|
10
|
+
const { colors } = useDesign();
|
|
9
11
|
const stackApp = useStackApp();
|
|
10
12
|
let style;
|
|
11
13
|
switch (provider) {
|
|
12
14
|
case 'google': {
|
|
13
15
|
style = {
|
|
14
16
|
backgroundColor: '#fff',
|
|
15
|
-
textColor: '#000',
|
|
16
17
|
name: 'Google',
|
|
18
|
+
border: Color(colors.primaryBgColor).isDark() ? undefined : '1px solid #ccc',
|
|
17
19
|
icon: (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 24 24", children: [_jsx("path", { fill: "#4285F4", 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" }), _jsx("path", { fill: "#34A853", 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" }), _jsx("path", { fill: "#FBBC05", 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" }), _jsx("path", { fill: "#EA4335", 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" }), _jsx("path", { fill: "none", d: "M1 1h22v22H1z" })] })),
|
|
18
20
|
};
|
|
19
21
|
break;
|
|
@@ -21,7 +23,7 @@ export default function OAuthButton({ provider, type, }) {
|
|
|
21
23
|
case 'github': {
|
|
22
24
|
style = {
|
|
23
25
|
backgroundColor: '#111',
|
|
24
|
-
|
|
26
|
+
border: Color(colors.primaryBgColor).isDark() ? '1px solid #666' : undefined,
|
|
25
27
|
name: 'GitHub',
|
|
26
28
|
icon: (_jsx(FaGithub, { color: "#fff", size: iconSize })),
|
|
27
29
|
};
|
|
@@ -30,7 +32,6 @@ export default function OAuthButton({ provider, type, }) {
|
|
|
30
32
|
case 'facebook': {
|
|
31
33
|
style = {
|
|
32
34
|
backgroundColor: '#1877F2',
|
|
33
|
-
textColor: '#fff',
|
|
34
35
|
name: 'Facebook',
|
|
35
36
|
icon: (_jsx(FaFacebook, { color: "#fff", size: iconSize })),
|
|
36
37
|
};
|
|
@@ -39,7 +40,6 @@ export default function OAuthButton({ provider, type, }) {
|
|
|
39
40
|
case 'apple': {
|
|
40
41
|
style = {
|
|
41
42
|
backgroundColor: '#000',
|
|
42
|
-
textColor: '#fff',
|
|
43
43
|
name: 'Apple',
|
|
44
44
|
icon: (_jsx(FaApple, { color: "#fff", size: iconSize })),
|
|
45
45
|
};
|
|
@@ -48,7 +48,6 @@ export default function OAuthButton({ provider, type, }) {
|
|
|
48
48
|
case 'microsoft': {
|
|
49
49
|
style = {
|
|
50
50
|
backgroundColor: '#2f2f2f',
|
|
51
|
-
textColor: '#fff',
|
|
52
51
|
name: 'Microsoft',
|
|
53
52
|
icon: (_jsxs("svg", { xmlns: "http://www.w3.org/2000/svg", width: iconSize, height: iconSize, viewBox: "0 0 21 21", children: [_jsx("title", { children: "MS-SymbolLockup" }), _jsx("path", { fill: "#f25022", d: "M1 1h9v9H1z" }), _jsx("path", { fill: "#00a4ef", d: "M1 11h9v9H1z" }), _jsx("path", { fill: "#7fba00", d: "M11 1h9v9h-9z" }), _jsx("path", { fill: "#ffb900", d: "M11 11h9v9h-9z" })] })),
|
|
54
53
|
};
|
|
@@ -57,11 +56,10 @@ export default function OAuthButton({ provider, type, }) {
|
|
|
57
56
|
default: {
|
|
58
57
|
style = {
|
|
59
58
|
backgroundColor: '#000',
|
|
60
|
-
textColor: '#fff',
|
|
61
59
|
name: provider,
|
|
62
60
|
icon: null
|
|
63
61
|
};
|
|
64
62
|
}
|
|
65
63
|
}
|
|
66
|
-
return (
|
|
64
|
+
return (_jsx(Button, { color: style.backgroundColor, style: { border: style.border }, onClick: () => runAsynchronously(stackApp.signInWithOAuth(provider)), children: _jsxs("div", { style: { display: 'flex', alignItems: 'center', width: '100%' }, children: [style.icon, _jsxs("span", { style: { flexGrow: 1 }, children: [type === 'signup' ? 'Sign up with ' : 'Sign in with ', style.name] }), _jsx("div", { style: { visibility: 'hidden' }, children: style.icon })] }) }));
|
|
67
65
|
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"oauth-group.d.ts","sourceRoot":"","sources":["../../src/elements/oauth-group.tsx"],"names":[],"mappings":"AAGA,MAAM,CAAC,OAAO,UAAU,UAAU,CAAC,EACjC,IAAI,GACL,EAAE;IACD,IAAI,EAAE,QAAQ,GAAG,QAAQ,CAAC;CAC3B,2CAWA"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { useStackApp } from "..";
|
|
3
|
+
import OAuthButton from "./oauth-button";
|
|
4
|
+
export default function OAuthGroup({ type, }) {
|
|
5
|
+
const stackApp = useStackApp();
|
|
6
|
+
const project = stackApp.useProject();
|
|
7
|
+
return (_jsx("div", { style: { gap: '16px', display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: project.oauthProviders.filter(p => p.enabled).map(p => (_jsx(OAuthButton, { provider: p.id, type: type }, p.id))) }));
|
|
8
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-field.d.ts","sourceRoot":"","sources":["../../src/elements/password-field.tsx"],"names":[],"mappings":";AAIA,eAAO,MAAM,aAAa,oJAwDxB,CAAC"}
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Input } from '@stackframe/stack-ui';
|
|
3
|
+
import { forwardRef, useRef, useState } from 'react';
|
|
4
|
+
import { HiEye, HiEyeOff } from 'react-icons/hi';
|
|
5
|
+
export const PasswordField = forwardRef(({ id, name, ...props }, ref) => {
|
|
6
|
+
const [isOpen, setIsOpen] = useState(false);
|
|
7
|
+
const inputRef = useRef(null);
|
|
8
|
+
const mergeRef = (node) => {
|
|
9
|
+
if (ref) {
|
|
10
|
+
if (typeof ref === 'function') {
|
|
11
|
+
ref(node);
|
|
12
|
+
}
|
|
13
|
+
else {
|
|
14
|
+
ref.current = node;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
inputRef.current = node;
|
|
18
|
+
};
|
|
19
|
+
const onClickReveal = () => {
|
|
20
|
+
setIsOpen(!isOpen);
|
|
21
|
+
const currentInput = inputRef.current;
|
|
22
|
+
if (currentInput) {
|
|
23
|
+
currentInput.focus({ preventScroll: true });
|
|
24
|
+
}
|
|
25
|
+
};
|
|
26
|
+
return (_jsxs("div", { style: { position: 'relative', display: 'flex' }, children: [_jsx(Input, { id: id, ref: mergeRef, name: name, type: isOpen ? 'text' : 'password', autoComplete: "current-password", required: true, style: { flex: 1 }, ...props }), _jsx("button", { tabIndex: -1, type: "button", style: {
|
|
27
|
+
position: 'absolute',
|
|
28
|
+
backgroundColor: 'transparent',
|
|
29
|
+
border: 'none',
|
|
30
|
+
top: 0,
|
|
31
|
+
right: 0,
|
|
32
|
+
bottom: 0,
|
|
33
|
+
display: 'flex',
|
|
34
|
+
alignItems: 'center',
|
|
35
|
+
paddingRight: '12px'
|
|
36
|
+
}, onClick: onClickReveal, "aria-label": isOpen ? 'Mask password' : 'Reveal password', children: isOpen ? _jsx(HiEyeOff, {}) : _jsx(HiEye, {}) })] }));
|
|
37
|
+
});
|
|
38
|
+
PasswordField.displayName = 'PasswordField';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"password-reset-inner.d.ts","sourceRoot":"","sources":["../../src/elements/password-reset-inner.tsx"],"names":[],"mappings":"AAeA,MAAM,CAAC,OAAO,UAAU,kBAAkB,CACxC,EAAE,IAAI,EAAE,QAAgB,EAAE,EAC1B;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,QAAQ,CAAC,EAAE,OAAO,CAAA;CAAE,2CAyFrC"}
|
|
@@ -0,0 +1,63 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from "react";
|
|
4
|
+
import { getPasswordError } from "@stackframe/stack-shared/dist/helpers/password";
|
|
5
|
+
import { useStackApp } from "..";
|
|
6
|
+
import { PasswordField } from "./password-field";
|
|
7
|
+
import { FormWarningText } from "./form-warning";
|
|
8
|
+
import RedirectMessageCard from "./redirect-message-card";
|
|
9
|
+
import MessageCard from "./message-card";
|
|
10
|
+
import CardFrame from "./card-frame";
|
|
11
|
+
import CardHeader from "./card-header";
|
|
12
|
+
import { Button, Label, Text } from "@stackframe/stack-ui";
|
|
13
|
+
import { runAsynchronously } from "@stackframe/stack-shared/dist/utils/promises";
|
|
14
|
+
export default function PasswordResetInner({ code, fullPage = false }) {
|
|
15
|
+
const [password, setPassword] = useState('');
|
|
16
|
+
const [passwordError, setPasswordError] = useState('');
|
|
17
|
+
const [passwordRepeat, setPasswordRepeat] = useState('');
|
|
18
|
+
const [passwordRepeatError, setPasswordRepeatError] = useState('');
|
|
19
|
+
const [finished, setFinished] = useState(false);
|
|
20
|
+
const [resetError, setResetError] = useState(false);
|
|
21
|
+
const stackApp = useStackApp();
|
|
22
|
+
const onSubmit = async () => {
|
|
23
|
+
if (!password) {
|
|
24
|
+
setPasswordError('Please enter your password');
|
|
25
|
+
return;
|
|
26
|
+
}
|
|
27
|
+
if (!passwordRepeat) {
|
|
28
|
+
setPasswordRepeatError('Please repeat your password');
|
|
29
|
+
return;
|
|
30
|
+
}
|
|
31
|
+
if (password !== passwordRepeat) {
|
|
32
|
+
setPasswordRepeatError('Passwords do not match');
|
|
33
|
+
return;
|
|
34
|
+
}
|
|
35
|
+
const errorMessage = getPasswordError(password);
|
|
36
|
+
if (errorMessage) {
|
|
37
|
+
setPasswordError(errorMessage);
|
|
38
|
+
return;
|
|
39
|
+
}
|
|
40
|
+
const errorCode = await stackApp.resetPassword({ password, code });
|
|
41
|
+
// this should not happen, the outer component should verify the code before rendering this component
|
|
42
|
+
if (errorCode) {
|
|
43
|
+
setResetError(true);
|
|
44
|
+
return;
|
|
45
|
+
}
|
|
46
|
+
setFinished(true);
|
|
47
|
+
};
|
|
48
|
+
if (finished) {
|
|
49
|
+
return _jsx(RedirectMessageCard, { type: 'passwordReset', fullPage: fullPage });
|
|
50
|
+
}
|
|
51
|
+
if (resetError) {
|
|
52
|
+
return (_jsx(MessageCard, { title: "Failed to reset password", fullPage: fullPage, children: _jsx(Text, { children: "Failed to reset password. Please request a new password reset link" }) }));
|
|
53
|
+
}
|
|
54
|
+
return (_jsxs(CardFrame, { fullPage: fullPage, children: [_jsx(CardHeader, { title: "Reset Your Password" }), _jsxs("div", { style: { display: 'flex', flexDirection: 'column', alignItems: 'stretch' }, children: [_jsx(Label, { htmlFor: "password", children: "New Password" }), _jsx(PasswordField, { id: "password", name: "password", value: password, onChange: (e) => {
|
|
55
|
+
setPassword(e.target.value);
|
|
56
|
+
setPasswordError('');
|
|
57
|
+
setPasswordRepeatError('');
|
|
58
|
+
} }), _jsx(FormWarningText, { text: passwordError }), _jsx(Label, { htmlFor: "repeat-password", style: { marginTop: "1rem" }, children: "Repeat New Password" }), _jsx(PasswordField, { id: "repeat-password", name: "repeat-password", value: passwordRepeat, onChange: (e) => {
|
|
59
|
+
setPasswordRepeat(e.target.value);
|
|
60
|
+
setPasswordError('');
|
|
61
|
+
setPasswordRepeatError('');
|
|
62
|
+
} }), _jsx(FormWarningText, { text: passwordRepeatError }), _jsx(Button, { style: { marginTop: '1.5rem' }, onClick: () => runAsynchronously(onSubmit()), children: "Reset Password" })] })] }));
|
|
63
|
+
}
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export default function RedirectMessageCard({ type, fullPage, }: {
|
|
2
|
+
type: 'signedIn' | 'signedOut' | 'emailSent' | 'passwordReset' | 'emailVerified';
|
|
3
|
+
fullPage?: boolean;
|
|
4
|
+
}): import("react/jsx-runtime").JSX.Element;
|
|
5
|
+
//# sourceMappingURL=redirect-message-card.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"redirect-message-card.d.ts","sourceRoot":"","sources":["../../src/elements/redirect-message-card.tsx"],"names":[],"mappings":"AAOA,MAAM,CAAC,OAAO,UAAU,mBAAmB,CAAC,EAC1C,IAAI,EACJ,QAAc,GACf,EAAE;IACD,IAAI,EAAE,UAAU,GAAG,WAAW,GAAG,WAAW,GAAG,eAAe,GAAG,eAAe,CAAC;IACjF,QAAQ,CAAC,EAAE,OAAO,CAAC;CACpB,2CAoEA"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useRouter } from "next/navigation";
|
|
4
|
+
import { useStackApp } from "..";
|
|
5
|
+
import MessageCard from "./message-card";
|
|
6
|
+
import { Text, Button } from "@stackframe/stack-ui";
|
|
7
|
+
export default function RedirectMessageCard({ type, fullPage = false, }) {
|
|
8
|
+
const stackApp = useStackApp();
|
|
9
|
+
const router = useRouter();
|
|
10
|
+
let title;
|
|
11
|
+
let primaryUrl;
|
|
12
|
+
let secondaryUrl = null;
|
|
13
|
+
let message = null;
|
|
14
|
+
let primaryButton;
|
|
15
|
+
let secondaryButton = null;
|
|
16
|
+
switch (type) {
|
|
17
|
+
case 'signedIn': {
|
|
18
|
+
title = "You are already signed in";
|
|
19
|
+
primaryUrl = stackApp.urls.home;
|
|
20
|
+
secondaryUrl = stackApp.urls.signOut;
|
|
21
|
+
primaryButton = "Go to Home";
|
|
22
|
+
secondaryButton = "Sign Out";
|
|
23
|
+
break;
|
|
24
|
+
}
|
|
25
|
+
case 'signedOut': {
|
|
26
|
+
title = "You are not currently signed in.";
|
|
27
|
+
primaryUrl = stackApp.urls.home;
|
|
28
|
+
primaryButton = "Go to Home";
|
|
29
|
+
break;
|
|
30
|
+
}
|
|
31
|
+
case 'emailSent': {
|
|
32
|
+
title = "Email sent!";
|
|
33
|
+
message = 'Please check your inbox. Make sure to check your spam folder.';
|
|
34
|
+
primaryUrl = stackApp.urls.home;
|
|
35
|
+
primaryButton = "Go to Home";
|
|
36
|
+
break;
|
|
37
|
+
}
|
|
38
|
+
case 'passwordReset': {
|
|
39
|
+
title = "Password reset successfully!";
|
|
40
|
+
message = 'Your password has been reset. You can now sign in with your new password.';
|
|
41
|
+
primaryUrl = stackApp.urls.signIn;
|
|
42
|
+
primaryButton = "Go to Sign In";
|
|
43
|
+
break;
|
|
44
|
+
}
|
|
45
|
+
case 'emailVerified': {
|
|
46
|
+
title = "Email verified!";
|
|
47
|
+
message = 'Your have successfully verified your email.';
|
|
48
|
+
primaryUrl = stackApp.urls.home;
|
|
49
|
+
primaryButton = "Go to Home";
|
|
50
|
+
break;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
return (_jsxs(MessageCard, { title: title, fullPage: fullPage, children: [message && _jsx(Text, { children: message }), _jsxs("div", { style: { display: 'flex', flexDirection: 'row', alignItems: 'center', justifyContent: 'center', gap: '16px', marginTop: 20 }, children: [secondaryButton && (_jsx(Button, { variant: "secondary", onClick: () => router.push(stackApp.urls.signOut.toString()), children: secondaryButton })), _jsx(Button, { onClick: () => router.push(primaryUrl.toString()), children: primaryButton })] })] }));
|
|
54
|
+
}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,20 @@
|
|
|
1
|
-
export { default as StackProvider } from "./providers/
|
|
1
|
+
export { default as StackProvider } from "./providers/stack-provider";
|
|
2
2
|
export { useUser, useStackApp } from "./lib/hooks";
|
|
3
3
|
export { StackClientApp, StackServerApp, StackAdminApp } from "./lib/stack-app";
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as EmailVerification } from "./components/
|
|
8
|
-
export { default as PasswordReset } from "./components/
|
|
9
|
-
export { default as ForgotPassword } from "./components/
|
|
10
|
-
|
|
4
|
+
export { default as StackHandler } from "./components-page/stack-handler";
|
|
5
|
+
export { default as SignIn } from "./components-page/sign-in";
|
|
6
|
+
export { default as SignUp } from "./components-page/sign-up";
|
|
7
|
+
export { default as EmailVerification } from "./components-page/email-verification";
|
|
8
|
+
export { default as PasswordReset } from "./components-page/password-reset";
|
|
9
|
+
export { default as ForgotPassword } from "./components-page/forgot-password";
|
|
10
|
+
export { default as CredentialSignIn } from "./components/credential-sign-in";
|
|
11
|
+
export { default as CredentialSignUp } from "./components/credential-sign-up";
|
|
12
|
+
export { default as OAuthButton } from "./components/oauth-button";
|
|
13
|
+
export { default as OAuthGroup } from "./components/oauth-group";
|
|
14
|
+
export { default as PasswordField } from "./components/password-field";
|
|
15
|
+
export { useDesign } from './providers/design-provider';
|
|
16
|
+
export { useComponents } from './providers/component-provider';
|
|
17
|
+
export { StackTheme, ThemeConfig } from './providers/theme-provider';
|
|
18
|
+
export { StackJoyTheme } from './providers/joy-provider';
|
|
19
|
+
export * from './components-core';
|
|
20
|
+
//# 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.
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,4BAA4B,CAAC;AAEtE,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,aAAa,CAAC;AACnD,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,iBAAiB,CAAC;AAEhF,OAAO,EAAE,OAAO,IAAI,YAAY,EAAE,MAAM,iCAAiC,CAAC;AAC1E,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,MAAM,EAAE,MAAM,2BAA2B,CAAC;AAC9D,OAAO,EAAE,OAAO,IAAI,iBAAiB,EAAE,MAAM,sCAAsC,CAAC;AACpF,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,kCAAkC,CAAC;AAC5E,OAAO,EAAE,OAAO,IAAI,cAAc,EAAE,MAAM,mCAAmC,CAAC;AAE9E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,gBAAgB,EAAE,MAAM,iCAAiC,CAAC;AAC9E,OAAO,EAAE,OAAO,IAAI,WAAW,EAAE,MAAM,2BAA2B,CAAC;AACnE,OAAO,EAAE,OAAO,IAAI,UAAU,EAAE,MAAM,0BAA0B,CAAC;AACjE,OAAO,EAAE,OAAO,IAAI,aAAa,EAAE,MAAM,6BAA6B,CAAC;AAEvE,OAAO,EAAE,SAAS,EAAE,MAAM,6BAA6B,CAAC;AACxD,OAAO,EAAE,aAAa,EAAE,MAAM,gCAAgC,CAAC;AAC/D,OAAO,EAAE,UAAU,EAAE,WAAW,EAAE,MAAM,4BAA4B,CAAC;AACrE,OAAO,EAAE,aAAa,EAAE,MAAM,0BAA0B,CAAC;AACzD,cAAc,mBAAmB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -1,11 +1,19 @@
|
|
|
1
|
-
export { default as StackProvider } from "./providers/
|
|
1
|
+
export { default as StackProvider } from "./providers/stack-provider";
|
|
2
2
|
export { useUser, useStackApp } from "./lib/hooks";
|
|
3
3
|
export { StackClientApp, StackServerApp, StackAdminApp } from "./lib/stack-app";
|
|
4
|
-
export { default as
|
|
5
|
-
export { default as
|
|
6
|
-
export { default as
|
|
7
|
-
export { default as EmailVerification } from "./components/
|
|
8
|
-
export { default as PasswordReset } from "./components/
|
|
9
|
-
export { default as ForgotPassword } from "./components/
|
|
10
|
-
|
|
11
|
-
|
|
4
|
+
export { default as StackHandler } from "./components-page/stack-handler";
|
|
5
|
+
export { default as SignIn } from "./components-page/sign-in";
|
|
6
|
+
export { default as SignUp } from "./components-page/sign-up";
|
|
7
|
+
export { default as EmailVerification } from "./components-page/email-verification";
|
|
8
|
+
export { default as PasswordReset } from "./components-page/password-reset";
|
|
9
|
+
export { default as ForgotPassword } from "./components-page/forgot-password";
|
|
10
|
+
export { default as CredentialSignIn } from "./components/credential-sign-in";
|
|
11
|
+
export { default as CredentialSignUp } from "./components/credential-sign-up";
|
|
12
|
+
export { default as OAuthButton } from "./components/oauth-button";
|
|
13
|
+
export { default as OAuthGroup } from "./components/oauth-group";
|
|
14
|
+
export { default as PasswordField } from "./components/password-field";
|
|
15
|
+
export { useDesign } from './providers/design-provider';
|
|
16
|
+
export { useComponents } from './providers/component-provider';
|
|
17
|
+
export { StackTheme } from './providers/theme-provider';
|
|
18
|
+
export { StackJoyTheme } from './providers/joy-provider';
|
|
19
|
+
export * from './components-core';
|
package/dist/lib/auth.d.ts
CHANGED
|
@@ -5,3 +5,4 @@ export declare function signInWithOAuth(iface: StackClientInterface, { provider,
|
|
|
5
5
|
redirectUrl?: string;
|
|
6
6
|
}): Promise<void>;
|
|
7
7
|
export declare function callOAuthCallback(iface: StackClientInterface, tokenStore: TokenStore, redirectUrl: string): Promise<import("oauth4webapi").OAuth2TokenEndpointResponse>;
|
|
8
|
+
//# sourceMappingURL=auth.d.ts.map
|
package/dist/lib/cookie.d.ts
CHANGED
package/dist/lib/hooks.d.ts
CHANGED
package/dist/lib/hooks.js
CHANGED
package/dist/lib/stack-app.d.ts
CHANGED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { ButtonProps } from '../components-core/button';
|
|
3
|
+
import { ContainerProps } from '../components-core/container';
|
|
4
|
+
import { DividerProps } from '../components-core/divider';
|
|
5
|
+
import { InputProps } from '../components-core/input';
|
|
6
|
+
import { LinkProps } from '../components-core/link';
|
|
7
|
+
import { LabelProps } from '../components-core/label';
|
|
8
|
+
import { TextProps } from '../components-core/text';
|
|
9
|
+
export type Components = {
|
|
10
|
+
Button: React.ComponentType<ButtonProps>;
|
|
11
|
+
Container: React.ComponentType<ContainerProps>;
|
|
12
|
+
Divider: React.ComponentType<DividerProps>;
|
|
13
|
+
Input: React.ComponentType<InputProps>;
|
|
14
|
+
Label: React.ComponentType<LabelProps>;
|
|
15
|
+
Link: React.ComponentType<LinkProps>;
|
|
16
|
+
Text: React.ComponentType<TextProps>;
|
|
17
|
+
};
|
|
18
|
+
export type ComponentConfig = {
|
|
19
|
+
components?: Partial<Components>;
|
|
20
|
+
};
|
|
21
|
+
export declare function useComponents(): Components;
|
|
22
|
+
export declare function StackComponentProvider(props: {
|
|
23
|
+
children?: React.ReactNode;
|
|
24
|
+
} & ComponentConfig): import("react/jsx-runtime").JSX.Element;
|
|
25
|
+
//# sourceMappingURL=component-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"component-provider.d.ts","sourceRoot":"","sources":["../../src/providers/component-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAoC,MAAM,OAAO,CAAC;AACzD,OAAe,EAAE,WAAW,EAAE,MAAM,2BAA2B,CAAC;AAChE,OAAkB,EAAE,cAAc,EAAE,MAAM,8BAA8B,CAAC;AACzE,OAAgB,EAAE,YAAY,EAAE,MAAM,4BAA4B,CAAC;AACnE,OAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAC1D,OAAc,EAAE,UAAU,EAAE,MAAM,0BAA0B,CAAC;AAC7D,OAAa,EAAE,SAAS,EAAE,MAAM,yBAAyB,CAAC;AAE1D,MAAM,MAAM,UAAU,GAAG;IACvB,MAAM,EAAE,KAAK,CAAC,aAAa,CAAC,WAAW,CAAC,CAAC;IACzC,SAAS,EAAE,KAAK,CAAC,aAAa,CAAC,cAAc,CAAC,CAAC;IAC/C,OAAO,EAAE,KAAK,CAAC,aAAa,CAAC,YAAY,CAAC,CAAC;IAC3C,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACvC,KAAK,EAAE,KAAK,CAAC,aAAa,CAAC,UAAU,CAAC,CAAC;IACvC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;IACrC,IAAI,EAAE,KAAK,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC;CACtC,CAAA;AAED,MAAM,MAAM,eAAe,GAAG;IAC5B,UAAU,CAAC,EAAE,OAAO,CAAC,UAAU,CAAC,CAAC;CAClC,CAAA;AAID,wBAAgB,aAAa,eAM5B;AAED,wBAAgB,sBAAsB,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,eAAe,2CAc7F"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { createContext, useContext } from 'react';
|
|
4
|
+
import Button from '../components-core/button';
|
|
5
|
+
import Container from '../components-core/container';
|
|
6
|
+
import Divider from '../components-core/divider';
|
|
7
|
+
import Input from '../components-core/input';
|
|
8
|
+
import Link from '../components-core/link';
|
|
9
|
+
import Label from '../components-core/label';
|
|
10
|
+
import Text from '../components-core/text';
|
|
11
|
+
const ComponentContext = createContext(undefined);
|
|
12
|
+
export function useComponents() {
|
|
13
|
+
const context = useContext(ComponentContext);
|
|
14
|
+
if (!context) {
|
|
15
|
+
throw new Error('Stack UI components must be used within a StackTheme');
|
|
16
|
+
}
|
|
17
|
+
return context;
|
|
18
|
+
}
|
|
19
|
+
export function StackComponentProvider(props) {
|
|
20
|
+
return (_jsx(ComponentContext.Provider, { value: {
|
|
21
|
+
Button: props.components?.Button || Button,
|
|
22
|
+
Container: props.components?.Container || Container,
|
|
23
|
+
Divider: props.components?.Divider || Divider,
|
|
24
|
+
Input: props.components?.Input || Input,
|
|
25
|
+
Label: props.components?.Label || Label,
|
|
26
|
+
Link: props.components?.Link || Link,
|
|
27
|
+
Text: props.components?.Text || Text,
|
|
28
|
+
}, children: props.children }));
|
|
29
|
+
}
|
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
type ColorPalette = {
|
|
3
|
+
primaryColor: string;
|
|
4
|
+
secondaryColor: string;
|
|
5
|
+
primaryBgColor: string;
|
|
6
|
+
secondaryBgColor: string;
|
|
7
|
+
neutralColor: string;
|
|
8
|
+
};
|
|
9
|
+
type Breakpoints = {
|
|
10
|
+
xs: number;
|
|
11
|
+
sm: number;
|
|
12
|
+
md: number;
|
|
13
|
+
lg: number;
|
|
14
|
+
xl: number;
|
|
15
|
+
};
|
|
16
|
+
type DesignContextValue = {
|
|
17
|
+
colors: ColorPalette;
|
|
18
|
+
breakpoints: Breakpoints;
|
|
19
|
+
colorMode: 'dark' | 'light';
|
|
20
|
+
setColorMode: (theme: 'dark' | 'light') => void;
|
|
21
|
+
};
|
|
22
|
+
export type DesignConfig = {
|
|
23
|
+
colors?: {
|
|
24
|
+
dark: Partial<ColorPalette>;
|
|
25
|
+
light: Partial<ColorPalette>;
|
|
26
|
+
};
|
|
27
|
+
breakpoints?: Partial<Breakpoints>;
|
|
28
|
+
} & ({} | {
|
|
29
|
+
colorMode: 'dark' | 'light';
|
|
30
|
+
setColorMode: (theme: 'dark' | 'light') => void;
|
|
31
|
+
});
|
|
32
|
+
export declare function hasCustomColorMode(config: DesignConfig): config is DesignConfig & {
|
|
33
|
+
colorMode: 'dark' | 'light';
|
|
34
|
+
setColorMode: (theme: 'dark' | 'light') => void;
|
|
35
|
+
};
|
|
36
|
+
export declare function StackDesignProvider(props: {
|
|
37
|
+
children?: React.ReactNode;
|
|
38
|
+
} & DesignConfig): import("react/jsx-runtime").JSX.Element | null;
|
|
39
|
+
export declare function useDesign(): DesignContextValue;
|
|
40
|
+
export {};
|
|
41
|
+
//# sourceMappingURL=design-provider.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"design-provider.d.ts","sourceRoot":"","sources":["../../src/providers/design-provider.tsx"],"names":[],"mappings":"AAEA,OAAO,KAAK,MAAM,OAAO,CAAC;AAK1B,KAAK,YAAY,GAAG;IAClB,YAAY,EAAE,MAAM,CAAC;IACrB,cAAc,EAAE,MAAM,CAAC;IACvB,cAAc,EAAE,MAAM,CAAC;IACvB,gBAAgB,EAAE,MAAM,CAAC;IACzB,YAAY,EAAE,MAAM,CAAC;CACtB,CAAC;AAEF,KAAK,WAAW,GAAG;IACjB,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;IACX,EAAE,EAAE,MAAM,CAAC;CACZ,CAAC;AAEF,KAAK,kBAAkB,GAAG;IACxB,MAAM,EAAE,YAAY,CAAC;IACrB,WAAW,EAAE,WAAW,CAAC;IACzB,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CACjD,CAAA;AAED,MAAM,MAAM,YAAY,GAAG;IACzB,MAAM,CAAC,EAAE;QACP,IAAI,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;QAC5B,KAAK,EAAE,OAAO,CAAC,YAAY,CAAC,CAAC;KAC9B,CAAC;IACF,WAAW,CAAC,EAAE,OAAO,CAAC,WAAW,CAAC,CAAC;CACpC,GAAG,CACF,EAAE,GACA;IACA,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CACjD,CACF,CAAA;AAYD,wBAAgB,kBAAkB,CAAC,MAAM,EAAE,YAAY,GAAG,MAAM,IAAI,YAAY,GAAG;IACjF,SAAS,EAAE,MAAM,GAAG,OAAO,CAAC;IAC5B,YAAY,EAAE,CAAC,KAAK,EAAE,MAAM,GAAG,OAAO,KAAK,IAAI,CAAC;CACjD,CAEA;AA4BD,wBAAgB,mBAAmB,CAAC,KAAK,EAAE;IAAE,QAAQ,CAAC,EAAE,KAAK,CAAC,SAAS,CAAA;CAAE,GAAG,YAAY,kDA6BvF;AAED,wBAAgB,SAAS,IAAI,kBAAkB,CAM9C"}
|