feat: add calendar component#70
Open
himself65 wants to merge 2 commits into
Open
Conversation
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.
|
@himself65 is attempting to deploy a commit to the Vercel Labs Team on Vercel. A member of the Team first needs to authorize it. |
Co-authored-by: vercel[bot] <35613825+vercel[bot]@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.calendarin the Zig builder, taking a typedCalendarSelectionunionDisplay-only like the rest of the library: the app model owns the shown month and the selection. Day presses inject the pressed
CalendarDateinto a bareon-selectMsg; the chevrons dispatchon-prev/on-nextsoupdatesteps the month viaCalendarDate.addMonths.What's included
calendar_date.zig— aCalendarDatevalue type: leap-year math, Sakamoto weekday, Hinnant civil-from-days arithmetic, ISOYYYY-MM-DDparse/format, and month-grid helpers (gridStart,addMonths, …). 11 standalone unit tests.single,range(inclusive start/end band), andmultiple. Today gets a soft fill, the selected day the accent fill, adjacent-month days read muted, andmin/maxrender out-of-bounds days disabled.select/prev/next), and the schema registry (stable codes + regenerated fingerprint pins)./components/calendarpage (markup, Zig builder, attribute table). Index grid and component vocab updated.changelog.d/.Testing
zig build test— green (addscalendar_date,ui_tests,ui_markup_tests,ui_markup_view_testscases 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/calendarbuilds.Notes
YYYY-MM-DDstrings (literal or{binding}).modepicks howselected-datesreads: one date forsingle, a start/end pair forrange, a comma/space-separated list formultiple.🤖 Generated with Claude Code