@terreno/ui 0.1.0 → 0.3.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/AIRequestExplorer.d.ts +31 -0
- package/dist/AIRequestExplorer.js +44 -0
- package/dist/AIRequestExplorer.js.map +1 -0
- package/dist/AttachmentPreview.d.ts +8 -0
- package/dist/AttachmentPreview.js +16 -0
- package/dist/AttachmentPreview.js.map +1 -0
- package/dist/Common.d.ts +44 -0
- package/dist/FilePickerButton.d.ts +13 -0
- package/dist/FilePickerButton.js +50 -0
- package/dist/FilePickerButton.js.map +1 -0
- package/dist/GPTChat.d.ts +66 -0
- package/dist/GPTChat.js +112 -0
- package/dist/GPTChat.js.map +1 -0
- package/dist/GPTMemoryModal.d.ts +8 -0
- package/dist/GPTMemoryModal.js +14 -0
- package/dist/GPTMemoryModal.js.map +1 -0
- package/dist/SocialLoginButton.d.ts +19 -0
- package/dist/SocialLoginButton.js +119 -0
- package/dist/SocialLoginButton.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +8 -0
- package/dist/index.js.map +1 -1
- package/dist/login/LoginScreen.d.ts +25 -0
- package/dist/login/LoginScreen.js +55 -0
- package/dist/login/LoginScreen.js.map +1 -0
- package/dist/login/index.d.ts +2 -0
- package/dist/login/index.js +2 -0
- package/dist/login/index.js.map +1 -0
- package/dist/login/loginTypes.d.ts +48 -0
- package/dist/login/loginTypes.js +2 -0
- package/dist/login/loginTypes.js.map +1 -0
- package/dist/signUp/OAuthButtons.d.ts +18 -0
- package/dist/signUp/OAuthButtons.js +15 -0
- package/dist/signUp/OAuthButtons.js.map +1 -0
- package/dist/signUp/PasswordRequirements.d.ts +15 -0
- package/dist/signUp/PasswordRequirements.js +14 -0
- package/dist/signUp/PasswordRequirements.js.map +1 -0
- package/dist/signUp/SignUpScreen.d.ts +26 -0
- package/dist/signUp/SignUpScreen.js +64 -0
- package/dist/signUp/SignUpScreen.js.map +1 -0
- package/dist/signUp/Swiper.d.ts +13 -0
- package/dist/signUp/Swiper.js +16 -0
- package/dist/signUp/Swiper.js.map +1 -0
- package/dist/signUp/index.d.ts +6 -0
- package/dist/signUp/index.js +6 -0
- package/dist/signUp/index.js.map +1 -0
- package/dist/signUp/passwordPresets.d.ts +9 -0
- package/dist/signUp/passwordPresets.js +41 -0
- package/dist/signUp/passwordPresets.js.map +1 -0
- package/dist/signUp/signUpTypes.d.ts +90 -0
- package/dist/signUp/signUpTypes.js +2 -0
- package/dist/signUp/signUpTypes.js.map +1 -0
- package/package.json +4 -2
- package/src/AIRequestExplorer.tsx +147 -0
- package/src/AttachmentPreview.tsx +63 -0
- package/src/Common.ts +52 -0
- package/src/FilePickerButton.tsx +88 -0
- package/src/GPTChat.tsx +551 -0
- package/src/GPTMemoryModal.tsx +50 -0
- package/src/SocialLoginButton.test.tsx +158 -0
- package/src/SocialLoginButton.tsx +182 -0
- package/src/__snapshots__/SocialLoginButton.test.tsx.snap +277 -0
- package/src/index.tsx +9 -0
- package/src/login/LoginScreen.test.tsx +148 -0
- package/src/login/LoginScreen.tsx +159 -0
- package/src/login/__snapshots__/LoginScreen.test.tsx.snap +630 -0
- package/src/login/index.ts +2 -0
- package/src/login/loginTypes.ts +51 -0
- package/src/signUp/OAuthButtons.test.tsx +45 -0
- package/src/signUp/OAuthButtons.tsx +52 -0
- package/src/signUp/PasswordRequirements.test.tsx +41 -0
- package/src/signUp/PasswordRequirements.tsx +49 -0
- package/src/signUp/SignUpScreen.test.tsx +134 -0
- package/src/signUp/SignUpScreen.tsx +172 -0
- package/src/signUp/Swiper.test.tsx +46 -0
- package/src/signUp/Swiper.tsx +59 -0
- package/src/signUp/__snapshots__/OAuthButtons.test.tsx.snap +272 -0
- package/src/signUp/__snapshots__/PasswordRequirements.test.tsx.snap +427 -0
- package/src/signUp/__snapshots__/SignUpScreen.test.tsx.snap +851 -0
- package/src/signUp/__snapshots__/Swiper.test.tsx.snap +249 -0
- package/src/signUp/index.ts +13 -0
- package/src/signUp/passwordPresets.test.ts +57 -0
- package/src/signUp/passwordPresets.ts +43 -0
- package/src/signUp/signUpTypes.ts +94 -0
|
@@ -0,0 +1,119 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import FontAwesome6 from "@expo/vector-icons/FontAwesome6";
|
|
3
|
+
import debounce from "lodash/debounce";
|
|
4
|
+
import { useMemo, useState } from "react";
|
|
5
|
+
import { ActivityIndicator, Pressable, Text, View } from "react-native";
|
|
6
|
+
import { Box } from "./Box";
|
|
7
|
+
import { useTheme } from "./Theme";
|
|
8
|
+
import { Unifier } from "./Unifier";
|
|
9
|
+
/**
|
|
10
|
+
* Brand colors for social login providers
|
|
11
|
+
*/
|
|
12
|
+
const PROVIDER_COLORS = {
|
|
13
|
+
apple: {
|
|
14
|
+
background: "#000000",
|
|
15
|
+
border: "#000000",
|
|
16
|
+
text: "#ffffff",
|
|
17
|
+
},
|
|
18
|
+
github: {
|
|
19
|
+
background: "#24292e",
|
|
20
|
+
border: "#24292e",
|
|
21
|
+
text: "#ffffff",
|
|
22
|
+
},
|
|
23
|
+
google: {
|
|
24
|
+
background: "#ffffff",
|
|
25
|
+
border: "#dadce0",
|
|
26
|
+
text: "#1f1f1f",
|
|
27
|
+
},
|
|
28
|
+
};
|
|
29
|
+
/**
|
|
30
|
+
* Font Awesome icon names for social providers
|
|
31
|
+
*/
|
|
32
|
+
const PROVIDER_ICONS = {
|
|
33
|
+
apple: "apple",
|
|
34
|
+
github: "github",
|
|
35
|
+
google: "google",
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* Display names for social providers
|
|
39
|
+
*/
|
|
40
|
+
const PROVIDER_NAMES = {
|
|
41
|
+
apple: "Apple",
|
|
42
|
+
github: "GitHub",
|
|
43
|
+
google: "Google",
|
|
44
|
+
};
|
|
45
|
+
/**
|
|
46
|
+
* A branded social login button for OAuth authentication.
|
|
47
|
+
*
|
|
48
|
+
* Supports Google, GitHub, and Apple sign-in with appropriate brand colors
|
|
49
|
+
* and icons following each provider's brand guidelines.
|
|
50
|
+
*
|
|
51
|
+
* @example
|
|
52
|
+
* ```tsx
|
|
53
|
+
* <SocialLoginButton
|
|
54
|
+
* provider="google"
|
|
55
|
+
* onPress={async () => {
|
|
56
|
+
* await authClient.signIn.social({ provider: "google" });
|
|
57
|
+
* }}
|
|
58
|
+
* />
|
|
59
|
+
* ```
|
|
60
|
+
*/
|
|
61
|
+
export const SocialLoginButton = ({ provider, onPress, loading: propsLoading, variant = "primary", disabled = false, fullWidth = true, text, testID, }) => {
|
|
62
|
+
const [loading, setLoading] = useState(propsLoading);
|
|
63
|
+
const { theme } = useTheme();
|
|
64
|
+
const { backgroundColor, borderColor, textColor } = useMemo(() => {
|
|
65
|
+
var _a, _b;
|
|
66
|
+
const colors = PROVIDER_COLORS[provider];
|
|
67
|
+
if (variant === "outline") {
|
|
68
|
+
return {
|
|
69
|
+
backgroundColor: (_a = theme === null || theme === void 0 ? void 0 : theme.surface.base) !== null && _a !== void 0 ? _a : "#ffffff",
|
|
70
|
+
borderColor: colors.border,
|
|
71
|
+
textColor: (_b = theme === null || theme === void 0 ? void 0 : theme.text.primary) !== null && _b !== void 0 ? _b : "#1f1f1f",
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
return {
|
|
75
|
+
backgroundColor: colors.background,
|
|
76
|
+
borderColor: colors.border,
|
|
77
|
+
textColor: colors.text,
|
|
78
|
+
};
|
|
79
|
+
}, [provider, variant, theme]);
|
|
80
|
+
const iconName = PROVIDER_ICONS[provider];
|
|
81
|
+
const providerName = PROVIDER_NAMES[provider];
|
|
82
|
+
const buttonText = text !== null && text !== void 0 ? text : `Continue with ${providerName}`;
|
|
83
|
+
const handlePress = useMemo(() => debounce(async () => {
|
|
84
|
+
await Unifier.utils.haptic();
|
|
85
|
+
setLoading(true);
|
|
86
|
+
try {
|
|
87
|
+
await onPress();
|
|
88
|
+
}
|
|
89
|
+
catch (error) {
|
|
90
|
+
console.error(`Social login error (${provider}):`, error);
|
|
91
|
+
}
|
|
92
|
+
finally {
|
|
93
|
+
setLoading(false);
|
|
94
|
+
}
|
|
95
|
+
}, 500, { leading: true }), [onPress, provider]);
|
|
96
|
+
if (!theme) {
|
|
97
|
+
return null;
|
|
98
|
+
}
|
|
99
|
+
const isDisabled = disabled || loading;
|
|
100
|
+
return (_jsx(Pressable, { accessibilityHint: `Sign in with ${providerName}`, "aria-label": buttonText, "aria-role": "button", disabled: isDisabled, onPress: handlePress, style: {
|
|
101
|
+
alignItems: "center",
|
|
102
|
+
alignSelf: fullWidth ? "stretch" : undefined,
|
|
103
|
+
backgroundColor: isDisabled ? theme.surface.disabled : backgroundColor,
|
|
104
|
+
borderColor,
|
|
105
|
+
borderRadius: theme.radius.rounded,
|
|
106
|
+
borderWidth: 1,
|
|
107
|
+
flexDirection: "row",
|
|
108
|
+
justifyContent: "center",
|
|
109
|
+
opacity: isDisabled ? 0.6 : 1,
|
|
110
|
+
paddingHorizontal: 20,
|
|
111
|
+
paddingVertical: 12,
|
|
112
|
+
width: fullWidth ? "100%" : "auto",
|
|
113
|
+
}, testID: testID !== null && testID !== void 0 ? testID : `social-login-${provider}`, children: _jsxs(View, { style: { alignItems: "center", flexDirection: "row" }, children: [Boolean(iconName) && (_jsx(View, { style: { marginRight: 12 }, children: _jsx(FontAwesome6, { brand: true, color: isDisabled ? theme.text.secondaryLight : textColor, name: iconName, size: 20 }) })), _jsx(Text, { style: {
|
|
114
|
+
color: isDisabled ? theme.text.secondaryLight : textColor,
|
|
115
|
+
fontSize: 16,
|
|
116
|
+
fontWeight: "600",
|
|
117
|
+
}, children: buttonText }), Boolean(loading) && (_jsx(Box, { marginLeft: 2, children: _jsx(ActivityIndicator, { color: isDisabled ? theme.text.secondaryLight : textColor, size: "small" }) }))] }) }));
|
|
118
|
+
};
|
|
119
|
+
//# sourceMappingURL=SocialLoginButton.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,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AC,UAAU,EAAE,QAAQ,EAAE,aAAa,EAAE,KAAK,EAAC,aACtD,OAAO,CAAC,QAAQ,CAAC,IAAI,CACpB,KAAC,IAAI,IAAC,KAAK,EAAE,EAAC,WAAW,EAAE,EAAE,EAAC,YAC5B,KAAC,YAAY,IACX,KAAK,QACL,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EACzD,IAAI,EAAE,QAAQ,EACd,IAAI,EAAE,EAAE,GACR,GACG,CACR,EACD,KAAC,IAAI,IACH,KAAK,EAAE;wBACL,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS;wBACzD,QAAQ,EAAE,EAAE;wBACZ,UAAU,EAAE,KAAK;qBAClB,YAEA,UAAU,GACN,EACN,OAAO,CAAC,OAAO,CAAC,IAAI,CACnB,KAAC,GAAG,IAAC,UAAU,EAAE,CAAC,YAChB,KAAC,iBAAiB,IAChB,KAAK,EAAE,UAAU,CAAC,CAAC,CAAC,KAAK,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC,CAAC,SAAS,EACzD,IAAI,EAAC,OAAO,GACZ,GACE,CACP,IACI,GACG,CACb,CAAC;AACJ,CAAC,CAAC"}
|
package/dist/index.d.ts
CHANGED
|
@@ -2,6 +2,8 @@ export type { StyleProp, ViewStyle } from "react-native";
|
|
|
2
2
|
export * from "./Accordion";
|
|
3
3
|
export * from "./ActionSheet";
|
|
4
4
|
export * from "./AddressField";
|
|
5
|
+
export * from "./AIRequestExplorer";
|
|
6
|
+
export * from "./AttachmentPreview";
|
|
5
7
|
export * from "./Avatar";
|
|
6
8
|
export * from "./Badge";
|
|
7
9
|
export * from "./Banner";
|
|
@@ -25,7 +27,10 @@ export { default as EmojiSelector } from "./EmojiSelector";
|
|
|
25
27
|
export * from "./ErrorBoundary";
|
|
26
28
|
export * from "./ErrorPage";
|
|
27
29
|
export * from "./Field";
|
|
30
|
+
export * from "./FilePickerButton";
|
|
28
31
|
export * from "./FlatList";
|
|
32
|
+
export * from "./GPTChat";
|
|
33
|
+
export * from "./GPTMemoryModal";
|
|
29
34
|
export * from "./Heading";
|
|
30
35
|
export * from "./HeightActionSheet";
|
|
31
36
|
export * from "./Icon";
|
|
@@ -35,6 +40,7 @@ export * from "./ImageBackground";
|
|
|
35
40
|
export * from "./InfoModalIcon";
|
|
36
41
|
export * from "./InfoTooltipButton";
|
|
37
42
|
export * from "./Link";
|
|
43
|
+
export * from "./login";
|
|
38
44
|
export * from "./MarkdownView";
|
|
39
45
|
export * from "./MediaQuery";
|
|
40
46
|
export * from "./MobileAddressAutoComplete";
|
|
@@ -59,8 +65,10 @@ export * from "./SideDrawer";
|
|
|
59
65
|
export * from "./Signature";
|
|
60
66
|
export * from "./SignatureField";
|
|
61
67
|
export * from "./Slider";
|
|
68
|
+
export * from "./SocialLoginButton";
|
|
62
69
|
export * from "./Spinner";
|
|
63
70
|
export * from "./SplitPage";
|
|
71
|
+
export * from "./signUp";
|
|
64
72
|
export * from "./TapToEdit";
|
|
65
73
|
export * from "./TerrenoProvider";
|
|
66
74
|
export * from "./Text";
|
package/dist/index.js
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
export * from "./Accordion";
|
|
2
2
|
export * from "./ActionSheet";
|
|
3
3
|
export * from "./AddressField";
|
|
4
|
+
export * from "./AIRequestExplorer";
|
|
5
|
+
export * from "./AttachmentPreview";
|
|
4
6
|
export * from "./Avatar";
|
|
5
7
|
export * from "./Badge";
|
|
6
8
|
export * from "./Banner";
|
|
@@ -24,7 +26,10 @@ export { default as EmojiSelector } from "./EmojiSelector";
|
|
|
24
26
|
export * from "./ErrorBoundary";
|
|
25
27
|
export * from "./ErrorPage";
|
|
26
28
|
export * from "./Field";
|
|
29
|
+
export * from "./FilePickerButton";
|
|
27
30
|
export * from "./FlatList";
|
|
31
|
+
export * from "./GPTChat";
|
|
32
|
+
export * from "./GPTMemoryModal";
|
|
28
33
|
export * from "./Heading";
|
|
29
34
|
export * from "./HeightActionSheet";
|
|
30
35
|
export * from "./Icon";
|
|
@@ -34,6 +39,7 @@ export * from "./ImageBackground";
|
|
|
34
39
|
export * from "./InfoModalIcon";
|
|
35
40
|
export * from "./InfoTooltipButton";
|
|
36
41
|
export * from "./Link";
|
|
42
|
+
export * from "./login";
|
|
37
43
|
export * from "./MarkdownView";
|
|
38
44
|
export * from "./MediaQuery";
|
|
39
45
|
export * from "./MobileAddressAutoComplete";
|
|
@@ -58,8 +64,10 @@ export * from "./SideDrawer";
|
|
|
58
64
|
export * from "./Signature";
|
|
59
65
|
export * from "./SignatureField";
|
|
60
66
|
export * from "./Slider";
|
|
67
|
+
export * from "./SocialLoginButton";
|
|
61
68
|
export * from "./Spinner";
|
|
62
69
|
export * from "./SplitPage";
|
|
70
|
+
export * from "./signUp";
|
|
63
71
|
export * from "./TapToEdit";
|
|
64
72
|
export * from "./TerrenoProvider";
|
|
65
73
|
export * from "./Text";
|
package/dist/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.tsx"],"names":[],"mappings":"AAEA,cAAc,aAAa,CAAC;AAC5B,cAAc,eAAe,CAAC;AAC9B,cAAc,gBAAgB,CAAC;AAC/B,cAAc,UAAU,CAAC;AACzB,cAAc,SAAS,CAAC;AACxB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,gBAAgB,CAAC;AAC/B,cAAc,OAAO,CAAC;AACtB,cAAc,UAAU,CAAC;AACzB,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,qBAAqB,CAAC;AACpC,cAAc,aAAa,CAAC;AAC5B,cAAc,uBAAuB,CAAC;AACtC,cAAc,iBAAiB,CAAC;AAChC,cAAc,iBAAiB,CA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AC;AAC1B,cAAc,aAAa,CAAC;AAC5B,cAAc,UAAU,CAAC;AACzB,cAAc,aAAa,CAAC;AAC5B,cAAc,mBAAmB,CAAC;AAClC,cAAc,QAAQ,CAAC;AACvB,cAAc,YAAY,CAAC;AAC3B,cAAc,aAAa,CAAC;AAC5B,cAAc,SAAS,CAAC;AACxB,cAAc,SAAS,CAAC;AACxB,cAAc,WAAW,CAAC;AAC1B,cAAc,eAAe,CAAC;AAC9B,cAAc,eAAe,CAAC;AAC9B,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,mBAAmB,CAAC;AAClC,cAAc,qBAAqB,CAAC;AACpC,cAAc,yBAAyB,CAAC;AACxC,cAAc,yBAAyB,CAAC;AACxC,cAAc,qBAAqB,CAAC;AACpC,cAAc,kBAAkB,CAAC;AACjC,cAAc,mBAAmB,CAAC;AAClC,cAAc,oBAAoB,CAAC;AACnC,cAAc,sBAAsB,CAAC;AACrC,cAAc,8BAA8B,CAAC;AAC7C,cAAc,WAAW,CAAC;AAC1B,cAAc,kBAAkB,CAAC;AACjC,cAAc,aAAa,CAAC;AAC5B,cAAc,kBAAkB,CAAC;AACjC,cAAc,0BAA0B,CAAC"}
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { LoginScreenProps } from "./loginTypes";
|
|
3
|
+
/**
|
|
4
|
+
* A configurable login screen component with support for custom fields,
|
|
5
|
+
* OAuth providers, sign-up link, and forgot password link.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <LoginScreen
|
|
10
|
+
* fields={[
|
|
11
|
+
* {name: "email", label: "Email", type: "email", required: true},
|
|
12
|
+
* {name: "password", label: "Password", type: "password", required: true},
|
|
13
|
+
* ]}
|
|
14
|
+
* onSubmit={async (values) => {
|
|
15
|
+
* await signIn(values.email, values.password);
|
|
16
|
+
* }}
|
|
17
|
+
* oauthProviders={[
|
|
18
|
+
* {provider: "google", onPress: () => signInWithSocial("google")},
|
|
19
|
+
* ]}
|
|
20
|
+
* onSignUpPress={() => router.push("/signup")}
|
|
21
|
+
* onForgotPasswordPress={() => router.push("/forgot-password")}
|
|
22
|
+
* />
|
|
23
|
+
* ```
|
|
24
|
+
*/
|
|
25
|
+
export declare const LoginScreen: FC<LoginScreenProps>;
|
|
@@ -0,0 +1,55 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { Box } from "../Box";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Heading } from "../Heading";
|
|
6
|
+
import { Page } from "../Page";
|
|
7
|
+
import { OAuthButtons } from "../signUp/OAuthButtons";
|
|
8
|
+
import { Text } from "../Text";
|
|
9
|
+
import { TextField } from "../TextField";
|
|
10
|
+
/**
|
|
11
|
+
* A configurable login screen component with support for custom fields,
|
|
12
|
+
* OAuth providers, sign-up link, and forgot password link.
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```tsx
|
|
16
|
+
* <LoginScreen
|
|
17
|
+
* fields={[
|
|
18
|
+
* {name: "email", label: "Email", type: "email", required: true},
|
|
19
|
+
* {name: "password", label: "Password", type: "password", required: true},
|
|
20
|
+
* ]}
|
|
21
|
+
* onSubmit={async (values) => {
|
|
22
|
+
* await signIn(values.email, values.password);
|
|
23
|
+
* }}
|
|
24
|
+
* oauthProviders={[
|
|
25
|
+
* {provider: "google", onPress: () => signInWithSocial("google")},
|
|
26
|
+
* ]}
|
|
27
|
+
* onSignUpPress={() => router.push("/signup")}
|
|
28
|
+
* onForgotPasswordPress={() => router.push("/forgot-password")}
|
|
29
|
+
* />
|
|
30
|
+
* ```
|
|
31
|
+
*/
|
|
32
|
+
export const LoginScreen = ({ fields, onSubmit, oauthProviders, logo, title = "Welcome Back", loading = false, error, signUpLinkText = "Need an account? Sign Up", onSignUpPress, forgotPasswordText = "Forgot password?", onForgotPasswordPress, testID = "login-screen", }) => {
|
|
33
|
+
const [formValues, setFormValues] = useState(() => {
|
|
34
|
+
const initial = {};
|
|
35
|
+
for (const field of fields) {
|
|
36
|
+
initial[field.name] = "";
|
|
37
|
+
}
|
|
38
|
+
return initial;
|
|
39
|
+
});
|
|
40
|
+
const handleFieldChange = useCallback((fieldName, value) => {
|
|
41
|
+
setFormValues((prev) => (Object.assign(Object.assign({}, prev), { [fieldName]: value })));
|
|
42
|
+
}, []);
|
|
43
|
+
const handleSubmit = useCallback(async () => {
|
|
44
|
+
await onSubmit(formValues);
|
|
45
|
+
}, [formValues, onSubmit]);
|
|
46
|
+
const requiredFieldsFilled = fields
|
|
47
|
+
.filter((f) => f.required)
|
|
48
|
+
.every((f) => { var _a; return ((_a = formValues[f.name]) !== null && _a !== void 0 ? _a : "").trim().length > 0; });
|
|
49
|
+
const isSubmitDisabled = loading || !requiredFieldsFilled;
|
|
50
|
+
return (_jsx(Page, { navigation: undefined, children: _jsxs(Box, { alignItems: "center", alignSelf: "center", flex: "grow", justifyContent: "center", maxWidth: 400, padding: 4, testID: testID, width: "100%", children: [Boolean(logo) && _jsx(Box, { marginBottom: 6, children: logo }), _jsx(Box, { marginBottom: 8, children: _jsx(Heading, { testID: `${testID}-title`, children: title }) }), _jsxs(Box, { gap: 4, width: "100%", children: [fields.map((field) => {
|
|
51
|
+
var _a;
|
|
52
|
+
return (_jsx(TextField, { autoComplete: field.autoComplete, disabled: loading, onChange: (value) => handleFieldChange(field.name, value), placeholder: (_a = field.placeholder) !== null && _a !== void 0 ? _a : field.label, testID: `${testID}-${field.name}-input`, title: field.label, type: field.type === "email" ? "email" : field.type === "password" ? "password" : "text", value: formValues[field.name] }, field.name));
|
|
53
|
+
}), Boolean(error) && (_jsx(Text, { color: "error", testID: `${testID}-error`, children: error })), _jsx(Box, { marginTop: 4, children: _jsx(Button, { disabled: isSubmitDisabled, fullWidth: true, loading: loading, onClick: handleSubmit, testID: `${testID}-submit-button`, text: "Log In" }) }), Boolean(onForgotPasswordPress) && (_jsx(Box, { alignItems: "center", marginTop: 2, children: _jsx(Button, { disabled: loading, onClick: onForgotPasswordPress, testID: `${testID}-forgot-password`, text: forgotPasswordText, variant: "muted" }) })), Boolean(onSignUpPress) && (_jsx(Box, { marginTop: 2, children: _jsx(Button, { disabled: loading, fullWidth: true, onClick: onSignUpPress, testID: `${testID}-signup-link`, text: signUpLinkText, variant: "outline" }) })), Boolean(oauthProviders && oauthProviders.length > 0) && (_jsx(OAuthButtons, { disabled: loading, providers: oauthProviders, testID: `${testID}-oauth` }))] })] }) }));
|
|
54
|
+
};
|
|
55
|
+
//# sourceMappingURL=LoginScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginScreen.js","sourceRoot":"","sources":["../../src/login/LoginScreen.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,YAAY,EAAC,MAAM,wBAAwB,CAAC;AACpD,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AAGvC;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,CAAC,MAAM,WAAW,GAAyB,CAAC,EAChD,MAAM,EACN,QAAQ,EACR,cAAc,EACd,IAAI,EACJ,KAAK,GAAG,cAAc,EACtB,OAAO,GAAG,KAAK,EACf,KAAK,EACL,cAAc,GAAG,0BAA0B,EAC3C,aAAa,EACb,kBAAkB,GAAG,kBAAkB,EACvC,qBAAqB,EACrB,MAAM,GAAG,cAAc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C,MAAM,IACL,QAAQ,EAAE,gBAAgB,EAC1B,SAAS,QACT,OAAO,EAAE,OAAO,EAChB,OAAO,EAAE,YAAY,EACrB,MAAM,EAAE,GAAG,MAAM,gBAAgB,EACjC,IAAI,EAAC,QAAQ,GACb,GACE,EAEL,OAAO,CAAC,qBAAqB,CAAC,IAAI,CACjC,KAAC,GAAG,IAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,YACnC,KAAC,MAAM,IACL,QAAQ,EAAE,OAAO,EACjB,OAAO,EAAE,qBAAsB,EAC/B,MAAM,EAAE,GAAG,MAAM,kBAAkB,EACnC,IAAI,EAAE,kBAAmB,EACzB,OAAO,EAAC,OAAO,GACf,GACE,CACP,EAEA,OAAO,CAAC,aAAa,CAAC,IAAI,CACzB,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,MAAM,IACL,QAAQ,EAAE,OAAO,EACjB,SAAS,QACT,OAAO,EAAE,aAAc,EACvB,MAAM,EAAE,GAAG,MAAM,cAAc,EAC/B,IAAI,EAAE,cAAe,EACrB,OAAO,EAAC,SAAS,GACjB,GACE,CACP,EAEA,OAAO,CAAC,cAAc,IAAI,cAAc,CAAC,MAAM,GAAG,CAAC,CAAC,IAAI,CACvD,KAAC,YAAY,IACX,QAAQ,EAAE,OAAO,EACjB,SAAS,EAAE,cAAe,EAC1B,MAAM,EAAE,GAAG,MAAM,QAAQ,GACzB,CACH,IACG,IACF,GACD,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/login/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,WAAW,EAAC,MAAM,eAAe,CAAC"}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import type { ReactNode } from "react";
|
|
2
|
+
import type { OAuthProviderConfig } from "../signUp/signUpTypes";
|
|
3
|
+
/**
|
|
4
|
+
* Configuration for a login form field.
|
|
5
|
+
*/
|
|
6
|
+
export interface LoginFieldConfig {
|
|
7
|
+
/** Unique field name used as the key in form state. */
|
|
8
|
+
name: string;
|
|
9
|
+
/** Display label for the field. */
|
|
10
|
+
label: string;
|
|
11
|
+
/** Placeholder text shown when the field is empty. */
|
|
12
|
+
placeholder?: string;
|
|
13
|
+
/** Input type for the field. */
|
|
14
|
+
type?: "text" | "email" | "password";
|
|
15
|
+
/** Whether the field is required. */
|
|
16
|
+
required?: boolean;
|
|
17
|
+
/** Auto-complete hint for the field. */
|
|
18
|
+
autoComplete?: "current-password" | "on" | "off" | "username";
|
|
19
|
+
}
|
|
20
|
+
/**
|
|
21
|
+
* Props for the LoginScreen component.
|
|
22
|
+
*/
|
|
23
|
+
export interface LoginScreenProps {
|
|
24
|
+
/** Form field configurations. */
|
|
25
|
+
fields: LoginFieldConfig[];
|
|
26
|
+
/** Callback triggered on form submission. Receives field values as a record. */
|
|
27
|
+
onSubmit: (values: Record<string, string>) => Promise<void>;
|
|
28
|
+
/** Optional OAuth provider configurations for social login buttons. */
|
|
29
|
+
oauthProviders?: OAuthProviderConfig[];
|
|
30
|
+
/** Custom logo or banner to display above the form. */
|
|
31
|
+
logo?: ReactNode;
|
|
32
|
+
/** Title text for the login form. */
|
|
33
|
+
title?: string;
|
|
34
|
+
/** Whether the form is in a loading state. */
|
|
35
|
+
loading?: boolean;
|
|
36
|
+
/** Error message to display. */
|
|
37
|
+
error?: string;
|
|
38
|
+
/** Text for the link to navigate to sign up. */
|
|
39
|
+
signUpLinkText?: string;
|
|
40
|
+
/** Callback triggered when the sign-up link is pressed. */
|
|
41
|
+
onSignUpPress?: () => void;
|
|
42
|
+
/** Text for the forgot password link. */
|
|
43
|
+
forgotPasswordText?: string;
|
|
44
|
+
/** Callback triggered when the forgot password link is pressed. */
|
|
45
|
+
onForgotPasswordPress?: () => void;
|
|
46
|
+
/** Test ID for the root element. */
|
|
47
|
+
testID?: string;
|
|
48
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"loginTypes.js","sourceRoot":"","sources":["../../src/login/loginTypes.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { OAuthProviderConfig } from "./signUpTypes";
|
|
3
|
+
interface OAuthButtonsProps {
|
|
4
|
+
/** OAuth provider configurations. */
|
|
5
|
+
providers: OAuthProviderConfig[];
|
|
6
|
+
/** Whether all buttons should be disabled. */
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
/** Divider text displayed above the OAuth buttons. */
|
|
9
|
+
dividerText?: string;
|
|
10
|
+
/** Test ID prefix for the component. */
|
|
11
|
+
testID?: string;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* Renders OAuth provider buttons with an optional divider text.
|
|
15
|
+
* Uses SocialLoginButton for branded provider buttons.
|
|
16
|
+
*/
|
|
17
|
+
export declare const OAuthButtons: FC<OAuthButtonsProps>;
|
|
18
|
+
export {};
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Box } from "../Box";
|
|
3
|
+
import { SocialLoginButton } from "../SocialLoginButton";
|
|
4
|
+
import { Text } from "../Text";
|
|
5
|
+
/**
|
|
6
|
+
* Renders OAuth provider buttons with an optional divider text.
|
|
7
|
+
* Uses SocialLoginButton for branded provider buttons.
|
|
8
|
+
*/
|
|
9
|
+
export const OAuthButtons = ({ providers, disabled = false, dividerText = "Or continue with", testID = "oauth-buttons", }) => {
|
|
10
|
+
if (providers.length === 0) {
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
return (_jsxs(Box, { testID: testID, width: "100%", children: [_jsx(Box, { alignItems: "center", marginTop: 6, children: _jsx(Text, { color: "secondaryLight", children: dividerText }) }), _jsx(Box, { gap: 3, marginTop: 4, children: providers.map((config) => (_jsx(SocialLoginButton, { disabled: disabled || config.disabled, loading: config.loading, onPress: config.onPress, provider: config.provider, testID: `${testID}-${config.provider}` }, config.provider))) })] }));
|
|
14
|
+
};
|
|
15
|
+
//# sourceMappingURL=OAuthButtons.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"OAuthButtons.js","sourceRoot":"","sources":["../../src/signUp/OAuthButtons.tsx"],"names":[],"mappings":";AAEA,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAC,iBAAiB,EAAC,MAAM,sBAAsB,CAAC;AACvD,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAc7B;;;GAGG;AACH,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,EAClD,SAAS,EACT,QAAQ,GAAG,KAAK,EAChB,WAAW,GAAG,kBAAkB,EAChC,MAAM,GAAG,eAAe,GACzB,EAAE,EAAE;IACH,IAAI,SAAS,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QAC3B,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,MAAC,GAAG,IAAC,MAAM,EAAE,MAAM,EAAE,KAAK,EAAC,MAAM,aAC/B,KAAC,GAAG,IAAC,UAAU,EAAC,QAAQ,EAAC,SAAS,EAAE,CAAC,YACnC,KAAC,IAAI,IAAC,KAAK,EAAC,gBAAgB,YAAE,WAAW,GAAQ,GAC7C,EACN,KAAC,GAAG,IAAC,GAAG,EAAE,CAAC,EAAE,SAAS,EAAE,CAAC,YACtB,SAAS,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,EAAE,CAAC,CACzB,KAAC,iBAAiB,IAChB,QAAQ,EAAE,QAAQ,IAAI,MAAM,CAAC,QAAQ,EAErC,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,OAAO,EAAE,MAAM,CAAC,OAAO,EACvB,QAAQ,EAAE,MAAM,CAAC,QAAQ,EACzB,MAAM,EAAE,GAAG,MAAM,IAAI,MAAM,CAAC,QAAQ,EAAE,IAJjC,MAAM,CAAC,QAAQ,CAKpB,CACH,CAAC,GACE,IACF,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { PasswordRequirement } from "./signUpTypes";
|
|
3
|
+
interface PasswordRequirementsProps {
|
|
4
|
+
/** The current password value to validate against. */
|
|
5
|
+
password: string;
|
|
6
|
+
/** List of password requirements to display. */
|
|
7
|
+
requirements: PasswordRequirement[];
|
|
8
|
+
/** Test ID prefix for the component. */
|
|
9
|
+
testID?: string;
|
|
10
|
+
}
|
|
11
|
+
/**
|
|
12
|
+
* Displays a list of password requirements with check/cross indicators.
|
|
13
|
+
*/
|
|
14
|
+
export declare const PasswordRequirements: FC<PasswordRequirementsProps>;
|
|
15
|
+
export {};
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { View } from "react-native";
|
|
3
|
+
import { Icon } from "../Icon";
|
|
4
|
+
import { Text } from "../Text";
|
|
5
|
+
/**
|
|
6
|
+
* Displays a list of password requirements with check/cross indicators.
|
|
7
|
+
*/
|
|
8
|
+
export const PasswordRequirements = ({ password, requirements, testID = "password-requirements", }) => {
|
|
9
|
+
return (_jsx(View, { testID: testID, children: requirements.map((req) => {
|
|
10
|
+
const isMet = password.length > 0 && req.validate(password);
|
|
11
|
+
return (_jsxs(View, { style: { alignItems: "center", flexDirection: "row", gap: 8, marginBottom: 4 }, testID: `${testID}-${req.key}`, children: [_jsx(Icon, { color: isMet ? "success" : "secondaryLight", iconName: isMet ? "circle-check" : "circle", size: "sm", testID: `${testID}-${req.key}-icon` }), _jsx(Text, { color: isMet ? "success" : "secondaryLight", size: "sm", children: req.label })] }, req.key));
|
|
12
|
+
}) }));
|
|
13
|
+
};
|
|
14
|
+
//# sourceMappingURL=PasswordRequirements.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PasswordRequirements.js","s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,CAAC,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { SignUpScreenProps } from "./signUpTypes";
|
|
3
|
+
/**
|
|
4
|
+
* A configurable sign-up screen component with support for custom fields,
|
|
5
|
+
* password requirements, OAuth providers, and onboarding pages.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* ```tsx
|
|
9
|
+
* <SignUpScreen
|
|
10
|
+
* fields={[
|
|
11
|
+
* {name: "name", label: "Name", type: "text", required: true},
|
|
12
|
+
* {name: "email", label: "Email", type: "email", required: true},
|
|
13
|
+
* {name: "password", label: "Password", type: "password", required: true},
|
|
14
|
+
* ]}
|
|
15
|
+
* onSubmit={async (values) => {
|
|
16
|
+
* await signUp(values.email, values.password, values.name);
|
|
17
|
+
* }}
|
|
18
|
+
* passwordRequirements={defaultPasswordRequirements}
|
|
19
|
+
* oauthProviders={[
|
|
20
|
+
* {provider: "google", onPress: () => signInWithSocial("google")},
|
|
21
|
+
* ]}
|
|
22
|
+
* onLoginPress={() => router.push("/login")}
|
|
23
|
+
* />
|
|
24
|
+
* ```
|
|
25
|
+
*/
|
|
26
|
+
export declare const SignUpScreen: FC<SignUpScreenProps>;
|
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useCallback, useState } from "react";
|
|
3
|
+
import { Box } from "../Box";
|
|
4
|
+
import { Button } from "../Button";
|
|
5
|
+
import { Heading } from "../Heading";
|
|
6
|
+
import { Page } from "../Page";
|
|
7
|
+
import { Text } from "../Text";
|
|
8
|
+
import { TextField } from "../TextField";
|
|
9
|
+
import { OAuthButtons } from "./OAuthButtons";
|
|
10
|
+
import { PasswordRequirements } from "./PasswordRequirements";
|
|
11
|
+
import { Swiper } from "./Swiper";
|
|
12
|
+
/**
|
|
13
|
+
* A configurable sign-up screen component with support for custom fields,
|
|
14
|
+
* password requirements, OAuth providers, and onboarding pages.
|
|
15
|
+
*
|
|
16
|
+
* @example
|
|
17
|
+
* ```tsx
|
|
18
|
+
* <SignUpScreen
|
|
19
|
+
* fields={[
|
|
20
|
+
* {name: "name", label: "Name", type: "text", required: true},
|
|
21
|
+
* {name: "email", label: "Email", type: "email", required: true},
|
|
22
|
+
* {name: "password", label: "Password", type: "password", required: true},
|
|
23
|
+
* ]}
|
|
24
|
+
* onSubmit={async (values) => {
|
|
25
|
+
* await signUp(values.email, values.password, values.name);
|
|
26
|
+
* }}
|
|
27
|
+
* passwordRequirements={defaultPasswordRequirements}
|
|
28
|
+
* oauthProviders={[
|
|
29
|
+
* {provider: "google", onPress: () => signInWithSocial("google")},
|
|
30
|
+
* ]}
|
|
31
|
+
* onLoginPress={() => router.push("/login")}
|
|
32
|
+
* />
|
|
33
|
+
* ```
|
|
34
|
+
*/
|
|
35
|
+
export const SignUpScreen = ({ fields, onSubmit, oauthProviders, passwordRequirements, onboardingPages, logo, title = "Create Account", loading = false, error, loginLinkText = "Already have an account? Log in", onLoginPress, testID = "signup-screen", }) => {
|
|
36
|
+
var _a;
|
|
37
|
+
const [formValues, setFormValues] = useState(() => {
|
|
38
|
+
const initial = {};
|
|
39
|
+
for (const field of fields) {
|
|
40
|
+
initial[field.name] = "";
|
|
41
|
+
}
|
|
42
|
+
return initial;
|
|
43
|
+
});
|
|
44
|
+
const handleFieldChange = useCallback((fieldName, value) => {
|
|
45
|
+
setFormValues((prev) => (Object.assign(Object.assign({}, prev), { [fieldName]: value })));
|
|
46
|
+
}, []);
|
|
47
|
+
const handleSubmit = useCallback(async () => {
|
|
48
|
+
await onSubmit(formValues);
|
|
49
|
+
}, [formValues, onSubmit]);
|
|
50
|
+
const passwordField = fields.find((f) => f.type === "password");
|
|
51
|
+
const passwordValue = passwordField ? ((_a = formValues[passwordField.name]) !== null && _a !== void 0 ? _a : "") : "";
|
|
52
|
+
const allRequirementsMet = !passwordRequirements ||
|
|
53
|
+
passwordRequirements.length === 0 ||
|
|
54
|
+
passwordRequirements.every((req) => req.validate(passwordValue));
|
|
55
|
+
const requiredFieldsFilled = fields
|
|
56
|
+
.filter((f) => f.required)
|
|
57
|
+
.every((f) => { var _a; return ((_a = formValues[f.name]) !== null && _a !== void 0 ? _a : "").trim().length > 0; });
|
|
58
|
+
const isSubmitDisabled = loading || !requiredFieldsFilled || !allRequirementsMet;
|
|
59
|
+
return (_jsx(Page, { navigation: undefined, children: _jsxs(Box, { alignItems: "center", alignSelf: "center", flex: "grow", justifyContent: "center", maxWidth: 400, padding: 4, testID: testID, width: "100%", children: [Boolean(onboardingPages && onboardingPages.length > 0) && (_jsx(Box, { marginBottom: 6, children: _jsx(Swiper, { pages: onboardingPages, testID: `${testID}-swiper` }) })), Boolean(logo) && _jsx(Box, { marginBottom: 6, children: logo }), _jsx(Box, { marginBottom: 8, children: _jsx(Heading, { testID: `${testID}-title`, children: title }) }), _jsxs(Box, { gap: 4, width: "100%", children: [fields.map((field) => {
|
|
60
|
+
var _a;
|
|
61
|
+
return (_jsx(TextField, { autoComplete: field.autoComplete, disabled: loading, onChange: (value) => handleFieldChange(field.name, value), placeholder: (_a = field.placeholder) !== null && _a !== void 0 ? _a : field.label, testID: `${testID}-${field.name}-input`, title: field.label, type: field.type === "email" ? "email" : field.type === "password" ? "password" : "text", value: formValues[field.name] }, field.name));
|
|
62
|
+
}), Boolean(passwordRequirements && passwordRequirements.length > 0 && passwordField) && (_jsx(PasswordRequirements, { password: passwordValue, requirements: passwordRequirements, testID: `${testID}-password-requirements` })), Boolean(error) && (_jsx(Text, { color: "error", testID: `${testID}-error`, children: error })), _jsx(Box, { marginTop: 4, children: _jsx(Button, { disabled: isSubmitDisabled, fullWidth: true, loading: loading, onClick: handleSubmit, testID: `${testID}-submit-button`, text: "Sign Up" }) }), Boolean(onLoginPress) && (_jsx(Box, { marginTop: 2, children: _jsx(Button, { disabled: loading, fullWidth: true, onClick: onLoginPress, testID: `${testID}-login-link`, text: loginLinkText, variant: "outline" }) })), Boolean(oauthProviders && oauthProviders.length > 0) && (_jsx(OAuthButtons, { disabled: loading, providers: oauthProviders, testID: `${testID}-oauth` }))] })] }) }));
|
|
63
|
+
};
|
|
64
|
+
//# sourceMappingURL=SignUpScreen.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SignUpScreen.js","sourceRoot":"","sources":["../../src/signUp/SignUpScreen.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,WAAW,EAAE,QAAQ,EAAC,MAAM,OAAO,CAAC;AAE5C,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAC,MAAM,EAAC,MAAM,WAAW,CAAC;AACjC,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAC7B,OAAO,EAAC,SAAS,EAAC,MAAM,cAAc,CAAC;AACvC,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC;AAGhC;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,MAAM,CAAC,MAAM,YAAY,GAA0B,CAAC,EAClD,MAAM,EACN,QAAQ,EACR,cAAc,EACd,oBAAoB,EACpB,eAAe,EACf,IAAI,EACJ,KAAK,GAAG,gBAAgB,EACxB,OAAO,GAAG,KAAK,EACf,KAAK,EACL,aAAa,GAAG,iCAAiC,EACjD,YAAY,EACZ,MAAM,GAAG,eAAe,GACzB,EAAE,EAAE;;IACH,MAAM,CAAC,UAAU,EAAE,aAAa,CAAC,GAAG,QAAQ,CAAyB,GAAG,EAAE;QACxE,MAAM,OAAO,GAA2B,EAAE,CAAC;QAC3C,KAAK,MAAM,KAAK,IAAI,MAAM,EAAE,CAAC;YAC3B,OA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AQ,EAAE,OAAO,EACjB,SAAS,EAAE,cAAe,EAC1B,MAAM,EAAE,GAAG,MAAM,QAAQ,GACzB,CACH,IACG,IACF,GACD,CACR,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { FC } from "react";
|
|
2
|
+
import type { OnboardingPage } from "./signUpTypes";
|
|
3
|
+
interface SwiperProps {
|
|
4
|
+
/** Onboarding pages to display. */
|
|
5
|
+
pages: OnboardingPage[];
|
|
6
|
+
/** Test ID prefix for the component. */
|
|
7
|
+
testID?: string;
|
|
8
|
+
}
|
|
9
|
+
/**
|
|
10
|
+
* An onboarding swiper that displays pages with optional images, titles, and subtitles.
|
|
11
|
+
*/
|
|
12
|
+
export declare const Swiper: FC<SwiperProps>;
|
|
13
|
+
export {};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { Image } from "react-native";
|
|
3
|
+
import { SwiperFlatList } from "react-native-swiper-flatlist";
|
|
4
|
+
import { Box } from "../Box";
|
|
5
|
+
import { Heading } from "../Heading";
|
|
6
|
+
import { Text } from "../Text";
|
|
7
|
+
/**
|
|
8
|
+
* An onboarding swiper that displays pages with optional images, titles, and subtitles.
|
|
9
|
+
*/
|
|
10
|
+
export const Swiper = ({ pages, testID = "onboarding-swiper" }) => {
|
|
11
|
+
if (pages.length === 0) {
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
14
|
+
return (_jsx(Box, { height: 300, testID: testID, width: "100%", children: _jsx(SwiperFlatList, { autoplay: true, autoplayDelay: 4, autoplayLoop: true, showPagination: true, children: pages.map((page, index) => (_jsxs(Box, { alignItems: "center", justifyContent: "center", padding: 4, width: "100%", children: [Boolean(page.image) && (_jsx(Image, { resizeMode: "contain", source: page.image, style: { height: 120, marginBottom: 16, width: 120 } })), Boolean(page.content) && page.content, _jsx(Heading, { align: "center", size: "md", children: page.title }), Boolean(page.subtitle) && (_jsx(Box, { marginTop: 2, children: _jsx(Text, { align: "center", color: "secondaryLight", children: page.subtitle }) }))] }, `${page.title}-${index}`))) }) }));
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=Swiper.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"Swiper.js","sourceRoot":"","sources":["../../src/signUp/Swiper.tsx"],"names":[],"mappings":";AACA,OAAO,EAAC,KAAK,EAAC,MAAM,cAAc,CAAC;AACnC,OAAO,EAAC,cAAc,EAAC,MAAM,8BAA8B,CAAC;AAE5D,OAAO,EAAC,GAAG,EAAC,MAAM,QAAQ,CAAC;AAC3B,OAAO,EAAC,OAAO,EAAC,MAAM,YAAY,CAAC;AACnC,OAAO,EAAC,IAAI,EAAC,MAAM,SAAS,CAAC;AAU7B;;GAEG;AACH,MAAM,CAAC,MAAM,MAAM,GAAoB,CAAC,EAAC,KAAK,EAAE,MAAM,GAAG,mBAAmB,EAAC,EAAE,EAAE;IAC/E,IAAI,KAAK,CAAC,MAAM,KAAK,CAAC,EAAE,CAAC;QACvB,OAAO,IAAI,CAAC;IACd,CAAC;IAED,OAAO,CACL,KAAC,GAAG,IAAC,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,MAAM,EAAE,KAAK,EAAC,MAAM,YAC5C,KAAC,cAAc,IAAC,QAAQ,QAAC,aAAa,EAAE,CAAC,EAAE,YAAY,QAAC,cAAc,kBACnE,KAAK,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,KAAK,EAAE,EAAE,CAAC,CAC1B,MAAC,GAAG,IACF,UAAU,EAAC,QAAQ,EACnB,cAAc,EAAC,QAAQ,EAEvB,OAAO,EAAE,CAAC,EACV,KAAK,EAAC,MAAM,aAEX,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,IAAI,CACtB,KAAC,KAAK,IACJ,UAAU,EAAC,SAAS,EACpB,MAAM,EAAE,IAAI,CAAC,KAAM,EACnB,KAAK,EAAE,EAAC,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,EAAE,EAAE,KAAK,EAAE,GAAG,EAAC,GAClD,CACH,EACA,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,IAAI,CAAC,OAAO,EACtC,KAAC,OAAO,IAAC,KAAK,EAAC,QAAQ,EAAC,IAAI,EAAC,IAAI,YAC9B,IAAI,CAAC,KAAK,GACH,EACT,OAAO,CAAC,IAAI,CAAC,QAAQ,CAAC,IAAI,CACzB,KAAC,GAAG,IAAC,SAAS,EAAE,CAAC,YACf,KAAC,IAAI,IAAC,KAAK,EAAC,QAAQ,EAAC,KAAK,EAAC,gBAAgB,YACxC,IAAI,CAAC,QAAQ,GACT,GACH,CACP,KArBI,GAAG,IAAI,CAAC,KAAK,IAAI,KAAK,EAAE,CAsBzB,CACP,CAAC,GACa,GACb,CACP,CAAC;AACJ,CAAC,CAAC"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OAuthButtons } from "./OAuthButtons";
|
|
2
|
+
export { PasswordRequirements } from "./PasswordRequirements";
|
|
3
|
+
export { defaultPasswordRequirements, simplePasswordRequirements } from "./passwordPresets";
|
|
4
|
+
export { SignUpScreen } from "./SignUpScreen";
|
|
5
|
+
export { Swiper } from "./Swiper";
|
|
6
|
+
export type { OAuthProvider, OAuthProviderConfig, OnboardingPage, PasswordRequirement, SignUpFieldConfig, SignUpScreenProps, } from "./signUpTypes";
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { OAuthButtons } from "./OAuthButtons";
|
|
2
|
+
export { PasswordRequirements } from "./PasswordRequirements";
|
|
3
|
+
export { defaultPasswordRequirements, simplePasswordRequirements } from "./passwordPresets";
|
|
4
|
+
export { SignUpScreen } from "./SignUpScreen";
|
|
5
|
+
export { Swiper } from "./Swiper";
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/signUp/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,oBAAoB,EAAC,MAAM,wBAAwB,CAAC;AAC5D,OAAO,EAAC,2BAA2B,EAAE,0BAA0B,EAAC,MAAM,mBAAmB,CAAC;AAC1F,OAAO,EAAC,YAAY,EAAC,MAAM,gBAAgB,CAAC;AAC5C,OAAO,EAAC,MAAM,EAAC,MAAM,UAAU,CAAC"}
|