@super-calendar/dom 2.0.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/src/index.ts ADDED
@@ -0,0 +1,49 @@
1
+ // react-dom entry point: real DOM components (no React Native, no react-native-web).
2
+ // Built on the library's headless core and Legend List's DOM renderer. Pair with
3
+ // the headless hooks (useDateRange, useMonthGrid) re-exported below for selection
4
+ // state and custom layouts.
5
+ export { Agenda, type AgendaProps, type DomAgendaEvent, type DomAgendaEventArgs } from "./Agenda";
6
+ export { Calendar, type CalendarProps } from "./Calendar";
7
+ export {
8
+ type DomMonthEvent,
9
+ type DomMonthEventArgs,
10
+ MonthView,
11
+ type MonthViewProps,
12
+ } from "./MonthView";
13
+ export { MonthList, type MonthListProps } from "./MonthList";
14
+ export {
15
+ TimeGrid,
16
+ type TimeGridProps,
17
+ type DomRenderEvent,
18
+ type DomRenderEventArgs,
19
+ } from "./TimeGrid";
20
+ export { type DomCalendarTheme, darkDomTheme, defaultDomTheme, mergeDomTheme } from "./theme";
21
+ export {
22
+ type BusinessHours,
23
+ type CalendarEvent,
24
+ type CalendarMode,
25
+ type DateRange,
26
+ type DateSelectionConstraints,
27
+ type DaySelectionState,
28
+ type ICalendarEvent,
29
+ type PositionedEvent,
30
+ type TimeGridMode,
31
+ type UseDateRangeOptions,
32
+ type WeekStartsOn,
33
+ getViewDays,
34
+ isAllDayEvent,
35
+ layoutDayEvents,
36
+ daySelectionState,
37
+ isDateSelectable,
38
+ isRangeEndpoint,
39
+ isWithinDateRange,
40
+ nextDateRange,
41
+ useDateRange,
42
+ useMonthGrid,
43
+ buildMonthGrid,
44
+ type MonthGrid,
45
+ type MonthGridDay,
46
+ type MonthGridWeek,
47
+ type MonthGridWeekday,
48
+ type UseMonthGridOptions,
49
+ } from "@super-calendar/core";
package/src/theme.ts ADDED
@@ -0,0 +1,38 @@
1
+ // Theme for the react-dom renderer. The DOM components style themselves with
2
+ // plain inline styles driven by this object, so consumers don't need to import
3
+ // a stylesheet or configure their bundler for CSS. Colours come from the shared
4
+ // @super-calendar/core token palette (one source for both renderers); only the
5
+ // DOM-specific pixel metrics and font stack live here.
6
+ import { type CalendarColors, darkColors, lightColors } from "@super-calendar/core";
7
+
8
+ export type DomCalendarTheme = CalendarColors & {
9
+ /** Row height of a day cell, in px. */
10
+ cellHeight: number;
11
+ /** Diameter of the day badge, in px. */
12
+ dayBadgeSize: number;
13
+ /**
14
+ * Height of the selection band strip, in px (the default pill look). The pill's
15
+ * corner radius is half this. Ignored when `fillCellOnSelection` is set, where
16
+ * the band fills the whole cell instead.
17
+ */
18
+ rangeBandHeight: number;
19
+ /** Font stack for the calendar. */
20
+ fontFamily: string;
21
+ };
22
+
23
+ const SYSTEM_FONT =
24
+ '-apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif';
25
+
26
+ const METRICS = { cellHeight: 48, dayBadgeSize: 34, rangeBandHeight: 32, fontFamily: SYSTEM_FONT };
27
+
28
+ export const defaultDomTheme: DomCalendarTheme = { ...lightColors, ...METRICS };
29
+
30
+ export const darkDomTheme: DomCalendarTheme = { ...darkColors, ...METRICS };
31
+
32
+ /** Merge a partial override onto a base theme (defaults to {@link defaultDomTheme}). */
33
+ export function mergeDomTheme(
34
+ overrides?: Partial<DomCalendarTheme>,
35
+ base: DomCalendarTheme = defaultDomTheme,
36
+ ): DomCalendarTheme {
37
+ return overrides ? { ...base, ...overrides } : base;
38
+ }