@peerproblem/sw3-ui 0.0.0-stage → 0.3.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 (144) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +109 -2
  3. package/agent/components/accordion.md +95 -0
  4. package/agent/components/action-square.md +106 -0
  5. package/agent/components/agent-bridge.md +87 -0
  6. package/agent/components/agent-console.md +123 -0
  7. package/agent/components/alert-dialog.md +82 -0
  8. package/agent/components/app-shell.md +105 -0
  9. package/agent/components/area-chart.md +56 -0
  10. package/agent/components/async-options.md +47 -0
  11. package/agent/components/autocomplete.md +69 -0
  12. package/agent/components/avatar.md +88 -0
  13. package/agent/components/badge.md +51 -0
  14. package/agent/components/bar-chart.md +56 -0
  15. package/agent/components/bar-list.md +49 -0
  16. package/agent/components/breadcrumbs.md +43 -0
  17. package/agent/components/button.md +109 -0
  18. package/agent/components/calendar.md +114 -0
  19. package/agent/components/canvas.md +105 -0
  20. package/agent/components/card.md +78 -0
  21. package/agent/components/carousel.md +113 -0
  22. package/agent/components/chart-card.md +41 -0
  23. package/agent/components/chart-surface.md +56 -0
  24. package/agent/components/checkbox.md +88 -0
  25. package/agent/components/citation-chip.md +61 -0
  26. package/agent/components/collapsible.md +69 -0
  27. package/agent/components/color-picker.md +82 -0
  28. package/agent/components/combobox.md +104 -0
  29. package/agent/components/command.md +92 -0
  30. package/agent/components/dashboard-grid.md +73 -0
  31. package/agent/components/date-input.md +87 -0
  32. package/agent/components/date-picker.md +122 -0
  33. package/agent/components/dialog.md +97 -0
  34. package/agent/components/donut-chart.md +50 -0
  35. package/agent/components/drawer.md +101 -0
  36. package/agent/components/empty-state.md +52 -0
  37. package/agent/components/field.md +80 -0
  38. package/agent/components/file-input.md +84 -0
  39. package/agent/components/hover-card.md +64 -0
  40. package/agent/components/image-cropper.md +77 -0
  41. package/agent/components/input.md +49 -0
  42. package/agent/components/label.md +53 -0
  43. package/agent/components/line-chart.md +60 -0
  44. package/agent/components/listbox.md +84 -0
  45. package/agent/components/map-view.md +104 -0
  46. package/agent/components/menu.md +117 -0
  47. package/agent/components/menubar.md +67 -0
  48. package/agent/components/meter.md +59 -0
  49. package/agent/components/navigation-menu.md +98 -0
  50. package/agent/components/number-input.md +81 -0
  51. package/agent/components/otp-input.md +67 -0
  52. package/agent/components/pagination.md +80 -0
  53. package/agent/components/password-input.md +67 -0
  54. package/agent/components/pill-button.md +116 -0
  55. package/agent/components/popover.md +85 -0
  56. package/agent/components/poster-card.md +61 -0
  57. package/agent/components/preferences.md +92 -0
  58. package/agent/components/progress.md +63 -0
  59. package/agent/components/provider.md +47 -0
  60. package/agent/components/radio.md +91 -0
  61. package/agent/components/rating.md +66 -0
  62. package/agent/components/reorder.md +61 -0
  63. package/agent/components/resizable.md +87 -0
  64. package/agent/components/scatter-chart.md +49 -0
  65. package/agent/components/scroll-area.md +81 -0
  66. package/agent/components/segmented-control.md +56 -0
  67. package/agent/components/select.md +130 -0
  68. package/agent/components/separator.md +60 -0
  69. package/agent/components/shortcuts.md +50 -0
  70. package/agent/components/sidebar-nav.md +68 -0
  71. package/agent/components/skeleton.md +58 -0
  72. package/agent/components/slider.md +79 -0
  73. package/agent/components/sparkline.md +39 -0
  74. package/agent/components/squircle.md +58 -0
  75. package/agent/components/stat.md +58 -0
  76. package/agent/components/switch.md +48 -0
  77. package/agent/components/table.md +58 -0
  78. package/agent/components/tabs.md +108 -0
  79. package/agent/components/textarea.md +68 -0
  80. package/agent/components/time-input.md +84 -0
  81. package/agent/components/timeline.md +91 -0
  82. package/agent/components/toast.md +85 -0
  83. package/agent/components/toggle.md +76 -0
  84. package/agent/components/token-input.md +66 -0
  85. package/agent/components/toolbar.md +76 -0
  86. package/agent/components/tooltip.md +83 -0
  87. package/agent/components/tracker.md +47 -0
  88. package/agent/components/tree.md +87 -0
  89. package/agent/components/treemap.md +72 -0
  90. package/agent/components/trend-chart.md +80 -0
  91. package/agent/components/trigger-menu.md +67 -0
  92. package/agent/components/typography.md +51 -0
  93. package/agent/components/waterfall.md +78 -0
  94. package/agent/components/week-schedule.md +113 -0
  95. package/agent/llms/actions-and-layout.txt +1749 -0
  96. package/agent/llms/agents.txt +505 -0
  97. package/agent/llms/charts.txt +778 -0
  98. package/agent/llms/dashboards.txt +457 -0
  99. package/agent/llms/extend.txt +132 -0
  100. package/agent/llms/extras.txt +527 -0
  101. package/agent/llms/forms.txt +2152 -0
  102. package/agent/llms/foundations.txt +674 -0
  103. package/agent/llms/hooks.txt +178 -0
  104. package/agent/llms/maps.txt +229 -0
  105. package/agent/llms/overlays-and-navigation.txt +1167 -0
  106. package/agent/llms-full.txt +8717 -0
  107. package/agent/llms.txt +145 -0
  108. package/agent/registry.json +11289 -0
  109. package/agent/tokens.md +66 -0
  110. package/dist/agent/index.d.ts +235 -0
  111. package/dist/agent/index.js +21 -0
  112. package/dist/card-Ipm-Cj5f.d.ts +490 -0
  113. package/dist/charts/index.d.ts +289 -0
  114. package/dist/charts/index.js +815 -0
  115. package/dist/check/cli.d.ts +1 -0
  116. package/dist/check/cli.js +48 -0
  117. package/dist/check/rendered.d.ts +11 -0
  118. package/dist/check/rendered.js +77 -0
  119. package/dist/check/source.d.ts +13 -0
  120. package/dist/check/source.js +182 -0
  121. package/dist/chunk-3DXBM65D.js +65 -0
  122. package/dist/chunk-3H5X4ZP6.js +55 -0
  123. package/dist/chunk-6XC4BC5C.js +92 -0
  124. package/dist/chunk-7H6TEAWD.js +507 -0
  125. package/dist/chunk-I63ZTJOI.js +1089 -0
  126. package/dist/chunk-JCIRUM4W.js +33 -0
  127. package/dist/chunk-LTBEHZ3P.js +25 -0
  128. package/dist/chunk-QDPPLO4U.js +60 -0
  129. package/dist/chunk-U2XFBPU4.js +56 -0
  130. package/dist/chunk-UY2WH5AY.js +681 -0
  131. package/dist/extras.d.ts +203 -0
  132. package/dist/extras.js +904 -0
  133. package/dist/icons-BJiGEAnU.d.ts +68 -0
  134. package/dist/index.d.ts +3737 -0
  135. package/dist/index.js +14477 -0
  136. package/dist/map/index.d.ts +115 -0
  137. package/dist/map/index.js +394 -0
  138. package/dist/meta/index.d.ts +3314 -0
  139. package/dist/meta/index.js +5106 -0
  140. package/dist/rules-1RIZ_JZr.d.ts +38 -0
  141. package/dist/styles.css +4037 -0
  142. package/dist/themes/calm.css +42 -0
  143. package/dist/themes/frost.css +40 -0
  144. package/package.json +142 -4
@@ -0,0 +1,289 @@
1
+ import * as react from 'react';
2
+ import { CSSProperties, HTMLAttributes, ReactNode } from 'react';
3
+ import { RadiusValue, CardProps } from '../index.js';
4
+ import 'motion/react';
5
+
6
+ type Accessor<D> = (keyof D & string) | ((d: D, i: number) => number | Date | string);
7
+ interface Series<D> {
8
+ /** Field in each datum holding the numeric value. */
9
+ key: keyof D & string;
10
+ label?: string;
11
+ /** CSS color. Defaults to the categorical palette in order (`--sw-chart-1..8`). */
12
+ color?: string;
13
+ }
14
+ interface XYChartProps<D> {
15
+ data: D[];
16
+ /** X field or accessor. Numbers and Dates are plotted on a scale; strings become ordered categories. */
17
+ x: Accessor<D>;
18
+ series: Series<D>[];
19
+ /** Chart height in px. Width always fills the parent. Default 240. */
20
+ height?: number;
21
+ xFormat?: (v: number | Date | string) => string;
22
+ yFormat?: (v: number) => string;
23
+ showXAxis?: boolean;
24
+ showYAxis?: boolean;
25
+ /** Horizontal grid lines. Default true. */
26
+ showGrid?: boolean;
27
+ /** Crosshair + tooltip on hover. Default true. */
28
+ tooltip?: boolean;
29
+ yDomain?: [number | undefined, number | undefined];
30
+ className?: string;
31
+ /** Accessible summary for screen readers and agents (they cannot see SVG). */
32
+ 'aria-label'?: string;
33
+ }
34
+ declare function Legend<D>({ series, className }: {
35
+ series: Array<Series<D> | {
36
+ key: string;
37
+ label?: string;
38
+ color?: string;
39
+ }>;
40
+ className?: string;
41
+ }): react.JSX.Element;
42
+
43
+ type Curve = 'smooth' | 'linear' | 'step';
44
+ interface LineChartProps<D> extends XYChartProps<D> {
45
+ curve?: Curve;
46
+ /** Line width in px. Default 2. */
47
+ lineWidth?: number;
48
+ }
49
+ /** Trend over time for 1–5 series. */
50
+ declare function LineChart<D>(p: LineChartProps<D>): react.JSX.Element;
51
+ interface AreaChartProps<D> extends XYChartProps<D> {
52
+ curve?: Curve;
53
+ /** Stack series on top of each other. Default false (overlapping, translucent). */
54
+ stacked?: boolean;
55
+ /** Draw a line on top of each area. Default true. */
56
+ line?: boolean;
57
+ }
58
+ /** Volume over time; use stacked for part-to-whole. */
59
+ declare function AreaChart<D>(p: AreaChartProps<D>): react.JSX.Element;
60
+ interface BarChartProps<D> extends XYChartProps<D> {
61
+ /** `grouped` (side by side) or `stacked`. Default grouped. */
62
+ mode?: 'grouped' | 'stacked';
63
+ orientation?: 'vertical' | 'horizontal';
64
+ /** Corner radius of bars in px. Default 4. */
65
+ barRadius?: number;
66
+ }
67
+ /** Compare categories. Strings on x become evenly spaced bars. */
68
+ declare function BarChart<D>(p: BarChartProps<D>): react.JSX.Element;
69
+ interface ScatterChartProps<D> extends Omit<XYChartProps<D>, 'series'> {
70
+ /** Numeric y field. */
71
+ y: keyof D & string;
72
+ /** Optional numeric field for point size. */
73
+ size?: keyof D & string;
74
+ color?: string;
75
+ label?: string;
76
+ }
77
+ /** Correlation between two numeric fields. */
78
+ declare function ScatterChart<D>(p: ScatterChartProps<D>): react.JSX.Element;
79
+
80
+ interface DonutSlice {
81
+ label: string;
82
+ value: number;
83
+ color?: string;
84
+ }
85
+ interface DonutChartProps {
86
+ data: DonutSlice[];
87
+ /** Big text in the middle, e.g. a total. */
88
+ centralLabel?: string;
89
+ centralSubLabel?: string;
90
+ /** Ring thickness in px. Default 18. */
91
+ arcWidth?: number;
92
+ height?: number;
93
+ className?: string;
94
+ 'aria-label'?: string;
95
+ }
96
+ /** Part-to-whole for 2–6 slices. Pair with <Legend series={...}/>. */
97
+ declare function DonutChart({ data, centralLabel, centralSubLabel, arcWidth, height, className, ...a }: DonutChartProps): react.JSX.Element;
98
+ interface SparklineProps {
99
+ data: number[];
100
+ color?: string;
101
+ height?: number;
102
+ /** Fill under the line (fades to nothing). Default true. */
103
+ area?: boolean;
104
+ /** Name the trend when it stands alone. Omit when the number beside it says it. */
105
+ 'aria-label'?: string;
106
+ className?: string;
107
+ }
108
+ /** A tiny trend line with no axes, drawn by TrendChart's spark mode. Use inside <Stat> or table cells. */
109
+ declare function Sparkline({ data, color, height, area, className, ...a }: SparklineProps): react.JSX.Element;
110
+
111
+ type TrendTone = 'chart' | 'neutral' | 'success' | 'warning' | 'danger';
112
+ interface TrendMarker {
113
+ /** Index into `values`. */
114
+ index: number;
115
+ /** Short label, e.g. "Deploy 4.12". Shown on hover. */
116
+ label: string;
117
+ }
118
+ interface TrendChartProps {
119
+ /** The series, oldest first. */
120
+ values: number[];
121
+ /** Label for each value (time or category). Used on the x axis and in the tooltip. */
122
+ labels?: string[];
123
+ /** Previous period or baseline, same length. Drawn as a muted dashed line. */
124
+ compare?: number[];
125
+ /** Name of the main and compare series in the tooltip. Default "Now" / "Previous". */
126
+ seriesLabels?: [string, string];
127
+ /** 'area' (fading fill), 'line', or 'bars'. Default 'area'. */
128
+ variant?: 'area' | 'line' | 'bars';
129
+ /** Color source. 'chart' = --sw-chart-1, 'neutral' = foreground. Default 'chart'. */
130
+ tone?: TrendTone;
131
+ /** Height in px. Default 180, the overview-card height (spark: 36). Keep tiles in a row the same height. */
132
+ height?: number;
133
+ /** KPI mode: no axes, no grid, no padding; the shape runs to the edges. */
134
+ spark?: boolean;
135
+ /** The last bucket is still filling (today, this hour): draw its segment dashed so it doesn't read as a drop. */
136
+ incomplete?: boolean;
137
+ /** Streaming data: the latest-value dot pulses. Off by default — motion is for live data only. */
138
+ live?: boolean;
139
+ /** Format values for labels and the tooltip. Default compact numbers (1.2k). */
140
+ format?(value: number): string;
141
+ /** A target or limit drawn as a dashed line, e.g. { value: 800, label: 'SLO 800ms' }. */
142
+ threshold?: {
143
+ value: number;
144
+ label?: string;
145
+ };
146
+ /** Event markers (deploys, incidents) as small ticks on the baseline. */
147
+ markers?: TrendMarker[];
148
+ /** Start the value axis at 0 for non-negative data. Default true (false for spark lines). */
149
+ zero?: boolean;
150
+ /** Called with the hovered/focused index while scrubbing, and null when it ends. */
151
+ onScrub?(index: number | null): void;
152
+ /** Show the built-in tooltip while scrubbing. Default true (false for spark). */
153
+ tooltip?: boolean;
154
+ /** Accessible summary of the takeaway, e.g. "Requests peaked at 72k at 15:00". Omit only for a decorative spark next to its number. */
155
+ 'aria-label'?: string;
156
+ /** Any CSS color instead of a tone, e.g. var(--sw-chart-3). */
157
+ color?: string;
158
+ className?: string;
159
+ style?: CSSProperties;
160
+ }
161
+ /** A crafted small time-series chart for dashboard tiles and KPI cells. Scrub with pointer or ←/→. */
162
+ declare function TrendChart({ values, labels, compare, seriesLabels, variant, tone, height: heightProp, spark, format, threshold, markers, zero, onScrub, tooltip, incomplete, live, color: colorProp, className, style, ...rest }: TrendChartProps): react.JSX.Element;
163
+
164
+ interface BarListItem {
165
+ id: string;
166
+ label: string;
167
+ value: number;
168
+ /** 15px icon before the label. */
169
+ icon?: ReactNode;
170
+ /** Secondary value after the main one, e.g. a share "34%" or a delta. */
171
+ meta?: ReactNode;
172
+ href?: string;
173
+ }
174
+ interface BarListProps extends Omit<HTMLAttributes<HTMLElement>, 'onSelect'> {
175
+ items: BarListItem[];
176
+ /** Format the value column. Default compact numbers. */
177
+ format?(value: number): string;
178
+ /** Scale bars against this instead of the largest value (e.g. a quota). */
179
+ max?: number;
180
+ /** Sort by value, largest first. Default true. */
181
+ sorted?: boolean;
182
+ /** Click on a row (drill in). Rows with `href` are links. */
183
+ onItemAction?(id: string): void;
184
+ /** Accessible name. */
185
+ 'aria-label': string;
186
+ }
187
+ /**
188
+ * Ranked rows with a bar behind each label: "top endpoints", "traffic by country".
189
+ * The bar *is* the row background, so a ranked list reads at a glance without a chart.
190
+ */
191
+ declare function BarList({ items, format, max, sorted, onItemAction, className, ...rest }: BarListProps): react.JSX.Element;
192
+
193
+ type TrackerStatus = 'ok' | 'degraded' | 'down' | 'none';
194
+ interface TrackerItem {
195
+ status: TrackerStatus;
196
+ /** Shown on hover/focus, e.g. "Mar 14 · 99.2% · 1 incident". */
197
+ label: string;
198
+ }
199
+ interface TrackerProps extends HTMLAttributes<HTMLDivElement> {
200
+ /** One tick per period (day, hour), oldest first. 30–90 ticks read best. */
201
+ items: TrackerItem[];
202
+ /** Tick height in px. Default 24. */
203
+ height?: number;
204
+ /** Accessible summary, e.g. "API uptime, last 60 days: 99.94%, 2 incidents". */
205
+ 'aria-label': string;
206
+ }
207
+ /** Status ticks over time (uptime, job runs, checks). Hover or ←/→ to read a tick. */
208
+ declare function Tracker({ items, height, className, style, ...rest }: TrackerProps): react.JSX.Element;
209
+
210
+ type Get<D, T> = (keyof D & string) | ((d: D) => T);
211
+ interface TreemapGroup {
212
+ /** Value returned by `groupBy`. */
213
+ key: string;
214
+ label?: string;
215
+ /** CSS color. Defaults to `--sw-chart-1..8` in the order of `groups`, then first appearance. */
216
+ color?: string;
217
+ }
218
+ interface TreemapProps<D> {
219
+ data: D[];
220
+ /** Size of each tile. Negative and missing values count as 0. */
221
+ value: Get<D, number>;
222
+ /** Tile name. */
223
+ label: Get<D, string>;
224
+ /** Nest tiles into labelled groups (one level). Leave out for a flat treemap. */
225
+ groupBy?: Get<D, string>;
226
+ /** Group order, labels and colors. Pass the same array to `<ChartCard legend>` so the legend matches. */
227
+ groups?: TreemapGroup[];
228
+ /** Pixels. Width fills the parent. Default 320. */
229
+ height?: number;
230
+ /** Formats tile, group and tooltip values. Default compact (12.4K). */
231
+ valueFormat?: (v: number) => string;
232
+ /** Group (outer) corner radius, token or px. Tiles inside a group get the concentric radius: outer − gap. Default 'sm', one step under the ChartCard it sits in. */
233
+ radius?: RadiusValue;
234
+ /** Space between tiles and the group inset, in px. Default 4. */
235
+ gap?: number;
236
+ /** Hover / focus tooltip. Default true. */
237
+ tooltip?: boolean;
238
+ /** Makes leaf tiles buttons. */
239
+ onTileClick?: (datum: D) => void;
240
+ className?: string;
241
+ /** The takeaway in one sentence. Agents and screen readers cannot read the tiles. */
242
+ 'aria-label'?: string;
243
+ }
244
+ /**
245
+ * Part-to-whole for many items, optionally grouped one level deep. Tiles are squircles;
246
+ * leaf tiles inside a group use the concentric radius (group radius − gap), so the curves nest.
247
+ */
248
+ declare function Treemap<D>({ data, value, label, groupBy, groups, height, valueFormat, radius, gap, tooltip, onTileClick, className, ...a }: TreemapProps<D>): react.JSX.Element;
249
+
250
+ interface ChartCardProps extends Omit<CardProps, 'title'> {
251
+ title: ReactNode;
252
+ description?: ReactNode;
253
+ /** Headline number shown top-right, e.g. "12.4k". */
254
+ value?: ReactNode;
255
+ /** Series to list in the legend. */
256
+ legend?: Array<Series<any> | {
257
+ key: string;
258
+ label?: string;
259
+ color?: string;
260
+ }>;
261
+ /** Controls (SegmentedControl, etc.) shown in the header. */
262
+ actions?: ReactNode;
263
+ children: ReactNode;
264
+ }
265
+ /** A Card laid out for a chart: title, optional value/legend/actions, then the chart. */
266
+ declare function ChartCard({ title, description, value, legend, actions, children, className, ...rest }: ChartCardProps): react.JSX.Element;
267
+
268
+ interface ChartSurfaceProps extends Omit<HTMLAttributes<HTMLDivElement>, 'role'> {
269
+ /** Short machine name, rendered as `data-chart`, e.g. "sankey" or a gallery slug. */
270
+ name?: string;
271
+ /** What the chart says, in one sentence. Agents and screen readers cannot see SVG. */
272
+ 'aria-label': string;
273
+ /**
274
+ * `figure` (default) keeps legends, buttons and brushes inside reachable.
275
+ * Use `img` for a static picture with nothing to operate.
276
+ */
277
+ role?: 'figure' | 'img';
278
+ children: ReactNode;
279
+ }
280
+ /**
281
+ * ChartSurface — themes any raw `@unovis/react` chart with SW3 tokens.
282
+ * Use it for chart types without an SW3 wrapper (Sankey, Graph, Timeline,
283
+ * Chord, Treemap, Heatmap, maps, …): every `--vis-*` variable, in light and
284
+ * dark, resolves to an `--sw-*` token inside it.
285
+ */
286
+ declare function ChartSurface({ name, role, className, children, ...rest }: ChartSurfaceProps): react.JSX.Element;
287
+
288
+ export { AreaChart, BarChart, BarList, ChartCard, ChartSurface, DonutChart, Legend, LineChart, ScatterChart, Sparkline, Tracker, Treemap, TrendChart };
289
+ export type { Accessor, AreaChartProps, BarChartProps, BarListItem, BarListProps, ChartCardProps, ChartSurfaceProps, Curve, DonutChartProps, DonutSlice, LineChartProps, ScatterChartProps, Series, SparklineProps, TrackerItem, TrackerProps, TrackerStatus, TreemapGroup, TreemapProps, TrendChartProps, TrendMarker, TrendTone, XYChartProps };