@cognite/aura 0.3.2 → 0.3.4
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 +134 -5
- package/README.md +24 -3
- package/dist/components/index.d.ts +5 -1
- package/dist/components/index.js +59 -327
- package/dist/components/ui/core/accordion/accordion.js +79 -114
- package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
- package/dist/components/ui/core/alert/alert.js +158 -206
- package/dist/components/ui/core/avatar/avatar.js +64 -90
- package/dist/components/ui/core/badge/badge.js +73 -108
- package/dist/components/ui/core/banner/banner.js +146 -215
- package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
- package/dist/components/ui/core/button/button.js +47 -52
- package/dist/components/ui/core/button-group/button-group.js +40 -79
- package/dist/components/ui/core/calendar/calendar-header.js +63 -0
- package/dist/components/ui/core/calendar/calendar-utils.js +39 -0
- package/dist/components/ui/core/calendar/calendar.js +68 -0
- package/dist/components/ui/core/calendar/constants.d.ts +1 -0
- package/dist/components/ui/core/card/card.js +102 -185
- package/dist/components/ui/core/chart/chart.js +116 -206
- package/dist/components/ui/core/chart/index.js +2 -8
- package/dist/components/ui/core/checkbox/checkbox.js +67 -132
- package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
- package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
- package/dist/components/ui/core/code-block/code-block.js +179 -267
- package/dist/components/ui/core/collapsible/collapsible.js +29 -49
- package/dist/components/ui/core/combobox/combobox.js +41 -0
- package/dist/components/ui/core/command/command.js +85 -150
- package/dist/components/ui/core/count/count.js +21 -32
- package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +10 -0
- package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +13 -0
- package/dist/components/ui/core/data-grid/data-grid-row.d.ts +18 -0
- package/dist/components/ui/core/data-grid/data-grid.d.ts +43 -0
- package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +12 -0
- package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +9 -0
- package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -72
- package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +2 -1
- package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -51
- package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -87
- package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +2 -1
- package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -68
- package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +1 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +36 -0
- package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -174
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +7 -6
- package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -145
- package/dist/components/ui/core/date-time-pickers/index.d.ts +3 -1
- package/dist/components/ui/core/date-time-pickers/index.js +6 -10
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +3 -2
- package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
- package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +3 -8
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
- package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -23
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
- package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +3 -2
- package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +3 -2
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +40 -40
- package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
- package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +78 -99
- package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +5 -4
- package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +41 -63
- package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +1 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +40 -0
- package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +3 -0
- package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +1 -0
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +3 -3
- package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
- package/dist/components/ui/core/dialog/dialog.js +82 -155
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +2 -2
- package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -248
- package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
- package/dist/components/ui/core/empty-state/empty-state.js +86 -138
- package/dist/components/ui/core/helper-text/helper-text.js +37 -65
- package/dist/components/ui/core/hover-card/hover-card.js +54 -80
- package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
- package/dist/components/ui/core/input/input.js +12 -27
- package/dist/components/ui/core/input-group/input-group.js +76 -173
- package/dist/components/ui/core/kbd/kbd.js +20 -36
- package/dist/components/ui/core/label/label.js +26 -43
- package/dist/components/ui/core/loader/loader.js +80 -117
- package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
- package/dist/components/ui/core/message/message.d.ts +2 -2
- package/dist/components/ui/core/message/message.js +316 -542
- package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +52 -0
- package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
- package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
- package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
- package/dist/components/ui/core/pagination/pagination.js +231 -334
- package/dist/components/ui/core/popover/popover.js +90 -157
- package/dist/components/ui/core/progress/progress.js +36 -61
- package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
- package/dist/components/ui/core/radio-group/radio-group.js +58 -113
- package/dist/components/ui/core/reasoning/reasoning.js +55 -86
- package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
- package/dist/components/ui/core/search/search.js +77 -99
- package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
- package/dist/components/ui/core/select/select.js +168 -293
- package/dist/components/ui/core/separator/separator.js +13 -23
- package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
- package/dist/components/ui/core/shimmer/shimmer.js +40 -107
- package/dist/components/ui/core/skeleton/skeleton.js +13 -18
- package/dist/components/ui/core/slider/slider.d.ts +9 -0
- package/dist/components/ui/core/slider/slider.js +40 -0
- package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
- package/dist/components/ui/core/sources/sources.d.ts +5 -1
- package/dist/components/ui/core/sources/sources.js +58 -79
- package/dist/components/ui/core/switch/switch.js +62 -0
- package/dist/components/ui/core/tabs/tabs.js +149 -223
- package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
- package/dist/components/ui/core/textarea/textarea.js +13 -27
- package/dist/components/ui/core/toggle/toggle.js +55 -74
- package/dist/components/ui/core/tool/tool.js +127 -163
- package/dist/components/ui/core/tooltip/tooltip.js +47 -86
- package/dist/components/ui/core/topbar/topbar.js +106 -190
- package/dist/eslint/index.js +5 -10
- package/dist/eslint/no-overriding-styles.js +178 -237
- package/dist/icons/index.d.ts +1 -0
- package/dist/icons/index.js +1 -0
- package/dist/index.d.ts +1 -1
- package/dist/lib/highlight-code.d.ts +9 -0
- package/dist/lib/highlight-code.js +42 -0
- package/dist/lib/portal-container-context.js +8 -9
- package/dist/lib/style-scope.js +6 -6
- package/dist/lib/use-controllable-state.js +21 -30
- package/dist/lib/utils.d.ts +0 -2
- package/dist/lib/utils.js +32 -112
- package/dist/styles.css +1 -1
- package/dist/styles.source.css +26 -0
- package/package.json +42 -8
- package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +0 -119
- package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +0 -93
- package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
- package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +0 -52
- /package/dist/components/ui/core/{date-time-pickers/shared/calendar-header → calendar}/calendar-header.d.ts +0 -0
- /package/dist/components/ui/core/{date-time-pickers/utils → calendar}/calendar-utils.d.ts +0 -0
- /package/dist/components/ui/core/{date-time-pickers/shared/calendar → calendar}/calendar.d.ts +0 -0
package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js
CHANGED
|
@@ -1,175 +1,119 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
7
|
-
import {
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
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
|
-
]
|
|
165
|
-
}
|
|
166
|
-
)
|
|
167
|
-
}
|
|
168
|
-
)
|
|
169
|
-
] })
|
|
170
|
-
}
|
|
171
|
-
);
|
|
172
|
-
};
|
|
173
|
-
export {
|
|
174
|
-
be as DateTimeRangePicker
|
|
1
|
+
import { cn as e } from "../../../../../lib/utils.js";
|
|
2
|
+
import { Button as t } from "../../button/button.js";
|
|
3
|
+
import { Popover as ee, PopoverContent as te, PopoverTrigger as n } from "../../popover/popover.js";
|
|
4
|
+
import { Calendar as r } from "../../calendar/calendar.js";
|
|
5
|
+
import { DateTimeInput as i } from "../shared/date-time-input/date-time-input.js";
|
|
6
|
+
import { ShortcutsPanel as a } from "../shared/shortcuts-panel/shortcuts-panel.js";
|
|
7
|
+
import { convert12HourTo24Hour as o } from "../utils/time-utils.js";
|
|
8
|
+
import { TimePickerPanel as s } from "../shared/time-picker-panel/time-picker-panel.js";
|
|
9
|
+
import { useDateTimeRangePicker as c } from "./use-date-time-range-picker.js";
|
|
10
|
+
import { useMemo as l } from "react";
|
|
11
|
+
import { jsx as u, jsxs as d } from "react/jsx-runtime";
|
|
12
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.tsx
|
|
13
|
+
var f = ({ value: f, onChange: p, format: m = "DD/MM/YYYY HH:mm", placeholder: h, displayWeekNumber: g = !1, shortcuts: _, timeFormat: v = "24h", defaultDate: ne, className: re }) => {
|
|
14
|
+
let { isOpen: y, step: b, displayedMonth: x, tempStart: S, tempEnd: C, hoverDate: w, tempStartHour: T, tempStartMinute: E, tempEndHour: D, tempEndMinute: O, startAmPm: k, endAmPm: A, handleOpenChange: j, handleSetStep: M, handleDateClick: N, handleMonthChange: P, handleDateHover: F, handleStartHourChange: ie, handleStartMinuteChange: I, handleEndHourChange: L, handleEndMinuteChange: R, handleStartAmPmChange: z, handleEndAmPmChange: B, handleNext: V, handleApply: H, handleBack: U, handleApplyShortcut: W, popoverRef: G, inputRef: K } = c({
|
|
15
|
+
value: f,
|
|
16
|
+
onChange: p,
|
|
17
|
+
timeFormat: v,
|
|
18
|
+
defaultDate: ne
|
|
19
|
+
}), q = b === "start" ? S !== null : C !== null, J = b === "start" ? "Next" : "Apply", Y = b === "start" ? V : H, X = b === "start" ? T : D, Z = b === "start" ? E : O, ae = b === "start" ? k : A, Q = b === "start" ? ie : L, $ = b === "start" ? I : R, oe = b === "start" ? z : B, se = l(() => [S ? S.hour(v === "12h" ? o(T, k) : T).minute(E) : null, C ? C.hour(v === "12h" ? o(D, A) : D).minute(O) : null], [
|
|
20
|
+
S,
|
|
21
|
+
C,
|
|
22
|
+
T,
|
|
23
|
+
E,
|
|
24
|
+
D,
|
|
25
|
+
O,
|
|
26
|
+
k,
|
|
27
|
+
A,
|
|
28
|
+
v
|
|
29
|
+
]);
|
|
30
|
+
return /* @__PURE__ */ u("div", {
|
|
31
|
+
"data-slot": "date-time-range-picker",
|
|
32
|
+
className: e("relative w-full", re),
|
|
33
|
+
children: /* @__PURE__ */ d(ee, {
|
|
34
|
+
open: y,
|
|
35
|
+
onOpenChange: j,
|
|
36
|
+
children: [/* @__PURE__ */ u(n, {
|
|
37
|
+
render: /* @__PURE__ */ u("div", {
|
|
38
|
+
ref: K,
|
|
39
|
+
className: "w-full"
|
|
40
|
+
}),
|
|
41
|
+
children: /* @__PURE__ */ u(i, {
|
|
42
|
+
value: se,
|
|
43
|
+
format: m,
|
|
44
|
+
placeholder: h,
|
|
45
|
+
isOpen: y,
|
|
46
|
+
variant: "datetime",
|
|
47
|
+
activeRangePart: y ? b : void 0,
|
|
48
|
+
onRangePartClick: y ? M : void 0
|
|
49
|
+
})
|
|
50
|
+
}), /* @__PURE__ */ u(te, {
|
|
51
|
+
ref: G,
|
|
52
|
+
className: "rounded-xl w-auto p-0",
|
|
53
|
+
side: "bottom",
|
|
54
|
+
align: "start",
|
|
55
|
+
children: /* @__PURE__ */ d("div", {
|
|
56
|
+
"data-slot": "date-time-range-picker-content",
|
|
57
|
+
className: "flex flex-col",
|
|
58
|
+
children: [/* @__PURE__ */ d("div", {
|
|
59
|
+
className: "flex flex-row",
|
|
60
|
+
children: [
|
|
61
|
+
_ && _.length > 0 && /* @__PURE__ */ u(a, {
|
|
62
|
+
shortcuts: _,
|
|
63
|
+
onShortcutClick: W
|
|
64
|
+
}),
|
|
65
|
+
/* @__PURE__ */ u("div", {
|
|
66
|
+
className: "p-3 border-r border-border",
|
|
67
|
+
children: /* @__PURE__ */ u(r, {
|
|
68
|
+
displayedMonth: x,
|
|
69
|
+
selectedRange: [S, C],
|
|
70
|
+
hoverDate: b === "end" ? w : null,
|
|
71
|
+
displayWeekNumber: g,
|
|
72
|
+
onDateClick: N,
|
|
73
|
+
onMonthChange: P,
|
|
74
|
+
onDateHover: F
|
|
75
|
+
})
|
|
76
|
+
}),
|
|
77
|
+
v === "12h" ? /* @__PURE__ */ u(s, {
|
|
78
|
+
hour: X,
|
|
79
|
+
minute: Z,
|
|
80
|
+
amPm: ae,
|
|
81
|
+
timeFormat: "12h",
|
|
82
|
+
onHourChange: Q,
|
|
83
|
+
onMinuteChange: $,
|
|
84
|
+
onAmPmChange: oe
|
|
85
|
+
}) : /* @__PURE__ */ u(s, {
|
|
86
|
+
hour: X,
|
|
87
|
+
minute: Z,
|
|
88
|
+
timeFormat: "24h",
|
|
89
|
+
onHourChange: Q,
|
|
90
|
+
onMinuteChange: $
|
|
91
|
+
})
|
|
92
|
+
]
|
|
93
|
+
}), /* @__PURE__ */ d("div", {
|
|
94
|
+
className: "flex p-2 justify-between items-center self-stretch border-t border-border",
|
|
95
|
+
children: [/* @__PURE__ */ u(t, {
|
|
96
|
+
variant: "ghost",
|
|
97
|
+
onClick: () => j(!1),
|
|
98
|
+
children: "Cancel"
|
|
99
|
+
}), /* @__PURE__ */ d("div", {
|
|
100
|
+
className: "flex gap-2",
|
|
101
|
+
children: [b === "end" && /* @__PURE__ */ u(t, {
|
|
102
|
+
variant: "ghost",
|
|
103
|
+
onClick: U,
|
|
104
|
+
children: "Back"
|
|
105
|
+
}), /* @__PURE__ */ u(t, {
|
|
106
|
+
variant: "secondary",
|
|
107
|
+
onClick: Y,
|
|
108
|
+
disabled: !q,
|
|
109
|
+
children: J
|
|
110
|
+
})]
|
|
111
|
+
})]
|
|
112
|
+
})]
|
|
113
|
+
})
|
|
114
|
+
})]
|
|
115
|
+
})
|
|
116
|
+
});
|
|
175
117
|
};
|
|
118
|
+
//#endregion
|
|
119
|
+
export { f as DateTimeRangePicker };
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Dayjs } from 'dayjs';
|
|
2
2
|
import { RangeSelectionStep } from '../shared/hooks/use-range-step-manager';
|
|
3
|
-
import {
|
|
3
|
+
import { ShortcutValueDayjs } from '../shared/shortcuts-panel/shortcuts-panel';
|
|
4
|
+
import { AmPm, TimeFormat } from '../utils/format-utils';
|
|
4
5
|
export type { RangeSelectionStep };
|
|
5
6
|
export interface UseDateTimeRangePickerProps {
|
|
6
7
|
value: [Dayjs | null, Dayjs | null];
|
|
@@ -19,8 +20,8 @@ export interface UseDateTimeRangePickerReturn {
|
|
|
19
20
|
tempStartMinute: number;
|
|
20
21
|
tempEndHour: number;
|
|
21
22
|
tempEndMinute: number;
|
|
22
|
-
startAmPm:
|
|
23
|
-
endAmPm:
|
|
23
|
+
startAmPm: AmPm;
|
|
24
|
+
endAmPm: AmPm;
|
|
24
25
|
handleOpenChange: (open: boolean) => void;
|
|
25
26
|
handleSetStep: (step: RangeSelectionStep) => void;
|
|
26
27
|
handleDateClick: (date: Dayjs) => void;
|
|
@@ -30,12 +31,12 @@ export interface UseDateTimeRangePickerReturn {
|
|
|
30
31
|
handleStartMinuteChange: (minute: number) => void;
|
|
31
32
|
handleEndHourChange: (hour: number) => void;
|
|
32
33
|
handleEndMinuteChange: (minute: number) => void;
|
|
33
|
-
handleStartAmPmChange: (value:
|
|
34
|
-
handleEndAmPmChange: (value:
|
|
34
|
+
handleStartAmPmChange: (value: AmPm) => void;
|
|
35
|
+
handleEndAmPmChange: (value: AmPm) => void;
|
|
35
36
|
handleNext: () => void;
|
|
36
37
|
handleApply: () => void;
|
|
37
38
|
handleBack: () => void;
|
|
38
|
-
handleApplyShortcut: (range:
|
|
39
|
+
handleApplyShortcut: (range: ShortcutValueDayjs) => void;
|
|
39
40
|
popoverRef: React.RefObject<HTMLDivElement>;
|
|
40
41
|
inputRef: React.RefObject<HTMLDivElement>;
|
|
41
42
|
}
|
|
@@ -1,148 +1,107 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import
|
|
7
|
-
|
|
8
|
-
function
|
|
9
|
-
|
|
1
|
+
import { usePopoverState as e } from "../shared/hooks/use-popover-state.js";
|
|
2
|
+
import { useTimeState as t } from "../shared/hooks/use-time-state.js";
|
|
3
|
+
import { useRangeDateState as n } from "../shared/hooks/use-range-date-state.js";
|
|
4
|
+
import { useRangeStepManager as r } from "../shared/hooks/use-range-step-manager.js";
|
|
5
|
+
import { useCallback as i, useEffect as a, useRef as o } from "react";
|
|
6
|
+
import s from "dayjs";
|
|
7
|
+
//#region libs/aura/src/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.ts
|
|
8
|
+
function c(e) {
|
|
9
|
+
return e.hour(0).minute(0);
|
|
10
10
|
}
|
|
11
|
-
function
|
|
12
|
-
|
|
11
|
+
function l(e) {
|
|
12
|
+
return e.hour(23).minute(59);
|
|
13
13
|
}
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
})
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
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);
|
|
111
|
-
},
|
|
112
|
-
[r, s]
|
|
113
|
-
);
|
|
114
|
-
return {
|
|
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
|
|
144
|
-
};
|
|
145
|
-
};
|
|
146
|
-
export {
|
|
147
|
-
gt as useDateTimeRangePicker
|
|
14
|
+
var u = ({ value: u, onChange: d, timeFormat: f = "24h", defaultDate: p = s() }) => {
|
|
15
|
+
let m = o(() => {}), { isOpen: h, setIsOpen: g, popoverRef: _, inputRef: v } = e({ onBackspace: i(() => m.current(), []) }), { step: y, handleNext: b, handleBack: x, resetStep: S } = r(), { tempStart: C, tempEnd: w, displayedMonth: T, hoverDate: E, stateRef: D, handleDateClick: O, handleDateHover: k, handleMonthChange: A, clearActiveSegment: j, resetDates: M } = n({
|
|
16
|
+
value: u,
|
|
17
|
+
defaultDate: p,
|
|
18
|
+
mapDate: (e, t) => t === "start" ? c(e) : l(e)
|
|
19
|
+
}), { hour: N, minute: P, amPm: F, hour24: I, handleHourChange: L, handleMinuteChange: R, handleAmPmChange: z, resetTime: B } = t({
|
|
20
|
+
initialHour: u[0]?.hour() ?? 0,
|
|
21
|
+
initialMinute: u[0]?.minute() ?? 0,
|
|
22
|
+
timeFormat: f
|
|
23
|
+
}), { hour: V, minute: H, amPm: U, hour24: W, handleHourChange: G, handleMinuteChange: K, handleAmPmChange: q, resetTime: J } = t({
|
|
24
|
+
initialHour: u[1]?.hour() ?? 23,
|
|
25
|
+
initialMinute: u[1]?.minute() ?? 59,
|
|
26
|
+
timeFormat: f
|
|
27
|
+
}), Y = i(() => {
|
|
28
|
+
M(u), S(), B(u[0]?.hour() ?? 0, u[0]?.minute() ?? 0), J(u[1]?.hour() ?? 23, u[1]?.minute() ?? 59);
|
|
29
|
+
}, [
|
|
30
|
+
u,
|
|
31
|
+
M,
|
|
32
|
+
S,
|
|
33
|
+
B,
|
|
34
|
+
J
|
|
35
|
+
]), X = i(() => {
|
|
36
|
+
let e = j(y);
|
|
37
|
+
e === null ? x() : e[0] === null && e[1] === null && d(e);
|
|
38
|
+
}, [
|
|
39
|
+
j,
|
|
40
|
+
y,
|
|
41
|
+
x,
|
|
42
|
+
d
|
|
43
|
+
]);
|
|
44
|
+
return a(() => {
|
|
45
|
+
m.current = X;
|
|
46
|
+
}, [X]), {
|
|
47
|
+
isOpen: h,
|
|
48
|
+
step: y,
|
|
49
|
+
displayedMonth: T,
|
|
50
|
+
tempStart: C,
|
|
51
|
+
tempEnd: w,
|
|
52
|
+
hoverDate: E,
|
|
53
|
+
tempStartHour: N,
|
|
54
|
+
tempStartMinute: P,
|
|
55
|
+
tempEndHour: V,
|
|
56
|
+
tempEndMinute: H,
|
|
57
|
+
startAmPm: F,
|
|
58
|
+
endAmPm: U,
|
|
59
|
+
handleOpenChange: (e) => {
|
|
60
|
+
Y(), g(e);
|
|
61
|
+
},
|
|
62
|
+
handleSetStep: i((e) => {
|
|
63
|
+
e === "start" ? x() : b();
|
|
64
|
+
}, [x, b]),
|
|
65
|
+
handleDateClick: i((e) => {
|
|
66
|
+
O(e, y);
|
|
67
|
+
}, [O, y]),
|
|
68
|
+
handleMonthChange: A,
|
|
69
|
+
handleDateHover: k,
|
|
70
|
+
handleStartHourChange: L,
|
|
71
|
+
handleStartMinuteChange: R,
|
|
72
|
+
handleEndHourChange: G,
|
|
73
|
+
handleEndMinuteChange: K,
|
|
74
|
+
handleStartAmPmChange: z,
|
|
75
|
+
handleEndAmPmChange: q,
|
|
76
|
+
handleNext: b,
|
|
77
|
+
handleApply: i(() => {
|
|
78
|
+
let { tempStart: e, tempEnd: t } = D.current;
|
|
79
|
+
if (e && t) {
|
|
80
|
+
let n = e.hour(I).minute(P).startOf("minute"), r = t.hour(W).minute(H).endOf("minute");
|
|
81
|
+
d(n.isAfter(r) ? [r, n] : [n, r]), g(!1);
|
|
82
|
+
}
|
|
83
|
+
}, [
|
|
84
|
+
D,
|
|
85
|
+
I,
|
|
86
|
+
P,
|
|
87
|
+
W,
|
|
88
|
+
H,
|
|
89
|
+
d,
|
|
90
|
+
g
|
|
91
|
+
]),
|
|
92
|
+
handleBack: i(() => {
|
|
93
|
+
x(), M([D.current.tempStart, null]);
|
|
94
|
+
}, [
|
|
95
|
+
x,
|
|
96
|
+
M,
|
|
97
|
+
D
|
|
98
|
+
]),
|
|
99
|
+
handleApplyShortcut: i((e) => {
|
|
100
|
+
d(Array.isArray(e) ? e : [e, e]), g(!1);
|
|
101
|
+
}, [d, g]),
|
|
102
|
+
popoverRef: _,
|
|
103
|
+
inputRef: v
|
|
104
|
+
};
|
|
148
105
|
};
|
|
106
|
+
//#endregion
|
|
107
|
+
export { u as useDateTimeRangePicker };
|
|
@@ -7,4 +7,6 @@ export type { DateRangePickerProps } from './date-range-picker';
|
|
|
7
7
|
export { DateTimeRangePicker } from './date-time-range-picker';
|
|
8
8
|
export type { DateTimeRangePickerProps } from './date-time-range-picker';
|
|
9
9
|
export type { ShortcutItem } from './date-time-range-picker';
|
|
10
|
-
export type { TimeFormat } from './utils/format-utils';
|
|
10
|
+
export type { AmPm, TimeFormat } from './utils/format-utils';
|
|
11
|
+
export { Calendar } from '../calendar/calendar';
|
|
12
|
+
export type { CalendarProps } from '../calendar/calendar';
|
|
@@ -1,10 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
i as DateRangePicker,
|
|
8
|
-
a as DateTimeRangePicker,
|
|
9
|
-
f as TimePicker
|
|
10
|
-
};
|
|
1
|
+
import { Calendar as e } from "../calendar/calendar.js";
|
|
2
|
+
import { DatePicker as t } from "./date-picker/date-picker.js";
|
|
3
|
+
import { TimePicker as n } from "./time-picker/time-picker.js";
|
|
4
|
+
import { DateRangePicker as r } from "./date-range-picker/date-range-picker.js";
|
|
5
|
+
import { DateTimeRangePicker as i } from "./date-time-range-picker/date-time-range-picker.js";
|
|
6
|
+
export { e as Calendar, t as DatePicker, r as DateRangePicker, i as DateTimeRangePicker, n as TimePicker };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { FC } from 'react';
|
|
2
|
+
import { AmPm } from '../../utils/format-utils';
|
|
2
3
|
export type AmPmScrollProps = {
|
|
3
|
-
value:
|
|
4
|
-
onChange: (value:
|
|
4
|
+
value: AmPm | null;
|
|
5
|
+
onChange: (value: AmPm) => void;
|
|
5
6
|
className?: string;
|
|
6
7
|
};
|
|
7
8
|
export declare const AmPmScroll: FC<AmPmScrollProps>;
|