@tactics/toddle-styleguide 2.0.3 → 3.0.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 (144) hide show
  1. package/App.tsx +0 -12
  2. package/app.json +1 -0
  3. package/babel.config.js +14 -1
  4. package/index.d.ts +2 -5
  5. package/index.tsx +0 -8
  6. package/metro.config.js +11 -0
  7. package/package.json +1 -1
  8. package/src/components/atoms/animated-wave/animated-wave.styles.d.ts +19 -19
  9. package/src/components/atoms/backdrop/backdrop.styles.d.ts +9 -9
  10. package/src/components/atoms/background-gradient/background-gradient.styles.d.ts +6 -6
  11. package/src/components/atoms/count/count.component.d.ts +1 -1
  12. package/src/components/atoms/count/count.component.tsx +12 -13
  13. package/src/components/atoms/count/count.preview.tsx +5 -5
  14. package/src/components/atoms/count/count.styles.d.ts +23 -20
  15. package/src/components/atoms/count/count.styles.js +25 -17
  16. package/src/components/atoms/footer/footer.component.d.ts +1 -4
  17. package/src/components/atoms/footer/footer.component.tsx +9 -13
  18. package/src/components/atoms/footer/footer.preview.tsx +0 -17
  19. package/src/components/atoms/footer/footer.styles.d.ts +16 -13
  20. package/src/components/atoms/footer/footer.styles.js +1 -1
  21. package/src/components/atoms/increment-input/increment-input.styles.d.ts +33 -33
  22. package/src/components/atoms/quick-message/quick-message.styles.d.ts +16 -13
  23. package/src/components/atoms/split-container/split-container.styles.d.ts +12 -12
  24. package/src/components/molecules/amount/amount.component.d.ts +3 -3
  25. package/src/components/molecules/amount/amount.component.tsx +125 -100
  26. package/src/components/molecules/amount/amount.preview.tsx +59 -11
  27. package/src/components/molecules/amount/amount.styles.d.ts +34 -34
  28. package/src/components/molecules/amount/amount.styles.js +7 -7
  29. package/src/components/molecules/avatar/avatar.component.d.ts +1 -1
  30. package/src/components/molecules/avatar/avatar.component.tsx +8 -6
  31. package/src/components/molecules/avatar/avatar.styles.d.ts +96 -78
  32. package/src/components/molecules/avatar/avatar.styles.js +18 -16
  33. package/src/components/molecules/bare-time-picker/bare-time-picker.component.d.ts +1 -1
  34. package/src/components/molecules/bare-time-picker/bare-time-picker.component.native.tsx +78 -0
  35. package/src/components/molecules/bare-time-picker/bare-time-picker.component.tsx +39 -67
  36. package/src/components/molecules/bare-time-picker/bare-time-picker.preview.tsx +1 -1
  37. package/src/components/molecules/bare-time-picker/bare-time-picker.styles.d.ts +6 -0
  38. package/src/components/molecules/bare-time-picker/bare-time-picker.styles.js +14 -8
  39. package/src/components/molecules/calendar-select/calendar-select.component.d.ts +2 -1
  40. package/src/components/molecules/calendar-select/calendar-select.component.tsx +76 -73
  41. package/src/components/molecules/calendar-select/calendar-select.styles.d.ts +31 -31
  42. package/src/components/molecules/calendar-select/calendar-select.styles.js +33 -33
  43. package/src/components/molecules/context-label/context-label.component.tsx +21 -23
  44. package/src/components/molecules/context-label/context-label.preview.tsx +45 -30
  45. package/src/components/molecules/context-label/context-label.styles.d.ts +7 -5
  46. package/src/components/molecules/date-input/date-input.styles.d.ts +16 -16
  47. package/src/components/molecules/day/day.component.d.ts +10 -6
  48. package/src/components/molecules/default-select/default-select.styles.d.ts +11 -11
  49. package/src/components/molecules/filter-range/filter-range.styles.d.ts +20 -20
  50. package/src/components/molecules/filter-tab/filter-tab.styles.d.ts +58 -53
  51. package/src/components/molecules/info/info.component.tsx +13 -5
  52. package/src/components/molecules/info/info.preview.tsx +4 -5
  53. package/src/components/molecules/info/info.styles.d.ts +14 -14
  54. package/src/components/molecules/inline-error/inline-error.component.tsx +10 -3
  55. package/src/components/molecules/inline-error/inline-error.preview.tsx +4 -2
  56. package/src/components/molecules/inline-error/inline-error.styles.d.ts +16 -16
  57. package/src/components/molecules/inline-error/inline-error.styles.js +2 -2
  58. package/src/components/molecules/inline-notice/inline-notice.component.tsx +16 -12
  59. package/src/components/molecules/inline-notice/inline-notice.preview.tsx +4 -2
  60. package/src/components/molecules/inline-notice/inline-notice.styles.d.ts +16 -16
  61. package/src/components/molecules/inline-notice/inline-notice.styles.js +18 -18
  62. package/src/components/molecules/message-input/message-input.styles.d.ts +31 -31
  63. package/src/components/molecules/password-input/password-input.component.tsx +1 -1
  64. package/src/components/molecules/password-input/password-input.styles.d.ts +27 -27
  65. package/src/components/molecules/quick-filter/quick-filter.component.tsx +1 -1
  66. package/src/components/molecules/quick-filter/quick-filter.preview.tsx +1 -1
  67. package/src/components/molecules/quick-filter/quick-filter.styles.js +1 -1
  68. package/src/components/molecules/search-input/search.styles.d.ts +31 -31
  69. package/src/components/molecules/select-list-item/select-list-item.component.d.ts +1 -1
  70. package/src/components/molecules/select-list-item/select-list-item.component.tsx +13 -9
  71. package/src/components/molecules/select-list-item/select-list-item.styles.d.ts +27 -22
  72. package/src/components/molecules/select-picker/select-picker.styles.d.ts +30 -30
  73. package/src/components/molecules/selectable-list-item/selectable-list-item-preview.tsx +1 -1
  74. package/src/components/molecules/selectable-list-item/selectable-list-item.component.d.ts +1 -1
  75. package/src/components/molecules/selectable-list-item/selectable-list-item.component.tsx +17 -5
  76. package/src/components/molecules/selectable-list-item/selectable-list-item.styles.d.ts +31 -27
  77. package/src/components/molecules/swipe/swipe.component.native.tsx +78 -0
  78. package/src/components/molecules/swipe/swipe.component.tsx +5 -63
  79. package/src/components/molecules/time-picker/time-picker.component.tsx +8 -2
  80. package/src/components/molecules/time-picker/time-picker.styles.d.ts +25 -25
  81. package/src/components/molecules/wide-button/wide-button.styles.d.ts +14 -10
  82. package/src/components/organisms/child-list-item/child-list-item.component.d.ts +1 -1
  83. package/src/components/organisms/child-list-item/child-list-item.component.tsx +29 -26
  84. package/src/components/organisms/child-list-item/child-list-item.styles.d.ts +56 -53
  85. package/src/components/organisms/child-list-item/child-list-item.styles.js +5 -5
  86. package/src/components/organisms/contact-item/contact-item.styles.d.ts +13 -13
  87. package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.d.ts +1 -1
  88. package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.tsx +5 -4
  89. package/src/components/organisms/journal-entry/journal-entry.component.d.ts +1 -1
  90. package/src/components/organisms/journal-entry/journal-entry.styles.d.ts +25 -22
  91. package/src/components/organisms/my-child-list-item/my-child-list-item.styles.d.ts +31 -31
  92. package/src/components/organisms/text-bubble/text-bubble.styles.d.ts +14 -14
  93. package/src/components/organisms/timetable-edit/timetable-edit.component.d.ts +1 -1
  94. package/src/components/organisms/timetable-edit/timetable-edit.component.tsx +58 -56
  95. package/src/components/organisms/timetable-edit/timetable-edit.preview.tsx +20 -18
  96. package/src/components/organisms/timetable-edit/timetable-edit.styles.d.ts +19 -19
  97. package/src/components/organisms/timetable-edit/timetable-edit.styles.js +21 -21
  98. package/src/components/organisms/timetable-editor/components/timetable-edit-wrapper.d.ts +4 -4
  99. package/src/components/organisms/timetable-editor/components/timetable-edit-wrapper.tsx +65 -58
  100. package/src/components/organisms/timetable-editor/timetable-editor-staff.component.d.ts +8 -0
  101. package/src/components/organisms/timetable-editor/timetable-editor-staff.component.tsx +66 -47
  102. package/src/components/organisms/timetable-editor/timetable-editor.component.d.ts +2 -2
  103. package/src/components/organisms/timetable-editor/timetable-editor.component.tsx +76 -53
  104. package/src/components/organisms/timetable-editor/timetable-editor.preview.tsx +7 -7
  105. package/src/components/organisms/timetable-editor/timetable-editor.styles.d.ts +6 -6
  106. package/src/components/organisms/timetable-editor/timetable-editor.styles.js +8 -8
  107. package/src/components/templates/modal/components/fade-panel.styles.d.ts +17 -13
  108. package/src/components/templates/modal/modal.styles.d.ts +21 -21
  109. package/src/components/templates/popover/components/foreground/foreground.styles.d.ts +10 -10
  110. package/src/components/templates/popover/components/modal/heading/heading.styles.d.ts +12 -12
  111. package/src/components/templates/popover/components/modal/modal.styles.d.ts +17 -17
  112. package/src/components/templates/popover/popover.styles.d.ts +9 -9
  113. package/src/components/templates/popover-action/popover-action.component.d.ts +8 -4
  114. package/src/components/templates/popover-action/popover-action.component.tsx +7 -4
  115. package/src/components/templates/popover-action/popover-action.styles.d.ts +26 -26
  116. package/src/context/theme.context.ts +4 -4
  117. package/src/hooks/use-debounce.ts +8 -8
  118. package/src/icons/crown.icon.tsx +18 -5
  119. package/src/icons/outline/outline-default.preview.tsx +2 -2
  120. package/src/icons/outline/outline.tsx +4 -4
  121. package/src/icons/outline/photograph/photograph.icon.tsx +3 -6
  122. package/src/icons/solid/photograph/photograph-solid.icon.tsx +4 -4
  123. package/src/icons/solid/share/share.icon.tsx +1 -3
  124. package/src/icons/solid/solid.tsx +4 -4
  125. package/src/models/time-slot-sequence.ts +13 -9
  126. package/src/theme/provider/parent.theme.ts +4 -4
  127. package/src/theme/provider/staff-member.theme.ts +4 -4
  128. package/src/types/state.enum.ts +5 -5
  129. package/src/utilities/color-handler/color-handler.ts +2 -3
  130. package/tsconfig.json +2 -1
  131. package/src/components/organisms/day-select/day-select.component.d.ts +0 -9
  132. package/src/components/organisms/day-select/day-select.component.tsx +0 -108
  133. package/src/components/organisms/day-select/day-select.preview.d.ts +0 -2
  134. package/src/components/organisms/day-select/day-select.preview.tsx +0 -23
  135. package/src/components/organisms/day-select/day-select.styles.d.ts +0 -18
  136. package/src/components/organisms/day-select/day-select.styles.js +0 -22
  137. package/src/components/organisms/tab-view/__snapshots__/tab-view.test.js.snap +0 -421
  138. package/src/components/organisms/tab-view/tab-view.component.d.ts +0 -12
  139. package/src/components/organisms/tab-view/tab-view.component.tsx +0 -49
  140. package/src/components/organisms/tab-view/tab-view.preview.d.ts +0 -2
  141. package/src/components/organisms/tab-view/tab-view.preview.tsx +0 -37
  142. package/src/components/organisms/tab-view/tab-view.styles.d.ts +0 -10
  143. package/src/components/organisms/tab-view/tab-view.styles.js +0 -14
  144. package/src/components/organisms/tab-view/tab-view.test.js +0 -37
@@ -1,84 +1,102 @@
1
- export function Stylesheet(context: any, size: any, isBlocked: any, isActive: any): StyleSheet.NamedStyles<any> | StyleSheet.NamedStyles<{
2
- container: ({
3
- overflow: string;
4
- backgroundColor: any;
5
- justifyContent: string;
6
- alignItems: string;
7
- width?: undefined;
8
- height?: undefined;
9
- borderRadius?: undefined;
10
- } | {
11
- width: number;
12
- height: number;
13
- borderRadius: number;
14
- overflow?: undefined;
15
- backgroundColor?: undefined;
16
- justifyContent?: undefined;
17
- alignItems?: undefined;
18
- })[];
19
- shadow: ({
20
- backgroundColor: string;
21
- shadowColor?: undefined;
22
- shadowOpacity?: undefined;
23
- shadowRadius?: undefined;
24
- shadowOffset?: undefined;
25
- elevation?: undefined;
26
- width?: undefined;
27
- height?: undefined;
28
- borderRadius?: undefined;
29
- } | {
30
- shadowColor: any;
31
- shadowOpacity: number;
32
- shadowRadius: number;
33
- shadowOffset: {
1
+ export function Stylesheet(
2
+ context: any,
3
+ size: any,
4
+ isBlocked: any,
5
+ isActive: any
6
+ ):
7
+ | StyleSheet.NamedStyles<any>
8
+ | StyleSheet.NamedStyles<{
9
+ container: (
10
+ | {
11
+ overflow: string;
12
+ backgroundColor: any;
13
+ justifyContent: string;
14
+ alignItems: string;
15
+ width?: undefined;
16
+ height?: undefined;
17
+ borderRadius?: undefined;
18
+ }
19
+ | {
34
20
  width: number;
35
21
  height: number;
36
- };
37
- backgroundColor?: undefined;
38
- elevation?: undefined;
39
- width?: undefined;
40
- height?: undefined;
41
- borderRadius?: undefined;
42
- } | {
43
- elevation: number;
44
- shadowColor: any;
45
- backgroundColor?: undefined;
46
- shadowOpacity?: undefined;
47
- shadowRadius?: undefined;
48
- shadowOffset?: undefined;
49
- width?: undefined;
50
- height?: undefined;
51
- borderRadius?: undefined;
52
- } | {
53
- width: number;
54
- height: number;
55
- borderRadius: number;
56
- backgroundColor?: undefined;
57
- shadowColor?: undefined;
58
- shadowOpacity?: undefined;
59
- shadowRadius?: undefined;
60
- shadowOffset?: undefined;
61
- elevation?: undefined;
62
- })[];
63
- image: {
22
+ borderRadius: number;
23
+ overflow?: undefined;
24
+ backgroundColor?: undefined;
25
+ justifyContent?: undefined;
26
+ alignItems?: undefined;
27
+ }
28
+ )[];
29
+ shadow: (
30
+ | {
31
+ backgroundColor: string;
32
+ shadowColor?: undefined;
33
+ shadowOpacity?: undefined;
34
+ shadowRadius?: undefined;
35
+ shadowOffset?: undefined;
36
+ elevation?: undefined;
37
+ width?: undefined;
38
+ height?: undefined;
39
+ borderRadius?: undefined;
40
+ }
41
+ | {
42
+ shadowColor: any;
43
+ shadowOpacity: number;
44
+ shadowRadius: number;
45
+ shadowOffset: {
46
+ width: number;
47
+ height: number;
48
+ };
49
+ backgroundColor?: undefined;
50
+ elevation?: undefined;
51
+ width?: undefined;
52
+ height?: undefined;
53
+ borderRadius?: undefined;
54
+ }
55
+ | {
56
+ elevation: number;
57
+ shadowColor: any;
58
+ backgroundColor?: undefined;
59
+ shadowOpacity?: undefined;
60
+ shadowRadius?: undefined;
61
+ shadowOffset?: undefined;
62
+ width?: undefined;
63
+ height?: undefined;
64
+ borderRadius?: undefined;
65
+ }
66
+ | {
67
+ width: number;
68
+ height: number;
69
+ borderRadius: number;
70
+ backgroundColor?: undefined;
71
+ shadowColor?: undefined;
72
+ shadowOpacity?: undefined;
73
+ shadowRadius?: undefined;
74
+ shadowOffset?: undefined;
75
+ elevation?: undefined;
76
+ }
77
+ )[];
78
+ image: {
64
79
  position: string;
65
80
  width: string;
66
81
  height: string;
67
82
  borderRadius: number;
68
- }[];
69
- text: {
70
- textTransform: "uppercase";
71
- };
72
- crownContainer: ({
73
- position: string;
74
- zIndex: number;
75
- top?: undefined;
76
- left?: undefined;
77
- } | {
78
- top: number;
79
- left: number;
80
- position?: undefined;
81
- zIndex?: undefined;
82
- })[];
83
- }>;
84
- import { StyleSheet } from 'react-native';
83
+ }[];
84
+ text: {
85
+ textTransform: 'uppercase';
86
+ };
87
+ crownContainer: (
88
+ | {
89
+ position: string;
90
+ zIndex: number;
91
+ top?: undefined;
92
+ left?: undefined;
93
+ }
94
+ | {
95
+ top: number;
96
+ left: number;
97
+ position?: undefined;
98
+ zIndex?: undefined;
99
+ }
100
+ )[];
101
+ }>;
102
+ import {StyleSheet} from 'react-native';
@@ -69,20 +69,22 @@ export const Stylesheet = (context, size, isBlocked, isActive) =>
69
69
  text: {
70
70
  textTransform: 'uppercase',
71
71
  },
72
- crownContainer:[ {
73
- position: 'absolute',
74
- zIndex: 999
75
- },
76
- size === Size.SMALL && {
77
- top: -10,
78
- left: -5,
79
- },
80
- size === Size.MEDIUM && {
81
- top: -6,
82
- left: 0,
83
- },
84
- size === Size.LARGE && {
85
- top: -2,
86
- left: 10,
87
- }]
72
+ crownContainer: [
73
+ {
74
+ position: 'absolute',
75
+ zIndex: 999,
76
+ },
77
+ size === Size.SMALL && {
78
+ top: -10,
79
+ left: -5,
80
+ },
81
+ size === Size.MEDIUM && {
82
+ top: -6,
83
+ left: 0,
84
+ },
85
+ size === Size.LARGE && {
86
+ top: -2,
87
+ left: 10,
88
+ },
89
+ ],
88
90
  });
@@ -1,4 +1,4 @@
1
- import React from "react";
1
+ import React from 'react';
2
2
  interface BareTimePickerProps {
3
3
  initialHours: string;
4
4
  initialMinutes: string;
@@ -0,0 +1,78 @@
1
+ import {useContext} from 'react';
2
+ import {ThemeCtx} from '../../../context/theme.context';
3
+ import {Stylesheet} from './bare-time-picker.styles';
4
+ import {View} from 'react-native';
5
+ import React from 'react';
6
+ import WheelPicker from 'react-native-wheely';
7
+ import {Scale} from '../../../theme/scale';
8
+
9
+ interface BareTimePickerProps {
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 BareTimePicker = ({
26
+ initialHours,
27
+ initialMinutes,
28
+ onChangeHours,
29
+ onChangeMinutes,
30
+ }: BareTimePickerProps) => {
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.rootContainer}>
40
+ <WheelPicker
41
+ options={HOURS.map((value) => (value == '' ? '--' : value))}
42
+ onChange={(index) => onChangeHours(HOURS[index])}
43
+ selectedIndex={initialIndexHandler(HOURS, initialHours)}
44
+ visibleRest={1}
45
+ selectedIndicatorStyle={{
46
+ borderRadius: 0,
47
+ backgroundColor: context.colors.main[9],
48
+ }}
49
+ containerStyle={{
50
+ backgroundColor: context.colors.ui.xlightgrey,
51
+ width: '50%',
52
+ borderTopLeftRadius: Scale.xxs,
53
+ borderBottomLeftRadius: Scale.xxs,
54
+ }}
55
+ itemTextStyle={{fontSize: Scale.l}}
56
+ scaleFunction={(x) => x / 1.5}
57
+ />
58
+ <WheelPicker
59
+ options={MINUTES.map((value) => (value == '' ? '--' : value))}
60
+ onChange={(index) => onChangeMinutes(MINUTES[index])}
61
+ selectedIndex={initialIndexHandler(MINUTES, initialMinutes)}
62
+ visibleRest={1}
63
+ selectedIndicatorStyle={{
64
+ borderRadius: 0,
65
+ backgroundColor: context.colors.main[9],
66
+ }}
67
+ containerStyle={{
68
+ backgroundColor: context.colors.ui.xlightgrey,
69
+ width: '50%',
70
+ borderTopRightRadius: Scale.xxs,
71
+ borderBottomRightRadius: Scale.xxs,
72
+ }}
73
+ itemTextStyle={{fontSize: Scale.l}}
74
+ scaleFunction={(x) => x / 1.5}
75
+ />
76
+ </View>
77
+ );
78
+ };
@@ -1,80 +1,52 @@
1
- import { useContext } from "react";
2
- import { ThemeCtx } from "../../../context/theme.context";
3
- import { Stylesheet } from "./bare-time-picker.styles";
4
- import { View } from "react-native";
5
- import React from "react";
6
- import WheelPicker from 'react-native-wheely';
7
- import { Scale } from "../../../theme/scale";
8
-
1
+ import {useContext} from 'react';
2
+ import {ThemeCtx} from '../../../context/theme.context';
3
+ import {Stylesheet} from './bare-time-picker.styles';
4
+ import {View} from 'react-native';
5
+ import React from 'react';
6
+ import { SelectPicker } from '../select-picker/select-picker.component';
7
+ import { Paragraph } from '../../atoms/paragraph-components';
8
+ import { Scale } from '../../../theme/scale';
9
9
 
10
10
  interface BareTimePickerProps {
11
- initialHours: string;
12
- initialMinutes: string;
13
- onChangeHours: (value: string) => void;
14
- onChangeMinutes: (value: string) => void;
11
+ initialHours: string;
12
+ initialMinutes: string;
13
+ onChangeHours: (value: string) => void;
14
+ onChangeMinutes: (value: string) => void;
15
15
  }
16
16
 
17
17
  const HOURS: string[] = [
18
- '',
19
- ...Array.from({length: 24}, (_, i) => i.toString().padStart(2, '0')),
18
+ '',
19
+ ...Array.from({length: 24}, (_, i) => i.toString().padStart(2, '0')),
20
20
  ];
21
21
  const MINUTES: string[] = [
22
- '',
23
- ...Array.from({length: 60}, (_, i) => i.toString().padStart(2, '0')),
22
+ '',
23
+ ...Array.from({length: 60}, (_, i) => i.toString().padStart(2, '0')),
24
24
  ];
25
25
 
26
-
27
26
  export const BareTimePicker = ({
28
- initialHours,
29
- initialMinutes,
30
- onChangeHours,
31
- onChangeMinutes,
27
+ initialHours,
28
+ initialMinutes,
29
+ onChangeHours,
30
+ onChangeMinutes,
32
31
  }: BareTimePickerProps) => {
33
- const context = useContext(ThemeCtx);
34
- const styles = Stylesheet(context);
32
+ const context = useContext(ThemeCtx);
33
+ const styles = Stylesheet(context);
35
34
 
36
- const initialIndexHandler = (dataArray: string[], value: string): number => {
37
- return dataArray.findIndex((element) => element === value);
38
- };
35
+ const hourItems = HOURS.map((el) => {
36
+ return {value: el, label: el}
37
+ });
39
38
 
40
- return (
41
- <View style={styles.rootContainer}>
42
- <WheelPicker
43
- options={HOURS.map((value) => (value == '' ? '--' : value))}
44
- onChange={(index) => onChangeHours(HOURS[index])}
45
- selectedIndex={initialIndexHandler(HOURS, initialHours)}
46
- visibleRest={1}
47
- selectedIndicatorStyle={{
48
- borderRadius: 0,
49
- backgroundColor: context.colors.main[9],
50
- }}
51
- containerStyle={{
52
- backgroundColor: context.colors.ui.xlightgrey,
53
- width: '50%',
54
- borderTopLeftRadius:Scale.xxs,
55
- borderBottomLeftRadius:Scale.xxs,
56
- }}
57
- itemTextStyle={{fontSize: Scale.l}}
58
- scaleFunction={(x) => x/1.5}
59
- />
60
- <WheelPicker
61
- options={MINUTES.map((value) => (value == '' ? '--' : value))}
62
- onChange={(index) => onChangeMinutes(MINUTES[index])}
63
- selectedIndex={initialIndexHandler(MINUTES, initialMinutes)}
64
- visibleRest={1}
65
- selectedIndicatorStyle={{
66
- borderRadius: 0,
67
- backgroundColor: context.colors.main[9]
68
- }}
69
- containerStyle={{
70
- backgroundColor: context.colors.ui.xlightgrey,
71
- width: '50%',
72
- borderTopRightRadius:Scale.xxs,
73
- borderBottomRightRadius:Scale.xxs,
74
- }}
75
- itemTextStyle={{fontSize: Scale.l}}
76
- scaleFunction={(x) => x/1.5}
77
- />
78
- </View>
79
- )
80
- }
39
+ const minuteItems = MINUTES.map((el) => {
40
+ return {value: el, label: el}
41
+ });
42
+
43
+ return (
44
+ <View style={styles.webRootContainer}>
45
+ <View style={{flexDirection: 'row', alignItems: 'center', justifyContent: 'center'}}>
46
+ <SelectPicker data={hourItems} onChange={onChangeHours} defaultValue={initialHours} />
47
+ <Paragraph addStyle={{paddingHorizontal: Scale.s}}>:</Paragraph>
48
+ <SelectPicker data={minuteItems} onChange={onChangeMinutes} defaultValue={initialMinutes} />
49
+ </View>
50
+ </View>
51
+ );
52
+ };
@@ -6,7 +6,7 @@ import {Avatar} from '../avatar/avatar.component';
6
6
  import {Initials} from '../../../models/initials.model';
7
7
  import {Size} from '../../../types/size.enum';
8
8
  import {Modal} from '../../templates/modal/modal.component';
9
- import { BareTimePicker } from './bare-time-picker.component';
9
+ import {BareTimePicker} from './bare-time-picker.component';
10
10
 
11
11
  export const BareTimePickerPreview = ({}: {}) => {
12
12
  const [popoverIsVisible, setPopoverIsVisible] = useState(false);
@@ -5,4 +5,10 @@ export function Stylesheet(context: any): {
5
5
  width: "100%";
6
6
  maxWidth: number;
7
7
  };
8
+ webRootContainer: {
9
+ flexDirection: "row";
10
+ alignItems: "center";
11
+ justifyContent: "center";
12
+ width: "100%";
13
+ };
8
14
  };
@@ -2,11 +2,17 @@ import {StyleSheet} from 'react-native';
2
2
  import {Scale} from '../../../theme/scale/index';
3
3
 
4
4
  export const Stylesheet = (context) =>
5
- StyleSheet.create({
6
- rootContainer: {
7
- flexDirection: 'row',
8
- alignItems: 'center',
9
- width: '100%',
10
- maxWidth: 200
11
- },
12
- });
5
+ StyleSheet.create({
6
+ rootContainer: {
7
+ flexDirection: 'row',
8
+ alignItems: 'center',
9
+ width: '100%',
10
+ maxWidth: 200,
11
+ },
12
+ webRootContainer: {
13
+ flexDirection: 'row',
14
+ alignItems: 'center',
15
+ justifyContent: 'center',
16
+ width: '100%',
17
+ },
18
+ });
@@ -4,6 +4,7 @@ type CalendarSelectProps = {
4
4
  onPressDate: (date: ToddleDateTime) => void;
5
5
  startDate: ToddleDateTime;
6
6
  onUpdateDate: (date: ToddleDateTime) => void;
7
+ labelForToday?: string | undefined;
7
8
  };
8
- declare const CalendarSelect: ({ onPressDate, startDate, onUpdateDate, }: CalendarSelectProps) => React.JSX.Element;
9
+ declare const CalendarSelect: ({ onPressDate, startDate, onUpdateDate, labelForToday, }: CalendarSelectProps) => React.JSX.Element;
9
10
  export { CalendarSelect as CalendarSelect };
@@ -6,90 +6,93 @@ import {Stylesheet} from './calendar-select.styles';
6
6
  import {Pressable, View} from 'react-native';
7
7
  import {Paragraph} from '../../atoms/paragraph-components';
8
8
  import {Icon} from '../../../icons/index';
9
- import { useDebounce } from '../../../hooks/use-debounce';
9
+ import {useDebounce} from '../../../hooks/use-debounce';
10
10
 
11
11
  type CalendarSelectProps = {
12
- onPressDate: (date: ToddleDateTime) => void;
13
- startDate: ToddleDateTime;
14
- onUpdateDate: (date: ToddleDateTime) => void;
15
- labelForToday?: string | undefined
12
+ onPressDate: (date: ToddleDateTime) => void;
13
+ startDate: ToddleDateTime;
14
+ onUpdateDate: (date: ToddleDateTime) => void;
15
+ labelForToday?: string | undefined;
16
16
  };
17
17
 
18
18
  const CalendarSelect = ({
19
- onPressDate,
20
- startDate,
21
- onUpdateDate,
22
- labelForToday
23
- }: CalendarSelectProps) => {
24
- const context = useContext(ThemeCtx);
25
- const styles = Stylesheet(context);
19
+ onPressDate,
20
+ startDate,
21
+ onUpdateDate,
22
+ labelForToday,
23
+ }: CalendarSelectProps) => {
24
+ const context = useContext(ThemeCtx);
25
+ const styles = Stylesheet(context);
26
26
 
27
- const [visibleDate, setVisibleDate] = useState(startDate);
28
- const debouncedVisibleDate = useDebounce<ToddleDateTime>(visibleDate, 500);
27
+ const [visibleDate, setVisibleDate] = useState(startDate);
28
+ const debouncedVisibleDate = useDebounce<ToddleDateTime>(visibleDate, 500);
29
29
 
30
- const today = ToddleDateTime.now();
31
- const format = 'yyyy-LL-dd';
32
- const isToday = today.toFormat(format) == visibleDate.toFormat(format);
30
+ const today = ToddleDateTime.now();
31
+ const format = 'yyyy-LL-dd';
32
+ const isToday = today.toFormat(format) == visibleDate.toFormat(format);
33
33
 
34
- useEffect(() => {
35
- setVisibleDate(startDate);
36
- }, [startDate]);
34
+ useEffect(() => {
35
+ setVisibleDate(startDate);
36
+ }, [startDate]);
37
37
 
38
- useEffect(() => {
39
- // If they are the same dont trigger event again.
40
- if (visibleDate !== startDate) {
41
- onUpdateDate(debouncedVisibleDate);
42
- }
43
- }, [debouncedVisibleDate])
38
+ useEffect(() => {
39
+ // If they are the same dont trigger event again.
40
+ if (visibleDate !== startDate) {
41
+ onUpdateDate(debouncedVisibleDate);
42
+ }
43
+ }, [debouncedVisibleDate]);
44
44
 
45
- return (
46
- <View style={styles.container}>
47
- <Pressable
48
- onPress={() => {
49
- setVisibleDate(visibleDate.minus({days: 1}));
50
- }}
51
- style={styles.arrowContainer}
52
- >
53
- <Icon
54
- style={'regular'}
55
- name={'chevron-left'}
56
- color={context.colors.main['9']}
57
- />
58
- </Pressable>
45
+ return (
46
+ <View style={styles.container}>
47
+ <Pressable
48
+ onPress={() => {
49
+ setVisibleDate(visibleDate.minus({days: 1}));
50
+ }}
51
+ style={styles.arrowContainer}
52
+ >
53
+ <Icon
54
+ style={'regular'}
55
+ name={'chevron-left'}
56
+ color={context.colors.main['9']}
57
+ />
58
+ </Pressable>
59
59
 
60
- <Pressable
61
- onPress={() => onPressDate(visibleDate)}
62
- style={styles.dateContainer}
63
- >
64
- <View style={styles.icon}>
65
- <Icon
66
- style={'regular'}
67
- name={'calendar'}
68
- color={context.colors.main['9']}
69
- />
70
- </View>
71
- <Paragraph textColor={context.colors.main['9']} textAlign={'center'} >
72
- {
73
- isToday && labelForToday ?
74
- labelForToday :
75
- visibleDate.toLocaleString({weekday: 'short', day: 'numeric', month: 'short', year: 'numeric'})
76
- }
77
- </Paragraph>
78
- </Pressable>
79
-
80
- <Pressable
81
- onPress={() => {
82
- setVisibleDate(visibleDate.plus({days: 1}));
83
- }}
84
- style={styles.arrowContainer}
85
- >
86
- <Icon
87
- style={'regular'}
88
- name={'chevron-right'}
89
- color={context.colors.main['9']}
90
- />
91
- </Pressable>
60
+ <Pressable
61
+ onPress={() => onPressDate(visibleDate)}
62
+ style={styles.dateContainer}
63
+ >
64
+ <View style={styles.icon}>
65
+ <Icon
66
+ style={'regular'}
67
+ name={'calendar'}
68
+ color={context.colors.main['9']}
69
+ />
92
70
  </View>
93
- );
71
+ <Paragraph textColor={context.colors.main['9']} textAlign={'center'}>
72
+ {isToday && labelForToday
73
+ ? labelForToday
74
+ : visibleDate.toLocaleString({
75
+ weekday: 'short',
76
+ day: 'numeric',
77
+ month: 'short',
78
+ year: 'numeric',
79
+ })}
80
+ </Paragraph>
81
+ </Pressable>
82
+
83
+ <Pressable
84
+ onPress={() => {
85
+ setVisibleDate(visibleDate.plus({days: 1}));
86
+ }}
87
+ style={styles.arrowContainer}
88
+ >
89
+ <Icon
90
+ style={'regular'}
91
+ name={'chevron-right'}
92
+ color={context.colors.main['9']}
93
+ />
94
+ </Pressable>
95
+ </View>
96
+ );
94
97
  };
95
98
  export {CalendarSelect as CalendarSelect};