@tactics/toddle-styleguide 1.2.8 → 1.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/App.tsx +11 -0
- package/index.d.ts +2 -1
- package/index.tsx +2 -0
- package/package.json +1 -1
- package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +18 -18
- package/src/components/atoms/line/line.component.d.ts +12 -0
- package/src/components/atoms/line/line.component.tsx +23 -0
- package/src/components/atoms/line/line.preview.d.ts +1 -0
- package/src/components/atoms/line/line.preview.tsx +54 -0
- package/src/components/atoms/line/line.styles.d.ts +12 -0
- package/src/components/atoms/line/line.styles.js +10 -0
- package/src/components/atoms/quick-message/__snapshots__/quick-message.test.js.snap +72 -1
- package/src/components/atoms/quick-message/quick-message.component.d.ts +2 -0
- package/src/components/atoms/quick-message/quick-message.component.tsx +3 -1
- package/src/components/atoms/quick-message/quick-message.preview.tsx +10 -1
- package/src/components/atoms/quick-message/quick-message.styles.d.ts +4 -1
- package/src/components/atoms/quick-message/quick-message.styles.js +4 -2
- package/src/components/atoms/quick-message/quick-message.test.js +38 -6
- package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +38 -78
- package/src/components/atoms/text-input/text-input.component.tsx +6 -9
- package/src/components/atoms/text-input/text-input.preview.tsx +3 -3
- package/src/components/atoms/text-input/text-input.styles.d.ts +9 -25
- package/src/components/atoms/text-input/text-input.styles.js +7 -13
- package/src/components/molecules/day/__snapshots__/day.test.js.snap +24 -24
- package/src/components/molecules/day/day.component.tsx +17 -4
- package/src/components/molecules/day/day.styles.d.ts +33 -42
- package/src/components/molecules/day/day.styles.js +14 -17
- package/src/components/molecules/failed-to-send/failed-bubble.component.d.ts +2 -2
- package/src/components/molecules/failed-to-send/failed-bubble.component.tsx +39 -22
- package/src/components/molecules/password-input/__snapshots__/password-input.test.js.snap +53 -68
- package/src/components/molecules/password-input/password-input.component.tsx +7 -9
- package/src/components/molecules/password-input/password-input.styles.d.ts +8 -7
- package/src/components/molecules/password-input/password-input.styles.js +6 -6
- package/src/components/molecules/search-input/__snapshots__/search.test.js.snap +30 -31
- package/src/components/molecules/search-input/search.component.d.ts +9 -11
- package/src/components/molecules/search-input/search.component.tsx +19 -30
- package/src/components/molecules/search-input/search.preview.tsx +8 -6
- package/src/components/molecules/search-input/search.styles.d.ts +12 -11
- package/src/components/molecules/search-input/search.styles.js +14 -8
- package/src/components/molecules/search-input/search.test.js +3 -1
- package/src/components/molecules/send-bubble/__snapshots__/send-text-bubble.test.js.snap +12 -32
- package/src/components/molecules/send-bubble/send-text-bubble.component.d.ts +4 -4
- package/src/components/molecules/send-bubble/send-text-bubble.component.tsx +36 -25
- package/src/components/molecules/send-bubble/send-text-bubble.styles.d.ts +4 -7
- package/src/components/molecules/send-bubble/send-text-bubble.styles.js +2 -8
- package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +4 -4
- package/src/components/molecules/timeline/timeline.styles.d.ts +1 -1
- package/src/components/molecules/timeline/timeline.styles.js +2 -2
- package/src/components/molecules/timestamp/__snapshots__/timestamp.test.js.snap +2 -1
- package/src/components/molecules/timestamp/timestamp.component.d.ts +2 -1
- package/src/components/molecules/timestamp/timestamp.component.tsx +4 -7
- package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +165 -10
- package/src/components/organisms/child-list-item/child-list-item.component.d.ts +2 -0
- package/src/components/organisms/child-list-item/child-list-item.component.tsx +24 -1
- package/src/components/organisms/child-list-item/child-list-item.preview.tsx +11 -0
- package/src/components/organisms/child-list-item/child-list-item.styles.d.ts +0 -3
- package/src/components/organisms/child-list-item/child-list-item.styles.js +2 -3
- package/src/components/organisms/child-list-item/child-list-item.test.js +9 -4
- package/src/components/organisms/child-list-item/components/child-list-tag.component.d.ts +9 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.component.tsx +28 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.d.ts +13 -0
- package/src/components/organisms/child-list-item/components/child-list-tag.styles.js +16 -0
- package/src/components/organisms/day-select/day-select.preview.tsx +9 -5
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.d.ts +9 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.styles.d.ts +13 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.styles.js +17 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.test.js +21 -0
- package/src/components/organisms/journal-entry/components/entry-type-indicator/entry-type-indicator.tsx +97 -0
- package/src/components/organisms/journal-entry/components/index.d.ts +2 -0
- package/src/components/organisms/journal-entry/components/index.ts +2 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/__snapshots__/journal-entry-type.test.js.snap +304 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.d.ts +16 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.tsx +60 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.styles.d.ts +13 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.styles.js +16 -0
- package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.test.js +48 -0
- package/src/components/organisms/journal-entry/journal-entry.component.d.ts +38 -0
- package/src/components/organisms/journal-entry/journal-entry.component.tsx +139 -0
- package/src/components/organisms/journal-entry/journal-entry.preview.d.ts +1 -0
- package/src/components/organisms/journal-entry/journal-entry.preview.tsx +212 -0
- package/src/components/organisms/journal-entry/journal-entry.styles.d.ts +42 -0
- package/src/components/organisms/journal-entry/journal-entry.styles.js +35 -0
- package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +143 -399
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.d.ts +5 -7
- package/src/components/organisms/my-child-list-item/my-child-list-item.component.tsx +32 -59
- package/src/components/organisms/my-child-list-item/my-child-list-item.preview.tsx +36 -24
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.d.ts +15 -11
- package/src/components/organisms/my-child-list-item/my-child-list-item.styles.js +16 -11
- package/src/components/organisms/my-child-list-item/my-child-list-item.test.js +5 -22
- package/src/components/organisms/text-bubble/__snapshots__/text-bubble.test.js.snap +45 -29
- package/src/components/organisms/text-bubble/text-bubble.component.d.ts +8 -6
- package/src/components/organisms/text-bubble/text-bubble.component.tsx +14 -12
- package/src/components/organisms/text-bubble/text-bubble.preview.tsx +14 -19
- package/src/components/organisms/text-bubble/text-bubble.styles.d.ts +14 -3
- package/src/components/organisms/text-bubble/text-bubble.styles.js +6 -0
- package/src/components/organisms/text-bubble/text-bubble.test.js +7 -7
- package/src/components/templates/modal/components/fade-panel.component.tsx +1 -1
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.d.ts +4 -0
- package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.tsx +6 -0
- package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +14 -1
- package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +31 -2
- package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +114 -84
- package/src/utilities/toddle-datetime/types/{duration-like.type.d.ts → duration.type.d.ts} +2 -0
- package/src/utilities/toddle-datetime/types/{duration-like.type.tsx → duration.type.tsx} +3 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.d.ts +1 -0
- package/src/utilities/toddle-datetime/types/toddle-datetime.type.tsx +8 -1
|
@@ -13,33 +13,25 @@ exports[`Visual test for the password input field shows a password input field w
|
|
|
13
13
|
}
|
|
14
14
|
}
|
|
15
15
|
>
|
|
16
|
-
<
|
|
16
|
+
<TextInput
|
|
17
|
+
keyboardType="default"
|
|
18
|
+
onChangeText={[Function]}
|
|
19
|
+
placeholderTextColor="#9AA5B1"
|
|
20
|
+
secureTextEntry={true}
|
|
17
21
|
style={
|
|
18
22
|
{
|
|
23
|
+
"color": "#1F2933",
|
|
19
24
|
"flex": 1,
|
|
25
|
+
"fontFamily": "SourceSansPro",
|
|
26
|
+
"fontSize": 16,
|
|
27
|
+
"height": "100%",
|
|
28
|
+
"justifyContent": "center",
|
|
29
|
+
"lineHeight": 20,
|
|
30
|
+
"paddingLeft": 16,
|
|
20
31
|
}
|
|
21
32
|
}
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
keyboardType="default"
|
|
25
|
-
onChangeText={[Function]}
|
|
26
|
-
placeholderTextColor="#9AA5B1"
|
|
27
|
-
secureTextEntry={true}
|
|
28
|
-
style={
|
|
29
|
-
{
|
|
30
|
-
"color": "#1F2933",
|
|
31
|
-
"fontFamily": "SourceSansPro",
|
|
32
|
-
"fontSize": 16,
|
|
33
|
-
"lineHeight": 20,
|
|
34
|
-
"paddingBottom": 0,
|
|
35
|
-
"paddingLeft": 16,
|
|
36
|
-
"paddingRight": 16,
|
|
37
|
-
"paddingTop": 0,
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
value="text"
|
|
41
|
-
/>
|
|
42
|
-
</View>
|
|
33
|
+
value="text"
|
|
34
|
+
/>
|
|
43
35
|
<View
|
|
44
36
|
accessibilityState={
|
|
45
37
|
{
|
|
@@ -72,6 +64,9 @@ exports[`Visual test for the password input field shows a password input field w
|
|
|
72
64
|
onStartShouldSetResponder={[Function]}
|
|
73
65
|
style={
|
|
74
66
|
{
|
|
67
|
+
"alignItems": "center",
|
|
68
|
+
"height": "100%",
|
|
69
|
+
"justifyContent": "center",
|
|
75
70
|
"paddingBottom": 8,
|
|
76
71
|
"paddingLeft": 16,
|
|
77
72
|
"paddingRight": 16,
|
|
@@ -173,34 +168,26 @@ exports[`Visual test for the password input field shows a password input field w
|
|
|
173
168
|
}
|
|
174
169
|
}
|
|
175
170
|
>
|
|
176
|
-
<
|
|
171
|
+
<TextInput
|
|
172
|
+
keyboardType="default"
|
|
173
|
+
onChangeText={[Function]}
|
|
174
|
+
placeholder="password"
|
|
175
|
+
placeholderTextColor="#9AA5B1"
|
|
176
|
+
secureTextEntry={true}
|
|
177
177
|
style={
|
|
178
178
|
{
|
|
179
|
+
"color": "#1F2933",
|
|
179
180
|
"flex": 1,
|
|
181
|
+
"fontFamily": "SourceSansPro",
|
|
182
|
+
"fontSize": 16,
|
|
183
|
+
"height": "100%",
|
|
184
|
+
"justifyContent": "center",
|
|
185
|
+
"lineHeight": 20,
|
|
186
|
+
"paddingLeft": 16,
|
|
180
187
|
}
|
|
181
188
|
}
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
keyboardType="default"
|
|
185
|
-
onChangeText={[Function]}
|
|
186
|
-
placeholder="password"
|
|
187
|
-
placeholderTextColor="#9AA5B1"
|
|
188
|
-
secureTextEntry={true}
|
|
189
|
-
style={
|
|
190
|
-
{
|
|
191
|
-
"color": "#1F2933",
|
|
192
|
-
"fontFamily": "SourceSansPro",
|
|
193
|
-
"fontSize": 16,
|
|
194
|
-
"lineHeight": 20,
|
|
195
|
-
"paddingBottom": 0,
|
|
196
|
-
"paddingLeft": 16,
|
|
197
|
-
"paddingRight": 16,
|
|
198
|
-
"paddingTop": 0,
|
|
199
|
-
}
|
|
200
|
-
}
|
|
201
|
-
value="text"
|
|
202
|
-
/>
|
|
203
|
-
</View>
|
|
189
|
+
value="text"
|
|
190
|
+
/>
|
|
204
191
|
<View
|
|
205
192
|
accessibilityState={
|
|
206
193
|
{
|
|
@@ -233,6 +220,9 @@ exports[`Visual test for the password input field shows a password input field w
|
|
|
233
220
|
onStartShouldSetResponder={[Function]}
|
|
234
221
|
style={
|
|
235
222
|
{
|
|
223
|
+
"alignItems": "center",
|
|
224
|
+
"height": "100%",
|
|
225
|
+
"justifyContent": "center",
|
|
236
226
|
"paddingBottom": 8,
|
|
237
227
|
"paddingLeft": 16,
|
|
238
228
|
"paddingRight": 16,
|
|
@@ -334,34 +324,26 @@ exports[`Visual test for the password input field shows a password input field w
|
|
|
334
324
|
}
|
|
335
325
|
}
|
|
336
326
|
>
|
|
337
|
-
<
|
|
327
|
+
<TextInput
|
|
328
|
+
keyboardType="number-pad"
|
|
329
|
+
onChangeText={[Function]}
|
|
330
|
+
placeholder="number password"
|
|
331
|
+
placeholderTextColor="#9AA5B1"
|
|
332
|
+
secureTextEntry={true}
|
|
338
333
|
style={
|
|
339
334
|
{
|
|
335
|
+
"color": "#1F2933",
|
|
340
336
|
"flex": 1,
|
|
337
|
+
"fontFamily": "SourceSansPro",
|
|
338
|
+
"fontSize": 16,
|
|
339
|
+
"height": "100%",
|
|
340
|
+
"justifyContent": "center",
|
|
341
|
+
"lineHeight": 20,
|
|
342
|
+
"paddingLeft": 16,
|
|
341
343
|
}
|
|
342
344
|
}
|
|
343
|
-
|
|
344
|
-
|
|
345
|
-
keyboardType="number-pad"
|
|
346
|
-
onChangeText={[Function]}
|
|
347
|
-
placeholder="number password"
|
|
348
|
-
placeholderTextColor="#9AA5B1"
|
|
349
|
-
secureTextEntry={true}
|
|
350
|
-
style={
|
|
351
|
-
{
|
|
352
|
-
"color": "#1F2933",
|
|
353
|
-
"fontFamily": "SourceSansPro",
|
|
354
|
-
"fontSize": 16,
|
|
355
|
-
"lineHeight": 20,
|
|
356
|
-
"paddingBottom": 0,
|
|
357
|
-
"paddingLeft": 16,
|
|
358
|
-
"paddingRight": 16,
|
|
359
|
-
"paddingTop": 0,
|
|
360
|
-
}
|
|
361
|
-
}
|
|
362
|
-
value="text"
|
|
363
|
-
/>
|
|
364
|
-
</View>
|
|
345
|
+
value="text"
|
|
346
|
+
/>
|
|
365
347
|
<View
|
|
366
348
|
accessibilityState={
|
|
367
349
|
{
|
|
@@ -394,6 +376,9 @@ exports[`Visual test for the password input field shows a password input field w
|
|
|
394
376
|
onStartShouldSetResponder={[Function]}
|
|
395
377
|
style={
|
|
396
378
|
{
|
|
379
|
+
"alignItems": "center",
|
|
380
|
+
"height": "100%",
|
|
381
|
+
"justifyContent": "center",
|
|
397
382
|
"paddingBottom": 8,
|
|
398
383
|
"paddingLeft": 16,
|
|
399
384
|
"paddingRight": 16,
|
|
@@ -24,15 +24,13 @@ export const PasswordInput = ({keyboardType, ...props}: PasswordInputProps) => {
|
|
|
24
24
|
|
|
25
25
|
return (
|
|
26
26
|
<View style={styles.container}>
|
|
27
|
-
<
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
/>
|
|
35
|
-
</View>
|
|
27
|
+
<RNTextInput
|
|
28
|
+
style={styles.textInput}
|
|
29
|
+
placeholderTextColor={Context.colors.ui.grey}
|
|
30
|
+
secureTextEntry={secure}
|
|
31
|
+
keyboardType={keyboardType ? keyboardType : KeyBoardTypes.DEFAULT}
|
|
32
|
+
{...props}
|
|
33
|
+
/>
|
|
36
34
|
<Pressable
|
|
37
35
|
style={styles.iconContainer}
|
|
38
36
|
onPress={() => setSecure(!secure)}
|
|
@@ -1,25 +1,26 @@
|
|
|
1
1
|
export function Stylesheet(Context: any): {
|
|
2
2
|
container: {
|
|
3
3
|
width: string;
|
|
4
|
+
height: number;
|
|
4
5
|
flexDirection: 'row';
|
|
5
6
|
backgroundColor: any;
|
|
6
7
|
borderRadius: number;
|
|
7
8
|
alignItems: 'center';
|
|
8
9
|
};
|
|
9
|
-
textInputContainer: {
|
|
10
|
-
flex: number;
|
|
11
|
-
};
|
|
12
10
|
textInput: {
|
|
11
|
+
lineHeight: number;
|
|
13
12
|
color: any;
|
|
14
13
|
fontFamily: string;
|
|
15
14
|
fontSize: number;
|
|
16
|
-
|
|
15
|
+
flex: number;
|
|
16
|
+
height: string;
|
|
17
17
|
paddingLeft: number;
|
|
18
|
-
|
|
19
|
-
paddingRight: number;
|
|
20
|
-
paddingBottom: number;
|
|
18
|
+
justifyContent: 'center';
|
|
21
19
|
};
|
|
22
20
|
iconContainer: {
|
|
21
|
+
height: string;
|
|
22
|
+
alignItems: 'center';
|
|
23
|
+
justifyContent: 'center';
|
|
23
24
|
paddingLeft: number;
|
|
24
25
|
paddingTop: number;
|
|
25
26
|
paddingRight: number;
|
|
@@ -12,19 +12,19 @@ export const Stylesheet = (Context) =>
|
|
|
12
12
|
borderRadius: Scale.xs,
|
|
13
13
|
alignItems: 'center',
|
|
14
14
|
},
|
|
15
|
-
textInputContainer: {
|
|
16
|
-
flex: 1,
|
|
17
|
-
},
|
|
18
15
|
textInput: {
|
|
16
|
+
flex: 1,
|
|
17
|
+
height: '100%',
|
|
19
18
|
paddingLeft: Scale.m,
|
|
20
|
-
|
|
21
|
-
paddingBottom: 0,
|
|
22
|
-
paddingRight: Scale.m,
|
|
19
|
+
justifyContent: 'center',
|
|
23
20
|
...Font.medium,
|
|
24
21
|
lineHeight: 20,
|
|
25
22
|
color: Context.colors.ui.black,
|
|
26
23
|
},
|
|
27
24
|
iconContainer: {
|
|
25
|
+
height: '100%',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center',
|
|
28
28
|
paddingLeft: Scale.m,
|
|
29
29
|
paddingTop: Scale.xs,
|
|
30
30
|
paddingRight: Scale.m,
|
|
@@ -11,37 +11,33 @@ exports[`test search shows search field 1`] = `
|
|
|
11
11
|
"borderStyle": "solid",
|
|
12
12
|
"borderWidth": 1,
|
|
13
13
|
"flexDirection": "row",
|
|
14
|
+
"height": 44,
|
|
14
15
|
"overflow": "hidden",
|
|
15
|
-
"
|
|
16
|
-
"paddingLeft": 16,
|
|
17
|
-
"paddingRight": 16,
|
|
18
|
-
"paddingTop": 8,
|
|
16
|
+
"paddingRight": 4,
|
|
19
17
|
"width": "100%",
|
|
20
18
|
}
|
|
21
19
|
}
|
|
22
20
|
>
|
|
23
|
-
<
|
|
21
|
+
<TextInput
|
|
22
|
+
keyboardType="default"
|
|
23
|
+
onChangeText={[Function]}
|
|
24
|
+
placeholder="placeholder search field"
|
|
25
|
+
placeholderTextColor="#9AA5B1"
|
|
24
26
|
style={
|
|
25
27
|
{
|
|
28
|
+
"color": "#1F2933",
|
|
26
29
|
"flex": 1,
|
|
30
|
+
"fontFamily": "SourceSansPro",
|
|
31
|
+
"fontSize": 16,
|
|
32
|
+
"height": "100%",
|
|
33
|
+
"justifyContent": "center",
|
|
34
|
+
"lineHeight": 20,
|
|
35
|
+
"paddingBottom": 8,
|
|
36
|
+
"paddingLeft": 16,
|
|
37
|
+
"paddingTop": 8,
|
|
27
38
|
}
|
|
28
39
|
}
|
|
29
|
-
|
|
30
|
-
<TextInput
|
|
31
|
-
keyboardType="default"
|
|
32
|
-
onChangeText={[Function]}
|
|
33
|
-
placeholder="placeholder search field"
|
|
34
|
-
placeholderTextColor="#9AA5B1"
|
|
35
|
-
style={
|
|
36
|
-
{
|
|
37
|
-
"color": "#1F2933",
|
|
38
|
-
"fontFamily": "SourceSansPro",
|
|
39
|
-
"fontSize": 16,
|
|
40
|
-
"lineHeight": 20,
|
|
41
|
-
}
|
|
42
|
-
}
|
|
43
|
-
/>
|
|
44
|
-
</View>
|
|
40
|
+
/>
|
|
45
41
|
<View
|
|
46
42
|
accessibilityState={
|
|
47
43
|
{
|
|
@@ -74,17 +70,20 @@ exports[`test search shows search field 1`] = `
|
|
|
74
70
|
onStartShouldSetResponder={[Function]}
|
|
75
71
|
style={
|
|
76
72
|
{
|
|
77
|
-
"
|
|
73
|
+
"alignItems": "center",
|
|
74
|
+
"justifyContent": "center",
|
|
75
|
+
"minHeight": 42,
|
|
76
|
+
"minWidth": 42,
|
|
78
77
|
}
|
|
79
78
|
}
|
|
80
79
|
>
|
|
81
80
|
<RNSVGSvgView
|
|
82
81
|
align="xMidYMid"
|
|
83
|
-
bbHeight="
|
|
84
|
-
bbWidth="
|
|
82
|
+
bbHeight="18"
|
|
83
|
+
bbWidth="18"
|
|
85
84
|
fill="none"
|
|
86
85
|
focusable={false}
|
|
87
|
-
height={
|
|
86
|
+
height={18}
|
|
88
87
|
meetOrSlice={0}
|
|
89
88
|
minX={0}
|
|
90
89
|
minY={0}
|
|
@@ -96,14 +95,14 @@ exports[`test search shows search field 1`] = `
|
|
|
96
95
|
},
|
|
97
96
|
{
|
|
98
97
|
"flex": 0,
|
|
99
|
-
"height":
|
|
100
|
-
"width":
|
|
98
|
+
"height": 18,
|
|
99
|
+
"width": 18,
|
|
101
100
|
},
|
|
102
101
|
]
|
|
103
102
|
}
|
|
104
|
-
vbHeight={
|
|
105
|
-
vbWidth={
|
|
106
|
-
width={
|
|
103
|
+
vbHeight={17}
|
|
104
|
+
vbWidth={17}
|
|
105
|
+
width={18}
|
|
107
106
|
>
|
|
108
107
|
<RNSVGGroup
|
|
109
108
|
fill={null}
|
|
@@ -114,7 +113,7 @@ exports[`test search shows search field 1`] = `
|
|
|
114
113
|
}
|
|
115
114
|
>
|
|
116
115
|
<RNSVGPath
|
|
117
|
-
d="
|
|
116
|
+
d="M1.75 15.25L15.25 1.75M1.75 1.75L15.25 15.25"
|
|
118
117
|
propList={
|
|
119
118
|
[
|
|
120
119
|
"stroke",
|
|
@@ -1,16 +1,14 @@
|
|
|
1
|
+
import {TextInputProps} from 'react-native';
|
|
1
2
|
import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
onPressSearch: (text: string) => void;
|
|
8
|
-
};
|
|
3
|
+
interface SearchProps extends TextInputProps {
|
|
4
|
+
keyboardType?: KeyBoardTypes;
|
|
5
|
+
onPressClear: () => void;
|
|
6
|
+
showClearIcon: boolean;
|
|
7
|
+
}
|
|
9
8
|
declare const Search: ({
|
|
10
|
-
placeholder,
|
|
11
|
-
onchangeText,
|
|
12
|
-
value,
|
|
13
9
|
keyboardType,
|
|
14
|
-
|
|
10
|
+
onPressClear,
|
|
11
|
+
showClearIcon,
|
|
12
|
+
...props
|
|
15
13
|
}: SearchProps) => JSX.Element;
|
|
16
14
|
export {Search as Search};
|
|
@@ -5,54 +5,43 @@ import {
|
|
|
5
5
|
View,
|
|
6
6
|
TextInput as NativeTextInput,
|
|
7
7
|
Pressable,
|
|
8
|
-
|
|
8
|
+
TextInputProps,
|
|
9
9
|
} from 'react-native';
|
|
10
10
|
import {ThemeCtx} from '../../../context/theme.context';
|
|
11
11
|
import {Stylesheet} from './search.styles';
|
|
12
12
|
import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
|
|
13
13
|
import {Icon} from '../../../icons/index';
|
|
14
|
+
import {Scale} from '../../../theme/scale/index';
|
|
14
15
|
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
onPressSearch: (text: string) => void;
|
|
21
|
-
};
|
|
16
|
+
interface SearchProps extends TextInputProps {
|
|
17
|
+
keyboardType?: KeyBoardTypes;
|
|
18
|
+
onPressClear: () => void;
|
|
19
|
+
showClearIcon: boolean;
|
|
20
|
+
}
|
|
22
21
|
|
|
23
22
|
const Search = ({
|
|
24
|
-
placeholder,
|
|
25
|
-
onchangeText,
|
|
26
|
-
value,
|
|
27
23
|
keyboardType,
|
|
28
|
-
|
|
24
|
+
onPressClear,
|
|
25
|
+
showClearIcon,
|
|
26
|
+
...props
|
|
29
27
|
}: SearchProps) => {
|
|
30
28
|
const context = useContext(ThemeCtx);
|
|
31
29
|
const styles = Stylesheet(context);
|
|
32
30
|
|
|
33
31
|
return (
|
|
34
32
|
<View style={styles.container}>
|
|
35
|
-
<
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
value={value}
|
|
43
|
-
/>
|
|
44
|
-
</View>
|
|
45
|
-
<Pressable
|
|
46
|
-
onPress={() => {
|
|
47
|
-
onPressSearch(value);
|
|
48
|
-
Keyboard.dismiss();
|
|
49
|
-
}}
|
|
50
|
-
style={styles.iconContainer}
|
|
51
|
-
>
|
|
33
|
+
<NativeTextInput
|
|
34
|
+
placeholderTextColor={context.colors.ui.grey}
|
|
35
|
+
style={styles.inputContainer}
|
|
36
|
+
keyboardType={keyboardType}
|
|
37
|
+
{...props}
|
|
38
|
+
/>
|
|
39
|
+
<Pressable onPress={onPressClear} style={styles.iconContainer}>
|
|
52
40
|
<Icon
|
|
53
41
|
style={'regular'}
|
|
54
|
-
name={'search'}
|
|
42
|
+
name={!showClearIcon ? 'search' : 'xmark'}
|
|
55
43
|
color={context.colors.ui.black}
|
|
44
|
+
size={showClearIcon ? Scale.m * 1.125 : undefined}
|
|
56
45
|
/>
|
|
57
46
|
</Pressable>
|
|
58
47
|
</View>
|
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import React, {useState} from 'react';
|
|
2
2
|
import {Search} from './search.component';
|
|
3
3
|
import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
|
|
4
|
-
import {SafeAreaView} from 'react-native';
|
|
4
|
+
import {Keyboard, SafeAreaView} from 'react-native';
|
|
5
5
|
|
|
6
6
|
export const SearchPreview = ({} = {}) => {
|
|
7
7
|
const [input, setInput] = useState('');
|
|
8
8
|
|
|
9
|
-
const
|
|
10
|
-
|
|
9
|
+
const clearHandler = () => {
|
|
10
|
+
setInput('');
|
|
11
|
+
Keyboard.dismiss;
|
|
11
12
|
};
|
|
12
13
|
|
|
13
14
|
return (
|
|
14
|
-
<SafeAreaView>
|
|
15
|
+
<SafeAreaView style={{paddingHorizontal: 16}}>
|
|
15
16
|
<Search
|
|
16
17
|
placeholder={'Search field placeholder'}
|
|
17
|
-
|
|
18
|
+
onChangeText={(text: string) => setInput(text)}
|
|
18
19
|
value={input}
|
|
19
20
|
keyboardType={KeyBoardTypes.DEFAULT}
|
|
20
|
-
|
|
21
|
+
onPressClear={clearHandler}
|
|
22
|
+
showClearIcon={input.length > 0}
|
|
21
23
|
/>
|
|
22
24
|
</SafeAreaView>
|
|
23
25
|
);
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export function Stylesheet(context: any): {
|
|
2
2
|
container: {
|
|
3
3
|
width: string;
|
|
4
|
+
height: number;
|
|
4
5
|
flexDirection: 'row';
|
|
5
6
|
borderStyle: 'solid';
|
|
6
7
|
borderWidth: number;
|
|
@@ -9,24 +10,24 @@ export function Stylesheet(context: any): {
|
|
|
9
10
|
backgroundColor: any;
|
|
10
11
|
overflow: 'hidden';
|
|
11
12
|
alignItems: 'center';
|
|
13
|
+
paddingRight: number;
|
|
12
14
|
};
|
|
13
|
-
|
|
14
|
-
flex: number;
|
|
15
|
-
};
|
|
16
|
-
input: {
|
|
15
|
+
inputContainer: {
|
|
17
16
|
lineHeight: number;
|
|
18
17
|
color: any;
|
|
19
|
-
fontFamily: string;
|
|
20
|
-
fontSize: number;
|
|
21
18
|
paddingLeft: number;
|
|
22
19
|
paddingTop: number;
|
|
23
20
|
paddingBottom: number;
|
|
24
|
-
|
|
21
|
+
fontFamily: string;
|
|
22
|
+
fontSize: number;
|
|
23
|
+
flex: number;
|
|
24
|
+
justifyContent: 'center';
|
|
25
|
+
height: string;
|
|
25
26
|
};
|
|
26
27
|
iconContainer: {
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
28
|
+
minWidth: number;
|
|
29
|
+
minHeight: number;
|
|
30
|
+
justifyContent: 'center';
|
|
31
|
+
alignItems: 'center';
|
|
31
32
|
};
|
|
32
33
|
};
|
|
@@ -8,6 +8,7 @@ export const Stylesheet = (context) =>
|
|
|
8
8
|
StyleSheet.create({
|
|
9
9
|
container: {
|
|
10
10
|
width: '100%',
|
|
11
|
+
height: Scale.m * 2.75,
|
|
11
12
|
flexDirection: 'row',
|
|
12
13
|
borderStyle: 'solid',
|
|
13
14
|
borderWidth: 1,
|
|
@@ -16,20 +17,25 @@ export const Stylesheet = (context) =>
|
|
|
16
17
|
backgroundColor: context.colors.ui.white,
|
|
17
18
|
overflow: 'hidden',
|
|
18
19
|
alignItems: 'center',
|
|
19
|
-
|
|
20
|
-
paddingTop: Scale.xs,
|
|
21
|
-
paddingRight: Scale.m,
|
|
22
|
-
paddingBottom: Scale.xs,
|
|
20
|
+
paddingRight: Scale.xxs,
|
|
23
21
|
},
|
|
24
|
-
|
|
22
|
+
inputContainer: {
|
|
25
23
|
flex: 1,
|
|
26
|
-
|
|
27
|
-
|
|
24
|
+
justifyContent: 'center',
|
|
25
|
+
height: '100%',
|
|
28
26
|
...Font.medium,
|
|
29
27
|
lineHeight: 20,
|
|
30
28
|
color: context.colors.ui.black,
|
|
29
|
+
paddingLeft: Scale.m,
|
|
30
|
+
paddingTop: Scale.xs,
|
|
31
|
+
paddingBottom: Scale.xs,
|
|
31
32
|
},
|
|
32
33
|
iconContainer: {
|
|
33
|
-
|
|
34
|
+
minWidth: 42,
|
|
35
|
+
minHeight: 42,
|
|
36
|
+
justifyContent: 'center',
|
|
37
|
+
alignItems: 'center',
|
|
38
|
+
// position: 'absolute',
|
|
39
|
+
// right: Scale.xs,
|
|
34
40
|
},
|
|
35
41
|
});
|
|
@@ -10,7 +10,9 @@ describe('test search', () => {
|
|
|
10
10
|
<Search
|
|
11
11
|
keyboardType={KeyBoardTypes.DEFAULT}
|
|
12
12
|
placeholder="placeholder search field"
|
|
13
|
-
|
|
13
|
+
onChangeText={() => console.log('text is changed')}
|
|
14
|
+
onPressClear={() => console.log('clear input')}
|
|
15
|
+
showClearIcon={true}
|
|
14
16
|
/>
|
|
15
17
|
)
|
|
16
18
|
.toJSON();
|