mirror of
https://github.com/bitbaum/whenkit.git
synced 2026-12-05 00:17:34 +01:00
Day chips, time chips, length chips, a readable date field over the native
picker, and a booking request that resolves to {startsAt, endsAt} in the
provider's zone.
- Core (no React): wall-clock YYYY-MM-DD / HH:MM strings, one zonedToUtc
(DST gaps resolve forward), todayIn(zone), slots inside opening hours,
lengths that fit, resolveRequest / describeRequest for three choices:
slot, days, flexible.
- React: BookingRequestPicker, DayStrip, ChipGroup (real radio groups),
DateField (native input transparent over a readable display).
- styles.css: --wk-* variables defaulting to @bitbaum/design-tokens; 44px
targets, 16px input, strip scrolls inside itself.
- Tests: 15 core + 8 server-render, and a Chromium check at 1280/390,
light/dark that taps bookings end to end. dist/ committed for github: installs.
Signed-off-by: Cato <41178744+catomean@users.noreply.github.com>
Co-authored-by: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
34 lines
1.4 KiB
TypeScript
34 lines
1.4 KiB
TypeScript
/**
|
||
* The next two weeks as tappable day chips — "Today", "Tomorrow", "Fri 10" —
|
||
* plus "Another date…" for anything further out (the native picker, via
|
||
* DateField). Most bookings are for the next few days; a calendar grid makes
|
||
* the common case three taps and a scroll.
|
||
*
|
||
* `range` mode selects from–to: the first tap sets the start, the second
|
||
* (later) tap the end, a tap on or before the start starts over.
|
||
*/
|
||
import { type ISODate } from "../calendar.js";
|
||
export interface DayStripProps {
|
||
label: string;
|
||
today: ISODate;
|
||
/** How many days to show as chips. */
|
||
days?: number;
|
||
locale?: string;
|
||
/** Single day: `value`. Range: `from` / `to`. */
|
||
mode?: "single" | "range";
|
||
value?: ISODate | null;
|
||
from?: ISODate | null;
|
||
to?: ISODate | null;
|
||
onChange: (next: {
|
||
date: ISODate | null;
|
||
from: ISODate | null;
|
||
to: ISODate | null;
|
||
}) => void;
|
||
/** Days that cannot be picked (closed, booked). */
|
||
isDisabled?: (date: ISODate) => boolean;
|
||
/** Allow deselecting the chosen day (used for "flexible, no preference"). */
|
||
allowClear?: boolean;
|
||
otherDateLabel?: string;
|
||
}
|
||
export declare function DayStrip({ label, today, days, locale, mode, value, from, to, onChange, isDisabled, allowClear, otherDateLabel, }: DayStripProps): import("react").JSX.Element;
|
||
//# sourceMappingURL=DayStrip.d.ts.map
|