@photon-ai/pho-ui 2.12.0 → 2.14.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.
- package/dist/chunks/IconChevronRight-CzoJnYNI.js +11 -0
- package/dist/chunks/IconChevronRight-CzoJnYNI.js.map +1 -0
- package/dist/chunks/badge-DlLJPLeZ.js +78 -0
- package/dist/chunks/badge-DlLJPLeZ.js.map +1 -0
- package/dist/chunks/bar-chart-BJfr3eyd.js +190 -0
- package/dist/chunks/bar-chart-BJfr3eyd.js.map +1 -0
- package/dist/chunks/{basic-page-CJwG4I83.js → basic-page-CdmVeL_Z.js} +433 -436
- package/dist/chunks/basic-page-CdmVeL_Z.js.map +1 -0
- package/dist/chunks/code-block-CdozzaHM.js +139 -0
- package/dist/chunks/code-block-CdozzaHM.js.map +1 -0
- package/dist/chunks/combobox-D4LiGJB2.js +136 -0
- package/dist/chunks/combobox-D4LiGJB2.js.map +1 -0
- package/dist/chunks/command-Ck8IAgV7.js +192 -0
- package/dist/chunks/command-Ck8IAgV7.js.map +1 -0
- package/dist/chunks/copy-button-B_B15mEi.js +56 -0
- package/dist/chunks/copy-button-B_B15mEi.js.map +1 -0
- package/dist/chunks/description-list-C-mwe4ki.js +59 -0
- package/dist/chunks/description-list-C-mwe4ki.js.map +1 -0
- package/dist/chunks/filter-bar-Cjjq38xo.js +259 -0
- package/dist/chunks/filter-bar-Cjjq38xo.js.map +1 -0
- package/dist/chunks/legend-C0mU7dqd.js +60 -0
- package/dist/chunks/legend-C0mU7dqd.js.map +1 -0
- package/dist/chunks/line-chart-CUR3AxrR.js +453 -0
- package/dist/chunks/line-chart-CUR3AxrR.js.map +1 -0
- package/dist/chunks/log-list-0AXnjFrk.js +244 -0
- package/dist/chunks/log-list-0AXnjFrk.js.map +1 -0
- package/dist/chunks/stat-hnNqjWVG.js +85 -0
- package/dist/chunks/stat-hnNqjWVG.js.map +1 -0
- package/dist/chunks/toggle-o84tawXy.js +33 -0
- package/dist/chunks/toggle-o84tawXy.js.map +1 -0
- package/dist/chunks/tooltip-BTF7GChl.js +32 -0
- package/dist/chunks/tooltip-BTF7GChl.js.map +1 -0
- package/dist/chunks/trace-CbH0IohX.js +314 -0
- package/dist/chunks/trace-CbH0IohX.js.map +1 -0
- package/dist/chunks/use-copy-D6JwKUll.js +25 -0
- package/dist/chunks/use-copy-D6JwKUll.js.map +1 -0
- package/dist/chunks/use-measure-CMVgLouO.js +616 -0
- package/dist/chunks/use-measure-CMVgLouO.js.map +1 -0
- package/dist/components/badge.js +5 -75
- package/dist/components/bar-chart.js +5 -0
- package/dist/components/chart.js +8 -0
- package/dist/components/code-block.js +6 -0
- package/dist/components/combobox.js +1 -1
- package/dist/components/command.js +3 -189
- package/dist/components/copy-button.js +6 -0
- package/dist/components/description-list.js +5 -0
- package/dist/components/filter-bar.js +8 -0
- package/dist/components/line-chart.js +5 -0
- package/dist/components/log-list.js +8 -0
- package/dist/components/phone-input.js +1 -1
- package/dist/components/stat.js +6 -0
- package/dist/components/toggle.js +3 -30
- package/dist/components/tooltip.js +2 -29
- package/dist/components/trace.js +9 -0
- package/dist/index.js +132 -93
- package/dist/primitives.js +2 -2
- package/dist/sections/basic-page.js +17 -17
- package/dist/src/components/accordion/index.d.ts +1 -1
- package/dist/src/components/bar-chart/bar-chart.d.ts +9 -0
- package/dist/src/components/bar-chart/index.d.ts +2 -0
- package/dist/src/components/chart/axes.d.ts +22 -0
- package/dist/src/components/chart/color.d.ts +10 -0
- package/dist/src/components/chart/format.d.ts +25 -0
- package/dist/src/components/chart/index.d.ts +8 -0
- package/dist/src/components/chart/legend.d.ts +26 -0
- package/dist/src/components/chart/scale.d.ts +34 -0
- package/dist/src/components/chart/shell.d.ts +42 -0
- package/dist/src/components/chart/tooltip.d.ts +30 -0
- package/dist/src/components/chart/types.d.ts +76 -0
- package/dist/src/components/chart/use-measure.d.ts +8 -0
- package/dist/src/components/code-block/code-block.d.ts +43 -0
- package/dist/src/components/code-block/index.d.ts +2 -0
- package/dist/src/components/code-block/tokenize-json.d.ts +12 -0
- package/dist/src/components/combobox/combobox.d.ts +30 -4
- package/dist/src/components/combobox/index.d.ts +1 -1
- package/dist/src/components/copy-button/copy-button.d.ts +49 -0
- package/dist/src/components/copy-button/index.d.ts +1 -0
- package/dist/src/components/description-list/description-list.d.ts +60 -0
- package/dist/src/components/description-list/index.d.ts +1 -0
- package/dist/src/components/filter-bar/filter-bar.d.ts +101 -0
- package/dist/src/components/filter-bar/index.d.ts +1 -0
- package/dist/src/components/line-chart/index.d.ts +2 -0
- package/dist/src/components/line-chart/line-chart.d.ts +11 -0
- package/dist/src/components/log-list/index.d.ts +1 -0
- package/dist/src/components/log-list/log-list.d.ts +136 -0
- package/dist/src/components/stat/index.d.ts +1 -0
- package/dist/src/components/stat/stat.d.ts +61 -0
- package/dist/src/components/toggle/toggle.d.ts +5 -1
- package/dist/src/components/trace/index.d.ts +2 -0
- package/dist/src/components/trace/layout.d.ts +48 -0
- package/dist/src/components/trace/trace.d.ts +53 -0
- package/dist/src/index.d.ts +10 -0
- package/dist/src/sections/basic-page/basic-page.d.ts +3 -3
- package/dist/src/utils/index.d.ts +1 -0
- package/dist/src/utils/use-copy.d.ts +14 -0
- package/dist/utils.js +6 -3
- package/package.json +47 -1
- package/src/styles/theme.css +81 -0
- package/dist/chunks/basic-page-CJwG4I83.js.map +0 -1
- package/dist/chunks/combobox-Dj5m_dDd.js +0 -117
- package/dist/chunks/combobox-Dj5m_dDd.js.map +0 -1
- package/dist/components/badge.js.map +0 -1
- package/dist/components/command.js.map +0 -1
- package/dist/components/toggle.js.map +0 -1
- package/dist/components/tooltip.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -1,101 +1,140 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import { t as
|
|
3
|
-
import { t } from "./chunks/is-react-component-DSnjtBmo.js";
|
|
4
|
-
import { t as
|
|
5
|
-
import { n as
|
|
6
|
-
import { BAR_RISE_PX as
|
|
7
|
-
import { n as
|
|
2
|
+
import { t as s } from "./chunks/cn-ChIgwEl3.js";
|
|
3
|
+
import { t as r } from "./chunks/is-react-component-DSnjtBmo.js";
|
|
4
|
+
import { t as E } from "./chunks/resolve-variant-CcD8iG5l.js";
|
|
5
|
+
import { n as _, t as i } from "./chunks/link-provider-DXzDQ08N.js";
|
|
6
|
+
import { BAR_RISE_PX as e, BLUR_PX as A, EASE_POP as n, EASE_STACK as T, FADE_ENTRANCE as R, FADE_SWAP as I, PRESS_SCALE as p, PRESS_SCALE_ROW as C, RISE_PX as P, SPRING_ENTRANCE as f, SPRING_PRESS as B, SPRING_PRESS_INLINE as N, SPRING_PRESS_QUICK as u, SPRING_SETTLE as O, TRAVEL_LINEAR as L, fadeThroughBlur as l, riseIn as D } from "./motion.js";
|
|
7
|
+
import { n as V, r as G, t as U } from "./chunks/use-press-pulse-IbNstUT0.js";
|
|
8
|
+
import { n as h, t as F } from "./chunks/use-copy-D6JwKUll.js";
|
|
8
9
|
import "./utils.js";
|
|
9
|
-
import { a as
|
|
10
|
-
import { a as
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
13
|
-
import { a as
|
|
14
|
-
import { t as
|
|
15
|
-
import { t as
|
|
16
|
-
import { t as
|
|
17
|
-
import { n as
|
|
18
|
-
import {
|
|
19
|
-
import {
|
|
20
|
-
import "./
|
|
10
|
+
import { a as k, c as b, d as W, i as X, l as Y, n as Z, o as v, r as w, s as y, t as H, u as K } from "./chunks/button-CdqS_t5a.js";
|
|
11
|
+
import { a as z, c as J, i as Q, l as j, n as q, o as $, r as aa, s as sa, t as ta } from "./chunks/error-D0yoFxCv.js";
|
|
12
|
+
import { o as oa } from "./chunks/data-table-CHLJfGkS.js";
|
|
13
|
+
import { n as Sa, t as _a } from "./chunks/copy-button-B_B15mEi.js";
|
|
14
|
+
import { a as ma, c as ea, i as Aa, n as na, o as Ta, r as Ra, s as Ia, t as pa } from "./chunks/sidebar-DVzZsCts.js";
|
|
15
|
+
import { t as Pa } from "./chunks/input-DjvZoF8v.js";
|
|
16
|
+
import { i as Ba, n as Na, r as ua, t as Oa } from "./chunks/filter-bar-Cjjq38xo.js";
|
|
17
|
+
import { n as la, t as Da } from "./chunks/code-block-CdozzaHM.js";
|
|
18
|
+
import { n as Va, t as Ga } from "./chunks/stat-hnNqjWVG.js";
|
|
19
|
+
import { t as da } from "./chunks/close-button-GvqWbLl0.js";
|
|
20
|
+
import { t as Fa } from "./chunks/input-group-fc9_jD4d.js";
|
|
21
|
+
import { n as Ma, t as ka } from "./chunks/card-DSW3Uhag.js";
|
|
22
|
+
import { n as Wa, t as Xa } from "./chunks/dialog-BxKACOj5.js";
|
|
23
|
+
import { i as Za, n as va, r as wa, t as ya } from "./chunks/status-view-C8tabjDu.js";
|
|
24
|
+
import { a as Ka, c as xa, d as za, f as Ja, i as Qa, l as ja, m as qa, n as $a, o as as, p as ss, r as ts, s as rs, t as os, u as Es } from "./chunks/basic-page-CdmVeL_Z.js";
|
|
25
|
+
import { i as _s, n as is, r as ms, t as es } from "./chunks/legend-C0mU7dqd.js";
|
|
26
|
+
import "./components/chart.js";
|
|
27
|
+
import { t as Ts } from "./chunks/bar-chart-BJfr3eyd.js";
|
|
28
|
+
import { t as Is } from "./chunks/line-chart-CUR3AxrR.js";
|
|
29
|
+
import { i as Cs, n as Ps, r as fs, t as Bs } from "./chunks/log-list-0AXnjFrk.js";
|
|
30
|
+
import { t as us } from "./chunks/description-list-C-mwe4ki.js";
|
|
31
|
+
import { a as Ls, i as ls, n as Ds, r as cs, t as Vs } from "./chunks/trace-CbH0IohX.js";
|
|
21
32
|
export {
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
33
|
+
os as AUTO_SAVE_DELAY_MS,
|
|
34
|
+
e as BAR_RISE_PX,
|
|
35
|
+
$a as BASIC_PAGE_CALLOUT,
|
|
36
|
+
ts as BASIC_PAGE_CARD,
|
|
37
|
+
Qa as BASIC_PAGE_ITEM,
|
|
38
|
+
Ka as BASIC_PAGE_ITEM_PANEL,
|
|
39
|
+
as as BASIC_PAGE_ITEM_PANEL_DIVIDED,
|
|
40
|
+
rs as BASIC_PAGE_ROW,
|
|
41
|
+
A as BLUR_PX,
|
|
42
|
+
H as BUTTON_COLORS,
|
|
43
|
+
Z as BUTTON_SHAPES,
|
|
44
|
+
w as BUTTON_SIZES,
|
|
45
|
+
X as BUTTON_VARIANTS,
|
|
46
|
+
Ts as BarChart,
|
|
47
|
+
xa as BasicPage,
|
|
48
|
+
k as Button,
|
|
49
|
+
v as ButtonLink,
|
|
50
|
+
ka as CARD_SURFACE,
|
|
51
|
+
ms as CHART_SLOTS,
|
|
52
|
+
ja as CONDENSE_BAR_ENTER,
|
|
53
|
+
Es as CONDENSE_BAR_RISE_PX,
|
|
54
|
+
za as CONDENSE_BAR_TRAVEL,
|
|
42
55
|
U as CONTROL_PRESS_SCALE,
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
y as
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
56
|
+
V as CONTROL_PRESS_SPRING,
|
|
57
|
+
_a as COPY_BUTTON_SIZES,
|
|
58
|
+
F as COPY_FEEDBACK_MS,
|
|
59
|
+
Ma as Card,
|
|
60
|
+
es as ChartLegend,
|
|
61
|
+
is as ChartSwatch,
|
|
62
|
+
da as CloseButton,
|
|
63
|
+
Da as CodeBlock,
|
|
64
|
+
Sa as CopyButton,
|
|
65
|
+
us as DescriptionList,
|
|
66
|
+
Xa as Dialog,
|
|
67
|
+
n as EASE_POP,
|
|
68
|
+
T as EASE_STACK,
|
|
69
|
+
y as EFFECT_BUTTON_SIZES,
|
|
70
|
+
b as EffectButton,
|
|
71
|
+
Y as EffectButtonLink,
|
|
72
|
+
ta as Error,
|
|
73
|
+
q as ErrorView,
|
|
74
|
+
R as FADE_ENTRANCE,
|
|
75
|
+
I as FADE_SWAP,
|
|
76
|
+
Oa as FILTER_DATE_PRESETS,
|
|
77
|
+
Na as FilterBar,
|
|
78
|
+
aa as GENERIC_ERROR_TITLE,
|
|
79
|
+
Pa as Input,
|
|
80
|
+
Fa as InputGroup,
|
|
81
|
+
Is as LineChart,
|
|
82
|
+
i as LinkProvider,
|
|
83
|
+
Bs as LogList,
|
|
84
|
+
p as PRESS_SCALE,
|
|
61
85
|
C as PRESS_SCALE_ROW,
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
86
|
+
P as RISE_PX,
|
|
87
|
+
pa as SIDEBAR_HEADER_INSET,
|
|
88
|
+
na as SIDEBAR_ITEM,
|
|
89
|
+
Ra as SIDEBAR_ITEM_ACTIVE,
|
|
90
|
+
Aa as SIDEBAR_ITEM_INACTIVE,
|
|
91
|
+
ma as SIDEBAR_ROOT,
|
|
92
|
+
Ta as SIDEBAR_ROOT_BASE,
|
|
93
|
+
Ia as SIDEBAR_ROOT_INSET,
|
|
94
|
+
f as SPRING_ENTRANCE,
|
|
95
|
+
B as SPRING_PRESS,
|
|
96
|
+
N as SPRING_PRESS_INLINE,
|
|
97
|
+
u as SPRING_PRESS_QUICK,
|
|
98
|
+
O as SPRING_SETTLE,
|
|
99
|
+
ya as STATUS_VIEW,
|
|
100
|
+
va as STATUS_VIEW_COPY,
|
|
101
|
+
wa as STATUS_VIEW_SIZES,
|
|
102
|
+
ea as Sidebar,
|
|
103
|
+
Ga as Stat,
|
|
104
|
+
Va as StatGroup,
|
|
105
|
+
Za as StatusView,
|
|
80
106
|
L as TRAVEL_LINEAR,
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
107
|
+
Vs as Trace,
|
|
108
|
+
K as buttonVariants,
|
|
109
|
+
Q as capitalizeFirst,
|
|
110
|
+
_s as chartColor,
|
|
111
|
+
s as cn,
|
|
112
|
+
oa as createColumns,
|
|
113
|
+
z as describeError,
|
|
114
|
+
W as effectButtonVariants,
|
|
115
|
+
l as fadeThroughBlur,
|
|
116
|
+
Ja as formToasts,
|
|
117
|
+
Ds as formatDuration,
|
|
118
|
+
ua as formatFilterValue,
|
|
119
|
+
cs as formatTick,
|
|
120
|
+
$ as httpReasonPhrase,
|
|
121
|
+
sa as httpStatusExplanation,
|
|
122
|
+
Ba as isFilterSet,
|
|
123
|
+
J as isProblem,
|
|
124
|
+
r as isReactComponent,
|
|
125
|
+
ls as layoutTrace,
|
|
126
|
+
Ps as logStatusColor,
|
|
127
|
+
fs as logStatusLabel,
|
|
128
|
+
Ls as niceStep,
|
|
129
|
+
j as parseProblem,
|
|
130
|
+
E as resolveVariant,
|
|
131
|
+
D as riseIn,
|
|
132
|
+
la as tokenizeJson,
|
|
133
|
+
Cs as truncateMiddle,
|
|
134
|
+
ss as useAutoSave,
|
|
135
|
+
qa as useCondense,
|
|
136
|
+
h as useCopy,
|
|
137
|
+
Wa as useDialogPending,
|
|
138
|
+
_ as useLinkComponent,
|
|
100
139
|
G as usePressPulse
|
|
101
140
|
};
|
package/dist/primitives.js
CHANGED
|
@@ -51,6 +51,8 @@ export * from "@base-ui/react/menu";
|
|
|
51
51
|
export * from "@base-ui/react/checkbox";
|
|
52
52
|
export * from "@base-ui/react/checkbox-group";
|
|
53
53
|
export * from "@base-ui/react/toast";
|
|
54
|
+
export * from "@base-ui/react/tooltip";
|
|
55
|
+
export * from "@base-ui/react/toggle";
|
|
54
56
|
export * from "@base-ui/react/accordion";
|
|
55
57
|
export * from "@base-ui/react/alert-dialog";
|
|
56
58
|
export * from "@base-ui/react/autocomplete";
|
|
@@ -76,7 +78,5 @@ export * from "@base-ui/react/select";
|
|
|
76
78
|
export * from "@base-ui/react/slider";
|
|
77
79
|
export * from "@base-ui/react/switch";
|
|
78
80
|
export * from "@base-ui/react/tabs";
|
|
79
|
-
export * from "@base-ui/react/toggle";
|
|
80
81
|
export * from "@base-ui/react/toggle-group";
|
|
81
82
|
export * from "@base-ui/react/toolbar";
|
|
82
|
-
export * from "@base-ui/react/tooltip";
|
|
@@ -1,20 +1,20 @@
|
|
|
1
1
|
"use client";
|
|
2
|
-
import {
|
|
3
|
-
import { o as R } from "../chunks/
|
|
2
|
+
import { o as s } from "../chunks/data-table-CHLJfGkS.js";
|
|
3
|
+
import { a as E, c as a, d as C, f as S, i as o, l as I, m as e, n as B, o as P, p as N, r, s as t, t as D, u as R } from "../chunks/basic-page-CdmVeL_Z.js";
|
|
4
4
|
export {
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
5
|
+
D as AUTO_SAVE_DELAY_MS,
|
|
6
|
+
B as BASIC_PAGE_CALLOUT,
|
|
7
|
+
r as BASIC_PAGE_CARD,
|
|
8
|
+
o as BASIC_PAGE_ITEM,
|
|
9
|
+
E as BASIC_PAGE_ITEM_PANEL,
|
|
10
|
+
P as BASIC_PAGE_ITEM_PANEL_DIVIDED,
|
|
11
|
+
t as BASIC_PAGE_ROW,
|
|
12
|
+
a as BasicPage,
|
|
13
|
+
I as CONDENSE_BAR_ENTER,
|
|
14
|
+
R as CONDENSE_BAR_RISE_PX,
|
|
15
|
+
C as CONDENSE_BAR_TRAVEL,
|
|
16
|
+
s as createColumns,
|
|
17
|
+
S as formToasts,
|
|
18
|
+
N as useAutoSave,
|
|
19
|
+
e as useCondense
|
|
20
20
|
};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export { Accordion } from './accordion';
|
|
1
|
+
export { Accordion, type AccordionRootProps, type AccordionSize, } from './accordion';
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ChartBaseProps, ChartDatum } from '../chart/types';
|
|
2
|
+
export interface BarChartProps<T extends ChartDatum> extends ChartBaseProps<T> {
|
|
3
|
+
/** Stack the series in one column per bucket, first series at the bottom. */
|
|
4
|
+
stacked?: boolean;
|
|
5
|
+
}
|
|
6
|
+
export declare function BarChart<T extends ChartDatum>({ data, series, label, description, height, width: fixedWidth, valueFormat, timeFormat, locale, legend, baseline, stacked, breakdownTitle, loading, empty, className, ...props }: BarChartProps<T>): import("react").JSX.Element;
|
|
7
|
+
export declare namespace BarChart {
|
|
8
|
+
var displayName: string;
|
|
9
|
+
}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { ChartLayout } from './shell';
|
|
2
|
+
export interface YAxisProps {
|
|
3
|
+
layout: ChartLayout;
|
|
4
|
+
ticks: ReadonlyArray<number>;
|
|
5
|
+
labels: ReadonlyArray<string>;
|
|
6
|
+
scale: (value: number) => number;
|
|
7
|
+
}
|
|
8
|
+
/**
|
|
9
|
+
* Gridlines across the plot with their labels on the left: hairlines one
|
|
10
|
+
* step off the surface, the zero line a touch stronger so bars read as
|
|
11
|
+
* standing on something.
|
|
12
|
+
*/
|
|
13
|
+
export declare function YAxis({ layout, ticks, labels, scale }: YAxisProps): import("react").JSX.Element;
|
|
14
|
+
export interface XAxisProps {
|
|
15
|
+
layout: ChartLayout;
|
|
16
|
+
ticks: ReadonlyArray<{
|
|
17
|
+
x: number;
|
|
18
|
+
label: string;
|
|
19
|
+
}>;
|
|
20
|
+
}
|
|
21
|
+
/** Time labels along the bottom band; the end labels tuck inside the plot. */
|
|
22
|
+
export declare function XAxis({ layout, ticks }: XAxisProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ChartColor } from './types';
|
|
2
|
+
/** The categorical slots, in the order series take them. */
|
|
3
|
+
export declare const CHART_SLOTS: readonly ["chart-1", "chart-2", "chart-3", "chart-4", "chart-5", "chart-6"];
|
|
4
|
+
/**
|
|
5
|
+
* The CSS value for a series colour: the named colour, or the categorical
|
|
6
|
+
* slot at `index` when the series names none. Slots are an ordered,
|
|
7
|
+
* validated set — a seventh series wraps, so fold a long tail into
|
|
8
|
+
* "Other" before it gets there.
|
|
9
|
+
*/
|
|
10
|
+
export declare function chartColor(color: ChartColor | undefined, index: number): string;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
import { ChartDatum, ChartSeries } from './types';
|
|
2
|
+
/**
|
|
3
|
+
* The default number format: grouped digits for a value someone reads
|
|
4
|
+
* ("12,001"), compact for an axis tick ("12K") where room is short.
|
|
5
|
+
*/
|
|
6
|
+
export declare function numberFormatter(locale: string | undefined, compact?: boolean): (value: number) => string;
|
|
7
|
+
/** A number under a series key, or nothing: missing, null, or not a number. */
|
|
8
|
+
export declare function readValue(datum: object, key: string): number | null;
|
|
9
|
+
/** "Inbound and outbound", "p50, p90 and p99". */
|
|
10
|
+
export declare function joinNames(names: ReadonlyArray<string>): string;
|
|
11
|
+
interface DescribeOptions<T extends ChartDatum> {
|
|
12
|
+
data: ReadonlyArray<T>;
|
|
13
|
+
series: ReadonlyArray<ChartSeries<T>>;
|
|
14
|
+
/** Bars sum to a total; lines run between a low and a high. */
|
|
15
|
+
kind: "bar" | "line";
|
|
16
|
+
valueFormat: (value: number) => string;
|
|
17
|
+
timeFormat: (date: Date) => string;
|
|
18
|
+
}
|
|
19
|
+
/**
|
|
20
|
+
* What the figure says about itself to assistive tech: which series, over
|
|
21
|
+
* what range, and for each one the total (bars) or the low and high
|
|
22
|
+
* (lines), plus where it peaked.
|
|
23
|
+
*/
|
|
24
|
+
export declare function describeChart<T extends ChartDatum>({ data, series, kind, valueFormat, timeFormat, }: DescribeOptions<T>): string;
|
|
25
|
+
export {};
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Chart foundation — what `BarChart` and `LineChart` share and a page may
|
|
3
|
+
* want on its own: the data contract, the series colour resolver, and the
|
|
4
|
+
* legend. Axes, scales, the shell and the tooltip stay internal.
|
|
5
|
+
*/
|
|
6
|
+
export type { ChartBaseProps, ChartBreakdownItem, ChartColor, ChartDatum, ChartSeries, ChartValueKey, } from './types';
|
|
7
|
+
export { chartColor, CHART_SLOTS } from './color';
|
|
8
|
+
export { ChartLegend, ChartSwatch, type ChartLegendItem, type ChartLegendProps, type ChartSwatchKind, type ChartSwatchProps, } from './legend';
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ComponentProps } from 'react';
|
|
2
|
+
/** A legend or tooltip key mirrors its mark: a square for a bar, a stroke for a line. */
|
|
3
|
+
export type ChartSwatchKind = "rect" | "line";
|
|
4
|
+
export interface ChartSwatchProps {
|
|
5
|
+
/** A CSS colour value — what `chartColor` returns. */
|
|
6
|
+
color: string;
|
|
7
|
+
kind?: ChartSwatchKind;
|
|
8
|
+
dashed?: boolean;
|
|
9
|
+
}
|
|
10
|
+
export declare function ChartSwatch({ color, kind, dashed, }: ChartSwatchProps): import("react").JSX.Element;
|
|
11
|
+
export interface ChartLegendItem {
|
|
12
|
+
label: string;
|
|
13
|
+
/** A CSS colour value — what `chartColor` returns. */
|
|
14
|
+
color: string;
|
|
15
|
+
kind?: ChartSwatchKind;
|
|
16
|
+
dashed?: boolean;
|
|
17
|
+
}
|
|
18
|
+
export interface ChartLegendProps extends Omit<ComponentProps<"ul">, "children"> {
|
|
19
|
+
items: ReadonlyArray<ChartLegendItem>;
|
|
20
|
+
}
|
|
21
|
+
/**
|
|
22
|
+
* The legend a chart of two or more series carries below the plot: a key
|
|
23
|
+
* per series, in series order, wrapping when the row runs out. Text stays
|
|
24
|
+
* in the UI ink; the swatch alone carries the colour.
|
|
25
|
+
*/
|
|
26
|
+
export declare function ChartLegend({ items, className, ...props }: ChartLegendProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,34 @@
|
|
|
1
|
+
/** Epoch milliseconds for a datum's `x`. */
|
|
2
|
+
export declare function toTime(x: Date | number): number;
|
|
3
|
+
/** A linear map from `domain` to `range`; a flat domain maps to its start. */
|
|
4
|
+
export declare function linearScale(domain: readonly [number, number], range: readonly [number, number]): (value: number) => number;
|
|
5
|
+
/**
|
|
6
|
+
* A y domain on round numbers with three to five ticks, the last tick on
|
|
7
|
+
* or above the data's high end so the top of the plot is labelled.
|
|
8
|
+
*/
|
|
9
|
+
export declare function niceLinearDomain(min: number, max: number): {
|
|
10
|
+
domain: [number, number];
|
|
11
|
+
ticks: number[];
|
|
12
|
+
};
|
|
13
|
+
/** The gap between buckets, in ms — the median step, so one hole doesn't skew it. */
|
|
14
|
+
export declare function bucketSpan(times: ReadonlyArray<number>): number;
|
|
15
|
+
/**
|
|
16
|
+
* Time ticks for a plot `width` px wide: one every ~96px, on the round
|
|
17
|
+
* boundaries d3-time picks (5 minutes, an hour, a day, a month…).
|
|
18
|
+
*/
|
|
19
|
+
export declare function timeAxisTicks(start: number, stop: number, width: number): Date[];
|
|
20
|
+
/**
|
|
21
|
+
* Labels a tick by the boundary it sits on: a time within a day, a date at
|
|
22
|
+
* midnight, month and year at a new year. `Intl` does the wording, so the
|
|
23
|
+
* labels follow the locale.
|
|
24
|
+
*/
|
|
25
|
+
export declare function timeTickFormatter(locale?: string): (date: Date) => string;
|
|
26
|
+
/**
|
|
27
|
+
* The tooltip's heading for a bucket: the date alone when buckets are a
|
|
28
|
+
* day or longer, date and time below that.
|
|
29
|
+
*/
|
|
30
|
+
export declare function bucketTimeFormatter(locale: string | undefined, span: number): (date: Date) => string;
|
|
31
|
+
/** Keep every nth tick so the labels fit the width without touching. */
|
|
32
|
+
export declare function thinTicks<T>(values: ReadonlyArray<T>, labelOf: (value: T) => string, width: number): T[];
|
|
33
|
+
/** The index of the position nearest `px` in an ascending list. */
|
|
34
|
+
export declare function nearestIndex(positions: ReadonlyArray<number>, px: number): number;
|
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
import { ComponentProps, PointerEvent, ReactNode, RefObject } from 'react';
|
|
2
|
+
/** The inner box the marks draw in, once the axes have taken their bands. */
|
|
3
|
+
export interface ChartLayout {
|
|
4
|
+
width: number;
|
|
5
|
+
height: number;
|
|
6
|
+
left: number;
|
|
7
|
+
top: number;
|
|
8
|
+
right: number;
|
|
9
|
+
bottom: number;
|
|
10
|
+
innerWidth: number;
|
|
11
|
+
innerHeight: number;
|
|
12
|
+
}
|
|
13
|
+
/** The plot's box for a measured width and the y-axis labels it must fit. */
|
|
14
|
+
export declare function chartLayout(width: number, height: number, yLabels: ReadonlyArray<string>): ChartLayout;
|
|
15
|
+
export interface ChartShellProps extends Omit<ComponentProps<"div">, "children"> {
|
|
16
|
+
/** The figure's `aria-label`. */
|
|
17
|
+
label: string;
|
|
18
|
+
/** The figure's spoken summary. */
|
|
19
|
+
description: string;
|
|
20
|
+
height: number;
|
|
21
|
+
/** The measured width; 0 before the browser has measured. */
|
|
22
|
+
width: number;
|
|
23
|
+
containerRef: RefObject<HTMLDivElement | null>;
|
|
24
|
+
legend?: ReactNode;
|
|
25
|
+
tooltip?: ReactNode;
|
|
26
|
+
loading?: boolean;
|
|
27
|
+
empty?: ReactNode;
|
|
28
|
+
/** The frame says `empty` instead of drawing. */
|
|
29
|
+
showEmpty?: boolean;
|
|
30
|
+
/** The pointer over the plot — the chart snaps to the nearest bucket. */
|
|
31
|
+
onPlotPointerMove?: (event: PointerEvent<SVGSVGElement>) => void;
|
|
32
|
+
onPlotPointerLeave?: () => void;
|
|
33
|
+
children?: ReactNode;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* The frame every chart draws in: a fixed-height plot box holding the
|
|
37
|
+
* SVG (`role="img"`, labelled and described for assistive tech), the
|
|
38
|
+
* tooltip layer over it, the legend on its own line below. Width comes
|
|
39
|
+
* from the parent; `height` covers the plot and the x-axis band, so a
|
|
40
|
+
* card never grows a nested scroll.
|
|
41
|
+
*/
|
|
42
|
+
export declare function ChartShell({ label, description, height, width, containerRef, legend, tooltip, loading, empty, showEmpty, onPlotPointerMove, onPlotPointerLeave, className, children, ...props }: ChartShellProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
import { ReactNode } from 'react';
|
|
2
|
+
import { ChartSwatchKind } from './legend';
|
|
3
|
+
import { ChartBreakdownItem } from './types';
|
|
4
|
+
export interface ChartTooltipRow {
|
|
5
|
+
label: string;
|
|
6
|
+
value: string;
|
|
7
|
+
color: string;
|
|
8
|
+
kind?: ChartSwatchKind;
|
|
9
|
+
dashed?: boolean;
|
|
10
|
+
}
|
|
11
|
+
export interface ChartTooltipProps {
|
|
12
|
+
/** The snapped x of the hovered bucket, in container px. */
|
|
13
|
+
x: number;
|
|
14
|
+
/** The container's width — the tooltip flips to the left past the middle. */
|
|
15
|
+
width: number;
|
|
16
|
+
/** Where the tooltip's top sits — the plot's top. */
|
|
17
|
+
top: number;
|
|
18
|
+
heading: string;
|
|
19
|
+
rows: ReadonlyArray<ChartTooltipRow>;
|
|
20
|
+
breakdown?: ReadonlyArray<ChartBreakdownItem>;
|
|
21
|
+
breakdownTitle?: ReactNode;
|
|
22
|
+
valueFormat: (value: number) => string;
|
|
23
|
+
}
|
|
24
|
+
/**
|
|
25
|
+
* The readout for one bucket: its time, then every series' value (values
|
|
26
|
+
* lead, in primary ink; labels follow), then the bucket's breakdown when
|
|
27
|
+
* it carries one. Presentational — the figure's description already
|
|
28
|
+
* speaks the data — and it never takes the pointer.
|
|
29
|
+
*/
|
|
30
|
+
export declare function ChartTooltip({ x, width, top, heading, rows, breakdown, breakdownTitle, valueFormat, }: ChartTooltipProps): import("react").JSX.Element;
|
|
@@ -0,0 +1,76 @@
|
|
|
1
|
+
import { ComponentProps, ReactNode } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* A series colour: the six ordered categorical slots, the two status
|
|
4
|
+
* inks (a series that MEANS successful / failed), or the monochrome ink
|
|
5
|
+
* for a one-series chart on the site's black and white.
|
|
6
|
+
*/
|
|
7
|
+
export type ChartColor = "chart-1" | "chart-2" | "chart-3" | "chart-4" | "chart-5" | "chart-6" | "success" | "error" | "ink";
|
|
8
|
+
/** One line of the per-bucket detail a tooltip lists under the series. */
|
|
9
|
+
export interface ChartBreakdownItem {
|
|
10
|
+
label: string;
|
|
11
|
+
value: number;
|
|
12
|
+
}
|
|
13
|
+
/**
|
|
14
|
+
* One bucket on the time axis. Series values sit beside `x` under the
|
|
15
|
+
* keys the `series` name — `{ x, inbound: 12, outbound: 4 }`.
|
|
16
|
+
*/
|
|
17
|
+
export interface ChartDatum {
|
|
18
|
+
/** When the bucket starts: a `Date` or epoch milliseconds. */
|
|
19
|
+
x: Date | number;
|
|
20
|
+
/**
|
|
21
|
+
* Detail for this bucket — errors by route, say — listed in the tooltip
|
|
22
|
+
* under the series rows.
|
|
23
|
+
*/
|
|
24
|
+
breakdown?: ReadonlyArray<ChartBreakdownItem>;
|
|
25
|
+
}
|
|
26
|
+
/** The keys of `T` that hold a number (or nothing yet). */
|
|
27
|
+
export type ChartValueKey<T> = {
|
|
28
|
+
[K in keyof T]-?: K extends "x" | "breakdown" ? never : T[K] extends number | null | undefined ? K : never;
|
|
29
|
+
}[keyof T] & string;
|
|
30
|
+
export interface ChartSeries<T extends ChartDatum = ChartDatum> {
|
|
31
|
+
/** The field of each datum this series plots. */
|
|
32
|
+
key: ChartValueKey<T>;
|
|
33
|
+
/** The name in the legend and the tooltip. */
|
|
34
|
+
label: string;
|
|
35
|
+
/** Defaults to the next categorical slot, in series order. */
|
|
36
|
+
color?: ChartColor;
|
|
37
|
+
/** Line charts: a dashed stroke — a min / max beside an average. */
|
|
38
|
+
dashed?: boolean;
|
|
39
|
+
}
|
|
40
|
+
/** What every chart takes, on top of the div it renders. */
|
|
41
|
+
export interface ChartBaseProps<T extends ChartDatum> extends Omit<ComponentProps<"div">, "children"> {
|
|
42
|
+
/** The buckets, oldest first, evenly spaced in time. */
|
|
43
|
+
data: ReadonlyArray<T>;
|
|
44
|
+
/**
|
|
45
|
+
* One entry per series, in drawing (and legend) order. `T` comes from
|
|
46
|
+
* `data`; the keys here are checked against it.
|
|
47
|
+
*/
|
|
48
|
+
series: ReadonlyArray<ChartSeries<NoInfer<T>>>;
|
|
49
|
+
/** Names the chart for assistive tech — the figure's `aria-label`. */
|
|
50
|
+
label: string;
|
|
51
|
+
/**
|
|
52
|
+
* What the figure says about itself to assistive tech. Generated from
|
|
53
|
+
* the series (range, totals or extremes, peaks) unless given.
|
|
54
|
+
*/
|
|
55
|
+
description?: string;
|
|
56
|
+
/** Plot plus x-axis band, in px; the legend adds its own line below. @default 200 */
|
|
57
|
+
height?: number;
|
|
58
|
+
/** A fixed width instead of measuring the parent — SSR renders, tests. */
|
|
59
|
+
width?: number;
|
|
60
|
+
/** Formats a value on the y-axis and in the tooltip. */
|
|
61
|
+
valueFormat?: (value: number) => string;
|
|
62
|
+
/** Formats a bucket's time in the tooltip heading and the description. */
|
|
63
|
+
timeFormat?: (date: Date) => string;
|
|
64
|
+
/** Locale for the default number and time formats. Runtime locale by default. */
|
|
65
|
+
locale?: string;
|
|
66
|
+
/** Show the legend. On for two or more series; a lone series is named by its title. */
|
|
67
|
+
legend?: boolean;
|
|
68
|
+
/** Where the y-axis starts: at zero, or at the data's low end. @default "zero" */
|
|
69
|
+
baseline?: "zero" | "auto";
|
|
70
|
+
/** A heading over a datum's `breakdown` list in the tooltip. */
|
|
71
|
+
breakdownTitle?: ReactNode;
|
|
72
|
+
/** Data is on its way: the chart holds its last render at half opacity. */
|
|
73
|
+
loading?: boolean;
|
|
74
|
+
/** What the frame says with no buckets to draw. */
|
|
75
|
+
empty?: ReactNode;
|
|
76
|
+
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { RefObject } from 'react';
|
|
2
|
+
/**
|
|
3
|
+
* The width of the element the ref lands on, kept current through a
|
|
4
|
+
* ResizeObserver. Nothing runs on the server: the first render is 0 wide
|
|
5
|
+
* and the plot fills in once the browser has measured. A `fixed` width
|
|
6
|
+
* skips measuring altogether.
|
|
7
|
+
*/
|
|
8
|
+
export declare function useMeasuredWidth<T extends HTMLElement>(fixed?: number): [RefObject<T | null>, number];
|