@overdoser/react-toolkit 0.20.0 → 0.22.0

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 (212) hide show
  1. package/AGENTS.md +2 -1
  2. package/CHANGELOG.md +41 -0
  3. package/components/Accordion/Accordion.js +160 -177
  4. package/components/Accordion/Accordion.module.scss.js +19 -35
  5. package/components/ActionButton/ActionButton.js +155 -209
  6. package/components/ActionButton/ActionButton.module.scss.js +24 -46
  7. package/components/ActionButton/CopyButton.js +52 -64
  8. package/components/Alert/Alert.js +93 -96
  9. package/components/Alert/Alert.module.scss.js +17 -32
  10. package/components/Avatar/Avatar.js +44 -55
  11. package/components/Avatar/Avatar.module.scss.js +22 -42
  12. package/components/Badge/Badge.js +15 -37
  13. package/components/Badge/Badge.module.scss.js +16 -30
  14. package/components/Breadcrumbs/Breadcrumbs.d.ts +1 -1
  15. package/components/Breadcrumbs/Breadcrumbs.js +52 -48
  16. package/components/Breadcrumbs/Breadcrumbs.module.scss.js +9 -16
  17. package/components/Button/Button.js +35 -57
  18. package/components/Button/Button.module.scss.js +24 -46
  19. package/components/Card/Card.js +94 -131
  20. package/components/Card/Card.module.scss.js +34 -59
  21. package/components/Chart/AreaChart.d.ts +1 -1
  22. package/components/Chart/AreaChart.js +248 -249
  23. package/components/Chart/Axis.d.ts +2 -2
  24. package/components/Chart/Axis.js +34 -43
  25. package/components/Chart/BarChart.d.ts +1 -1
  26. package/components/Chart/BarChart.js +307 -348
  27. package/components/Chart/Chart.module.scss.js +31 -60
  28. package/components/Chart/ChartContainer.js +33 -41
  29. package/components/Chart/ChartLegend.d.ts +1 -1
  30. package/components/Chart/ChartLegend.js +31 -30
  31. package/components/Chart/ChartTooltip.d.ts +1 -1
  32. package/components/Chart/ChartTooltip.js +45 -40
  33. package/components/Chart/LineChart.d.ts +1 -1
  34. package/components/Chart/LineChart.js +220 -232
  35. package/components/Chart/PieChart.d.ts +1 -1
  36. package/components/Chart/PieChart.js +224 -240
  37. package/components/Chart/RadarChart.d.ts +1 -1
  38. package/components/Chart/RadarChart.js +166 -215
  39. package/components/Chart/Sparkline.js +73 -68
  40. package/components/Chart/TradingChart.d.ts +1 -1
  41. package/components/Chart/TradingChart.js +804 -701
  42. package/components/Chart/scales.js +28 -35
  43. package/components/Chart/trading/indicators.js +61 -62
  44. package/components/Chart/trading/period.js +46 -68
  45. package/components/Chart/useChartDimensions.js +30 -22
  46. package/components/Chip/Chip.js +98 -141
  47. package/components/Chip/Chip.module.scss.js +31 -58
  48. package/components/CodeBlock/CodeBlock.js +111 -119
  49. package/components/CodeBlock/CodeBlock.module.scss.js +22 -42
  50. package/components/CommandPalette/CommandPalette.js +387 -392
  51. package/components/CommandPalette/CommandPalette.module.scss.js +27 -48
  52. package/components/ConfirmDialog/ConfirmDialog.d.ts +1 -1
  53. package/components/ConfirmDialog/ConfirmDialog.js +184 -199
  54. package/components/ConfirmDialog/ConfirmDialog.module.scss.js +11 -20
  55. package/components/Divider/Divider.js +25 -36
  56. package/components/Divider/Divider.module.scss.js +16 -30
  57. package/components/Draggable/Draggable.d.ts +1 -1
  58. package/components/Draggable/Draggable.js +157 -164
  59. package/components/Draggable/Draggable.module.scss.js +9 -16
  60. package/components/Drawer/Drawer.js +104 -126
  61. package/components/Drawer/Drawer.module.scss.js +65 -118
  62. package/components/Dropdown/Dropdown.js +175 -234
  63. package/components/Dropdown/Dropdown.module.scss.js +28 -52
  64. package/components/Dropdown/DropdownItem.js +55 -58
  65. package/components/Dropdown/DropdownLabel.js +14 -11
  66. package/components/Dropdown/DropdownSeparator.js +13 -11
  67. package/components/Dropdown/dropdownContext.js +4 -5
  68. package/components/Dropdown/useContextMenu.js +27 -17
  69. package/components/Dropzone/Dropzone.js +99 -105
  70. package/components/Dropzone/Dropzone.module.scss.js +11 -20
  71. package/components/EmptyState/EmptyState.js +57 -54
  72. package/components/EmptyState/EmptyState.module.scss.js +13 -24
  73. package/components/Form/Form.d.ts +1 -1
  74. package/components/Form/Form.js +31 -34
  75. package/components/Form/Form.module.scss.js +15 -28
  76. package/components/Form/FormField.d.ts +1 -1
  77. package/components/Form/FormField.js +71 -75
  78. package/components/Form/FormRow.d.ts +1 -1
  79. package/components/Form/FormRow.js +11 -8
  80. package/components/Form/formFieldDefaults.js +4 -5
  81. package/components/ImageViewer/ImageViewer.js +312 -201
  82. package/components/ImageViewer/ImageViewer.module.scss.js +25 -46
  83. package/components/ImageViewer/useZoomPan.js +206 -137
  84. package/components/Kbd/Kbd.js +24 -21
  85. package/components/Kbd/Kbd.module.scss.js +9 -16
  86. package/components/KeyValueList/KeyValueList.js +119 -123
  87. package/components/KeyValueList/KeyValueList.module.scss.js +22 -42
  88. package/components/Link/Link.js +45 -59
  89. package/components/Link/Link.module.scss.js +9 -15
  90. package/components/List/List.js +22 -46
  91. package/components/List/List.module.scss.js +11 -20
  92. package/components/Loader/Loader.js +152 -182
  93. package/components/Loader/Loader.module.scss.js +39 -69
  94. package/components/Modal/Modal.js +93 -105
  95. package/components/Modal/Modal.module.scss.js +17 -32
  96. package/components/PageHeader/PageHeader.js +79 -73
  97. package/components/PageHeader/PageHeader.module.scss.js +22 -42
  98. package/components/Pagination/Pagination.js +62 -83
  99. package/components/Pagination/Pagination.module.scss.js +12 -22
  100. package/components/Pagination/paginationRange.js +15 -22
  101. package/components/Popover/Popover.js +110 -134
  102. package/components/Popover/Popover.module.scss.js +11 -20
  103. package/components/ProgressBar/ProgressBar.d.ts +15 -1
  104. package/components/ProgressBar/ProgressBar.js +56 -89
  105. package/components/ProgressBar/ProgressBar.module.scss.js +28 -50
  106. package/components/RelativeTime/RelativeTime.js +36 -43
  107. package/components/RelativeTime/RelativeTime.module.scss.js +3 -7
  108. package/components/SegmentedControl/SegmentedControl.js +93 -129
  109. package/components/SegmentedControl/SegmentedControl.module.scss.js +20 -38
  110. package/components/Skeleton/Skeleton.js +36 -50
  111. package/components/Skeleton/Skeleton.module.scss.js +14 -24
  112. package/components/Spinner/Spinner.js +25 -25
  113. package/components/Spinner/Spinner.module.scss.js +11 -19
  114. package/components/SplitButton/SplitButton.js +149 -196
  115. package/components/SplitButton/SplitButton.module.scss.js +30 -56
  116. package/components/SplitPane/SplitPane.js +134 -170
  117. package/components/SplitPane/SplitPane.module.scss.js +13 -24
  118. package/components/StatCard/StatCard.js +132 -125
  119. package/components/StatCard/StatCard.module.scss.js +41 -71
  120. package/components/StatusDot/StatusDot.js +28 -39
  121. package/components/StatusDot/StatusDot.module.scss.js +17 -31
  122. package/components/Table/Table.d.ts +1 -1
  123. package/components/Table/Table.js +381 -451
  124. package/components/Table/Table.module.scss.js +41 -80
  125. package/components/Table/useTableSort.js +51 -42
  126. package/components/Tabs/Tabs.js +109 -161
  127. package/components/Tabs/Tabs.module.scss.js +27 -52
  128. package/components/ThemeToggle/ThemeToggle.js +122 -98
  129. package/components/ThemeToggle/ThemeToggle.module.scss.js +12 -22
  130. package/components/Timeline/GanttTimeline.js +357 -318
  131. package/components/Timeline/GanttTimeline.module.scss.js +28 -54
  132. package/components/Timeline/HistoryTimeline.js +486 -450
  133. package/components/Timeline/HistoryTimeline.module.scss.js +30 -58
  134. package/components/Timeline/Timeline.module.scss.js +75 -140
  135. package/components/Timeline/TimelineShared.d.ts +7 -7
  136. package/components/Timeline/TimelineShared.js +288 -279
  137. package/components/Timeline/TraceEventDetails.d.ts +3 -3
  138. package/components/Timeline/TraceEventDetails.js +244 -177
  139. package/components/Timeline/TraceTimeline.js +823 -783
  140. package/components/Timeline/TraceTimeline.module.scss.js +97 -188
  141. package/components/Timeline/historyLayout.js +336 -263
  142. package/components/Timeline/timelineCore.js +208 -183
  143. package/components/Timeline/traceEvent.js +59 -61
  144. package/components/Timeline/traceLayout.js +101 -90
  145. package/components/Timeline/useTimeline.js +76 -79
  146. package/components/Timer/Timer.js +190 -156
  147. package/components/Timer/Timer.module.scss.js +28 -54
  148. package/components/Toast/Toast.d.ts +1 -1
  149. package/components/Toast/Toast.js +128 -128
  150. package/components/Toast/Toast.module.scss.js +36 -61
  151. package/components/Toast/toastStore.js +58 -62
  152. package/components/ToggleIconButton/ToggleIconButton.js +36 -58
  153. package/components/ToggleIconButton/ToggleIconButton.module.scss.js +14 -26
  154. package/components/Tooltip/Tooltip.d.ts +1 -1
  155. package/components/Tooltip/Tooltip.js +76 -85
  156. package/components/Tooltip/Tooltip.module.scss.js +16 -29
  157. package/components/Typography/Typography.js +10 -35
  158. package/components/Typography/Typography.module.scss.js +29 -52
  159. package/components/inputs/Checkbox/Checkbox.js +27 -51
  160. package/components/inputs/Checkbox/Checkbox.module.scss.js +9 -16
  161. package/components/inputs/Checkbox/CheckboxGroup.js +53 -111
  162. package/components/inputs/Checkbox/CheckboxGroup.module.scss.js +16 -30
  163. package/components/inputs/DatePicker/CalendarPanel.d.ts +1 -1
  164. package/components/inputs/DatePicker/CalendarPanel.js +263 -286
  165. package/components/inputs/DatePicker/CalendarPanel.module.scss.js +22 -40
  166. package/components/inputs/DatePicker/DatePicker.js +115 -142
  167. package/components/inputs/DatePicker/DatePicker.module.scss.js +13 -24
  168. package/components/inputs/DatePicker/dateUtils.js +32 -41
  169. package/components/inputs/DateTimePicker/DateTimePicker.js +226 -232
  170. package/components/inputs/DateTimePicker/DateTimePicker.module.scss.js +19 -36
  171. package/components/inputs/DateTimePicker/DateTimeSegments.js +273 -252
  172. package/components/inputs/DateTimePicker/TimeField.d.ts +1 -1
  173. package/components/inputs/DateTimePicker/TimeField.js +131 -132
  174. package/components/inputs/DateTimePicker/timeZoneUtils.js +95 -92
  175. package/components/inputs/Input/Input.js +98 -109
  176. package/components/inputs/Input/Input.module.scss.js +14 -26
  177. package/components/inputs/NumberInput/NumberInput.js +112 -132
  178. package/components/inputs/NumberInput/NumberInput.module.scss.js +13 -24
  179. package/components/inputs/Radio/Radio.js +50 -73
  180. package/components/inputs/Radio/Radio.module.scss.js +8 -14
  181. package/components/inputs/SearchInput/SearchInput.js +98 -115
  182. package/components/inputs/SearchInput/SearchInput.module.scss.js +7 -12
  183. package/components/inputs/Select/Select.d.ts +55 -3
  184. package/components/inputs/Select/Select.js +696 -682
  185. package/components/inputs/Select/Select.module.scss.js +49 -72
  186. package/components/inputs/Slider/Slider.js +97 -128
  187. package/components/inputs/Slider/Slider.module.scss.js +8 -14
  188. package/components/inputs/Switch/Switch.js +11 -8
  189. package/components/inputs/Textarea/Textarea.js +42 -58
  190. package/components/inputs/Textarea/Textarea.module.scss.js +13 -24
  191. package/hooks/useClickOutside.js +17 -14
  192. package/hooks/useDebouncedValue.js +13 -14
  193. package/hooks/useElementSize.js +27 -22
  194. package/hooks/useEscapeLayer.js +28 -29
  195. package/hooks/useFocusTrap.js +27 -38
  196. package/hooks/useKeyboard.js +76 -64
  197. package/hooks/useMediaQuery.js +10 -15
  198. package/hooks/useNow.js +28 -33
  199. package/hooks/usePersistedState.js +98 -94
  200. package/hooks/usePortalPosition.d.ts +2 -1
  201. package/hooks/usePortalPosition.js +28 -19
  202. package/hooks/useResizable.js +106 -104
  203. package/hooks/useTheme.js +28 -23
  204. package/index.css +2 -1
  205. package/index.js +96 -214
  206. package/index.layered.css +2 -3
  207. package/llms.txt +28 -4
  208. package/manifest.json +41 -4
  209. package/package.json +1 -1
  210. package/utils/formatBytes.js +29 -13
  211. package/utils/themeScript.js +6 -8
  212. package/utils/timeAgo.js +59 -32
@@ -1,286 +1,295 @@
1
- import { jsxs as h, Fragment as L, jsx as t } from "react/jsx-runtime";
2
- import { useRef as T, useState as D, useEffect as S } from "react";
3
- import c from "clsx";
4
- import e from "./Timeline.module.scss.js";
5
- import { highlightParts as Z } from "./timelineCore.js";
6
- import { Draggable as E } from "../Draggable/Draggable.js";
7
- function G({
8
- items: o,
9
- className: s
10
- }) {
11
- return o.length ? /* @__PURE__ */ t("div", { className: c(e.legend, s), children: o.map((a) => /* @__PURE__ */ h("span", { className: e.legendItem, children: [
12
- /* @__PURE__ */ t("span", { className: e.legendDot, style: { background: a.color } }),
13
- a.name
14
- ] }, a.name)) }) : null;
1
+ import { useEffect as e, useRef as t, useState as n } from "react";
2
+ import r from "clsx";
3
+ import i from "./Timeline.module.scss.js";
4
+ import { highlightParts as a } from "./timelineCore.js";
5
+ import { Draggable as o } from "../Draggable/Draggable.js";
6
+ import { Fragment as s, jsx as c, jsxs as l } from "react/jsx-runtime";
7
+ // src/components/Timeline/TimelineShared.tsx
8
+ function u({ items: e, className: t }) {
9
+ return e.length ? /* @__PURE__ */ c("div", {
10
+ className: r(i.legend, t),
11
+ children: e.map((e) => /* @__PURE__ */ l("span", {
12
+ className: i.legendItem,
13
+ children: [/* @__PURE__ */ c("span", {
14
+ className: i.legendDot,
15
+ style: { background: e.color }
16
+ }), e.name]
17
+ }, e.name))
18
+ }) : null;
15
19
  }
16
- function J({
17
- zoomPct: o,
18
- fitActive: s,
19
- onZoomIn: a,
20
- onZoomOut: r,
21
- onFit: i,
22
- hint: p,
23
- children: b,
24
- className: f
25
- }) {
26
- return /* @__PURE__ */ h("div", { className: c(e.controls, f), children: [
27
- b,
28
- /* @__PURE__ */ t("button", { type: "button", className: e.zoomBtn, title: "Zoom out", onClick: r, children: "−" }),
29
- /* @__PURE__ */ t("span", { className: e.zoomPct, children: o }),
30
- /* @__PURE__ */ t("button", { type: "button", className: e.zoomBtn, title: "Zoom in", onClick: a, children: "+" }),
31
- /* @__PURE__ */ t(
32
- "button",
33
- {
34
- type: "button",
35
- className: c(e.fitBtn, s && e.fitBtnActive),
36
- onClick: i,
37
- children: "Fit"
38
- }
39
- ),
40
- p ? /* @__PURE__ */ t("span", { className: e.controlsHint, children: p }) : null
41
- ] });
20
+ function d({ zoomPct: e, fitActive: t, onZoomIn: n, onZoomOut: a, onFit: o, hint: s, children: u, className: d }) {
21
+ return /* @__PURE__ */ l("div", {
22
+ className: r(i.controls, d),
23
+ children: [
24
+ u,
25
+ /* @__PURE__ */ c("button", {
26
+ type: "button",
27
+ className: i.zoomBtn,
28
+ title: "Zoom out",
29
+ onClick: a,
30
+ children: "−"
31
+ }),
32
+ /* @__PURE__ */ c("span", {
33
+ className: i.zoomPct,
34
+ children: e
35
+ }),
36
+ /* @__PURE__ */ c("button", {
37
+ type: "button",
38
+ className: i.zoomBtn,
39
+ title: "Zoom in",
40
+ onClick: n,
41
+ children: "+"
42
+ }),
43
+ /* @__PURE__ */ c("button", {
44
+ type: "button",
45
+ className: r(i.fitBtn, t && i.fitBtnActive),
46
+ onClick: o,
47
+ children: "Fit"
48
+ }),
49
+ s ? /* @__PURE__ */ c("span", {
50
+ className: i.controlsHint,
51
+ children: s
52
+ }) : null
53
+ ]
54
+ });
42
55
  }
43
- function Q({
44
- value: o,
45
- options: s,
46
- onChange: a
47
- }) {
48
- return /* @__PURE__ */ t("div", { className: e.segmented, children: s.map((r) => /* @__PURE__ */ t(
49
- "button",
50
- {
51
- type: "button",
52
- title: r.title,
53
- className: c(e.segmentedBtn, r.value === o && e.segmentedBtnActive),
54
- onClick: () => a(r.value),
55
- children: r.label
56
- },
57
- r.value
58
- )) });
56
+ function f({ value: e, options: t, onChange: n }) {
57
+ return /* @__PURE__ */ c("div", {
58
+ className: i.segmented,
59
+ children: t.map((t) => /* @__PURE__ */ c("button", {
60
+ type: "button",
61
+ title: t.title,
62
+ className: r(i.segmentedBtn, t.value === e && i.segmentedBtnActive),
63
+ onClick: () => n(t.value),
64
+ children: t.label
65
+ }, t.value))
66
+ });
59
67
  }
60
- function j({
61
- panel: o,
62
- width: s,
63
- min: a,
64
- max: r,
65
- onResize: i,
66
- label: p,
67
- className: b
68
- }) {
69
- const f = T(null), [y, B] = D(!1), g = T(s);
70
- g.current = s;
71
- const u = (l) => Math.min(r, Math.max(a, l));
72
- return S(() => {
73
- if (!y) return;
74
- const l = (P) => {
75
- const k = f.current;
76
- if (!k) return;
77
- const v = P.clientX - k.x;
78
- i(Math.min(r, Math.max(a, k.w + (o === "left" ? v : -v))));
79
- }, d = () => {
80
- f.current = null, B(!1);
81
- };
82
- return window.addEventListener("pointermove", l), window.addEventListener("pointerup", d), () => {
83
- window.removeEventListener("pointermove", l), window.removeEventListener("pointerup", d);
84
- };
85
- }, [y, o, a, r, i]), /* @__PURE__ */ t(
86
- "div",
87
- {
88
- className: c(e.dockResizer, y && e.dockResizerActive, b),
89
- role: "separator",
90
- "aria-orientation": "vertical",
91
- "aria-label": p,
92
- tabIndex: 0,
93
- onPointerDown: (l) => {
94
- l.button > 0 || (l.preventDefault(), f.current = { x: l.clientX, w: g.current }, B(!0));
95
- },
96
- onKeyDown: (l) => {
97
- const d = l.key === "ArrowLeft" ? -16 : l.key === "ArrowRight" ? 16 : 0;
98
- d && (l.preventDefault(), i(u(g.current + (o === "left" ? d : -d))));
99
- }
100
- }
101
- );
68
+ function p({ panel: a, width: o, min: s, max: l, onResize: u, label: d, className: f }) {
69
+ let p = t(null), [m, h] = n(!1), g = t(o);
70
+ g.current = o;
71
+ let _ = (e) => Math.min(l, Math.max(s, e));
72
+ return e(() => {
73
+ if (!m) return;
74
+ let e = (e) => {
75
+ let t = p.current;
76
+ if (!t) return;
77
+ let n = e.clientX - t.x;
78
+ u(Math.min(l, Math.max(s, t.w + (a === "left" ? n : -n))));
79
+ }, t = () => {
80
+ p.current = null, h(!1);
81
+ };
82
+ return window.addEventListener("pointermove", e), window.addEventListener("pointerup", t), () => {
83
+ window.removeEventListener("pointermove", e), window.removeEventListener("pointerup", t);
84
+ };
85
+ }, [
86
+ m,
87
+ a,
88
+ s,
89
+ l,
90
+ u
91
+ ]), /* @__PURE__ */ c("div", {
92
+ className: r(i.dockResizer, m && i.dockResizerActive, f),
93
+ role: "separator",
94
+ "aria-orientation": "vertical",
95
+ "aria-label": d,
96
+ tabIndex: 0,
97
+ onPointerDown: (e) => {
98
+ e.button > 0 || (e.preventDefault(), p.current = {
99
+ x: e.clientX,
100
+ w: g.current
101
+ }, h(!0));
102
+ },
103
+ onKeyDown: (e) => {
104
+ let t = e.key === "ArrowLeft" ? -16 : e.key === "ArrowRight" ? 16 : 0;
105
+ t && (e.preventDefault(), u(_(g.current + (a === "left" ? t : -t))));
106
+ }
107
+ });
102
108
  }
103
- function Y({
104
- heading: o = "Events",
105
- items: s,
106
- onPick: a,
107
- placement: r = "left",
108
- floatingDefaultPosition: i,
109
- bubbleGlyphColors: p,
110
- className: b
111
- }) {
112
- const f = T(null), y = T(!1), [B, g] = D(!1), [u, l] = D(!1), [d, P] = D(262), [k, v] = D({ x: 0, y: 0 }), N = r === "bubble", H = r === "floating", z = H || N && !u, A = r === "top" || r === "bottom";
113
- let w = -1, C = -1;
114
- s.forEach((n, m) => {
115
- n.inView && (w < 0 && (w = m), C = m);
116
- });
117
- const M = w === 0 && C === s.length - 1;
118
- S(() => {
119
- const n = f.current;
120
- if (!n || y.current || w < 0 || M) return;
121
- const m = n.querySelectorAll("[data-timeline-summary-row]"), I = m[w], R = m[C];
122
- if (!I || !R) return;
123
- const V = (I.offsetTop + R.offsetTop + R.offsetHeight) / 2;
124
- n.scrollTop = Math.max(0, V - n.clientHeight / 2);
125
- }, [w, C, M]);
126
- const F = /* @__PURE__ */ h(L, { children: [
127
- /* @__PURE__ */ h("span", { children: [
128
- z && /* @__PURE__ */ t("span", { className: e.summaryGrip, "aria-hidden": !0, children: "⠿" }),
129
- o
130
- ] }),
131
- N ? /* @__PURE__ */ h("span", { className: e.summaryHeadTools, children: [
132
- /* @__PURE__ */ t("span", { className: e.summaryCount, children: s.length }),
133
- /* @__PURE__ */ t(
134
- "button",
135
- {
136
- type: "button",
137
- className: e.summaryDockBtn,
138
- "aria-label": u ? "Undock event summary" : "Dock event summary",
139
- title: u ? "Float the panel" : "Dock to the left edge",
140
- onClick: (n) => {
141
- n.stopPropagation(), l(!u), v({ x: 0, y: 0 });
142
- },
143
- onPointerDown: (n) => n.stopPropagation(),
144
- children: u ? "⇱" : "⇤"
145
- }
146
- ),
147
- /* @__PURE__ */ t(
148
- "button",
149
- {
150
- type: "button",
151
- className: e.summaryCollapse,
152
- "aria-label": "Collapse event summary",
153
- onClick: (n) => {
154
- n.stopPropagation(), g(!1), v({ x: 0, y: 0 });
155
- },
156
- onPointerDown: (n) => n.stopPropagation(),
157
- children: "×"
158
- }
159
- )
160
- ] }) : /* @__PURE__ */ t("span", { className: e.summaryCount, children: s.length })
161
- ] }), x = /* @__PURE__ */ h(
162
- "div",
163
- {
164
- className: c(
165
- e.summary,
166
- A && e.summaryHorizontal,
167
- r === "top" && e.summaryTop,
168
- r === "bottom" && e.summaryBottom,
169
- H && e.summaryFloatingCard,
170
- N && e.summaryBubbleCard,
171
- N && u && e.summaryDockCard,
172
- b
173
- ),
174
- onMouseEnter: () => {
175
- y.current = !0;
176
- },
177
- onMouseLeave: () => {
178
- y.current = !1;
179
- },
180
- children: [
181
- z ? /* @__PURE__ */ t(E.Handle, { className: c(e.summaryHeader, e.summaryHandle), children: F }) : /* @__PURE__ */ t("div", { className: e.summaryHeader, children: F }),
182
- /* @__PURE__ */ t(
183
- "div",
184
- {
185
- ref: f,
186
- className: c(e.summaryList, A && e.summaryListGrid),
187
- children: s.map((n) => /* @__PURE__ */ h(
188
- "div",
189
- {
190
- "data-timeline-summary-row": !0,
191
- role: "button",
192
- tabIndex: 0,
193
- className: c(
194
- e.summaryRow,
195
- n.inView && e.summaryRowInView,
196
- n.selected && e.summaryRowSelected
197
- ),
198
- onClick: () => a(n.id),
199
- onKeyDown: (m) => {
200
- (m.key === "Enter" || m.key === " ") && (m.preventDefault(), a(n.id));
201
- },
202
- children: [
203
- /* @__PURE__ */ t("span", { className: e.summaryNum, children: n.number }),
204
- /* @__PURE__ */ t("span", { className: e.summaryDot, style: { background: n.color } }),
205
- /* @__PURE__ */ t("span", { className: e.summaryLabel, children: n.label }),
206
- n.time && /* @__PURE__ */ t("span", { className: e.summaryTime, children: n.time })
207
- ]
208
- },
209
- n.id
210
- ))
211
- }
212
- ),
213
- N && /* @__PURE__ */ t("div", { className: e.summaryFootnote, children: "Tinted rows are in the viewport" })
214
- ]
215
- }
216
- );
217
- return N ? B ? u ? /* @__PURE__ */ h("div", { className: e.summaryDock, style: { flexBasis: d }, children: [
218
- x,
219
- /* @__PURE__ */ t(
220
- j,
221
- {
222
- panel: "left",
223
- width: d,
224
- min: 200,
225
- max: 520,
226
- onResize: P,
227
- label: "Resize event summary",
228
- className: e.summaryDockResizer
229
- }
230
- )
231
- ] }) : /* @__PURE__ */ t("div", { className: e.summaryBubbleAnchor, children: /* @__PURE__ */ t(
232
- E,
233
- {
234
- className: e.summaryBubblePanel,
235
- bounds: "viewport",
236
- position: k,
237
- onDrag: v,
238
- children: x
239
- }
240
- ) }) : /* @__PURE__ */ t("div", { className: e.summaryBubbleAnchor, children: /* @__PURE__ */ h(
241
- "button",
242
- {
243
- type: "button",
244
- className: c(e.summaryBubble, b),
245
- title: "Event summary",
246
- onClick: () => g(!0),
247
- children: [
248
- /* @__PURE__ */ t("span", { className: e.summaryBubbleGlyph, "aria-hidden": !0, children: (p && p.length ? p : ["var(--crk-timeline-accent)"]).slice(0, 3).map((n, m) => /* @__PURE__ */ t("span", { style: { background: n } }, m)) }),
249
- o,
250
- /* @__PURE__ */ t("span", { className: e.summaryCount, children: s.length })
251
- ]
252
- }
253
- ) }) : H ? /* @__PURE__ */ t(
254
- E,
255
- {
256
- className: e.summaryFloating,
257
- bounds: "viewport",
258
- defaultPosition: i ?? { x: 0, y: 0 },
259
- children: x
260
- }
261
- ) : x;
109
+ function m({ heading: a = "Events", items: u, onPick: d, placement: f = "left", floatingDefaultPosition: m, bubbleGlyphColors: h, className: g }) {
110
+ let _ = t(null), v = t(!1), [y, b] = n(!1), [x, S] = n(!1), [C, w] = n(262), [T, E] = n({
111
+ x: 0,
112
+ y: 0
113
+ }), D = f === "bubble", O = f === "floating", k = O || D && !x, A = f === "top" || f === "bottom", j = -1, M = -1;
114
+ u.forEach((e, t) => {
115
+ e.inView && (j < 0 && (j = t), M = t);
116
+ });
117
+ let N = j === 0 && M === u.length - 1;
118
+ e(() => {
119
+ let e = _.current;
120
+ if (!e || v.current || j < 0 || N) return;
121
+ let t = e.querySelectorAll("[data-timeline-summary-row]"), n = t[j], r = t[M];
122
+ if (!n || !r) return;
123
+ let i = (n.offsetTop + r.offsetTop + r.offsetHeight) / 2;
124
+ e.scrollTop = Math.max(0, i - e.clientHeight / 2);
125
+ }, [
126
+ j,
127
+ M,
128
+ N
129
+ ]);
130
+ let P = /* @__PURE__ */ l(s, { children: [/* @__PURE__ */ l("span", { children: [k && /* @__PURE__ */ c("span", {
131
+ className: i.summaryGrip,
132
+ "aria-hidden": !0,
133
+ children: "⠿"
134
+ }), a] }), D ? /* @__PURE__ */ l("span", {
135
+ className: i.summaryHeadTools,
136
+ children: [
137
+ /* @__PURE__ */ c("span", {
138
+ className: i.summaryCount,
139
+ children: u.length
140
+ }),
141
+ /* @__PURE__ */ c("button", {
142
+ type: "button",
143
+ className: i.summaryDockBtn,
144
+ "aria-label": x ? "Undock event summary" : "Dock event summary",
145
+ title: x ? "Float the panel" : "Dock to the left edge",
146
+ onClick: (e) => {
147
+ e.stopPropagation(), S(!x), E({
148
+ x: 0,
149
+ y: 0
150
+ });
151
+ },
152
+ onPointerDown: (e) => e.stopPropagation(),
153
+ children: x ? "⇱" : "⇤"
154
+ }),
155
+ /* @__PURE__ */ c("button", {
156
+ type: "button",
157
+ className: i.summaryCollapse,
158
+ "aria-label": "Collapse event summary",
159
+ onClick: (e) => {
160
+ e.stopPropagation(), b(!1), E({
161
+ x: 0,
162
+ y: 0
163
+ });
164
+ },
165
+ onPointerDown: (e) => e.stopPropagation(),
166
+ children: "×"
167
+ })
168
+ ]
169
+ }) : /* @__PURE__ */ c("span", {
170
+ className: i.summaryCount,
171
+ children: u.length
172
+ })] }), F = /* @__PURE__ */ l("div", {
173
+ className: r(i.summary, A && i.summaryHorizontal, f === "top" && i.summaryTop, f === "bottom" && i.summaryBottom, O && i.summaryFloatingCard, D && i.summaryBubbleCard, D && x && i.summaryDockCard, g),
174
+ onMouseEnter: () => {
175
+ v.current = !0;
176
+ },
177
+ onMouseLeave: () => {
178
+ v.current = !1;
179
+ },
180
+ children: [
181
+ k ? /* @__PURE__ */ c(o.Handle, {
182
+ className: r(i.summaryHeader, i.summaryHandle),
183
+ children: P
184
+ }) : /* @__PURE__ */ c("div", {
185
+ className: i.summaryHeader,
186
+ children: P
187
+ }),
188
+ /* @__PURE__ */ c("div", {
189
+ ref: _,
190
+ className: r(i.summaryList, A && i.summaryListGrid),
191
+ children: u.map((e) => /* @__PURE__ */ l("div", {
192
+ "data-timeline-summary-row": !0,
193
+ role: "button",
194
+ tabIndex: 0,
195
+ className: r(i.summaryRow, e.inView && i.summaryRowInView, e.selected && i.summaryRowSelected),
196
+ onClick: () => d(e.id),
197
+ onKeyDown: (t) => {
198
+ (t.key === "Enter" || t.key === " ") && (t.preventDefault(), d(e.id));
199
+ },
200
+ children: [
201
+ /* @__PURE__ */ c("span", {
202
+ className: i.summaryNum,
203
+ children: e.number
204
+ }),
205
+ /* @__PURE__ */ c("span", {
206
+ className: i.summaryDot,
207
+ style: { background: e.color }
208
+ }),
209
+ /* @__PURE__ */ c("span", {
210
+ className: i.summaryLabel,
211
+ children: e.label
212
+ }),
213
+ e.time && /* @__PURE__ */ c("span", {
214
+ className: i.summaryTime,
215
+ children: e.time
216
+ })
217
+ ]
218
+ }, e.id))
219
+ }),
220
+ D && /* @__PURE__ */ c("div", {
221
+ className: i.summaryFootnote,
222
+ children: "Tinted rows are in the viewport"
223
+ })
224
+ ]
225
+ });
226
+ return D ? y ? x ? /* @__PURE__ */ l("div", {
227
+ className: i.summaryDock,
228
+ style: { flexBasis: C },
229
+ children: [F, /* @__PURE__ */ c(p, {
230
+ panel: "left",
231
+ width: C,
232
+ min: 200,
233
+ max: 520,
234
+ onResize: w,
235
+ label: "Resize event summary",
236
+ className: i.summaryDockResizer
237
+ })]
238
+ }) : /* @__PURE__ */ c("div", {
239
+ className: i.summaryBubbleAnchor,
240
+ children: /* @__PURE__ */ c(o, {
241
+ className: i.summaryBubblePanel,
242
+ bounds: "viewport",
243
+ position: T,
244
+ onDrag: E,
245
+ children: F
246
+ })
247
+ }) : /* @__PURE__ */ c("div", {
248
+ className: i.summaryBubbleAnchor,
249
+ children: /* @__PURE__ */ l("button", {
250
+ type: "button",
251
+ className: r(i.summaryBubble, g),
252
+ title: "Event summary",
253
+ onClick: () => b(!0),
254
+ children: [
255
+ /* @__PURE__ */ c("span", {
256
+ className: i.summaryBubbleGlyph,
257
+ "aria-hidden": !0,
258
+ children: (h && h.length ? h : ["var(--crk-timeline-accent)"]).slice(0, 3).map((e, t) => /* @__PURE__ */ c("span", { style: { background: e } }, t))
259
+ }),
260
+ a,
261
+ /* @__PURE__ */ c("span", {
262
+ className: i.summaryCount,
263
+ children: u.length
264
+ })
265
+ ]
266
+ })
267
+ }) : O ? /* @__PURE__ */ c(o, {
268
+ className: i.summaryFloating,
269
+ bounds: "viewport",
270
+ defaultPosition: m ?? {
271
+ x: 0,
272
+ y: 0
273
+ },
274
+ children: F
275
+ }) : F;
262
276
  }
263
- function _({
264
- x: o,
265
- y: s,
266
- children: a,
267
- className: r,
268
- style: i
269
- }) {
270
- return /* @__PURE__ */ t("div", { className: c(e.tooltip, r), style: { left: o, top: s, ...i }, children: a });
277
+ function h({ x: e, y: t, children: n, className: a, style: o }) {
278
+ return /* @__PURE__ */ c("div", {
279
+ className: r(i.tooltip, a),
280
+ style: {
281
+ left: e,
282
+ top: t,
283
+ ...o
284
+ },
285
+ children: n
286
+ });
271
287
  }
272
- function $({ text: o, query: s }) {
273
- const a = Z(o, s);
274
- return a.length === 1 && !a[0].hit ? /* @__PURE__ */ t(L, { children: a[0].t }) : /* @__PURE__ */ t(L, { children: a.map(
275
- (r, i) => r.hit ? /* @__PURE__ */ t("span", { className: e.mark, children: r.t }, i) : /* @__PURE__ */ t("span", { children: r.t }, i)
276
- ) });
288
+ function g({ text: e, query: t }) {
289
+ let n = a(e, t);
290
+ return n.length === 1 && !n[0].hit ? /* @__PURE__ */ c(s, { children: n[0].t }) : /* @__PURE__ */ c(s, { children: n.map((e, t) => e.hit ? /* @__PURE__ */ c("span", {
291
+ className: i.mark,
292
+ children: e.t
293
+ }, t) : /* @__PURE__ */ c("span", { children: e.t }, t)) });
277
294
  }
278
- export {
279
- $ as HighlightText,
280
- G as TimelineLegend,
281
- j as TimelineResizer,
282
- Q as TimelineSegmented,
283
- Y as TimelineSummary,
284
- _ as TimelineTooltip,
285
- J as TimelineZoomControls
286
- };
295
+ export { g as HighlightText, u as TimelineLegend, p as TimelineResizer, f as TimelineSegmented, m as TimelineSummary, h as TimelineTooltip, d as TimelineZoomControls };
@@ -5,7 +5,7 @@ export declare function EventBadge({ event, pending, small, }: {
5
5
  event: TraceTimelineEvent;
6
6
  pending: boolean;
7
7
  small?: boolean;
8
- }): import("react/jsx-runtime").JSX.Element | null;
8
+ }): import("react").JSX.Element | null;
9
9
  /**
10
10
  * One labeled value: the label always sits above its value, and fields stack
11
11
  * vertically. Non-inline values (objects, arrays) become copyable JSON blocks.
@@ -14,7 +14,7 @@ export declare function FieldRow({ field, query, className, }: {
14
14
  field: TraceTimelineField;
15
15
  query?: string;
16
16
  className?: string;
17
- }): import("react/jsx-runtime").JSX.Element;
17
+ }): import("react").JSX.Element;
18
18
  /** A JSON payload block: uppercase heading + copy button + pretty-printed body. */
19
19
  export declare function PayloadBlock({ label, value, copyLabel, section, }: {
20
20
  label: string;
@@ -22,7 +22,7 @@ export declare function PayloadBlock({ label, value, copyLabel, section, }: {
22
22
  copyLabel: string;
23
23
  /** Render the heading as a panel section title instead of a micro-label. */
24
24
  section?: boolean;
25
- }): import("react/jsx-runtime").JSX.Element;
25
+ }): import("react").JSX.Element;
26
26
  export interface TraceEventDetailsClasses {
27
27
  root: string;
28
28
  head: string;