tempest-react-sdk 0.27.0 → 0.28.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/README.md +24 -0
- package/bin/lib/css/analyze.mjs +149 -0
- package/bin/lib/css/analyze.test.mjs +136 -0
- package/bin/lib/css/collect.mjs +152 -0
- package/bin/lib/css/findings.mjs +79 -0
- package/bin/lib/css/fix.e2e.test.mjs +99 -0
- package/bin/lib/css/fix.mjs +138 -0
- package/bin/lib/css/fix.test.mjs +108 -0
- package/bin/lib/css/index.mjs +16 -0
- package/bin/lib/css/parse.mjs +398 -0
- package/bin/lib/css/parse.test.mjs +146 -0
- package/bin/lib/css/properties.mjs +399 -0
- package/bin/lib/css/repetition.mjs +213 -0
- package/bin/lib/css/repetition.test.mjs +166 -0
- package/bin/lib/css/semantic.mjs +327 -0
- package/bin/lib/css/semantic.test.mjs +201 -0
- package/bin/lib/css/tokens.mjs +119 -0
- package/bin/lib/doctor/doctor.e2e.test.mjs +45 -0
- package/bin/tempest.mjs +169 -7
- package/dist/charts/scales.cjs +2 -0
- package/dist/charts/scales.cjs.map +1 -0
- package/dist/charts/scales.js +29 -0
- package/dist/charts/scales.js.map +1 -0
- package/dist/charts.cjs +1 -1
- package/dist/charts.d.ts +91 -0
- package/dist/charts.js +9 -8
- package/dist/components/BottomNavigation/BottomNavigation.module.cjs.map +1 -1
- package/dist/components/BottomNavigation/BottomNavigation.module.js.map +1 -1
- package/dist/components/Carousel/Carousel.module.cjs.map +1 -1
- package/dist/components/Carousel/Carousel.module.js.map +1 -1
- package/dist/components/CodeBlock/CodeBlock.cjs +3 -0
- package/dist/components/CodeBlock/CodeBlock.cjs.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.js +53 -0
- package/dist/components/CodeBlock/CodeBlock.js.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.module.cjs +2 -0
- package/dist/components/CodeBlock/CodeBlock.module.cjs.map +1 -0
- package/dist/components/CodeBlock/CodeBlock.module.js +29 -0
- package/dist/components/CodeBlock/CodeBlock.module.js.map +1 -0
- package/dist/components/CodeBlock/tokenize.cjs +3 -0
- package/dist/components/CodeBlock/tokenize.cjs.map +1 -0
- package/dist/components/CodeBlock/tokenize.js +267 -0
- package/dist/components/CodeBlock/tokenize.js.map +1 -0
- package/dist/components/Navbar/Navbar.module.cjs.map +1 -1
- package/dist/components/Navbar/Navbar.module.js.map +1 -1
- package/dist/components/QRCode/QRCode.cjs +2 -0
- package/dist/components/QRCode/QRCode.cjs.map +1 -0
- package/dist/components/QRCode/QRCode.js +49 -0
- package/dist/components/QRCode/QRCode.js.map +1 -0
- package/dist/components/QRCode/QRCode.module.cjs +2 -0
- package/dist/components/QRCode/QRCode.module.cjs.map +1 -0
- package/dist/components/QRCode/QRCode.module.js +9 -0
- package/dist/components/QRCode/QRCode.module.js.map +1 -0
- package/dist/components/QRCode/qr-encode.cjs +2 -0
- package/dist/components/QRCode/qr-encode.cjs.map +1 -0
- package/dist/components/QRCode/qr-encode.js +295 -0
- package/dist/components/QRCode/qr-encode.js.map +1 -0
- package/dist/components/QRCode/qr-tables.cjs +2 -0
- package/dist/components/QRCode/qr-tables.cjs.map +1 -0
- package/dist/components/QRCode/qr-tables.js +366 -0
- package/dist/components/QRCode/qr-tables.js.map +1 -0
- package/dist/components/ScrollArea/ScrollArea.cjs +1 -1
- package/dist/components/ScrollArea/ScrollArea.cjs.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.js +22 -16
- package/dist/components/ScrollArea/ScrollArea.js.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.module.cjs.map +1 -1
- package/dist/components/ScrollArea/ScrollArea.module.js.map +1 -1
- package/dist/components/Sparkline/Sparkline.cjs +2 -0
- package/dist/components/Sparkline/Sparkline.cjs.map +1 -0
- package/dist/components/Sparkline/Sparkline.js +64 -0
- package/dist/components/Sparkline/Sparkline.js.map +1 -0
- package/dist/components/Sparkline/Sparkline.module.cjs +2 -0
- package/dist/components/Sparkline/Sparkline.module.cjs.map +1 -0
- package/dist/components/Sparkline/Sparkline.module.js +10 -0
- package/dist/components/Sparkline/Sparkline.module.js.map +1 -0
- package/dist/components/Sparkline/sparkline-geometry.cjs +2 -0
- package/dist/components/Sparkline/sparkline-geometry.cjs.map +1 -0
- package/dist/components/Sparkline/sparkline-geometry.js +56 -0
- package/dist/components/Sparkline/sparkline-geometry.js.map +1 -0
- package/dist/components/Table/Table.cjs +1 -1
- package/dist/components/Table/Table.cjs.map +1 -1
- package/dist/components/Table/Table.js +37 -30
- package/dist/components/Table/Table.js.map +1 -1
- package/dist/components/Table/Table.module.cjs.map +1 -1
- package/dist/components/Table/Table.module.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.cjs +1 -1
- package/dist/components/VirtualList/VirtualList.cjs.map +1 -1
- package/dist/components/VirtualList/VirtualList.js +13 -11
- package/dist/components/VirtualList/VirtualList.js.map +1 -1
- package/dist/components/VirtualList/VirtualList.module.cjs.map +1 -1
- package/dist/components/VirtualList/VirtualList.module.js.map +1 -1
- package/dist/hooks/use-scroll-overflow.cjs +2 -0
- package/dist/hooks/use-scroll-overflow.cjs.map +1 -0
- package/dist/hooks/use-scroll-overflow.js +22 -0
- package/dist/hooks/use-scroll-overflow.js.map +1 -0
- package/dist/styles.css +1 -1
- package/dist/tempest-react-sdk.cjs +1 -1
- package/dist/tempest-react-sdk.d.ts +445 -2
- package/dist/tempest-react-sdk.js +197 -190
- package/dist/theme/create-theme.cjs +3 -3
- package/dist/theme/create-theme.cjs.map +1 -1
- package/dist/theme/create-theme.js +52 -28
- package/dist/theme/create-theme.js.map +1 -1
- package/dist/theme/data-viz-ramps.cjs +2 -0
- package/dist/theme/data-viz-ramps.cjs.map +1 -0
- package/dist/theme/data-viz-ramps.js +58 -0
- package/dist/theme/data-viz-ramps.js.map +1 -0
- package/package.json +2 -1
|
@@ -1092,6 +1092,9 @@ export declare const CEPInput: ForwardRefExoticComponent<Omit<InputProps, "value
|
|
|
1092
1092
|
onChange: (value: string) => void;
|
|
1093
1093
|
} & RefAttributes<HTMLInputElement>>;
|
|
1094
1094
|
|
|
1095
|
+
/** A `var(--tempest-chart-…)` reference, so the value follows the active theme. */
|
|
1096
|
+
export declare type ChartColorToken = string;
|
|
1097
|
+
|
|
1095
1098
|
/**
|
|
1096
1099
|
* Accessible checkbox. Supports a tri-state via `indeterminate` and pairs the
|
|
1097
1100
|
* input with a label/description column for forms.
|
|
@@ -1213,6 +1216,50 @@ export declare const CNPJInput: ForwardRefExoticComponent<Omit<InputProps, "valu
|
|
|
1213
1216
|
onChange: (value: string) => void;
|
|
1214
1217
|
} & RefAttributes<HTMLInputElement>>;
|
|
1215
1218
|
|
|
1219
|
+
/**
|
|
1220
|
+
* A read-only code sample: syntax colours, optional line numbers, copy button.
|
|
1221
|
+
*
|
|
1222
|
+
* The `<pre>` is always focusable. A code block is scrollable and holds nothing
|
|
1223
|
+
* focusable inside, so without a tab stop a keyboard user can see there is more
|
|
1224
|
+
* code past the edge and has no way to reach it. It is the one scroll container
|
|
1225
|
+
* where the stop is unconditional rather than measured — a code sample is
|
|
1226
|
+
* expected to be reachable, read and selected on its own.
|
|
1227
|
+
*
|
|
1228
|
+
* Colours come from an approximate scanner, not a parser — see {@link tokenize}.
|
|
1229
|
+
*
|
|
1230
|
+
* @example
|
|
1231
|
+
* <CodeBlock code={snippet} language="ts" filename="src/main.ts" showLineNumbers />
|
|
1232
|
+
* <CodeBlock code={log} language="bash" maxHeight={280} />
|
|
1233
|
+
*/
|
|
1234
|
+
export declare function CodeBlock({ code, language, filename, showLineNumbers, highlightLines, copyable, maxHeight, wrap, label, className, ...rest }: CodeBlockProps): JSX.Element;
|
|
1235
|
+
|
|
1236
|
+
export declare interface CodeBlockProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
1237
|
+
/** The source to display. Leading and trailing blank lines are trimmed. */
|
|
1238
|
+
code: string;
|
|
1239
|
+
/** Grammar name or alias (`ts`, `bash`, `json`…). Unknown values render plain. */
|
|
1240
|
+
language?: string;
|
|
1241
|
+
/** Shown in the header, usually a file path. */
|
|
1242
|
+
filename?: ReactNode;
|
|
1243
|
+
/** Number the lines. Default `false`. */
|
|
1244
|
+
showLineNumbers?: boolean;
|
|
1245
|
+
/** 1-based line numbers to mark as the point of the snippet. */
|
|
1246
|
+
highlightLines?: readonly number[];
|
|
1247
|
+
/** Offer a copy button. Default `true`. */
|
|
1248
|
+
copyable?: boolean;
|
|
1249
|
+
/** Cap the height in px or any CSS length; the body scrolls past it. */
|
|
1250
|
+
maxHeight?: number | string;
|
|
1251
|
+
/** Wrap long lines instead of scrolling sideways. Default `false`. */
|
|
1252
|
+
wrap?: boolean;
|
|
1253
|
+
/**
|
|
1254
|
+
* Accessible name for the code region. Defaults to naming the language, and
|
|
1255
|
+
* to the filename when there is one.
|
|
1256
|
+
*/
|
|
1257
|
+
label?: string;
|
|
1258
|
+
}
|
|
1259
|
+
|
|
1260
|
+
/** Languages the tokenizer knows. Anything else renders as plain text. */
|
|
1261
|
+
export declare type CodeLanguage = "typescript" | "javascript" | "tsx" | "jsx" | "json" | "css" | "html" | "bash" | "python" | "sql" | "plain";
|
|
1262
|
+
|
|
1216
1263
|
/**
|
|
1217
1264
|
* A single expand/collapse region — a lighter alternative to `Accordion` for
|
|
1218
1265
|
* one toggleable block. The trigger is a `<button aria-expanded aria-controls>`
|
|
@@ -2602,6 +2649,40 @@ export declare interface DisclosureHandlers {
|
|
|
2602
2649
|
toggle: () => void;
|
|
2603
2650
|
}
|
|
2604
2651
|
|
|
2652
|
+
/** How many steps the diverging token scale has, midpoint included. */
|
|
2653
|
+
export declare const DIVERGING_STEP_COUNT = 9;
|
|
2654
|
+
|
|
2655
|
+
/**
|
|
2656
|
+
* Build a polarity scale over the diverging tokens.
|
|
2657
|
+
*
|
|
2658
|
+
* Each arm is scaled against its **own** distance from the centre, so an asymmetric
|
|
2659
|
+
* domain (say −5…+80) still uses the full cool arm for its small negatives. Scaling
|
|
2660
|
+
* both arms by the wider one — the easy mistake — would collapse every negative
|
|
2661
|
+
* into the step next to the midpoint and hide the sign entirely.
|
|
2662
|
+
*
|
|
2663
|
+
* @example
|
|
2664
|
+
* const color = divergingScale({ min: -12, max: 40 }); // centre 0
|
|
2665
|
+
* const budget = divergingScale({ min: 80, max: 130, center: 100 });
|
|
2666
|
+
*
|
|
2667
|
+
* @param options - The data domain and the neutral centre.
|
|
2668
|
+
* @returns A function from value to a CSS colour reference.
|
|
2669
|
+
*/
|
|
2670
|
+
export declare function divergingScale(options: DivergingScaleOptions): (value: number) => ChartColorToken;
|
|
2671
|
+
|
|
2672
|
+
export declare interface DivergingScaleOptions {
|
|
2673
|
+
/** Lowest value in the data. */
|
|
2674
|
+
min: number;
|
|
2675
|
+
/** Highest value in the data. */
|
|
2676
|
+
max: number;
|
|
2677
|
+
/**
|
|
2678
|
+
* The value that means "no deviation". Default `0`.
|
|
2679
|
+
*
|
|
2680
|
+
* It is a parameter because the interesting midpoint is often not zero — a
|
|
2681
|
+
* budget variance diverges around the target, not around nothing.
|
|
2682
|
+
*/
|
|
2683
|
+
center?: number;
|
|
2684
|
+
}
|
|
2685
|
+
|
|
2605
2686
|
/**
|
|
2606
2687
|
* Horizontal or vertical visual separator. When `label` is provided in
|
|
2607
2688
|
* horizontal mode the divider splits and centers the label between two lines.
|
|
@@ -2765,6 +2846,25 @@ export declare interface EmptyStateProps {
|
|
|
2765
2846
|
className?: string;
|
|
2766
2847
|
}
|
|
2767
2848
|
|
|
2849
|
+
/**
|
|
2850
|
+
* Encode text into a QR matrix.
|
|
2851
|
+
*
|
|
2852
|
+
* The whole pipeline of ISO/IEC 18004: pick the densest mode the payload
|
|
2853
|
+
* qualifies for, pick the smallest version that fits, build the bit stream, add
|
|
2854
|
+
* Reed-Solomon correction, interleave the blocks, lay the modules out, then try
|
|
2855
|
+
* all eight masks and keep the one the standard's penalty function likes best.
|
|
2856
|
+
*
|
|
2857
|
+
* @param text - The payload. Byte mode encodes it as UTF-8.
|
|
2858
|
+
* @param options - Level and an optional version floor.
|
|
2859
|
+
* @returns The finished matrix, without a quiet zone.
|
|
2860
|
+
* @throws {QRCapacityError} When the payload does not fit at that level.
|
|
2861
|
+
*
|
|
2862
|
+
* @example
|
|
2863
|
+
* const qr = encodeQR("https://tempest.dev", { level: "Q" });
|
|
2864
|
+
* qr.modules[0][0]; // true — top-left of the finder pattern
|
|
2865
|
+
*/
|
|
2866
|
+
export declare function encodeQR(text: string, options?: QREncodeOptions): QRMatrix;
|
|
2867
|
+
|
|
2768
2868
|
/**
|
|
2769
2869
|
* Class-based React error boundary with a render-prop or static fallback.
|
|
2770
2870
|
* Auto-resets when any value in `resetKeys` changes.
|
|
@@ -4511,6 +4611,19 @@ export declare interface LongPressHandlers {
|
|
|
4511
4611
|
onContextMenu: (event: MouseEvent_2) => void;
|
|
4512
4612
|
}
|
|
4513
4613
|
|
|
4614
|
+
/**
|
|
4615
|
+
* The matrix as an SVG path, one `M…h…v…h…z` rectangle per dark module.
|
|
4616
|
+
*
|
|
4617
|
+
* A path beats one `<rect>` per module: a version-10 symbol is 3 481 modules,
|
|
4618
|
+
* and that many elements is a real cost to parse and to paint. Coordinates are
|
|
4619
|
+
* whole numbers in module space, so the shape stays crisp at any size.
|
|
4620
|
+
*
|
|
4621
|
+
* @param matrix - An encoded matrix.
|
|
4622
|
+
* @param margin - Quiet zone in modules. The standard asks for 4.
|
|
4623
|
+
* @returns The `d` attribute, empty when there is nothing dark.
|
|
4624
|
+
*/
|
|
4625
|
+
export declare function matrixToPath(matrix: QRMatrix, margin?: number): string;
|
|
4626
|
+
|
|
4514
4627
|
/**
|
|
4515
4628
|
* Memoize only the most recent call of `fn`, keyed by shallow-equal arguments.
|
|
4516
4629
|
*
|
|
@@ -5348,6 +5461,16 @@ export declare interface OpenModalOptions {
|
|
|
5348
5461
|
onClose?: () => void;
|
|
5349
5462
|
}
|
|
5350
5463
|
|
|
5464
|
+
/**
|
|
5465
|
+
* First sequential step that clears 2:1 against the chart surface.
|
|
5466
|
+
*
|
|
5467
|
+
* A sequential scale may let its near-zero end recede into the surface — on a
|
|
5468
|
+
* heatmap that is exactly what "almost nothing" should look like. An **ordinal**
|
|
5469
|
+
* scale may not: every step is a discrete mark someone has to see. Starting an
|
|
5470
|
+
* ordinal ramp here is the difference.
|
|
5471
|
+
*/
|
|
5472
|
+
export declare const ORDINAL_START_STEP = 3;
|
|
5473
|
+
|
|
5351
5474
|
/** Options for {@link createOSRMBackend}. */
|
|
5352
5475
|
export declare interface OSRMBackendOptions {
|
|
5353
5476
|
/**
|
|
@@ -5852,6 +5975,103 @@ export declare interface PushPayload {
|
|
|
5852
5975
|
data?: Record<string, unknown>;
|
|
5853
5976
|
}
|
|
5854
5977
|
|
|
5978
|
+
/** Raised when a payload cannot be encoded at the requested level. */
|
|
5979
|
+
export declare class QRCapacityError extends Error {
|
|
5980
|
+
readonly length: number;
|
|
5981
|
+
readonly level: QRErrorCorrection;
|
|
5982
|
+
constructor(length: number, level: QRErrorCorrection);
|
|
5983
|
+
}
|
|
5984
|
+
|
|
5985
|
+
/**
|
|
5986
|
+
* A QR symbol, encoded in the browser and drawn as SVG.
|
|
5987
|
+
*
|
|
5988
|
+
* No dependency and no network round trip: an image service would leak the
|
|
5989
|
+
* payload — a payment link, a session token, an invite — to a third party, and
|
|
5990
|
+
* the encoder is a few kilobytes.
|
|
5991
|
+
*
|
|
5992
|
+
* SVG rather than canvas so the symbol stays sharp at any size and prints at
|
|
5993
|
+
* the printer's resolution instead of the screen's. Everything is one path
|
|
5994
|
+
* (horizontal runs merged), because a version-10 symbol is 3 481 modules and
|
|
5995
|
+
* that many elements costs real paint time.
|
|
5996
|
+
*
|
|
5997
|
+
* The colours are **black on white in both themes, on purpose** — they are the
|
|
5998
|
+
* one part of the SDK that ignores the theme tokens. Scanners expect
|
|
5999
|
+
* dark-on-light, and the ones that cope with an inverted symbol do it slowly and
|
|
6000
|
+
* unreliably; a QR that looks integrated with a dark page and scans on the third
|
|
6001
|
+
* try is worse than one that looks pasted on. Wiring the modules to
|
|
6002
|
+
* `--tempest-text` would flip them light in dark mode and leave a light symbol
|
|
6003
|
+
* on the white background, which scans as nothing at all. Override
|
|
6004
|
+
* `color`/`background` only with a scanner in hand.
|
|
6005
|
+
*
|
|
6006
|
+
* @throws {QRCapacityError} When the payload is too long for a version-40
|
|
6007
|
+
* symbol at the chosen level. That is a programming error rather than a state
|
|
6008
|
+
* to render, so it surfaces instead of silently drawing nothing — wrap it in
|
|
6009
|
+
* `ErrorBoundary` if the payload comes from user input.
|
|
6010
|
+
*
|
|
6011
|
+
* @example
|
|
6012
|
+
* <QRCode value="https://tempest.dev" />
|
|
6013
|
+
* <QRCode value={pixPayload} level="H" size={220} label="QR do Pix" />
|
|
6014
|
+
*/
|
|
6015
|
+
export declare function QRCode({ value, size, level, margin, color, background, label, className, style, ...rest }: QRCodeProps): JSX.Element;
|
|
6016
|
+
|
|
6017
|
+
export declare interface QRCodeProps extends Omit<HTMLAttributes<HTMLDivElement>, "children"> {
|
|
6018
|
+
/** The payload. Encoded as UTF-8 when it is not plain digits or upper-case text. */
|
|
6019
|
+
value: string;
|
|
6020
|
+
/** Rendered side in px, quiet zone included. Default `160`. */
|
|
6021
|
+
size?: number;
|
|
6022
|
+
/** Error correction level. Default `"M"`. */
|
|
6023
|
+
level?: QRErrorCorrection;
|
|
6024
|
+
/** Quiet zone in modules. The standard asks for 4; below that, scanners start to miss. */
|
|
6025
|
+
margin?: number;
|
|
6026
|
+
/** Module colour. Defaults to black — see the note on dark mode below. */
|
|
6027
|
+
color?: string;
|
|
6028
|
+
/** Background colour. Defaults to white. */
|
|
6029
|
+
background?: string;
|
|
6030
|
+
/**
|
|
6031
|
+
* Accessible name. Defaults to naming the payload, because a screen reader
|
|
6032
|
+
* user cannot scan the symbol: the content has to reach them as text.
|
|
6033
|
+
*/
|
|
6034
|
+
label?: string;
|
|
6035
|
+
}
|
|
6036
|
+
|
|
6037
|
+
export declare interface QREncodeOptions {
|
|
6038
|
+
/** Error correction level. Default `"M"`. */
|
|
6039
|
+
level?: QRErrorCorrection;
|
|
6040
|
+
/**
|
|
6041
|
+
* Force a minimum version. The encoder still grows past it when the payload
|
|
6042
|
+
* does not fit — a version is a floor, never a cap that silently truncates.
|
|
6043
|
+
*/
|
|
6044
|
+
minVersion?: number;
|
|
6045
|
+
}
|
|
6046
|
+
|
|
6047
|
+
/**
|
|
6048
|
+
* The fixed tables of ISO/IEC 18004, transcribed.
|
|
6049
|
+
*
|
|
6050
|
+
* They are data, not logic: the standard specifies them and there is nothing to
|
|
6051
|
+
* derive. They live apart from {@link ./qr-encode} so the algorithm reads as
|
|
6052
|
+
* algorithm and a typo in a table stays findable.
|
|
6053
|
+
*/
|
|
6054
|
+
/** Error correction level, by how much of the symbol it can lose and survive. */
|
|
6055
|
+
export declare type QRErrorCorrection = "L" | "M" | "Q" | "H";
|
|
6056
|
+
|
|
6057
|
+
export declare interface QRMatrix {
|
|
6058
|
+
/** Side length in modules, including no quiet zone. */
|
|
6059
|
+
size: number;
|
|
6060
|
+
/** Row-major modules; `true` is dark. */
|
|
6061
|
+
modules: boolean[][];
|
|
6062
|
+
/** Symbol version, 1 to 40. */
|
|
6063
|
+
version: number;
|
|
6064
|
+
/** Level the symbol was encoded at. */
|
|
6065
|
+
level: QRErrorCorrection;
|
|
6066
|
+
/** The mode chosen for the payload. */
|
|
6067
|
+
mode: QRMode;
|
|
6068
|
+
/** Which of the eight masks scored best. */
|
|
6069
|
+
mask: number;
|
|
6070
|
+
}
|
|
6071
|
+
|
|
6072
|
+
/** How the payload is packed into bits. */
|
|
6073
|
+
export declare type QRMode = "numeric" | "alphanumeric" | "byte";
|
|
6074
|
+
|
|
5855
6075
|
/**
|
|
5856
6076
|
* Wrapper around `QueryClientProvider` that bootstraps a `QueryClient` with
|
|
5857
6077
|
* sane SDK defaults (5-minute stale time, 30-minute gc time, 1 retry).
|
|
@@ -6226,6 +6446,14 @@ export declare interface ResizableProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
6226
6446
|
|
|
6227
6447
|
export declare type ResolvedTheme = "light" | "dark";
|
|
6228
6448
|
|
|
6449
|
+
/**
|
|
6450
|
+
* Normalise a language name onto a known grammar.
|
|
6451
|
+
*
|
|
6452
|
+
* @param language - Whatever the caller passed, e.g. `"ts"` or `"Shell"`.
|
|
6453
|
+
* @returns The grammar to use; `"plain"` when there is no match.
|
|
6454
|
+
*/
|
|
6455
|
+
export declare function resolveLanguage(language: string | undefined): CodeLanguage;
|
|
6456
|
+
|
|
6229
6457
|
declare type Resolver<T> = (values: unknown, context: unknown, options: {
|
|
6230
6458
|
criteriaMode?: "firstError" | "all";
|
|
6231
6459
|
}) => Promise<ResolverOutput<T>>;
|
|
@@ -6420,6 +6648,17 @@ export declare interface SafeAreaProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
6420
6648
|
/** The ten steps of a Tempest tint scale, lightest to darkest. */
|
|
6421
6649
|
export declare type ScaleStep = 50 | 100 | 200 | 300 | 400 | 500 | 600 | 700 | 800 | 900;
|
|
6422
6650
|
|
|
6651
|
+
/**
|
|
6652
|
+
* Every step of a token scale, in order — for rendering a legend.
|
|
6653
|
+
*
|
|
6654
|
+
* A continuous scale needs a legend showing the ramp with its end labels; without
|
|
6655
|
+
* one the reader has no way to turn a colour back into a number.
|
|
6656
|
+
*
|
|
6657
|
+
* @param kind - Which scale.
|
|
6658
|
+
* @returns The token references, lightest/coolest first.
|
|
6659
|
+
*/
|
|
6660
|
+
export declare function scaleSteps(kind: "sequential" | "diverging"): ChartColorToken[];
|
|
6661
|
+
|
|
6423
6662
|
/**
|
|
6424
6663
|
* An agenda: events placed on a time grid across consecutive days.
|
|
6425
6664
|
*
|
|
@@ -6494,6 +6733,12 @@ export declare interface SchedulerProps extends Omit<HTMLAttributes<HTMLDivEleme
|
|
|
6494
6733
|
* thin custom scrollbar (WebKit) while staying fully functional in browsers
|
|
6495
6734
|
* without scrollbar styling. Forwards `className`, `style` and the ref to the
|
|
6496
6735
|
* underlying `<div>`.
|
|
6736
|
+
*
|
|
6737
|
+
* While the content overflows, the container becomes a named, focusable group.
|
|
6738
|
+
* A scroll area whose children are plain text holds nothing focusable, so
|
|
6739
|
+
* without that a keyboard user can see the scrollbar and has no way to move it.
|
|
6740
|
+
* The tab stop disappears again once the content fits, so an area that does not
|
|
6741
|
+
* scroll never adds one. Callers may still override `tabIndex` or `role`.
|
|
6497
6742
|
*/
|
|
6498
6743
|
export declare const ScrollArea: ForwardRefExoticComponent<ScrollAreaProps & RefAttributes<HTMLDivElement>>;
|
|
6499
6744
|
|
|
@@ -6504,8 +6749,17 @@ export declare interface ScrollAreaProps extends HTMLAttributes<HTMLDivElement>
|
|
|
6504
6749
|
maxHeight?: number | string;
|
|
6505
6750
|
/** Which axis scrolls. Default `"vertical"`. */
|
|
6506
6751
|
orientation?: ScrollAreaOrientation;
|
|
6752
|
+
/**
|
|
6753
|
+
* Accessible name used while the content actually overflows, when the area
|
|
6754
|
+
* takes a tab stop of its own. Defaults to a generic one; name it when the
|
|
6755
|
+
* page holds several scroll areas.
|
|
6756
|
+
*/
|
|
6757
|
+
scrollLabel?: string;
|
|
6507
6758
|
}
|
|
6508
6759
|
|
|
6760
|
+
/** Which axis to watch for overflow. */
|
|
6761
|
+
export declare type ScrollOverflowAxis = "horizontal" | "vertical" | "both";
|
|
6762
|
+
|
|
6509
6763
|
/**
|
|
6510
6764
|
* Search input with magnifier icon and a clear button. Controlled component:
|
|
6511
6765
|
* pass `value` and `onChange`.
|
|
@@ -6563,6 +6817,19 @@ export declare interface SegmentedControlProps<TValue extends string = string> e
|
|
|
6563
6817
|
*/
|
|
6564
6818
|
export declare const Select: ForwardRefExoticComponent<SelectProps & RefAttributes<HTMLSelectElement>>;
|
|
6565
6819
|
|
|
6820
|
+
/**
|
|
6821
|
+
* Pick the densest mode the payload qualifies for.
|
|
6822
|
+
*
|
|
6823
|
+
* Numeric packs 3 digits into 10 bits and alphanumeric 2 characters into 11, so
|
|
6824
|
+
* a phone number or an upper-case code encodes far smaller than the same string
|
|
6825
|
+
* as bytes — often a whole version smaller, which is a visibly coarser symbol
|
|
6826
|
+
* and therefore easier to scan.
|
|
6827
|
+
*
|
|
6828
|
+
* @param text - The payload.
|
|
6829
|
+
* @returns The narrowest mode that can represent it.
|
|
6830
|
+
*/
|
|
6831
|
+
export declare function selectMode(text: string): QRMode;
|
|
6832
|
+
|
|
6566
6833
|
export declare interface SelectOption {
|
|
6567
6834
|
value: string | number;
|
|
6568
6835
|
label: string;
|
|
@@ -6599,6 +6866,39 @@ export declare interface SentryLike {
|
|
|
6599
6866
|
flush?: (timeout?: number) => Promise<boolean>;
|
|
6600
6867
|
}
|
|
6601
6868
|
|
|
6869
|
+
/** How many steps the sequential token scale has. */
|
|
6870
|
+
export declare const SEQUENTIAL_STEP_COUNT = 7;
|
|
6871
|
+
|
|
6872
|
+
/**
|
|
6873
|
+
* Build a magnitude scale over the sequential tokens.
|
|
6874
|
+
*
|
|
6875
|
+
* Returns `var(--tempest-chart-sequential-N)` rather than a hex string, so a
|
|
6876
|
+
* heatmap painted once follows the theme — including dark mode, whose steps are
|
|
6877
|
+
* chosen for the dark surface rather than flipped.
|
|
6878
|
+
*
|
|
6879
|
+
* @example
|
|
6880
|
+
* const color = sequentialScale({ min: 0, max: 250 });
|
|
6881
|
+
* <rect fill={color(value)} />
|
|
6882
|
+
*
|
|
6883
|
+
* @param options - The data domain, and whether every step must stay visible.
|
|
6884
|
+
* @returns A function from value to a CSS colour reference.
|
|
6885
|
+
*/
|
|
6886
|
+
export declare function sequentialScale(options: SequentialScaleOptions): (value: number) => ChartColorToken;
|
|
6887
|
+
|
|
6888
|
+
export declare interface SequentialScaleOptions {
|
|
6889
|
+
/** Lowest value in the data. */
|
|
6890
|
+
min: number;
|
|
6891
|
+
/** Highest value in the data. */
|
|
6892
|
+
max: number;
|
|
6893
|
+
/**
|
|
6894
|
+
* Keep every step visible against the surface, for discrete ordered marks.
|
|
6895
|
+
*
|
|
6896
|
+
* Off by default: a heatmap *wants* its near-zero cells to recede. Turn it on
|
|
6897
|
+
* for tiers, funnel stages or anything where each step is its own mark.
|
|
6898
|
+
*/
|
|
6899
|
+
ordinal?: boolean;
|
|
6900
|
+
}
|
|
6901
|
+
|
|
6602
6902
|
/**
|
|
6603
6903
|
* Wrap the Web Share API with a uniform result object. Falls through to
|
|
6604
6904
|
* `unsupported: true` when the browser lacks `navigator.share`, leaving the
|
|
@@ -6906,6 +7206,58 @@ export declare interface SpacerProps extends HTMLAttributes<HTMLDivElement> {
|
|
|
6906
7206
|
axis?: SpacerAxis;
|
|
6907
7207
|
}
|
|
6908
7208
|
|
|
7209
|
+
/**
|
|
7210
|
+
* A tiny inline chart: shape only, no axes, no legend.
|
|
7211
|
+
*
|
|
7212
|
+
* Sized to sit in a table cell or beside a number, which is why it is plain SVG on
|
|
7213
|
+
* the root entry rather than a recharts wrapper — a sparkline in a data table should
|
|
7214
|
+
* not oblige an app to install a charting library.
|
|
7215
|
+
*
|
|
7216
|
+
* It carries `role="img"` and a spoken description of the series (direction, ends,
|
|
7217
|
+
* extremes). Without that it is an unlabelled image: a sparkline has no axis or
|
|
7218
|
+
* legend to fall back on, so a screen reader would reach it and read nothing. Pair it
|
|
7219
|
+
* with the number it annotates — the shape is context, never the only way to read the
|
|
7220
|
+
* value.
|
|
7221
|
+
*
|
|
7222
|
+
* @example
|
|
7223
|
+
* <Sparkline data={last30Days} />
|
|
7224
|
+
* <Sparkline data={revenue} variant="area" width={120} height={32} />
|
|
7225
|
+
*
|
|
7226
|
+
* // Same axis across a column, so the rows are comparable
|
|
7227
|
+
* <Sparkline data={row.series} min={0} max={columnMax} />
|
|
7228
|
+
*/
|
|
7229
|
+
export declare function Sparkline({ data, width, height, variant, color, showEnd, min, max, valueFormatter, label, className, ...rest }: SparklineProps): JSX.Element;
|
|
7230
|
+
|
|
7231
|
+
export declare interface SparklineProps extends Omit<HTMLAttributes<HTMLSpanElement>, "children"> {
|
|
7232
|
+
/** The series, in order. Non-finite entries are skipped. */
|
|
7233
|
+
data: readonly number[];
|
|
7234
|
+
/** Drawing width in px. Default `88`. */
|
|
7235
|
+
width?: number;
|
|
7236
|
+
/** Drawing height in px. Default `24`. */
|
|
7237
|
+
height?: number;
|
|
7238
|
+
/** Which mark to draw. Default `"line"`. */
|
|
7239
|
+
variant?: SparklineVariant;
|
|
7240
|
+
/** Any CSS colour. Defaults to the first chart series token. */
|
|
7241
|
+
color?: string;
|
|
7242
|
+
/** Draw a dot on the last point. Default `true` for line and area. */
|
|
7243
|
+
showEnd?: boolean;
|
|
7244
|
+
/** Force the low end of the value axis — use it to compare several sparklines. */
|
|
7245
|
+
min?: number;
|
|
7246
|
+
/** Force the high end. */
|
|
7247
|
+
max?: number;
|
|
7248
|
+
/** Render a value; used in the accessible description. */
|
|
7249
|
+
valueFormatter?: (value: number) => string;
|
|
7250
|
+
/**
|
|
7251
|
+
* Accessible name. Defaults to a sentence describing the series.
|
|
7252
|
+
*
|
|
7253
|
+
* Pass one when the surrounding text already says what is plotted — the default
|
|
7254
|
+
* still appends the shape, so a caller never ends up with an unlabelled image.
|
|
7255
|
+
*/
|
|
7256
|
+
label?: string;
|
|
7257
|
+
}
|
|
7258
|
+
|
|
7259
|
+
export declare type SparklineVariant = "line" | "area" | "bar";
|
|
7260
|
+
|
|
6909
7261
|
/**
|
|
6910
7262
|
* Loading spinner with preset sizes (xs..xl). Provide `label` for screen
|
|
6911
7263
|
* readers, `caption` for a visible message, and `overlay` to center it inside a
|
|
@@ -7214,7 +7566,7 @@ export declare interface TabItem {
|
|
|
7214
7566
|
* - `stackOnMobile` re-renders each row as a label/value card on mobile,
|
|
7215
7567
|
* avoiding horizontal scroll for dense data.
|
|
7216
7568
|
*/
|
|
7217
|
-
export declare function Table<T>({ columns, data, rowKey, onRowClick, emptyMessage, className, stackOnMobile, }: TableProps<T>): JSX.Element;
|
|
7569
|
+
export declare function Table<T>({ columns, data, rowKey, onRowClick, emptyMessage, className, stackOnMobile, scrollLabel, }: TableProps<T>): JSX.Element;
|
|
7218
7570
|
|
|
7219
7571
|
export declare type TableAlign = "left" | "right" | "center";
|
|
7220
7572
|
|
|
@@ -7247,6 +7599,12 @@ export declare interface TableProps<T> {
|
|
|
7247
7599
|
* Better than horizontal scroll when each row has 3+ columns of dense data.
|
|
7248
7600
|
*/
|
|
7249
7601
|
stackOnMobile?: boolean;
|
|
7602
|
+
/**
|
|
7603
|
+
* Accessible name for the scrollable region, used only while the table is
|
|
7604
|
+
* actually wider than its box. A focus stop that announces nothing is worse
|
|
7605
|
+
* than no focus stop, so name the table when the page holds several.
|
|
7606
|
+
*/
|
|
7607
|
+
scrollLabel?: string;
|
|
7250
7608
|
}
|
|
7251
7609
|
|
|
7252
7610
|
/**
|
|
@@ -7738,6 +8096,50 @@ export declare type ToggleSize = "sm" | "md" | "lg";
|
|
|
7738
8096
|
|
|
7739
8097
|
export declare type ToggleVariant = "default" | "outline";
|
|
7740
8098
|
|
|
8099
|
+
export declare interface Token {
|
|
8100
|
+
kind: TokenKind;
|
|
8101
|
+
value: string;
|
|
8102
|
+
}
|
|
8103
|
+
|
|
8104
|
+
/**
|
|
8105
|
+
* Split source into coloured tokens.
|
|
8106
|
+
*
|
|
8107
|
+
* This is a **scanner, not a parser**: it recognises comments, strings, numbers,
|
|
8108
|
+
* keywords and punctuation by pattern, and knows nothing about scope, types or
|
|
8109
|
+
* grammar. That is a deliberate ceiling. A real parser per language is a
|
|
8110
|
+
* dependency the size of the rest of the SDK, and the payoff — being right about
|
|
8111
|
+
* the corner cases in a documentation snippet — is small. Where it is unsure it
|
|
8112
|
+
* emits `plain`, which renders as ordinary text rather than as something wrong.
|
|
8113
|
+
*
|
|
8114
|
+
* Unknown languages produce a single `plain` token, so an unhighlighted block is
|
|
8115
|
+
* a normal outcome and never an error.
|
|
8116
|
+
*
|
|
8117
|
+
* @param code - The source.
|
|
8118
|
+
* @param language - Grammar name or alias.
|
|
8119
|
+
* @returns Tokens covering the input exactly, in order.
|
|
8120
|
+
*
|
|
8121
|
+
* @example
|
|
8122
|
+
* tokenize("const x = 1;", "ts");
|
|
8123
|
+
* // [{kind: "keyword", value: "const"}, {kind: "plain", value: " x "}, …]
|
|
8124
|
+
*/
|
|
8125
|
+
export declare function tokenize(code: string, language: string | undefined): Token[];
|
|
8126
|
+
|
|
8127
|
+
/**
|
|
8128
|
+
* The same tokens, split at newlines so each line can be rendered on its own.
|
|
8129
|
+
*
|
|
8130
|
+
* Line numbers and highlighted lines both need a per-line structure, and a token
|
|
8131
|
+
* is free to span a line break — a block comment usually does. Splitting here
|
|
8132
|
+
* keeps that out of the component.
|
|
8133
|
+
*
|
|
8134
|
+
* @param code - The source.
|
|
8135
|
+
* @param language - Grammar name or alias.
|
|
8136
|
+
* @returns One token array per line. Always at least one line.
|
|
8137
|
+
*/
|
|
8138
|
+
export declare function tokenizeLines(code: string, language: string | undefined): Token[][];
|
|
8139
|
+
|
|
8140
|
+
/** What a token is painted as. */
|
|
8141
|
+
export declare type TokenKind = "plain" | "comment" | "string" | "number" | "keyword" | "literal" | "function" | "punctuation" | "tag" | "attribute" | "property";
|
|
8142
|
+
|
|
7741
8143
|
/**
|
|
7742
8144
|
* Lightweight tooltip. Shows on hover and on focus (keyboard-friendly). Wraps
|
|
7743
8145
|
* a single child element via `cloneElement`, so the trigger keeps its own ref
|
|
@@ -9348,6 +9750,41 @@ export { useRouteError }
|
|
|
9348
9750
|
*/
|
|
9349
9751
|
export declare function useScrollLock(active: boolean): void;
|
|
9350
9752
|
|
|
9753
|
+
/**
|
|
9754
|
+
* Track whether an element's content currently overflows its box.
|
|
9755
|
+
*
|
|
9756
|
+
* The use this exists for is keyboard access. A scroll container holding no
|
|
9757
|
+
* focusable content is unreachable by keyboard: the user can see there is more
|
|
9758
|
+
* content past the edge and has no way to get to it, because focus never lands
|
|
9759
|
+
* anywhere the arrow keys would scroll. Giving the container `tabIndex={0}`
|
|
9760
|
+
* fixes it — but doing that unconditionally puts a tab stop on every such
|
|
9761
|
+
* container on the page, including the ones whose content fits and have nothing
|
|
9762
|
+
* to scroll. The stop is only wanted while the overflow is real, which is what
|
|
9763
|
+
* this reports. (It is also what axe checks as `scrollable-region-focusable`.)
|
|
9764
|
+
*
|
|
9765
|
+
* Both the container and its content are observed: content can outgrow a box
|
|
9766
|
+
* whose own dimensions never change, and a box can shrink around content that
|
|
9767
|
+
* never changes. Watching one alone misses half the transitions.
|
|
9768
|
+
*
|
|
9769
|
+
* A one-pixel difference is ignored — that is layout rounding, not overflow.
|
|
9770
|
+
*
|
|
9771
|
+
* @param ref - The scroll container.
|
|
9772
|
+
* @param axis - Which axis to measure. Defaults to `"both"`.
|
|
9773
|
+
* @returns `true` while the content is larger than the box on that axis.
|
|
9774
|
+
*
|
|
9775
|
+
* @example
|
|
9776
|
+
* const ref = useRef<HTMLDivElement>(null);
|
|
9777
|
+
* const scrollable = useScrollOverflow(ref, "horizontal");
|
|
9778
|
+
*
|
|
9779
|
+
* <div
|
|
9780
|
+
* ref={ref}
|
|
9781
|
+
* tabIndex={scrollable ? 0 : undefined}
|
|
9782
|
+
* role={scrollable ? "group" : undefined}
|
|
9783
|
+
* aria-label={scrollable ? "Tabela rolável" : undefined}
|
|
9784
|
+
* >
|
|
9785
|
+
*/
|
|
9786
|
+
export declare function useScrollOverflow(ref: RefObject<HTMLElement | null>, axis?: ScrollOverflowAxis): boolean;
|
|
9787
|
+
|
|
9351
9788
|
export { useSearchParams }
|
|
9352
9789
|
|
|
9353
9790
|
/**
|
|
@@ -9766,7 +10203,7 @@ export declare interface ViaCEPResult {
|
|
|
9766
10203
|
* For variable heights, use `react-window`/`@tanstack/react-virtual` — those
|
|
9767
10204
|
* solve a more general problem at the cost of extra setup.
|
|
9768
10205
|
*/
|
|
9769
|
-
export declare function VirtualList<T>({ items, itemHeight, renderItem, height, overscan, getKey, className, style, }: VirtualListProps<T>): JSX.Element;
|
|
10206
|
+
export declare function VirtualList<T>({ items, itemHeight, renderItem, height, overscan, getKey, className, style, label, }: VirtualListProps<T>): JSX.Element;
|
|
9770
10207
|
|
|
9771
10208
|
export declare interface VirtualListProps<T> {
|
|
9772
10209
|
items: T[];
|
|
@@ -9782,6 +10219,12 @@ export declare interface VirtualListProps<T> {
|
|
|
9782
10219
|
getKey?: (item: T, index: number) => string | number;
|
|
9783
10220
|
className?: string;
|
|
9784
10221
|
style?: CSSProperties;
|
|
10222
|
+
/**
|
|
10223
|
+
* Accessible name for the list. Worth setting when the list scrolls: it
|
|
10224
|
+
* then carries a tab stop of its own, and a focus stop that announces
|
|
10225
|
+
* nothing is worse than no focus stop.
|
|
10226
|
+
*/
|
|
10227
|
+
label?: string;
|
|
9785
10228
|
}
|
|
9786
10229
|
|
|
9787
10230
|
/**
|