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