@mitcsutt/kiln-ui 0.6.0 → 0.8.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/dist/components/actions/CopyButton/CopyButton.d.ts +58 -0
- package/dist/components/actions/CopyButton/CopyButton.js +63 -0
- package/dist/components/actions/CopyButton/CopyButton.js.map +1 -0
- package/dist/components/actions/CopyButton/CopyButton.module.js +9 -0
- package/dist/components/actions/CopyButton/CopyButton.module.js.map +1 -0
- package/dist/components/actions/CopyButton/index.d.ts +4 -0
- package/dist/components/actions/CopyButton/useClipboard.d.ts +35 -0
- package/dist/components/actions/CopyButton/useClipboard.js +62 -0
- package/dist/components/actions/CopyButton/useClipboard.js.map +1 -0
- package/dist/components/actions/ToggleChip/ToggleChip.d.ts +6 -0
- package/dist/components/actions/ToggleChip/ToggleChip.js +26 -24
- package/dist/components/actions/ToggleChip/ToggleChip.js.map +1 -1
- package/dist/components/display/Badge/Badge.d.ts +6 -0
- package/dist/components/display/Badge/Badge.js +16 -15
- package/dist/components/display/Badge/Badge.js.map +1 -1
- package/dist/components/display/CodeBlock/CodeBlock.js +45 -58
- package/dist/components/display/CodeBlock/CodeBlock.js.map +1 -1
- package/dist/components/display/Swatch/Swatch.d.ts +52 -0
- package/dist/components/display/Swatch/Swatch.js +27 -0
- package/dist/components/display/Swatch/Swatch.js.map +1 -0
- package/dist/components/display/Swatch/Swatch.module.js +6 -0
- package/dist/components/display/Swatch/Swatch.module.js.map +1 -0
- package/dist/components/display/Swatch/index.d.ts +2 -0
- package/dist/components/display/Tag/Tag.d.ts +7 -0
- package/dist/components/display/Tag/Tag.js +31 -26
- package/dist/components/display/Tag/Tag.js.map +1 -1
- package/dist/components/display/TreeTable/TreeTable.d.ts +69 -0
- package/dist/components/display/TreeTable/TreeTable.js +152 -0
- package/dist/components/display/TreeTable/TreeTable.js.map +1 -0
- package/dist/components/display/TreeTable/TreeTable.module.js +12 -0
- package/dist/components/display/TreeTable/TreeTable.module.js.map +1 -0
- package/dist/components/display/TreeTable/index.d.ts +2 -0
- package/dist/components/feedback/Indicator/Indicator.d.ts +74 -0
- package/dist/components/feedback/Indicator/Indicator.js +50 -0
- package/dist/components/feedback/Indicator/Indicator.js.map +1 -0
- package/dist/components/feedback/Indicator/Indicator.module.js +12 -0
- package/dist/components/feedback/Indicator/Indicator.module.js.map +1 -0
- package/dist/components/feedback/Indicator/index.d.ts +2 -0
- package/dist/components/feedback/Toaster/Toaster.d.ts +71 -0
- package/dist/components/feedback/Toaster/Toaster.js +121 -0
- package/dist/components/feedback/Toaster/Toaster.js.map +1 -0
- package/dist/components/feedback/Toaster/Toaster.module.js +20 -0
- package/dist/components/feedback/Toaster/Toaster.module.js.map +1 -0
- package/dist/components/feedback/Toaster/index.d.ts +4 -0
- package/dist/components/feedback/Toaster/toast.d.ts +96 -0
- package/dist/components/feedback/Toaster/toast.js +131 -0
- package/dist/components/feedback/Toaster/toast.js.map +1 -0
- package/dist/components/inputs/Calendar/Calendar.d.ts +87 -0
- package/dist/components/inputs/Calendar/Calendar.js +217 -0
- package/dist/components/inputs/Calendar/Calendar.js.map +1 -0
- package/dist/components/inputs/Calendar/Calendar.module.js +18 -0
- package/dist/components/inputs/Calendar/Calendar.module.js.map +1 -0
- package/dist/components/inputs/Calendar/index.d.ts +2 -0
- package/dist/components/inputs/Combobox/Combobox.js +36 -44
- package/dist/components/inputs/Combobox/Combobox.js.map +1 -1
- package/dist/components/inputs/DateField/DateField.d.ts +17 -0
- package/dist/components/inputs/DateField/DateField.js +26 -0
- package/dist/components/inputs/DateField/DateField.js.map +1 -0
- package/dist/components/inputs/DateField/index.d.ts +2 -0
- package/dist/components/inputs/DateInput/DateInput.d.ts +75 -0
- package/dist/components/inputs/DateInput/DateInput.js +139 -0
- package/dist/components/inputs/DateInput/DateInput.js.map +1 -0
- package/dist/components/inputs/DateInput/index.d.ts +3 -0
- package/dist/components/inputs/DateRangeField/DateRangeField.d.ts +18 -3
- package/dist/components/inputs/DateRangeField/DateRangeField.js.map +1 -1
- package/dist/components/inputs/DateRangeField/DateRangeField.module.js +8 -3
- package/dist/components/inputs/DateRangeField/DateRangeField.module.js.map +1 -1
- package/dist/components/inputs/DateRangeField/DateRangePickerField.d.ts +48 -0
- package/dist/components/inputs/DateRangeField/DateRangePickerField.js +246 -0
- package/dist/components/inputs/DateRangeField/DateRangePickerField.js.map +1 -0
- package/dist/components/inputs/DateRangeField/index.d.ts +2 -0
- package/dist/components/inputs/DateTimeField/DateTimeField.d.ts +17 -0
- package/dist/components/inputs/DateTimeField/DateTimeField.js +26 -0
- package/dist/components/inputs/DateTimeField/DateTimeField.js.map +1 -0
- package/dist/components/inputs/DateTimeField/index.d.ts +2 -0
- package/dist/components/inputs/DateTimeInput/DateTimeInput.d.ts +83 -0
- package/dist/components/inputs/DateTimeInput/DateTimeInput.js +216 -0
- package/dist/components/inputs/DateTimeInput/DateTimeInput.js.map +1 -0
- package/dist/components/inputs/DateTimeInput/index.d.ts +2 -0
- package/dist/components/inputs/JsonField/JsonField.d.ts +23 -0
- package/dist/components/inputs/JsonField/JsonField.js +33 -0
- package/dist/components/inputs/JsonField/JsonField.js.map +1 -0
- package/dist/components/inputs/JsonField/index.d.ts +2 -0
- package/dist/components/inputs/JsonInput/JsonInput.d.ts +119 -0
- package/dist/components/inputs/JsonInput/JsonInput.js +282 -0
- package/dist/components/inputs/JsonInput/JsonInput.js.map +1 -0
- package/dist/components/inputs/JsonInput/JsonInput.module.js +16 -0
- package/dist/components/inputs/JsonInput/JsonInput.module.js.map +1 -0
- package/dist/components/inputs/JsonInput/index.d.ts +4 -0
- package/dist/components/inputs/JsonInput/json.d.ts +59 -0
- package/dist/components/inputs/JsonInput/json.js +231 -0
- package/dist/components/inputs/JsonInput/json.js.map +1 -0
- package/dist/components/inputs/TagsInput/TagsInput.js +5 -5
- package/dist/components/inputs/TimeField/TimeField.d.ts +17 -0
- package/dist/components/inputs/TimeField/TimeField.js +26 -0
- package/dist/components/inputs/TimeField/TimeField.js.map +1 -0
- package/dist/components/inputs/TimeField/index.d.ts +2 -0
- package/dist/components/inputs/TimeInput/TimeInput.d.ts +54 -0
- package/dist/components/inputs/TimeInput/TimeInput.js +107 -0
- package/dist/components/inputs/TimeInput/TimeInput.js.map +1 -0
- package/dist/components/inputs/TimeInput/index.d.ts +2 -0
- package/dist/components/inputs/internal/DateSegments.d.ts +80 -0
- package/dist/components/inputs/internal/DateSegments.js +345 -0
- package/dist/components/inputs/internal/DateSegments.js.map +1 -0
- package/dist/components/inputs/internal/dates.d.ts +101 -0
- package/dist/components/inputs/internal/dates.js +262 -0
- package/dist/components/inputs/internal/dates.js.map +1 -0
- package/dist/components/inputs/internal/filterOptions.d.ts +22 -1
- package/dist/components/inputs/internal/filterOptions.js +32 -1
- package/dist/components/inputs/internal/filterOptions.js.map +1 -1
- package/dist/components/inputs/internal/picker.d.ts +31 -0
- package/dist/components/inputs/internal/picker.js +29 -0
- package/dist/components/inputs/internal/picker.js.map +1 -0
- package/dist/components/inputs/internal/picker.module.js +15 -0
- package/dist/components/inputs/internal/picker.module.js.map +1 -0
- package/dist/components/inputs/internal/segments.module.js +10 -0
- package/dist/components/inputs/internal/segments.module.js.map +1 -0
- package/dist/components/layout/Collapse/Collapse.d.ts +39 -0
- package/dist/components/layout/Collapse/Collapse.js +24 -0
- package/dist/components/layout/Collapse/Collapse.js.map +1 -0
- package/dist/components/layout/Collapse/Collapse.module.js +6 -0
- package/dist/components/layout/Collapse/Collapse.module.js.map +1 -0
- package/dist/components/layout/Collapse/index.d.ts +2 -0
- package/dist/components/layout/Collapse/useHeightMotion.d.ts +16 -0
- package/dist/components/layout/Collapse/useHeightMotion.js +60 -0
- package/dist/components/layout/Collapse/useHeightMotion.js.map +1 -0
- package/dist/components/layout/ShowMore/ShowMore.d.ts +59 -0
- package/dist/components/layout/ShowMore/ShowMore.js +114 -0
- package/dist/components/layout/ShowMore/ShowMore.js.map +1 -0
- package/dist/components/layout/ShowMore/ShowMore.module.js +12 -0
- package/dist/components/layout/ShowMore/ShowMore.module.js.map +1 -0
- package/dist/components/layout/ShowMore/index.d.ts +2 -0
- package/dist/components/layout/Transition/Transition.d.ts +63 -0
- package/dist/components/layout/Transition/Transition.js +63 -0
- package/dist/components/layout/Transition/Transition.js.map +1 -0
- package/dist/components/layout/Transition/Transition.module.js +17 -0
- package/dist/components/layout/Transition/Transition.module.js.map +1 -0
- package/dist/components/layout/Transition/index.d.ts +2 -0
- package/dist/components/navigation/Collapsible/Collapsible.d.ts +49 -0
- package/dist/components/navigation/Collapsible/Collapsible.js +83 -0
- package/dist/components/navigation/Collapsible/Collapsible.js.map +1 -0
- package/dist/components/navigation/Collapsible/Collapsible.module.js +11 -0
- package/dist/components/navigation/Collapsible/Collapsible.module.js.map +1 -0
- package/dist/components/navigation/Collapsible/index.d.ts +2 -0
- package/dist/components/navigation/NavLinks/NavLinks.d.ts +32 -4
- package/dist/components/navigation/NavLinks/NavLinks.js +69 -39
- package/dist/components/navigation/NavLinks/NavLinks.js.map +1 -1
- package/dist/components/navigation/NavLinks/NavLinks.module.js +13 -3
- package/dist/components/navigation/NavLinks/NavLinks.module.js.map +1 -1
- package/dist/components/navigation/NavLinks/NavLinksGroup.d.ts +49 -0
- package/dist/components/navigation/NavLinks/NavLinksGroup.js +185 -0
- package/dist/components/navigation/NavLinks/NavLinksGroup.js.map +1 -0
- package/dist/components/navigation/NavLinks/context.d.ts +28 -0
- package/dist/components/navigation/NavLinks/context.js +13 -0
- package/dist/components/navigation/NavLinks/context.js.map +1 -0
- package/dist/components/navigation/NavLinks/index.d.ts +2 -0
- package/dist/components/navigation/NavLinks/treeKeys.d.ts +8 -0
- package/dist/components/navigation/NavLinks/treeKeys.js +57 -0
- package/dist/components/navigation/NavLinks/treeKeys.js.map +1 -0
- package/dist/components/overlays/CommandPalette/CommandPalette.d.ts +120 -0
- package/dist/components/overlays/CommandPalette/CommandPalette.js +386 -0
- package/dist/components/overlays/CommandPalette/CommandPalette.js.map +1 -0
- package/dist/components/overlays/CommandPalette/CommandPalette.module.js +31 -0
- package/dist/components/overlays/CommandPalette/CommandPalette.module.js.map +1 -0
- package/dist/components/overlays/CommandPalette/index.d.ts +2 -0
- package/dist/components/overlays/CommandPalette/shortcut.d.ts +28 -0
- package/dist/components/overlays/CommandPalette/shortcut.js +104 -0
- package/dist/components/overlays/CommandPalette/shortcut.js.map +1 -0
- package/dist/index.d.ts +42 -4
- package/dist/index.js +124 -100
- package/dist/styles.css +1 -1
- package/dist/themes/fiesta.css +1 -1
- package/dist/themes/flightdeck.css +1 -1
- package/dist/themes/ledger.css +1 -1
- package/dist/themes/monograph.css +1 -1
- package/dist/themes/riso.css +1 -1
- package/package.json +2 -1
- package/skills/custom-theme/SKILL.md +32 -0
- package/skills/custom-theme/references/colour.md +20 -0
- package/skills/custom-theme/references/motion.md +9 -0
- package/skills/custom-theme/references/tokens.md +35 -0
- package/skills/design-rules/SKILL.md +5 -2
- package/skills/setup-and-theming/SKILL.md +1 -1
- package/skills/setup-and-theming/references/paper.md +1 -1
|
@@ -0,0 +1,139 @@
|
|
|
1
|
+
import { cx as e } from "../../../utils/cx.js";
|
|
2
|
+
import { CalendarIcon as t, CloseIcon as n } from "../../../icons/icons.js";
|
|
3
|
+
import { useMergedRefs as r } from "../internal/refs.js";
|
|
4
|
+
import { markFieldAware as i, useResolvedField as a } from "../internal/FieldContext.js";
|
|
5
|
+
import o from "../internal/control.module.js";
|
|
6
|
+
import { Popover as s } from "../../overlays/Popover/Popover.js";
|
|
7
|
+
import { DEFAULT_LOCALE as ee, compareDates as c, formatDate as l, parseDate as u, todayIn as te } from "../internal/dates.js";
|
|
8
|
+
import { Calendar as ne } from "../Calendar/Calendar.js";
|
|
9
|
+
import { useControllableState as d } from "../Combobox/useControllableState.js";
|
|
10
|
+
import { DateSegments as re, draftDate as f, draftFromParts as p, segmentPattern as ie, useSegmentDraft as ae } from "../internal/DateSegments.js";
|
|
11
|
+
import { DEFAULT_DATE_TIME_LABELS as oe, focusSegment as se, handleBoxPointerDown as ce, isLeaving as m } from "../internal/picker.js";
|
|
12
|
+
import h from "../internal/picker.module.js";
|
|
13
|
+
import { forwardRef as g, useMemo as le, useRef as _ } from "react";
|
|
14
|
+
import { jsx as v, jsxs as y } from "react/jsx-runtime";
|
|
15
|
+
//#region src/components/inputs/DateInput/DateInput.tsx
|
|
16
|
+
var ue = (e) => p(u(e)), de = (e) => {
|
|
17
|
+
let t = f(e);
|
|
18
|
+
return t ? l(t) : "";
|
|
19
|
+
};
|
|
20
|
+
function b(e, t, n, r) {
|
|
21
|
+
let i = u(e);
|
|
22
|
+
if (!i) return !1;
|
|
23
|
+
let a = u(t ?? ""), o = u(n ?? "");
|
|
24
|
+
return a !== null && c(i, a) < 0 || o !== null && c(i, o) > 0 || (r?.(e) ?? !1);
|
|
25
|
+
}
|
|
26
|
+
var x = i(g(function({ value: i, defaultValue: c, onValueChange: l, min: f, max: g, isDateDisabled: x, firstDayOfWeek: fe, locale: S = ee, timeZone: C, calendar: w = !0, clearable: T = !1, name: E, form: pe, size: me = "md", id: D, disabled: O, readOnly: k, required: A, invalid: j, open: M, defaultOpen: N, onOpenChange: P, onBlur: F, onFocus: I, onKeyDown: L, labels: R, className: z, "aria-describedby": he, "aria-invalid": B, "aria-labelledby": ge, ..._e }, ve) {
|
|
27
|
+
let V = {
|
|
28
|
+
...oe,
|
|
29
|
+
...R
|
|
30
|
+
}, H = a({
|
|
31
|
+
id: D,
|
|
32
|
+
describedBy: he,
|
|
33
|
+
invalid: j,
|
|
34
|
+
ariaInvalid: B,
|
|
35
|
+
disabled: O,
|
|
36
|
+
readOnly: k,
|
|
37
|
+
required: A
|
|
38
|
+
}), U = _(null), W = _(null), ye = r(ve, U), [G, K] = d(i, c ?? "", l), [be, q] = d(M, N ?? !1, P), xe = le(() => ie("date", S, "minute", 24), [S]), [J, Y] = ae(G, ue, de, K), X = !H.disabled && !H.readOnly, Z = H.invalid || b(G, f, g, x), Q = Object.keys(J).length > 0, Se = p(te(C)), Ce = (e) => {
|
|
39
|
+
L?.(e), !e.defaultPrevented && w && X && e.altKey && e.key === "ArrowDown" && (e.preventDefault(), q(!0));
|
|
40
|
+
}, $ = /* @__PURE__ */ y("div", {
|
|
41
|
+
ref: ye,
|
|
42
|
+
role: "group",
|
|
43
|
+
className: e(o.box, h.root, z),
|
|
44
|
+
"data-size": me,
|
|
45
|
+
"data-invalid": Z || void 0,
|
|
46
|
+
"data-disabled": H.disabled || void 0,
|
|
47
|
+
"data-readonly": H.readOnly || void 0,
|
|
48
|
+
"aria-labelledby": ge ?? H.labelId,
|
|
49
|
+
"aria-describedby": H.describedBy,
|
|
50
|
+
"aria-busy": H.busy || void 0,
|
|
51
|
+
..._e,
|
|
52
|
+
onPointerDown: ce,
|
|
53
|
+
onKeyDown: Ce,
|
|
54
|
+
onFocus: (e) => {
|
|
55
|
+
m(e, U, W) && I?.(e);
|
|
56
|
+
},
|
|
57
|
+
onBlur: (e) => {
|
|
58
|
+
m(e, U, W) && F?.(e);
|
|
59
|
+
},
|
|
60
|
+
children: [
|
|
61
|
+
/* @__PURE__ */ v(re, {
|
|
62
|
+
pattern: xe,
|
|
63
|
+
draft: J,
|
|
64
|
+
onDraftChange: Y,
|
|
65
|
+
hourCycle: 24,
|
|
66
|
+
periodNames: ["", ""],
|
|
67
|
+
labels: V,
|
|
68
|
+
reference: Se,
|
|
69
|
+
firstId: H.id,
|
|
70
|
+
disabled: H.disabled,
|
|
71
|
+
readOnly: H.readOnly,
|
|
72
|
+
invalid: Z,
|
|
73
|
+
required: H.required
|
|
74
|
+
}),
|
|
75
|
+
T && X && Q || w ? /* @__PURE__ */ y("span", {
|
|
76
|
+
className: h.trailing,
|
|
77
|
+
children: [T && X && Q ? /* @__PURE__ */ v("button", {
|
|
78
|
+
type: "button",
|
|
79
|
+
className: h.button,
|
|
80
|
+
"aria-label": V.clear,
|
|
81
|
+
onClick: () => {
|
|
82
|
+
Y({}), se(U.current, "first");
|
|
83
|
+
},
|
|
84
|
+
children: /* @__PURE__ */ v(n, {})
|
|
85
|
+
}) : null, w ? /* @__PURE__ */ v(s.Trigger, {
|
|
86
|
+
asChild: !0,
|
|
87
|
+
children: /* @__PURE__ */ v("button", {
|
|
88
|
+
type: "button",
|
|
89
|
+
className: h.button,
|
|
90
|
+
"aria-label": V.openCalendar,
|
|
91
|
+
disabled: !X,
|
|
92
|
+
children: /* @__PURE__ */ v(t, {})
|
|
93
|
+
})
|
|
94
|
+
}) : null]
|
|
95
|
+
}) : null,
|
|
96
|
+
E === void 0 ? null : /* @__PURE__ */ v("input", {
|
|
97
|
+
type: "hidden",
|
|
98
|
+
name: E,
|
|
99
|
+
form: pe,
|
|
100
|
+
value: G,
|
|
101
|
+
disabled: H.disabled || void 0
|
|
102
|
+
})
|
|
103
|
+
]
|
|
104
|
+
});
|
|
105
|
+
return w ? /* @__PURE__ */ y(s, {
|
|
106
|
+
open: be && X,
|
|
107
|
+
onOpenChange: q,
|
|
108
|
+
children: [/* @__PURE__ */ v(s.Anchor, {
|
|
109
|
+
asChild: !0,
|
|
110
|
+
children: $
|
|
111
|
+
}), /* @__PURE__ */ v(s.Content, {
|
|
112
|
+
ref: W,
|
|
113
|
+
className: h.popover,
|
|
114
|
+
align: "start",
|
|
115
|
+
"aria-label": V.openCalendar,
|
|
116
|
+
onOpenAutoFocus: (e) => {
|
|
117
|
+
e.preventDefault();
|
|
118
|
+
},
|
|
119
|
+
children: /* @__PURE__ */ v(ne, {
|
|
120
|
+
autoFocus: !0,
|
|
121
|
+
value: u(G) ? G : "",
|
|
122
|
+
min: f,
|
|
123
|
+
max: g,
|
|
124
|
+
isDateDisabled: x,
|
|
125
|
+
firstDayOfWeek: fe,
|
|
126
|
+
locale: S,
|
|
127
|
+
timeZone: C,
|
|
128
|
+
labels: V,
|
|
129
|
+
onValueChange: (e) => {
|
|
130
|
+
K(e), q(!1);
|
|
131
|
+
}
|
|
132
|
+
})
|
|
133
|
+
})]
|
|
134
|
+
}) : $;
|
|
135
|
+
}));
|
|
136
|
+
//#endregion
|
|
137
|
+
export { x as DateInput, b as isDateOutOfRange };
|
|
138
|
+
|
|
139
|
+
//# sourceMappingURL=DateInput.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateInput.js","names":["control","picker","control_module_default","picker_module_default","toDraft","draftFromParts","parseDate","value","fromDraft","date","draftDate","draft","formatDate","isDateOutOfRange","minDate","min","maxDate","max","compareDates","isDateDisabled","DateInput","markFieldAware","forwardRef","valueProp","DEFAULT_LOCALE","idProp","disabledProp","readOnlyProp","requiredProp","invalidProp","openProp","labelsProp","describedByProp","ariaInvalid","ariaLabelledBy","rest","labels","DEFAULT_DATE_TIME_LABELS","field","useResolvedField","rootRef","useRef","panelRef","composedRef","useMergedRefs","ref","setValue","useControllableState","defaultValue","onValueChange","open","setOpen","defaultOpen","onOpenChange","pattern","useMemo","segmentPattern","locale","setDraft","useSegmentDraft","interactive","invalid","hasEntry","reference","todayIn","timeZone","handleKeyDown","onKeyDown","event","calendar","box","cx","className","size","handleBoxPointerDown","isLeaving","onFocus","onBlur","DateSegments","clearable","focusSegment","CloseIcon","Popover","CalendarIcon","name","Calendar","next"],"sources":["../../../../src/components/inputs/DateInput/DateInput.tsx"],"sourcesContent":["import {\n forwardRef,\n useMemo,\n useRef,\n type FocusEventHandler,\n type HTMLAttributes,\n type KeyboardEvent,\n} from 'react'\nimport { CalendarIcon, CloseIcon } from '#icons'\nimport { cx } from '#utils/cx'\nimport type { Size } from '#utils/tokens'\nimport { Popover } from '#components/overlays/Popover'\nimport { Calendar } from '#components/inputs/Calendar'\nimport { useControllableState } from '#components/inputs/Combobox/useControllableState'\nimport { markFieldAware, useResolvedField } from '#components/inputs/internal/FieldContext'\nimport { useMergedRefs } from '#components/inputs/internal/refs'\nimport {\n DateSegments,\n draftDate,\n draftFromParts,\n segmentPattern,\n useSegmentDraft,\n type Draft,\n} from '#components/inputs/internal/DateSegments'\nimport {\n DEFAULT_LOCALE,\n compareDates,\n formatDate,\n parseDate,\n todayIn,\n} from '#components/inputs/internal/dates'\nimport {\n DEFAULT_DATE_TIME_LABELS,\n focusSegment,\n handleBoxPointerDown,\n isLeaving,\n type DateTimeLabels,\n} from '#components/inputs/internal/picker'\nimport control from '#components/inputs/internal/control.module.css'\nimport picker from '#components/inputs/internal/picker.module.css'\n\nexport interface DateInputProps extends Omit<\n HTMLAttributes<HTMLDivElement>,\n 'onChange' | 'defaultValue' | 'onBlur' | 'onFocus'\n> {\n /** `YYYY-MM-DD`, or `''` until every part is filled in. */\n value?: string\n defaultValue?: string\n onValueChange?: (value: string) => void\n /** Earliest date (`YYYY-MM-DD`). Earlier dates can't be picked and mark a typed one invalid. */\n min?: string\n /** Latest date (`YYYY-MM-DD`). */\n max?: string\n /** Marks other dates unavailable, in the calendar and when typed. */\n isDateDisabled?: (date: string) => boolean\n /** 0 (Sunday) to 6 (Saturday). Defaults to the locale's own week. */\n firstDayOfWeek?: number\n /** BCP 47 locale for the order of the parts and the calendar's names. Default `en-AU`. */\n locale?: string\n /** The zone \"today\" is read in: the calendar's marker and where arrow keys start. */\n timeZone?: string\n /** Show the calendar button. Default `true`. Typing always works. */\n calendar?: boolean\n /** Show a clear button while there's a value. */\n clearable?: boolean\n /** Submits the ISO date (`''` when incomplete). */\n name?: string\n form?: string\n size?: Size\n disabled?: boolean\n readOnly?: boolean\n required?: boolean\n /** Critical border + `aria-invalid`. Inside a `<Field error>` this is set for you. */\n invalid?: boolean\n /** Whether the calendar is open. Controlled. */\n open?: boolean\n defaultOpen?: boolean\n onOpenChange?: (open: boolean) => void\n /** Fires once focus leaves the whole control, calendar included. */\n onBlur?: FocusEventHandler<HTMLElement>\n onFocus?: FocusEventHandler<HTMLElement>\n labels?: Partial<DateTimeLabels>\n}\n\nconst toDraft = (value: string): Draft => draftFromParts(parseDate(value))\nconst fromDraft = (draft: Draft): string => {\n const date = draftDate(draft)\n return date ? formatDate(date) : ''\n}\n\n/** Whether `value` is a date outside `min`/`max` or one `isDateDisabled` rules out. */\nexport function isDateOutOfRange(\n value: string,\n min: string | undefined,\n max: string | undefined,\n isDateDisabled?: (date: string) => boolean,\n): boolean {\n const date = parseDate(value)\n if (!date) return false\n const minDate = parseDate(min ?? '')\n const maxDate = parseDate(max ?? '')\n return (\n (minDate !== null && compareDates(date, minDate) < 0) ||\n (maxDate !== null && compareDates(date, maxDate) > 0) ||\n (isDateDisabled?.(value) ?? false)\n )\n}\n\n/**\n * A date typed part by part in the locale's order, with a calendar to pick from.\n *\n * @remarks\n * `DateInput` holds a date as an ISO string (`2026-10-15`). The day, month and year are separate\n * parts in the locale's order: type the digits and it moves to the next part on its own, or use\n * the arrow keys to step a part up and down. The calendar button opens a {@link Calendar | Calendar}\n * for anyone who'd rather pick, and Alt + Down Arrow opens it from the keyboard. Until every part\n * is filled in the value stays `''`.\n *\n * A date outside `min`/`max`, or one `isDateDisabled` rules out, can't be picked in the calendar\n * and marks a typed one invalid. For the usual labelled field, use {@link DateField | DateField}.\n *\n * ## Keyboard\n *\n * | Key | Does |\n * | --- | --- |\n * | Digits | Fill the focused part, moving on when it's full |\n * | Up / Down Arrow | Step the focused part (an empty part starts from today) |\n * | Left / Right Arrow | Move between parts |\n * | Backspace | Clear the focused part |\n * | Alt + Down Arrow | Open the calendar |\n *\n * @privateRemarks\n * Each part is a `role=\"spinbutton\"` inside a `role=\"group\"` box named by the Field label; the\n * first part takes the Field's `id`. The ref goes to the box. Value ↔ draft lives in\n * `useSegmentDraft`: a new value from outside (controlled, or a calendar pick) resets the parts.\n *\n * <DateInput value={due} onValueChange={setDue} min=\"2026-10-01\" clearable />\n */\nexport const DateInput = markFieldAware(\n forwardRef<HTMLDivElement, DateInputProps>(function DateInput(\n {\n value: valueProp,\n defaultValue,\n onValueChange,\n min,\n max,\n isDateDisabled,\n firstDayOfWeek,\n locale = DEFAULT_LOCALE,\n timeZone,\n calendar = true,\n clearable = false,\n name,\n form,\n size = 'md',\n id: idProp,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n required: requiredProp,\n invalid: invalidProp,\n open: openProp,\n defaultOpen,\n onOpenChange,\n onBlur,\n onFocus,\n onKeyDown,\n labels: labelsProp,\n className,\n 'aria-describedby': describedByProp,\n 'aria-invalid': ariaInvalid,\n 'aria-labelledby': ariaLabelledBy,\n ...rest\n },\n ref,\n ) {\n const labels = { ...DEFAULT_DATE_TIME_LABELS, ...labelsProp }\n const field = useResolvedField({\n id: idProp,\n describedBy: describedByProp,\n invalid: invalidProp,\n ariaInvalid,\n disabled: disabledProp,\n readOnly: readOnlyProp,\n required: requiredProp,\n })\n const rootRef = useRef<HTMLDivElement>(null)\n const panelRef = useRef<HTMLDivElement>(null)\n const composedRef = useMergedRefs(ref, rootRef)\n const [value, setValue] = useControllableState(valueProp, defaultValue ?? '', onValueChange)\n const [open, setOpen] = useControllableState(openProp, defaultOpen ?? false, onOpenChange)\n const pattern = useMemo(() => segmentPattern('date', locale, 'minute', 24), [locale])\n const [draft, setDraft] = useSegmentDraft(value, toDraft, fromDraft, setValue)\n const interactive = !field.disabled && !field.readOnly\n const invalid = field.invalid || isDateOutOfRange(value, min, max, isDateDisabled)\n const hasEntry = Object.keys(draft).length > 0\n const reference = draftFromParts(todayIn(timeZone))\n\n const handleKeyDown = (event: KeyboardEvent<HTMLDivElement>) => {\n onKeyDown?.(event)\n if (event.defaultPrevented) return\n if (calendar && interactive && event.altKey && event.key === 'ArrowDown') {\n event.preventDefault()\n setOpen(true)\n }\n }\n\n const box = (\n // The group only routes what its parts don't handle: a click on its padding, and\n // Alt + Down Arrow from any part to open the calendar.\n // eslint-disable-next-line jsx-a11y/no-noninteractive-element-interactions\n <div\n ref={composedRef}\n role=\"group\"\n className={cx(control.box, picker.root, className)}\n data-size={size}\n data-invalid={invalid || undefined}\n data-disabled={field.disabled || undefined}\n data-readonly={field.readOnly || undefined}\n aria-labelledby={ariaLabelledBy ?? field.labelId}\n aria-describedby={field.describedBy}\n aria-busy={field.busy || undefined}\n {...rest}\n onPointerDown={handleBoxPointerDown}\n onKeyDown={handleKeyDown}\n onFocus={(event) => {\n if (isLeaving(event, rootRef, panelRef)) onFocus?.(event)\n }}\n onBlur={(event) => {\n if (isLeaving(event, rootRef, panelRef)) onBlur?.(event)\n }}\n >\n <DateSegments\n pattern={pattern}\n draft={draft}\n onDraftChange={setDraft}\n hourCycle={24}\n periodNames={['', '']}\n labels={labels}\n reference={reference}\n firstId={field.id}\n disabled={field.disabled}\n readOnly={field.readOnly}\n invalid={invalid}\n required={field.required}\n />\n {(clearable && interactive && hasEntry) || calendar ? (\n <span className={picker.trailing}>\n {clearable && interactive && hasEntry ? (\n <button\n type=\"button\"\n className={picker.button}\n aria-label={labels.clear}\n onClick={() => {\n setDraft({})\n focusSegment(rootRef.current, 'first')\n }}\n >\n <CloseIcon />\n </button>\n ) : null}\n {calendar ? (\n <Popover.Trigger asChild>\n <button\n type=\"button\"\n className={picker.button}\n aria-label={labels.openCalendar}\n disabled={!interactive}\n >\n <CalendarIcon />\n </button>\n </Popover.Trigger>\n ) : null}\n </span>\n ) : null}\n {name !== undefined ? (\n <input\n type=\"hidden\"\n name={name}\n form={form}\n value={value}\n disabled={field.disabled || undefined}\n />\n ) : null}\n </div>\n )\n\n if (!calendar) return box\n\n return (\n <Popover open={open && interactive} onOpenChange={setOpen}>\n <Popover.Anchor asChild>{box}</Popover.Anchor>\n <Popover.Content\n ref={panelRef}\n className={picker.popover}\n align=\"start\"\n aria-label={labels.openCalendar}\n onOpenAutoFocus={(event) => {\n // The calendar focuses its own day instead of the first button.\n event.preventDefault()\n }}\n >\n <Calendar\n // The panel is a dialog: opening it moves focus to its current day.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n value={parseDate(value) ? value : ''}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n timeZone={timeZone}\n labels={labels}\n onValueChange={(next) => {\n setValue(next)\n setOpen(false)\n }}\n />\n </Popover.Content>\n </Popover>\n )\n }),\n)\n"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ttributes } from 'react';
|
|
2
2
|
import type { Size } from '../../../utils/tokens.js';
|
|
3
3
|
import { type FieldLabelProps } from '../Field/index.js';
|
|
4
|
-
/**
|
|
4
|
+
/**
|
|
5
|
+
* Two ISO dates (`YYYY-MM-DD`); `''` for an unset end. With a time `granularity` on
|
|
6
|
+
* `DateRangePickerField`, each end is a date-time in the same form as
|
|
7
|
+
* {@link DateTimeInput | DateTimeInput}'s value.
|
|
8
|
+
*/
|
|
5
9
|
export interface DateRangeValue {
|
|
6
10
|
start: string;
|
|
7
11
|
end: string;
|
|
@@ -27,17 +31,28 @@ export interface DateRangeFieldProps extends FieldLabelProps, Omit<HTMLAttribute
|
|
|
27
31
|
size?: Size;
|
|
28
32
|
}
|
|
29
33
|
/**
|
|
30
|
-
* A start and end date
|
|
34
|
+
* A start and end date under one legend: two native date inputs, or with `DateRangePickerField`
|
|
35
|
+
* typed dates with one calendar for the range, optional times and preset ranges.
|
|
31
36
|
*
|
|
32
37
|
* @remarks
|
|
33
38
|
* `DateRangeField` is two native date inputs, side by side and wrapping on a phone, under one
|
|
34
39
|
* legend. Native inputs mean the platform's own date picker and its accessibility.
|
|
35
40
|
*
|
|
41
|
+
* `DateRangePickerField` takes the same props and types the two ends like
|
|
42
|
+
* {@link DateInput | DateInput}, and one button opens a two-month {@link Calendar | Calendar}: the
|
|
43
|
+
* first pick sets the start, the second the end. `granularity="minute"` adds a time to each end (a
|
|
44
|
+
* new range runs from the start of its first day to the end of its last), and `presets` lists
|
|
45
|
+
* ranges such as "Last 7 days" beside the calendar. It's a separate import, so a native
|
|
46
|
+
* `DateRangeField` doesn't carry the calendar.
|
|
47
|
+
*
|
|
48
|
+
* Whichever you use, the start can't pass the end and the end can't come before the start.
|
|
49
|
+
*
|
|
36
50
|
* @privateRemarks
|
|
37
51
|
* A date range as two native date inputs under one legend, side by side and wrapping
|
|
38
52
|
* when narrow. The start can't pass the end and the end can't come before the start
|
|
39
53
|
* (each input's `min`/`max` follows the other). `id` goes to the start input; the ref to
|
|
40
|
-
* the fieldset.
|
|
54
|
+
* the fieldset. The calendar picker is its own component, DateRangePickerField, so the native
|
|
55
|
+
* markup, behaviour and import size stay exactly as they were for existing callers (ADR 0044).
|
|
41
56
|
*
|
|
42
57
|
* <DateRangeField label="Trip dates" value={dates} onValueChange={setDates} />
|
|
43
58
|
*/
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeField.js","names":["styles","DateRangeField_module_default","EMPTY","DateRangeField","forwardRef","fieldProps","rest","splitFieldLabelProps","props","fieldsetProps","valueProp","restProps","internal","setInternal","useState","defaultValue","value","update","readOnly","nextValue","part","next","onValueChange","handleBlur","event","onBlur","invalid","hasError","required","busy","Fieldset","label","labelHidden","description","hint","cx","className","Field","startLabel","id","Input","name","max","endLabel","min"],"sources":["../../../../src/components/inputs/DateRangeField/DateRangeField.tsx"],"sourcesContent":["import {\n forwardRef,\n useState,\n type FocusEvent,\n type FocusEventHandler,\n type HTMLAttributes,\n} from 'react'\nimport { cx } from '#utils/cx'\nimport type { Size } from '#utils/tokens'\nimport { Field, type FieldLabelProps } from '#components/inputs/Field'\nimport { Fieldset } from '#components/inputs/Fieldset'\nimport { Input } from '#components/inputs/Input'\nimport { splitFieldLabelProps } from '#components/inputs/internal/fieldProps'\nimport { hasError } from '#components/inputs/internal/errors'\nimport styles from './DateRangeField.module.css'\n\n
|
|
1
|
+
{"version":3,"file":"DateRangeField.js","names":["styles","DateRangeField_module_default","EMPTY","DateRangeField","forwardRef","fieldProps","rest","splitFieldLabelProps","props","fieldsetProps","valueProp","restProps","internal","setInternal","useState","defaultValue","value","update","readOnly","nextValue","part","next","onValueChange","handleBlur","event","onBlur","invalid","hasError","required","busy","Fieldset","label","labelHidden","description","hint","cx","className","Field","startLabel","id","Input","name","max","endLabel","min"],"sources":["../../../../src/components/inputs/DateRangeField/DateRangeField.tsx"],"sourcesContent":["import {\n forwardRef,\n useState,\n type FocusEvent,\n type FocusEventHandler,\n type HTMLAttributes,\n} from 'react'\nimport { cx } from '#utils/cx'\nimport type { Size } from '#utils/tokens'\nimport { Field, type FieldLabelProps } from '#components/inputs/Field'\nimport { Fieldset } from '#components/inputs/Fieldset'\nimport { Input } from '#components/inputs/Input'\nimport { splitFieldLabelProps } from '#components/inputs/internal/fieldProps'\nimport { hasError } from '#components/inputs/internal/errors'\nimport styles from './DateRangeField.module.css'\n\n/**\n * Two ISO dates (`YYYY-MM-DD`); `''` for an unset end. With a time `granularity` on\n * `DateRangePickerField`, each end is a date-time in the same form as\n * {@link DateTimeInput | DateTimeInput}'s value.\n */\nexport interface DateRangeValue {\n start: string\n end: string\n}\n\nexport interface DateRangeFieldProps\n extends\n FieldLabelProps,\n Omit<\n HTMLAttributes<HTMLFieldSetElement>,\n 'onChange' | 'defaultValue' | 'onBlur' | keyof FieldLabelProps\n > {\n value?: DateRangeValue\n defaultValue?: DateRangeValue\n onValueChange?: (value: DateRangeValue) => void\n /** Earliest date either end may take (`YYYY-MM-DD`). */\n min?: string\n /** Latest date either end may take (`YYYY-MM-DD`). */\n max?: string\n /** Label of the first input. Default `'Start date'`. */\n startLabel?: string\n /** Label of the second input. Default `'End date'`. */\n endLabel?: string\n /** Submits `${name}.start` and `${name}.end`. */\n name?: string\n disabled?: boolean\n readOnly?: boolean\n /** Fires when focus leaves both inputs (not when it moves from start to end). */\n onBlur?: FocusEventHandler\n size?: Size\n}\n\nconst EMPTY: DateRangeValue = { start: '', end: '' }\n\n/**\n * A start and end date under one legend: two native date inputs, or with `DateRangePickerField`\n * typed dates with one calendar for the range, optional times and preset ranges.\n *\n * @remarks\n * `DateRangeField` is two native date inputs, side by side and wrapping on a phone, under one\n * legend. Native inputs mean the platform's own date picker and its accessibility.\n *\n * `DateRangePickerField` takes the same props and types the two ends like\n * {@link DateInput | DateInput}, and one button opens a two-month {@link Calendar | Calendar}: the\n * first pick sets the start, the second the end. `granularity=\"minute\"` adds a time to each end (a\n * new range runs from the start of its first day to the end of its last), and `presets` lists\n * ranges such as \"Last 7 days\" beside the calendar. It's a separate import, so a native\n * `DateRangeField` doesn't carry the calendar.\n *\n * Whichever you use, the start can't pass the end and the end can't come before the start.\n *\n * @privateRemarks\n * A date range as two native date inputs under one legend, side by side and wrapping\n * when narrow. The start can't pass the end and the end can't come before the start\n * (each input's `min`/`max` follows the other). `id` goes to the start input; the ref to\n * the fieldset. The calendar picker is its own component, DateRangePickerField, so the native\n * markup, behaviour and import size stay exactly as they were for existing callers (ADR 0044).\n *\n * <DateRangeField label=\"Trip dates\" value={dates} onValueChange={setDates} />\n */\nexport const DateRangeField = forwardRef<HTMLFieldSetElement, DateRangeFieldProps>(\n function DateRangeField(props, ref) {\n const [fieldProps, rest] = splitFieldLabelProps(props)\n // `layout` goes to the Fieldset (legend column for `horizontal`); the two inputs always\n // sit side by side.\n const { label, labelHidden, hint, description, readOnly = false, ...fieldsetProps } = fieldProps\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n min,\n max,\n startLabel = 'Start date',\n endLabel = 'End date',\n name,\n disabled = false,\n onBlur,\n size,\n id,\n className,\n ...restProps\n } = rest\n\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue ?? EMPTY)\n const value = valueProp ?? internal\n\n const update = (part: keyof DateRangeValue, next: string) => {\n if (readOnly) return\n const nextValue = { ...value, [part]: next }\n if (valueProp === undefined) setInternal(nextValue)\n onValueChange?.(nextValue)\n }\n\n const handleBlur = (event: FocusEvent<HTMLFieldSetElement>) => {\n if (event.relatedTarget instanceof Node && event.currentTarget.contains(event.relatedTarget))\n return\n onBlur?.(event)\n }\n\n const invalid = hasError(fieldsetProps.error) || undefined\n const required = fieldsetProps.required\n const busy = fieldsetProps.validating ? true : undefined\n\n return (\n <Fieldset\n ref={ref}\n {...restProps}\n {...fieldsetProps}\n legend={label}\n legendHidden={labelHidden}\n description={description ?? hint}\n disabled={disabled}\n readOnly={readOnly}\n className={cx(styles.root, className)}\n onBlur={handleBlur}\n >\n <div className={styles.parts}>\n <Field\n label={startLabel}\n htmlFor={id}\n className={styles.part}\n error={invalid}\n errorHidden\n disabled={disabled}\n readOnly={readOnly}\n >\n <Input\n id={id}\n type=\"date\"\n size={size}\n name={name != null ? `${name}.start` : undefined}\n value={value.start}\n min={min}\n max={value.end || max}\n required={required}\n aria-busy={busy}\n onChange={(event) => {\n update('start', event.target.value)\n }}\n />\n </Field>\n <Field\n label={endLabel}\n className={styles.part}\n error={invalid}\n errorHidden\n disabled={disabled}\n readOnly={readOnly}\n >\n <Input\n type=\"date\"\n size={size}\n name={name != null ? `${name}.end` : undefined}\n value={value.end}\n min={value.start || min}\n max={max}\n required={required}\n aria-busy={busy}\n onChange={(event) => {\n update('end', event.target.value)\n }}\n />\n </Field>\n </div>\n </Fieldset>\n )\n },\n)\n"],"mappings":";;;;;;;;;;AAqDA,IAAME,IAAwB;CAAE,OAAO;CAAI,KAAK;AAAG,GA4BtCC,IAAiBC,EAC5B,SAAwB,GAAO,GAAK;CAClC,IAAM,CAACC,GAAYC,KAAQC,EAAqBC,CAAK,GAG/C,EAAE,UAAO,gBAAa,SAAM,gBAAa,cAAW,IAAO,GAAGC,MAAkBJ,GAChF,EACJ,OAAOK,GACP,iBACA,kBACA,QACA,QACA,gBAAa,cACb,cAAW,YACX,SACA,cAAW,IACX,WACA,SACA,OACA,cACA,GAAGC,MACDL,GAEE,CAACM,GAAUC,KAAeC,EAAyBC,KAAgBb,CAAK,GACxEc,IAAQN,KAAaE,GAErBK,KAAU,GAA4B,MAAiB;EAC3D,IAAIC,GAAU;EACd,IAAMC,IAAY;GAAE,GAAGH;IAAQI,IAAOC;EAAK;EAE3C,AADIX,MAAc,KAAA,KAAWG,EAAYM,CAAS,GAClDG,IAAgBH,CAAS;CAC3B,GAEMI,KAAc,MAA2C;EAC7D,AAAIC,EAAM,yBAAyB,QAAQA,EAAM,cAAc,SAASA,EAAM,aAAa,KAE3FC,IAASD,CAAK;CAChB,GAEME,IAAUC,EAASlB,EAAc,KAAK,KAAK,KAAA,GAC3CmB,IAAWnB,EAAc,UACzBoB,IAAOpB,EAAc,aAAa,KAAO,KAAA;CAE/C,OACE,kBAACqB,GAAD;EACO;EACL,GAAInB;EACJ,GAAIF;EACJ,QAAQsB;EACR,cAAcC;EACd,aAAaC,KAAeC;EAClB;EACA;EACV,WAAWC,EAAGnC,EAAO,MAAMoC,CAAS;EACpC,QAAQb;EAER,UAAA,kBAAC,OAAD;GAAK,WAAWvB,EAAO;GAAvB,UAAA,CACE,kBAACqC,GAAD;IACE,OAAOC;IACP,SAASC;IACT,WAAWvC,EAAO;IAClB,OAAO0B;IACP,aAAA;IACU;IACA;IAEV,UAAA,kBAACc,GAAD;KACM;KACJ,MAAK;KACC;KACN,MAAMC,KAAQ,OAAyB,KAAA,IAAlB,GAAGA,EAAK;KAC7B,OAAOzB,EAAM;KACR;KACL,KAAKA,EAAM,OAAO0B;KACR;KACV,aAAWb;KACX,WAAW,MAAU;MACnB,EAAO,SAASL,EAAM,OAAO,KAAK;KACpC;IACD,CAAA;GACI,CAAA,GACP,kBAACa,GAAD;IACE,OAAOM;IACP,WAAW3C,EAAO;IAClB,OAAO0B;IACP,aAAA;IACU;IACA;IAEV,UAAA,kBAACc,GAAD;KACE,MAAK;KACC;KACN,MAAMC,KAAQ,OAAuB,KAAA,IAAhB,GAAGA,EAAK;KAC7B,OAAOzB,EAAM;KACb,KAAKA,EAAM,SAAS4B;KACf;KACK;KACV,aAAWf;KACX,WAAW,MAAU;MACnB,EAAO,OAAOL,EAAM,OAAO,KAAK;KAClC;IACD,CAAA;GACI,CAAA,CACJ;;CACG,CAAA;AAEd,CACF"}
|
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
//#region src/components/inputs/DateRangeField/DateRangeField.module.css
|
|
2
|
-
var e = "kiln-DateRangeField__root", t = "kiln-DateRangeField__parts", n = "kiln-DateRangeField__part", r = {
|
|
2
|
+
var e = "kiln-DateRangeField__root", t = "kiln-DateRangeField__parts", n = "kiln-DateRangeField__part", r = "kiln-DateRangeField__trigger", i = "kiln-DateRangeField__panel", a = "kiln-DateRangeField__presets", o = "kiln-DateRangeField__preset", s = "kiln-DateRangeField__times", c = {
|
|
3
3
|
root: e,
|
|
4
4
|
parts: t,
|
|
5
|
-
part: n
|
|
5
|
+
part: n,
|
|
6
|
+
trigger: r,
|
|
7
|
+
panel: i,
|
|
8
|
+
presets: a,
|
|
9
|
+
preset: o,
|
|
10
|
+
times: s
|
|
6
11
|
};
|
|
7
12
|
//#endregion
|
|
8
|
-
export {
|
|
13
|
+
export { c as default, i as panel, n as part, t as parts, o as preset, a as presets, e as root, s as times, r as trigger };
|
|
9
14
|
|
|
10
15
|
//# sourceMappingURL=DateRangeField.module.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DateRangeField.module.js","names":["root","parts","part","DateRangeField_module_default"],"sources":["../../../../src/components/inputs/DateRangeField/DateRangeField.module.css"],"sourcesContent":["/*\n * Start and end side by side, each at least --space-11 wide, wrapping to a stack when the\n * column is narrower than both.\n */\n.root {\n min-inline-size: 0;\n}\n\n.parts {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-3);\n}\n\n.part {\n flex: 1 1 var(--space-11);\n min-inline-size: 0;\n}\n"],"mappings":""}
|
|
1
|
+
{"version":3,"file":"DateRangeField.module.js","names":["root","parts","part","trigger","panel","presets","preset","times","DateRangeField_module_default"],"sources":["../../../../src/components/inputs/DateRangeField/DateRangeField.module.css"],"sourcesContent":["/*\n * Start and end side by side, each at least --space-11 wide, wrapping to a stack when the\n * column is narrower than both.\n */\n.root {\n min-inline-size: 0;\n}\n\n.parts {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-3);\n}\n\n.part {\n flex: 1 1 var(--space-11);\n min-inline-size: 0;\n}\n\n/* Calendar picker: one calendar button after the two ends, level with their boxes. */\n.trigger {\n flex: none;\n align-self: flex-end;\n}\n\n.panel {\n display: flex;\n flex-wrap: wrap;\n gap: var(--space-4);\n}\n\n.presets {\n display: flex;\n flex-direction: column;\n gap: var(--space-1);\n min-inline-size: 9rem;\n padding-inline-end: var(--space-4);\n border-inline-end: var(--border-width) solid var(--color-line);\n}\n\n.preset {\n justify-content: flex-start;\n}\n.preset[aria-pressed='true'] {\n background-color: var(--color-accent-soft);\n}\n\n.times {\n display: flex;\n flex-direction: column;\n gap: var(--space-2);\n}\n"],"mappings":""}
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
import { type TimeGranularity } from '../internal/dates.js';
|
|
2
|
+
import { type DateTimeLabels } from '../internal/picker.js';
|
|
3
|
+
import type { DateRangeFieldProps, DateRangeValue } from './DateRangeField.js';
|
|
4
|
+
/** A range offered beside the calendar: "Last 7 days", "This month". */
|
|
5
|
+
export interface DateRangePreset {
|
|
6
|
+
label: string;
|
|
7
|
+
/**
|
|
8
|
+
* The range, or a function that works it out when picked (so "today" is always today). With a
|
|
9
|
+
* time `granularity`, a date-only end runs from the start of its first day to the end of its last.
|
|
10
|
+
*/
|
|
11
|
+
value: DateRangeValue | (() => DateRangeValue);
|
|
12
|
+
}
|
|
13
|
+
export interface DateRangePickerFieldProps extends DateRangeFieldProps {
|
|
14
|
+
/** `day` (default), or `minute`/`second` to give each end a time. */
|
|
15
|
+
granularity?: 'day' | TimeGranularity;
|
|
16
|
+
/** Ranges to offer beside the calendar. */
|
|
17
|
+
presets?: readonly DateRangePreset[];
|
|
18
|
+
/** Show a clear button in each input. */
|
|
19
|
+
clearable?: boolean;
|
|
20
|
+
/** Marks dates unavailable. */
|
|
21
|
+
isDateDisabled?: (date: string) => boolean;
|
|
22
|
+
/** 0 (Sunday) to 6 (Saturday). Defaults to the locale's week. */
|
|
23
|
+
firstDayOfWeek?: number;
|
|
24
|
+
/** BCP 47 locale for the parts and names. Default `en-AU`. */
|
|
25
|
+
locale?: string;
|
|
26
|
+
/**
|
|
27
|
+
* The zone "today" is read in. With a time `granularity`, each end becomes a UTC instant typed as
|
|
28
|
+
* this zone's clock, as in {@link DateTimeInput | DateTimeInput}.
|
|
29
|
+
*/
|
|
30
|
+
timeZone?: string;
|
|
31
|
+
/** With a time `granularity`: 12 or 24. Defaults to the locale's clock. */
|
|
32
|
+
hourCycle?: 12 | 24;
|
|
33
|
+
/** Words for another language or wording. */
|
|
34
|
+
labels?: Partial<DateTimeLabels>;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* A start and end date typed part by part under one legend, with one two-month calendar for the
|
|
38
|
+
* range, optional times and preset ranges.
|
|
39
|
+
*
|
|
40
|
+
* @privateRemarks
|
|
41
|
+
* The calendar picker for a range, documented on {@link DateRangeField | DateRangeField}'s page. It
|
|
42
|
+
* is a separate export rather than a `picker` prop on DateRangeField, so importing DateRangeField
|
|
43
|
+
* alone doesn't bring Popover, Calendar and the typed inputs (ADR 0044). The ref goes to the
|
|
44
|
+
* fieldset and `id` to the start input, as in DateRangeField.
|
|
45
|
+
*
|
|
46
|
+
* <DateRangePickerField label="Stay" presets={presets} value={dates} onValueChange={setDates} />
|
|
47
|
+
*/
|
|
48
|
+
export declare const DateRangePickerField: import("react").ForwardRefExoticComponent<DateRangePickerFieldProps & import("react").RefAttributes<HTMLFieldSetElement>>;
|
|
@@ -0,0 +1,246 @@
|
|
|
1
|
+
import { cx as e } from "../../../utils/cx.js";
|
|
2
|
+
import { CalendarIcon as t } from "../../../icons/icons.js";
|
|
3
|
+
import { Button as n } from "../../actions/Button/Button.js";
|
|
4
|
+
import { IconButton as r } from "../../actions/IconButton/IconButton.js";
|
|
5
|
+
import { FieldContext as ee } from "../internal/FieldContext.js";
|
|
6
|
+
import { hasError as te } from "../internal/errors.js";
|
|
7
|
+
import { Field as i } from "../Field/Field.js";
|
|
8
|
+
import { Fieldset as ne } from "../Fieldset/Fieldset.js";
|
|
9
|
+
import { splitFieldLabelProps as re } from "../internal/fieldProps.js";
|
|
10
|
+
import a from "./DateRangeField.module.js";
|
|
11
|
+
import { Popover as o } from "../../overlays/Popover/Popover.js";
|
|
12
|
+
import { DEFAULT_LOCALE as ie, dateOf as s, defaultHourCycle as ae, formatDate as c, formatDateTime as oe, formatTime as se, parseDate as l, parseDateTime as ce, parseTime as le } from "../internal/dates.js";
|
|
13
|
+
import { Calendar as ue } from "../Calendar/Calendar.js";
|
|
14
|
+
import { DEFAULT_DATE_TIME_LABELS as de } from "../internal/picker.js";
|
|
15
|
+
import u from "../internal/picker.module.js";
|
|
16
|
+
import { DateInput as d } from "../DateInput/DateInput.js";
|
|
17
|
+
import { TimeInput as fe } from "../TimeInput/TimeInput.js";
|
|
18
|
+
import { DateTimeInput as f } from "../DateTimeInput/DateTimeInput.js";
|
|
19
|
+
import { forwardRef as p, useRef as pe, useState as m } from "react";
|
|
20
|
+
import { jsx as h, jsxs as g } from "react/jsx-runtime";
|
|
21
|
+
//#region src/components/inputs/DateRangeField/DateRangePickerField.tsx
|
|
22
|
+
var me = {
|
|
23
|
+
start: "",
|
|
24
|
+
end: ""
|
|
25
|
+
}, _ = {
|
|
26
|
+
hour: 0,
|
|
27
|
+
minute: 0,
|
|
28
|
+
second: 0
|
|
29
|
+
}, v = {
|
|
30
|
+
hour: 23,
|
|
31
|
+
minute: 59,
|
|
32
|
+
second: 59
|
|
33
|
+
}, he = (e) => typeof e.value == "function" ? e.value() : e.value, y = p(function(p, y) {
|
|
34
|
+
let [ge, _e] = re(p), { label: ve, labelHidden: ye, hint: be, description: xe, readOnly: b = !1, ...x } = ge, { value: S, defaultValue: Se, onValueChange: Ce, min: C, max: w, startLabel: we = "Start date", endLabel: Te = "End date", name: T, disabled: E = !1, onBlur: Ee, size: D, id: O, className: De, granularity: k = "day", presets: A, clearable: Oe = !1, isDateDisabled: j, firstDayOfWeek: M, locale: N = ie, timeZone: P, hourCycle: F, labels: ke, ...Ae } = _e, [je, Me] = m(Se ?? me), [Ne, I] = m(!1), L = pe(null), R = S ?? je, z = (e) => {
|
|
35
|
+
b || (S === void 0 && Me(e), Ce?.(e));
|
|
36
|
+
}, B = (e, t) => {
|
|
37
|
+
z({
|
|
38
|
+
...R,
|
|
39
|
+
[e]: t
|
|
40
|
+
});
|
|
41
|
+
}, Pe = (e) => {
|
|
42
|
+
let t = e.relatedTarget;
|
|
43
|
+
t instanceof Node && (e.currentTarget.contains(t) || L.current?.contains(t)) || Ee?.(e);
|
|
44
|
+
}, V = te(x.error) || void 0, Fe = x.required, Ie = x.validating ? !0 : void 0, H = {
|
|
45
|
+
...de,
|
|
46
|
+
...ke
|
|
47
|
+
}, U = k !== "day", W = k === "second" ? "second" : "minute", G = F ?? ae(N), K = !E && !b, q = s(R.start, P), J = s(R.end, P), Y = (e) => ce(e, P)?.time ?? null, X = (e, t) => {
|
|
48
|
+
let n = l(e);
|
|
49
|
+
return n ? oe({
|
|
50
|
+
date: n,
|
|
51
|
+
time: t
|
|
52
|
+
}, W, P) : "";
|
|
53
|
+
}, Le = J ? c(J) : w, Re = q ? c(q) : C, Z = (e, t) => U && e ? X(e, t) : e, ze = (e) => {
|
|
54
|
+
if (!U) {
|
|
55
|
+
z(e), e.start && e.end && I(!1);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
z({
|
|
59
|
+
start: e.start ? X(e.start, Y(R.start) ?? _) : "",
|
|
60
|
+
end: e.end ? X(e.end, Y(R.end) ?? v) : ""
|
|
61
|
+
});
|
|
62
|
+
}, Q = (e) => {
|
|
63
|
+
let t = he(e);
|
|
64
|
+
return U ? {
|
|
65
|
+
start: l(t.start) ? X(t.start, _) : t.start,
|
|
66
|
+
end: l(t.end) ? X(t.end, v) : t.end
|
|
67
|
+
} : t;
|
|
68
|
+
}, Be = (e, t) => {
|
|
69
|
+
let n = le(t), r = e === "start" ? q : J;
|
|
70
|
+
n && r && B(e, X(c(r), n));
|
|
71
|
+
}, $ = (e) => ({
|
|
72
|
+
size: D,
|
|
73
|
+
name: T == null ? void 0 : `${T}.${e}`,
|
|
74
|
+
value: R[e],
|
|
75
|
+
required: Fe,
|
|
76
|
+
clearable: Oe,
|
|
77
|
+
isDateDisabled: j,
|
|
78
|
+
firstDayOfWeek: M,
|
|
79
|
+
locale: N,
|
|
80
|
+
timeZone: P,
|
|
81
|
+
labels: H,
|
|
82
|
+
calendar: !1,
|
|
83
|
+
"aria-busy": Ie,
|
|
84
|
+
onValueChange: (t) => {
|
|
85
|
+
B(e, t);
|
|
86
|
+
}
|
|
87
|
+
});
|
|
88
|
+
return /* @__PURE__ */ h(ne, {
|
|
89
|
+
ref: y,
|
|
90
|
+
...Ae,
|
|
91
|
+
...x,
|
|
92
|
+
legend: ve,
|
|
93
|
+
legendHidden: ye,
|
|
94
|
+
description: xe ?? be,
|
|
95
|
+
disabled: E,
|
|
96
|
+
readOnly: b,
|
|
97
|
+
className: e(a.root, De),
|
|
98
|
+
onBlur: Pe,
|
|
99
|
+
"data-picker": "calendar",
|
|
100
|
+
children: /* @__PURE__ */ g(o, {
|
|
101
|
+
open: Ne && K,
|
|
102
|
+
onOpenChange: I,
|
|
103
|
+
children: [/* @__PURE__ */ h(o.Anchor, {
|
|
104
|
+
asChild: !0,
|
|
105
|
+
children: /* @__PURE__ */ g("div", {
|
|
106
|
+
className: a.parts,
|
|
107
|
+
children: [
|
|
108
|
+
/* @__PURE__ */ h(i, {
|
|
109
|
+
label: we,
|
|
110
|
+
htmlFor: O,
|
|
111
|
+
className: a.part,
|
|
112
|
+
error: V,
|
|
113
|
+
errorHidden: !0,
|
|
114
|
+
disabled: E,
|
|
115
|
+
readOnly: b,
|
|
116
|
+
children: U ? /* @__PURE__ */ h(f, {
|
|
117
|
+
id: O,
|
|
118
|
+
...$("start"),
|
|
119
|
+
granularity: W,
|
|
120
|
+
hourCycle: G,
|
|
121
|
+
min: Z(C, _),
|
|
122
|
+
max: R.end || Z(w, v)
|
|
123
|
+
}) : /* @__PURE__ */ h(d, {
|
|
124
|
+
id: O,
|
|
125
|
+
...$("start"),
|
|
126
|
+
min: C,
|
|
127
|
+
max: Le
|
|
128
|
+
})
|
|
129
|
+
}),
|
|
130
|
+
/* @__PURE__ */ h(i, {
|
|
131
|
+
label: Te,
|
|
132
|
+
className: a.part,
|
|
133
|
+
error: V,
|
|
134
|
+
errorHidden: !0,
|
|
135
|
+
disabled: E,
|
|
136
|
+
readOnly: b,
|
|
137
|
+
children: U ? /* @__PURE__ */ h(f, {
|
|
138
|
+
...$("end"),
|
|
139
|
+
granularity: W,
|
|
140
|
+
hourCycle: G,
|
|
141
|
+
min: R.start || Z(C, _),
|
|
142
|
+
max: Z(w, v)
|
|
143
|
+
}) : /* @__PURE__ */ h(d, {
|
|
144
|
+
...$("end"),
|
|
145
|
+
min: Re,
|
|
146
|
+
max: w
|
|
147
|
+
})
|
|
148
|
+
}),
|
|
149
|
+
/* @__PURE__ */ h(o.Trigger, {
|
|
150
|
+
asChild: !0,
|
|
151
|
+
children: /* @__PURE__ */ h(r, {
|
|
152
|
+
className: a.trigger,
|
|
153
|
+
variant: "outline",
|
|
154
|
+
size: D,
|
|
155
|
+
shape: "square",
|
|
156
|
+
label: H.openCalendar,
|
|
157
|
+
icon: /* @__PURE__ */ h(t, {}),
|
|
158
|
+
disabled: !K
|
|
159
|
+
})
|
|
160
|
+
})
|
|
161
|
+
]
|
|
162
|
+
})
|
|
163
|
+
}), /* @__PURE__ */ h(o.Content, {
|
|
164
|
+
ref: L,
|
|
165
|
+
className: u.popover,
|
|
166
|
+
align: "end",
|
|
167
|
+
"aria-label": H.openCalendar,
|
|
168
|
+
onOpenAutoFocus: (e) => {
|
|
169
|
+
e.preventDefault();
|
|
170
|
+
},
|
|
171
|
+
children: /* @__PURE__ */ h(ee.Provider, {
|
|
172
|
+
value: null,
|
|
173
|
+
children: /* @__PURE__ */ g("div", {
|
|
174
|
+
className: a.panel,
|
|
175
|
+
children: [A && A.length > 0 ? /* @__PURE__ */ h("div", {
|
|
176
|
+
role: "group",
|
|
177
|
+
"aria-label": H.presets,
|
|
178
|
+
className: a.presets,
|
|
179
|
+
children: A.map((e) => {
|
|
180
|
+
let t = Q(e), r = t.start === R.start && t.end === R.end;
|
|
181
|
+
return /* @__PURE__ */ h(n, {
|
|
182
|
+
variant: "ghost",
|
|
183
|
+
size: "sm",
|
|
184
|
+
className: a.preset,
|
|
185
|
+
"aria-pressed": r,
|
|
186
|
+
onClick: () => {
|
|
187
|
+
z(Q(e)), I(!1);
|
|
188
|
+
},
|
|
189
|
+
children: e.label
|
|
190
|
+
}, e.label);
|
|
191
|
+
})
|
|
192
|
+
}) : null, /* @__PURE__ */ g("div", {
|
|
193
|
+
className: u.panel,
|
|
194
|
+
children: [/* @__PURE__ */ h(ue, {
|
|
195
|
+
mode: "range",
|
|
196
|
+
months: 2,
|
|
197
|
+
autoFocus: !0,
|
|
198
|
+
value: {
|
|
199
|
+
start: q ? c(q) : "",
|
|
200
|
+
end: J ? c(J) : ""
|
|
201
|
+
},
|
|
202
|
+
min: C,
|
|
203
|
+
max: w,
|
|
204
|
+
isDateDisabled: j,
|
|
205
|
+
firstDayOfWeek: M,
|
|
206
|
+
locale: N,
|
|
207
|
+
timeZone: P,
|
|
208
|
+
labels: H,
|
|
209
|
+
onValueChange: ze
|
|
210
|
+
}), U ? /* @__PURE__ */ h("div", {
|
|
211
|
+
className: a.times,
|
|
212
|
+
children: ["start", "end"].map((e) => {
|
|
213
|
+
let t = Y(R[e]);
|
|
214
|
+
return /* @__PURE__ */ g("div", {
|
|
215
|
+
className: u.timeRow,
|
|
216
|
+
children: [/* @__PURE__ */ h("span", {
|
|
217
|
+
className: u.timeLabel,
|
|
218
|
+
"aria-hidden": "true",
|
|
219
|
+
children: e === "start" ? H.startTime : H.endTime
|
|
220
|
+
}), /* @__PURE__ */ h(fe, {
|
|
221
|
+
"aria-label": e === "start" ? H.startTime : H.endTime,
|
|
222
|
+
value: t ? se(t, W) : "",
|
|
223
|
+
granularity: W,
|
|
224
|
+
hourCycle: G,
|
|
225
|
+
locale: N,
|
|
226
|
+
size: "sm",
|
|
227
|
+
labels: H,
|
|
228
|
+
disabled: (e === "start" ? q : J) === null,
|
|
229
|
+
onValueChange: (t) => {
|
|
230
|
+
Be(e, t);
|
|
231
|
+
}
|
|
232
|
+
})]
|
|
233
|
+
}, e);
|
|
234
|
+
})
|
|
235
|
+
}) : null]
|
|
236
|
+
})]
|
|
237
|
+
})
|
|
238
|
+
})
|
|
239
|
+
})]
|
|
240
|
+
})
|
|
241
|
+
});
|
|
242
|
+
});
|
|
243
|
+
//#endregion
|
|
244
|
+
export { y as DateRangePickerField };
|
|
245
|
+
|
|
246
|
+
//# sourceMappingURL=DateRangePickerField.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"DateRangePickerField.js","names":["styles","picker","DateRangeField_module_default","picker_module_default","EMPTY","MIDNIGHT","LAST_SECOND","resolvePreset","preset","DateRangePickerField","forwardRef","fieldProps","rest","splitFieldLabelProps","props","fieldsetProps","valueProp","DEFAULT_LOCALE","labelsProp","restProps","internal","setInternal","useState","defaultValue","open","setOpen","panelRef","useRef","value","setRange","readOnly","nextValue","onValueChange","update","part","next","handleBlur","event","onBlur","invalid","hasError","required","busy","labels","DEFAULT_DATE_TIME_LABELS","withTime","granularity","timeGranularity","clock","hourCycle","defaultHourCycle","locale","interactive","disabled","startDate","dateOf","timeZone","endDate","timeOf","parseDateTime","text","join","day","parseDate","date","formatDateTime","startMax","formatDate","max","endMin","min","boundOf","time","pickRange","presetRange","range","setTime","parseTime","partProps","name","Fieldset","label","labelHidden","description","hint","cx","className","Popover","Field","startLabel","id","DateTimeInput","DateInput","endLabel","IconButton","CalendarIcon","FieldContext","presets","current","Button","Calendar","TimeInput","formatTime"],"sources":["../../../../src/components/inputs/DateRangeField/DateRangePickerField.tsx"],"sourcesContent":["import { forwardRef, useRef, useState, type FocusEvent } from 'react'\nimport { CalendarIcon } from '#icons'\nimport { cx } from '#utils/cx'\nimport { Button } from '#components/actions/Button'\nimport { IconButton } from '#components/actions/IconButton'\nimport { Popover } from '#components/overlays/Popover'\nimport { Calendar } from '#components/inputs/Calendar'\nimport { DateInput } from '#components/inputs/DateInput'\nimport { DateTimeInput } from '#components/inputs/DateTimeInput'\nimport { Field } from '#components/inputs/Field'\nimport { Fieldset } from '#components/inputs/Fieldset'\nimport { TimeInput } from '#components/inputs/TimeInput'\nimport { FieldContext } from '#components/inputs/internal/FieldContext'\nimport { splitFieldLabelProps } from '#components/inputs/internal/fieldProps'\nimport { hasError } from '#components/inputs/internal/errors'\nimport {\n DEFAULT_LOCALE,\n dateOf,\n defaultHourCycle,\n formatDate,\n formatDateTime,\n formatTime,\n parseDate,\n parseDateTime,\n parseTime,\n type TimeGranularity,\n type TimeOfDay,\n} from '#components/inputs/internal/dates'\nimport { DEFAULT_DATE_TIME_LABELS, type DateTimeLabels } from '#components/inputs/internal/picker'\nimport picker from '#components/inputs/internal/picker.module.css'\nimport type { DateRangeFieldProps, DateRangeValue } from './DateRangeField'\nimport styles from './DateRangeField.module.css'\n\n/** A range offered beside the calendar: \"Last 7 days\", \"This month\". */\nexport interface DateRangePreset {\n label: string\n /**\n * The range, or a function that works it out when picked (so \"today\" is always today). With a\n * time `granularity`, a date-only end runs from the start of its first day to the end of its last.\n */\n value: DateRangeValue | (() => DateRangeValue)\n}\n\nexport interface DateRangePickerFieldProps extends DateRangeFieldProps {\n /** `day` (default), or `minute`/`second` to give each end a time. */\n granularity?: 'day' | TimeGranularity\n /** Ranges to offer beside the calendar. */\n presets?: readonly DateRangePreset[]\n /** Show a clear button in each input. */\n clearable?: boolean\n /** Marks dates unavailable. */\n isDateDisabled?: (date: string) => boolean\n /** 0 (Sunday) to 6 (Saturday). Defaults to the locale's week. */\n firstDayOfWeek?: number\n /** BCP 47 locale for the parts and names. Default `en-AU`. */\n locale?: string\n /**\n * The zone \"today\" is read in. With a time `granularity`, each end becomes a UTC instant typed as\n * this zone's clock, as in {@link DateTimeInput | DateTimeInput}.\n */\n timeZone?: string\n /** With a time `granularity`: 12 or 24. Defaults to the locale's clock. */\n hourCycle?: 12 | 24\n /** Words for another language or wording. */\n labels?: Partial<DateTimeLabels>\n}\n\nconst EMPTY: DateRangeValue = { start: '', end: '' }\nconst MIDNIGHT: TimeOfDay = { hour: 0, minute: 0, second: 0 }\nconst LAST_SECOND: TimeOfDay = { hour: 23, minute: 59, second: 59 }\n\nconst resolvePreset = (preset: DateRangePreset): DateRangeValue =>\n typeof preset.value === 'function' ? preset.value() : preset.value\n\n/**\n * A start and end date typed part by part under one legend, with one two-month calendar for the\n * range, optional times and preset ranges.\n *\n * @privateRemarks\n * The calendar picker for a range, documented on {@link DateRangeField | DateRangeField}'s page. It\n * is a separate export rather than a `picker` prop on DateRangeField, so importing DateRangeField\n * alone doesn't bring Popover, Calendar and the typed inputs (ADR 0044). The ref goes to the\n * fieldset and `id` to the start input, as in DateRangeField.\n *\n * <DateRangePickerField label=\"Stay\" presets={presets} value={dates} onValueChange={setDates} />\n */\nexport const DateRangePickerField = forwardRef<HTMLFieldSetElement, DateRangePickerFieldProps>(\n function DateRangePickerField(props, ref) {\n const [fieldProps, rest] = splitFieldLabelProps(props)\n // `layout` goes to the Fieldset (legend column for `horizontal`); the two inputs always\n // sit side by side.\n const { label, labelHidden, hint, description, readOnly = false, ...fieldsetProps } = fieldProps\n const {\n value: valueProp,\n defaultValue,\n onValueChange,\n min,\n max,\n startLabel = 'Start date',\n endLabel = 'End date',\n name,\n disabled = false,\n onBlur,\n size,\n id,\n className,\n granularity = 'day',\n presets,\n clearable = false,\n isDateDisabled,\n firstDayOfWeek,\n locale = DEFAULT_LOCALE,\n timeZone,\n hourCycle,\n labels: labelsProp,\n ...restProps\n } = rest\n\n const [internal, setInternal] = useState<DateRangeValue>(defaultValue ?? EMPTY)\n const [open, setOpen] = useState(false)\n const panelRef = useRef<HTMLDivElement>(null)\n const value = valueProp ?? internal\n\n const setRange = (nextValue: DateRangeValue) => {\n if (readOnly) return\n if (valueProp === undefined) setInternal(nextValue)\n onValueChange?.(nextValue)\n }\n const update = (part: keyof DateRangeValue, next: string) => {\n setRange({ ...value, [part]: next })\n }\n\n const handleBlur = (event: FocusEvent<HTMLFieldSetElement>) => {\n const next = event.relatedTarget\n if (\n next instanceof Node &&\n (event.currentTarget.contains(next) || panelRef.current?.contains(next))\n )\n return\n onBlur?.(event)\n }\n\n const invalid = hasError(fieldsetProps.error) || undefined\n const required = fieldsetProps.required\n const busy = fieldsetProps.validating ? true : undefined\n\n const labels = { ...DEFAULT_DATE_TIME_LABELS, ...labelsProp }\n const withTime = granularity !== 'day'\n const timeGranularity: TimeGranularity = granularity === 'second' ? 'second' : 'minute'\n const clock = hourCycle ?? defaultHourCycle(locale)\n const interactive = !disabled && !readOnly\n const startDate = dateOf(value.start, timeZone)\n const endDate = dateOf(value.end, timeZone)\n const timeOf = (text: string) => parseDateTime(text, timeZone)?.time ?? null\n const join = (date: string, time: TimeOfDay) => {\n const day = parseDate(date)\n return day ? formatDateTime({ date: day, time }, timeGranularity, timeZone) : ''\n }\n // An end's date bounds the other end's calendar and typing; its time doesn't.\n const startMax = endDate ? formatDate(endDate) : max\n const endMin = startDate ? formatDate(startDate) : min\n const boundOf = (date: string | undefined, time: TimeOfDay) =>\n withTime && date ? join(date, time) : date\n\n const pickRange = (next: DateRangeValue) => {\n if (!withTime) {\n setRange(next)\n if (next.start && next.end) setOpen(false)\n return\n }\n setRange({\n start: next.start ? join(next.start, timeOf(value.start) ?? MIDNIGHT) : '',\n end: next.end ? join(next.end, timeOf(value.end) ?? LAST_SECOND) : '',\n })\n }\n const presetRange = (preset: DateRangePreset): DateRangeValue => {\n const range = resolvePreset(preset)\n if (!withTime) return range\n return {\n start: parseDate(range.start) ? join(range.start, MIDNIGHT) : range.start,\n end: parseDate(range.end) ? join(range.end, LAST_SECOND) : range.end,\n }\n }\n const setTime = (part: keyof DateRangeValue, text: string) => {\n const time = parseTime(text)\n const date = part === 'start' ? startDate : endDate\n if (time && date) update(part, join(formatDate(date), time))\n }\n\n const partProps = (part: keyof DateRangeValue) => ({\n size,\n name: name != null ? `${name}.${part}` : undefined,\n value: value[part],\n required,\n clearable,\n isDateDisabled,\n firstDayOfWeek,\n locale,\n timeZone,\n labels,\n calendar: false,\n 'aria-busy': busy,\n onValueChange: (next: string) => {\n update(part, next)\n },\n })\n\n return (\n <Fieldset\n ref={ref}\n {...restProps}\n {...fieldsetProps}\n legend={label}\n legendHidden={labelHidden}\n description={description ?? hint}\n disabled={disabled}\n readOnly={readOnly}\n className={cx(styles.root, className)}\n onBlur={handleBlur}\n data-picker=\"calendar\"\n >\n <Popover open={open && interactive} onOpenChange={setOpen}>\n <Popover.Anchor asChild>\n <div className={styles.parts}>\n <Field\n label={startLabel}\n htmlFor={id}\n className={styles.part}\n error={invalid}\n errorHidden\n disabled={disabled}\n readOnly={readOnly}\n >\n {withTime ? (\n <DateTimeInput\n id={id}\n {...partProps('start')}\n granularity={timeGranularity}\n hourCycle={clock}\n min={boundOf(min, MIDNIGHT)}\n max={value.end || boundOf(max, LAST_SECOND)}\n />\n ) : (\n <DateInput id={id} {...partProps('start')} min={min} max={startMax} />\n )}\n </Field>\n <Field\n label={endLabel}\n className={styles.part}\n error={invalid}\n errorHidden\n disabled={disabled}\n readOnly={readOnly}\n >\n {withTime ? (\n <DateTimeInput\n {...partProps('end')}\n granularity={timeGranularity}\n hourCycle={clock}\n min={value.start || boundOf(min, MIDNIGHT)}\n max={boundOf(max, LAST_SECOND)}\n />\n ) : (\n <DateInput {...partProps('end')} min={endMin} max={max} />\n )}\n </Field>\n <Popover.Trigger asChild>\n <IconButton\n className={styles.trigger}\n variant=\"outline\"\n size={size}\n shape=\"square\"\n label={labels.openCalendar}\n icon={<CalendarIcon />}\n disabled={!interactive}\n />\n </Popover.Trigger>\n </div>\n </Popover.Anchor>\n <Popover.Content\n ref={panelRef}\n className={picker.popover}\n align=\"end\"\n aria-label={labels.openCalendar}\n onOpenAutoFocus={(event) => {\n event.preventDefault()\n }}\n >\n {/* The panel's own controls aren't the fieldset's: no label, error or id from it. */}\n <FieldContext.Provider value={null}>\n <div className={styles.panel}>\n {presets && presets.length > 0 ? (\n <div role=\"group\" aria-label={labels.presets} className={styles.presets}>\n {presets.map((preset) => {\n const range = presetRange(preset)\n const current = range.start === value.start && range.end === value.end\n return (\n <Button\n key={preset.label}\n variant=\"ghost\"\n size=\"sm\"\n className={styles.preset}\n aria-pressed={current}\n onClick={() => {\n setRange(presetRange(preset))\n setOpen(false)\n }}\n >\n {preset.label}\n </Button>\n )\n })}\n </div>\n ) : null}\n <div className={picker.panel}>\n <Calendar\n mode=\"range\"\n months={2}\n // The panel is a dialog: opening it moves focus to its current day.\n // eslint-disable-next-line jsx-a11y/no-autofocus\n autoFocus\n value={{\n start: startDate ? formatDate(startDate) : '',\n end: endDate ? formatDate(endDate) : '',\n }}\n min={min}\n max={max}\n isDateDisabled={isDateDisabled}\n firstDayOfWeek={firstDayOfWeek}\n locale={locale}\n timeZone={timeZone}\n labels={labels}\n onValueChange={pickRange}\n />\n {withTime ? (\n <div className={styles.times}>\n {(['start', 'end'] as const).map((part) => {\n const time = timeOf(value[part])\n return (\n <div key={part} className={picker.timeRow}>\n <span className={picker.timeLabel} aria-hidden=\"true\">\n {part === 'start' ? labels.startTime : labels.endTime}\n </span>\n <TimeInput\n aria-label={part === 'start' ? labels.startTime : labels.endTime}\n value={time ? formatTime(time, timeGranularity) : ''}\n granularity={timeGranularity}\n hourCycle={clock}\n locale={locale}\n size=\"sm\"\n labels={labels}\n disabled={(part === 'start' ? startDate : endDate) === null}\n onValueChange={(next) => {\n setTime(part, next)\n }}\n />\n </div>\n )\n })}\n </div>\n ) : null}\n </div>\n </div>\n </FieldContext.Provider>\n </Popover.Content>\n </Popover>\n </Fieldset>\n )\n },\n)\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAmEA,IAAMI,KAAwB;CAAE,OAAO;CAAI,KAAK;AAAG,GAC7CC,IAAsB;CAAE,MAAM;CAAG,QAAQ;CAAG,QAAQ;AAAE,GACtDC,IAAyB;CAAE,MAAM;CAAI,QAAQ;CAAI,QAAQ;AAAG,GAE5DC,MAAiB,MACrB,OAAOC,EAAO,SAAU,aAAaA,EAAO,MAAM,IAAIA,EAAO,OAclDC,IAAuBC,EAClC,S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