@tactics/toddle-styleguide 0.0.1

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 (220) hide show
  1. package/.expo-shared/assets.json +4 -0
  2. package/.github/workflows/run-tests.yml +16 -0
  3. package/.prettierrc.js +9 -0
  4. package/.yarnrc.yml +1 -0
  5. package/App.tsx +221 -0
  6. package/app.json +33 -0
  7. package/assets/adaptive-icon.png +0 -0
  8. package/assets/components/avatar/baby.png +0 -0
  9. package/assets/favicon.png +0 -0
  10. package/assets/fonts/montserrat/bold.ttf +0 -0
  11. package/assets/fonts/montserrat/regular.ttf +0 -0
  12. package/assets/fonts/source-sans-pro/bold.ttf +0 -0
  13. package/assets/fonts/source-sans-pro/regular.ttf +0 -0
  14. package/assets/icon.png +0 -0
  15. package/assets/splash.png +0 -0
  16. package/babel.config.js +6 -0
  17. package/jest.config.js +22 -0
  18. package/package.json +53 -0
  19. package/src/components/atoms/avatar/__snapshots__/avatar.test.js.snap +85 -0
  20. package/src/components/atoms/avatar/avatar.component.tsx +35 -0
  21. package/src/components/atoms/avatar/avatar.preview.tsx +38 -0
  22. package/src/components/atoms/avatar/avatar.styles.js +55 -0
  23. package/src/components/atoms/avatar/avatar.test.js +22 -0
  24. package/src/components/atoms/button/__snapshots__/button.test.js.snap +307 -0
  25. package/src/components/atoms/button/button.component.tsx +27 -0
  26. package/src/components/atoms/button/button.preview.tsx +34 -0
  27. package/src/components/atoms/button/button.styles.js +25 -0
  28. package/src/components/atoms/button/button.test.js +35 -0
  29. package/src/components/atoms/cancel-link/__snapshots__/cancel-link.test.js.snap +89 -0
  30. package/src/components/atoms/cancel-link/cancel-link.component.tsx +24 -0
  31. package/src/components/atoms/cancel-link/cancel-link.preview.tsx +20 -0
  32. package/src/components/atoms/cancel-link/cancel-link.styles.js +20 -0
  33. package/src/components/atoms/cancel-link/cancel-link.test.js +28 -0
  34. package/src/components/atoms/check-switch/__snapshots__/check-switch.test.js.snap +67 -0
  35. package/src/components/atoms/check-switch/check-switch.component.tsx +46 -0
  36. package/src/components/atoms/check-switch/check-switch.preview.tsx +31 -0
  37. package/src/components/atoms/check-switch/check-switch.styles.js +36 -0
  38. package/src/components/atoms/check-switch/check-switch.test.js +13 -0
  39. package/src/components/atoms/checkbox/__snapshots__/checkbox.test.js.snap +120 -0
  40. package/src/components/atoms/checkbox/checkbox.component.tsx +26 -0
  41. package/src/components/atoms/checkbox/checkbox.preview.tsx +46 -0
  42. package/src/components/atoms/checkbox/checkbox.styles.js +35 -0
  43. package/src/components/atoms/checkbox/checkbox.test.js +30 -0
  44. package/src/components/atoms/child-list-item/__snapshots__/child-list-item.test.js.snap +635 -0
  45. package/src/components/atoms/child-list-item/child-list-item.component.tsx +81 -0
  46. package/src/components/atoms/child-list-item/child-list-item.preview.tsx +65 -0
  47. package/src/components/atoms/child-list-item/child-list-item.styles.js +82 -0
  48. package/src/components/atoms/child-list-item/child-list-item.test.js +73 -0
  49. package/src/components/atoms/contact-item/__snapshots__/contact-item.test.js.snap +321 -0
  50. package/src/components/atoms/contact-item/contact-item.component.tsx +61 -0
  51. package/src/components/atoms/contact-item/contact-item.preview.tsx +30 -0
  52. package/src/components/atoms/contact-item/contact-item.styles.js +26 -0
  53. package/src/components/atoms/contact-item/contact-item.test.js +20 -0
  54. package/src/components/atoms/filter-tab/__snapshots__/filter-tab.test.js.snap +415 -0
  55. package/src/components/atoms/filter-tab/filter-tab.component.tsx +93 -0
  56. package/src/components/atoms/filter-tab/filter-tab.preview.tsx +37 -0
  57. package/src/components/atoms/filter-tab/filter-tab.styles.js +64 -0
  58. package/src/components/atoms/filter-tab/filter-tab.test.js +38 -0
  59. package/src/components/atoms/form-actions/__snapshots__/form-action.test.js.snap +176 -0
  60. package/src/components/atoms/form-actions/form-action.component.tsx +25 -0
  61. package/src/components/atoms/form-actions/form-action.preview.tsx +29 -0
  62. package/src/components/atoms/form-actions/form-action.styles.js +19 -0
  63. package/src/components/atoms/form-actions/form-action.test.js +32 -0
  64. package/src/components/atoms/image-bubble/__snapshots__/image-bubble.test.js.snap +67 -0
  65. package/src/components/atoms/image-bubble/image-bubble.component.tsx +25 -0
  66. package/src/components/atoms/image-bubble/image-bubble.preview.tsx +19 -0
  67. package/src/components/atoms/image-bubble/image-bubble.styles.js +31 -0
  68. package/src/components/atoms/image-bubble/image-bubble.test.js +20 -0
  69. package/src/components/atoms/info/__snapshots__/info.test.js.snap +43 -0
  70. package/src/components/atoms/info/info.component.tsx +22 -0
  71. package/src/components/atoms/info/info.preview.tsx +20 -0
  72. package/src/components/atoms/info/info.styles.js +25 -0
  73. package/src/components/atoms/info/info.test.js +18 -0
  74. package/src/components/atoms/pill/__snapshots__/pill.test.js.snap +141 -0
  75. package/src/components/atoms/pill/pill.component.tsx +23 -0
  76. package/src/components/atoms/pill/pill.preview.tsx +21 -0
  77. package/src/components/atoms/pill/pill.styles.js +32 -0
  78. package/src/components/atoms/pill/pill.test.js +34 -0
  79. package/src/components/atoms/popover/components/backdrop/backdrop.component.tsx +40 -0
  80. package/src/components/atoms/popover/components/backdrop/backdrop.styles.js +15 -0
  81. package/src/components/atoms/popover/components/foreground/foreground.component.tsx +17 -0
  82. package/src/components/atoms/popover/components/foreground/foreground.styles.js +17 -0
  83. package/src/components/atoms/popover/components/index.js +5 -0
  84. package/src/components/atoms/popover/components/modal/close/close.component.tsx +21 -0
  85. package/src/components/atoms/popover/components/modal/close/close.styles.js +13 -0
  86. package/src/components/atoms/popover/components/modal/heading/heading.component.tsx +22 -0
  87. package/src/components/atoms/popover/components/modal/heading/heading.styles.js +24 -0
  88. package/src/components/atoms/popover/components/modal/modal.component.tsx +87 -0
  89. package/src/components/atoms/popover/components/modal/modal.styles.js +23 -0
  90. package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.component.tsx +18 -0
  91. package/src/components/atoms/popover/components/modal/scroll-content/scroll-content.styles.js +10 -0
  92. package/src/components/atoms/popover/popover.component.tsx +60 -0
  93. package/src/components/atoms/popover/popover.preview.tsx +135 -0
  94. package/src/components/atoms/popover/popover.styles.js +12 -0
  95. package/src/components/atoms/popover-heading/__snapshots__/popover_heading.test.js.snap +35 -0
  96. package/src/components/atoms/popover-heading/popover-heading.component.tsx +22 -0
  97. package/src/components/atoms/popover-heading/popover-heading.preview.tsx +18 -0
  98. package/src/components/atoms/popover-heading/popover-heading.styles.js +19 -0
  99. package/src/components/atoms/popover-heading/popover_heading.test.js +11 -0
  100. package/src/components/atoms/pressable-icon/__snapshots__/pressable-icon.test.js.snap +364 -0
  101. package/src/components/atoms/pressable-icon/pressable-icon.component.tsx +48 -0
  102. package/src/components/atoms/pressable-icon/pressable-icon.preview.tsx +37 -0
  103. package/src/components/atoms/pressable-icon/pressable-icon.styles.js +25 -0
  104. package/src/components/atoms/pressable-icon/pressable-icon.test.js +47 -0
  105. package/src/components/atoms/quick-filter/__snapshots__/quick-filter.test.js.snap +465 -0
  106. package/src/components/atoms/quick-filter/quick-filter.component.tsx +32 -0
  107. package/src/components/atoms/quick-filter/quick-filter.prevriew.tsx +46 -0
  108. package/src/components/atoms/quick-filter/quick-filter.styles.js +68 -0
  109. package/src/components/atoms/quick-filter/quick-filter.test.js +127 -0
  110. package/src/components/atoms/select-list-item/__snapshots__/select-list-item.test.js.snap +391 -0
  111. package/src/components/atoms/select-list-item/select-list-item-preview.tsx +31 -0
  112. package/src/components/atoms/select-list-item/select-list-item.test.js +38 -0
  113. package/src/components/atoms/select-list-item/select-list.component-item.tsx +52 -0
  114. package/src/components/atoms/select-list-item/select-list.styles-item.js +40 -0
  115. package/src/components/atoms/snackbar/__snapshots__/snackbar.test.js.snap +493 -0
  116. package/src/components/atoms/snackbar/snackbar.component.tsx +28 -0
  117. package/src/components/atoms/snackbar/snackbar.preview.tsx +33 -0
  118. package/src/components/atoms/snackbar/snackbar.styles.js +82 -0
  119. package/src/components/atoms/snackbar/snackbar.test.js +35 -0
  120. package/src/components/atoms/tag/__snapshots__/tag.test.js.snap +87 -0
  121. package/src/components/atoms/tag/tag.component.tsx +37 -0
  122. package/src/components/atoms/tag/tag.preview.tsx +27 -0
  123. package/src/components/atoms/tag/tag.styles.js +22 -0
  124. package/src/components/atoms/tag/tag.test.js +24 -0
  125. package/src/components/atoms/text-bubble/__snapshots__/text-bubble.test.js.snap +337 -0
  126. package/src/components/atoms/text-bubble/text-bubble.component.tsx +32 -0
  127. package/src/components/atoms/text-bubble/text-bubble.preview.tsx +27 -0
  128. package/src/components/atoms/text-bubble/text-bubble.styles.js +64 -0
  129. package/src/components/atoms/text-bubble/text-bubble.test.js +84 -0
  130. package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +68 -0
  131. package/src/components/atoms/text-input/text-input.component.tsx +32 -0
  132. package/src/components/atoms/text-input/text-input.preview.tsx +24 -0
  133. package/src/components/atoms/text-input/text-input.styles.js +26 -0
  134. package/src/components/atoms/text-input/text-input.test.js +32 -0
  135. package/src/components/atoms/time-tracker/__snapshots__/time-tracker.test.js.snap +206 -0
  136. package/src/components/atoms/time-tracker/time-tracker.component.tsx +24 -0
  137. package/src/components/atoms/time-tracker/time-tracker.preview.tsx +15 -0
  138. package/src/components/atoms/time-tracker/time-tracker.styles.js +36 -0
  139. package/src/components/atoms/time-tracker/time-tracker.test.js +37 -0
  140. package/src/components/atoms/wide-button/__snapshots__/wide-button.test.js.snap +92 -0
  141. package/src/components/atoms/wide-button/wide-button.component.tsx +23 -0
  142. package/src/components/atoms/wide-button/wide-button.preview.tsx +18 -0
  143. package/src/components/atoms/wide-button/wide-button.styles.js +22 -0
  144. package/src/components/atoms/wide-button/wide-button.test.js +16 -0
  145. package/src/context/theme.context.ts +49 -0
  146. package/src/gradients/main/main.gradient.tsx +20 -0
  147. package/src/gradients/main/main.styles.js +11 -0
  148. package/src/icons/__snapshots__/icons.test.js.snap +2588 -0
  149. package/src/icons/icons.test.js +245 -0
  150. package/src/icons/index.tsx +7 -0
  151. package/src/icons/outline/calendar/calendar.icon.tsx +20 -0
  152. package/src/icons/outline/chat/chat.icon.tsx +20 -0
  153. package/src/icons/outline/chat-alt/chat-alt.icon.tsx +20 -0
  154. package/src/icons/outline/check-circle/check-circle.icon.tsx +20 -0
  155. package/src/icons/outline/chevron-left/chevron-left.icon.tsx +20 -0
  156. package/src/icons/outline/chevron-right/chevron-right.icon.tsx +20 -0
  157. package/src/icons/outline/clock/clock.icon.tsx +20 -0
  158. package/src/icons/outline/cloud-download/cloud-download.icon.tsx +20 -0
  159. package/src/icons/outline/cross/cross.icon.tsx +20 -0
  160. package/src/icons/outline/currency-euro/currency-euro.icon.tsx +20 -0
  161. package/src/icons/outline/document-text/document-text.icon.tsx +20 -0
  162. package/src/icons/outline/exclamation/exclamation.icon.tsx +20 -0
  163. package/src/icons/outline/exclamation-circle/exclamation-circle.icon.tsx +20 -0
  164. package/src/icons/outline/eye/eye.icon.tsx +27 -0
  165. package/src/icons/outline/filter/filter.icon.tsx +59 -0
  166. package/src/icons/outline/information-circle/information-circle.icon.tsx +20 -0
  167. package/src/icons/outline/logout/logout.icon.tsx +20 -0
  168. package/src/icons/outline/mail/mail.icon.tsx +20 -0
  169. package/src/icons/outline/mail-open/mail-open.icon.tsx +20 -0
  170. package/src/icons/outline/menu/menu.icon.tsx +20 -0
  171. package/src/icons/outline/minus-sm/minus-sm.icon.tsx +20 -0
  172. package/src/icons/outline/office-building/office-building.icon.tsx +20 -0
  173. package/src/icons/outline/outline-default.preview.tsx +99 -0
  174. package/src/icons/outline/outline-grey.preview.tsx +100 -0
  175. package/src/icons/outline/outline-white.preview.tsx +100 -0
  176. package/src/icons/outline/outline.tsx +81 -0
  177. package/src/icons/outline/paper-airplane/paper-airplane.icon.tsx +20 -0
  178. package/src/icons/outline/paperclip/paperclip.icon.tsx +20 -0
  179. package/src/icons/outline/pencil/pencil.icon.tsx +20 -0
  180. package/src/icons/outline/phone/phone.icon.tsx +20 -0
  181. package/src/icons/outline/plus/plus.icon.tsx +20 -0
  182. package/src/icons/outline/plus-sm/plus-sm.icon.tsx +20 -0
  183. package/src/icons/outline/qrcode/qrcode.icon.tsx +17 -0
  184. package/src/icons/outline/refresh/refresh.icon.tsx +20 -0
  185. package/src/icons/outline/search/search.icon.tsx +20 -0
  186. package/src/icons/outline/selector/selector.icon.tsx +20 -0
  187. package/src/icons/outline/sm-view-grid-add/sm-view-grid-add.icon.tsx +20 -0
  188. package/src/icons/outline/status-online/status-online.icon.tsx +20 -0
  189. package/src/icons/outline/thumb-up/thumb-up.icon.tsx +20 -0
  190. package/src/icons/outline/trash/trash.icon.tsx +20 -0
  191. package/src/icons/outline/user/user.icon.tsx +27 -0
  192. package/src/icons/outline/user-group/user-group.icon.tsx +20 -0
  193. package/src/icons/outline/users/users.icon.tsx +20 -0
  194. package/src/icons/solid/chat-alt/chat-alt-solid.icon.tsx +20 -0
  195. package/src/icons/solid/clock/clock-solid.icon.tsx +20 -0
  196. package/src/icons/solid/information-circle/information-circle-solid.icon.tsx +20 -0
  197. package/src/icons/solid/pencil/pencil-solid.icon.tsx +22 -0
  198. package/src/icons/solid/phone/phone-solid.icon.tsx +18 -0
  199. package/src/icons/solid/refresh/refresh-solid.icon.tsx +20 -0
  200. package/src/icons/solid/solid.preview.tsx +73 -0
  201. package/src/icons/solid/solid.tsx +19 -0
  202. package/src/icons/solid/status-online/status-online-solid.icon.tsx +24 -0
  203. package/src/icons/solid/trash/trash-solid.icon.tsx +20 -0
  204. package/src/models/hex-color.model.ts +25 -0
  205. package/src/models/hex-color.test.js +20 -0
  206. package/src/models/initials.model.ts +32 -0
  207. package/src/models/initials.test.js +23 -0
  208. package/src/theme/font/font.ts +72 -0
  209. package/src/theme/font/index.ts +4 -0
  210. package/src/theme/font/load-fonts.ts +10 -0
  211. package/src/theme/provider/index.ts +4 -0
  212. package/src/theme/provider/parent.theme.ts +45 -0
  213. package/src/theme/provider/staff-member.theme.ts +45 -0
  214. package/src/theme/scale/index.ts +14 -0
  215. package/src/types/bubble-alignment.enum.ts +4 -0
  216. package/src/types/icontype.type.ts +3 -0
  217. package/src/types/keyboard-types.enum.ts +9 -0
  218. package/src/types/size.enum.ts +5 -0
  219. package/src/types/visual-state.enum.ts +6 -0
  220. package/tsconfig.json +7 -0
@@ -0,0 +1,25 @@
1
+ import {StyleSheet} from 'react-native';
2
+ import {Scale} from '../../../theme/scale';
3
+
4
+ export const Stylesheet = (context, disabled) =>
5
+ StyleSheet.create({
6
+ container: {
7
+ flexDirection: 'row',
8
+ justifyContent: 'center',
9
+ alignItems: 'center',
10
+ borderRadius: 50,
11
+ width: 50,
12
+ height: 50,
13
+ padding: Scale.s,
14
+ },
15
+ backgroundDefault: {
16
+ backgroundColor: disabled
17
+ ? context.colors.ui.lightgrey
18
+ : context.colors.main['9'],
19
+ },
20
+ backgroundInverted: {
21
+ backgroundColor: disabled
22
+ ? context.colors.ui.lightgrey
23
+ : context.colors.main['0'],
24
+ },
25
+ });
@@ -0,0 +1,47 @@
1
+ import React from 'react';
2
+ import render from 'react-test-renderer';
3
+ import {PressableIcon} from './pressable-icon.component';
4
+ import {Icon} from '../../../icons';
5
+
6
+ describe('pressable-icon test', () => {
7
+ it('render a default pressable icon', function () {
8
+ const tree = render
9
+ .create(<PressableIcon icon={<Icon.Outline.ThumbUp key="default" />} />)
10
+ .toJSON();
11
+ expect(tree).toMatchSnapshot();
12
+ });
13
+ it('render a default disabled pressable icon', () => {
14
+ const tree = render
15
+ .create(
16
+ <PressableIcon
17
+ icon={<Icon.Outline.Mail key="disabled" />}
18
+ disabled={true}
19
+ />
20
+ )
21
+ .toJSON();
22
+ expect(tree).toMatchSnapshot();
23
+ });
24
+ it('render an inverted pressable icon', () => {
25
+ const tree = render
26
+ .create(
27
+ <PressableIcon
28
+ icon={<Icon.Outline.Filter key="inverted" />}
29
+ inverted={true}
30
+ />
31
+ )
32
+ .toJSON();
33
+ expect(tree).toMatchSnapshot();
34
+ });
35
+ it('render an inverted pressable icon that is disabled', () => {
36
+ const tree = render
37
+ .create(
38
+ <PressableIcon
39
+ icon={<Icon.Solid.Trash key="disabled inverted" />}
40
+ inverted={true}
41
+ disabled={true}
42
+ />
43
+ )
44
+ .toJSON();
45
+ expect(tree).toMatchSnapshot();
46
+ });
47
+ });
@@ -0,0 +1,465 @@
1
+ // Jest Snapshot v1, https://goo.gl/fbAQLP
2
+
3
+ exports[`test quick filter given the visual state is default AND isSelected is false ,return a white circle with a bleu border and a blue number 1`] = `
4
+ <View
5
+ accessible={true}
6
+ collapsable={false}
7
+ focusable={true}
8
+ onBlur={[Function]}
9
+ onClick={[Function]}
10
+ onFocus={[Function]}
11
+ onResponderGrant={[Function]}
12
+ onResponderMove={[Function]}
13
+ onResponderRelease={[Function]}
14
+ onResponderTerminate={[Function]}
15
+ onResponderTerminationRequest={[Function]}
16
+ onStartShouldSetResponder={[Function]}
17
+ style={
18
+ [
19
+ {
20
+ "alignItems": "center",
21
+ "borderRadius": 50,
22
+ "borderStyle": "solid",
23
+ "borderWidth": 2,
24
+ "height": 48,
25
+ "justifyContent": "center",
26
+ "overflow": "hidden",
27
+ "width": 48,
28
+ },
29
+ {
30
+ "backgroundColor": "#FFFFFF",
31
+ "borderColor": "#19216C",
32
+ },
33
+ false,
34
+ false,
35
+ false,
36
+ ]
37
+ }
38
+ >
39
+ <Text
40
+ style={
41
+ [
42
+ {
43
+ "fontFamily": "MontserratBold",
44
+ "fontSize": 14,
45
+ "lineHeight": 22.4,
46
+ },
47
+ {
48
+ "color": "#19216C",
49
+ },
50
+ false,
51
+ false,
52
+ false,
53
+ ]
54
+ }
55
+ >
56
+ 3
57
+ </Text>
58
+ </View>
59
+ `;
60
+
61
+ exports[`test quick filter given the visual state is default AND isSelected is true ,return a blue circle with a white number 1`] = `
62
+ <View
63
+ accessible={true}
64
+ collapsable={false}
65
+ focusable={true}
66
+ onBlur={[Function]}
67
+ onClick={[Function]}
68
+ onFocus={[Function]}
69
+ onResponderGrant={[Function]}
70
+ onResponderMove={[Function]}
71
+ onResponderRelease={[Function]}
72
+ onResponderTerminate={[Function]}
73
+ onResponderTerminationRequest={[Function]}
74
+ onStartShouldSetResponder={[Function]}
75
+ style={
76
+ [
77
+ {
78
+ "alignItems": "center",
79
+ "borderRadius": 50,
80
+ "borderStyle": "solid",
81
+ "borderWidth": 2,
82
+ "height": 48,
83
+ "justifyContent": "center",
84
+ "overflow": "hidden",
85
+ "width": 48,
86
+ },
87
+ {
88
+ "backgroundColor": "#35469C",
89
+ "borderColor": "#19216C",
90
+ },
91
+ false,
92
+ false,
93
+ false,
94
+ ]
95
+ }
96
+ >
97
+ <Text
98
+ style={
99
+ [
100
+ {
101
+ "fontFamily": "MontserratBold",
102
+ "fontSize": 14,
103
+ "lineHeight": 22.4,
104
+ },
105
+ {
106
+ "color": "#FFFFFF",
107
+ },
108
+ false,
109
+ false,
110
+ false,
111
+ ]
112
+ }
113
+ >
114
+ 3
115
+ </Text>
116
+ </View>
117
+ `;
118
+
119
+ exports[`test quick filter given the visual state is error AND isSelected is false ,return a white circle with a red border and a red number 1`] = `
120
+ <View
121
+ accessible={true}
122
+ collapsable={false}
123
+ focusable={true}
124
+ onBlur={[Function]}
125
+ onClick={[Function]}
126
+ onFocus={[Function]}
127
+ onResponderGrant={[Function]}
128
+ onResponderMove={[Function]}
129
+ onResponderRelease={[Function]}
130
+ onResponderTerminate={[Function]}
131
+ onResponderTerminationRequest={[Function]}
132
+ onStartShouldSetResponder={[Function]}
133
+ style={
134
+ [
135
+ {
136
+ "alignItems": "center",
137
+ "borderRadius": 50,
138
+ "borderStyle": "solid",
139
+ "borderWidth": 2,
140
+ "height": 48,
141
+ "justifyContent": "center",
142
+ "overflow": "hidden",
143
+ "width": 48,
144
+ },
145
+ {
146
+ "backgroundColor": "#FFFFFF",
147
+ "borderColor": "#19216C",
148
+ },
149
+ false,
150
+ false,
151
+ false,
152
+ ]
153
+ }
154
+ >
155
+ <Text
156
+ style={
157
+ [
158
+ {
159
+ "fontFamily": "MontserratBold",
160
+ "fontSize": 14,
161
+ "lineHeight": 22.4,
162
+ },
163
+ {
164
+ "color": "#19216C",
165
+ },
166
+ false,
167
+ false,
168
+ false,
169
+ ]
170
+ }
171
+ >
172
+ 3
173
+ </Text>
174
+ </View>
175
+ `;
176
+
177
+ exports[`test quick filter given the visual state is error AND isSelected is true ,return a red circle with a white number 1`] = `
178
+ <View
179
+ accessible={true}
180
+ collapsable={false}
181
+ focusable={true}
182
+ onBlur={[Function]}
183
+ onClick={[Function]}
184
+ onFocus={[Function]}
185
+ onResponderGrant={[Function]}
186
+ onResponderMove={[Function]}
187
+ onResponderRelease={[Function]}
188
+ onResponderTerminate={[Function]}
189
+ onResponderTerminationRequest={[Function]}
190
+ onStartShouldSetResponder={[Function]}
191
+ style={
192
+ [
193
+ {
194
+ "alignItems": "center",
195
+ "borderRadius": 50,
196
+ "borderStyle": "solid",
197
+ "borderWidth": 2,
198
+ "height": 48,
199
+ "justifyContent": "center",
200
+ "overflow": "hidden",
201
+ "width": 48,
202
+ },
203
+ {
204
+ "backgroundColor": "#35469C",
205
+ "borderColor": "#19216C",
206
+ },
207
+ false,
208
+ false,
209
+ false,
210
+ ]
211
+ }
212
+ >
213
+ <Text
214
+ style={
215
+ [
216
+ {
217
+ "fontFamily": "MontserratBold",
218
+ "fontSize": 14,
219
+ "lineHeight": 22.4,
220
+ },
221
+ {
222
+ "color": "#FFFFFF",
223
+ },
224
+ false,
225
+ false,
226
+ false,
227
+ ]
228
+ }
229
+ >
230
+ 3
231
+ </Text>
232
+ </View>
233
+ `;
234
+
235
+ exports[`test quick filter given the visual state is success AND isSelected is false ,return a white circle with a green border and a green number 1`] = `
236
+ <View
237
+ accessible={true}
238
+ collapsable={false}
239
+ focusable={true}
240
+ onBlur={[Function]}
241
+ onClick={[Function]}
242
+ onFocus={[Function]}
243
+ onResponderGrant={[Function]}
244
+ onResponderMove={[Function]}
245
+ onResponderRelease={[Function]}
246
+ onResponderTerminate={[Function]}
247
+ onResponderTerminationRequest={[Function]}
248
+ onStartShouldSetResponder={[Function]}
249
+ style={
250
+ [
251
+ {
252
+ "alignItems": "center",
253
+ "borderRadius": 50,
254
+ "borderStyle": "solid",
255
+ "borderWidth": 2,
256
+ "height": 48,
257
+ "justifyContent": "center",
258
+ "overflow": "hidden",
259
+ "width": 48,
260
+ },
261
+ {
262
+ "backgroundColor": "#FFFFFF",
263
+ "borderColor": "#19216C",
264
+ },
265
+ false,
266
+ false,
267
+ false,
268
+ ]
269
+ }
270
+ >
271
+ <Text
272
+ style={
273
+ [
274
+ {
275
+ "fontFamily": "MontserratBold",
276
+ "fontSize": 14,
277
+ "lineHeight": 22.4,
278
+ },
279
+ {
280
+ "color": "#19216C",
281
+ },
282
+ false,
283
+ false,
284
+ false,
285
+ ]
286
+ }
287
+ >
288
+ 3
289
+ </Text>
290
+ </View>
291
+ `;
292
+
293
+ exports[`test quick filter given the visual state is success AND isSelected is true ,return a green circle with a white number 1`] = `
294
+ <View
295
+ accessible={true}
296
+ collapsable={false}
297
+ focusable={true}
298
+ onBlur={[Function]}
299
+ onClick={[Function]}
300
+ onFocus={[Function]}
301
+ onResponderGrant={[Function]}
302
+ onResponderMove={[Function]}
303
+ onResponderRelease={[Function]}
304
+ onResponderTerminate={[Function]}
305
+ onResponderTerminationRequest={[Function]}
306
+ onStartShouldSetResponder={[Function]}
307
+ style={
308
+ [
309
+ {
310
+ "alignItems": "center",
311
+ "borderRadius": 50,
312
+ "borderStyle": "solid",
313
+ "borderWidth": 2,
314
+ "height": 48,
315
+ "justifyContent": "center",
316
+ "overflow": "hidden",
317
+ "width": 48,
318
+ },
319
+ {
320
+ "backgroundColor": "#35469C",
321
+ "borderColor": "#19216C",
322
+ },
323
+ false,
324
+ false,
325
+ false,
326
+ ]
327
+ }
328
+ >
329
+ <Text
330
+ style={
331
+ [
332
+ {
333
+ "fontFamily": "MontserratBold",
334
+ "fontSize": 14,
335
+ "lineHeight": 22.4,
336
+ },
337
+ {
338
+ "color": "#FFFFFF",
339
+ },
340
+ false,
341
+ false,
342
+ false,
343
+ ]
344
+ }
345
+ >
346
+ 3
347
+ </Text>
348
+ </View>
349
+ `;
350
+
351
+ exports[`test quick filter given the visual state is warning AND isSelected is false ,return a white circle with an orange border and an orange number 1`] = `
352
+ <View
353
+ accessible={true}
354
+ collapsable={false}
355
+ focusable={true}
356
+ onBlur={[Function]}
357
+ onClick={[Function]}
358
+ onFocus={[Function]}
359
+ onResponderGrant={[Function]}
360
+ onResponderMove={[Function]}
361
+ onResponderRelease={[Function]}
362
+ onResponderTerminate={[Function]}
363
+ onResponderTerminationRequest={[Function]}
364
+ onStartShouldSetResponder={[Function]}
365
+ style={
366
+ [
367
+ {
368
+ "alignItems": "center",
369
+ "borderRadius": 50,
370
+ "borderStyle": "solid",
371
+ "borderWidth": 2,
372
+ "height": 48,
373
+ "justifyContent": "center",
374
+ "overflow": "hidden",
375
+ "width": 48,
376
+ },
377
+ {
378
+ "backgroundColor": "#FFFFFF",
379
+ "borderColor": "#19216C",
380
+ },
381
+ false,
382
+ false,
383
+ false,
384
+ ]
385
+ }
386
+ >
387
+ <Text
388
+ style={
389
+ [
390
+ {
391
+ "fontFamily": "MontserratBold",
392
+ "fontSize": 14,
393
+ "lineHeight": 22.4,
394
+ },
395
+ {
396
+ "color": "#19216C",
397
+ },
398
+ false,
399
+ false,
400
+ false,
401
+ ]
402
+ }
403
+ >
404
+ 3
405
+ </Text>
406
+ </View>
407
+ `;
408
+
409
+ exports[`test quick filter given the visual state is warning AND isSelected is true ,return an orange circle with a white number 1`] = `
410
+ <View
411
+ accessible={true}
412
+ collapsable={false}
413
+ focusable={true}
414
+ onBlur={[Function]}
415
+ onClick={[Function]}
416
+ onFocus={[Function]}
417
+ onResponderGrant={[Function]}
418
+ onResponderMove={[Function]}
419
+ onResponderRelease={[Function]}
420
+ onResponderTerminate={[Function]}
421
+ onResponderTerminationRequest={[Function]}
422
+ onStartShouldSetResponder={[Function]}
423
+ style={
424
+ [
425
+ {
426
+ "alignItems": "center",
427
+ "borderRadius": 50,
428
+ "borderStyle": "solid",
429
+ "borderWidth": 2,
430
+ "height": 48,
431
+ "justifyContent": "center",
432
+ "overflow": "hidden",
433
+ "width": 48,
434
+ },
435
+ {
436
+ "backgroundColor": "#35469C",
437
+ "borderColor": "#19216C",
438
+ },
439
+ false,
440
+ false,
441
+ false,
442
+ ]
443
+ }
444
+ >
445
+ <Text
446
+ style={
447
+ [
448
+ {
449
+ "fontFamily": "MontserratBold",
450
+ "fontSize": 14,
451
+ "lineHeight": 22.4,
452
+ },
453
+ {
454
+ "color": "#FFFFFF",
455
+ },
456
+ false,
457
+ false,
458
+ false,
459
+ ]
460
+ }
461
+ >
462
+ 3
463
+ </Text>
464
+ </View>
465
+ `;
@@ -0,0 +1,32 @@
1
+ import React, {useContext} from 'react';
2
+ import {Pressable, Text} from 'react-native';
3
+ import {ThemeCtx} from '../../../context/theme.context';
4
+ import {VisualState} from '../../../types/visual-state.enum';
5
+ import {Stylesheet} from './quick-filter.styles';
6
+
7
+ type QuickFilterProps = {
8
+ id: string;
9
+ amount: number;
10
+ isSelected?: boolean;
11
+ onSelect: (id: string) => void;
12
+ visualState: VisualState;
13
+ };
14
+
15
+ const QuickFilter = ({
16
+ id,
17
+ amount,
18
+ isSelected,
19
+ onSelect,
20
+ visualState,
21
+ }: QuickFilterProps) => {
22
+ const context = useContext(ThemeCtx);
23
+ const styles = Stylesheet(context, visualState, isSelected);
24
+
25
+ return (
26
+ <Pressable onPress={() => onSelect(id)} style={styles.container}>
27
+ <Text style={styles.text}>{amount}</Text>
28
+ </Pressable>
29
+ );
30
+ };
31
+
32
+ export {QuickFilter as QuickFilter};
@@ -0,0 +1,46 @@
1
+ import React, {useState} from 'react';
2
+ import {VisualState} from '../../../types/visual-state.enum';
3
+ import {QuickFilter} from './quick-filter.component';
4
+ import {View} from 'react-native';
5
+
6
+ export const QuickFilterPreview = ({}: {}) => {
7
+ const [quickFilterIsSelected, setQuickFilterIsSelected] = useState(false);
8
+
9
+ const onClick = (id: string) => {
10
+ setQuickFilterIsSelected((current) => !current);
11
+ console.log('selected=', quickFilterIsSelected, 'id=', id);
12
+ };
13
+
14
+ return (
15
+ <View>
16
+ <QuickFilter
17
+ id={'1'}
18
+ amount={6}
19
+ onSelect={onClick}
20
+ visualState={VisualState.DEFAULT}
21
+ isSelected={quickFilterIsSelected}
22
+ />
23
+ <QuickFilter
24
+ id={'22'}
25
+ amount={60}
26
+ onSelect={onClick}
27
+ visualState={VisualState.SUCCESS}
28
+ isSelected={!quickFilterIsSelected}
29
+ />
30
+ <QuickFilter
31
+ id={'3'}
32
+ amount={3}
33
+ onSelect={onClick}
34
+ visualState={VisualState.ERROR}
35
+ isSelected={quickFilterIsSelected}
36
+ />
37
+ <QuickFilter
38
+ id={'4'}
39
+ amount={44}
40
+ onSelect={onClick}
41
+ visualState={VisualState.WARNING}
42
+ isSelected={!quickFilterIsSelected}
43
+ />
44
+ </View>
45
+ );
46
+ };
@@ -0,0 +1,68 @@
1
+ import React from 'react';
2
+ import {StyleSheet} from 'react-native';
3
+ import {VisualState} from '../../../types/visual-state.enum';
4
+ import {Scale} from '../../../theme/scale';
5
+ import {Font} from '../../../theme/font';
6
+
7
+ export const Stylesheet = (context, visualState, isSelected) =>
8
+ StyleSheet.create({
9
+ container: [
10
+ {
11
+ alignItems: 'center',
12
+ justifyContent: 'center',
13
+ borderRadius: 50,
14
+ borderStyle: 'solid',
15
+ borderWidth: 2,
16
+ overflow: 'hidden',
17
+ width: Scale.xxl,
18
+ height: Scale.xxl,
19
+ },
20
+ visualState === VisualState.DEFAULT && {
21
+ backgroundColor: isSelected
22
+ ? context.colors.main['2']
23
+ : context.colors.ui.white,
24
+ borderColor: context.colors.main['0'],
25
+ },
26
+ visualState === VisualState.WARNING && {
27
+ backgroundColor: isSelected
28
+ ? context.colors.ui.warning.default
29
+ : context.colors.ui.white,
30
+ borderColor: context.colors.ui.warning.dark,
31
+ },
32
+ visualState === VisualState.ERROR && {
33
+ backgroundColor: isSelected
34
+ ? context.colors.ui.error.default
35
+ : context.colors.ui.white,
36
+ borderColor: context.colors.ui.error.dark,
37
+ },
38
+ visualState === VisualState.SUCCESS && {
39
+ backgroundColor: isSelected
40
+ ? context.colors.ui.success.default
41
+ : context.colors.ui.white,
42
+ borderColor: context.colors.ui.success.dark,
43
+ },
44
+ ],
45
+ text: [
46
+ {
47
+ ...Font.regularBold,
48
+ },
49
+ visualState === VisualState.DEFAULT && {
50
+ color: isSelected ? context.colors.ui.white : context.colors.main['0'],
51
+ },
52
+ visualState === VisualState.WARNING && {
53
+ color: isSelected
54
+ ? context.colors.ui.white
55
+ : context.colors.ui.warning.dark,
56
+ },
57
+ visualState === VisualState.ERROR && {
58
+ color: isSelected
59
+ ? context.colors.ui.white
60
+ : context.colors.ui.error.dark,
61
+ },
62
+ visualState === VisualState.SUCCESS && {
63
+ color: isSelected
64
+ ? context.colors.ui.white
65
+ : context.colors.ui.success.dark,
66
+ },
67
+ ],
68
+ });