@tactics/toddle-styleguide 5.2.2 → 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 (186) hide show
  1. package/App.tsx +11 -19
  2. package/app.json +8 -4
  3. package/index.tsx +2 -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/contact-address/contact-address.component.d.ts +8 -0
  12. package/src/components/molecules/contact-address/contact-address.component.tsx +20 -0
  13. package/src/components/molecules/contact-address/contact-address.preview.d.ts +2 -0
  14. package/src/components/molecules/contact-address/contact-address.preview.tsx +17 -0
  15. package/src/components/molecules/contact-address/contact-address.styles.d.ts +7 -0
  16. package/src/components/molecules/contact-address/contact-address.styles.js +10 -0
  17. package/src/components/molecules/date-input/date-input.component.d.ts +2 -2
  18. package/src/components/molecules/date-input/date-input.component.tsx +3 -3
  19. package/src/components/molecules/date-input/date-input.preview.tsx +5 -5
  20. package/src/components/molecules/day/day.component.d.ts +3 -3
  21. package/src/components/molecules/day/day.component.tsx +22 -17
  22. package/src/components/molecules/selectable-list-item/selectable-list-item.component.tsx +12 -7
  23. package/src/components/molecules/timestamp/timestamp.component.d.ts +2 -2
  24. package/src/components/molecules/timestamp/timestamp.component.tsx +12 -5
  25. package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.d.ts +2 -2
  26. package/src/components/organisms/journal-entry/components/journal-entry-type/journal-entry-type.component.tsx +5 -5
  27. package/src/components/organisms/journal-entry/journal-entry.component.d.ts +3 -3
  28. package/src/components/organisms/journal-entry/journal-entry.component.tsx +7 -3
  29. package/src/components/organisms/journal-entry/journal-entry.preview.tsx +7 -3
  30. package/src/components/organisms/person-info-card/person-info-card.component.tsx +8 -2
  31. package/src/components/organisms/person-info-card/person-info-card.preview.tsx +3 -0
  32. package/src/components/organisms/person-info-card/person-info-card.styles.d.ts +4 -0
  33. package/src/components/organisms/person-info-card/person-info-card.styles.js +4 -0
  34. package/src/components/organisms/text-bubble/text-bubble.component.d.ts +2 -2
  35. package/src/components/organisms/text-bubble/text-bubble.component.tsx +6 -3
  36. package/src/components/organisms/text-bubble/text-bubble.preview.tsx +19 -7
  37. package/src/components/templates/popover-action/popover-action.component.tsx +9 -8
  38. package/src/icons/solid/cloud-download/cloud-download.icon.tsx +1 -1
  39. package/src/icons/solid/refresh/refresh-solid.icon.tsx +2 -2
  40. package/src/utilities/datetime/clock.class.tsx +14 -0
  41. package/src/utilities/datetime/dateonly.class.tsx +287 -0
  42. package/src/utilities/datetime/datetime.class.tsx +288 -0
  43. package/src/utilities/datetime/day.class.tsx +48 -0
  44. package/src/utilities/datetime/dayjs-config.ts +96 -0
  45. package/src/utilities/datetime/dayoftheweek.class.tsx +242 -0
  46. package/src/utilities/datetime/hour.class.tsx +60 -0
  47. package/src/utilities/datetime/locale.tsx +6 -0
  48. package/src/utilities/datetime/millisecond.class.tsx +48 -0
  49. package/src/utilities/datetime/minute.class.tsx +55 -0
  50. package/src/utilities/datetime/month.class.tsx +74 -0
  51. package/src/utilities/datetime/second.class.tsx +52 -0
  52. package/src/utilities/datetime/time.class.tsx +190 -0
  53. package/src/utilities/datetime/timezone.class.tsx +36 -0
  54. package/src/utilities/datetime/year.class.tsx +78 -0
  55. package/src/utilities/datetime/yearandmonth.class.tsx +80 -0
  56. package/src/components/atoms/background-gradient/__snapshots__/background-gradient.test.js.snap +0 -40
  57. package/src/components/atoms/background-gradient/background-gradient.test.js +0 -10
  58. package/src/components/atoms/calendar/__snapshots__/calendar.test.js.snap +0 -6817
  59. package/src/components/atoms/calendar/calendar.test.js +0 -35
  60. package/src/components/atoms/check-switch/__snapshots__/check-switch.test.js.snap +0 -84
  61. package/src/components/atoms/check-switch/check-switch.test.js +0 -13
  62. package/src/components/atoms/heading-components/all-caps-heading/__snapshots__/all-caps-heading.test.js.snap +0 -113
  63. package/src/components/atoms/heading-components/all-caps-heading/all-caps-heading.test.js +0 -44
  64. package/src/components/atoms/heading-components/heading1/__snapshots__/heading1.test.js.snap +0 -121
  65. package/src/components/atoms/heading-components/heading1/heading1.test.js +0 -51
  66. package/src/components/atoms/heading-components/heading2/__snapshots__/heading2.test.js.snap +0 -121
  67. package/src/components/atoms/heading-components/heading2/heading2.test.js +0 -51
  68. package/src/components/atoms/heading-components/heading3/__snapshots__/heading3.test.js.snap +0 -121
  69. package/src/components/atoms/heading-components/heading3/heading3.test.js +0 -51
  70. package/src/components/atoms/heading-components/heading4/__snapshots__/heading4.test.js.snap +0 -121
  71. package/src/components/atoms/heading-components/heading4/heading4.test.js +0 -51
  72. package/src/components/atoms/image-bubble/__snapshots__/image-bubble.test.js.snap +0 -67
  73. package/src/components/atoms/image-bubble/image-bubble.test.js +0 -20
  74. package/src/components/atoms/increment-input/__snapshots__/increment-input.test.js.snap +0 -269
  75. package/src/components/atoms/increment-input/increment-input.test.js +0 -14
  76. package/src/components/atoms/logo/__snapshots__/logo.test.js.snap +0 -113
  77. package/src/components/atoms/logo/logo.test.js +0 -16
  78. package/src/components/atoms/paragraph-components/paragraph/__snapshots__/paragraph.test.js.snap +0 -121
  79. package/src/components/atoms/paragraph-components/paragraph/paragraph.test.js +0 -76
  80. package/src/components/atoms/paragraph-components/small-text/__snapshots__/small-text.test.js.snap +0 -121
  81. package/src/components/atoms/paragraph-components/small-text/small-text.test.js +0 -76
  82. package/src/components/atoms/paragraph-components/tiny-text/__snapshots__/tiny-text.test.js.snap +0 -121
  83. package/src/components/atoms/paragraph-components/tiny-text/tiny-text.test.js +0 -76
  84. package/src/components/atoms/quick-message/__snapshots__/quick-message.test.js.snap +0 -143
  85. package/src/components/atoms/quick-message/quick-message.test.js +0 -58
  86. package/src/components/atoms/split-container/__snapshots__/split-container.test.js.snap +0 -333
  87. package/src/components/atoms/split-container/split-container.test.js +0 -45
  88. package/src/components/atoms/text-input/__snapshots__/text-input.test.js.snap +0 -123
  89. package/src/components/atoms/text-input/text-input.test.js +0 -59
  90. package/src/components/molecules/avatar/__snapshots__/avatar.test.js.snap +0 -97
  91. package/src/components/molecules/avatar/avatar.test.js +0 -22
  92. package/src/components/molecules/blocked-message/__snapshots__/blocked-message.test.js.snap +0 -107
  93. package/src/components/molecules/blocked-message/blocked-message.test.js +0 -12
  94. package/src/components/molecules/button/__snapshots__/button.test.js.snap +0 -652
  95. package/src/components/molecules/button/button.test.js +0 -56
  96. package/src/components/molecules/calendar-select/__snapshots__/calendar-select.test.js.snap +0 -343
  97. package/src/components/molecules/calendar-select/calendar-select.test.js +0 -20
  98. package/src/components/molecules/cancel-link/__snapshots__/cancel-link.test.js.snap +0 -139
  99. package/src/components/molecules/cancel-link/cancel-link.test.js +0 -28
  100. package/src/components/molecules/checkbox/__snapshots__/checkbox.test.js.snap +0 -176
  101. package/src/components/molecules/checkbox/checkbox.test.js +0 -30
  102. package/src/components/molecules/contact-role/__snapshots__/contact-role.test.js.snap +0 -113
  103. package/src/components/molecules/contact-role/contact-role.test.js +0 -18
  104. package/src/components/molecules/date-input/__snapshots__/date-input.test.js.snap +0 -140
  105. package/src/components/molecules/date-input/date-input.test.js +0 -23
  106. package/src/components/molecules/day/__snapshots__/day.test.js.snap +0 -263
  107. package/src/components/molecules/day/day.test.js +0 -37
  108. package/src/components/molecules/default-select/__snapshots__/default-select.test.js.snap +0 -140
  109. package/src/components/molecules/default-select/default-select.test.js +0 -17
  110. package/src/components/molecules/department_logo/__snapshots__/department-logo.test.js.snap +0 -27
  111. package/src/components/molecules/department_logo/department-logo.test.js +0 -12
  112. package/src/components/molecules/failed-to-send/__snapshots__/failed-bubble.test.js.snap +0 -386
  113. package/src/components/molecules/failed-to-send/failed-bubble.test.js +0 -75
  114. package/src/components/molecules/filter-range/__snapshots__/filter-range.test.js.snap +0 -208
  115. package/src/components/molecules/filter-range/filter-range.test.js +0 -20
  116. package/src/components/molecules/filter-tab/__snapshots__/filter-tab.test.js.snap +0 -536
  117. package/src/components/molecules/filter-tab/filter-tab.test.js +0 -42
  118. package/src/components/molecules/info/__snapshots__/info.test.js.snap +0 -64
  119. package/src/components/molecules/info/info.test.js +0 -18
  120. package/src/components/molecules/language-button/__snapshots__/language-button.test.js.snap +0 -129
  121. package/src/components/molecules/language-button/language-button.test.js +0 -29
  122. package/src/components/molecules/message-input/__snapshots__/message-input.test.js.snap +0 -611
  123. package/src/components/molecules/message-input/message-input.test.js +0 -63
  124. package/src/components/molecules/more-info-button/__snapshots__/more-info-button.test.js.snap +0 -133
  125. package/src/components/molecules/more-info-button/more-info-button.test.js +0 -29
  126. package/src/components/molecules/password-input/__snapshots__/password-input.test.js.snap +0 -504
  127. package/src/components/molecules/password-input/password-input.test.js +0 -46
  128. package/src/components/molecules/pill/__snapshots__/pill.test.js.snap +0 -226
  129. package/src/components/molecules/pill/pill.test.js +0 -42
  130. package/src/components/molecules/pressable-icon/__snapshots__/pressable-icon.test.js.snap +0 -460
  131. package/src/components/molecules/pressable-icon/pressable-icon.test.js +0 -51
  132. package/src/components/molecules/quick-filter/__snapshots__/quick-filter.test.js.snap +0 -557
  133. package/src/components/molecules/quick-filter/quick-filter.test.js +0 -134
  134. package/src/components/molecules/search-input/__snapshots__/search.test.js.snap +0 -145
  135. package/src/components/molecules/search-input/search.test.js +0 -22
  136. package/src/components/molecules/select-link/__snapshots__/select-link.test.js.snap +0 -70
  137. package/src/components/molecules/select-link/select-link.test.js +0 -17
  138. package/src/components/molecules/select-list-item/__snapshots__/select-list-item.test.js.snap +0 -762
  139. package/src/components/molecules/select-list-item/select-list-item.test.js +0 -38
  140. package/src/components/molecules/select-picker/__snapshots__/select-picker.test.js.snap +0 -407
  141. package/src/components/molecules/select-picker/select-picker.test.js +0 -31
  142. package/src/components/molecules/send-bubble/__snapshots__/send-text-bubble.test.js.snap +0 -1979
  143. package/src/components/molecules/send-bubble/send-text-bubble.test.js +0 -156
  144. package/src/components/molecules/snackbar/__snapshots__/snackbar.test.js.snap +0 -557
  145. package/src/components/molecules/snackbar/snackbar.test.js +0 -35
  146. package/src/components/molecules/swipe/__snapshots__/swipe.test.js.snap +0 -340
  147. package/src/components/molecules/swipe/swipe.test.js +0 -46
  148. package/src/components/molecules/tag/__snapshots__/tag.test.js.snap +0 -139
  149. package/src/components/molecules/tag/tag.test.js +0 -34
  150. package/src/components/molecules/time-picker/__snapshots__/time-picker.test.js.snap +0 -2221
  151. package/src/components/molecules/time-picker/time-picker.test.js +0 -18
  152. package/src/components/molecules/time-tracker/__snapshots__/time-tracker.test.js.snap +0 -266
  153. package/src/components/molecules/time-tracker/time-tracker.test.js +0 -36
  154. package/src/components/molecules/timeline/__snapshots__/timeline.test.js.snap +0 -257
  155. package/src/components/molecules/timeline/timeline.test.js +0 -18
  156. package/src/components/molecules/timestamp/__snapshots__/timestamp.test.js.snap +0 -28
  157. package/src/components/molecules/timestamp/timestamp.test.js +0 -16
  158. package/src/components/molecules/wave-background/__snapshots__/wave.test.js.snap +0 -173
  159. package/src/components/molecules/wave-background/wave.test.js +0 -25
  160. package/src/components/molecules/wide-button/__snapshots__/wide-button.test.js.snap +0 -269
  161. package/src/components/molecules/wide-button/wide-button.test.js +0 -30
  162. package/src/components/organisms/child-list-item/__snapshots__/child-list-item.test.js.snap +0 -1040
  163. package/src/components/organisms/child-list-item/child-list-item.test.js +0 -75
  164. package/src/components/organisms/contact-item/__snapshots__/contact-item.test.js.snap +0 -404
  165. package/src/components/organisms/contact-item/contact-item.test.js +0 -22
  166. package/src/components/organisms/loading-indicator/__snapshots__/loading-indicator.test.js.snap +0 -474
  167. package/src/components/organisms/loading-indicator/loading-indicator.test.js +0 -41
  168. package/src/components/organisms/my-child-list-item/__snapshots__/my-child-list-item.test.js.snap +0 -293
  169. package/src/components/organisms/my-child-list-item/my-child-list-item.test.js +0 -23
  170. package/src/components/organisms/person-info-card/__snapshots__/person-info-card.test.js.snap +0 -709
  171. package/src/components/organisms/person-info-card/person-info-card.test.js +0 -85
  172. package/src/components/organisms/text-bubble/__snapshots__/text-bubble.test.js.snap +0 -3046
  173. package/src/components/organisms/text-bubble/text-bubble.test.js +0 -144
  174. package/src/utilities/toddle-datetime/interfaces/duration.interface.d.ts +0 -22
  175. package/src/utilities/toddle-datetime/interfaces/duration.interface.tsx +0 -23
  176. package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.d.ts +0 -22
  177. package/src/utilities/toddle-datetime/interfaces/toddle-datetime.interface.tsx +0 -25
  178. package/src/utilities/toddle-datetime/toddle-datetime.class.d.ts +0 -50
  179. package/src/utilities/toddle-datetime/toddle-datetime.class.tsx +0 -206
  180. package/src/utilities/toddle-datetime/toddle-datetime.preview.d.ts +0 -2
  181. package/src/utilities/toddle-datetime/toddle-datetime.preview.tsx +0 -160
  182. package/src/utilities/toddle-datetime/toddle-datetime.test.js +0 -127
  183. package/src/utilities/toddle-datetime/types/duration.type.d.ts +0 -4
  184. package/src/utilities/toddle-datetime/types/duration.type.tsx +0 -6
  185. package/src/utilities/toddle-datetime/types/toddle-datetime.type.d.ts +0 -5
  186. package/src/utilities/toddle-datetime/types/toddle-datetime.type.tsx +0 -23
@@ -1,127 +0,0 @@
1
- import {DateTime as LuxonDateTime} from 'luxon';
2
- import {ToddleDateTime} from './toddle-datetime.class';
3
-
4
- describe('ToddleDateTime static members', () => {
5
- it('now() returns an instance of ToddleDateTime', () => {
6
- expect(ToddleDateTime.now()).toBeInstanceOf(ToddleDateTime);
7
- });
8
-
9
- it('fromISO() returns an instance of ToddleDateTime', () => {
10
- const date = '2022-01-01T00:00:00.000-07:00';
11
- expect(ToddleDateTime.fromISO(date)).toBeInstanceOf(ToddleDateTime);
12
- });
13
-
14
- it('fromISO() parses ISO date correctly', () => {
15
- const date = '2022-01-01T00:00:00.000-07:00';
16
- const toddleDateTime = ToddleDateTime.fromISO(date);
17
- const luxonDateTime = LuxonDateTime.fromISO(date);
18
- expect(toddleDateTime.toISODate()).toEqual(luxonDateTime.toISODate());
19
- });
20
-
21
- it('fromSeconds() returns an instance of ToddleDateTime', () => {
22
- const timestamp = 1688729520;
23
- expect(ToddleDateTime.fromSeconds(timestamp)).toBeInstanceOf(
24
- ToddleDateTime
25
- );
26
- const toddleDateTime = ToddleDateTime.fromSeconds(timestamp);
27
- const luxonDateTime = LuxonDateTime.fromSeconds(timestamp);
28
- expect(toddleDateTime.toISO()).toEqual(luxonDateTime.toISO());
29
- });
30
- });
31
-
32
- describe('ToddleDateTime FORMAT PRESETS', () => {
33
- const date = '2022-01-01T00:00:00.000-07:00';
34
- const luxonDateMed = LuxonDateTime.now(date).toLocaleString(
35
- LuxonDateTime.DATE_MED
36
- );
37
- const toddleDateMed = ToddleDateTime.now(date).toLocaleString(
38
- ToddleDateTime.DATE_MED
39
- );
40
- expect(toddleDateMed).toMatch(luxonDateMed);
41
- });
42
-
43
- describe('ToddleDateTime GET methods', () => {
44
- let dateTime;
45
- let luxonDateTime = LuxonDateTime.local();
46
-
47
- beforeEach(() => {
48
- dateTime = new ToddleDateTime(luxonDateTime);
49
- });
50
-
51
- it('day returns the day of the month', () => {
52
- expect(dateTime.day).toEqual(luxonDateTime.day);
53
- });
54
-
55
- it('weekdayShort returns the short weekday name', () => {
56
- expect(dateTime.weekdayShort).toEqual(luxonDateTime.weekdayShort);
57
- });
58
- });
59
-
60
- describe('ToddleDateTime TRANSFORM methods', () => {
61
- let dateTime;
62
- const luxonDateTime = LuxonDateTime.local();
63
-
64
- beforeEach(() => {
65
- dateTime = new ToddleDateTime(luxonDateTime);
66
- });
67
-
68
- it('plus() adds a duration to the date time', () => {
69
- const duration = {days: 7};
70
- const newDateTime = dateTime.plus(duration);
71
- expect(newDateTime.day).toEqual(luxonDateTime.plus(duration).day);
72
- });
73
-
74
- it('minus() subtracts a duration from the date time', () => {
75
- const duration = {days: 7};
76
- const newDateTime = dateTime.minus(duration);
77
- expect(newDateTime.day).toEqual(luxonDateTime.minus(duration).day);
78
- });
79
-
80
- it('startOf() changes the date time to the start of a unit', () => {
81
- dateTime.startOf('month');
82
- expect(dateTime.day).toEqual(1);
83
- });
84
-
85
- it('endOf() changes the date time to the end of a unit', () => {
86
- dateTime.endOf('year');
87
- expect(dateTime.day).toEqual(31);
88
- });
89
- });
90
-
91
- describe('ToddleDateTime OUTPUT methods', () => {
92
- let dateTime;
93
-
94
- beforeEach(() => {
95
- dateTime = ToddleDateTime.now('30-01-2023');
96
- });
97
-
98
- it('toFormat() formats the date time according to the provided format string', () => {
99
- const formattedDate = dateTime.toFormat('yyyy-MM-dd');
100
- expect(formattedDate).toMatch(dateTime.toFormat('yyyy-MM-dd'));
101
- });
102
-
103
- it('toISO() formats the date time in ISO format', () => {
104
- const formattedDate = dateTime.toISO();
105
- expect(formattedDate).toMatch(dateTime.toISO());
106
- });
107
-
108
- it('toISODate() formats the date time in ISO date format', () => {
109
- const formattedDate = dateTime.toISODate();
110
- expect(formattedDate).toMatch(dateTime.toISODate());
111
- });
112
-
113
- it('toString() formats the date time as a string', () => {
114
- const stringDate = dateTime.toString();
115
- expect(stringDate).toMatch(dateTime.toString());
116
- });
117
-
118
- it('toLocaleString() formats the date time as a locale string', () => {
119
- const localeString = dateTime.toLocaleString();
120
- expect(localeString).toMatch(dateTime.toLocaleString());
121
- });
122
-
123
- it('timestamp formats the time to a number', () => {
124
- const timestamp = dateTime.timestamp();
125
- expect(timestamp).toEqual(dateTime.timestamp());
126
- });
127
- });
@@ -1,4 +0,0 @@
1
- import { DurationLikeObject } from '../interfaces/duration.interface';
2
- export type DurationUnit = keyof DurationLikeObject;
3
- export type DurationUnits = DurationUnit | DurationUnit[];
4
- export type DurationLike = DurationLikeObject | number;
@@ -1,6 +0,0 @@
1
- import {DurationLikeObject} from '../interfaces/duration.interface';
2
-
3
- export type DurationUnit = keyof DurationLikeObject;
4
- export type DurationUnits = DurationUnit | DurationUnit[];
5
-
6
- export type DurationLike = DurationLikeObject | number;
@@ -1,5 +0,0 @@
1
- import { DateTimeOptions } from '../interfaces/toddle-datetime.interface';
2
- export type DateTimeFormatOptions = Intl.DateTimeFormatOptions;
3
- export type DateTimeUnit = 'year' | 'quarter' | 'month' | 'week' | 'day' | 'hour' | 'minute' | 'second' | 'millisecond';
4
- export type DateTimeJSOptions = Omit<DateTimeOptions, 'setZone'>;
5
- export type ConversionAccuracy = 'casual' | 'longterm';
@@ -1,23 +0,0 @@
1
- import {
2
- DateTimeOptions,
3
- LocaleOptions,
4
- } from '../interfaces/toddle-datetime.interface';
5
- import {CanBeInvalid} from 'luxon/src/_util';
6
- import {_ToObjectOutput} from 'luxon';
7
-
8
- export type DateTimeFormatOptions = Intl.DateTimeFormatOptions;
9
-
10
- export type DateTimeUnit =
11
- | 'year'
12
- | 'quarter'
13
- | 'month'
14
- | 'week'
15
- | 'day'
16
- | 'hour'
17
- | 'minute'
18
- | 'second'
19
- | 'millisecond';
20
-
21
- export type DateTimeJSOptions = Omit<DateTimeOptions, 'setZone'>;
22
-
23
- export type ConversionAccuracy = 'casual' | 'longterm';