@daryasidorovich/modsen-datepicker 1.0.1 → 1.0.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 (149) hide show
  1. package/README.md +302 -302
  2. package/package.json +122 -106
  3. package/.babelrc.json +0 -7
  4. package/.github/workflows/chromatic.yml +0 -25
  5. package/.github/workflows/ci.yml +0 -56
  6. package/.husky/commit-msg +0 -1
  7. package/.husky/pre-commit +0 -1
  8. package/.prettierignore +0 -16
  9. package/.prettierrc +0 -6
  10. package/.storybook/main.js +0 -93
  11. package/.storybook/main.ts +0 -16
  12. package/.storybook/preview-head.html +0 -6
  13. package/.storybook/preview.js +0 -26
  14. package/.storybook/preview.tsx +0 -18
  15. package/commitlint.config.js +0 -23
  16. package/eslint.config.ts +0 -80
  17. package/jest.config.json +0 -21
  18. package/rollup.config.js +0 -65
  19. package/src/assets/actions/Delete.svg +0 -4
  20. package/src/assets/actions/Edit.svg +0 -3
  21. package/src/assets/arrows/Next.svg +0 -4
  22. package/src/assets/arrows/Prev.svg +0 -4
  23. package/src/assets/input/Calendar.svg +0 -3
  24. package/src/assets/input/Clear.svg +0 -3
  25. package/src/components/BaseCalendar/BaseCalendar.stories.tsx +0 -77
  26. package/src/components/BaseCalendar/index.tsx +0 -63
  27. package/src/components/BaseCalendar/styles.module.scss +0 -15
  28. package/src/components/Button/Button.stories.tsx +0 -16
  29. package/src/components/Button/Button.tsx +0 -14
  30. package/src/components/Button/index.ts +0 -1
  31. package/src/components/Button/styles.module.scss +0 -3
  32. package/src/components/CalendarGrid/CalendarGrid.stories.tsx +0 -136
  33. package/src/components/CalendarGrid/CalendarGridWithTasks/Tooltip/index.tsx +0 -27
  34. package/src/components/CalendarGrid/CalendarGridWithTasks/Tooltip/styles.module.scss +0 -9
  35. package/src/components/CalendarGrid/CalendarGridWithTasks/index.tsx +0 -51
  36. package/src/components/CalendarGrid/CalendarGridWithoutTasks/CalendarGridWithoutTasks.test.tsx +0 -223
  37. package/src/components/CalendarGrid/CalendarGridWithoutTasks/index.tsx +0 -36
  38. package/src/components/CalendarGrid/CalendarGridWithoutTasks/styles.module.scss +0 -11
  39. package/src/components/CalendarGrid/index.tsx +0 -19
  40. package/src/components/CalendarGrid/types.ts +0 -26
  41. package/src/components/Clear/Clear.stories.tsx +0 -16
  42. package/src/components/Clear/index.tsx +0 -12
  43. package/src/components/Clear/styles.module.scss +0 -34
  44. package/src/components/DatePicker/DatePicker.stories.tsx +0 -127
  45. package/src/components/DatePicker/index.tsx +0 -72
  46. package/src/components/DatePicker/styles.module.scss +0 -10
  47. package/src/components/Day/Day.stories.tsx +0 -75
  48. package/src/components/Day/index.tsx +0 -95
  49. package/src/components/Day/styles.module.scss +0 -97
  50. package/src/components/Input/Input.stories.tsx +0 -37
  51. package/src/components/Input/index.tsx +0 -64
  52. package/src/components/Input/styles.module.scss +0 -79
  53. package/src/components/Modal/CrudModal/index.tsx +0 -43
  54. package/src/components/Modal/CrudModal/styles.module.scss +0 -44
  55. package/src/components/Modal/index.tsx +0 -66
  56. package/src/components/Modal/styles.module.scss +0 -40
  57. package/src/components/Modal/types.ts +0 -13
  58. package/src/components/Month/Month.stories.tsx +0 -19
  59. package/src/components/Month/index.tsx +0 -31
  60. package/src/components/Month/styles.module.scss +0 -30
  61. package/src/components/RangePicker/RangePicker.stories.tsx +0 -134
  62. package/src/components/RangePicker/index.tsx +0 -144
  63. package/src/components/RangePicker/styles.module.scss +0 -19
  64. package/src/components/TasksManager/AddModal/index.tsx +0 -62
  65. package/src/components/TasksManager/DeleteModal/index.tsx +0 -22
  66. package/src/components/TasksManager/EditModal/index.tsx +0 -96
  67. package/src/components/TasksManager/index.tsx +0 -112
  68. package/src/components/TasksManager/styles.module.scss +0 -62
  69. package/src/components/Week/Week.stories.tsx +0 -49
  70. package/src/components/Week/index.tsx +0 -68
  71. package/src/components/Week/styles.module.scss +0 -7
  72. package/src/components/WeekDay/WeekDay.stories.tsx +0 -38
  73. package/src/components/WeekDay/index.tsx +0 -35
  74. package/src/components/WeekDay/styles.module.scss +0 -19
  75. package/src/constants/dateMask.ts +0 -23
  76. package/src/constants/firstDayOfWeek.ts +0 -7
  77. package/src/constants/holidays.ts +0 -32
  78. package/src/constants/modes.ts +0 -6
  79. package/src/constants/monthsNames.ts +0 -14
  80. package/src/constants/weekdaysNames.ts +0 -1
  81. package/src/hooks/useCalendar.ts +0 -62
  82. package/src/hooks/useLockBodyScroll.ts +0 -19
  83. package/src/hooks/useModal.ts +0 -45
  84. package/src/hooks/useTooltip.ts +0 -41
  85. package/src/hooks/useValidate.ts +0 -80
  86. package/src/index.ts +0 -15
  87. package/src/services/calendarService.ts +0 -62
  88. package/src/services/decorators/withHolidays.test.ts +0 -64
  89. package/src/services/decorators/withHolidays.ts +0 -12
  90. package/src/services/decorators/withMinMax.test.ts +0 -77
  91. package/src/services/decorators/withMinMax.ts +0 -19
  92. package/src/services/holidayService.ts +0 -56
  93. package/src/setupTests.ts +0 -1
  94. package/src/store/localStorage.ts +0 -33
  95. package/src/store/tasksStore.test.tsx +0 -208
  96. package/src/store/tasksStore.tsx +0 -146
  97. package/src/store/types.ts +0 -22
  98. package/src/stories/Button.stories.ts +0 -54
  99. package/src/stories/Button.tsx +0 -37
  100. package/src/stories/Configure.mdx +0 -388
  101. package/src/stories/Header.stories.ts +0 -34
  102. package/src/stories/Header.tsx +0 -56
  103. package/src/stories/Page.stories.ts +0 -33
  104. package/src/stories/Page.tsx +0 -73
  105. package/src/stories/assets/accessibility.png +0 -0
  106. package/src/stories/assets/accessibility.svg +0 -1
  107. package/src/stories/assets/addon-library.png +0 -0
  108. package/src/stories/assets/assets.png +0 -0
  109. package/src/stories/assets/avif-test-image.avif +0 -0
  110. package/src/stories/assets/context.png +0 -0
  111. package/src/stories/assets/discord.svg +0 -1
  112. package/src/stories/assets/docs.png +0 -0
  113. package/src/stories/assets/figma-plugin.png +0 -0
  114. package/src/stories/assets/github.svg +0 -1
  115. package/src/stories/assets/share.png +0 -0
  116. package/src/stories/assets/styling.png +0 -0
  117. package/src/stories/assets/testing.png +0 -0
  118. package/src/stories/assets/theming.png +0 -0
  119. package/src/stories/assets/tutorials.svg +0 -1
  120. package/src/stories/assets/youtube.svg +0 -1
  121. package/src/stories/button.css +0 -30
  122. package/src/stories/header.css +0 -32
  123. package/src/stories/page.css +0 -68
  124. package/src/styles/_border.scss +0 -9
  125. package/src/styles/_colors.scss +0 -53
  126. package/src/styles/_gap.scss +0 -4
  127. package/src/styles/_globals.scss +0 -61
  128. package/src/styles/_grid.scss +0 -9
  129. package/src/styles/_mixins.scss +0 -6
  130. package/src/styles/_reset.scss +0 -98
  131. package/src/styles/_theme-mixins.scss +0 -51
  132. package/src/styles/_typography.scss +0 -10
  133. package/src/styles/_variables.scss +0 -8
  134. package/src/styles/main.scss +0 -3
  135. package/src/types/types.d.ts +0 -15
  136. package/src/utils/calendar.test.ts +0 -154
  137. package/src/utils/calendar.ts +0 -82
  138. package/src/utils/controlDate.ts +0 -3
  139. package/src/utils/dateChecks.test.ts +0 -216
  140. package/src/utils/dateChecks.ts +0 -75
  141. package/src/utils/formatDate.test.ts +0 -57
  142. package/src/utils/formatDate.ts +0 -27
  143. package/src/utils/schema.test.ts +0 -40
  144. package/src/utils/schema.ts +0 -8
  145. package/src/utils/weekdayOrder.test.ts +0 -11
  146. package/src/utils/weekdayOrder.ts +0 -7
  147. package/tsconfig.json +0 -31
  148. package/vitest.config.ts +0 -38
  149. package/vitest.shims.d.ts +0 -1
@@ -1,216 +0,0 @@
1
- import {
2
- isCurrentMonth,
3
- isDisabled,
4
- isInRange,
5
- isRangeEnd,
6
- isRangeStart,
7
- isSameDay,
8
- isSelected,
9
- isToday,
10
- isWeekend,
11
- } from './dateChecks';
12
-
13
- describe('dateChecks:', () => {
14
- describe('isSameDay:', () => {
15
- it('returns true for same day', () => {
16
- const date1 = new Date(2026, 7, 25);
17
- const date2 = new Date(2026, 7, 25);
18
- expect(isSameDay(date1, date2)).toBe(true);
19
- });
20
-
21
- it('returns false for different days', () => {
22
- const date1 = new Date(2026, 7, 25);
23
- const date2 = new Date(2026, 7, 26);
24
- expect(isSameDay(date1, date2)).toBe(false);
25
- });
26
-
27
- it('returns false for different months', () => {
28
- const date1 = new Date(2026, 7, 25);
29
- const date2 = new Date(2026, 8, 25);
30
- expect(isSameDay(date1, date2)).toBe(false);
31
- });
32
-
33
- it('returns false for different years', () => {
34
- const date1 = new Date(2026, 7, 25);
35
- const date2 = new Date(2027, 7, 25);
36
- expect(isSameDay(date1, date2)).toBe(false);
37
- });
38
- });
39
-
40
- describe('isCurrentMonth:', () => {
41
- it('returns true for same month and year', () => {
42
- const date = new Date(2026, 7, 25);
43
- const monthDate = new Date(2026, 7, 1);
44
- expect(isCurrentMonth(date, monthDate)).toBe(true);
45
- });
46
-
47
- it('returns false for different month', () => {
48
- const date = new Date(2026, 9, 1);
49
- const monthDate = new Date(2026, 8, 1);
50
- expect(isCurrentMonth(date, monthDate)).toBe(false);
51
- });
52
-
53
- it('returns false for different year', () => {
54
- const date = new Date(2026, 9, 25);
55
- const monthDate = new Date(2027, 9, 1);
56
- expect(isCurrentMonth(date, monthDate)).toBe(false);
57
- });
58
- });
59
-
60
- describe('isWeekend:', () => {
61
- it('returns true for Sunday', () => {
62
- const sunday = new Date(2026, 8, 6);
63
- expect(isWeekend(sunday)).toBe(true);
64
- });
65
-
66
- it('returns true for Saturday', () => {
67
- const saturday = new Date(2026, 8, 5);
68
- expect(isWeekend(saturday)).toBe(true);
69
- });
70
-
71
- it('returns false for Wednesday', () => {
72
- const wednesday = new Date(2026, 8, 9);
73
- expect(isWeekend(wednesday)).toBe(false);
74
- });
75
- });
76
-
77
- describe('isToday', () => {
78
- it('returns true for today', () => {
79
- const today = new Date();
80
- expect(isToday(today)).toBe(true);
81
- });
82
-
83
- it('returns false for random date', () => {
84
- const random = new Date(2026, 2, 9);
85
- expect(isToday(random)).toBe(false);
86
- });
87
- });
88
-
89
- describe('isSelected:', () => {
90
- it('returns true when date is selected', () => {
91
- const date = new Date(2026, 7, 25);
92
- const selectedDate = new Date(2026, 7, 25);
93
- expect(isSelected(date, selectedDate)).toBe(true);
94
- });
95
-
96
- it('returns false when date is not selected', () => {
97
- const date = new Date(2026, 7, 25);
98
- const selectedDate = new Date(2026, 7, 26);
99
- expect(isSelected(date, selectedDate)).toBe(false);
100
- });
101
-
102
- it('returns false when selectedDate is undefined', () => {
103
- const date = new Date(2026, 7, 25);
104
- expect(isSelected(date, undefined)).toBe(false);
105
- });
106
- });
107
-
108
- describe('isDisabled', () => {
109
- it('returns true when date is before minDate', () => {
110
- const date = new Date(2026, 7, 25);
111
- const minDate = new Date(2026, 7, 26);
112
- expect(isDisabled(date, minDate)).toBe(true);
113
- });
114
-
115
- it('returns true when date is after maxDate', () => {
116
- const date = new Date(2026, 7, 25);
117
- const maxDate = new Date(2026, 7, 24);
118
- expect(isDisabled(date, null, maxDate)).toBe(true);
119
- });
120
-
121
- it('returns false when date is within range', () => {
122
- const date = new Date(2026, 7, 25);
123
- const minDate = new Date(2026, 7, 20);
124
- const maxDate = new Date(2026, 7, 30);
125
- expect(isDisabled(date, minDate, maxDate)).toBe(false);
126
- });
127
-
128
- it('returns false when minDate and maxDate are null', () => {
129
- const date = new Date(2026, 7, 25);
130
- expect(isDisabled(date, null, null)).toBe(false);
131
- });
132
-
133
- it('returns false when date equals minDate', () => {
134
- const date = new Date(2026, 7, 25);
135
- const minDate = new Date(2026, 7, 25);
136
- expect(isDisabled(date, minDate, null)).toBe(false);
137
- });
138
-
139
- it('returns false when date equals maxDate', () => {
140
- const date = new Date(2026, 7, 25);
141
- const maxDate = new Date(2026, 7, 25);
142
- expect(isDisabled(date, null, maxDate)).toBe(false);
143
- });
144
- });
145
-
146
- describe('isInRange:', () => {
147
- it('returns true when date is between start and end', () => {
148
- const date = new Date(2026, 7, 25);
149
- const start = new Date(2026, 7, 20);
150
- const end = new Date(2026, 7, 30);
151
- expect(isInRange(date, start, end)).toBe(true);
152
- });
153
-
154
- it('returns false when date equals start', () => {
155
- const date = new Date(2026, 7, 20);
156
- const start = new Date(2026, 7, 20);
157
- const end = new Date(2026, 7, 30);
158
- expect(isInRange(date, start, end)).toBe(false);
159
- });
160
-
161
- it('returns false when date equals end', () => {
162
- const date = new Date(2026, 7, 30);
163
- const start = new Date(2026, 7, 20);
164
- const end = new Date(2026, 7, 30);
165
- expect(isInRange(date, start, end)).toBe(false);
166
- });
167
-
168
- it('returns false when start is undefined', () => {
169
- const date = new Date(2026, 7, 25);
170
- expect(isInRange(date, undefined, new Date(2026, 7, 30))).toBe(false);
171
- });
172
-
173
- it('returns false when end is undefined', () => {
174
- const date = new Date(2026, 7, 25);
175
- expect(isInRange(date, new Date(2026, 7, 20), undefined)).toBe(false);
176
- });
177
- });
178
-
179
- describe('isRangeStart', () => {
180
- it('returns true when date equals start', () => {
181
- const date = new Date(2026, 7, 25);
182
- const start = new Date(2026, 7, 25);
183
- expect(isRangeStart(date, start)).toBe(true);
184
- });
185
-
186
- it('returns false when date does not equal start', () => {
187
- const date = new Date(2026, 7, 25);
188
- const start = new Date(2026, 7, 26);
189
- expect(isRangeStart(date, start)).toBe(false);
190
- });
191
-
192
- it('returns false when start is undefined', () => {
193
- const date = new Date(2026, 7, 25);
194
- expect(isRangeStart(date, undefined)).toBe(false);
195
- });
196
- });
197
-
198
- describe('isRangeEnd:', () => {
199
- it('returns true when date equals end', () => {
200
- const date = new Date(2026, 7, 25);
201
- const end = new Date(2026, 7, 25);
202
- expect(isRangeEnd(date, end)).toBe(true);
203
- });
204
-
205
- it('returns false when date does not equal end', () => {
206
- const date = new Date(2026, 7, 25);
207
- const end = new Date(2026, 7, 26);
208
- expect(isRangeEnd(date, end)).toBe(false);
209
- });
210
-
211
- it('returns false when end is undefined', () => {
212
- const date = new Date(2026, 7, 25);
213
- expect(isRangeEnd(date, undefined)).toBe(false);
214
- });
215
- });
216
- });
@@ -1,75 +0,0 @@
1
- import { formatDateForInput } from './formatDate';
2
-
3
- export const isSameDay = (date1: Date, date2: Date) => {
4
- return (
5
- date1.getFullYear() === date2.getFullYear() &&
6
- date1.getMonth() === date2.getMonth() &&
7
- date1.getDate() === date2.getDate()
8
- );
9
- };
10
-
11
- export const isCurrentMonth = (date: Date, monthDate: Date) => {
12
- return (
13
- date.getMonth() === monthDate.getMonth() &&
14
- date.getFullYear() === monthDate.getFullYear()
15
- );
16
- };
17
-
18
- export const isWeekend = (date: Date) => {
19
- return date.getDay() === 0 || date.getDay() === 6;
20
- };
21
-
22
- export const isToday = (date: Date) => {
23
- return isSameDay(date, new Date());
24
- };
25
-
26
- export const isSelected = (date: Date, selectedDate?: Date) => {
27
- if (!selectedDate) return false;
28
- return isSameDay(date, selectedDate);
29
- };
30
-
31
- export const isDisabled = (
32
- date: Date,
33
- minDate?: Date | null,
34
- maxDate?: Date | null
35
- ): boolean => {
36
- if (minDate && date < minDate) return true;
37
- if (maxDate && date > maxDate) return true;
38
- return false;
39
- };
40
-
41
- export const isInRange = (date: Date, start?: Date, end?: Date) => {
42
- if (!start || !end) return false;
43
-
44
- const dateStart = new Date(
45
- start.getFullYear(),
46
- start.getMonth(),
47
- start.getDate()
48
- );
49
- const dateEnd = new Date(end.getFullYear(), end.getMonth(), end.getDate());
50
- const dateToCheck = new Date(
51
- date.getFullYear(),
52
- date.getMonth(),
53
- date.getDate()
54
- );
55
-
56
- return dateToCheck > dateStart && dateToCheck < dateEnd;
57
- };
58
-
59
- export const isRangeStart = (date: Date, start?: Date) => {
60
- if (!start) return false;
61
- return isSameDay(date, start);
62
- };
63
-
64
- export const isRangeEnd = (date: Date, end?: Date) => {
65
- if (!end) return false;
66
- return isSameDay(date, end);
67
- };
68
-
69
- export const getRangeError = (date: Date, startDate: Date): string => {
70
- if (startDate && date < startDate) {
71
- return `Date must be after ${formatDateForInput(startDate)}`;
72
- }
73
-
74
- return '';
75
- };
@@ -1,57 +0,0 @@
1
- import { formatDate, formatDateForInput, parseDate } from './formatDate';
2
-
3
- describe('formatting dates:', () => {
4
- test('formatDate:', () => {
5
- const date1 = new Date(2026, 0, 3);
6
- const date2 = new Date(2024, 5, 15);
7
- const date3 = new Date(2000, 11, 31);
8
- const date4 = new Date(1999, 8, 9);
9
- const date5 = new Date(2025, 2, 1);
10
-
11
- expect(formatDate(date1)).toBe('2026-01-03');
12
- expect(formatDate(date2)).toBe('2024-06-15');
13
- expect(formatDate(date3)).toBe('2000-12-31');
14
- expect(formatDate(date4)).toBe('1999-09-09');
15
- expect(formatDate(date5)).toBe('2025-03-01');
16
- });
17
-
18
- test('formatDateForInput:', () => {
19
- const date1 = new Date(2026, 0, 3);
20
- const date2 = new Date(2024, 5, 15);
21
- const date3 = new Date(2000, 11, 31);
22
- const date4 = new Date(1999, 8, 9);
23
- const date5 = new Date(2025, 2, 1);
24
-
25
- expect(formatDateForInput(date1)).toBe('03/01/2026');
26
- expect(formatDateForInput(date2)).toBe('15/06/2024');
27
- expect(formatDateForInput(date3)).toBe('31/12/2000');
28
- expect(formatDateForInput(date4)).toBe('09/09/1999');
29
- expect(formatDateForInput(date5)).toBe('01/03/2025');
30
- });
31
-
32
- describe('parseDate:', () => {
33
- test('returns parsed date', () => {
34
- const date1 = '03/03/2026';
35
- const date2 = '15/06/2024';
36
- const date3 = '31/12/2000';
37
- const date4 = '09/09/1999';
38
- const date5 = '01/03/2025';
39
-
40
- expect(parseDate(date1)).toEqual(new Date(2026, 2, 3));
41
- expect(parseDate(date2)).toEqual(new Date(2024, 5, 15));
42
- expect(parseDate(date3)).toEqual(new Date(2000, 11, 31));
43
- expect(parseDate(date4)).toEqual(new Date(1999, 8, 9));
44
- expect(parseDate(date5)).toEqual(new Date(2025, 2, 1));
45
- });
46
-
47
- test('returns null id date is invalid', () => {
48
- const date1 = '31/02/2026';
49
- const date2 = '00/06/2024';
50
- const date3 = '31/14/2000';
51
-
52
- expect(parseDate(date1)).toBeNull();
53
- expect(parseDate(date2)).toBeNull();
54
- expect(parseDate(date3)).toBeNull();
55
- });
56
- });
57
- });
@@ -1,27 +0,0 @@
1
- export const formatDate = (date: Date): string => {
2
- const year = date.getFullYear();
3
- const month = String(date.getMonth() + 1).padStart(2, '0');
4
- const day = String(date.getDate()).padStart(2, '0');
5
- return `${year}-${month}-${day}`;
6
- };
7
-
8
- export const formatDateForInput = (date: Date): string => {
9
- const year = date.getFullYear();
10
- const month = String(date.getMonth() + 1).padStart(2, '0');
11
- const day = String(date.getDate()).padStart(2, '0');
12
- return `${day}/${month}/${year}`;
13
- };
14
-
15
- export const parseDate = (value: string): Date | null => {
16
- if (!value.trim()) return null;
17
-
18
- const [day, month, year] = value.split('/').map(Number);
19
- const parsed = new Date(year, month - 1, day);
20
-
21
- const isValid =
22
- parsed.getFullYear() === year &&
23
- parsed.getMonth() === month - 1 &&
24
- parsed.getDate() === day;
25
-
26
- return isValid ? parsed : null;
27
- };
@@ -1,40 +0,0 @@
1
- import z from 'zod';
2
-
3
- import { formSchema } from './schema';
4
-
5
- describe('formSchema:', () => {
6
- it('successfully validates correct data', () => {
7
- const validData = { title: 'Run 100 km', date: '2026-03-11' };
8
- const result = formSchema.safeParse(validData);
9
-
10
- expect(result.success).toBe(true);
11
- if (result.success) {
12
- expect(result.data).toEqual(validData);
13
- }
14
- });
15
-
16
- it('returns an error if title is shorter than 3 characters', () => {
17
- const result = formSchema.safeParse({ title: 'Ru', date: '2026-03-11' });
18
-
19
- expect(result.success).toBe(false);
20
- if (!result.success) {
21
- const errors = z.treeifyError(result.error).properties;
22
- expect(errors?.title?.errors).toContain(
23
- 'Title must be at least 3 characters'
24
- );
25
- }
26
- });
27
-
28
- it('returns an error if date format is incorrect', () => {
29
- const result = formSchema.safeParse({
30
- title: 'Run 100 km',
31
- date: '2026.01.13',
32
- });
33
-
34
- expect(result.success).toBe(false);
35
- if (!result.success) {
36
- const errors = z.treeifyError(result.error).properties;
37
- expect(errors?.date?.errors).toContain('Incorrect date format');
38
- }
39
- });
40
- });
@@ -1,8 +0,0 @@
1
- import * as z from 'zod';
2
-
3
- export const formSchema = z.object({
4
- title: z.string().min(3, 'Title must be at least 3 characters'),
5
- date: z.string().regex(/^\d{4}-\d{2}-\d{2}$/, 'Incorrect date format'),
6
- });
7
-
8
- export type FormData = z.infer<typeof formSchema>;
@@ -1,11 +0,0 @@
1
- import { getOrderedDays } from './weekdayOrder';
2
-
3
- describe('getOrderedDays:', () => {
4
- test('returns indexes for Sunday', () => {
5
- expect(getOrderedDays(0)).toEqual([0, 1, 2, 3, 4, 5, 6]);
6
- });
7
-
8
- test('returns indexes for Monday', () => {
9
- expect(getOrderedDays(1)).toEqual([1, 2, 3, 4, 5, 6, 0]);
10
- });
11
- });
@@ -1,7 +0,0 @@
1
- export const getOrderedDays = (firstDayOfWeek: 0 | 1): Array<number> => {
2
- if (firstDayOfWeek === 0) {
3
- return [0, 1, 2, 3, 4, 5, 6];
4
- } else {
5
- return [1, 2, 3, 4, 5, 6, 0];
6
- }
7
- };
package/tsconfig.json DELETED
@@ -1,31 +0,0 @@
1
- {
2
- "compilerOptions": {
3
- "target": "ES2022",
4
- "lib": ["DOM", "ES2022"],
5
- "allowJs": true,
6
- "skipLibCheck": true,
7
- "esModuleInterop": true,
8
- "allowSyntheticDefaultImports": true,
9
- "strict": true,
10
- "forceConsistentCasingInFileNames": true,
11
- "moduleResolution": "bundler",
12
- "resolveJsonModule": true,
13
- "isolatedModules": true,
14
- "noEmit": false,
15
- "importHelpers": true,
16
- "jsx": "react-jsx",
17
- "declaration": true,
18
- "rootDir": "src",
19
- "module": "ESNext",
20
- "types": ["jest", "@testing-library/jest-dom", "node"],
21
- "paths": {
22
- "@/*": ["./src/*"],
23
- "@components/*": ["./src/components/*"],
24
- "@utils/*": ["./src/utils/*"],
25
- "@styles/*": ["./src/styles/*"],
26
- "@assets/*": ["./src/assets/*"]
27
- }
28
- },
29
- "include": ["src"],
30
- "exclude": ["lib", "node_modules", "**/*.stories.tsx"]
31
- }
package/vitest.config.ts DELETED
@@ -1,38 +0,0 @@
1
- import path from 'node:path';
2
- import { fileURLToPath } from 'node:url';
3
-
4
- import { defineConfig } from 'vitest/config';
5
-
6
- import { storybookTest } from '@storybook/addon-vitest/vitest-plugin';
7
-
8
- import { playwright } from '@vitest/browser-playwright';
9
-
10
- const dirname =
11
- typeof __dirname !== 'undefined'
12
- ? __dirname
13
- : path.dirname(fileURLToPath(import.meta.url));
14
-
15
- // More info at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon
16
- export default defineConfig({
17
- test: {
18
- projects: [
19
- {
20
- extends: true,
21
- plugins: [
22
- // The plugin will run tests for the stories defined in your Storybook config
23
- // See options at: https://storybook.js.org/docs/next/writing-tests/integrations/vitest-addon#storybooktest
24
- storybookTest({ configDir: path.join(dirname, '.storybook') }),
25
- ],
26
- test: {
27
- name: 'storybook',
28
- browser: {
29
- enabled: true,
30
- headless: true,
31
- provider: playwright({}),
32
- instances: [{ browser: 'chromium' }],
33
- },
34
- },
35
- },
36
- ],
37
- },
38
- });
package/vitest.shims.d.ts DELETED
@@ -1 +0,0 @@
1
- /// <reference types="@vitest/browser-playwright" />