twico-ui 1.8.0 → 1.9.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/llms.txt CHANGED
@@ -207,7 +207,7 @@ in the examples.
207
207
 
208
208
  ---
209
209
 
210
- ## Component reference (62 components)
210
+ ## Component reference (76 components)
211
211
 
212
212
  ### Buttons & actions
213
213
 
@@ -1249,6 +1249,106 @@ import { Badge } from "twico-ui";
1249
1249
  <Badge tone="info" size="lg">12 new</Badge>
1250
1250
  ```
1251
1251
 
1252
+ #### Boxplot
1253
+
1254
+ A dependency-free inline-SVG box-and-whisker chart that draws one box per category from a five-number summary (min, Q1, median, Q3, max) with whiskers and optional outlier points. Reach for it to compare the spread, skew, and outliers of distributions across groups where a bar or line chart would hide the shape of the data.
1255
+
1256
+ `import { Boxplot } from "twico-ui"`
1257
+
1258
+ Props:
1259
+ - `data` — `BoxplotDatum[]` · **required** — The boxes to plot, one per category, each a five-number summary with an optional array of outlier values.
1260
+ - `color` — `string` · default `"var(--color-primary)"` — Box fill and stroke accent, accepting any CSS color including a design token reference.
1261
+ - `height` — `number` · default `300` — Pixel height of the chart; the width fills its container at 100%.
1262
+ - `showGrid` — `boolean` · default `true` — Whether to draw horizontal grid lines at the value axis ticks behind the boxes.
1263
+ - `showAxis` — `boolean` · default `true` — Whether to render the value axis and the category labels under each box.
1264
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter applied to values in the per-box tooltip and the hidden data table.
1265
+ - `ariaLabel` — `string` · default `"box plot"` — Accessible name for the chart's role="img" SVG; per-box values are exposed via the hidden data table.
1266
+ - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as an accessible text alternative for screen readers (WCAG 1.1.1).
1267
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1268
+
1269
+ ```jsx
1270
+ import { Boxplot } from "twico-ui";
1271
+
1272
+ <Boxplot
1273
+ data={[
1274
+ { label: "API", min: 12, q1: 24, median: 33, q3: 42, max: 58, outliers: [72] },
1275
+ { label: "Web", min: 18, q1: 30, median: 41, q3: 52, max: 66 },
1276
+ { label: "Cache", min: 8, q1: 20, median: 27, q3: 38, max: 49 },
1277
+ ]}
1278
+ valueFormat={(v) => `${v}ms`}
1279
+ />
1280
+ ```
1281
+
1282
+ #### BubbleChart
1283
+
1284
+ A dependency-free SVG bubble chart — a ScatterChart preset that sizes each dot by a third value (z) across two nice-scaled numeric axes. Reach for it when you need to show a third dimension (volume, revenue, weight) on top of an x/y relationship.
1285
+
1286
+ `import { BubbleChart } from "twico-ui"`
1287
+
1288
+ Props:
1289
+ - `series` — `ScatterSeries[]` · **required** — The series to plot; each has an optional name/color and a list of { x, y, z?, label? } points.
1290
+ - `bubble` — `boolean` · default `true` — Size the dots by their z value; on by default for BubbleChart, and also auto-enabled when any point has a numeric z.
1291
+ - `maxBubble` — `number` · default `26` — Maximum bubble radius in pixels — the largest z value maps to this radius, with area scaling as radius ∝ √z.
1292
+ - `dotRadius` — `number` · default `4.5` — Fixed dot radius in pixels used when bubble sizing is turned off.
1293
+ - `height` — `number` · default `300` — Pixel height of the chart, which also sets the SVG aspect ratio so dots stay round.
1294
+ - `xLabel` — `React.ReactNode` — Axis title drawn beneath the x axis.
1295
+ - `yLabel` — `React.ReactNode` — Axis title drawn, rotated, beside the y axis.
1296
+ - `showGrid` — `boolean` · default `true` — Whether to render the background grid lines behind the plotted points.
1297
+ - `showLegend` — `boolean` · default `true when >1 series` — Whether to show the series legend; defaults on when there is more than one series.
1298
+ - `xFormat` — `(value: number) => string` — Formatter for x values in tooltips and the hidden table; defaults to valueFormat.
1299
+ - `yFormat` — `(value: number) => string` — Formatter for y values in tooltips and the hidden table; defaults to valueFormat.
1300
+ - `valueFormat` — `(value: number) => string` — Fallback value formatter for x/y/z, using locale-grouped numbers by default.
1301
+ - `ariaLabel` — `string` · default `"bubble chart"` — Accessible name for the chart's role="img" SVG; per-point values are exposed via the hidden data table instead.
1302
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1303
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1304
+
1305
+ ```jsx
1306
+ import { BubbleChart } from "twico-ui";
1307
+
1308
+ <BubbleChart
1309
+ series={[
1310
+ { name: "Plans", points: [
1311
+ { x: 12, y: 40, z: 800, label: "Starter" },
1312
+ { x: 26, y: 65, z: 2400, label: "Team" },
1313
+ { x: 48, y: 82, z: 5200, label: "Business" },
1314
+ ] },
1315
+ ]}
1316
+ xLabel="Seats"
1317
+ yLabel="Satisfaction"
1318
+ />
1319
+ ```
1320
+
1321
+ #### Candlestick
1322
+
1323
+ An OHLC candlestick chart that draws one candle per period — a high→low wick and an open→close body colored by direction — as dependency-free inline SVG. Reach for it to visualize price or range data over time; use Chart for bars, lines and areas.
1324
+
1325
+ `import { Candlestick } from "twico-ui"`
1326
+
1327
+ Props:
1328
+ - `data` — `CandlestickDatum[]` · **required** — OHLC data points, one candle each ({ label, open, high, low, close }), given in chronological order.
1329
+ - `upColor` — `string` · default `"var(--color-success)"` — Color for up candles where close is greater than or equal to open, accepting any CSS color.
1330
+ - `downColor` — `string` · default `"var(--color-danger)"` — Color for down candles where close is less than open, accepting any CSS color.
1331
+ - `height` — `number` · default `300` — Pixel height of the chart; the width always fills the container at 100 percent.
1332
+ - `showGrid` — `boolean` · default `true` — Whether to draw the horizontal value grid lines behind the candles.
1333
+ - `showAxis` — `boolean` · default `true` — Whether to render the value axis and the category (x) labels, which thin out automatically when dense.
1334
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formats values in the per-candle tooltip and the hidden data-table cells.
1335
+ - `ariaLabel` — `string` · default `"candlestick chart"` — Accessible name for the chart's SVG role="img"; aria-label is also accepted as an alternative.
1336
+ - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1337
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1338
+
1339
+ ```jsx
1340
+ import { Candlestick } from "twico-ui";
1341
+
1342
+ <Candlestick
1343
+ valueFormat={(v) => `$${v}`}
1344
+ data={[
1345
+ { label: "Mon", open: 132, high: 138, low: 130, close: 136 },
1346
+ { label: "Tue", open: 136, high: 141, low: 134, close: 135 },
1347
+ { label: "Wed", open: 135, high: 137, low: 128, close: 129 },
1348
+ ]}
1349
+ />
1350
+ ```
1351
+
1252
1352
  #### Card
1253
1353
 
1254
1354
  Card is a surface container for grouping related content, with an optional header (title/subtitle), body, and footer. Use it to present grouped information such as stats, summaries, or actions, optionally making it interactive with a hover-lift effect.
@@ -1326,6 +1426,8 @@ Props:
1326
1426
  - `showLegend` — `boolean` · default `false` — Displays a legend keying each series to its color, off by default and most useful when plotting multiple series.
1327
1427
  - `valueFormat` — `(value: number) => string` — Formats raw numeric values into display strings for tooltips, letting you add units, separators, or currency symbols.
1328
1428
  - `colors` — `string[]` · default `built-in token palette` — Per-series colors (any CSS color), cycled when shorter than series.
1429
+ - `showValues` — `boolean` · default `false` — Print each value as a small data label on the bars or points.
1430
+ - `animate` — `boolean` · default `true` — Play the entrance animation (bars grow, lines draw); respects prefers-reduced-motion.
1329
1431
  - `ariaLabel` — `string` — Accessible name for the chart's <svg role="img">; defaults to a description of the chart type.
1330
1432
 
1331
1433
  ```jsx
@@ -1504,6 +1606,158 @@ export default function Example() {
1504
1606
  }
1505
1607
  ```
1506
1608
 
1609
+ #### DonutChart
1610
+
1611
+ A PieChart preset rendered as a ring with a hollow center, showing proportional slices of a single value series with tooltips, an optional legend, and a donut center label. Reach for it to visualize parts-of-a-whole (traffic sources, budget splits, storage breakdowns) when you want a total called out in the middle.
1612
+
1613
+ `import { DonutChart } from "twico-ui"`
1614
+
1615
+ Props:
1616
+ - `data` — `PieChartDatum[]` · **required** — Slices to plot; each is a { label, value, color? } where only positive values contribute a slice.
1617
+ - `donut` — `boolean` · default `true` — Render as a donut (ring) instead of a filled pie; on by default for this preset, pass false for a solid pie.
1618
+ - `innerRadius` — `number` · default `0.6` — Inner-hole radius as a fraction (0..1) of the outer radius; 0.6 when donut, else 0.
1619
+ - `startAngle` — `number` · default `0` — Angle in degrees, clockwise from 12 o'clock, where the first slice starts.
1620
+ - `padAngle` — `number` · default `0` — Gap in degrees inserted between adjacent slices to visually separate them.
1621
+ - `showLabels` — `boolean` · default `false` — Draw a percentage label centered on each non-hairline slice directly on the ring.
1622
+ - `showLegend` — `boolean` · default `true` — Show the slice legend below the chart, mapping each color to its label.
1623
+ - `centerLabel` — `React.ReactNode` — Content for the donut's center; defaults to the formatted total when donut, and is ignored for a solid pie.
1624
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter applied to tooltip and hidden data-table values, e.g. adding a currency or percent sign.
1625
+ - `height` — `number` · default `260` — Pixel height of the chart; the square chart area is sized from this value.
1626
+ - `colors` — `string[]` — Per-slice colors (any CSS color), cycled when shorter than data; defaults to the built-in token palette.
1627
+ - `ariaLabel` — `string` · default `"donut chart"` — Accessible name for the <svg role="img">; per-slice values live in the hidden data table, not this label.
1628
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
1629
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1630
+
1631
+ ```jsx
1632
+ import { DonutChart } from "twico-ui";
1633
+
1634
+ <DonutChart
1635
+ data={[
1636
+ { label: "Direct", value: 42 },
1637
+ { label: "Referral", value: 28 },
1638
+ { label: "Social", value: 30 },
1639
+ ]}
1640
+ centerLabel="Traffic"
1641
+ showLegend
1642
+ />
1643
+
1644
+ <DonutChart data={data} donut={false} />
1645
+ ```
1646
+
1647
+ #### FunnelChart
1648
+
1649
+ A dependency-free inline-SVG funnel chart that draws descending stages as centered trapezoids tapering from each stage's value to the next. Reach for it to visualize conversion or drop-off flows where each step is a subset of the one above.
1650
+
1651
+ `import { FunnelChart } from "twico-ui"`
1652
+
1653
+ Props:
1654
+ - `data` — `FunnelDatum[]` · **required** — Funnel stages, each `{ label, value, color? }`, ordered from the widest/top stage down to the narrowest.
1655
+ - `showValues` — `boolean` · default `true` — Print each stage's formatted value in its centered caption.
1656
+ - `showPercent` — `boolean` · default `true` — Print each stage's percentage of the first (top) stage in its caption.
1657
+ - `horizontal` — `boolean` · default `false` — Lay the funnel out left→right (tapering vertically) instead of the default top→bottom flow.
1658
+ - `gap` — `number` · default `2` — Pixel gap between adjacent stage bands.
1659
+ - `height` — `number` · default `300` — Pixel height of the chart.
1660
+ - `colors` — `string[]` — Per-stage colors (any CSS color), cycled when shorter than data; defaults to the token palette.
1661
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter for captions, tooltips, and the hidden data-table cells.
1662
+ - `ariaLabel` — `string` · default `"funnel chart"` — Accessible name for the chart's `<svg role="img">`; also accepts `aria-label`, with per-stage values in the hidden table.
1663
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative (WCAG 1.1.1).
1664
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1665
+
1666
+ ```jsx
1667
+ import { FunnelChart } from "twico-ui";
1668
+
1669
+ <FunnelChart
1670
+ data={[
1671
+ { label: "Visits", value: 8200 },
1672
+ { label: "Signups", value: 4100 },
1673
+ { label: "Trials", value: 1600 },
1674
+ { label: "Paid", value: 540 },
1675
+ ]}
1676
+ valueFormat={(v) => v.toLocaleString()}
1677
+ />
1678
+
1679
+ <FunnelChart horizontal showPercent={false} height={220} data={[
1680
+ { label: "Leads", value: 500, color: "var(--sky-500)" },
1681
+ { label: "Qualified", value: 320 },
1682
+ { label: "Won", value: 90 },
1683
+ ]} />
1684
+ ```
1685
+
1686
+ #### Gauge
1687
+
1688
+ A dependency-free inline-SVG radial gauge that renders a single value as a thick arc sweeping between two angles, with the value and an optional caption in the center. Reach for it to show a KPI, progress, or capacity reading — or pass `series` to draw several concentric rings as a radial-bar chart.
1689
+
1690
+ `import { Gauge } from "twico-ui"`
1691
+
1692
+ Props:
1693
+ - `value` — `number` · default `0` — The value to display, mapped from the min..max domain onto the arc sweep.
1694
+ - `min` — `number` · default `0` — Lower bound of the value domain, mapped to the startAngle.
1695
+ - `max` — `number` · default `100` — Upper bound of the value domain, mapped to the endAngle.
1696
+ - `startAngle` — `number` · default `-110` — Sweep start angle in degrees, where 0 is the top and angles run clockwise.
1697
+ - `endAngle` — `number` · default `110` — Sweep end angle in degrees, where 0 is the top and angles run clockwise.
1698
+ - `thickness` — `number` · default `0.16` — Ring stroke width expressed as a fraction of the gauge radius.
1699
+ - `showValue` — `boolean` · default `true` — Show the formatted value in the center; applies to a single gauge only.
1700
+ - `label` — `React.ReactNode` — Small caption rendered under the center value for a single gauge.
1701
+ - `valueFormat` — `(value: number) => string` — Formats the center value and hidden-table cells; defaults to a rounded integer.
1702
+ - `color` — `string` · default `"var(--color-primary)"` — Value-arc color, accepting any CSS color string.
1703
+ - `trackColor` — `string` · default `"var(--color-surface-sunken)"` — Background track color behind the value arc, accepting any CSS color string.
1704
+ - `size` — `number` · default `200` — SVG width and height in pixels; the gauge is always square.
1705
+ - `series` — `GaugeSeries[]` — Multiple concentric radial bars; when set, the single value and label are ignored.
1706
+ - `showLegend` — `boolean` · default `true` — Show the legend for a multi-ring gauge driven by the series prop.
1707
+ - `ariaLabel` — `string` — Accessible name for the SVG role="img"; defaults to a value summary and also accepts aria-label.
1708
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative per WCAG 1.1.1.
1709
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the gauge's accessible label.
1710
+
1711
+ ```jsx
1712
+ import { Gauge } from "twico-ui";
1713
+
1714
+ <Gauge value={72} label="CPU" valueFormat={(n) => `${Math.round(n)}%`} />
1715
+
1716
+ <Gauge size={220} series={[
1717
+ { value: 82, label: "Complete", color: "var(--emerald-500)" },
1718
+ { value: 54, label: "In review" },
1719
+ { value: 23, label: "Blocked" },
1720
+ ]} />
1721
+ ```
1722
+
1723
+ #### Heatmap
1724
+
1725
+ A dependency-free SVG matrix of colored cells keyed by (x, y), each shaded by a single-hue intensity scale between min and max. Reach for it to reveal density, correlation, or activity patterns across two categorical dimensions — think punch-card activity grids, cohort retention, or correlation matrices.
1726
+
1727
+ `import { Heatmap } from "twico-ui"`
1728
+
1729
+ Props:
1730
+ - `data` — `HeatmapDatum[]` · **required** — Cells to plot as { x, y, value } objects; X columns and Y rows are derived from these in first-seen order.
1731
+ - `min` — `number` — Low end of the color scale; defaults to the minimum value found in data.
1732
+ - `max` — `number` — High end of the color scale; defaults to the maximum value found in data.
1733
+ - `colorScale` — `string` · default `"var(--brand-500)"` — Base token color for the high end; cells mix it over transparent by their value intensity.
1734
+ - `showValues` — `boolean` · default `false` — Print each cell's formatted value at its center in addition to the color shading.
1735
+ - `cellGap` — `number` · default `2` — Gap in pixels between adjacent cells in the grid.
1736
+ - `radius` — `number` · default `2` — Cell corner radius in pixels.
1737
+ - `xLabel` — `React.ReactNode` — Optional title rendered beneath the X-axis category labels.
1738
+ - `yLabel` — `React.ReactNode` — Optional title rendered rotated alongside the Y-axis category labels.
1739
+ - `showLegend` — `boolean` · default `true` — Show the low-to-high gradient scale legend below the grid.
1740
+ - `valueFormat` — `(value: number) => string` · default `fmtNumber` — Formatter for tooltips, printed cell values, and the hidden data table.
1741
+ - `height` — `number` · default `300` — Pixel height of the chart.
1742
+ - `ariaLabel` — `string` · default `"heatmap"` — Accessible name for the chart's SVG role="img"; also accepts aria-label, with per-cell values exposed via the hidden table.
1743
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative (WCAG 1.1.1).
1744
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1745
+
1746
+ ```jsx
1747
+ import { Heatmap } from "twico-ui";
1748
+
1749
+ <Heatmap
1750
+ xLabel="Hour"
1751
+ yLabel="Day"
1752
+ data={[
1753
+ { x: "9a", y: "Mon", value: 12 }, { x: "12p", y: "Mon", value: 48 },
1754
+ { x: "9a", y: "Tue", value: 20 }, { x: "12p", y: "Tue", value: 62 },
1755
+ ]}
1756
+ />
1757
+
1758
+ <Heatmap showValues colorScale="var(--emerald-500)" valueFormat={(v) => `${v}%`} data={cells} />
1759
+ ```
1760
+
1507
1761
  #### Kanban
1508
1762
 
1509
1763
  Kanban is a drag-and-drop board that arranges cards into columns you can drag between. Use it for visualizing and reorganizing work items (tasks, tickets, stages) by status, either controlled via cards + onCardMove or uncontrolled.
@@ -1589,6 +1843,227 @@ const [page, setPage] = useState(1);
1589
1843
  />
1590
1844
  ```
1591
1845
 
1846
+ #### PieChart
1847
+
1848
+ A dependency-free inline-SVG pie or donut chart that renders proportional slices of a whole from a single value series, with per-slice tooltips, an optional legend, percentage labels, and a donut center label. Reach for it to show part-to-whole composition; use Chart for bar/line/area trends.
1849
+
1850
+ `import { PieChart } from "twico-ui"`
1851
+
1852
+ Props:
1853
+ - `data` — `PieChartDatum[]` · **required** — Slices to plot, each a { label, value, color? }; only positive values contribute a slice and negatives are treated as zero.
1854
+ - `donut` — `boolean` · default `false` — Render as a donut ring instead of a filled pie, using the default innerRadius.
1855
+ - `innerRadius` — `number` · default `0.6 when donut, else 0` — Inner-hole radius as a fraction (0..1) of the outer radius, letting you tune the ring thickness.
1856
+ - `startAngle` — `number` · default `0` — Angle in degrees, clockwise from 12 o'clock, where the first slice begins.
1857
+ - `padAngle` — `number` · default `0` — Gap in degrees inserted between adjacent slices to visually separate them.
1858
+ - `showLabels` — `boolean` · default `false` — Draw a percentage label centered on each non-hairline slice.
1859
+ - `showLegend` — `boolean` · default `true` — Show the slice legend below the chart.
1860
+ - `centerLabel` — `React.ReactNode` · default `formatted total when donut` — Content for a donut's center; defaults to the formatted total and is ignored for a solid pie.
1861
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter for the tooltip and hidden data-table values.
1862
+ - `height` — `number` · default `260` — Pixel height of the chart; the square chart area is sized from this value.
1863
+ - `colors` — `string[]` · default `built-in token palette` — Per-slice colors (any CSS color), cycled when shorter than data; defaults to the built-in token palette.
1864
+ - `ariaLabel` — `string` · default `"pie chart" / "donut chart"` — Accessible name for the role="img" SVG; per-slice values live in the hidden data table, not this label.
1865
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative for the chart (WCAG 1.1.1).
1866
+ - `caption` — `React.ReactNode` · default `chart's accessible label` — Caption for the hidden data table; defaults to the chart's accessible label.
1867
+
1868
+ ```jsx
1869
+ import { PieChart } from "twico-ui";
1870
+
1871
+ <PieChart data={[
1872
+ { label: "Direct", value: 340 },
1873
+ { label: "Referral", value: 210 },
1874
+ { label: "Social", value: 120 },
1875
+ ]} />
1876
+
1877
+ <PieChart donut showLabels centerLabel="100%" data={[
1878
+ { label: "Done", value: 62, color: "var(--emerald-500)" },
1879
+ { label: "In progress", value: 28 },
1880
+ { label: "Blocked", value: 10 },
1881
+ ]} />
1882
+ ```
1883
+
1884
+ #### PolarAreaChart
1885
+
1886
+ A dependency-free inline-SVG polar-area (Coxcomb / Nightingale rose) chart of equal-angle slices whose radius encodes each value over concentric value rings. Reach for it to compare a handful of categories where slice area — scaled by the square root so it stays statistically honest — reads more naturally than bars or wedges.
1887
+
1888
+ `import { PolarAreaChart } from "twico-ui"`
1889
+
1890
+ Props:
1891
+ - `data` — `PolarAreaDatum[]` · **required** — Data points — one equal-angle slice each, ordered clockwise from startAngle, each with a label, value, and optional color.
1892
+ - `max` — `number` — Radial maximum (the value at the outer ring); defaults to a nice ceiling of the largest value.
1893
+ - `levels` — `number` · default `4` — Number of concentric grid rings drawn, which also sets how many value tick labels appear.
1894
+ - `startAngle` — `number` · default `0` — Angle in degrees of the first slice's leading edge, measured clockwise from the 12 o'clock position.
1895
+ - `showLegend` — `boolean` · default `true` — Show the per-slice legend listing each category label with its swatch below the chart.
1896
+ - `valueFormat` — `(value: number) => string` · default `fmtNumber` — Formats values shown in the per-slice tooltip and the hidden data-table cells.
1897
+ - `height` — `number` · default `280` — Pixel height of the chart; the square plotting area is centered within the full-width container.
1898
+ - `colors` — `string[]` — Per-slice colors (any CSS color) cycled across slices; defaults to the built-in token palette.
1899
+ - `ariaLabel` — `string` · default `"polar area chart"` — Accessible name for the chart's SVG role="img"; aria-label is also accepted as an alternative.
1900
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative for screen readers (WCAG 1.1.1).
1901
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1902
+
1903
+ ```jsx
1904
+ import { PolarAreaChart } from "twico-ui";
1905
+
1906
+ <PolarAreaChart
1907
+ data={[
1908
+ { label: "Mon", value: 12 },
1909
+ { label: "Tue", value: 30 },
1910
+ { label: "Wed", value: 22 },
1911
+ { label: "Thu", value: 41 },
1912
+ { label: "Fri", value: 18, color: "var(--rose-500)" },
1913
+ ]}
1914
+ valueFormat={(v) => `${v}h`}
1915
+ />
1916
+
1917
+ <PolarAreaChart max={100} levels={5} startAngle={-90} showLegend={false} data={[
1918
+ { label: "N", value: 40 }, { label: "E", value: 65 }, { label: "S", value: 25 }, { label: "W", value: 80 },
1919
+ ]} />
1920
+ ```
1921
+
1922
+ #### RadarChart
1923
+
1924
+ A dependency-free SVG radar (spider) chart that plots one or more series as closed polygons over a shared set of categorical axes radiating from a center. Reach for it to compare multi-dimensional profiles — skill sets, scorecards, feature ratings — where each entity is a shape across the same handful of metrics.
1925
+
1926
+ `import { RadarChart } from "twico-ui"`
1927
+
1928
+ Props:
1929
+ - `data` — `RadarDatum<K>[]` · **required** — Data rows, one per axis; each carries a label plus one numeric field for every series key you plot.
1930
+ - `series` — `K[]` · default `["value"]` — Series field names to draw as polygons; supplying more than one overlays several shapes on the same axes.
1931
+ - `max` — `number` — Radial value at the outer ring; defaults to a nice ceiling computed from the largest datum.
1932
+ - `levels` — `number` · default `4` — Number of concentric grid rings drawn between the center and the outer edge of the chart.
1933
+ - `fill` — `boolean` · default `true` — Fills each polygon at low opacity in addition to its stroke; set false for a clean outline.
1934
+ - `showLegend` — `boolean` · default `series.length > 1` — Shows a series legend; defaults to true when more than one series is plotted, otherwise false.
1935
+ - `showDots` — `boolean` · default `true` — Draws a marker dot at each polygon vertex where an axis meets its series value.
1936
+ - `colors` — `string[]` — Per-series CSS colors, cycled when shorter than series; defaults to the built-in design-token palette.
1937
+ - `valueFormat` — `(value: number) => string` — Formats values shown in tooltips and the hidden accessible data-table cells.
1938
+ - `height` — `number` · default `300` — Pixel height of the chart, which renders on a square canvas of this size.
1939
+ - `ariaLabel` — `string` · default `"radar chart"` — Accessible name for the chart's role="img" SVG; also accepts the aria-label attribute.
1940
+ - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden data table as a text alternative to the SVG for screen readers (WCAG 1.1.1).
1941
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label.
1942
+
1943
+ ```jsx
1944
+ import { RadarChart } from "twico-ui";
1945
+
1946
+ <RadarChart
1947
+ series={["team", "rival"]}
1948
+ showLegend
1949
+ data={[
1950
+ { label: "Speed", team: 80, rival: 65 },
1951
+ { label: "Power", team: 60, rival: 90 },
1952
+ { label: "Defense", team: 85, rival: 60 },
1953
+ ]}
1954
+ />
1955
+
1956
+ <RadarChart series={["score"]} max={100} levels={5} data={scoreData} />
1957
+ ```
1958
+
1959
+ #### RangeChart
1960
+
1961
+ A dependency-free inline-SVG chart for values that span a min→max range: horizontal range bars for a timeline/Gantt of one band per row, or a range area shading the band between a per-category min line and max line. Reach for it when each data point is an interval (start→end, low→high) rather than a single value.
1962
+
1963
+ `import { RangeChart } from "twico-ui"`
1964
+
1965
+ Props:
1966
+ - `type` — `"bar" | "area"` · default `"bar"` — Chooses horizontal range bars (a timeline/Gantt) or a range area shading the band between a min and max line.
1967
+ - `data` — `RangeDatum[]` · **required** — Range points, each a { label, min, max, color? }; bars run top→bottom while the area runs left→right.
1968
+ - `height` — `number` · default `300` — Pixel height of the chart; the SVG stretches to fill 100% of its container width.
1969
+ - `showGrid` — `boolean` · default `true` — Toggles the value grid lines — vertical for bars, horizontal for the area band.
1970
+ - `showAxis` — `boolean` · default `true` — Toggles the value axis together with the per-category labels drawn alongside the chart.
1971
+ - `colors` — `string[]` — Palette for bar fills and the area band, cycled by index; defaults to the built-in token palette.
1972
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formats numbers in tooltips and the hidden data-table cells, e.g. adding units or currency symbols.
1973
+ - `ariaLabel` — `string` · default `"range <type> chart"` — Accessible name for the chart's role="img" SVG; aria-label is also accepted as an alias.
1974
+ - `tableFallback` — `boolean` · default `true` — Renders a visually-hidden min/max data table as an accessible text alternative for screen readers (WCAG 1.1.1).
1975
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
1976
+
1977
+ ```jsx
1978
+ import { RangeChart } from "twico-ui";
1979
+
1980
+ <RangeChart type="bar" data={[
1981
+ { label: "Design", min: 0, max: 4 },
1982
+ { label: "Build", min: 3, max: 9 },
1983
+ ]} />
1984
+
1985
+ <RangeChart type="area" data={[
1986
+ { label: "Mon", min: 12, max: 20 },
1987
+ { label: "Tue", min: 14, max: 24 },
1988
+ ]} />
1989
+ ```
1990
+
1991
+ #### ScatterChart
1992
+
1993
+ A dependency-free inline-SVG scatter and bubble chart that plots x/y points across two nice-scaled numeric axes, with one or many series, grid, tooltips, an optional legend, and a hidden data table. Reach for it to show correlation or distribution between two numeric variables — add a per-point z value to encode a third dimension as bubble size.
1994
+
1995
+ `import { ScatterChart } from "twico-ui"`
1996
+
1997
+ Props:
1998
+ - `series` — `ScatterSeries[]` · **required** — The series to plot; each has an optional name/color and a list of { x, y, z?, label? } points.
1999
+ - `bubble` — `boolean` · default `false` — Size the dots by their z value (bubble chart); auto-enabled when any point has a numeric z.
2000
+ - `maxBubble` — `number` · default `26` — Maximum bubble radius in pixels — the largest z value maps to this size.
2001
+ - `dotRadius` — `number` · default `4.5` — Fixed dot radius in pixels used when the chart is not in bubble mode.
2002
+ - `height` — `number` · default `300` — Pixel height of the chart, which also sets the SVG aspect ratio so dots stay round.
2003
+ - `xLabel` — `React.ReactNode` — Axis title drawn beneath the x axis.
2004
+ - `yLabel` — `React.ReactNode` — Axis title drawn rotated beside the y axis.
2005
+ - `showGrid` — `boolean` · default `true` — Whether to draw the background grid lines behind the plotted points.
2006
+ - `showLegend` — `boolean` · default `true when >1 series` — Whether to show the series legend; defaults on when there is more than one series.
2007
+ - `xFormat` — `(value: number) => string` · default `valueFormat` — Formatter for x values in tooltips and the hidden table; defaults to valueFormat.
2008
+ - `yFormat` — `(value: number) => string` · default `valueFormat` — Formatter for y values in tooltips and the hidden table; defaults to valueFormat.
2009
+ - `valueFormat` — `(value: number) => string` · default `locale-grouped numbers` — Fallback value formatter for x, y, and z values; defaults to locale-grouped numbers.
2010
+ - `ariaLabel` — `string` · default `"scatter chart" / "bubble chart"` — Accessible name for the chart's role="img" SVG; also accepts aria-label. Per-point values live in the hidden table.
2011
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table as an accessible text alternative to the SVG (WCAG 1.1.1).
2012
+ - `caption` — `React.ReactNode` · default `chart's accessible label` — Caption for the hidden data table; defaults to the chart's accessible label.
2013
+
2014
+ ```jsx
2015
+ import { ScatterChart } from "twico-ui";
2016
+
2017
+ <ScatterChart
2018
+ xLabel="Weight"
2019
+ yLabel="Score"
2020
+ series={[
2021
+ { name: "Group A", points: [{ x: 12, y: 30 }, { x: 20, y: 45 }] },
2022
+ { name: "Group B", points: [{ x: 15, y: 22 }, { x: 28, y: 38 }] },
2023
+ ]}
2024
+ />
2025
+
2026
+ // Bubble chart — a numeric z auto-enables sizing
2027
+ <ScatterChart
2028
+ maxBubble={32}
2029
+ series={[{ name: "Markets", points: [
2030
+ { x: 40, y: 12, z: 900, label: "US" },
2031
+ { x: 22, y: 30, z: 400, label: "EU" },
2032
+ ] }]}
2033
+ />
2034
+ ```
2035
+
2036
+ #### Sparkline
2037
+
2038
+ A minimal, word-sized trend chart — line, area, or bars — with no axes, grid, ticks, or legend. Reach for it to sit inline beside text or inside a table cell or stat tile; for a full chart with axes, tooltips, and a legend use Chart instead.
2039
+
2040
+ `import { Sparkline } from "twico-ui"`
2041
+
2042
+ Props:
2043
+ - `data` — `SparklineDatum[]` · **required** — The points to plot: bare numbers, or `{ value, label }` objects whose label is used for tooltips and the hidden table.
2044
+ - `type` — `"line" | "area" | "bar"` · default `"line"` — Trend style: `area` fills below the line and `bar` draws thin columns instead of a continuous line.
2045
+ - `area` — `boolean` · default `false` — Shorthand for `type="area"`, filling the region below the line without setting the full type prop.
2046
+ - `color` — `string` · default `"var(--color-primary)"` — Stroke and fill color; accepts any CSS color, including a design token like `var(--emerald-500)`.
2047
+ - `width` — `number` · default `120` — The SVG viewbox width in pixels; the rendered element still scales to fill its container width.
2048
+ - `height` — `number` · default `40` — Pixel height of the sparkline, controlling how tall the trend renders inline.
2049
+ - `strokeWidth` — `number` · default `2` — Line stroke width in pixels; ignored for the bar type, which draws columns rather than a stroke.
2050
+ - `curve` — `"straight" | "smooth" | "stepped"` · default `"smooth"` — Line and area interpolation: straight segments, a smooth spline, or stepped right-angle transitions between points.
2051
+ - `showDots` — `boolean` · default `false` — Emphasize the last data point with a filled dot to highlight the most recent value.
2052
+ - `min` — `number` — Pin the low end of the value scale; when omitted it is derived from the data's minimum.
2053
+ - `max` — `number` — Pin the high end of the value scale; when omitted it is derived from the data's maximum.
2054
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter for values shown in tooltips and the hidden data table, e.g. adding a currency or percent unit.
2055
+ - `ariaLabel` — `string` — Accessible name for the `<svg role="img">`; defaults to a spoken summary of point count and first/last/min/max.
2056
+ - `tableFallback` — `boolean` · default `false` — Render a visually-hidden data table as a WCAG 1.1.1 text alternative; off by default since the aria-label usually suffices.
2057
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the accessible label when not provided.
2058
+
2059
+ ```jsx
2060
+ import { Sparkline } from "twico-ui";
2061
+
2062
+ <Sparkline data={[3, 5, 4, 8, 6, 9, 7, 12]} showDots />
2063
+ <Sparkline area color="var(--emerald-500)" data={[120, 180, 140, 220]} />
2064
+ <Sparkline type="bar" height={28} data={[4, 6, 2, 8, 5, 7]} />
2065
+ ```
2066
+
1592
2067
  #### Stat
1593
2068
 
1594
2069
  Stat is a KPI / metric card that displays a label, a large value, and optional icon, trend delta, and help text. Use it on dashboards or summary panels to surface a single key metric with its trend direction.
@@ -1718,6 +2193,38 @@ import { Timeline } from "twico-ui";
1718
2193
  />
1719
2194
  ```
1720
2195
 
2196
+ #### Treemap
2197
+
2198
+ A dependency-free SVG treemap that partitions a rectangle into tiles sized in proportion to a flat list of values, using a squarified layout that keeps tile aspect ratios near 1:1. Reach for it to show the relative weight of parts within a whole — spend by category, storage by bucket — where a pie would crowd or a bar chart would lose the sense of area.
2199
+
2200
+ `import { Treemap } from "twico-ui"`
2201
+
2202
+ Props:
2203
+ - `data` — `TreemapDatum[]` · **required** — Tiles to lay out; each has a label, a non-negative value driving its area, and an optional color override.
2204
+ - `showValues` — `boolean` · default `true` — Draw the formatted value under the label inside tiles tall enough to fit both lines of text.
2205
+ - `valueFormat` — `(value: number) => string` · default `toLocaleString` — Formatter applied to the tooltip, the in-tile value, and the hidden data-table cells.
2206
+ - `height` — `number` · default `300` — Pixel height, which also sets the SVG's aspect ratio; the width fills the container.
2207
+ - `colors` — `string[]` — Tile colors cycled by index; defaults to the built-in token palette, and a datum's own color wins.
2208
+ - `gap` — `number` · default `2` — Gap in pixels inset between adjacent tiles so their boundaries read clearly.
2209
+ - `ariaLabel` — `string` · default `"treemap"` — Accessible name for the chart's role="img" SVG; also accepts aria-label, with values exposed via the data table.
2210
+ - `tableFallback` — `boolean` · default `true` — Render a visually-hidden data table of value and share as an accessible text alternative (WCAG 1.1.1).
2211
+ - `caption` — `React.ReactNode` — Caption for the hidden data table; defaults to the chart's accessible label when omitted.
2212
+
2213
+ ```jsx
2214
+ import { Treemap } from "twico-ui";
2215
+
2216
+ <Treemap
2217
+ ariaLabel="Cloud spend by service"
2218
+ valueFormat={(v) => `$${v.toLocaleString()}`}
2219
+ data={[
2220
+ { label: "Compute", value: 4200 },
2221
+ { label: "Storage", value: 2600 },
2222
+ { label: "Network", value: 1800 },
2223
+ { label: "Other", value: 700, color: "var(--slate-500)" },
2224
+ ]}
2225
+ />
2226
+ ```
2227
+
1721
2228
  ### Navigation
1722
2229
 
1723
2230
  #### Accordion
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "twico-ui",
3
- "version": "1.8.0",
3
+ "version": "1.9.0",
4
4
  "description": "Twico UI — a free, modern, themeable React + Tailwind-friendly component library. 61 components with dark mode, motion, and accessibility built in.",
5
5
  "license": "MIT",
6
6
  "author": "Twico UI",