ape-calendar-form
v0.1.0
Published
Event form modal for ape-calendar. Exposes a useEventForm hook, individual field building blocks, and a ready-to-use EventFormDialog. Self-contained with own Radix primitives.
Maintainers
Readme
ape-calendar-form
Event form modal for ape-calendar. Two modes of use:
- Quick: drop in
<EventFormDialog>and pass anonSubmitcallback. - Custom: use
useEventForm()+ individual field building blocks to compose your own modal.
Status: scaffold. Components are migrated from
cms-portalpackage-by-package.
Install
npm install ape-calendar-form
npm install react react-domimport 'ape-calendar-form/style.css'Usage (planned)
Mode A — default dialog:
import { EventFormDialog } from 'ape-calendar-form'
<EventFormDialog
mode="create"
open={open}
initialDate={date}
onSubmit={values => createEventApi(values)}
onOpenChange={setOpen}
/>Mode B — custom modal with building blocks:
import {
useEventForm,
TitleField,
DateRangeField,
EventTypeField,
} from 'ape-calendar-form'
const form = useEventForm({ mode: 'create', initialDate })
<MyAppDialog open={open}>
<TitleField {...form.fields.title} />
<DateRangeField {...form.fields.dateRange} />
<EventTypeField {...form.fields.eventType} options={myCustomTypes} />
<button onClick={() => form.submit(handleSubmit)}>Crear</button>
</MyAppDialog>