@siyahi/ui 0.1.9-next.31 → 0.1.9-next.33
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/DESIGN.md +4 -3
- package/agents/examples/data-table.tsx +4 -1
- package/agents/examples/metric-strip.tsx +2 -0
- package/dist/components/registry/charts/area-chart-card.d.ts +2 -2
- package/dist/components/registry/charts/bar-chart-card.d.ts +4 -4
- package/dist/components/registry/charts/line-chart-card.d.ts +1 -1
- package/dist/components/registry/dashboard-01/section-cards.d.ts +4 -4
- package/dist/components/registry/dashboardcn/bar-list.d.ts +8 -8
- package/dist/components/registry/dashboardcn/distribution-bar.d.ts +11 -11
- package/dist/components/registry/dashboardcn/kpi-row-card.d.ts +5 -3
- package/dist/components/registry/dashboardcn/kpi-row-card.js +1 -0
- package/dist/components/registry/dashboardcn/sparkline.d.ts +6 -6
- package/dist/components/registry/heatmap/calendar-heatmap.d.ts +50 -50
- package/dist/components/registry/heatmap/status-heatmap.d.ts +44 -44
- package/dist/components/registry/heatmap/weekday-heatmap.d.ts +53 -53
- package/dist/components/registry/minidev/copy-button.d.ts +2 -2
- package/dist/components/registry/niko-table/components/data-table-column-actions.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-column-filter.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-empty-state.d.ts +7 -7
- package/dist/components/registry/niko-table/components/data-table-faceted-filter.d.ts +5 -5
- package/dist/components/registry/niko-table/components/data-table-grouped-rows.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-row-context-menu-slot.d.ts +1 -1
- package/dist/components/registry/niko-table/components/data-table-row-context-menu.d.ts +1 -1
- package/dist/components/registry/niko-table/config/feature-detection.d.ts +13 -13
- package/dist/components/registry/niko-table/core/data-table-context.d.ts +5 -5
- package/dist/components/registry/niko-table/core/data-table-error-boundary.d.ts +3 -3
- package/dist/components/registry/niko-table/core/data-table-grouped-row.d.ts +2 -2
- package/dist/components/registry/niko-table/core/data-table-root.d.ts +36 -35
- package/dist/components/registry/niko-table/core/data-table-structure.d.ts +29 -22
- package/dist/components/registry/niko-table/core/data-table-structure.js +9 -5
- package/dist/components/registry/niko-table/core/data-table.d.ts +3 -3
- package/dist/components/registry/niko-table/filters/table-column-actions.d.ts +5 -5
- package/dist/components/registry/niko-table/filters/table-column-sort.d.ts +6 -6
- package/dist/components/registry/niko-table/filters/table-column-title.d.ts +2 -2
- package/dist/components/registry/niko-table/filters/table-faceted-filter.d.ts +9 -9
- package/dist/components/registry/niko-table/filters/table-search-filter.d.ts +7 -7
- package/dist/components/registry/niko-table/hooks/use-generated-options.d.ts +7 -7
- package/dist/components/registry/niko-table/lib/build-faceted-options.d.ts +2 -2
- package/dist/components/registry/niko-table/lib/column-resize-handle.d.ts +3 -3
- package/dist/components/registry/niko-table/lib/create-scroll-handler.d.ts +4 -4
- package/dist/components/registry/niko-table/lib/styles.js +1 -1
- package/dist/components/registry/niko-table/types/index.d.ts +29 -29
- package/dist/components/registry/sidebar-07/app-sidebar.d.ts +6 -5
- package/dist/components/registry/sidebar-07/nav-main.d.ts +4 -4
- package/dist/components/siyahi/callout.d.ts +1 -1
- package/dist/components/siyahi/change-bar.d.ts +3 -3
- package/dist/components/siyahi/change-grid.d.ts +6 -6
- package/dist/components/siyahi/data-bar.d.ts +2 -2
- package/dist/components/siyahi/data-list.d.ts +1 -1
- package/dist/components/siyahi/data-table-row-count.d.ts +1 -1
- package/dist/components/siyahi/data-table-sort-header.d.ts +1 -1
- package/dist/components/siyahi/delta.d.ts +2 -2
- package/dist/components/siyahi/drawdown-chart.d.ts +2 -2
- package/dist/components/siyahi/histogram-chart.d.ts +5 -5
- package/dist/components/siyahi/local-time.d.ts +1 -1
- package/dist/components/siyahi/page-section.d.ts +1 -1
- package/dist/components/siyahi/page-toc.d.ts +2 -2
- package/dist/components/siyahi/panel-grid.d.ts +2 -2
- package/dist/components/siyahi/price-chart.d.ts +1 -1
- package/dist/components/siyahi/range-position.d.ts +5 -5
- package/dist/components/siyahi/scale-toggle.d.ts +2 -2
- package/dist/components/siyahi/scatter-chart.d.ts +15 -15
- package/dist/components/siyahi/siyahi-provider.d.ts +3 -2
- package/dist/components/siyahi/siyahi-provider.js +1 -4
- package/dist/components/siyahi/slope-chart.d.ts +4 -4
- package/dist/components/siyahi/status-alert.d.ts +1 -1
- package/dist/components/siyahi/status-badge.d.ts +1 -1
- package/dist/components/siyahi/target-rows.d.ts +6 -6
- package/dist/components/siyahi/treemap.d.ts +8 -8
- package/dist/components/siyahi/waterfall-chart.d.ts +3 -3
- package/dist/lib/chart-frame.d.ts +13 -13
- package/dist/lib/chart-marks.d.ts +2 -2
- package/dist/lib/chart-series.d.ts +22 -22
- package/dist/lib/format.d.ts +1 -1
- package/dist/lib/optional.d.ts +7 -0
- package/dist/lib/optional.js +0 -0
- package/dist/lib/scatter.d.ts +7 -7
- package/dist/lib/treemap.d.ts +1 -1
- package/package.json +2 -2
- package/styles/siyahi.css +39 -6
|
@@ -38,15 +38,15 @@ export interface HistogramChartCardProps extends Pick<SeriesChartProps<Histogram
|
|
|
38
38
|
/** The raw values, one per item, such as each request's response time. */
|
|
39
39
|
values: readonly number[];
|
|
40
40
|
/** About how many buckets; the width is rounded, so the count varies a little. */
|
|
41
|
-
bins?: number;
|
|
41
|
+
bins?: number | undefined;
|
|
42
42
|
/** Writes the bucket edges and the marks, such as (v) => `${v} ms`. Defaults to the locale's numbers. */
|
|
43
|
-
valueFormatter?: (value: number) => string;
|
|
43
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
44
44
|
/** The bucket edges under the axis, when they should be shorter than valueFormatter: 1,000 against 1,000 ms. */
|
|
45
|
-
tickFormatter?: (value: number) => string;
|
|
45
|
+
tickFormatter?: ((value: number) => string) | undefined;
|
|
46
46
|
/** What is counted, in the legend and tooltip, such as "Requests". */
|
|
47
|
-
countLabel?: string;
|
|
47
|
+
countLabel?: string | undefined;
|
|
48
48
|
/** Percentiles to mark with a line at their bucket; their exact values are written under the chart. */
|
|
49
|
-
marks?: readonly HistogramMark[];
|
|
49
|
+
marks?: readonly HistogramMark[] | undefined;
|
|
50
50
|
}
|
|
51
51
|
/**
|
|
52
52
|
* How values spread: counts in buckets of one round width, such as response times by 50 ms, with the median or a
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
export interface LocalTimeProps {
|
|
3
3
|
value: Date | number | string;
|
|
4
4
|
/** Write the date, in the same zone, before the time: 20 Oct 2026, 14:30 IST. */
|
|
5
|
-
withDate?: boolean;
|
|
5
|
+
withDate?: boolean | undefined;
|
|
6
6
|
}
|
|
7
7
|
/** A time in the configured zone (14:30 IST), with the viewer's own clock in a tooltip. */
|
|
8
8
|
export declare function LocalTime({ value, withDate }: LocalTimeProps): import("react").JSX.Element;
|
|
@@ -2,7 +2,7 @@ import { ReactNode } from "react";
|
|
|
2
2
|
//#region src/components/siyahi/page-section.d.ts
|
|
3
3
|
export interface PageSectionProps {
|
|
4
4
|
/** Anchor for a table of contents; the section scrolls in with room above it. */
|
|
5
|
-
id?: string;
|
|
5
|
+
id?: string | undefined;
|
|
6
6
|
/** Small muted line above the title, such as "Part 2". */
|
|
7
7
|
eyebrow?: ReactNode;
|
|
8
8
|
title: ReactNode;
|
|
@@ -7,9 +7,9 @@ export interface PageTocItem {
|
|
|
7
7
|
export interface PageTocProps {
|
|
8
8
|
items: PageTocItem[];
|
|
9
9
|
/** Names the navigation for screen readers. */
|
|
10
|
-
label?: string;
|
|
10
|
+
label?: string | undefined;
|
|
11
11
|
/** Layout only, such as `top-14` under a sticky page header. */
|
|
12
|
-
className?: string;
|
|
12
|
+
className?: string | undefined;
|
|
13
13
|
}
|
|
14
14
|
/**
|
|
15
15
|
* A long page's sections as one sticky "On this page" index. It stays at the top while the reader scrolls,
|
|
@@ -8,9 +8,9 @@ declare const COLUMNS: {
|
|
|
8
8
|
};
|
|
9
9
|
export interface PanelGridProps {
|
|
10
10
|
/** Blocks across on a wide page; two on a medium one, and one on a phone. */
|
|
11
|
-
columns?: keyof typeof COLUMNS;
|
|
11
|
+
columns?: keyof typeof COLUMNS | undefined;
|
|
12
12
|
children: ReactNode;
|
|
13
|
-
className?: string;
|
|
13
|
+
className?: string | undefined;
|
|
14
14
|
}
|
|
15
15
|
/**
|
|
16
16
|
* Data blocks side by side: chart cards, tables, a MetricStrip. On a ruled surface, the default, the grid is filled
|
|
@@ -5,7 +5,7 @@ export interface PriceChartProps {
|
|
|
5
5
|
/** Fixed height in pixels. */
|
|
6
6
|
height: number;
|
|
7
7
|
/** TradingView's licence asks for a credit on the page; turn it off on the second chart. */
|
|
8
|
-
credit?: boolean;
|
|
8
|
+
credit?: boolean | undefined;
|
|
9
9
|
}
|
|
10
10
|
/** A TradingView Lightweight Charts price chart in the theme's colours, redrawn when the scheme changes. */
|
|
11
11
|
export declare function PriceChart({ data, height, credit }: PriceChartProps): import("react").JSX.Element;
|
|
@@ -5,15 +5,15 @@ export interface RangePositionProps {
|
|
|
5
5
|
high: number;
|
|
6
6
|
value: number;
|
|
7
7
|
/** Names the low end: "52-week low". */
|
|
8
|
-
lowLabel?: string;
|
|
9
|
-
highLabel?: string;
|
|
8
|
+
lowLabel?: string | undefined;
|
|
9
|
+
highLabel?: string | undefined;
|
|
10
10
|
/** Follows the percentage in the full variant: "of the way up the 52-week range". */
|
|
11
11
|
caption?: ReactNode;
|
|
12
12
|
/** Writes low, high and value; useFormat().money by default. */
|
|
13
|
-
valueFormatter?: (value: number) => string;
|
|
13
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
14
14
|
/** compact fits a table cell: the ends' figures either side of the track, nothing above it. */
|
|
15
|
-
variant?: "full" | "compact";
|
|
16
|
-
className?: string;
|
|
15
|
+
variant?: "full" | "compact" | undefined;
|
|
16
|
+
className?: string | undefined;
|
|
17
17
|
}
|
|
18
18
|
/**
|
|
19
19
|
* How far a value sits between a low and a high, such as a price in its 52-week range: a track filled to the value
|
|
@@ -7,11 +7,11 @@ export interface ScaleToggleProps {
|
|
|
7
7
|
/** The group's accessible name, such as "Share of book scale". */
|
|
8
8
|
label: string;
|
|
9
9
|
/** The axis' name shown before the buttons, for a card with a toggle on each axis. */
|
|
10
|
-
caption?: string;
|
|
10
|
+
caption?: string | undefined;
|
|
11
11
|
value: AxisScale;
|
|
12
12
|
onValueChange: (scale: AxisScale) => void;
|
|
13
13
|
/** Why log cannot draw this data, such as a value at or below zero: Log is disabled and this shows beside it. */
|
|
14
|
-
logBlocked?: string;
|
|
14
|
+
logBlocked?: string | undefined;
|
|
15
15
|
}
|
|
16
16
|
/** Linear and Log buttons for one chart axis, in the header's toggle style. */
|
|
17
17
|
export declare function ScaleToggle({ label, caption, value, onValueChange, logBlocked }: ScaleToggleProps): import("react").JSX.Element;
|
|
@@ -9,12 +9,12 @@ export interface ScatterPoint {
|
|
|
9
9
|
/** Up. `null` when unknown: the point is not drawn, so say on the page how many are missing. */
|
|
10
10
|
y: number | null;
|
|
11
11
|
/** Unique key when names repeat, such as one product sold in two regions. Defaults to `name`. */
|
|
12
|
-
key?: string;
|
|
12
|
+
key?: string | undefined;
|
|
13
13
|
/**
|
|
14
14
|
* A weight, such as a holding's value: the dot's area follows it. Give every point a size, or none. A size that is
|
|
15
15
|
* not a positive number draws the smallest dot and leaves the others' sizes as they are.
|
|
16
16
|
*/
|
|
17
|
-
size?: number;
|
|
17
|
+
size?: number | undefined;
|
|
18
18
|
}
|
|
19
19
|
/** One tooltip row: a label and its figure, such as ["Sales", "₹9.8L"]. */
|
|
20
20
|
export type ScatterDetail = readonly [label: string, value: string];
|
|
@@ -35,33 +35,33 @@ export interface ScatterChartCardProps<T extends ScatterPoint> {
|
|
|
35
35
|
* "log" spreads values across powers of ten, for sizes that run from tiny to large. With xScaleToggle it is the
|
|
36
36
|
* first selection. Log draws only when every x is above zero; otherwise the axis is linear.
|
|
37
37
|
*/
|
|
38
|
-
xScale?: AxisScale;
|
|
38
|
+
xScale?: AxisScale | undefined;
|
|
39
39
|
/** Linear and Log buttons for the x axis in the header, so a reader can switch. */
|
|
40
|
-
xScaleToggle?: boolean;
|
|
40
|
+
xScaleToggle?: boolean | undefined;
|
|
41
41
|
/** As xScale, for the y axis: log draws only when every y is above zero. */
|
|
42
|
-
yScale?: AxisScale;
|
|
42
|
+
yScale?: AxisScale | undefined;
|
|
43
43
|
/** Linear and Log buttons for the y axis in the header. */
|
|
44
|
-
yScaleToggle?: boolean;
|
|
44
|
+
yScaleToggle?: boolean | undefined;
|
|
45
45
|
/** The x ticks and the tooltip's x figure. Defaults to the locale's numbers. */
|
|
46
|
-
xFormatter?: (value: number) => string;
|
|
46
|
+
xFormatter?: ((value: number) => string) | undefined;
|
|
47
47
|
/** The y ticks and the tooltip's y figure. Defaults to the locale's numbers. */
|
|
48
|
-
yFormatter?: (value: number) => string;
|
|
48
|
+
yFormatter?: ((value: number) => string) | undefined;
|
|
49
49
|
/** How many points get their name beside the dot, at most; a name with no free spot is left to the tooltip. */
|
|
50
|
-
labels?: number;
|
|
50
|
+
labels?: number | undefined;
|
|
51
51
|
/** The tooltip's rows under the point's name, and what a screen reader hears. Defaults to the two axes' figures. */
|
|
52
|
-
details?: (point: T) => readonly ScatterDetail[];
|
|
52
|
+
details?: ((point: T) => readonly ScatterDetail[]) | undefined;
|
|
53
53
|
/** The point that carries a ring, matched by key; pass back what onSelect gave. */
|
|
54
|
-
selected?: T | null;
|
|
54
|
+
selected?: T | null | undefined;
|
|
55
55
|
/** Gets a tapped or keyed point, and null on a second tap, Escape or a tap on the plot. */
|
|
56
|
-
onSelect?: (point: T | null) => void;
|
|
56
|
+
onSelect?: ((point: T | null) => void) | undefined;
|
|
57
57
|
/** Lines under the chart, such as a caption or how many points are not drawn. */
|
|
58
58
|
footer?: ReactNode;
|
|
59
59
|
/** Dashed lines at a value on each axis, splitting the plot into four, and the corners' names. */
|
|
60
|
-
quadrants?: ScatterQuadrants;
|
|
60
|
+
quadrants?: ScatterQuadrants | undefined;
|
|
61
61
|
/** Names the size in the tooltip, such as "Value". Defaults to "Size". */
|
|
62
|
-
sizeLabel?: string;
|
|
62
|
+
sizeLabel?: string | undefined;
|
|
63
63
|
/** The tooltip's size figure. Defaults to the locale's numbers. */
|
|
64
|
-
sizeFormatter?: (value: number) => string;
|
|
64
|
+
sizeFormatter?: ((value: number) => string) | undefined;
|
|
65
65
|
}
|
|
66
66
|
/** Two measures per item as dots, such as size against growth, with the leading names beside their dots. */
|
|
67
67
|
export declare function ScatterChartCard<T extends ScatterPoint>({ title, description, action, points, height, xLabel, yLabel, xScale, xScaleToggle, yScale, yScaleToggle, xFormatter, yFormatter, labels, details, selected, onSelect, footer, quadrants, sizeLabel, sizeFormatter }: ScatterChartCardProps<T>): import("react").JSX.Element;
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { Optional } from "../../lib/optional.js";
|
|
1
2
|
import { SiyahiLocale } from "../../lib/locale.js";
|
|
2
3
|
import { ReactNode } from "react";
|
|
3
4
|
//#region src/components/siyahi/siyahi-provider.d.ts
|
|
@@ -10,12 +11,12 @@ import { ReactNode } from "react";
|
|
|
10
11
|
export type Surface = "ruled" | "card" | "open";
|
|
11
12
|
export interface SiyahiProviderProps {
|
|
12
13
|
/** Any setting left out keeps its default: en-IN, INR, Asia/Kolkata. */
|
|
13
|
-
locale?:
|
|
14
|
+
locale?: Optional<SiyahiLocale> | undefined;
|
|
14
15
|
/**
|
|
15
16
|
* Set it on a nested provider for one part of a page. Left out, a provider keeps the surface around it, so a
|
|
16
17
|
* provider that only changes the locale changes nothing else; the outermost default is "ruled".
|
|
17
18
|
*/
|
|
18
|
-
surface?: Surface;
|
|
19
|
+
surface?: Surface | undefined;
|
|
19
20
|
children: ReactNode;
|
|
20
21
|
}
|
|
21
22
|
/** Wrap the app once. Carries the locale, the surface and the tooltip provider shadcn asks for. */
|
|
@@ -7,10 +7,7 @@ const LocaleContext = createContext(defaultLocale);
|
|
|
7
7
|
const SurfaceContext = createContext("ruled");
|
|
8
8
|
/** Wrap the app once. Carries the locale, the surface and the tooltip provider shadcn asks for. */
|
|
9
9
|
function SiyahiProvider({ locale, surface, children }) {
|
|
10
|
-
const { numberLocale, currency, timeZone } = {
|
|
11
|
-
...defaultLocale,
|
|
12
|
-
...locale
|
|
13
|
-
};
|
|
10
|
+
const { numberLocale = defaultLocale.numberLocale, currency = defaultLocale.currency, timeZone = defaultLocale.timeZone } = locale ?? {};
|
|
14
11
|
const value = useMemo(() => ({
|
|
15
12
|
numberLocale,
|
|
16
13
|
currency,
|
|
@@ -6,7 +6,7 @@ export interface SlopeItem {
|
|
|
6
6
|
/** The value on the right: after, or our own figure. */
|
|
7
7
|
to: number;
|
|
8
8
|
/** Unique key when names repeat. Defaults to `name`. */
|
|
9
|
-
key?: string;
|
|
9
|
+
key?: string | undefined;
|
|
10
10
|
}
|
|
11
11
|
export interface SlopeChartProps {
|
|
12
12
|
/** An item whose from or to is not a finite number is not drawn: say on the page how many are left out. */
|
|
@@ -16,10 +16,10 @@ export interface SlopeChartProps {
|
|
|
16
16
|
/** Heads the right side, such as "Portfolio" or "2026". */
|
|
17
17
|
toLabel: string;
|
|
18
18
|
/** Keys (or names) of the items to draw in the accent colour; the rest stay grey. */
|
|
19
|
-
highlighted?: readonly string[];
|
|
19
|
+
highlighted?: readonly string[] | undefined;
|
|
20
20
|
/** Writes each end's value; useFormat().pct by default. */
|
|
21
|
-
valueFormatter?: (value: number) => string;
|
|
22
|
-
className?: string;
|
|
21
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
22
|
+
className?: string | undefined;
|
|
23
23
|
}
|
|
24
24
|
/**
|
|
25
25
|
* Pushes labels apart so none sits closer than `gap` to the next, keeping their order and staying inside [min, max]:
|
|
@@ -4,7 +4,7 @@ import { ComponentProps } from "react";
|
|
|
4
4
|
//#region src/components/siyahi/status-alert.d.ts
|
|
5
5
|
export interface StatusAlertProps extends Omit<ComponentProps<typeof Alert>, "variant"> {
|
|
6
6
|
/** neutral for information, warning for a caution, negative for an error, positive for a success. */
|
|
7
|
-
tone?: Tone;
|
|
7
|
+
tone?: Tone | undefined;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A notice the reader must not miss: the whole card takes its tone, a faint wash inside a border of the same colour,
|
|
@@ -4,7 +4,7 @@ import { ComponentProps } from "react";
|
|
|
4
4
|
//#region src/components/siyahi/status-badge.d.ts
|
|
5
5
|
export interface StatusBadgeProps extends Omit<ComponentProps<typeof Badge>, "variant"> {
|
|
6
6
|
/** positive for done or paid, warning for pending, negative for failed, accent for new, neutral for a draft. */
|
|
7
|
-
tone?: Tone;
|
|
7
|
+
tone?: Tone | undefined;
|
|
8
8
|
}
|
|
9
9
|
/**
|
|
10
10
|
* A state, such as Paid, Pending or Failed: the badge takes its tone's wash and border, and a dot in the tone's
|
|
@@ -13,18 +13,18 @@ export interface TargetRow {
|
|
|
13
13
|
value: number;
|
|
14
14
|
target: number;
|
|
15
15
|
/** Qualitative ranges behind the bar as [from, to]; each later band draws a grey step darker, so nest them. */
|
|
16
|
-
bands?: [number, number][];
|
|
17
|
-
status?: TargetStatus;
|
|
16
|
+
bands?: [number, number][] | undefined;
|
|
17
|
+
status?: TargetStatus | undefined;
|
|
18
18
|
/** Tells rows apart when labels are not plain unique text. */
|
|
19
|
-
key?: string;
|
|
19
|
+
key?: string | undefined;
|
|
20
20
|
}
|
|
21
21
|
export interface TargetRowsProps {
|
|
22
22
|
rows: TargetRow[];
|
|
23
23
|
/** The scale every row shares; by default 0 to the largest value, target or band edge. */
|
|
24
|
-
domain?: [number, number];
|
|
24
|
+
domain?: [number, number] | undefined;
|
|
25
25
|
/** Writes the value and the target; useFormat().count by default. */
|
|
26
|
-
valueFormatter?: (value: number) => string;
|
|
27
|
-
className?: string;
|
|
26
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
27
|
+
className?: string | undefined;
|
|
28
28
|
}
|
|
29
29
|
/**
|
|
30
30
|
* Bullet rows: each row's label, value and status beside a track where the value is a solid bar, the target a tall
|
|
@@ -6,35 +6,35 @@ export interface TreemapItem {
|
|
|
6
6
|
/** Signed change as a fraction; sets the heat. `null` when unknown: a muted tile marked "—". */
|
|
7
7
|
change: number | null;
|
|
8
8
|
/** Unique key when names repeat, such as one city sold to online and in stores. Defaults to `name`. */
|
|
9
|
-
key?: string;
|
|
9
|
+
key?: string | undefined;
|
|
10
10
|
/** Tiles of one group, such as a region, sit together under the group's name, even a group of one. */
|
|
11
|
-
group?: string;
|
|
11
|
+
group?: string | undefined;
|
|
12
12
|
}
|
|
13
13
|
export interface TreemapProps<T extends TreemapItem> {
|
|
14
14
|
items: T[];
|
|
15
15
|
height: number;
|
|
16
16
|
/** ±range: the change, as a fraction, that takes the deepest heat step. Default 0.05 (±5%); a range that is not a positive number uses the default. */
|
|
17
|
-
range?: number;
|
|
17
|
+
range?: number | undefined;
|
|
18
18
|
/**
|
|
19
19
|
* Gets the item under a mouse, and null when it moves onto a group's name or leaves the map. A tap fires no hover:
|
|
20
20
|
* on a touch screen it selects, so the page shows the tile in place rather than in a card at the finger.
|
|
21
21
|
*/
|
|
22
|
-
onHover?: (item: T | null) => void;
|
|
22
|
+
onHover?: ((item: T | null) => void) | undefined;
|
|
23
23
|
/** The selected item, matched by key, whose tile carries a ring. Pass back what onSelect gave. */
|
|
24
|
-
selected?: T | null;
|
|
24
|
+
selected?: T | null | undefined;
|
|
25
25
|
/**
|
|
26
26
|
* Gets the item whose tile is tapped or clicked, and null when the selected
|
|
27
27
|
* tile is tapped again or a tap lands anywhere else. On a touch screen, which
|
|
28
28
|
* has no hover, this is how a reader gets a tile's figures.
|
|
29
29
|
*/
|
|
30
|
-
onSelect?: (item: T | null) => void;
|
|
30
|
+
onSelect?: ((item: T | null) => void) | undefined;
|
|
31
31
|
}
|
|
32
32
|
/** Heat map of parts of a whole: area by weight, colour by signed change, optionally grouped; hand-drawn SVG. */
|
|
33
33
|
export declare function Treemap<T extends TreemapItem>({ items, height, range, onHover, selected, onSelect }: TreemapProps<T>): import("react").JSX.Element;
|
|
34
34
|
export interface TreemapLegendProps {
|
|
35
35
|
/** The Treemap's own range, so each swatch matches its tiles. */
|
|
36
|
-
range?: number;
|
|
37
|
-
className?: string;
|
|
36
|
+
range?: number | undefined;
|
|
37
|
+
className?: string | undefined;
|
|
38
38
|
}
|
|
39
39
|
/** The Treemap's colour scale under the map: five steps of loss, no change, five steps of gain, deepest at the ends. */
|
|
40
40
|
export declare function TreemapLegend({ range, className }: TreemapLegendProps): import("react").JSX.Element;
|
|
@@ -12,7 +12,7 @@ export type WaterfallStep = {
|
|
|
12
12
|
} | {
|
|
13
13
|
kind: "total";
|
|
14
14
|
label: string;
|
|
15
|
-
value?: number;
|
|
15
|
+
value?: number | undefined;
|
|
16
16
|
};
|
|
17
17
|
/** A step as drawn: the running total after it, and the span its bar covers. */
|
|
18
18
|
export interface WaterfallBar {
|
|
@@ -35,13 +35,13 @@ export interface WaterfallChartCardProps extends Pick<SeriesChartProps<Waterfall
|
|
|
35
35
|
/** The bars in order: usually a total to start from, the changes, and a total to end on. */
|
|
36
36
|
steps: readonly WaterfallStep[];
|
|
37
37
|
/** Bars run sideways with the labels down the left, for long names such as product categories. */
|
|
38
|
-
horizontal?: boolean;
|
|
38
|
+
horizontal?: boolean | undefined;
|
|
39
39
|
/** What the legend calls each kind of bar. */
|
|
40
40
|
labels?: {
|
|
41
41
|
rise: string;
|
|
42
42
|
fall: string;
|
|
43
43
|
total: string;
|
|
44
|
-
};
|
|
44
|
+
} | undefined;
|
|
45
45
|
}
|
|
46
46
|
/**
|
|
47
47
|
* A running total bridged step by step: where it starts, each change that moved it, and where it ends, such as a
|
|
@@ -24,7 +24,7 @@ export declare function QuietLegend<T>({ series, raisable, raised, onRaise }: Qu
|
|
|
24
24
|
interface ChartFrameProps<T extends object, K extends keyof T> extends Omit<SeriesChartProps<T, K>, "yDomain">, NumericXProps, ValueScaleProps, LineMarksProps<T, K> {
|
|
25
25
|
chart: typeof AreaChart | typeof BarChart | typeof LineChart;
|
|
26
26
|
/** The value axis' range: a page's fixed one, or a card's rule such as bars reaching zero. */
|
|
27
|
-
yDomain?: YAxisProps["domain"];
|
|
27
|
+
yDomain?: YAxisProps["domain"] | undefined;
|
|
28
28
|
/** One Bar, Area or Line per series. */
|
|
29
29
|
children: ReactNode;
|
|
30
30
|
/**
|
|
@@ -32,22 +32,22 @@ interface ChartFrameProps<T extends object, K extends keyof T> extends Omit<Seri
|
|
|
32
32
|
* chart-bar-horizontal. The value axis runs along the bottom when yTickFormatter is given, and is hidden
|
|
33
33
|
* otherwise. x and y keep their meaning: x is the category, y the value.
|
|
34
34
|
*/
|
|
35
|
-
horizontal?: boolean;
|
|
35
|
+
horizontal?: boolean | undefined;
|
|
36
36
|
/** "sign" stacks negative values below zero and positive ones above, rather than on one running total. */
|
|
37
|
-
stackOffset?: "sign";
|
|
38
|
-
onClick?: ComponentProps<typeof BarChart>["onClick"];
|
|
37
|
+
stackOffset?: "sign" | undefined;
|
|
38
|
+
onClick?: ComponentProps<typeof BarChart>["onClick"] | undefined;
|
|
39
39
|
/** A tooltip row per hovered mark; by default each series' colour, label and formatted value (seriesRow). */
|
|
40
|
-
tooltipRow?: ComponentProps<typeof ChartTooltipContent>["formatter"];
|
|
40
|
+
tooltipRow?: ComponentProps<typeof ChartTooltipContent>["formatter"] | undefined;
|
|
41
41
|
/** The legend under the plot; by default one chip per series. */
|
|
42
|
-
legend?: ReactElement;
|
|
42
|
+
legend?: ReactElement | undefined;
|
|
43
43
|
/** Why this chart cannot go on a log scale whatever its values, such as stacked areas adding up from zero. */
|
|
44
|
-
logBlocked?: string;
|
|
44
|
+
logBlocked?: string | undefined;
|
|
45
45
|
/** The marks are lines (a line chart, unstacked areas): name each series at its line's end, where there is room. */
|
|
46
|
-
endLabels?: boolean;
|
|
46
|
+
endLabels?: boolean | undefined;
|
|
47
47
|
/** Hatch a forecast stretch, behind lines that sit on card halos; a stack's fills cover it already. */
|
|
48
|
-
forecastHatch?: boolean;
|
|
48
|
+
forecastHatch?: boolean | undefined;
|
|
49
49
|
/** The lines' curve, which a grey line raised from the legend is drawn with too. */
|
|
50
|
-
curve?: ChartCurve;
|
|
50
|
+
curve?: ChartCurve | undefined;
|
|
51
51
|
}
|
|
52
52
|
/**
|
|
53
53
|
* The colour a series' Bar takes, which its legend chip shows: the negative colour when every value drawn is below
|
|
@@ -59,9 +59,9 @@ export declare function seriesFill<T>(item: ChartSeriesItem<T>, data: readonly T
|
|
|
59
59
|
* grid, and none elsewhere. The eye lands on now, where a reader starts.
|
|
60
60
|
*/
|
|
61
61
|
export declare function endDot(color: ChartColor, count: number, hollow?: boolean): ({ cx, cy, index }: {
|
|
62
|
-
cx?: number;
|
|
63
|
-
cy?: number;
|
|
64
|
-
index?: number;
|
|
62
|
+
cx?: number | undefined;
|
|
63
|
+
cy?: number | undefined;
|
|
64
|
+
index?: number | undefined;
|
|
65
65
|
}) => import("react").JSX.Element;
|
|
66
66
|
/** A tooltip row: the series' colour and label, then its value as the page formats it, or — when the row has none. */
|
|
67
67
|
export declare function seriesRow<T>(series: ChartSeries<T>, formatValue: (value: number) => string): (value: unknown, _name: unknown, item: {
|
|
@@ -65,9 +65,9 @@ interface TimeMarksProps<T extends object, K extends keyof T> {
|
|
|
65
65
|
data: readonly T[];
|
|
66
66
|
xKey: K;
|
|
67
67
|
/** The x value from which the data is a forecast. */
|
|
68
|
-
forecastFrom?: T[K];
|
|
68
|
+
forecastFrom?: T[K] | undefined;
|
|
69
69
|
/** The x value of today. */
|
|
70
|
-
today?: T[K];
|
|
70
|
+
today?: T[K] | undefined;
|
|
71
71
|
/** Prefix of the clip paths the series' actual and forecast copies use (`<id>-actual`, `<id>-forecast`). */
|
|
72
72
|
clipId: string;
|
|
73
73
|
/** Hatch the forecast stretch; a stack's fills already cover it, so a stacked chart only labels it. */
|
|
@@ -14,7 +14,7 @@ export interface ChartSeriesItem<T> {
|
|
|
14
14
|
label: string;
|
|
15
15
|
color: ChartColor;
|
|
16
16
|
/** A bar below zero takes this colour instead, such as var(--negative) for a loss beside var(--positive). */
|
|
17
|
-
negativeColor?: ChartColor;
|
|
17
|
+
negativeColor?: ChartColor | undefined;
|
|
18
18
|
}
|
|
19
19
|
/**
|
|
20
20
|
* The series in draw, stack and legend order; give the slots in order from
|
|
@@ -28,16 +28,16 @@ export type ChartSeries<T> = readonly ChartSeriesItem<T>[];
|
|
|
28
28
|
*/
|
|
29
29
|
export type ChartReferenceLine = ({
|
|
30
30
|
y: number;
|
|
31
|
-
x?: never;
|
|
31
|
+
x?: never | undefined;
|
|
32
32
|
} | {
|
|
33
33
|
x: number | string;
|
|
34
|
-
y?: never;
|
|
34
|
+
y?: never | undefined;
|
|
35
35
|
}) & {
|
|
36
|
-
label?: string;
|
|
36
|
+
label?: string | undefined;
|
|
37
37
|
/** "strong" draws it in the text colour, for the line that matters most; "muted" by default. */
|
|
38
|
-
emphasis?: "muted" | "strong";
|
|
38
|
+
emphasis?: "muted" | "strong" | undefined;
|
|
39
39
|
/** Where the label sits against the line. Defaults to insideTopLeft. */
|
|
40
|
-
labelPosition?: "insideTopLeft" | "insideTopRight" | "insideBottomLeft" | "insideBottomRight";
|
|
40
|
+
labelPosition?: "insideTopLeft" | "insideTopRight" | "insideBottomLeft" | "insideBottomRight" | undefined;
|
|
41
41
|
};
|
|
42
42
|
/** What BarChartCard, AreaChartCard and LineChartCard all take. */
|
|
43
43
|
export interface SeriesChartProps<T extends object, K extends keyof T> {
|
|
@@ -51,35 +51,35 @@ export interface SeriesChartProps<T extends object, K extends keyof T> {
|
|
|
51
51
|
xKey: K;
|
|
52
52
|
series: ChartSeries<NoInfer<T>>;
|
|
53
53
|
/** Categories to label, or tick positions with xDomain. Every named tick is drawn; other rows keep their marks and tooltips. */
|
|
54
|
-
xTicks?: readonly T[K][];
|
|
54
|
+
xTicks?: readonly T[K][] | undefined;
|
|
55
55
|
/** The x axis ticks, and the tooltip's heading unless xTooltipFormatter is set. Defaults to the value as text. */
|
|
56
|
-
xFormatter?: (value: T[K]) => string;
|
|
56
|
+
xFormatter?: ((value: T[K]) => string) | undefined;
|
|
57
57
|
/** The tooltip's heading, when it should say more than a tick: "19:34:13 IST, 10 s average" against "19:34". */
|
|
58
|
-
xTooltipFormatter?: (value: T[K]) => string;
|
|
58
|
+
xTooltipFormatter?: ((value: T[K]) => string) | undefined;
|
|
59
59
|
/** A series' value in the tooltip, and the y axis unless yTickFormatter is set. Defaults to the locale's numbers. */
|
|
60
|
-
valueFormatter?: (value: number) => string;
|
|
60
|
+
valueFormatter?: ((value: number) => string) | undefined;
|
|
61
61
|
/**
|
|
62
62
|
* The y axis, when its ticks should be shorter than the tooltip's figures: moneyCompact against money. It gets the
|
|
63
63
|
* axis' largest tick as `scale`, so moneyCompact writes every tick in one unit.
|
|
64
64
|
*/
|
|
65
|
-
yTickFormatter?: (value: number, scale: number) => string;
|
|
65
|
+
yTickFormatter?: ((value: number, scale: number) => string) | undefined;
|
|
66
66
|
/**
|
|
67
67
|
* A fixed range for the value axis, such as [0, 100] for a percentage. By default it fits the data; a bar
|
|
68
68
|
* chart's always reaches zero.
|
|
69
69
|
*/
|
|
70
|
-
yDomain?: [number, number];
|
|
70
|
+
yDomain?: [number, number] | undefined;
|
|
71
71
|
/** Where the value axis puts its ticks, such as [0, 25, 50, 75, 100]. */
|
|
72
|
-
yTicks?: readonly number[];
|
|
72
|
+
yTicks?: readonly number[] | undefined;
|
|
73
73
|
/** Height of the plot and legend, in pixels. Sideways bars grow when wrapped tick details need more room. */
|
|
74
74
|
height: number;
|
|
75
75
|
/** A second line under each x tick, so a row's figure reads without a hover: "FY24" then "+₹1.2L". */
|
|
76
|
-
xTickDetail?: (row: T) => string;
|
|
76
|
+
xTickDetail?: ((row: T) => string) | undefined;
|
|
77
77
|
/** A title under the x axis, such as "Hour of day (IST)". Not drawn on sideways bars. */
|
|
78
|
-
xLabel?: string;
|
|
78
|
+
xLabel?: string | undefined;
|
|
79
79
|
/** A title beside the value axis, read bottom to top, such as "Orders". Not drawn on sideways bars. */
|
|
80
|
-
yLabel?: string;
|
|
80
|
+
yLabel?: string | undefined;
|
|
81
81
|
/** Limits and events to mark on the plot. A zero line draws by itself when a value goes below zero. */
|
|
82
|
-
referenceLines?: readonly ChartReferenceLine[];
|
|
82
|
+
referenceLines?: readonly ChartReferenceLine[] | undefined;
|
|
83
83
|
/** Shown in the plot's place, at its height, while the data loads or after it failed to. */
|
|
84
84
|
placeholder?: ReactNode;
|
|
85
85
|
/** Lines under the chart, such as a caption or a takeaway, in the card's footer. */
|
|
@@ -96,14 +96,14 @@ export interface LineMarksProps<T extends object, K extends keyof T> {
|
|
|
96
96
|
* The x value from which the data is a forecast, such as the last month-end: each line goes dashed from it, a faint
|
|
97
97
|
* hatched band labelled FORECAST covers the stretch, and the end dots are hollow.
|
|
98
98
|
*/
|
|
99
|
-
forecastFrom?: NoInfer<T[K]
|
|
99
|
+
forecastFrom?: NoInfer<T[K]> | undefined;
|
|
100
100
|
/** The x value of today: a 1px rule in the link colour with a small TODAY label. */
|
|
101
|
-
today?: NoInfer<T[K]
|
|
101
|
+
today?: NoInfer<T[K]> | undefined;
|
|
102
102
|
}
|
|
103
103
|
/** A numeric x axis, for samples in time or any measure where a mark can sit between two rows. */
|
|
104
104
|
export interface NumericXProps {
|
|
105
105
|
/** The x axis runs over this range of the xKey field, which must hold numbers; without it the axis is one slot per row. */
|
|
106
|
-
xDomain?: [number, number];
|
|
106
|
+
xDomain?: [number, number] | undefined;
|
|
107
107
|
}
|
|
108
108
|
/** A value axis that may run on a log scale: lines and areas, which need not start at zero as bars must. */
|
|
109
109
|
export interface ValueScaleProps {
|
|
@@ -112,9 +112,9 @@ export interface ValueScaleProps {
|
|
|
112
112
|
* yScaleToggle is set. Log draws only when every value, and yDomain, is above zero; otherwise the axis is linear.
|
|
113
113
|
* On log the axis ticks at 1, 2 and 5 inside yDomain, if given, and yTicks is not used.
|
|
114
114
|
*/
|
|
115
|
-
yScale?: AxisScale;
|
|
115
|
+
yScale?: AxisScale | undefined;
|
|
116
116
|
/** Linear and Log buttons for the value axis in the header, after the action, so a reader can switch. */
|
|
117
|
-
yScaleToggle?: boolean;
|
|
117
|
+
yScaleToggle?: boolean | undefined;
|
|
118
118
|
}
|
|
119
119
|
/**
|
|
120
120
|
* How a line or an area's edge joins its points: "linear" draws straight segments, as measured samples should
|
package/dist/lib/format.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ export declare function count(value: number, locale?: SiyahiLocale): string;
|
|
|
19
19
|
export declare function pct(value: number, locale?: SiyahiLocale, fractionDigits?: number): string;
|
|
20
20
|
export interface TimeOptions {
|
|
21
21
|
/** Write the date, in the same zone, before the time: 20 Oct 2026, 14:30 IST. */
|
|
22
|
-
withDate?: boolean;
|
|
22
|
+
withDate?: boolean | undefined;
|
|
23
23
|
}
|
|
24
24
|
/** A 24-hour time in the locale's zone, with the zone written: 14:30 IST. */
|
|
25
25
|
export declare function time(value: Date | number | string, locale?: SiyahiLocale, { withDate }?: TimeOptions): string;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
//#region src/lib/optional.d.ts
|
|
2
|
+
/**
|
|
3
|
+
* Every prop of T optional and taking undefined too, where `Partial<T>` under exactOptionalPropertyTypes takes only
|
|
4
|
+
* a missing prop: for settings a page passes some of, such as `locale={{ currency: usd ? "USD" : undefined }}`.
|
|
5
|
+
*/
|
|
6
|
+
export type Optional<T> = { [K in keyof T]?: T[K] | undefined; };
|
|
7
|
+
//#endregion
|
|
File without changes
|
package/dist/lib/scatter.d.ts
CHANGED
|
@@ -42,11 +42,11 @@ export interface ScatterQuadrants {
|
|
|
42
42
|
x: number;
|
|
43
43
|
y: number;
|
|
44
44
|
labels?: {
|
|
45
|
-
topLeft?: string;
|
|
46
|
-
topRight?: string;
|
|
47
|
-
bottomLeft?: string;
|
|
48
|
-
bottomRight?: string;
|
|
49
|
-
};
|
|
45
|
+
topLeft?: string | undefined;
|
|
46
|
+
topRight?: string | undefined;
|
|
47
|
+
bottomLeft?: string | undefined;
|
|
48
|
+
bottomRight?: string | undefined;
|
|
49
|
+
} | undefined;
|
|
50
50
|
}
|
|
51
51
|
export type QuadrantLabels = ScatterQuadrants["labels"];
|
|
52
52
|
/** A split a log axis cannot place, at or below zero, or one that is not a number, is no split at all. */
|
|
@@ -58,10 +58,10 @@ export declare const MAX_RADIUS = 20;
|
|
|
58
58
|
* nothing draws the smallest dot, so it cannot shrink or hide the others. Points without sizes all take `plain`.
|
|
59
59
|
*/
|
|
60
60
|
export declare function dotSizes(points: readonly {
|
|
61
|
-
size?: number;
|
|
61
|
+
size?: number | undefined;
|
|
62
62
|
}[], plain: number): {
|
|
63
63
|
radiusOf: (p: {
|
|
64
|
-
size?: number;
|
|
64
|
+
size?: number | undefined;
|
|
65
65
|
}) => number;
|
|
66
66
|
sized: boolean;
|
|
67
67
|
};
|
package/dist/lib/treemap.d.ts
CHANGED
|
@@ -16,7 +16,7 @@ export interface Layout<T> {
|
|
|
16
16
|
/** Squarified layout: items without a group are tiles of their own, the rest sit together under their group's label. */
|
|
17
17
|
export declare function layout<T extends {
|
|
18
18
|
weight: number;
|
|
19
|
-
group?: string;
|
|
19
|
+
group?: string | undefined;
|
|
20
20
|
}>(items: T[], width: number, height: number): Layout<T>;
|
|
21
21
|
//#endregion
|
|
22
22
|
export {};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@siyahi/ui",
|
|
3
|
-
"version": "0.1.9-next.
|
|
3
|
+
"version": "0.1.9-next.33",
|
|
4
4
|
"description": "Stock shadcn/ui on Base UI and Tailwind v4, a finance theme, a few compositions and formatters.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"base-ui",
|
|
@@ -81,6 +81,6 @@
|
|
|
81
81
|
},
|
|
82
82
|
"scripts": {
|
|
83
83
|
"build": "node ../tools/contrast.mjs styles/siyahi.css && vp pack",
|
|
84
|
-
"typecheck": "tsc --noEmit"
|
|
84
|
+
"typecheck": "tsc --noEmit && tsc -p test/types"
|
|
85
85
|
}
|
|
86
86
|
}
|