@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.
Files changed (143) hide show
  1. package/DESIGN.md +134 -5
  2. package/README.md +24 -3
  3. package/dist/components/index.d.ts +5 -1
  4. package/dist/components/index.js +59 -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/calendar/calendar-header.js +63 -0
  15. package/dist/components/ui/core/calendar/calendar-utils.js +39 -0
  16. package/dist/components/ui/core/calendar/calendar.js +68 -0
  17. package/dist/components/ui/core/calendar/constants.d.ts +1 -0
  18. package/dist/components/ui/core/card/card.js +102 -185
  19. package/dist/components/ui/core/chart/chart.js +116 -206
  20. package/dist/components/ui/core/chart/index.js +2 -8
  21. package/dist/components/ui/core/checkbox/checkbox.js +67 -132
  22. package/dist/components/ui/core/checkbox/checkbox.metadata.js +7 -7
  23. package/dist/components/ui/core/code-block/code-block.d.ts +1 -1
  24. package/dist/components/ui/core/code-block/code-block.js +179 -267
  25. package/dist/components/ui/core/collapsible/collapsible.js +29 -49
  26. package/dist/components/ui/core/combobox/combobox.js +41 -0
  27. package/dist/components/ui/core/command/command.js +85 -150
  28. package/dist/components/ui/core/count/count.js +21 -32
  29. package/dist/components/ui/core/data-grid/data-grid-cell.d.ts +10 -0
  30. package/dist/components/ui/core/data-grid/data-grid-header-row.d.ts +13 -0
  31. package/dist/components/ui/core/data-grid/data-grid-row.d.ts +18 -0
  32. package/dist/components/ui/core/data-grid/data-grid.d.ts +43 -0
  33. package/dist/components/ui/core/data-grid/data-grid.fixtures.d.ts +12 -0
  34. package/dist/components/ui/core/data-grid/data-grid.utils.d.ts +9 -0
  35. package/dist/components/ui/core/date-time-pickers/date-picker/date-picker.js +60 -72
  36. package/dist/components/ui/core/date-time-pickers/date-picker/types.d.ts +2 -1
  37. package/dist/components/ui/core/date-time-pickers/date-picker/use-date-picker.js +36 -51
  38. package/dist/components/ui/core/date-time-pickers/date-range-picker/date-range-picker.js +63 -87
  39. package/dist/components/ui/core/date-time-pickers/date-range-picker/types.d.ts +2 -1
  40. package/dist/components/ui/core/date-time-pickers/date-range-picker/use-date-range-picker.js +60 -68
  41. package/dist/components/ui/core/date-time-pickers/date-time-picker/index.d.ts +1 -0
  42. package/dist/components/ui/core/date-time-pickers/date-time-picker/types.d.ts +36 -0
  43. package/dist/components/ui/core/date-time-pickers/date-time-picker/use-date-time-picker.d.ts +3 -0
  44. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/date-time-range-picker.js +118 -174
  45. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/types.d.ts +7 -6
  46. package/dist/components/ui/core/date-time-pickers/date-time-range-picker/use-date-time-range-picker.js +104 -145
  47. package/dist/components/ui/core/date-time-pickers/index.d.ts +3 -1
  48. package/dist/components/ui/core/date-time-pickers/index.js +6 -10
  49. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.d.ts +3 -2
  50. package/dist/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.js +42 -56
  51. package/dist/components/ui/core/date-time-pickers/shared/constants.d.ts +3 -8
  52. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.js +64 -98
  53. package/dist/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.js +38 -67
  54. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.js +23 -23
  55. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.js +52 -62
  56. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.js +18 -18
  57. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-single-date-state.js +24 -31
  58. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.d.ts +3 -3
  59. package/dist/components/ui/core/date-time-pickers/shared/hooks/use-time-state.js +24 -33
  60. package/dist/components/ui/core/date-time-pickers/shared/scroll-cell-classes.js +4 -7
  61. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.d.ts +3 -2
  62. package/dist/components/ui/core/date-time-pickers/shared/shortcuts-panel/shortcuts-panel.js +17 -31
  63. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.d.ts +3 -2
  64. package/dist/components/ui/core/date-time-pickers/shared/time-picker-panel/time-picker-panel.js +40 -40
  65. package/dist/components/ui/core/date-time-pickers/shared/time-picker-scroll/time-picker-scroll.js +33 -50
  66. package/dist/components/ui/core/date-time-pickers/time-picker/time-picker.js +78 -99
  67. package/dist/components/ui/core/date-time-pickers/time-picker/types.d.ts +5 -4
  68. package/dist/components/ui/core/date-time-pickers/time-picker/use-time-picker.js +41 -63
  69. package/dist/components/ui/core/date-time-pickers/time-range-picker/index.d.ts +1 -0
  70. package/dist/components/ui/core/date-time-pickers/time-range-picker/types.d.ts +40 -0
  71. package/dist/components/ui/core/date-time-pickers/time-range-picker/use-time-range-picker.d.ts +3 -0
  72. package/dist/components/ui/core/date-time-pickers/utils/format-utils.d.ts +1 -0
  73. package/dist/components/ui/core/date-time-pickers/utils/time-utils.d.ts +3 -3
  74. package/dist/components/ui/core/date-time-pickers/utils/time-utils.js +7 -15
  75. package/dist/components/ui/core/dialog/dialog.js +82 -155
  76. package/dist/components/ui/core/dropdown-menu/dropdown-menu.d.ts +2 -2
  77. package/dist/components/ui/core/dropdown-menu/dropdown-menu.js +150 -248
  78. package/dist/components/ui/core/empty-state/empty-state.context.js +5 -8
  79. package/dist/components/ui/core/empty-state/empty-state.js +86 -138
  80. package/dist/components/ui/core/helper-text/helper-text.js +37 -65
  81. package/dist/components/ui/core/hover-card/hover-card.js +54 -80
  82. package/dist/components/ui/core/inline-citation/inline-citation.js +98 -181
  83. package/dist/components/ui/core/input/input.js +12 -27
  84. package/dist/components/ui/core/input-group/input-group.js +76 -173
  85. package/dist/components/ui/core/kbd/kbd.js +20 -36
  86. package/dist/components/ui/core/label/label.js +26 -43
  87. package/dist/components/ui/core/loader/loader.js +80 -117
  88. package/dist/components/ui/core/message/message-response-default-streamdown-controls.js +12 -12
  89. package/dist/components/ui/core/message/message.d.ts +2 -2
  90. package/dist/components/ui/core/message/message.js +316 -542
  91. package/dist/components/ui/core/overflow-list/overflow-list.utils.d.ts +52 -0
  92. package/dist/components/ui/core/pagination/pagination-size-context.js +5 -6
  93. package/dist/components/ui/core/pagination/pagination-teleport.js +86 -106
  94. package/dist/components/ui/core/pagination/pagination-teleport.utils.js +6 -6
  95. package/dist/components/ui/core/pagination/pagination.js +231 -334
  96. package/dist/components/ui/core/popover/popover.js +90 -157
  97. package/dist/components/ui/core/progress/progress.js +36 -61
  98. package/dist/components/ui/core/prompt-input/prompt-input.js +274 -413
  99. package/dist/components/ui/core/radio-group/radio-group.js +58 -113
  100. package/dist/components/ui/core/reasoning/reasoning.js +55 -86
  101. package/dist/components/ui/core/scroll-area/scroll-area.js +41 -71
  102. package/dist/components/ui/core/search/search.js +77 -99
  103. package/dist/components/ui/core/segmented-control/segmented-control.js +110 -167
  104. package/dist/components/ui/core/select/select.js +168 -293
  105. package/dist/components/ui/core/separator/separator.js +13 -23
  106. package/dist/components/ui/core/shimmer/shimmer.d.ts +2 -4
  107. package/dist/components/ui/core/shimmer/shimmer.js +40 -107
  108. package/dist/components/ui/core/skeleton/skeleton.js +13 -18
  109. package/dist/components/ui/core/slider/slider.d.ts +9 -0
  110. package/dist/components/ui/core/slider/slider.js +40 -0
  111. package/dist/components/ui/core/sonner-toast/sonner-toast.js +54 -47
  112. package/dist/components/ui/core/sources/sources.d.ts +5 -1
  113. package/dist/components/ui/core/sources/sources.js +58 -79
  114. package/dist/components/ui/core/switch/switch.js +62 -0
  115. package/dist/components/ui/core/tabs/tabs.js +149 -223
  116. package/dist/components/ui/core/tabs/tabs.utils.js +6 -8
  117. package/dist/components/ui/core/textarea/textarea.js +13 -27
  118. package/dist/components/ui/core/toggle/toggle.js +55 -74
  119. package/dist/components/ui/core/tool/tool.js +127 -163
  120. package/dist/components/ui/core/tooltip/tooltip.js +47 -86
  121. package/dist/components/ui/core/topbar/topbar.js +106 -190
  122. package/dist/eslint/index.js +5 -10
  123. package/dist/eslint/no-overriding-styles.js +178 -237
  124. package/dist/icons/index.d.ts +1 -0
  125. package/dist/icons/index.js +1 -0
  126. package/dist/index.d.ts +1 -1
  127. package/dist/lib/highlight-code.d.ts +9 -0
  128. package/dist/lib/highlight-code.js +42 -0
  129. package/dist/lib/portal-container-context.js +8 -9
  130. package/dist/lib/style-scope.js +6 -6
  131. package/dist/lib/use-controllable-state.js +21 -30
  132. package/dist/lib/utils.d.ts +0 -2
  133. package/dist/lib/utils.js +32 -112
  134. package/dist/styles.css +1 -1
  135. package/dist/styles.source.css +26 -0
  136. package/package.json +42 -8
  137. package/dist/components/ui/core/date-time-pickers/shared/calendar/calendar.js +0 -119
  138. package/dist/components/ui/core/date-time-pickers/shared/calendar-header/calendar-header.js +0 -93
  139. package/dist/components/ui/core/date-time-pickers/shared/constants.js +0 -14
  140. package/dist/components/ui/core/date-time-pickers/utils/calendar-utils.js +0 -52
  141. /package/dist/components/ui/core/{date-time-pickers/shared/calendar-header → calendar}/calendar-header.d.ts +0 -0
  142. /package/dist/components/ui/core/{date-time-pickers/utils → calendar}/calendar-utils.d.ts +0 -0
  143. /package/dist/components/ui/core/{date-time-pickers/shared/calendar → calendar}/calendar.d.ts +0 -0
@@ -1,57 +1,43 @@
1
- import { jsx as i } from "react/jsx-runtime";
2
- import { useRef as s, useEffect as L } from "react";
3
- import { cn as l } from "../../../../../../lib/utils.js";
4
- import { SCROLL_ITEM_SELECTED_CLASSES as _, SCROLL_ITEM_UNSELECTED_CLASSES as C, SCROLL_ITEM_BASE_CLASSES as a, SCROLL_CONTAINER_CLASSES as d } from "../scroll-cell-classes.js";
5
- const A = ["AM", "PM"], p = ({
6
- value: e,
7
- onChange: c,
8
- className: S
9
- }) => {
10
- const r = s(null), n = s(null);
11
- L(() => {
12
- if (e !== null && n.current && r.current) {
13
- const o = r.current, t = n.current;
14
- o.scrollTo({
15
- top: t.offsetTop - o.offsetHeight / 2 + t.offsetHeight / 2,
16
- behavior: "smooth"
17
- });
18
- }
19
- }, [e]);
20
- const f = (o, t) => {
21
- (o.key === "Enter" || o.key === " ") && (o.preventDefault(), c(t));
22
- };
23
- return /* @__PURE__ */ i(
24
- "div",
25
- {
26
- "data-slot": "am-pm-scroll",
27
- ref: r,
28
- role: "listbox",
29
- "aria-label": "AM/PM",
30
- "aria-orientation": "vertical",
31
- className: l(d, S),
32
- children: A.map((o) => {
33
- const t = e !== null && o === e;
34
- return /* @__PURE__ */ i(
35
- "div",
36
- {
37
- ref: t ? n : void 0,
38
- tabIndex: 0,
39
- className: l(
40
- a,
41
- t ? _ : C
42
- ),
43
- onClick: () => c(o),
44
- onKeyDown: (E) => f(E, o),
45
- role: "option",
46
- "aria-selected": t,
47
- children: o
48
- },
49
- o
50
- );
51
- })
52
- }
53
- );
54
- };
55
- export {
56
- p as AmPmScroll
1
+ import { cn as e } from "../../../../../../lib/utils.js";
2
+ import { SCROLL_CONTAINER_CLASSES as t, SCROLL_ITEM_BASE_CLASSES as n, SCROLL_ITEM_SELECTED_CLASSES as r, SCROLL_ITEM_UNSELECTED_CLASSES as i } from "../scroll-cell-classes.js";
3
+ import { useEffect as a, useRef as o } from "react";
4
+ import { jsx as s } from "react/jsx-runtime";
5
+ //#region libs/aura/src/components/ui/core/date-time-pickers/shared/am-pm-scroll/am-pm-scroll.tsx
6
+ var c = ["AM", "PM"], l = ({ value: l, onChange: u, className: d }) => {
7
+ let f = o(null), p = o(null);
8
+ a(() => {
9
+ if (l !== null && p.current && f.current) {
10
+ let e = f.current, t = p.current;
11
+ e.scrollTo({
12
+ top: t.offsetTop - e.offsetHeight / 2 + t.offsetHeight / 2,
13
+ behavior: "smooth"
14
+ });
15
+ }
16
+ }, [l]);
17
+ let m = (e, t) => {
18
+ (e.key === "Enter" || e.key === " ") && (e.preventDefault(), u(t));
19
+ };
20
+ return /* @__PURE__ */ s("div", {
21
+ "data-slot": "am-pm-scroll",
22
+ ref: f,
23
+ role: "listbox",
24
+ "aria-label": "AM/PM",
25
+ "aria-orientation": "vertical",
26
+ className: e(t, d),
27
+ children: c.map((t) => {
28
+ let a = l !== null && t === l;
29
+ return /* @__PURE__ */ s("div", {
30
+ ref: a ? p : void 0,
31
+ tabIndex: 0,
32
+ className: e(n, a ? r : i),
33
+ onClick: () => u(t),
34
+ onKeyDown: (e) => m(e, t),
35
+ role: "option",
36
+ "aria-selected": a,
37
+ children: t
38
+ }, t);
39
+ })
40
+ });
57
41
  };
42
+ //#endregion
43
+ export { l as AmPmScroll };
@@ -1,20 +1,15 @@
1
- /**
2
- * Shared numeric constants for date/time picker components.
3
- * Colors and typography are applied via Tailwind utility classes — no CSS
4
- * variable strings are exported from here.
5
- */
1
+ import { AmPm } from '../utils/format-utils';
6
2
  export declare const HOURS_IN_DAY = 24;
7
3
  export declare const HOURS_IN_12H = 12;
8
4
  export declare const MINUTES_IN_HOUR = 60;
9
5
  export declare const MINUTE_INCREMENT = 1;
10
- export declare const DAYS_IN_WEEK = 7;
11
6
  export declare const DEFAULT_START_HOUR = 9;
12
7
  export declare const DEFAULT_END_HOUR = 17;
13
8
  export declare const DEFAULT_MINUTE = 0;
14
9
  export declare const START_OF_DAY_HOUR = 0;
15
10
  export declare const END_OF_DAY_HOUR = 23;
16
11
  export declare const END_OF_DAY_MINUTE = 59;
17
- export declare const DEFAULT_START_AMPM: 'AM' | 'PM';
18
- export declare const DEFAULT_END_AMPM: 'AM' | 'PM';
12
+ export declare const DEFAULT_START_AMPM: AmPm;
13
+ export declare const DEFAULT_END_AMPM: AmPm;
19
14
  export declare const NOON_HOUR = 12;
20
15
  export declare const MIDNIGHT_HOUR = 0;
@@ -1,99 +1,65 @@
1
- import { jsxs as u, jsx as r } from "react/jsx-runtime";
2
- import { IconCalendarClock as A, IconClock as I, IconCalendar as y } from "@tabler/icons-react";
3
- import { cn as a } from "../../../../../../lib/utils.js";
4
- import { Input as D } from "../../../input/input.js";
5
- import { RangeInputDisplay as R } from "./range-input-display.js";
6
- const v = "Date picker", C = () => {
7
- }, p = {
8
- date: /* @__PURE__ */ r(y, { "aria-label": "date-icon", className: "size-4" }),
9
- time: /* @__PURE__ */ r(I, { "aria-label": "time-icon", className: "size-4" }),
10
- datetime: /* @__PURE__ */ r(A, { "aria-label": "datetime-icon", className: "size-4" })
11
- }, g = (e, o) => a(
12
- "absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none",
13
- "flex items-center justify-center",
14
- "transition-colors duration-150",
15
- o || e ? "text-foreground" : "text-muted-foreground",
16
- "group-hover:text-foreground"
17
- ), _ = ({
18
- value: e,
19
- format: o,
20
- placeholder: b,
21
- onClick: n,
22
- isOpen: t,
23
- className: i,
24
- ariaLabel: l = v,
25
- variant: s = "date",
26
- activeRangePart: f,
27
- onRangePartClick: x,
28
- popoverId: c
29
- }) => {
30
- if (Array.isArray(e)) {
31
- const N = e[0] !== null || e[1] !== null;
32
- return /* @__PURE__ */ u(
33
- "div",
34
- {
35
- "data-slot": "date-time-input",
36
- className: a(
37
- "relative flex items-center cursor-pointer w-full group",
38
- i
39
- ),
40
- role: "combobox",
41
- "aria-label": l,
42
- "aria-expanded": t,
43
- "aria-controls": c,
44
- onClick: n,
45
- children: [
46
- /* @__PURE__ */ r(
47
- R,
48
- {
49
- startDate: e[0],
50
- endDate: e[1],
51
- format: o,
52
- activeRangePart: f,
53
- onRangePartClick: x,
54
- isOpen: t
55
- }
56
- ),
57
- /* @__PURE__ */ r("div", { className: g(t, N), children: p[s] })
58
- ]
59
- }
60
- );
61
- }
62
- const d = e?.format(o) ?? "", m = d.length > 0, h = b ?? o;
63
- return /* @__PURE__ */ u(
64
- "div",
65
- {
66
- "data-slot": "date-time-input",
67
- className: a(
68
- "relative flex items-center cursor-pointer w-full group",
69
- i
70
- ),
71
- onClick: n,
72
- children: [
73
- /* @__PURE__ */ r(
74
- D,
75
- {
76
- value: d,
77
- placeholder: h,
78
- onChange: C,
79
- "aria-label": l,
80
- "aria-expanded": t,
81
- "aria-controls": c,
82
- role: "combobox",
83
- className: a(
84
- "border-transparent bg-muted-background cursor-pointer caret-transparent pr-9",
85
- m ? "text-foreground" : "text-muted-foreground",
86
- "hover:border-border-emphasized",
87
- t && "!bg-background !text-foreground !border-border"
88
- )
89
- }
90
- ),
91
- /* @__PURE__ */ r("div", { className: g(t, m), children: p[s] })
92
- ]
93
- }
94
- );
95
- };
96
- export {
97
- v as DEFAULT_ARIA_LABEL,
98
- _ as DateTimeInput
1
+ import { cn as e } from "../../../../../../lib/utils.js";
2
+ import { Input as t } from "../../../input/input.js";
3
+ import { RangeInputDisplay as n } from "./range-input-display.js";
4
+ import { IconCalendar as r, IconCalendarClock as i, IconClock as a } from "@tabler/icons-react";
5
+ import { jsx as o, jsxs as s } from "react/jsx-runtime";
6
+ //#region libs/aura/src/components/ui/core/date-time-pickers/shared/date-time-input/date-time-input.tsx
7
+ var c = "Date picker", l = () => void 0, u = {
8
+ date: /* @__PURE__ */ o(r, {
9
+ "aria-label": "date-icon",
10
+ className: "size-4"
11
+ }),
12
+ time: /* @__PURE__ */ o(a, {
13
+ "aria-label": "time-icon",
14
+ className: "size-4"
15
+ }),
16
+ datetime: /* @__PURE__ */ o(i, {
17
+ "aria-label": "datetime-icon",
18
+ className: "size-4"
19
+ })
20
+ }, d = (t, n) => e("absolute right-3 top-1/2 -translate-y-1/2 pointer-events-none", "flex items-center justify-center", "transition-colors duration-150", n || t ? "text-foreground" : "text-muted-foreground", "group-hover:text-foreground"), f = ({ value: r, format: i, placeholder: a, onClick: f, isOpen: p, className: m, ariaLabel: h = c, variant: g = "date", activeRangePart: _, onRangePartClick: v, popoverId: y }) => {
21
+ if (Array.isArray(r)) {
22
+ let t = r[0] !== null || r[1] !== null;
23
+ return /* @__PURE__ */ s("div", {
24
+ "data-slot": "date-time-input",
25
+ className: e("relative flex items-center cursor-pointer w-full group", m),
26
+ role: "combobox",
27
+ "aria-label": h,
28
+ "aria-expanded": p,
29
+ "aria-controls": y,
30
+ onClick: f,
31
+ children: [/* @__PURE__ */ o(n, {
32
+ startDate: r[0],
33
+ endDate: r[1],
34
+ format: i,
35
+ activeRangePart: _,
36
+ onRangePartClick: v,
37
+ isOpen: p
38
+ }), /* @__PURE__ */ o("div", {
39
+ className: d(p, t),
40
+ children: u[g]
41
+ })]
42
+ });
43
+ }
44
+ let b = r?.format(i) ?? "", x = b.length > 0, S = a ?? i;
45
+ return /* @__PURE__ */ s("div", {
46
+ "data-slot": "date-time-input",
47
+ className: e("relative flex items-center cursor-pointer w-full group", m),
48
+ onClick: f,
49
+ children: [/* @__PURE__ */ o(t, {
50
+ value: b,
51
+ placeholder: S,
52
+ onChange: l,
53
+ "aria-label": h,
54
+ "aria-expanded": p,
55
+ "aria-controls": y,
56
+ role: "combobox",
57
+ className: e("border-transparent bg-muted-background cursor-pointer caret-transparent pr-9", x ? "text-foreground" : "text-muted-foreground", "hover:border-border-emphasized", p && "!bg-background !text-foreground !border-border")
58
+ }), /* @__PURE__ */ o("div", {
59
+ className: d(p, x),
60
+ children: u[g]
61
+ })]
62
+ });
99
63
  };
64
+ //#endregion
65
+ export { c as DEFAULT_ARIA_LABEL, f as DateTimeInput };
@@ -1,68 +1,39 @@
1
- import { jsxs as p, jsx as o } from "react/jsx-runtime";
2
- import { cn as n } from "../../../../../../lib/utils.js";
3
- const a = "px-1 py-0.5 rounded-sm transition-colors duration-150", i = "text-muted-foreground group-hover:text-foreground transition-colors duration-150", x = ({
4
- startDate: d,
5
- endDate: t,
6
- format: e,
7
- activeRangePart: s,
8
- onRangePartClick: r,
9
- isOpen: l
10
- }) => {
11
- const u = d !== null || t !== null, c = (b) => (g) => {
12
- r && (g.stopPropagation(), r(b));
13
- };
14
- return /* @__PURE__ */ p(
15
- "div",
16
- {
17
- className: n(
18
- "flex items-center w-full py-1 px-3 pr-9 border rounded-lg",
19
- "text-sm leading-5 h-9 box-border whitespace-nowrap overflow-hidden",
20
- "transition-[background,border-color,color,box-shadow] duration-150",
21
- l ? "bg-background text-foreground border-border shadow-focus-ring" : [
22
- "bg-muted-background border-transparent",
23
- "hover:bg-accent-background hover:text-foreground hover:border-border-emphasized",
24
- u ? "text-foreground" : "text-muted-foreground"
25
- ]
26
- ),
27
- children: [
28
- /* @__PURE__ */ o(
29
- "span",
30
- {
31
- className: n(
32
- a,
33
- r ? "cursor-pointer" : "cursor-default",
34
- s === "start" ? "bg-active-muted-background" : r && "hover:bg-active-muted-background-hover"
35
- ),
36
- onClick: c("start"),
37
- children: d ? d.format(e) : /* @__PURE__ */ o("span", { className: i, children: e })
38
- }
39
- ),
40
- /* @__PURE__ */ o(
41
- "span",
42
- {
43
- className: n(
44
- "select-none transition-colors duration-150",
45
- u ? "text-foreground" : "text-muted-foreground group-hover:text-foreground"
46
- ),
47
- children: " – "
48
- }
49
- ),
50
- /* @__PURE__ */ o(
51
- "span",
52
- {
53
- className: n(
54
- a,
55
- r ? "cursor-pointer" : "cursor-default",
56
- s === "end" ? "bg-active-muted-background" : r && "hover:bg-active-muted-background-hover"
57
- ),
58
- onClick: c("end"),
59
- children: t ? t.format(e) : /* @__PURE__ */ o("span", { className: i, children: e })
60
- }
61
- )
62
- ]
63
- }
64
- );
65
- };
66
- export {
67
- x as RangeInputDisplay
1
+ import { cn as e } from "../../../../../../lib/utils.js";
2
+ import { jsx as t, jsxs as n } from "react/jsx-runtime";
3
+ //#region libs/aura/src/components/ui/core/date-time-pickers/shared/date-time-input/range-input-display.tsx
4
+ var r = "px-1 py-0.5 rounded-sm transition-colors duration-150", i = "text-muted-foreground group-hover:text-foreground transition-colors duration-150", a = ({ startDate: a, endDate: o, format: s, activeRangePart: c, onRangePartClick: l, isOpen: u }) => {
5
+ let d = a !== null || o !== null, f = (e) => (t) => {
6
+ l && (t.stopPropagation(), l(e));
7
+ };
8
+ return /* @__PURE__ */ n("div", {
9
+ className: e("flex items-center w-full py-1 px-3 pr-9 border rounded-lg", "text-sm leading-5 h-9 box-border whitespace-nowrap overflow-hidden", "transition-[background,border-color,color,box-shadow] duration-150", u ? "bg-background text-foreground border-border shadow-focus-ring" : [
10
+ "bg-muted-background border-transparent",
11
+ "hover:bg-accent-background hover:text-foreground hover:border-border-emphasized",
12
+ d ? "text-foreground" : "text-muted-foreground"
13
+ ]),
14
+ children: [
15
+ /* @__PURE__ */ t("span", {
16
+ className: e(r, l ? "cursor-pointer" : "cursor-default", c === "start" ? "bg-active-muted-background" : l && "hover:bg-active-muted-background-hover"),
17
+ onClick: f("start"),
18
+ children: a ? a.format(s) : /* @__PURE__ */ t("span", {
19
+ className: i,
20
+ children: s
21
+ })
22
+ }),
23
+ /* @__PURE__ */ t("span", {
24
+ className: e("select-none transition-colors duration-150", d ? "text-foreground" : "text-muted-foreground group-hover:text-foreground"),
25
+ children: " – "
26
+ }),
27
+ /* @__PURE__ */ t("span", {
28
+ className: e(r, l ? "cursor-pointer" : "cursor-default", c === "end" ? "bg-active-muted-background" : l && "hover:bg-active-muted-background-hover"),
29
+ onClick: f("end"),
30
+ children: o ? o.format(s) : /* @__PURE__ */ t("span", {
31
+ className: i,
32
+ children: s
33
+ })
34
+ })
35
+ ]
36
+ });
68
37
  };
38
+ //#endregion
39
+ export { a as RangeInputDisplay };
@@ -1,24 +1,24 @@
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());
10
- }
11
- };
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
20
- };
21
- };
22
- export {
23
- m as usePopoverState
1
+ import { useEffect as e, useRef as t, useState as n } from "react";
2
+ //#region libs/aura/src/components/ui/core/date-time-pickers/shared/hooks/use-popover-state.ts
3
+ var r = (r = {}) => {
4
+ let { onBackspace: i } = r, [a, o] = n(!1), s = t(null), c = t(null);
5
+ return e(() => {
6
+ if (!a) return;
7
+ let e = (e) => {
8
+ if (e.key === "Backspace" && i) {
9
+ let { target: t } = e;
10
+ t instanceof HTMLInputElement || t instanceof HTMLTextAreaElement || t instanceof HTMLElement && t.isContentEditable || (e.preventDefault(), i());
11
+ }
12
+ };
13
+ return document.addEventListener("keydown", e), () => {
14
+ document.removeEventListener("keydown", e);
15
+ };
16
+ }, [a, i]), {
17
+ isOpen: a,
18
+ setIsOpen: o,
19
+ popoverRef: s,
20
+ inputRef: c
21
+ };
24
22
  };
23
+ //#endregion
24
+ export { r as usePopoverState };
@@ -1,63 +1,53 @@
1
- import { useCallback as e, useState as u, useRef as b } from "react";
2
- const A = ({
3
- value: c,
4
- defaultDate: p,
5
- mapDate: a,
6
- onEndDateSelected: S
7
- }) => {
8
- const o = e(
9
- (t, m) => a ? a(t, m) : t,
10
- [a]
11
- ), [E, f] = u(c[0]), [y, M] = u(c[1]), [g, i] = u(
12
- () => c[0] ?? p
13
- ), [C, l] = u(null), n = b({
14
- tempStart: c[0],
15
- tempEnd: c[1]
16
- }), s = e((t) => {
17
- n.current.tempStart = t, f(t);
18
- }, []), r = e((t) => {
19
- n.current.tempEnd = t, M(t);
20
- }, []), R = e(
21
- (t, m) => {
22
- if (m === "start") {
23
- s(o(t, "start")), r(null), l(null);
24
- return;
25
- }
26
- const d = n.current.tempStart;
27
- if (d && t.isBefore(d, "day")) {
28
- s(o(t, "start")), r(null), l(null);
29
- return;
30
- }
31
- const h = o(t, "end");
32
- r(h), l(null), S?.(n.current.tempStart, h);
33
- },
34
- [o, s, r, S]
35
- ), k = e((t) => {
36
- l(t);
37
- }, []), D = e((t) => {
38
- i(t);
39
- }, []), H = e(
40
- (t) => t === "start" ? (s(null), [null, n.current.tempEnd]) : n.current.tempEnd === null ? null : (r(null), [n.current.tempStart, null]),
41
- [s, r]
42
- ), T = e(
43
- (t) => {
44
- s(t[0]), r(t[1]), l(null), i(t[0] ?? p);
45
- },
46
- [s, r, p]
47
- );
48
- return {
49
- tempStart: E,
50
- tempEnd: y,
51
- displayedMonth: g,
52
- hoverDate: C,
53
- stateRef: n,
54
- handleDateClick: R,
55
- handleDateHover: k,
56
- handleMonthChange: D,
57
- clearActiveSegment: H,
58
- resetDates: T
59
- };
60
- };
61
- export {
62
- A as useRangeDateState
1
+ import { useCallback as e, useRef as t, useState as n } from "react";
2
+ //#region libs/aura/src/components/ui/core/date-time-pickers/shared/hooks/use-range-date-state.ts
3
+ var r = ({ value: r, defaultDate: i, mapDate: a, onEndDateSelected: o }) => {
4
+ let s = e((e, t) => a ? a(e, t) : e, [a]), [c, l] = n(r[0]), [u, d] = n(r[1]), [f, p] = n(() => r[0] ?? i), [m, h] = n(null), g = t({
5
+ tempStart: r[0],
6
+ tempEnd: r[1]
7
+ }), _ = e((e) => {
8
+ g.current.tempStart = e, l(e);
9
+ }, []), v = e((e) => {
10
+ g.current.tempEnd = e, d(e);
11
+ }, []);
12
+ return {
13
+ tempStart: c,
14
+ tempEnd: u,
15
+ displayedMonth: f,
16
+ hoverDate: m,
17
+ stateRef: g,
18
+ handleDateClick: e((e, t) => {
19
+ if (t === "start") {
20
+ _(s(e, "start")), v(null), h(null);
21
+ return;
22
+ }
23
+ let n = g.current.tempStart;
24
+ if (n && e.isBefore(n, "day")) {
25
+ _(s(e, "start")), v(null), h(null);
26
+ return;
27
+ }
28
+ let r = s(e, "end");
29
+ v(r), h(null), o?.(g.current.tempStart, r);
30
+ }, [
31
+ s,
32
+ _,
33
+ v,
34
+ o
35
+ ]),
36
+ handleDateHover: e((e) => {
37
+ h(e);
38
+ }, []),
39
+ handleMonthChange: e((e) => {
40
+ p(e);
41
+ }, []),
42
+ clearActiveSegment: e((e) => e === "start" ? (_(null), [null, g.current.tempEnd]) : g.current.tempEnd === null ? null : (v(null), [g.current.tempStart, null]), [_, v]),
43
+ resetDates: e((e) => {
44
+ _(e[0]), v(e[1]), h(null), p(e[0] ?? i);
45
+ }, [
46
+ _,
47
+ v,
48
+ i
49
+ ])
50
+ };
63
51
  };
52
+ //#endregion
53
+ export { r as useRangeDateState };
@@ -1,19 +1,19 @@
1
- import { useState as o, useCallback as e } from "react";
2
- const p = () => {
3
- const [s, t] = o("start"), a = e(() => {
4
- t("end");
5
- }, []), n = e(() => {
6
- t("start");
7
- }, []), r = e(() => {
8
- t("start");
9
- }, []);
10
- return {
11
- step: s,
12
- handleNext: a,
13
- handleBack: n,
14
- resetStep: r
15
- };
16
- };
17
- export {
18
- p as useRangeStepManager
1
+ import { useCallback as e, useState as t } from "react";
2
+ //#region libs/aura/src/components/ui/core/date-time-pickers/shared/hooks/use-range-step-manager.ts
3
+ var n = () => {
4
+ let [n, r] = t("start");
5
+ return {
6
+ step: n,
7
+ handleNext: e(() => {
8
+ r("end");
9
+ }, []),
10
+ handleBack: e(() => {
11
+ r("start");
12
+ }, []),
13
+ resetStep: e(() => {
14
+ r("start");
15
+ }, [])
16
+ };
19
17
  };
18
+ //#endregion
19
+ export { n as useRangeStepManager };