@mechane-ai/elements 0.45.0 → 0.46.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.
Files changed (110) hide show
  1. package/README.md +48 -18
  2. package/bin/mechane-elements-catalog.mjs +42 -4
  3. package/dist/ai.js +268 -202
  4. package/dist/catalog.json +91 -31
  5. package/dist/categorical-values-BXi-rJuv.js +74 -0
  6. package/dist/chart-cursor-1mFd48Jc.js +23 -0
  7. package/dist/chart-data-CIJVWCYt.js +21 -0
  8. package/dist/{chart-frame-Ztktqs1b.js → chart-frame-BaxKn_MB.js} +22 -41
  9. package/dist/{chart-input-BO3BqlFO.js → chart-input-Bm82_9Rd.js} +2 -2
  10. package/dist/chart-theme-4zprJ3rW.js +404 -0
  11. package/dist/charts/cartesian.js +1598 -1432
  12. package/dist/charts/distribution.js +476 -404
  13. package/dist/charts/graph.js +363 -349
  14. package/dist/charts/hierarchy.js +103 -94
  15. package/dist/charts/matrix.js +340 -333
  16. package/dist/charts/timeline.js +167 -134
  17. package/dist/charts.js +3 -3
  18. package/dist/{code-block-Cpfr7B6a.js → code-block-DioAM2bZ.js} +67 -52
  19. package/dist/collections.js +1648 -1188
  20. package/dist/content/code.js +1 -1
  21. package/dist/content/diff.js +67 -66
  22. package/dist/content/link.js +1 -1
  23. package/dist/content/markdown.js +2 -2
  24. package/dist/content/tree.js +2 -2
  25. package/dist/{content-link-CGeFFb9F.js → content-link-NWuHp5rC.js} +1 -1
  26. package/dist/content.js +1 -1
  27. package/dist/csp.js +6 -11
  28. package/dist/feedback.js +1 -1
  29. package/dist/forms/dates.js +274 -214
  30. package/dist/{forms-DeU0Tiv3.js → forms-CEbwzlRR.js} +50 -41
  31. package/dist/forms.js +3 -3
  32. package/dist/index.js +1 -1
  33. package/dist/layout.js +207 -207
  34. package/dist/navigation.js +4 -3
  35. package/dist/packages/ai/src/conversation.d.ts +2 -0
  36. package/dist/packages/ai/src/prompt-input.d.ts +7 -2
  37. package/dist/packages/charts/src/cartesian/composition-bars.d.ts +2 -2
  38. package/dist/packages/charts/src/cartesian/index.d.ts +3 -2
  39. package/dist/packages/charts/src/cartesian/scatter-plot.d.ts +8 -2
  40. package/dist/packages/charts/src/cartesian/time-series.d.ts +11 -1
  41. package/dist/packages/charts/src/categorical-values.d.ts +14 -9
  42. package/dist/packages/charts/src/chart-frame.d.ts +7 -9
  43. package/dist/packages/charts/src/chart-inspection.d.ts +1 -2
  44. package/dist/packages/charts/src/chart-range.d.ts +33 -0
  45. package/dist/packages/charts/src/chart-rows.d.ts +20 -0
  46. package/dist/packages/charts/src/chart-theme.d.ts +17 -0
  47. package/dist/packages/charts/src/chart.d.ts +81 -0
  48. package/dist/packages/charts/src/distribution/distribution-plot.d.ts +4 -4
  49. package/dist/packages/charts/src/index.d.ts +1 -0
  50. package/dist/packages/charts/src/matrix/matrix-strip.d.ts +3 -3
  51. package/dist/packages/charts/src/plot-width.d.ts +0 -1
  52. package/dist/packages/charts/src/timeline/index.d.ts +1 -1
  53. package/dist/packages/charts/src/timeline/waterfall.d.ts +6 -2
  54. package/dist/packages/collections/src/collection-controls.d.ts +5 -1
  55. package/dist/packages/collections/src/collection-filters.d.ts +4 -1
  56. package/dist/packages/collections/src/control-toolbar.d.ts +13 -0
  57. package/dist/packages/collections/src/data-table-layout.d.ts +78 -0
  58. package/dist/packages/collections/src/data-table-rows.d.ts +54 -0
  59. package/dist/packages/collections/src/data-table-styles.d.ts +340 -0
  60. package/dist/packages/collections/src/data-table-text.d.ts +13 -0
  61. package/dist/packages/collections/src/data-table-trigger.d.ts +23 -0
  62. package/dist/packages/collections/src/data-table.d.ts +3 -85
  63. package/dist/packages/collections/src/index.d.ts +11 -6
  64. package/dist/packages/collections/src/query-controls.d.ts +6 -2
  65. package/dist/packages/collections/src/table-results.d.ts +47 -13
  66. package/dist/packages/collections/src/timeline.d.ts +1 -0
  67. package/dist/packages/collections/src/use-collection-controls.d.ts +2 -1
  68. package/dist/packages/collections/src/use-table-window.d.ts +25 -0
  69. package/dist/packages/content/src/viewer.d.ts +8 -0
  70. package/dist/packages/core/src/disclosure.d.ts +9 -1
  71. package/dist/packages/core/src/index.d.ts +1 -0
  72. package/dist/packages/core/src/route-link.d.ts +11 -0
  73. package/dist/packages/forms/src/dates/date-inputs.d.ts +3 -1
  74. package/dist/packages/forms/src/file-picker.d.ts +15 -0
  75. package/dist/packages/forms/src/form-controls.d.ts +1 -6
  76. package/dist/packages/forms/src/forms.d.ts +4 -1
  77. package/dist/packages/forms/src/index.d.ts +4 -2
  78. package/dist/packages/forms/src/selection.d.ts +14 -0
  79. package/dist/packages/foundations/src/csp/index.d.ts +1 -1
  80. package/dist/packages/foundations/src/csp/provider.d.ts +7 -2
  81. package/dist/packages/navigation/src/index.d.ts +1 -1
  82. package/dist/{pierre-diff-B3tD3-6z.js → pierre-diff-DlvjyuJn.js} +1 -1
  83. package/dist/plot-width-v2c_rA20.js +63 -0
  84. package/dist/{src-gqEebHEa.js → src-1EHkSFS-.js} +395 -274
  85. package/dist/{src-DBNncL7_.js → src-BPTDJqt0.js} +48 -68
  86. package/dist/src-CGc_hjxJ.js +409 -0
  87. package/dist/{src-DcW_gMX8.js → src-CpdJlDhO.js} +480 -362
  88. package/dist/{src-Dcs3SZ9V.js → src-DVHlknB6.js} +1 -1
  89. package/dist/styles2.css +136 -114
  90. package/package.json +1 -4
  91. package/skills/extend-elements/SKILL.md +74 -0
  92. package/skills/review-elements/SKILL.md +76 -0
  93. package/skills/upgrade-elements/SKILL.md +34 -0
  94. package/skills/upgrade-elements/references/releases.md +58 -0
  95. package/skills/use-elements/SKILL.md +64 -13
  96. package/skills/use-elements/references/agent.md +57 -0
  97. package/skills/use-elements/references/charts.md +63 -0
  98. package/skills/use-elements/references/collections.md +89 -0
  99. package/skills/use-elements/references/conversations.md +47 -0
  100. package/skills/use-elements/references/forms.md +81 -0
  101. package/skills/use-elements/references/styling.md +70 -0
  102. package/skills/use-elements/references/workspace.md +3 -3
  103. package/dist/categorical-values-DZLGQVW1.js +0 -63
  104. package/dist/chart-navigation-BAbb5PV9.js +0 -154
  105. package/dist/header-styles-COxCYFZx.js +0 -90
  106. package/dist/packages/charts/src/chart-navigation.d.ts +0 -39
  107. package/dist/packages/charts/src/chart-surface.d.ts +0 -27
  108. package/dist/packages/navigation/src/route-link.d.ts +0 -2
  109. package/dist/plot-width-CIqBiHcd.js +0 -105
  110. package/dist/src-Bk7M67zy.js +0 -396
@@ -1,3 +1,4 @@
1
- import { n as e, t } from "./navigation-CveMIuXI.js";
2
- import { a as n, i as r, n as i, o as a, r as o, t as s } from "./src-DBNncL7_.js";
3
- export { t as Breadcrumb, s as ContentTabs, e as Kbd, r as PageNavigation, n as PageNavigationPlaceholder, a as RouteLink, o as SkipLink, i as Tabs };
1
+ import { j as e } from "./src-CpdJlDhO.js";
2
+ import { n as t, t as n } from "./navigation-CveMIuXI.js";
3
+ import { a as r, i, n as a, r as o, t as s } from "./src-BPTDJqt0.js";
4
+ export { n as Breadcrumb, s as ContentTabs, t as Kbd, i as PageNavigation, r as PageNavigationPlaceholder, e as RouteLink, o as SkipLink, a as Tabs };
@@ -33,11 +33,13 @@ export type ConversationLatestButtonProps = {
33
33
  readonly label: string;
34
34
  readonly onActivate?: () => void;
35
35
  };
36
+ /** A conversation on the UI SDK scroll area: it follows the end while a reply grows, until the reader scrolls up. */
36
37
  declare function ConversationRoot({ children, initialPosition, shouldFollow, viewportRef, }: ConversationRootProps): ReactNode;
37
38
  declare function ConversationViewport({ label, children, scrollRestorationId }: ConversationViewportProps): ReactNode;
38
39
  declare function ConversationContent({ children, isStreaming }: ConversationContentProps): ReactNode;
39
40
  declare function ConversationItem({ messageId, shouldRevealOnAppend, children }: ConversationItemProps): ReactNode;
40
41
  declare function ConversationControls({ children }: ConversationControlsProps): ReactNode;
42
+ /** Shows while the reader is away from the end. A press scrolls there, follows again and focuses the viewport. */
41
43
  declare function ConversationJumpToLatest({ label }: ConversationJumpProps): ReactNode;
42
44
  declare function ConversationLatestButton({ label, onActivate }: ConversationLatestButtonProps): ReactNode;
43
45
  export declare const Conversation: {
@@ -1,4 +1,5 @@
1
1
  import type { ComponentProps, ReactNode } from 'react';
2
+ import { Textarea } from '../../forms/src/index.ts';
2
3
  export type PromptInputPlaceholderProps = {
3
4
  readonly isCompact?: boolean;
4
5
  };
@@ -6,7 +7,8 @@ export declare function PromptInputPlaceholder({ isCompact }: PromptInputPlaceho
6
7
  export type PromptInputProps = {
7
8
  readonly label: string;
8
9
  readonly value: string;
9
- readonly onValueChange: (value: string) => void;
10
+ /** The new text, then the UI SDK change details. */
11
+ readonly onValueChange: NonNullable<ComponentProps<typeof Textarea>['onValueChange']>;
10
12
  readonly onSubmit: NonNullable<ComponentProps<'form'>['onSubmit']>;
11
13
  readonly name?: string;
12
14
  readonly placeholder?: string;
@@ -17,7 +19,10 @@ export type PromptInputProps = {
17
19
  readonly isSubmitDisabled?: boolean;
18
20
  readonly submitLabel?: string;
19
21
  readonly pendingLabel?: string;
22
+ /** What a plain Enter does. Command or Control with Enter always submits, and Shift with Enter always adds a line. */
20
23
  readonly enterBehavior?: 'newline' | 'submit';
24
+ /** Earlier prompts, oldest first. Arrow Up on the first line brings one back, and Arrow Down returns to the draft. */
25
+ readonly history?: ReadonlyArray<string>;
21
26
  readonly isCompact?: boolean;
22
27
  readonly description?: ReactNode;
23
28
  readonly error?: string | undefined;
@@ -27,4 +32,4 @@ export type PromptInputProps = {
27
32
  readonly isStopPending?: boolean;
28
33
  readonly stopLabel?: string;
29
34
  };
30
- export declare function PromptInput({ label, value, onValueChange, onSubmit, name, placeholder, maxLength, required, isPending, disabled, isSubmitDisabled, submitLabel, pendingLabel, enterBehavior, isCompact, description, error, controls, attachments, onStop, isStopPending, stopLabel, }: PromptInputProps): ReactNode;
35
+ export declare function PromptInput({ label, value, onValueChange, onSubmit, name, placeholder, maxLength, required, isPending, disabled, isSubmitDisabled, submitLabel, pendingLabel, enterBehavior, history, isCompact, description, error, controls, attachments, onStop, isStopPending, stopLabel, }: PromptInputProps): ReactNode;
@@ -8,8 +8,8 @@ type CompositionBarsProps = {
8
8
  readonly x: number;
9
9
  readonly width: number;
10
10
  readonly y: (value: number) => number;
11
- readonly isHighlighted: boolean;
11
+ readonly isSelected: boolean;
12
12
  readonly highlightedSeriesId?: string | undefined;
13
13
  };
14
- export declare function CompositionBars({ bucket, series, focusedSeries, index, x, width, y, isHighlighted, highlightedSeriesId, }: CompositionBarsProps): ReactNode;
14
+ export declare function CompositionBars({ bucket, series, focusedSeries, index, x, width, y, isSelected, highlightedSeriesId, }: CompositionBarsProps): ReactNode;
15
15
  export {};
@@ -5,7 +5,7 @@ export { BreakdownBar } from './breakdown-bar.tsx';
5
5
  export type { BridgeChartProps, BridgeStep } from './bridge-chart.tsx';
6
6
  export { BridgeChart } from './bridge-chart.tsx';
7
7
  export type { ChartReferenceLine } from './reference-lines.tsx';
8
- export type { ScatterPoint, ScatterRange, ScatterRangeSelection, ScatterPlotProps } from './scatter-plot.tsx';
8
+ export type { ScatterPoint, ScatterRange, ScatterRangeDetails, ScatterRangeSelection, ScatterPlotProps, } from './scatter-plot.tsx';
9
9
  export { MAX_SCATTER_POINTS, ScatterPlot } from './scatter-plot.tsx';
10
10
  export type { SparklineProps, SparklinePoint } from './sparkline.tsx';
11
11
  export { Sparkline } from './sparkline.tsx';
@@ -13,5 +13,6 @@ export type { TimeSeriesPoint, TimeSeries, TimeSeriesMarker } from './time-serie
13
13
  export { timeSeriesLimits } from './time-series-data.ts';
14
14
  export type { TimeSeriesBand, TimeSeriesBandPoint, TimeSeriesCrossing } from './time-series-bands.ts';
15
15
  export { timeSeriesBandLimits } from './time-series-bands.ts';
16
- export type { TimeSeriesChartProps, TimeSeriesChartPlaceholderProps, AreaChartProps, SmallMultiplesProps, SmallMultiplesPlaceholderProps, } from './time-series.tsx';
16
+ export type { TimeSeriesChartProps, TimeSeriesChartPlaceholderProps, AreaChartProps, SmallMultiplesProps, SmallMultiplesPlaceholderProps, TimeRangeSelection, } from './time-series.tsx';
17
+ export type { ChartRangeDetails, ChartRangeValue } from '../chart-range.tsx';
17
18
  export { LineChart, AreaChart, SmallMultiples, SmallMultiplesPlaceholder, TimeSeriesChartPlaceholder, } from './time-series.tsx';
@@ -1,4 +1,6 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ChangeDetails } from '@ui-sdk/core';
2
+ import type { ComponentProps, ReactNode } from 'react';
3
+ import { Slider } from '../../../forms/src/index.ts';
2
4
  import type { ChartTone } from '../../../foundations/src/chart-tones.ts';
3
5
  import type { ChartReport, ChartSelection } from '../chart-frame.tsx';
4
6
  export type ScatterPoint = {
@@ -12,9 +14,12 @@ export type ScatterRange = {
12
14
  readonly x: readonly [number, number];
13
15
  readonly y: readonly [number, number];
14
16
  };
17
+ type SliderDetails = Parameters<NonNullable<ComponentProps<typeof Slider.Root<[number, number]>>['onValueChange']>>[1];
18
+ /** Why the range changed: a drag on the plot, one of the bound sliders, or the clear button. */
19
+ export type ScatterRangeDetails = ChangeDetails<'drag' | 'clear-press'> | SliderDetails;
15
20
  export type ScatterRangeSelection = {
16
21
  readonly value: ScatterRange | null;
17
- readonly onChange: (range: ScatterRange | null) => void;
22
+ readonly onChange: (range: ScatterRange | null, details: ScatterRangeDetails) => void;
18
23
  readonly xStep: number;
19
24
  readonly yStep: number;
20
25
  readonly locale: string;
@@ -36,3 +41,4 @@ export type ScatterPlotProps = {
36
41
  };
37
42
  export declare const MAX_SCATTER_POINTS = 1000;
38
43
  export declare function ScatterPlot(props: ScatterPlotProps): ReactNode;
44
+ export {};
@@ -1,7 +1,15 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ChartSeriesReport } from '../chart-frame.tsx';
3
+ import type { ChartRangeDetails, ChartRangeValue } from '../chart-range.tsx';
3
4
  import type { TimeSeriesBand, TimeSeriesCrossing } from './time-series-bands.ts';
4
5
  import type { TimeSeries, TimeSeriesMarker } from './time-series-data.ts';
6
+ /** A range of time a reader selects on the plot. The application owns it, for example to filter another view. */
7
+ export type TimeRangeSelection = {
8
+ readonly value: ChartRangeValue | null;
9
+ readonly onChange: (range: ChartRangeValue | null, details: ChartRangeDetails) => void;
10
+ /** What each end snaps to and what an arrow key moves the range by, in the timestamps' unit. */
11
+ readonly step: number;
12
+ };
5
13
  export type TimeSeriesChartProps = {
6
14
  readonly title: string;
7
15
  readonly description?: ReactNode;
@@ -18,6 +26,8 @@ export type TimeSeriesChartProps = {
18
26
  readonly bands?: ReadonlyArray<TimeSeriesBand> | undefined;
19
27
  /** Where a series or band center first reaches a value. A crossing that never happens is listed as not reached. */
20
28
  readonly crossings?: ReadonlyArray<TimeSeriesCrossing> | undefined;
29
+ /** Lets a reader select a range of time by dragging on the plot, with the keyboard, or with the buttons below it. */
30
+ readonly rangeSelection?: TimeRangeSelection | undefined;
21
31
  };
22
32
  export type AreaChartProps = TimeSeriesChartProps & {
23
33
  readonly isStacked?: boolean | undefined;
@@ -25,7 +35,7 @@ export type AreaChartProps = TimeSeriesChartProps & {
25
35
  export type TimeSeriesChartPlaceholderProps = Pick<TimeSeriesChartProps, 'title' | 'description' | 'height' | 'actions' | 'report'> & {
26
36
  readonly series: ReadonlyArray<Pick<TimeSeries, 'id' | 'label' | 'tone'>>;
27
37
  };
28
- export type SmallMultiplesProps = Omit<TimeSeriesChartProps, 'series' | 'title' | 'description' | 'actions' | 'formatValue' | 'formatTick' | 'markers' | 'report' | 'bands' | 'crossings'> & {
38
+ export type SmallMultiplesProps = Omit<TimeSeriesChartProps, 'series' | 'title' | 'description' | 'actions' | 'formatValue' | 'formatTick' | 'markers' | 'report' | 'bands' | 'crossings' | 'rangeSelection'> & {
29
39
  readonly charts: ReadonlyArray<{
30
40
  readonly id: string;
31
41
  readonly title: string;
@@ -1,6 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ChartTone } from '../../foundations/src/chart-tones.ts';
3
- import type { ChartSelection } from './chart-frame.tsx';
3
+ import type { ChartItem, ChartView } from './chart.tsx';
4
4
  export type BreakdownItem = {
5
5
  readonly id: string;
6
6
  readonly label: string;
@@ -13,12 +13,17 @@ export declare const categoricalLimits: {
13
13
  };
14
14
  export declare function colorTone(tone: ChartTone | undefined, index: number): ChartTone;
15
15
  export declare function validateBreakdown(items: ReadonlyArray<BreakdownItem>): string | undefined;
16
- export declare function CategoricalValues({ items, selection, }: {
17
- readonly items: ReadonlyArray<{
18
- readonly id: string;
19
- readonly label: string;
20
- readonly valueLabel: string;
21
- readonly tone: ChartTone;
22
- }>;
23
- readonly selection?: ChartSelection | undefined;
16
+ export type CategoricalValue = {
17
+ readonly id: string;
18
+ readonly label: string;
19
+ readonly valueLabel: string;
20
+ readonly tone: ChartTone;
21
+ };
22
+ /** What a chart of categorical values tells its readers and agents about each item. */
23
+ export declare function categoricalItems(items: ReadonlyArray<CategoricalValue>): ReadonlyArray<ChartItem>;
24
+ export declare function CategoricalValues({ title, items, view, }: {
25
+ readonly title: string;
26
+ readonly items: ReadonlyArray<CategoricalValue>;
27
+ /** The chart's view when its rows can be selected. */
28
+ readonly view: ChartView | undefined;
24
29
  }): ReactNode;
@@ -1,5 +1,6 @@
1
- import type { ReactNode } from 'react';
1
+ import type { ComponentProps, ReactNode } from 'react';
2
2
  import type { ChartLegendItem } from './chart-theme.ts';
3
+ import type { ChartSelectDetails } from './chart.tsx';
3
4
  type ChartReportHeading = {
4
5
  readonly meta?: ReactNode;
5
6
  readonly actions?: ReactNode;
@@ -14,7 +15,8 @@ export type ChartSeriesReport = ChartReport | (ChartReportHeading & {
14
15
  });
15
16
  export type ChartSelection = {
16
17
  readonly selectedId: string | undefined;
17
- readonly onSelect: (id: string) => void;
18
+ /** The details say why and how: a press, a key or an agent's step. */
19
+ readonly onSelect: (id: string, details: ChartSelectDetails) => void;
18
20
  };
19
21
  export type ChartFrameProps = {
20
22
  readonly title: ReactNode;
@@ -24,6 +26,8 @@ export type ChartFrameProps = {
24
26
  readonly footer?: ReactNode;
25
27
  readonly report?: ChartSeriesReport | undefined;
26
28
  readonly series?: ReadonlyArray<ChartLegendItem> | undefined;
29
+ /** The chart part's own props, when this figure is the root of an interactive chart. */
30
+ readonly figure?: ComponentProps<'figure'> | undefined;
27
31
  };
28
32
  export type { ChartLegendItem } from './chart-theme.ts';
29
33
  export type ChartLegendProps = {
@@ -31,14 +35,8 @@ export type ChartLegendProps = {
31
35
  readonly label?: string | undefined;
32
36
  readonly isScrollable?: boolean | undefined;
33
37
  };
34
- export declare function ChartFrame({ title, description, children, actions, footer, report, series, }: ChartFrameProps): ReactNode;
38
+ export declare function ChartFrame({ title, description, children, actions, footer, report, series, figure, }: ChartFrameProps): ReactNode;
35
39
  export declare function ChartLegend({ items, label, isScrollable }: ChartLegendProps): ReactNode;
36
- export declare function ChartDatumButton({ label, isSelected, onSelect, children, }: {
37
- readonly label: string;
38
- readonly isSelected?: boolean | undefined;
39
- readonly onSelect?: (() => void) | undefined;
40
- readonly children: ReactNode;
41
- }): ReactNode;
42
40
  export declare function ChartReadout({ children, id }: {
43
41
  readonly children: ReactNode;
44
42
  readonly id?: string;
@@ -13,7 +13,6 @@ type ChartInspectionProps = {
13
13
  readonly x: number;
14
14
  readonly width: number;
15
15
  readonly offset?: number | undefined;
16
- readonly source: 'pointer' | 'keyboard' | undefined;
17
16
  readonly notes?: ReadonlyArray<string> | undefined;
18
17
  readonly hasSeriesSummary?: boolean | undefined;
19
18
  /** False for a plot whose axis labels name every mark, so the inspector replaces the legend at every width. */
@@ -25,5 +24,5 @@ export declare function ChartInspectionTitle({ title, detail, }: {
25
24
  readonly detail: string | undefined;
26
25
  }): ReactNode;
27
26
  export declare function inspectionReadout({ label, summary, rows, notes, }: Pick<ChartInspectionProps, 'label' | 'summary' | 'rows' | 'notes'>): string | undefined;
28
- export declare function ChartInspection({ id, label, summary, legend, layoutLegend, rows, x, width, offset, source, notes, hasSeriesSummary, hasLegend, }: ChartInspectionProps): ReactNode;
27
+ export declare function ChartInspection({ id, label, summary, legend, layoutLegend, rows, x, width, offset, notes, hasSeriesSummary, hasLegend, }: ChartInspectionProps): ReactNode;
29
28
  export {};
@@ -0,0 +1,33 @@
1
+ import type { ChangeDetails, SpansReason } from '@ui-sdk/core';
2
+ import type { ReactNode } from 'react';
3
+ /** A range along a plot's axis, in the axis's own units, such as two timestamps. */
4
+ export type ChartRangeValue = readonly [number, number];
5
+ /** Why the range changed: a drag, an arrow key, Delete, a button beside the plot, or a call such as an agent's step. */
6
+ export type ChartRangeDetails = ChangeDetails<SpansReason | 'clear-press' | 'trigger-press'>;
7
+ export type ChartRangeOptions = {
8
+ /** The selected range, or null. The application owns it and passes back what `onValueChange` asks for. */
9
+ readonly value: ChartRangeValue | null;
10
+ readonly onValueChange: (value: ChartRangeValue | null, details: ChartRangeDetails) => void;
11
+ /** Where the axis starts and ends, in its units. */
12
+ readonly min: number;
13
+ readonly max: number;
14
+ /** What each end snaps to, and what an arrow key moves the range by. */
15
+ readonly step: number;
16
+ /** A range as a reader hears it, such as "09:00 to 09:30". */
17
+ readonly describe: (value: ChartRangeValue) => string;
18
+ };
19
+ export type ChartRangeProps = ChartRangeOptions & {
20
+ /** Where the axis sits inside the plot, in CSS pixels from the plot's top left corner. */
21
+ readonly left: number;
22
+ readonly width: number;
23
+ readonly height: number;
24
+ /** Names the plot and its range together, such as "Request latency time range". */
25
+ readonly label: string;
26
+ /** The plot the range is drawn over. A mouse or pen press on it starts a new range. */
27
+ readonly children: ReactNode;
28
+ };
29
+ /**
30
+ * A range a reader draws along a plot's axis and moves with a drag or the arrow keys. Its edges or Shift and an arrow
31
+ * resize it, and Delete clears it. An agent reads the range and sets or clears it.
32
+ */
33
+ export declare function ChartRange({ left, width, height, label, children, ...options }: ChartRangeProps): ReactNode;
@@ -0,0 +1,20 @@
1
+ import type { ReactNode } from 'react';
2
+ import type { ChartItem, ChartView } from './chart.tsx';
3
+ /**
4
+ * The rows of a chart whose exact values are visible text, such as ranked bars. Rows an application can select are one
5
+ * Tab stop: arrow keys move between them and Enter or Space selects. Rows it cannot select stay plain text.
6
+ */
7
+ export declare function ChartRows({ title, items, view, children, }: {
8
+ readonly title: string;
9
+ readonly items: ReadonlyArray<ChartItem>;
10
+ /** The chart's view when its rows can be selected. */
11
+ readonly view: ChartView | undefined;
12
+ readonly children: ReactNode;
13
+ }): ReactNode;
14
+ /** One row inside `ChartRows`. With the chart's view it is a mark a reader can select; without, it is text. */
15
+ export declare function ChartDatum({ id, label, view, children, }: {
16
+ readonly id: string;
17
+ readonly label: string;
18
+ readonly view: ChartView | undefined;
19
+ readonly children: ReactNode;
20
+ }): ReactNode;
@@ -68,9 +68,26 @@ export declare const chartStyles: Readonly<{
68
68
  readonly strokeWidth: stylex.StyleXClassNameFor<"strokeWidth", 2>;
69
69
  readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
70
70
  }>;
71
+ readonly inspected: Readonly<{
72
+ readonly stroke: stylex.StyleXClassNameFor<"stroke", string>;
73
+ readonly strokeWidth: stylex.StyleXClassNameFor<"strokeWidth", 1>;
74
+ readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
75
+ }>;
71
76
  readonly inspectable: Readonly<{
72
77
  readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "none">;
73
78
  }>;
79
+ readonly cursor: Readonly<{
80
+ readonly outlineWidth: stylex.StyleXClassNameFor<"outlineWidth", string>;
81
+ readonly outlineColor: stylex.StyleXClassNameFor<"outlineColor", string>;
82
+ readonly outlineStyle: stylex.StyleXClassNameFor<"outlineStyle", "dashed" | "none">;
83
+ readonly outlineOffset: stylex.StyleXClassNameFor<"outlineOffset", 2>;
84
+ }>;
85
+ readonly shapeCursor: Readonly<{
86
+ readonly stroke: stylex.StyleXClassNameFor<"stroke", string>;
87
+ readonly strokeWidth: stylex.StyleXClassNameFor<"strokeWidth", string | 0>;
88
+ readonly strokeDasharray: stylex.StyleXClassNameFor<"strokeDasharray", "4 3">;
89
+ readonly vectorEffect: stylex.StyleXClassNameFor<"vectorEffect", "non-scaling-stroke">;
90
+ }>;
74
91
  readonly emphasis: Readonly<{
75
92
  readonly transitionProperty: stylex.StyleXClassNameFor<"transitionProperty", "opacity">;
76
93
  readonly transitionDuration: stylex.StyleXClassNameFor<"transitionDuration", string>;
@@ -0,0 +1,81 @@
1
+ import type { ChangeDetails, SpatialRect } from '@ui-sdk/core';
2
+ import type { PartProps } from '@ui-sdk/react/primitive';
3
+ import type { ComponentType } from 'react';
4
+ export type ChartItem = {
5
+ readonly id: string;
6
+ readonly label: string;
7
+ };
8
+ export type ChartInspectReason = 'item-hover' | 'item-press' | 'list-navigation' | 'focus-in' | 'focus-out' | 'escape-key' | 'outside-press' | 'window-blur' | 'imperative';
9
+ export type ChartInspectDetails = ChangeDetails<ChartInspectReason>;
10
+ export type ChartSelectDetails = ChangeDetails<'item-press'>;
11
+ /** A pointer position inside the plot, in CSS pixels from its top left corner, with the plot's rendered size. */
12
+ export type ChartPoint = {
13
+ readonly x: number;
14
+ readonly y: number;
15
+ readonly width: number;
16
+ readonly height: number;
17
+ };
18
+ export type ChartOptions = {
19
+ /** The marks a reader can inspect, in the order the arrow keys step through them. */
20
+ readonly items: ReadonlyArray<ChartItem>;
21
+ /** One item's exact values as a sentence, for the spoken readout and for agents. Defaults to the item's label. */
22
+ readonly readout?: ((id: string) => string | undefined) | undefined;
23
+ /** Arranges the items row by row in a grid this wide. Up and Down change rows; Home and End stay in the row. */
24
+ readonly columns?: number | undefined;
25
+ /** Whether Up and Down step through a list like Left and Right. Leave it out when the page should keep them. */
26
+ readonly arrows?: 'horizontal' | 'both' | undefined;
27
+ /** Where an item sits, in any one unit. Arrows then move to the nearest item in their direction. */
28
+ readonly place?: ((id: string) => SpatialRect | undefined) | undefined;
29
+ /** The item under a pointer anywhere in the plot. Leave it out when each mark hears its own pointer. */
30
+ readonly locate?: ((point: ChartPoint) => string | undefined) | undefined;
31
+ /** Names the data the readouts describe. An open inspection closes when it changes. */
32
+ readonly revision?: string | undefined;
33
+ /** The item the application has selected, or null. Selection is the application's state. */
34
+ readonly selected?: string | null | undefined;
35
+ /** Asks the application to select an item. Without it, the chart only inspects. */
36
+ readonly onSelect?: ((id: string, details: ChartSelectDetails) => void) | undefined;
37
+ readonly inspected?: string | null | undefined;
38
+ readonly defaultInspected?: string | null | undefined;
39
+ readonly onInspectedChange?: ((id: string | null, details: ChartInspectDetails) => void) | undefined;
40
+ /** Other elements a press counts as inside, such as sibling plots that share one inspection. */
41
+ readonly within?: ((target: Node) => boolean) | undefined;
42
+ };
43
+ type ChartState = {
44
+ readonly items: ReadonlyArray<ChartItem>;
45
+ readonly inspected: string | null;
46
+ readonly selected: string | null;
47
+ readonly cursor: string | null;
48
+ };
49
+ /** What a chart draws from: the open inspection, the application's selection, and where the keyboard cursor rests. */
50
+ export type ChartView = Pick<ChartState, 'inspected' | 'selected' | 'cursor'>;
51
+ /** A `locate` for items in equal bands along the x axis of a plot drawn `width` units wide, such as bar categories. */
52
+ export declare function locateBand({ ids, start, step, width, }: {
53
+ readonly ids: ReadonlyArray<string>;
54
+ readonly start: number;
55
+ readonly step: number;
56
+ readonly width: number;
57
+ }): (point: ChartPoint) => string | undefined;
58
+ type MarkState = {
59
+ readonly isInspected: boolean;
60
+ readonly isSelected: boolean;
61
+ };
62
+ type ChartPart<Tag extends 'figure' | 'div' | 'svg' | 'p' | 'span', State, Named = object> = ComponentType<Omit<PartProps<Tag, State>, 'id' | keyof Named> & Named>;
63
+ /** The chart's figure. It owns inspection, the keyboard cursor and selection requests for the plot inside it. */
64
+ export declare const Chart: ChartPart<'figure', ChartView, ChartOptions>;
65
+ /** The plot as one Tab stop: arrows move the cursor, Enter or Space selects, Escape or an outside press dismisses. */
66
+ export declare const ChartPlot: ChartPart<'div', ChartView>;
67
+ export declare const ChartSvgPlot: ChartPart<'svg', ChartView>;
68
+ export declare const ChartTextPlot: ChartPart<'p', ChartView>;
69
+ /** One datum a pointer can inspect and press. Pass `render` for a mark that is not a span, such as an SVG shape. */
70
+ export declare const ChartMark: ChartPart<'span', MarkState, {
71
+ readonly value: string;
72
+ }>;
73
+ /** The visible readout for the open inspection, or a space that holds its line. */
74
+ export declare function inspectedLabel(items: ReadonlyArray<ChartItem>, inspected: string | null): string;
75
+ /** Names a plot for a reader who steps through its marks, such as "categories". */
76
+ export declare function plotLabel({ title, marks, isSelectable, }: {
77
+ readonly title: string;
78
+ readonly marks?: string | undefined;
79
+ readonly isSelectable: boolean;
80
+ }): string;
81
+ export {};
@@ -1,6 +1,5 @@
1
1
  import * as stylex from '@stylexjs/stylex';
2
2
  import type { ReactNode } from 'react';
3
- import type { useChartNavigation } from '../chart-navigation.tsx';
4
3
  import type { NumericDomain } from './distribution-input.ts';
5
4
  export declare const distributionGeometry: {
6
5
  readonly height: 160;
@@ -144,8 +143,9 @@ export declare const distributionStyles: Readonly<{
144
143
  }>;
145
144
  }>;
146
145
  type NumericPlotProps = {
147
- readonly navigation: ReturnType<typeof useChartNavigation>['props'];
148
- readonly onInspectValue?: (value: number) => void;
146
+ /** The plot's accessible name and the id of the readout that describes it. */
147
+ readonly label: string;
148
+ readonly readoutId: string;
149
149
  readonly xDomain: NumericDomain;
150
150
  readonly yDomain: NumericDomain;
151
151
  readonly xLabel: string;
@@ -154,7 +154,7 @@ type NumericPlotProps = {
154
154
  readonly formatY: (value: number) => string;
155
155
  readonly children: (width: number) => ReactNode;
156
156
  };
157
- export declare function NumericPlot({ navigation, onInspectValue, xDomain, yDomain, xLabel, yLabel, formatX, formatY, children, }: NumericPlotProps): ReactNode;
157
+ export declare function NumericPlot({ label, readoutId, xDomain, yDomain, xLabel, yLabel, formatX, formatY, children, }: NumericPlotProps): ReactNode;
158
158
  export declare function DomainLabels({ domain, formatValue, }: {
159
159
  readonly domain: NumericDomain;
160
160
  readonly formatValue: (value: number) => string;
@@ -1,6 +1,7 @@
1
1
  export type { BreakdownItem } from './categorical-values.tsx';
2
2
  export type { ChartReport, ChartSeriesReport, ChartSelection, ChartFrameProps, ChartLegendItem, ChartLegendProps, } from './chart-frame.tsx';
3
3
  export { ChartFrame, ChartLegend } from './chart-frame.tsx';
4
+ export type { ChartSelectDetails } from './chart.tsx';
4
5
  export type { ChartTone } from '../../foundations/src/chart-tones.ts';
5
6
  export { chartToneColors, chartToneOutlines } from '../../foundations/src/chart-tones.ts';
6
7
  export type { ChartMarkShape, ChartSeriesMarkerProps } from './chart-series-marker.tsx';
@@ -1,5 +1,6 @@
1
1
  import type { ReactNode } from 'react';
2
2
  import type { ChartSelection } from '../chart-frame.tsx';
3
+ import type { ChartView } from '../chart.tsx';
3
4
  import type { HeatmapScale } from './heatmap-scale.ts';
4
5
  import type { MatrixAxisItem, MatrixCell } from './matrix-types.ts';
5
6
  type StripProps = HeatmapScale & {
@@ -7,8 +8,7 @@ type StripProps = HeatmapScale & {
7
8
  readonly columns: ReadonlyArray<MatrixAxisItem>;
8
9
  readonly cellAt: (rowId: string, columnId: string) => MatrixCell | undefined;
9
10
  readonly coordinateId: (rowId: string, columnId: string) => string;
10
- readonly inspectedId: string | undefined;
11
- readonly onInspect: (id: string) => void;
11
+ readonly view: ChartView;
12
12
  readonly formatValue: (value: number) => string;
13
13
  readonly selection: ChartSelection | undefined;
14
14
  };
@@ -16,5 +16,5 @@ type StripProps = HeatmapScale & {
16
16
  * Draws a matrix as compact intensity rows that fill the available width, such as months across categories. Cells carry
17
17
  * color and state glyphs only; inspection and the exact-value table hold the numbers.
18
18
  */
19
- export declare function MatrixStrip({ rows, columns, cellAt, coordinateId, inspectedId, onInspect, domain, palette, formatValue, selection, }: StripProps): ReactNode;
19
+ export declare function MatrixStrip({ rows, columns, cellAt, coordinateId, view, domain, palette, formatValue, selection, }: StripProps): ReactNode;
20
20
  export {};
@@ -1,5 +1,4 @@
1
1
  export declare function usePlotWidth(): {
2
2
  ref: import("react").Dispatch<import("react").SetStateAction<HTMLDivElement | null>>;
3
3
  width: number;
4
- element: HTMLDivElement | null;
5
4
  };
@@ -1,2 +1,2 @@
1
- export type { WaterfallItem } from './waterfall.tsx';
1
+ export type { WaterfallItem, WaterfallSelectDetails } from './waterfall.tsx';
2
2
  export { Waterfall } from './waterfall.tsx';
@@ -1,3 +1,4 @@
1
+ import type { WaterfallProps as SpansProps } from '@ui-sdk/react/waterfall';
1
2
  import type { ReactNode, Ref } from 'react';
2
3
  import type { ChartReport } from '../chart-frame.tsx';
3
4
  type WaterfallGeometry = {
@@ -20,6 +21,8 @@ export type WaterfallItem = {
20
21
  readonly geometry: WaterfallGeometry;
21
22
  readonly controls?: string;
22
23
  };
24
+ /** Why the selection wants to change: a press or Enter on a row, or a call such as an agent's step. */
25
+ export type WaterfallSelectDetails = Parameters<NonNullable<SpansProps['onValueChange']>>[1];
23
26
  type WaterfallProps = {
24
27
  readonly items: ReadonlyArray<WaterfallItem>;
25
28
  readonly start: number;
@@ -30,8 +33,9 @@ type WaterfallProps = {
30
33
  readonly summaryLabel: string;
31
34
  readonly emptyLabel: string;
32
35
  readonly selectedId: string | undefined;
33
- readonly selectedRef?: Ref<HTMLButtonElement> | undefined;
34
- readonly onSelect: (id: string) => void;
36
+ /** The selected row, which takes focus, so an owner can return focus to it. */
37
+ readonly selectedRef?: Ref<HTMLDivElement> | undefined;
38
+ readonly onSelect: (id: string, details: WaterfallSelectDetails) => void;
35
39
  readonly formatOffset: (offset: number) => string;
36
40
  };
37
41
  export declare function Waterfall({ items, start, end, label, report, rowLabel, summaryLabel, emptyLabel, selectedId, selectedRef, onSelect, formatOffset, }: WaterfallProps): ReactNode;
@@ -1,19 +1,23 @@
1
+ import type { ChangeDetails } from '@ui-sdk/core';
1
2
  import type { ReactNode } from 'react';
2
3
  export type CollectionToolbarProps = {
3
4
  readonly label: string;
4
5
  readonly children?: ReactNode;
5
6
  readonly actions?: ReactNode;
6
7
  };
8
+ /** The control row above a collection, on the UI SDK toolbar: filter chips and actions share one Tab stop. */
7
9
  export declare function CollectionToolbar({ label, children, actions }: CollectionToolbarProps): ReactNode;
8
10
  export type FilterChip = {
9
11
  readonly id: string;
10
12
  readonly label: string;
11
13
  };
14
+ export type FilterRemoveDetails = ChangeDetails<'remove-press'>;
12
15
  export type FilterChipsProps = {
13
16
  readonly filters: ReadonlyArray<FilterChip>;
14
- readonly onRemove: (id: string) => void;
17
+ readonly onRemove: (id: string, details: FilterRemoveDetails) => void;
15
18
  readonly label?: string;
16
19
  };
20
+ /** The applied filters, each with a remove button. The buttons share one Tab stop on the UI SDK toolbar. */
17
21
  export declare function FilterChips({ filters, onRemove, label }: FilterChipsProps): ReactNode;
18
22
  export type DisplayOption = {
19
23
  readonly id: string;
@@ -1,3 +1,4 @@
1
+ import type { ChangeDetails } from '@ui-sdk/core';
1
2
  import type { ComponentProps, ReactNode } from 'react';
2
3
  import type { Badge } from '../../core/src/index.ts';
3
4
  export type FilterOption = {
@@ -6,6 +7,8 @@ export type FilterOption = {
6
7
  readonly icon?: ReactNode;
7
8
  tone?: ComponentProps<typeof Badge>['tone'];
8
9
  };
10
+ /** Why a filter changed: a menu option, its chip's remove button, or a call such as an agent's step. */
11
+ export type CollectionFilterDetails = ChangeDetails<'item-press' | 'remove-press' | 'imperative'>;
9
12
  export type CollectionFilter = {
10
13
  readonly id: string;
11
14
  readonly label: string;
@@ -13,7 +16,7 @@ export type CollectionFilter = {
13
16
  readonly value: string;
14
17
  readonly defaultValue: string;
15
18
  readonly options: ReadonlyArray<FilterOption>;
16
- readonly onChange: (value: string) => void;
19
+ readonly onChange: (value: string, details: CollectionFilterDetails) => void;
17
20
  };
18
21
  export declare function CollectionFilters({ groups }: {
19
22
  groups: ReadonlyArray<CollectionFilter>;
@@ -0,0 +1,13 @@
1
+ import { ToolbarGroup } from '@ui-sdk/react/toolbar';
2
+ import type { ComponentProps, ReactElement, ReactNode } from 'react';
3
+ type ControlToolbarProps = ComponentProps<typeof ToolbarGroup> & {
4
+ readonly 'aria-label': string;
5
+ };
6
+ /**
7
+ * A named set of controls on the UI SDK toolbar: Tab enters once and the arrow keys move between the controls. Inside
8
+ * another set it becomes a group of that toolbar, so a row of sets still has one Tab stop.
9
+ */
10
+ export declare function ControlToolbar(props: ControlToolbarProps): ReactNode;
11
+ /** Joins a button to the toolbar around it. Outside a toolbar the button renders as given. */
12
+ export declare function useToolbarButton(button: ReactElement): ReactElement;
13
+ export {};