Initial Commit

This commit is contained in:
2026-05-27 23:29:53 +01:00
commit fbc70f96e6
10000 changed files with 1102152 additions and 0 deletions

View File

@@ -0,0 +1,86 @@
# OpenSpec Change: enterprise-react-calendar
- **Change ID**: enterprise-react-calendar
- **Package**: `@suaveplan/react-calendar`
- **Category**: react
- **Target path**: `react/forms/react-calendar`
- **Status**: PROPOSED
- **Date**: 2026-04-24
- **Reference spec**: `/mnt/s/web/suaveplan/enterprise/react-calendar.md`
---
## Summary
Deliver `@suaveplan/react-calendar` on genesis from scratch at enterprise quality. Headless calendar engine (`useCalendar`) plus `Calendar` component with month/week/day/agenda views. Ships four per-view components, `CalendarHeader`, typed `CalendarEvent`/`CalendarEventMap` with `@suaveplan/events` emitter. Genesis adds Storybook stories (zero currently exist), Playwright E2E, event store indexing for O(1) lookups, and `@suaveplan/datetime` integration for timezone-aware date math.
---
## Current-state audit (genesis)
Package does not exist on genesis — fresh build.
---
## Available workspace deps on genesis
| Package | Role |
|---|---|
| `@suaveplan/error` (`workspace:^`) | `CalendarError` |
| `@suaveplan/events` (`workspace:^`) | `EventBus` for calendar events |
| `@suaveplan/datetime` (`workspace:^`) | Timezone-aware date math |
| `@suaveplan/react-translate` (`workspace:^`) | i18n |
| `zod` (`catalog:forms`) | Event/config schemas |
| `@opentelemetry/api` (`catalog:observability`) | `calendar.navigate` span |
External: `tslib catalog:build`. React 18 peer.
---
## Preserved public API surface
```ts
Calendar, CalendarAgendaView, CalendarDayView, CalendarHeader,
CalendarMonthView, CalendarWeekView
useCalendar (+ UseCalendarReturn)
// Types
CalendarConfig, CalendarEvent, CalendarEventMap,
CalendarHeaderProps, CalendarProps, CalendarView,
CalendarViewProps, DateRange, NavigationDirection
```
---
## New additions for genesis
1. **`@suaveplan/datetime` integration** — `useCalendar` uses `@suaveplan/datetime` `addDuration`/`startOf`/`endOf` for view range computation; accepts optional `timeZone`.
2. **O(1) event lookup** — event store is a `Map<string, CalendarEvent[]>` keyed by ISO date string.
3. **`CalendarError`** — codes: `CALENDAR_INVALID_EVENT`, `CALENDAR_VIEW_NOT_SUPPORTED`.
4. **Stories** — `Calendar` (month, week, day, agenda, with-events, empty, playground), `CalendarHeader` (all navigations), each view component.
5. **Playwright E2E** — click next/prev, verify date advances; add event, verify appears in month view.
---
## File layout
```text
react/forms/react-calendar/
package.json
tsconfig.json
vitest.config.ts
src/
index.ts
hooks/
use-calendar/ (ts + types + md + test + index)
components/
calendar/ (tsx + types + md + test + stories + index)
calendar-header/ (tsx + types + md + test + stories + index)
month-view/ week-view/ day-view/ agenda-view/
types/
calendar.types.ts
utils/
cn.ts
e2e/
calendar.spec.ts
```