@praxical/ui 0.0.0-stage → 0.10.1
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/LICENSE +21 -0
- package/README.md +23 -2
- package/dist/activity-calendar.d.ts +13 -0
- package/dist/activity-calendar.js +7 -0
- package/dist/activity-heatmap.d.ts +14 -0
- package/dist/activity-heatmap.js +13 -0
- package/dist/chart-data.d.ts +9 -0
- package/dist/chart-data.js +9 -0
- package/dist/charts.d.ts +56 -0
- package/dist/charts.js +424 -0
- package/dist/chunk-7RMPDKZV.js +541 -0
- package/dist/chunk-7RTW3X7C.js +142 -0
- package/dist/chunk-EBF2F3LN.js +1523 -0
- package/dist/chunk-FCYIZANU.js +385 -0
- package/dist/chunk-HMO4VQZN.js +58 -0
- package/dist/chunk-II677WPC.js +177 -0
- package/dist/chunk-KZHUBPY6.js +102 -0
- package/dist/chunk-OLGZOPLD.js +166 -0
- package/dist/chunk-PDSV773E.js +52 -0
- package/dist/chunk-Q4ARHP76.js +457 -0
- package/dist/chunk-U5W7O3QV.js +22 -0
- package/dist/chunk-V6MXR4P2.js +275 -0
- package/dist/chunk-VZZDLRM5.js +152 -0
- package/dist/chunk-WEM2UQPR.js +110 -0
- package/dist/chunk-XFNDEA5M.js +104 -0
- package/dist/chunk-YKFAA7GU.js +72 -0
- package/dist/code-value.d.ts +13 -0
- package/dist/code-value.js +10 -0
- package/dist/code.d.ts +36 -0
- package/dist/code.js +198 -0
- package/dist/collection.d.ts +21 -0
- package/dist/collection.js +48 -0
- package/dist/content.d.ts +42 -0
- package/dist/content.js +122 -0
- package/dist/display.d.ts +58 -0
- package/dist/display.js +27 -0
- package/dist/feedback.d.ts +34 -0
- package/dist/feedback.js +184 -0
- package/dist/file-tree.d.ts +17 -0
- package/dist/file-tree.js +11 -0
- package/dist/forms.d.ts +69 -0
- package/dist/forms.js +273 -0
- package/dist/git-graph.d.ts +8 -0
- package/dist/git-graph.js +15 -0
- package/dist/git-layout.d.ts +24 -0
- package/dist/git-layout.js +7 -0
- package/dist/image-viewer.d.ts +18 -0
- package/dist/image-viewer.js +11 -0
- package/dist/index.d.ts +363 -0
- package/dist/index.js +98 -0
- package/dist/inputs.d.ts +112 -0
- package/dist/inputs.js +938 -0
- package/dist/layout.d.ts +56 -0
- package/dist/layout.js +180 -0
- package/dist/map-frame.d.ts +37 -0
- package/dist/map-frame.js +13 -0
- package/dist/media.d.ts +40 -0
- package/dist/media.js +19 -0
- package/dist/network-layout.d.ts +94 -0
- package/dist/network-layout.js +19 -0
- package/dist/network.d.ts +111 -0
- package/dist/network.js +354 -0
- package/dist/overlays.d.ts +95 -0
- package/dist/overlays.js +25 -0
- package/dist/patterns.d.ts +117 -0
- package/dist/patterns.js +387 -0
- package/dist/power-layout.d.ts +91 -0
- package/dist/power-layout.js +13 -0
- package/dist/power.d.ts +91 -0
- package/dist/power.js +353 -0
- package/dist/signal-context.d.ts +11 -0
- package/dist/signal-context.js +15 -0
- package/dist/strings-es-419.d.ts +13 -0
- package/dist/strings-es-419.js +357 -0
- package/dist/strings-fr.d.ts +15 -0
- package/dist/strings-fr.js +359 -0
- package/dist/strings-ja.d.ts +16 -0
- package/dist/strings-ja.js +357 -0
- package/dist/strings-pt-BR.d.ts +13 -0
- package/dist/strings-pt-BR.js +357 -0
- package/dist/strings.d.ts +394 -0
- package/dist/strings.js +15 -0
- package/dist/styles.css +2 -0
- package/dist/tab-bar.d.ts +20 -0
- package/dist/tab-bar.js +114 -0
- package/package.json +154 -3
package/dist/network.js
ADDED
|
@@ -0,0 +1,354 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
MapFrame,
|
|
5
|
+
clip
|
|
6
|
+
} from "./chunk-II677WPC.js";
|
|
7
|
+
import {
|
|
8
|
+
faceplateGrid,
|
|
9
|
+
formatBitRate,
|
|
10
|
+
formatLinkSpeed,
|
|
11
|
+
layoutNetworkMap,
|
|
12
|
+
linkSpeedTier,
|
|
13
|
+
mapGeometry,
|
|
14
|
+
portLabel
|
|
15
|
+
} from "./chunk-VZZDLRM5.js";
|
|
16
|
+
import {
|
|
17
|
+
Tooltip
|
|
18
|
+
} from "./chunk-EBF2F3LN.js";
|
|
19
|
+
import {
|
|
20
|
+
useSignalStrings
|
|
21
|
+
} from "./chunk-U5W7O3QV.js";
|
|
22
|
+
import "./chunk-FCYIZANU.js";
|
|
23
|
+
|
|
24
|
+
// packages/ui/src/network.tsx
|
|
25
|
+
import {
|
|
26
|
+
cloneElement,
|
|
27
|
+
useMemo,
|
|
28
|
+
useState
|
|
29
|
+
} from "react";
|
|
30
|
+
import { Network as NetworkIcon } from "lucide-react";
|
|
31
|
+
import { Fragment, jsx, jsxs } from "react/jsx-runtime";
|
|
32
|
+
var cx = (...names) => names.filter(Boolean).join(" ");
|
|
33
|
+
var traffic = (s) => s && (s.health === "up" || s.health === "problem");
|
|
34
|
+
var severityOf = (s) => s?.severity ?? (s?.health === "problem" ? "warning" : void 0);
|
|
35
|
+
function Faceplate({
|
|
36
|
+
label,
|
|
37
|
+
blocks,
|
|
38
|
+
ports,
|
|
39
|
+
onPortSelect,
|
|
40
|
+
className,
|
|
41
|
+
...props
|
|
42
|
+
}) {
|
|
43
|
+
const strings = useSignalStrings();
|
|
44
|
+
const names = blocks.flatMap((b) => b.ports.flatMap((p) => p?.name ? [p.name] : []));
|
|
45
|
+
const [active, setActive] = useState();
|
|
46
|
+
const current = active && names.includes(active) ? active : names[0];
|
|
47
|
+
const move = (e) => {
|
|
48
|
+
const all = [...e.currentTarget.querySelectorAll("[data-port]")];
|
|
49
|
+
const from = all.indexOf(e.target);
|
|
50
|
+
if (from < 0) return;
|
|
51
|
+
let to = -1;
|
|
52
|
+
if (e.key === "Home") to = 0;
|
|
53
|
+
else if (e.key === "End") to = all.length - 1;
|
|
54
|
+
else {
|
|
55
|
+
const dir = { ArrowRight: [1, 0], ArrowLeft: [-1, 0], ArrowDown: [0, 1], ArrowUp: [0, -1] }[e.key];
|
|
56
|
+
if (!dir) return;
|
|
57
|
+
const centre = (el) => {
|
|
58
|
+
const r = el.getBoundingClientRect();
|
|
59
|
+
return [r.left + r.width / 2, r.top + r.height / 2];
|
|
60
|
+
};
|
|
61
|
+
const [x0, y0] = centre(all[from]);
|
|
62
|
+
let best = Infinity;
|
|
63
|
+
all.forEach((el, i) => {
|
|
64
|
+
const [x, y] = centre(el);
|
|
65
|
+
const along = (x - x0) * dir[0] + (y - y0) * dir[1];
|
|
66
|
+
if (i === from || along < 1) return;
|
|
67
|
+
const score = along + 2 * Math.abs((x - x0) * dir[1] + (y - y0) * dir[0]);
|
|
68
|
+
if (score < best) [best, to] = [score, i];
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
if (to < 0) return;
|
|
72
|
+
e.preventDefault();
|
|
73
|
+
all[to].focus();
|
|
74
|
+
};
|
|
75
|
+
return /* @__PURE__ */ jsx(
|
|
76
|
+
"div",
|
|
77
|
+
{
|
|
78
|
+
...props,
|
|
79
|
+
className: cx("signal-faceplate", className),
|
|
80
|
+
role: "group",
|
|
81
|
+
"aria-label": label,
|
|
82
|
+
onKeyDown: (e) => {
|
|
83
|
+
move(e);
|
|
84
|
+
props.onKeyDown?.(e);
|
|
85
|
+
},
|
|
86
|
+
children: blocks.map((block, b) => {
|
|
87
|
+
const { rows, cols, cells } = faceplateGrid(block);
|
|
88
|
+
return /* @__PURE__ */ jsxs("div", { className: "signal-faceplate-block", children: [
|
|
89
|
+
block.caption && /* @__PURE__ */ jsx("span", { className: "signal-faceplate-caption", children: block.caption }),
|
|
90
|
+
/* @__PURE__ */ jsx(
|
|
91
|
+
"div",
|
|
92
|
+
{
|
|
93
|
+
className: "signal-faceplate-grid",
|
|
94
|
+
style: { gridTemplateColumns: `repeat(${cols}, var(--signal-port-pitch))` },
|
|
95
|
+
children: cells.map(({ row, col, index }) => {
|
|
96
|
+
const port = block.ports[index];
|
|
97
|
+
const style = { gridRow: row + 1, gridColumn: col + 1 };
|
|
98
|
+
if (!port?.name)
|
|
99
|
+
return /* @__PURE__ */ jsx("span", { className: "signal-port-blank", style, "aria-hidden": "true" }, index);
|
|
100
|
+
const state = ports[port.name];
|
|
101
|
+
const health = state?.health ?? "unknown";
|
|
102
|
+
const said = state?.label ?? strings.network.health[health];
|
|
103
|
+
const attrs = {
|
|
104
|
+
className: "signal-port",
|
|
105
|
+
style,
|
|
106
|
+
tabIndex: port.name === current ? 0 : -1,
|
|
107
|
+
"data-port": "",
|
|
108
|
+
"data-shape": block.shape,
|
|
109
|
+
"data-health": health,
|
|
110
|
+
"data-tier": traffic(state) ? state?.tier : void 0,
|
|
111
|
+
"data-severity": severityOf(state),
|
|
112
|
+
"data-above": rows === 2 && row === 0 || void 0,
|
|
113
|
+
"aria-label": `${port.name}, ${said}`,
|
|
114
|
+
onFocus: () => setActive(port.name)
|
|
115
|
+
};
|
|
116
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
117
|
+
/* @__PURE__ */ jsx("span", { className: "signal-port-jack", "aria-hidden": "true" }),
|
|
118
|
+
/* @__PURE__ */ jsxs("span", { className: "signal-port-text", "aria-hidden": "true", children: [
|
|
119
|
+
/* @__PURE__ */ jsx("span", { className: "signal-port-name", children: portLabel(port) }),
|
|
120
|
+
traffic(state) && (state?.rx !== void 0 || state?.tx !== void 0) ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
121
|
+
/* @__PURE__ */ jsx("span", { children: `\u2193${formatBitRate(state?.rx ?? 0)}` }),
|
|
122
|
+
/* @__PURE__ */ jsx("span", { children: `\u2191${formatBitRate(state?.tx ?? 0)}` })
|
|
123
|
+
] }) : /* @__PURE__ */ jsx("span", { children: health === "off" ? strings.network.portOff : health === "down" ? "\u2014" : "" })
|
|
124
|
+
] })
|
|
125
|
+
] });
|
|
126
|
+
const element = state?.href ? /* @__PURE__ */ jsx("a", { ...attrs, href: state.href, children: body }) : onPortSelect ? /* @__PURE__ */ jsx("button", { ...attrs, type: "button", onClick: () => onPortSelect(port.name), children: body }) : /* @__PURE__ */ jsx("span", { ...attrs, role: "img", children: body });
|
|
127
|
+
return /* @__PURE__ */ jsx(
|
|
128
|
+
Tooltip,
|
|
129
|
+
{
|
|
130
|
+
content: /* @__PURE__ */ jsxs("span", { className: "signal-network-tip", children: [
|
|
131
|
+
/* @__PURE__ */ jsx("strong", { className: "signal-mono", children: port.name }),
|
|
132
|
+
state?.tooltip ?? said
|
|
133
|
+
] }),
|
|
134
|
+
children: element
|
|
135
|
+
},
|
|
136
|
+
index
|
|
137
|
+
);
|
|
138
|
+
})
|
|
139
|
+
}
|
|
140
|
+
)
|
|
141
|
+
] }, b);
|
|
142
|
+
})
|
|
143
|
+
}
|
|
144
|
+
);
|
|
145
|
+
}
|
|
146
|
+
function FaceplateLegend({ className, ...props }) {
|
|
147
|
+
const s = useSignalStrings().network;
|
|
148
|
+
const item = (label, attrs) => /* @__PURE__ */ jsxs("li", { children: [
|
|
149
|
+
/* @__PURE__ */ jsx("span", { className: "signal-port-swatch", "aria-hidden": "true", ...attrs }),
|
|
150
|
+
label
|
|
151
|
+
] }, label);
|
|
152
|
+
return /* @__PURE__ */ jsxs("ul", { ...props, className: cx("signal-network-legend", className), "aria-label": s.faceplateLegend, children: [
|
|
153
|
+
s.tiers.map((t, i) => item(t, { "data-health": "up", "data-tier": i })),
|
|
154
|
+
item(s.upUnknownSpeed, { "data-health": "up" }),
|
|
155
|
+
item(s.health.problem, { "data-health": "problem", "data-tier": 1, "data-severity": "warning" }),
|
|
156
|
+
item(s.health.down, { "data-health": "down" }),
|
|
157
|
+
item(s.health.off, { "data-health": "off" }),
|
|
158
|
+
item(s.health.unknown, { "data-health": "unknown" })
|
|
159
|
+
] });
|
|
160
|
+
}
|
|
161
|
+
function NetworkMap({
|
|
162
|
+
roots,
|
|
163
|
+
label,
|
|
164
|
+
onNodeSelect,
|
|
165
|
+
legend = true,
|
|
166
|
+
className,
|
|
167
|
+
...props
|
|
168
|
+
}) {
|
|
169
|
+
const s = useSignalStrings().network;
|
|
170
|
+
const L = useMemo(() => layoutNetworkMap(roots), [roots]);
|
|
171
|
+
const items = useMemo(() => L.nodes.map((p) => ({ id: p.node.id, parent: p.parent })), [L]);
|
|
172
|
+
if (!roots.length) return /* @__PURE__ */ jsx("p", { className: "signal-muted", children: s.empty });
|
|
173
|
+
const linkText = (l) => l.label ?? [s.health[l.health], l.speed, l.wireless ? s.wireless : ""].filter(Boolean).join(", ");
|
|
174
|
+
const nodeTip = (n) => /* @__PURE__ */ jsxs("span", { className: "signal-network-tip", children: [
|
|
175
|
+
/* @__PURE__ */ jsx("strong", { children: n.label }),
|
|
176
|
+
n.description && /* @__PURE__ */ jsx("span", { className: "signal-muted", children: n.description }),
|
|
177
|
+
n.status && /* @__PURE__ */ jsx("span", { children: n.status.label }),
|
|
178
|
+
n.tooltip,
|
|
179
|
+
n.link && /* @__PURE__ */ jsx("span", { className: "signal-muted", children: s.link(linkText(n.link)) })
|
|
180
|
+
] });
|
|
181
|
+
const linkTip = (n, l) => /* @__PURE__ */ jsxs("span", { className: "signal-network-tip", children: [
|
|
182
|
+
/* @__PURE__ */ jsx("strong", { children: n.label }),
|
|
183
|
+
l.tooltip ?? linkText(l)
|
|
184
|
+
] });
|
|
185
|
+
return /* @__PURE__ */ jsx("div", { ...props, className: cx("signal-network-map", className), children: /* @__PURE__ */ jsx(
|
|
186
|
+
MapFrame,
|
|
187
|
+
{
|
|
188
|
+
className: "signal-network-frame",
|
|
189
|
+
label: label ?? s.map,
|
|
190
|
+
hint: s.mapHint,
|
|
191
|
+
width: L.width,
|
|
192
|
+
height: L.height,
|
|
193
|
+
items,
|
|
194
|
+
after: legend && /* @__PURE__ */ jsx(NetworkMapLegend, {}),
|
|
195
|
+
children: (frame) => /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
196
|
+
L.spines.map((d, i) => /* @__PURE__ */ jsx("path", { d, className: "signal-network-spine" }, i)),
|
|
197
|
+
L.edges.map((e) => {
|
|
198
|
+
const n = e.child.node;
|
|
199
|
+
const l = n.link ?? { health: "unknown" };
|
|
200
|
+
const speed = l.health === "up" || l.health === "problem" ? l.tier : void 0;
|
|
201
|
+
const text = l.wireless && l.speed ? `${s.wireless} ${l.speed}` : l.speed;
|
|
202
|
+
return /* @__PURE__ */ jsxs("g", { className: "signal-network-cable", ...frame.hover(linkTip(n, l)), children: [
|
|
203
|
+
/* @__PURE__ */ jsx("path", { d: e.d, className: "signal-network-hit" }),
|
|
204
|
+
/* @__PURE__ */ jsx(
|
|
205
|
+
"path",
|
|
206
|
+
{
|
|
207
|
+
d: e.d,
|
|
208
|
+
className: "signal-network-edge",
|
|
209
|
+
"data-health": l.health,
|
|
210
|
+
"data-severity": severityOf(l),
|
|
211
|
+
"data-tier": speed,
|
|
212
|
+
"data-wireless": l.wireless || void 0
|
|
213
|
+
}
|
|
214
|
+
),
|
|
215
|
+
!e.stacked && text && /* @__PURE__ */ jsx(
|
|
216
|
+
"text",
|
|
217
|
+
{
|
|
218
|
+
x: e.labelX,
|
|
219
|
+
y: e.labelY,
|
|
220
|
+
className: "signal-network-speed",
|
|
221
|
+
"data-severity": severityOf(l),
|
|
222
|
+
"data-declared": l.declared || void 0,
|
|
223
|
+
children: text
|
|
224
|
+
}
|
|
225
|
+
)
|
|
226
|
+
] }, n.id);
|
|
227
|
+
}),
|
|
228
|
+
L.joints.map((j, i) => /* @__PURE__ */ jsx("circle", { cx: j.x, cy: j.y, r: 3, className: "signal-network-joint" }, i)),
|
|
229
|
+
L.nodes.map((p) => /* @__PURE__ */ jsx(
|
|
230
|
+
MapNode,
|
|
231
|
+
{
|
|
232
|
+
p,
|
|
233
|
+
frame: frame.item(p.node.id, nodeTip(p.node)),
|
|
234
|
+
said: [p.node.label, p.node.description, p.node.status?.label, p.node.link && s.link(linkText(p.node.link))].filter(Boolean).join(", "),
|
|
235
|
+
onNodeSelect
|
|
236
|
+
},
|
|
237
|
+
p.node.id
|
|
238
|
+
))
|
|
239
|
+
] })
|
|
240
|
+
}
|
|
241
|
+
) });
|
|
242
|
+
}
|
|
243
|
+
function MapNode({
|
|
244
|
+
p,
|
|
245
|
+
frame,
|
|
246
|
+
said,
|
|
247
|
+
onNodeSelect
|
|
248
|
+
}) {
|
|
249
|
+
const s = useSignalStrings().network;
|
|
250
|
+
const g = mapGeometry;
|
|
251
|
+
const n = p.node;
|
|
252
|
+
const r = p.stacked ? g.leafRadius : g.radius;
|
|
253
|
+
const size = p.stacked ? 14 : 18;
|
|
254
|
+
const l = n.link;
|
|
255
|
+
const meta = l ? [l.ports, l.speed, l.wireless ? s.wireless : ""].filter(Boolean).join(" \xB7 ") : "";
|
|
256
|
+
const select = !n.href && onNodeSelect ? () => onNodeSelect(n) : void 0;
|
|
257
|
+
const common = {
|
|
258
|
+
...frame,
|
|
259
|
+
className: "signal-network-node",
|
|
260
|
+
"data-action": n.href || select ? "" : void 0,
|
|
261
|
+
"aria-label": said
|
|
262
|
+
};
|
|
263
|
+
const body = /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
264
|
+
/* @__PURE__ */ jsx("circle", { cx: p.x, cy: p.y, r, className: "signal-network-disc" }),
|
|
265
|
+
cloneElement(n.icon ?? /* @__PURE__ */ jsx(NetworkIcon, {}), {
|
|
266
|
+
x: p.x - size / 2,
|
|
267
|
+
y: p.y - size / 2,
|
|
268
|
+
width: size,
|
|
269
|
+
height: size,
|
|
270
|
+
className: "signal-network-icon",
|
|
271
|
+
"aria-hidden": true
|
|
272
|
+
}),
|
|
273
|
+
n.status && /* @__PURE__ */ jsx(
|
|
274
|
+
"circle",
|
|
275
|
+
{
|
|
276
|
+
cx: p.x + r * 0.72,
|
|
277
|
+
cy: p.y + r * 0.72,
|
|
278
|
+
r: p.stacked ? 3.5 : 4.5,
|
|
279
|
+
className: "signal-network-status",
|
|
280
|
+
"data-tone": n.status.tone
|
|
281
|
+
}
|
|
282
|
+
),
|
|
283
|
+
p.stacked ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
284
|
+
/* @__PURE__ */ jsx("text", { x: p.x + r + 8, y: p.y - 1, className: "signal-network-name", children: clip(n.label, 24) }),
|
|
285
|
+
/* @__PURE__ */ jsx(
|
|
286
|
+
"text",
|
|
287
|
+
{
|
|
288
|
+
x: p.x + r + 8,
|
|
289
|
+
y: p.y + 12,
|
|
290
|
+
className: "signal-network-sub",
|
|
291
|
+
"data-severity": severityOf(l),
|
|
292
|
+
"data-declared": l?.declared && !!meta || void 0,
|
|
293
|
+
children: clip(meta || n.description || "", 30)
|
|
294
|
+
}
|
|
295
|
+
)
|
|
296
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
297
|
+
/* @__PURE__ */ jsx("text", { x: p.x, y: p.y + g.radius + 15, textAnchor: "middle", className: "signal-network-name", children: clip(n.label, 18) }),
|
|
298
|
+
n.description && /* @__PURE__ */ jsx("text", { x: p.x, y: p.y + g.radius + 29, textAnchor: "middle", className: "signal-network-sub", children: clip(n.description, 22) })
|
|
299
|
+
] })
|
|
300
|
+
] });
|
|
301
|
+
return n.href ? /* @__PURE__ */ jsx("a", { ...common, href: n.href, children: body }) : /* @__PURE__ */ jsx(
|
|
302
|
+
"g",
|
|
303
|
+
{
|
|
304
|
+
...common,
|
|
305
|
+
role: select ? "button" : "img",
|
|
306
|
+
onClick: select,
|
|
307
|
+
onKeyDown: (e) => {
|
|
308
|
+
if (select && (e.key === "Enter" || e.key === " ")) {
|
|
309
|
+
e.preventDefault();
|
|
310
|
+
select();
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
children: body
|
|
314
|
+
}
|
|
315
|
+
);
|
|
316
|
+
}
|
|
317
|
+
function NetworkMapLegend({ className, ...props }) {
|
|
318
|
+
const s = useSignalStrings().network;
|
|
319
|
+
const item = (label, attrs) => /* @__PURE__ */ jsxs("li", { children: [
|
|
320
|
+
/* @__PURE__ */ jsx("svg", { width: "28", height: "10", "aria-hidden": "true", children: /* @__PURE__ */ jsx("path", { d: "M2,5 H26", className: "signal-network-edge", ...attrs }) }),
|
|
321
|
+
label
|
|
322
|
+
] }, label);
|
|
323
|
+
return /* @__PURE__ */ jsxs("ul", { ...props, className: cx("signal-network-legend", className), "aria-label": s.mapLegend, children: [
|
|
324
|
+
item(s.faster, { "data-health": "up", "data-tier": "3" }),
|
|
325
|
+
item(s.health.problem, { "data-health": "problem", "data-severity": "warning" }),
|
|
326
|
+
item(s.mustStayUp, { "data-health": "down", "data-severity": "danger" }),
|
|
327
|
+
item(s.health.down, { "data-health": "down" }),
|
|
328
|
+
item(s.health.unknown, { "data-health": "unknown" }),
|
|
329
|
+
item(s.wireless, { "data-health": "up", "data-wireless": "" }),
|
|
330
|
+
/* @__PURE__ */ jsxs("li", { children: [
|
|
331
|
+
/* @__PURE__ */ jsx("span", { className: "signal-network-speed-key", children: "10G" }),
|
|
332
|
+
" ",
|
|
333
|
+
s.measured,
|
|
334
|
+
",",
|
|
335
|
+
" ",
|
|
336
|
+
/* @__PURE__ */ jsx("span", { className: "signal-network-speed-key", "data-declared": "", children: "10G" }),
|
|
337
|
+
" ",
|
|
338
|
+
s.declared
|
|
339
|
+
] })
|
|
340
|
+
] });
|
|
341
|
+
}
|
|
342
|
+
export {
|
|
343
|
+
Faceplate,
|
|
344
|
+
FaceplateLegend,
|
|
345
|
+
NetworkMap,
|
|
346
|
+
NetworkMapLegend,
|
|
347
|
+
faceplateGrid,
|
|
348
|
+
formatBitRate,
|
|
349
|
+
formatLinkSpeed,
|
|
350
|
+
layoutNetworkMap,
|
|
351
|
+
linkSpeedTier,
|
|
352
|
+
mapGeometry,
|
|
353
|
+
portLabel
|
|
354
|
+
};
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
import { type ReactNode } from "react";
|
|
2
|
+
import { type ButtonProps } from "./index.js";
|
|
3
|
+
export interface ActionItem {
|
|
4
|
+
id: string;
|
|
5
|
+
label: string;
|
|
6
|
+
onSelect: () => void;
|
|
7
|
+
disabled?: boolean;
|
|
8
|
+
icon?: ReactNode;
|
|
9
|
+
shortcut?: string;
|
|
10
|
+
danger?: boolean;
|
|
11
|
+
}
|
|
12
|
+
export declare function SplitButton({ label, onClick, items, variant, disabled, }: {
|
|
13
|
+
label: string;
|
|
14
|
+
onClick: () => void;
|
|
15
|
+
items: readonly ActionItem[];
|
|
16
|
+
variant?: ButtonProps["variant"];
|
|
17
|
+
disabled?: boolean;
|
|
18
|
+
}): import("react").JSX.Element;
|
|
19
|
+
export declare function ContextMenu({ label, children, items, }: {
|
|
20
|
+
label: string;
|
|
21
|
+
children: ReactNode;
|
|
22
|
+
items: readonly ActionItem[];
|
|
23
|
+
}): import("react").JSX.Element;
|
|
24
|
+
export interface CommandItem extends ActionItem {
|
|
25
|
+
keywords?: string;
|
|
26
|
+
}
|
|
27
|
+
export declare function CommandDialog({ items, open, onOpenChange, shortcut, label, trigger, }: {
|
|
28
|
+
items: readonly CommandItem[];
|
|
29
|
+
open: boolean;
|
|
30
|
+
onOpenChange: (v: boolean) => void;
|
|
31
|
+
shortcut?: boolean;
|
|
32
|
+
label?: string;
|
|
33
|
+
/** `false` renders no trigger; the application opens the dialog itself. */
|
|
34
|
+
trigger?: ReactNode | false;
|
|
35
|
+
}): import("react").JSX.Element;
|
|
36
|
+
export interface NotificationItem {
|
|
37
|
+
id: string;
|
|
38
|
+
title: string;
|
|
39
|
+
body?: ReactNode;
|
|
40
|
+
time: string;
|
|
41
|
+
dateTime: string;
|
|
42
|
+
unread?: boolean;
|
|
43
|
+
action?: ReactNode;
|
|
44
|
+
}
|
|
45
|
+
export declare function NotificationDrawer({ items, open, onOpenChange, onMarkRead, onDismiss, label, }: {
|
|
46
|
+
items: readonly NotificationItem[];
|
|
47
|
+
open: boolean;
|
|
48
|
+
onOpenChange: (v: boolean) => void;
|
|
49
|
+
onMarkRead?: (id: string) => void;
|
|
50
|
+
onDismiss?: (id: string) => void;
|
|
51
|
+
label?: string;
|
|
52
|
+
}): import("react").JSX.Element;
|
|
53
|
+
/** A modal side panel with a fixed header and an independently scrolling body. */
|
|
54
|
+
export declare function SidePanel({ title, trigger, triggerLabel, open, onOpenChange, children, side, className, }: {
|
|
55
|
+
title: string;
|
|
56
|
+
trigger: ReactNode;
|
|
57
|
+
/** Accessible name of the trigger when it should differ from the panel title,
|
|
58
|
+
* such as "Open navigation" for a panel titled "Store navigation". */
|
|
59
|
+
triggerLabel?: string;
|
|
60
|
+
open: boolean;
|
|
61
|
+
onOpenChange: (v: boolean) => void;
|
|
62
|
+
children: ReactNode;
|
|
63
|
+
side?: "left" | "right";
|
|
64
|
+
className?: string;
|
|
65
|
+
}): import("react").JSX.Element;
|
|
66
|
+
export interface ContentOption {
|
|
67
|
+
id: string;
|
|
68
|
+
label: string;
|
|
69
|
+
keywords?: string;
|
|
70
|
+
category?: string;
|
|
71
|
+
preview?: ReactNode;
|
|
72
|
+
description?: string;
|
|
73
|
+
disabled?: boolean;
|
|
74
|
+
}
|
|
75
|
+
/** Searchable insertion picker for caller-owned content. Base UI owns popup and grid/list keyboard behavior. */
|
|
76
|
+
export declare function ContentPicker({ label, trigger, items, onSelect, grid, compact, }: {
|
|
77
|
+
label: string;
|
|
78
|
+
trigger: ReactNode;
|
|
79
|
+
items: readonly ContentOption[];
|
|
80
|
+
onSelect: (item: ContentOption) => void;
|
|
81
|
+
grid?: boolean;
|
|
82
|
+
compact?: boolean;
|
|
83
|
+
}): import("react").JSX.Element;
|
|
84
|
+
export interface EmojiOption {
|
|
85
|
+
id: string;
|
|
86
|
+
emoji: string;
|
|
87
|
+
label: string;
|
|
88
|
+
keywords?: string;
|
|
89
|
+
}
|
|
90
|
+
export declare const commonEmoji: readonly EmojiOption[];
|
|
91
|
+
export declare function EmojiPicker({ onSelect, items, label, }: {
|
|
92
|
+
onSelect: (item: EmojiOption) => void;
|
|
93
|
+
items?: readonly EmojiOption[];
|
|
94
|
+
label?: string;
|
|
95
|
+
}): import("react").JSX.Element;
|
package/dist/overlays.js
ADDED
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
"use client";
|
|
3
|
+
import {
|
|
4
|
+
CommandDialog,
|
|
5
|
+
ContentPicker,
|
|
6
|
+
ContextMenu,
|
|
7
|
+
EmojiPicker,
|
|
8
|
+
NotificationDrawer,
|
|
9
|
+
SidePanel,
|
|
10
|
+
SplitButton,
|
|
11
|
+
commonEmoji
|
|
12
|
+
} from "./chunk-7RMPDKZV.js";
|
|
13
|
+
import "./chunk-EBF2F3LN.js";
|
|
14
|
+
import "./chunk-U5W7O3QV.js";
|
|
15
|
+
import "./chunk-FCYIZANU.js";
|
|
16
|
+
export {
|
|
17
|
+
CommandDialog,
|
|
18
|
+
ContentPicker,
|
|
19
|
+
ContextMenu,
|
|
20
|
+
EmojiPicker,
|
|
21
|
+
NotificationDrawer,
|
|
22
|
+
SidePanel,
|
|
23
|
+
SplitButton,
|
|
24
|
+
commonEmoji
|
|
25
|
+
};
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
import type { ComponentProps, ReactNode, MouseEvent } from "react";
|
|
2
|
+
import { type EmojiOption } from "./overlays.js";
|
|
3
|
+
import { type AudioPlayerProps } from "./media.js";
|
|
4
|
+
/** Initials or an image. Beside a visible name, pass `decorative` so the name
|
|
5
|
+
* is not read twice. */
|
|
6
|
+
export declare function Avatar({ name, src, size, decorative, }: {
|
|
7
|
+
name: string;
|
|
8
|
+
src?: string;
|
|
9
|
+
size?: "small" | "normal";
|
|
10
|
+
/** Hide from assistive technology; the adjacent text already names the person. */
|
|
11
|
+
decorative?: boolean;
|
|
12
|
+
}): import("react").JSX.Element;
|
|
13
|
+
export declare function Breadcrumbs({ children, label, }: {
|
|
14
|
+
children: ReactNode;
|
|
15
|
+
label?: string;
|
|
16
|
+
}): import("react").JSX.Element;
|
|
17
|
+
export declare function NavItem({ icon, children, current, ...props }: ComponentProps<"a"> & {
|
|
18
|
+
icon?: ReactNode;
|
|
19
|
+
current?: boolean;
|
|
20
|
+
}): import("react").JSX.Element;
|
|
21
|
+
export declare function Pagination({ page, pageCount, onPageChange, label, }: {
|
|
22
|
+
page: number;
|
|
23
|
+
pageCount: number;
|
|
24
|
+
onPageChange: (page: number) => void;
|
|
25
|
+
label?: string;
|
|
26
|
+
}): import("react").JSX.Element;
|
|
27
|
+
export declare function KeyValue({ items, divided, }: {
|
|
28
|
+
items: {
|
|
29
|
+
label: string;
|
|
30
|
+
value: ReactNode;
|
|
31
|
+
}[];
|
|
32
|
+
divided?: boolean;
|
|
33
|
+
}): import("react").JSX.Element;
|
|
34
|
+
export declare function Timeline({ label, items, }: {
|
|
35
|
+
label: string;
|
|
36
|
+
items: {
|
|
37
|
+
id: string;
|
|
38
|
+
title: ReactNode;
|
|
39
|
+
detail?: ReactNode;
|
|
40
|
+
time: string;
|
|
41
|
+
dateTime: string;
|
|
42
|
+
}[];
|
|
43
|
+
}): import("react").JSX.Element;
|
|
44
|
+
export type MessageDelivery = "sending" | "sent" | "delivered" | "read" | "failed";
|
|
45
|
+
export type MessageReaction = {
|
|
46
|
+
id: string;
|
|
47
|
+
emoji: string;
|
|
48
|
+
label: string;
|
|
49
|
+
count: number;
|
|
50
|
+
selected?: boolean;
|
|
51
|
+
};
|
|
52
|
+
export type MessageProps = {
|
|
53
|
+
author: string;
|
|
54
|
+
avatar?: ReactNode;
|
|
55
|
+
children: ReactNode;
|
|
56
|
+
time: string;
|
|
57
|
+
dateTime: string;
|
|
58
|
+
mode?: "inline" | "conversation";
|
|
59
|
+
direction?: "incoming" | "outgoing";
|
|
60
|
+
delivery?: MessageDelivery;
|
|
61
|
+
tags?: ReactNode;
|
|
62
|
+
media?: ReactNode;
|
|
63
|
+
actions?: ReactNode;
|
|
64
|
+
reactions?: MessageReaction[];
|
|
65
|
+
onReaction?: (reaction: MessageReaction) => void;
|
|
66
|
+
onAddReaction?: (emoji: EmojiOption) => void;
|
|
67
|
+
reactionOptions?: readonly EmojiOption[];
|
|
68
|
+
};
|
|
69
|
+
/** Presentation only: the application owns delivery receipts, reactions and message persistence. */
|
|
70
|
+
export declare function Message({ author, avatar, children, time, dateTime, actions, mode, direction, delivery, tags, media, reactions, onReaction, onAddReaction, reactionOptions, }: MessageProps): import("react").JSX.Element;
|
|
71
|
+
export declare function Conversation({ label, children, live, }: {
|
|
72
|
+
label: string;
|
|
73
|
+
children: ReactNode;
|
|
74
|
+
live?: "off" | "polite";
|
|
75
|
+
}): import("react").JSX.Element;
|
|
76
|
+
export type MediaAttachmentProps = {
|
|
77
|
+
kind: "image";
|
|
78
|
+
src: string;
|
|
79
|
+
alt: string;
|
|
80
|
+
caption?: string;
|
|
81
|
+
onOpen?: (event: MouseEvent<HTMLButtonElement>) => void;
|
|
82
|
+
} | (AudioPlayerProps & {
|
|
83
|
+
kind: "audio";
|
|
84
|
+
}) | {
|
|
85
|
+
kind: "video";
|
|
86
|
+
src: string;
|
|
87
|
+
label: string;
|
|
88
|
+
poster?: string;
|
|
89
|
+
captions?: {
|
|
90
|
+
src: string;
|
|
91
|
+
language: string;
|
|
92
|
+
label: string;
|
|
93
|
+
};
|
|
94
|
+
} | {
|
|
95
|
+
kind: "file";
|
|
96
|
+
name: string;
|
|
97
|
+
detail: string;
|
|
98
|
+
action?: ReactNode;
|
|
99
|
+
};
|
|
100
|
+
/** Caller supplies authorized URLs. Browser media controls never autoplay. */
|
|
101
|
+
export declare function MediaAttachment(props: MediaAttachmentProps): import("react").JSX.Element;
|
|
102
|
+
export declare function FileRow({ name, detail, icon, action, }: {
|
|
103
|
+
name: string;
|
|
104
|
+
detail: string;
|
|
105
|
+
icon?: ReactNode;
|
|
106
|
+
action?: ReactNode;
|
|
107
|
+
}): import("react").JSX.Element;
|
|
108
|
+
/** A text-only log/code surface. Caller controls redaction, streaming, language and copying. */
|
|
109
|
+
export declare function CodeBlock({ label, children, }: {
|
|
110
|
+
label: string;
|
|
111
|
+
children: string;
|
|
112
|
+
}): import("react").JSX.Element;
|
|
113
|
+
export declare function Skeleton({ label, rows, }: {
|
|
114
|
+
label?: string;
|
|
115
|
+
rows?: number;
|
|
116
|
+
}): import("react").JSX.Element;
|
|
117
|
+
export declare function Separator(): import("react").JSX.Element;
|