@adiraku/react-native-ui 1.2.0 → 1.2.2
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/commonjs/components/Appbar/Appbar.component.js +6 -4
- package/lib/commonjs/components/Appbar/Appbar.component.js.map +1 -1
- package/lib/commonjs/components/Appbar/Appbar.style.js +9 -2
- package/lib/commonjs/components/Appbar/Appbar.style.js.map +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.component.js +6 -23
- package/lib/commonjs/components/BottomSheet/BottomSheet.component.js.map +1 -1
- package/lib/commonjs/components/BottomSheet/BottomSheet.style.js +11 -4
- package/lib/commonjs/components/BottomSheet/BottomSheet.style.js.map +1 -1
- package/lib/commonjs/components/CheckBoxInput/CheckBoxInput.component.js +18 -10
- package/lib/commonjs/components/CheckBoxInput/CheckBoxInput.component.js.map +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.component.js +5 -3
- package/lib/commonjs/components/Checkbox/Checkbox.component.js.map +1 -1
- package/lib/commonjs/components/Checkbox/Checkbox.type.js +4 -0
- package/lib/commonjs/components/RadioButton/RadioButton.component.js +5 -3
- package/lib/commonjs/components/RadioButton/RadioButton.component.js.map +1 -1
- package/lib/commonjs/components/RadioButton/RadioButton.type.js +4 -0
- package/lib/commonjs/components/RadioInput/RadioInput.component.js +18 -10
- package/lib/commonjs/components/RadioInput/RadioInput.component.js.map +1 -1
- package/lib/commonjs/components/Tabs/Tabs.component.js +1 -0
- package/lib/commonjs/components/Tabs/Tabs.component.js.map +1 -1
- package/lib/commonjs/components/TextArea/TextArea.component.js +3 -2
- package/lib/commonjs/components/TextArea/TextArea.component.js.map +1 -1
- package/lib/commonjs/components/TextInput/TextInput.component.js +6 -3
- package/lib/commonjs/components/TextInput/TextInput.component.js.map +1 -1
- package/lib/commonjs/components/index.js +62 -0
- package/lib/commonjs/components/index.js.map +1 -1
- package/lib/commonjs/components/rounded-tab/rounded-tab.component.js +7 -2
- package/lib/commonjs/components/rounded-tab/rounded-tab.component.js.map +1 -1
- package/lib/commonjs/components/search-input/search-input.component.js +57 -0
- package/lib/commonjs/components/search-input/search-input.component.js.map +1 -0
- package/lib/commonjs/components/search-input/search-input.style.js +34 -0
- package/lib/commonjs/components/search-input/search-input.style.js.map +1 -0
- package/lib/commonjs/components/search-input/search-input.type.js +6 -0
- package/lib/commonjs/components/search-input/search-input.type.js.map +1 -0
- package/lib/commonjs/components/textlink/textlink.component.js +7 -2
- package/lib/commonjs/components/textlink/textlink.component.js.map +1 -1
- package/lib/module/components/Appbar/Appbar.component.js +6 -4
- package/lib/module/components/Appbar/Appbar.component.js.map +1 -1
- package/lib/module/components/Appbar/Appbar.style.js +9 -2
- package/lib/module/components/Appbar/Appbar.style.js.map +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.component.js +7 -25
- package/lib/module/components/BottomSheet/BottomSheet.component.js.map +1 -1
- package/lib/module/components/BottomSheet/BottomSheet.style.js +11 -4
- package/lib/module/components/BottomSheet/BottomSheet.style.js.map +1 -1
- package/lib/module/components/CheckBoxInput/CheckBoxInput.component.js +18 -10
- package/lib/module/components/CheckBoxInput/CheckBoxInput.component.js.map +1 -1
- package/lib/module/components/Checkbox/Checkbox.component.js +5 -3
- package/lib/module/components/Checkbox/Checkbox.component.js.map +1 -1
- package/lib/module/components/Checkbox/Checkbox.type.js +1 -1
- package/lib/module/components/RadioButton/RadioButton.component.js +5 -3
- package/lib/module/components/RadioButton/RadioButton.component.js.map +1 -1
- package/lib/module/components/RadioButton/RadioButton.type.js +1 -1
- package/lib/module/components/RadioInput/RadioInput.component.js +18 -10
- package/lib/module/components/RadioInput/RadioInput.component.js.map +1 -1
- package/lib/module/components/Tabs/Tabs.component.js +1 -0
- package/lib/module/components/Tabs/Tabs.component.js.map +1 -1
- package/lib/module/components/TextArea/TextArea.component.js +3 -2
- package/lib/module/components/TextArea/TextArea.component.js.map +1 -1
- package/lib/module/components/TextInput/TextInput.component.js +5 -4
- package/lib/module/components/TextInput/TextInput.component.js.map +1 -1
- package/lib/module/components/index.js +2 -0
- package/lib/module/components/index.js.map +1 -1
- package/lib/module/components/rounded-tab/rounded-tab.component.js +7 -2
- package/lib/module/components/rounded-tab/rounded-tab.component.js.map +1 -1
- package/lib/module/components/search-input/search-input.component.js +50 -0
- package/lib/module/components/search-input/search-input.component.js.map +1 -0
- package/lib/module/components/search-input/search-input.style.js +27 -0
- package/lib/module/components/search-input/search-input.style.js.map +1 -0
- package/lib/module/components/search-input/search-input.type.js +2 -0
- package/lib/module/components/search-input/search-input.type.js.map +1 -0
- package/lib/module/components/textlink/textlink.component.js +7 -2
- package/lib/module/components/textlink/textlink.component.js.map +1 -1
- package/lib/typescript/components/Appbar/Appbar.component.d.ts.map +1 -1
- package/lib/typescript/components/Appbar/Appbar.style.d.ts +3 -1
- package/lib/typescript/components/Appbar/Appbar.style.d.ts.map +1 -1
- package/lib/typescript/components/Appbar/Appbar.type.d.ts +2 -0
- package/lib/typescript/components/Appbar/Appbar.type.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/BottomSheet.component.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/BottomSheet.style.d.ts +1 -0
- package/lib/typescript/components/BottomSheet/BottomSheet.style.d.ts.map +1 -1
- package/lib/typescript/components/BottomSheet/BottomSheet.type.d.ts +2 -2
- package/lib/typescript/components/BottomSheet/BottomSheet.type.d.ts.map +1 -1
- package/lib/typescript/components/CheckBoxInput/CheckBoxInput.component.d.ts.map +1 -1
- package/lib/typescript/components/CheckBoxInput/CheckBoxInput.type.d.ts +7 -4
- package/lib/typescript/components/CheckBoxInput/CheckBoxInput.type.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/Checkbox.component.d.ts.map +1 -1
- package/lib/typescript/components/Checkbox/Checkbox.type.d.ts +2 -1
- package/lib/typescript/components/Checkbox/Checkbox.type.d.ts.map +1 -1
- package/lib/typescript/components/RadioButton/RadioButton.component.d.ts.map +1 -1
- package/lib/typescript/components/RadioButton/RadioButton.type.d.ts +2 -1
- package/lib/typescript/components/RadioButton/RadioButton.type.d.ts.map +1 -1
- package/lib/typescript/components/RadioInput/RadioInput.component.d.ts.map +1 -1
- package/lib/typescript/components/RadioInput/RadioInput.type.d.ts +7 -4
- package/lib/typescript/components/RadioInput/RadioInput.type.d.ts.map +1 -1
- package/lib/typescript/components/Tabs/Tabs.component.d.ts.map +1 -1
- package/lib/typescript/components/TextArea/TextArea.component.d.ts.map +1 -1
- package/lib/typescript/components/TextArea/TextArea.type.d.ts +2 -0
- package/lib/typescript/components/TextArea/TextArea.type.d.ts.map +1 -1
- package/lib/typescript/components/TextInput/TextInput.component.d.ts.map +1 -1
- package/lib/typescript/components/TextInput/TextInput.type.d.ts +4 -2
- package/lib/typescript/components/TextInput/TextInput.type.d.ts.map +1 -1
- package/lib/typescript/components/index.d.ts +3 -0
- package/lib/typescript/components/index.d.ts.map +1 -1
- package/lib/typescript/components/rounded-tab/rounded-tab.component.d.ts.map +1 -1
- package/lib/typescript/components/rounded-tab/rounded-tab.type.d.ts +3 -1
- package/lib/typescript/components/rounded-tab/rounded-tab.type.d.ts.map +1 -1
- package/lib/typescript/components/search-input/search-input.component.d.ts +4 -0
- package/lib/typescript/components/search-input/search-input.component.d.ts.map +1 -0
- package/lib/typescript/components/search-input/search-input.style.d.ts +10 -0
- package/lib/typescript/components/search-input/search-input.style.d.ts.map +1 -0
- package/lib/typescript/components/search-input/search-input.type.d.ts +7 -0
- package/lib/typescript/components/search-input/search-input.type.d.ts.map +1 -0
- package/lib/typescript/components/textlink/textlink.component.d.ts.map +1 -1
- package/package.json +3 -2
- package/src/components/Appbar/Appbar.component.tsx +35 -34
- package/src/components/Appbar/Appbar.style.tsx +9 -2
- package/src/components/Appbar/Appbar.type.ts +4 -0
- package/src/components/BottomSheet/BottomSheet.component.tsx +32 -53
- package/src/components/BottomSheet/BottomSheet.style.tsx +11 -2
- package/src/components/BottomSheet/BottomSheet.type.ts +3 -2
- package/src/components/CheckBoxInput/CheckBoxInput.component.tsx +18 -2
- package/src/components/CheckBoxInput/CheckBoxInput.type.ts +7 -5
- package/src/components/Checkbox/Checkbox.component.tsx +2 -1
- package/src/components/Checkbox/Checkbox.type.ts +3 -1
- package/src/components/RadioButton/RadioButton.component.tsx +2 -1
- package/src/components/RadioButton/RadioButton.type.ts +3 -1
- package/src/components/RadioInput/RadioInput.component.tsx +18 -2
- package/src/components/RadioInput/RadioInput.type.ts +7 -5
- package/src/components/Tabs/Tabs.component.tsx +1 -0
- package/src/components/TextArea/TextArea.component.tsx +6 -1
- package/src/components/TextArea/TextArea.type.ts +2 -0
- package/src/components/TextInput/TextInput.component.tsx +8 -3
- package/src/components/TextInput/TextInput.type.ts +4 -2
- package/src/components/index.ts +13 -0
- package/src/components/rounded-tab/rounded-tab.component.tsx +11 -2
- package/src/components/rounded-tab/rounded-tab.type.ts +3 -1
- package/src/components/search-input/search-input.component.tsx +66 -0
- package/src/components/search-input/search-input.style.ts +38 -0
- package/src/components/search-input/search-input.type.ts +7 -0
- package/src/components/textlink/textlink.component.tsx +6 -0
|
@@ -1,25 +1,32 @@
|
|
|
1
1
|
import { StyleSheet } from 'react-native';
|
|
2
2
|
|
|
3
3
|
import { Palettes, Radius, Spacing } from '../../themes';
|
|
4
|
+
import { AppbarProps } from './Appbar.type';
|
|
4
5
|
|
|
5
6
|
import type { ViewStyle } from 'react-native';
|
|
6
7
|
import { TextStyle } from 'react-native';
|
|
7
8
|
|
|
8
9
|
interface ComputedStyleProps {
|
|
9
10
|
container?: ViewStyle;
|
|
11
|
+
wrapperContainer?: ViewStyle;
|
|
10
12
|
iconWrapper?: ViewStyle;
|
|
11
13
|
contentWrapper?: ViewStyle;
|
|
12
14
|
title?: TextStyle;
|
|
13
15
|
}
|
|
14
16
|
|
|
15
|
-
export const getStyle = () => {
|
|
17
|
+
export const getStyle = (props: AppbarProps) => {
|
|
18
|
+
const { statusBarHeight = 0, backgroundColor = Palettes.white[50] } = props;
|
|
16
19
|
const computedStyle: ComputedStyleProps = {};
|
|
17
20
|
|
|
18
21
|
computedStyle.container = {
|
|
22
|
+
paddingTop: statusBarHeight,
|
|
23
|
+
backgroundColor,
|
|
24
|
+
};
|
|
25
|
+
|
|
26
|
+
computedStyle.wrapperContainer = {
|
|
19
27
|
width: '100%',
|
|
20
28
|
height: 56,
|
|
21
29
|
padding: Spacing[16],
|
|
22
|
-
backgroundColor: Palettes.white[50],
|
|
23
30
|
flexDirection: 'row',
|
|
24
31
|
justifyContent: 'flex-start',
|
|
25
32
|
alignItems: 'center',
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import * as React from 'react';
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
Animated,
|
|
4
|
+
Dimensions,
|
|
5
|
+
PanResponder,
|
|
6
|
+
TouchableHighlight,
|
|
7
|
+
View,
|
|
8
|
+
} from 'react-native';
|
|
3
9
|
import Modal from 'react-native-modal';
|
|
4
10
|
|
|
5
11
|
import { getStyle } from './BottomSheet.style';
|
|
6
12
|
import { Typography } from '../typography/typography.component';
|
|
7
13
|
|
|
8
14
|
import type { BottomSheetProps } from './BottomSheet.type';
|
|
9
|
-
import { TouchableHighlight } from 'react-native';
|
|
10
15
|
|
|
11
16
|
type BottomSheetRefHandle = {
|
|
12
17
|
open: () => void;
|
|
@@ -108,61 +113,35 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
108
113
|
return (
|
|
109
114
|
<View style={[computedStyle.sheetHeaderWrapper]}>
|
|
110
115
|
<View style={[computedStyle.sheetHeader]}>
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
{
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
}
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
minWidth: ((deviceWindow.width - 32) / 8) * 4,
|
|
135
|
-
},
|
|
136
|
-
]}
|
|
137
|
-
>
|
|
138
|
-
{!!title && (
|
|
139
|
-
<Typography
|
|
140
|
-
variant="subtitle1"
|
|
141
|
-
style={[computedStyle.textCenter]}
|
|
142
|
-
numberOfLines={2}
|
|
143
|
-
{...titleProps}
|
|
144
|
-
>
|
|
145
|
-
{title}
|
|
146
|
-
</Typography>
|
|
147
|
-
)}
|
|
148
|
-
</View>
|
|
149
|
-
<View
|
|
150
|
-
style={[
|
|
151
|
-
{
|
|
152
|
-
maxWidth: ((deviceWindow.width - 32) / 8) * 2,
|
|
153
|
-
minWidth: ((deviceWindow.width - 32) / 8) * 2,
|
|
154
|
-
},
|
|
155
|
-
computedStyle.sheetActionWrapper,
|
|
156
|
-
]}
|
|
157
|
-
>
|
|
158
|
-
{action || null}
|
|
159
|
-
</View>
|
|
116
|
+
{!!dismissIcon && (
|
|
117
|
+
<TouchableHighlight
|
|
118
|
+
onPress={handleDismiss}
|
|
119
|
+
style={[computedStyle.sheetDismissIconWrapper]}
|
|
120
|
+
underlayColor={'transparent'}
|
|
121
|
+
{...dismissIconProps}
|
|
122
|
+
>
|
|
123
|
+
{dismissIcon}
|
|
124
|
+
</TouchableHighlight>
|
|
125
|
+
)}
|
|
126
|
+
{!!title && (
|
|
127
|
+
<Typography
|
|
128
|
+
variant="subtitle1"
|
|
129
|
+
style={[computedStyle.textCenter]}
|
|
130
|
+
numberOfLines={2}
|
|
131
|
+
{...titleProps}
|
|
132
|
+
>
|
|
133
|
+
{title}
|
|
134
|
+
</Typography>
|
|
135
|
+
)}
|
|
136
|
+
{action && (
|
|
137
|
+
<View style={[computedStyle.sheetActionWrapper]}>{action}</View>
|
|
138
|
+
)}
|
|
160
139
|
</View>
|
|
161
140
|
{!!subtitle && (
|
|
162
141
|
<Typography
|
|
163
142
|
variant="body2"
|
|
164
143
|
numberOfLines={2}
|
|
165
|
-
style={[computedStyle.textCenter]}
|
|
144
|
+
style={[computedStyle.textCenter, computedStyle.subtitleText]}
|
|
166
145
|
{...subtitleProps}
|
|
167
146
|
>
|
|
168
147
|
{subtitle}
|
|
@@ -186,7 +165,7 @@ const BottomSheet = React.forwardRef<BottomSheetRefHandle, BottomSheetProps>(
|
|
|
186
165
|
{!!dismissIcon && (
|
|
187
166
|
<TouchableHighlight
|
|
188
167
|
onPress={handleDismiss}
|
|
189
|
-
style={[computedStyle.sheetDismissIconWrapper
|
|
168
|
+
style={[computedStyle.sheetDismissIconWrapper]}
|
|
190
169
|
underlayColor={'transparent'}
|
|
191
170
|
{...dismissIconProps}
|
|
192
171
|
>
|
|
@@ -18,6 +18,7 @@ interface ComputedStyleProps {
|
|
|
18
18
|
sheetActionWrapper?: ViewStyle;
|
|
19
19
|
largeIconContainer?: ViewStyle;
|
|
20
20
|
largeIconAbsoluteWrapper?: ViewStyle;
|
|
21
|
+
subtitleText?: TextStyle;
|
|
21
22
|
}
|
|
22
23
|
|
|
23
24
|
export const getStyle = () => {
|
|
@@ -57,7 +58,7 @@ export const getStyle = () => {
|
|
|
57
58
|
computedStyle.sheetHeader = {
|
|
58
59
|
flexDirection: 'row',
|
|
59
60
|
alignItems: 'center',
|
|
60
|
-
justifyContent: '
|
|
61
|
+
justifyContent: 'center',
|
|
61
62
|
};
|
|
62
63
|
|
|
63
64
|
computedStyle.sheetHeaderWrapper = {
|
|
@@ -66,10 +67,14 @@ export const getStyle = () => {
|
|
|
66
67
|
};
|
|
67
68
|
computedStyle.sheetDismissIconWrapper = {
|
|
68
69
|
padding: 4,
|
|
70
|
+
position: 'absolute',
|
|
71
|
+
left: 0,
|
|
72
|
+
zIndex: 99,
|
|
69
73
|
};
|
|
70
74
|
computedStyle.sheetActionWrapper = {
|
|
71
|
-
flexDirection: 'row',
|
|
72
75
|
justifyContent: 'flex-end',
|
|
76
|
+
position: 'absolute',
|
|
77
|
+
right: 0,
|
|
73
78
|
};
|
|
74
79
|
|
|
75
80
|
computedStyle.textCenter = {
|
|
@@ -85,5 +90,9 @@ export const getStyle = () => {
|
|
|
85
90
|
bottom: 0,
|
|
86
91
|
};
|
|
87
92
|
|
|
93
|
+
computedStyle.subtitleText = {
|
|
94
|
+
marginTop: Spacing[8],
|
|
95
|
+
};
|
|
96
|
+
|
|
88
97
|
return StyleSheet.create(computedStyle);
|
|
89
98
|
};
|
|
@@ -3,12 +3,13 @@ import { ReactNode } from 'react';
|
|
|
3
3
|
import type { TextProps, TouchableHighlightProps } from 'react-native';
|
|
4
4
|
import type { ModalProps } from 'react-native-modal';
|
|
5
5
|
|
|
6
|
-
export interface BottomSheetProps
|
|
6
|
+
export interface BottomSheetProps
|
|
7
|
+
extends Omit<Partial<ModalProps>, 'isVisible'> {
|
|
7
8
|
onDismiss?: () => void;
|
|
8
9
|
|
|
9
10
|
sheetHeader?: ReactNode;
|
|
10
11
|
|
|
11
|
-
title
|
|
12
|
+
title?: string;
|
|
12
13
|
|
|
13
14
|
titleProps?: TextProps;
|
|
14
15
|
|
|
@@ -31,6 +31,7 @@ const CheckBoxInput: React.FunctionComponent<CheckboxInputProps> = (props) => {
|
|
|
31
31
|
label,
|
|
32
32
|
errorMessage,
|
|
33
33
|
helperMessage,
|
|
34
|
+
helperMessageProps,
|
|
34
35
|
isError,
|
|
35
36
|
disabled,
|
|
36
37
|
editable = true,
|
|
@@ -46,6 +47,8 @@ const CheckBoxInput: React.FunctionComponent<CheckboxInputProps> = (props) => {
|
|
|
46
47
|
onInputDismiss = () => {},
|
|
47
48
|
customCheckboxInput,
|
|
48
49
|
customItemSeparator = <Divider />,
|
|
50
|
+
testID = '',
|
|
51
|
+
...rest
|
|
49
52
|
} = props;
|
|
50
53
|
|
|
51
54
|
const [labelWidth, setLabelWidth] = React.useState(0);
|
|
@@ -149,7 +152,11 @@ const CheckBoxInput: React.FunctionComponent<CheckboxInputProps> = (props) => {
|
|
|
149
152
|
|
|
150
153
|
return (
|
|
151
154
|
<>
|
|
152
|
-
<TouchableWithoutFeedback
|
|
155
|
+
<TouchableWithoutFeedback
|
|
156
|
+
onPress={openBottomSheet}
|
|
157
|
+
testID={testID}
|
|
158
|
+
{...rest}
|
|
159
|
+
>
|
|
153
160
|
<View style={computedStyle.fieldWrapper}>
|
|
154
161
|
<View style={computedStyle.fieldContainer}>
|
|
155
162
|
{!!label && (
|
|
@@ -180,7 +187,11 @@ const CheckBoxInput: React.FunctionComponent<CheckboxInputProps> = (props) => {
|
|
|
180
187
|
</View>
|
|
181
188
|
</View>
|
|
182
189
|
{errorMessage || helperMessage ? (
|
|
183
|
-
<Typography
|
|
190
|
+
<Typography
|
|
191
|
+
variant="caption"
|
|
192
|
+
style={computedStyle.messageHelper}
|
|
193
|
+
{...helperMessageProps}
|
|
194
|
+
>
|
|
184
195
|
{errorMessage || ((!isError && helperMessage) as string)}
|
|
185
196
|
</Typography>
|
|
186
197
|
) : null}
|
|
@@ -207,6 +218,7 @@ const CheckBoxInput: React.FunctionComponent<CheckboxInputProps> = (props) => {
|
|
|
207
218
|
data={item}
|
|
208
219
|
selectedValue={selectedValue}
|
|
209
220
|
onItemPress={onCheckboxItemPress}
|
|
221
|
+
testID={`${testID}_checkbox_item_${item.index}`}
|
|
210
222
|
/>
|
|
211
223
|
);
|
|
212
224
|
}}
|
|
@@ -232,6 +244,8 @@ function CheckboxItem({
|
|
|
232
244
|
data,
|
|
233
245
|
selectedValue,
|
|
234
246
|
onItemPress = () => {},
|
|
247
|
+
testID,
|
|
248
|
+
...rest
|
|
235
249
|
}: CheckboxItemPropsComponent) {
|
|
236
250
|
const { item } = data;
|
|
237
251
|
const { label, value, disabled } = item;
|
|
@@ -242,6 +256,7 @@ function CheckboxItem({
|
|
|
242
256
|
onPress={() => onItemPress(item)}
|
|
243
257
|
underlayColor={Palettes.whiteDark[100]}
|
|
244
258
|
disabled={disabled}
|
|
259
|
+
{...rest}
|
|
245
260
|
{...item}
|
|
246
261
|
>
|
|
247
262
|
<View style={[computedStyle.checkboxItemWrapper]}>
|
|
@@ -253,6 +268,7 @@ function CheckboxItem({
|
|
|
253
268
|
!!selectedValue?.some((selected) => selected.value === value)
|
|
254
269
|
}
|
|
255
270
|
disabled={disabled}
|
|
271
|
+
testID={testID}
|
|
256
272
|
/>
|
|
257
273
|
</View>
|
|
258
274
|
</TouchableHighlight>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { TouchableHighlightProps } from 'react-native';
|
|
4
|
+
import type { TouchableWithoutFeedbackProps } from 'react-native';
|
|
4
5
|
|
|
5
6
|
import type { BottomSheetProps } from '../BottomSheet/BottomSheet.type';
|
|
6
7
|
import type { ButtonProps } from '../button/button.type';
|
|
8
|
+
import { TypographyProps } from '../typography/typography.type';
|
|
7
9
|
|
|
8
|
-
export interface CheckboxInputProps {
|
|
10
|
+
export interface CheckboxInputProps extends TouchableWithoutFeedbackProps {
|
|
9
11
|
/**
|
|
10
12
|
* A string that specifies the label text for the input field.
|
|
11
13
|
*/
|
|
@@ -17,7 +19,7 @@ export interface CheckboxInputProps {
|
|
|
17
19
|
* guidance to the user, such as formatting requirements or error messages.
|
|
18
20
|
*/
|
|
19
21
|
helperMessage?: string;
|
|
20
|
-
|
|
22
|
+
helperMessageProps?: TypographyProps;
|
|
21
23
|
/**
|
|
22
24
|
* Indicate error state
|
|
23
25
|
*/
|
|
@@ -46,7 +48,7 @@ export interface CheckboxInputProps {
|
|
|
46
48
|
|
|
47
49
|
saveInputLabel: string;
|
|
48
50
|
|
|
49
|
-
saveInputProps
|
|
51
|
+
saveInputProps?: ButtonProps;
|
|
50
52
|
|
|
51
53
|
bottomSheetOpt: Omit<BottomSheetProps, 'visibility' | 'onDismiss'>;
|
|
52
54
|
|
|
@@ -65,10 +67,10 @@ export type CheckboxItemProps = {
|
|
|
65
67
|
disabled?: boolean;
|
|
66
68
|
} & TouchableHighlightProps;
|
|
67
69
|
|
|
68
|
-
export
|
|
70
|
+
export interface CheckboxItemPropsComponent extends TouchableHighlightProps {
|
|
69
71
|
data: {
|
|
70
72
|
item: CheckboxItemProps;
|
|
71
73
|
};
|
|
72
74
|
selectedValue?: CheckboxItemProps[];
|
|
73
75
|
onItemPress?: (value: CheckboxItemProps) => void;
|
|
74
|
-
}
|
|
76
|
+
}
|
|
@@ -8,7 +8,7 @@ import { IconTick } from '../../icons';
|
|
|
8
8
|
import { Palettes } from '../../themes';
|
|
9
9
|
|
|
10
10
|
const Checkbox: React.FunctionComponent<CheckboxProps> = (props) => {
|
|
11
|
-
const { selected, disabled } = props;
|
|
11
|
+
const { selected, disabled, ...rest } = props;
|
|
12
12
|
|
|
13
13
|
const computedStyle = getStyle();
|
|
14
14
|
|
|
@@ -20,6 +20,7 @@ const Checkbox: React.FunctionComponent<CheckboxProps> = (props) => {
|
|
|
20
20
|
selected && computedStyle.outerSelected,
|
|
21
21
|
disabled && computedStyle.outerDisabled,
|
|
22
22
|
]}
|
|
23
|
+
{...rest}
|
|
23
24
|
>
|
|
24
25
|
{selected && (
|
|
25
26
|
<IconTick
|
|
@@ -6,7 +6,7 @@ import { getStyle } from './RadioButton.style';
|
|
|
6
6
|
import type { RadioButtonProps } from './RadioButton.type';
|
|
7
7
|
|
|
8
8
|
const RadioButton: React.FunctionComponent<RadioButtonProps> = (props) => {
|
|
9
|
-
const { selected, disabled } = props;
|
|
9
|
+
const { selected, disabled, ...rest } = props;
|
|
10
10
|
|
|
11
11
|
const computedStyle = getStyle();
|
|
12
12
|
|
|
@@ -14,6 +14,7 @@ const RadioButton: React.FunctionComponent<RadioButtonProps> = (props) => {
|
|
|
14
14
|
<>
|
|
15
15
|
<View
|
|
16
16
|
style={[computedStyle.outer, disabled && computedStyle.outerDisabled]}
|
|
17
|
+
{...rest}
|
|
17
18
|
>
|
|
18
19
|
<View
|
|
19
20
|
style={[
|
|
@@ -29,6 +29,7 @@ const RadioInput: React.FunctionComponent<RadioInputProps> = (props) => {
|
|
|
29
29
|
label,
|
|
30
30
|
errorMessage,
|
|
31
31
|
helperMessage,
|
|
32
|
+
helperMessageProps,
|
|
32
33
|
isError,
|
|
33
34
|
disabled,
|
|
34
35
|
editable = true,
|
|
@@ -43,6 +44,8 @@ const RadioInput: React.FunctionComponent<RadioInputProps> = (props) => {
|
|
|
43
44
|
onInputDismiss = () => {},
|
|
44
45
|
customRadioInput,
|
|
45
46
|
customItemSeparator = <Divider />,
|
|
47
|
+
testID,
|
|
48
|
+
...rest
|
|
46
49
|
} = props;
|
|
47
50
|
|
|
48
51
|
const [labelWidth, setLabelWidth] = React.useState(0);
|
|
@@ -121,7 +124,11 @@ const RadioInput: React.FunctionComponent<RadioInputProps> = (props) => {
|
|
|
121
124
|
|
|
122
125
|
return (
|
|
123
126
|
<>
|
|
124
|
-
<TouchableWithoutFeedback
|
|
127
|
+
<TouchableWithoutFeedback
|
|
128
|
+
onPress={openBottomSheet}
|
|
129
|
+
testID={testID}
|
|
130
|
+
{...rest}
|
|
131
|
+
>
|
|
125
132
|
<View style={computedStyle.fieldWrapper}>
|
|
126
133
|
<View style={computedStyle.fieldContainer}>
|
|
127
134
|
{!!label && (
|
|
@@ -152,7 +159,11 @@ const RadioInput: React.FunctionComponent<RadioInputProps> = (props) => {
|
|
|
152
159
|
</View>
|
|
153
160
|
</View>
|
|
154
161
|
{errorMessage || helperMessage ? (
|
|
155
|
-
<Typography
|
|
162
|
+
<Typography
|
|
163
|
+
variant="caption"
|
|
164
|
+
style={computedStyle.messageHelper}
|
|
165
|
+
{...helperMessageProps}
|
|
166
|
+
>
|
|
156
167
|
{errorMessage || ((!isError && helperMessage) as string)}
|
|
157
168
|
</Typography>
|
|
158
169
|
) : null}
|
|
@@ -179,6 +190,7 @@ const RadioInput: React.FunctionComponent<RadioInputProps> = (props) => {
|
|
|
179
190
|
data={item}
|
|
180
191
|
selectedValue={selectedValue}
|
|
181
192
|
onItemPress={onRadioItemPress}
|
|
193
|
+
testID={`${testID}_item_radio_${item.index}`}
|
|
182
194
|
/>
|
|
183
195
|
);
|
|
184
196
|
}}
|
|
@@ -204,6 +216,8 @@ function RadioItem({
|
|
|
204
216
|
data,
|
|
205
217
|
selectedValue,
|
|
206
218
|
onItemPress = () => {},
|
|
219
|
+
testID,
|
|
220
|
+
...rest
|
|
207
221
|
}: RadioItemPropsComponent) {
|
|
208
222
|
const { item } = data;
|
|
209
223
|
const { label, value, disabled } = item;
|
|
@@ -214,6 +228,7 @@ function RadioItem({
|
|
|
214
228
|
onPress={() => onItemPress(item)}
|
|
215
229
|
underlayColor={Palettes.whiteDark[100]}
|
|
216
230
|
disabled={disabled}
|
|
231
|
+
{...rest}
|
|
217
232
|
{...item}
|
|
218
233
|
>
|
|
219
234
|
<View style={[computedStyle.radioItemWrapper]}>
|
|
@@ -223,6 +238,7 @@ function RadioItem({
|
|
|
223
238
|
<RadioButton
|
|
224
239
|
selected={value === selectedValue?.value}
|
|
225
240
|
disabled={disabled}
|
|
241
|
+
testID={testID}
|
|
226
242
|
/>
|
|
227
243
|
</View>
|
|
228
244
|
</TouchableHighlight>
|
|
@@ -1,11 +1,13 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
2
|
|
|
3
3
|
import type { TouchableHighlightProps } from 'react-native';
|
|
4
|
+
import type { TouchableWithoutFeedbackProps } from 'react-native';
|
|
4
5
|
|
|
5
6
|
import type { BottomSheetProps } from '../BottomSheet/BottomSheet.type';
|
|
6
7
|
import type { ButtonProps } from '../button/button.type';
|
|
8
|
+
import { TypographyProps } from '../typography/typography.type';
|
|
7
9
|
|
|
8
|
-
export interface RadioInputProps {
|
|
10
|
+
export interface RadioInputProps extends TouchableWithoutFeedbackProps {
|
|
9
11
|
/**
|
|
10
12
|
* A string that specifies the label text for the input field.
|
|
11
13
|
*/
|
|
@@ -17,7 +19,7 @@ export interface RadioInputProps {
|
|
|
17
19
|
* guidance to the user, such as formatting requirements or error messages.
|
|
18
20
|
*/
|
|
19
21
|
helperMessage?: string;
|
|
20
|
-
|
|
22
|
+
helperMessageProps?: TypographyProps;
|
|
21
23
|
/**
|
|
22
24
|
* Indicate error state
|
|
23
25
|
*/
|
|
@@ -46,7 +48,7 @@ export interface RadioInputProps {
|
|
|
46
48
|
|
|
47
49
|
saveInputLabel: string;
|
|
48
50
|
|
|
49
|
-
saveInputProps
|
|
51
|
+
saveInputProps?: ButtonProps;
|
|
50
52
|
|
|
51
53
|
bottomSheetOpt: Omit<BottomSheetProps, 'visibility' | 'onDismiss'>;
|
|
52
54
|
|
|
@@ -63,10 +65,10 @@ export type RadioItemProps = {
|
|
|
63
65
|
disabled?: boolean;
|
|
64
66
|
} & TouchableHighlightProps;
|
|
65
67
|
|
|
66
|
-
export
|
|
68
|
+
export interface RadioItemPropsComponent extends TouchableHighlightProps {
|
|
67
69
|
data: {
|
|
68
70
|
item: RadioItemProps;
|
|
69
71
|
};
|
|
70
72
|
selectedValue?: RadioItemProps;
|
|
71
73
|
onItemPress?: (value: RadioItemProps) => void;
|
|
72
|
-
}
|
|
74
|
+
}
|
|
@@ -72,6 +72,7 @@ const Tabs: React.FunctionComponent<TabsProps> = (props) => {
|
|
|
72
72
|
<View style={[computedStyle.container]}>
|
|
73
73
|
{labels.map((label, idx) => (
|
|
74
74
|
<TouchableOpacity
|
|
75
|
+
key={idx}
|
|
75
76
|
onPress={() => onTabPress(idx)}
|
|
76
77
|
style={[computedStyle.tabContainer]}
|
|
77
78
|
onLayout={(event) => onLayout(event, idx)}
|
|
@@ -17,6 +17,7 @@ const TextArea: React.FunctionComponent<TextAreaProps> = (props) => {
|
|
|
17
17
|
helperMessage = '',
|
|
18
18
|
counter = 0,
|
|
19
19
|
errorMessage,
|
|
20
|
+
helperMessageProps,
|
|
20
21
|
isError,
|
|
21
22
|
onBlur = () => null,
|
|
22
23
|
onFocus = () => null,
|
|
@@ -67,7 +68,11 @@ const TextArea: React.FunctionComponent<TextAreaProps> = (props) => {
|
|
|
67
68
|
)}
|
|
68
69
|
</View>
|
|
69
70
|
{errorMessage || helperMessage ? (
|
|
70
|
-
<Typography
|
|
71
|
+
<Typography
|
|
72
|
+
variant="caption"
|
|
73
|
+
style={computedStyle.messageHelper}
|
|
74
|
+
{...helperMessageProps}
|
|
75
|
+
>
|
|
71
76
|
{errorMessage || ((!isError && helperMessage) as string)}
|
|
72
77
|
</Typography>
|
|
73
78
|
) : null}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { TextInput } from 'react-native';
|
|
2
|
+
import { TypographyProps } from '../typography/typography.type';
|
|
2
3
|
|
|
3
4
|
export interface TextAreaProps extends React.ComponentProps<typeof TextInput> {
|
|
4
5
|
/**
|
|
@@ -12,6 +13,7 @@ export interface TextAreaProps extends React.ComponentProps<typeof TextInput> {
|
|
|
12
13
|
* guidance to the user, such as formatting requirements or error messages.
|
|
13
14
|
*/
|
|
14
15
|
helperMessage?: string;
|
|
16
|
+
helperMessageProps?: TypographyProps;
|
|
15
17
|
|
|
16
18
|
/**
|
|
17
19
|
* Indicate error state
|
|
@@ -2,7 +2,7 @@ import * as React from 'react';
|
|
|
2
2
|
import { View } from 'react-native';
|
|
3
3
|
import { getStyle } from './TextInput.style';
|
|
4
4
|
import type { TextInputProps } from './TextInput.type';
|
|
5
|
-
import
|
|
5
|
+
import MaskInput from 'react-native-mask-input';
|
|
6
6
|
import { Typography } from '../typography/typography.component';
|
|
7
7
|
import { Animated } from 'react-native';
|
|
8
8
|
import { Palettes } from '../../themes';
|
|
@@ -18,6 +18,7 @@ const TextInput: React.FunctionComponent<TextInputProps> = (props) => {
|
|
|
18
18
|
onFocus = () => null,
|
|
19
19
|
errorMessage,
|
|
20
20
|
helperMessage,
|
|
21
|
+
helperMessageProps,
|
|
21
22
|
isError,
|
|
22
23
|
counter = 0,
|
|
23
24
|
inputIcon = null,
|
|
@@ -95,7 +96,7 @@ const TextInput: React.FunctionComponent<TextInputProps> = (props) => {
|
|
|
95
96
|
</Animated.View>
|
|
96
97
|
)}
|
|
97
98
|
<View style={computedStyle.inputWrapper}>
|
|
98
|
-
<
|
|
99
|
+
<MaskInput
|
|
99
100
|
value={value}
|
|
100
101
|
style={[computedStyle.textField]}
|
|
101
102
|
onFocus={handleOnFocus}
|
|
@@ -113,7 +114,11 @@ const TextInput: React.FunctionComponent<TextInputProps> = (props) => {
|
|
|
113
114
|
</View>
|
|
114
115
|
</View>
|
|
115
116
|
{errorMessage || helperMessage ? (
|
|
116
|
-
<Typography
|
|
117
|
+
<Typography
|
|
118
|
+
variant="caption"
|
|
119
|
+
style={computedStyle.messageHelper}
|
|
120
|
+
{...helperMessageProps}
|
|
121
|
+
>
|
|
117
122
|
{errorMessage || ((!isError && helperMessage) as string)}
|
|
118
123
|
</Typography>
|
|
119
124
|
) : null}
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import type { ReactNode } from 'react';
|
|
2
|
-
import
|
|
2
|
+
import { MaskInputProps } from 'react-native-mask-input';
|
|
3
|
+
import { TypographyProps } from '../typography/typography.type';
|
|
3
4
|
|
|
4
|
-
export interface TextInputProps extends
|
|
5
|
+
export interface TextInputProps extends MaskInputProps {
|
|
5
6
|
/**
|
|
6
7
|
* A string that specifies the label text for the input field.
|
|
7
8
|
*/
|
|
@@ -13,6 +14,7 @@ export interface TextInputProps extends React.ComponentProps<typeof TextInput> {
|
|
|
13
14
|
* guidance to the user, such as formatting requirements or error messages.
|
|
14
15
|
*/
|
|
15
16
|
helperMessage?: string;
|
|
17
|
+
helperMessageProps?: TypographyProps;
|
|
16
18
|
|
|
17
19
|
/**
|
|
18
20
|
* Indicate error state
|
package/src/components/index.ts
CHANGED
|
@@ -15,6 +15,7 @@ export {
|
|
|
15
15
|
BottomSheet,
|
|
16
16
|
BottomSheetHandler,
|
|
17
17
|
} from './BottomSheet/BottomSheet.component';
|
|
18
|
+
export { SearchInput } from './search-input/search-input.component';
|
|
18
19
|
export { RadioInput } from './RadioInput/RadioInput.component';
|
|
19
20
|
export { CheckBoxInput } from './CheckBoxInput/CheckBoxInput.component';
|
|
20
21
|
export { Checkbox } from './Checkbox/Checkbox.component';
|
|
@@ -25,6 +26,17 @@ export { Dot } from './dot/dot.component';
|
|
|
25
26
|
export { InformationBox } from './information-box/information-box.component';
|
|
26
27
|
export { RoundedTab } from './rounded-tab/rounded-tab.component';
|
|
27
28
|
export { Countdown } from './countdown/countdown.component';
|
|
29
|
+
export {
|
|
30
|
+
Mask,
|
|
31
|
+
MaskArray,
|
|
32
|
+
MaskInputProps,
|
|
33
|
+
MaskItem,
|
|
34
|
+
Masks,
|
|
35
|
+
UseMaskedInputProps,
|
|
36
|
+
createNumberMask,
|
|
37
|
+
formatWithMask,
|
|
38
|
+
useMaskedInputProps,
|
|
39
|
+
} from 'react-native-mask-input';
|
|
28
40
|
|
|
29
41
|
export type { ButtonProps } from './button/button.type';
|
|
30
42
|
export type { TextInputProps } from './TextInput/TextInput.type';
|
|
@@ -36,3 +48,4 @@ export type { TextAreaProps } from './TextArea/TextArea.type';
|
|
|
36
48
|
export type { StepperCounterProps } from './StepperCounter/StepperCounter.type';
|
|
37
49
|
export type { DividerProps } from './Divider/Divider.type';
|
|
38
50
|
export type { TabsProps } from './Tabs/Tabs.type';
|
|
51
|
+
export type { SearchInputProps } from './search-input/search-input.type';
|