@cognite/aura 0.3.0 → 0.3.2
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/DESIGN.md +2243 -729
- package/README.md +133 -11
- package/dist/components/index.d.ts +3 -2
- package/dist/components/index.js +183 -176
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +4 -4
- package/dist/components/ui/core/alert/alert.js +3 -3
- package/dist/components/ui/core/banner/banner.js +6 -6
- package/dist/components/ui/core/button/button.js +4 -4
- package/dist/components/ui/core/checkbox/checkbox.js +8 -8
- package/dist/components/ui/core/code-block/code-block.js +6 -6
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.d.ts +15 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +73 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/index.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +17 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +52 -0
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +64 -75
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +51 -64
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +146 -161
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +1 -2
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +124 -137
- package/dist/components/ui/core/date-time-pickers/index.d.ts +4 -0
- package/dist/components/ui/core/date-time-pickers/index.js +10 -0
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +8 -8
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +1 -1
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +0 -2
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +18 -34
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.d.ts +23 -0
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +32 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +19 -0
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +41 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +16 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +100 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +23 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +64 -0
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +3 -3
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +1 -1
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +17 -15
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +83 -85
- package/dist/components/ui/core/hover-card/hover-card.js +3 -3
- package/dist/components/ui/core/input/input.js +1 -1
- package/dist/components/ui/core/message/message.js +387 -101
- package/dist/components/ui/core/pagination/pagination.js +9 -7
- package/dist/components/ui/core/prompt-input/prompt-input.js +16 -16
- package/dist/components/ui/core/radio-group/radio-group.js +7 -7
- package/dist/components/ui/core/reasoning/reasoning.js +1 -1
- package/dist/components/ui/core/segmented-control/segmented-control.js +3 -3
- package/dist/components/ui/core/select/select.d.ts +2 -1
- package/dist/components/ui/core/select/select.js +134 -110
- package/dist/components/ui/core/shimmer/shimmer.d.ts +3 -1
- package/dist/components/ui/core/shimmer/shimmer.js +89 -49
- package/dist/components/ui/core/tabs/tabs.js +3 -3
- package/dist/components/ui/core/textarea/textarea.js +1 -1
- package/dist/components/ui/core/toggle/toggle.d.ts +15 -0
- package/dist/components/ui/core/toggle/toggle.js +74 -0
- package/dist/components/ui/core/tool/tool.js +3 -3
- package/dist/index.d.ts +1 -1
- package/dist/lib/portal-container-context.js +3 -3
- package/dist/lib/use-controllable-state.js +17 -17
- package/dist/lib/utils.d.ts +1 -1
- package/dist/lib/utils.js +7 -7
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +3 -0
- package/package.json +200 -18
- package/dist/index.js +0 -308
package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js
CHANGED
|
@@ -1,190 +1,175 @@
|
|
|
1
|
-
import { jsx as e, jsxs as
|
|
2
|
-
import { useMemo as
|
|
3
|
-
import { cn as
|
|
4
|
-
import { Button as
|
|
5
|
-
import { Popover as
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
const He = ({
|
|
1
|
+
import { jsx as e, jsxs as o } from "react/jsx-runtime";
|
|
2
|
+
import { useMemo as te } from "react";
|
|
3
|
+
import { cn as ne } from "../../../../../lib/utils.js";
|
|
4
|
+
import { Button as p } from "../../button/button.js";
|
|
5
|
+
import { Popover as re, PopoverTrigger as ae, PopoverContent as oe } from "../../popover/popover.js";
|
|
6
|
+
import { Calendar as le } from "../shared/calendar/calendar.js";
|
|
7
|
+
import { DateTimeInput as ie } from "../shared/date-time-input/date-time-input.js";
|
|
8
|
+
import { ShortcutsPanel as de } from "../shared/shortcuts-panel/shortcuts-panel.js";
|
|
9
|
+
import { TimePickerPanel as k } from "../shared/time-picker-panel/time-picker-panel.js";
|
|
10
|
+
import { convert12HourTo24Hour as b } from "../utils/time-utils.js";
|
|
11
|
+
import { useDateTimeRangePicker as ce } from "./use-date-time-range-picker.js";
|
|
12
|
+
const be = ({
|
|
14
13
|
value: x,
|
|
15
|
-
onChange:
|
|
16
|
-
format:
|
|
17
|
-
placeholder:
|
|
18
|
-
displayWeekNumber:
|
|
14
|
+
onChange: H,
|
|
15
|
+
format: M = "DD/MM/YYYY HH:mm",
|
|
16
|
+
placeholder: D,
|
|
17
|
+
displayWeekNumber: S = !1,
|
|
19
18
|
shortcuts: c,
|
|
20
|
-
timeFormat:
|
|
21
|
-
defaultDate:
|
|
22
|
-
className:
|
|
19
|
+
timeFormat: n = "24h",
|
|
20
|
+
defaultDate: A,
|
|
21
|
+
className: N
|
|
23
22
|
}) => {
|
|
24
23
|
const {
|
|
25
24
|
isOpen: l,
|
|
26
|
-
step:
|
|
27
|
-
displayedMonth:
|
|
28
|
-
tempStart:
|
|
29
|
-
tempEnd:
|
|
30
|
-
hoverDate:
|
|
25
|
+
step: t,
|
|
26
|
+
displayedMonth: T,
|
|
27
|
+
tempStart: r,
|
|
28
|
+
tempEnd: a,
|
|
29
|
+
hoverDate: y,
|
|
31
30
|
tempStartHour: i,
|
|
32
|
-
tempStartMinute:
|
|
31
|
+
tempStartMinute: m,
|
|
33
32
|
tempEndHour: d,
|
|
34
33
|
tempEndMinute: h,
|
|
35
|
-
startAmPm:
|
|
36
|
-
endAmPm:
|
|
37
|
-
|
|
38
|
-
handleSetStep:
|
|
39
|
-
handleDateClick:
|
|
34
|
+
startAmPm: s,
|
|
35
|
+
endAmPm: u,
|
|
36
|
+
handleOpenChange: f,
|
|
37
|
+
handleSetStep: R,
|
|
38
|
+
handleDateClick: E,
|
|
40
39
|
handleMonthChange: w,
|
|
41
|
-
handleDateHover:
|
|
42
|
-
handleStartHourChange:
|
|
43
|
-
handleStartMinuteChange:
|
|
44
|
-
handleEndHourChange:
|
|
45
|
-
handleEndMinuteChange:
|
|
46
|
-
handleStartAmPmChange:
|
|
47
|
-
handleEndAmPmChange:
|
|
48
|
-
handleNext:
|
|
49
|
-
handleApply:
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
} = me({
|
|
40
|
+
handleDateHover: Y,
|
|
41
|
+
handleStartHourChange: j,
|
|
42
|
+
handleStartMinuteChange: B,
|
|
43
|
+
handleEndHourChange: O,
|
|
44
|
+
handleEndMinuteChange: W,
|
|
45
|
+
handleStartAmPmChange: I,
|
|
46
|
+
handleEndAmPmChange: L,
|
|
47
|
+
handleNext: V,
|
|
48
|
+
handleApply: q,
|
|
49
|
+
handleBack: z,
|
|
50
|
+
handleApplyShortcut: G,
|
|
51
|
+
popoverRef: J,
|
|
52
|
+
inputRef: K
|
|
53
|
+
} = ce({
|
|
56
54
|
value: x,
|
|
57
|
-
onChange:
|
|
58
|
-
timeFormat:
|
|
59
|
-
defaultDate:
|
|
60
|
-
}),
|
|
61
|
-
const
|
|
62
|
-
|
|
63
|
-
).minute(
|
|
64
|
-
|
|
55
|
+
onChange: H,
|
|
56
|
+
timeFormat: n,
|
|
57
|
+
defaultDate: A
|
|
58
|
+
}), Q = t === "start" ? r !== null : a !== null, U = t === "start" ? "Next" : "Apply", X = t === "start" ? V : q, g = t === "start" ? i : d, v = t === "start" ? m : h, Z = t === "start" ? s : u, C = t === "start" ? j : O, P = t === "start" ? B : W, _ = t === "start" ? I : L, $ = te(() => {
|
|
59
|
+
const F = r ? r.hour(
|
|
60
|
+
n === "12h" ? b(i, s) : i
|
|
61
|
+
).minute(m) : null, ee = a ? a.hour(
|
|
62
|
+
n === "12h" ? b(d, u) : d
|
|
65
63
|
).minute(h) : null;
|
|
66
|
-
return [
|
|
64
|
+
return [F, ee];
|
|
67
65
|
}, [
|
|
66
|
+
r,
|
|
68
67
|
a,
|
|
69
|
-
o,
|
|
70
68
|
i,
|
|
71
|
-
|
|
69
|
+
m,
|
|
72
70
|
d,
|
|
73
71
|
h,
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
72
|
+
s,
|
|
73
|
+
u,
|
|
74
|
+
n
|
|
77
75
|
]);
|
|
78
76
|
return /* @__PURE__ */ e(
|
|
79
77
|
"div",
|
|
80
78
|
{
|
|
81
79
|
"data-slot": "date-time-range-picker",
|
|
82
|
-
className:
|
|
83
|
-
children: /* @__PURE__ */
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
ie,
|
|
80
|
+
className: ne("relative w-full", N),
|
|
81
|
+
children: /* @__PURE__ */ o(re, { open: l, onOpenChange: f, children: [
|
|
82
|
+
/* @__PURE__ */ e(ae, { render: /* @__PURE__ */ e("div", { ref: K, className: "w-full" }), children: /* @__PURE__ */ e(
|
|
83
|
+
ie,
|
|
84
|
+
{
|
|
85
|
+
value: $,
|
|
86
|
+
format: M,
|
|
87
|
+
placeholder: D,
|
|
88
|
+
isOpen: l,
|
|
89
|
+
variant: "datetime",
|
|
90
|
+
activeRangePart: l ? t : void 0,
|
|
91
|
+
onRangePartClick: l ? R : void 0
|
|
92
|
+
}
|
|
93
|
+
) }),
|
|
94
|
+
/* @__PURE__ */ e(
|
|
95
|
+
oe,
|
|
96
|
+
{
|
|
97
|
+
ref: J,
|
|
98
|
+
className: "rounded-xl w-auto p-0",
|
|
99
|
+
side: "bottom",
|
|
100
|
+
align: "start",
|
|
101
|
+
children: /* @__PURE__ */ o(
|
|
102
|
+
"div",
|
|
106
103
|
{
|
|
107
|
-
|
|
108
|
-
className: "
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
{
|
|
169
|
-
variant: "secondary",
|
|
170
|
-
onClick: Q,
|
|
171
|
-
disabled: !J,
|
|
172
|
-
children: K
|
|
173
|
-
}
|
|
174
|
-
)
|
|
175
|
-
] })
|
|
176
|
-
] })
|
|
177
|
-
]
|
|
178
|
-
}
|
|
179
|
-
)
|
|
104
|
+
"data-slot": "date-time-range-picker-content",
|
|
105
|
+
className: "flex flex-col",
|
|
106
|
+
children: [
|
|
107
|
+
/* @__PURE__ */ o("div", { className: "flex flex-row", children: [
|
|
108
|
+
c && c.length > 0 && /* @__PURE__ */ e(
|
|
109
|
+
de,
|
|
110
|
+
{
|
|
111
|
+
shortcuts: c,
|
|
112
|
+
onShortcutClick: G
|
|
113
|
+
}
|
|
114
|
+
),
|
|
115
|
+
/* @__PURE__ */ e("div", { className: "p-3 border-r border-border", children: /* @__PURE__ */ e(
|
|
116
|
+
le,
|
|
117
|
+
{
|
|
118
|
+
displayedMonth: T,
|
|
119
|
+
selectedRange: [r, a],
|
|
120
|
+
hoverDate: t === "end" ? y : null,
|
|
121
|
+
displayWeekNumber: S,
|
|
122
|
+
onDateClick: E,
|
|
123
|
+
onMonthChange: w,
|
|
124
|
+
onDateHover: Y
|
|
125
|
+
}
|
|
126
|
+
) }),
|
|
127
|
+
n === "12h" ? /* @__PURE__ */ e(
|
|
128
|
+
k,
|
|
129
|
+
{
|
|
130
|
+
hour: g,
|
|
131
|
+
minute: v,
|
|
132
|
+
amPm: Z,
|
|
133
|
+
timeFormat: "12h",
|
|
134
|
+
onHourChange: C,
|
|
135
|
+
onMinuteChange: P,
|
|
136
|
+
onAmPmChange: _
|
|
137
|
+
}
|
|
138
|
+
) : /* @__PURE__ */ e(
|
|
139
|
+
k,
|
|
140
|
+
{
|
|
141
|
+
hour: g,
|
|
142
|
+
minute: v,
|
|
143
|
+
timeFormat: "24h",
|
|
144
|
+
onHourChange: C,
|
|
145
|
+
onMinuteChange: P
|
|
146
|
+
}
|
|
147
|
+
)
|
|
148
|
+
] }),
|
|
149
|
+
/* @__PURE__ */ o("div", { className: "flex p-2 justify-between items-center self-stretch border-t border-border", children: [
|
|
150
|
+
/* @__PURE__ */ e(p, { variant: "ghost", onClick: () => f(!1), children: "Cancel" }),
|
|
151
|
+
/* @__PURE__ */ o("div", { className: "flex gap-2", children: [
|
|
152
|
+
t === "end" && /* @__PURE__ */ e(p, { variant: "ghost", onClick: z, children: "Back" }),
|
|
153
|
+
/* @__PURE__ */ e(
|
|
154
|
+
p,
|
|
155
|
+
{
|
|
156
|
+
variant: "secondary",
|
|
157
|
+
onClick: X,
|
|
158
|
+
disabled: !Q,
|
|
159
|
+
children: U
|
|
160
|
+
}
|
|
161
|
+
)
|
|
162
|
+
] })
|
|
163
|
+
] })
|
|
164
|
+
]
|
|
180
165
|
}
|
|
181
166
|
)
|
|
182
|
-
|
|
183
|
-
|
|
184
|
-
)
|
|
167
|
+
}
|
|
168
|
+
)
|
|
169
|
+
] })
|
|
185
170
|
}
|
|
186
171
|
);
|
|
187
172
|
};
|
|
188
173
|
export {
|
|
189
|
-
|
|
174
|
+
be as DateTimeRangePicker
|
|
190
175
|
};
|
|
@@ -21,7 +21,7 @@ export interface UseDateTimeRangePickerReturn {
|
|
|
21
21
|
tempEndMinute: number;
|
|
22
22
|
startAmPm: 'AM' | 'PM';
|
|
23
23
|
endAmPm: 'AM' | 'PM';
|
|
24
|
-
|
|
24
|
+
handleOpenChange: (open: boolean) => void;
|
|
25
25
|
handleSetStep: (step: RangeSelectionStep) => void;
|
|
26
26
|
handleDateClick: (date: Dayjs) => void;
|
|
27
27
|
handleMonthChange: (month: Dayjs) => void;
|
|
@@ -34,7 +34,6 @@ export interface UseDateTimeRangePickerReturn {
|
|
|
34
34
|
handleEndAmPmChange: (value: 'AM' | 'PM') => void;
|
|
35
35
|
handleNext: () => void;
|
|
36
36
|
handleApply: () => void;
|
|
37
|
-
handleCancel: () => void;
|
|
38
37
|
handleBack: () => void;
|
|
39
38
|
handleApplyShortcut: (range: Dayjs | [Dayjs, Dayjs] | [Dayjs | null, Dayjs | null]) => void;
|
|
40
39
|
popoverRef: React.RefObject<HTMLDivElement>;
|
|
@@ -1,161 +1,148 @@
|
|
|
1
|
-
import { useRef as
|
|
2
|
-
import
|
|
3
|
-
import { DEFAULT_MINUTE as
|
|
4
|
-
import { usePopoverState as
|
|
5
|
-
import { useRangeDateState as
|
|
6
|
-
import { useRangeStepManager as
|
|
7
|
-
import { useTimeState as
|
|
8
|
-
function
|
|
9
|
-
return
|
|
1
|
+
import { useRef as mt, useCallback as n, useEffect as ut } from "react";
|
|
2
|
+
import ht from "dayjs";
|
|
3
|
+
import { DEFAULT_MINUTE as f, START_OF_DAY_HOUR as S, END_OF_DAY_MINUTE as A, END_OF_DAY_HOUR as D } from "../shared/constants.js";
|
|
4
|
+
import { usePopoverState as ct } from "../shared/hooks/use-popover-state.js";
|
|
5
|
+
import { useRangeDateState as dt } from "../shared/hooks/use-range-date-state.js";
|
|
6
|
+
import { useRangeStepManager as lt } from "../shared/hooks/use-range-step-manager.js";
|
|
7
|
+
import { useTimeState as _ } from "../shared/hooks/use-time-state.js";
|
|
8
|
+
function pt(e) {
|
|
9
|
+
return e.hour(S).minute(f);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
return
|
|
11
|
+
function ft(e) {
|
|
12
|
+
return e.hour(D).minute(A);
|
|
13
13
|
}
|
|
14
|
-
const
|
|
15
|
-
value:
|
|
14
|
+
const gt = ({
|
|
15
|
+
value: e,
|
|
16
16
|
onChange: r,
|
|
17
17
|
timeFormat: M = "24h",
|
|
18
|
-
defaultDate:
|
|
18
|
+
defaultDate: y = ht()
|
|
19
19
|
}) => {
|
|
20
|
-
const
|
|
21
|
-
}),
|
|
22
|
-
}), {
|
|
23
|
-
isOpen: h,
|
|
24
|
-
setIsOpen: o,
|
|
25
|
-
popoverRef: w,
|
|
26
|
-
inputRef: x,
|
|
27
|
-
handleTogglePopover: H
|
|
28
|
-
} = pe({
|
|
29
|
-
onClose: n(() => C.current(), []),
|
|
20
|
+
const E = mt(() => {
|
|
21
|
+
}), { isOpen: B, setIsOpen: s, popoverRef: N, inputRef: U } = ct({
|
|
30
22
|
onBackspace: n(() => E.current(), [])
|
|
31
|
-
}),
|
|
32
|
-
value:
|
|
33
|
-
defaultDate:
|
|
34
|
-
mapDate: (
|
|
23
|
+
}), F = lt(), { step: i, handleNext: h, handleBack: a, resetStep: H } = F, I = dt({
|
|
24
|
+
value: e,
|
|
25
|
+
defaultDate: y,
|
|
26
|
+
mapDate: (t, o) => o === "start" ? pt(t) : ft(t)
|
|
35
27
|
}), {
|
|
36
|
-
tempStart:
|
|
37
|
-
tempEnd:
|
|
38
|
-
displayedMonth:
|
|
39
|
-
hoverDate:
|
|
40
|
-
stateRef:
|
|
41
|
-
handleDateClick:
|
|
42
|
-
handleDateHover:
|
|
43
|
-
handleMonthChange:
|
|
44
|
-
clearActiveSegment:
|
|
45
|
-
resetDates:
|
|
46
|
-
} =
|
|
47
|
-
initialHour:
|
|
48
|
-
initialMinute:
|
|
28
|
+
tempStart: Y,
|
|
29
|
+
tempEnd: w,
|
|
30
|
+
displayedMonth: x,
|
|
31
|
+
hoverDate: b,
|
|
32
|
+
stateRef: m,
|
|
33
|
+
handleDateClick: T,
|
|
34
|
+
handleDateHover: j,
|
|
35
|
+
handleMonthChange: L,
|
|
36
|
+
clearActiveSegment: g,
|
|
37
|
+
resetDates: u
|
|
38
|
+
} = I, q = _({
|
|
39
|
+
initialHour: e[0]?.hour() ?? S,
|
|
40
|
+
initialMinute: e[0]?.minute() ?? f,
|
|
49
41
|
timeFormat: M
|
|
50
42
|
}), {
|
|
51
|
-
hour:
|
|
52
|
-
minute:
|
|
53
|
-
amPm:
|
|
54
|
-
hour24:
|
|
55
|
-
handleHourChange:
|
|
56
|
-
handleMinuteChange:
|
|
57
|
-
handleAmPmChange:
|
|
58
|
-
resetTime:
|
|
59
|
-
} =
|
|
60
|
-
initialHour:
|
|
61
|
-
initialMinute:
|
|
43
|
+
hour: z,
|
|
44
|
+
minute: c,
|
|
45
|
+
amPm: G,
|
|
46
|
+
hour24: C,
|
|
47
|
+
handleHourChange: J,
|
|
48
|
+
handleMinuteChange: K,
|
|
49
|
+
handleAmPmChange: Q,
|
|
50
|
+
resetTime: O
|
|
51
|
+
} = q, W = _({
|
|
52
|
+
initialHour: e[1]?.hour() ?? D,
|
|
53
|
+
initialMinute: e[1]?.minute() ?? A,
|
|
62
54
|
timeFormat: M
|
|
63
55
|
}), {
|
|
64
|
-
hour:
|
|
65
|
-
minute:
|
|
66
|
-
amPm:
|
|
67
|
-
hour24:
|
|
68
|
-
handleHourChange:
|
|
69
|
-
handleMinuteChange:
|
|
70
|
-
handleAmPmChange:
|
|
71
|
-
resetTime:
|
|
72
|
-
} =
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
),
|
|
77
|
-
|
|
78
|
-
|
|
56
|
+
hour: X,
|
|
57
|
+
minute: d,
|
|
58
|
+
amPm: Z,
|
|
59
|
+
hour24: k,
|
|
60
|
+
handleHourChange: $,
|
|
61
|
+
handleMinuteChange: V,
|
|
62
|
+
handleAmPmChange: v,
|
|
63
|
+
resetTime: R
|
|
64
|
+
} = W, tt = n(() => {
|
|
65
|
+
u(e), H(), O(
|
|
66
|
+
e[0]?.hour() ?? S,
|
|
67
|
+
e[0]?.minute() ?? f
|
|
68
|
+
), R(
|
|
69
|
+
e[1]?.hour() ?? D,
|
|
70
|
+
e[1]?.minute() ?? A
|
|
79
71
|
);
|
|
80
|
-
}, [
|
|
81
|
-
const
|
|
82
|
-
|
|
83
|
-
}, [
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
}, [
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
(e) => {
|
|
93
|
-
e === "start" ? a() : d();
|
|
72
|
+
}, [e, u, H, O, R]), P = n(() => {
|
|
73
|
+
const t = g(i);
|
|
74
|
+
t === null ? a() : t[0] === null && t[1] === null && r(t);
|
|
75
|
+
}, [g, i, a, r]);
|
|
76
|
+
ut(() => {
|
|
77
|
+
E.current = P;
|
|
78
|
+
}, [P]);
|
|
79
|
+
const et = (t) => {
|
|
80
|
+
tt(), s(t);
|
|
81
|
+
}, nt = n(
|
|
82
|
+
(t) => {
|
|
83
|
+
t === "start" ? a() : h();
|
|
94
84
|
},
|
|
95
|
-
[a,
|
|
96
|
-
),
|
|
97
|
-
(
|
|
98
|
-
|
|
85
|
+
[a, h]
|
|
86
|
+
), rt = n(
|
|
87
|
+
(t) => {
|
|
88
|
+
T(t, i);
|
|
99
89
|
},
|
|
100
|
-
[
|
|
101
|
-
),
|
|
102
|
-
const { tempStart:
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
r(
|
|
90
|
+
[T, i]
|
|
91
|
+
), at = n(() => {
|
|
92
|
+
const { tempStart: t, tempEnd: o } = m.current;
|
|
93
|
+
if (t && o) {
|
|
94
|
+
const l = t.hour(C).minute(c).startOf("minute"), p = o.hour(k).minute(d).endOf("minute"), it = l.isAfter(p) ? [p, l] : [l, p];
|
|
95
|
+
r(it), s(!1);
|
|
106
96
|
}
|
|
107
97
|
}, [
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
98
|
+
m,
|
|
99
|
+
C,
|
|
100
|
+
c,
|
|
101
|
+
k,
|
|
102
|
+
d,
|
|
113
103
|
r,
|
|
114
|
-
|
|
115
|
-
]),
|
|
116
|
-
|
|
117
|
-
}, [
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
const i = Array.isArray(e) ? e : [e, e];
|
|
122
|
-
r(i), o(!1);
|
|
104
|
+
s
|
|
105
|
+
]), ot = n(() => {
|
|
106
|
+
a(), u([m.current.tempStart, null]);
|
|
107
|
+
}, [a, u, m]), st = n(
|
|
108
|
+
(t) => {
|
|
109
|
+
const o = Array.isArray(t) ? t : [t, t];
|
|
110
|
+
r(o), s(!1);
|
|
123
111
|
},
|
|
124
|
-
[r,
|
|
112
|
+
[r, s]
|
|
125
113
|
);
|
|
126
114
|
return {
|
|
127
|
-
isOpen:
|
|
128
|
-
step:
|
|
129
|
-
displayedMonth:
|
|
130
|
-
tempStart:
|
|
131
|
-
tempEnd:
|
|
132
|
-
hoverDate:
|
|
133
|
-
tempStartHour:
|
|
134
|
-
tempStartMinute:
|
|
135
|
-
tempEndHour:
|
|
136
|
-
tempEndMinute:
|
|
137
|
-
startAmPm:
|
|
138
|
-
endAmPm:
|
|
139
|
-
|
|
140
|
-
handleSetStep:
|
|
141
|
-
handleDateClick:
|
|
142
|
-
handleMonthChange:
|
|
143
|
-
handleDateHover:
|
|
144
|
-
handleStartHourChange:
|
|
145
|
-
handleStartMinuteChange:
|
|
146
|
-
handleEndHourChange:
|
|
147
|
-
handleEndMinuteChange:
|
|
148
|
-
handleStartAmPmChange:
|
|
149
|
-
handleEndAmPmChange:
|
|
150
|
-
handleNext:
|
|
151
|
-
handleApply:
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
inputRef: x
|
|
115
|
+
isOpen: B,
|
|
116
|
+
step: i,
|
|
117
|
+
displayedMonth: x,
|
|
118
|
+
tempStart: Y,
|
|
119
|
+
tempEnd: w,
|
|
120
|
+
hoverDate: b,
|
|
121
|
+
tempStartHour: z,
|
|
122
|
+
tempStartMinute: c,
|
|
123
|
+
tempEndHour: X,
|
|
124
|
+
tempEndMinute: d,
|
|
125
|
+
startAmPm: G,
|
|
126
|
+
endAmPm: Z,
|
|
127
|
+
handleOpenChange: et,
|
|
128
|
+
handleSetStep: nt,
|
|
129
|
+
handleDateClick: rt,
|
|
130
|
+
handleMonthChange: L,
|
|
131
|
+
handleDateHover: j,
|
|
132
|
+
handleStartHourChange: J,
|
|
133
|
+
handleStartMinuteChange: K,
|
|
134
|
+
handleEndHourChange: $,
|
|
135
|
+
handleEndMinuteChange: V,
|
|
136
|
+
handleStartAmPmChange: Q,
|
|
137
|
+
handleEndAmPmChange: v,
|
|
138
|
+
handleNext: h,
|
|
139
|
+
handleApply: at,
|
|
140
|
+
handleBack: ot,
|
|
141
|
+
handleApplyShortcut: st,
|
|
142
|
+
popoverRef: N,
|
|
143
|
+
inputRef: U
|
|
157
144
|
};
|
|
158
145
|
};
|
|
159
146
|
export {
|
|
160
|
-
|
|
147
|
+
gt as useDateTimeRangePicker
|
|
161
148
|
};
|
|
@@ -1,3 +1,7 @@
|
|
|
1
|
+
export { DatePicker } from './date-picker';
|
|
2
|
+
export type { DatePickerProps } from './date-picker';
|
|
3
|
+
export { TimePicker } from './time-picker';
|
|
4
|
+
export type { TimePickerProps } from './time-picker';
|
|
1
5
|
export { DateRangePicker } from './date-range-picker';
|
|
2
6
|
export type { DateRangePickerProps } from './date-range-picker';
|
|
3
7
|
export { DateTimeRangePicker } from './date-time-range-picker';
|