@navegarti/rn-design-system 0.8.2 → 0.8.5
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/module/components/Button/styles.js +4 -2
- package/lib/module/components/Button/types.js +4 -0
- package/lib/module/components/Checkbox/types.js +4 -0
- package/lib/module/components/FAB/types.js +4 -0
- package/lib/module/components/Flex/types.js +4 -0
- package/lib/module/components/FormLabel/types.js +4 -0
- package/lib/module/components/Input/styles.js +6 -3
- package/lib/module/components/Input/types.js +4 -0
- package/lib/module/components/Margin/styles.js +4 -6
- package/lib/module/components/Margin/types.js +2 -0
- package/lib/module/components/OTPInput/index.js +50 -67
- package/lib/module/components/OTPInput/types.js +4 -0
- package/lib/module/components/Padding/styles.js +4 -6
- package/lib/module/components/Padding/types.js +2 -0
- package/lib/module/components/Radio/types.js +4 -0
- package/lib/module/components/Select/types.js +4 -0
- package/lib/module/components/Skeleton/types.js +4 -0
- package/lib/module/components/Switch/types.js +4 -0
- package/lib/module/components/Text/styles.js +3 -1
- package/lib/module/components/Text/types.js +4 -0
- package/lib/typescript/src/components/Button/index.d.ts +3 -81
- package/lib/typescript/src/components/Button/styles.d.ts +2 -87
- package/lib/typescript/src/components/Button/types.d.ts +8 -0
- package/lib/typescript/src/components/Card/index.d.ts +55 -322
- package/lib/typescript/src/components/Card/styles.d.ts +55 -322
- package/lib/typescript/src/components/Carousel/index.d.ts +10 -17
- package/lib/typescript/src/components/Checkbox/index.d.ts +3 -8
- package/lib/typescript/src/components/Checkbox/styles.d.ts +9 -4
- package/lib/typescript/src/components/Checkbox/types.d.ts +8 -0
- package/lib/typescript/src/components/FAB/components/extended-fab.d.ts +1 -1
- package/lib/typescript/src/components/FAB/index.d.ts +3 -3
- package/lib/typescript/src/components/FAB/styles.d.ts +9 -103
- package/lib/typescript/src/components/FAB/types.d.ts +16 -0
- package/lib/typescript/src/components/Flex/index.d.ts +1 -0
- package/lib/typescript/src/components/Flex/styles.d.ts +10 -7
- package/lib/typescript/src/components/Flex/types.d.ts +3 -0
- package/lib/typescript/src/components/FormLabel/index.d.ts +3 -2
- package/lib/typescript/src/components/FormLabel/styles.d.ts +1 -79
- package/lib/typescript/src/components/FormLabel/types.d.ts +3 -0
- package/lib/typescript/src/components/Input/components/input-field.d.ts +2 -6
- package/lib/typescript/src/components/Input/components/input-root.d.ts +1 -7
- package/lib/typescript/src/components/Input/index.d.ts +3 -9
- package/lib/typescript/src/components/Input/styles.d.ts +29 -170
- package/lib/typescript/src/components/Input/types.d.ts +11 -0
- package/lib/typescript/src/components/Margin/index.d.ts +1 -0
- package/lib/typescript/src/components/Margin/styles.d.ts +11 -17
- package/lib/typescript/src/components/Margin/types.d.ts +12 -0
- package/lib/typescript/src/components/OTPInput/index.d.ts +3 -15
- package/lib/typescript/src/components/OTPInput/types.d.ts +12 -0
- package/lib/typescript/src/components/Padding/index.d.ts +1 -0
- package/lib/typescript/src/components/Padding/styles.d.ts +11 -17
- package/lib/typescript/src/components/Padding/types.d.ts +12 -0
- package/lib/typescript/src/components/Radio/components/radio-item.d.ts +1 -6
- package/lib/typescript/src/components/Radio/index.d.ts +3 -83
- package/lib/typescript/src/components/Radio/styles.d.ts +18 -8
- package/lib/typescript/src/components/Radio/types.d.ts +12 -0
- package/lib/typescript/src/components/Select/components/select-field.d.ts +2 -4
- package/lib/typescript/src/components/Select/index.d.ts +3 -6
- package/lib/typescript/src/components/Select/styles.d.ts +2 -158
- package/lib/typescript/src/components/Select/types.d.ts +7 -0
- package/lib/typescript/src/components/Skeleton/index.d.ts +2 -9
- package/lib/typescript/src/components/Skeleton/types.d.ts +9 -0
- package/lib/typescript/src/components/Switch/index.d.ts +2 -9
- package/lib/typescript/src/components/Switch/styles.d.ts +18 -8
- package/lib/typescript/src/components/Switch/types.d.ts +9 -0
- package/lib/typescript/src/components/Text/index.d.ts +1 -1
- package/lib/typescript/src/components/Text/styles.d.ts +2 -93
- package/lib/typescript/src/components/Text/types.d.ts +15 -0
- package/lib/typescript/src/components.d.ts +11 -0
- package/lib/typescript/src/index.d.ts +11 -0
- package/package.json +16 -38
- package/src/components/Button/index.tsx +3 -2
- package/src/components/Button/styles.ts +6 -10
- package/src/components/Button/types.ts +8 -0
- package/src/components/Checkbox/index.tsx +3 -8
- package/src/components/Checkbox/types.ts +8 -0
- package/src/components/FAB/components/extended-fab.tsx +2 -5
- package/src/components/FAB/index.tsx +3 -2
- package/src/components/FAB/styles.ts +2 -24
- package/src/components/FAB/types.ts +18 -0
- package/src/components/Flex/index.tsx +1 -0
- package/src/components/Flex/styles.ts +1 -15
- package/src/components/Flex/types.ts +16 -0
- package/src/components/FormLabel/index.tsx +4 -2
- package/src/components/FormLabel/types.ts +3 -0
- package/src/components/Input/components/input-field.tsx +2 -6
- package/src/components/Input/components/input-root.tsx +1 -7
- package/src/components/Input/index.tsx +2 -0
- package/src/components/Input/styles.ts +6 -3
- package/src/components/Input/types.ts +12 -0
- package/src/components/Margin/index.tsx +1 -0
- package/src/components/Margin/styles.ts +6 -18
- package/src/components/Margin/types.ts +11 -0
- package/src/components/OTPInput/index.tsx +54 -99
- package/src/components/OTPInput/types.ts +13 -0
- package/src/components/Padding/index.tsx +1 -0
- package/src/components/Padding/styles.ts +6 -18
- package/src/components/Padding/types.ts +11 -0
- package/src/components/Radio/components/radio-item.tsx +1 -7
- package/src/components/Radio/index.tsx +2 -8
- package/src/components/Radio/types.ts +14 -0
- package/src/components/Select/components/select-field.tsx +2 -4
- package/src/components/Select/index.tsx +2 -4
- package/src/components/Select/types.ts +8 -0
- package/src/components/Skeleton/index.tsx +6 -9
- package/src/components/Skeleton/types.ts +9 -0
- package/src/components/Switch/index.tsx +3 -9
- package/src/components/Switch/types.ts +10 -0
- package/src/components/Text/index.tsx +1 -1
- package/src/components/Text/styles.ts +3 -18
- package/src/components/Text/types.ts +16 -0
- package/src/components.tsx +11 -0
- package/src/index.tsx +11 -0
- package/lib/module/components/OTPInput/styles.js +0 -23
- package/lib/module/components/OTPInput/utils.js +0 -24
- package/lib/typescript/src/components/OTPInput/styles.d.ts +0 -214
- package/lib/typescript/src/components/OTPInput/utils.d.ts +0 -3
- package/src/components/OTPInput/styles.ts +0 -23
- package/src/components/OTPInput/utils.ts +0 -31
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import type { CheckboxProps as ExpoCheckboxProps } from 'expo-checkbox';
|
|
2
|
+
import type { ViewProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export type CheckboxProps = {
|
|
5
|
+
value: boolean;
|
|
6
|
+
onValueChange: (value: boolean) => void;
|
|
7
|
+
containerProps?: ViewProps;
|
|
8
|
+
} & Omit<ExpoCheckboxProps, 'OnValueChange'>;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { ExtendedFAB } from './components/extended-fab';
|
|
2
|
-
import { DefaultFABStyle,
|
|
2
|
+
import { DefaultFABStyle, LargeFAB, SmallFAB } from './styles';
|
|
3
|
+
import type { FABProps } from './types';
|
|
3
4
|
|
|
4
|
-
export type { ExtendedFABProps, FABProps } from './
|
|
5
|
+
export type { ExtendedFABProps, FABProps } from './types';
|
|
5
6
|
|
|
6
7
|
const DefaultFAB = (props: FABProps) => (
|
|
7
8
|
<DefaultFABStyle activeOpacity={0.9} {...props} />
|
|
@@ -1,30 +1,8 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import type { TouchableOpacityProps } from 'react-native';
|
|
3
2
|
|
|
4
3
|
import { Text } from '../Text';
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
getSizeStyle,
|
|
8
|
-
type Position,
|
|
9
|
-
type Size,
|
|
10
|
-
} from './utils';
|
|
11
|
-
|
|
12
|
-
type FABProps = {
|
|
13
|
-
position?: Position;
|
|
14
|
-
size?: Size;
|
|
15
|
-
color?: string;
|
|
16
|
-
offset?: {
|
|
17
|
-
horizontal?: number;
|
|
18
|
-
vertical?: number;
|
|
19
|
-
};
|
|
20
|
-
} & TouchableOpacityProps;
|
|
21
|
-
|
|
22
|
-
export type { FABProps };
|
|
23
|
-
|
|
24
|
-
export type ExtendedFABProps = FABProps & {
|
|
25
|
-
label: string;
|
|
26
|
-
labelColor?: string;
|
|
27
|
-
};
|
|
4
|
+
import type { FABProps } from './types';
|
|
5
|
+
import { getPositionStyle, getSizeStyle } from './utils';
|
|
28
6
|
|
|
29
7
|
export const DefaultFABStyle = styled.TouchableOpacity<FABProps>(
|
|
30
8
|
({ position, size, color, offset }) => ({
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type { TouchableOpacityProps } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import type { Position, Size } from './utils';
|
|
4
|
+
|
|
5
|
+
export type FABProps = {
|
|
6
|
+
position?: Position;
|
|
7
|
+
size?: Size;
|
|
8
|
+
color?: string;
|
|
9
|
+
offset?: {
|
|
10
|
+
horizontal?: number;
|
|
11
|
+
vertical?: number;
|
|
12
|
+
};
|
|
13
|
+
} & TouchableOpacityProps;
|
|
14
|
+
|
|
15
|
+
export type ExtendedFABProps = FABProps & {
|
|
16
|
+
label: string;
|
|
17
|
+
labelColor?: string;
|
|
18
|
+
};
|
|
@@ -1,20 +1,6 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
|
-
import type { ViewStyle } from 'react-native';
|
|
3
2
|
|
|
4
|
-
type FlexProps
|
|
5
|
-
ViewStyle,
|
|
6
|
-
| 'flex'
|
|
7
|
-
| 'flexDirection'
|
|
8
|
-
| 'flexGrow'
|
|
9
|
-
| 'flexShrink'
|
|
10
|
-
| 'flexWrap'
|
|
11
|
-
| 'alignContent'
|
|
12
|
-
| 'alignItems'
|
|
13
|
-
| 'alignSelf'
|
|
14
|
-
| 'justifyContent'
|
|
15
|
-
| 'gap'
|
|
16
|
-
| 'flexBasis'
|
|
17
|
-
>;
|
|
3
|
+
import type { FlexProps } from './types';
|
|
18
4
|
|
|
19
5
|
export const Flex = styled.View<FlexProps>(
|
|
20
6
|
({
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
export type FlexProps = Pick<
|
|
4
|
+
ViewStyle,
|
|
5
|
+
| 'flex'
|
|
6
|
+
| 'flexDirection'
|
|
7
|
+
| 'flexGrow'
|
|
8
|
+
| 'flexShrink'
|
|
9
|
+
| 'flexWrap'
|
|
10
|
+
| 'alignContent'
|
|
11
|
+
| 'alignItems'
|
|
12
|
+
| 'alignSelf'
|
|
13
|
+
| 'justifyContent'
|
|
14
|
+
| 'gap'
|
|
15
|
+
| 'flexBasis'
|
|
16
|
+
>;
|
|
@@ -1,6 +1,8 @@
|
|
|
1
|
-
import type { TextProps } from 'react-native';
|
|
2
1
|
import { LabelText } from './styles';
|
|
2
|
+
import type { FormLabelProps } from './types';
|
|
3
3
|
|
|
4
|
-
export
|
|
4
|
+
export type { FormLabelProps } from './types';
|
|
5
|
+
|
|
6
|
+
export const FormLabel = (props: FormLabelProps) => {
|
|
5
7
|
return <LabelText {...props} />;
|
|
6
8
|
};
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { memo, useState } from 'react';
|
|
2
|
-
import type { MaskInputProps } from 'react-native-mask-input';
|
|
3
2
|
|
|
4
3
|
import { useInputContext } from '../context';
|
|
5
4
|
import { ErrorExclamation, StyledMaskInput } from '../styles';
|
|
5
|
+
import type { InputFieldProps } from '../types';
|
|
6
6
|
import { InputIcon } from './input-icon';
|
|
7
7
|
|
|
8
|
-
type InputProps = {
|
|
9
|
-
onChangeText?: (unmasked: string, masked: string) => void;
|
|
10
|
-
} & Omit<MaskInputProps, 'onBlur' | 'onFocus'>;
|
|
11
|
-
|
|
12
8
|
export const InputField = memo(
|
|
13
|
-
({ value, onChangeText, ...props }:
|
|
9
|
+
({ value, onChangeText, ...props }: InputFieldProps) => {
|
|
14
10
|
const {
|
|
15
11
|
inputRef,
|
|
16
12
|
handleFocus,
|
|
@@ -2,13 +2,7 @@ import { useRef, useState } from 'react';
|
|
|
2
2
|
|
|
3
3
|
import { InputContext } from '../context';
|
|
4
4
|
import { InputRootContainer } from '../styles';
|
|
5
|
-
|
|
6
|
-
type InputRootProps = {
|
|
7
|
-
children: React.ReactNode;
|
|
8
|
-
isPassword?: boolean;
|
|
9
|
-
hasError?: boolean;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
};
|
|
5
|
+
import type { InputRootProps } from '../types';
|
|
12
6
|
|
|
13
7
|
export const InputRoot = ({
|
|
14
8
|
children,
|
|
@@ -5,6 +5,8 @@ import { InputIcon } from './components/input-icon';
|
|
|
5
5
|
import { InputPasswordToggle } from './components/input-password-toggle';
|
|
6
6
|
import { InputRoot } from './components/input-root';
|
|
7
7
|
|
|
8
|
+
export type { InputFieldProps, InputRootProps } from './types';
|
|
9
|
+
|
|
8
10
|
const Input = {
|
|
9
11
|
Root: InputRoot,
|
|
10
12
|
Field: InputField,
|
|
@@ -35,12 +35,15 @@ export const InputControlContainer = styled.Pressable<{
|
|
|
35
35
|
borderColor: getInputBorderColor(!!hasError, isFocused),
|
|
36
36
|
borderRadius: 4,
|
|
37
37
|
boxShadow: getInputShadow(!!hasError, isFocused),
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
paddingLeft: 8,
|
|
39
|
+
paddingRight: 8,
|
|
40
|
+
paddingTop: 4,
|
|
41
|
+
paddingBottom: 4,
|
|
40
42
|
|
|
41
43
|
backgroundColor: disabled ? '#f2f2f2' : '#fff',
|
|
42
44
|
}));
|
|
43
45
|
|
|
44
46
|
export const InputIconContainer = styled.View({
|
|
45
|
-
|
|
47
|
+
marginLeft: 4,
|
|
48
|
+
marginRight: 4,
|
|
46
49
|
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import type { MaskInputProps } from 'react-native-mask-input';
|
|
2
|
+
|
|
3
|
+
export type InputRootProps = {
|
|
4
|
+
children: React.ReactNode;
|
|
5
|
+
isPassword?: boolean;
|
|
6
|
+
hasError?: boolean;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export type InputFieldProps = {
|
|
11
|
+
onChangeText?: (unmasked: string, masked: string) => void;
|
|
12
|
+
} & Omit<MaskInputProps, 'onBlur' | 'onFocus'>;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
2
|
|
|
3
|
-
type
|
|
4
|
-
insets: {
|
|
5
|
-
all?: number | 'auto';
|
|
6
|
-
block?: number | 'auto';
|
|
7
|
-
inline?: number | 'auto';
|
|
8
|
-
top?: number | 'auto';
|
|
9
|
-
right?: number | 'auto';
|
|
10
|
-
bottom?: number | 'auto';
|
|
11
|
-
left?: number | 'auto';
|
|
12
|
-
};
|
|
13
|
-
};
|
|
3
|
+
import type { MarginProps } from './types';
|
|
14
4
|
|
|
15
|
-
export const Margin = styled.View<
|
|
5
|
+
export const Margin = styled.View<MarginProps>(({ insets }) => ({
|
|
16
6
|
margin: insets.all,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
marginRight: insets.right,
|
|
22
|
-
marginTop: insets.top,
|
|
7
|
+
marginTop: insets.vertical ?? insets.top,
|
|
8
|
+
marginBottom: insets.vertical ?? insets.bottom,
|
|
9
|
+
marginLeft: insets.horizontal ?? insets.left,
|
|
10
|
+
marginRight: insets.horizontal ?? insets.right,
|
|
23
11
|
}));
|
|
@@ -1,114 +1,69 @@
|
|
|
1
|
-
import
|
|
2
|
-
import type { TextInputKeyPressEvent, TextInputProps } from 'react-native';
|
|
1
|
+
import type { OTPInputProps } from './types';
|
|
3
2
|
|
|
4
|
-
|
|
5
|
-
import { InputBox } from './styles';
|
|
3
|
+
export type { OTPInputProps } from './types';
|
|
6
4
|
|
|
7
|
-
|
|
8
|
-
length?: number;
|
|
9
|
-
defaultValue?: string;
|
|
10
|
-
onComplete: (code: string[]) => void;
|
|
11
|
-
hasError?: boolean;
|
|
12
|
-
disabled?: boolean;
|
|
13
|
-
autoFocus?: boolean;
|
|
14
|
-
onlyNumbers?: boolean;
|
|
15
|
-
containerProps?: ComponentProps<typeof Flex>;
|
|
16
|
-
} & Omit<TextInputProps, 'value' | 'onChangeText' | 'maxLength'>;
|
|
5
|
+
import { OtpInput as OtpEntry } from 'react-native-otp-entry';
|
|
17
6
|
|
|
18
7
|
export const OTPInput = ({
|
|
19
8
|
length = 6,
|
|
20
|
-
defaultValue = '',
|
|
21
9
|
onComplete,
|
|
22
|
-
hasError = false,
|
|
23
10
|
disabled = false,
|
|
24
11
|
autoFocus = false,
|
|
25
12
|
onlyNumbers = true,
|
|
26
13
|
containerProps,
|
|
27
14
|
...props
|
|
28
15
|
}: OTPInputProps) => {
|
|
29
|
-
const [otp, setOtp] = useState<string[]>(
|
|
30
|
-
Array(length)
|
|
31
|
-
.fill('')
|
|
32
|
-
.map((_, i) => defaultValue[i] || ''),
|
|
33
|
-
);
|
|
34
|
-
const [focusedIndex, setFocusedIndex] = useState<number | null>(
|
|
35
|
-
autoFocus ? 0 : null,
|
|
36
|
-
);
|
|
37
|
-
const inputRefs = useRef<any[]>([]);
|
|
38
|
-
|
|
39
|
-
const handleChangeText = (text: string, index: number) => {
|
|
40
|
-
if (disabled) return;
|
|
41
|
-
|
|
42
|
-
setOtp((prevOtp) => {
|
|
43
|
-
const newOtp = [...prevOtp];
|
|
44
|
-
newOtp[index] = text;
|
|
45
|
-
|
|
46
|
-
const newOtpLength = newOtp.join('').length;
|
|
47
|
-
|
|
48
|
-
if (newOtpLength === length) {
|
|
49
|
-
onComplete(newOtp);
|
|
50
|
-
inputRefs.current[index]?.blur();
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
return newOtp;
|
|
54
|
-
});
|
|
55
|
-
|
|
56
|
-
if (index < length - 1 && text) {
|
|
57
|
-
inputRefs.current[index + 1]?.focus();
|
|
58
|
-
}
|
|
59
|
-
};
|
|
60
|
-
|
|
61
|
-
const handleKeyPress = (e: TextInputKeyPressEvent, index: number) => {
|
|
62
|
-
if (e.nativeEvent.key === 'Backspace' && !otp[index] && index > 0) {
|
|
63
|
-
inputRefs.current[index - 1]?.focus();
|
|
64
|
-
}
|
|
65
|
-
};
|
|
66
|
-
|
|
67
|
-
const handleFocus = (index: number) => {
|
|
68
|
-
setFocusedIndex(index);
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
const handleBlur = () => {
|
|
72
|
-
setFocusedIndex(null);
|
|
73
|
-
};
|
|
74
|
-
|
|
75
|
-
useEffect(() => {
|
|
76
|
-
if (autoFocus && inputRefs.current[0]) {
|
|
77
|
-
inputRefs.current[0]?.focus();
|
|
78
|
-
}
|
|
79
|
-
}, [autoFocus]);
|
|
80
|
-
|
|
81
16
|
return (
|
|
82
|
-
<
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
{
|
|
88
|
-
|
|
89
|
-
{
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
17
|
+
<OtpEntry
|
|
18
|
+
numberOfDigits={length}
|
|
19
|
+
focusColor="rgb(0, 140, 255)"
|
|
20
|
+
onFilled={onComplete}
|
|
21
|
+
disabled={disabled}
|
|
22
|
+
autoFocus={autoFocus}
|
|
23
|
+
type="alphanumeric"
|
|
24
|
+
blurOnFilled={true}
|
|
25
|
+
textInputProps={{
|
|
26
|
+
accessibilityLabel: 'Código de verificação',
|
|
27
|
+
}}
|
|
28
|
+
textProps={{
|
|
29
|
+
accessibilityRole: 'text',
|
|
30
|
+
accessibilityLabel: 'Dígito do código de verificação',
|
|
31
|
+
allowFontScaling: false,
|
|
32
|
+
}}
|
|
33
|
+
theme={{
|
|
34
|
+
containerStyle: {
|
|
35
|
+
gap: 10,
|
|
36
|
+
justifyContent: 'flex-start',
|
|
37
|
+
},
|
|
38
|
+
pinCodeContainerStyle: {
|
|
39
|
+
backgroundColor: 'rgb(242,242,242)',
|
|
40
|
+
borderWidth: 1,
|
|
41
|
+
borderRadius: 4,
|
|
42
|
+
width: 50,
|
|
43
|
+
height: 50,
|
|
44
|
+
borderColor: 'transparent',
|
|
45
|
+
},
|
|
46
|
+
pinCodeTextStyle: {
|
|
47
|
+
color: disabled ? '#555' : '#333',
|
|
48
|
+
fontSize: 20,
|
|
49
|
+
fontWeight: 500,
|
|
50
|
+
},
|
|
51
|
+
focusedPinCodeContainerStyle: {
|
|
52
|
+
borderColor: 'rgb(50,50,50)',
|
|
53
|
+
},
|
|
54
|
+
focusStickStyle: {
|
|
55
|
+
backgroundColor: '#555',
|
|
56
|
+
height: 24,
|
|
57
|
+
},
|
|
58
|
+
disabledPinCodeContainerStyle: {
|
|
59
|
+
backgroundColor: 'rgb(220,220,220)',
|
|
60
|
+
borderColor: 'rgb(100,100,100)',
|
|
61
|
+
},
|
|
62
|
+
filledPinCodeContainerStyle: {
|
|
63
|
+
borderColor: 'transparent',
|
|
64
|
+
},
|
|
65
|
+
}}
|
|
66
|
+
{...props}
|
|
67
|
+
/>
|
|
113
68
|
);
|
|
114
69
|
};
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import type { OtpInputProps } from 'react-native-otp-entry';
|
|
2
|
+
|
|
3
|
+
import type { FlexProps } from '../Flex';
|
|
4
|
+
|
|
5
|
+
export type OTPInputProps = {
|
|
6
|
+
length?: number;
|
|
7
|
+
onComplete: (code: string) => void;
|
|
8
|
+
hasError?: boolean;
|
|
9
|
+
disabled?: boolean;
|
|
10
|
+
autoFocus?: boolean;
|
|
11
|
+
onlyNumbers?: boolean;
|
|
12
|
+
containerProps?: FlexProps;
|
|
13
|
+
} & OtpInputProps;
|
|
@@ -1,23 +1,11 @@
|
|
|
1
1
|
import styled from '@emotion/native';
|
|
2
2
|
|
|
3
|
-
type
|
|
4
|
-
insets: {
|
|
5
|
-
all?: number | 'auto';
|
|
6
|
-
block?: number | 'auto';
|
|
7
|
-
inline?: number | 'auto';
|
|
8
|
-
top?: number | 'auto';
|
|
9
|
-
right?: number | 'auto';
|
|
10
|
-
bottom?: number | 'auto';
|
|
11
|
-
left?: number | 'auto';
|
|
12
|
-
};
|
|
13
|
-
};
|
|
3
|
+
import type { PaddingProps } from './types';
|
|
14
4
|
|
|
15
|
-
export const Padding = styled.View<
|
|
5
|
+
export const Padding = styled.View<PaddingProps>(({ insets }) => ({
|
|
16
6
|
padding: insets.all,
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
paddingRight: insets.right,
|
|
22
|
-
paddingTop: insets.top,
|
|
7
|
+
paddingTop: insets.vertical ?? insets.top,
|
|
8
|
+
paddingBottom: insets.vertical ?? insets.bottom,
|
|
9
|
+
paddingLeft: insets.horizontal ?? insets.left,
|
|
10
|
+
paddingRight: insets.horizontal ?? insets.right,
|
|
23
11
|
}));
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react';
|
|
2
1
|
import { useContext } from 'react';
|
|
3
|
-
import type { TouchableOpacityProps } from 'react-native';
|
|
4
2
|
|
|
5
3
|
import { Text } from '../../Text';
|
|
6
4
|
import { RadioContext } from '../context';
|
|
7
5
|
import { RadioButton, RadioInner, RadioTouchable } from '../styles';
|
|
8
|
-
|
|
9
|
-
type RadioItemProps = PropsWithChildren<{
|
|
10
|
-
value: string;
|
|
11
|
-
}> &
|
|
12
|
-
Omit<TouchableOpacityProps, 'onPress'>;
|
|
6
|
+
import type { RadioItemProps } from '../types';
|
|
13
7
|
|
|
14
8
|
export const RadioItem = ({ value, children, ...props }: RadioItemProps) => {
|
|
15
9
|
const context = useContext(RadioContext);
|
|
@@ -1,15 +1,9 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react';
|
|
2
|
-
|
|
3
1
|
import { Flex } from '../Flex';
|
|
4
2
|
import { RadioItem } from './components/radio-item';
|
|
5
3
|
import { RadioContext } from './context';
|
|
4
|
+
import type { RadioGroupProps } from './types';
|
|
6
5
|
|
|
7
|
-
type RadioGroupProps
|
|
8
|
-
value: string;
|
|
9
|
-
onValueChange: (value: string) => void;
|
|
10
|
-
disabled?: boolean;
|
|
11
|
-
hasError?: boolean;
|
|
12
|
-
}>;
|
|
6
|
+
export type { RadioGroupProps, RadioItemProps } from './types';
|
|
13
7
|
|
|
14
8
|
const RadioGroup = ({
|
|
15
9
|
value,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import type { PropsWithChildren } from 'react';
|
|
2
|
+
import type { TouchableOpacityProps } from 'react-native';
|
|
3
|
+
|
|
4
|
+
export type RadioGroupProps = PropsWithChildren<{
|
|
5
|
+
value: string;
|
|
6
|
+
onValueChange: (value: string) => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
hasError?: boolean;
|
|
9
|
+
}>;
|
|
10
|
+
|
|
11
|
+
export type RadioItemProps = PropsWithChildren<{
|
|
12
|
+
value: string;
|
|
13
|
+
}> &
|
|
14
|
+
Omit<TouchableOpacityProps, 'onPress'>;
|
|
@@ -1,17 +1,15 @@
|
|
|
1
|
-
import type { PickerSelectProps } from 'react-native-picker-select';
|
|
2
1
|
import RNPickerSelect from 'react-native-picker-select';
|
|
3
2
|
|
|
4
3
|
import { useSelectContext } from '../context';
|
|
4
|
+
import type { SelectFieldProps } from '../types';
|
|
5
5
|
import { ErrorIcon } from './error-icon';
|
|
6
6
|
|
|
7
|
-
type FormSelectProps = PickerSelectProps;
|
|
8
|
-
|
|
9
7
|
export const SelectField = ({
|
|
10
8
|
placeholder,
|
|
11
9
|
style,
|
|
12
10
|
disabled,
|
|
13
11
|
...props
|
|
14
|
-
}:
|
|
12
|
+
}: SelectFieldProps) => {
|
|
15
13
|
const { hasError } = useSelectContext();
|
|
16
14
|
|
|
17
15
|
const {
|
|
@@ -1,13 +1,11 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react';
|
|
2
1
|
import { View } from 'react-native';
|
|
3
2
|
|
|
4
3
|
import { SelectError } from './components/select-error';
|
|
5
4
|
import { SelectField } from './components/select-field';
|
|
6
5
|
import { SelectContext } from './context';
|
|
6
|
+
import type { SelectRootProps } from './types';
|
|
7
7
|
|
|
8
|
-
type SelectRootProps
|
|
9
|
-
hasError?: boolean;
|
|
10
|
-
};
|
|
8
|
+
export type { SelectFieldProps, SelectRootProps } from './types';
|
|
11
9
|
|
|
12
10
|
const SelectRoot = ({ children, hasError }: SelectRootProps) => {
|
|
13
11
|
return (
|
|
@@ -1,12 +1,9 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { Animated
|
|
3
|
-
|
|
4
|
-
type SkeletonProps
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
radius?: number;
|
|
8
|
-
isLoading?: boolean;
|
|
9
|
-
} & PropsWithChildren;
|
|
1
|
+
import { useEffect, useRef } from 'react';
|
|
2
|
+
import { Animated } from 'react-native';
|
|
3
|
+
|
|
4
|
+
import type { SkeletonProps } from './types';
|
|
5
|
+
|
|
6
|
+
export type { SkeletonProps } from './types';
|
|
10
7
|
|
|
11
8
|
export const Skeleton = ({
|
|
12
9
|
width,
|
|
@@ -1,17 +1,11 @@
|
|
|
1
|
-
import type { PropsWithChildren } from 'react';
|
|
2
1
|
import { useEffect, useRef } from 'react';
|
|
3
|
-
import { Animated
|
|
2
|
+
import { Animated } from 'react-native';
|
|
4
3
|
|
|
5
4
|
import { Text } from '../Text';
|
|
6
5
|
import { SwitchContainer, SwitchThumb, SwitchTrack } from './styles';
|
|
6
|
+
import type { SwitchProps } from './types';
|
|
7
7
|
|
|
8
|
-
type SwitchProps
|
|
9
|
-
value: boolean;
|
|
10
|
-
onValueChange: (value: boolean) => void;
|
|
11
|
-
disabled?: boolean;
|
|
12
|
-
hasError?: boolean;
|
|
13
|
-
}> &
|
|
14
|
-
Omit<TouchableOpacityProps, 'onPress'>;
|
|
8
|
+
export type { SwitchProps } from './types';
|
|
15
9
|
|
|
16
10
|
export const Switch = ({
|
|
17
11
|
value,
|