@tactics/toddle-styleguide 5.3.1 → 5.3.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 (178) hide show
  1. package/App.tsx +0 -19
  2. package/app.json +8 -4
  3. package/index.tsx +0 -4
  4. package/package.json +55 -27
  5. package/src/components/atoms/calendar/calendar.component.tsx +10 -6
  6. package/src/components/atoms/calendar/calendar.preview.tsx +4 -3
  7. package/src/components/molecules/amount/amount.component.tsx +5 -4
  8. package/src/components/molecules/calendar-select/calendar-select.component.d.ts +4 -4
  9. package/src/components/molecules/calendar-select/calendar-select.component.tsx +17 -16
  10. package/src/components/molecules/calendar-select/calendar-select.preview.tsx +16 -5
  11. package/src/components/molecules/date-input/date-input.component.d.ts +2 -2
  12. package/src/components/molecules/date-input/date-input.component.tsx +3 -3
  13. package/src/components/molecules/date-input/date-input.preview.tsx +5 -5
  14. package/src/components/molecules/day/day.component.d.ts +3 -3
  15. package/src/components/molecules/day/day.component.tsx +22 -17
  16. package/src/components/molecules/selectable-list-item/selectable-list-item.component.tsx +12 -7
  17. package/src/components/molecules/timestamp/timestamp.component.d.ts +2 -2
  18. package/src/components/molecules/timestamp/timestamp.component.tsx +12 -5
  19. package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.d.ts +2 -2
  20. package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.tsx +5 -5
  21. package/src/components/organisms/journal-entry/journal-entry.component.d.ts +3 -3
  22. package/src/components/organisms/journal-entry/journal-entry.component.tsx +7 -3
  23. package/src/components/organisms/journal-entry/journal-entry.preview.tsx +7 -3
  24. package/src/components/organisms/text-bubble/text-bubble.component.d.ts +2 -2
  25. package/src/components/organisms/text-bubble/text-bubble.component.tsx +6 -3
  26. package/src/components/organisms/text-bubble/text-bubble.preview.tsx +19 -7
  27. package/src/components/templates/popover-action/popover-action.component.tsx +9 -8
  28. package/src/icons/solid/cloud-download/cloud-download.icon.tsx +1 -1
  29. package/src/icons/solid/refresh/refresh-solid.icon.tsx +2 -2
  30. package/src/utilities/datetime/clock.class.tsx +14 -0
  31. package/src/utilities/datetime/dateonly.class.tsx +287 -0
  32. package/src/utilities/datetime/datetime.class.tsx +288 -0
  33. package/src/utilities/datetime/day.class.tsx +48 -0
  34. package/src/utilities/datetime/dayjs-config.ts +96 -0
  35. package/src/utilities/datetime/dayoftheweek.class.tsx +242 -0
  36. package/src/utilities/datetime/hour.class.tsx +60 -0
  37. package/src/utilities/datetime/locale.tsx +6 -0
  38. package/src/utilities/datetime/millisecond.class.tsx +48 -0
  39. package/src/utilities/datetime/minute.class.tsx +55 -0
  40. package/src/utilities/datetime/month.class.tsx +74 -0
  41. package/src/utilities/datetime/second.class.tsx +52 -0
  42. package/src/utilities/datetime/time.class.tsx +190 -0
  43. package/src/utilities/datetime/timezone.class.tsx +36 -0
  44. package/src/utilities/datetime/year.class.tsx +78 -0
  45. package/src/utilities/datetime/yearandmonth.class.tsx +80 -0
  46. package/src/components/atoms/background-gradient/__snapshots__/background-gradient.test.js.snap +0 -40
  47. package/src/components/atoms/background-gradient/background-gradient.test.js +0 -10
  48. package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +0 -6817
  49. package/src/components/atoms/calendar/calendar.test.js +0 -35
  50. package/src/components/atoms/check-switch/__snapshots__/check-switch.test.js.snap +0 -84
  51. package/src/components/atoms/check-switch/check-switch.test.js +0 -13
  52. package/src/components/atoms/heading-components/all-caps-heading/__snapshots__/all-caps-heading.test.js.snap +0 -113
  53. package/src/components/atoms/heading-components/all-caps-heading/all-caps-heading.test.js +0 -44
  54. package/src/components/atoms/heading-components/heading1/__snapshots__/heading1.test.js.snap +0 -121
  55. package/src/components/atoms/heading-components/heading1/heading1.test.js +0 -51
  56. package/src/components/atoms/heading-components/heading2/__snapshots__/heading2.test.js.snap +0 -121
  57. package/src/components/atoms/heading-components/heading2/heading2.test.js +0 -51
  58. package/src/components/atoms/heading-components/heading3/__snapshots__/heading3.test.js.snap +0 -121
  59. package/src/components/atoms/heading-components/heading3/heading3.test.js +0 -51
  60. package/src/components/atoms/heading-components/heading4/__snapshots__/heading4.test.js.snap +0 -121
  61. package/src/components/atoms/heading-components/heading4/heading4.test.js +0 -51
  62. package/src/components/atoms/image-bubble/__snapshots__/image-bubble.test.js.snap +0 -67
  63. package/src/components/atoms/image-bubble/image-bubble.test.js +0 -20
  64. package/src/components/atoms/increment-input/__snapshots__/increment-input.test.js.snap +0 -269
  65. package/src/components/atoms/increment-input/increment-input.test.js +0 -14
  66. package/src/components/atoms/logo/__snapshots__/logo.test.js.snap +0 -113
  67. package/src/components/atoms/logo/logo.test.js +0 -16
  68. package/src/components/atoms/paragraph-components/paragraph/__snapshots__/paragraph.test.js.snap +0 -121
  69. package/src/components/atoms/paragraph-components/paragraph/paragraph.test.js +0 -76
  70. package/src/components/atoms/paragraph-components/small-text/__snapshots__/small-text.test.js.snap +0 -121
  71. package/src/components/atoms/paragraph-components/small-text/small-text.test.js +0 -76
  72. package/src/components/atoms/paragraph-components/tiny-text/__snapshots__/tiny-text.test.js.snap +0 -121
  73. package/src/components/atoms/paragraph-components/tiny-text/tiny-text.test.js +0 -76
  74. package/src/components/atoms/quick-message/__snapshots__/quick-message.test.js.snap +0 -143
  75. package/src/components/atoms/quick-message/quick-message.test.js +0 -58
  76. package/src/components/atoms/split-container/__snapshots__/split-container.test.js.snap +0 -333
  77. package/src/components/atoms/split-container/split-container.test.js +0 -45
  78. package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +0 -123
  79. package/src/components/atoms/text-input/text-input.test.js +0 -59
  80. package/src/components/molecules/avatar/__snapshots__/avatar.test.js.snap +0 -97
  81. package/src/components/molecules/avatar/avatar.test.js +0 -22
  82. package/src/components/molecules/blocked-message/__snapshots__/blocked-message.test.js.snap +0 -107
  83. package/src/components/molecules/blocked-message/blocked-message.test.js +0 -12
  84. package/src/components/molecules/button/__snapshots__/button.test.js.snap +0 -652
  85. package/src/components/molecules/button/button.test.js +0 -56
  86. package/src/components/molecules/calendar-select/__snapshots__/calendar-select.test.js.snap +0 -343
  87. package/src/components/molecules/calendar-select/calendar-select.test.js +0 -20
  88. package/src/components/molecules/cancel-link/__snapshots__/cancel-link.test.js.snap +0 -139
  89. package/src/components/molecules/cancel-link/cancel-link.test.js +0 -28
  90. package/src/components/molecules/checkbox/__snapshots__/checkbox.test.js.snap +0 -176
  91. package/src/components/molecules/checkbox/checkbox.test.js +0 -30
  92. package/src/components/molecules/contact-address/__snapshots__/contact-address.test.js.snap +0 -113
  93. package/src/components/molecules/contact-address/contact-address.test.js +0 -18
  94. package/src/components/molecules/contact-role/__snapshots__/contact-role.test.js.snap +0 -113
  95. package/src/components/molecules/contact-role/contact-role.test.js +0 -18
  96. package/src/components/molecules/date-input/__snapshots__/date-input.test.js.snap +0 -140
  97. package/src/components/molecules/date-input/date-input.test.js +0 -23
  98. package/src/components/molecules/day/__snapshots__/day.test.js.snap +0 -263
  99. package/src/components/molecules/day/day.test.js +0 -37
  100. package/src/components/molecules/default-select/__snapshots__/default-select.test.js.snap +0 -140
  101. package/src/components/molecules/default-select/default-select.test.js +0 -17
  102. package/src/components/molecules/department_logo/__snapshots__/department-logo.test.js.snap +0 -27
  103. package/src/components/molecules/department_logo/department-logo.test.js +0 -12
  104. package/src/components/molecules/failed-to-send/__snapshots__/failed-bubble.test.js.snap +0 -386
  105. package/src/components/molecules/failed-to-send/failed-bubble.test.js +0 -75
  106. package/src/components/molecules/filter-range/__snapshots__/filter-range.test.js.snap +0 -208
  107. package/src/components/molecules/filter-range/filter-range.test.js +0 -20
  108. package/src/components/molecules/filter-tab/__snapshots__/filter-tab.test.js.snap +0 -536
  109. package/src/components/molecules/filter-tab/filter-tab.test.js +0 -42
  110. package/src/components/molecules/info/__snapshots__/info.test.js.snap +0 -64
  111. package/src/components/molecules/info/info.test.js +0 -18
  112. package/src/components/molecules/language-button/__snapshots__/language-button.test.js.snap +0 -129
  113. package/src/components/molecules/language-button/language-button.test.js +0 -29
  114. package/src/components/molecules/message-input/__snapshots__/message-input.test.js.snap +0 -611
  115. package/src/components/molecules/message-input/message-input.test.js +0 -63
  116. package/src/components/molecules/more-info-button/__snapshots__/more-info-button.test.js.snap +0 -133
  117. package/src/components/molecules/more-info-button/more-info-button.test.js +0 -29
  118. package/src/components/molecules/password-input/__snapshots__/password-input.test.js.snap +0 -504
  119. package/src/components/molecules/password-input/password-input.test.js +0 -46
  120. package/src/components/molecules/pill/__snapshots__/pill.test.js.snap +0 -226
  121. package/src/components/molecules/pill/pill.test.js +0 -42
  122. package/src/components/molecules/pressable-icon/__snapshots__/pressable-icon.test.js.snap +0 -460
  123. package/src/components/molecules/pressable-icon/pressable-icon.test.js +0 -51
  124. package/src/components/molecules/quick-filter/__snapshots__/quick-filter.test.js.snap +0 -557
  125. package/src/components/molecules/quick-filter/quick-filter.test.js +0 -134
  126. package/src/components/molecules/search-input/__snapshots__/search.test.js.snap +0 -145
  127. package/src/components/molecules/search-input/search.test.js +0 -22
  128. package/src/components/molecules/select-link/__snapshots__/select-link.test.js.snap +0 -70
  129. package/src/components/molecules/select-link/select-link.test.js +0 -17
  130. package/src/components/molecules/select-list-item/__snapshots__/select-list-item.test.js.snap +0 -762
  131. package/src/components/molecules/select-list-item/select-list-item.test.js +0 -38
  132. package/src/components/molecules/select-picker/__snapshots__/select-picker.test.js.snap +0 -407
  133. package/src/components/molecules/select-picker/select-picker.test.js +0 -31
  134. package/src/components/molecules/send-bubble/__snapshots__/send-text-bubble.test.js.snap +0 -1979
  135. package/src/components/molecules/send-bubble/send-text-bubble.test.js +0 -156
  136. package/src/components/molecules/snackbar/__snapshots__/snackbar.test.js.snap +0 -557
  137. package/src/components/molecules/snackbar/snackbar.test.js +0 -35
  138. package/src/components/molecules/swipe/__snapshots__/swipe.test.js.snap +0 -340
  139. package/src/components/molecules/swipe/swipe.test.js +0 -46
  140. package/src/components/molecules/tag/__snapshots__/tag.test.js.snap +0 -139
  141. package/src/components/molecules/tag/tag.test.js +0 -34
  142. package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +0 -2221
  143. package/src/components/molecules/time-picker/time-picker.test.js +0 -18
  144. package/src/components/molecules/time-tracker/__snapshots__/time-tracker.test.js.snap +0 -266
  145. package/src/components/molecules/time-tracker/time-tracker.test.js +0 -36
  146. package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +0 -257
  147. package/src/components/molecules/timeline/timeline.test.js +0 -18
  148. package/src/components/molecules/timestamp/__snapshots__/timestamp.test.js.snap +0 -28
  149. package/src/components/molecules/timestamp/timestamp.test.js +0 -16
  150. package/src/components/molecules/wave-background/__snapshots__/wave.test.js.snap +0 -173
  151. package/src/components/molecules/wave-background/wave.test.js +0 -25
  152. package/src/components/molecules/wide-button/__snapshots__/wide-button.test.js.snap +0 -269
  153. package/src/components/molecules/wide-button/wide-button.test.js +0 -30
  154. package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +0 -1040
  155. package/src/components/organisms/child-list-item/child-list-item.test.js +0 -75
  156. package/src/components/organisms/contact-item/__snapshots__/contact-item.test.js.snap +0 -404
  157. package/src/components/organisms/contact-item/contact-item.test.js +0 -22
  158. package/src/components/organisms/loading-indicator/__snapshots__/loading-indicator.test.js.snap +0 -474
  159. package/src/components/organisms/loading-indicator/loading-indicator.test.js +0 -41
  160. package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +0 -293
  161. package/src/components/organisms/my-child-list-item/my-child-list-item.test.js +0 -23
  162. package/src/components/organisms/person-info-card/__snapshots__/person-info-card.test.js.snap +0 -709
  163. package/src/components/organisms/person-info-card/person-info-card.test.js +0 -85
  164. package/src/components/organisms/text-bubble/__snapshots__/text-bubble.test.js.snap +0 -3046
  165. package/src/components/organisms/text-bubble/text-bubble.test.js +0 -144
  166. package/src/utilities/toddle-datetime/interfaces/duration.interface.d.ts +0 -22
  167. package/src/utilities/toddle-datetime/interfaces/duration.interface.tsx +0 -23
  168. package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.d.ts +0 -22
  169. package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.tsx +0 -25
  170. package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +0 -50
  171. package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +0 -206
  172. package/src/utilities/toddle-datetime/toddle-datetime.preview.d.ts +0 -2
  173. package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +0 -160
  174. package/src/utilities/toddle-datetime/toddle-datetime.test.js +0 -127
  175. package/src/utilities/toddle-datetime/types/duration.type.d.ts +0 -4
  176. package/src/utilities/toddle-datetime/types/duration.type.tsx +0 -6
  177. package/src/utilities/toddle-datetime/types/toddle-datetime.type.d.ts +0 -5
  178. package/src/utilities/toddle-datetime/types/toddle-datetime.type.tsx +0 -23
@@ -1,5 +1,5 @@
1
1
  import * as React from 'react';
2
- import {useContext} from 'react';
2
+ import {isValidElement, ReactElement, useContext} from 'react';
3
3
 
4
4
  import {ThemeCtx} from '../../../context/theme.context';
5
5
  import {Pressable, View} from 'react-native';
@@ -26,12 +26,17 @@ const SelectableListItem = ({
26
26
  }: SelectableListProps) => {
27
27
  const context = useContext(ThemeCtx);
28
28
  const styles = Stylesheet(context, selected, inverse);
29
- const invertedIcon = React.Children.map(icon, (child) =>
30
- React.cloneElement(child, {
31
- ...icon.props,
32
- color: context.colors.main[6],
33
- })
34
- );
29
+
30
+ const invertedIcon = React.Children.map(icon, (child) => {
31
+ if (isValidElement(child)) {
32
+ return React.cloneElement(child as ReactElement<any>, {
33
+ // @ts-ignore
34
+ ...child.props,
35
+ color: context.colors.main[6],
36
+ });
37
+ }
38
+ return null; // Skip invalid elements
39
+ });
35
40
 
36
41
  return (
37
42
  <Pressable
@@ -1,7 +1,7 @@
1
1
  import * as React from 'react';
2
- import { ToddleDateTime } from '../../../utilities/toddle-datetime/toddle-datetime.class';
2
+ import {DateTimeInterface} from '../../../utilities/datetime/datetime.class';
3
3
  type TimestampProps = {
4
- sent: ToddleDateTime;
4
+ sent: DateTimeInterface;
5
5
  label?: string;
6
6
  };
7
7
  export declare const Timestamp: ({ sent, label }: TimestampProps) => React.JSX.Element;
@@ -1,21 +1,28 @@
1
1
  import * as React from 'react';
2
2
  import {useContext} from 'react';
3
3
  import {ThemeCtx} from '../../../context/theme.context';
4
- import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
5
4
  import {Stylesheet} from './timestamp.styles';
6
5
  import {SmallText} from '../../atoms/paragraph-components';
6
+ import {DateTimeInterface} from '../../../utilities/datetime/datetime.class';
7
+ import {Locale} from '../../../utilities/datetime/locale';
8
+ import {MonthLocalAwareOutputFormat} from '../../../utilities/datetime/month.class';
9
+ import {TimeOutputFormat} from '../../../utilities/datetime/time.class';
7
10
 
8
11
  type TimestampProps = {
9
- sent: ToddleDateTime;
12
+ sent: DateTimeInterface;
10
13
  label?: string;
14
+ locale: Locale;
11
15
  };
12
16
 
13
- export const Timestamp = ({sent, label}: TimestampProps) => {
17
+ export const Timestamp = ({sent, label, locale}: TimestampProps) => {
14
18
  const Context = useContext(ThemeCtx);
15
19
  const styles = Stylesheet();
16
20
 
17
- const timestampToStringHandler = (timestamp: ToddleDateTime) => {
18
- return timestamp.toFormat('d LLL, H:mm');
21
+ const timestampToStringHandler = (timestamp: DateTimeInterface) => {
22
+ const day = timestamp.day.asInt();
23
+ const month = timestamp.month.formatLocale(MonthLocalAwareOutputFormat.MONTH_SHORT, locale);
24
+ const time = timestamp.toTime().format(TimeOutputFormat.TIME_SHORT);
25
+ return day + ' ' + month + ', ' + time;
19
26
  };
20
27
 
21
28
  return (
@@ -1,9 +1,9 @@
1
- import { ToddleDateTime } from '../../../../../utilities/toddle-datetime/toddle-datetime.class';
2
1
  import React from 'react';
2
+ import {DateTimeInterface} from '../../../../../utilities/datetime/datetime.class';
3
3
  interface JournalEntryTypeProps {
4
4
  prio: boolean;
5
5
  type: string;
6
- happenedAt?: ToddleDateTime;
6
+ happenedAt?: DateTimeInterface;
7
7
  loading?: boolean;
8
8
  send: boolean;
9
9
  }
@@ -1,17 +1,17 @@
1
- import {useContext} from 'react';
1
+ import React, {useContext} from 'react';
2
2
  import {View} from 'react-native';
3
3
  import {Icon} from '../../../../../icons/index';
4
4
  import {ThemeCtx} from '../../../../../context/theme.context';
5
5
  import {Stylesheet} from './journal-entry-type.styles';
6
6
  import {EntryTypeIndicator} from '../entry-type-indicator/entry-type-indicator.component';
7
7
  import {SmallText} from '../../../../atoms/paragraph-components';
8
- import {ToddleDateTime} from '../../../../../utilities/toddle-datetime/toddle-datetime.class';
9
- import React from 'react';
8
+ import {DateTimeInterface} from '../../../../../utilities/datetime/datetime.class';
9
+ import {TimeOutputFormat} from '../../../../../utilities/datetime/time.class';
10
10
 
11
11
  interface JournalEntryTypeProps {
12
12
  prio: boolean;
13
13
  type: string;
14
- happenedAt?: ToddleDateTime;
14
+ happenedAt?: DateTimeInterface;
15
15
  loading?: boolean;
16
16
  send: boolean;
17
17
  }
@@ -53,7 +53,7 @@ export const JournalEntryType = ({
53
53
  <View>
54
54
  {happenedAt ? (
55
55
  <SmallText textColor={context.colors.ui.darkgrey}>
56
- {` - ` + happenedAt.toFormat('H:mm')}
56
+ {` - ` + happenedAt.toTime().format(TimeOutputFormat.TIME_SHORT)}
57
57
  </SmallText>
58
58
  ) : null}
59
59
  </View>
@@ -1,14 +1,14 @@
1
1
  import React from 'react';
2
- import { ToddleDateTime } from '../../../utilities/toddle-datetime/toddle-datetime.class';
3
2
  import { VisualState } from '../../../types/visual-state.enum';
3
+ import {DateTimeInterface} from '../../../utilities/datetime/datetime.class';
4
4
  interface JournalEntryProps {
5
5
  id: string;
6
6
  prio: boolean;
7
- happenedAt?: ToddleDateTime;
7
+ happenedAt?: DateTimeInterface;
8
8
  type: string;
9
9
  text: string;
10
10
  visualState: VisualState;
11
- createdAt?: ToddleDateTime;
11
+ createdAt?: DateTimeInterface;
12
12
  timestampLabel?: string;
13
13
  onFail?: (id: string) => void;
14
14
  onEdit?: (id: string) => void;
@@ -9,26 +9,28 @@ import {
9
9
  import {ThemeCtx} from '../../../context/theme.context';
10
10
  import {Stylesheet} from './journal-entry.styles';
11
11
  import {JournalEntryType} from './components';
12
- import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
13
12
  import {TextBubble} from '../text-bubble/text-bubble.component';
14
13
  import {VisualState} from '../../../types/visual-state.enum';
15
14
  import {Line} from '../../atoms/line/line.component';
16
15
  import {LoadingIndicator} from '../loading-indicator/loading-indicator.component';
16
+ import {DateTimeInterface} from '../../../utilities/datetime/datetime.class';
17
+ import {Locale} from '../../../utilities/datetime/locale';
17
18
 
18
19
  interface JournalEntryProps {
19
20
  id: string;
20
21
  prio: boolean;
21
- happenedAt?: ToddleDateTime;
22
+ happenedAt?: DateTimeInterface;
22
23
  type: string;
23
24
  text: string;
24
25
  visualState: VisualState;
25
- createdAt?: ToddleDateTime;
26
+ createdAt?: DateTimeInterface;
26
27
  timestampLabel?: string;
27
28
  onFail?: (id: string) => void;
28
29
  onEdit?: (id: string) => void;
29
30
  onDelete?: (id: string) => void;
30
31
  afterAnimationComplete?: () => void;
31
32
  loadingNewEntry?: boolean;
33
+ locale: Locale;
32
34
  }
33
35
 
34
36
  export const JournalEntry = ({
@@ -45,6 +47,7 @@ export const JournalEntry = ({
45
47
  onDelete,
46
48
  afterAnimationComplete,
47
49
  loadingNewEntry,
50
+ locale
48
51
  }: JournalEntryProps) => {
49
52
  const context = useContext(ThemeCtx);
50
53
  const styles = Stylesheet(context, createdAt);
@@ -123,6 +126,7 @@ export const JournalEntry = ({
123
126
  onDelete={deleteJournalEntryHandler}
124
127
  onEdit={onEdit}
125
128
  onFail={onFail}
129
+ locale={locale}
126
130
  />
127
131
  )}
128
132
 
@@ -1,13 +1,14 @@
1
1
  import {FlatList, LayoutAnimation, ListRenderItem, View} from 'react-native';
2
2
 
3
3
  import {JournalEntry} from './journal-entry.component';
4
- import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
5
4
  import {VisualState} from '../../../types/visual-state.enum';
6
5
  import {BubbleAlignment} from '../../../types/bubble-alignment.enum';
7
6
  import {useRef, useState} from 'react';
8
7
  import {PressableIcon} from '../../molecules/pressable-icon/pressable-icon.component';
9
8
  import {Icon} from '../../../icons/index';
10
9
  import React from 'react';
10
+ import {DateTime, DateTimeInterface} from '../../../utilities/datetime/datetime.class';
11
+ import {Locale} from '../../../utilities/datetime/locale';
11
12
 
12
13
  const DATA = [
13
14
  {
@@ -120,6 +121,8 @@ export const JournalEntryPreview = () => {
120
121
  const [entries, setEntries] = useState(DATA);
121
122
  const flatListRef = useRef<FlatList | null>(null);
122
123
 
124
+ const locale = Locale.nl;
125
+
123
126
  const addJournalEntry = (newEntry: JournalEntry) => {
124
127
  setEntries((prevEntries) => [
125
128
  ...prevEntries,
@@ -150,10 +153,10 @@ export const JournalEntryPreview = () => {
150
153
  id={item.uuid}
151
154
  prio={item.prio}
152
155
  type={item.type}
153
- happenedAt={ToddleDateTime.fromSeconds(item.happened_at, {zone: 'utc'})}
156
+ happenedAt={DateTime.fromTimestamp(item.happened_at)}
154
157
  text={item.message}
155
158
  visualState={item.prio ? VisualState.WARNING : VisualState.DEFAULT}
156
- createdAt={ToddleDateTime.fromSeconds(item.happened_at, {zone: 'utc'})}
159
+ createdAt={DateTime.fromTimestamp(item.happened_at)}
157
160
  timestampLabel={'ingevuld op'}
158
161
  onDelete={
159
162
  item.sender === 'STAFF_MEMBER' ? deleteJournalEntry : undefined
@@ -166,6 +169,7 @@ export const JournalEntryPreview = () => {
166
169
  onFail={item.send ? undefined : () => console.log('resend')}
167
170
  afterAnimationComplete={() => console.log('animation done')}
168
171
  loadingNewEntry={item.loadingNewEntry}
172
+ locale={locale}
169
173
  />
170
174
  );
171
175
  };
@@ -1,11 +1,11 @@
1
1
  import * as React from 'react';
2
2
  import { VisualState } from '../../../types/visual-state.enum';
3
- import { ToddleDateTime } from '../../../utilities/toddle-datetime/toddle-datetime.class';
3
+ import {DateTimeInterface} from '../../../utilities/datetime/datetime.class';
4
4
  type TextBubbleProps = {
5
5
  id: string;
6
6
  text: string;
7
7
  visualState: VisualState;
8
- timestamp?: ToddleDateTime;
8
+ timestamp?: DateTimeInterface;
9
9
  timestampLabel?: string;
10
10
  onFail?: (id: string) => void;
11
11
  onEdit?: (id: string) => void;
@@ -4,19 +4,21 @@ import {View} from 'react-native';
4
4
  import {Stylesheet} from './text-bubble.styles';
5
5
  import {VisualState} from '../../../types/visual-state.enum';
6
6
  import {Timestamp} from '../../molecules/timestamp/timestamp.component';
7
- import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
8
7
  import {FailedTextBubble} from '../../molecules/failed-to-send/failed-bubble.component';
9
8
  import {SendTextBubble} from '../../molecules/send-bubble/send-text-bubble.component';
9
+ import {DateTimeInterface} from '../../../utilities/datetime/datetime.class';
10
+ import {Locale} from '../../../utilities/datetime/locale';
10
11
 
11
12
  type TextBubbleProps = {
12
13
  id: string;
13
14
  text: string;
14
15
  visualState: VisualState;
15
- timestamp?: ToddleDateTime;
16
+ timestamp?: DateTimeInterface;
16
17
  timestampLabel?: string;
17
18
  onFail?: (id: string) => void;
18
19
  onEdit?: (id: string) => void;
19
20
  onDelete?: (id: string) => void;
21
+ locale: Locale;
20
22
  };
21
23
 
22
24
  const TextBubble = ({
@@ -28,6 +30,7 @@ const TextBubble = ({
28
30
  onFail,
29
31
  onEdit,
30
32
  onDelete,
33
+ locale
31
34
  }: TextBubbleProps) => {
32
35
  const styles = Stylesheet();
33
36
 
@@ -61,7 +64,7 @@ const TextBubble = ({
61
64
  )}
62
65
  {timestamp ? (
63
66
  <View style={styles.timestampContainer}>
64
- <Timestamp sent={timestamp} label={timestampLabel} />
67
+ <Timestamp sent={timestamp} label={timestampLabel} locale={locale} />
65
68
  </View>
66
69
  ) : null}
67
70
  </View>
@@ -1,17 +1,23 @@
1
1
  import React from 'react';
2
2
  import {VisualState} from '../../../types/visual-state.enum';
3
3
  import {TextBubble} from './text-bubble.component';
4
- import {ToddleDateTime} from '../../../utilities/toddle-datetime/toddle-datetime.class';
5
4
  import {ScrollView} from 'react-native';
5
+ import {DateTime, DateTimeInterface} from '../../../utilities/datetime/datetime.class';
6
+ import {SystemClock} from '../../../utilities/datetime/clock.class';
7
+ import {UTCTimezone} from '../../../utilities/datetime/timezone.class';
8
+ import {Locale} from '../../../utilities/datetime/locale';
6
9
 
7
10
  const {View} = require('react-native');
8
11
 
9
12
  export const TextBubblePreview = ({}: {}) => {
10
13
  const dateTimeString = '2023-11-28T09:12:00';
11
- const alternativeDateTime = ToddleDateTime.fromISO(dateTimeString);
14
+ const alternativeDateTime = DateTime.fromIso8601(dateTimeString, UTCTimezone);
15
+ const clock = new SystemClock();
12
16
 
13
17
  const send = false;
14
18
 
19
+ const locale = Locale.nl;
20
+
15
21
  return (
16
22
  <View
17
23
  style={{
@@ -33,51 +39,57 @@ export const TextBubblePreview = ({}: {}) => {
33
39
  onFail={send ? undefined : () => console.log('failed try to resend')}
34
40
  onEdit={() => alert('Edit the message')}
35
41
  onDelete={() => alert('Delete the message')}
42
+ locale={locale}
36
43
  />
37
44
  <TextBubble
38
45
  id={'2'}
39
46
  text="Test."
40
47
  visualState={VisualState.WARNING}
41
48
  timestampLabel={'ingevuld op'}
42
- timestamp={ToddleDateTime.now()}
49
+ timestamp={clock.now()}
43
50
  onEdit={() => alert('Edit the message')}
44
51
  onDelete={() => alert('Delete the message')}
52
+ locale={locale}
45
53
  />
46
54
  <TextBubble
47
55
  id={'3'}
48
56
  text={`"I don't like sand... it's rough, and course, and irritating, and it gets everywhere."`}
49
57
  visualState={VisualState.DEFAULT}
50
58
  timestampLabel={'ingevuld op'}
51
- timestamp={ToddleDateTime.now()}
59
+ timestamp={clock.now()}
52
60
  onEdit={() => alert('Edit the message')}
53
61
  onDelete={() => alert('Delete the message')}
62
+ locale={locale}
54
63
  />
55
64
  <TextBubble
56
65
  id={'4'}
57
66
  text="Error!"
58
67
  visualState={VisualState.WARNING}
59
68
  timestampLabel={'ingevuld op'}
60
- timestamp={ToddleDateTime.now()}
69
+ timestamp={clock.now()}
61
70
  onFail={send ? undefined : () => alert('Try to resend')}
62
71
  onEdit={() => alert('Edit the message')}
63
72
  onDelete={() => alert('Delete the message')}
73
+ locale={locale}
64
74
  />
65
75
  <TextBubble
66
76
  id={'5'}
67
77
  text="Niet verzonden! Probeer het opnieuw aub! Swipe en refresh!"
68
78
  visualState={VisualState.WARNING}
69
79
  timestampLabel={'ingevuld op'}
70
- timestamp={ToddleDateTime.now()}
80
+ timestamp={clock.now()}
71
81
  onFail={send ? undefined : () => alert('Try to resend')}
72
82
  onEdit={() => alert('Edit the message')}
73
83
  onDelete={() => alert('Delete the message')}
84
+ locale={locale}
74
85
  />
75
86
  <TextBubble
76
87
  id={'6'}
77
88
  text="We hebben uw betaling van vorige maand nog niet ontvangen!"
78
89
  visualState={VisualState.WARNING}
79
90
  timestampLabel={'ingevuld op'}
80
- timestamp={ToddleDateTime.now()}
91
+ timestamp={clock.now()}
92
+ locale={locale}
81
93
  />
82
94
  </ScrollView>
83
95
  </View>
@@ -1,5 +1,5 @@
1
- import React, {Children, useContext, useEffect, useMemo, useState} from 'react';
2
- import {Animated, Dimensions, Platform, StatusBar, View} from 'react-native';
1
+ import React, {Children, isValidElement, useContext, useEffect, useMemo, useState} from 'react';
2
+ import {Animated, Dimensions, LayoutChangeEvent, Platform, StatusBar, View, ViewProps} from 'react-native';
3
3
  import {Backdrop} from '../../atoms/backdrop/backdrop.component';
4
4
  import {Stylesheet} from './popover-action.styles';
5
5
  import {Swipe} from '../../molecules/swipe/swipe.component';
@@ -32,12 +32,13 @@ export const PopOverAction = ({
32
32
  };
33
33
 
34
34
  const renderChildren = Children.map(children, (child, index) => {
35
- return child
36
- ? React.cloneElement(child as React.ReactElement, {
37
- onLayout: (event: any) =>
38
- handleChildLayout(index, event.nativeEvent.layout),
39
- })
40
- : null;
35
+ if (isValidElement<ViewProps>(child)) {
36
+ return React.cloneElement(child, {
37
+ onLayout: (event: LayoutChangeEvent) =>
38
+ handleChildLayout(index, event.nativeEvent.layout),
39
+ });
40
+ }
41
+ return null;
41
42
  });
42
43
 
43
44
  const handleChildIndexChange = (index: number) => {
@@ -12,7 +12,7 @@ export const CloudDownloadIcon = ({color, size = Scale.l}: IconSVGProps) => {
12
12
  <Svg width={size} height={size} viewBox="0 0 18 20" fill="none">
13
13
  <Path
14
14
  fill={color ? HexColor.of(color).toString() : context.colors.main['0']}
15
- fill-rule="evenodd"
15
+ fillRule="evenodd"
16
16
  clipRule="evenodd"
17
17
  d="M0.199951 9.45001C0.199951 11.5763 1.92365 13.3 4.04995 13.3H7.89995V16.1444L6.47777 14.7222C6.04819 14.2926 5.35171 14.2926 4.92213 14.7222C4.49256 15.1518 4.49256 15.8482 4.92213 16.2778L8.22213 19.5778C8.65171 20.0074 9.34819 20.0074 9.77777 19.5778L13.0778 16.2778C13.5073 15.8482 13.5073 15.1518 13.0778 14.7222C12.6482 14.2926 11.9517 14.2926 11.5221 14.7222L10.1 16.1444V13.3H12.8499C15.5838 13.3 17.7999 11.0838 17.7999 8.35001C17.7999 5.6162 15.5838 3.40001 12.8499 3.40001C12.6203 3.40001 12.3942 3.41565 12.1729 3.44593C11.7006 1.52492 9.96668 0.100006 7.89995 0.100006C5.4699 0.100006 3.49995 2.06995 3.49995 4.50001C3.49995 4.88746 3.55003 5.26321 3.64407 5.62115C1.70856 5.82394 0.199951 7.46079 0.199951 9.45001ZM10.1 13.3H7.89995V7.80001C7.89995 7.19249 8.39244 6.70001 8.99995 6.70001C9.60746 6.70001 10.1 7.19249 10.1 7.80001V13.3Z"
18
18
  />
@@ -13,8 +13,8 @@ export const RefreshIcon = ({color, size = Scale.l}: IconSVGProps) => {
13
13
  <Svg width={size} height={size} viewBox="0 0 16 18" fill="none">
14
14
  <Path
15
15
  fill={color ? HexColor.of(color).toString() : context.colors.main['0']}
16
- fill-rule="evenodd"
17
- clip-rule="evenodd"
16
+ fillRule="evenodd"
17
+ clipRule="evenodd"
18
18
  d="M1.40005 0.200012C2.00756 0.200012 2.50005 0.692499 2.50005 1.30001V3.61139C3.89715 2.18539 5.84462 1.30001 8.00005 1.30001C11.3544 1.30001 14.2051 3.44426 15.2616 6.43344C15.4641 7.00623 15.1639 7.63468 14.5911 7.83714C14.0183 8.03959 13.3898 7.73937 13.1874 7.16658C12.4318 5.02891 10.3931 3.50001 8.00005 3.50001C6.20162 3.50001 4.60329 4.36353 3.59934 5.70001H6.90005C7.50756 5.70001 8.00005 6.1925 8.00005 6.80001C8.00005 7.40752 7.50756 7.90001 6.90005 7.90001H1.40005C0.792536 7.90001 0.300049 7.40752 0.300049 6.80001V1.30001C0.300049 0.692499 0.792536 0.200012 1.40005 0.200012ZM1.40903 10.1629C1.98182 9.96044 2.61027 10.2607 2.81273 10.8334C3.56828 12.9711 5.60703 14.5 8.00005 14.5C9.79847 14.5 11.3968 13.6365 12.4008 12.3L9.10005 12.3C8.49254 12.3 8.00005 11.8075 8.00005 11.2C8.00005 10.5925 8.49254 10.1 9.10005 10.1H14.6C14.8918 10.1 15.1716 10.2159 15.3779 10.4222C15.5842 10.6285 15.7 10.9083 15.7 11.2V16.7C15.7 17.3075 15.2076 17.8 14.6 17.8C13.9925 17.8 13.5 17.3075 13.5 16.7V14.3886C12.1029 15.8146 10.1555 16.7 8.00005 16.7C4.6457 16.7 1.795 14.5558 0.738478 11.5666C0.536026 10.9938 0.836243 10.3653 1.40903 10.1629Z"
19
19
  />
20
20
  </Svg>
@@ -0,0 +1,14 @@
1
+ import {DateTime, DateTimeInterface} from './datetime.class';
2
+ import dayjs from './dayjs-config';
3
+ import {TimeZoneInterface} from './timezone.class';
4
+
5
+ export interface ClockInterface {
6
+ now(): DateTimeInterface;
7
+ }
8
+
9
+ export class SystemClock implements ClockInterface {
10
+ public now(): DateTimeInterface {
11
+ const nowInTimezone = dayjs();
12
+ return DateTime.fromTimestamp(nowInTimezone.unix());
13
+ }
14
+ }