@sudobility/building_blocks_rn 0.0.20 → 0.0.21
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.
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { View, Text, Pressable } from 'react-native';
|
|
3
|
+
import { colors as designColors } from '@sudobility/design';
|
|
3
4
|
import { createThemedStyles } from '../../utils/styles';
|
|
4
5
|
export function EmptyState({ message, buttonLabel, onPress }) {
|
|
5
6
|
const styles = useStyles();
|
|
@@ -20,7 +21,7 @@ const useStyles = createThemedStyles(colors => ({
|
|
|
20
21
|
marginBottom: 16,
|
|
21
22
|
},
|
|
22
23
|
button: {
|
|
23
|
-
backgroundColor:
|
|
24
|
+
backgroundColor: designColors.raw.blue[600],
|
|
24
25
|
borderRadius: 6,
|
|
25
26
|
minHeight: 44,
|
|
26
27
|
paddingHorizontal: 24,
|
|
@@ -29,7 +30,7 @@ const useStyles = createThemedStyles(colors => ({
|
|
|
29
30
|
justifyContent: 'center',
|
|
30
31
|
},
|
|
31
32
|
buttonText: {
|
|
32
|
-
color:
|
|
33
|
+
color: designColors.raw.neutral[0],
|
|
33
34
|
fontSize: 14,
|
|
34
35
|
fontWeight: '500',
|
|
35
36
|
},
|
|
@@ -16,6 +16,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
16
16
|
*/
|
|
17
17
|
import React from 'react';
|
|
18
18
|
import { View, Text, Pressable, StyleSheet } from 'react-native';
|
|
19
|
+
import { colors } from '@sudobility/design';
|
|
19
20
|
export class ErrorBoundary extends React.Component {
|
|
20
21
|
constructor(props) {
|
|
21
22
|
super(props);
|
|
@@ -47,29 +48,29 @@ const styles = StyleSheet.create({
|
|
|
47
48
|
justifyContent: 'center',
|
|
48
49
|
alignItems: 'center',
|
|
49
50
|
padding: 24,
|
|
50
|
-
backgroundColor:
|
|
51
|
+
backgroundColor: colors.raw.neutral[50],
|
|
51
52
|
},
|
|
52
53
|
title: {
|
|
53
54
|
fontSize: 24,
|
|
54
55
|
fontWeight: '700',
|
|
55
|
-
color:
|
|
56
|
+
color: colors.raw.neutral[900],
|
|
56
57
|
marginBottom: 8,
|
|
57
58
|
},
|
|
58
59
|
message: {
|
|
59
60
|
fontSize: 16,
|
|
60
|
-
color:
|
|
61
|
+
color: colors.raw.neutral[600],
|
|
61
62
|
textAlign: 'center',
|
|
62
63
|
marginBottom: 12,
|
|
63
64
|
},
|
|
64
65
|
errorDetail: {
|
|
65
66
|
fontSize: 13,
|
|
66
|
-
color:
|
|
67
|
+
color: colors.raw.neutral[400],
|
|
67
68
|
textAlign: 'center',
|
|
68
69
|
marginBottom: 24,
|
|
69
70
|
paddingHorizontal: 16,
|
|
70
71
|
},
|
|
71
72
|
retryButton: {
|
|
72
|
-
backgroundColor:
|
|
73
|
+
backgroundColor: colors.raw.blue[600],
|
|
73
74
|
borderRadius: 8,
|
|
74
75
|
paddingVertical: 12,
|
|
75
76
|
paddingHorizontal: 24,
|
|
@@ -78,7 +79,7 @@ const styles = StyleSheet.create({
|
|
|
78
79
|
alignItems: 'center',
|
|
79
80
|
},
|
|
80
81
|
retryButtonText: {
|
|
81
|
-
color:
|
|
82
|
+
color: colors.raw.neutral[0],
|
|
82
83
|
fontSize: 16,
|
|
83
84
|
fontWeight: '600',
|
|
84
85
|
},
|
|
@@ -14,6 +14,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
14
14
|
*/
|
|
15
15
|
import { useState, useCallback } from 'react';
|
|
16
16
|
import { View, Text, TextInput, Pressable, ActivityIndicator, Image, KeyboardAvoidingView, Platform, } from 'react-native';
|
|
17
|
+
import { colors as designColors } from '@sudobility/design';
|
|
17
18
|
import { createThemedStyles } from '../../utils/styles';
|
|
18
19
|
export function LoginScreen({ appName, logo, onLogin, onSignUp, onGoogleSignIn, onAppleSignIn, showGoogleSignIn = false, showAppleSignIn = false, showSignUp = true, style, }) {
|
|
19
20
|
const styles = useStyles();
|
|
@@ -60,7 +61,7 @@ export function LoginScreen({ appName, logo, onLogin, onSignUp, onGoogleSignIn,
|
|
|
60
61
|
return (_jsx(KeyboardAvoidingView, { style: [styles.container, style], behavior: Platform.OS === 'ios' ? 'padding' : 'height', children: _jsxs(View, { style: styles.card, accessibilityLabel: 'Login form', children: [logo && (_jsx(Image, { source: logo, style: styles.logo, resizeMode: 'contain', accessibilityLabel: `${appName} logo` })), _jsx(Text, { style: styles.title, accessibilityRole: 'header', accessibilityLabel: isSignUp ? `Sign up for ${appName}` : `Sign in to ${appName}`, children: isSignUp ? `Sign up for ${appName}` : `Sign in to ${appName}` }), error && (_jsx(View, { style: styles.errorBox, accessibilityRole: 'alert', accessibilityLabel: `Error: ${error}`, children: _jsx(Text, { style: styles.errorText, children: error }) })), _jsxs(View, { style: styles.form, children: [_jsx(Text, { style: styles.label, accessibilityLabel: 'Email address', children: "Email" }), _jsx(TextInput, { style: styles.input, value: email, onChangeText: setEmail, placeholder: 'you@example.com', autoCapitalize: 'none', autoCorrect: false, keyboardType: 'email-address', textContentType: 'emailAddress', editable: !loading, accessibilityLabel: 'Email address input', accessibilityHint: 'Enter your email address' }), _jsx(Text, { style: styles.label, accessibilityLabel: 'Password', children: "Password" }), _jsx(TextInput, { style: styles.input, value: password, onChangeText: setPassword, placeholder: 'Password', secureTextEntry: true, textContentType: isSignUp ? 'newPassword' : 'password', editable: !loading, onSubmitEditing: handleSubmit, accessibilityLabel: 'Password input', accessibilityHint: 'Enter your password' }), _jsx(Pressable, { style: [
|
|
61
62
|
styles.submitButton,
|
|
62
63
|
loading && styles.submitButtonDisabled,
|
|
63
|
-
], onPress: handleSubmit, disabled: loading, accessibilityRole: 'button', accessibilityLabel: isSignUp ? 'Sign Up' : 'Sign In', accessibilityState: { disabled: loading, busy: loading }, children: loading ? (_jsx(ActivityIndicator, { color:
|
|
64
|
+
], onPress: handleSubmit, disabled: loading, accessibilityRole: 'button', accessibilityLabel: isSignUp ? 'Sign Up' : 'Sign In', accessibilityState: { disabled: loading, busy: loading }, children: loading ? (_jsx(ActivityIndicator, { color: designColors.raw.neutral[0], size: 'small' })) : (_jsx(Text, { style: styles.submitButtonText, children: isSignUp ? 'Sign Up' : 'Sign In' })) })] }), (showGoogleSignIn || showAppleSignIn) && (_jsxs(View, { style: styles.socialSection, children: [_jsxs(View, { style: styles.divider, children: [_jsx(View, { style: styles.dividerLine }), _jsx(Text, { style: styles.dividerText, children: "or" }), _jsx(View, { style: styles.dividerLine })] }), showGoogleSignIn && onGoogleSignIn && (_jsx(Pressable, { style: styles.socialButton, onPress: () => handleSocialSignIn(onGoogleSignIn), disabled: loading, accessibilityRole: 'button', accessibilityLabel: 'Continue with Google', accessibilityState: { disabled: loading }, children: _jsx(Text, { style: styles.socialButtonText, children: "Continue with Google" }) })), showAppleSignIn && onAppleSignIn && (_jsx(Pressable, { style: [styles.socialButton, styles.appleButton], onPress: () => handleSocialSignIn(onAppleSignIn), disabled: loading, accessibilityRole: 'button', accessibilityLabel: 'Continue with Apple', accessibilityState: { disabled: loading }, children: _jsx(Text, { style: [styles.socialButtonText, styles.appleButtonText], children: "Continue with Apple" }) }))] })), showSignUp && onSignUp && (_jsx(Pressable, { style: styles.toggleLink, onPress: () => {
|
|
64
65
|
setIsSignUp(!isSignUp);
|
|
65
66
|
setError(null);
|
|
66
67
|
}, accessibilityRole: 'button', accessibilityLabel: isSignUp
|
|
@@ -144,7 +145,7 @@ const useStyles = createThemedStyles(colors => ({
|
|
|
144
145
|
opacity: 0.6,
|
|
145
146
|
},
|
|
146
147
|
submitButtonText: {
|
|
147
|
-
color:
|
|
148
|
+
color: designColors.raw.neutral[0],
|
|
148
149
|
fontSize: 16,
|
|
149
150
|
fontWeight: '600',
|
|
150
151
|
},
|
|
@@ -25,6 +25,7 @@ import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
|
25
25
|
import React, { createContext, useCallback, useContext, useEffect, useRef, useState, } from 'react';
|
|
26
26
|
import { View, Text, Animated, Pressable } from 'react-native';
|
|
27
27
|
import { useSafeAreaInsets } from 'react-native-safe-area-context';
|
|
28
|
+
import { colors as designColors } from '@sudobility/design';
|
|
28
29
|
import { useTheme } from '../../theme/ThemeContext';
|
|
29
30
|
import { createThemedStyles } from '../../utils/styles';
|
|
30
31
|
const ToastContext = createContext(null);
|
|
@@ -125,7 +126,7 @@ const useToastStyles = createThemedStyles(_colors => ({
|
|
|
125
126
|
justifyContent: 'center',
|
|
126
127
|
},
|
|
127
128
|
toastText: {
|
|
128
|
-
color:
|
|
129
|
+
color: designColors.raw.neutral[0],
|
|
129
130
|
fontSize: 15,
|
|
130
131
|
fontWeight: '500',
|
|
131
132
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sudobility/building_blocks_rn",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.21",
|
|
4
4
|
"description": "Higher-level shared UI building blocks for Sudobility React Native apps",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -43,7 +43,8 @@
|
|
|
43
43
|
"@react-navigation/native-stack": ">=7.0.0",
|
|
44
44
|
"i18next": "^23.0.0 || ^24.0.0 || ^25.0.0",
|
|
45
45
|
"react-i18next": "^14.0.0 || ^15.0.0 || ^16.0.0",
|
|
46
|
-
"@react-native-async-storage/async-storage": ">=1.0.0"
|
|
46
|
+
"@react-native-async-storage/async-storage": ">=1.0.0",
|
|
47
|
+
"@sudobility/design": "^1.1.26"
|
|
47
48
|
},
|
|
48
49
|
"peerDependenciesMeta": {
|
|
49
50
|
"firebase": {
|