@daryasidorovich/modsen-datepicker 1.0.0 → 1.0.2

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 (118) hide show
  1. package/README.md +302 -302
  2. package/package.json +111 -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/preview-head.html +0 -6
  12. package/.storybook/preview.js +0 -26
  13. package/.storybook/preview.tsx +0 -18
  14. package/commitlint.config.js +0 -23
  15. package/eslint.config.ts +0 -80
  16. package/jest.config.json +0 -21
  17. package/rollup.config.js +0 -65
  18. package/src/assets/actions/Delete.svg +0 -4
  19. package/src/assets/actions/Edit.svg +0 -3
  20. package/src/assets/arrows/Next.svg +0 -4
  21. package/src/assets/arrows/Prev.svg +0 -4
  22. package/src/assets/input/Calendar.svg +0 -3
  23. package/src/assets/input/Clear.svg +0 -3
  24. package/src/components/BaseCalendar/BaseCalendar.stories.tsx +0 -77
  25. package/src/components/BaseCalendar/index.tsx +0 -63
  26. package/src/components/BaseCalendar/styles.module.scss +0 -15
  27. package/src/components/CalendarGrid/CalendarGrid.stories.tsx +0 -136
  28. package/src/components/CalendarGrid/CalendarGridWithTasks/Tooltip/index.tsx +0 -27
  29. package/src/components/CalendarGrid/CalendarGridWithTasks/Tooltip/styles.module.scss +0 -9
  30. package/src/components/CalendarGrid/CalendarGridWithTasks/index.tsx +0 -51
  31. package/src/components/CalendarGrid/CalendarGridWithoutTasks/CalendarGridWithoutTasks.test.tsx +0 -223
  32. package/src/components/CalendarGrid/CalendarGridWithoutTasks/index.tsx +0 -36
  33. package/src/components/CalendarGrid/CalendarGridWithoutTasks/styles.module.scss +0 -11
  34. package/src/components/CalendarGrid/index.tsx +0 -19
  35. package/src/components/CalendarGrid/types.ts +0 -26
  36. package/src/components/Clear/Clear.stories.tsx +0 -16
  37. package/src/components/Clear/index.tsx +0 -12
  38. package/src/components/Clear/styles.module.scss +0 -34
  39. package/src/components/DatePicker/DatePicker.stories.tsx +0 -127
  40. package/src/components/DatePicker/index.tsx +0 -72
  41. package/src/components/DatePicker/styles.module.scss +0 -10
  42. package/src/components/Day/Day.stories.tsx +0 -75
  43. package/src/components/Day/index.tsx +0 -95
  44. package/src/components/Day/styles.module.scss +0 -97
  45. package/src/components/Input/Input.stories.tsx +0 -37
  46. package/src/components/Input/index.tsx +0 -64
  47. package/src/components/Input/styles.module.scss +0 -79
  48. package/src/components/Modal/CrudModal/index.tsx +0 -43
  49. package/src/components/Modal/CrudModal/styles.module.scss +0 -44
  50. package/src/components/Modal/index.tsx +0 -66
  51. package/src/components/Modal/styles.module.scss +0 -40
  52. package/src/components/Modal/types.ts +0 -13
  53. package/src/components/Month/Month.stories.tsx +0 -19
  54. package/src/components/Month/index.tsx +0 -31
  55. package/src/components/Month/styles.module.scss +0 -30
  56. package/src/components/RangePicker/RangePicker.stories.tsx +0 -134
  57. package/src/components/RangePicker/index.tsx +0 -144
  58. package/src/components/RangePicker/styles.module.scss +0 -19
  59. package/src/components/TasksManager/AddModal/index.tsx +0 -62
  60. package/src/components/TasksManager/DeleteModal/index.tsx +0 -22
  61. package/src/components/TasksManager/EditModal/index.tsx +0 -96
  62. package/src/components/TasksManager/index.tsx +0 -112
  63. package/src/components/TasksManager/styles.module.scss +0 -62
  64. package/src/components/Week/Week.stories.tsx +0 -49
  65. package/src/components/Week/index.tsx +0 -68
  66. package/src/components/Week/styles.module.scss +0 -7
  67. package/src/components/WeekDay/WeekDay.stories.tsx +0 -38
  68. package/src/components/WeekDay/index.tsx +0 -35
  69. package/src/components/WeekDay/styles.module.scss +0 -19
  70. package/src/constants/dateMask.ts +0 -23
  71. package/src/constants/firstDayOfWeek.ts +0 -7
  72. package/src/constants/holidays.ts +0 -32
  73. package/src/constants/modes.ts +0 -6
  74. package/src/constants/monthsNames.ts +0 -14
  75. package/src/constants/weekdaysNames.ts +0 -1
  76. package/src/hooks/useCalendar.ts +0 -62
  77. package/src/hooks/useLockBodyScroll.ts +0 -19
  78. package/src/hooks/useModal.ts +0 -45
  79. package/src/hooks/useTooltip.ts +0 -41
  80. package/src/hooks/useValidate.ts +0 -80
  81. package/src/index.ts +0 -15
  82. package/src/services/calendarService.ts +0 -62
  83. package/src/services/decorators/withHolidays.test.ts +0 -64
  84. package/src/services/decorators/withHolidays.ts +0 -12
  85. package/src/services/decorators/withMinMax.test.ts +0 -77
  86. package/src/services/decorators/withMinMax.ts +0 -19
  87. package/src/services/holidayService.ts +0 -56
  88. package/src/setupTests.ts +0 -1
  89. package/src/store/localStorage.ts +0 -33
  90. package/src/store/tasksStore.test.tsx +0 -208
  91. package/src/store/tasksStore.tsx +0 -146
  92. package/src/store/types.ts +0 -22
  93. package/src/styles/_border.scss +0 -9
  94. package/src/styles/_colors.scss +0 -53
  95. package/src/styles/_gap.scss +0 -4
  96. package/src/styles/_globals.scss +0 -61
  97. package/src/styles/_grid.scss +0 -9
  98. package/src/styles/_mixins.scss +0 -6
  99. package/src/styles/_reset.scss +0 -98
  100. package/src/styles/_theme-mixins.scss +0 -51
  101. package/src/styles/_typography.scss +0 -10
  102. package/src/styles/_variables.scss +0 -8
  103. package/src/styles/main.scss +0 -3
  104. package/src/types/types.d.ts +0 -15
  105. package/src/utils/calendar.test.ts +0 -154
  106. package/src/utils/calendar.ts +0 -82
  107. package/src/utils/controlDate.ts +0 -3
  108. package/src/utils/dateChecks.test.ts +0 -216
  109. package/src/utils/dateChecks.ts +0 -75
  110. package/src/utils/formatDate.test.ts +0 -57
  111. package/src/utils/formatDate.ts +0 -27
  112. package/src/utils/schema.test.ts +0 -40
  113. package/src/utils/schema.ts +0 -8
  114. package/src/utils/weekdayOrder.test.ts +0 -11
  115. package/src/utils/weekdayOrder.ts +0 -7
  116. package/tsconfig.json +0 -31
  117. package/vitest.config.ts +0 -38
  118. package/vitest.shims.d.ts +0 -1
@@ -1,77 +0,0 @@
1
- import { isDisabled } from '@/utils/dateChecks';
2
-
3
- import { CalendarService } from '../calendarService';
4
- import { withMinMax } from './withMinMax';
5
-
6
- jest.mock('@/utils/dateChecks', () => ({
7
- isDisabled: jest.fn(),
8
- }));
9
-
10
- describe('withMinMax:', () => {
11
- let calendar: CalendarService;
12
-
13
- beforeEach(() => {
14
- calendar = new CalendarService();
15
- jest.clearAllMocks();
16
- });
17
-
18
- it('returns the same calendar instance', () => {
19
- const result = withMinMax(
20
- calendar,
21
- new Date(2026, 0, 1),
22
- new Date(2026, 11, 31)
23
- );
24
-
25
- expect(result).toBe(calendar);
26
- });
27
-
28
- it('returns true when the date is outside the min/max range', () => {
29
- calendar.getIsDisabled = jest.fn().mockReturnValue(false);
30
- (isDisabled as jest.Mock).mockReturnValue(true);
31
-
32
- withMinMax(calendar, new Date(2026, 0, 1), new Date(2026, 11, 31));
33
- const result = calendar.getIsDisabled(new Date(2027, 0, 1));
34
-
35
- expect(result).toBe(true);
36
- });
37
-
38
- it('returns false when the date passes both checks', () => {
39
- calendar.getIsDisabled = jest.fn().mockReturnValue(false);
40
- (isDisabled as jest.Mock).mockReturnValue(false);
41
-
42
- withMinMax(calendar, new Date(2026, 0, 1), new Date(2026, 11, 31));
43
- const result = calendar.getIsDisabled(new Date(2026, 5, 15));
44
-
45
- expect(result).toBe(false);
46
- });
47
-
48
- it('works with only minDate provided', () => {
49
- calendar.getIsDisabled = jest.fn().mockReturnValue(false);
50
- (isDisabled as jest.Mock).mockReturnValue(false);
51
-
52
- const minDate = new Date(2026, 0, 1);
53
- withMinMax(calendar, minDate);
54
- calendar.getIsDisabled(new Date(2026, 5, 15));
55
-
56
- expect(isDisabled).toHaveBeenCalledWith(
57
- new Date(2026, 5, 15),
58
- minDate,
59
- undefined
60
- );
61
- });
62
-
63
- it('works with only maxDate provided', () => {
64
- calendar.getIsDisabled = jest.fn().mockReturnValue(false);
65
- (isDisabled as jest.Mock).mockReturnValue(false);
66
-
67
- const maxDate = new Date(2026, 11, 31);
68
- withMinMax(calendar, undefined, maxDate);
69
- calendar.getIsDisabled(new Date(2026, 5, 15));
70
-
71
- expect(isDisabled).toHaveBeenCalledWith(
72
- new Date(2026, 5, 15),
73
- undefined,
74
- maxDate
75
- );
76
- });
77
- });
@@ -1,19 +0,0 @@
1
- import { isDisabled } from '@/utils/dateChecks';
2
-
3
- import { CalendarService } from '../calendarService';
4
-
5
- export function withMinMax(
6
- calendar: CalendarService,
7
- minDate?: Date,
8
- maxDate?: Date
9
- ) {
10
- const original = calendar.getIsDisabled;
11
-
12
- calendar.getIsDisabled = (date: Date): boolean => {
13
- if (original(date)) return true;
14
-
15
- return isDisabled(date, minDate, maxDate);
16
- };
17
-
18
- return calendar;
19
- }
@@ -1,56 +0,0 @@
1
- const HOLIDAY_API_URL = process.env.STORYBOOK_HOLIDAY_API_URL;
2
- const API_KEY = process.env.STORYBOOK_HOLIDAY_API_KEY;
3
-
4
- export interface Holiday {
5
- name: string;
6
- date: string;
7
- }
8
-
9
- export const getHolidays = async (
10
- year: number = new Date().getFullYear(),
11
- signal?: AbortSignal
12
- ): Promise<Date[]> => {
13
- try {
14
- let holidayDates;
15
- const locale = new Intl.Locale(navigator.language);
16
- const countryCode = locale.region;
17
-
18
- if (!countryCode) {
19
- throw new Error('Cannot get your country code');
20
- }
21
-
22
- if (!API_KEY) {
23
- throw new Error('API key is not defined');
24
- }
25
-
26
- const url = `${HOLIDAY_API_URL}?key=${API_KEY}&country=${countryCode}&year=${year}`;
27
- const response = await fetch(url, { signal });
28
-
29
- if (!response.ok) {
30
- throw new Error(`Error while loading holidays`);
31
- }
32
-
33
- const data = await response.json();
34
-
35
- if (data.holidays) {
36
- holidayDates = data.holidays.map((holiday: Holiday) => {
37
- const date = new Date(holiday.date);
38
- return new Date(date.getFullYear(), date.getMonth(), date.getDate());
39
- });
40
-
41
- return holidayDates;
42
- }
43
-
44
- return [];
45
- } catch (err) {
46
- if (err instanceof Error && err.name === 'AbortError') {
47
- throw new Error('Fetch aborted');
48
- }
49
-
50
- if (err instanceof Error) {
51
- throw err;
52
- }
53
-
54
- throw new Error('Failed to fetch holidays');
55
- }
56
- };
package/src/setupTests.ts DELETED
@@ -1 +0,0 @@
1
- import '@testing-library/jest-dom';
@@ -1,33 +0,0 @@
1
- import { Task } from './types';
2
-
3
- const STORAGE_KEY = 'tasks';
4
-
5
- export const loadTasksFromStorage = (): Task[] => {
6
- try {
7
- const stored = localStorage.getItem(STORAGE_KEY);
8
- if (stored) {
9
- const parsed = JSON.parse(stored);
10
- return parsed.map((task: Task) => ({
11
- ...task,
12
- date: new Date(task.date),
13
- }));
14
- }
15
- } catch (error) {
16
- throw new Error(
17
- error instanceof Error
18
- ? error.message
19
- : 'Failed to load tasks from storage'
20
- );
21
- }
22
- return [];
23
- };
24
-
25
- export const saveTasksToStorage = (tasks: Task[]): void => {
26
- try {
27
- localStorage.setItem(STORAGE_KEY, JSON.stringify(tasks));
28
- } catch (error) {
29
- throw new Error(
30
- error instanceof Error ? error.message : 'Failed to save tasks to storage'
31
- );
32
- }
33
- };
@@ -1,208 +0,0 @@
1
- import { render, screen, waitFor } from '@testing-library/react';
2
- import { userEvent } from '@testing-library/user-event';
3
- import { TasksProvider, useTasks } from '@/store/tasksStore';
4
- import { loadTasksFromStorage, saveTasksToStorage } from './localStorage';
5
-
6
- jest.mock('@/store/localStorage', () => ({
7
- loadTasksFromStorage: jest.fn(),
8
- saveTasksToStorage: jest.fn(),
9
- }));
10
-
11
- const TestComponent = () => {
12
- const {
13
- tasks,
14
- error,
15
- getTasksByDate,
16
- hasTasks,
17
- addTask,
18
- editTask,
19
- deleteTask,
20
- toggleTask,
21
- } = useTasks();
22
-
23
- return (
24
- <div>
25
- {error && <div data-testid="error">{error}</div>}
26
-
27
- <div data-testid="tasks-count">Count: {tasks.length}</div>
28
- <ul data-testid="tasks-list">
29
- {Array.isArray(tasks) &&
30
- tasks.map((task) => (
31
- <li key={task.id}>
32
- <p data-testid={`task-title-${task.id}`}>{task.title}</p>
33
- <span data-testid={`task-completed-${task.id}`}>
34
- {task.completed ? 'yes' : 'no'}
35
- </span>
36
- <button
37
- data-testid={`toggle-${task.id}`}
38
- onClick={() => toggleTask(task.id)}
39
- >
40
- Toggle
41
- </button>
42
- <button
43
- data-testid={`delete-${task.id}`}
44
- onClick={() => deleteTask(task.id)}
45
- >
46
- Delete
47
- </button>
48
- <button
49
- data-testid={`edit-${task.id}`}
50
- onClick={() => editTask(task.id, { title: 'Edited task' })}
51
- ></button>
52
- </li>
53
- ))}
54
- </ul>
55
-
56
- <div data-testid="has-tasks-today">
57
- Has tasks today:
58
- {Array.isArray(tasks) && hasTasks(new Date()) ? 'yes' : 'no'}
59
- </div>
60
- <div data-testid="tasks-by-date">
61
- Tasks today: {Array.isArray(tasks) && getTasksByDate(new Date()).length}
62
- </div>
63
-
64
- <button
65
- data-testid="add-task-btn"
66
- onClick={() => addTask(new Date(), 'New task')}
67
- >
68
- Add Task
69
- </button>
70
- </div>
71
- );
72
- };
73
-
74
- describe('TasksContext:', () => {
75
- beforeEach(() => {
76
- jest.resetAllMocks();
77
- });
78
-
79
- const mockTasks = [
80
- { id: '1', date: new Date(), title: 'Task 1', completed: false },
81
- { id: '2', date: new Date(), title: 'Task 2', completed: true },
82
- ];
83
-
84
- test('loads tasks from localStorage on mount:', () => {
85
- (loadTasksFromStorage as jest.Mock).mockReturnValue(mockTasks);
86
-
87
- render(
88
- <TasksProvider>
89
- <TestComponent />
90
- </TasksProvider>
91
- );
92
-
93
- expect(screen.getByTestId('tasks-count')).toHaveTextContent('Count: 2');
94
-
95
- expect(screen.getByTestId('task-title-1')).toHaveTextContent('Task 1');
96
- expect(screen.getByTestId('task-title-2')).toHaveTextContent('Task 2');
97
- });
98
-
99
- test('adds task correctly:', async () => {
100
- (loadTasksFromStorage as jest.Mock).mockReturnValue([]);
101
-
102
- render(
103
- <TasksProvider>
104
- <TestComponent />
105
- </TasksProvider>
106
- );
107
-
108
- expect(screen.getByTestId('tasks-count')).toHaveTextContent('Count: 0');
109
-
110
- await userEvent.click(screen.getByTestId('add-task-btn'));
111
-
112
- expect(screen.getByTestId('tasks-count')).toHaveTextContent('Count: 1');
113
- expect(screen.getByText('New task')).toBeInTheDocument();
114
-
115
- expect(saveTasksToStorage).toHaveBeenCalled();
116
- expect(saveTasksToStorage).toHaveBeenCalledWith([
117
- expect.objectContaining({ title: 'New task' }),
118
- ]);
119
- });
120
-
121
- test('edits task correctly:', async () => {
122
- (loadTasksFromStorage as jest.Mock).mockReturnValue(mockTasks);
123
-
124
- render(
125
- <TasksProvider>
126
- <TestComponent />
127
- </TasksProvider>
128
- );
129
-
130
- await userEvent.click(screen.getByTestId('edit-1'));
131
-
132
- expect(screen.getByTestId('task-title-1')).toHaveTextContent('Edited task');
133
- });
134
-
135
- test('deletes task correctly', async () => {
136
- (loadTasksFromStorage as jest.Mock).mockReturnValue(mockTasks);
137
-
138
- render(
139
- <TasksProvider>
140
- <TestComponent />
141
- </TasksProvider>
142
- );
143
-
144
- expect(screen.getByTestId('task-title-1')).toBeInTheDocument();
145
-
146
- await userEvent.click(screen.getByTestId('delete-1'));
147
-
148
- expect(screen.queryByTestId('task-title-1')).not.toBeInTheDocument();
149
- expect(screen.getByTestId('tasks-count')).toHaveTextContent('Count: 1');
150
- });
151
-
152
- test('toggles task completion status', async () => {
153
- (loadTasksFromStorage as jest.Mock).mockReturnValue(mockTasks);
154
-
155
- render(
156
- <TasksProvider>
157
- <TestComponent />
158
- </TasksProvider>
159
- );
160
-
161
- expect(screen.getByTestId('task-completed-1')).toHaveTextContent('no');
162
-
163
- await userEvent.click(screen.getByTestId('toggle-1'));
164
-
165
- expect(screen.getByTestId('task-completed-1')).toHaveTextContent('yes');
166
- });
167
-
168
- test('checks if tasks exist for a date', () => {
169
- (loadTasksFromStorage as jest.Mock).mockReturnValue(mockTasks);
170
-
171
- render(
172
- <TasksProvider>
173
- <TestComponent />
174
- </TasksProvider>
175
- );
176
-
177
- expect(screen.getByTestId('has-tasks-today')).toHaveTextContent('yes');
178
- });
179
-
180
- test('gets tasks by date', () => {
181
- (loadTasksFromStorage as jest.Mock).mockReturnValue(mockTasks);
182
-
183
- render(
184
- <TasksProvider>
185
- <TestComponent />
186
- </TasksProvider>
187
- );
188
-
189
- expect(screen.getByTestId('tasks-by-date')).toHaveTextContent(
190
- 'Tasks today: 2'
191
- );
192
- });
193
-
194
- test('handles loading error', () => {
195
- const errorMessage = 'Failed to load tasks';
196
- (loadTasksFromStorage as jest.Mock).mockImplementation(() => {
197
- throw new Error(errorMessage);
198
- });
199
-
200
- render(
201
- <TasksProvider>
202
- <TestComponent />
203
- </TasksProvider>
204
- );
205
-
206
- expect(screen.getByTestId('error')).toHaveTextContent(errorMessage);
207
- });
208
- });
@@ -1,146 +0,0 @@
1
- import {
2
- createContext,
3
- ReactNode,
4
- useCallback,
5
- useContext,
6
- useEffect,
7
- useState,
8
- } from 'react';
9
-
10
- import { isSameDay } from '@/utils/dateChecks';
11
-
12
- import { loadTasksFromStorage, saveTasksToStorage } from './localStorage';
13
- import { Task, TasksContextValue } from './types';
14
-
15
- const TasksContext = createContext<TasksContextValue | null>(null);
16
-
17
- interface TasksProviderProps {
18
- children: ReactNode;
19
- }
20
-
21
- export const TasksProvider = ({ children }: TasksProviderProps) => {
22
- const [tasks, setTasks] = useState<Task[]>([]);
23
- const [loading, setLoading] = useState(false);
24
- const [error, setError] = useState<string>('');
25
-
26
- const loadTasks = useCallback(() => {
27
- setLoading(true);
28
- setError('');
29
- try {
30
- const loadedTasks = loadTasksFromStorage();
31
- setTasks(loadedTasks);
32
- } catch (err) {
33
- setError(err instanceof Error ? err.message : 'Failed to load tasks');
34
- } finally {
35
- setLoading(false);
36
- }
37
- }, []);
38
-
39
- useEffect(() => {
40
- loadTasks();
41
- }, [loadTasks]);
42
-
43
- const getTasksByDate = (date: Date) => {
44
- return tasks.filter((task) => isSameDay(task.date, date));
45
- };
46
-
47
- const hasTasks = (date: Date) => {
48
- return tasks.some((task) => isSameDay(task.date, date));
49
- };
50
-
51
- const addTask = (date: Date, title: string) => {
52
- const newTask = {
53
- id: Date.now().toString(),
54
- date,
55
- title,
56
- completed: false,
57
- };
58
-
59
- setTasks((prev) => {
60
- const updated = [...prev, newTask];
61
- saveTasksToStorage(updated);
62
- return updated;
63
- });
64
-
65
- return newTask;
66
- };
67
-
68
- const editTask = (id: string, updates: Partial<Omit<Task, 'id'>>) => {
69
- let result: Task | undefined;
70
-
71
- setTasks((prevTasks) => {
72
- const updatedTasks = prevTasks.map((task) => {
73
- if (task.id === id) {
74
- result = { ...task, ...updates };
75
- return result;
76
- }
77
- return task;
78
- });
79
-
80
- saveTasksToStorage(updatedTasks);
81
- return updatedTasks;
82
- });
83
-
84
- return result;
85
- };
86
-
87
- const deleteTask = (id: string) => {
88
- let deleted = false;
89
-
90
- setTasks((prev) => {
91
- const updated = prev.filter((task) => {
92
- if (task.id === id) {
93
- deleted = true;
94
- return false;
95
- }
96
- return true;
97
- });
98
- saveTasksToStorage(updated);
99
- return updated;
100
- });
101
-
102
- return deleted;
103
- };
104
-
105
- const toggleTask = (id: string) => {
106
- let toggledTask;
107
-
108
- setTasks((prev) => {
109
- const updated = prev.map((task) => {
110
- if (task.id === id) {
111
- toggledTask = { ...task, completed: !task.completed };
112
- return toggledTask;
113
- }
114
- return task;
115
- });
116
- saveTasksToStorage(updated);
117
- return updated;
118
- });
119
-
120
- return toggledTask;
121
- };
122
-
123
- const value = {
124
- tasks,
125
- loading,
126
- error,
127
- getTasksByDate,
128
- hasTasks,
129
- addTask,
130
- editTask,
131
- deleteTask,
132
- toggleTask,
133
- loadTasks,
134
- };
135
- return (
136
- <TasksContext.Provider value={value}>{children}</TasksContext.Provider>
137
- );
138
- };
139
-
140
- export const useTasks = () => {
141
- const context = useContext(TasksContext);
142
- if (!context) {
143
- throw new Error('Error while loading context');
144
- }
145
- return context;
146
- };
@@ -1,22 +0,0 @@
1
- export interface Task {
2
- id: string;
3
- date: Date;
4
- title: string;
5
- completed: boolean;
6
- }
7
-
8
- export interface TasksContextValue {
9
- tasks: Task[];
10
- loading: boolean;
11
- error: string;
12
- getTasksByDate: (date: Date) => Task[];
13
- hasTasks: (date: Date) => boolean;
14
- addTask: (date: Date, title: string) => Task;
15
- editTask: (
16
- id: string,
17
- updates: Partial<Omit<Task, 'id'>>
18
- ) => Task | undefined;
19
- deleteTask: (id: string) => boolean;
20
- toggleTask: (id: string) => Task | undefined;
21
- loadTasks: () => void;
22
- }
@@ -1,9 +0,0 @@
1
- $radius-8: 8px;
2
-
3
- $border-width: 1px;
4
- $border-solid: solid;
5
-
6
- @mixin border {
7
- border-style: $border-solid;
8
- border-width: $border-width;
9
- }
@@ -1,53 +0,0 @@
1
- @use 'sass:map';
2
-
3
- $colors: (
4
- color-blue: #2f80ed,
5
- color-blue-60: #2f81ed93,
6
- color-blue-10: #2f81ed2a,
7
-
8
- color-white: #ffffff,
9
- color-black: #333333,
10
-
11
- color-red: #ff383c,
12
- color-green: #62d0a2,
13
- color-light-gray: #e1e1e1,
14
- color-gray: #aaaaaa,
15
- color-dark-gray: #2c314466,
16
- );
17
-
18
- @function color($key) {
19
- @return map.get($colors, $key);
20
- }
21
-
22
- $themes: (
23
- light: (
24
- border: color(color-light-gray),
25
- background: color(color-white),
26
- text: color(color-black),
27
- middle-blue: color(color-blue-60),
28
- light-blue: color(color-blue-10),
29
- blue: color(color-blue),
30
- disabled: color(color-gray),
31
- selected: color(color-blue),
32
- accent: color(color-red),
33
- marker: color(color-green),
34
- white-color: color(color-white),
35
- button-hover: color(color-blue-60),
36
- overlay: color(color-dark-gray),
37
- ),
38
- dark: (
39
- border: color(color-gray),
40
- background: color(color-black),
41
- text: color(color-white),
42
- middle-blue: color(color-blue-60),
43
- light-blue: color(color-blue-10),
44
- blue: color(color-blue),
45
- disabled: color(color-gray),
46
- selected: color(color-blue),
47
- accent: color(color-red),
48
- marker: color(color-green),
49
- white-color: color(color-light-gray),
50
- button-hover: color(color-gray),
51
- overlay: color(color-dark-gray),
52
- ),
53
- );
@@ -1,4 +0,0 @@
1
- $gap-5: 5px;
2
- $gap-8: 8px;
3
- $gap-10: 10px;
4
- $gap-24: 24px;
@@ -1,61 +0,0 @@
1
- @use './colors' as *;
2
- @use './typography' as *;
3
- @use './border' as *;
4
- @use './variables' as *;
5
- @use './mixins' as *;
6
- @use './theme-mixins' as *;
7
-
8
- html {
9
- &.is-lock {
10
- overflow: hidden;
11
- }
12
- }
13
-
14
- body {
15
- font-weight: $font-weight-regular;
16
- font-family: $font-family-base;
17
- font-size: $font-size-14;
18
-
19
- @include themify($themes) {
20
- color: themed('text');
21
- background: themed('gradient');
22
- }
23
- }
24
-
25
- h1,
26
- h2 {
27
- margin: 0;
28
- }
29
-
30
- h1 {
31
- font-size: $font-size-15;
32
- font-weight: $font-weight-semibold;
33
- }
34
-
35
- h2 {
36
- font-weight: $font-weight-bold;
37
- }
38
-
39
- a,
40
- button,
41
- label,
42
- input,
43
- textarea,
44
- select,
45
- svg * {
46
- transition:
47
- color $transition-duration $easing,
48
- background-color $transition-duration $easing,
49
- border-color $transition-duration $easing,
50
- fill $transition-duration $easing,
51
- opacity $transition-duration $easing;
52
- }
53
-
54
- a,
55
- button {
56
- &:has(svg) {
57
- display: flex;
58
- justify-content: center;
59
- align-items: center;
60
- }
61
- }
@@ -1,9 +0,0 @@
1
- @use './mixins' as *;
2
- @use './gap' as *;
3
-
4
- .grid {
5
- display: grid;
6
- width: 100%;
7
-
8
- grid-template-columns: repeat(7, 1fr);
9
- }