@cognite/aura 0.3.2 → 0.3.3

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 (108) hide show
  1. package/DESIGN.md +134 -5
  2. package/README.md +24 -3
  3. package/dist/components/index.d.ts +2 -0
  4. package/dist/components/index.js +58 -327
  5. package/dist/components/ui/core/accordion/accordion.js +79 -114
  6. package/dist/components/ui/core/action-toolbar/action-toolbar.js +108 -176
  7. package/dist/components/ui/core/alert/alert.js +158 -206
  8. package/dist/components/ui/core/avatar/avatar.js +64 -90
  9. package/dist/components/ui/core/badge/badge.js +73 -108
  10. package/dist/components/ui/core/banner/banner.js +146 -215
  11. package/dist/components/ui/core/breadcrumb/breadcrumb.js +105 -200
  12. package/dist/components/ui/core/button/button.js +47 -52
  13. package/dist/components/ui/core/button-group/button-group.js +40 -79
  14. package/dist/components/ui/core/card/card.js +102 -185
  15. package/dist/components/ui/core/chart/chart.js +116 -206
  16. package/dist/components/ui/core/chart/index.js +2 -8
  17. package/dist/components/ui/core/checkbox/checkbox.js +67 -132
  18. package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
  19. package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
  20. package/dist/components/ui/core/code-block/code-block.js +179 -267
  21. package/dist/components/ui/core/collapsible/collapsible.js +29 -49
  22. package/dist/components/ui/core/combobox/combobox.js +41 -0
  23. package/dist/components/ui/core/command/command.js +85 -150
  24. package/dist/components/ui/core/count/count.js +21 -32
  25. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -72
  26. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -51
  27. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -87
  28. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -68
  29. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -174
  30. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -145
  31. package/dist/components/ui/core/date-time-pickers/index.js +5 -10
  32. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
  33. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +66 -117
  34. package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +63 -93
  35. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
  36. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
  37. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -23
  38. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
  39. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
  40. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
  41. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
  42. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
  43. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
  44. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +40 -40
  45. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
  46. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +78 -99
  47. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +41 -63
  48. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +39 -52
  49. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
  50. package/dist/components/ui/core/dialog/dialog.js +82 -155
  51. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +2 -2
  52. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -248
  53. package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
  54. package/dist/components/ui/core/empty-state/empty-state.js +86 -138
  55. package/dist/components/ui/core/helper-text/helper-text.js +37 -65
  56. package/dist/components/ui/core/hover-card/hover-card.js +54 -80
  57. package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
  58. package/dist/components/ui/core/input/input.js +12 -27
  59. package/dist/components/ui/core/input-group/input-group.js +76 -173
  60. package/dist/components/ui/core/kbd/kbd.js +20 -36
  61. package/dist/components/ui/core/label/label.js +26 -43
  62. package/dist/components/ui/core/loader/loader.js +80 -117
  63. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
  64. package/dist/components/ui/core/message/message.d.ts +2 -2
  65. package/dist/components/ui/core/message/message.js +316 -542
  66. package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
  67. package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
  68. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
  69. package/dist/components/ui/core/pagination/pagination.js +231 -334
  70. package/dist/components/ui/core/popover/popover.js +90 -157
  71. package/dist/components/ui/core/progress/progress.js +36 -61
  72. package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
  73. package/dist/components/ui/core/radio-group/radio-group.js +58 -113
  74. package/dist/components/ui/core/reasoning/reasoning.js +55 -86
  75. package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
  76. package/dist/components/ui/core/search/search.js +77 -99
  77. package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
  78. package/dist/components/ui/core/select/select.js +168 -293
  79. package/dist/components/ui/core/separator/separator.js +13 -23
  80. package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
  81. package/dist/components/ui/core/shimmer/shimmer.js +40 -107
  82. package/dist/components/ui/core/skeleton/skeleton.js +13 -18
  83. package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
  84. package/dist/components/ui/core/sources/sources.d.ts +5 -1
  85. package/dist/components/ui/core/sources/sources.js +58 -79
  86. package/dist/components/ui/core/switch/switch.js +62 -0
  87. package/dist/components/ui/core/tabs/tabs.js +149 -223
  88. package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
  89. package/dist/components/ui/core/textarea/textarea.js +13 -27
  90. package/dist/components/ui/core/toggle/toggle.js +55 -74
  91. package/dist/components/ui/core/tool/tool.js +127 -163
  92. package/dist/components/ui/core/tooltip/tooltip.js +47 -86
  93. package/dist/components/ui/core/topbar/topbar.js +106 -190
  94. package/dist/eslint/index.js +5 -10
  95. package/dist/eslint/no-overriding-styles.js +178 -237
  96. package/dist/icons/index.d.ts +1 -0
  97. package/dist/icons/index.js +1 -0
  98. package/dist/lib/highlight-code.d.ts +9 -0
  99. package/dist/lib/highlight-code.js +42 -0
  100. package/dist/lib/portal-container-context.js +8 -9
  101. package/dist/lib/style-scope.js +6 -6
  102. package/dist/lib/use-controllable-state.js +21 -30
  103. package/dist/lib/utils.d.ts +0 -2
  104. package/dist/lib/utils.js +32 -112
  105. package/dist/styles.css +1 -1
  106. package/dist/styles.source.css +23 -0
  107. package/package.json +23 -7
  108. package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
@@ -1,88 +1,64 @@
1
- import { jsx as e, jsxs as i } from "react/jsx-runtime";
2
- import { cn as S } from "../../../../../lib/utils.js";
3
- import { Popover as M, PopoverTrigger as N, PopoverContent as w } from "../../popover/popover.js";
4
- import { Calendar as Y } from "../shared/calendar/calendar.js";
5
- import { DateTimeInput as O } from "../shared/date-time-input/date-time-input.js";
6
- import { ShortcutsPanel as j } from "../shared/shortcuts-panel/shortcuts-panel.js";
7
- import { useDateRangePicker as y } from "./use-date-range-picker.js";
8
- const z = ({
9
- value: n,
10
- onChange: d,
11
- format: p = "DD/MM/YYYY",
12
- placeholder: c,
13
- displayWeekNumber: h = !1,
14
- shortcuts: t,
15
- defaultDate: m,
16
- className: s
17
- }) => {
18
- const {
19
- isOpen: a,
20
- step: r,
21
- displayedMonth: v,
22
- tempStart: o,
23
- tempEnd: l,
24
- hoverDate: f,
25
- handleOpenChange: g,
26
- handleDateClick: D,
27
- handleMonthChange: u,
28
- handleDateHover: C,
29
- handleSetStep: k,
30
- handleApplyShortcut: P,
31
- inputRef: R,
32
- popoverRef: x
33
- } = y({ value: n, onChange: d, defaultDate: m });
34
- return /* @__PURE__ */ e(
35
- "div",
36
- {
37
- "data-slot": "date-range-picker",
38
- className: S("relative w-full", s),
39
- children: /* @__PURE__ */ i(M, { open: a, onOpenChange: g, children: [
40
- /* @__PURE__ */ e(N, { render: /* @__PURE__ */ e("div", { ref: R, className: "w-full" }), children: /* @__PURE__ */ e(
41
- O,
42
- {
43
- value: a ? [o, l] : n,
44
- format: p,
45
- placeholder: c,
46
- isOpen: a,
47
- variant: "date",
48
- activeRangePart: a ? r : void 0,
49
- onRangePartClick: a ? k : void 0
50
- }
51
- ) }),
52
- /* @__PURE__ */ e(
53
- w,
54
- {
55
- ref: x,
56
- className: "rounded-xl w-auto p-0",
57
- side: "bottom",
58
- align: "start",
59
- children: /* @__PURE__ */ i("div", { "data-slot": "date-range-picker-content", className: "flex flex-row", children: [
60
- t && t.length > 0 && /* @__PURE__ */ e(
61
- j,
62
- {
63
- shortcuts: t,
64
- onShortcutClick: P
65
- }
66
- ),
67
- /* @__PURE__ */ e("div", { className: "p-3", children: /* @__PURE__ */ e(
68
- Y,
69
- {
70
- displayedMonth: v,
71
- selectedRange: [o, l],
72
- hoverDate: r === "end" ? f : null,
73
- displayWeekNumber: h,
74
- onDateClick: D,
75
- onMonthChange: u,
76
- onDateHover: C
77
- }
78
- ) })
79
- ] })
80
- }
81
- )
82
- ] })
83
- }
84
- );
85
- };
86
- export {
87
- z as DateRangePicker
1
+ import { cn as e } from "../../../../../lib/utils.js";
2
+ import { Popover as t, PopoverContent as n, PopoverTrigger as r } from "../../popover/popover.js";
3
+ import { Calendar as i } from "../shared/calendar/calendar.js";
4
+ import { DateTimeInput as a } from "../shared/date-time-input/date-time-input.js";
5
+ import { ShortcutsPanel as o } from "../shared/shortcuts-panel/shortcuts-panel.js";
6
+ import { useDateRangePicker as s } from "./use-date-range-picker.js";
7
+ import { jsx as c, jsxs as l } from "react/jsx-runtime";
8
+ //#region libs/aura/src/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.tsx
9
+ var u = ({ value: u, onChange: d, format: f = "DD/MM/YYYY", placeholder: p, displayWeekNumber: m = !1, shortcuts: h, defaultDate: g, className: _ }) => {
10
+ let { isOpen: v, step: y, displayedMonth: b, tempStart: x, tempEnd: S, hoverDate: C, handleOpenChange: w, handleDateClick: T, handleMonthChange: E, handleDateHover: D, handleSetStep: O, handleApplyShortcut: k, inputRef: A, popoverRef: j } = s({
11
+ value: u,
12
+ onChange: d,
13
+ defaultDate: g
14
+ });
15
+ return /* @__PURE__ */ c("div", {
16
+ "data-slot": "date-range-picker",
17
+ className: e("relative w-full", _),
18
+ children: /* @__PURE__ */ l(t, {
19
+ open: v,
20
+ onOpenChange: w,
21
+ children: [/* @__PURE__ */ c(r, {
22
+ render: /* @__PURE__ */ c("div", {
23
+ ref: A,
24
+ className: "w-full"
25
+ }),
26
+ children: /* @__PURE__ */ c(a, {
27
+ value: v ? [x, S] : u,
28
+ format: f,
29
+ placeholder: p,
30
+ isOpen: v,
31
+ variant: "date",
32
+ activeRangePart: v ? y : void 0,
33
+ onRangePartClick: v ? O : void 0
34
+ })
35
+ }), /* @__PURE__ */ c(n, {
36
+ ref: j,
37
+ className: "rounded-xl w-auto p-0",
38
+ side: "bottom",
39
+ align: "start",
40
+ children: /* @__PURE__ */ l("div", {
41
+ "data-slot": "date-range-picker-content",
42
+ className: "flex flex-row",
43
+ children: [h && h.length > 0 && /* @__PURE__ */ c(o, {
44
+ shortcuts: h,
45
+ onShortcutClick: k
46
+ }), /* @__PURE__ */ c("div", {
47
+ className: "p-3",
48
+ children: /* @__PURE__ */ c(i, {
49
+ displayedMonth: b,
50
+ selectedRange: [x, S],
51
+ hoverDate: y === "end" ? C : null,
52
+ displayWeekNumber: m,
53
+ onDateClick: T,
54
+ onMonthChange: E,
55
+ onDateHover: D
56
+ })
57
+ })]
58
+ })
59
+ })]
60
+ })
61
+ });
88
62
  };
63
+ //#endregion
64
+ export { u as DateRangePicker };
@@ -1,69 +1,61 @@
1
- import { useRef as E, useCallback as c, useEffect as x } from "react";
2
- import P from "dayjs";
3
- import { usePopoverState as b } from "../shared/hooks/use-popover-state.js";
4
- import { useRangeDateState as j } from "../shared/hooks/use-range-date-state.js";
5
- import { useRangeStepManager as H } from "../shared/hooks/use-range-step-manager.js";
6
- const L = ({
7
- value: r,
8
- onChange: t,
9
- defaultDate: S = P()
10
- }) => {
11
- const p = E(() => {
12
- }), { isOpen: m, setIsOpen: s, popoverRef: u, inputRef: k } = b({
13
- onBackspace: c(() => p.current(), [])
14
- }), D = H(), { step: n, handleBack: o, handleNext: d, resetStep: a } = D, R = j({
15
- value: r,
16
- defaultDate: S,
17
- onEndDateSelected: c(
18
- (e, l) => {
19
- t([e, l]), s(!1), a();
20
- },
21
- [t, s, a]
22
- )
23
- }), {
24
- tempStart: y,
25
- tempEnd: A,
26
- displayedMonth: B,
27
- hoverDate: C,
28
- handleDateClick: M,
29
- handleDateHover: O,
30
- handleMonthChange: g,
31
- clearActiveSegment: i,
32
- resetDates: h
33
- } = R, v = c(() => {
34
- h(r), a();
35
- }, [h, a, r]), f = c(() => {
36
- const e = i(n);
37
- e === null ? o() : e[0] === null && e[1] === null && t(e);
38
- }, [i, n, o, t]);
39
- return x(() => {
40
- p.current = f;
41
- }, [f]), {
42
- isOpen: m,
43
- step: n,
44
- displayedMonth: B,
45
- tempStart: y,
46
- tempEnd: A,
47
- hoverDate: C,
48
- handleOpenChange: (e) => {
49
- v(), s(e);
50
- },
51
- handleDateClick: (e) => {
52
- M(e, n), n === "start" && d();
53
- },
54
- handleMonthChange: g,
55
- handleDateHover: O,
56
- handleSetStep: (e) => {
57
- e === "start" ? o() : d();
58
- },
59
- handleApplyShortcut: (e) => {
60
- const l = Array.isArray(e) ? e : [e, e];
61
- t(l), s(!1), a();
62
- },
63
- inputRef: k,
64
- popoverRef: u
65
- };
66
- };
67
- export {
68
- L as useDateRangePicker
1
+ import { usePopoverState as e } from "../shared/hooks/use-popover-state.js";
2
+ import { useRangeDateState as t } from "../shared/hooks/use-range-date-state.js";
3
+ import { useRangeStepManager as n } from "../shared/hooks/use-range-step-manager.js";
4
+ import { useCallback as r, useEffect as i, useRef as a } from "react";
5
+ import o from "dayjs";
6
+ //#region libs/aura/src/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.ts
7
+ var s = ({ value: s, onChange: c, defaultDate: l = o() }) => {
8
+ let u = a(() => {}), { isOpen: d, setIsOpen: f, popoverRef: p, inputRef: m } = e({ onBackspace: r(() => u.current(), []) }), { step: h, handleBack: g, handleNext: _, resetStep: v } = n(), { tempStart: y, tempEnd: b, displayedMonth: x, hoverDate: S, handleDateClick: C, handleDateHover: w, handleMonthChange: T, clearActiveSegment: E, resetDates: D } = t({
9
+ value: s,
10
+ defaultDate: l,
11
+ onEndDateSelected: r((e, t) => {
12
+ c([e, t]), f(!1), v();
13
+ }, [
14
+ c,
15
+ f,
16
+ v
17
+ ])
18
+ }), O = r(() => {
19
+ D(s), v();
20
+ }, [
21
+ D,
22
+ v,
23
+ s
24
+ ]), k = r(() => {
25
+ let e = E(h);
26
+ e === null ? g() : e[0] === null && e[1] === null && c(e);
27
+ }, [
28
+ E,
29
+ h,
30
+ g,
31
+ c
32
+ ]);
33
+ return i(() => {
34
+ u.current = k;
35
+ }, [k]), {
36
+ isOpen: d,
37
+ step: h,
38
+ displayedMonth: x,
39
+ tempStart: y,
40
+ tempEnd: b,
41
+ hoverDate: S,
42
+ handleOpenChange: (e) => {
43
+ O(), f(e);
44
+ },
45
+ handleDateClick: (e) => {
46
+ C(e, h), h === "start" && _();
47
+ },
48
+ handleMonthChange: T,
49
+ handleDateHover: w,
50
+ handleSetStep: (e) => {
51
+ e === "start" ? g() : _();
52
+ },
53
+ handleApplyShortcut: (e) => {
54
+ c(Array.isArray(e) ? e : [e, e]), f(!1), v();
55
+ },
56
+ inputRef: m,
57
+ popoverRef: p
58
+ };
69
59
  };
60
+ //#endregion
61
+ export { s as useDateRangePicker };
@@ -1,175 +1,119 @@
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 = ({
13
- value: x,
14
- onChange: H,
15
- format: M = "DD/MM/YYYY HH:mm",
16
- placeholder: D,
17
- displayWeekNumber: S = !1,
18
- shortcuts: c,
19
- timeFormat: n = "24h",
20
- defaultDate: A,
21
- className: N
22
- }) => {
23
- const {
24
- isOpen: l,
25
- step: t,
26
- displayedMonth: T,
27
- tempStart: r,
28
- tempEnd: a,
29
- hoverDate: y,
30
- tempStartHour: i,
31
- tempStartMinute: m,
32
- tempEndHour: d,
33
- tempEndMinute: h,
34
- startAmPm: s,
35
- endAmPm: u,
36
- handleOpenChange: f,
37
- handleSetStep: R,
38
- handleDateClick: E,
39
- handleMonthChange: w,
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({
54
- value: x,
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
63
- ).minute(h) : null;
64
- return [F, ee];
65
- }, [
66
- r,
67
- a,
68
- i,
69
- m,
70
- d,
71
- h,
72
- s,
73
- u,
74
- n
75
- ]);
76
- return /* @__PURE__ */ e(
77
- "div",
78
- {
79
- "data-slot": "date-time-range-picker",
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",
103
- {
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
- ]
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 "../shared/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 };