@hero-design/rn 7.17.0 → 7.18.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.
Files changed (142) hide show
  1. package/.turbo/turbo-build.log +2 -2
  2. package/es/index.js +3712 -3473
  3. package/lib/index.js +3716 -3475
  4. package/package.json +2 -2
  5. package/src/components/Accordion/__tests__/__snapshots__/AccordionItem.spec.tsx.snap +12 -12
  6. package/src/components/Accordion/__tests__/__snapshots__/index.spec.tsx.snap +18 -18
  7. package/src/components/Alert/__tests__/__snapshots__/index.spec.tsx.snap +26 -26
  8. package/src/components/Avatar/__tests__/__snapshots__/StyledAvatar.spec.tsx.snap +3 -3
  9. package/src/components/Avatar/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  10. package/src/components/Badge/__tests__/__snapshots__/Badge.spec.tsx.snap +1 -1
  11. package/src/components/Badge/__tests__/__snapshots__/Status.spec.tsx.snap +2 -2
  12. package/src/components/BottomNavigation/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
  13. package/src/components/BottomNavigation/index.tsx +1 -1
  14. package/src/components/BottomSheet/__tests__/__snapshots__/index.spec.tsx.snap +12 -12
  15. package/src/components/Button/Button.tsx +1 -0
  16. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/StyledLoadingIndicator.spec.tsx.snap +2 -2
  17. package/src/components/Button/LoadingIndicator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
  18. package/src/components/Button/UtilityButton/{styled.tsx → StyledUtilityButton.tsx} +2 -2
  19. package/src/components/Button/UtilityButton/__tests__/__snapshots__/index.spec.tsx.snap +8 -8
  20. package/src/components/Button/UtilityButton/index.tsx +5 -1
  21. package/src/components/Button/__tests__/__snapshots__/IconButton.spec.tsx.snap +1 -1
  22. package/src/components/Button/__tests__/__snapshots__/StyledButton.spec.tsx.snap +69 -69
  23. package/src/components/Calendar/__tests__/__snapshots__/CalendarRowItem.spec.tsx.snap +12 -12
  24. package/src/components/Card/__tests__/__snapshots__/StyledCard.spec.tsx.snap +1 -1
  25. package/src/components/Checkbox/__tests__/__snapshots__/StyledCheckbox.spec.tsx.snap +1 -1
  26. package/src/components/Checkbox/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  27. package/src/components/ContentNavigator/__tests__/__snapshots__/StyledContentNavigator.spec.tsx.snap +1 -1
  28. package/src/components/ContentNavigator/__tests__/__snapshots__/index.spec.tsx.snap +6 -6
  29. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerAndroid.spec.tsx.snap +6 -5
  30. package/src/components/DatePicker/__tests__/__snapshots__/DatePickerIOS.spec.tsx.snap +13 -12
  31. package/src/components/Divider/__tests__/__snapshots__/StyledDivider.spec.tsx.snap +12 -12
  32. package/src/components/Drawer/DragableDrawer/__tests__/__snapshots__/index.spec.tsx.snap +99 -0
  33. package/src/components/Drawer/DragableDrawer/__tests__/helpers.spec.ts +39 -0
  34. package/src/components/Drawer/DragableDrawer/__tests__/index.spec.tsx +24 -0
  35. package/src/components/Drawer/DragableDrawer/helpers.ts +43 -0
  36. package/src/components/Drawer/DragableDrawer/index.tsx +205 -0
  37. package/src/components/Drawer/StyledDrawer.tsx +70 -26
  38. package/src/components/Drawer/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  39. package/src/components/Drawer/index.tsx +4 -1
  40. package/src/components/Empty/StyledEmpty.tsx +4 -3
  41. package/src/components/Empty/__tests__/__snapshots__/index.spec.tsx.snap +4 -3
  42. package/src/components/Empty/index.tsx +2 -2
  43. package/src/components/FAB/ActionGroup/__tests__/__snapshots__/index.spec.tsx.snap +28 -28
  44. package/src/components/FAB/ActionGroup/index.tsx +1 -1
  45. package/src/components/FAB/__tests__/__snapshots__/AnimatedFABIcon.spec.tsx.snap +2 -2
  46. package/src/components/FAB/__tests__/__snapshots__/StyledFAB.spec.tsx.snap +3 -3
  47. package/src/components/FAB/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
  48. package/src/components/Icon/__tests__/__snapshots__/index.spec.tsx.snap +3 -3
  49. package/src/components/List/ListItem.tsx +1 -1
  50. package/src/components/List/__tests__/__snapshots__/BasicListItem.spec.tsx.snap +3 -3
  51. package/src/components/List/__tests__/__snapshots__/ListItem.spec.tsx.snap +20 -20
  52. package/src/components/List/__tests__/__snapshots__/StyledBasicListItem.spec.tsx.snap +6 -6
  53. package/src/components/List/__tests__/__snapshots__/StyledListItem.spec.tsx.snap +12 -12
  54. package/src/components/PinInput/__tests__/__snapshots__/PinCell.spec.tsx.snap +4 -4
  55. package/src/components/PinInput/__tests__/__snapshots__/index.spec.tsx.snap +22 -22
  56. package/src/components/Progress/ProgressCircle.tsx +25 -22
  57. package/src/components/Progress/StyledProgressCircle.tsx +33 -28
  58. package/src/components/Progress/__tests__/__snapshots__/index.spec.js.snap +102 -92
  59. package/src/components/Radio/__tests__/__snapshots__/Radio.spec.tsx.snap +5 -5
  60. package/src/components/Radio/__tests__/__snapshots__/RadioGroup.spec.tsx.snap +6 -6
  61. package/src/components/Radio/__tests__/__snapshots__/StyledRadio.spec.tsx.snap +3 -3
  62. package/src/components/RichTextEditor/__tests__/__snapshots__/EditorToolbar.spec.tsx.snap +11 -11
  63. package/src/components/RichTextEditor/__tests__/__snapshots__/RichTextEditor.spec.tsx.snap +8 -6
  64. package/src/components/SectionHeading/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
  65. package/src/components/SectionHeading/__tests__/__snapshots__/index.spec.tsx.snap +9 -9
  66. package/src/components/Select/MultiSelect/__tests__/__snapshots__/Option.spec.tsx.snap +3 -3
  67. package/src/components/Select/MultiSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +42 -42
  68. package/src/components/Select/MultiSelect/__tests__/__snapshots__/index.spec.tsx.snap +126 -121
  69. package/src/components/Select/MultiSelect/index.tsx +1 -4
  70. package/src/components/Select/SingleSelect/__tests__/__snapshots__/Option.spec.tsx.snap +2 -2
  71. package/src/components/Select/SingleSelect/__tests__/__snapshots__/OptionList.spec.tsx.snap +36 -36
  72. package/src/components/Select/SingleSelect/__tests__/__snapshots__/index.spec.tsx.snap +99 -94
  73. package/src/components/Select/SingleSelect/index.tsx +2 -6
  74. package/src/components/Select/__tests__/__snapshots__/StyledSelect.spec.tsx.snap +2 -2
  75. package/src/components/Spinner/__tests__/__snapshots__/AnimatedSpinner.spec.tsx.snap +4 -4
  76. package/src/components/Spinner/__tests__/__snapshots__/StyledSpinner.spec.tsx.snap +8 -8
  77. package/src/components/Spinner/__tests__/__snapshots__/index.spec.tsx.snap +4 -4
  78. package/src/components/Switch/__tests__/__snapshots__/StyledHeading.spec.tsx.snap +1 -1
  79. package/src/components/Switch/__tests__/__snapshots__/index.spec.tsx.snap +2 -2
  80. package/src/components/Tabs/ScrollableTabs.tsx +1 -1
  81. package/src/components/Tabs/__tests__/ScrollableTabs.spec.tsx +8 -0
  82. package/src/components/Tabs/__tests__/__snapshots__/ScrollableTabs.spec.tsx.snap +85 -6
  83. package/src/components/Tabs/__tests__/__snapshots__/index.spec.tsx.snap +87 -8
  84. package/src/components/Tabs/__tests__/index.spec.tsx +8 -0
  85. package/src/components/Tabs/index.tsx +8 -3
  86. package/src/components/Tag/__tests__/__snapshots__/Tag.spec.tsx.snap +9 -9
  87. package/src/components/TextInput/StyledTextInput.tsx +1 -0
  88. package/src/components/TextInput/__tests__/__snapshots__/StyledTextInput.spec.tsx.snap +50 -50
  89. package/src/components/TextInput/__tests__/__snapshots__/index.spec.tsx.snap +100 -87
  90. package/src/components/TextInput/index.tsx +2 -2
  91. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerAndroid.spec.tsx.snap +6 -5
  92. package/src/components/TimePicker/__tests__/__snapshots__/TimePickerIOS.spec.tsx.snap +13 -12
  93. package/src/components/Toast/__tests__/__snapshots__/Toast.spec.tsx.snap +22 -22
  94. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarGroup.spec.tsx.snap +12 -12
  95. package/src/components/Toolbar/__tests__/__snapshots__/ToolbarItem.spec.tsx.snap +8 -8
  96. package/src/components/Typography/Text/__tests__/__snapshots__/StyledText.spec.tsx.snap +13 -13
  97. package/src/index.ts +9 -1
  98. package/src/theme/ThemeProvider.ts +19 -0
  99. package/src/theme/ThemeSwitcher.tsx +27 -0
  100. package/src/theme/__tests__/__snapshots__/index.spec.ts.snap +161 -149
  101. package/src/theme/components/alert.ts +3 -3
  102. package/src/theme/components/badge.ts +1 -1
  103. package/src/theme/components/button.ts +9 -8
  104. package/src/theme/components/card.ts +4 -4
  105. package/src/theme/components/drawer.ts +14 -2
  106. package/src/theme/components/empty.ts +3 -2
  107. package/src/theme/components/list.ts +4 -4
  108. package/src/theme/components/pinInput.ts +2 -2
  109. package/src/theme/components/progress.ts +5 -5
  110. package/src/theme/components/toast.ts +3 -3
  111. package/src/theme/getTheme.ts +129 -0
  112. package/src/theme/global/colors/swag.ts +54 -0
  113. package/src/theme/global/colors/types.ts +45 -0
  114. package/src/theme/global/colors/work.ts +14 -0
  115. package/src/theme/global/index.ts +6 -2
  116. package/src/theme/index.ts +16 -143
  117. package/src/utils/scale.ts +4 -1
  118. package/types/components/Button/Button.d.ts +1 -0
  119. package/types/components/Button/UtilityButton/{styled.d.ts → StyledUtilityButton.d.ts} +0 -0
  120. package/types/components/Drawer/DragableDrawer/__tests__/helpers.spec.d.ts +1 -0
  121. package/types/components/Drawer/DragableDrawer/__tests__/index.spec.d.ts +1 -0
  122. package/types/components/Drawer/DragableDrawer/helpers.d.ts +8 -0
  123. package/types/components/Drawer/DragableDrawer/index.d.ts +33 -0
  124. package/types/components/Drawer/StyledDrawer.d.ts +34 -4
  125. package/types/components/Drawer/index.d.ts +4 -2
  126. package/types/components/Empty/index.d.ts +1 -1
  127. package/types/components/Icon/utils.d.ts +1 -1
  128. package/types/components/Progress/StyledProgressCircle.d.ts +12 -6
  129. package/types/index.d.ts +2 -2
  130. package/types/theme/ThemeProvider.d.ts +12 -0
  131. package/types/theme/ThemeSwitcher.d.ts +7 -0
  132. package/types/theme/components/button.d.ts +1 -1
  133. package/types/theme/components/drawer.d.ts +9 -0
  134. package/types/theme/components/empty.d.ts +3 -2
  135. package/types/theme/components/progress.d.ts +1 -2
  136. package/types/theme/getTheme.d.ts +74 -0
  137. package/types/theme/global/colors/swag.d.ts +3 -0
  138. package/types/theme/global/{colors.d.ts → colors/types.d.ts} +4 -3
  139. package/types/theme/global/colors/work.d.ts +3 -0
  140. package/types/theme/global/index.d.ts +7 -2
  141. package/types/theme/index.d.ts +7 -84
  142. package/src/theme/global/colors.ts +0 -50
@@ -15,7 +15,7 @@ exports[`Checkbox renders correctly 1`] = `
15
15
  onStartShouldSetResponder={[Function]}
16
16
  style={
17
17
  Object {
18
- "borderColor": "#7622d7",
18
+ "borderColor": "#8505a2",
19
19
  "borderRadius": 4,
20
20
  "borderWidth": 2,
21
21
  "display": "flex",
@@ -46,7 +46,7 @@ exports[`Checkbox trigger press function correctly 1`] = `
46
46
  onStartShouldSetResponder={[Function]}
47
47
  style={
48
48
  Object {
49
- "borderColor": "#7622d7",
49
+ "borderColor": "#8505a2",
50
50
  "borderRadius": 4,
51
51
  "borderWidth": 2,
52
52
  "display": "flex",
@@ -5,7 +5,7 @@ exports[`Value has correct style 1`] = `
5
5
  style={
6
6
  Array [
7
7
  Object {
8
- "color": "#292a2b",
8
+ "color": "#001f23",
9
9
  "fontFamily": "BeVietnamPro-Regular",
10
10
  "fontSize": 14,
11
11
  "letterSpacing": 0.42,
@@ -37,7 +37,7 @@ exports[`rendering renders correctly 1`] = `
37
37
  style={
38
38
  Array [
39
39
  Object {
40
- "color": "#292a2b",
40
+ "color": "#001f23",
41
41
  "fontSize": 24,
42
42
  },
43
43
  undefined,
@@ -51,7 +51,7 @@ exports[`rendering renders correctly 1`] = `
51
51
  style={
52
52
  Array [
53
53
  Object {
54
- "color": "#292a2b",
54
+ "color": "#001f23",
55
55
  "fontFamily": "BeVietnamPro-SemiBold",
56
56
  "fontSize": 14,
57
57
  "letterSpacing": 0.42,
@@ -96,7 +96,7 @@ exports[`rendering renders correctly 1`] = `
96
96
  style={
97
97
  Array [
98
98
  Object {
99
- "color": "#292a2b",
99
+ "color": "#001f23",
100
100
  "fontSize": 24,
101
101
  },
102
102
  undefined,
@@ -146,7 +146,7 @@ exports[`rendering renders correctly when icon buttons are disabled 1`] = `
146
146
  style={
147
147
  Array [
148
148
  Object {
149
- "color": "#8b8d92",
149
+ "color": "#808f91",
150
150
  "fontSize": 24,
151
151
  },
152
152
  undefined,
@@ -160,7 +160,7 @@ exports[`rendering renders correctly when icon buttons are disabled 1`] = `
160
160
  style={
161
161
  Array [
162
162
  Object {
163
- "color": "#292a2b",
163
+ "color": "#001f23",
164
164
  "fontFamily": "BeVietnamPro-SemiBold",
165
165
  "fontSize": 14,
166
166
  "letterSpacing": 0.42,
@@ -205,7 +205,7 @@ exports[`rendering renders correctly when icon buttons are disabled 1`] = `
205
205
  style={
206
206
  Array [
207
207
  Object {
208
- "color": "#8b8d92",
208
+ "color": "#808f91",
209
209
  "fontSize": 24,
210
210
  },
211
211
  undefined,
@@ -49,7 +49,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
49
49
  style={
50
50
  Array [
51
51
  Object {
52
- "borderColor": "#292a2b",
52
+ "borderColor": "#001f23",
53
53
  "borderRadius": 8,
54
54
  "borderWidth": 1,
55
55
  "bottom": 0,
@@ -84,7 +84,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
84
84
  style={
85
85
  Array [
86
86
  Object {
87
- "color": "#292a2b",
87
+ "color": "#001f23",
88
88
  "fontFamily": "BeVietnamPro-Regular",
89
89
  "fontSize": 12,
90
90
  "letterSpacing": 0.36,
@@ -92,7 +92,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
92
92
  },
93
93
  Array [
94
94
  Object {
95
- "color": "#292a2b",
95
+ "color": "#001f23",
96
96
  },
97
97
  undefined,
98
98
  ],
@@ -115,6 +115,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
115
115
  "alignSelf": "stretch",
116
116
  "flexDirection": "row",
117
117
  "flexGrow": 2,
118
+ "flexShrink": 1,
118
119
  },
119
120
  undefined,
120
121
  ]
@@ -140,7 +141,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
140
141
  "textAlignVertical": "center",
141
142
  },
142
143
  Object {
143
- "color": "#292a2b",
144
+ "color": "#001f23",
144
145
  },
145
146
  ]
146
147
  }
@@ -153,7 +154,7 @@ exports[`DatePickerAndroid renders correctly 1`] = `
153
154
  style={
154
155
  Array [
155
156
  Object {
156
- "color": "#292a2b",
157
+ "color": "#001f23",
157
158
  "fontSize": 16,
158
159
  },
159
160
  undefined,
@@ -49,7 +49,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
49
49
  style={
50
50
  Array [
51
51
  Object {
52
- "borderColor": "#292a2b",
52
+ "borderColor": "#001f23",
53
53
  "borderRadius": 8,
54
54
  "borderWidth": 1,
55
55
  "bottom": 0,
@@ -84,7 +84,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
84
84
  style={
85
85
  Array [
86
86
  Object {
87
- "color": "#292a2b",
87
+ "color": "#001f23",
88
88
  "fontFamily": "BeVietnamPro-Regular",
89
89
  "fontSize": 12,
90
90
  "letterSpacing": 0.36,
@@ -92,7 +92,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
92
92
  },
93
93
  Array [
94
94
  Object {
95
- "color": "#292a2b",
95
+ "color": "#001f23",
96
96
  },
97
97
  undefined,
98
98
  ],
@@ -115,6 +115,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
115
115
  "alignSelf": "stretch",
116
116
  "flexDirection": "row",
117
117
  "flexGrow": 2,
118
+ "flexShrink": 1,
118
119
  },
119
120
  undefined,
120
121
  ]
@@ -140,7 +141,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
140
141
  "textAlignVertical": "center",
141
142
  },
142
143
  Object {
143
- "color": "#292a2b",
144
+ "color": "#001f23",
144
145
  },
145
146
  ]
146
147
  }
@@ -153,7 +154,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
153
154
  style={
154
155
  Array [
155
156
  Object {
156
- "color": "#292a2b",
157
+ "color": "#001f23",
157
158
  "fontSize": 16,
158
159
  },
159
160
  undefined,
@@ -266,7 +267,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
266
267
  onStartShouldSetResponder={[Function]}
267
268
  style={
268
269
  Object {
269
- "backgroundColor": "#292a2b",
270
+ "backgroundColor": "#001f23",
270
271
  "bottom": 0,
271
272
  "left": 0,
272
273
  "opacity": 0.48,
@@ -288,7 +289,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
288
289
  "borderTopRightRadius": 16,
289
290
  "elevation": 10,
290
291
  "maxHeight": "94%",
291
- "shadowColor": "#292a2b",
292
+ "shadowColor": "#001f23",
292
293
  "shadowOffset": Object {
293
294
  "height": 3,
294
295
  "width": 0,
@@ -334,7 +335,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
334
335
  style={
335
336
  Array [
336
337
  Object {
337
- "color": "#292a2b",
338
+ "color": "#001f23",
338
339
  "fontFamily": "BeVietnamPro-SemiBold",
339
340
  "fontSize": 16,
340
341
  "letterSpacing": 0.48,
@@ -388,7 +389,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
388
389
  style={
389
390
  Array [
390
391
  Object {
391
- "color": "#292a2b",
392
+ "color": "#001f23",
392
393
  "fontSize": 20,
393
394
  },
394
395
  undefined,
@@ -404,7 +405,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
404
405
  style={
405
406
  Array [
406
407
  Object {
407
- "borderBottomColor": "#dadbde",
408
+ "borderBottomColor": "#e8e9ea",
408
409
  "borderBottomWidth": 1,
409
410
  "maxWidth": "100%",
410
411
  },
@@ -440,7 +441,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
440
441
  style={
441
442
  Array [
442
443
  Object {
443
- "borderBottomColor": "#dadbde",
444
+ "borderBottomColor": "#e8e9ea",
444
445
  "borderBottomWidth": 1,
445
446
  "maxWidth": "100%",
446
447
  },
@@ -485,7 +486,7 @@ exports[`DatePickerIOS renders correctly 1`] = `
485
486
  style={
486
487
  Array [
487
488
  Object {
488
- "color": "#7622d7",
489
+ "color": "#8505a2",
489
490
  "fontFamily": "BeVietnamPro-SemiBold",
490
491
  "fontSize": 16,
491
492
  "letterSpacing": 0.48,
@@ -5,7 +5,7 @@ exports[`Divider has large marginHorizontal style 1`] = `
5
5
  style={
6
6
  Array [
7
7
  Object {
8
- "borderBottomColor": "#dadbde",
8
+ "borderBottomColor": "#e8e9ea",
9
9
  "borderBottomWidth": 1,
10
10
  "marginHorizontal": 24,
11
11
  "maxWidth": "100%",
@@ -22,7 +22,7 @@ exports[`Divider has large marginVertical style 1`] = `
22
22
  style={
23
23
  Array [
24
24
  Object {
25
- "borderBottomColor": "#dadbde",
25
+ "borderBottomColor": "#e8e9ea",
26
26
  "borderBottomWidth": 1,
27
27
  "marginVertical": 24,
28
28
  "maxWidth": "100%",
@@ -39,7 +39,7 @@ exports[`Divider has medium marginHorizontal style 1`] = `
39
39
  style={
40
40
  Array [
41
41
  Object {
42
- "borderBottomColor": "#dadbde",
42
+ "borderBottomColor": "#e8e9ea",
43
43
  "borderBottomWidth": 1,
44
44
  "marginHorizontal": 16,
45
45
  "maxWidth": "100%",
@@ -56,7 +56,7 @@ exports[`Divider has medium marginVertical style 1`] = `
56
56
  style={
57
57
  Array [
58
58
  Object {
59
- "borderBottomColor": "#dadbde",
59
+ "borderBottomColor": "#e8e9ea",
60
60
  "borderBottomWidth": 1,
61
61
  "marginVertical": 16,
62
62
  "maxWidth": "100%",
@@ -73,7 +73,7 @@ exports[`Divider has small marginHorizontal style 1`] = `
73
73
  style={
74
74
  Array [
75
75
  Object {
76
- "borderBottomColor": "#dadbde",
76
+ "borderBottomColor": "#e8e9ea",
77
77
  "borderBottomWidth": 1,
78
78
  "marginHorizontal": 8,
79
79
  "maxWidth": "100%",
@@ -90,7 +90,7 @@ exports[`Divider has small marginVertical style 1`] = `
90
90
  style={
91
91
  Array [
92
92
  Object {
93
- "borderBottomColor": "#dadbde",
93
+ "borderBottomColor": "#e8e9ea",
94
94
  "borderBottomWidth": 1,
95
95
  "marginVertical": 8,
96
96
  "maxWidth": "100%",
@@ -107,7 +107,7 @@ exports[`Divider has undefined marginHorizontal style 1`] = `
107
107
  style={
108
108
  Array [
109
109
  Object {
110
- "borderBottomColor": "#dadbde",
110
+ "borderBottomColor": "#e8e9ea",
111
111
  "borderBottomWidth": 1,
112
112
  "maxWidth": "100%",
113
113
  },
@@ -122,7 +122,7 @@ exports[`Divider has undefined marginVertical style 1`] = `
122
122
  style={
123
123
  Array [
124
124
  Object {
125
- "borderBottomColor": "#dadbde",
125
+ "borderBottomColor": "#e8e9ea",
126
126
  "borderBottomWidth": 1,
127
127
  "maxWidth": "100%",
128
128
  },
@@ -137,7 +137,7 @@ exports[`Divider has xlarge marginHorizontal style 1`] = `
137
137
  style={
138
138
  Array [
139
139
  Object {
140
- "borderBottomColor": "#dadbde",
140
+ "borderBottomColor": "#e8e9ea",
141
141
  "borderBottomWidth": 1,
142
142
  "marginHorizontal": 32,
143
143
  "maxWidth": "100%",
@@ -154,7 +154,7 @@ exports[`Divider has xlarge marginVertical style 1`] = `
154
154
  style={
155
155
  Array [
156
156
  Object {
157
- "borderBottomColor": "#dadbde",
157
+ "borderBottomColor": "#e8e9ea",
158
158
  "borderBottomWidth": 1,
159
159
  "marginVertical": 32,
160
160
  "maxWidth": "100%",
@@ -171,7 +171,7 @@ exports[`Divider has xsmall marginHorizontal style 1`] = `
171
171
  style={
172
172
  Array [
173
173
  Object {
174
- "borderBottomColor": "#dadbde",
174
+ "borderBottomColor": "#e8e9ea",
175
175
  "borderBottomWidth": 1,
176
176
  "marginHorizontal": 4,
177
177
  "maxWidth": "100%",
@@ -188,7 +188,7 @@ exports[`Divider has xsmall marginVertical style 1`] = `
188
188
  style={
189
189
  Array [
190
190
  Object {
191
- "borderBottomColor": "#dadbde",
191
+ "borderBottomColor": "#e8e9ea",
192
192
  "borderBottomWidth": 1,
193
193
  "marginVertical": 4,
194
194
  "maxWidth": "100%",
@@ -0,0 +1,99 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`DragableDrawer renders correctly 1`] = `
4
+ <View
5
+ enableShadow={true}
6
+ pointerEvents="box-none"
7
+ style={
8
+ Array [
9
+ Object {
10
+ "bottom": 0,
11
+ "elevation": 9999,
12
+ "flexDirection": "column-reverse",
13
+ "left": 0,
14
+ "overflow": "hidden",
15
+ "position": "absolute",
16
+ "right": 0,
17
+ "shadowColor": "#001f23",
18
+ "shadowOffset": Object {
19
+ "height": 3,
20
+ "width": 0,
21
+ },
22
+ "shadowOpacity": 0.27,
23
+ "shadowRadius": 4.65,
24
+ "top": 0,
25
+ "zIndex": 9999,
26
+ },
27
+ undefined,
28
+ ]
29
+ }
30
+ testID="drawer"
31
+ >
32
+ <View
33
+ collapsable={false}
34
+ enableShadow={true}
35
+ nativeID="animatedComponent"
36
+ onLayout={[Function]}
37
+ style={
38
+ Object {
39
+ "backgroundColor": "#ffffff",
40
+ "borderTopLeftRadius": 16,
41
+ "borderTopRightRadius": 16,
42
+ "elevation": 10,
43
+ "maxHeight": "100%",
44
+ "overflow": "hidden",
45
+ "transform": Array [
46
+ Object {
47
+ "scaleY": 0,
48
+ },
49
+ Object {
50
+ "translateY": 0,
51
+ },
52
+ ],
53
+ }
54
+ }
55
+ >
56
+ <View
57
+ onMoveShouldSetResponder={[Function]}
58
+ onMoveShouldSetResponderCapture={[Function]}
59
+ onResponderEnd={[Function]}
60
+ onResponderGrant={[Function]}
61
+ onResponderMove={[Function]}
62
+ onResponderReject={[Function]}
63
+ onResponderRelease={[Function]}
64
+ onResponderStart={[Function]}
65
+ onResponderTerminate={[Function]}
66
+ onResponderTerminationRequest={[Function]}
67
+ onStartShouldSetResponder={[Function]}
68
+ onStartShouldSetResponderCapture={[Function]}
69
+ style={
70
+ Array [
71
+ Object {
72
+ "alignItems": "center",
73
+ "backgroundColor": "#ffffff",
74
+ "paddingVertical": 8,
75
+ },
76
+ undefined,
77
+ ]
78
+ }
79
+ >
80
+ <View
81
+ style={
82
+ Array [
83
+ Object {
84
+ "backgroundColor": "#001f23",
85
+ "borderRadius": 4,
86
+ "height": 4,
87
+ "width": 56,
88
+ },
89
+ undefined,
90
+ ]
91
+ }
92
+ />
93
+ </View>
94
+ <Text>
95
+ Drawer Content
96
+ </Text>
97
+ </View>
98
+ </View>
99
+ `;
@@ -0,0 +1,39 @@
1
+ import {
2
+ calculateAnimatedToValue,
3
+ calculateSnapPointsData,
4
+ getOffset,
5
+ } from '../helpers';
6
+
7
+ describe('calculateSnapPointsData', () => {
8
+ it('returns correct values', () => {
9
+ const actual = calculateSnapPointsData(20, 1000, [10, 30, 40, 80]);
10
+ expect(actual).toEqual({
11
+ list: [800, 700, 600, 200, 0],
12
+ minHeightOffset: 800,
13
+ maxHeightOffset: 0,
14
+ });
15
+ });
16
+ });
17
+
18
+ describe('calculateAnimatedToValue', () => {
19
+ it('returns correct value', () => {
20
+ const actual = calculateAnimatedToValue(350, [800, 500, 300, 0]);
21
+ expect(actual).toEqual(300);
22
+ });
23
+ });
24
+
25
+ describe('getOffset', () => {
26
+ it.each`
27
+ percentage | expected
28
+ ${-2} | ${1000}
29
+ ${0} | ${1000}
30
+ ${150} | ${0}
31
+ ${30} | ${700}
32
+ `(
33
+ 'returns $expected when percentage is $percentage',
34
+ ({ percentage, expected }) => {
35
+ const actual = getOffset(1000, percentage);
36
+ expect(actual).toEqual(expected);
37
+ }
38
+ );
39
+ });
@@ -0,0 +1,24 @@
1
+ import React from 'react';
2
+ import { Text } from 'react-native';
3
+ import renderWithTheme from '../../../../testHelpers/renderWithTheme';
4
+ import DragableDrawer from '..';
5
+
6
+ describe('DragableDrawer', () => {
7
+ it('renders correctly', () => {
8
+ const { toJSON, getByTestId } = renderWithTheme(
9
+ <DragableDrawer
10
+ initialHeightPercentage={30}
11
+ minimumHeightPercentage={10}
12
+ onExpanded={jest.fn()}
13
+ onCollapsed={jest.fn()}
14
+ snapPoints={[40, 70]}
15
+ testID="drawer"
16
+ >
17
+ <Text>Drawer Content</Text>
18
+ </DragableDrawer>
19
+ );
20
+
21
+ expect(toJSON()).toMatchSnapshot();
22
+ expect(getByTestId('drawer')).toBeTruthy();
23
+ });
24
+ });
@@ -0,0 +1,43 @@
1
+ export const getOffset = (height: number, percentage: number) => {
2
+ if (percentage < 0) return height;
3
+ if (percentage > 100) return 0;
4
+
5
+ return height * ((100 - percentage) / 100);
6
+ };
7
+
8
+ export type SnapPointsData = {
9
+ list: number[];
10
+ minHeightOffset: number;
11
+ maxHeightOffset: number;
12
+ };
13
+
14
+ export const calculateSnapPointsData = (
15
+ minimumHeight: number,
16
+ height: number,
17
+ snapPoints: number[]
18
+ ): SnapPointsData => {
19
+ const filteredSnapPoints = snapPoints.filter(value => value >= minimumHeight);
20
+ const snapPointsOffsetValues = [
21
+ minimumHeight,
22
+ ...filteredSnapPoints,
23
+ ].map(value => getOffset(height, value));
24
+ const uniqSnapPointOffsetValues = Array.from(
25
+ new Set([...snapPointsOffsetValues, 0])
26
+ );
27
+
28
+ return {
29
+ list: uniqSnapPointOffsetValues,
30
+ minHeightOffset: Math.max(...uniqSnapPointOffsetValues), // Furthest from max height
31
+ maxHeightOffset: 0, // Max height
32
+ };
33
+ };
34
+
35
+ export const calculateAnimatedToValue = (
36
+ position: number,
37
+ heightSnapPoints: number[]
38
+ ) => {
39
+ const distances = heightSnapPoints.map(height => Math.abs(position - height));
40
+
41
+ const minIndex = distances.indexOf(Math.min(...distances));
42
+ return heightSnapPoints[minIndex];
43
+ };