@tactics/toddle-styleguide 1.2.1 → 1.2.3

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 (236) hide show
  1. package/App.d.ts +0 -1
  2. package/App.tsx +15 -7
  3. package/index.d.ts +3 -2
  4. package/index.tsx +4 -2
  5. package/package.json +30 -26
  6. package/src/components/atoms/animated-wave/animated-wave.component.d.ts +0 -1
  7. package/src/components/atoms/backdrop/backdrop.component.d.ts +0 -1
  8. package/src/components/atoms/background-gradient/background-gradient.component.d.ts +0 -1
  9. package/src/components/atoms/background-gradient/background-gradient.preview.d.ts +0 -1
  10. package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +234 -234
  11. package/src/components/atoms/calendar/calendar.component.d.ts +0 -1
  12. package/src/components/atoms/calendar/calendar.component.tsx +8 -6
  13. package/src/components/atoms/calendar/calendar.preview.d.ts +0 -1
  14. package/src/components/atoms/check-switch/check-switch.component.d.ts +0 -1
  15. package/src/components/atoms/check-switch/check-switch.preview.d.ts +0 -1
  16. package/src/components/atoms/footer/footer.preview.d.ts +0 -1
  17. package/src/components/atoms/footer/footer.preview.tsx +0 -3
  18. package/src/components/atoms/heading-components/all-caps-heading/all-caps-heading.component.d.ts +0 -1
  19. package/src/components/atoms/heading-components/heading1/heading1.component.d.ts +0 -1
  20. package/src/components/atoms/heading-components/heading2/heading2.component.d.ts +0 -1
  21. package/src/components/atoms/heading-components/heading3/heading3.component.d.ts +0 -1
  22. package/src/components/atoms/heading-components/heading4/heading4.component.d.ts +0 -1
  23. package/src/components/atoms/heading-components/headings.preview.d.ts +0 -1
  24. package/src/components/atoms/image-bubble/image-bubble.component.d.ts +0 -1
  25. package/src/components/atoms/image-bubble/image-bubble.preview.d.ts +0 -1
  26. package/src/components/atoms/increment-input/increment-input.component.d.ts +0 -1
  27. package/src/components/atoms/increment-input/increment-input.preview.d.ts +0 -1
  28. package/src/components/atoms/logo/logo.component.d.ts +0 -1
  29. package/src/components/atoms/logo/logo.preview.d.ts +0 -1
  30. package/src/components/atoms/paragraph-components/paragraph/paragraph.component.d.ts +0 -1
  31. package/src/components/atoms/paragraph-components/paragraph-components.preview.d.ts +0 -1
  32. package/src/components/atoms/paragraph-components/small-text/small-text.component.d.ts +0 -1
  33. package/src/components/atoms/paragraph-components/tiny-text/tiny-text.component.d.ts +0 -1
  34. package/src/components/atoms/split-container/split-container.preview.d.ts +0 -1
  35. package/src/components/atoms/static-wave/static-wave.component.d.ts +0 -1
  36. package/src/components/atoms/text-input/text-input.component.d.ts +0 -1
  37. package/src/components/atoms/text-input/text-input.preview.d.ts +0 -1
  38. package/src/components/molecules/avatar/avatar.component.d.ts +0 -1
  39. package/src/components/molecules/avatar/avatar.preview.d.ts +0 -1
  40. package/src/components/molecules/blocked-message/blocked-message.component.d.ts +0 -1
  41. package/src/components/molecules/blocked-message/blocked-message.preview.d.ts +0 -1
  42. package/src/components/molecules/button/button.component.d.ts +0 -1
  43. package/src/components/molecules/button/button.preview.d.ts +0 -1
  44. package/src/components/molecules/calendar-select/calendar-select.component.d.ts +2 -3
  45. package/src/components/molecules/calendar-select/calendar-select.component.tsx +4 -14
  46. package/src/components/molecules/calendar-select/calendar-select.preview.d.ts +0 -1
  47. package/src/components/molecules/calendar-select/calendar-select.preview.tsx +9 -22
  48. package/src/components/molecules/cancel-link/cancel-link.component.d.ts +0 -1
  49. package/src/components/molecules/cancel-link/cancel-link.preview.d.ts +0 -1
  50. package/src/components/molecules/checkbox/checkbox.component.d.ts +0 -1
  51. package/src/components/molecules/checkbox/checkbox.preview.d.ts +0 -1
  52. package/src/components/molecules/contact-role/contact-role.component.d.ts +0 -1
  53. package/src/components/molecules/contact-role/contact-role.preview.d.ts +0 -1
  54. package/src/components/molecules/date-input/date-input.component.d.ts +0 -1
  55. package/src/components/molecules/date-input/date-input.preview.d.ts +0 -1
  56. package/src/components/molecules/day/day.component.d.ts +0 -1
  57. package/src/components/molecules/default-select/default-select.component.d.ts +0 -1
  58. package/src/components/molecules/default-select/default-select.preview.d.ts +0 -1
  59. package/src/components/molecules/department_logo/department-logo.component.d.ts +0 -1
  60. package/src/components/molecules/department_logo/department-logo.preview.d.ts +0 -1
  61. package/src/components/molecules/failed-to-send/failed-bubble.component.d.ts +0 -1
  62. package/src/components/molecules/filter-range/filter-range.component.d.ts +0 -1
  63. package/src/components/molecules/filter-range/filter-range.preview.d.ts +0 -1
  64. package/src/components/molecules/filter-tab/filter-tab.component.d.ts +0 -1
  65. package/src/components/molecules/filter-tab/filter-tab.preview.d.ts +0 -1
  66. package/src/components/molecules/info/info.component.d.ts +0 -1
  67. package/src/components/molecules/info/info.preview.d.ts +0 -1
  68. package/src/components/molecules/language-button/language-button.component.d.ts +0 -1
  69. package/src/components/molecules/language-button/language-button.preview.d.ts +0 -1
  70. package/src/components/molecules/message-input/message-input.component.d.ts +0 -1
  71. package/src/components/molecules/message-input/message-input.preview.d.ts +0 -1
  72. package/src/components/molecules/more-info-button/more-info-button.component.d.ts +0 -1
  73. package/src/components/molecules/more-info-button/more-info-button.preview.d.ts +0 -1
  74. package/src/components/molecules/password-input/password-input.component.d.ts +0 -1
  75. package/src/components/molecules/password-input/password-input.preview.d.ts +0 -1
  76. package/src/components/molecules/pill/pill.component.d.ts +0 -1
  77. package/src/components/molecules/pill/pill.preview.d.ts +0 -1
  78. package/src/components/molecules/pressable-icon/pressable-icon.preview.d.ts +0 -1
  79. package/src/components/molecules/quick-filter/quick-filter.component.d.ts +0 -1
  80. package/src/components/molecules/quick-filter/quick-filter.preview.d.ts +0 -1
  81. package/src/components/molecules/search-input/search.component.d.ts +0 -1
  82. package/src/components/molecules/search-input/search.preview.d.ts +0 -1
  83. package/src/components/molecules/select-link/select-link.component.d.ts +0 -1
  84. package/src/components/molecules/select-link/select-link.preview.d.ts +0 -1
  85. package/src/components/molecules/select-list-item/select-list-item-preview.d.ts +0 -1
  86. package/src/components/molecules/select-picker/select-picker.component.d.ts +0 -1
  87. package/src/components/molecules/select-picker/select-picker.preview.d.ts +0 -1
  88. package/src/components/molecules/send-bubble/send-text-bubble.component.d.ts +0 -1
  89. package/src/components/molecules/snackbar/snackbar.component.d.ts +0 -1
  90. package/src/components/molecules/snackbar/snackbar.preview.d.ts +0 -1
  91. package/src/components/molecules/swipe/swipe.preview.d.ts +0 -1
  92. package/src/components/molecules/tag/tag.component.d.ts +0 -1
  93. package/src/components/molecules/tag/tag.preview.d.ts +0 -1
  94. package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +2149 -0
  95. package/src/components/molecules/time-picker/time-picker.component.d.ts +8 -0
  96. package/src/components/molecules/time-picker/time-picker.component.tsx +65 -0
  97. package/src/components/molecules/time-picker/time-picker.preview.d.ts +1 -0
  98. package/src/components/molecules/time-picker/time-picker.preview.tsx +109 -0
  99. package/src/components/molecules/time-picker/time-picker.styles.d.ts +15 -0
  100. package/src/components/molecules/time-picker/time-picker.styles.js +19 -0
  101. package/src/components/molecules/time-picker/time-picker.test.js +18 -0
  102. package/src/components/molecules/time-tracker/time-tracker.component.d.ts +0 -1
  103. package/src/components/molecules/time-tracker/time-tracker.preview.d.ts +0 -1
  104. package/src/components/molecules/time-tracker/time-tracker.test.js +0 -1
  105. package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +47 -39
  106. package/src/components/molecules/timeline/timeline.component.d.ts +2 -3
  107. package/src/components/molecules/timeline/timeline.component.tsx +27 -120
  108. package/src/components/molecules/timeline/timeline.preview.d.ts +0 -1
  109. package/src/components/molecules/timeline/timeline.preview.tsx +9 -20
  110. package/src/components/molecules/timeline/timeline.styles.d.ts +58 -40
  111. package/src/components/molecules/timeline/timeline.styles.js +24 -17
  112. package/src/components/molecules/timeline/timeline.test.js +3 -3
  113. package/src/components/molecules/timestamp/timestamp.component.d.ts +0 -1
  114. package/src/components/molecules/wave-background/wave.component.d.ts +0 -1
  115. package/src/components/molecules/wave-background/wave.preview.d.ts +0 -1
  116. package/src/components/molecules/wide-button/wide-button.component.d.ts +0 -1
  117. package/src/components/molecules/wide-button/wide-button.preview.d.ts +0 -1
  118. package/src/components/organisms/child-list-item/child-list-item.preview.d.ts +0 -1
  119. package/src/components/organisms/contact-item/contact-item.component.d.ts +0 -1
  120. package/src/components/organisms/contact-item/contact-item.preview.d.ts +0 -1
  121. package/src/components/organisms/day-select/day-select.component.d.ts +0 -1
  122. package/src/components/organisms/day-select/day-select.preview.d.ts +0 -1
  123. package/src/components/organisms/loading-indicator/container.component.d.ts +0 -1
  124. package/src/components/organisms/loading-indicator/dot.component.d.ts +0 -1
  125. package/src/components/organisms/loading-indicator/loading-indicator.component.d.ts +0 -1
  126. package/src/components/organisms/loading-indicator/loading-indicator.preview.d.ts +0 -1
  127. package/src/components/organisms/my-child-list-item/my-child-list-item.component.d.ts +0 -1
  128. package/src/components/organisms/my-child-list-item/my-child-list-item.preview.d.ts +0 -1
  129. package/src/components/organisms/person-info-card/person-info-card.component.d.ts +0 -1
  130. package/src/components/organisms/person-info-card/person-info-card.preview.d.ts +0 -1
  131. package/src/components/organisms/text-bubble/text-bubble.component.d.ts +0 -1
  132. package/src/components/organisms/text-bubble/text-bubble.preview.d.ts +0 -1
  133. package/src/components/templates/modal/components/fade-panel.component.d.ts +2 -1
  134. package/src/components/templates/modal/components/fade-panel.component.tsx +8 -2
  135. package/src/components/templates/modal/modal.component.d.ts +2 -1
  136. package/src/components/templates/modal/modal.component.tsx +4 -3
  137. package/src/components/templates/modal/modal.preview.d.ts +0 -1
  138. package/src/components/templates/modal/modal.styles.d.ts +3 -6
  139. package/src/components/templates/modal/modal.styles.js +3 -3
  140. package/src/components/templates/popover/components/modal/close/close.component.d.ts +0 -1
  141. package/src/components/templates/popover/components/modal/heading/heading.component.d.ts +0 -1
  142. package/src/components/templates/popover/components/modal/modal.component.tsx +0 -2
  143. package/src/components/templates/popover/popover.preview.d.ts +0 -1
  144. package/src/gradients/main/main.gradient.d.ts +0 -1
  145. package/src/icons/index.d.ts +0 -1
  146. package/src/icons/outline/calendar/calendar.icon.d.ts +0 -1
  147. package/src/icons/outline/chat/chat.icon.d.ts +0 -1
  148. package/src/icons/outline/chat-alt/chat-alt.icon.d.ts +0 -1
  149. package/src/icons/outline/check-circle/check-circle.icon.d.ts +0 -1
  150. package/src/icons/outline/chevron-left/chevron-left.icon.d.ts +0 -1
  151. package/src/icons/outline/chevron-right/chevron-right.icon.d.ts +0 -1
  152. package/src/icons/outline/clock/clock.icon.d.ts +0 -1
  153. package/src/icons/outline/cloud-download/cloud-download.icon.d.ts +0 -1
  154. package/src/icons/outline/currency-euro/currency-euro.icon.d.ts +0 -1
  155. package/src/icons/outline/document-text/document-text.icon.d.ts +0 -1
  156. package/src/icons/outline/exclamation/exclamation.icon.d.ts +0 -1
  157. package/src/icons/outline/exclamation-circle/exclamation-circle.icon.d.ts +0 -1
  158. package/src/icons/outline/eye/eye.icon.d.ts +0 -1
  159. package/src/icons/outline/eye-off/eye-off.icon.d.ts +0 -1
  160. package/src/icons/outline/filter/filter.icon.d.ts +0 -1
  161. package/src/icons/outline/information-circle/information-circle.icon.d.ts +0 -1
  162. package/src/icons/outline/logout/logout.icon.d.ts +0 -1
  163. package/src/icons/outline/mail/mail.icon.d.ts +0 -1
  164. package/src/icons/outline/mail-open/mail-open.icon.d.ts +0 -1
  165. package/src/icons/outline/menu/menu.icon.d.ts +0 -1
  166. package/src/icons/outline/minus-sm/minus-sm.icon.d.ts +0 -1
  167. package/src/icons/outline/office-building/office-building.icon.d.ts +0 -1
  168. package/src/icons/outline/outline-default.preview.d.ts +0 -1
  169. package/src/icons/outline/outline-grey.preview.d.ts +0 -1
  170. package/src/icons/outline/outline-white.preview.d.ts +0 -1
  171. package/src/icons/outline/outline.d.ts +0 -1
  172. package/src/icons/outline/paper-airplane/paper-airplane.icon.d.ts +0 -1
  173. package/src/icons/outline/paperclip/paperclip.icon.d.ts +0 -1
  174. package/src/icons/outline/pencil/pencil.icon.d.ts +0 -1
  175. package/src/icons/outline/phone/phone.icon.d.ts +0 -1
  176. package/src/icons/outline/plus/plus.icon.d.ts +0 -1
  177. package/src/icons/outline/plus-sm/plus-sm.icon.d.ts +0 -1
  178. package/src/icons/outline/qrcode/qrcode.icon.d.ts +0 -1
  179. package/src/icons/outline/refresh/refresh.icon.d.ts +0 -1
  180. package/src/icons/outline/search/search.icon.d.ts +0 -1
  181. package/src/icons/outline/selector/selector.icon.d.ts +0 -1
  182. package/src/icons/outline/sm-view-grid-add/sm-view-grid-add.icon.d.ts +0 -1
  183. package/src/icons/outline/status-online/status-online.icon.d.ts +0 -1
  184. package/src/icons/outline/thumb-up/thumb-up.icon.d.ts +0 -1
  185. package/src/icons/outline/trash/trash.icon.d.ts +0 -1
  186. package/src/icons/outline/user/user.icon.d.ts +0 -1
  187. package/src/icons/outline/user-group/user-group.icon.d.ts +0 -1
  188. package/src/icons/outline/users/users.icon.d.ts +0 -1
  189. package/src/icons/outline/xmark/xmark.icon.d.ts +0 -1
  190. package/src/icons/solid/calendar/calendar.icon.d.ts +0 -1
  191. package/src/icons/solid/chat/chat.icon.d.ts +0 -1
  192. package/src/icons/solid/chat-alt/chat-alt-solid.icon.d.ts +0 -1
  193. package/src/icons/solid/check-circle/check-circle.icon.d.ts +0 -1
  194. package/src/icons/solid/chevron-left/chevron-left.icon.d.ts +0 -1
  195. package/src/icons/solid/chevron-right/chevron-right.icon.d.ts +0 -1
  196. package/src/icons/solid/clock/clock-solid.icon.d.ts +0 -1
  197. package/src/icons/solid/cloud-download/cloud-download.icon.d.ts +0 -1
  198. package/src/icons/solid/currency-euro/currency-euro.icon.d.ts +0 -1
  199. package/src/icons/solid/document-text/document-text-solid.icon.d.ts +0 -1
  200. package/src/icons/solid/exclamation/exclamation.icon.d.ts +0 -1
  201. package/src/icons/solid/exclamation-circle/exclamation-circle.icon.d.ts +0 -1
  202. package/src/icons/solid/eye/eye.icon.d.ts +0 -1
  203. package/src/icons/solid/eye-off/eye-off.icon.d.ts +0 -1
  204. package/src/icons/solid/filter/filter.icon.d.ts +0 -1
  205. package/src/icons/solid/information-circle/information-circle-solid.icon.d.ts +0 -1
  206. package/src/icons/solid/logout/logout.icon.d.ts +0 -1
  207. package/src/icons/solid/mail/mail.icon.d.ts +0 -1
  208. package/src/icons/solid/mail-open/mail-open.icon.d.ts +0 -1
  209. package/src/icons/solid/menu/menu.icon.d.ts +0 -1
  210. package/src/icons/solid/minus-sm/minus-sm.icon.d.ts +0 -1
  211. package/src/icons/solid/office-building/office-building.icon.d.ts +0 -1
  212. package/src/icons/solid/paper-airplane/paper-airplane.icon.d.ts +0 -1
  213. package/src/icons/solid/paperclip/paperclip.icon.d.ts +0 -1
  214. package/src/icons/solid/pencil/pencil-solid.icon.d.ts +0 -1
  215. package/src/icons/solid/phone/phone-solid.icon.d.ts +0 -1
  216. package/src/icons/solid/plus/plus.icon.d.ts +0 -1
  217. package/src/icons/solid/plus-sm/plus-sm.icon.d.ts +0 -1
  218. package/src/icons/solid/qrcode/qrcode.icon.d.ts +0 -1
  219. package/src/icons/solid/refresh/refresh-solid.icon.d.ts +0 -1
  220. package/src/icons/solid/search/search.icon.d.ts +0 -1
  221. package/src/icons/solid/selector/selector.icon.d.ts +0 -1
  222. package/src/icons/solid/sm-view-grid-add/sm-view-grid-add.icon.d.ts +0 -1
  223. package/src/icons/solid/solid.d.ts +0 -1
  224. package/src/icons/solid/solid.preview.d.ts +0 -1
  225. package/src/icons/solid/status-online/status-online-solid.icon.d.ts +0 -1
  226. package/src/icons/solid/thumb-up/thumb-up.icon.d.ts +0 -1
  227. package/src/icons/solid/trash/trash-solid.icon.d.ts +0 -1
  228. package/src/icons/solid/user/user.icon.d.ts +0 -1
  229. package/src/icons/solid/user-group/user-group.icon.d.ts +0 -1
  230. package/src/icons/solid/users/users-solid.icon.d.ts +0 -1
  231. package/src/icons/solid/xmark/xmark.icon.d.ts +0 -1
  232. package/src/theme/provider/parent.theme.d.ts +4 -1
  233. package/src/theme/provider/parent.theme.ts +4 -1
  234. package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +2 -2
  235. package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +2 -2
  236. package/src/utilities/toddle-datetime/toddle-datetime.preview.d.ts +0 -1
@@ -0,0 +1,8 @@
1
+ interface TimePickerProps {
2
+ initialHours: string;
3
+ initialMinutes: string;
4
+ onChangeHours: (value: string) => void;
5
+ onChangeMinutes: (value: string) => void;
6
+ }
7
+ export declare const TimePicker: ({ initialHours, initialMinutes, onChangeHours, onChangeMinutes, }: TimePickerProps) => JSX.Element;
8
+ export {};
@@ -0,0 +1,65 @@
1
+ import {View} from 'react-native';
2
+ import WheelPickerExpo from 'react-native-wheel-picker-expo';
3
+ import {Heading3} from '../../atoms/heading-components';
4
+ import {Stylesheet} from './time-picker.styles';
5
+ import {Scale} from '../../../theme/scale/index';
6
+ import {useContext} from 'react';
7
+ import {ThemeCtx} from '../../../context/theme.context';
8
+
9
+ interface TimePickerProps {
10
+ initialHours: string;
11
+ initialMinutes: string;
12
+ onChangeHours: (value: string) => void;
13
+ onChangeMinutes: (value: string) => void;
14
+ }
15
+
16
+ const HOURS: string[] = [
17
+ '--',
18
+ ...Array.from({length: 24}, (_, i) => i.toString().padStart(2, '0')),
19
+ ];
20
+ const MINUTES: string[] = [
21
+ '--',
22
+ ...Array.from({length: 60}, (_, i) => i.toString().padStart(2, '0')),
23
+ ];
24
+
25
+ export const TimePicker = ({
26
+ initialHours,
27
+ initialMinutes,
28
+ onChangeHours,
29
+ onChangeMinutes,
30
+ }: TimePickerProps) => {
31
+ const context = useContext(ThemeCtx);
32
+ const styles = Stylesheet(context);
33
+
34
+ const initialIndexHandler = (dataArray: string[], value: string): number => {
35
+ return dataArray.findIndex((element) => element === value);
36
+ };
37
+
38
+ return (
39
+ <View style={styles.container}>
40
+ <WheelPickerExpo
41
+ items={HOURS.map((value) => ({label: value, value: value}))}
42
+ onChange={({item}) => onChangeHours(item.label)}
43
+ width={Scale.m * 4.5}
44
+ selectedStyle={styles.selected}
45
+ renderItem={({label, textAlign}) => (
46
+ <Heading3 textAlign={textAlign}>{label}</Heading3>
47
+ )}
48
+ initialSelectedIndex={initialIndexHandler(HOURS, initialHours)}
49
+ />
50
+ <View>
51
+ <Heading3>:</Heading3>
52
+ </View>
53
+ <WheelPickerExpo
54
+ items={MINUTES.map((value) => ({label: value, value: value}))}
55
+ onChange={({item}) => onChangeMinutes(item.label)}
56
+ width={Scale.m * 4.5}
57
+ selectedStyle={styles.selected}
58
+ renderItem={({label, textAlign}) => (
59
+ <Heading3 textAlign={textAlign}>{label}</Heading3>
60
+ )}
61
+ initialSelectedIndex={initialIndexHandler(MINUTES, initialMinutes)}
62
+ />
63
+ </View>
64
+ );
65
+ };
@@ -0,0 +1 @@
1
+ export declare const TimePickerPreview: ({}: {}) => JSX.Element;
@@ -0,0 +1,109 @@
1
+ import React, {useState} from 'react';
2
+ import {View} from 'react-native';
3
+ import {TimePicker} from './time-picker.component';
4
+ import {Heading3} from '../../atoms/heading-components';
5
+ import {Button} from '../button/button.component';
6
+ import {Avatar} from '../avatar/avatar.component';
7
+ import {Initials} from '../../../models/initials.model';
8
+ import {Size} from '../../../types/size.enum';
9
+ import {Modal} from '../../templates/modal/modal.component';
10
+
11
+ export const TimePickerPreview = ({}: {}) => {
12
+ const [popoverIsVisible, setPopoverIsVisible] = useState(false);
13
+
14
+ const [checkInHours, setCheckInHours] = useState('09');
15
+ const [checkInMinutes, setCheckInMinutes] = useState('06');
16
+
17
+ const [checkOutHours, setCheckOutHours] = useState('--');
18
+ const [checkOutMinutes, setCheckOutMinutes] = useState('--');
19
+
20
+ console.log(`
21
+ Check In:
22
+ Hours: ${checkInHours}
23
+ Minutes: ${checkInMinutes}
24
+
25
+ Check Out:
26
+ Hours: ${checkOutHours}
27
+ Minutes: ${checkOutMinutes}
28
+ `);
29
+
30
+ return (
31
+ <View
32
+ style={{
33
+ width: '100%',
34
+ height: '100%',
35
+ zIndex: 10000,
36
+ }}
37
+ >
38
+ <View
39
+ style={{
40
+ marginTop: 150,
41
+ }}
42
+ >
43
+ <Button
44
+ onPress={() => setPopoverIsVisible(true)}
45
+ label="Open popover"
46
+ />
47
+ </View>
48
+ <Modal
49
+ title={'Zeno Driesennnnnnnnnnnnnnnnn'}
50
+ subtitle={'Registratie aanpassen'}
51
+ onClose={() => setPopoverIsVisible(false)}
52
+ isVisible={popoverIsVisible}
53
+ scrollable={false}
54
+ >
55
+ <View>
56
+ <View style={{alignItems: 'center', marginBottom: 16}}>
57
+ <Avatar
58
+ source={Initials.for('Zeno', 'Driesen')}
59
+ size={Size.LARGE}
60
+ />
61
+ </View>
62
+ <View
63
+ style={{
64
+ flexDirection: 'row',
65
+ justifyContent: 'space-between',
66
+ }}
67
+ >
68
+ <View>
69
+ <Heading3
70
+ bold={true}
71
+ textAlign={'center'}
72
+ addStyle={{marginBottom: 8}}
73
+ >
74
+ Check In
75
+ </Heading3>
76
+ <TimePicker
77
+ initialHours={checkInHours}
78
+ initialMinutes={checkInMinutes}
79
+ onChangeHours={setCheckInHours}
80
+ onChangeMinutes={setCheckInMinutes}
81
+ />
82
+ </View>
83
+ <View>
84
+ <Heading3
85
+ bold={true}
86
+ textAlign={'center'}
87
+ addStyle={{marginBottom: 8}}
88
+ >
89
+ Check Out
90
+ </Heading3>
91
+ <TimePicker
92
+ initialHours={checkOutHours}
93
+ initialMinutes={checkOutMinutes}
94
+ onChangeHours={setCheckOutHours}
95
+ onChangeMinutes={setCheckOutMinutes}
96
+ />
97
+ </View>
98
+ </View>
99
+ <View style={{marginTop: 32, marginBottom: 16, alignItems: 'center'}}>
100
+ <Button
101
+ label={'Bewaar'}
102
+ onPress={() => console.log('Bewaar registratie aanpassing')}
103
+ />
104
+ </View>
105
+ </View>
106
+ </Modal>
107
+ </View>
108
+ );
109
+ };
@@ -0,0 +1,15 @@
1
+ export function Stylesheet(context: any): {
2
+ container: {
3
+ borderColor: any;
4
+ borderWidth: number;
5
+ borderStyle: 'solid';
6
+ borderRadius: number;
7
+ overflow: 'hidden';
8
+ flexDirection: 'row';
9
+ alignItems: 'center';
10
+ };
11
+ selected: {
12
+ borderColor: any;
13
+ borderWidth: number;
14
+ };
15
+ };
@@ -0,0 +1,19 @@
1
+ import {StyleSheet} from 'react-native';
2
+ import {Scale} from '../../../theme/scale/index';
3
+
4
+ export const Stylesheet = (context) =>
5
+ StyleSheet.create({
6
+ container: {
7
+ borderColor: context.colors.ui.xlightgrey,
8
+ borderWidth: 1,
9
+ borderStyle: 'solid',
10
+ borderRadius: Scale.m,
11
+ overflow: 'hidden',
12
+ flexDirection: 'row',
13
+ alignItems: 'center',
14
+ },
15
+ selected: {
16
+ borderColor: context.colors.ui.lightgrey,
17
+ borderWidth: 1,
18
+ },
19
+ });
@@ -0,0 +1,18 @@
1
+ import renderer from 'react-test-renderer';
2
+ import {TimePicker} from './time-picker.component';
3
+
4
+ describe('Time picker test', () => {
5
+ it('Should render a time picker where we can choose the hours and minutes separately, and our initial set time is 08:00', () => {
6
+ const tree = renderer
7
+ .create(
8
+ <TimePicker
9
+ initialHours={'08'}
10
+ initialMinutes={'00'}
11
+ onChangeHours={() => console.log('set the hours')}
12
+ onChangeMinutes={() => console.log('set the minutes')}
13
+ />
14
+ )
15
+ .toJSON();
16
+ expect(tree).toMatchSnapshot();
17
+ });
18
+ });
@@ -1,4 +1,3 @@
1
- /// <reference types="react" />
2
1
  import { VisualState } from '../../../types/visual-state.enum';
3
2
  type TimeTrackerProps = {
4
3
  text: string;
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const TimeTrackerPreview: ({}: {}) => JSX.Element;
@@ -1,7 +1,6 @@
1
1
  import React from 'react';
2
2
  import renderer from 'react-test-renderer';
3
3
  import {TimeTracker} from './time-tracker.component';
4
- import render from 'react-test-renderer';
5
4
 
6
5
  describe('test time-tracker', () => {
7
6
  it('given the visualState is DEFAULT return a blue colored ball', () => {
@@ -4,6 +4,8 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
4
4
  <View
5
5
  style={
6
6
  {
7
+ "marginBottom": 8,
8
+ "marginTop": 8,
7
9
  "width": "100%",
8
10
  }
9
11
  }
@@ -14,6 +16,7 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
14
16
  "backgroundColor": "#E5E8EB",
15
17
  "borderRadius": 50,
16
18
  "height": 8,
19
+ "overflow": "hidden",
17
20
  }
18
21
  }
19
22
  >
@@ -36,35 +39,36 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
36
39
  }
37
40
  }
38
41
  style={
39
- [
40
- {
41
- "borderRadius": 50,
42
- "height": 8,
43
- "left": "8%",
44
- },
45
- {
46
- "width": "40%",
47
- },
48
- ]
42
+ {
43
+ "borderRadius": 50,
44
+ "height": 8,
45
+ "left": "10%",
46
+ "width": "33.333333333333336%",
47
+ }
49
48
  }
50
49
  />
51
50
  </View>
52
51
  <View
53
52
  style={
54
- {
55
- "flexDirection": "row",
56
- "height": 24,
57
- "justifyContent": "space-between",
58
- "marginLeft": "8%",
59
- "marginTop": 8,
60
- "width": "40%",
61
- }
53
+ [
54
+ {
55
+ "flexDirection": "row",
56
+ "height": 24,
57
+ "marginTop": 8,
58
+ "width": "33.333333333333336%",
59
+ },
60
+ {
61
+ "justifyContent": "space-between",
62
+ "marginLeft": "10%",
63
+ },
64
+ false,
65
+ ]
62
66
  }
63
67
  >
64
68
  <View
65
69
  style={
66
70
  {
67
- "right": 20,
71
+ "right": 16,
68
72
  }
69
73
  }
70
74
  >
@@ -93,7 +97,7 @@ exports[`Timeline visual test renders a check-in time and check-out time 1`] = `
93
97
  <View
94
98
  style={
95
99
  {
96
- "left": 20,
100
+ "left": 16,
97
101
  }
98
102
  }
99
103
  >
@@ -127,6 +131,8 @@ exports[`Timeline visual test renders a check-in time with no known check-out ti
127
131
  <View
128
132
  style={
129
133
  {
134
+ "marginBottom": 8,
135
+ "marginTop": 8,
130
136
  "width": "100%",
131
137
  }
132
138
  }
@@ -137,6 +143,7 @@ exports[`Timeline visual test renders a check-in time with no known check-out ti
137
143
  "backgroundColor": "#E5E8EB",
138
144
  "borderRadius": 50,
139
145
  "height": 8,
146
+ "overflow": "hidden",
140
147
  }
141
148
  }
142
149
  >
@@ -159,35 +166,36 @@ exports[`Timeline visual test renders a check-in time with no known check-out ti
159
166
  }
160
167
  }
161
168
  style={
162
- [
163
- {
164
- "borderRadius": 50,
165
- "height": 8,
166
- "left": "8%",
167
- },
168
- {
169
- "width": "35%",
170
- },
171
- ]
169
+ {
170
+ "borderRadius": 50,
171
+ "height": 8,
172
+ "left": "10%",
173
+ "width": "25%",
174
+ }
172
175
  }
173
176
  />
174
177
  </View>
175
178
  <View
176
179
  style={
177
- {
178
- "flexDirection": "row",
179
- "height": 24,
180
- "justifyContent": "space-between",
181
- "marginLeft": "8%",
182
- "marginTop": 8,
183
- "width": "35%",
184
- }
180
+ [
181
+ {
182
+ "flexDirection": "row",
183
+ "height": 24,
184
+ "marginTop": 8,
185
+ "width": "25%",
186
+ },
187
+ {
188
+ "justifyContent": "space-between",
189
+ "marginLeft": "10%",
190
+ },
191
+ false,
192
+ ]
185
193
  }
186
194
  >
187
195
  <View
188
196
  style={
189
197
  {
190
- "right": 20,
198
+ "right": 16,
191
199
  }
192
200
  }
193
201
  >
@@ -1,7 +1,6 @@
1
- /// <reference types="react" />
2
- type TimelineProps = {
1
+ type TimeLineProps = {
3
2
  checkIn: string;
4
3
  checkOut?: string;
5
4
  };
6
- export declare const Timeline: ({ checkIn, checkOut }: TimelineProps) => JSX.Element;
5
+ export declare const TimeLine: ({ checkIn, checkOut }: TimeLineProps) => JSX.Element;
7
6
  export {};
@@ -5,132 +5,42 @@ import {Stylesheet} from './timeline.styles';
5
5
  import {LinearGradient} from 'expo-linear-gradient';
6
6
  import {SmallText} from '../../atoms/paragraph-components';
7
7
 
8
- type TimelineProps = {
8
+ type TimeLineProps = {
9
9
  checkIn: string;
10
10
  checkOut?: string;
11
11
  };
12
12
 
13
- export const Timeline = ({checkIn, checkOut}: TimelineProps) => {
14
- let position: number;
13
+ export const TimeLine = ({checkIn, checkOut}: TimeLineProps) => {
14
+ const startHour = 6;
15
+ const endHour = 21;
15
16
 
16
- function positionHandler(prop: string) {
17
- if (prop === '06:30') {
18
- position = 0;
19
- } else if (prop < '07:00') {
20
- position = 2;
21
- } else if (prop === '07:00') {
22
- position = 4;
23
- } else if (prop < '07:30') {
24
- position = 6;
25
- } else if (prop === '07:30') {
26
- position = 8;
27
- } else if (prop < '08:00') {
28
- position = 10;
29
- } else if (prop === '08:00') {
30
- position = 12;
31
- } else if (prop < '08:30') {
32
- position = 14;
33
- } else if (prop === '08:30') {
34
- position = 16;
35
- } else if (prop < '09:00') {
36
- position = 18;
37
- } else if (prop === '09:00') {
38
- position = 20;
39
- } else if (prop < '09:30') {
40
- position = 22;
41
- } else if (prop === '09:30') {
42
- position = 24;
43
- } else if (prop < '10:00') {
44
- position = 26;
45
- } else if (prop === '10:00') {
46
- position = 28;
47
- } else if (prop < '10:30') {
48
- position = 30;
49
- } else if (prop === '10:30') {
50
- position = 32;
51
- } else if (prop < '11:00') {
52
- position = 34;
53
- } else if (prop === '11:00') {
54
- position = 36;
55
- } else if (prop < '11:30') {
56
- position = 38;
57
- } else if (prop === '11:30') {
58
- position = 40;
59
- } else if (prop < '12:00') {
60
- position = 42;
61
- } else if (prop === '12:00') {
62
- position = 44;
63
- } else if (prop < '12:30') {
64
- position = 46;
65
- } else if (prop === '12:30') {
66
- position = 48;
67
- } else if (prop < '13:00') {
68
- position = 50;
69
- } else if (prop === '13:00') {
70
- position = 52;
71
- } else if (prop < '13:30') {
72
- position = 54;
73
- } else if (prop === '13:30') {
74
- position = 56;
75
- } else if (prop < '14:00') {
76
- position = 58;
77
- } else if (prop === '14:00') {
78
- position = 60;
79
- } else if (prop < '14:30') {
80
- position = 62;
81
- } else if (prop === '14:30') {
82
- position = 64;
83
- } else if (prop < '15:00') {
84
- position = 66;
85
- } else if (prop === '15:00') {
86
- position = 68;
87
- } else if (prop < '15:30') {
88
- position = 70;
89
- } else if (prop === '15:30') {
90
- position = 72;
91
- } else if (prop < '16:00') {
92
- position = 74;
93
- } else if (prop === '16:00') {
94
- position = 76;
95
- } else if (prop < '16:30') {
96
- position = 78;
97
- } else if (prop === '16:30') {
98
- position = 80;
99
- } else if (prop < '17:00') {
100
- position = 82;
101
- } else if (prop === '17:00') {
102
- position = 84;
103
- } else if (prop < '17:30') {
104
- position = 86;
105
- } else if (prop === '17:30') {
106
- position = 88;
107
- } else if (prop < '18:00') {
108
- position = 90;
109
- } else if (prop === '18:00') {
110
- position = 92;
111
- } else if (prop < '18:30') {
112
- position = 94;
113
- } else if (prop === '18:30') {
114
- position = 96;
115
- } else if (prop < '19:00') {
116
- position = 98;
117
- } else if (prop === '19:00') {
118
- position = 100;
119
- }
120
- return position;
121
- }
17
+ const calculateCheckInPosition = (checkInTime: string) => {
18
+ const [hours, minutes] = checkInTime.split(':');
19
+ const totalMinutes =
20
+ parseInt(hours) * 60 + parseInt(minutes) - startHour * 60;
21
+ return (totalMinutes / ((endHour - startHour) * 60)) * 100;
22
+ };
122
23
 
123
- const checkInPosition = positionHandler(checkIn);
124
- const checkOutPosition = positionHandler(checkOut!);
24
+ const calculateCheckOutPosition = (checkOutTime?: string) => {
25
+ if (checkOutTime) {
26
+ const [hours, minutes] = checkOutTime.split(':');
27
+ const totalMinutes =
28
+ parseInt(hours) * 60 + parseInt(minutes) - startHour * 60;
29
+ return (totalMinutes / ((endHour - startHour) * 60)) * 100;
30
+ }
31
+ return 25;
32
+ };
125
33
 
126
- function calcWidth(prop1: number, prop2: number) {
127
- return prop1 - prop2;
128
- }
34
+ const checkInPosition = calculateCheckInPosition(checkIn);
35
+ const checkOutPosition = calculateCheckOutPosition(checkOut);
129
36
 
130
- const lineWidth = calcWidth(checkOutPosition, checkInPosition);
37
+ const gradientWidth =
38
+ checkOut && checkOutPosition !== checkInPosition
39
+ ? checkOutPosition - checkInPosition
40
+ : 25;
131
41
 
132
42
  const context = useContext(ThemeCtx);
133
- const styles = Stylesheet(context, checkInPosition, lineWidth, checkOut);
43
+ const styles = Stylesheet(context, checkInPosition, gradientWidth);
134
44
 
135
45
  return (
136
46
  <View style={styles.container}>
@@ -141,10 +51,7 @@ export const Timeline = ({checkIn, checkOut}: TimelineProps) => {
141
51
  ? [context.colors.main['5'], context.colors.ui.lightgrey]
142
52
  : [context.colors.main['5'], context.colors.main['5']]
143
53
  }
144
- style={[
145
- styles.checkInLine,
146
- !checkOut ? styles.checkInWidth : styles.checkOutWidth,
147
- ]}
54
+ style={styles.checkInLine}
148
55
  start={{x: 0, y: 0}}
149
56
  end={{x: 1, y: 0}}
150
57
  />
@@ -1,2 +1 @@
1
- /// <reference types="react" />
2
1
  export declare const TimeLinePreview: ({}: {}) => JSX.Element;
@@ -1,6 +1,5 @@
1
1
  import React from 'react';
2
- import {Timeline} from './timeline.component';
3
- import {SafeAreaView, ScrollView} from 'react-native';
2
+ import {TimeLine} from './timeline.component';
4
3
  const {View} = require('react-native');
5
4
 
6
5
  export const TimeLinePreview = ({}: {}) => {
@@ -19,24 +18,14 @@ export const TimeLinePreview = ({}: {}) => {
19
18
  justifyContent: 'center',
20
19
  }}
21
20
  >
22
- <Timeline checkIn={'07:00'} checkOut={'12:00'} />
23
- <Timeline checkIn={'08:00'} checkOut={'12:30'} />
24
- <Timeline checkIn={'13:00'} />
25
- <View
26
- style={{
27
- width: '60%',
28
- marginTop: 30,
29
- marginBottom: 30,
30
- }}
31
- >
32
- <Timeline checkIn={'13:30'} checkOut={'19:00'} />
33
- <Timeline checkIn={'09:00'} checkOut={'17:30'} />
34
- <Timeline checkIn={'07:12'} />
35
- <Timeline checkIn={'06:30'} checkOut={'19:00'} />
36
- </View>
37
- <Timeline checkIn={'08:17'} />
38
- <Timeline checkIn={'07:52'} checkOut={'12:20'} />
39
- <Timeline checkIn={'13:00'} checkOut={'17:45'} />
21
+ <TimeLine checkIn={'07:00'} checkOut={'12:00'} />
22
+ <TimeLine checkIn={'08:00'} checkOut={'12:30'} />
23
+ <TimeLine checkIn={'13:00'} checkOut={''} />
24
+ <TimeLine checkIn={'16:00'} checkOut={'21:00'} />
25
+ <TimeLine checkIn={'07:52'} checkOut={'12:20'} />
26
+ <TimeLine checkIn={'13:00'} checkOut={'17:45'} />
27
+ <TimeLine checkIn={'18:00'} />
28
+ <TimeLine checkIn={'15:00'} checkOut={'20:00'} />
40
29
  </View>
41
30
  </View>
42
31
  );