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 +21 -0
- package/README.md +132 -0
- package/dist/calendar.d.ts +126 -0
- package/dist/calendar.js +14 -0
- package/dist/calendar.js.map +1 -0
- package/dist/chunk-5426MN2K.js +211 -0
- package/dist/chunk-5426MN2K.js.map +1 -0
- package/dist/chunk-6QRNDYNF.js +16 -0
- package/dist/chunk-6QRNDYNF.js.map +1 -0
- package/dist/chunk-EFN32TNK.js +159 -0
- package/dist/chunk-EFN32TNK.js.map +1 -0
- package/dist/chunk-GN2YCKFZ.js +98 -0
- package/dist/chunk-GN2YCKFZ.js.map +1 -0
- package/dist/chunk-VSD2IX3U.js +183 -0
- package/dist/chunk-VSD2IX3U.js.map +1 -0
- package/dist/chunk-XNVORQQ5.js +112 -0
- package/dist/chunk-XNVORQQ5.js.map +1 -0
- package/dist/chunk-ZN4FZDUQ.js +16 -0
- package/dist/chunk-ZN4FZDUQ.js.map +1 -0
- package/dist/date-field.d.ts +74 -0
- package/dist/date-field.js +11 -0
- package/dist/date-field.js.map +1 -0
- package/dist/date-picker.d.ts +69 -0
- package/dist/date-picker.js +13 -0
- package/dist/date-picker.js.map +1 -0
- package/dist/field-CQjoX8QG.d.ts +11 -0
- package/dist/form-BCAGbNh-.d.ts +20 -0
- package/dist/index.d.ts +10 -0
- package/dist/index.js +40 -0
- package/dist/index.js.map +1 -0
- package/dist/range-calendar.d.ts +194 -0
- package/dist/range-calendar.js +11 -0
- package/dist/range-calendar.js.map +1 -0
- package/dist/time-field.d.ts +74 -0
- package/dist/time-field.js +11 -0
- package/dist/time-field.js.map +1 -0
- package/package.json +75 -0
|
@@ -0,0 +1,112 @@
|
|
|
1
|
+
import {
|
|
2
|
+
Calendar,
|
|
3
|
+
CalendarSurface,
|
|
4
|
+
useCalendar
|
|
5
|
+
} from "./chunk-EFN32TNK.js";
|
|
6
|
+
import {
|
|
7
|
+
Part,
|
|
8
|
+
composeEvent,
|
|
9
|
+
useChronaConfig,
|
|
10
|
+
useFormReset
|
|
11
|
+
} from "./chunk-GN2YCKFZ.js";
|
|
12
|
+
|
|
13
|
+
// src/range-calendar.tsx
|
|
14
|
+
import * as React from "react";
|
|
15
|
+
import { createRange, createStore, formatDate, getRangeCellProps, transitionRange, translations, validateRange } from "chrona-core";
|
|
16
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
17
|
+
function useRangeCalendar(input = {}) {
|
|
18
|
+
const props = useChronaConfig(input);
|
|
19
|
+
const [store] = React.useState(() => createStore(createRange(props.value !== void 0 ? props.value : props.defaultValue)));
|
|
20
|
+
const snapshot = React.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);
|
|
21
|
+
if (props.value) validateRange(props.value);
|
|
22
|
+
const state = { ...snapshot, value: props.value === void 0 ? snapshot.value : props.value };
|
|
23
|
+
const [announcement, setAnnouncement] = React.useState("");
|
|
24
|
+
function send(event) {
|
|
25
|
+
const result = transitionRange(state, event, props);
|
|
26
|
+
store.setState(result.state);
|
|
27
|
+
for (const effect of result.effects) {
|
|
28
|
+
if (effect.type === "change") {
|
|
29
|
+
props.onChange?.(effect.value);
|
|
30
|
+
setAnnouncement(effect.value ? [effect.value.start, effect.value.end].map((date) => formatDate(date, props.locale, { dateStyle: "long" })).join(props.translations?.rangeSeparator ?? translations.rangeSeparator) : "");
|
|
31
|
+
}
|
|
32
|
+
if (effect.type === "rangeStart") {
|
|
33
|
+
props.onRangeStartChange?.(effect.value);
|
|
34
|
+
if (effect.value) setAnnouncement(formatDate(effect.value, props.locale, { dateStyle: "long" }));
|
|
35
|
+
}
|
|
36
|
+
if (effect.type === "invalid") {
|
|
37
|
+
props.onInvalid?.();
|
|
38
|
+
setAnnouncement(props.translations?.unavailable ?? translations.unavailable);
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
}
|
|
42
|
+
const calendar = useCalendar({ ...props, value: null, defaultValue: null, placeholderValue: props.placeholderValue ?? state.value?.start, onChange: (date) => {
|
|
43
|
+
if (date) send({ type: "SELECT", date });
|
|
44
|
+
}, onFocusedValueChange: (date) => {
|
|
45
|
+
props.onFocusedValueChange?.(date);
|
|
46
|
+
if (state.anchor) send({ type: "PREVIEW", date });
|
|
47
|
+
} });
|
|
48
|
+
const baseApi = calendar.api;
|
|
49
|
+
const api = { ...baseApi, getCellProps: (date, month) => ({ ...baseApi.getCellProps(date, month), ...getRangeCellProps(state, date) }) };
|
|
50
|
+
return {
|
|
51
|
+
state,
|
|
52
|
+
send,
|
|
53
|
+
announcement,
|
|
54
|
+
props,
|
|
55
|
+
options: props,
|
|
56
|
+
api,
|
|
57
|
+
rootRef: calendar.rootRef,
|
|
58
|
+
months: calendar.months,
|
|
59
|
+
reset() {
|
|
60
|
+
const value = props.defaultValue ?? null;
|
|
61
|
+
store.setState(createRange(value));
|
|
62
|
+
props.onChange?.(value);
|
|
63
|
+
},
|
|
64
|
+
calendar: { ...calendar, api }
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
var Context = React.createContext(null);
|
|
68
|
+
function useContext2() {
|
|
69
|
+
const value = React.useContext(Context);
|
|
70
|
+
if (!value) throw new Error("RangeCalendar parts must be inside RangeCalendar.Root.");
|
|
71
|
+
return value;
|
|
72
|
+
}
|
|
73
|
+
function Root({ children, asChild, className, style, ...props }) {
|
|
74
|
+
const context = useRangeCalendar(props);
|
|
75
|
+
return /* @__PURE__ */ jsx(Context.Provider, { value: context, children: /* @__PURE__ */ jsx(CalendarSurface, { calendar: context.calendar, asChild, className, style, "data-scope": "range-calendar", onKeyDown: (event) => {
|
|
76
|
+
if (event.key === "Escape" && context.state.anchor) {
|
|
77
|
+
event.preventDefault();
|
|
78
|
+
context.send({ type: "CANCEL" });
|
|
79
|
+
}
|
|
80
|
+
}, children }) });
|
|
81
|
+
}
|
|
82
|
+
var Cell = React.forwardRef(function Cell2({ date, onPointerEnter, ...props }, ref) {
|
|
83
|
+
const { send } = useContext2();
|
|
84
|
+
return /* @__PURE__ */ jsx(Calendar.Cell, { ...props, ref, date, onPointerEnter: composeEvent(onPointerEnter, () => send({ type: "PREVIEW", date })) });
|
|
85
|
+
});
|
|
86
|
+
var GridBody = React.forwardRef(function GridBody2({ children, ...props }, ref) {
|
|
87
|
+
return /* @__PURE__ */ jsx(Calendar.GridBody, { ...props, ref, children: children ?? ((date) => /* @__PURE__ */ jsx(Cell, { date })) });
|
|
88
|
+
});
|
|
89
|
+
var LiveRegion = React.forwardRef(function LiveRegion2(props, ref) {
|
|
90
|
+
const { announcement } = useContext2();
|
|
91
|
+
return /* @__PURE__ */ jsx(Part, { ...props, ref, role: "status", "aria-live": "polite", "aria-atomic": "true", "data-scope": "range-calendar", "data-part": "live-region", children: announcement });
|
|
92
|
+
});
|
|
93
|
+
var ClearButton = React.forwardRef(function ClearButton2({ onClick, ...props }, ref) {
|
|
94
|
+
const { send, props: options } = useContext2();
|
|
95
|
+
return /* @__PURE__ */ jsx(Part, { as: "button", ...props, ref, type: "button", disabled: options.disabled || options.readOnly, "aria-label": options.translations?.clear ?? translations.clear, "data-scope": "range-calendar", "data-part": "clear-button", onClick: composeEvent(onClick, () => send({ type: "CLEAR" })) });
|
|
96
|
+
});
|
|
97
|
+
function HiddenInput({ name, form, id, disabled, ...inputProps }) {
|
|
98
|
+
const { state, props, reset } = useContext2();
|
|
99
|
+
const input = React.useRef(null);
|
|
100
|
+
useFormReset(input, form, reset);
|
|
101
|
+
return /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
102
|
+
/* @__PURE__ */ jsx("input", { ...inputProps, id: id ? `${id}-start` : void 0, ref: input, type: "hidden", name: `${name}.start`, form, value: state.value?.start.toString() ?? "", disabled: props.disabled || disabled, "data-scope": "range-calendar", "data-part": "hidden-input" }),
|
|
103
|
+
/* @__PURE__ */ jsx("input", { ...inputProps, id: id ? `${id}-end` : void 0, type: "hidden", name: `${name}.end`, form, value: state.value?.end.toString() ?? "", disabled: props.disabled || disabled, "data-scope": "range-calendar", "data-part": "hidden-input" })
|
|
104
|
+
] });
|
|
105
|
+
}
|
|
106
|
+
var RangeCalendar = { ...Calendar, Root, Cell, GridBody, LiveRegion, ClearButton, HiddenInput };
|
|
107
|
+
|
|
108
|
+
export {
|
|
109
|
+
useRangeCalendar,
|
|
110
|
+
RangeCalendar
|
|
111
|
+
};
|
|
112
|
+
//# sourceMappingURL=chunk-XNVORQQ5.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/range-calendar.tsx"],"sourcesContent":["import * as React from \"react\";\nimport { createRange, createStore, formatDate, getRangeCellProps, transitionRange, translations, validateRange, type DateRange, type PlainDate, type RangeEvent } from \"chrona-core\";\nimport { Calendar, CalendarSurface, useCalendar, type CalendarProps } from \"./calendar\";\nimport { Part, composeEvent, type PartProps } from \"./part\";\nimport { useFormReset, type HiddenInputProps } from \"./form\";\nimport { useChronaConfig } from \"./provider\";\n\nexport interface RangeCalendarProps extends Omit<CalendarProps, \"value\" | \"defaultValue\" | \"onChange\"> {\n value?: DateRange | null;\n defaultValue?: DateRange | null;\n onChange?: (value: DateRange | null) => void;\n onRangeStartChange?: (value: PlainDate | null) => void;\n onInvalid?: () => void;\n}\n\nexport function useRangeCalendar(input: RangeCalendarProps = {}) {\n const props = useChronaConfig(input);\n const [store] = React.useState(() => createStore(createRange(props.value !== undefined ? props.value : props.defaultValue)));\n const snapshot = React.useSyncExternalStore(store.subscribe, store.getSnapshot, store.getServerSnapshot);\n if (props.value) validateRange(props.value);\n const state = { ...snapshot, value: props.value === undefined ? snapshot.value : props.value };\n const [announcement, setAnnouncement] = React.useState(\"\");\n function send(event: RangeEvent) {\n const result = transitionRange(state, event, props);\n store.setState(result.state);\n for (const effect of result.effects) {\n if (effect.type === \"change\") {\n props.onChange?.(effect.value);\n setAnnouncement(effect.value ? [effect.value.start, effect.value.end].map((date) => formatDate(date, props.locale, { dateStyle: \"long\" })).join(props.translations?.rangeSeparator ?? translations.rangeSeparator) : \"\");\n }\n if (effect.type === \"rangeStart\") {\n props.onRangeStartChange?.(effect.value);\n if (effect.value) setAnnouncement(formatDate(effect.value, props.locale, { dateStyle: \"long\" }));\n }\n if (effect.type === \"invalid\") { props.onInvalid?.(); setAnnouncement(props.translations?.unavailable ?? translations.unavailable); }\n }\n }\n const calendar = useCalendar({ ...props, value: null, defaultValue: null, placeholderValue: props.placeholderValue ?? state.value?.start, onChange: (date) => { if (date) send({ type: \"SELECT\", date }); }, onFocusedValueChange: (date) => { props.onFocusedValueChange?.(date); if (state.anchor) send({ type: \"PREVIEW\", date }); } });\n const baseApi = calendar.api;\n const api = { ...baseApi, getCellProps: (date: PlainDate, month?: PlainDate) => ({ ...baseApi.getCellProps(date, month), ...getRangeCellProps(state, date) }) };\n return {\n state, send, announcement, props, options: props, api, rootRef: calendar.rootRef, months: calendar.months,\n reset() { const value = props.defaultValue ?? null; store.setState(createRange(value)); props.onChange?.(value); },\n calendar: { ...calendar, api },\n };\n}\n\nconst Context = React.createContext<ReturnType<typeof useRangeCalendar> | null>(null);\nfunction useContext() {\n const value = React.useContext(Context);\n if (!value) throw new Error(\"RangeCalendar parts must be inside RangeCalendar.Root.\");\n return value;\n}\n\nfunction Root({ children, asChild, className, style, ...props }: RangeCalendarProps & Pick<PartProps, \"children\" | \"asChild\" | \"className\" | \"style\">) {\n const context = useRangeCalendar(props);\n return <Context.Provider value={context}><CalendarSurface calendar={context.calendar} asChild={asChild} className={className} style={style} data-scope=\"range-calendar\" onKeyDown={(event) => { if (event.key === \"Escape\" && context.state.anchor) { event.preventDefault(); context.send({ type: \"CANCEL\" }); } }}>{children}</CalendarSurface></Context.Provider>;\n}\n\nconst Cell = React.forwardRef<HTMLElement, React.ComponentPropsWithoutRef<typeof Calendar.Cell>>(function Cell({ date, onPointerEnter, ...props }, ref) {\n const { send } = useContext();\n return <Calendar.Cell {...props} ref={ref} date={date} onPointerEnter={composeEvent(onPointerEnter, () => send({ type: \"PREVIEW\", date }))} />;\n});\n\nconst GridBody = React.forwardRef<HTMLElement, React.ComponentPropsWithoutRef<typeof Calendar.GridBody>>(function GridBody({ children, ...props }, ref) {\n return <Calendar.GridBody {...props} ref={ref}>{children ?? ((date) => <Cell date={date} />)}</Calendar.GridBody>;\n});\n\nconst LiveRegion = React.forwardRef<HTMLElement, PartProps>(function LiveRegion(props, ref) {\n const { announcement } = useContext();\n return <Part {...props} ref={ref} role=\"status\" aria-live=\"polite\" aria-atomic=\"true\" data-scope=\"range-calendar\" data-part=\"live-region\">{announcement}</Part>;\n});\n\nconst ClearButton = React.forwardRef<HTMLElement, React.ComponentPropsWithoutRef<typeof Calendar.ClearButton>>(function ClearButton({ onClick, ...props }, ref) {\n const { send, props: options } = useContext();\n return <Part as=\"button\" {...props} ref={ref} type=\"button\" disabled={options.disabled || options.readOnly} aria-label={options.translations?.clear ?? translations.clear} data-scope=\"range-calendar\" data-part=\"clear-button\" onClick={composeEvent(onClick, () => send({ type: \"CLEAR\" }))} />;\n});\n\nfunction HiddenInput({ name, form, id, disabled, ...inputProps }: HiddenInputProps & { name: string }) {\n const { state, props, reset } = useContext();\n const input = React.useRef<HTMLInputElement>(null);\n useFormReset(input, form, reset);\n return <><input {...inputProps} id={id ? `${id}-start` : undefined} ref={input} type=\"hidden\" name={`${name}.start`} form={form} value={state.value?.start.toString() ?? \"\"} disabled={props.disabled || disabled} data-scope=\"range-calendar\" data-part=\"hidden-input\" /><input {...inputProps} id={id ? `${id}-end` : undefined} type=\"hidden\" name={`${name}.end`} form={form} value={state.value?.end.toString() ?? \"\"} disabled={props.disabled || disabled} data-scope=\"range-calendar\" data-part=\"hidden-input\" /></>;\n}\n\nexport const RangeCalendar = { ...Calendar, Root, Cell, GridBody, LiveRegion, ClearButton, HiddenInput };"],"mappings":";;;;;;;;;;;;;AAAA,YAAY,WAAW;AACvB,SAAS,aAAa,aAAa,YAAY,mBAAmB,iBAAiB,cAAc,qBAAsE;AAuD1H,SA0BlC,UA1BkC,KA0BlC,YA1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AAM,QAAc,aAAyB,IAAI;AACjD,eAAa,OAAO,MAAM,KAAK;AAC/B,SAAO,iCAAE;AAAA,wBAAC,WAAO,GAAG,YAAY,IAAI,KAAK,GAAG,EAAE,WAAW,QAAW,KAAK,OAAO,MAAK,UAAS,MAAM,GAAG,IAAI,UAAU,MAAY,OAAO,MAAM,OAAO,MAAM,SAAS,KAAK,IAAI,UAAU,MAAM,YAAY,UAAU,cAAW,kBAAiB,aAAU,gBAAe;AAAA,IAAE,oBAAC,WAAO,GAAG,YAAY,IAAI,KAAK,GAAG,EAAE,SAAS,QAAW,MAAK,UAAS,MAAM,GAAG,IAAI,QAAQ,MAAY,OAAO,MAAM,OAAO,IAAI,SAAS,KAAK,IAAI,UAAU,MAAM,YAAY,UAAU,cAAW,kBAAiB,aAAU,gBAAe;AAAA,KAAE;AAC7f;AAEO,IAAM,gBAAgB,EAAE,GAAG,UAAU,MAAM,MAAM,UAAU,YAAY,aAAa,YAAY;","names":["useContext","Cell","GridBody","LiveRegion","ClearButton"]}
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
createFieldComponents,
|
|
3
|
+
useField
|
|
4
|
+
} from "./chunk-VSD2IX3U.js";
|
|
5
|
+
|
|
6
|
+
// src/date-field.tsx
|
|
7
|
+
var DateField = createFieldComponents("date");
|
|
8
|
+
function useDateField(props = {}) {
|
|
9
|
+
return useField("date", props);
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
export {
|
|
13
|
+
DateField,
|
|
14
|
+
useDateField
|
|
15
|
+
};
|
|
16
|
+
//# sourceMappingURL=chunk-ZN4FZDUQ.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/date-field.tsx"],"sourcesContent":["import { createFieldComponents, useField, type FieldProps } from \"./field\";\n\nexport type DateFieldProps = FieldProps<\"date\">;\nexport const DateField = createFieldComponents(\"date\");\nexport function useDateField(props: DateFieldProps = {}) { return useField(\"date\", props); }"],"mappings":";;;;;;AAGO,IAAM,YAAY,sBAAsB,MAAM;AAC9C,SAAS,aAAa,QAAwB,CAAC,GAAG;AAAE,SAAO,SAAS,QAAQ,KAAK;AAAG;","names":[]}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { P as PartProps, H as HiddenInputProps, C as ChronaConfig } from './form-BCAGbNh-.js';
|
|
2
|
+
import * as chrona_core from 'chrona-core';
|
|
3
|
+
import * as React from 'react';
|
|
4
|
+
import { F as FieldProps } from './field-CQjoX8QG.js';
|
|
5
|
+
|
|
6
|
+
type DateFieldProps = FieldProps<"date">;
|
|
7
|
+
declare const DateField: {
|
|
8
|
+
Root: ({ children, asChild, className, style, ...props }: FieldProps<"date"> & Pick<PartProps, "children" | "asChild" | "className" | "style">) => React.JSX.Element;
|
|
9
|
+
Label: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
10
|
+
asChild?: boolean;
|
|
11
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
12
|
+
Field: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
13
|
+
asChild?: boolean;
|
|
14
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
15
|
+
Segment: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value" | "defaultValue" | "onChange" | "children" | "type"> & {
|
|
16
|
+
type: chrona_core.SegmentType;
|
|
17
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
18
|
+
HiddenInput: (props: HiddenInputProps) => React.JSX.Element;
|
|
19
|
+
ClearButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
20
|
+
asChild?: boolean;
|
|
21
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
22
|
+
LiveRegion: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
23
|
+
asChild?: boolean;
|
|
24
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
25
|
+
};
|
|
26
|
+
declare function useDateField(props?: DateFieldProps): {
|
|
27
|
+
id: string;
|
|
28
|
+
state: chrona_core.FieldState<"date">;
|
|
29
|
+
options: FieldProps<"date"> & ChronaConfig;
|
|
30
|
+
send: (event: chrona_core.FieldEvent) => void;
|
|
31
|
+
reset: () => void;
|
|
32
|
+
moveFocus: (segment: chrona_core.SegmentType, offset: number) => void;
|
|
33
|
+
groupRef: React.RefObject<HTMLElement | null>;
|
|
34
|
+
announcement: string;
|
|
35
|
+
registerLabel: React.Dispatch<React.SetStateAction<boolean>>;
|
|
36
|
+
api: {
|
|
37
|
+
segments: {
|
|
38
|
+
type: chrona_core.SegmentType | "literal";
|
|
39
|
+
value: string;
|
|
40
|
+
}[];
|
|
41
|
+
getGroupProps: () => {
|
|
42
|
+
role: "group";
|
|
43
|
+
"aria-labelledby": string | undefined;
|
|
44
|
+
"aria-describedby": string | undefined;
|
|
45
|
+
"aria-invalid": true | undefined;
|
|
46
|
+
"data-scope": string;
|
|
47
|
+
"data-part": string;
|
|
48
|
+
"data-invalid": string | undefined;
|
|
49
|
+
"data-disabled": string | undefined;
|
|
50
|
+
"data-readonly": string | undefined;
|
|
51
|
+
dir: "ltr" | "rtl" | undefined;
|
|
52
|
+
};
|
|
53
|
+
getSegmentProps: (segment: chrona_core.SegmentType) => {
|
|
54
|
+
role: "spinbutton";
|
|
55
|
+
"aria-label": string;
|
|
56
|
+
"aria-valuemin": number;
|
|
57
|
+
"aria-valuemax": number;
|
|
58
|
+
"aria-valuenow": number | undefined;
|
|
59
|
+
"aria-valuetext": string;
|
|
60
|
+
"aria-required": true | undefined;
|
|
61
|
+
"aria-invalid": true | undefined;
|
|
62
|
+
"aria-describedby": string | undefined;
|
|
63
|
+
"aria-readonly": true | undefined;
|
|
64
|
+
"data-scope": string;
|
|
65
|
+
"data-part": string;
|
|
66
|
+
"data-segment": chrona_core.SegmentName;
|
|
67
|
+
"data-placeholder": string | undefined;
|
|
68
|
+
"data-invalid": string | undefined;
|
|
69
|
+
display: string;
|
|
70
|
+
};
|
|
71
|
+
};
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
export { DateField, type DateFieldProps, useDateField };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { P as PartProps, H as HiddenInputProps } from './form-BCAGbNh-.js';
|
|
2
|
+
import * as chrona_core from 'chrona-core';
|
|
3
|
+
import { PlainDate, PickerEvent } from 'chrona-core';
|
|
4
|
+
import * as React from 'react';
|
|
5
|
+
import { CalendarProps } from './calendar.js';
|
|
6
|
+
import { DateFieldProps } from './date-field.js';
|
|
7
|
+
import 'temporal-spec';
|
|
8
|
+
import './field-CQjoX8QG.js';
|
|
9
|
+
|
|
10
|
+
interface DatePickerProps extends DateFieldProps {
|
|
11
|
+
open?: boolean;
|
|
12
|
+
defaultOpen?: boolean;
|
|
13
|
+
onOpenChange?: (open: boolean) => void;
|
|
14
|
+
modal?: boolean;
|
|
15
|
+
timeZone?: string;
|
|
16
|
+
firstDayOfWeek?: number;
|
|
17
|
+
fixedWeeks?: boolean;
|
|
18
|
+
numberOfMonths?: number;
|
|
19
|
+
pagedNavigation?: boolean;
|
|
20
|
+
}
|
|
21
|
+
interface PickerContext {
|
|
22
|
+
props: DatePickerProps;
|
|
23
|
+
options: DatePickerProps;
|
|
24
|
+
state: {
|
|
25
|
+
value: PlainDate | null;
|
|
26
|
+
open: boolean;
|
|
27
|
+
};
|
|
28
|
+
id: string;
|
|
29
|
+
value: PlainDate | null;
|
|
30
|
+
change: (value: PlainDate | null) => void;
|
|
31
|
+
open: boolean;
|
|
32
|
+
send: (event: PickerEvent) => void;
|
|
33
|
+
trigger: {
|
|
34
|
+
current: HTMLElement | null;
|
|
35
|
+
};
|
|
36
|
+
labelled: boolean;
|
|
37
|
+
registerLabel: (present: boolean) => void;
|
|
38
|
+
}
|
|
39
|
+
declare function Root({ children, asChild, className, style, ...input }: DatePickerProps & Pick<PartProps, "children" | "asChild" | "className" | "style">): React.JSX.Element;
|
|
40
|
+
declare function useDatePicker(input?: DatePickerProps): PickerContext;
|
|
41
|
+
declare function PickerCalendar({ children, ...props }: Omit<CalendarProps, "value" | "defaultValue" | "onChange"> & Pick<PartProps, "children" | "className" | "style">): React.JSX.Element;
|
|
42
|
+
declare const DatePicker: {
|
|
43
|
+
Root: typeof Root;
|
|
44
|
+
Label: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
45
|
+
asChild?: boolean;
|
|
46
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
47
|
+
Field: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
48
|
+
asChild?: boolean;
|
|
49
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
50
|
+
Segment: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.InputHTMLAttributes<HTMLInputElement>, HTMLInputElement>, "ref">, "value" | "defaultValue" | "onChange" | "children" | "type"> & {
|
|
51
|
+
type: chrona_core.SegmentType;
|
|
52
|
+
} & React.RefAttributes<HTMLInputElement>>;
|
|
53
|
+
HiddenInput: (props: HiddenInputProps) => React.JSX.Element;
|
|
54
|
+
ClearButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
55
|
+
asChild?: boolean;
|
|
56
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
57
|
+
LiveRegion: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
58
|
+
asChild?: boolean;
|
|
59
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
60
|
+
Trigger: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
61
|
+
asChild?: boolean;
|
|
62
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
63
|
+
Popover: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.DialogHTMLAttributes<HTMLDialogElement>, HTMLDialogElement>, "ref">, "open"> & {
|
|
64
|
+
anchored?: boolean;
|
|
65
|
+
} & React.RefAttributes<HTMLDialogElement>>;
|
|
66
|
+
Calendar: typeof PickerCalendar;
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
export { DatePicker, type DatePickerProps, useDatePicker };
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DatePicker,
|
|
3
|
+
useDatePicker
|
|
4
|
+
} from "./chunk-5426MN2K.js";
|
|
5
|
+
import "./chunk-ZN4FZDUQ.js";
|
|
6
|
+
import "./chunk-EFN32TNK.js";
|
|
7
|
+
import "./chunk-VSD2IX3U.js";
|
|
8
|
+
import "./chunk-GN2YCKFZ.js";
|
|
9
|
+
export {
|
|
10
|
+
DatePicker,
|
|
11
|
+
useDatePicker
|
|
12
|
+
};
|
|
13
|
+
//# sourceMappingURL=date-picker.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { FieldKind, FieldOptions, FieldValue } from 'chrona-core';
|
|
2
|
+
|
|
3
|
+
interface FieldProps<Kind extends FieldKind> extends FieldOptions<Kind> {
|
|
4
|
+
defaultValue?: FieldValue<Kind> | null;
|
|
5
|
+
onChange?: (value: FieldValue<Kind> | null) => void;
|
|
6
|
+
onInvalid?: (reason: "range" | "unavailable") => void;
|
|
7
|
+
id?: string;
|
|
8
|
+
describedBy?: string;
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
export type { FieldProps as F };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { Translations } from 'chrona-core';
|
|
3
|
+
|
|
4
|
+
interface ChronaConfig {
|
|
5
|
+
locale?: string;
|
|
6
|
+
timeZone?: string;
|
|
7
|
+
dir?: "ltr" | "rtl";
|
|
8
|
+
translations?: Partial<Translations>;
|
|
9
|
+
}
|
|
10
|
+
declare function ChronaProvider({ children, ...config }: ChronaConfig & {
|
|
11
|
+
children: React.ReactNode;
|
|
12
|
+
}): React.JSX.Element;
|
|
13
|
+
|
|
14
|
+
type PartProps = React.HTMLAttributes<HTMLElement> & {
|
|
15
|
+
asChild?: boolean;
|
|
16
|
+
};
|
|
17
|
+
|
|
18
|
+
type HiddenInputProps = Omit<React.ComponentPropsWithoutRef<"input">, "type" | "value" | "defaultValue" | "onChange">;
|
|
19
|
+
|
|
20
|
+
export { type ChronaConfig as C, type HiddenInputProps as H, type PartProps as P, ChronaProvider as a };
|
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { Calendar, CalendarProps, CalendarRoot, Weekday, useCalendar } from './calendar.js';
|
|
2
|
+
export { C as ChronaConfig, a as ChronaProvider } from './form-BCAGbNh-.js';
|
|
3
|
+
export { DateField, DateFieldProps, useDateField } from './date-field.js';
|
|
4
|
+
export { TimeField, TimeFieldProps, useTimeField } from './time-field.js';
|
|
5
|
+
export { DatePicker, DatePickerProps, useDatePicker } from './date-picker.js';
|
|
6
|
+
export { RangeCalendar, RangeCalendarProps, useRangeCalendar } from './range-calendar.js';
|
|
7
|
+
import 'temporal-spec';
|
|
8
|
+
import 'chrona-core';
|
|
9
|
+
import 'react';
|
|
10
|
+
import './field-CQjoX8QG.js';
|
package/dist/index.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DatePicker,
|
|
3
|
+
useDatePicker
|
|
4
|
+
} from "./chunk-5426MN2K.js";
|
|
5
|
+
import {
|
|
6
|
+
DateField,
|
|
7
|
+
useDateField
|
|
8
|
+
} from "./chunk-ZN4FZDUQ.js";
|
|
9
|
+
import {
|
|
10
|
+
RangeCalendar,
|
|
11
|
+
useRangeCalendar
|
|
12
|
+
} from "./chunk-XNVORQQ5.js";
|
|
13
|
+
import {
|
|
14
|
+
Calendar,
|
|
15
|
+
CalendarRoot,
|
|
16
|
+
useCalendar
|
|
17
|
+
} from "./chunk-EFN32TNK.js";
|
|
18
|
+
import {
|
|
19
|
+
TimeField,
|
|
20
|
+
useTimeField
|
|
21
|
+
} from "./chunk-6QRNDYNF.js";
|
|
22
|
+
import "./chunk-VSD2IX3U.js";
|
|
23
|
+
import {
|
|
24
|
+
ChronaProvider
|
|
25
|
+
} from "./chunk-GN2YCKFZ.js";
|
|
26
|
+
export {
|
|
27
|
+
Calendar,
|
|
28
|
+
CalendarRoot,
|
|
29
|
+
ChronaProvider,
|
|
30
|
+
DateField,
|
|
31
|
+
DatePicker,
|
|
32
|
+
RangeCalendar,
|
|
33
|
+
TimeField,
|
|
34
|
+
useCalendar,
|
|
35
|
+
useDateField,
|
|
36
|
+
useDatePicker,
|
|
37
|
+
useRangeCalendar,
|
|
38
|
+
useTimeField
|
|
39
|
+
};
|
|
40
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|
|
@@ -0,0 +1,194 @@
|
|
|
1
|
+
import { CalendarProps, Weekday } from './calendar.js';
|
|
2
|
+
import * as chrona_core from 'chrona-core';
|
|
3
|
+
import { DateRange, PlainDate, RangeEvent } from 'chrona-core';
|
|
4
|
+
import * as temporal_spec from 'temporal-spec';
|
|
5
|
+
import { P as PartProps, H as HiddenInputProps, C as ChronaConfig } from './form-BCAGbNh-.js';
|
|
6
|
+
import * as React from 'react';
|
|
7
|
+
|
|
8
|
+
interface RangeCalendarProps extends Omit<CalendarProps, "value" | "defaultValue" | "onChange"> {
|
|
9
|
+
value?: DateRange | null;
|
|
10
|
+
defaultValue?: DateRange | null;
|
|
11
|
+
onChange?: (value: DateRange | null) => void;
|
|
12
|
+
onRangeStartChange?: (value: PlainDate | null) => void;
|
|
13
|
+
onInvalid?: () => void;
|
|
14
|
+
}
|
|
15
|
+
declare function useRangeCalendar(input?: RangeCalendarProps): {
|
|
16
|
+
state: {
|
|
17
|
+
value: DateRange | null;
|
|
18
|
+
anchor: PlainDate | null;
|
|
19
|
+
preview: PlainDate | null;
|
|
20
|
+
invalid: boolean;
|
|
21
|
+
};
|
|
22
|
+
send: (event: RangeEvent) => void;
|
|
23
|
+
announcement: string;
|
|
24
|
+
props: RangeCalendarProps & ChronaConfig;
|
|
25
|
+
options: RangeCalendarProps & ChronaConfig;
|
|
26
|
+
api: {
|
|
27
|
+
getCellProps: (date: PlainDate, month?: PlainDate) => {
|
|
28
|
+
"data-scope": string;
|
|
29
|
+
"aria-selected": boolean;
|
|
30
|
+
"data-selected": string | undefined;
|
|
31
|
+
"data-in-range": string | undefined;
|
|
32
|
+
"data-range-start": string | undefined;
|
|
33
|
+
"data-range-end": string | undefined;
|
|
34
|
+
"data-preview": string | undefined;
|
|
35
|
+
"data-invalid": string | undefined;
|
|
36
|
+
id: string;
|
|
37
|
+
role: "gridcell";
|
|
38
|
+
tabIndex: number;
|
|
39
|
+
"aria-label": string;
|
|
40
|
+
"aria-disabled": true | undefined;
|
|
41
|
+
"aria-current": "date" | undefined;
|
|
42
|
+
"data-date": string;
|
|
43
|
+
"data-focused": string | undefined;
|
|
44
|
+
"data-disabled": string | undefined;
|
|
45
|
+
"data-unavailable": string | undefined;
|
|
46
|
+
"data-outside-month": string | undefined;
|
|
47
|
+
"data-today": string | undefined;
|
|
48
|
+
"data-part": string;
|
|
49
|
+
};
|
|
50
|
+
getRootProps: () => {
|
|
51
|
+
dir: "ltr" | "rtl" | undefined;
|
|
52
|
+
"data-disabled": string | undefined;
|
|
53
|
+
"data-readonly": string | undefined;
|
|
54
|
+
"data-scope": string;
|
|
55
|
+
"data-part": string;
|
|
56
|
+
};
|
|
57
|
+
getGridProps: (month?: temporal_spec.Temporal.PlainDate) => {
|
|
58
|
+
role: "grid";
|
|
59
|
+
"aria-label": string;
|
|
60
|
+
"aria-readonly": true | undefined;
|
|
61
|
+
"aria-disabled": true | undefined;
|
|
62
|
+
"data-scope": string;
|
|
63
|
+
"data-part": string;
|
|
64
|
+
};
|
|
65
|
+
getPrevButtonProps: () => {
|
|
66
|
+
type: "button";
|
|
67
|
+
"aria-label": string;
|
|
68
|
+
disabled: boolean;
|
|
69
|
+
"data-scope": string;
|
|
70
|
+
"data-part": string;
|
|
71
|
+
};
|
|
72
|
+
getNextButtonProps: () => {
|
|
73
|
+
type: "button";
|
|
74
|
+
"aria-label": string;
|
|
75
|
+
disabled: boolean;
|
|
76
|
+
"data-scope": string;
|
|
77
|
+
"data-part": string;
|
|
78
|
+
};
|
|
79
|
+
};
|
|
80
|
+
rootRef: React.RefObject<HTMLElement | null>;
|
|
81
|
+
months: temporal_spec.Temporal.PlainDate[];
|
|
82
|
+
reset(): void;
|
|
83
|
+
calendar: {
|
|
84
|
+
api: {
|
|
85
|
+
getCellProps: (date: PlainDate, month?: PlainDate) => {
|
|
86
|
+
"data-scope": string;
|
|
87
|
+
"aria-selected": boolean;
|
|
88
|
+
"data-selected": string | undefined;
|
|
89
|
+
"data-in-range": string | undefined;
|
|
90
|
+
"data-range-start": string | undefined;
|
|
91
|
+
"data-range-end": string | undefined;
|
|
92
|
+
"data-preview": string | undefined;
|
|
93
|
+
"data-invalid": string | undefined;
|
|
94
|
+
id: string;
|
|
95
|
+
role: "gridcell";
|
|
96
|
+
tabIndex: number;
|
|
97
|
+
"aria-label": string;
|
|
98
|
+
"aria-disabled": true | undefined;
|
|
99
|
+
"aria-current": "date" | undefined;
|
|
100
|
+
"data-date": string;
|
|
101
|
+
"data-focused": string | undefined;
|
|
102
|
+
"data-disabled": string | undefined;
|
|
103
|
+
"data-unavailable": string | undefined;
|
|
104
|
+
"data-outside-month": string | undefined;
|
|
105
|
+
"data-today": string | undefined;
|
|
106
|
+
"data-part": string;
|
|
107
|
+
};
|
|
108
|
+
getRootProps: () => {
|
|
109
|
+
dir: "ltr" | "rtl" | undefined;
|
|
110
|
+
"data-disabled": string | undefined;
|
|
111
|
+
"data-readonly": string | undefined;
|
|
112
|
+
"data-scope": string;
|
|
113
|
+
"data-part": string;
|
|
114
|
+
};
|
|
115
|
+
getGridProps: (month?: temporal_spec.Temporal.PlainDate) => {
|
|
116
|
+
role: "grid";
|
|
117
|
+
"aria-label": string;
|
|
118
|
+
"aria-readonly": true | undefined;
|
|
119
|
+
"aria-disabled": true | undefined;
|
|
120
|
+
"data-scope": string;
|
|
121
|
+
"data-part": string;
|
|
122
|
+
};
|
|
123
|
+
getPrevButtonProps: () => {
|
|
124
|
+
type: "button";
|
|
125
|
+
"aria-label": string;
|
|
126
|
+
disabled: boolean;
|
|
127
|
+
"data-scope": string;
|
|
128
|
+
"data-part": string;
|
|
129
|
+
};
|
|
130
|
+
getNextButtonProps: () => {
|
|
131
|
+
type: "button";
|
|
132
|
+
"aria-label": string;
|
|
133
|
+
disabled: boolean;
|
|
134
|
+
"data-scope": string;
|
|
135
|
+
"data-part": string;
|
|
136
|
+
};
|
|
137
|
+
};
|
|
138
|
+
state: chrona_core.CalendarState;
|
|
139
|
+
options: CalendarProps & ChronaConfig;
|
|
140
|
+
send: (event: chrona_core.CalendarEvent) => void;
|
|
141
|
+
rootRef: React.RefObject<HTMLElement | null>;
|
|
142
|
+
announcement: string;
|
|
143
|
+
months: temporal_spec.Temporal.PlainDate[];
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
declare function Root({ children, asChild, className, style, ...props }: RangeCalendarProps & Pick<PartProps, "children" | "asChild" | "className" | "style">): React.JSX.Element;
|
|
147
|
+
declare function HiddenInput({ name, form, id, disabled, ...inputProps }: HiddenInputProps & {
|
|
148
|
+
name: string;
|
|
149
|
+
}): React.JSX.Element;
|
|
150
|
+
declare const RangeCalendar: {
|
|
151
|
+
Root: typeof Root;
|
|
152
|
+
Cell: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
153
|
+
asChild?: boolean;
|
|
154
|
+
} & {
|
|
155
|
+
date: PlainDate;
|
|
156
|
+
} & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
157
|
+
GridBody: React.ForwardRefExoticComponent<Omit<Omit<PartProps, "children"> & {
|
|
158
|
+
children?: (date: PlainDate) => React.ReactNode;
|
|
159
|
+
} & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
160
|
+
LiveRegion: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
161
|
+
asChild?: boolean;
|
|
162
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
163
|
+
ClearButton: React.ForwardRefExoticComponent<Omit<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
164
|
+
asChild?: boolean;
|
|
165
|
+
} & React.RefAttributes<HTMLElement>, "ref"> & React.RefAttributes<HTMLElement>>;
|
|
166
|
+
HiddenInput: typeof HiddenInput;
|
|
167
|
+
Header: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
168
|
+
asChild?: boolean;
|
|
169
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
170
|
+
Heading: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
171
|
+
asChild?: boolean;
|
|
172
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
173
|
+
PrevButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
174
|
+
asChild?: boolean;
|
|
175
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
176
|
+
NextButton: React.ForwardRefExoticComponent<Omit<React.DetailedHTMLProps<React.ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, "ref"> & {
|
|
177
|
+
asChild?: boolean;
|
|
178
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
179
|
+
Grid: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
180
|
+
asChild?: boolean;
|
|
181
|
+
} & {
|
|
182
|
+
monthIndex?: number;
|
|
183
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
184
|
+
GridHeader: React.ForwardRefExoticComponent<Omit<PartProps, "children"> & {
|
|
185
|
+
children?: (day: Weekday) => React.ReactNode;
|
|
186
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
187
|
+
HeaderCell: React.ForwardRefExoticComponent<React.HTMLAttributes<HTMLElement> & {
|
|
188
|
+
asChild?: boolean;
|
|
189
|
+
} & {
|
|
190
|
+
day: Weekday;
|
|
191
|
+
} & React.RefAttributes<HTMLElement>>;
|
|
192
|
+
};
|
|
193
|
+
|
|
194
|
+
export { RangeCalendar, type RangeCalendarProps, useRangeCalendar };
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|