@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,181 +1,248 @@
1
- import { jsxs as i, jsx as l, Fragment as u } from "react/jsx-runtime";
2
- import { forwardRef as T, isValidElement as C } from "react";
1
+ import { forwardRef as e, isValidElement as t } from "react";
3
2
  import n from "clsx";
4
- import h from "./Timeline.module.scss.js";
5
- import a from "./TraceTimeline.module.scss.js";
6
- import { fmtISO as D, fmtDur as O } from "./timelineCore.js";
7
- import { HighlightText as I } from "./TimelineShared.js";
8
- import { isRequestEvent as Q, extraFieldsOf as z, routeOf as M, badgeOf as A, isInline as U, toText as b } from "./traceEvent.js";
9
- import { CopyButton as E } from "../ActionButton/CopyButton.js";
10
- function W({
11
- event: o,
12
- pending: d,
13
- small: c
14
- }) {
15
- const e = A(o, d);
16
- return e ? /* @__PURE__ */ l(
17
- "span",
18
- {
19
- className: n(
20
- a.statusBadge,
21
- c && a.badgeSm,
22
- e.tone === "pending" && a.statusPending,
23
- e.tone === "warn" && a.statusWarn,
24
- e.tone === "error" && a.statusError
25
- ),
26
- children: e.text
27
- }
28
- ) : null;
3
+ import r from "./Timeline.module.scss.js";
4
+ import i from "./TraceTimeline.module.scss.js";
5
+ import { fmtDur as a, fmtISO as o } from "./timelineCore.js";
6
+ import { HighlightText as s } from "./TimelineShared.js";
7
+ import { CopyButton as c } from "../ActionButton/CopyButton.js";
8
+ import { badgeOf as l, extraFieldsOf as u, isInline as d, isRequestEvent as f, routeOf as p, toText as m } from "./traceEvent.js";
9
+ import { Fragment as h, jsx as g, jsxs as _ } from "react/jsx-runtime";
10
+ // src/components/Timeline/TraceEventDetails.tsx
11
+ function v({ event: e, pending: t, small: r }) {
12
+ let a = l(e, t);
13
+ return a ? /* @__PURE__ */ g("span", {
14
+ className: n(i.statusBadge, r && i.badgeSm, a.tone === "pending" && i.statusPending, a.tone === "warn" && i.statusWarn, a.tone === "error" && i.statusError),
15
+ children: a.text
16
+ }) : null;
29
17
  }
30
- function f({
31
- field: o,
32
- query: d,
33
- className: c
34
- }) {
35
- const { label: e, value: r, mono: g = !0, copy: k } = o, p = U(r) || r == null || C(r), v = /* @__PURE__ */ l(
36
- E,
37
- {
38
- size: "sm",
39
- className: a.payloadCopy,
40
- value: () => b(r),
41
- "aria-label": `Copy ${e}`
42
- }
43
- );
44
- return /* @__PURE__ */ i("div", { className: n(a.field, !p && a.fieldBlock, c), children: [
45
- k || !p ? /* @__PURE__ */ i("div", { className: a.bodyHead, children: [
46
- /* @__PURE__ */ l("span", { className: a.fieldLabel, children: e }),
47
- v
48
- ] }) : /* @__PURE__ */ l("span", { className: a.fieldLabel, children: e }),
49
- p ? /* @__PURE__ */ l("div", { className: n(a.fieldValue, g && a.fieldMono), children: C(r) ? r : r == null || r === "" ? "—" : /* @__PURE__ */ l(I, { text: String(r), query: d }) }) : /* @__PURE__ */ l("pre", { className: n(h.asideRaw, a.fieldPre), children: b(r) })
50
- ] });
18
+ function y({ field: e, query: a, className: o }) {
19
+ let { label: l, value: u, mono: f = !0, copy: p } = e, h = d(u) || u == null || t(u), v = /* @__PURE__ */ g(c, {
20
+ size: "sm",
21
+ className: i.payloadCopy,
22
+ value: () => m(u),
23
+ "aria-label": `Copy ${l}`
24
+ });
25
+ return /* @__PURE__ */ _("div", {
26
+ className: n(i.field, !h && i.fieldBlock, o),
27
+ children: [p || !h ? /* @__PURE__ */ _("div", {
28
+ className: i.bodyHead,
29
+ children: [/* @__PURE__ */ g("span", {
30
+ className: i.fieldLabel,
31
+ children: l
32
+ }), v]
33
+ }) : /* @__PURE__ */ g("span", {
34
+ className: i.fieldLabel,
35
+ children: l
36
+ }), h ? /* @__PURE__ */ g("div", {
37
+ className: n(i.fieldValue, f && i.fieldMono),
38
+ children: t(u) ? u : u == null || u === "" ? "—" : /* @__PURE__ */ g(s, {
39
+ text: String(u),
40
+ query: a
41
+ })
42
+ }) : /* @__PURE__ */ g("pre", {
43
+ className: n(r.asideRaw, i.fieldPre),
44
+ children: m(u)
45
+ })]
46
+ });
51
47
  }
52
- function R({
53
- label: o,
54
- value: d,
55
- copyLabel: c,
56
- section: e
57
- }) {
58
- return /* @__PURE__ */ i(u, { children: [
59
- /* @__PURE__ */ i("div", { className: a.bodyHead, children: [
60
- /* @__PURE__ */ l(
61
- "span",
62
- {
63
- className: n(e ? a.drawerSection : h.asideSection, a.bodyLabel),
64
- children: o
65
- }
66
- ),
67
- d != null && /* @__PURE__ */ l(
68
- E,
69
- {
70
- size: "sm",
71
- className: a.payloadCopy,
72
- value: () => b(d),
73
- "aria-label": c
74
- }
75
- )
76
- ] }),
77
- /* @__PURE__ */ l("pre", { className: h.asideRaw, children: d != null ? b(d) : "(empty)" })
78
- ] });
48
+ function b({ label: e, value: t, copyLabel: a, section: o }) {
49
+ return /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ _("div", {
50
+ className: i.bodyHead,
51
+ children: [/* @__PURE__ */ g("span", {
52
+ className: n(o ? i.drawerSection : r.asideSection, i.bodyLabel),
53
+ children: e
54
+ }), t != null && /* @__PURE__ */ g(c, {
55
+ size: "sm",
56
+ className: i.payloadCopy,
57
+ value: () => m(t),
58
+ "aria-label": a
59
+ })]
60
+ }), /* @__PURE__ */ g("pre", {
61
+ className: r.asideRaw,
62
+ children: t == null ? "(empty)" : m(t)
63
+ })] });
79
64
  }
80
- const H = (o) => Object.entries(o || {}).map(([d, c]) => ({ k: d, v: String(c) })), le = T(
81
- function(d, c) {
82
- const {
83
- event: e,
84
- now: r = Date.now(),
85
- highlight: g,
86
- showExtraFields: k = !0,
87
- hiddenFields: p,
88
- onClose: v,
89
- classes: m,
90
- className: F,
91
- style: j
92
- } = d, y = (g || "").trim(), q = e.end == null, B = Q(e), w = k ? z(e, p) : [], x = !!Object.keys(e.query || {}).length, L = !!Object.keys(e.reqHeaders || {}).length, V = !!Object.keys(e.resHeaders || {}).length, t = [], S = e.reqHeaders && e.reqHeaders["x-request-id"] || e.requestId;
93
- e.op && t.push({ label: "Operation", value: e.op }), e.url ? t.push({ label: "URL", value: e.url }) : e.label && t.push({ label: "Label", value: e.label }), t.push({ label: "Event id", value: e.id }), S && t.push({ label: "Request id", value: S }), t.push({ label: "Started", value: D(e.start, !0) }), q ? t.push({ label: "Duration", value: O(r - e.start) + " so far" }) : e.end === e.start ? t.push({ label: "Duration", value: "instant" }) : (t.push({ label: "Ended", value: D(e.end, !0) }), t.push({ label: "Duration", value: O(e.end - e.start) }));
94
- const K = !B && !e.message && !e.details?.length && e.payload == null && !w.length, N = (s) => /* @__PURE__ */ l("div", { className: n(a.drawerSection, m?.section), children: s });
95
- return /* @__PURE__ */ i("div", { ref: c, className: n(m?.root, F), style: j, children: [
96
- /* @__PURE__ */ l("div", { className: n(a.drawerHead, m?.head), children: /* @__PURE__ */ i("div", { className: a.drawerHeadRow, children: [
97
- e.method && /* @__PURE__ */ l("span", { className: a.methodBadge, children: e.method }),
98
- /* @__PURE__ */ l(W, { event: e, pending: q }),
99
- /* @__PURE__ */ l("span", { className: a.drawerRoute, children: M(e) }),
100
- /* @__PURE__ */ l("div", { className: a.drawerSpacer }),
101
- v && /* @__PURE__ */ l(
102
- "button",
103
- {
104
- type: "button",
105
- className: h.asideClose,
106
- "aria-label": "Close details",
107
- onClick: v,
108
- children: "✕"
109
- }
110
- )
111
- ] }) }),
112
- /* @__PURE__ */ i("div", { className: n(a.drawerBody, m?.body), children: [
113
- /* @__PURE__ */ l("div", { className: n(a.fieldList, a.headFields), children: t.map((s) => /* @__PURE__ */ l(f, { field: s, query: y, className: m?.field }, s.label)) }),
114
- e.message && /* @__PURE__ */ l("div", { className: a.fieldList, children: /* @__PURE__ */ l(
115
- f,
116
- {
117
- field: { label: "Message", value: e.message, mono: !1 },
118
- query: y,
119
- className: m?.field
120
- }
121
- ) }),
122
- !!e.details?.length && /* @__PURE__ */ i(u, { children: [
123
- N("Details"),
124
- /* @__PURE__ */ l("div", { className: a.fieldList, children: e.details.map((s, P) => /* @__PURE__ */ l(f, { field: s, query: y, className: m?.field }, s.label + P)) })
125
- ] }),
126
- e.payload != null && /* @__PURE__ */ l(R, { section: !0, label: "Payload", value: e.payload, copyLabel: "Copy payload" }),
127
- B && /* @__PURE__ */ i(u, { children: [
128
- N("Request"),
129
- x && /* @__PURE__ */ i(u, { children: [
130
- /* @__PURE__ */ l("div", { className: h.asideSection, children: "Query parameters" }),
131
- H(e.query).map((s) => /* @__PURE__ */ i("div", { className: a.kvRow, children: [
132
- /* @__PURE__ */ l("span", { className: n(a.kvKey, a.kvKeyQuery), children: s.k }),
133
- /* @__PURE__ */ l("span", { className: a.kvVal, children: s.v })
134
- ] }, s.k))
135
- ] }),
136
- L && /* @__PURE__ */ i(u, { children: [
137
- /* @__PURE__ */ l("div", { className: h.asideSection, children: "Headers" }),
138
- H(e.reqHeaders).map((s) => /* @__PURE__ */ i("div", { className: a.kvRow, children: [
139
- /* @__PURE__ */ l("span", { className: a.kvKey, children: s.k }),
140
- /* @__PURE__ */ l("span", { className: a.kvVal, children: s.v })
141
- ] }, s.k))
142
- ] }),
143
- e.reqBody != null && /* @__PURE__ */ l(R, { label: "Body", value: e.reqBody, copyLabel: "Copy request payload" }),
144
- !x && !L && e.reqBody == null && /* @__PURE__ */ l("div", { className: a.emptyNote, children: "No request data captured." }),
145
- N("Response"),
146
- q ? /* @__PURE__ */ i("div", { className: a.awaiting, children: [
147
- /* @__PURE__ */ l("span", { className: n(h.pulseDot, a.awaitingDot) }),
148
- "Awaiting response…"
149
- ] }) : /* @__PURE__ */ i(u, { children: [
150
- V && /* @__PURE__ */ i(u, { children: [
151
- /* @__PURE__ */ l("div", { className: h.asideSection, children: "Headers" }),
152
- H(e.resHeaders).map((s) => /* @__PURE__ */ i("div", { className: a.kvRow, children: [
153
- /* @__PURE__ */ l("span", { className: a.kvKey, children: s.k }),
154
- /* @__PURE__ */ l("span", { className: a.kvVal, children: s.v })
155
- ] }, s.k))
156
- ] }),
157
- /* @__PURE__ */ l(
158
- R,
159
- {
160
- label: "Body",
161
- value: e.resBody,
162
- copyLabel: "Copy response payload"
163
- }
164
- )
165
- ] })
166
- ] }),
167
- !!w.length && /* @__PURE__ */ i(u, { children: [
168
- N("Other fields"),
169
- /* @__PURE__ */ l("div", { className: a.fieldList, children: w.map((s) => /* @__PURE__ */ l(f, { field: s, query: y, className: m?.field }, s.label)) })
170
- ] }),
171
- K && /* @__PURE__ */ l("div", { className: a.emptyNote, children: "No further details for this event." })
172
- ] })
173
- ] });
174
- }
175
- );
176
- export {
177
- W as EventBadge,
178
- f as FieldRow,
179
- R as PayloadBlock,
180
- le as TraceEventDetails
181
- };
65
+ var x = (e) => Object.entries(e || {}).map(([e, t]) => ({
66
+ k: e,
67
+ v: String(t)
68
+ })), S = e(function(e, t) {
69
+ let { event: s, now: c = Date.now(), highlight: l, showExtraFields: d = !0, hiddenFields: m, onClose: S, classes: C, className: w, style: T } = e, E = (l || "").trim(), D = s.end == null, O = f(s), k = d ? u(s, m) : [], A = !!Object.keys(s.query || {}).length, j = !!Object.keys(s.reqHeaders || {}).length, M = !!Object.keys(s.resHeaders || {}).length, N = [], P = s.reqHeaders && s.reqHeaders["x-request-id"] || s.requestId;
70
+ s.op && N.push({
71
+ label: "Operation",
72
+ value: s.op
73
+ }), s.url ? N.push({
74
+ label: "URL",
75
+ value: s.url
76
+ }) : s.label && N.push({
77
+ label: "Label",
78
+ value: s.label
79
+ }), N.push({
80
+ label: "Event id",
81
+ value: s.id
82
+ }), P && N.push({
83
+ label: "Request id",
84
+ value: P
85
+ }), N.push({
86
+ label: "Started",
87
+ value: o(s.start, !0)
88
+ }), D ? N.push({
89
+ label: "Duration",
90
+ value: a(c - s.start) + " so far"
91
+ }) : s.end === s.start ? N.push({
92
+ label: "Duration",
93
+ value: "instant"
94
+ }) : (N.push({
95
+ label: "Ended",
96
+ value: o(s.end, !0)
97
+ }), N.push({
98
+ label: "Duration",
99
+ value: a(s.end - s.start)
100
+ }));
101
+ let F = !O && !s.message && !s.details?.length && s.payload == null && !k.length, I = (e) => /* @__PURE__ */ g("div", {
102
+ className: n(i.drawerSection, C?.section),
103
+ children: e
104
+ });
105
+ return /* @__PURE__ */ _("div", {
106
+ ref: t,
107
+ className: n(C?.root, w),
108
+ style: T,
109
+ children: [/* @__PURE__ */ g("div", {
110
+ className: n(i.drawerHead, C?.head),
111
+ children: /* @__PURE__ */ _("div", {
112
+ className: i.drawerHeadRow,
113
+ children: [
114
+ s.method && /* @__PURE__ */ g("span", {
115
+ className: i.methodBadge,
116
+ children: s.method
117
+ }),
118
+ /* @__PURE__ */ g(v, {
119
+ event: s,
120
+ pending: D
121
+ }),
122
+ /* @__PURE__ */ g("span", {
123
+ className: i.drawerRoute,
124
+ children: p(s)
125
+ }),
126
+ /* @__PURE__ */ g("div", { className: i.drawerSpacer }),
127
+ S && /* @__PURE__ */ g("button", {
128
+ type: "button",
129
+ className: r.asideClose,
130
+ "aria-label": "Close details",
131
+ onClick: S,
132
+ children: "✕"
133
+ })
134
+ ]
135
+ })
136
+ }), /* @__PURE__ */ _("div", {
137
+ className: n(i.drawerBody, C?.body),
138
+ children: [
139
+ /* @__PURE__ */ g("div", {
140
+ className: n(i.fieldList, i.headFields),
141
+ children: N.map((e) => /* @__PURE__ */ g(y, {
142
+ field: e,
143
+ query: E,
144
+ className: C?.field
145
+ }, e.label))
146
+ }),
147
+ s.message && /* @__PURE__ */ g("div", {
148
+ className: i.fieldList,
149
+ children: /* @__PURE__ */ g(y, {
150
+ field: {
151
+ label: "Message",
152
+ value: s.message,
153
+ mono: !1
154
+ },
155
+ query: E,
156
+ className: C?.field
157
+ })
158
+ }),
159
+ !!s.details?.length && /* @__PURE__ */ _(h, { children: [I("Details"), /* @__PURE__ */ g("div", {
160
+ className: i.fieldList,
161
+ children: s.details.map((e, t) => /* @__PURE__ */ g(y, {
162
+ field: e,
163
+ query: E,
164
+ className: C?.field
165
+ }, e.label + t))
166
+ })] }),
167
+ s.payload != null && /* @__PURE__ */ g(b, {
168
+ section: !0,
169
+ label: "Payload",
170
+ value: s.payload,
171
+ copyLabel: "Copy payload"
172
+ }),
173
+ O && /* @__PURE__ */ _(h, { children: [
174
+ I("Request"),
175
+ A && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", {
176
+ className: r.asideSection,
177
+ children: "Query parameters"
178
+ }), x(s.query).map((e) => /* @__PURE__ */ _("div", {
179
+ className: i.kvRow,
180
+ children: [/* @__PURE__ */ g("span", {
181
+ className: n(i.kvKey, i.kvKeyQuery),
182
+ children: e.k
183
+ }), /* @__PURE__ */ g("span", {
184
+ className: i.kvVal,
185
+ children: e.v
186
+ })]
187
+ }, e.k))] }),
188
+ j && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", {
189
+ className: r.asideSection,
190
+ children: "Headers"
191
+ }), x(s.reqHeaders).map((e) => /* @__PURE__ */ _("div", {
192
+ className: i.kvRow,
193
+ children: [/* @__PURE__ */ g("span", {
194
+ className: i.kvKey,
195
+ children: e.k
196
+ }), /* @__PURE__ */ g("span", {
197
+ className: i.kvVal,
198
+ children: e.v
199
+ })]
200
+ }, e.k))] }),
201
+ s.reqBody != null && /* @__PURE__ */ g(b, {
202
+ label: "Body",
203
+ value: s.reqBody,
204
+ copyLabel: "Copy request payload"
205
+ }),
206
+ !A && !j && s.reqBody == null && /* @__PURE__ */ g("div", {
207
+ className: i.emptyNote,
208
+ children: "No request data captured."
209
+ }),
210
+ I("Response"),
211
+ D ? /* @__PURE__ */ _("div", {
212
+ className: i.awaiting,
213
+ children: [/* @__PURE__ */ g("span", { className: n(r.pulseDot, i.awaitingDot) }), "Awaiting response…"]
214
+ }) : /* @__PURE__ */ _(h, { children: [M && /* @__PURE__ */ _(h, { children: [/* @__PURE__ */ g("div", {
215
+ className: r.asideSection,
216
+ children: "Headers"
217
+ }), x(s.resHeaders).map((e) => /* @__PURE__ */ _("div", {
218
+ className: i.kvRow,
219
+ children: [/* @__PURE__ */ g("span", {
220
+ className: i.kvKey,
221
+ children: e.k
222
+ }), /* @__PURE__ */ g("span", {
223
+ className: i.kvVal,
224
+ children: e.v
225
+ })]
226
+ }, e.k))] }), /* @__PURE__ */ g(b, {
227
+ label: "Body",
228
+ value: s.resBody,
229
+ copyLabel: "Copy response payload"
230
+ })] })
231
+ ] }),
232
+ !!k.length && /* @__PURE__ */ _(h, { children: [I("Other fields"), /* @__PURE__ */ g("div", {
233
+ className: i.fieldList,
234
+ children: k.map((e) => /* @__PURE__ */ g(y, {
235
+ field: e,
236
+ query: E,
237
+ className: C?.field
238
+ }, e.label))
239
+ })] }),
240
+ F && /* @__PURE__ */ g("div", {
241
+ className: i.emptyNote,
242
+ children: "No further details for this event."
243
+ })
244
+ ]
245
+ })]
246
+ });
247
+ });
248
+ export { v as EventBadge, y as FieldRow, b as PayloadBlock, S as TraceEventDetails };