@code-rhapsodie/react-scheduler 0.4.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 (142) hide show
  1. package/LICENSE +7 -0
  2. package/dist/App.d.ts +3 -0
  3. package/dist/assets/icons/index.d.ts +3 -0
  4. package/dist/assets/icons/types.d.ts +5 -0
  5. package/dist/components/Calendar/Calendar.d.ts +4 -0
  6. package/dist/components/Calendar/Grid/Grid.d.ts +5 -0
  7. package/dist/components/Calendar/Grid/index.d.ts +1 -0
  8. package/dist/components/Calendar/Grid/styles.d.ts +6 -0
  9. package/dist/components/Calendar/Grid/types.d.ts +10 -0
  10. package/dist/components/Calendar/Header/Header.d.ts +4 -0
  11. package/dist/components/Calendar/Header/Topbar/Topbar.d.ts +4 -0
  12. package/dist/components/Calendar/Header/Topbar/index.d.ts +1 -0
  13. package/dist/components/Calendar/Header/Topbar/styles.d.ts +8 -0
  14. package/dist/components/Calendar/Header/Topbar/types.d.ts +5 -0
  15. package/dist/components/Calendar/Header/index.d.ts +1 -0
  16. package/dist/components/Calendar/Header/styles.d.ts +4 -0
  17. package/dist/components/Calendar/Header/types.d.ts +6 -0
  18. package/dist/components/Calendar/index.d.ts +1 -0
  19. package/dist/components/Calendar/styles.d.ts +4 -0
  20. package/dist/components/Calendar/types.d.ts +12 -0
  21. package/dist/components/ConfigPanel/ConfigPanel.d.ts +4 -0
  22. package/dist/components/ConfigPanel/index.d.ts +1 -0
  23. package/dist/components/ConfigPanel/styles.d.ts +8 -0
  24. package/dist/components/ConfigPanel/types.d.ts +5 -0
  25. package/dist/components/EmptyBox/EmptyBox.d.ts +3 -0
  26. package/dist/components/EmptyBox/index.d.ts +1 -0
  27. package/dist/components/EmptyBox/styles.d.ts +3 -0
  28. package/dist/components/Icon/Icon.d.ts +4 -0
  29. package/dist/components/Icon/index.d.ts +2 -0
  30. package/dist/components/Icon/types.d.ts +8 -0
  31. package/dist/components/IconButton/IconButton.d.ts +4 -0
  32. package/dist/components/IconButton/index.d.ts +1 -0
  33. package/dist/components/IconButton/styles.d.ts +2 -0
  34. package/dist/components/IconButton/types.d.ts +10 -0
  35. package/dist/components/LeftColumn/LeftColumn.d.ts +4 -0
  36. package/dist/components/LeftColumn/LeftColumnItem/LeftColumnItem.d.ts +4 -0
  37. package/dist/components/LeftColumn/LeftColumnItem/index.d.ts +1 -0
  38. package/dist/components/LeftColumn/LeftColumnItem/styles.d.ts +7 -0
  39. package/dist/components/LeftColumn/LeftColumnItem/types.d.ts +14 -0
  40. package/dist/components/LeftColumn/index.d.ts +1 -0
  41. package/dist/components/LeftColumn/styles.d.ts +5 -0
  42. package/dist/components/LeftColumn/types.d.ts +15 -0
  43. package/dist/components/Loader/Loader.d.ts +4 -0
  44. package/dist/components/Loader/index.d.ts +1 -0
  45. package/dist/components/Loader/styles.d.ts +3 -0
  46. package/dist/components/Loader/types.d.ts +6 -0
  47. package/dist/components/PaginationButton/PaginationButton.d.ts +4 -0
  48. package/dist/components/PaginationButton/index.d.ts +1 -0
  49. package/dist/components/PaginationButton/styles.d.ts +5 -0
  50. package/dist/components/PaginationButton/types.d.ts +11 -0
  51. package/dist/components/Scheduler/Scheduler.d.ts +4 -0
  52. package/dist/components/Scheduler/styles.d.ts +3 -0
  53. package/dist/components/Scheduler/types.d.ts +16 -0
  54. package/dist/components/Tiles/Tile/Tile.d.ts +4 -0
  55. package/dist/components/Tiles/Tile/index.d.ts +1 -0
  56. package/dist/components/Tiles/Tile/styles.d.ts +6 -0
  57. package/dist/components/Tiles/Tile/types.d.ts +10 -0
  58. package/dist/components/Tiles/Tiles.d.ts +4 -0
  59. package/dist/components/Tiles/index.d.ts +1 -0
  60. package/dist/components/Tiles/types.d.ts +8 -0
  61. package/dist/components/Toggle/Toggle.d.ts +4 -0
  62. package/dist/components/Toggle/index.d.ts +1 -0
  63. package/dist/components/Toggle/styles.d.ts +4 -0
  64. package/dist/components/Toggle/types.d.ts +3 -0
  65. package/dist/components/Tooltip/Tooltip.d.ts +4 -0
  66. package/dist/components/Tooltip/index.d.ts +1 -0
  67. package/dist/components/Tooltip/styles.d.ts +9 -0
  68. package/dist/components/Tooltip/types.d.ts +5 -0
  69. package/dist/components/index.d.ts +16 -0
  70. package/dist/constants.d.ts +50 -0
  71. package/dist/context/CalendarProvider/CalendarProvider.d.ts +6 -0
  72. package/dist/context/CalendarProvider/calendarContext.d.ts +3 -0
  73. package/dist/context/CalendarProvider/index.d.ts +1 -0
  74. package/dist/context/CalendarProvider/types.d.ts +38 -0
  75. package/dist/context/LocaleProvider/LocaleProvider.d.ts +6 -0
  76. package/dist/context/LocaleProvider/index.d.ts +1 -0
  77. package/dist/context/LocaleProvider/localeContext.d.ts +3 -0
  78. package/dist/context/LocaleProvider/locales.d.ts +9 -0
  79. package/dist/context/LocaleProvider/types.d.ts +34 -0
  80. package/dist/hooks/types.d.ts +39 -0
  81. package/dist/hooks/usePagination.d.ts +3 -0
  82. package/dist/index.cjs +554 -0
  83. package/dist/index.css +2 -0
  84. package/dist/index.d.ts +5 -0
  85. package/dist/index.js +4875 -0
  86. package/dist/locales/de.d.ts +17 -0
  87. package/dist/locales/en.d.ts +17 -0
  88. package/dist/locales/es.d.ts +17 -0
  89. package/dist/locales/fr.d.ts +17 -0
  90. package/dist/locales/he.d.ts +17 -0
  91. package/dist/locales/index.d.ts +10 -0
  92. package/dist/locales/it.d.ts +17 -0
  93. package/dist/locales/lt.d.ts +17 -0
  94. package/dist/locales/pl.d.ts +17 -0
  95. package/dist/locales/ptBR.d.ts +17 -0
  96. package/dist/locales/ro.d.ts +17 -0
  97. package/dist/main.d.ts +1 -0
  98. package/dist/mock/appMock.d.ts +5 -0
  99. package/dist/styles.d.ts +15 -0
  100. package/dist/types/global.d.ts +172 -0
  101. package/dist/types/guards.d.ts +2 -0
  102. package/dist/utils/dates.d.ts +6 -0
  103. package/dist/utils/drawDashedLine.d.ts +2 -0
  104. package/dist/utils/drawGrid/drawCell.d.ts +2 -0
  105. package/dist/utils/drawGrid/drawGrid.d.ts +3 -0
  106. package/dist/utils/drawGrid/drawHourlyView.d.ts +3 -0
  107. package/dist/utils/drawGrid/drawMonthlyView.d.ts +3 -0
  108. package/dist/utils/drawGrid/drawYearlyView.d.ts +3 -0
  109. package/dist/utils/drawHeader/drawHeader.d.ts +3 -0
  110. package/dist/utils/drawHeader/drawRows/DrawZoom2MonthsOnTop.d.ts +3 -0
  111. package/dist/utils/drawHeader/drawRows/drawDaysOnBottom.d.ts +3 -0
  112. package/dist/utils/drawHeader/drawRows/drawMonthsInMiddle.d.ts +3 -0
  113. package/dist/utils/drawHeader/drawRows/drawMonthsOnTop.d.ts +3 -0
  114. package/dist/utils/drawHeader/drawRows/drawWeeksInMiddle.d.ts +3 -0
  115. package/dist/utils/drawHeader/drawRows/drawWeeksOnBottom.d.ts +3 -0
  116. package/dist/utils/drawHeader/drawRows/drawYearsOnTop.d.ts +3 -0
  117. package/dist/utils/drawHeader/drawRows/drawZoom2DaysInMiddle.d.ts +3 -0
  118. package/dist/utils/drawHeader/drawRows/drawZoom2HoursOnBottom.d.ts +3 -0
  119. package/dist/utils/drawRow.d.ts +3 -0
  120. package/dist/utils/getBoxFillStyle.d.ts +3 -0
  121. package/dist/utils/getCanvasWidth.d.ts +1 -0
  122. package/dist/utils/getCols.d.ts +2 -0
  123. package/dist/utils/getDatesRange.d.ts +11 -0
  124. package/dist/utils/getDayOccupancy.d.ts +3 -0
  125. package/dist/utils/getDuration.d.ts +2 -0
  126. package/dist/utils/getHourOccupancy.d.ts +3 -0
  127. package/dist/utils/getOccupancy.d.ts +3 -0
  128. package/dist/utils/getProjectsOnGrid.d.ts +5 -0
  129. package/dist/utils/getTextStyle.d.ts +3 -0
  130. package/dist/utils/getTileProperties.d.ts +3 -0
  131. package/dist/utils/getTileTextColor.d.ts +13 -0
  132. package/dist/utils/getTileXAndWidth.d.ts +5 -0
  133. package/dist/utils/getTimeOccupancy.d.ts +2 -0
  134. package/dist/utils/getTooltipData.d.ts +2 -0
  135. package/dist/utils/getTotalHoursAndMinutes.d.ts +5 -0
  136. package/dist/utils/getTotalRowsPerPage.d.ts +2 -0
  137. package/dist/utils/getWeekOccupancy.d.ts +3 -0
  138. package/dist/utils/resizeCanvas.d.ts +1 -0
  139. package/dist/utils/setProjectsInRows.d.ts +2 -0
  140. package/dist/utils/splitToPages.d.ts +2 -0
  141. package/package.json +98 -0
  142. package/readme.md +369 -0
package/package.json ADDED
@@ -0,0 +1,98 @@
1
+ {
2
+ "name": "@code-rhapsodie/react-scheduler",
3
+ "version": "0.4.0",
4
+ "type": "module",
5
+ "license": "MIT",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "https://github.com/code-rhapsodie/react-scheduler"
9
+ },
10
+ "keywords": [
11
+ "scheduler",
12
+ "gantt",
13
+ "gantt chart",
14
+ "react",
15
+ "timeline",
16
+ "calendar"
17
+ ],
18
+ "author": {
19
+ "name": "Bitnoise",
20
+ "url": "https://scheduler.bitnoise.pl/"
21
+ },
22
+ "scripts": {
23
+ "dev": "vite",
24
+ "build": "vite build && tsc",
25
+ "preview": "vite preview",
26
+ "lint": "typescript_eslint_allow_unsupported_typescript_version=true eslint .",
27
+ "lint:fix": "eslint --fix .",
28
+ "format": "prettier --write .",
29
+ "typecheck": "tsc -b",
30
+ "prepare": "husky install"
31
+ },
32
+ "main": "dist/index.cjs",
33
+ "modules": "dist/index.js",
34
+ "types": "dist/index.d.ts",
35
+ "exports": {
36
+ ".": {
37
+ "types": "./dist/index.d.ts",
38
+ "import": "./dist/index.js",
39
+ "require": "./dist/index.cjs"
40
+ },
41
+ "./dist/index.css": "./dist/index.css",
42
+ "./index.css": "./dist/index.css",
43
+ "./dist/style.css": "./dist/index.css",
44
+ "./style.css": "./dist/index.css"
45
+ },
46
+ "files": [
47
+ "dist"
48
+ ],
49
+ "publishConfig": {
50
+ "access": "public"
51
+ },
52
+ "lint-staged": {
53
+ "**/*.{ts,tsx}": [
54
+ "yarn run lint"
55
+ ]
56
+ },
57
+ "dependencies": {
58
+ "dayjs": "1.11.21",
59
+ "eslint-plugin-import-x": "^4.17.1",
60
+ "lodash.debounce": "4.0.8"
61
+ },
62
+ "peerDependencies": {
63
+ "react": "^19.0.0",
64
+ "react-dom": "^19.0.0",
65
+ "styled-components": "^6.0.0"
66
+ },
67
+ "devDependencies": {
68
+ "@eslint/js": "^10.0.1",
69
+ "@faker-js/faker": "10.5.0",
70
+ "@types/lodash.debounce": "4.0.9",
71
+ "@types/node": "24.13.3",
72
+ "@types/react": "^19.0.0",
73
+ "@types/react-dom": "^19.0.0",
74
+ "@typescript-eslint/eslint-plugin": "8.66.0",
75
+ "@typescript-eslint/parser": "8.66.0",
76
+ "@vitejs/plugin-react": "6.0.5",
77
+ "eslint": "10.8.1",
78
+ "eslint-config-prettier": "10.1.8",
79
+ "eslint-import-resolver-typescript": "4.4.5",
80
+ "eslint-plugin-filenames": "^1.3.2",
81
+ "eslint-plugin-import": "2.32.0",
82
+ "eslint-plugin-prettier": "^5.5.6",
83
+ "eslint-plugin-react": "7.37.5",
84
+ "eslint-plugin-react-hooks": "7.1.1",
85
+ "globals": "^17.9.0",
86
+ "husky": "9.1.7",
87
+ "lint-staged": "17.3.0",
88
+ "prettier": "3.9.6",
89
+ "react": "^19.0.0",
90
+ "react-dom": "^19.0.0",
91
+ "rollup-plugin-visualizer": "7.0.1",
92
+ "styled-components": "6.5.1",
93
+ "typescript": "7.0.2",
94
+ "typescript-eslint": "^8.66.0",
95
+ "vite": "8.2.1",
96
+ "vite-plugin-svgr": "5.2.0"
97
+ }
98
+ }
package/readme.md ADDED
@@ -0,0 +1,369 @@
1
+ <div align="center">
2
+ <img src="logo.svg" style="height: 60px" alt="@code-rhapsodie/react-scheduler/react-scheduler">
3
+ <hr />
4
+ <p align="center">
5
+ ✨ <a href="https://scheduler.bitnoise.pl/">https://scheduler.bitnoise.pl/</a> ✨
6
+ <br/>
7
+ Open sourced, typescript oriented, light-weight, and ultra fast React Component for creating gantt charts.
8
+ </p>
9
+ <div align="center">
10
+ <a href="https://bit.ly/react_scheduler">Youtube Tutorial</a>
11
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
12
+ <a href="https://www.npmjs.com/package/@code-rhapsodie/react-scheduler">npm</a>
13
+ <span>&nbsp;&nbsp;•&nbsp;&nbsp;</span>
14
+ <a href="https://github.com/code-rhapsodie/react-scheduler/issues/new">Report an issue</a>
15
+ </div>
16
+ </div>
17
+ <hr />
18
+
19
+ ## About this fork
20
+
21
+ `@code-rhapsodie/react-scheduler` is a maintained fork of Bitnoise/react-scheduler, published by Code Rhapsodie with ongoing fixes and updates. Credit for the original library goes to the Bitnoise team.
22
+
23
+ ### Installation
24
+
25
+ ```bash
26
+ # yarn
27
+ yarn add '@code-rhapsodie/react-scheduler'
28
+ # npm
29
+ npm install '@code-rhapsodie/react-scheduler'
30
+ ```
31
+
32
+ ### Example usage
33
+
34
+ 1. import required styles for scheduler
35
+
36
+ ```ts
37
+ import "@code-rhapsodie/react-scheduler/dist/style.css";
38
+ ```
39
+
40
+ 2. Import Scheduler component into your project
41
+
42
+ ```ts
43
+ import { Scheduler, SchedulerData } from "@code-rhapsodie/react-scheduler";
44
+ import dayjs from "dayjs";
45
+
46
+ default export function Component() {
47
+ const [filterButtonState, setFilterButtonState] = useState(0);
48
+
49
+ const [range, setRange] = useState({
50
+ startDate: new Date(),
51
+ endDate: new Date()
52
+ });
53
+
54
+ const handleRangeChange = useCallback((range) => {
55
+ setRange(range);
56
+ }, []);
57
+
58
+ // Filtering events that are included in current date range
59
+ // Example can be also found on video https://youtu.be/9oy4rTVEfBQ?t=118&si=52BGKSIYz6bTZ7fx
60
+ // and in the react-scheduler repo App.tsx file https://github.com/Bitnoise/react-scheduler/blob/master/src/App.tsx
61
+ const filteredMockedSchedulerData = mockedSchedulerData.map((person) => ({
62
+ ...person,
63
+ data: person.data.filter(
64
+ (project) =>
65
+ // we use "dayjs" for date calculations, but feel free to use library of your choice
66
+ dayjs(project.startDate).isBetween(range.startDate, range.endDate) ||
67
+ dayjs(project.endDate).isBetween(range.startDate, range.endDate) ||
68
+ (dayjs(project.startDate).isBefore(range.startDate, "day") &&
69
+ dayjs(project.endDate).isAfter(range.endDate, "day"))
70
+ )
71
+ }))
72
+
73
+ return (
74
+ <section>
75
+ <Scheduler
76
+ data={filteredMockedSchedulerData}
77
+ isLoading={isLoading}
78
+ onRangeChange={handleRangeChange}
79
+ onTileClick={(clickedResource) => console.log(clickedResource)}
80
+ onItemClick={(item) => console.log(item)}
81
+ onFilterData={() => {
82
+ // Some filtering logic...
83
+ setFilterButtonState(1);
84
+ }}
85
+ onClearFilterData={() => {
86
+ // Some clearing filters logic...
87
+ setFilterButtonState(0)
88
+ }}
89
+ config={{
90
+ zoom: 0,
91
+ filterButtonState,
92
+ }}
93
+ />
94
+ </section>
95
+ );
96
+ }
97
+
98
+ const mockedSchedulerData: SchedulerData = [
99
+ {
100
+ id: "070ac5b5-8369-4cd2-8ba2-0a209130cc60",
101
+ label: {
102
+ icon: "https://picsum.photos/24",
103
+ title: "Joe Doe",
104
+ subtitle: "Frontend Developer"
105
+ },
106
+ data: [
107
+ {
108
+ id: "8b71a8a5-33dd-4fc8-9caa-b4a584ba3762",
109
+ startDate: new Date("2023-04-13T15:31:24.272Z"),
110
+ endDate: new Date("2023-08-28T10:28:22.649Z"),
111
+ occupancy: 3600,
112
+ title: "Project A",
113
+ subtitle: "Subtitle A",
114
+ description: "array indexing Salad West Account",
115
+ bgColor: "rgb(254,165,177)"
116
+ },
117
+ {
118
+ id: "22fbe237-6344-4c8e-affb-64a1750f33bd",
119
+ startDate: new Date("2023-10-07T08:16:31.123Z"),
120
+ endDate: new Date("2023-11-15T21:55:23.582Z"),
121
+ occupancy: 2852,
122
+ title: "Project B",
123
+ subtitle: "Subtitle B",
124
+ description: "Tuna Home pascal IP drive",
125
+ bgColor: "rgb(254,165,177)"
126
+ },
127
+ {
128
+ id: "3601c1cd-f4b5-46bc-8564-8c983919e3f5",
129
+ startDate: new Date("2023-03-30T22:25:14.377Z"),
130
+ endDate: new Date("2023-09-01T07:20:50.526Z"),
131
+ occupancy: 1800,
132
+ title: "Project C",
133
+ subtitle: "Subtitle C",
134
+ bgColor: "rgb(254,165,177)"
135
+ },
136
+ {
137
+ id: "b088e4ac-9911-426f-aef3-843d75e714c2",
138
+ startDate: new Date("2023-10-28T10:08:22.986Z"),
139
+ endDate: new Date("2023-10-30T12:30:30.150Z"),
140
+ occupancy: 11111,
141
+ title: "Project D",
142
+ subtitle: "Subtitle D",
143
+ description: "Garden heavy an software Metal",
144
+ bgColor: "rgb(254,165,177)"
145
+ }
146
+ ]
147
+ }
148
+ ];
149
+
150
+ ```
151
+
152
+ 3. If some problems occur, please see our troubleshooting section below.
153
+
154
+ ### Scheduler API
155
+
156
+ ##### Scheduler Component Props
157
+
158
+ | Property Name | Type | Arguments | Description |
159
+ | ----------------- | ---------- | --------------------------------- | --------------------------------------------------------------------------------------------------------------------------------- |
160
+ | isLoading | `boolean` | - | shows loading indicators on scheduler |
161
+ | onRangeChange | `function` | updated `startDate` and `endDate` | runs whenever user reaches end of currently rendered canvas |
162
+ | onTileClick | `function` | clicked resource data | detects resource click |
163
+ | onItemClick | `function` | clicked left column item data | detects item click on left column |
164
+ | onFilterData | `function` | - | callback firing when filter button was clicked |
165
+ | onClearFilterData | `function` | - | callback firing when clear filters button was clicked (clearing button is visible **only** when filterButtonState is set to `>0`) |
166
+ | config | `Config` | - | object with scheduler config properties |
167
+
168
+ ##### Scheduler Config Object
169
+
170
+ ---
171
+
172
+ | Property Name | Type | Default | Description |
173
+ | ------------------------------------ | ---------------------------------------------------------------- | ----------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
174
+ | zoom | `0` or `1` or `2` | 0 | `0` - display grid divided into weeks `1` - display grid divided into days `2` - display grid divided into hours |
175
+ | filterButtonState | `number` | 0 | `< 0` - hides filter button, `0` - state for when filters were not set, `> 0` - state for when some filters were set (allows to also handle `onClearFilterData` event) |
176
+ | maxRecordsPerPage | `number` | 50 | number of items from `SchedulerData` visible per page |
177
+ | lang | `en`, `es`, `lt`, `de`, `fr`, `it`, `pt-BR`, `he` , `ro` or `pl` | en | scheduler's language |
178
+ | includeTakenHoursOnWeekendsInDayView | `boolean` | `false` | show weekends as taken when given resource is longer than a week |
179
+ | showTooltip | `boolean` | `true` | show tooltip when hovering over tiles |
180
+ | translations | `LocaleType[]` | `undefined` | option to add specific langs translations |
181
+ | showThemeToggle | `boolean` | `false` | show toggle button to switch between light/dark mode |
182
+ | defaultTheme | `light` or `dark` | `light` | scheduler's default theme |
183
+
184
+ #### Translation object example
185
+
186
+ ```ts
187
+ import enDayjsTranslations from "dayjs/locale/en";
188
+
189
+ const langs: LocaleType[] = [
190
+ {
191
+ id: "en",
192
+ lang: {
193
+ feelingEmpty: "I feel so empty...",
194
+ free: "Free",
195
+ loadNext: "Next",
196
+ loadPrevious: "Previous",
197
+ over: "over",
198
+ taken: "Taken",
199
+ topbar: {
200
+ filters: "Filters",
201
+ next: "next",
202
+ prev: "prev",
203
+ today: "Today",
204
+ view: "View"
205
+ },
206
+ search: "search",
207
+ week: "week"
208
+ },
209
+ translateCode: "en-EN",
210
+ dayjsTranslations: enDayjsTranslations
211
+ }
212
+ ];
213
+
214
+ <Scheduler
215
+ // ... //
216
+ config={{
217
+ lang: "en",
218
+ translations: langs
219
+ }}
220
+ />;
221
+ ```
222
+
223
+ #### Scheduler LocaleType Object
224
+
225
+ | Property Name | Type | Description |
226
+ | ----------------- | -------------------------- | ---------------------------------- |
227
+ | id | `string` | key is needed for selecting lang |
228
+ | lang | `Translation` | object with translations |
229
+ | translateCode | `string` | code that is saved in localStorage |
230
+ | dayjsTranslations | `string ILocale undefined` | object with translation from dayjs |
231
+
232
+ #### Scheduler Translation Object
233
+
234
+ | Property Name | Type |
235
+ | ------------- | -------- |
236
+ | feelingEmpty | `string` |
237
+ | free | `string` |
238
+ | loadNext | `string` |
239
+ | loadPrevious | `string` |
240
+ | over | `string` |
241
+ | taken | `string` |
242
+ | search | `string` |
243
+ | week | `string` |
244
+ | topbar | `Topbar` |
245
+
246
+ ##### Scheduler Topbar Object
247
+
248
+ | Property Name | Type |
249
+ | ------------- | -------- |
250
+ | filters | `string` |
251
+ | next | `string` |
252
+ | prev | `string` |
253
+ | today | `string` |
254
+ | view | `string` |
255
+
256
+ ##### Scheduler Data
257
+
258
+ array of chart rows with shape of
259
+
260
+ | Property Name | Type | Description |
261
+ | ------------- | --------------------- | ----------------------------------------------- |
262
+ | id | `string` | unique row id |
263
+ | label | `SchedulerRowLabel` | row's label, `e.g person's name, surname, icon` |
264
+ | data | `Array<ResourceItem>` | array of `resources` |
265
+
266
+ ##### Left Colum Item Data
267
+
268
+ data that is accessible as argument of `onItemClick` callback
269
+
270
+ | Property Name | Type | Description |
271
+ | ------------- | ------------------- | ----------------------------------------------- |
272
+ | id | `string` | unique row id |
273
+ | label | `SchedulerRowLabel` | row's label, `e.g person's name, surname, icon` |
274
+
275
+ ##### Resource Item
276
+
277
+ item that will be visible on the grid as tile and that will be accessible as argument of `onTileClick` event
278
+
279
+ | Property Name | Type | Description |
280
+ | ------------- | ------------------- | ------------------------------------------------------------------------------------------------------- |
281
+ | id | `string` | unique resource id |
282
+ | title | `string` | resource title that will be displayed on resource tile |
283
+ | subtitle | `string (optional)` | resource subtitle that will be displayed on resource tile |
284
+ | description | `string (optional)` | resource description that will be displayed on resource tile |
285
+ | startDate | `Date` | date for calculating start position for resource |
286
+ | endDate | `Date` | date for calculating end position for resource |
287
+ | occupancy | `number` | number of seconds resource takes up for given row that will be visible on resource tooltip when hovered |
288
+ | bgColor | `string (optional)` | tile color |
289
+
290
+ ### Troubleshooting
291
+
292
+ - For using Scheduler with RemixJS make sure to add `@code-rhapsodie/react-scheduler` to `serverDependenciesToBundle` in `remix.config.js` like so:
293
+
294
+ ```js
295
+ // remix.config.js
296
+ /** @type {import('@remix-run/dev').AppConfig} */
297
+ module.exports = {
298
+ // ...
299
+ serverDependenciesToBundle: [..., "@code-rhapsodie/react-scheduler"],
300
+ };
301
+ ```
302
+
303
+ - When using with NextJS (app router) Scheduler needs to be wrapped with component with `use client`
304
+
305
+ ```ts
306
+ "use client"
307
+ import { Scheduler, SchedulerProps } from "@code-rhapsodie/react-scheduler";
308
+
309
+ default export function SchedulerClient(props: SchedulerProps) {
310
+ return <Scheduler {...props} />;
311
+ }
312
+
313
+ ```
314
+
315
+ - When using with NextJS (pages router) it needs to be imported using `dynamic`:
316
+
317
+ ```ts
318
+ import dynamic from "next/dynamic";
319
+ const Scheduler = dynamic(
320
+ () => import("@code-rhapsodie/react-scheduler").then((mod) => mod.Scheduler),
321
+ {
322
+ ssr: false
323
+ }
324
+ );
325
+ ```
326
+
327
+ - How to customize Scheduler dimensions
328
+
329
+ Scheduler is position absolutely to take all available space. If you want to have fixed dimensions wrap Scheduler inside a div with position set to relative.
330
+
331
+ Example using styled components:
332
+
333
+ ```ts
334
+ export const StyledSchedulerFrame = styled.div`
335
+ position: relative;
336
+ height: 40vh;
337
+ width: 40vw;
338
+ `;
339
+
340
+ <StyledSchedulerFrame>
341
+ <Scheduler {...}/>
342
+ </StyledSchedulerFrame>
343
+ ```
344
+
345
+ ### Known Issues
346
+
347
+ 1. No responsiveness
348
+ 2. Slower performance on Firefox when working with big set of data due to Firefox being slower working with canvas
349
+
350
+ ### How to contribute
351
+
352
+ - **Reporting Issues**: If you come across any bugs, glitches, or have any suggestions for improvements, please [open an issue](https://github.com/Bitnoise/react-scheduler/issues) on our GitHub repository. Provide as much detail as possible, including steps to reproduce the issue.
353
+ - **Suggesting Enhancements**: If you have ideas for new features or enhancements, we would love to hear them! You can [open an issue](https://github.com/Bitnoise/react-scheduler/issues) on our GitHub repository and clearly describe your suggestion.
354
+ - **Submitting Pull Requests**: If you have developed a fix or a new feature that you would like to contribute, you can submit a pull request. Here's a quick overview of the process:
355
+ - Clone the repository and create your own branch: `git checkout -b feat/your-branch-name`.
356
+ - Implement your changes, following the **code style and guidelines** from [development.md](development.md).
357
+ - Test your changes to ensure they work as expected.
358
+ - Commit your changes and push to your forked repository.
359
+ - Open a pull request against our main repository's `master` branch.
360
+ - add at least 1 reviewer
361
+ - link correct issue
362
+
363
+ ### Contact
364
+
365
+ If you have any questions or need further assistance, feel free to reach out to us at [scheduler@bitnoi.se](mailto:scheduler@bitnoi.se). We appreciate your contributions and thank you for helping us improve this project!
366
+
367
+ ### License
368
+
369
+ MIT Licensed. Copyright (c) Bitnoise 2023.