chrona-react 0.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2026 Devlin Duldulao
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,132 @@
1
+ # chrona-react
2
+
3
+ Headless, Temporal-native React date and time primitives. No legacy `Date`
4
+ values, no free-form date parsing, and no CSS — you own every pixel.
5
+
6
+ Part of [Chrona](https://github.com/devlinduldulao/chrona). Built on
7
+ [`chrona-core`](https://www.npmjs.com/package/chrona-core).
8
+
9
+ > **Status: experimental 0.1.0.** Public APIs and styling attributes are not
10
+ > frozen for v1. Automated axe checks pass, but no screen-reader compatibility
11
+ > certification is claimed.
12
+
13
+ ## Install
14
+
15
+ ```sh
16
+ npm install chrona-react
17
+ ```
18
+
19
+ React 18 or 19. Both are gated in CI.
20
+
21
+ ## Temporal Is Application-Owned
22
+
23
+ Chrona reads `globalThis.Temporal` and never installs a runtime for you. Where
24
+ it is not native, load a polyfill before rendering:
25
+
26
+ ```ts
27
+ import "temporal-polyfill/global";
28
+ ```
29
+
30
+ ## Calendar
31
+
32
+ ```tsx
33
+ "use client";
34
+
35
+ import { useState } from "react";
36
+ import { Calendar, ChronaProvider } from "chrona-react";
37
+
38
+ export function BookingCalendar() {
39
+ const [value, setValue] = useState<Temporal.PlainDate | null>(null);
40
+ const reference = Temporal.PlainDate.from({ year: 2026, month: 9, day: 16 });
41
+
42
+ return (
43
+ <ChronaProvider locale="en-US" timeZone="Europe/Copenhagen">
44
+ <Calendar.Root value={value} onChange={setValue} placeholderValue={reference} fixedWeeks>
45
+ <Calendar.Header>
46
+ <Calendar.PrevButton>Previous</Calendar.PrevButton>
47
+ <Calendar.Heading />
48
+ <Calendar.NextButton>Next</Calendar.NextButton>
49
+ </Calendar.Header>
50
+ <Calendar.Grid>
51
+ <Calendar.GridHeader />
52
+ <Calendar.GridBody />
53
+ </Calendar.Grid>
54
+ <Calendar.LiveRegion className="visually-hidden" />
55
+ <Calendar.HiddenInput name="bookingDate" />
56
+ </Calendar.Root>
57
+ </ChronaProvider>
58
+ );
59
+ }
60
+ ```
61
+
62
+ Supply your own CSS, including the visually-hidden utility. Keyboard support
63
+ covers arrows, Home/End, PageUp/PageDown, Shift+PageUp/PageDown, and
64
+ Enter/Space, with RTL and locale week starts. Unavailable dates stay focusable
65
+ but unselectable; hard-disabled dates are not interactive.
66
+
67
+ ## DatePicker
68
+
69
+ ```tsx
70
+ <DatePicker.Root value={value} onChange={setValue} placeholderValue={reference}>
71
+ <DatePicker.Label>Appointment</DatePicker.Label>
72
+ <DatePicker.Field />
73
+ <DatePicker.Trigger>Choose date</DatePicker.Trigger>
74
+ <DatePicker.Popover>
75
+ <DatePicker.Calendar />
76
+ </DatePicker.Popover>
77
+ <DatePicker.HiddenInput name="appointment" />
78
+ </DatePicker.Root>
79
+ ```
80
+
81
+ The popover is a native `<dialog>`, modal by default. It anchors to its trigger,
82
+ flips above when that fits, shifts to stay in the viewport, and scrolls
83
+ internally when oversized. Escape, outside pointer dismissal, and selection all
84
+ return focus to the trigger.
85
+
86
+ ## Components
87
+
88
+ | Export | Subpath | Notes |
89
+ | --- | --- | --- |
90
+ | `Calendar` | `chrona-react/calendar` | Single or multi-month grid |
91
+ | `RangeCalendar` | `chrona-react/range-calendar` | Inclusive `{ start, end }`; draft first endpoint |
92
+ | `DateField` | `chrona-react/date-field` | Locale-ordered segments; ISO/Gregorian years 1–9999 |
93
+ | `TimeField` | `chrona-react/time-field` | `hourCycle` h11/h12/h23/h24, minute or second granularity |
94
+ | `DatePicker` | `chrona-react/date-picker` | Field plus calendar in a native dialog |
95
+ | `ChronaProvider` | — | Ambient `locale` and `timeZone` |
96
+
97
+ A barrel export is also available. Matching hooks — `useCalendar`,
98
+ `useRangeCalendar`, `useDateField`, `useTimeField`, `useDatePicker` — expose
99
+ `state`, resolved `options`, and `send` for custom shells.
100
+
101
+ ## Styling And Forms
102
+
103
+ Style via `data-scope`, `data-part`, and state attributes: `data-selected`,
104
+ `data-focused`, `data-today`, `data-disabled`, `data-unavailable`,
105
+ `data-outside-month`, `data-in-range`, `data-range-start`, `data-range-end`,
106
+ `data-preview`, `data-invalid`, `data-placeholder`.
107
+
108
+ Layout and button parts accept `asChild` with event and ref composition. Input
109
+ segments, hidden inputs, and the dialog keep their HTML elements.
110
+
111
+ Hidden inputs serialize with `.toString()` and are never read back.
112
+ `RangeCalendar`'s `HiddenInput name="stay"` emits `stay.start` and `stay.end`.
113
+
114
+ **`required` is accessibility metadata, not native submit blocking.** Hidden
115
+ inputs do not take part in browser constraint validation — validate required,
116
+ incomplete, or invalid values in your form layer before submission.
117
+
118
+ ## Notes
119
+
120
+ - ESM with declarations and source maps, targeting ES2022.
121
+ - Size budgets, minified + gzip, excluding React: Calendar 6 kB, DatePicker 12 kB.
122
+ - For deterministic SSR, pass the same reference date, value, locale, and time
123
+ zone on server and client. In Server Component frameworks, consume this
124
+ package from a client component.
125
+ - Use `value`/`onChange` or `defaultValue`/`onChange` — do not switch modes
126
+ during a component's lifetime.
127
+
128
+ Full documentation lives in the [repository README](https://github.com/devlinduldulao/chrona#readme).
129
+
130
+ ## License
131
+
132
+ [MIT](./LICENSE) © Devlin Duldulao
@@ -0,0 +1,126 @@
1
+ import * as temporal_spec from 'temporal-spec';
2
+ import { P as PartProps, H as HiddenInputProps, C as ChronaConfig } from './form-BCAGbNh-.js';
3
+ import * as chrona_core from 'chrona-core';
4
+ import { CalendarOptions, PlainDate, CalendarEvent } from 'chrona-core';
5
+ import * as React from 'react';
6
+
7
+ interface CalendarProps extends CalendarOptions {
8
+ defaultValue?: PlainDate | null;
9
+ defaultFocusedValue?: PlainDate;
10
+ onChange?: (value: PlainDate | null) => void;
11
+ onSelect?: (value: PlainDate) => void;
12
+ onFocusedValueChange?: (value: PlainDate) => void;
13
+ id?: string;
14
+ }
15
+ declare function useCalendar(props?: CalendarProps): {
16
+ state: chrona_core.CalendarState;
17
+ options: CalendarProps & ChronaConfig;
18
+ send: (event: CalendarEvent) => void;
19
+ rootRef: React.RefObject<HTMLElement | null>;
20
+ announcement: string;
21
+ api: {
22
+ getRootProps: () => {
23
+ dir: "ltr" | "rtl" | undefined;
24
+ "data-disabled": string | undefined;
25
+ "data-readonly": string | undefined;
26
+ "data-scope": string;
27
+ "data-part": string;
28
+ };
29
+ getGridProps: (month?: temporal_spec.Temporal.PlainDate) => {
30
+ role: "grid";
31
+ "aria-label": string;
32
+ "aria-readonly": true | undefined;
33
+ "aria-disabled": true | undefined;
34
+ "data-scope": string;
35
+ "data-part": string;
36
+ };
37
+ getCellProps: (date: PlainDate, month?: temporal_spec.Temporal.PlainDate) => {
38
+ id: string;
39
+ role: "gridcell";
40
+ tabIndex: number;
41
+ "aria-label": string;
42
+ "aria-selected": boolean;
43
+ "aria-disabled": true | undefined;
44
+ "aria-current": "date" | undefined;
45
+ "data-date": string;
46
+ "data-selected": string | undefined;
47
+ "data-focused": string | undefined;
48
+ "data-disabled": string | undefined;
49
+ "data-unavailable": string | undefined;
50
+ "data-outside-month": string | undefined;
51
+ "data-today": string | undefined;
52
+ "data-scope": string;
53
+ "data-part": string;
54
+ };
55
+ getPrevButtonProps: () => {
56
+ type: "button";
57
+ "aria-label": string;
58
+ disabled: boolean;
59
+ "data-scope": string;
60
+ "data-part": string;
61
+ };
62
+ getNextButtonProps: () => {
63
+ type: "button";
64
+ "aria-label": string;
65
+ disabled: boolean;
66
+ "data-scope": string;
67
+ "data-part": string;
68
+ };
69
+ };
70
+ months: temporal_spec.Temporal.PlainDate[];
71
+ };
72
+ type CalendarContextValue = ReturnType<typeof useCalendar>;
73
+ declare function CalendarRoot({ children, asChild, className, style, ...props }: CalendarProps & Pick<PartProps, "children" | "asChild" | "className" | "style">): React.JSX.Element;
74
+ declare function CalendarSurface({ calendar, ...props }: PartProps & {
75
+ calendar: CalendarContextValue;
76
+ }): React.JSX.Element;
77
+ interface Weekday {
78
+ date: PlainDate;
79
+ label: string;
80
+ }
81
+ declare function HiddenInput(props: HiddenInputProps): React.JSX.Element;
82
+ declare const Calendar: {
83
+ Root: typeof CalendarRoot;
84
+ Header: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
85
+ asChild?: boolean;
86
+ } & React.RefAttributes<HTMLElement>>;
87
+ Heading: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
88
+ asChild?: boolean;
89
+ } & React.RefAttributes<HTMLElement>>;
90
+ PrevButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
91
+ asChild?: boolean;
92
+ } & React.RefAttributes<HTMLElement>>;
93
+ NextButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
94
+ asChild?: boolean;
95
+ } & React.RefAttributes<HTMLElement>>;
96
+ Grid: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
97
+ asChild?: boolean;
98
+ } & {
99
+ monthIndex?: number;
100
+ } & React.RefAttributes<HTMLElement>>;
101
+ GridHeader: React.ForwardRefExoticComponent<Omit<PartProps, "children"> & {
102
+ children?: (day: Weekday) => React.ReactNode;
103
+ } & React.RefAttributes<HTMLElement>>;
104
+ HeaderCell: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
105
+ asChild?: boolean;
106
+ } & {
107
+ day: Weekday;
108
+ } & React.RefAttributes<HTMLElement>>;
109
+ GridBody: React.ForwardRefExoticComponent<Omit<PartProps, "children"> & {
110
+ children?: (date: PlainDate) => React.ReactNode;
111
+ } & React.RefAttributes<HTMLElement>>;
112
+ Cell: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
113
+ asChild?: boolean;
114
+ } & {
115
+ date: PlainDate;
116
+ } & React.RefAttributes<HTMLElement>>;
117
+ LiveRegion: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
118
+ asChild?: boolean;
119
+ } & React.RefAttributes<HTMLElement>>;
120
+ ClearButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
121
+ asChild?: boolean;
122
+ } & React.RefAttributes<HTMLElement>>;
123
+ HiddenInput: typeof HiddenInput;
124
+ };
125
+
126
+ export { Calendar, type CalendarProps, CalendarRoot, CalendarSurface, type Weekday, useCalendar };
@@ -0,0 +1,14 @@
1
+ import {
2
+ Calendar,
3
+ CalendarRoot,
4
+ CalendarSurface,
5
+ useCalendar
6
+ } from "./chunk-EFN32TNK.js";
7
+ import "./chunk-GN2YCKFZ.js";
8
+ export {
9
+ Calendar,
10
+ CalendarRoot,
11
+ CalendarSurface,
12
+ useCalendar
13
+ };
14
+ //# sourceMappingURL=calendar.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,211 @@
1
+ import {
2
+ DateField
3
+ } from "./chunk-ZN4FZDUQ.js";
4
+ import {
5
+ Calendar
6
+ } from "./chunk-EFN32TNK.js";
7
+ import {
8
+ Part,
9
+ composeEvent,
10
+ useChronaConfig
11
+ } from "./chunk-GN2YCKFZ.js";
12
+
13
+ // src/date-picker.tsx
14
+ import * as React from "react";
15
+ import { computeAnchorPosition, containTabFocus, transitionPicker, translations } from "chrona-core";
16
+ import { Fragment, jsx, jsxs } from "react/jsx-runtime";
17
+ var Context = React.createContext(null);
18
+ function usePicker() {
19
+ const value = React.useContext(Context);
20
+ if (!value) throw new Error("DatePicker parts must be inside DatePicker.Root.");
21
+ return value;
22
+ }
23
+ function Root({ children, asChild, className, style, ...input }) {
24
+ const picker = useDatePicker(input);
25
+ return /* @__PURE__ */ jsx(Context.Provider, { value: picker, children: /* @__PURE__ */ jsx(Part, { asChild, className, style, dir: picker.props.dir, "data-scope": "date-picker", "data-part": "root", children: /* @__PURE__ */ jsx(DateField.Root, { ...picker.props, id: `${picker.id}-field`, value: picker.value, onChange: picker.change, children }) }) });
26
+ }
27
+ function useDatePicker(input = {}) {
28
+ const props = useChronaConfig(input);
29
+ const generatedId = React.useId();
30
+ const id = props.id ?? generatedId;
31
+ const [uncontrolledValue, setValue] = React.useState(props.defaultValue ?? null);
32
+ const [uncontrolledOpen, setOpen] = React.useState(props.defaultOpen ?? false);
33
+ const value = props.value === void 0 ? uncontrolledValue : props.value;
34
+ const open = props.open ?? uncontrolledOpen;
35
+ const trigger = React.useRef(null);
36
+ const [labelled, registerLabel] = React.useState(false);
37
+ function change(next) {
38
+ if (props.value === void 0) setValue(next);
39
+ props.onChange?.(next);
40
+ }
41
+ function send(event) {
42
+ const result = transitionPicker({ open }, event, props);
43
+ for (const effect of result.effects) if (effect.type === "openChange") {
44
+ if (props.open === void 0) setOpen(effect.open);
45
+ props.onOpenChange?.(effect.open);
46
+ }
47
+ }
48
+ return { props, options: props, state: { value, open }, id, value, change, open, send, trigger, labelled, registerLabel };
49
+ }
50
+ var Label = React.forwardRef(function Label2(props, ref) {
51
+ const { registerLabel } = usePicker();
52
+ React.useEffect(() => {
53
+ registerLabel(true);
54
+ return () => registerLabel(false);
55
+ }, [registerLabel]);
56
+ return /* @__PURE__ */ jsx(DateField.Label, { ...props, ref });
57
+ });
58
+ var Trigger = React.forwardRef(function Trigger2({ onClick, ...props }, ref) {
59
+ const picker = usePicker();
60
+ return /* @__PURE__ */ jsx(Part, { as: "button", ...props, type: "button", ref: (node) => {
61
+ picker.trigger.current = node;
62
+ if (typeof ref === "function") ref(node);
63
+ else if (ref) ref.current = node;
64
+ }, "aria-label": props["aria-label"] ?? picker.props.translations?.chooseDate ?? translations.chooseDate, "aria-haspopup": "dialog", "aria-expanded": picker.open, "aria-controls": `${picker.id}-dialog`, disabled: picker.props.disabled, "data-scope": "date-picker", "data-part": "trigger", onClick: composeEvent(onClick, () => picker.send({ type: "TOGGLE" })) });
65
+ });
66
+ var Popover = React.forwardRef(function Popover2({ children, anchored = true, onCancel, onClose, onKeyDown, ...props }, ref) {
67
+ const picker = usePicker();
68
+ const dialog = React.useRef(null);
69
+ const latest = React.useRef(picker);
70
+ latest.current = picker;
71
+ React.useEffect(() => {
72
+ const element = dialog.current;
73
+ if (!element) return;
74
+ if (picker.open && !element.open) {
75
+ if (picker.props.modal === false) element.show();
76
+ else element.showModal();
77
+ element.querySelector('[data-part="cell"][tabindex="0"]')?.focus();
78
+ } else if (!picker.open && element.open) {
79
+ element.close();
80
+ picker.trigger.current?.focus();
81
+ }
82
+ }, [picker.open, picker.props.modal, picker.trigger]);
83
+ React.useEffect(() => {
84
+ if (!picker.open || !anchored) return;
85
+ const element = dialog.current;
86
+ const anchor = picker.trigger.current;
87
+ const window = element?.ownerDocument.defaultView;
88
+ if (!element || !anchor || !window) return;
89
+ const properties = ["position", "margin", "top", "left", "max-width", "max-height", "min-width", "min-height", "box-sizing", "overflow"];
90
+ const original = properties.map((property) => ({ property, value: element.style.getPropertyValue(property), priority: element.style.getPropertyPriority(property) }));
91
+ const originalPlacement = element.getAttribute("data-placement");
92
+ const position = () => {
93
+ const viewport = window.visualViewport;
94
+ const width = viewport?.width ?? element.ownerDocument.documentElement.clientWidth;
95
+ const height = viewport?.height ?? element.ownerDocument.documentElement.clientHeight;
96
+ const offsetTop = viewport?.offsetTop ?? 0;
97
+ const offsetLeft = viewport?.offsetLeft ?? 0;
98
+ Object.assign(element.style, {
99
+ position: "fixed",
100
+ margin: "0",
101
+ boxSizing: "border-box",
102
+ overflow: "auto",
103
+ minWidth: "0",
104
+ minHeight: "0",
105
+ maxWidth: `${Math.max(0, width - 8)}px`,
106
+ maxHeight: `${Math.max(0, height - 8)}px`
107
+ });
108
+ const rect = anchor.getBoundingClientRect();
109
+ const { top, left, placement } = computeAnchorPosition(
110
+ { top: rect.top - offsetTop, left: rect.left - offsetLeft, width: rect.width, height: rect.height },
111
+ { width: element.offsetWidth, height: element.offsetHeight },
112
+ { width, height }
113
+ );
114
+ Object.assign(element.style, { top: `${top + offsetTop}px`, left: `${left + offsetLeft}px` });
115
+ element.setAttribute("data-placement", placement);
116
+ };
117
+ position();
118
+ let frame;
119
+ const schedulePosition = () => {
120
+ if (frame !== void 0) return;
121
+ frame = window.requestAnimationFrame(() => {
122
+ frame = void 0;
123
+ position();
124
+ });
125
+ };
126
+ const observer = window.ResizeObserver ? new window.ResizeObserver(schedulePosition) : void 0;
127
+ observer?.observe(element);
128
+ observer?.observe(anchor);
129
+ window.addEventListener("resize", schedulePosition);
130
+ window.addEventListener("scroll", schedulePosition, true);
131
+ window.visualViewport?.addEventListener("resize", schedulePosition);
132
+ window.visualViewport?.addEventListener("scroll", schedulePosition);
133
+ return () => {
134
+ if (frame !== void 0) window.cancelAnimationFrame(frame);
135
+ observer?.disconnect();
136
+ window.removeEventListener("resize", schedulePosition);
137
+ window.removeEventListener("scroll", schedulePosition, true);
138
+ window.visualViewport?.removeEventListener("resize", schedulePosition);
139
+ window.visualViewport?.removeEventListener("scroll", schedulePosition);
140
+ for (const { property, value, priority } of original) {
141
+ if (value) element.style.setProperty(property, value, priority);
142
+ else element.style.removeProperty(property);
143
+ }
144
+ if (originalPlacement === null) element.removeAttribute("data-placement");
145
+ else element.setAttribute("data-placement", originalPlacement);
146
+ };
147
+ }, [picker.open, anchored, picker.trigger]);
148
+ React.useEffect(() => {
149
+ const element = dialog.current;
150
+ if (!picker.open || !element) return;
151
+ const dismiss = (event) => {
152
+ if (!(event.target instanceof Node) || latest.current.trigger.current?.contains(event.target)) return;
153
+ const rect = element.getBoundingClientRect();
154
+ const onBackdrop = event.target === element && (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom);
155
+ if (!element.contains(event.target) || onBackdrop) latest.current.send({ type: "CLOSE" });
156
+ };
157
+ element.ownerDocument.addEventListener("pointerdown", dismiss);
158
+ return () => element.ownerDocument.removeEventListener("pointerdown", dismiss);
159
+ }, [picker.open]);
160
+ return /* @__PURE__ */ jsx(
161
+ "dialog",
162
+ {
163
+ ...props,
164
+ ref: (node) => {
165
+ dialog.current = node;
166
+ if (typeof ref === "function") ref(node);
167
+ else if (ref) ref.current = node;
168
+ },
169
+ id: `${picker.id}-dialog`,
170
+ "aria-label": props["aria-label"] ?? picker.props.translations?.chooseDate ?? translations.chooseDate,
171
+ "aria-labelledby": props["aria-labelledby"] ?? (props["aria-label"] || !picker.labelled ? void 0 : `${picker.id}-field-label`),
172
+ "aria-modal": picker.props.modal !== false || void 0,
173
+ "data-scope": "date-picker",
174
+ "data-part": "popover",
175
+ onKeyDown: composeEvent(onKeyDown, (event) => {
176
+ if (picker.props.modal !== false) containTabFocus(event.currentTarget, event);
177
+ }),
178
+ onCancel: (event) => {
179
+ onCancel?.(event);
180
+ const canceled = event.defaultPrevented;
181
+ event.preventDefault();
182
+ if (!canceled) picker.send({ type: "CLOSE" });
183
+ },
184
+ onClose: composeEvent(onClose, () => {
185
+ if (picker.open) picker.send({ type: "CLOSE" });
186
+ }),
187
+ children: picker.open ? children : null
188
+ }
189
+ );
190
+ });
191
+ function PickerCalendar({ children, ...props }) {
192
+ const picker = usePicker();
193
+ return /* @__PURE__ */ jsx(Calendar.Root, { ...picker.props, ...props, value: picker.value, onChange: picker.change, onSelect: () => picker.send({ type: "SELECT" }), children: children ?? /* @__PURE__ */ jsxs(Fragment, { children: [
194
+ /* @__PURE__ */ jsxs(Calendar.Header, { children: [
195
+ /* @__PURE__ */ jsx(Calendar.PrevButton, {}),
196
+ /* @__PURE__ */ jsx(Calendar.Heading, {}),
197
+ /* @__PURE__ */ jsx(Calendar.NextButton, {})
198
+ ] }),
199
+ /* @__PURE__ */ jsxs(Calendar.Grid, { children: [
200
+ /* @__PURE__ */ jsx(Calendar.GridHeader, {}),
201
+ /* @__PURE__ */ jsx(Calendar.GridBody, {})
202
+ ] })
203
+ ] }) });
204
+ }
205
+ var DatePicker = { Root, Label, Field: DateField.Field, Segment: DateField.Segment, HiddenInput: DateField.HiddenInput, ClearButton: DateField.ClearButton, LiveRegion: DateField.LiveRegion, Trigger, Popover, Calendar: PickerCalendar };
206
+
207
+ export {
208
+ useDatePicker,
209
+ DatePicker
210
+ };
211
+ //# sourceMappingURL=chunk-5426MN2K.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/date-picker.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { computeAnchorPosition, containTabFocus, transitionPicker, translations, type PlainDate, type PickerEvent } from \"chrona-core\";\nimport { Calendar, type CalendarProps } from \"./calendar\";\nimport { DateField, type DateFieldProps } from \"./date-field\";\nimport { Part, composeEvent, type PartProps } from \"./part\";\nimport { useChronaConfig } from \"./provider\";\n\nexport interface DatePickerProps extends DateFieldProps {\n open?: boolean;\n defaultOpen?: boolean;\n onOpenChange?: (open: boolean) => void;\n modal?: boolean;\n timeZone?: string;\n firstDayOfWeek?: number;\n fixedWeeks?: boolean;\n numberOfMonths?: number;\n pagedNavigation?: boolean;\n}\n\ninterface PickerContext {\n props: DatePickerProps;\n options: DatePickerProps;\n state: { value: PlainDate | null; open: boolean };\n id: string;\n value: PlainDate | null;\n change: (value: PlainDate | null) => void;\n open: boolean;\n send: (event: PickerEvent) => void;\n trigger: { current: HTMLElement | null };\n labelled: boolean;\n registerLabel: (present: boolean) => void;\n}\n\nconst Context = React.createContext<PickerContext | null>(null);\nfunction usePicker() {\n const value = React.useContext(Context);\n if (!value) throw new Error(\"DatePicker parts must be inside DatePicker.Root.\");\n return value;\n}\n\nfunction Root({ children, asChild, className, style, ...input }: DatePickerProps & Pick<PartProps, \"children\" | \"asChild\" | \"className\" | \"style\">) {\n const picker = useDatePicker(input);\n return <Context.Provider value={picker}><Part asChild={asChild} className={className} style={style} dir={picker.props.dir} data-scope=\"date-picker\" data-part=\"root\"><DateField.Root {...picker.props} id={`${picker.id}-field`} value={picker.value} onChange={picker.change}>{children}</DateField.Root></Part></Context.Provider>;\n}\n\nexport function useDatePicker(input: DatePickerProps = {}): PickerContext {\n const props = useChronaConfig(input);\n const generatedId = React.useId();\n const id = props.id ?? generatedId;\n const [uncontrolledValue, setValue] = React.useState(props.defaultValue ?? null);\n const [uncontrolledOpen, setOpen] = React.useState(props.defaultOpen ?? false);\n const value = props.value === undefined ? uncontrolledValue : props.value;\n const open = props.open ?? uncontrolledOpen;\n const trigger = React.useRef<HTMLElement | null>(null);\n const [labelled, registerLabel] = React.useState(false);\n function change(next: PlainDate | null) {\n if (props.value === undefined) setValue(next);\n props.onChange?.(next);\n }\n function send(event: PickerEvent) {\n const result = transitionPicker({ open }, event, props);\n for (const effect of result.effects) if (effect.type === \"openChange\") {\n if (props.open === undefined) setOpen(effect.open);\n props.onOpenChange?.(effect.open);\n }\n }\n return { props, options: props, state: { value, open }, id, value, change, open, send, trigger, labelled, registerLabel };\n}\n\nconst Label = React.forwardRef<HTMLElement, PartProps>(function Label(props, ref) {\n const { registerLabel } = usePicker();\n React.useEffect(() => {\n registerLabel(true);\n return () => registerLabel(false);\n }, [registerLabel]);\n return <DateField.Label {...props} ref={ref} />;\n});\n\nconst Trigger = React.forwardRef<HTMLElement, React.ComponentPropsWithoutRef<\"button\"> & { asChild?: boolean }>(function Trigger({ onClick, ...props }, ref) {\n const picker = usePicker();\n return <Part as=\"button\" {...props} type=\"button\" ref={(node) => {\n picker.trigger.current = node;\n if (typeof ref === \"function\") ref(node); else if (ref) ref.current = node;\n }} aria-label={props[\"aria-label\"] ?? picker.props.translations?.chooseDate ?? translations.chooseDate} aria-haspopup=\"dialog\" aria-expanded={picker.open} aria-controls={`${picker.id}-dialog`} disabled={picker.props.disabled} data-scope=\"date-picker\" data-part=\"trigger\" onClick={composeEvent(onClick, () => picker.send({ type: \"TOGGLE\" }))} />;\n});\n\nconst Popover = React.forwardRef<HTMLDialogElement, Omit<React.ComponentPropsWithoutRef<\"dialog\">, \"open\"> & { anchored?: boolean }>(function Popover({ children, anchored = true, onCancel, onClose, onKeyDown, ...props }, ref) {\n const picker = usePicker();\n const dialog = React.useRef<HTMLDialogElement | null>(null);\n const latest = React.useRef(picker);\n latest.current = picker;\n\n React.useEffect(() => {\n const element = dialog.current;\n if (!element) return;\n if (picker.open && !element.open) {\n if (picker.props.modal === false) element.show(); else element.showModal();\n element.querySelector<HTMLElement>('[data-part=\"cell\"][tabindex=\"0\"]')?.focus();\n } else if (!picker.open && element.open) {\n element.close();\n picker.trigger.current?.focus();\n }\n }, [picker.open, picker.props.modal, picker.trigger]);\n\n React.useEffect(() => {\n if (!picker.open || !anchored) return;\n const element = dialog.current;\n const anchor = picker.trigger.current;\n const window = element?.ownerDocument.defaultView;\n if (!element || !anchor || !window) return;\n const properties = [\"position\", \"margin\", \"top\", \"left\", \"max-width\", \"max-height\", \"min-width\", \"min-height\", \"box-sizing\", \"overflow\"];\n const original = properties.map((property) => ({ property, value: element.style.getPropertyValue(property), priority: element.style.getPropertyPriority(property) }));\n const originalPlacement = element.getAttribute(\"data-placement\");\n const position = () => {\n const viewport = window.visualViewport;\n const width = viewport?.width ?? element.ownerDocument.documentElement.clientWidth;\n const height = viewport?.height ?? element.ownerDocument.documentElement.clientHeight;\n const offsetTop = viewport?.offsetTop ?? 0;\n const offsetLeft = viewport?.offsetLeft ?? 0;\n Object.assign(element.style, {\n position: \"fixed\", margin: \"0\", boxSizing: \"border-box\", overflow: \"auto\",\n minWidth: \"0\", minHeight: \"0\", maxWidth: `${Math.max(0, width - 8)}px`, maxHeight: `${Math.max(0, height - 8)}px`,\n });\n const rect = anchor.getBoundingClientRect();\n const { top, left, placement } = computeAnchorPosition(\n { top: rect.top - offsetTop, left: rect.left - offsetLeft, width: rect.width, height: rect.height },\n { width: element.offsetWidth, height: element.offsetHeight }, { width, height },\n );\n Object.assign(element.style, { top: `${top + offsetTop}px`, left: `${left + offsetLeft}px` });\n element.setAttribute(\"data-placement\", placement);\n };\n position();\n let frame: number | undefined;\n const schedulePosition = () => {\n if (frame !== undefined) return;\n frame = window.requestAnimationFrame(() => {\n frame = undefined;\n position();\n });\n };\n const observer = window.ResizeObserver ? new window.ResizeObserver(schedulePosition) : undefined;\n observer?.observe(element);\n observer?.observe(anchor);\n window.addEventListener(\"resize\", schedulePosition);\n window.addEventListener(\"scroll\", schedulePosition, true);\n window.visualViewport?.addEventListener(\"resize\", schedulePosition);\n window.visualViewport?.addEventListener(\"scroll\", schedulePosition);\n return () => {\n if (frame !== undefined) window.cancelAnimationFrame(frame);\n observer?.disconnect();\n window.removeEventListener(\"resize\", schedulePosition);\n window.removeEventListener(\"scroll\", schedulePosition, true);\n window.visualViewport?.removeEventListener(\"resize\", schedulePosition);\n window.visualViewport?.removeEventListener(\"scroll\", schedulePosition);\n for (const { property, value, priority } of original) {\n if (value) element.style.setProperty(property, value, priority);\n else element.style.removeProperty(property);\n }\n if (originalPlacement === null) element.removeAttribute(\"data-placement\");\n else element.setAttribute(\"data-placement\", originalPlacement);\n };\n }, [picker.open, anchored, picker.trigger]);\n\n React.useEffect(() => {\n const element = dialog.current;\n if (!picker.open || !element) return;\n const dismiss = (event: PointerEvent) => {\n if (!(event.target instanceof Node) || latest.current.trigger.current?.contains(event.target)) return;\n const rect = element.getBoundingClientRect();\n const onBackdrop = event.target === element && (event.clientX < rect.left || event.clientX > rect.right || event.clientY < rect.top || event.clientY > rect.bottom);\n if (!element.contains(event.target) || onBackdrop) latest.current.send({ type: \"CLOSE\" });\n };\n element.ownerDocument.addEventListener(\"pointerdown\", dismiss);\n return () => element.ownerDocument.removeEventListener(\"pointerdown\", dismiss);\n }, [picker.open]);\n\n return <dialog {...props} ref={(node) => {\n dialog.current = node;\n if (typeof ref === \"function\") ref(node); else if (ref) ref.current = node;\n }} id={`${picker.id}-dialog`} aria-label={props[\"aria-label\"] ?? picker.props.translations?.chooseDate ?? translations.chooseDate} aria-labelledby={props[\"aria-labelledby\"] ?? (props[\"aria-label\"] || !picker.labelled ? undefined : `${picker.id}-field-label`)} aria-modal={picker.props.modal !== false || undefined} data-scope=\"date-picker\" data-part=\"popover\"\n onKeyDown={composeEvent(onKeyDown, (event) => { if (picker.props.modal !== false) containTabFocus(event.currentTarget, event); })}\n onCancel={(event) => { onCancel?.(event); const canceled = event.defaultPrevented; event.preventDefault(); if (!canceled) picker.send({ type: \"CLOSE\" }); }}\n onClose={composeEvent(onClose, () => { if (picker.open) picker.send({ type: \"CLOSE\" }); })}>{picker.open ? children : null}</dialog>;\n});\n\nfunction PickerCalendar({ children, ...props }: Omit<CalendarProps, \"value\" | \"defaultValue\" | \"onChange\"> & Pick<PartProps, \"children\" | \"className\" | \"style\">) {\n const picker = usePicker();\n return <Calendar.Root {...picker.props} {...props} value={picker.value} onChange={picker.change} onSelect={() => picker.send({ type: \"SELECT\" })}>{children ?? <><Calendar.Header><Calendar.PrevButton /><Calendar.Heading /><Calendar.NextButton /></Calendar.Header><Calendar.Grid><Calendar.GridHeader /><Calendar.GridBody /></Calendar.Grid></>}</Calendar.Root>;\n}\n\nexport const DatePicker = { Root, Label, Field: DateField.Field, Segment: DateField.Segment, HiddenInput: DateField.HiddenInput, ClearButton: DateField.ClearButton, LiveRegion: DateField.LiveRegion, Trigger, Popover, Calendar: PickerCalendar };"],"mappings":";;;;;;;;;;;;;AAAA,YAAY,WAAW;AACvB,SAAS,uBAAuB,iBAAiB,kBAAkB,oBAAsD;AAyCgD,SAiJN,UAjJM,KAiJJ,YAjJI;AATzK,IAAM,UAAgB,oBAAoC,IAAI;AAC9D,SAAS,YAAY;AACjB,QAAM,QAAc,iBAAW,OAAO;AACtC,MAAI,CAAC,MAAO,OAAM,IAAI,MAAM,kDAAkD;AAC9E,SAAO;AACX;AAEA,SAAS,KAAK,EAAE,UAAU,SAAS,WAAW,OAAO,GAAG,MAAM,GAAsF;AAChJ,QAAM,SAAS,cAAc,KAAK;AAClC,SAAO,oBAAC,QAAQ,UAAR,EAAiB,OAAO,QAAQ,8BAAC,QAAK,SAAkB,WAAsB,OAAc,KAAK,OAAO,MAAM,KAAK,cAAW,eAAc,aAAU,QAAO,8BAAC,UAAU,MAAV,EAAgB,GAAG,OAAO,OAAO,IAAI,GAAG,OAAO,EAAE,UAAU,OAAO,OAAO,OAAO,UAAU,OAAO,QAAS,UAAS,GAAiB,GAAO;AACrT;AAEO,SAAS,cAAc,QAAyB,CAAC,GAAkB;AACtE,QAAM,QAAQ,gBAAgB,KAAK;AACnC,QAAM,cAAoB,YAAM;AAChC,QAAM,KAAK,MAAM,MAAM;AACvB,QAAM,CAAC,mBAAmB,QAAQ,IAAU,eAAS,MAAM,gBAAgB,IAAI;AAC/E,QAAM,CAAC,kBAAkB,OAAO,IAAU,eAAS,MAAM,eAAe,KAAK;AAC7E,QAAM,QAAQ,MAAM,UAAU,SAAY,oBAAoB,MAAM;AACpE,QAAM,OAAO,MAAM,QAAQ;AAC3B,QAAM,UAAgB,aAA2B,IAAI;AACrD,QAAM,CAAC,UAAU,aAAa,IAAU,eAAS,KAA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QAAT,EAAgB;AAAA,0BAAC,SAAS,YAAT,EAAoB;AAAA,MAAE,oBAAC,SAAS,SAAT,EAAiB;AAAA,MAAE,oBAAC,SAAS,YAAT,EAAoB;AAAA,OAAE;AAAA,IAAkB,qBAAC,SAAS,MAAT,EAAc;AAAA,0BAAC,SAAS,YAAT,EAAoB;AAAA,MAAE,oBAAC,SAAS,UAAT,EAAkB;AAAA,OAAE;AAAA,KAAgB,GAAI;AACzV;AAEO,IAAM,aAAa,EAAE,MAAM,OAAO,OAAO,UAAU,OAAO,SAAS,UAAU,SAAS,aAAa,UAAU,aAAa,aAAa,UAAU,aAAa,YAAY,UAAU,YAAY,SAAS,SAAS,UAAU,eAAe;","names":["Label","Trigger","Popover"]}
@@ -0,0 +1,16 @@
1
+ import {
2
+ createFieldComponents,
3
+ useField
4
+ } from "./chunk-VSD2IX3U.js";
5
+
6
+ // src/time-field.tsx
7
+ var TimeField = createFieldComponents("time");
8
+ function useTimeField(props = {}) {
9
+ return useField("time", props);
10
+ }
11
+
12
+ export {
13
+ TimeField,
14
+ useTimeField
15
+ };
16
+ //# sourceMappingURL=chunk-6QRNDYNF.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/time-field.tsx"],"sourcesContent":["import { createFieldComponents, useField, type FieldProps } from \"./field\";\n\nexport type TimeFieldProps = FieldProps<\"time\">;\nexport const TimeField = createFieldComponents(\"time\");\nexport function useTimeField(props: TimeFieldProps = {}) { return useField(\"time\", props); }"],"mappings":";;;;;;AAGO,IAAM,YAAY,sBAAsB,MAAM;AAC9C,SAAS,aAAa,QAAwB,CAAC,GAAG;AAAE,SAAO,SAAS,QAAQ,KAAK;AAAG;","names":[]}