Skip to content

feat: add calendar component#70

Open
himself65 wants to merge 2 commits into
vercel-labs:mainfrom
himself65:feat/calendar-component
Open

feat: add calendar component#70
himself65 wants to merge 2 commits into
vercel-labs:mainfrom
himself65:feat/calendar-component

Conversation

@himself65

Copy link
Copy Markdown

Summary

Adds a calendar component to the catalog — a day-grid month picker modeled on shadcn's base calendar. It ships both ways, matching the stepper/chart path (a composite that lowers to primitives — no bespoke widget kind, no golden pixel signatures):

  • <calendar> in Native markup, wired through both lowering backends (interpreter + compiled engine)
  • Ui.calendar in the Zig builder, taking a typed CalendarSelection union

Display-only like the rest of the library: the app model owns the shown month and the selection. Day presses inject the pressed CalendarDate into a bare on-select Msg; the chevrons dispatch on-prev/on-next so update steps the month via CalendarDate.addMonths.

What's included

  • calendar_date.zig — a CalendarDate value type: leap-year math, Sakamoto weekday, Hinnant civil-from-days arithmetic, ISO YYYY-MM-DD parse/format, and month-grid helpers (gridStart, addMonths, …). 11 standalone unit tests.
  • Selection modessingle, range (inclusive start/end band), and multiple. Today gets a soft fill, the selected day the accent fill, adjacent-month days read muted, and min/max render out-of-bounds days disabled.
  • Full wiring — markup validator, binary serializer events table (select/prev/next), and the schema registry (stable codes + regenerated fingerprint pins).
  • Docs — engine-rendered preview tiles (single hero + full grid), a live WASM preview scene, and a /components/calendar page (markup, Zig builder, attribute table). Index grid and component vocab updated.
  • Changelog fragment under changelog.d/.

Testing

  • zig build test — green (adds calendar_date, ui_tests, ui_markup_tests, ui_markup_view_tests cases covering the grid, nav, all three selection modes, disabled bounds, and outside-days).
  • scripts/gate.sh fast — all suites PASS.
  • pnpm --dir docs check — green; /components/calendar builds.

Notes

  • Dates ride attributes as YYYY-MM-DD strings (literal or {binding}).
  • mode picks how selected-dates reads: one date for single, a start/end pair for range, a comma/space-separated list for multiple.

🤖 Generated with Claude Code

A day-grid month picker available both as `<calendar>` in Native markup
and `Ui.calendar` in the Zig builder, matching the stepper/chart path
(a composite that lowers to primitives — no bespoke widget kind).

- New `calendar_date.zig`: `CalendarDate` value type with leap-year math,
  Sakamoto weekday, Hinnant civil-from-days arithmetic, ISO parse/format,
  and month-grid helpers. 11 standalone unit tests.
- `Ui.calendar` builder with single / range / multiple selection, today
  and min/max bounds, prev/next month nav, and muted adjacent-month days.
  Day cells render as buttons so the selected day gets the accent fill.
- `<calendar>` wired through both lowering backends (interpreter +
  compiled engine), the markup validator, the binary serializer events
  table, and the schema registry (pins regenerated).
- Docs: engine-rendered previews (single hero + full grid), a live WASM
  preview scene, and a `/components/calendar` page (markup, Zig builder,
  attributes). Index grid and vocab updated.
- Tests across ui_tests, ui_markup_tests, and ui_markup_view_tests cover
  the grid, nav, selection modes, disabled bounds, and outside-days.

Display-only like the rest of the library: the app model owns the shown
month and the selection; day presses inject the pressed `CalendarDate`
into a bare `on-select` Msg.
@vercel

vercel Bot commented Jul 9, 2026

Copy link
Copy Markdown

@himself65 is attempting to deploy a commit to the Vercel Labs Team on Vercel.

A member of the Team first needs to authorize it.

@himself65 himself65 changed the title Add calendar component feat: add calendar component Jul 9, 2026
Comment thread src/primitives/canvas/calendar_date.zig Outdated
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant