@super-calendar/dom 2.13.0 → 2.14.1
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 +26 -0
- package/dist/index.d.mts +22 -2
- package/dist/index.d.ts +22 -2
- package/dist/index.js +235 -64
- package/dist/index.mjs +237 -66
- package/package.json +2 -2
- package/src/Calendar.tsx +16 -0
- package/src/MonthList.tsx +11 -4
- package/src/MonthView.tsx +26 -16
- package/src/ResourceTimeline.tsx +48 -50
- package/src/TimeGrid.tsx +263 -35
- package/src/touch.ts +61 -0
package/README.md
CHANGED
|
@@ -52,13 +52,35 @@ export function MyCalendar() {
|
|
|
52
52
|
|
|
53
53
|
For a custom picker, pair the headless hooks (`useDateRange`, `useMonthGrid`) with `MonthList` and `TimeGrid`, all re-exported from this package.
|
|
54
54
|
|
|
55
|
+
## Touch event gestures
|
|
56
|
+
|
|
57
|
+
Touch and pen on `TimeGrid` wait for a 300 ms hold within 8 px before dragging.
|
|
58
|
+
A tap presses the event from its click; a vertical swipe scrolls the grid.
|
|
59
|
+
Additional contacts cancel pending holds and cannot take over an active drag.
|
|
60
|
+
Set `touchDragDelay` and `touchDragThreshold` on `TimeGrid` or `Calendar` to adjust
|
|
61
|
+
the hold. Mouse drag and resize retain their existing behavior. See the
|
|
62
|
+
[dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
63
|
+
|
|
55
64
|
## Moving events
|
|
56
65
|
|
|
57
66
|
Pass `onDragEvent` and update your event state with the returned `start` and `end`.
|
|
67
|
+
|
|
68
|
+
Time-grid edge paging requires a mouse drag. Touch and pen remain within the
|
|
69
|
+
visible period, so resting near an edge cannot repeatedly change the date.
|
|
70
|
+
See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
71
|
+
|
|
58
72
|
On the time grid, dragging any segment of a multi-day event previews the whole
|
|
59
73
|
range moving together and preserves its duration. Drag a resize grip to change
|
|
60
74
|
only the start or end. See the [dragging guide](https://super-calendar.afonsojramos.me/guides/dragging).
|
|
61
75
|
|
|
76
|
+
## Month chip dimensions
|
|
77
|
+
|
|
78
|
+
`chipHeight` and `chipGap` configure month lanes and overflow rows on `Calendar`,
|
|
79
|
+
`MonthView`, and `MonthList`. Native `MonthPager` forwards them too. DOM defaults
|
|
80
|
+
remain 18 px height and 2 px gaps; native height keeps its theme default.
|
|
81
|
+
Changing either dimension updates already mounted list and pager months.
|
|
82
|
+
See the [month guide](https://super-calendar.afonsojramos.me/guides/month-view).
|
|
83
|
+
|
|
62
84
|
## Styling
|
|
63
85
|
|
|
64
86
|
Out of the box the calendar is fully styled from the theme, no stylesheet required. To restyle a specific part with **Tailwind** or your own CSS, every element is a named slot: pass `classNames` (or `styles`) per slot, and use `data-*` state variants like `data-[today]:`.
|
|
@@ -76,6 +98,10 @@ Out of the box the calendar is fully styled from the theme, no stylesheet requir
|
|
|
76
98
|
|
|
77
99
|
A slot's structural layout is always kept; only its themed look steps aside for your class, so the class wins over the inline default. See the [styling guide](https://super-calendar.afonsojramos.me/guides/styling).
|
|
78
100
|
|
|
101
|
+
On the time grid, an empty-slot touch tap calls `onPressCell` from the column's
|
|
102
|
+
click. Swipes and cancelled contacts do not press the slot. Mouse and pen retain
|
|
103
|
+
drag-to-create behavior. See the [DOM guide](https://super-calendar.afonsojramos.me/guides/dom).
|
|
104
|
+
|
|
79
105
|
## Documentation
|
|
80
106
|
|
|
81
107
|
See the [full documentation](https://super-calendar.afonsojramos.me), the [quickstart](https://super-calendar.afonsojramos.me/quickstart), and the [API reference](https://super-calendar.afonsojramos.me/reference/api).
|
package/dist/index.d.mts
CHANGED
|
@@ -233,6 +233,10 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
233
233
|
* per day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
234
234
|
*/
|
|
235
235
|
maxVisibleEventCount?: number;
|
|
236
|
+
/** Height of an event chip and of the "+N more" row, in px (default 18). */
|
|
237
|
+
chipHeight?: number;
|
|
238
|
+
/** Vertical gap between event chips, in px (default 2). */
|
|
239
|
+
chipGap?: number;
|
|
236
240
|
/** Template for the overflow row; `{moreCount}` is replaced (default "{moreCount} More"). */
|
|
237
241
|
moreLabel?: string;
|
|
238
242
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -322,7 +326,7 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
322
326
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
323
327
|
* ```
|
|
324
328
|
*/
|
|
325
|
-
export declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, labels: labelsProp, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
329
|
+
export declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels: labelsProp, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
326
330
|
//#endregion
|
|
327
331
|
//#region src/TimeGrid.d.ts
|
|
328
332
|
/**
|
|
@@ -388,6 +392,10 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
388
392
|
eventGap?: number;
|
|
389
393
|
/** Snap dragged events to this many minutes (default 15). */
|
|
390
394
|
dragStepMinutes?: number;
|
|
395
|
+
/** Hold duration before a DOM touch or pen drag, in ms (default 300). */
|
|
396
|
+
touchDragDelay?: number;
|
|
397
|
+
/** Movement tolerance for a DOM touch or pen hold, in px (default 8). */
|
|
398
|
+
touchDragThreshold?: number;
|
|
391
399
|
/** Render event time ranges in 12-hour AM/PM (default false, 24h). */
|
|
392
400
|
ampm?: boolean;
|
|
393
401
|
/** Sub-divisions per hour for the grid lines, e.g. 2 for half-hour (default 1). */
|
|
@@ -635,6 +643,10 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
635
643
|
eventOverlap?: boolean;
|
|
636
644
|
/** Snap dragged/created events to this many minutes. */
|
|
637
645
|
dragStepMinutes?: number;
|
|
646
|
+
/** DOM touch/pen hold duration in ms (default 300). */
|
|
647
|
+
touchDragDelay?: number;
|
|
648
|
+
/** DOM touch/pen movement tolerance in px (default 8). */
|
|
649
|
+
touchDragThreshold?: number;
|
|
638
650
|
/**
|
|
639
651
|
* Tap empty space: the date+time pressed on the week/day grid, or the tapped
|
|
640
652
|
* day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
@@ -667,6 +679,10 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
667
679
|
keyboardEventNavigation?: boolean;
|
|
668
680
|
/** Max chips per day before a "+N more" row. */
|
|
669
681
|
maxVisibleEventCount?: number;
|
|
682
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
683
|
+
chipHeight?: number;
|
|
684
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
685
|
+
chipGap?: number;
|
|
670
686
|
/** Overflow row template; `{moreCount}` is replaced. */
|
|
671
687
|
moreLabel?: string;
|
|
672
688
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -756,6 +772,10 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
756
772
|
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
757
773
|
/** Max chips shown per day before a "+N more" row (default 3). */
|
|
758
774
|
maxVisibleEventCount?: number;
|
|
775
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
776
|
+
chipHeight?: number;
|
|
777
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
778
|
+
chipGap?: number;
|
|
759
779
|
/** Template for the overflow row; `{moreCount}` is replaced. */
|
|
760
780
|
moreLabel?: string;
|
|
761
781
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -794,7 +814,7 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
794
814
|
* Legend List's DOM renderer and the library's headless grid logic. Selection is
|
|
795
815
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
796
816
|
*/
|
|
797
|
-
export declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, labels, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
817
|
+
export declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
798
818
|
//#endregion
|
|
799
819
|
//#region src/DateRangePicker.d.ts
|
|
800
820
|
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|
package/dist/index.d.ts
CHANGED
|
@@ -233,6 +233,10 @@ interface MonthViewProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
233
233
|
* per day, so a long bar can push a lightly-booked day's own events into "+N more".
|
|
234
234
|
*/
|
|
235
235
|
maxVisibleEventCount?: number;
|
|
236
|
+
/** Height of an event chip and of the "+N more" row, in px (default 18). */
|
|
237
|
+
chipHeight?: number;
|
|
238
|
+
/** Vertical gap between event chips, in px (default 2). */
|
|
239
|
+
chipGap?: number;
|
|
236
240
|
/** Template for the overflow row; `{moreCount}` is replaced (default "{moreCount} More"). */
|
|
237
241
|
moreLabel?: string;
|
|
238
242
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -322,7 +326,7 @@ interface MonthViewInternalProps<T = unknown> extends MonthViewProps<T> {
|
|
|
322
326
|
* <MonthView date={new Date()} events={events} onPressDay={(d) => setDate(d)} />
|
|
323
327
|
* ```
|
|
324
328
|
*/
|
|
325
|
-
export declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, labels: labelsProp, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
329
|
+
export declare function MonthView<T = unknown>({ date, weekStartsOn, hiddenDays, weekdayFormat, events, eventsByDay: eventsByDayProp, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels: labelsProp, onPressEvent, onPressMore, selectedRange, selectedDates, showAdjacentMonths, highlightWeekends, fillCellOnSelection, showTitle, showWeekdays, locale, theme: themeOverrides, minDate, maxDate, isDateDisabled, onPressDay, onPressCell, onCreateEvent, onSelectDrag, onDragEvent, onDragStart, eventStartEditable, eventOverlap, keyboardDayNavigation, className, style, classNames, styles }: MonthViewInternalProps<T>): ReactElement;
|
|
326
330
|
//#endregion
|
|
327
331
|
//#region src/TimeGrid.d.ts
|
|
328
332
|
/**
|
|
@@ -388,6 +392,10 @@ interface TimeGridProps<T = unknown> extends SlotStyleProps<TimeGridSlot> {
|
|
|
388
392
|
eventGap?: number;
|
|
389
393
|
/** Snap dragged events to this many minutes (default 15). */
|
|
390
394
|
dragStepMinutes?: number;
|
|
395
|
+
/** Hold duration before a DOM touch or pen drag, in ms (default 300). */
|
|
396
|
+
touchDragDelay?: number;
|
|
397
|
+
/** Movement tolerance for a DOM touch or pen hold, in px (default 8). */
|
|
398
|
+
touchDragThreshold?: number;
|
|
391
399
|
/** Render event time ranges in 12-hour AM/PM (default false, 24h). */
|
|
392
400
|
ampm?: boolean;
|
|
393
401
|
/** Sub-divisions per hour for the grid lines, e.g. 2 for half-hour (default 1). */
|
|
@@ -635,6 +643,10 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
635
643
|
eventOverlap?: boolean;
|
|
636
644
|
/** Snap dragged/created events to this many minutes. */
|
|
637
645
|
dragStepMinutes?: number;
|
|
646
|
+
/** DOM touch/pen hold duration in ms (default 300). */
|
|
647
|
+
touchDragDelay?: number;
|
|
648
|
+
/** DOM touch/pen movement tolerance in px (default 8). */
|
|
649
|
+
touchDragThreshold?: number;
|
|
638
650
|
/**
|
|
639
651
|
* Tap empty space: the date+time pressed on the week/day grid, or the tapped
|
|
640
652
|
* day at midnight in `month` mode (where it fires alongside `onPressDay`).
|
|
@@ -667,6 +679,10 @@ interface CalendarProps<T = unknown> extends DateSelectionConstraints$1, SlotSty
|
|
|
667
679
|
keyboardEventNavigation?: boolean;
|
|
668
680
|
/** Max chips per day before a "+N more" row. */
|
|
669
681
|
maxVisibleEventCount?: number;
|
|
682
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
683
|
+
chipHeight?: number;
|
|
684
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
685
|
+
chipGap?: number;
|
|
670
686
|
/** Overflow row template; `{moreCount}` is replaced. */
|
|
671
687
|
moreLabel?: string;
|
|
672
688
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -756,6 +772,10 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
756
772
|
eventAccessibilityLabel?: EventAccessibilityLabeler$1<T>;
|
|
757
773
|
/** Max chips shown per day before a "+N more" row (default 3). */
|
|
758
774
|
maxVisibleEventCount?: number;
|
|
775
|
+
/** Month chip height in pixels; omit to keep the renderer default. */
|
|
776
|
+
chipHeight?: number;
|
|
777
|
+
/** Gap between month chip rows in pixels (default 2). */
|
|
778
|
+
chipGap?: number;
|
|
759
779
|
/** Template for the overflow row; `{moreCount}` is replaced. */
|
|
760
780
|
moreLabel?: string;
|
|
761
781
|
/** Translations for the screen-reader words and gutter text; omitted keys use English. */
|
|
@@ -794,7 +814,7 @@ interface MonthListProps<T = unknown> extends DateSelectionConstraints$1, SlotSt
|
|
|
794
814
|
* Legend List's DOM renderer and the library's headless grid logic. Selection is
|
|
795
815
|
* controlled, pass `selectedRange` (or `selectedDates`) and handle `onPressDay`.
|
|
796
816
|
*/
|
|
797
|
-
export declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, moreLabel, labels, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
817
|
+
export declare function MonthList<T = unknown>({ date, pastMonths, futureMonths, weekdayFormat, highlightWeekends, weekStartsOn, events, renderEvent, eventAccessibilityLabel, maxVisibleEventCount, chipHeight, chipGap, moreLabel, labels, onPressEvent, onPressMore, selectedRange, selectedDates, fillCellOnSelection, locale, theme: themeOverrides, height, minDate, maxDate, isDateDisabled, keyboardDayNavigation, onPressDay, className, style, classNames, styles }: MonthListProps<T>): ReactElement;
|
|
798
818
|
//#endregion
|
|
799
819
|
//#region src/DateRangePicker.d.ts
|
|
800
820
|
/** Styleable chrome of the pickers (the calendar's own slots forward through too). */
|