@super-calendar/native 2.6.0 → 2.8.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/dist/picker.d.mts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as darkTheme, C as RenderEventArgs, D as CalendarTheme, M as mergeTheme, N as useCalendarTheme, O as CalendarThemeProvider, S as RenderEvent, T as WeekStartsOn, a as MonthPager, c as MonthViewProps, h as CalendarMode, j as defaultTheme, k as PartialCalendarTheme, m as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, v as EventKeyExtractor, y as ICalendarEvent } from "./DefaultMonthEvent-zDj9dHEv.mjs";
1
+ import { A as PartialCalendarTheme, C as RenderEvent, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as darkTheme, k as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as RenderEventArgs, y as EventKeyExtractor } from "./DefaultMonthEvent-Cm9DsHBK.mjs";
2
2
  import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
3
3
  export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
package/dist/picker.d.ts CHANGED
@@ -1,3 +1,3 @@
1
- import { A as darkTheme, C as RenderEventArgs, D as CalendarTheme, M as mergeTheme, N as useCalendarTheme, O as CalendarThemeProvider, S as RenderEvent, T as WeekStartsOn, a as MonthPager, c as MonthViewProps, h as CalendarMode, j as defaultTheme, k as PartialCalendarTheme, m as CalendarEvent, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, v as EventKeyExtractor, y as ICalendarEvent } from "./DefaultMonthEvent-BSvuJUFk.js";
1
+ import { A as PartialCalendarTheme, C as RenderEvent, E as WeekStartsOn, M as defaultTheme, N as mergeTheme, O as CalendarTheme, P as useCalendarTheme, a as MonthPager, b as ICalendarEvent, c as MonthViewProps, g as CalendarMode, h as CalendarEvent, j as darkTheme, k as CalendarThemeProvider, n as MonthList, o as MonthPagerProps, r as MonthListProps, s as MonthView, t as DefaultMonthEvent, w as RenderEventArgs, y as EventKeyExtractor } from "./DefaultMonthEvent-DAxZjk_D.js";
2
2
  import { DateRange, DateSelectionConstraints, DaySelectionState, MonthGrid, MonthGridDay, MonthGridWeek, MonthGridWeekday, UseDateRangeOptions, UseMonthGridOptions, buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
3
3
  export { type CalendarEvent, type CalendarMode, type CalendarTheme, CalendarThemeProvider, type DateRange, type DateSelectionConstraints, type DaySelectionState, DefaultMonthEvent, type EventKeyExtractor, type ICalendarEvent, type MonthGrid, type MonthGridDay, type MonthGridWeek, type MonthGridWeekday, MonthList, type MonthListProps, MonthPager, type MonthPagerProps, MonthView, type MonthViewProps, type PartialCalendarTheme, type RenderEvent, type RenderEventArgs, type UseDateRangeOptions, type UseMonthGridOptions, type WeekStartsOn, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
package/dist/picker.js CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_MonthList = require("./MonthList-Gu6p64fE.js");
2
+ const require_MonthList = require("./MonthList-BWTCCmko.js");
3
3
  let _super_calendar_core = require("@super-calendar/core");
4
4
  exports.CalendarThemeProvider = require_MonthList.CalendarThemeProvider;
5
5
  exports.DefaultMonthEvent = require_MonthList.DefaultMonthEvent;
package/dist/picker.mjs CHANGED
@@ -1,3 +1,3 @@
1
- import { d as darkTheme, f as defaultTheme, i as MonthView, m as useCalendarTheme, n as DefaultMonthEvent, p as mergeTheme, r as MonthPager, t as MonthList, u as CalendarThemeProvider } from "./MonthList-CMzYn9T0.mjs";
1
+ import { d as darkTheme, f as defaultTheme, i as MonthView, m as useCalendarTheme, n as DefaultMonthEvent, p as mergeTheme, r as MonthPager, t as MonthList, u as CalendarThemeProvider } from "./MonthList-Chx0jP5n.mjs";
2
2
  import { buildMonthGrid, buildMonthWeeks, daySelectionState, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, minutesIntoDay, nextDateRange, useDateRange, useMonthGrid } from "@super-calendar/core";
3
3
  export { CalendarThemeProvider, DefaultMonthEvent, MonthList, MonthPager, MonthView, buildMonthGrid, buildMonthWeeks, darkTheme, daySelectionState, defaultTheme, getIsToday, getWeekDays, isDateSelectable, isRangeEndpoint, isSameCalendarDay, isWeekend, isWithinDateRange, mergeTheme, minutesIntoDay, nextDateRange, useCalendarTheme, useDateRange, useMonthGrid };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@super-calendar/native",
3
- "version": "2.6.0",
3
+ "version": "2.8.0",
4
4
  "description": "Gesture-driven, virtualized month / week / day calendar and date picker for React Native (and web via react-native-web).",
5
5
  "keywords": [
6
6
  "agenda",
@@ -64,7 +64,7 @@
64
64
  "access": "public"
65
65
  },
66
66
  "dependencies": {
67
- "@super-calendar/core": "2.6.0"
67
+ "@super-calendar/core": "2.8.0"
68
68
  },
69
69
  "peerDependencies": {
70
70
  "@legendapp/list": ">=3",
@@ -6,7 +6,7 @@ import { useCalendarTheme } from "../theme";
6
6
  import type { CalendarEvent, EventKeyExtractor, RenderEvent } from "../types";
7
7
  import { createSlots, type SlotStyleProps } from "../utils/slots";
8
8
  import { getIsToday } from "@super-calendar/core";
9
- import { isAllDayEvent } from "@super-calendar/core";
9
+ import { isAllDayEvent, isBackgroundEvent } from "@super-calendar/core";
10
10
 
11
11
  /**
12
12
  * The styleable parts of {@link Agenda}. Mirrors the dom renderer's slot names;
@@ -60,7 +60,10 @@ export function Agenda<T>({
60
60
  const RenderEventComponent = renderEvent;
61
61
 
62
62
  const rows = useMemo<Row<T>[]>(() => {
63
- const sorted = [...events].sort((a, b) => a.start.getTime() - b.start.getTime());
63
+ const sorted = events
64
+ // Background events shade the grids; they have no agenda row.
65
+ .filter((event) => !isBackgroundEvent(event))
66
+ .sort((a, b) => a.start.getTime() - b.start.getTime());
64
67
  const out: Row<T>[] = [];
65
68
  let currentDay: Date | null = null;
66
69
  sorted.forEach((event, index) => {
@@ -3,7 +3,7 @@ import { StyleSheet, Text, View } from "react-native";
3
3
  import { useCalendarTheme } from "../theme";
4
4
  import type { CalendarEvent, CalendarMode, EventKeyExtractor, RenderEvent } from "../types";
5
5
  import { useSlots } from "../utils/slots";
6
- import { isAllDayEvent } from "@super-calendar/core";
6
+ import { isAllDayEvent, isBackgroundEvent } from "@super-calendar/core";
7
7
 
8
8
  // The lane's slots are a subset of the TimeGrid slot union; typed locally so
9
9
  // this file doesn't import the full TimeGrid type.
@@ -42,7 +42,8 @@ export function AllDayLane<T>({
42
42
  const slot = useSlots<AllDayLaneSlot>();
43
43
  const RenderEventComponent = renderEvent;
44
44
 
45
- const allDay = events.filter(isAllDayEvent);
45
+ // Background events shade the timed columns instead of taking a lane chip.
46
+ const allDay = events.filter((event) => isAllDayEvent(event) && !isBackgroundEvent(event));
46
47
  const perDay = days.map((day) => {
47
48
  const start = startOfDay(day);
48
49
  const next = addDays(start, 1);
@@ -18,6 +18,7 @@ import { useSharedValue } from "react-native-reanimated";
18
18
  import { CalendarThemeProvider, mergeTheme, type PartialCalendarTheme } from "../theme";
19
19
  import type {
20
20
  BusinessHours,
21
+ BusinessHoursBand,
21
22
  CalendarEvent,
22
23
  CalendarMode,
23
24
  EventKeyExtractor,
@@ -128,6 +129,14 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
128
129
  disableMonthEventCellPress?: boolean;
129
130
  /** First day of the week. Sunday = 0 (default) … Saturday = 6. */
130
131
  weekStartsOn?: WeekStartsOn;
132
+ /** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
133
+ hiddenDays?: number[];
134
+ /**
135
+ * Fixed "now" instant for the current-time indicator (doesn't tick), e.g. a
136
+ * server-synced clock. Defaults to the device clock, shifted into `timeZone`
137
+ * when one is set so the line matches the displayed events.
138
+ */
139
+ now?: Date;
131
140
  /** Weekday header label width: `narrow` ("M"), `short` ("Mon", default), or `long` ("Monday"). */
132
141
  weekdayFormat?: WeekdayFormat;
133
142
  /** Number of day columns when `mode="custom"`. Ignored by other modes. Default 1. */
@@ -156,6 +165,13 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
156
165
  * whole day (closed). Omit for no shading.
157
166
  */
158
167
  businessHours?: BusinessHours;
168
+ /**
169
+ * Week/day grid only: render a closed-hours band's content yourself (a
170
+ * label, icon, pattern). The grid keeps positioning the band; when set, the
171
+ * themed tint is dropped and your output fills the band instead. Decorative only: the
172
+ * band stays non-interactive and hidden from assistive tech.
173
+ */
174
+ renderBusinessHours?: (band: BusinessHoursBand) => React.ReactNode;
159
175
  /** Stable key per event. Defaults to start-time + index. */
160
176
  keyExtractor?: EventKeyExtractor<T>;
161
177
  /** Partial theme merged over the defaults. */
@@ -177,6 +193,14 @@ export type CalendarProps<T> = SlotStyleProps<CalendarSlot> & {
177
193
  * whole-day spans) are not shown on the time grid.
178
194
  */
179
195
  showAllDayEventCell?: boolean;
196
+ /** Tint weekend columns (default true). Set false to treat weekends normally. */
197
+ highlightWeekends?: boolean;
198
+ /** Allow moving events by default (per-event `startEditable` overrides). Default true. */
199
+ eventStartEditable?: boolean;
200
+ /** Allow resizing events by default (per-event `durationEditable` overrides). Default true. */
201
+ eventDurationEditable?: boolean;
202
+ /** Reject drags/resizes that would overlap another event (default true = allowed). */
203
+ eventOverlap?: boolean;
180
204
  /** Show the ISO week number in the week/day header gutter. Default false. */
181
205
  showWeekNumber?: boolean;
182
206
  /** Prefix for the week-number label (e.g. "W"). Default "W". */
@@ -363,6 +387,8 @@ export function Calendar<T>({
363
387
  showAdjacentMonths,
364
388
  disableMonthEventCellPress,
365
389
  weekStartsOn = 0,
390
+ hiddenDays,
391
+ now,
366
392
  weekdayFormat,
367
393
  numberOfDays,
368
394
  weekEndsOn,
@@ -371,6 +397,7 @@ export function Calendar<T>({
371
397
  eventCellStyle,
372
398
  calendarCellStyle,
373
399
  businessHours,
400
+ renderBusinessHours,
374
401
  keyExtractor = defaultKeyExtractor as EventKeyExtractor<T>,
375
402
  theme,
376
403
  cellHeight: cellHeightProp,
@@ -381,6 +408,10 @@ export function Calendar<T>({
381
408
  hideHours,
382
409
  timeslots,
383
410
  showAllDayEventCell,
411
+ highlightWeekends,
412
+ eventStartEditable,
413
+ eventDurationEditable,
414
+ eventOverlap,
384
415
  showWeekNumber,
385
416
  weekNumberPrefix,
386
417
  hourComponent,
@@ -516,6 +547,7 @@ export function Calendar<T>({
516
547
  events={displayEvents}
517
548
  maxVisibleEventCount={maxVisibleEventCount}
518
549
  weekStartsOn={weekStartsOn}
550
+ hiddenDays={hiddenDays}
519
551
  weekdayFormat={weekdayFormat}
520
552
  locale={locale}
521
553
  sortedMonthView={sortedMonthView}
@@ -546,6 +578,7 @@ export function Calendar<T>({
546
578
  date={date}
547
579
  events={displayEvents}
548
580
  weekStartsOn={weekStartsOn}
581
+ hiddenDays={hiddenDays}
549
582
  locale={locale}
550
583
  activeDate={activeDate}
551
584
  onPressDay={onPressDay}
@@ -578,6 +611,9 @@ export function Calendar<T>({
578
611
  hourHeight={hourHeight}
579
612
  weekStartsOn={weekStartsOn}
580
613
  weekdayFormat={weekdayFormat}
614
+ hiddenDays={hiddenDays}
615
+ now={now}
616
+ timeZone={timeZone}
581
617
  renderEvent={resolvedRenderEvent}
582
618
  keyExtractor={keyExtractor}
583
619
  scrollOffsetMinutes={scrollOffsetMinutes}
@@ -585,8 +621,13 @@ export function Calendar<T>({
585
621
  hideHours={hideHours}
586
622
  timeslots={timeslots}
587
623
  showAllDayEventCell={showAllDayEventCell}
624
+ highlightWeekends={highlightWeekends}
625
+ eventStartEditable={eventStartEditable}
626
+ eventDurationEditable={eventDurationEditable}
627
+ eventOverlap={eventOverlap}
588
628
  calendarCellStyle={calendarCellStyle}
589
629
  businessHours={businessHours}
630
+ renderBusinessHours={renderBusinessHours}
590
631
  showWeekNumber={showWeekNumber}
591
632
  weekNumberPrefix={weekNumberPrefix}
592
633
  hourComponent={hourComponent}
@@ -132,7 +132,9 @@ export function DefaultEvent<T>({
132
132
  ]}
133
133
  onPress={onPress}
134
134
  onLongPress={onLongPress}
135
- activeOpacity={0.7}
135
+ // Keep the box fully opaque while pressed: a move drag is a held long-press,
136
+ // and a dimmed event under the finger for the whole drag reads as broken.
137
+ activeOpacity={1}
136
138
  accessibilityRole="button"
137
139
  accessibilityLabel={accessibilityLabel}
138
140
  accessibilityState={{ disabled: event.disabled ?? false }}
@@ -17,7 +17,12 @@ import {
17
17
  } from "react-native";
18
18
  import { useCalendarTheme } from "../theme";
19
19
  import type { CalendarEvent, EventKeyExtractor, RenderEvent, WeekStartsOn } from "../types";
20
- import { type WeekdayFormat, getWeekDays, weekdayFormatToken } from "@super-calendar/core";
20
+ import {
21
+ type WeekdayFormat,
22
+ filterHiddenDays,
23
+ getWeekDays,
24
+ weekdayFormatToken,
25
+ } from "@super-calendar/core";
21
26
  import { createSlots, type SlotStyleProps } from "../utils/slots";
22
27
  import { useWebPagerKeys } from "../utils/useWebPagerKeys";
23
28
  import { MonthView, type MonthViewSlot } from "./MonthView";
@@ -41,6 +46,8 @@ export type MonthPagerProps<T> = {
41
46
  events: CalendarEvent<T>[];
42
47
  maxVisibleEventCount?: number;
43
48
  weekStartsOn: WeekStartsOn;
49
+ /** Weekdays (0=Sunday…6=Saturday) hidden from the grid, e.g. `[0, 6]` for weekends off. */
50
+ hiddenDays?: number[];
44
51
  weekdayFormat?: WeekdayFormat;
45
52
  locale?: Locale;
46
53
  sortedMonthView?: boolean;
@@ -72,6 +79,7 @@ function MonthPagerInner<T>({
72
79
  events,
73
80
  maxVisibleEventCount,
74
81
  weekStartsOn,
82
+ hiddenDays,
75
83
  weekdayFormat = "short",
76
84
  locale,
77
85
  sortedMonthView,
@@ -210,9 +218,9 @@ function MonthPagerInner<T>({
210
218
  // only on `weekStartsOn`, so any week works; reuse the anchor. Reversed in RTL
211
219
  // to line up with the mirrored day cells.
212
220
  const weekDays = useMemo(() => {
213
- const days = getWeekDays(anchor, weekStartsOn);
221
+ const days = filterHiddenDays(getWeekDays(anchor, weekStartsOn), hiddenDays);
214
222
  return isRTL ? days.reverse() : days;
215
- }, [anchor, weekStartsOn, isRTL]);
223
+ }, [anchor, weekStartsOn, isRTL, hiddenDays]);
216
224
 
217
225
  // Pages are keyed by month Dates that never change, so LegendList keeps the
218
226
  // pages it has already rendered and only re-renders them when `data` or
@@ -237,6 +245,7 @@ function MonthPagerInner<T>({
237
245
  showWeekdays={false}
238
246
  maxVisibleEventCount={maxVisibleEventCount}
239
247
  weekStartsOn={weekStartsOn}
248
+ hiddenDays={hiddenDays}
240
249
  locale={locale}
241
250
  sortedMonthView={sortedMonthView}
242
251
  moreLabel={moreLabel}