@cognite/aura 0.3.1 → 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 (34) hide show
  1. package/DESIGN.md +1517 -2
  2. package/README.md +21 -0
  3. package/dist/components/index.d.ts +2 -2
  4. package/dist/components/index.js +37 -35
  5. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +64 -75
  6. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +1 -2
  7. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +38 -49
  8. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +64 -75
  9. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +1 -2
  10. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +51 -64
  11. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +146 -161
  12. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +1 -2
  13. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +124 -137
  14. package/dist/components/ui/core/date-time-pickers/index.d.ts +2 -0
  15. package/dist/components/ui/core/date-time-pickers/index.js +6 -4
  16. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +8 -8
  17. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.d.ts +1 -1
  18. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +1 -1
  19. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.d.ts +0 -2
  20. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +18 -34
  21. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/index.d.ts +2 -0
  22. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +19 -0
  23. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +41 -0
  24. package/dist/components/ui/core/date-time-pickers/time-picker/index.d.ts +3 -0
  25. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.d.ts +16 -0
  26. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +100 -0
  27. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +23 -0
  28. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.d.ts +3 -0
  29. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +64 -0
  30. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +17 -15
  31. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +83 -85
  32. package/dist/lib/use-controllable-state.js +17 -17
  33. package/dist/styles.css +1 -1
  34. package/package.json +1 -1
@@ -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,5 +1,7 @@
1
1
  export { DatePicker } from './date-picker';
2
2
  export type { DatePickerProps } from './date-picker';
3
+ export { TimePicker } from './time-picker';
4
+ export type { TimePickerProps } from './time-picker';
3
5
  export { DateRangePicker } from './date-range-picker';
4
6
  export type { DateRangePickerProps } from './date-range-picker';
5
7
  export { DateTimeRangePicker } from './date-time-range-picker';
@@ -1,8 +1,10 @@
1
1
  import { DatePicker as o } from "./date-picker/date-picker.js";
2
- import { DateRangePicker as a } from "./date-range-picker/date-range-picker.js";
3
- import { DateTimeRangePicker as m } from "./date-time-range-picker/date-time-range-picker.js";
2
+ import { DateRangePicker as i } from "./date-range-picker/date-range-picker.js";
3
+ import { DateTimeRangePicker as a } from "./date-time-range-picker/date-time-range-picker.js";
4
+ import { TimePicker as f } from "./time-picker/time-picker.js";
4
5
  export {
5
6
  o as DatePicker,
6
- a as DateRangePicker,
7
- m as DateTimeRangePicker
7
+ i as DateRangePicker,
8
+ a as DateTimeRangePicker,
9
+ f as TimePicker
8
10
  };
@@ -1,10 +1,10 @@
1
1
  import { jsxs as x, jsx as l } from "react/jsx-runtime";
2
2
  import C from "react";
3
3
  import { cn as b } from "../../../../../../lib/utils.js";
4
- import { getCalendarDays as _, getWeekdayNames as E, getWeekNumbers as O, isDateInRange as v, isSameDay as f, isToday as T, isOutsideMonth as B } from "../../utils/calendar-utils.js";
5
- import { CalendarHeader as K } from "../calendar-header/calendar-header.js";
4
+ import { getCalendarDays as E, getWeekdayNames as O, getWeekNumbers as T, isDateInRange as v, isSameDay as f, isToday as B, isOutsideMonth as K } from "../../utils/calendar-utils.js";
5
+ import { CalendarHeader as P } from "../calendar-header/calendar-header.js";
6
6
  import { DAYS_IN_WEEK as p } from "../constants.js";
7
- function P({
7
+ function _({
8
8
  isOutsideMonth: r,
9
9
  isSelected: t,
10
10
  isToday: s,
@@ -42,14 +42,14 @@ const W = ({
42
42
  onDateHover: i,
43
43
  className: N
44
44
  }) => {
45
- const [n, m] = t, h = _(r), M = E(), k = o ? O(h) : [], Y = () => {
45
+ const [n, m] = t, h = E(r), M = O(), k = o ? T(h) : [], Y = () => {
46
46
  a(r.subtract(1, "month"));
47
47
  }, D = () => {
48
48
  a(r.add(1, "month"));
49
49
  }, w = (e) => {
50
50
  const d = {
51
- isOutsideMonth: B(e, r),
52
- isToday: T(e),
51
+ isOutsideMonth: K(e, r),
52
+ isToday: B(e),
53
53
  isSelected: f(e, n) || f(e, m),
54
54
  isRangeStart: f(e, n),
55
55
  isRangeEnd: f(e, m),
@@ -64,7 +64,7 @@ const W = ({
64
64
  };
65
65
  return /* @__PURE__ */ x("div", { "data-slot": "calendar", className: b("flex flex-col gap-4", N), children: [
66
66
  /* @__PURE__ */ l(
67
- K,
67
+ P,
68
68
  {
69
69
  displayedMonth: r,
70
70
  onPrevMonth: Y,
@@ -96,7 +96,7 @@ const W = ({
96
96
  /* @__PURE__ */ l(
97
97
  "div",
98
98
  {
99
- className: P(u),
99
+ className: _(u),
100
100
  onClick: () => c(e),
101
101
  onMouseEnter: () => i?.(e),
102
102
  onMouseLeave: () => i?.(null),
@@ -7,7 +7,7 @@ export interface DateTimeInputProps {
7
7
  value: [Dayjs | null, Dayjs | null] | Dayjs | null;
8
8
  format: string;
9
9
  placeholder?: string;
10
- onClick: () => void;
10
+ onClick?: () => void;
11
11
  isOpen: boolean;
12
12
  className?: string;
13
13
  ariaLabel?: string;
@@ -37,11 +37,11 @@ const v = "Date picker", C = () => {
37
37
  "relative flex items-center cursor-pointer w-full group",
38
38
  i
39
39
  ),
40
- onClick: n,
41
40
  role: "combobox",
42
41
  "aria-label": l,
43
42
  "aria-expanded": t,
44
43
  "aria-controls": c,
44
+ onClick: n,
45
45
  children: [
46
46
  /* @__PURE__ */ r(
47
47
  R,
@@ -1,5 +1,4 @@
1
1
  export interface UsePopoverStateOptions {
2
- onClose?: () => void;
3
2
  onBackspace?: () => void;
4
3
  }
5
4
  export interface UsePopoverStateReturn {
@@ -7,6 +6,5 @@ export interface UsePopoverStateReturn {
7
6
  setIsOpen: (isOpen: boolean) => void;
8
7
  popoverRef: React.RefObject<HTMLDivElement>;
9
8
  inputRef: React.RefObject<HTMLDivElement>;
10
- handleTogglePopover: () => void;
11
9
  }
12
10
  export declare const usePopoverState: (options?: UsePopoverStateOptions) => UsePopoverStateReturn;
@@ -1,40 +1,24 @@
1
- import { useState as I, useRef as f, useCallback as L, useEffect as T } from "react";
2
- const g = (p = {}) => {
3
- const { onClose: s, onBackspace: c } = p, [a, n] = I(!1), i = f(null), r = f(null), m = L(() => {
4
- n((o) => !o);
5
- }, []);
6
- return T(() => {
7
- if (!a) return;
8
- const o = (t) => {
9
- const e = t.target;
10
- if (!(e instanceof Node)) return;
11
- const l = i.current?.contains(e) ?? !1, k = r.current?.contains(e) ?? !1, v = t.composedPath().some(
12
- (d) => d instanceof HTMLElement && d.hasAttribute("data-picker-overlay")
13
- );
14
- !l && !k && !v && (n(!1), s?.());
15
- }, u = (t) => {
16
- if (t.key === "Escape") {
17
- n(!1), s?.();
18
- return;
1
+ import { useState as f, useRef as c, useEffect as p } from "react";
2
+ const m = (r = {}) => {
3
+ const { onBackspace: t } = r, [n, a] = f(!1), u = c(null), i = c(null);
4
+ return p(() => {
5
+ if (!n) return;
6
+ const s = (o) => {
7
+ if (o.key === "Backspace" && t) {
8
+ const { target: e } = o;
9
+ e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable || (o.preventDefault(), t());
19
10
  }
20
- if (t.key === "Backspace" && c) {
21
- const { target: e } = t;
22
- e instanceof HTMLInputElement || e instanceof HTMLTextAreaElement || e instanceof HTMLElement && e.isContentEditable || (t.preventDefault(), c());
23
- }
24
- }, E = setTimeout(() => {
25
- document.addEventListener("mousedown", o);
26
- }, 0);
27
- return document.addEventListener("keydown", u), () => {
28
- clearTimeout(E), document.removeEventListener("mousedown", o), document.removeEventListener("keydown", u);
29
11
  };
30
- }, [a, s, c]), {
31
- isOpen: a,
32
- setIsOpen: n,
33
- popoverRef: i,
34
- inputRef: r,
35
- handleTogglePopover: m
12
+ return document.addEventListener("keydown", s), () => {
13
+ document.removeEventListener("keydown", s);
14
+ };
15
+ }, [n, t]), {
16
+ isOpen: n,
17
+ setIsOpen: a,
18
+ popoverRef: u,
19
+ inputRef: i
36
20
  };
37
21
  };
38
22
  export {
39
- g as usePopoverState
23
+ m as usePopoverState
40
24
  };
@@ -0,0 +1,2 @@
1
+ export { TimePickerPanel } from './time-picker-panel';
2
+ export type { TimePickerPanelProps } from './time-picker-panel';
@@ -0,0 +1,19 @@
1
+ import { FC } from 'react';
2
+ type TimePickerPanelBaseProps = {
3
+ hour: number;
4
+ minute: number;
5
+ onHourChange: (hour: number) => void;
6
+ onMinuteChange: (minute: number) => void;
7
+ className?: string;
8
+ };
9
+ export type TimePickerPanelProps = TimePickerPanelBaseProps & ({
10
+ timeFormat: '12h';
11
+ amPm: 'AM' | 'PM';
12
+ onAmPmChange: (amPm: 'AM' | 'PM') => void;
13
+ } | {
14
+ timeFormat?: '24h';
15
+ amPm?: undefined;
16
+ onAmPmChange?: undefined;
17
+ });
18
+ export declare const TimePickerPanel: FC<TimePickerPanelProps>;
19
+ export {};
@@ -0,0 +1,41 @@
1
+ import { jsxs as r, jsx as e, Fragment as c } from "react/jsx-runtime";
2
+ import { cn as h } from "../../../../../../lib/utils.js";
3
+ import { AmPmScroll as d } from "../am-pm-scroll/am-pm-scroll.js";
4
+ import { TimePickerScroll as a } from "../time-picker-scroll/time-picker-scroll.js";
5
+ const f = (m) => {
6
+ const { hour: t, minute: i, onHourChange: n, onMinuteChange: l, className: o } = m, s = m.timeFormat ?? "24h";
7
+ return /* @__PURE__ */ r(
8
+ "div",
9
+ {
10
+ "data-slot": "time-picker-panel",
11
+ className: h("flex items-stretch", o),
12
+ children: [
13
+ /* @__PURE__ */ e("div", { className: "px-3", children: /* @__PURE__ */ e(
14
+ a,
15
+ {
16
+ value: t,
17
+ onChange: n,
18
+ type: "hour",
19
+ timeFormat: s
20
+ }
21
+ ) }),
22
+ /* @__PURE__ */ e("div", { className: "w-px bg-border shrink-0 self-stretch" }),
23
+ /* @__PURE__ */ e("div", { className: "px-3", children: /* @__PURE__ */ e(
24
+ a,
25
+ {
26
+ value: i,
27
+ onChange: l,
28
+ type: "minute"
29
+ }
30
+ ) }),
31
+ m.timeFormat === "12h" && /* @__PURE__ */ r(c, { children: [
32
+ /* @__PURE__ */ e("div", { className: "w-px bg-border shrink-0 self-stretch" }),
33
+ /* @__PURE__ */ e("div", { className: "px-3", children: /* @__PURE__ */ e(d, { value: m.amPm, onChange: m.onAmPmChange }) })
34
+ ] })
35
+ ]
36
+ }
37
+ );
38
+ };
39
+ export {
40
+ f as TimePickerPanel
41
+ };
@@ -0,0 +1,3 @@
1
+ export { TimePicker } from './time-picker';
2
+ export type { TimePickerProps, ShortcutItem } from './time-picker';
3
+ export type { UseTimePickerProps, UseTimePickerReturn } from './types';
@@ -0,0 +1,16 @@
1
+ import { FC } from 'react';
2
+ import { Dayjs } from 'dayjs';
3
+ import { ShortcutItem } from '../shared/shortcuts-panel/shortcuts-panel';
4
+ import { TimeFormat } from '../utils/format-utils';
5
+ export type { ShortcutItem };
6
+ export interface TimePickerProps {
7
+ value: Dayjs | null;
8
+ onChange: (time: Dayjs | null) => void;
9
+ timeFormat?: TimeFormat;
10
+ format?: string;
11
+ placeholder?: string;
12
+ shortcuts?: ShortcutItem[];
13
+ defaultDate?: Dayjs;
14
+ className?: string;
15
+ }
16
+ export declare const TimePicker: FC<TimePickerProps>;