@innosolutions/inno-calendar 1.0.60 → 1.0.61

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 (47) hide show
  1. package/AGENT.md +1783 -1756
  2. package/README.md +279 -279
  3. package/dist/agenda-widget-D6E-NQK-.cjs +2 -0
  4. package/dist/agenda-widget-D6E-NQK-.cjs.map +1 -0
  5. package/dist/{agenda-widget-COpTIR70.js → agenda-widget-DVj4CEZE.js} +1295 -1277
  6. package/dist/agenda-widget-DVj4CEZE.js.map +1 -0
  7. package/dist/components/event/event-card.d.ts.map +1 -1
  8. package/dist/components/index.cjs +1 -1
  9. package/dist/components/index.mjs +2 -2
  10. package/dist/components/primitives/scroll-navigator.d.ts +3 -1
  11. package/dist/components/primitives/scroll-navigator.d.ts.map +1 -1
  12. package/dist/components/views/timeline-view.d.ts +1 -1
  13. package/dist/components/views/timeline-view.d.ts.map +1 -1
  14. package/dist/core/context/slot-selection-context.d.ts +2 -0
  15. package/dist/core/context/slot-selection-context.d.ts.map +1 -1
  16. package/dist/core/index.cjs +1 -1
  17. package/dist/core/index.mjs +1 -1
  18. package/dist/index.cjs +1 -1
  19. package/dist/index.mjs +201 -201
  20. package/dist/position-utils-BQpbtF6N.cjs.map +1 -1
  21. package/dist/position-utils-DMVQFywD.js.map +1 -1
  22. package/dist/presets/index.cjs +1 -1
  23. package/dist/presets/index.mjs +1 -1
  24. package/dist/slot-selection-context-CRstOosL.js +604 -0
  25. package/dist/slot-selection-context-CRstOosL.js.map +1 -0
  26. package/dist/slot-selection-context-DBCZI2Dn.cjs +2 -0
  27. package/dist/slot-selection-context-DBCZI2Dn.cjs.map +1 -0
  28. package/dist/styles/index.css +1 -1
  29. package/dist/{tailwind-calendar-C3DidCJ5.js → tailwind-calendar-CNhXkxzW.js} +2 -2
  30. package/dist/{tailwind-calendar-C3DidCJ5.js.map → tailwind-calendar-CNhXkxzW.js.map} +1 -1
  31. package/dist/{tailwind-calendar-iFeIx0Ci.cjs → tailwind-calendar-VRvPJQwa.cjs} +2 -2
  32. package/dist/{tailwind-calendar-iFeIx0Ci.cjs.map → tailwind-calendar-VRvPJQwa.cjs.map} +1 -1
  33. package/dist/week-view-C1Vu2ErD.cjs +11 -0
  34. package/dist/week-view-C1Vu2ErD.cjs.map +1 -0
  35. package/dist/{week-view-CNbtlkE_.js → week-view-DY167Wok.js} +700 -670
  36. package/dist/week-view-DY167Wok.js.map +1 -0
  37. package/package.json +138 -138
  38. package/dist/agenda-widget-BtjS59HE.cjs +0 -2
  39. package/dist/agenda-widget-BtjS59HE.cjs.map +0 -1
  40. package/dist/agenda-widget-COpTIR70.js.map +0 -1
  41. package/dist/slot-selection-context-CKGT_45R.js +0 -598
  42. package/dist/slot-selection-context-CKGT_45R.js.map +0 -1
  43. package/dist/slot-selection-context-CS1te8uo.cjs +0 -2
  44. package/dist/slot-selection-context-CS1te8uo.cjs.map +0 -1
  45. package/dist/week-view-B9_48WmF.cjs +0 -11
  46. package/dist/week-view-B9_48WmF.cjs.map +0 -1
  47. package/dist/week-view-CNbtlkE_.js.map +0 -1
package/README.md CHANGED
@@ -1,279 +1,279 @@
1
- # @inno/calendar
2
-
3
- A headless-first, fully customizable React calendar for enterprise applications.
4
-
5
- [![npm version](https://img.shields.io/npm/v/@innosolutions/inno-calendar.svg)](https://www.npmjs.com/package/@innosolutions/inno-calendar)
6
- [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
7
- [![React](https://img.shields.io/badge/React-18+-61DAFB.svg)](https://reactjs.org/)
8
-
9
- > **🤖 AI Agents:** For comprehensive implementation details, copy the contents of [AGENT.md](./AGENT.md) into your context.
10
-
11
- ## Installation
12
-
13
- ```bash
14
- npm install @innosolutions/inno-calendar
15
- ```
16
-
17
- ```bash
18
- # Optional: Radix UI for enhanced popovers/tooltips
19
- npm install @radix-ui/react-popover @radix-ui/react-tooltip @radix-ui/react-dropdown-menu
20
- ```
21
-
22
- ## Quick Start
23
-
24
- ```tsx
25
- import { InnoCalendar, type CalendarEvent } from "@innosolutions/inno-calendar";
26
- import "@innosolutions/inno-calendar/styles";
27
-
28
- const events: CalendarEvent[] = [
29
- {
30
- id: "1",
31
- title: "Team Meeting",
32
- startDate: new Date("2026-02-04T09:00:00"),
33
- endDate: new Date("2026-02-04T10:00:00"),
34
- color: "blue",
35
- },
36
- ];
37
-
38
- function MyCalendar() {
39
- return (
40
- <InnoCalendar
41
- events={events}
42
- initialView="week"
43
- onEventClick={(event) => console.log(event)}
44
- onSlotSelect={(selection) =>
45
- console.log(selection.startDate, selection.endDate)
46
- }
47
- />
48
- );
49
- }
50
- ```
51
-
52
- ## Features
53
-
54
- - **8 View Modes** — Day, Week, Month, Year, Agenda, Timeline (1/3/7 day)
55
- - **Headless Architecture** — Use hooks directly or pre-built components
56
- - **Drag & Drop** — Drag to select time ranges, drag events to reschedule
57
- - **TypeScript** — Fully typed with generic event data support
58
- - **Customizable** — Custom popovers, settings panels, filters
59
- - **No External Dependencies** — Native Date API, minimal footprint
60
-
61
- ## Views
62
-
63
- | View | Description |
64
- | --------------- | -------------------------- |
65
- | `day` | Single day hourly grid |
66
- | `week` | 7-day grid with time slots |
67
- | `month` | Monthly calendar |
68
- | `year` | 12-month overview |
69
- | `agenda` | Scrollable event list |
70
- | `timeline-day` | Resource timeline (1 day) |
71
- | `timeline-3day` | Resource timeline (3 days) |
72
- | `timeline-week` | Resource timeline (7 days) |
73
-
74
- ## Event Structure
75
-
76
- ```tsx
77
- interface CalendarEvent<TData = Record<string, unknown>> {
78
- // Required
79
- id: string;
80
- title: ReactNode; // String or JSX
81
- startDate: Date;
82
- endDate: Date;
83
-
84
- // Optional display fields
85
- color?:
86
- | "blue"
87
- | "green"
88
- | "red"
89
- | "yellow"
90
- | "purple"
91
- | "orange"
92
- | "pink"
93
- | "teal"
94
- | "gray"
95
- | "indigo";
96
- hexColor?: string; // Hex override (takes precedence over color)
97
- description?: ReactNode; // String or JSX
98
- isCanceled?: boolean;
99
- isAllDay?: boolean;
100
- isMultiDay?: boolean;
101
- isRecurring?: boolean;
102
- resourceId?: string; // For resource/timeline views
103
-
104
- // Built-in filtering (optional — skip if you filter server-side)
105
- scheduleTypeId?: number;
106
- scheduleTypeName?: ReactNode; // String or JSX
107
- participants?: ICalendarUser[];
108
-
109
- // @deprecated — still functional, but migrate to `data` bag.
110
- // Will be removed in the next major version.
111
- meetingTookPlace?: boolean; // → data.meetingTookPlace
112
- isAccepted?: boolean; // → data.isAccepted
113
- companyId?: number; // → data.companyId
114
- cancelReason?: string | null; // → data.cancelReason
115
- user?: ICalendarUser; // → data.user
116
- // ... and others (see types.ts for full list)
117
-
118
- data?: TData; // Your custom domain-specific fields (RECOMMENDED)
119
- }
120
- ```
121
-
122
- ### ReactNode Props
123
-
124
- `title`, `description`, and `scheduleTypeName` accept `ReactNode` — you can pass plain strings (fully backwards compatible) or custom JSX:
125
-
126
- ```tsx
127
- const event: CalendarEvent = {
128
- id: "1",
129
- title: <span><UserIcon className="h-3 w-3 inline" /> John Doe</span>,
130
- description: <p className="italic">VIP client meeting</p>,
131
- startDate: new Date(),
132
- endDate: new Date(),
133
- };
134
- ```
135
-
136
- The built-in search and `aria-label` automatically extract plain text from JSX nodes via the `reactNodeToText` utility.
137
-
138
- ### Extended Props (data.extendedProps)
139
-
140
- For rendering an arbitrary number of custom lines on EventCard/EventBlock, use the `extendedProps` array in the `data` bag:
141
-
142
- ```tsx
143
- const event: CalendarEvent = {
144
- id: "1",
145
- title: "Practical Course",
146
- startDate: new Date(),
147
- endDate: new Date(),
148
- data: {
149
- extendedProps: [
150
- <p key="student" className="font-medium">Student: Jane Doe</p>,
151
- <p key="phone">Phone: +32 123 456 789</p>,
152
- <div key="info" className="flex items-center gap-1">
153
- <CarIcon className="h-3 w-3" />
154
- <span>Automatic transmission</span>
155
- </div>,
156
- ],
157
- },
158
- };
159
- ```
160
-
161
- Each entry renders as its own row. Visible on EventCard (full variant) and EventBlock (events >= 45min). Also shown in tooltips.
162
-
163
- ## Props
164
-
165
- ```tsx
166
- <InnoCalendar
167
- // Data
168
- events={events}
169
- users={users}
170
- scheduleTypes={scheduleTypes}
171
- // Initial State
172
- initialView="week"
173
- initialDate={new Date()}
174
- // Callbacks
175
- onEventClick={(event) => {}}
176
- onSlotSelect={(selection) => {}}
177
- onSlotClick={(date, hour) => {}}
178
- onAddEvent={() => {}}
179
- onEventDrop={(result) => {}}
180
- onDateChange={(date, view) => {}}
181
- onViewChange={(view) => {}}
182
- // Customization
183
- renderPopover={({ event, onClose }) => <CustomPopover />}
184
- settingsContent={<SettingsPanel />}
185
- filterContent={<FiltersRow />}
186
- showHeader={true}
187
- />
188
- ```
189
-
190
- ## Provider Pattern
191
-
192
- For shared state across components:
193
-
194
- ```tsx
195
- import {
196
- InnoCalendarProvider,
197
- useInnoCalendar,
198
- CalendarHeader,
199
- WeekView,
200
- } from "@innosolutions/inno-calendar";
201
-
202
- function App() {
203
- return (
204
- <InnoCalendarProvider initialEvents={events} initialView="week">
205
- <CalendarContent />
206
- </InnoCalendarProvider>
207
- );
208
- }
209
-
210
- function CalendarContent() {
211
- const { view, filteredEvents, selectedDate } = useInnoCalendar();
212
- return (
213
- <>
214
- <CalendarHeader />
215
- <WeekView events={filteredEvents} date={selectedDate} />
216
- </>
217
- );
218
- }
219
- ```
220
-
221
- ## Working Hours
222
-
223
- ```tsx
224
- const workingHours = {
225
- 0: { enabled: false, from: 8, to: 17 }, // Sunday
226
- 1: { enabled: true, from: 9, to: 18 }, // Monday
227
- 2: { enabled: true, from: 9, to: 18 }, // Tuesday
228
- 3: { enabled: true, from: 9, to: 18 }, // Wednesday
229
- 4: { enabled: true, from: 9, to: 18 }, // Thursday
230
- 5: { enabled: true, from: 9, to: 17 }, // Friday
231
- 6: { enabled: false, from: 8, to: 12 }, // Saturday
232
- };
233
-
234
- <InnoCalendar
235
- events={events}
236
- preferencesConfig={{
237
- defaults: { workingHours },
238
- }}
239
- />;
240
- ```
241
-
242
- ## Styles
243
-
244
- Import the bundled styles for proper rendering:
245
-
246
- ```tsx
247
- import "@innosolutions/inno-calendar/styles";
248
- ```
249
-
250
- Or include CSS custom properties for theming:
251
-
252
- ```css
253
- :root {
254
- --inno-border-color: #e5e7eb;
255
- --inno-primary: #3b82f6;
256
- --inno-hour-height: 96px;
257
- }
258
- ```
259
-
260
- ## TypeScript
261
-
262
- ```tsx
263
- import type {
264
- CalendarEvent,
265
- TCalendarView,
266
- TEventColor,
267
- ICalendarUser,
268
- IScheduleType,
269
- ISelectionResult,
270
- TWorkingHours,
271
- } from "@innosolutions/inno-calendar";
272
-
273
- // Utility: extract plain text from any ReactNode (for search, labels, etc.)
274
- import { reactNodeToText } from "@innosolutions/inno-calendar";
275
- ```
276
-
277
- ## License
278
-
279
- MIT © [InnoSolutions](https://github.com/innosolutions)
1
+ # @inno/calendar
2
+
3
+ A headless-first, fully customizable React calendar for enterprise applications.
4
+
5
+ [![npm version](https://img.shields.io/npm/v/@innosolutions/inno-calendar.svg)](https://www.npmjs.com/package/@innosolutions/inno-calendar)
6
+ [![TypeScript](https://img.shields.io/badge/TypeScript-5.0+-blue.svg)](https://www.typescriptlang.org/)
7
+ [![React](https://img.shields.io/badge/React-18+-61DAFB.svg)](https://reactjs.org/)
8
+
9
+ > **🤖 AI Agents:** For comprehensive implementation details, copy the contents of [AGENT.md](./AGENT.md) into your context.
10
+
11
+ ## Installation
12
+
13
+ ```bash
14
+ npm install @innosolutions/inno-calendar
15
+ ```
16
+
17
+ ```bash
18
+ # Optional: Radix UI for enhanced popovers/tooltips
19
+ npm install @radix-ui/react-popover @radix-ui/react-tooltip @radix-ui/react-dropdown-menu
20
+ ```
21
+
22
+ ## Quick Start
23
+
24
+ ```tsx
25
+ import { InnoCalendar, type CalendarEvent } from "@innosolutions/inno-calendar";
26
+ import "@innosolutions/inno-calendar/styles";
27
+
28
+ const events: CalendarEvent[] = [
29
+ {
30
+ id: "1",
31
+ title: "Team Meeting",
32
+ startDate: new Date("2026-02-04T09:00:00"),
33
+ endDate: new Date("2026-02-04T10:00:00"),
34
+ color: "blue",
35
+ },
36
+ ];
37
+
38
+ function MyCalendar() {
39
+ return (
40
+ <InnoCalendar
41
+ events={events}
42
+ initialView="week"
43
+ onEventClick={(event) => console.log(event)}
44
+ onSlotSelect={(selection) =>
45
+ console.log(selection.startDate, selection.endDate)
46
+ }
47
+ />
48
+ );
49
+ }
50
+ ```
51
+
52
+ ## Features
53
+
54
+ - **8 View Modes** — Day, Week, Month, Year, Agenda, Timeline (1/3/7 day)
55
+ - **Headless Architecture** — Use hooks directly or pre-built components
56
+ - **Drag & Drop** — Drag to select time ranges, drag events to reschedule
57
+ - **TypeScript** — Fully typed with generic event data support
58
+ - **Customizable** — Custom popovers, settings panels, filters
59
+ - **No External Dependencies** — Native Date API, minimal footprint
60
+
61
+ ## Views
62
+
63
+ | View | Description |
64
+ | --------------- | -------------------------- |
65
+ | `day` | Single day hourly grid |
66
+ | `week` | 7-day grid with time slots |
67
+ | `month` | Monthly calendar |
68
+ | `year` | 12-month overview |
69
+ | `agenda` | Scrollable event list |
70
+ | `timeline-day` | Resource timeline (1 day) |
71
+ | `timeline-3day` | Resource timeline (3 days) |
72
+ | `timeline-week` | Resource timeline (7 days) |
73
+
74
+ ## Event Structure
75
+
76
+ ```tsx
77
+ interface CalendarEvent<TData = Record<string, unknown>> {
78
+ // Required
79
+ id: string;
80
+ title: ReactNode; // String or JSX
81
+ startDate: Date;
82
+ endDate: Date;
83
+
84
+ // Optional display fields
85
+ color?:
86
+ | "blue"
87
+ | "green"
88
+ | "red"
89
+ | "yellow"
90
+ | "purple"
91
+ | "orange"
92
+ | "pink"
93
+ | "teal"
94
+ | "gray"
95
+ | "indigo";
96
+ hexColor?: string; // Hex override (takes precedence over color)
97
+ description?: ReactNode; // String or JSX
98
+ isCanceled?: boolean;
99
+ isAllDay?: boolean;
100
+ isMultiDay?: boolean;
101
+ isRecurring?: boolean;
102
+ resourceId?: string; // For resource/timeline views
103
+
104
+ // Built-in filtering (optional — skip if you filter server-side)
105
+ scheduleTypeId?: number;
106
+ scheduleTypeName?: ReactNode; // String or JSX
107
+ participants?: ICalendarUser[];
108
+
109
+ // @deprecated — still functional, but migrate to `data` bag.
110
+ // Will be removed in the next major version.
111
+ meetingTookPlace?: boolean; // → data.meetingTookPlace
112
+ isAccepted?: boolean; // → data.isAccepted
113
+ companyId?: number; // → data.companyId
114
+ cancelReason?: string | null; // → data.cancelReason
115
+ user?: ICalendarUser; // → data.user
116
+ // ... and others (see types.ts for full list)
117
+
118
+ data?: TData; // Your custom domain-specific fields (RECOMMENDED)
119
+ }
120
+ ```
121
+
122
+ ### ReactNode Props
123
+
124
+ `title`, `description`, and `scheduleTypeName` accept `ReactNode` — you can pass plain strings (fully backwards compatible) or custom JSX:
125
+
126
+ ```tsx
127
+ const event: CalendarEvent = {
128
+ id: "1",
129
+ title: <span><UserIcon className="h-3 w-3 inline" /> John Doe</span>,
130
+ description: <p className="italic">VIP client meeting</p>,
131
+ startDate: new Date(),
132
+ endDate: new Date(),
133
+ };
134
+ ```
135
+
136
+ The built-in search and `aria-label` automatically extract plain text from JSX nodes via the `reactNodeToText` utility.
137
+
138
+ ### Extended Props (data.extendedProps)
139
+
140
+ For rendering an arbitrary number of custom lines on EventCard/EventBlock, use the `extendedProps` array in the `data` bag:
141
+
142
+ ```tsx
143
+ const event: CalendarEvent = {
144
+ id: "1",
145
+ title: "Practical Course",
146
+ startDate: new Date(),
147
+ endDate: new Date(),
148
+ data: {
149
+ extendedProps: [
150
+ <p key="student" className="font-medium">Student: Jane Doe</p>,
151
+ <p key="phone">Phone: +32 123 456 789</p>,
152
+ <div key="info" className="flex items-center gap-1">
153
+ <CarIcon className="h-3 w-3" />
154
+ <span>Automatic transmission</span>
155
+ </div>,
156
+ ],
157
+ },
158
+ };
159
+ ```
160
+
161
+ Each entry renders as its own row. Visible on EventCard (full variant) and EventBlock (events >= 45min). Also shown in tooltips.
162
+
163
+ ## Props
164
+
165
+ ```tsx
166
+ <InnoCalendar
167
+ // Data
168
+ events={events}
169
+ users={users}
170
+ scheduleTypes={scheduleTypes}
171
+ // Initial State
172
+ initialView="week"
173
+ initialDate={new Date()}
174
+ // Callbacks
175
+ onEventClick={(event) => {}}
176
+ onSlotSelect={(selection) => {}}
177
+ onSlotClick={(date, hour) => {}}
178
+ onAddEvent={() => {}}
179
+ onEventDrop={(result) => {}}
180
+ onDateChange={(date, view) => {}}
181
+ onViewChange={(view) => {}}
182
+ // Customization
183
+ renderPopover={({ event, onClose }) => <CustomPopover />}
184
+ settingsContent={<SettingsPanel />}
185
+ filterContent={<FiltersRow />}
186
+ showHeader={true}
187
+ />
188
+ ```
189
+
190
+ ## Provider Pattern
191
+
192
+ For shared state across components:
193
+
194
+ ```tsx
195
+ import {
196
+ InnoCalendarProvider,
197
+ useInnoCalendar,
198
+ CalendarHeader,
199
+ WeekView,
200
+ } from "@innosolutions/inno-calendar";
201
+
202
+ function App() {
203
+ return (
204
+ <InnoCalendarProvider initialEvents={events} initialView="week">
205
+ <CalendarContent />
206
+ </InnoCalendarProvider>
207
+ );
208
+ }
209
+
210
+ function CalendarContent() {
211
+ const { view, filteredEvents, selectedDate } = useInnoCalendar();
212
+ return (
213
+ <>
214
+ <CalendarHeader />
215
+ <WeekView events={filteredEvents} date={selectedDate} />
216
+ </>
217
+ );
218
+ }
219
+ ```
220
+
221
+ ## Working Hours
222
+
223
+ ```tsx
224
+ const workingHours = {
225
+ 0: { enabled: false, from: 8, to: 17 }, // Sunday
226
+ 1: { enabled: true, from: 9, to: 18 }, // Monday
227
+ 2: { enabled: true, from: 9, to: 18 }, // Tuesday
228
+ 3: { enabled: true, from: 9, to: 18 }, // Wednesday
229
+ 4: { enabled: true, from: 9, to: 18 }, // Thursday
230
+ 5: { enabled: true, from: 9, to: 17 }, // Friday
231
+ 6: { enabled: false, from: 8, to: 12 }, // Saturday
232
+ };
233
+
234
+ <InnoCalendar
235
+ events={events}
236
+ preferencesConfig={{
237
+ defaults: { workingHours },
238
+ }}
239
+ />;
240
+ ```
241
+
242
+ ## Styles
243
+
244
+ Import the bundled styles for proper rendering:
245
+
246
+ ```tsx
247
+ import "@innosolutions/inno-calendar/styles";
248
+ ```
249
+
250
+ Or include CSS custom properties for theming:
251
+
252
+ ```css
253
+ :root {
254
+ --inno-border-color: #e5e7eb;
255
+ --inno-primary: #3b82f6;
256
+ --inno-hour-height: 96px;
257
+ }
258
+ ```
259
+
260
+ ## TypeScript
261
+
262
+ ```tsx
263
+ import type {
264
+ CalendarEvent,
265
+ TCalendarView,
266
+ TEventColor,
267
+ ICalendarUser,
268
+ IScheduleType,
269
+ ISelectionResult,
270
+ TWorkingHours,
271
+ } from "@innosolutions/inno-calendar";
272
+
273
+ // Utility: extract plain text from any ReactNode (for search, labels, etc.)
274
+ import { reactNodeToText } from "@innosolutions/inno-calendar";
275
+ ```
276
+
277
+ ## License
278
+
279
+ MIT © [InnoSolutions](https://github.com/innosolutions)