@tactics/toddle-styleguide 0.1.9 → 0.1.10

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.
Files changed (23) hide show
  1. package/index.d.ts +3 -1
  2. package/index.tsx +4 -0
  3. package/package.json +1 -1
  4. package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +30 -6
  5. package/src/components/atoms/filter-tab/__snapshots__/filter-tab.test.js.snap +11 -11
  6. package/src/components/atoms/filter-tab/filter-tab.styles.js +3 -3
  7. package/src/components/atoms/message-input/__snapshots__/message-input.test.js.snap +16 -12
  8. package/src/components/atoms/message-input/message-input.component.tsx +2 -0
  9. package/src/components/atoms/message-input/message-input.styles.js +3 -3
  10. package/src/components/atoms/password-input/__snapshots__/password-input.test.js.snap +9 -3
  11. package/src/components/atoms/password-input/password-input.component.tsx +1 -0
  12. package/src/components/atoms/password-input/password-input.styles.js +2 -1
  13. package/src/components/atoms/search/__snapshots__/search.test.js.snap +87 -53
  14. package/src/components/atoms/search/search.component.tsx +13 -8
  15. package/src/components/atoms/search/search.styles.d.ts +20 -9
  16. package/src/components/atoms/search/search.styles.js +20 -8
  17. package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +125 -30
  18. package/src/components/atoms/text-input/text-input.component.d.ts +2 -1
  19. package/src/components/atoms/text-input/text-input.component.tsx +4 -1
  20. package/src/components/atoms/text-input/text-input.preview.tsx +12 -1
  21. package/src/components/atoms/text-input/text-input.styles.d.ts +49 -21
  22. package/src/components/atoms/text-input/text-input.styles.js +24 -15
  23. package/src/components/atoms/text-input/text-input.test.js +28 -1
package/index.d.ts CHANGED
@@ -39,6 +39,8 @@ import { DateInput } from './src/components/atoms/date-input/date-input.componen
39
39
  import { FilterRange } from './src/components/atoms/filter-range/filter-range.component';
40
40
  import { Footer } from './src/components/atoms/footer/footer.component';
41
41
  import { DefaultSelect } from './src/components/atoms/default-select/default-select.component';
42
+ import { PasswordInput } from './src/components/atoms/password-input/password-input.component';
43
+ import { MessageInput } from './src/components/atoms/message-input/message-input.component';
42
44
  import { BubbleAlignment } from './src/types/bubble-alignment.enum';
43
45
  import { KeyBoardTypes } from './src/types/keyboard-types.enum';
44
46
  import { Size } from './src/types/size.enum';
@@ -46,4 +48,4 @@ import { VisualState } from './src/types/visual-state.enum';
46
48
  import { Initials } from './src/models/initials.model';
47
49
  import { ThemeCtx } from './src/context/theme.context';
48
50
  import { Scale } from './src/theme/scale/index';
49
- export { Initials, BubbleAlignment, KeyBoardTypes, Size, Scale, VisualState, ThemeCtx, Avatar, Button, CancelLink, Check, Checkbox, ChildListItem, ContactItem, FilterTab, SplitContainer, ImageBubble, Info, Pill, Popover, PressableIcon, QuickFilter, Search, SelectListItem, Snackbar, Tag, TextBubble, TextInput, TimeTracker, WideButton, Icon, Calendar, IncrementInput, Swipe, Logo, DaySelect, BlockedMessage, DepartmentLogo, ContactRole, Timeline, SelectPicker, CalendarSelect, DateInput, FilterRange, Footer, DefaultSelect, };
51
+ export { Initials, BubbleAlignment, KeyBoardTypes, Size, Scale, VisualState, ThemeCtx, Avatar, Button, CancelLink, Check, Checkbox, ChildListItem, ContactItem, FilterTab, SplitContainer, ImageBubble, Info, Pill, Popover, PressableIcon, QuickFilter, Search, SelectListItem, Snackbar, Tag, TextBubble, TextInput, TimeTracker, WideButton, Icon, Calendar, IncrementInput, Swipe, Logo, DaySelect, BlockedMessage, DepartmentLogo, ContactRole, Timeline, SelectPicker, CalendarSelect, DateInput, FilterRange, Footer, DefaultSelect, PasswordInput, MessageInput, };
package/index.tsx CHANGED
@@ -47,6 +47,8 @@ import {DateInput} from './src/components/atoms/date-input/date-input.component'
47
47
  import {FilterRange} from './src/components/atoms/filter-range/filter-range.component';
48
48
  import {Footer} from './src/components/atoms/footer/footer.component';
49
49
  import {DefaultSelect} from './src/components/atoms/default-select/default-select.component';
50
+ import {PasswordInput} from './src/components/atoms/password-input/password-input.component';
51
+ import {MessageInput} from './src/components/atoms/message-input/message-input.component';
50
52
 
51
53
  // Exports of enums
52
54
  import {BubbleAlignment} from './src/types/bubble-alignment.enum';
@@ -110,4 +112,6 @@ export {
110
112
  FilterRange,
111
113
  Footer,
112
114
  DefaultSelect,
115
+ PasswordInput,
116
+ MessageInput,
113
117
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@tactics/toddle-styleguide",
3
- "version": "0.1.9",
3
+ "version": "0.1.10",
4
4
  "main": "index.tsx",
5
5
  "types": "index.d.ts",
6
6
  "prepublish": "tsc",
@@ -2418,7 +2418,7 @@ exports[`Test for the calendar component renders a calendar where you can select
2418
2418
  }
2419
2419
  >
2420
2420
  <View
2421
- accessibilityLabel=" Maandag 23 Januari 2023 "
2421
+ accessibilityLabel="today Maandag 23 Januari 2023 "
2422
2422
  accessibilityRole="button"
2423
2423
  accessibilityState={
2424
2424
  {
@@ -2438,6 +2438,10 @@ exports[`Test for the calendar component renders a calendar where you can select
2438
2438
  style={
2439
2439
  {
2440
2440
  "alignItems": "center",
2441
+ "borderColor": "#7B93DB",
2442
+ "borderRadius": 21,
2443
+ "borderStyle": "solid",
2444
+ "borderWidth": 1,
2441
2445
  "height": 42,
2442
2446
  "justifyContent": "center",
2443
2447
  "opacity": 1,
@@ -2457,6 +2461,9 @@ exports[`Test for the calendar component renders a calendar where you can select
2457
2461
  "lineHeight": 22.4,
2458
2462
  "marginTop": 4,
2459
2463
  },
2464
+ {
2465
+ "color": "#7B93DB",
2466
+ },
2460
2467
  ]
2461
2468
  }
2462
2469
  >
@@ -2487,7 +2494,7 @@ exports[`Test for the calendar component renders a calendar where you can select
2487
2494
  }
2488
2495
  >
2489
2496
  <View
2490
- accessibilityLabel=" Dinsdag 24 Januari 2023 "
2497
+ accessibilityLabel="today Dinsdag 24 Januari 2023 "
2491
2498
  accessibilityRole="button"
2492
2499
  accessibilityState={
2493
2500
  {
@@ -2507,6 +2514,10 @@ exports[`Test for the calendar component renders a calendar where you can select
2507
2514
  style={
2508
2515
  {
2509
2516
  "alignItems": "center",
2517
+ "borderColor": "#7B93DB",
2518
+ "borderRadius": 21,
2519
+ "borderStyle": "solid",
2520
+ "borderWidth": 1,
2510
2521
  "height": 42,
2511
2522
  "justifyContent": "center",
2512
2523
  "opacity": 1,
@@ -2526,6 +2537,9 @@ exports[`Test for the calendar component renders a calendar where you can select
2526
2537
  "lineHeight": 22.4,
2527
2538
  "marginTop": 4,
2528
2539
  },
2540
+ {
2541
+ "color": "#7B93DB",
2542
+ },
2529
2543
  ]
2530
2544
  }
2531
2545
  >
@@ -5870,7 +5884,8 @@ exports[`Test for the calendar component renders a calendar where you can select
5870
5884
  }
5871
5885
  >
5872
5886
  <View
5873
- accessibilityLabel=" Maandag 23 Januari 2023 "
5887
+ accessibilityLabel="today Maandag 23 Januari 2023 "
5888
+ accessibilityRole="button"
5874
5889
  accessibilityState={
5875
5890
  {
5876
5891
  "disabled": false,
@@ -5889,6 +5904,10 @@ exports[`Test for the calendar component renders a calendar where you can select
5889
5904
  style={
5890
5905
  {
5891
5906
  "alignItems": "center",
5907
+ "borderColor": "#7B93DB",
5908
+ "borderRadius": 21,
5909
+ "borderStyle": "solid",
5910
+ "borderWidth": 1,
5892
5911
  "height": 42,
5893
5912
  "justifyContent": "center",
5894
5913
  "opacity": 1,
@@ -5909,7 +5928,7 @@ exports[`Test for the calendar component renders a calendar where you can select
5909
5928
  "marginTop": 4,
5910
5929
  },
5911
5930
  {
5912
- "color": "#9AA5B1",
5931
+ "color": "#7B93DB",
5913
5932
  },
5914
5933
  ]
5915
5934
  }
@@ -5941,7 +5960,8 @@ exports[`Test for the calendar component renders a calendar where you can select
5941
5960
  }
5942
5961
  >
5943
5962
  <View
5944
- accessibilityLabel=" Dinsdag 24 Januari 2023 "
5963
+ accessibilityLabel="today Dinsdag 24 Januari 2023 "
5964
+ accessibilityRole="button"
5945
5965
  accessibilityState={
5946
5966
  {
5947
5967
  "disabled": false,
@@ -5960,6 +5980,10 @@ exports[`Test for the calendar component renders a calendar where you can select
5960
5980
  style={
5961
5981
  {
5962
5982
  "alignItems": "center",
5983
+ "borderColor": "#7B93DB",
5984
+ "borderRadius": 21,
5985
+ "borderStyle": "solid",
5986
+ "borderWidth": 1,
5963
5987
  "height": 42,
5964
5988
  "justifyContent": "center",
5965
5989
  "opacity": 1,
@@ -5980,7 +6004,7 @@ exports[`Test for the calendar component renders a calendar where you can select
5980
6004
  "marginTop": 4,
5981
6005
  },
5982
6006
  {
5983
- "color": "#9AA5B1",
6007
+ "color": "#7B93DB",
5984
6008
  },
5985
6009
  ]
5986
6010
  }
@@ -8,8 +8,8 @@ exports[`Filter tab test renders a filter tab with 2 tabs 1`] = `
8
8
  "borderRadius": 16,
9
9
  "display": "flex",
10
10
  "paddingBottom": 4,
11
- "paddingLeft": 4,
12
- "paddingRight": 4,
11
+ "paddingLeft": 8,
12
+ "paddingRight": 8,
13
13
  "paddingTop": 4,
14
14
  "width": "100%",
15
15
  }
@@ -65,7 +65,7 @@ exports[`Filter tab test renders a filter tab with 2 tabs 1`] = `
65
65
  style={
66
66
  [
67
67
  {
68
- "color": "#1F2933",
68
+ "color": "#19216C",
69
69
  "fontFamily": "SourceSansPro",
70
70
  "fontSize": 16,
71
71
  "lineHeight": 22.4,
@@ -115,7 +115,7 @@ exports[`Filter tab test renders a filter tab with 2 tabs 1`] = `
115
115
  style={
116
116
  [
117
117
  {
118
- "color": "#1F2933",
118
+ "color": "#19216C",
119
119
  "fontFamily": "SourceSansPro",
120
120
  "fontSize": 16,
121
121
  "lineHeight": 22.4,
@@ -161,7 +161,7 @@ exports[`Filter tab test renders a filter tab with 2 tabs 1`] = `
161
161
  style={
162
162
  [
163
163
  {
164
- "color": "#1F2933",
164
+ "color": "#19216C",
165
165
  "fontFamily": "SourceSansPro",
166
166
  "fontSize": 16,
167
167
  "lineHeight": 22.4,
@@ -194,8 +194,8 @@ exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
194
194
  "borderRadius": 16,
195
195
  "display": "flex",
196
196
  "paddingBottom": 4,
197
- "paddingLeft": 4,
198
- "paddingRight": 4,
197
+ "paddingLeft": 8,
198
+ "paddingRight": 8,
199
199
  "paddingTop": 4,
200
200
  "width": "100%",
201
201
  }
@@ -251,7 +251,7 @@ exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
251
251
  style={
252
252
  [
253
253
  {
254
- "color": "#1F2933",
254
+ "color": "#19216C",
255
255
  "fontFamily": "SourceSansPro",
256
256
  "fontSize": 16,
257
257
  "lineHeight": 22.4,
@@ -301,7 +301,7 @@ exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
301
301
  style={
302
302
  [
303
303
  {
304
- "color": "#1F2933",
304
+ "color": "#19216C",
305
305
  "fontFamily": "SourceSansPro",
306
306
  "fontSize": 16,
307
307
  "lineHeight": 22.4,
@@ -349,7 +349,7 @@ exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
349
349
  style={
350
350
  [
351
351
  {
352
- "color": "#1F2933",
352
+ "color": "#19216C",
353
353
  "fontFamily": "SourceSansPro",
354
354
  "fontSize": 16,
355
355
  "lineHeight": 22.4,
@@ -395,7 +395,7 @@ exports[`Filter tab test renders a filter tab with 3 tabs 1`] = `
395
395
  style={
396
396
  [
397
397
  {
398
- "color": "#1F2933",
398
+ "color": "#19216C",
399
399
  "fontFamily": "SourceSansPro",
400
400
  "fontSize": 16,
401
401
  "lineHeight": 22.4,
@@ -7,8 +7,8 @@ export const Stylesheet = (Context, inRow, ElementWidth, ItemWidth) =>
7
7
  container: {
8
8
  width: '100%',
9
9
  display: 'flex',
10
- paddingRight: Scale.xxs,
11
- paddingLeft: Scale.xxs,
10
+ paddingRight: Scale.xs,
11
+ paddingLeft: Scale.xs,
12
12
  paddingTop: Scale.xxs,
13
13
  paddingBottom: Scale.xxs,
14
14
  borderRadius: inRow ? 50 : Scale.m,
@@ -55,7 +55,7 @@ export const Stylesheet = (Context, inRow, ElementWidth, ItemWidth) =>
55
55
  ...Font.medium,
56
56
  width: '100%',
57
57
  textAlign: 'center',
58
- color: Context.colors.ui.black,
58
+ color: Context.colors.main['0'],
59
59
  maxHeight: 32,
60
60
  overflow: 'hidden',
61
61
  whiteSpace: 'nowrap',
@@ -11,10 +11,10 @@ exports[`Message Input test render a message text input component with placehold
11
11
  "borderStyle": "solid",
12
12
  "borderWidth": 1,
13
13
  "flexDirection": "row",
14
- "paddingBottom": 8,
14
+ "paddingBottom": 7,
15
15
  "paddingLeft": 16,
16
16
  "paddingRight": 16,
17
- "paddingTop": 8,
17
+ "paddingTop": 7,
18
18
  "width": "100%",
19
19
  }
20
20
  }
@@ -91,9 +91,10 @@ exports[`Message Input test render a message text input component with placehold
91
91
  multiline={true}
92
92
  onChangeText={[Function]}
93
93
  placeholder="Placeholder"
94
+ placeholderTextColor="#9AA5B1"
94
95
  style={
95
96
  {
96
- "color": "#9AA5B1",
97
+ "color": "#1F2933",
97
98
  "flex": 1,
98
99
  "fontFamily": "SourceSansPro",
99
100
  "fontSize": 16,
@@ -186,10 +187,10 @@ exports[`Message Input test render a message text input component with placehold
186
187
  "borderStyle": "solid",
187
188
  "borderWidth": 1,
188
189
  "flexDirection": "row",
189
- "paddingBottom": 8,
190
+ "paddingBottom": 7,
190
191
  "paddingLeft": 16,
191
192
  "paddingRight": 16,
192
- "paddingTop": 8,
193
+ "paddingTop": 7,
193
194
  "width": "100%",
194
195
  }
195
196
  }
@@ -266,9 +267,10 @@ exports[`Message Input test render a message text input component with placehold
266
267
  multiline={true}
267
268
  onChangeText={[Function]}
268
269
  placeholder="Placeholder"
270
+ placeholderTextColor="#9AA5B1"
269
271
  style={
270
272
  {
271
- "color": "#9AA5B1",
273
+ "color": "#1F2933",
272
274
  "flex": 1,
273
275
  "fontFamily": "SourceSansPro",
274
276
  "fontSize": 16,
@@ -361,10 +363,10 @@ exports[`Message Input test render a message text input component without placeh
361
363
  "borderStyle": "solid",
362
364
  "borderWidth": 1,
363
365
  "flexDirection": "row",
364
- "paddingBottom": 8,
366
+ "paddingBottom": 7,
365
367
  "paddingLeft": 16,
366
368
  "paddingRight": 16,
367
- "paddingTop": 8,
369
+ "paddingTop": 7,
368
370
  "width": "100%",
369
371
  }
370
372
  }
@@ -440,9 +442,10 @@ exports[`Message Input test render a message text input component without placeh
440
442
  keyboardType="default"
441
443
  multiline={true}
442
444
  onChangeText={[Function]}
445
+ placeholderTextColor="#9AA5B1"
443
446
  style={
444
447
  {
445
- "color": "#9AA5B1",
448
+ "color": "#1F2933",
446
449
  "flex": 1,
447
450
  "fontFamily": "SourceSansPro",
448
451
  "fontSize": 16,
@@ -535,10 +538,10 @@ exports[`Message Input test render a message text input component without placeh
535
538
  "borderStyle": "solid",
536
539
  "borderWidth": 1,
537
540
  "flexDirection": "row",
538
- "paddingBottom": 8,
541
+ "paddingBottom": 7,
539
542
  "paddingLeft": 16,
540
543
  "paddingRight": 16,
541
- "paddingTop": 8,
544
+ "paddingTop": 7,
542
545
  "width": "100%",
543
546
  }
544
547
  }
@@ -614,9 +617,10 @@ exports[`Message Input test render a message text input component without placeh
614
617
  keyboardType="email-address"
615
618
  multiline={true}
616
619
  onChangeText={[Function]}
620
+ placeholderTextColor="#9AA5B1"
617
621
  style={
618
622
  {
619
- "color": "#9AA5B1",
623
+ "color": "#1F2933",
620
624
  "flex": 1,
621
625
  "fontFamily": "SourceSansPro",
622
626
  "fontSize": 16,
@@ -23,6 +23,7 @@ const MessageInput = ({
23
23
  }: MessageInputProps) => {
24
24
  const Context = useContext(ThemeCtx);
25
25
  const styles = Stylesheet(Context);
26
+
26
27
  return (
27
28
  <View style={styles.rootContainer}>
28
29
  <Pressable onPress={() => console.log('pressed add attachment')}>
@@ -32,6 +33,7 @@ const MessageInput = ({
32
33
  style={styles.textInput}
33
34
  multiline={true}
34
35
  placeholder={placeholder}
36
+ placeholderTextColor={Context.colors.ui.grey}
35
37
  onChangeText={onChangeText}
36
38
  value={value}
37
39
  keyboardType={keyboardType ? keyboardType : KeyBoardTypes.DEFAULT}
@@ -14,15 +14,15 @@ export const Stylesheet = (context) =>
14
14
  borderColor: context.colors.ui.lightgrey,
15
15
  borderRadius: Scale.xs,
16
16
  paddingLeft: Scale.m,
17
- paddingTop: Scale.xs,
17
+ paddingTop: Scale.xs - 1,
18
18
  paddingRight: Scale.m,
19
- paddingBottom: Scale.xs,
19
+ paddingBottom: Scale.xs - 1,
20
20
  },
21
21
  textInput: {
22
22
  maxHeight: 100,
23
23
  flex: 1,
24
24
  ...Font.medium,
25
- color: context.colors.ui.grey,
25
+ color: context.colors.ui.black,
26
26
  marginLeft: Scale.m,
27
27
  marginRight: Scale.m,
28
28
  },
@@ -8,6 +8,7 @@ exports[`Visual test for the password input field shows a password input field w
8
8
  "backgroundColor": "#FFFFFF",
9
9
  "borderRadius": 8,
10
10
  "flexDirection": "row",
11
+ "height": 44,
11
12
  "width": "100%",
12
13
  }
13
14
  }
@@ -22,10 +23,11 @@ exports[`Visual test for the password input field shows a password input field w
22
23
  <TextInput
23
24
  keyboardType="default"
24
25
  onChangeText={[Function]}
26
+ placeholderTextColor="#9AA5B1"
25
27
  secureTextEntry={true}
26
28
  style={
27
29
  {
28
- "color": "#9AA5B1",
30
+ "color": "#1F2933",
29
31
  "fontFamily": "SourceSansPro",
30
32
  "fontSize": 16,
31
33
  "lineHeight": 20,
@@ -139,6 +141,7 @@ exports[`Visual test for the password input field shows a password input field w
139
141
  "backgroundColor": "#FFFFFF",
140
142
  "borderRadius": 8,
141
143
  "flexDirection": "row",
144
+ "height": 44,
142
145
  "width": "100%",
143
146
  }
144
147
  }
@@ -154,10 +157,11 @@ exports[`Visual test for the password input field shows a password input field w
154
157
  keyboardType="default"
155
158
  onChangeText={[Function]}
156
159
  placeholder="password"
160
+ placeholderTextColor="#9AA5B1"
157
161
  secureTextEntry={true}
158
162
  style={
159
163
  {
160
- "color": "#9AA5B1",
164
+ "color": "#1F2933",
161
165
  "fontFamily": "SourceSansPro",
162
166
  "fontSize": 16,
163
167
  "lineHeight": 20,
@@ -271,6 +275,7 @@ exports[`Visual test for the password input field shows a password input field w
271
275
  "backgroundColor": "#FFFFFF",
272
276
  "borderRadius": 8,
273
277
  "flexDirection": "row",
278
+ "height": 44,
274
279
  "width": "100%",
275
280
  }
276
281
  }
@@ -286,10 +291,11 @@ exports[`Visual test for the password input field shows a password input field w
286
291
  keyboardType="number-pad"
287
292
  onChangeText={[Function]}
288
293
  placeholder="number password"
294
+ placeholderTextColor="#9AA5B1"
289
295
  secureTextEntry={true}
290
296
  style={
291
297
  {
292
- "color": "#9AA5B1",
298
+ "color": "#1F2933",
293
299
  "fontFamily": "SourceSansPro",
294
300
  "fontSize": 16,
295
301
  "lineHeight": 20,
@@ -30,6 +30,7 @@ export const PasswordInput = ({
30
30
  <RNTextInput
31
31
  style={styles.textInput}
32
32
  placeholder={placeholder}
33
+ placeholderTextColor={Context.colors.ui.grey}
33
34
  secureTextEntry={secure}
34
35
  value={value}
35
36
  onChangeText={onChangeText}
@@ -6,6 +6,7 @@ export const Stylesheet = (Context) =>
6
6
  StyleSheet.create({
7
7
  container: {
8
8
  width: '100%',
9
+ height: 44,
9
10
  flexDirection: 'row',
10
11
  backgroundColor: Context.colors.ui.white,
11
12
  borderRadius: Scale.xs,
@@ -21,7 +22,7 @@ export const Stylesheet = (Context) =>
21
22
  paddingRight: Scale.m,
22
23
  ...Font.medium,
23
24
  lineHeight: 20,
24
- color: Context.colors.ui.grey,
25
+ color: Context.colors.ui.black,
25
26
  },
26
27
  iconContainer: {
27
28
  paddingLeft: Scale.m,
@@ -4,6 +4,7 @@ exports[`test search shows search field 1`] = `
4
4
  <View
5
5
  style={
6
6
  {
7
+ "alignItems": "center",
7
8
  "backgroundColor": "#FFFFFF",
8
9
  "borderColor": "#E5E8EB",
9
10
  "borderRadius": 8,
@@ -11,77 +12,110 @@ exports[`test search shows search field 1`] = `
11
12
  "borderWidth": 1,
12
13
  "flexDirection": "row",
13
14
  "overflow": "hidden",
14
- "paddingBottom": 8,
15
- "paddingLeft": 16,
16
- "paddingRight": 16,
17
- "paddingTop": 8,
15
+ "width": "100%",
18
16
  }
19
17
  }
20
18
  >
21
- <TextInput
22
- keyboardType="default"
23
- onChangeText={[Function]}
24
- placeholder="placeholder search field"
19
+ <View
25
20
  style={
26
21
  {
27
22
  "flex": 1,
28
- "fontFamily": "SourceSansPro",
29
- "fontSize": 16,
30
- "lineHeight": 22.4,
31
23
  }
32
24
  }
33
- />
34
- <RNSVGSvgView
35
- align="xMidYMid"
36
- bbHeight="28"
37
- bbWidth="28"
38
- fill="none"
39
- focusable={false}
40
- height="28"
41
- meetOrSlice={0}
42
- minX={0}
43
- minY={0}
44
- style={
45
- [
46
- {
47
- "backgroundColor": "transparent",
48
- "borderWidth": 0,
49
- },
25
+ >
26
+ <TextInput
27
+ keyboardType="default"
28
+ onChangeText={[Function]}
29
+ placeholder="placeholder search field"
30
+ placeholderTextColor="#9AA5B1"
31
+ style={
50
32
  {
51
- "flex": 0,
52
- "height": 28,
53
- "width": 28,
54
- },
55
- ]
33
+ "color": "#1F2933",
34
+ "fontFamily": "SourceSansPro",
35
+ "fontSize": 16,
36
+ "lineHeight": 20,
37
+ "paddingBottom": 0,
38
+ "paddingLeft": 16,
39
+ "paddingRight": 16,
40
+ "paddingTop": 0,
41
+ }
42
+ }
43
+ />
44
+ </View>
45
+ <View
46
+ accessible={true}
47
+ collapsable={false}
48
+ focusable={true}
49
+ onBlur={[Function]}
50
+ onClick={[Function]}
51
+ onFocus={[Function]}
52
+ onResponderGrant={[Function]}
53
+ onResponderMove={[Function]}
54
+ onResponderRelease={[Function]}
55
+ onResponderTerminate={[Function]}
56
+ onResponderTerminationRequest={[Function]}
57
+ onStartShouldSetResponder={[Function]}
58
+ style={
59
+ {
60
+ "paddingBottom": 7,
61
+ "paddingLeft": 16,
62
+ "paddingRight": 16,
63
+ "paddingTop": 7,
64
+ }
56
65
  }
57
- vbHeight={27}
58
- vbWidth={27}
59
- width="28"
60
66
  >
61
- <RNSVGGroup
62
- fill={null}
63
- propList={
67
+ <RNSVGSvgView
68
+ align="xMidYMid"
69
+ bbHeight="28"
70
+ bbWidth="28"
71
+ fill="none"
72
+ focusable={false}
73
+ height="28"
74
+ meetOrSlice={0}
75
+ minX={0}
76
+ minY={0}
77
+ style={
64
78
  [
65
- "fill",
79
+ {
80
+ "backgroundColor": "transparent",
81
+ "borderWidth": 0,
82
+ },
83
+ {
84
+ "flex": 0,
85
+ "height": 28,
86
+ "width": 28,
87
+ },
66
88
  ]
67
89
  }
90
+ vbHeight={27}
91
+ vbWidth={27}
92
+ width="28"
68
93
  >
69
- <RNSVGPath
70
- d="M23.625 23.625L16.875 16.875M19.125 11.25C19.125 15.5992 15.5992 19.125 11.25 19.125C6.90076 19.125 3.375 15.5992 3.375 11.25C3.375 6.90076 6.90076 3.375 11.25 3.375C15.5992 3.375 19.125 6.90076 19.125 11.25Z"
94
+ <RNSVGGroup
95
+ fill={null}
71
96
  propList={
72
97
  [
73
- "stroke",
74
- "strokeWidth",
75
- "strokeLinecap",
76
- "strokeLinejoin",
98
+ "fill",
77
99
  ]
78
100
  }
79
- stroke={4279837036}
80
- strokeLinecap={1}
81
- strokeLinejoin={1}
82
- strokeWidth="2"
83
- />
84
- </RNSVGGroup>
85
- </RNSVGSvgView>
101
+ >
102
+ <RNSVGPath
103
+ d="M23.625 23.625L16.875 16.875M19.125 11.25C19.125 15.5992 15.5992 19.125 11.25 19.125C6.90076 19.125 3.375 15.5992 3.375 11.25C3.375 6.90076 6.90076 3.375 11.25 3.375C15.5992 3.375 19.125 6.90076 19.125 11.25Z"
104
+ propList={
105
+ [
106
+ "stroke",
107
+ "strokeWidth",
108
+ "strokeLinecap",
109
+ "strokeLinejoin",
110
+ ]
111
+ }
112
+ stroke={4279837036}
113
+ strokeLinecap={1}
114
+ strokeLinejoin={1}
115
+ strokeWidth="2"
116
+ />
117
+ </RNSVGGroup>
118
+ </RNSVGSvgView>
119
+ </View>
86
120
  </View>
87
121
  `;
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
2
  import {useContext} from 'react';
3
3
 
4
- import {View, TextInput as NativeTextInput} from 'react-native';
4
+ import {View, TextInput as NativeTextInput, Pressable} from 'react-native';
5
5
  import {ThemeCtx} from '../../../context/theme.context';
6
6
  import {Stylesheet} from './search.styles';
7
7
  import {KeyBoardTypes} from '../../../types/keyboard-types.enum';
@@ -19,13 +19,18 @@ const Search = ({placeholder, onchangeText, keyboardType}: SearchProps) => {
19
19
 
20
20
  return (
21
21
  <View style={styles.container}>
22
- <NativeTextInput
23
- placeholder={placeholder}
24
- style={styles.input}
25
- onChangeText={onchangeText}
26
- keyboardType={keyboardType}
27
- />
28
- <SearchIcon />
22
+ <View style={styles.textInputContainer}>
23
+ <NativeTextInput
24
+ placeholder={placeholder}
25
+ placeholderTextColor={context.colors.ui.grey}
26
+ style={styles.input}
27
+ onChangeText={onchangeText}
28
+ keyboardType={keyboardType}
29
+ />
30
+ </View>
31
+ <Pressable style={styles.iconContainer}>
32
+ <SearchIcon />
33
+ </Pressable>
29
34
  </View>
30
35
  );
31
36
  };
@@ -1,21 +1,32 @@
1
1
  export function Stylesheet(context: any): {
2
2
  container: {
3
+ width: string;
3
4
  flexDirection: 'row';
4
- borderColor: any;
5
- borderWidth: number;
6
5
  borderStyle: 'solid';
7
- backgroundColor: any;
6
+ borderWidth: number;
7
+ borderColor: any;
8
8
  borderRadius: number;
9
+ backgroundColor: any;
9
10
  overflow: 'hidden';
10
- paddingTop: number;
11
- paddingBottom: number;
12
- paddingLeft: number;
13
- paddingRight: number;
11
+ alignItems: 'center';
12
+ };
13
+ textInputContainer: {
14
+ flex: number;
14
15
  };
15
16
  input: {
17
+ lineHeight: number;
18
+ color: any;
16
19
  fontFamily: string;
17
20
  fontSize: number;
18
- lineHeight: number;
19
- flex: number;
21
+ paddingLeft: number;
22
+ paddingTop: number;
23
+ paddingBottom: number;
24
+ paddingRight: number;
25
+ };
26
+ iconContainer: {
27
+ paddingLeft: number;
28
+ paddingTop: number;
29
+ paddingRight: number;
30
+ paddingBottom: number;
20
31
  };
21
32
  };
@@ -7,20 +7,32 @@ import {Font} from '../../../theme/font';
7
7
  export const Stylesheet = (context) =>
8
8
  StyleSheet.create({
9
9
  container: {
10
+ width: '100%',
10
11
  flexDirection: 'row',
11
- borderColor: context.colors.ui.lightgrey,
12
- borderWidth: 1,
13
12
  borderStyle: 'solid',
14
- backgroundColor: context.colors.ui.white,
13
+ borderWidth: 1,
14
+ borderColor: context.colors.ui.lightgrey,
15
15
  borderRadius: Scale.xs,
16
+ backgroundColor: context.colors.ui.white,
16
17
  overflow: 'hidden',
17
- paddingTop: Scale.xs,
18
- paddingBottom: Scale.xs,
19
- paddingLeft: Scale.m,
20
- paddingRight: Scale.m,
18
+ alignItems: 'center',
21
19
  },
22
- input: {
20
+ textInputContainer: {
23
21
  flex: 1,
22
+ },
23
+ input: {
24
+ paddingLeft: Scale.m,
25
+ paddingTop: 0,
26
+ paddingBottom: 0,
27
+ paddingRight: Scale.m,
24
28
  ...Font.medium,
29
+ lineHeight: 20,
30
+ color: context.colors.ui.black,
31
+ },
32
+ iconContainer: {
33
+ paddingLeft: Scale.m,
34
+ paddingTop: Scale.xs - 1,
35
+ paddingRight: Scale.m,
36
+ paddingBottom: Scale.xs - 1,
25
37
  },
26
38
  });
@@ -1,32 +1,84 @@
1
1
  // Jest Snapshot v1, https://goo.gl/fbAQLP
2
2
 
3
- exports[`test input texts shows icon when provided 1`] = `
3
+ exports[`test input texts show an input field with a border and placeholder text 1`] = `
4
4
  <View
5
5
  style={
6
- {
7
- "backgroundColor": "#FFFFFF",
8
- "borderColor": "#E5E8EB",
9
- "borderRadius": 8,
10
- "borderStyle": "solid",
11
- "borderWidth": 1,
12
- "flexDirection": "row",
13
- "overflow": "hidden",
14
- "paddingBottom": 8,
15
- "paddingLeft": 16,
16
- "paddingRight": 16,
17
- "paddingTop": 8,
6
+ [
7
+ {
8
+ "alignItems": "flex-start",
9
+ "backgroundColor": "#FFFFFF",
10
+ "borderRadius": 8,
11
+ "height": 44,
12
+ "justifyContent": "center",
13
+ "overflow": "hidden",
14
+ "paddingBottom": 8,
15
+ "paddingLeft": 16,
16
+ "paddingRight": 16,
17
+ "paddingTop": 8,
18
+ "width": "100%",
19
+ },
20
+ {
21
+ "borderColor": "#E5E8EB",
22
+ "borderStyle": "solid",
23
+ "borderWidth": 1,
24
+ },
25
+ ]
26
+ }
27
+ >
28
+ <TextInput
29
+ keyboardType="email-address"
30
+ onChangeText={[Function]}
31
+ placeholder="Text input field with a border"
32
+ placeholderTextColor="#9AA5B1"
33
+ style={
34
+ {
35
+ "color": "#1F2933",
36
+ "fontFamily": "SourceSansPro",
37
+ "fontSize": 16,
38
+ "lineHeight": 20,
39
+ "width": "100%",
40
+ }
18
41
  }
42
+ />
43
+ </View>
44
+ `;
45
+
46
+ exports[`test input texts show an input field with a border and without placeholder text 1`] = `
47
+ <View
48
+ style={
49
+ [
50
+ {
51
+ "alignItems": "flex-start",
52
+ "backgroundColor": "#FFFFFF",
53
+ "borderRadius": 8,
54
+ "height": 44,
55
+ "justifyContent": "center",
56
+ "overflow": "hidden",
57
+ "paddingBottom": 8,
58
+ "paddingLeft": 16,
59
+ "paddingRight": 16,
60
+ "paddingTop": 8,
61
+ "width": "100%",
62
+ },
63
+ {
64
+ "borderColor": "#E5E8EB",
65
+ "borderStyle": "solid",
66
+ "borderWidth": 1,
67
+ },
68
+ ]
19
69
  }
20
70
  >
21
71
  <TextInput
22
72
  keyboardType="email-address"
23
73
  onChangeText={[Function]}
74
+ placeholderTextColor="#9AA5B1"
24
75
  style={
25
76
  {
26
- "flex": 1,
77
+ "color": "#1F2933",
27
78
  "fontFamily": "SourceSansPro",
28
79
  "fontSize": 16,
29
- "lineHeight": 22.4,
80
+ "lineHeight": 20,
81
+ "width": "100%",
30
82
  }
31
83
  }
32
84
  />
@@ -36,31 +88,74 @@ exports[`test input texts shows icon when provided 1`] = `
36
88
  exports[`test input texts shows placeholder when provided 1`] = `
37
89
  <View
38
90
  style={
39
- {
40
- "backgroundColor": "#FFFFFF",
41
- "borderColor": "#E5E8EB",
42
- "borderRadius": 8,
43
- "borderStyle": "solid",
44
- "borderWidth": 1,
45
- "flexDirection": "row",
46
- "overflow": "hidden",
47
- "paddingBottom": 8,
48
- "paddingLeft": 16,
49
- "paddingRight": 16,
50
- "paddingTop": 8,
51
- }
91
+ [
92
+ {
93
+ "alignItems": "flex-start",
94
+ "backgroundColor": "#FFFFFF",
95
+ "borderRadius": 8,
96
+ "height": 44,
97
+ "justifyContent": "center",
98
+ "overflow": "hidden",
99
+ "paddingBottom": 8,
100
+ "paddingLeft": 16,
101
+ "paddingRight": 16,
102
+ "paddingTop": 8,
103
+ "width": "100%",
104
+ },
105
+ undefined,
106
+ ]
52
107
  }
53
108
  >
54
109
  <TextInput
55
110
  keyboardType="default"
56
111
  onChangeText={[Function]}
57
112
  placeholder="dummy placeholder"
113
+ placeholderTextColor="#9AA5B1"
114
+ style={
115
+ {
116
+ "color": "#1F2933",
117
+ "fontFamily": "SourceSansPro",
118
+ "fontSize": 16,
119
+ "lineHeight": 20,
120
+ "width": "100%",
121
+ }
122
+ }
123
+ />
124
+ </View>
125
+ `;
126
+
127
+ exports[`test input texts text input field without placeholder text 1`] = `
128
+ <View
129
+ style={
130
+ [
131
+ {
132
+ "alignItems": "flex-start",
133
+ "backgroundColor": "#FFFFFF",
134
+ "borderRadius": 8,
135
+ "height": 44,
136
+ "justifyContent": "center",
137
+ "overflow": "hidden",
138
+ "paddingBottom": 8,
139
+ "paddingLeft": 16,
140
+ "paddingRight": 16,
141
+ "paddingTop": 8,
142
+ "width": "100%",
143
+ },
144
+ undefined,
145
+ ]
146
+ }
147
+ >
148
+ <TextInput
149
+ keyboardType="email-address"
150
+ onChangeText={[Function]}
151
+ placeholderTextColor="#9AA5B1"
58
152
  style={
59
153
  {
60
- "flex": 1,
154
+ "color": "#1F2933",
61
155
  "fontFamily": "SourceSansPro",
62
156
  "fontSize": 16,
63
- "lineHeight": 22.4,
157
+ "lineHeight": 20,
158
+ "width": "100%",
64
159
  }
65
160
  }
66
161
  />
@@ -3,6 +3,7 @@ declare type TextInputProps = {
3
3
  placeholder?: string;
4
4
  onchangeText?: (text: string) => void;
5
5
  keyboardType: KeyBoardTypes;
6
+ border?: boolean;
6
7
  };
7
- declare const TextInput: ({ placeholder, onchangeText, keyboardType, }: TextInputProps) => JSX.Element;
8
+ declare const TextInput: ({ placeholder, onchangeText, keyboardType, border, }: TextInputProps) => JSX.Element;
8
9
  export { TextInput as TextInput };
@@ -10,20 +10,23 @@ type TextInputProps = {
10
10
  placeholder?: string;
11
11
  onchangeText?: (text: string) => void;
12
12
  keyboardType: KeyBoardTypes;
13
+ border?: boolean;
13
14
  };
14
15
 
15
16
  const TextInput = ({
16
17
  placeholder,
17
18
  onchangeText,
18
19
  keyboardType,
20
+ border,
19
21
  }: TextInputProps) => {
20
22
  const context = useContext(ThemeCtx);
21
- const styles = Stylesheet(context);
23
+ const styles = Stylesheet(context, border);
22
24
 
23
25
  return (
24
26
  <View style={styles.container}>
25
27
  <NativeTextInput
26
28
  placeholder={placeholder}
29
+ placeholderTextColor={context.colors.ui.grey}
27
30
  style={styles.input}
28
31
  onChangeText={onchangeText}
29
32
  keyboardType={keyboardType}
@@ -5,7 +5,7 @@ import {SafeAreaView} from 'react-native';
5
5
 
6
6
  export const TextInputPreview = ({} = {}) => {
7
7
  return (
8
- <SafeAreaView>
8
+ <SafeAreaView style={{flex: 1, justifyContent: 'space-around'}}>
9
9
  <TextInput
10
10
  onchangeText={(text: string) =>
11
11
  console.log('text is changed to: ' + text)
@@ -25,6 +25,17 @@ export const TextInputPreview = ({} = {}) => {
25
25
  }
26
26
  keyboardType={KeyBoardTypes.EMAIL_ADDRESS}
27
27
  />
28
+ <TextInput
29
+ keyboardType={KeyBoardTypes.DEFAULT}
30
+ onchangeText={(text: string) => console.log('text: ' + text)}
31
+ placeholder={'with border'}
32
+ border={true}
33
+ />
34
+ <TextInput
35
+ keyboardType={KeyBoardTypes.DEFAULT}
36
+ onchangeText={(text: string) => console.log('text: ' + text)}
37
+ border={true}
38
+ />
28
39
  </SafeAreaView>
29
40
  );
30
41
  };
@@ -1,21 +1,49 @@
1
- export function Stylesheet(context: any): {
2
- container: {
3
- flexDirection: 'row';
4
- borderColor: any;
5
- borderWidth: number;
6
- borderStyle: 'solid';
7
- backgroundColor: any;
8
- borderRadius: number;
9
- overflow: 'hidden';
10
- paddingTop: number;
11
- paddingBottom: number;
12
- paddingLeft: number;
13
- paddingRight: number;
14
- };
15
- input: {
16
- fontFamily: string;
17
- fontSize: number;
18
- lineHeight: number;
19
- flex: number;
20
- };
21
- };
1
+ export function Stylesheet(
2
+ context: any,
3
+ border: any
4
+ ):
5
+ | StyleSheet.NamedStyles<any>
6
+ | StyleSheet.NamedStyles<{
7
+ container: (
8
+ | {
9
+ width: string;
10
+ height: number;
11
+ borderRadius: number;
12
+ overflow: string;
13
+ paddingLeft: number;
14
+ paddingTop: number;
15
+ paddingRight: number;
16
+ paddingBottom: number;
17
+ backgroundColor: any;
18
+ justifyContent: string;
19
+ alignItems: string;
20
+ borderStyle?: undefined;
21
+ borderWidth?: undefined;
22
+ borderColor?: undefined;
23
+ }
24
+ | {
25
+ borderStyle: string;
26
+ borderWidth: number;
27
+ borderColor: any;
28
+ width?: undefined;
29
+ height?: undefined;
30
+ borderRadius?: undefined;
31
+ overflow?: undefined;
32
+ paddingLeft?: undefined;
33
+ paddingTop?: undefined;
34
+ paddingRight?: undefined;
35
+ paddingBottom?: undefined;
36
+ backgroundColor?: undefined;
37
+ justifyContent?: undefined;
38
+ alignItems?: undefined;
39
+ }
40
+ )[];
41
+ input: {
42
+ lineHeight: number;
43
+ color: any;
44
+ fontFamily: string;
45
+ fontSize: number;
46
+ width: string;
47
+ };
48
+ }>;
49
+ import {StyleSheet} from 'react-native';
@@ -4,23 +4,32 @@ import {StyleSheet} from 'react-native';
4
4
  import {Scale} from '../../../theme/scale';
5
5
  import {Font} from '../../../theme/font';
6
6
 
7
- export const Stylesheet = (context) =>
7
+ export const Stylesheet = (context, border) =>
8
8
  StyleSheet.create({
9
- container: {
10
- flexDirection: 'row',
11
- borderColor: context.colors.ui.lightgrey,
12
- borderWidth: 1,
13
- borderStyle: 'solid',
14
- backgroundColor: context.colors.ui.white,
15
- borderRadius: Scale.xs,
16
- overflow: 'hidden',
17
- paddingTop: Scale.xs,
18
- paddingBottom: Scale.xs,
19
- paddingLeft: Scale.m,
20
- paddingRight: Scale.m,
21
- },
9
+ container: [
10
+ {
11
+ width: '100%',
12
+ height: 44,
13
+ borderRadius: Scale.xs,
14
+ overflow: 'hidden',
15
+ paddingLeft: Scale.m,
16
+ paddingTop: Scale.xs,
17
+ paddingRight: Scale.m,
18
+ paddingBottom: Scale.xs,
19
+ backgroundColor: context.colors.ui.white,
20
+ justifyContent: 'center',
21
+ alignItems: 'flex-start',
22
+ },
23
+ border && {
24
+ borderStyle: 'solid',
25
+ borderWidth: 1,
26
+ borderColor: context.colors.ui.lightgrey,
27
+ },
28
+ ],
22
29
  input: {
23
- flex: 1,
30
+ width: '100%',
24
31
  ...Font.medium,
32
+ lineHeight: 20,
33
+ color: context.colors.ui.black,
25
34
  },
26
35
  });
@@ -17,7 +17,7 @@ describe('test input texts', () => {
17
17
 
18
18
  expect(tree).toMatchSnapshot();
19
19
  });
20
- it('shows icon when provided', () => {
20
+ it('text input field without placeholder text', () => {
21
21
  const tree = renderer
22
22
  .create(
23
23
  <TextInput
@@ -29,4 +29,31 @@ describe('test input texts', () => {
29
29
 
30
30
  expect(tree).toMatchSnapshot();
31
31
  });
32
+ it('show an input field with a border and without placeholder text', () => {
33
+ const tree = renderer
34
+ .create(
35
+ <TextInput
36
+ keyboardType={KeyBoardTypes.EMAIL_ADDRESS}
37
+ onchangeText={() => console.log('text changed')}
38
+ border={true}
39
+ />
40
+ )
41
+ .toJSON();
42
+
43
+ expect(tree).toMatchSnapshot();
44
+ });
45
+ it('show an input field with a border and placeholder text', () => {
46
+ const tree = renderer
47
+ .create(
48
+ <TextInput
49
+ keyboardType={KeyBoardTypes.EMAIL_ADDRESS}
50
+ onchangeText={() => console.log('text changed')}
51
+ border={true}
52
+ placeholder={'Text input field with a border'}
53
+ />
54
+ )
55
+ .toJSON();
56
+
57
+ expect(tree).toMatchSnapshot();
58
+ });
32
59
  });