@rtkelly-labs/design-system 0.18.0 → 0.19.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/CHANGELOG.md +19 -0
- package/README.md +1 -1
- package/dist/components/DataTable.js +135 -52
- package/dist/components/DataTable.js.map +1 -1
- package/dist/components/InlineAction.js +58 -0
- package/dist/components/InlineAction.js.map +1 -0
- package/dist/components/ResourceState.js +55 -0
- package/dist/components/ResourceState.js.map +1 -0
- package/dist/components/docs/figures/DrawingSheet.js +4 -1
- package/dist/components/docs/figures/DrawingSheet.js.map +1 -1
- package/dist/components/docs/figures/FigureSurfaceContext.js +9 -0
- package/dist/components/docs/figures/FigureSurfaceContext.js.map +1 -0
- package/dist/components/docs/figures/IndexedSection.js +8 -2
- package/dist/components/docs/figures/IndexedSection.js.map +1 -1
- package/dist/components/docs/figures/index.js.map +1 -1
- package/dist/hooks/usePolledResource.js +98 -0
- package/dist/hooks/usePolledResource.js.map +1 -0
- package/dist/index.d.ts +269 -3
- package/dist/index.js +4 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/units.js +25 -0
- package/dist/lib/units.js.map +1 -0
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/docs/figures/DrawingSheet.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/docs/figures/DrawingSheet.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\n\n\n\nimport { FigureSurfaceContext } from './FigureSurfaceContext';\n\nconst LETTERS = 'ABCDEFGHJKLMNPQRSTUVWXYZ';\n\n/** Row reference for an index — drawing-sheet convention skips I and O, which read as 1 and 0. */\nfunction sheetRowLabel(index: number): string {\n const letter = LETTERS[index % LETTERS.length] ?? 'A';\n return index < LETTERS.length ? letter : `${letter}${Math.floor(index / LETTERS.length) + 1}`;\n}\n\nexport interface DrawingSheetProps extends React.HTMLAttributes<HTMLDivElement> {\n /** Grid references across the top edge, numbered from 1. `0` hides the top ruler. */\n columns?: number;\n /** Grid references down the left edge, lettered from A. `0` hides the side ruler. */\n rows?: number;\n /** Sheet content, usually one or more `IndexedSection`s. */\n children?: ReactNode;\n /** Additional classes for the root. */\n className?: string;\n}\n\n/**\n * An engineering drawing sheet: a hard border with numbered columns along the top and lettered\n * rows down the side, so a review can point at \"B2\" rather than \"the second box on the left\".\n *\n * The references divide the sheet evenly and are decorative — they are hidden from assistive\n * technology, which navigates by the sections' headings instead.\n */\nexport const DrawingSheet = React.forwardRef<HTMLDivElement, DrawingSheetProps>(function DrawingSheet({ columns = 4, rows = 3, children, className, ...rest }, ref) {\n const top = Math.max(0, Math.floor(columns));\n const side = Math.max(0, Math.floor(rows));\n return (\n <div\n ref={ref}\n {...rest}\n data-slot=\"drawing-sheet\"\n className={cn(\n 'grid w-full border-2 border-edge-strong bg-surface-base text-content-primary',\n side > 0 ? 'grid-cols-[1.75rem_minmax(0,1fr)]' : 'grid-cols-[minmax(0,1fr)]',\n top > 0 ? 'grid-rows-[auto_1fr]' : 'grid-rows-[1fr]',\n className,\n )}\n >\n {top > 0 && side > 0 ? <span aria-hidden=\"true\" className=\"border-b-2 border-r-2 border-edge-strong\" /> : null}\n {top > 0 ? (\n <div aria-hidden=\"true\" data-slot=\"drawing-sheet-columns\" className=\"flex select-none border-b-2 border-edge-strong font-mono text-xs text-content-muted\">\n {Array.from({ length: top }, (_, index) => (\n <span key={index} className={cn('flex-1 py-1 text-center', index > 0 && 'border-l border-edge-default')}>\n {index + 1}\n </span>\n ))}\n </div>\n ) : null}\n {side > 0 ? (\n <div aria-hidden=\"true\" data-slot=\"drawing-sheet-rows\" className=\"flex select-none flex-col border-r-2 border-edge-strong font-mono text-xs text-content-muted\">\n {Array.from({ length: side }, (_, index) => (\n <span key={index} className={cn('flex flex-1 items-center justify-center', index > 0 && 'border-t border-edge-default')}>\n {sheetRowLabel(index)}\n </span>\n ))}\n </div>\n ) : null}\n <div data-slot=\"drawing-sheet-body\" className=\"flex min-w-0 flex-col gap-6 p-3 sm:p-6\">\n <FigureSurfaceContext.Provider value=\"sheet\">\n {children}\n </FigureSurfaceContext.Provider>\n </div>\n </div>\n );\n});\n"],"mappings":";;;AAGA,YAAY,WAAW;AACvB,SAAS,UAAU;AAInB,SAAS,4BAA4B;AAgCjC,SAWyB,KAXzB;AA9BJ,IAAM,UAAU;AAGhB,SAAS,cAAc,OAAuB;AAC5C,QAAM,SAAS,QAAQ,QAAQ,QAAQ,MAAM,KAAK;AAClD,SAAO,QAAQ,QAAQ,SAAS,SAAS,GAAG,MAAM,GAAG,KAAK,MAAM,QAAQ,QAAQ,MAAM,IAAI,CAAC;AAC7F;AAoBO,IAAM,eAAqB,iBAA8C,SAASA,cAAa,EAAE,UAAU,GAAG,OAAO,GAAG,UAAU,WAAW,GAAG,KAAK,GAAG,KAAK;AAClK,QAAM,MAAM,KAAK,IAAI,GAAG,KAAK,MAAM,OAAO,CAAC;AAC3C,QAAM,OAAO,KAAK,IAAI,GAAG,KAAK,MAAM,IAAI,CAAC;AACzC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACC,GAAG;AAAA,MACJ,aAAU;AAAA,MACV,WAAW;AAAA,QACT;AAAA,QACA,OAAO,IAAI,sCAAsC;AAAA,QACjD,MAAM,IAAI,yBAAyB;AAAA,QACnC;AAAA,MACF;AAAA,MAEC;AAAA,cAAM,KAAK,OAAO,IAAI,oBAAC,UAAK,eAAY,QAAO,WAAU,4CAA2C,IAAK;AAAA,QACzG,MAAM,IACL,oBAAC,SAAI,eAAY,QAAO,aAAU,yBAAwB,WAAU,uFACjE,gBAAM,KAAK,EAAE,QAAQ,IAAI,GAAG,CAAC,GAAG,UAC/B,oBAAC,UAAiB,WAAW,GAAG,2BAA2B,QAAQ,KAAK,8BAA8B,GACnG,kBAAQ,KADA,KAEX,CACD,GACH,IACE;AAAA,QACH,OAAO,IACN,oBAAC,SAAI,eAAY,QAAO,aAAU,sBAAqB,WAAU,gGAC9D,gBAAM,KAAK,EAAE,QAAQ,KAAK,GAAG,CAAC,GAAG,UAChC,oBAAC,UAAiB,WAAW,GAAG,2CAA2C,QAAQ,KAAK,8BAA8B,GACnH,wBAAc,KAAK,KADX,KAEX,CACD,GACH,IACE;AAAA,QACJ,oBAAC,SAAI,aAAU,sBAAqB,WAAU,0CAC5C,8BAAC,qBAAqB,UAArB,EAA8B,OAAM,SAClC,UACH,GACF;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["DrawingSheet"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/docs/figures/FigureSurfaceContext.ts"],"sourcesContent":["'use client';\n\nimport * as React from 'react';\n\nexport type FigureSurface = 'base' | 'sheet';\n\n/**\n * Context communicating the enclosing figure container surface to child sections.\n *\n * When nested inside a `DrawingSheet`, child `IndexedSection` elements step up to\n * `bg-surface-raised` to provide crisp contrast against the sheet's `bg-surface-base`\n * grid canvas, preventing the \"same-surface sandwich\" effect.\n */\nexport const FigureSurfaceContext = React.createContext<FigureSurface | null>(null);\n"],"mappings":";;;AAEA,YAAY,WAAW;AAWhB,IAAM,uBAA6B,oBAAoC,IAAI;","names":[]}
|
|
@@ -1,8 +1,14 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
1
3
|
// src/components/docs/figures/IndexedSection.tsx
|
|
2
4
|
import * as React from "react";
|
|
3
5
|
import { cn } from "../../../lib/recipe.js";
|
|
6
|
+
import { FigureSurfaceContext } from "./FigureSurfaceContext.js";
|
|
4
7
|
import { jsx, jsxs } from "react/jsx-runtime";
|
|
5
|
-
var IndexedSection = React.forwardRef(function IndexedSection2({ index, title, headingLevel = 3, actions, children, className, ...rest }, ref) {
|
|
8
|
+
var IndexedSection = React.forwardRef(function IndexedSection2({ index, title, headingLevel = 3, actions, surface, children, className, ...rest }, ref) {
|
|
9
|
+
const enclosingSurface = React.useContext(FigureSurfaceContext);
|
|
10
|
+
const resolvedSurface = surface ?? (enclosingSurface === "sheet" ? "raised" : "base");
|
|
11
|
+
const surfaceClass = resolvedSurface === "raised" ? "bg-surface-raised" : resolvedSurface === "transparent" ? "bg-transparent" : "bg-surface-base";
|
|
6
12
|
const headingId = React.useId();
|
|
7
13
|
const Heading = `h${headingLevel}`;
|
|
8
14
|
return /* @__PURE__ */ jsxs(
|
|
@@ -12,7 +18,7 @@ var IndexedSection = React.forwardRef(function IndexedSection2({ index, title, h
|
|
|
12
18
|
"aria-labelledby": headingId,
|
|
13
19
|
...rest,
|
|
14
20
|
"data-slot": "indexed-section",
|
|
15
|
-
className: cn("flex min-w-0 flex-col border-2 border-edge-strong
|
|
21
|
+
className: cn("flex min-w-0 flex-col border-2 border-edge-strong", surfaceClass, className),
|
|
16
22
|
children: [
|
|
17
23
|
/* @__PURE__ */ jsxs("header", { "data-slot": "indexed-section-header", className: "flex items-stretch border-b-2 border-edge-strong", children: [
|
|
18
24
|
/* @__PURE__ */ jsx(
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/docs/figures/IndexedSection.tsx"],"sourcesContent":["
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/docs/figures/IndexedSection.tsx"],"sourcesContent":["'use client';\n\nimport type { ReactNode } from 'react';\nimport * as React from 'react';\nimport { cn } from '../../../lib/recipe';\nimport { FigureSurfaceContext } from './FigureSurfaceContext';\n\nexport interface IndexedSectionProps extends Omit<React.HTMLAttributes<HTMLElement>, 'title'> {\n /** Short reference drawn in the solid tab, such as `A`, `B2`, or `01`. */\n index: ReactNode;\n /** Section heading. */\n title: ReactNode;\n /** Heading level for `title`, so the section sits correctly in the page outline. */\n headingLevel?: 2 | 3 | 4;\n /** Controls drawn at the right of the header, such as a comment button. */\n actions?: ReactNode;\n /**\n * Surface elevation rung for the section background.\n * If omitted, defaults to `'raised'` when nested in a `DrawingSheet`, or `'base'` standalone.\n */\n surface?: 'base' | 'raised' | 'transparent';\n /** Section content. */\n children?: ReactNode;\n /** Additional classes for the root. */\n className?: string;\n}\n\n/**\n * An indexed section container: a solid high-contrast index tab, a heading, an optional actions\n * slot, and a hard-ruled body. Works on its own, inside an article/spec, or within a `DrawingSheet`.\n */\nexport const IndexedSection = React.forwardRef<HTMLElement, IndexedSectionProps>(function IndexedSection(\n { index, title, headingLevel = 3, actions, surface, children, className, ...rest },\n ref,\n) {\n const enclosingSurface = React.useContext(FigureSurfaceContext);\n const resolvedSurface = surface ?? (enclosingSurface === 'sheet' ? 'raised' : 'base');\n const surfaceClass = resolvedSurface === 'raised'\n ? 'bg-surface-raised'\n : resolvedSurface === 'transparent'\n ? 'bg-transparent'\n : 'bg-surface-base';\n\n const headingId = React.useId();\n const Heading = `h${headingLevel}` as const;\n return (\n <section\n ref={ref}\n aria-labelledby={headingId}\n {...rest}\n data-slot=\"indexed-section\"\n className={cn('flex min-w-0 flex-col border-2 border-edge-strong', surfaceClass, className)}\n >\n <header data-slot=\"indexed-section-header\" className=\"flex items-stretch border-b-2 border-edge-strong\">\n <span\n data-slot=\"indexed-section-index\"\n className=\"flex min-w-12 items-center justify-center bg-content-primary px-3 font-mono text-lg font-bold text-content-inverse\"\n >\n {index}\n </span>\n <Heading\n id={headingId}\n data-slot=\"indexed-section-title\"\n className=\"m-0 flex flex-1 items-center px-4 py-3 font-mono text-lg font-bold tracking-tight text-content-primary\"\n >\n {title}\n </Heading>\n {actions != null ? (\n <div data-slot=\"indexed-section-actions\" className=\"flex items-center gap-2 px-3\">\n {actions}\n </div>\n ) : null}\n </header>\n <div data-slot=\"indexed-section-body\" className=\"min-w-0 p-4 sm:p-6\">\n {children}\n </div>\n </section>\n );\n});\n"],"mappings":";;;AAGA,YAAY,WAAW;AACvB,SAAS,UAAU;AACnB,SAAS,4BAA4B;AAgD/B,SACE,KADF;AAtBC,IAAM,iBAAuB,iBAA6C,SAASA,gBACxF,EAAE,OAAO,OAAO,eAAe,GAAG,SAAS,SAAS,UAAU,WAAW,GAAG,KAAK,GACjF,KACA;AACA,QAAM,mBAAyB,iBAAW,oBAAoB;AAC9D,QAAM,kBAAkB,YAAY,qBAAqB,UAAU,WAAW;AAC9E,QAAM,eAAe,oBAAoB,WACrC,sBACA,oBAAoB,gBAClB,mBACA;AAEN,QAAM,YAAkB,YAAM;AAC9B,QAAM,UAAU,IAAI,YAAY;AAChC,SACE;AAAA,IAAC;AAAA;AAAA,MACC;AAAA,MACA,mBAAiB;AAAA,MAChB,GAAG;AAAA,MACJ,aAAU;AAAA,MACV,WAAW,GAAG,qDAAqD,cAAc,SAAS;AAAA,MAE1F;AAAA,6BAAC,YAAO,aAAU,0BAAyB,WAAU,oDACnD;AAAA;AAAA,YAAC;AAAA;AAAA,cACC,aAAU;AAAA,cACV,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,UACA;AAAA,YAAC;AAAA;AAAA,cACC,IAAI;AAAA,cACJ,aAAU;AAAA,cACV,WAAU;AAAA,cAET;AAAA;AAAA,UACH;AAAA,UACC,WAAW,OACV,oBAAC,SAAI,aAAU,2BAA0B,WAAU,gCAChD,mBACH,IACE;AAAA,WACN;AAAA,QACA,oBAAC,SAAI,aAAU,wBAAuB,WAAU,sBAC7C,UACH;AAAA;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["IndexedSection"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/components/docs/figures/index.ts"],"sourcesContent":["export { FigureFrame } from './FigureFrame';\nexport type { FigureFrameProps } from './FigureFrame';\nexport * from './FlowDiagram';\nexport * from './Timeline';\nexport * from './ChangeSummary';\nexport * from './BeforeAfter';\nexport * from './UptimeStrip';\nexport * from './TreeDiagram';\nexport * from './FileChangeTree';\nexport * from './DrawingSheet';\nexport * from './IndexedSection';\nexport * from './ActivityGrid';\nexport * from './GanttChart';\nexport * from './Terminal';\nexport * from './Steps';\nexport * from './SwatchCompare';\nexport * from './MetricStrip';\nexport * from './TokenTable';\nexport * from './Decision';\nexport * from './TermGrid';\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;
|
|
1
|
+
{"version":3,"sources":["../../../../src/components/docs/figures/index.ts"],"sourcesContent":["export { FigureFrame } from './FigureFrame';\nexport type { FigureFrameProps } from './FigureFrame';\nexport * from './FlowDiagram';\nexport * from './Timeline';\nexport * from './ChangeSummary';\nexport * from './BeforeAfter';\nexport * from './UptimeStrip';\nexport * from './TreeDiagram';\nexport * from './FileChangeTree';\nexport * from './DrawingSheet';\nexport * from './IndexedSection';\nexport type { FigureSurface } from './FigureSurfaceContext';\nexport * from './ActivityGrid';\nexport * from './GanttChart';\nexport * from './Terminal';\nexport * from './Steps';\nexport * from './SwatchCompare';\nexport * from './MetricStrip';\nexport * from './TokenTable';\nexport * from './Decision';\nexport * from './TermGrid';\n"],"mappings":";AAAA,SAAS,mBAAmB;AAE5B,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AAEd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;AACd,cAAc;","names":[]}
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
"use client";
|
|
2
|
+
|
|
3
|
+
// src/hooks/usePolledResource.ts
|
|
4
|
+
import { useCallback, useEffect, useRef, useState } from "react";
|
|
5
|
+
function messageOf(reason) {
|
|
6
|
+
return (reason instanceof Error ? reason.message : String(reason)) || "Unknown error";
|
|
7
|
+
}
|
|
8
|
+
function usePolledResource(load, { key, intervalMs = 3e4, enabled = true } = {}) {
|
|
9
|
+
const [snapshot, setSnapshot] = useState(() => ({
|
|
10
|
+
key,
|
|
11
|
+
data: void 0,
|
|
12
|
+
error: void 0,
|
|
13
|
+
loading: enabled,
|
|
14
|
+
updatedAt: void 0
|
|
15
|
+
}));
|
|
16
|
+
const loadRef = useRef(load);
|
|
17
|
+
const keyRef = useRef(key);
|
|
18
|
+
const intervalRef = useRef(intervalMs);
|
|
19
|
+
const enabledRef = useRef(enabled);
|
|
20
|
+
const generation = useRef(0);
|
|
21
|
+
const timer = useRef(void 0);
|
|
22
|
+
const missed = useRef(false);
|
|
23
|
+
useEffect(() => {
|
|
24
|
+
loadRef.current = load;
|
|
25
|
+
keyRef.current = key;
|
|
26
|
+
intervalRef.current = intervalMs;
|
|
27
|
+
enabledRef.current = enabled;
|
|
28
|
+
});
|
|
29
|
+
const run = useCallback(function loadNow() {
|
|
30
|
+
if (!enabledRef.current) return;
|
|
31
|
+
clearTimeout(timer.current);
|
|
32
|
+
missed.current = false;
|
|
33
|
+
const mine = ++generation.current;
|
|
34
|
+
const forKey = keyRef.current;
|
|
35
|
+
setSnapshot(
|
|
36
|
+
(prev) => prev.key === forKey ? { ...prev, loading: true } : { key: forKey, data: void 0, error: void 0, loading: true, updatedAt: void 0 }
|
|
37
|
+
);
|
|
38
|
+
const schedule = () => {
|
|
39
|
+
const every = intervalRef.current;
|
|
40
|
+
if (every <= 0) return;
|
|
41
|
+
timer.current = setTimeout(() => {
|
|
42
|
+
if (document.visibilityState === "visible") loadNow();
|
|
43
|
+
else missed.current = true;
|
|
44
|
+
}, every);
|
|
45
|
+
};
|
|
46
|
+
let pending;
|
|
47
|
+
try {
|
|
48
|
+
pending = Promise.resolve(loadRef.current());
|
|
49
|
+
} catch (reason) {
|
|
50
|
+
pending = Promise.reject(reason);
|
|
51
|
+
}
|
|
52
|
+
pending.then(
|
|
53
|
+
(value) => {
|
|
54
|
+
if (mine !== generation.current) return;
|
|
55
|
+
setSnapshot({ key: forKey, data: value, error: void 0, loading: false, updatedAt: Date.now() });
|
|
56
|
+
schedule();
|
|
57
|
+
},
|
|
58
|
+
(reason) => {
|
|
59
|
+
if (mine !== generation.current) return;
|
|
60
|
+
setSnapshot((prev) => ({ ...prev, error: messageOf(reason), loading: false }));
|
|
61
|
+
schedule();
|
|
62
|
+
}
|
|
63
|
+
);
|
|
64
|
+
}, []);
|
|
65
|
+
useEffect(() => {
|
|
66
|
+
if (!enabled) return void 0;
|
|
67
|
+
const requests = generation;
|
|
68
|
+
run();
|
|
69
|
+
return () => {
|
|
70
|
+
requests.current++;
|
|
71
|
+
clearTimeout(timer.current);
|
|
72
|
+
missed.current = false;
|
|
73
|
+
setSnapshot((prev) => prev.loading ? { ...prev, loading: false } : prev);
|
|
74
|
+
};
|
|
75
|
+
}, [key, enabled, intervalMs, run]);
|
|
76
|
+
useEffect(() => {
|
|
77
|
+
if (!enabled) return void 0;
|
|
78
|
+
const onVisibilityChange = () => {
|
|
79
|
+
if (document.visibilityState === "visible" && missed.current) run();
|
|
80
|
+
};
|
|
81
|
+
document.addEventListener("visibilitychange", onVisibilityChange);
|
|
82
|
+
return () => document.removeEventListener("visibilitychange", onVisibilityChange);
|
|
83
|
+
}, [enabled, run]);
|
|
84
|
+
if (snapshot.key !== key) {
|
|
85
|
+
return { data: void 0, error: void 0, loading: enabled, updatedAt: void 0, reload: run };
|
|
86
|
+
}
|
|
87
|
+
return {
|
|
88
|
+
data: snapshot.data,
|
|
89
|
+
error: snapshot.error,
|
|
90
|
+
loading: enabled && snapshot.loading,
|
|
91
|
+
updatedAt: snapshot.updatedAt,
|
|
92
|
+
reload: run
|
|
93
|
+
};
|
|
94
|
+
}
|
|
95
|
+
export {
|
|
96
|
+
usePolledResource
|
|
97
|
+
};
|
|
98
|
+
//# sourceMappingURL=usePolledResource.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../src/hooks/usePolledResource.ts"],"sourcesContent":["'use client';\n\nimport { useCallback, useEffect, useRef, useState } from 'react';\n\nexport interface UsePolledResourceOptions {\n /**\n * What is being loaded — an id, a filter, a page number. A change of key\n * drops the previous key's data and loads afresh. The load function itself is\n * read through a ref, so a new closure on every render reloads nothing; the\n * key is what says the question changed.\n */\n key?: string | number;\n /**\n * Milliseconds between loads, counted from when the previous one settled.\n * Default `30_000`. Zero or less loads once and never polls.\n */\n intervalMs?: number;\n /** Load and poll while true. Default true. While false nothing loads, and `reload` does nothing. */\n enabled?: boolean;\n}\n\nexport interface UsePolledResourceResult<T> {\n /** The last good answer for the current key, kept when a later load fails. */\n data: T | undefined;\n /** Why the latest load failed, as a message; cleared by the next success. */\n error: string | undefined;\n /** True while a load for the current key is in flight. */\n loading: boolean;\n /** When `data` was last loaded, as epoch milliseconds — what `FreshnessIndicator` takes as `updatedAt`. */\n updatedAt: number | undefined;\n /** Load now, superseding any load in flight, and restart the poll from when it settles. */\n reload: () => void;\n}\n\ninterface Snapshot<T> {\n key: string | number | undefined;\n data: T | undefined;\n error: string | undefined;\n loading: boolean;\n updatedAt: number | undefined;\n}\n\n/** An error, a rejection reason or a thrown string, as one line a person can read. */\nfunction messageOf(reason: unknown): string {\n // `new Error()` and `reject('')` still failed; an empty message must not read as success.\n return (reason instanceof Error ? reason.message : String(reason)) || 'Unknown error';\n}\n\n/**\n * Data that refreshes itself while someone is looking at it.\n *\n * Loads once on mount, then again `intervalMs` after each load settles — but\n * only while `document.visibilityState` is `visible`. A background tab costs\n * nothing. A tick that falls due while the tab is hidden is remembered, and the\n * load happens the moment the tab is shown again, so a reader returning after\n * ten minutes sees fresh data at once rather than ten-minute-old data for up to\n * another interval. A tab that is hidden and shown again *before* a tick fell\n * due does not load, so switching back and forth does not hammer the source.\n *\n * Counting the interval from when a load settles, not on a fixed clock, means a\n * load slower than the interval is never cut off by the next tick.\n *\n * ## What it guarantees\n *\n * - **The newest request wins.** Every load takes a generation number, and an\n * answer that arrives after a newer request was made is discarded. A slow\n * response for an old key can never overwrite a fast one for the new key.\n * - **A failure keeps the last good answer.** `data` survives a failed load and\n * `error` says why, so a view can show what it had with a stale warning —\n * which is what `ResourceState` renders.\n * - **A new key starts empty.** Changing `key` clears `data`, `error` and\n * `updatedAt` in the same render, so the previous key's answer is never\n * shown as though it belonged to the new one.\n *\n * Errors are normalised to a message string: the one thing a view does with a\n * failure is show it, and doing that once here saves every caller doing it.\n */\nexport function usePolledResource<T>(\n load: () => Promise<T>,\n { key, intervalMs = 30_000, enabled = true }: UsePolledResourceOptions = {},\n): UsePolledResourceResult<T> {\n const [snapshot, setSnapshot] = useState<Snapshot<T>>(() => ({\n key,\n data: undefined,\n error: undefined,\n loading: enabled,\n updatedAt: undefined,\n }));\n\n const loadRef = useRef(load);\n const keyRef = useRef(key);\n const intervalRef = useRef(intervalMs);\n const enabledRef = useRef(enabled);\n const generation = useRef(0);\n const timer = useRef<ReturnType<typeof setTimeout> | undefined>(undefined);\n const missed = useRef(false);\n\n // Declared first, so every effect below reads this render's values.\n useEffect(() => {\n loadRef.current = load;\n keyRef.current = key;\n intervalRef.current = intervalMs;\n enabledRef.current = enabled;\n });\n\n // Named, so the poll's timeout re-enters it without reading `run` before it exists.\n const run = useCallback(function loadNow() {\n if (!enabledRef.current) return;\n clearTimeout(timer.current);\n missed.current = false;\n const mine = ++generation.current;\n const forKey = keyRef.current;\n\n setSnapshot((prev) =>\n prev.key === forKey\n ? { ...prev, loading: true }\n : { key: forKey, data: undefined, error: undefined, loading: true, updatedAt: undefined },\n );\n\n const schedule = () => {\n const every = intervalRef.current;\n if (every <= 0) return;\n timer.current = setTimeout(() => {\n if (document.visibilityState === 'visible') loadNow();\n else missed.current = true;\n }, every);\n };\n\n let pending: Promise<T>;\n try {\n pending = Promise.resolve(loadRef.current());\n } catch (reason) {\n pending = Promise.reject(reason);\n }\n\n pending.then(\n (value) => {\n if (mine !== generation.current) return;\n setSnapshot({ key: forKey, data: value, error: undefined, loading: false, updatedAt: Date.now() });\n schedule();\n },\n (reason: unknown) => {\n if (mine !== generation.current) return;\n setSnapshot((prev) => ({ ...prev, error: messageOf(reason), loading: false }));\n schedule();\n },\n );\n }, []);\n\n useEffect(() => {\n if (!enabled) return undefined;\n const requests = generation;\n run();\n return () => {\n // Whatever is in flight now answers a question nobody is asking.\n requests.current++;\n clearTimeout(timer.current);\n missed.current = false;\n setSnapshot((prev) => (prev.loading ? { ...prev, loading: false } : prev));\n };\n }, [key, enabled, intervalMs, run]);\n\n useEffect(() => {\n if (!enabled) return undefined;\n const onVisibilityChange = () => {\n if (document.visibilityState === 'visible' && missed.current) run();\n };\n document.addEventListener('visibilitychange', onVisibilityChange);\n return () => document.removeEventListener('visibilitychange', onVisibilityChange);\n }, [enabled, run]);\n\n // The render after a key change, before the effect has loaded anything: the\n // snapshot still holds the old key's answer, which must not be shown.\n if (snapshot.key !== key) {\n return { data: undefined, error: undefined, loading: enabled, updatedAt: undefined, reload: run };\n }\n\n return {\n data: snapshot.data,\n error: snapshot.error,\n loading: enabled && snapshot.loading,\n updatedAt: snapshot.updatedAt,\n reload: run,\n };\n}\n"],"mappings":";;;AAEA,SAAS,aAAa,WAAW,QAAQ,gBAAgB;AAyCzD,SAAS,UAAU,QAAyB;AAE1C,UAAQ,kBAAkB,QAAQ,OAAO,UAAU,OAAO,MAAM,MAAM;AACxE;AA+BO,SAAS,kBACd,MACA,EAAE,KAAK,aAAa,KAAQ,UAAU,KAAK,IAA8B,CAAC,GAC9C;AAC5B,QAAM,CAAC,UAAU,WAAW,IAAI,SAAsB,OAAO;AAAA,IAC3D;AAAA,IACA,MAAM;AAAA,IACN,OAAO;AAAA,IACP,SAAS;AAAA,IACT,WAAW;AAAA,EACb,EAAE;AAEF,QAAM,UAAU,OAAO,IAAI;AAC3B,QAAM,SAAS,OAAO,GAAG;AACzB,QAAM,cAAc,OAAO,UAAU;AACrC,QAAM,aAAa,OAAO,OAAO;AACjC,QAAM,aAAa,OAAO,CAAC;AAC3B,QAAM,QAAQ,OAAkD,MAAS;AACzE,QAAM,SAAS,OAAO,KAAK;AAG3B,YAAU,MAAM;AACd,YAAQ,UAAU;AAClB,WAAO,UAAU;AACjB,gBAAY,UAAU;AACtB,eAAW,UAAU;AAAA,EACvB,CAAC;AAGD,QAAM,MAAM,YAAY,SAAS,UAAU;AACzC,QAAI,CAAC,WAAW,QAAS;AACzB,iBAAa,MAAM,OAAO;AAC1B,WAAO,UAAU;AACjB,UAAM,OAAO,EAAE,WAAW;AAC1B,UAAM,SAAS,OAAO;AAEtB;AAAA,MAAY,CAAC,SACX,KAAK,QAAQ,SACT,EAAE,GAAG,MAAM,SAAS,KAAK,IACzB,EAAE,KAAK,QAAQ,MAAM,QAAW,OAAO,QAAW,SAAS,MAAM,WAAW,OAAU;AAAA,IAC5F;AAEA,UAAM,WAAW,MAAM;AACrB,YAAM,QAAQ,YAAY;AAC1B,UAAI,SAAS,EAAG;AAChB,YAAM,UAAU,WAAW,MAAM;AAC/B,YAAI,SAAS,oBAAoB,UAAW,SAAQ;AAAA,YAC/C,QAAO,UAAU;AAAA,MACxB,GAAG,KAAK;AAAA,IACV;AAEA,QAAI;AACJ,QAAI;AACF,gBAAU,QAAQ,QAAQ,QAAQ,QAAQ,CAAC;AAAA,IAC7C,SAAS,QAAQ;AACf,gBAAU,QAAQ,OAAO,MAAM;AAAA,IACjC;AAEA,YAAQ;AAAA,MACN,CAAC,UAAU;AACT,YAAI,SAAS,WAAW,QAAS;AACjC,oBAAY,EAAE,KAAK,QAAQ,MAAM,OAAO,OAAO,QAAW,SAAS,OAAO,WAAW,KAAK,IAAI,EAAE,CAAC;AACjG,iBAAS;AAAA,MACX;AAAA,MACA,CAAC,WAAoB;AACnB,YAAI,SAAS,WAAW,QAAS;AACjC,oBAAY,CAAC,UAAU,EAAE,GAAG,MAAM,OAAO,UAAU,MAAM,GAAG,SAAS,MAAM,EAAE;AAC7E,iBAAS;AAAA,MACX;AAAA,IACF;AAAA,EACF,GAAG,CAAC,CAAC;AAEL,YAAU,MAAM;AACd,QAAI,CAAC,QAAS,QAAO;AACrB,UAAM,WAAW;AACjB,QAAI;AACJ,WAAO,MAAM;AAEX,eAAS;AACT,mBAAa,MAAM,OAAO;AAC1B,aAAO,UAAU;AACjB,kBAAY,CAAC,SAAU,KAAK,UAAU,EAAE,GAAG,MAAM,SAAS,MAAM,IAAI,IAAK;AAAA,IAC3E;AAAA,EACF,GAAG,CAAC,KAAK,SAAS,YAAY,GAAG,CAAC;AAElC,YAAU,MAAM;AACd,QAAI,CAAC,QAAS,QAAO;AACrB,UAAM,qBAAqB,MAAM;AAC/B,UAAI,SAAS,oBAAoB,aAAa,OAAO,QAAS,KAAI;AAAA,IACpE;AACA,aAAS,iBAAiB,oBAAoB,kBAAkB;AAChE,WAAO,MAAM,SAAS,oBAAoB,oBAAoB,kBAAkB;AAAA,EAClF,GAAG,CAAC,SAAS,GAAG,CAAC;AAIjB,MAAI,SAAS,QAAQ,KAAK;AACxB,WAAO,EAAE,MAAM,QAAW,OAAO,QAAW,SAAS,SAAS,WAAW,QAAW,QAAQ,IAAI;AAAA,EAClG;AAEA,SAAO;AAAA,IACL,MAAM,SAAS;AAAA,IACf,OAAO,SAAS;AAAA,IAChB,SAAS,WAAW,SAAS;AAAA,IAC7B,WAAW,SAAS;AAAA,IACpB,QAAQ;AAAA,EACV;AACF;","names":[]}
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import * as react from 'react';
|
|
2
|
-
import react__default, { ReactNode, DetailedHTMLProps, ButtonHTMLAttributes, AnchorHTMLAttributes, HTMLAttributes, ElementType, MouseEventHandler, InputHTMLAttributes, TextareaHTMLAttributes, TableHTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, RefObject, ReactElement, SVGProps } from 'react';
|
|
2
|
+
import react__default, { ReactNode, DetailedHTMLProps, ButtonHTMLAttributes, AnchorHTMLAttributes, HTMLAttributes, ElementType, MouseEventHandler, InputHTMLAttributes, TextareaHTMLAttributes, TableHTMLAttributes, TdHTMLAttributes, ThHTMLAttributes, RefObject, ReactElement, SVGProps, RefAttributes } from 'react';
|
|
3
3
|
import { Table as Table$1, ColumnDef } from '@tanstack/react-table';
|
|
4
4
|
import { RegisterableHotkey } from '@tanstack/react-hotkeys';
|
|
5
5
|
export { ParentSize as ResponsiveChartContainer } from '@visx/responsive';
|
|
@@ -955,6 +955,49 @@ declare class Slugger {
|
|
|
955
955
|
*/
|
|
956
956
|
declare function childrenToText(node: unknown): string;
|
|
957
957
|
|
|
958
|
+
/**
|
|
959
|
+
* Quantities with a unit ladder: a byte count written in the largest unit that
|
|
960
|
+
* keeps it under the next one.
|
|
961
|
+
*
|
|
962
|
+
* Everything here is pure and React-free, so a server component or a script
|
|
963
|
+
* can call it.
|
|
964
|
+
*/
|
|
965
|
+
/** Options for {@link formatBytes}. */
|
|
966
|
+
interface FormatBytesOptions {
|
|
967
|
+
/**
|
|
968
|
+
* The step between units. `1024` (the default) labels them with IEC binary
|
|
969
|
+
* prefixes — `KiB`, `MiB`, `GiB`; `1000` with SI decimal prefixes — `kB`,
|
|
970
|
+
* `MB`, `GB`.
|
|
971
|
+
*/
|
|
972
|
+
base?: 1024 | 1000;
|
|
973
|
+
}
|
|
974
|
+
/**
|
|
975
|
+
* `512 B`, `1.5 KiB`, `20 MiB`, `3.2 TiB`: a byte count in the largest unit
|
|
976
|
+
* that keeps it below the next one, whole for bytes and to one decimal above
|
|
977
|
+
* them, with a trailing `.0` dropped as `formatShare` and `formatTraceDuration`
|
|
978
|
+
* do. A space separates number and unit, as the SI and IEC conventions write
|
|
979
|
+
* them.
|
|
980
|
+
*
|
|
981
|
+
* **Binary by default, and labelled as binary.** The counts this formats come
|
|
982
|
+
* from the file system, memory and process accounting, which count in powers
|
|
983
|
+
* of two — and Windows and most dashboards already divide by 1024. What they
|
|
984
|
+
* get wrong is the label: `KB` for 1024 bytes is the JEDEC usage SI reserves
|
|
985
|
+
* for 1000, so the same string means two numbers 2.4% apart at `KB` and 10%
|
|
986
|
+
* apart at `TB`. `KiB` cannot be misread. Pass `{ base: 1000 }` for sizes
|
|
987
|
+
* that are decimal by nature — network transfer, storage as a vendor states it
|
|
988
|
+
* — and the labels become `kB`, `MB`, `GB`.
|
|
989
|
+
*
|
|
990
|
+
* The unit is chosen *after* rounding, so a value that would round up to the
|
|
991
|
+
* base moves to the next unit: 1023.96 KiB is `1 MiB`, never `1024 KiB`, and
|
|
992
|
+
* 1023.6 B is `1 KiB`. Petabytes are the top of the ladder; anything larger
|
|
993
|
+
* stays in them (`2048 PiB`).
|
|
994
|
+
*
|
|
995
|
+
* A negative count — a size delta — keeps its sign (`-1.5 KiB`); `-0` is
|
|
996
|
+
* `0 B`. `NaN` and `±Infinity` are `—`, as the other formatters here write a
|
|
997
|
+
* value they cannot.
|
|
998
|
+
*/
|
|
999
|
+
declare function formatBytes(bytes: number, options?: FormatBytesOptions): string;
|
|
1000
|
+
|
|
958
1001
|
interface UseCopyToClipboardResult {
|
|
959
1002
|
/** True for `resetAfter` ms following a successful copy. */
|
|
960
1003
|
copied: boolean;
|
|
@@ -1049,6 +1092,65 @@ interface TraceReplay {
|
|
|
1049
1092
|
*/
|
|
1050
1093
|
declare function useTraceReplay(duration: number, { autoPlay, loop, speed: initialSpeed, loopDelay }?: UseTraceReplayOptions): TraceReplay;
|
|
1051
1094
|
|
|
1095
|
+
interface UsePolledResourceOptions {
|
|
1096
|
+
/**
|
|
1097
|
+
* What is being loaded — an id, a filter, a page number. A change of key
|
|
1098
|
+
* drops the previous key's data and loads afresh. The load function itself is
|
|
1099
|
+
* read through a ref, so a new closure on every render reloads nothing; the
|
|
1100
|
+
* key is what says the question changed.
|
|
1101
|
+
*/
|
|
1102
|
+
key?: string | number;
|
|
1103
|
+
/**
|
|
1104
|
+
* Milliseconds between loads, counted from when the previous one settled.
|
|
1105
|
+
* Default `30_000`. Zero or less loads once and never polls.
|
|
1106
|
+
*/
|
|
1107
|
+
intervalMs?: number;
|
|
1108
|
+
/** Load and poll while true. Default true. While false nothing loads, and `reload` does nothing. */
|
|
1109
|
+
enabled?: boolean;
|
|
1110
|
+
}
|
|
1111
|
+
interface UsePolledResourceResult<T> {
|
|
1112
|
+
/** The last good answer for the current key, kept when a later load fails. */
|
|
1113
|
+
data: T | undefined;
|
|
1114
|
+
/** Why the latest load failed, as a message; cleared by the next success. */
|
|
1115
|
+
error: string | undefined;
|
|
1116
|
+
/** True while a load for the current key is in flight. */
|
|
1117
|
+
loading: boolean;
|
|
1118
|
+
/** When `data` was last loaded, as epoch milliseconds — what `FreshnessIndicator` takes as `updatedAt`. */
|
|
1119
|
+
updatedAt: number | undefined;
|
|
1120
|
+
/** Load now, superseding any load in flight, and restart the poll from when it settles. */
|
|
1121
|
+
reload: () => void;
|
|
1122
|
+
}
|
|
1123
|
+
/**
|
|
1124
|
+
* Data that refreshes itself while someone is looking at it.
|
|
1125
|
+
*
|
|
1126
|
+
* Loads once on mount, then again `intervalMs` after each load settles — but
|
|
1127
|
+
* only while `document.visibilityState` is `visible`. A background tab costs
|
|
1128
|
+
* nothing. A tick that falls due while the tab is hidden is remembered, and the
|
|
1129
|
+
* load happens the moment the tab is shown again, so a reader returning after
|
|
1130
|
+
* ten minutes sees fresh data at once rather than ten-minute-old data for up to
|
|
1131
|
+
* another interval. A tab that is hidden and shown again *before* a tick fell
|
|
1132
|
+
* due does not load, so switching back and forth does not hammer the source.
|
|
1133
|
+
*
|
|
1134
|
+
* Counting the interval from when a load settles, not on a fixed clock, means a
|
|
1135
|
+
* load slower than the interval is never cut off by the next tick.
|
|
1136
|
+
*
|
|
1137
|
+
* ## What it guarantees
|
|
1138
|
+
*
|
|
1139
|
+
* - **The newest request wins.** Every load takes a generation number, and an
|
|
1140
|
+
* answer that arrives after a newer request was made is discarded. A slow
|
|
1141
|
+
* response for an old key can never overwrite a fast one for the new key.
|
|
1142
|
+
* - **A failure keeps the last good answer.** `data` survives a failed load and
|
|
1143
|
+
* `error` says why, so a view can show what it had with a stale warning —
|
|
1144
|
+
* which is what `ResourceState` renders.
|
|
1145
|
+
* - **A new key starts empty.** Changing `key` clears `data`, `error` and
|
|
1146
|
+
* `updatedAt` in the same render, so the previous key's answer is never
|
|
1147
|
+
* shown as though it belonged to the new one.
|
|
1148
|
+
*
|
|
1149
|
+
* Errors are normalised to a message string: the one thing a view does with a
|
|
1150
|
+
* failure is show it, and doing that once here saves every caller doing it.
|
|
1151
|
+
*/
|
|
1152
|
+
declare function usePolledResource<T>(load: () => Promise<T>, { key, intervalMs, enabled }?: UsePolledResourceOptions): UsePolledResourceResult<T>;
|
|
1153
|
+
|
|
1052
1154
|
interface ButtonOwnProps {
|
|
1053
1155
|
/**
|
|
1054
1156
|
* The label. Written in caps at the call site rather than upper-cased in
|
|
@@ -1188,6 +1290,81 @@ type ButtonProps = ButtonElementProps | ButtonLinkProps;
|
|
|
1188
1290
|
*/
|
|
1189
1291
|
declare const Button: react.ForwardRefExoticComponent<(Omit<ButtonElementProps, "ref"> | Omit<ButtonLinkProps, "ref">) & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
1190
1292
|
|
|
1293
|
+
interface InlineActionOwnProps {
|
|
1294
|
+
/**
|
|
1295
|
+
* The words, in the case the surrounding text is written in. Unlike
|
|
1296
|
+
* `Button`'s label this is read as part of a sentence or a cell, so it is
|
|
1297
|
+
* not written in caps — `view output`, `retry`, `all alerts →`.
|
|
1298
|
+
*/
|
|
1299
|
+
children: ReactNode;
|
|
1300
|
+
/**
|
|
1301
|
+
* How loudly it reads against the text around it. `accent` is the primary
|
|
1302
|
+
* accent ink with a solid underline — the one to reach for, and what a link
|
|
1303
|
+
* in a row of data looks like. `quiet` is secondary ink with a dotted
|
|
1304
|
+
* underline, for a housekeeping action beside the content it acts on —
|
|
1305
|
+
* `clear`, `reset`, `show all` — that should not compete with it.
|
|
1306
|
+
* Omitted, the tone is `accent`.
|
|
1307
|
+
*/
|
|
1308
|
+
tone?: InlineActionTone;
|
|
1309
|
+
/**
|
|
1310
|
+
* Merged into the recipe's own classes. Reach for it to set the typeface or
|
|
1311
|
+
* size where the surrounding text does not — `font-mono` in a table of ids —
|
|
1312
|
+
* rather than to recolour it.
|
|
1313
|
+
*/
|
|
1314
|
+
className?: string;
|
|
1315
|
+
}
|
|
1316
|
+
/** The inks an `InlineAction` may take. Named for emphasis, not for a hue. */
|
|
1317
|
+
type InlineActionTone = 'accent' | 'quiet';
|
|
1318
|
+
/**
|
|
1319
|
+
* The `<button>` form: an action on the current page. `href?: never` is what
|
|
1320
|
+
* lets the union below discriminate, exactly as it does on `Button`.
|
|
1321
|
+
*/
|
|
1322
|
+
type InlineActionButtonProps = InlineActionOwnProps & Omit<DetailedHTMLProps<ButtonHTMLAttributes<HTMLButtonElement>, HTMLButtonElement>, 'children'> & {
|
|
1323
|
+
href?: never;
|
|
1324
|
+
};
|
|
1325
|
+
/**
|
|
1326
|
+
* The `<a>` form: the same ink on something that navigates. Rendered through
|
|
1327
|
+
* `LinkProvider`, so an app's router handles an internal href.
|
|
1328
|
+
*/
|
|
1329
|
+
type InlineActionLinkProps = InlineActionOwnProps & Omit<DetailedHTMLProps<AnchorHTMLAttributes<HTMLAnchorElement>, HTMLAnchorElement>, 'children'> & {
|
|
1330
|
+
/**
|
|
1331
|
+
* Where it navigates — and the discriminant. Supplying it renders a link
|
|
1332
|
+
* through the `LinkProvider`'s component; omit it for anything that acts
|
|
1333
|
+
* on the current page.
|
|
1334
|
+
*/
|
|
1335
|
+
href: string;
|
|
1336
|
+
/**
|
|
1337
|
+
* Not offered on the anchor form. `disabled` does nothing on an `<a>`, and
|
|
1338
|
+
* a link that cannot be followed is text, not a link.
|
|
1339
|
+
*/
|
|
1340
|
+
disabled?: never;
|
|
1341
|
+
};
|
|
1342
|
+
type InlineActionProps = InlineActionButtonProps | InlineActionLinkProps;
|
|
1343
|
+
/**
|
|
1344
|
+
* An action that reads as a link: underlined text inside a sentence or a table
|
|
1345
|
+
* cell, with no box, padding or press of its own.
|
|
1346
|
+
*
|
|
1347
|
+
* `Button` is the control a screen is built around — bordered, filled, caps,
|
|
1348
|
+
* a 44px hit area. In a table row that is too much: one per row is a column of
|
|
1349
|
+
* buttons, and the row's data is lost behind them. This is the same decision
|
|
1350
|
+
* in the weight of the text around it, and like `Button` the element follows
|
|
1351
|
+
* the job rather than the look: without `href` it is a `<button type="button">`
|
|
1352
|
+
* that runs `onClick`; with `href` it is a link, through `LinkProvider`.
|
|
1353
|
+
*
|
|
1354
|
+
* It takes the surrounding font and size, so it is mono in a mono cell and
|
|
1355
|
+
* prose in a paragraph; there is no `size`. An inline target is exempt from
|
|
1356
|
+
* the WCAG 2.5.8 target-size minimum because its size is set by the line it
|
|
1357
|
+
* sits in — which is also why it belongs inline, not standing on its own as a
|
|
1358
|
+
* page's action.
|
|
1359
|
+
*
|
|
1360
|
+
* ```tsx
|
|
1361
|
+
* <InlineAction onClick={() => openRun(run.id)}>view output</InlineAction>
|
|
1362
|
+
* <InlineAction href={`/runs/${run.id}`}>open run</InlineAction>
|
|
1363
|
+
* <InlineAction tone="quiet" onClick={clear}>clear</InlineAction>
|
|
1364
|
+
* ```
|
|
1365
|
+
*/
|
|
1366
|
+
declare const InlineAction: react.ForwardRefExoticComponent<(Omit<InlineActionButtonProps, "ref"> | Omit<InlineActionLinkProps, "ref">) & react.RefAttributes<HTMLButtonElement | HTMLAnchorElement>>;
|
|
1367
|
+
|
|
1191
1368
|
/**
|
|
1192
1369
|
* The two shapes a `Card` renders.
|
|
1193
1370
|
*
|
|
@@ -2675,6 +2852,37 @@ type DataTableSharedProps<T> = {
|
|
|
2675
2852
|
* dataset to assistive tech, through `aria-rowcount` and `aria-rowindex`.
|
|
2676
2853
|
*/
|
|
2677
2854
|
virtualize?: boolean | DataTableVirtualization;
|
|
2855
|
+
/**
|
|
2856
|
+
* The keys of the selected rows, as `keyExtractor` produces them (numbers
|
|
2857
|
+
* are compared as strings). Controlled: the table never changes it, it
|
|
2858
|
+
* reports the next set through `onSelectionChange`. Because selection is
|
|
2859
|
+
* keyed rather than positional it survives a sort, a page change and a
|
|
2860
|
+
* windowed scroll. Without a `keyExtractor` the key is TanStack's row id,
|
|
2861
|
+
* which is the row's index in `data` and does not follow a row when
|
|
2862
|
+
* `data` changes — pass one.
|
|
2863
|
+
*/
|
|
2864
|
+
selectedKeys?: ReadonlySet<string>;
|
|
2865
|
+
/**
|
|
2866
|
+
* Turns selection on: a leading column of checkboxes, one per row, and one
|
|
2867
|
+
* in the header. Called with the whole next selection on every toggle.
|
|
2868
|
+
* The set it reports holds only keys of rows that are still in the data
|
|
2869
|
+
* and still selectable, so a key whose row has gone, or has become
|
|
2870
|
+
* unselectable, drops out on the next change rather than lingering.
|
|
2871
|
+
*/
|
|
2872
|
+
onSelectionChange?: (keys: Set<string>) => void;
|
|
2873
|
+
/**
|
|
2874
|
+
* Whether a row may be selected. `false` disables its checkbox; a string
|
|
2875
|
+
* disables it *and* says why, as the checkbox's accessible description and
|
|
2876
|
+
* as a tooltip on hover. Every row is selectable when omitted.
|
|
2877
|
+
*/
|
|
2878
|
+
isRowSelectable?: (row: T) => boolean | string;
|
|
2879
|
+
/**
|
|
2880
|
+
* The accessible name of a row's checkbox. Defaults to "Select" followed by
|
|
2881
|
+
* the row-header column's value (`rowHeader` / `meta.rowHeader`), or by
|
|
2882
|
+
* the row's key when there is no row header — so mark a row header, or
|
|
2883
|
+
* pass this, or every checkbox is named by an id.
|
|
2884
|
+
*/
|
|
2885
|
+
selectionLabel?: (row: T) => string;
|
|
2678
2886
|
};
|
|
2679
2887
|
type DataTableProps<T> = DataTableSharedProps<T> & ({
|
|
2680
2888
|
/** Pre-configured TanStack table instance */
|
|
@@ -2696,7 +2904,7 @@ type DataTableProps<T> = DataTableSharedProps<T> & ({
|
|
|
2696
2904
|
* column, a real sort button per sortable header, an optional `caption`, and a
|
|
2697
2905
|
* true row count when the body is windowed.
|
|
2698
2906
|
*/
|
|
2699
|
-
declare function DataTable<T>({ table: providedTable, columns, data, keyExtractor, caption, appearance, density, emptyText, className, containerClassName, virtualize, ...rest }: DataTableProps<T>): react.JSX.Element;
|
|
2907
|
+
declare function DataTable<T>({ table: providedTable, columns, data, keyExtractor, caption, appearance, density, emptyText, className, containerClassName, virtualize, selectedKeys, onSelectionChange, isRowSelectable, selectionLabel, ...rest }: DataTableProps<T>): react.JSX.Element;
|
|
2700
2908
|
|
|
2701
2909
|
interface ModalProps extends Omit<HTMLAttributes<HTMLDivElement>, 'title' | 'children' | 'className'> {
|
|
2702
2910
|
isOpen: boolean;
|
|
@@ -6379,6 +6587,57 @@ declare function formatAge(ms: number): string;
|
|
|
6379
6587
|
*/
|
|
6380
6588
|
declare const FreshnessIndicator: react.ForwardRefExoticComponent<FreshnessIndicatorProps & react.RefAttributes<HTMLSpanElement>>;
|
|
6381
6589
|
|
|
6590
|
+
/** Which of the four states a `ResourceState` is showing. */
|
|
6591
|
+
type ResourceStatus = 'loading' | 'failed' | 'stale' | 'ready';
|
|
6592
|
+
/**
|
|
6593
|
+
* What `ResourceState` reads. `usePolledResource`'s result fits as it is; so
|
|
6594
|
+
* does any `{ data, error }` from another loader.
|
|
6595
|
+
*/
|
|
6596
|
+
interface ResourceStateValue<T> {
|
|
6597
|
+
/** The last good answer, or `undefined` before there is one. */
|
|
6598
|
+
data: T | undefined;
|
|
6599
|
+
/** Why the latest load failed, or `undefined` when it did not. */
|
|
6600
|
+
error: string | undefined;
|
|
6601
|
+
/** A load is in flight. Sets `aria-busy` on the region; absent reads as loading while there is no data. */
|
|
6602
|
+
loading?: boolean;
|
|
6603
|
+
}
|
|
6604
|
+
interface ResourceStateProps<T> extends Omit<HTMLAttributes<HTMLDivElement>, 'children'> {
|
|
6605
|
+
/** The resource to render — `usePolledResource`'s result, or any structurally compatible `{ data, error }`. */
|
|
6606
|
+
state: ResourceStateValue<T>;
|
|
6607
|
+
/** Renders the data once there is some. Called with the data, never with `undefined`. */
|
|
6608
|
+
children: (data: T) => ReactNode;
|
|
6609
|
+
/** Shown while there is no data and no error. Default one block `Skeleton`; pass the shape of the real content to keep the page still when it lands. */
|
|
6610
|
+
loading?: ReactNode;
|
|
6611
|
+
/** The warning title when the load failed and there is nothing to show. Default `Could not load`. */
|
|
6612
|
+
errorTitle?: string;
|
|
6613
|
+
/** The warning title above data kept from an earlier load after a later one failed. Default `Showing the last good data`. */
|
|
6614
|
+
staleTitle?: string;
|
|
6615
|
+
}
|
|
6616
|
+
/** `forwardRef` erases a generic; this restores it, so `children` is typed by `state`. */
|
|
6617
|
+
type ResourceStateComponent = (<T>(props: ResourceStateProps<T> & RefAttributes<HTMLDivElement>) => ReactElement | null) & {
|
|
6618
|
+
displayName?: string;
|
|
6619
|
+
};
|
|
6620
|
+
/**
|
|
6621
|
+
* The loading, failed and stale states around a view of loaded data, so every
|
|
6622
|
+
* panel says them the same way.
|
|
6623
|
+
*
|
|
6624
|
+
* - **Loading** — no data yet and no error: the `loading` slot, a `Skeleton`
|
|
6625
|
+
* unless overridden.
|
|
6626
|
+
* - **Failed** — no data and an error: a `NoteBlock` warning, in the danger
|
|
6627
|
+
* role, carrying the error message under `errorTitle`.
|
|
6628
|
+
* - **Stale** — data from an earlier load, and a later load failed: a
|
|
6629
|
+
* `NoteBlock` in the warning role, under `staleTitle`, then the data. The data
|
|
6630
|
+
* stays because an older answer is more use than none, and the note stays
|
|
6631
|
+
* because an older answer shown as current is a lie.
|
|
6632
|
+
* - **Ready** — data and no error: `children(data)`.
|
|
6633
|
+
*
|
|
6634
|
+
* The region carries `aria-busy` while a load is in flight and `data-state`
|
|
6635
|
+
* naming the state. Pair it with `usePolledResource`, and put a
|
|
6636
|
+
* `FreshnessIndicator` fed its `updatedAt` near the view, to say how old the
|
|
6637
|
+
* data on screen is as well as whether it is.
|
|
6638
|
+
*/
|
|
6639
|
+
declare const ResourceState: ResourceStateComponent;
|
|
6640
|
+
|
|
6382
6641
|
/** The visible part of an id: its first `count` characters and `…`, or all of it. */
|
|
6383
6642
|
declare function truncateId(value: string, count?: number): string;
|
|
6384
6643
|
|
|
@@ -7592,6 +7851,11 @@ interface IndexedSectionProps extends Omit<react.HTMLAttributes<HTMLElement>, 't
|
|
|
7592
7851
|
headingLevel?: 2 | 3 | 4;
|
|
7593
7852
|
/** Controls drawn at the right of the header, such as a comment button. */
|
|
7594
7853
|
actions?: ReactNode;
|
|
7854
|
+
/**
|
|
7855
|
+
* Surface elevation rung for the section background.
|
|
7856
|
+
* If omitted, defaults to `'raised'` when nested in a `DrawingSheet`, or `'base'` standalone.
|
|
7857
|
+
*/
|
|
7858
|
+
surface?: 'base' | 'raised' | 'transparent';
|
|
7595
7859
|
/** Section content. */
|
|
7596
7860
|
children?: ReactNode;
|
|
7597
7861
|
/** Additional classes for the root. */
|
|
@@ -7603,6 +7867,8 @@ interface IndexedSectionProps extends Omit<react.HTMLAttributes<HTMLElement>, 't
|
|
|
7603
7867
|
*/
|
|
7604
7868
|
declare const IndexedSection: react.ForwardRefExoticComponent<IndexedSectionProps & react.RefAttributes<HTMLElement>>;
|
|
7605
7869
|
|
|
7870
|
+
type FigureSurface = 'base' | 'sheet';
|
|
7871
|
+
|
|
7606
7872
|
/**
|
|
7607
7873
|
* Adapted from mdxcn by Keshav Bagaade, MIT licensed.
|
|
7608
7874
|
* Source: https://github.com/keshav-exe/mdxcn/blob/2928126ba146ebbae9c2351deca27d27bb40e744/registry/default/graph-activity/graph-activity.tsx
|
|
@@ -7984,4 +8250,4 @@ declare const mdxComponents: {
|
|
|
7984
8250
|
};
|
|
7985
8251
|
type MdxComponents = typeof mdxComponents;
|
|
7986
8252
|
|
|
7987
|
-
export { ALERT_STATE_ORDER, ANSI_SLOTS, type AccentToken, type ActivityDay, ActivityGrid, type ActivityGridProps, type Alert, AlertDialog, type AlertDialogProps, AlertList, type AlertListProps, type AlertSeverity, type AlertState, AnchorHeading, type AnchorHeadingProps, type AnsiChrome, type AnsiHue, type AnsiScheme, type AnsiSlot, AppMain, type AppMainProps, type AppNavItem, AppShell, type AppShellProps, AppSidebar, AppSidebarNav, type AppSidebarNavProps, type AppSidebarProps, AppTopbar, type AppTopbarProps, AsciiDivider, type AsciiDividerProps, AsciiGauge, type AsciiGaugeProps, type AsciiGaugeVariant, Avatar, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartDatum, type BarChartProps, BeforeAfter, type BeforeAfterProps, type BlogAuthor, BlogPost, type BlogPostProps, BlueskyIcon, type BorderTone, BracketText, type BracketTextProps, Breadcrumbs, type BreadcrumbsProps, type BrutalistTheme, type BuildTraceOptions, BulletChart, type BulletChartProps, Button, type ButtonElementProps, type ButtonLinkProps, type ButtonProps, type ButtonVariant, CSS_MEDIUM, CTASection, type CTASectionAccent, type CTASectionProps, Card, type CardProps, type CardVariant, ChangeSummary, type ChangeSummaryProps, ChartTooltip, type ChartTooltipProps, Checkbox, type CheckboxProps, type ClassInput, CodeBlock, CodeBlockAttachment, type CodeBlockProps, CodeTab, type CodeTabProps, CodeTabs, type CodeTabsProps, type CodeTabsVariant, ColophonCard, type ColophonCardProps, type ColophonLink, type Column, type ContrastCheck, type ContrastFloor, type Crumb, DEFAULT_DEPLOY_LOG, DEFAULT_EXPERIMENTS, DEFAULT_LEVEL, DEFAULT_PRICING_TIERS, DIVIDER_PATTERNS, DataTable, type DataTableProps, type DataTableVirtualization, Decision, type DecisionOption, type DecisionProps, type Delta, type DeltaGround, DesignSandbox, type DiffLineProps, type DiffRow, type DiffSign, Divider, type DividerProps, type DividerVariant, DocPager, type DocPagerProps, type DocPagerTarget, DocsHeader, type DocsHeaderProps, DocsLayout, type DocsLayoutProps, DocsLink, type DocsLinkProps, DocsLinkProvider, type DocsLinkProviderProps, type DocsNavItem, type DocsNavNode, DocsSidebar, type DocsSidebarProps, Drawer, type DrawerPlacement, type DrawerProps, DrawingSheet, type DrawingSheetProps, type Emphasis, EmptyState, type EmptyStateProps, ErrorSummary, type ErrorSummaryError, type ErrorSummaryProps, Event, type ExperimentItem, ExperimentsView, type ExperimentsViewProps, FILTER_OPERATORS, FILTER_OPERATOR_LABELS, FIXED_COLOURS, FREE_TEXT_KEY, Feature, FeatureGrid, type FeatureGridProps, type FeatureProps, Fieldset, type FieldsetProps, FigureFrame, type FigureFrameProps, type FileChange, type FileChangeNode, FileChangeTree, type FileChangeTreeProps, type FileChangeView, type Filter, FilterBar, type FilterBarField, type FilterBarProps, type FilterOperator, type FilterParseResult, type Finding, type FixedColour, FlowDiagram, type FlowDiagramProps, type FlowNode, type FlowPathProps, type FlowRow, type FlowTone, FreshnessIndicator, type FreshnessIndicatorProps, type FreshnessState, GanttChart, type GanttChartProps, type GanttItem, GitHubIcon, Glyph, type GlyphProps, HEADING_EMPHASIS, type HeadingLevel, Hero, type HeroProps, type Hue, type HueAgreementCheck, type HueRef, INK_WEIGHT, IdChip, type IdChipProps, type IncidentEvent, type IncidentEventKind, type IncidentSummary, IncidentTimeline, type IncidentTimelineProps, IndexedSection, type IndexedSectionProps, Input, type InputProps, type IntensityScale, type Intent, LATENCY_HEATMAP_VARIANTS, LATENCY_HISTOGRAM_VARIANTS, LEVELS, LOG_SEVERITIES, type LatencyBucket, type LatencyCell, type LatencyGrid, LatencyHeatmap, type LatencyHeatmapProps, LatencyHistogram, type LatencyHistogramProps, type LatencyPoint, type LatencySlo, Legend, type LegendProps, type LevelDefinition, Line, type LinkComponentProps, LinkProvider, type LinkProviderProps, LinkedInIcon, type LogEntry, type LogFieldValue, type LogFilter, type LogHighlightPart, type LogSeverity, LogViewer, type LogViewerProps, LoremIpsumPost, MAXIMUM_NEUTRAL_CHROMA, MEDIA, MEDIA_DEFINITIONS, MINIMUM_RATIO, MailIcon, type MdxComponents, type Medium, type MediumDefinition, Menu, MenuItem, type MenuItemProps, type MenuProps, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuSeparator, type MenuSeparatorProps, MetadataGrid, type MetadataGridCustomItem, type MetadataGridProps, type MetadataGridSeries, type Metric, MetricStrip, type MetricStripProps, type MetricTone, MobileNav, type MobileNavProps, Modal, type ModalProps, type Motion, NERD_GLYPHS, NerdIcon, type NerdIconAccent, type NerdIconName, type NerdIconProps, Node, type NodeProps, NotFoundPage, type NotFoundPageProps, NoteBlock, type NoteBlockProps, OBSERVABILITY_INCIDENT_WINDOW, ObservabilityConsole, type ObservabilityConsoleProps, Option, type OverlayAlign, type OverlaySide, PALETTE_HUES, PageHeader, type PageHeaderProps, PageTitle, type PageTitleProps, Pagination, type PaginationProps, Path, type Polarity, Popover, type PopoverProps, PricingGrid, type PricingGridProps, PricingTier, type PricingTierAccent, type PricingTierProps, Progress, type ProgressProps, Prose, type ProseProps, RECOMMENDED_COLOURS, RECOMMENDED_COLOUR_CLASSES, RECOMMENDED_COLOUR_NAMESPACES, RECOMMENDED_COLOUR_PROPERTIES, RECOMMENDED_COLOUR_ROLES, RECOMMENDED_COLOUR_VARS, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RecommendedColourClass, type RecommendedColourNamespace, type RecommendedColourProperty, type RecommendedThemeColours, ReportDetails, type ReportDetailsProps, ReportDocument, type ReportDocumentProps, type ReportMetaItem, ReportSection, type ReportSectionProps, type Rgb, SEVERITY_ACCENTS, SLIDE_DECK_HOTKEYS, SLOTS, SYSTEM_LEVEL, SaasLandingPage, type SaasLandingPageProps, type SectionAlign, type SectionColumns, SectionContainer, type SectionContainerProps, Select, type SelectOption, type SelectProps, type SelectionDevice, type SelectionDeviceCheck, ServerErrorPage, type ServerErrorPageProps, type ServiceEdge, type ServiceGraph, type ServiceGraphLayout, type ServiceGraphLayoutEdge, type ServiceGraphLayoutNode, type ServiceGraphLayoutOptions, type ServiceGraphPoint, ServiceMap, type ServiceMapProps, type ServiceNode, type ServiceNodeKind, type Severity, SeverityBadge, type SeverityBadgeProps, SiteFooter, type SiteFooterProps, SiteHeader, type SiteHeaderCollapse, type SiteHeaderProps, SiteLink, type SiteLinkProps, SiteNav, type SiteNavGroupItemProps, SiteNavItem, type SiteNavItemProps, type SiteNavLinkItemProps, type SiteNavOrientation, type SiteNavProps, Skeleton, type SkeletonProps, Slide, SlideDeck, type SlideDeckHotkey, type SlideDeckProps, type SlideProps, Slope, type SlopeItem, Slugger, SocialIcon, type SocialIconName, type SocialIconProps, Sparkline, type SparklineProps, Spinner, type SpinnerProps, StatCard, type StatCardAccent, type StatCardProps, StatusPage, type StatusPageProps, Step, type StepProps, type StepState, Steps, type StepsProps, type Surface, Swatch, type SwatchColumn, SwatchCompare, type SwatchCompareProps, SwatchGroup, type SwatchGroupProps, type SwatchProps, type SwatchRow, Switch, type SwitchProps, THEME_ATTRIBUTE, THEME_LEVELS, THEME_STORAGE_KEY, TIME_RANGE_PRESETS, TIME_SERIES_VARIANTS, TLDR, type TLDRProps, TOKEN_RULES, Table, type TableAppearance, TableBody, TableCaption, TableCell, type TableDensity, TableFooter, TableHead, TableHeader, TableOfContents, type TableOfContentsProps, TableRow, Tabs, type TabsFont, TabsList, type TabsListProps, type TabsOrientation, TabsPanel, type TabsPanelProps, type TabsProps, TabsTab, type TabsTabProps, type TabsVariant, Tag, type TagProps, TelemetryGauge, type TelemetryGaugeProps, type TelemetryMachineState, Term, TermGrid, type TermGridProps, type TermItem, Terminal, type TerminalProps, TextArea, type TextAreaProps, type TextHierarchyStep, type TextTone, type ThemeContextValue, type ThemeLevel, ThemeProvider, type ThemeProviderProps, TickerTape, type TickerTapeProps, type TimeCursorState, type TimeRange, TimeRangePicker, type TimeRangePickerProps, type TimeRangePreset, TimeRangeProvider, type TimeRangeProviderProps, type TimeRangeState, type TimeSeries, type TimeSeriesAnnotation, TimeSeriesChart, type TimeSeriesChartProps, type TimeSeriesColorStrategy, type TimeSeriesCurve, type TimeSeriesDensity, type TimeSeriesGrid, type TimeSeriesLegend, type TimeSeriesPoint, type TimeSeriesPointMarkers, type TimeSeriesThreshold, type TimeSeriesVariant, type TimeSeriesYDomain, type TimeSeriesYScale, Timeline, type TimelineEvent, type TimelineProps, type TimelineState, type ToastActionOptions, type ToastApi, type ToastIntent, type ToastOptions, ToastProvider, type ToastProviderProps, type TocEntry, type TokenRow, type TokenRule, TokenTable, type TokenTableProps, Tooltip, type TooltipProps, type TraceAttributeValue, type TraceModel, type TraceReplay, type TraceSpan, type TraceSpanInput, type TraceSpanStatus, TraceViewer, type TraceViewerProps, TraceWaterfall, type TraceWaterfallProps, TrackCard, type TrackCardProps, type TrackItem, type TrackItemStatus, TreeDiagram, type TreeDiagramProps, type TreeNode, type TypeStep, type TypeStepName, type UptimeStatus, UptimeStrip, type UptimeStripProps, type UseActiveHeadingOptions, type UseCopyToClipboardResult, type UseTraceClockOptions, type UseTraceReplayOptions, type VerdictTone, WEB_FLOOR, XIcon, accentVar, ansiScheme, apcaContrast, assertNever, auditContrast, auditHueAgreement, auditSelectionDevices, auditTextHierarchy, borderVar, bucketIndex, bucketPercentile, bucketTimes, buildTrace, childrenToText, clampToRange, cn, collectHeadings, composite, contrastRatio, createAnchorHeading, describeFilter, describeLogEntry, describeTraceSpan, filterLogEntries, fontVar, formatAge, formatAlertDuration, formatClock, formatCount, formatDay, formatFilter, formatLatencyRange, formatRange, formatRangeDuration, formatRequests, formatServiceCount, formatServiceErrorRate, formatShare, formatTimeTick, formatTimestamp, formatTraceDuration, getRecommendedColours, getThemeInitScript, heatmapCells, highlightLogText, histogram, inLogRange, intensityLevel, intensityThresholds, isExternalHref, isMedium, isRecommendedColourClass, isThemeLevel, latencyBuckets, latencyExtent, latencyRowPosition, layoutServiceGraph, linearBuckets, logTicks, lookupField, matchFilters, matchLogEntry, matchTraceSpan, mdxComponents, nearestLogIndex, nextLevel, normaliseRange, parseColor, parseFilter, parseOtlpTrace, parseTraceDocument, percentile, percentiles, presetRange, relativeLuminance, replayTrace, sameFilter, scanRules, scanTokenRules, semanticTokens, serviceEdgeMidpoint, serviceEdgePath, serviceGraph, severityAccent, shareAbove, slugify, sortAlerts, sortLogEntries, summariseIncident, surfaceVar, textVar, timeTicks, truncateId, tryParseFilter, useActiveHeading, useCopyToClipboard, useDocsLinkComponent, useIsCurrentHref, useLinkComponent, useOptionalTheme, useOptionalToast, useTheme, useTimeCursor, useTimeRange, useToast, useTraceClock, useTraceReplay, visibleTraceSpans };
|
|
8253
|
+
export { ALERT_STATE_ORDER, ANSI_SLOTS, type AccentToken, type ActivityDay, ActivityGrid, type ActivityGridProps, type Alert, AlertDialog, type AlertDialogProps, AlertList, type AlertListProps, type AlertSeverity, type AlertState, AnchorHeading, type AnchorHeadingProps, type AnsiChrome, type AnsiHue, type AnsiScheme, type AnsiSlot, AppMain, type AppMainProps, type AppNavItem, AppShell, type AppShellProps, AppSidebar, AppSidebarNav, type AppSidebarNavProps, type AppSidebarProps, AppTopbar, type AppTopbarProps, AsciiDivider, type AsciiDividerProps, AsciiGauge, type AsciiGaugeProps, type AsciiGaugeVariant, Avatar, type AvatarProps, Badge, type BadgeProps, BarChart, type BarChartDatum, type BarChartProps, BeforeAfter, type BeforeAfterProps, type BlogAuthor, BlogPost, type BlogPostProps, BlueskyIcon, type BorderTone, BracketText, type BracketTextProps, Breadcrumbs, type BreadcrumbsProps, type BrutalistTheme, type BuildTraceOptions, BulletChart, type BulletChartProps, Button, type ButtonElementProps, type ButtonLinkProps, type ButtonProps, type ButtonVariant, CSS_MEDIUM, CTASection, type CTASectionAccent, type CTASectionProps, Card, type CardProps, type CardVariant, ChangeSummary, type ChangeSummaryProps, ChartTooltip, type ChartTooltipProps, Checkbox, type CheckboxProps, type ClassInput, CodeBlock, CodeBlockAttachment, type CodeBlockProps, CodeTab, type CodeTabProps, CodeTabs, type CodeTabsProps, type CodeTabsVariant, ColophonCard, type ColophonCardProps, type ColophonLink, type Column, type ContrastCheck, type ContrastFloor, type Crumb, DEFAULT_DEPLOY_LOG, DEFAULT_EXPERIMENTS, DEFAULT_LEVEL, DEFAULT_PRICING_TIERS, DIVIDER_PATTERNS, DataTable, type DataTableProps, type DataTableVirtualization, Decision, type DecisionOption, type DecisionProps, type Delta, type DeltaGround, DesignSandbox, type DiffLineProps, type DiffRow, type DiffSign, Divider, type DividerProps, type DividerVariant, DocPager, type DocPagerProps, type DocPagerTarget, DocsHeader, type DocsHeaderProps, DocsLayout, type DocsLayoutProps, DocsLink, type DocsLinkProps, DocsLinkProvider, type DocsLinkProviderProps, type DocsNavItem, type DocsNavNode, DocsSidebar, type DocsSidebarProps, Drawer, type DrawerPlacement, type DrawerProps, DrawingSheet, type DrawingSheetProps, type Emphasis, EmptyState, type EmptyStateProps, ErrorSummary, type ErrorSummaryError, type ErrorSummaryProps, Event, type ExperimentItem, ExperimentsView, type ExperimentsViewProps, FILTER_OPERATORS, FILTER_OPERATOR_LABELS, FIXED_COLOURS, FREE_TEXT_KEY, Feature, FeatureGrid, type FeatureGridProps, type FeatureProps, Fieldset, type FieldsetProps, FigureFrame, type FigureFrameProps, type FigureSurface, type FileChange, type FileChangeNode, FileChangeTree, type FileChangeTreeProps, type FileChangeView, type Filter, FilterBar, type FilterBarField, type FilterBarProps, type FilterOperator, type FilterParseResult, type Finding, type FixedColour, FlowDiagram, type FlowDiagramProps, type FlowNode, type FlowPathProps, type FlowRow, type FlowTone, type FormatBytesOptions, FreshnessIndicator, type FreshnessIndicatorProps, type FreshnessState, GanttChart, type GanttChartProps, type GanttItem, GitHubIcon, Glyph, type GlyphProps, HEADING_EMPHASIS, type HeadingLevel, Hero, type HeroProps, type Hue, type HueAgreementCheck, type HueRef, INK_WEIGHT, IdChip, type IdChipProps, type IncidentEvent, type IncidentEventKind, type IncidentSummary, IncidentTimeline, type IncidentTimelineProps, IndexedSection, type IndexedSectionProps, InlineAction, type InlineActionButtonProps, type InlineActionLinkProps, type InlineActionProps, type InlineActionTone, Input, type InputProps, type IntensityScale, type Intent, LATENCY_HEATMAP_VARIANTS, LATENCY_HISTOGRAM_VARIANTS, LEVELS, LOG_SEVERITIES, type LatencyBucket, type LatencyCell, type LatencyGrid, LatencyHeatmap, type LatencyHeatmapProps, LatencyHistogram, type LatencyHistogramProps, type LatencyPoint, type LatencySlo, Legend, type LegendProps, type LevelDefinition, Line, type LinkComponentProps, LinkProvider, type LinkProviderProps, LinkedInIcon, type LogEntry, type LogFieldValue, type LogFilter, type LogHighlightPart, type LogSeverity, LogViewer, type LogViewerProps, LoremIpsumPost, MAXIMUM_NEUTRAL_CHROMA, MEDIA, MEDIA_DEFINITIONS, MINIMUM_RATIO, MailIcon, type MdxComponents, type Medium, type MediumDefinition, Menu, MenuItem, type MenuItemProps, type MenuProps, MenuRadioGroup, type MenuRadioGroupProps, MenuRadioItem, type MenuRadioItemProps, MenuSeparator, type MenuSeparatorProps, MetadataGrid, type MetadataGridCustomItem, type MetadataGridProps, type MetadataGridSeries, type Metric, MetricStrip, type MetricStripProps, type MetricTone, MobileNav, type MobileNavProps, Modal, type ModalProps, type Motion, NERD_GLYPHS, NerdIcon, type NerdIconAccent, type NerdIconName, type NerdIconProps, Node, type NodeProps, NotFoundPage, type NotFoundPageProps, NoteBlock, type NoteBlockProps, OBSERVABILITY_INCIDENT_WINDOW, ObservabilityConsole, type ObservabilityConsoleProps, Option, type OverlayAlign, type OverlaySide, PALETTE_HUES, PageHeader, type PageHeaderProps, PageTitle, type PageTitleProps, Pagination, type PaginationProps, Path, type Polarity, Popover, type PopoverProps, PricingGrid, type PricingGridProps, PricingTier, type PricingTierAccent, type PricingTierProps, Progress, type ProgressProps, Prose, type ProseProps, RECOMMENDED_COLOURS, RECOMMENDED_COLOUR_CLASSES, RECOMMENDED_COLOUR_NAMESPACES, RECOMMENDED_COLOUR_PROPERTIES, RECOMMENDED_COLOUR_ROLES, RECOMMENDED_COLOUR_VARS, Radio, RadioGroup, type RadioGroupProps, type RadioProps, type RecommendedColourClass, type RecommendedColourNamespace, type RecommendedColourProperty, type RecommendedThemeColours, ReportDetails, type ReportDetailsProps, ReportDocument, type ReportDocumentProps, type ReportMetaItem, ReportSection, type ReportSectionProps, ResourceState, type ResourceStateProps, type ResourceStateValue, type ResourceStatus, type Rgb, SEVERITY_ACCENTS, SLIDE_DECK_HOTKEYS, SLOTS, SYSTEM_LEVEL, SaasLandingPage, type SaasLandingPageProps, type SectionAlign, type SectionColumns, SectionContainer, type SectionContainerProps, Select, type SelectOption, type SelectProps, type SelectionDevice, type SelectionDeviceCheck, ServerErrorPage, type ServerErrorPageProps, type ServiceEdge, type ServiceGraph, type ServiceGraphLayout, type ServiceGraphLayoutEdge, type ServiceGraphLayoutNode, type ServiceGraphLayoutOptions, type ServiceGraphPoint, ServiceMap, type ServiceMapProps, type ServiceNode, type ServiceNodeKind, type Severity, SeverityBadge, type SeverityBadgeProps, SiteFooter, type SiteFooterProps, SiteHeader, type SiteHeaderCollapse, type SiteHeaderProps, SiteLink, type SiteLinkProps, SiteNav, type SiteNavGroupItemProps, SiteNavItem, type SiteNavItemProps, type SiteNavLinkItemProps, type SiteNavOrientation, type SiteNavProps, Skeleton, type SkeletonProps, Slide, SlideDeck, type SlideDeckHotkey, type SlideDeckProps, type SlideProps, Slope, type SlopeItem, Slugger, SocialIcon, type SocialIconName, type SocialIconProps, Sparkline, type SparklineProps, Spinner, type SpinnerProps, StatCard, type StatCardAccent, type StatCardProps, StatusPage, type StatusPageProps, Step, type StepProps, type StepState, Steps, type StepsProps, type Surface, Swatch, type SwatchColumn, SwatchCompare, type SwatchCompareProps, SwatchGroup, type SwatchGroupProps, type SwatchProps, type SwatchRow, Switch, type SwitchProps, THEME_ATTRIBUTE, THEME_LEVELS, THEME_STORAGE_KEY, TIME_RANGE_PRESETS, TIME_SERIES_VARIANTS, TLDR, type TLDRProps, TOKEN_RULES, Table, type TableAppearance, TableBody, TableCaption, TableCell, type TableDensity, TableFooter, TableHead, TableHeader, TableOfContents, type TableOfContentsProps, TableRow, Tabs, type TabsFont, TabsList, type TabsListProps, type TabsOrientation, TabsPanel, type TabsPanelProps, type TabsProps, TabsTab, type TabsTabProps, type TabsVariant, Tag, type TagProps, TelemetryGauge, type TelemetryGaugeProps, type TelemetryMachineState, Term, TermGrid, type TermGridProps, type TermItem, Terminal, type TerminalProps, TextArea, type TextAreaProps, type TextHierarchyStep, type TextTone, type ThemeContextValue, type ThemeLevel, ThemeProvider, type ThemeProviderProps, TickerTape, type TickerTapeProps, type TimeCursorState, type TimeRange, TimeRangePicker, type TimeRangePickerProps, type TimeRangePreset, TimeRangeProvider, type TimeRangeProviderProps, type TimeRangeState, type TimeSeries, type TimeSeriesAnnotation, TimeSeriesChart, type TimeSeriesChartProps, type TimeSeriesColorStrategy, type TimeSeriesCurve, type TimeSeriesDensity, type TimeSeriesGrid, type TimeSeriesLegend, type TimeSeriesPoint, type TimeSeriesPointMarkers, type TimeSeriesThreshold, type TimeSeriesVariant, type TimeSeriesYDomain, type TimeSeriesYScale, Timeline, type TimelineEvent, type TimelineProps, type TimelineState, type ToastActionOptions, type ToastApi, type ToastIntent, type ToastOptions, ToastProvider, type ToastProviderProps, type TocEntry, type TokenRow, type TokenRule, TokenTable, type TokenTableProps, Tooltip, type TooltipProps, type TraceAttributeValue, type TraceModel, type TraceReplay, type TraceSpan, type TraceSpanInput, type TraceSpanStatus, TraceViewer, type TraceViewerProps, TraceWaterfall, type TraceWaterfallProps, TrackCard, type TrackCardProps, type TrackItem, type TrackItemStatus, TreeDiagram, type TreeDiagramProps, type TreeNode, type TypeStep, type TypeStepName, type UptimeStatus, UptimeStrip, type UptimeStripProps, type UseActiveHeadingOptions, type UseCopyToClipboardResult, type UsePolledResourceOptions, type UsePolledResourceResult, type UseTraceClockOptions, type UseTraceReplayOptions, type VerdictTone, WEB_FLOOR, XIcon, accentVar, ansiScheme, apcaContrast, assertNever, auditContrast, auditHueAgreement, auditSelectionDevices, auditTextHierarchy, borderVar, bucketIndex, bucketPercentile, bucketTimes, buildTrace, childrenToText, clampToRange, cn, collectHeadings, composite, contrastRatio, createAnchorHeading, describeFilter, describeLogEntry, describeTraceSpan, filterLogEntries, fontVar, formatAge, formatAlertDuration, formatBytes, formatClock, formatCount, formatDay, formatFilter, formatLatencyRange, formatRange, formatRangeDuration, formatRequests, formatServiceCount, formatServiceErrorRate, formatShare, formatTimeTick, formatTimestamp, formatTraceDuration, getRecommendedColours, getThemeInitScript, heatmapCells, highlightLogText, histogram, inLogRange, intensityLevel, intensityThresholds, isExternalHref, isMedium, isRecommendedColourClass, isThemeLevel, latencyBuckets, latencyExtent, latencyRowPosition, layoutServiceGraph, linearBuckets, logTicks, lookupField, matchFilters, matchLogEntry, matchTraceSpan, mdxComponents, nearestLogIndex, nextLevel, normaliseRange, parseColor, parseFilter, parseOtlpTrace, parseTraceDocument, percentile, percentiles, presetRange, relativeLuminance, replayTrace, sameFilter, scanRules, scanTokenRules, semanticTokens, serviceEdgeMidpoint, serviceEdgePath, serviceGraph, severityAccent, shareAbove, slugify, sortAlerts, sortLogEntries, summariseIncident, surfaceVar, textVar, timeTicks, truncateId, tryParseFilter, useActiveHeading, useCopyToClipboard, useDocsLinkComponent, useIsCurrentHref, useLinkComponent, useOptionalTheme, useOptionalToast, usePolledResource, useTheme, useTimeCursor, useTimeRange, useToast, useTraceClock, useTraceReplay, visibleTraceSpans };
|
package/dist/index.js
CHANGED
|
@@ -13,11 +13,14 @@ export { HEADING_EMPHASIS, accentVar, borderVar, fontVar, semanticTokens, surfac
|
|
|
13
13
|
export { RECOMMENDED_COLOURS, RECOMMENDED_COLOUR_CLASSES, RECOMMENDED_COLOUR_NAMESPACES, RECOMMENDED_COLOUR_PROPERTIES, RECOMMENDED_COLOUR_ROLES, RECOMMENDED_COLOUR_VARS, getRecommendedColours, isRecommendedColourClass } from "./theme/recommended.js";
|
|
14
14
|
import { cn } from "./lib/recipe.js";
|
|
15
15
|
export { Slugger, childrenToText, slugify } from "./lib/slug.js";
|
|
16
|
+
export { formatBytes } from "./lib/units.js";
|
|
16
17
|
export { useCopyToClipboard } from "./hooks/useCopyToClipboard.js";
|
|
17
18
|
export { useActiveHeading } from "./hooks/useActiveHeading.js";
|
|
18
19
|
export { useTraceClock } from "./hooks/useTraceClock.js";
|
|
19
20
|
export { useTraceReplay } from "./hooks/useTraceReplay.js";
|
|
21
|
+
export { usePolledResource } from "./hooks/usePolledResource.js";
|
|
20
22
|
export { Button } from "./components/Button.js";
|
|
23
|
+
export { InlineAction } from "./components/InlineAction.js";
|
|
21
24
|
export { Card } from "./components/Card.js";
|
|
22
25
|
export { Badge } from "./components/Badge.js";
|
|
23
26
|
export { ReportDetails, ReportDocument, ReportSection } from "./components/ReportDocument.js";
|
|
@@ -105,6 +108,7 @@ export { ServiceMap } from "./components/ServiceMap.js";
|
|
|
105
108
|
export { ALERT_STATE_ORDER, AlertList, formatAlertDuration, sortAlerts } from "./components/AlertList.js";
|
|
106
109
|
export { IncidentTimeline, summariseIncident } from "./components/IncidentTimeline.js";
|
|
107
110
|
export { FreshnessIndicator, formatAge } from "./components/FreshnessIndicator.js";
|
|
111
|
+
export { ResourceState } from "./components/ResourceState.js";
|
|
108
112
|
export { truncateId } from "./lib/ids.js";
|
|
109
113
|
export { IdChip } from "./components/IdChip.js";
|
|
110
114
|
export { Slide } from "./components/slides/Slide.js";
|