@savvycal/calendar 0.3.0 → 0.5.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.
- package/README.md +110 -3
- package/dist/components/day-grid-view/AllDayEventChip.d.ts +14 -0
- package/dist/components/day-grid-view/AllDayEventChip.d.ts.map +1 -0
- package/dist/components/day-grid-view/AllDayEventChip.js +86 -0
- package/dist/components/day-grid-view/AllDaySection.d.ts +16 -0
- package/dist/components/day-grid-view/AllDaySection.d.ts.map +1 -0
- package/dist/components/day-grid-view/AllDaySection.js +60 -0
- package/dist/components/day-grid-view/DayColumn.d.ts +21 -0
- package/dist/components/day-grid-view/DayColumn.d.ts.map +1 -0
- package/dist/components/day-grid-view/DayColumn.js +51 -0
- package/dist/components/day-grid-view/DayGridView.d.ts +3 -0
- package/dist/components/day-grid-view/DayGridView.d.ts.map +1 -0
- package/dist/components/day-grid-view/DayGridView.js +356 -0
- package/dist/components/day-grid-view/DayHeader.d.ts +16 -0
- package/dist/components/day-grid-view/DayHeader.d.ts.map +1 -0
- package/dist/components/day-grid-view/DayHeader.js +36 -0
- package/dist/components/day-grid-view/defaults.d.ts +3 -0
- package/dist/components/day-grid-view/defaults.d.ts.map +1 -0
- package/dist/components/day-grid-view/defaults.js +35 -0
- package/dist/components/day-grid-view/index.d.ts +3 -0
- package/dist/components/day-grid-view/index.d.ts.map +1 -0
- package/dist/components/resource-grid-view/ResourceColumn.d.ts +2 -2
- package/dist/components/resource-grid-view/ResourceColumn.d.ts.map +1 -1
- package/dist/components/resource-grid-view/ResourceColumn.js +28 -27
- package/dist/components/resource-grid-view/ResourceGridView.d.ts.map +1 -1
- package/dist/components/resource-grid-view/ResourceGridView.js +133 -115
- package/dist/components/{resource-grid-view → shared}/AllDayRow.d.ts +2 -2
- package/dist/components/shared/AllDayRow.d.ts.map +1 -0
- package/dist/components/{resource-grid-view → shared}/EventChip.d.ts +3 -3
- package/dist/components/shared/EventChip.d.ts.map +1 -0
- package/dist/components/{resource-grid-view → shared}/EventChip.js +8 -8
- package/dist/components/{resource-grid-view → shared}/NowIndicator.d.ts +2 -2
- package/dist/components/shared/NowIndicator.d.ts.map +1 -0
- package/dist/components/{resource-grid-view → shared}/SelectionOverlay.d.ts +5 -4
- package/dist/components/shared/SelectionOverlay.d.ts.map +1 -0
- package/dist/components/shared/SelectionOverlay.js +83 -0
- package/dist/components/{resource-grid-view → shared}/SlotInteractionLayer.d.ts +10 -5
- package/dist/components/shared/SlotInteractionLayer.d.ts.map +1 -0
- package/dist/components/shared/SlotInteractionLayer.js +214 -0
- package/dist/components/{resource-grid-view → shared}/TimeGutter.d.ts +2 -2
- package/dist/components/shared/TimeGutter.d.ts.map +1 -0
- package/dist/components/{resource-grid-view → shared}/UnavailabilityOverlay.d.ts +2 -2
- package/dist/components/shared/UnavailabilityOverlay.d.ts.map +1 -0
- package/dist/components/shared/useAnnouncer.d.ts.map +1 -0
- package/dist/components/shared/useEffectiveHourHeight.d.ts.map +1 -0
- package/dist/index.d.ts +3 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +15 -15
- package/dist/lib/overlap.d.ts +13 -1
- package/dist/lib/overlap.d.ts.map +1 -1
- package/dist/lib/overlap.js +126 -45
- package/dist/lib/time.d.ts +2 -0
- package/dist/lib/time.d.ts.map +1 -1
- package/dist/lib/time.js +31 -18
- package/dist/types/calendar.d.ts +63 -2
- package/dist/types/calendar.d.ts.map +1 -1
- package/package.json +1 -1
- package/dist/components/resource-grid-view/AllDayRow.d.ts.map +0 -1
- package/dist/components/resource-grid-view/EventChip.d.ts.map +0 -1
- package/dist/components/resource-grid-view/NowIndicator.d.ts.map +0 -1
- package/dist/components/resource-grid-view/SelectionOverlay.d.ts.map +0 -1
- package/dist/components/resource-grid-view/SelectionOverlay.js +0 -87
- package/dist/components/resource-grid-view/SlotInteractionLayer.d.ts.map +0 -1
- package/dist/components/resource-grid-view/SlotInteractionLayer.js +0 -213
- package/dist/components/resource-grid-view/TimeGutter.d.ts.map +0 -1
- package/dist/components/resource-grid-view/UnavailabilityOverlay.d.ts.map +0 -1
- package/dist/components/resource-grid-view/useAnnouncer.d.ts.map +0 -1
- package/dist/components/resource-grid-view/useEffectiveHourHeight.d.ts.map +0 -1
- package/dist/lib/ranges.d.ts +0 -34
- package/dist/lib/ranges.d.ts.map +0 -1
- package/dist/lib/ranges.js +0 -45
- /package/dist/components/{resource-grid-view → shared}/AllDayRow.js +0 -0
- /package/dist/components/{resource-grid-view → shared}/NowIndicator.js +0 -0
- /package/dist/components/{resource-grid-view → shared}/TimeGutter.js +0 -0
- /package/dist/components/{resource-grid-view → shared}/UnavailabilityOverlay.js +0 -0
- /package/dist/components/{resource-grid-view → shared}/useAnnouncer.d.ts +0 -0
- /package/dist/components/{resource-grid-view → shared}/useAnnouncer.js +0 -0
- /package/dist/components/{resource-grid-view → shared}/useEffectiveHourHeight.d.ts +0 -0
- /package/dist/components/{resource-grid-view → shared}/useEffectiveHourHeight.js +0 -0
package/README.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
# @savvycal/calendar
|
|
2
2
|
|
|
3
|
-
A fully-featured
|
|
3
|
+
A fully-featured calendar component library built with React, Tailwind CSS v4, and the Temporal API. Includes a resource grid view (resources as columns) and a day grid view (days as columns).
|
|
4
4
|
|
|
5
5
|
## Installation
|
|
6
6
|
|
|
@@ -126,6 +126,106 @@ function App() {
|
|
|
126
126
|
| `renderEvent` | `(props: { event: TimedCalendarEvent, position: PositionedEvent }) => ReactNode` | Custom renderer for timed events. |
|
|
127
127
|
| `renderCorner` | `() => ReactNode` | Custom renderer for the top-left corner cell (e.g. time zone label). |
|
|
128
128
|
|
|
129
|
+
## DayGridView
|
|
130
|
+
|
|
131
|
+
A day-based grid view that shows days as columns (e.g. a week view).
|
|
132
|
+
|
|
133
|
+
### Quick start
|
|
134
|
+
|
|
135
|
+
```tsx
|
|
136
|
+
import { DayGridView, Temporal } from '@savvycal/calendar';
|
|
137
|
+
|
|
138
|
+
const today = Temporal.Now.plainDateISO();
|
|
139
|
+
const weekStart = today.subtract({ days: today.dayOfWeek - 1 });
|
|
140
|
+
const weekEnd = weekStart.add({ days: 6 });
|
|
141
|
+
|
|
142
|
+
function App() {
|
|
143
|
+
return (
|
|
144
|
+
<DayGridView
|
|
145
|
+
activeRange={{ startDate: weekStart, endDate: weekEnd }}
|
|
146
|
+
timeZone="America/Chicago"
|
|
147
|
+
events={[
|
|
148
|
+
{
|
|
149
|
+
id: 'evt-1',
|
|
150
|
+
title: 'Meeting',
|
|
151
|
+
resourceId: '',
|
|
152
|
+
startTime: today
|
|
153
|
+
.toPlainDateTime({ hour: 10 })
|
|
154
|
+
.toZonedDateTime('America/Chicago'),
|
|
155
|
+
endTime: today
|
|
156
|
+
.toPlainDateTime({ hour: 11 })
|
|
157
|
+
.toZonedDateTime('America/Chicago'),
|
|
158
|
+
},
|
|
159
|
+
]}
|
|
160
|
+
/>
|
|
161
|
+
);
|
|
162
|
+
}
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
### DayGridView props
|
|
166
|
+
|
|
167
|
+
#### Required
|
|
168
|
+
|
|
169
|
+
| Prop | Type | Description |
|
|
170
|
+
| ------------- | ------------------------------------------------- | ------------------------------------------------------ |
|
|
171
|
+
| `activeRange` | `{ startDate: PlainDate; endDate: PlainDate }` | The date range to display (inclusive). |
|
|
172
|
+
| `timeZone` | `string` | IANA time zone identifier (e.g. `"America/Chicago"`). |
|
|
173
|
+
| `events` | `CalendarEvent[]` | Array of timed and/or all-day events. |
|
|
174
|
+
|
|
175
|
+
#### Availability
|
|
176
|
+
|
|
177
|
+
| Prop | Type | Default | Description |
|
|
178
|
+
| --------------- | --------------------- | ------- | ------------------------------------------------------------------------------------------------ |
|
|
179
|
+
| `availability` | `AvailabilityRange[]` | — | Time ranges that are available. Times outside these ranges are shown as unavailable. |
|
|
180
|
+
| `unavailability`| `AvailabilityRange[]` | — | Time ranges explicitly marked unavailable. Applied on top of availability. |
|
|
181
|
+
|
|
182
|
+
#### Layout, events & interaction
|
|
183
|
+
|
|
184
|
+
The following props work identically to `ResourceGridView`: `timeAxis`, `hourHeight`, `columnMinWidth`, `eventLayout`, `eventGap`, `stackOffset`, `className`, `classNames` (uses `DayGridViewClassNames`), `onEventClick`, `snapDuration`, `placeholderDuration`, `selectionAppearance`, `dragPreviewAppearance`, `selectedEventId`, `selectedEventRef`.
|
|
185
|
+
|
|
186
|
+
#### Selection
|
|
187
|
+
|
|
188
|
+
| Prop | Type | Description |
|
|
189
|
+
| --------------- | ------------------------------------------------- | ----------------------------------------------- |
|
|
190
|
+
| `selectedRange` | `DayGridSelectedRange \| null` | The currently selected time range (controlled). |
|
|
191
|
+
| `onSelect` | `(range: DayGridSelectedRange \| null) => void` | Called when the user selects or clears a range. |
|
|
192
|
+
| `selectionRef` | `Ref<HTMLDivElement>` | Ref attached to the selection overlay element. |
|
|
193
|
+
|
|
194
|
+
#### Slot click
|
|
195
|
+
|
|
196
|
+
| Prop | Type | Description |
|
|
197
|
+
| ------------- | ---------------------------------------------------------- | --------------------------------------- |
|
|
198
|
+
| `onSlotClick` | `(info: { date, startTime, endTime }) => void` | Called when an empty time slot is clicked. Receives the `date` (PlainDate) and time range. |
|
|
199
|
+
|
|
200
|
+
#### Render props
|
|
201
|
+
|
|
202
|
+
| Prop | Type | Description |
|
|
203
|
+
| -------------- | -------------------------------------------------------------------------------- | -------------------------------------------------------------------- |
|
|
204
|
+
| `renderHeader` | `(props: { date: PlainDate, isToday: boolean }) => ReactNode` | Custom renderer for day column headers. |
|
|
205
|
+
| `renderEvent` | `(props: { event: TimedCalendarEvent, position: PositionedEvent }) => ReactNode` | Custom renderer for timed events. |
|
|
206
|
+
| `renderCorner` | `(props: { timeZone: string }) => ReactNode` | Custom renderer for the top-left corner cell (e.g. time zone label). |
|
|
207
|
+
|
|
208
|
+
### DayGridSelectedRange
|
|
209
|
+
|
|
210
|
+
```ts
|
|
211
|
+
interface DayGridSelectedRange {
|
|
212
|
+
startTime: Temporal.ZonedDateTime;
|
|
213
|
+
endTime: Temporal.ZonedDateTime;
|
|
214
|
+
}
|
|
215
|
+
```
|
|
216
|
+
|
|
217
|
+
### DayGridViewClassNames
|
|
218
|
+
|
|
219
|
+
Extends `GridViewClassNames` with day-specific keys:
|
|
220
|
+
|
|
221
|
+
| Key | Description |
|
|
222
|
+
| ------------------ | ------------------------------------------- |
|
|
223
|
+
| `headerWeekday` | Weekday abbreviation text (e.g. "Mon"). |
|
|
224
|
+
| `headerDayNumber` | Day number text. |
|
|
225
|
+
| `headerToday` | Additional classes for today's day number. |
|
|
226
|
+
|
|
227
|
+
All shared keys from `GridViewClassNames` (root, grid, event, etc.) also apply.
|
|
228
|
+
|
|
129
229
|
## Data types
|
|
130
230
|
|
|
131
231
|
### CalendarResource
|
|
@@ -422,9 +522,12 @@ const { refs, floatingStyles } = useFloating({
|
|
|
422
522
|
|
|
423
523
|
```ts
|
|
424
524
|
// Components
|
|
425
|
-
export { ResourceGridView } from '@savvycal/calendar';
|
|
525
|
+
export { ResourceGridView, DayGridView } from '@savvycal/calendar';
|
|
426
526
|
// Defaults
|
|
427
|
-
export {
|
|
527
|
+
export {
|
|
528
|
+
resourceGridViewDefaults,
|
|
529
|
+
dayGridViewDefaults,
|
|
530
|
+
} from '@savvycal/calendar';
|
|
428
531
|
|
|
429
532
|
// Temporal polyfill
|
|
430
533
|
export { Temporal } from '@savvycal/calendar';
|
|
@@ -443,6 +546,10 @@ export type {
|
|
|
443
546
|
TimeAxisConfig,
|
|
444
547
|
ResourceGridViewProps,
|
|
445
548
|
ResourceGridViewClassNames,
|
|
549
|
+
GridViewClassNames,
|
|
550
|
+
DayGridViewProps,
|
|
551
|
+
DayGridViewClassNames,
|
|
552
|
+
DayGridSelectedRange,
|
|
446
553
|
PositionedEvent,
|
|
447
554
|
SelectedRange,
|
|
448
555
|
SelectionAppearance,
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { CalendarEvent, DayGridViewClassNames } from '../../types/calendar';
|
|
3
|
+
import { PositionedAllDayEvent } from '../../lib/overlap';
|
|
4
|
+
interface AllDayEventChipProps {
|
|
5
|
+
positioned: PositionedAllDayEvent;
|
|
6
|
+
laneOffset: number;
|
|
7
|
+
cls: (key: keyof DayGridViewClassNames) => string;
|
|
8
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
9
|
+
selectedEventId?: string | null;
|
|
10
|
+
selectedEventRef?: Ref<HTMLDivElement>;
|
|
11
|
+
}
|
|
12
|
+
export declare const AllDayEventChip: import('react').NamedExoticComponent<AllDayEventChipProps>;
|
|
13
|
+
export {};
|
|
14
|
+
//# sourceMappingURL=AllDayEventChip.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllDayEventChip.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/AllDayEventChip.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AAEvC,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAE3D,UAAU,oBAAoB;IAC5B,UAAU,EAAE,qBAAqB,CAAC;IAClC,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,qBAAqB,KAAK,MAAM,CAAC;IAClD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,eAAe,4DAkG1B,CAAC"}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
import { jsxs as R, Fragment as D, jsx as n } from "react/jsx-runtime";
|
|
2
|
+
import { memo as x } from "react";
|
|
3
|
+
import { cn as f } from "../../lib/utils.js";
|
|
4
|
+
const B = x(function({
|
|
5
|
+
positioned: y,
|
|
6
|
+
laneOffset: g,
|
|
7
|
+
cls: t,
|
|
8
|
+
onEventClick: a,
|
|
9
|
+
selectedEventId: h,
|
|
10
|
+
selectedEventRef: b
|
|
11
|
+
}) {
|
|
12
|
+
const {
|
|
13
|
+
event: e,
|
|
14
|
+
gridColumnStart: o,
|
|
15
|
+
gridColumnSpan: r,
|
|
16
|
+
lane: v,
|
|
17
|
+
continuesBefore: l,
|
|
18
|
+
continuesAfter: s
|
|
19
|
+
} = y, C = e.id === h, d = v + 1 + g, i = [e.title, "all day"];
|
|
20
|
+
e.clientName && i.push(e.clientName);
|
|
21
|
+
const c = l ? 2 : 4, m = s ? 2 : 4, p = {
|
|
22
|
+
...l ? {
|
|
23
|
+
borderTopLeftRadius: 0,
|
|
24
|
+
borderBottomLeftRadius: 0,
|
|
25
|
+
paddingLeft: 4
|
|
26
|
+
} : {},
|
|
27
|
+
...s ? { borderTopRightRadius: 0, borderBottomRightRadius: 0 } : {}
|
|
28
|
+
}, u = /* @__PURE__ */ R(D, { children: [
|
|
29
|
+
e.color && !l && /* @__PURE__ */ n(
|
|
30
|
+
"div",
|
|
31
|
+
{
|
|
32
|
+
className: t("allDayEventColorBar"),
|
|
33
|
+
style: { backgroundColor: e.color, borderRadius: "inherit" }
|
|
34
|
+
}
|
|
35
|
+
),
|
|
36
|
+
/* @__PURE__ */ n("span", { className: t("allDayEventTitle"), children: e.title })
|
|
37
|
+
] });
|
|
38
|
+
return C ? /* @__PURE__ */ n(
|
|
39
|
+
"div",
|
|
40
|
+
{
|
|
41
|
+
ref: b,
|
|
42
|
+
style: {
|
|
43
|
+
gridColumn: `${o} / span ${r}`,
|
|
44
|
+
gridRow: d,
|
|
45
|
+
display: "flex",
|
|
46
|
+
minWidth: 0,
|
|
47
|
+
marginLeft: c,
|
|
48
|
+
marginRight: m
|
|
49
|
+
},
|
|
50
|
+
children: /* @__PURE__ */ n(
|
|
51
|
+
"button",
|
|
52
|
+
{
|
|
53
|
+
type: "button",
|
|
54
|
+
"aria-label": i.join(", "),
|
|
55
|
+
className: f(
|
|
56
|
+
t("allDayEvent"),
|
|
57
|
+
t("allDayEventSelected"),
|
|
58
|
+
"relative flex items-center gap-1 w-full"
|
|
59
|
+
),
|
|
60
|
+
style: p,
|
|
61
|
+
onClick: () => a?.(e),
|
|
62
|
+
children: u
|
|
63
|
+
}
|
|
64
|
+
)
|
|
65
|
+
}
|
|
66
|
+
) : /* @__PURE__ */ n(
|
|
67
|
+
"button",
|
|
68
|
+
{
|
|
69
|
+
type: "button",
|
|
70
|
+
"aria-label": i.join(", "),
|
|
71
|
+
className: f(t("allDayEvent"), "relative flex items-center gap-1"),
|
|
72
|
+
style: {
|
|
73
|
+
gridColumn: `${o} / span ${r}`,
|
|
74
|
+
gridRow: d,
|
|
75
|
+
marginLeft: c,
|
|
76
|
+
marginRight: m,
|
|
77
|
+
...p
|
|
78
|
+
},
|
|
79
|
+
onClick: () => a?.(e),
|
|
80
|
+
children: u
|
|
81
|
+
}
|
|
82
|
+
);
|
|
83
|
+
});
|
|
84
|
+
export {
|
|
85
|
+
B as AllDayEventChip
|
|
86
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { Temporal } from 'temporal-polyfill';
|
|
3
|
+
import { CalendarEvent, DayGridViewClassNames } from '../../types/calendar';
|
|
4
|
+
import { PositionedAllDayEvent } from '../../lib/overlap';
|
|
5
|
+
interface AllDaySectionProps {
|
|
6
|
+
positioned: PositionedAllDayEvent[];
|
|
7
|
+
dates: Temporal.PlainDate[];
|
|
8
|
+
headerHeight: number;
|
|
9
|
+
cls: (key: keyof DayGridViewClassNames) => string;
|
|
10
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
11
|
+
selectedEventId?: string | null;
|
|
12
|
+
selectedEventRef?: Ref<HTMLDivElement>;
|
|
13
|
+
}
|
|
14
|
+
export declare const AllDaySection: import('react').NamedExoticComponent<AllDaySectionProps>;
|
|
15
|
+
export {};
|
|
16
|
+
//# sourceMappingURL=AllDaySection.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"AllDaySection.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/AllDaySection.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,mBAAmB,CAAC;AAClD,OAAO,KAAK,EAAE,aAAa,EAAE,qBAAqB,EAAE,MAAM,kBAAkB,CAAC;AAC7E,OAAO,KAAK,EAAE,qBAAqB,EAAE,MAAM,eAAe,CAAC;AAG3D,UAAU,kBAAkB;IAC1B,UAAU,EAAE,qBAAqB,EAAE,CAAC;IACpC,KAAK,EAAE,QAAQ,CAAC,SAAS,EAAE,CAAC;IAC5B,YAAY,EAAE,MAAM,CAAC;IACrB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,qBAAqB,KAAK,MAAM,CAAC;IAClD,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,aAAa,0DA+DxB,CAAC"}
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
import { jsxs as u, jsx as i } from "react/jsx-runtime";
|
|
2
|
+
import { memo as x } from "react";
|
|
3
|
+
import { AllDayEventChip as y } from "./AllDayEventChip.js";
|
|
4
|
+
const C = x(function({
|
|
5
|
+
positioned: o,
|
|
6
|
+
dates: n,
|
|
7
|
+
headerHeight: s,
|
|
8
|
+
cls: a,
|
|
9
|
+
onEventClick: m,
|
|
10
|
+
selectedEventId: d,
|
|
11
|
+
selectedEventRef: p
|
|
12
|
+
}) {
|
|
13
|
+
const g = o.length > 0 ? Math.max(...o.map((t) => t.lane)) + 1 : 0, e = o.length > 0, r = e ? "4px" : "0px", c = e ? `${r} repeat(${g}, auto) ${r}` : "auto";
|
|
14
|
+
return /* @__PURE__ */ u(
|
|
15
|
+
"div",
|
|
16
|
+
{
|
|
17
|
+
className: a("allDayLane"),
|
|
18
|
+
style: {
|
|
19
|
+
gridRow: 2,
|
|
20
|
+
gridColumn: "2 / -1",
|
|
21
|
+
display: "grid",
|
|
22
|
+
gridTemplateColumns: "subgrid",
|
|
23
|
+
gridTemplateRows: c,
|
|
24
|
+
position: "sticky",
|
|
25
|
+
top: s,
|
|
26
|
+
zIndex: 20,
|
|
27
|
+
gap: "2px 0"
|
|
28
|
+
},
|
|
29
|
+
children: [
|
|
30
|
+
n.map((t, l) => /* @__PURE__ */ i(
|
|
31
|
+
"div",
|
|
32
|
+
{
|
|
33
|
+
className: l < n.length - 1 ? "border-r border-cal-border" : void 0,
|
|
34
|
+
style: {
|
|
35
|
+
gridColumn: l + 1,
|
|
36
|
+
gridRow: "1 / -1",
|
|
37
|
+
pointerEvents: "none"
|
|
38
|
+
}
|
|
39
|
+
},
|
|
40
|
+
t.toString()
|
|
41
|
+
)),
|
|
42
|
+
o.map((t) => /* @__PURE__ */ i(
|
|
43
|
+
y,
|
|
44
|
+
{
|
|
45
|
+
positioned: t,
|
|
46
|
+
laneOffset: e ? 1 : 0,
|
|
47
|
+
cls: a,
|
|
48
|
+
onEventClick: m,
|
|
49
|
+
selectedEventId: d,
|
|
50
|
+
selectedEventRef: p
|
|
51
|
+
},
|
|
52
|
+
t.event.id
|
|
53
|
+
))
|
|
54
|
+
]
|
|
55
|
+
}
|
|
56
|
+
);
|
|
57
|
+
});
|
|
58
|
+
export {
|
|
59
|
+
C as AllDaySection
|
|
60
|
+
};
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import { Ref } from 'react';
|
|
2
|
+
import { CalendarEvent, EventLayout, GridViewClassNames, PositionedEvent, TimedCalendarEvent } from '../../types/calendar';
|
|
3
|
+
interface DayColumnProps {
|
|
4
|
+
positionedEvents: PositionedEvent[];
|
|
5
|
+
column: number;
|
|
6
|
+
timeZone: string;
|
|
7
|
+
cls: (key: keyof GridViewClassNames) => string;
|
|
8
|
+
onEventClick?: (event: CalendarEvent) => void;
|
|
9
|
+
renderEvent?: (props: {
|
|
10
|
+
event: TimedCalendarEvent;
|
|
11
|
+
position: PositionedEvent;
|
|
12
|
+
}) => React.ReactNode;
|
|
13
|
+
eventGap?: number;
|
|
14
|
+
eventLayout?: EventLayout;
|
|
15
|
+
stackOffset?: number;
|
|
16
|
+
selectedEventId?: string | null;
|
|
17
|
+
selectedEventRef?: Ref<HTMLDivElement>;
|
|
18
|
+
}
|
|
19
|
+
export declare const DayColumn: import('react').NamedExoticComponent<DayColumnProps>;
|
|
20
|
+
export {};
|
|
21
|
+
//# sourceMappingURL=DayColumn.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayColumn.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/DayColumn.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAQ,KAAK,GAAG,EAAE,MAAM,OAAO,CAAC;AACvC,OAAO,KAAK,EACV,aAAa,EACb,WAAW,EACX,kBAAkB,EAClB,eAAe,EACf,kBAAkB,EACnB,MAAM,kBAAkB,CAAC;AAG1B,UAAU,cAAc;IACtB,gBAAgB,EAAE,eAAe,EAAE,CAAC;IACpC,MAAM,EAAE,MAAM,CAAC;IACf,QAAQ,EAAE,MAAM,CAAC;IACjB,GAAG,EAAE,CAAC,GAAG,EAAE,MAAM,kBAAkB,KAAK,MAAM,CAAC;IAC/C,YAAY,CAAC,EAAE,CAAC,KAAK,EAAE,aAAa,KAAK,IAAI,CAAC;IAC9C,WAAW,CAAC,EAAE,CAAC,KAAK,EAAE;QACpB,KAAK,EAAE,kBAAkB,CAAC;QAC1B,QAAQ,EAAE,eAAe,CAAC;KAC3B,KAAK,KAAK,CAAC,SAAS,CAAC;IACtB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB,eAAe,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IAChC,gBAAgB,CAAC,EAAE,GAAG,CAAC,cAAc,CAAC,CAAC;CACxC;AAED,eAAO,MAAM,SAAS,sDA2CpB,CAAC"}
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
import { jsx as t } from "react/jsx-runtime";
|
|
2
|
+
import { memo as C } from "react";
|
|
3
|
+
import { EventChip as f } from "../shared/EventChip.js";
|
|
4
|
+
const h = C(function({
|
|
5
|
+
positionedEvents: r,
|
|
6
|
+
column: i,
|
|
7
|
+
timeZone: m,
|
|
8
|
+
cls: n,
|
|
9
|
+
onEventClick: l,
|
|
10
|
+
renderEvent: s,
|
|
11
|
+
eventGap: v,
|
|
12
|
+
eventLayout: a,
|
|
13
|
+
stackOffset: c,
|
|
14
|
+
selectedEventId: d,
|
|
15
|
+
selectedEventRef: u
|
|
16
|
+
}) {
|
|
17
|
+
return /* @__PURE__ */ t(
|
|
18
|
+
"div",
|
|
19
|
+
{
|
|
20
|
+
className: n("eventColumn"),
|
|
21
|
+
style: {
|
|
22
|
+
gridRow: "3 / -1",
|
|
23
|
+
gridColumn: i,
|
|
24
|
+
pointerEvents: "none",
|
|
25
|
+
isolation: "isolate"
|
|
26
|
+
},
|
|
27
|
+
children: r.map((e) => {
|
|
28
|
+
const o = e.event.id === d;
|
|
29
|
+
return /* @__PURE__ */ t(
|
|
30
|
+
f,
|
|
31
|
+
{
|
|
32
|
+
positioned: e,
|
|
33
|
+
timeZone: m,
|
|
34
|
+
cls: n,
|
|
35
|
+
onClick: l,
|
|
36
|
+
renderEvent: s,
|
|
37
|
+
eventGap: v,
|
|
38
|
+
eventLayout: a,
|
|
39
|
+
stackOffset: c,
|
|
40
|
+
isSelected: o,
|
|
41
|
+
selectedEventRef: o ? u : void 0
|
|
42
|
+
},
|
|
43
|
+
e.event.id
|
|
44
|
+
);
|
|
45
|
+
})
|
|
46
|
+
}
|
|
47
|
+
);
|
|
48
|
+
});
|
|
49
|
+
export {
|
|
50
|
+
h as DayColumn
|
|
51
|
+
};
|
|
@@ -0,0 +1,3 @@
|
|
|
1
|
+
import { DayGridViewProps } from '../../types/calendar';
|
|
2
|
+
export declare function DayGridView({ activeRange, timeZone, events, availability, unavailability, timeAxis, onEventClick, snapDuration, placeholderDuration, selectedRange, onSelect, onSlotClick, className, classNames, hourHeight, columnMinWidth, renderHeader, renderEvent, selectionAppearance, dragPreviewAppearance, selectionRef, selectionLingerMs, selectedEventId, selectedEventRef, renderCorner, eventGap, eventLayout, stackOffset, }: DayGridViewProps): import("react/jsx-runtime").JSX.Element;
|
|
3
|
+
//# sourceMappingURL=DayGridView.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DayGridView.d.ts","sourceRoot":"","sources":["../../../src/components/day-grid-view/DayGridView.tsx"],"names":[],"mappings":"AAiBA,OAAO,KAAK,EAKV,gBAAgB,EAEjB,MAAM,kBAAkB,CAAC;AAa1B,wBAAgB,WAAW,CAAC,EAC1B,WAAW,EACX,QAAQ,EACR,MAAM,EACN,YAAY,EACZ,cAAc,EACd,QAAQ,EACR,YAAY,EACZ,YAAY,EACZ,mBAAmB,EACnB,aAAa,EACb,QAAQ,EACR,WAAW,EACX,SAAS,EACT,UAAU,EACV,UAAe,EACf,cAAoB,EACpB,YAAY,EACZ,WAAW,EACX,mBAAmB,EACnB,qBAAqB,EACrB,YAAY,EACZ,iBAAqB,EACrB,eAAe,EACf,gBAAgB,EAChB,YAAY,EACZ,QAAQ,EACR,WAAuB,EACvB,WAAe,GAChB,EAAE,gBAAgB,2CAkZlB"}
|