calendar-simple 2.0.0-beta.1 → 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/README.md +4 -4
- package/dist/index.cjs.js +1 -1
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.es.js +1282 -1269
- package/dist/index.es.js.map +1 -1
- package/dist/index.iife.js +1 -1
- package/dist/index.iife.js.map +1 -1
- package/dist/src/hooks/useEvents.d.ts +2 -1
- package/dist/src/index.d.ts +1 -1
- package/dist/src/types/calendar.d.ts +12 -5
- package/dist/src/utils/common.d.ts +8 -0
- package/package.json +3 -3
- package/dist/stats.html +0 -4950
|
@@ -11,6 +11,7 @@ import { CalendarEvent } from '../types/events';
|
|
|
11
11
|
* events are pre-sorted by `startDate` ascending). **Caveat:** unsorted input will render in the
|
|
12
12
|
* provided order — the library never re-sorts the array.
|
|
13
13
|
* @param enableEnrichedEvents - When `true`, skips validation (caller supplies pre-enriched events via `enrichedEventsByDate`).
|
|
14
|
+
* @param enrichedEventsByDate - Required companion map when `enableEnrichedEvents=true`.
|
|
14
15
|
* @returns A memoized array containing only logically valid events.
|
|
15
16
|
*/
|
|
16
|
-
export default function useEvents(events: CalendarEvent[], eventsAreSorted?: boolean, enableEnrichedEvents?: boolean): CalendarEvent[];
|
|
17
|
+
export default function useEvents(events: CalendarEvent[], eventsAreSorted?: boolean, enableEnrichedEvents?: boolean, enrichedEventsByDate?: Record<string, CalendarEvent[]>): CalendarEvent[];
|
package/dist/src/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { default as Calendar } from './Calendar';
|
|
2
2
|
export { EDayType, ECalendarViewType } from './types';
|
|
3
|
-
export type { CalendarProps, CalendarEvent, CalendarContentProps, ColorScheme, CalendarTheme, ThemeScheme, } from './types';
|
|
3
|
+
export type { CalendarProps, CalendarEvent, CalendarContentProps, ColorScheme, CalendarTheme, ThemeScheme, CalendarClassNames, } from './types';
|
|
4
4
|
export type { HeaderProps } from './components/layout/Header';
|
|
5
5
|
export type { ViewProps } from './components/views/View';
|
|
6
6
|
export type { MonthViewProps } from './components/views/month_view/MonthView';
|
|
@@ -151,16 +151,23 @@ export interface CalendarProps {
|
|
|
151
151
|
renderHourCell?: (date: Date) => ReactNode;
|
|
152
152
|
/** Replaces the default date number in Month view cells. */
|
|
153
153
|
renderDateCell?: (props: RenderDateCellProps) => ReactNode;
|
|
154
|
-
/**
|
|
154
|
+
/**
|
|
155
|
+
* Pre-built O(1) lookup map of events keyed by date string. Avoids re-filtering on each render.
|
|
156
|
+
* Must be provided when `enableEnrichedEvents=true` — omitting it emits a `console.warn`.
|
|
157
|
+
*/
|
|
155
158
|
enrichedEventsByDate?: Record<string, CalendarEvent[]>;
|
|
156
|
-
/**
|
|
159
|
+
/**
|
|
160
|
+
* Enable O(1) event lookup via `enrichedEventsByDate`.
|
|
161
|
+
* Emits a `console.warn` if `enrichedEventsByDate` is not provided alongside this flag (K-05).
|
|
162
|
+
*/
|
|
157
163
|
enableEnrichedEvents?: boolean;
|
|
158
164
|
/**
|
|
159
165
|
* Skip internal validation when events are already sorted by `startDate` ascending.
|
|
160
166
|
*
|
|
161
|
-
* **
|
|
162
|
-
*
|
|
163
|
-
*
|
|
167
|
+
* **Caveat:** the library does not re-sort the array. If unsorted events are passed with this
|
|
168
|
+
* flag set to `true`, they will render in the order provided. Only set this flag when the
|
|
169
|
+
* input is guaranteed to be sorted. A `console.warn` is emitted if the array is detected
|
|
170
|
+
* to be unsorted (K-03).
|
|
164
171
|
*/
|
|
165
172
|
eventsAreSorted?: boolean;
|
|
166
173
|
/** Maintain stable visual ordering of overlapping events across re-renders. */
|
|
@@ -8,6 +8,14 @@ import { DateType } from './date';
|
|
|
8
8
|
* @returns The maximum number of events to display
|
|
9
9
|
*/
|
|
10
10
|
export declare function calculateMaxEvents(height: number, rowsInView: number): number;
|
|
11
|
+
/**
|
|
12
|
+
* Normalizes a calendar dimension into a valid CSS length.
|
|
13
|
+
* Numbers are treated as pixels; strings are any CSS value, used verbatim.
|
|
14
|
+
*
|
|
15
|
+
* @param value - A pixel count (number) or any CSS length string (e.g. "100%", "60vh").
|
|
16
|
+
* @returns A CSS length string safe to assign to a custom property.
|
|
17
|
+
*/
|
|
18
|
+
export declare function toCssLength(value: number | string): string;
|
|
11
19
|
/**
|
|
12
20
|
* Helper to determine if an event is an all-day event.
|
|
13
21
|
* An event is considered "all-day" if its start and end date strings
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "calendar-simple",
|
|
3
|
-
"version": "2.0.0
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "A user-friendly calendar app for viewing, selecting, and managing dates with data management capabilities.",
|
|
6
6
|
"main": "./dist/index.cjs.js",
|
|
@@ -28,8 +28,8 @@
|
|
|
28
28
|
"build": "vite build",
|
|
29
29
|
"storybook": "storybook dev -p 6006",
|
|
30
30
|
"build-storybook": "storybook build",
|
|
31
|
-
"lint": "eslint src",
|
|
32
|
-
"lint:fix": "eslint src --fix",
|
|
31
|
+
"lint": "tsc --noEmit && eslint src",
|
|
32
|
+
"lint:fix": "tsc --noEmit && eslint src --fix",
|
|
33
33
|
"format": "prettier --write .",
|
|
34
34
|
"format:check": "prettier --check .",
|
|
35
35
|
"test": "vitest run",
|