datepicker-pashuk 1.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (63) hide show
  1. package/README.md +161 -0
  2. package/dist/index.cjs.js +1163 -0
  3. package/dist/index.cjs.js.map +1 -0
  4. package/dist/index.esm.js +1158 -0
  5. package/dist/index.esm.js.map +1 -0
  6. package/dist/types/.storybook/main.d.ts +3 -0
  7. package/dist/types/.storybook/preview.d.ts +4 -0
  8. package/dist/types/jest.setup.d.ts +1 -0
  9. package/dist/types/src/entities/buggyComponent/ui/BuggyComponent.d.ts +1 -0
  10. package/dist/types/src/entities/calendar/assets/NextIcon.d.ts +1 -0
  11. package/dist/types/src/entities/calendar/assets/PreviousIcon.d.ts +1 -0
  12. package/dist/types/src/entities/calendar/assets/index.d.ts +2 -0
  13. package/dist/types/src/entities/calendar/lib/decorators/BaseCalendarEngine.d.ts +9 -0
  14. package/dist/types/src/entities/calendar/lib/decorators/CalenderDecorator.d.ts +7 -0
  15. package/dist/types/src/entities/calendar/lib/decorators/FromMondayDecorator.d.ts +7 -0
  16. package/dist/types/src/entities/calendar/lib/decorators/HolidayDecorator.d.ts +7 -0
  17. package/dist/types/src/entities/calendar/lib/decorators/MinMaxDecorator.d.ts +12 -0
  18. package/dist/types/src/entities/calendar/lib/decorators/RangeCalenderDecorator.d.ts +23 -0
  19. package/dist/types/src/entities/calendar/lib/decorators/TodoDecorator.d.ts +13 -0
  20. package/dist/types/src/entities/calendar/lib/decorators/ViewByWeekDecorator.d.ts +8 -0
  21. package/dist/types/src/entities/calendar/lib/decorators/WeekdayDecorator.d.ts +6 -0
  22. package/dist/types/src/entities/calendar/lib/helpers/generateMonthArray.d.ts +4 -0
  23. package/dist/types/src/entities/calendar/lib/helpers/generateYearArray.d.ts +1 -0
  24. package/dist/types/src/entities/calendar/lib/helpers/isMinMaxValue.d.ts +1 -0
  25. package/dist/types/src/entities/calendar/lib/helpers/isSameDates.d.ts +1 -0
  26. package/dist/types/src/entities/calendar/lib/helpers/validationInput.d.ts +4 -0
  27. package/dist/types/src/entities/calendar/lib/tests/constants.d.ts +67 -0
  28. package/dist/types/src/entities/calendar/model/constants.d.ts +7 -0
  29. package/dist/types/src/entities/calendar/model/service.d.ts +35 -0
  30. package/dist/types/src/entities/calendar/model/storageService.d.ts +7 -0
  31. package/dist/types/src/entities/calendar/model/types.d.ts +75 -0
  32. package/dist/types/src/entities/calendar/ui/BaseCalendar/BaseCalendar.d.ts +2 -0
  33. package/dist/types/src/entities/calendar/ui/CalendarCell/CalendarCell.d.ts +2 -0
  34. package/dist/types/src/entities/calendar/ui/CalendarGrid/CalendarGrid.d.ts +2 -0
  35. package/dist/types/src/entities/calendar/ui/CalendarHeader/CalendarHeader.d.ts +2 -0
  36. package/dist/types/src/features/calendar/Calendar.d.ts +2 -0
  37. package/dist/types/src/features/calendar/model/constants.d.ts +5 -0
  38. package/dist/types/src/features/calendarWithInput/CalendarWithInput.d.ts +2 -0
  39. package/dist/types/src/features/calendarWithInput/model/types.d.ts +5 -0
  40. package/dist/types/src/features/calenderWithTodo/lib/helperTests.d.ts +91 -0
  41. package/dist/types/src/features/calenderWithTodo/lib/useCalendarPortal.d.ts +8 -0
  42. package/dist/types/src/features/calenderWithTodo/ui/CalenderWithTodo.d.ts +2 -0
  43. package/dist/types/src/features/rangeCalender/lib/useDateRangePicker.d.ts +23 -0
  44. package/dist/types/src/features/rangeCalender/model/types.d.ts +5 -0
  45. package/dist/types/src/features/rangeCalender/ui/RangeCalender.d.ts +2 -0
  46. package/dist/types/src/index.d.ts +5 -0
  47. package/dist/types/src/shared/lib/getThemed.d.ts +2 -0
  48. package/dist/types/src/shared/lib/useCalendarService.d.ts +6 -0
  49. package/dist/types/src/shared/model/constants.d.ts +3 -0
  50. package/dist/types/src/shared/model/helperTest.d.ts +33 -0
  51. package/dist/types/src/shared/ui/ErrorBoundary/types/types.d.ts +7 -0
  52. package/dist/types/src/shared/ui/ErrorBoundary/ui/ErrorBoundary.d.ts +9 -0
  53. package/dist/types/src/shared/ui/Input/lib/maskDate.d.ts +1 -0
  54. package/dist/types/src/shared/ui/Input/model/constants.d.ts +4 -0
  55. package/dist/types/src/shared/ui/Input/model/types.d.ts +9 -0
  56. package/dist/types/src/shared/ui/Input/ui/Input.d.ts +2 -0
  57. package/dist/types/src/shared/ui/Input/ui/InputWithState.d.ts +2 -0
  58. package/dist/types/src/shared/ui/Input/ui/assets/CalendarIcon.d.ts +1 -0
  59. package/dist/types/src/shared/ui/Input/ui/assets/CloseIcon.d.ts +1 -0
  60. package/dist/types/src/shared/ui/Input/ui/assets/index.d.ts +2 -0
  61. package/dist/types/src/shared/ui/Portal/model/types.d.ts +18 -0
  62. package/dist/types/src/shared/ui/Portal/ui/Portal.d.ts +2 -0
  63. package/package.json +93 -0
package/README.md ADDED
@@ -0,0 +1,161 @@
1
+ # DatePicker Library
2
+
3
+ React calendar library built with a focus on architectural clean code and flexibility. The library employs the Decorator and Observer patterns to manage complex logic and dynamically add functionality like holiday highlighting, range selection, and TODO management.
4
+
5
+ ## Table of Contents
6
+
7
+ - [Features](#features)
8
+ - [Architecture](#architecture)
9
+ - [Technologies](#technologies)
10
+ - [Installation](#installation)
11
+ - [API Reference](#api-reference)
12
+ - [Storybook](#storybook)
13
+
14
+ ---
15
+
16
+ ## Features
17
+
18
+ - **Flexible Views:** Switch between standard month view and week-by-week view.
19
+ - **Decorator Pattern:** Logic is extended via decorators (Range, Holiday, Todo, etc.).
20
+ - **Customization:**
21
+ - Choose week start (Monday or Sunday).
22
+ - Toggle weekend visibility.
23
+ - Highlight custom holiday dates.
24
+ - **Boundary Control:** Set `minDate` and `maxDate` limits.
25
+ - **TODO Integration:** Add and save tasks for specific days in `localStorage`.
26
+ - **Theming:** Full support for Light and Dark modes.
27
+ - **Input Support:** Manual date entry with validation.
28
+ - **Robustness:** test coverage and Error Boundary protection.
29
+
30
+ ---
31
+
32
+ ## Architecture
33
+
34
+ The project follows FSD methodology:
35
+
36
+ - **Entities:** Core calendar logic, types, and the base CalendarCell.
37
+ - **Features:** Implementation of the DatePicker with Input and Todo integration.
38
+ - **Shared:** Reusable UI components, helpers, and hooks.
39
+
40
+ ### The Decorator Pattern
41
+
42
+ The core logic is handled by a `BaseCalendarEngine`. Specific features are added by wrapping the engine:
43
+
44
+ 1. `HolidayDecorator`: Injects holiday status into days.
45
+ 2. `WeekendDecorator`: Identifies weekends.
46
+ 3. `RangeDecorator`: Manages date range selection logic.
47
+ 4. `TodoDecorator`: Connects days with local storage tasks.
48
+ 5. `FromMondayDecorator`: Start week from Monday.
49
+ 6. `MinMaxDecorator`: Minimum and maximum selectable date.
50
+ 7. `ViewByWeekDecorator`: View by week.
51
+
52
+ ---
53
+
54
+ ## Technologies
55
+
56
+ - **Core:** React 19, TypeScript, SCSS
57
+ - **Build Tools:** Rollup, Babel
58
+ - **Code Quality:** ESLint, Prettier, Husky, Commitlint
59
+ - **Testing:** Jest, react testing library
60
+ - **Documentation:** Storybook, Chromatic
61
+ - **CI/CD:** GitHub Actions
62
+
63
+ ---
64
+
65
+ ## API Reference
66
+
67
+ Note: All properties are optional.
68
+
69
+ | Prop | Type | Default | Description |
70
+ | :------------ | :-------- | :------------- | :---------------------------------- |
71
+ | `fromMonday` | `boolean` | `false` | Start the week on Monday. |
72
+ | `withHoliday` | `boolean` | `false` | Enable holiday highlighting. |
73
+ | `holidays` | `Date[]` | `[]` | Array of holiday dates. |
74
+ | `withWeekend` | `boolean` | `false` | Highlight or show weekends. |
75
+ | `minDate` | `Date` | `undefined` | Minimum selectable date. |
76
+ | `maxDate` | `Date` | `undefined` | Maximum selectable date. |
77
+ | `defaultDate` | `Date` | `current date` | Initial date displayed in calendar. |
78
+ | `viewByWeek` | `boolean` | `false` | Toggle between month and week view. |
79
+ | `withRange` | `boolean` | `false` | Enable date range selection. |
80
+ | `withTodo` | `boolean` | `false` | Enable task management system. |
81
+ | `darkThemed` | `boolean` | `false` | Enable dark theme. |
82
+
83
+ ---
84
+
85
+ ## Storybook
86
+
87
+ Visual documentation and component isolation are handled by Storybook. You can explore all decorators and features in the interactive environment.
88
+
89
+ ```bash
90
+ # locally
91
+ npm run storybook
92
+ ```
93
+
94
+ **Available Stories:**
95
+
96
+ - `Decorators/Calendar`: Basic configurations.
97
+ - `Decorators/RangeCalendar`: Selection of date ranges.
98
+ - `Features/CalendarWithTodo`: Full TODO functionality.
99
+ - `Features/CalendarWithInput`: Input-driven date selection.
100
+
101
+ ---
102
+
103
+ ## 🔌 Installation
104
+
105
+ ```bash
106
+ npm install datepicker-pashuk
107
+ # or
108
+ yarn add datepicker-pashuk
109
+ ```
110
+
111
+ ## Component Modes & Usage
112
+
113
+ Choose the component that best fits your specific use case.
114
+
115
+ ### 1. Basic Calendar
116
+
117
+ Standard calendar for single date selection.
118
+
119
+ ```tsx
120
+ import { Calendar } from 'datepicker-pashuk';
121
+
122
+ <Calendar />;
123
+ ```
124
+
125
+ You can add any props from API:
126
+
127
+ ```tsx
128
+ import { Calendar } from 'datepicker-pashuk';
129
+
130
+ <Calendar fromMonday={true} withWeekend={true} darkThemed={false} />;
131
+ ```
132
+
133
+ ### 2. Range Selection
134
+
135
+ Enables period selection logic. The first click sets the start date, and the second click sets the end date. The range between them is visually highlighted.You can add any props from API
136
+
137
+ ```tsx
138
+ import { RangeCalendar } from 'datepicker-pashuk';
139
+
140
+ <RangeCalendar withRange={true} />;
141
+ ```
142
+
143
+ ### 3. Manual Input Integration
144
+
145
+ A composition of a text input and a calendar. Features real-time manual entry validation and bidirectional synchronization between the input field and the calendar view.You can add any props from API
146
+
147
+ ```tsx
148
+ import { CalendarWithInput } from 'datepicker-pashuk';
149
+
150
+ <CalendarWithInput />;
151
+ ```
152
+
153
+ ### 4. Task Management (Todo)
154
+
155
+ Integrates a task scheduler. Users can add notes to specific dates, which are persisted via `localStorage`. Dates with tasks are marked with a visual indicator.You can add any props from API
156
+
157
+ ```tsx
158
+ import { CalendarWithTodo } from 'datepicker-pashuk';
159
+
160
+ <CalendarWithTodo />;
161
+ ```