@dodopayments/ui 1.4.0 → 1.5.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/ai/component-registry.json +209 -68
- package/ai/component-registry.md +1 -0
- package/ai/components/area-chart.md +4 -4
- package/ai/components/avatar.md +1 -1
- package/ai/components/bar-chart.md +18 -18
- package/ai/components/chart-tooltip.md +3 -3
- package/ai/components/chart.md +6 -6
- package/ai/components/checkout-page.md +1 -1
- package/ai/components/composed-chart.md +7 -7
- package/ai/components/copyable-id.md +1 -0
- package/ai/components/filter-grid.md +4 -7
- package/ai/components/funnel-chart.md +14 -12
- package/ai/components/gauge-chart.md +9 -11
- package/ai/components/line-chart.md +2 -2
- package/ai/components/money.md +3 -3
- package/ai/components/pie-chart.md +11 -2
- package/ai/components/reorder-list.md +1 -1
- package/ai/components/ring-chart.md +17 -8
- package/ai/components/sale-share-card.md +48 -0
- package/ai/components/sankey-chart.md +23 -23
- package/ai/components/stat-card.md +32 -5
- package/ai/components/sunburst-chart.md +7 -4
- package/ai/components/test-mode-banner.md +3 -3
- package/ai/skills/dodo-charts/SKILL.md +12 -7
- package/ai/skills/dodo-design/SKILL.md +2 -1
- package/dist/components/avatar/avatar.d.ts +9 -7
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +9 -7
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/copyable-id/copyable-id.d.ts +7 -1
- package/dist/components/copyable-id/copyable-id.d.ts.map +1 -1
- package/dist/components/copyable-id/copyable-id.js +21 -3
- package/dist/components/copyable-id/copyable-id.js.map +1 -1
- package/dist/components/data-grid/bulk-actions.js +1 -1
- package/dist/components/data-grid/bulk-actions.js.map +1 -1
- package/dist/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.js +15 -3
- package/dist/components/data-grid/data-grid.js.map +1 -1
- package/dist/components/data-grid/table.d.ts.map +1 -1
- package/dist/components/data-grid/table.js +5 -0
- package/dist/components/data-grid/table.js.map +1 -1
- package/dist/components/filter-grid/filter-grid.d.ts +7 -2
- package/dist/components/filter-grid/filter-grid.d.ts.map +1 -1
- package/dist/components/filter-grid/filter-grid.js +3 -2
- package/dist/components/filter-grid/filter-grid.js.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.d.ts +3 -2
- package/dist/components/funnel-chart/funnel-chart.d.ts.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.js +3 -2
- package/dist/components/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.d.ts +3 -4
- package/dist/components/gauge-chart/gauge-chart.d.ts.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.js +3 -4
- package/dist/components/gauge-chart/gauge-chart.js.map +1 -1
- package/dist/components/live-activity/live-activity.d.ts.map +1 -1
- package/dist/components/live-activity/live-activity.js +8 -3
- package/dist/components/live-activity/live-activity.js.map +1 -1
- package/dist/components/page-header/page-header.d.ts.map +1 -1
- package/dist/components/page-header/page-header.js +3 -2
- package/dist/components/page-header/page-header.js.map +1 -1
- package/dist/components/payment-method-list/payment-method-list.d.ts.map +1 -1
- package/dist/components/payment-method-list/payment-method-list.js +4 -1
- package/dist/components/payment-method-list/payment-method-list.js.map +1 -1
- package/dist/components/sale-share-card/index.d.ts +2 -0
- package/dist/components/sale-share-card/index.d.ts.map +1 -0
- package/dist/components/sale-share-card/index.js +2 -0
- package/dist/components/sale-share-card/index.js.map +1 -0
- package/dist/components/sale-share-card/sale-share-card.d.ts +27 -0
- package/dist/components/sale-share-card/sale-share-card.d.ts.map +1 -0
- package/dist/components/sale-share-card/sale-share-card.js +46 -0
- package/dist/components/sale-share-card/sale-share-card.js.map +1 -0
- package/dist/components/sankey-chart/sankey-chart.d.ts +4 -4
- package/dist/components/sankey-chart/sankey-chart.js +4 -4
- package/dist/components/slider/slider-thumb.d.ts +2 -2
- package/dist/components/slider/slider-thumb.d.ts.map +1 -1
- package/dist/components/slider/slider-thumb.js +2 -2
- package/dist/components/slider/slider-thumb.js.map +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/stat-card/index.d.ts +1 -1
- package/dist/components/stat-card/index.d.ts.map +1 -1
- package/dist/components/stat-card/index.js +1 -1
- package/dist/components/stat-card/index.js.map +1 -1
- package/dist/components/stat-card/stat-card.d.ts +47 -7
- package/dist/components/stat-card/stat-card.d.ts.map +1 -1
- package/dist/components/stat-card/stat-card.js +72 -12
- package/dist/components/stat-card/stat-card.js.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.d.ts +2 -1
- package/dist/components/sunburst-chart/sunburst-chart.d.ts.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.js +2 -1
- package/dist/components/sunburst-chart/sunburst-chart.js.map +1 -1
- package/dist/components/timestamp/timestamp.js +1 -1
- package/dist/components/timestamp/timestamp.js.map +1 -1
- package/dist/lib/cn-tables.js +5 -5
- package/dist/lib/cn-tables.js.map +1 -1
- package/dist/primitives/charts/area-chart.js +1 -1
- package/dist/primitives/charts/area-chart.js.map +1 -1
- package/dist/primitives/charts/area.d.ts +1 -1
- package/dist/primitives/charts/area.d.ts.map +1 -1
- package/dist/primitives/charts/bar-chart.js +1 -1
- package/dist/primitives/charts/bar-chart.js.map +1 -1
- package/dist/primitives/charts/bar-squares.d.ts +1 -1
- package/dist/primitives/charts/bar-squares.d.ts.map +1 -1
- package/dist/primitives/charts/bar.d.ts +6 -5
- package/dist/primitives/charts/bar.d.ts.map +1 -1
- package/dist/primitives/charts/bar.js +1 -1
- package/dist/primitives/charts/bar.js.map +1 -1
- package/dist/primitives/charts/chart-context.js +2 -2
- package/dist/primitives/charts/chart-context.js.map +1 -1
- package/dist/primitives/charts/composed-chart.js +3 -3
- package/dist/primitives/charts/composed-chart.js.map +1 -1
- package/dist/primitives/charts/funnel-chart.d.ts +12 -8
- package/dist/primitives/charts/funnel-chart.d.ts.map +1 -1
- package/dist/primitives/charts/funnel-chart.js +38 -9
- package/dist/primitives/charts/funnel-chart.js.map +1 -1
- package/dist/primitives/charts/gauge.d.ts +4 -4
- package/dist/primitives/charts/gauge.js +7 -7
- package/dist/primitives/charts/gauge.js.map +1 -1
- package/dist/primitives/charts/line-chart.js +1 -1
- package/dist/primitives/charts/line-chart.js.map +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.d.ts.map +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.js +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.js.map +1 -1
- package/dist/primitives/charts/line.d.ts +1 -1
- package/dist/primitives/charts/line.d.ts.map +1 -1
- package/dist/primitives/charts/notch-gauge-shared.d.ts.map +1 -1
- package/dist/primitives/charts/notch-gauge-shared.js +4 -3
- package/dist/primitives/charts/notch-gauge-shared.js.map +1 -1
- package/dist/primitives/charts/pie-context.d.ts +3 -2
- package/dist/primitives/charts/pie-context.d.ts.map +1 -1
- package/dist/primitives/charts/pie-context.js +7 -6
- package/dist/primitives/charts/pie-context.js.map +1 -1
- package/dist/primitives/charts/pie-slice.d.ts +2 -2
- package/dist/primitives/charts/pie-slice.js +1 -1
- package/dist/primitives/charts/pie-slice.js.map +1 -1
- package/dist/primitives/charts/ring-context.d.ts +4 -2
- package/dist/primitives/charts/ring-context.d.ts.map +1 -1
- package/dist/primitives/charts/ring-context.js +8 -6
- package/dist/primitives/charts/ring-context.js.map +1 -1
- package/dist/primitives/charts/ring.d.ts +8 -8
- package/dist/primitives/charts/ring.d.ts.map +1 -1
- package/dist/primitives/charts/ring.js +4 -4
- package/dist/primitives/charts/ring.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.d.ts +9 -10
- package/dist/primitives/charts/sankey/sankey-link.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.js +14 -9
- package/dist/primitives/charts/sankey/sankey-link.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.d.ts +5 -5
- package/dist/primitives/charts/sankey/sankey-node.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.js +6 -6
- package/dist/primitives/charts/sankey/sankey-node.js.map +1 -1
- package/dist/primitives/charts/series-bar.d.ts +4 -4
- package/dist/primitives/charts/series-bar.d.ts.map +1 -1
- package/dist/primitives/charts/series-bar.js +1 -1
- package/dist/primitives/charts/series-bar.js.map +1 -1
- package/dist/primitives/charts/sunburst-context.d.ts +3 -2
- package/dist/primitives/charts/sunburst-context.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-context.js +6 -5
- package/dist/primitives/charts/sunburst-context.js.map +1 -1
- package/dist/primitives/charts/sunburst-legend.d.ts +7 -2
- package/dist/primitives/charts/sunburst-legend.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-legend.js +8 -6
- package/dist/primitives/charts/sunburst-legend.js.map +1 -1
- package/dist/primitives/charts/sunburst-segment.d.ts +3 -3
- package/dist/primitives/charts/sunburst-segment.js +2 -2
- package/dist/primitives/charts/sunburst-segment.js.map +1 -1
- package/dist/primitives/charts/tooltip/date-ticker.js +2 -2
- package/dist/primitives/charts/tooltip/date-ticker.js.map +1 -1
- package/dist/primitives/charts/tooltip/tooltip-box.js +1 -1
- package/dist/primitives/charts/tooltip/tooltip-box.js.map +1 -1
- package/dist/primitives/ui/alert-dialog.js +1 -1
- package/dist/primitives/ui/alert-dialog.js.map +1 -1
- package/dist/primitives/ui/autocomplete.js +1 -1
- package/dist/primitives/ui/autocomplete.js.map +1 -1
- package/dist/primitives/ui/dialog.js +1 -1
- package/dist/primitives/ui/dialog.js.map +1 -1
- package/dist/primitives/ui/drawer.js +1 -1
- package/dist/primitives/ui/drawer.js.map +1 -1
- package/dist/primitives/ui/popover.js +1 -1
- package/dist/primitives/ui/popover.js.map +1 -1
- package/dist/primitives/ui/preview-card.js +1 -1
- package/dist/primitives/ui/preview-card.js.map +1 -1
- package/dist/primitives/ui/sheet.js +2 -2
- package/dist/primitives/ui/sheet.js.map +1 -1
- package/dist/primitives/ui/slider.js +1 -1
- package/dist/primitives/ui/slider.js.map +1 -1
- package/dist/primitives/ui/switch.d.ts +1 -1
- package/dist/primitives/ui/switch.d.ts.map +1 -1
- package/dist/primitives/ui/switch.js +1 -1
- package/dist/primitives/ui/switch.js.map +1 -1
- package/dist/primitives/ui/toast.js +2 -2
- package/dist/primitives/ui/toast.js.map +1 -1
- package/dist/primitives/ui/tooltip.js +1 -1
- package/dist/primitives/ui/tooltip.js.map +1 -1
- package/dist/styles/theme.css +9 -0
- package/dist/styles/tokens.css +96 -36
- package/dist/styles/tokens.test.tsx +20 -2
- package/dist/theme/color.d.ts +5 -0
- package/dist/theme/color.d.ts.map +1 -1
- package/dist/theme/color.js +22 -0
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/css.d.ts +3 -3
- package/dist/theme/css.d.ts.map +1 -1
- package/dist/theme/css.js +29 -11
- package/dist/theme/css.js.map +1 -1
- package/package.json +1 -1
package/ai/component-registry.md
CHANGED
|
@@ -83,6 +83,7 @@
|
|
|
83
83
|
- **List toolbar** (`@dodopayments/ui/list-toolbar`, Data display): The row above every Data table (Dodo Nest List toolbar): search, a count or a Refresh button on the left, every
|
|
84
84
|
- **Leaderboard** (`@dodopayments/ui/leaderboard`, Data display): Top customers by spend (Dodo Nest Leaderboard): a podium of the top three (one joined block of white cells
|
|
85
85
|
- **Milestone** (`@dodopayments/ui/milestone`, Data display): A milestone on the Milestones page (Design File › Merchant Milestones). `state="achieved"` is a reached milestone:
|
|
86
|
+
- **Sale share card** (`@dodopayments/ui/sale-share-card`, Data display): A new sale as an image to share (the dashboard's payments list, Share): 720 by 400, the artwork behind, the
|
|
86
87
|
- **Setup guide** (`@dodopayments/ui/setup-guide`, Feedback): The setup guide a new business follows (the dashboard's Setup guide, opened from the top bar's Setup guide
|
|
87
88
|
- **Filter Grid** (`@dodopayments/ui/filter-grid`, Data display): Filter chips over a grid of cards, after interior.dev's filter grid
|
|
88
89
|
- **Live Activity** (`@dodopayments/ui/live-activity`, Feedback): A small pod that reports one background task, like a phone's live activity, after interior.dev's
|
|
@@ -56,7 +56,7 @@ While the chart loads it draws the loading pulse or sweep.
|
|
|
56
56
|
| `dashArray` | `string` | - | Dash pattern for the tail segment when `dashFromIndex` is set. Default: "6,4" |
|
|
57
57
|
| `dashFromIndex` | `number` | - | Data index from which the line stroke becomes dashed (inclusive). Useful for projecting incomplete periods, e.g. dashed from yesterday through today. |
|
|
58
58
|
| `fadeEdges` | `FadeEdges` | - | Fade the area fill (and stroke) toward transparent at the chart edges. - `true` fades both edges, `false` disables the fade entirely. - `"left"` / `"right"` fades only that side: useful when the opposite edge butts up against another element you don't want to fade into. Default: false |
|
|
59
|
-
| `fill` | `string` | - | Fill color for the area gradient start. Default: var(--chart-1) |
|
|
59
|
+
| `fill` | `string` | - | Fill color for the area gradient start. Default: var(--chart-solid-1) |
|
|
60
60
|
| `fillOpacity` | `number` | - | Fill opacity at the top of the area. Default: 0.4 |
|
|
61
61
|
| `gradientSpan` | `number` | - | Vertical extent of the fill gradient (0–1). `1` fades across the full height; lower values compress the gradient toward the top. |
|
|
62
62
|
| `gradientToOpacity` | `number` | - | Gradient opacity at bottom (0 = fully transparent). Default: 0 |
|
|
@@ -146,7 +146,7 @@ export default function AreaChartDefault() {
|
|
|
146
146
|
<YAxis formatValue={(value) => usdCompact.format(value)} />
|
|
147
147
|
<ChartTooltip
|
|
148
148
|
rows={(point) => [
|
|
149
|
-
{ color: "var(--chart-1)", label: "Gross revenue", value: usd.format(point["revenue"] as number) },
|
|
149
|
+
{ color: "var(--chart-solid-1)", label: "Gross revenue", value: usd.format(point["revenue"] as number) },
|
|
150
150
|
]}
|
|
151
151
|
/>
|
|
152
152
|
</AreaChart>
|
|
@@ -220,7 +220,7 @@ const data = Array.from({ length: 13 }, (_, week) => ({
|
|
|
220
220
|
}));
|
|
221
221
|
|
|
222
222
|
const series = [
|
|
223
|
-
{ key: "scale", label: "Scale", color: "var(--chart-1)" },
|
|
223
|
+
{ key: "scale", label: "Scale", color: "var(--chart-solid-1)" },
|
|
224
224
|
{ key: "growth", label: "Growth", color: "var(--chart-2)" },
|
|
225
225
|
{ key: "starter", label: "Starter", color: "var(--chart-3)" },
|
|
226
226
|
] as const;
|
|
@@ -292,7 +292,7 @@ export default function AreaChartReferenceArea() {
|
|
|
292
292
|
patternColor="var(--chart-scale-pattern-color)"
|
|
293
293
|
strokeStyle="dashed"
|
|
294
294
|
/>
|
|
295
|
-
<Area dataKey="checkouts" fill="var(--chart-1)" />
|
|
295
|
+
<Area dataKey="checkouts" fill="var(--chart-solid-1)" />
|
|
296
296
|
<XAxis />
|
|
297
297
|
<ChartTooltip />
|
|
298
298
|
</AreaChart>
|
package/ai/components/avatar.md
CHANGED
|
@@ -28,7 +28,7 @@ Shown while the image loads, when it fails or when there is no image. Renders th
|
|
|
28
28
|
| Prop | Type | Default | Description |
|
|
29
29
|
| --- | --- | --- | --- |
|
|
30
30
|
| `className` | `string` | - | Additional Tailwind classes, merged last. |
|
|
31
|
-
| `color` | `"auto" \| "neutral" \| "blue" \| "purple" \| "pink" \| "lime"` | `"auto"` | `auto`: Picks blue, purple, pink or lime from the name's initials, so a name always gets the same colour.<br>`neutral`: Grey: Surface/Tertiary with Content/Primary initials. Never picked by `auto`; set it where colour would distract.<br>`blue`: The `info` tone: a soft blue fill with blue initials.<br>`purple`: The
|
|
31
|
+
| `color` | `"auto" \| "neutral" \| "blue" \| "purple" \| "pink" \| "lime"` | `"auto"` | `auto`: Picks blue, purple, pink or lime from the name's initials, so a name always gets the same colour.<br>`neutral`: Grey: Surface/Tertiary with Content/Primary initials. Never picked by `auto`; set it where colour would distract.<br>`blue`: The `info` tone: a soft blue fill with blue initials.<br>`purple`: The violet category tone: a soft violet fill with violet initials.<br>`pink`: The pink category tone: a soft pink fill with pink initials.<br>`lime`: The `success` tone: a soft green fill with green initials. |
|
|
32
32
|
| `name` | `string` | - | Full name, always read by screen readers (also when `children` replace the initials). Without `children`, its initials (first and last word) are shown. |
|
|
33
33
|
| `singleInitials` | `boolean` | `false` | Show only the first initial. |
|
|
34
34
|
|
|
@@ -60,7 +60,7 @@ gradient or a pattern `url(#id)`; set `stroke` for the tooltip dot when `fill` i
|
|
|
60
60
|
| `animate` | `boolean` | - | Whether to animate the bars. Default: true |
|
|
61
61
|
| `animationType` | `BarAnimationType` | - | Animation type: "grow" (height) or "fade" (opacity + blur). Default: "grow" |
|
|
62
62
|
| `fadedOpacity` | `number` | - | Opacity when not hovered (when another bar is hovered). Default: 0.3 |
|
|
63
|
-
| `fill` | `string` | - | Fill color for the bar. Can be a color, gradient url, or pattern url. Default: var(--chart-1) |
|
|
63
|
+
| `fill` | `string` | - | Fill color for the bar. Can be a color, gradient url, or pattern url. Default: var(--chart-solid-1) |
|
|
64
64
|
| `groupGap` | `number` | - | Gap between grouped bars in pixels. Default: 4 |
|
|
65
65
|
| `lineCap` | `BarLineCap` | - | Line cap style for bar ends: "round", "butt", or a number for custom radius. Default: "round" |
|
|
66
66
|
| `minBarHeight` | `number` | - | Minimum rendered bar height in px (non-stacked, vertical). Floors short or zero-value bars so they stay visible. Pair with the same value on `<BarDepthProvider minBarHeight>` when using the 3D surfaces. Default: 0 |
|
|
@@ -68,7 +68,7 @@ gradient or a pattern `url(#id)`; set `stroke` for the tooltip dot when `fill` i
|
|
|
68
68
|
| `stackGap` | `number` | - | Gap between stacked bars in pixels. Default: 0 |
|
|
69
69
|
| `staggerDelay` | `number` | - | Stagger delay between bars in seconds. Auto-calculated if not provided. |
|
|
70
70
|
| `stroke` | `string` | - | Color for tooltip dot. Use when fill is a gradient/pattern. Default: uses fill value |
|
|
71
|
-
| `variant` | `"tint" \| "solid"` | - | `"tint"`: the radar look, an opaque 20% wash of the colour (mixed into the card, so gridlines stay behind it) with a solid 3px edge at the value end (35% while hovered).
|
|
71
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: the full colour, the default look of the bar charts. `"tint"`: the radar look, an opaque 20% wash of the colour (mixed into the card, so gridlines stay behind it) with a solid 3px edge at the value end (35% while hovered). A gradient or pattern `fill` without `stroke`, and `perspective` bars, stay solid. Default: "solid" |
|
|
72
72
|
| `yAxisId` | `string \| number` | - | Y-scale group id for vertical bars (Recharts `yAxisId`). Default: `"left"`. |
|
|
73
73
|
|
|
74
74
|
## BarXAxis
|
|
@@ -134,10 +134,10 @@ Several `SeriesBar`s in a composed chart group or stack by the chart's bar setti
|
|
|
134
134
|
| `dataKey` (required) | `string` | - | Key in data for bar height (y value) |
|
|
135
135
|
| `animate` | `boolean` | - | Animate grow from baseline. Default: true |
|
|
136
136
|
| `fadedOpacity` | `number` | - | Opacity for non-hovered bars when another point is hovered (matches BarChart). Default: 0.3 |
|
|
137
|
-
| `fill` | `string` | - | Fill color. Default: var(--chart-1) |
|
|
137
|
+
| `fill` | `string` | - | Fill color. Default: var(--chart-solid-1) |
|
|
138
138
|
| `radius` | `number` | - | Corner radius for bar top corners. Default: 0 (square tops, similar to Bar lineCap="butt") |
|
|
139
139
|
| `stroke` | `string` | - | Tooltip dot color when fill is gradient/pattern. Default: fill |
|
|
140
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
140
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: the full colour, as `Bar`. `"tint"`: an opaque 20% wash of the colour (35% for the hovered point) with a solid 3px edge along the top. A gradient or pattern `fill` without `stroke` stays solid. Default: "solid" |
|
|
141
141
|
|
|
142
142
|
## BarColumnTrack
|
|
143
143
|
|
|
@@ -168,7 +168,7 @@ the tooltip dots land on the top square.
|
|
|
168
168
|
| `dataKey` (required) | `string` | - | Key in data for the column value. |
|
|
169
169
|
| `animate` | `boolean` | - | Whether the squares cascade up on mount. Default: true |
|
|
170
170
|
| `fadedOpacity` | `number` | - | Opacity of the other columns while one category is hovered. Default: 0.3 |
|
|
171
|
-
| `fill` | `string` | - | Fill color, gradient url, or pattern url. Default: var(--chart-1) |
|
|
171
|
+
| `fill` | `string` | - | Fill color, gradient url, or pattern url. Default: var(--chart-solid-1) |
|
|
172
172
|
| `gradientStops` | `GradientStop[]` | - | |
|
|
173
173
|
| `groupGap` | `number` | - | Gap between grouped series columns in pixels. Default: 4 |
|
|
174
174
|
| `patternPreset` | `"none" \| "vertical" \| "horizontal" \| "diagonal" \| "cross" \| "dots" \| "circles" \| "accent"` | - | Pattern preset when fill is a pattern (for gradient tinting) |
|
|
@@ -293,8 +293,8 @@ const data = [
|
|
|
293
293
|
];
|
|
294
294
|
|
|
295
295
|
const legendItems = [
|
|
296
|
-
{ label: "Gross revenue", value: 0, color: "var(--chart-1)" },
|
|
297
|
-
{ label: "Net revenue", value: 0, color: "var(--chart-2)" },
|
|
296
|
+
{ label: "Gross revenue", value: 0, color: "var(--chart-solid-1)" },
|
|
297
|
+
{ label: "Net revenue", value: 0, color: "var(--chart-solid-2)" },
|
|
298
298
|
];
|
|
299
299
|
|
|
300
300
|
const usd = new Intl.NumberFormat("en-US", {
|
|
@@ -308,19 +308,19 @@ export default function BarChartGrouped() {
|
|
|
308
308
|
<div className="flex w-full flex-col gap-3">
|
|
309
309
|
<Legend items={legendItems} className="flex-row flex-wrap gap-1">
|
|
310
310
|
<LegendItem className="flex items-center gap-2">
|
|
311
|
-
<LegendMarker
|
|
311
|
+
<LegendMarker />
|
|
312
312
|
<LegendLabel />
|
|
313
313
|
</LegendItem>
|
|
314
314
|
</Legend>
|
|
315
315
|
<BarChart data={data} xDataKey="month" label="Gross and net revenue by month, January to June 2026">
|
|
316
316
|
<ChartGrid horizontal />
|
|
317
|
-
<Bar dataKey="gross" fill="var(--chart-1)" />
|
|
318
|
-
<Bar dataKey="net" fill="var(--chart-2)" />
|
|
317
|
+
<Bar dataKey="gross" fill="var(--chart-solid-1)" />
|
|
318
|
+
<Bar dataKey="net" fill="var(--chart-solid-2)" />
|
|
319
319
|
<BarXAxis />
|
|
320
320
|
<ChartTooltip
|
|
321
321
|
rows={(point) => [
|
|
322
|
-
{ color: "var(--chart-1)", label: "Gross", value: usd.format(point.gross as number) },
|
|
323
|
-
{ color: "var(--chart-2)", label: "Net", value: usd.format(point.net as number) },
|
|
322
|
+
{ color: "var(--chart-solid-1)", label: "Gross", value: usd.format(point.gross as number) },
|
|
323
|
+
{ color: "var(--chart-solid-2)", label: "Net", value: usd.format(point.net as number) },
|
|
324
324
|
]}
|
|
325
325
|
/>
|
|
326
326
|
</BarChart>
|
|
@@ -364,12 +364,12 @@ export default function BarChartHorizontal() {
|
|
|
364
364
|
label="Top products by revenue, last 30 days"
|
|
365
365
|
>
|
|
366
366
|
<ChartGrid horizontal={false} vertical />
|
|
367
|
-
<Bar dataKey="revenue" fill="var(--chart-1)" />
|
|
367
|
+
<Bar dataKey="revenue" fill="var(--chart-solid-1)" />
|
|
368
368
|
<BarYAxis />
|
|
369
369
|
<ChartTooltip
|
|
370
370
|
showCrosshair={false}
|
|
371
371
|
rows={(point) => [
|
|
372
|
-
{ color: "var(--chart-1)", label: "Revenue", value: usd.format(point.revenue as number) },
|
|
372
|
+
{ color: "var(--chart-solid-1)", label: "Revenue", value: usd.format(point.revenue as number) },
|
|
373
373
|
]}
|
|
374
374
|
/>
|
|
375
375
|
</BarChart>
|
|
@@ -444,9 +444,9 @@ const data = [
|
|
|
444
444
|
];
|
|
445
445
|
|
|
446
446
|
const series = [
|
|
447
|
-
{ key: "bank", label: "Bank transfer", color: "var(--chart-1)" },
|
|
448
|
-
{ key: "card", label: "Card", color: "var(--chart-2)" },
|
|
449
|
-
{ key: "wallet", label: "Wallet", color: "var(--chart-3)" },
|
|
447
|
+
{ key: "bank", label: "Bank transfer", color: "var(--chart-solid-1)" },
|
|
448
|
+
{ key: "card", label: "Card", color: "var(--chart-solid-2)" },
|
|
449
|
+
{ key: "wallet", label: "Wallet", color: "var(--chart-solid-3)" },
|
|
450
450
|
] as const;
|
|
451
451
|
|
|
452
452
|
const legendItems = series.map(({ label, color }) => ({ label, value: 0, color }));
|
|
@@ -462,7 +462,7 @@ export default function BarChartStacked() {
|
|
|
462
462
|
<div className="flex w-full flex-col gap-3">
|
|
463
463
|
<Legend items={legendItems} className="flex-row flex-wrap gap-1">
|
|
464
464
|
<LegendItem className="flex items-center gap-2">
|
|
465
|
-
<LegendMarker
|
|
465
|
+
<LegendMarker />
|
|
466
466
|
<LegendLabel />
|
|
467
467
|
</LegendItem>
|
|
468
468
|
</Legend>
|
|
@@ -149,7 +149,7 @@ export default function ChartTooltipCustomRows() {
|
|
|
149
149
|
return (
|
|
150
150
|
<AreaChart data={data} label="Gross revenue, refunds and net revenue, first two weeks of September 2026">
|
|
151
151
|
<ChartGrid horizontal />
|
|
152
|
-
<Area dataKey="revenue" fill="var(--chart-1)" />
|
|
152
|
+
<Area dataKey="revenue" fill="var(--chart-solid-1)" />
|
|
153
153
|
<Area dataKey="refunds" fill="var(--chart-2)" />
|
|
154
154
|
<XAxis />
|
|
155
155
|
<ChartTooltip
|
|
@@ -157,7 +157,7 @@ export default function ChartTooltipCustomRows() {
|
|
|
157
157
|
const revenue = point.revenue as number;
|
|
158
158
|
const refunds = point.refunds as number;
|
|
159
159
|
return [
|
|
160
|
-
{ color: "var(--chart-1)", label: "Gross revenue", value: usd.format(revenue) },
|
|
160
|
+
{ color: "var(--chart-solid-1)", label: "Gross revenue", value: usd.format(revenue) },
|
|
161
161
|
{ color: "var(--chart-2)", label: "Refunds", value: usd.format(refunds) },
|
|
162
162
|
{ color: "var(--muted-foreground)", label: "Net revenue", value: usd.format(revenue - refunds) },
|
|
163
163
|
];
|
|
@@ -188,7 +188,7 @@ export default function ChartTooltipDefault() {
|
|
|
188
188
|
return (
|
|
189
189
|
<AreaChart data={data} label="Gross revenue and refunds, first two weeks of September 2026">
|
|
190
190
|
<ChartGrid horizontal />
|
|
191
|
-
<Area dataKey="revenue" fill="var(--chart-1)" />
|
|
191
|
+
<Area dataKey="revenue" fill="var(--chart-solid-1)" />
|
|
192
192
|
<Area dataKey="refunds" fill="var(--chart-2)" />
|
|
193
193
|
<XAxis />
|
|
194
194
|
<ChartTooltip />
|
package/ai/components/chart.md
CHANGED
|
@@ -307,7 +307,7 @@ export default function ChartBrushDemo() {
|
|
|
307
307
|
animationDuration={0}
|
|
308
308
|
style={{ aspectRatio: "unset" }}
|
|
309
309
|
>
|
|
310
|
-
<Area dataKey="payouts" fill="var(--chart-1)" fillOpacity={0.15} animate={false} showHighlight={false} />
|
|
310
|
+
<Area dataKey="payouts" fill="var(--chart-solid-1)" fillOpacity={0.15} animate={false} showHighlight={false} />
|
|
311
311
|
<ChartBrush
|
|
312
312
|
fadeOuterEdges
|
|
313
313
|
initialSelection={layout.brushSelection ?? undefined}
|
|
@@ -328,7 +328,7 @@ export default function ChartBrushDemo() {
|
|
|
328
328
|
yDomainTween
|
|
329
329
|
>
|
|
330
330
|
<ChartGrid horizontal />
|
|
331
|
-
<Area dataKey="payouts" fill="var(--chart-1)" />
|
|
331
|
+
<Area dataKey="payouts" fill="var(--chart-solid-1)" />
|
|
332
332
|
<XAxis />
|
|
333
333
|
<ChartTooltip />
|
|
334
334
|
</AreaChart>
|
|
@@ -364,7 +364,7 @@ export default function ChartGridAxes() {
|
|
|
364
364
|
return (
|
|
365
365
|
<AreaChart data={data} label="Monthly recurring revenue, September 2026" margin={{ left: 56 }}>
|
|
366
366
|
<ChartGrid horizontal vertical />
|
|
367
|
-
<Area dataKey="mrr" fill="var(--chart-1)" />
|
|
367
|
+
<Area dataKey="mrr" fill="var(--chart-solid-1)" />
|
|
368
368
|
<XAxis />
|
|
369
369
|
<YAxis formatValue={(value) => usdCompact.format(value)} />
|
|
370
370
|
</AreaChart>
|
|
@@ -425,7 +425,7 @@ export default function ChartMarkersDemo() {
|
|
|
425
425
|
return (
|
|
426
426
|
<AreaChart data={data} label="Gross revenue with product and incident events, September 2026" margin={{ top: 40 }}>
|
|
427
427
|
<ChartGrid horizontal />
|
|
428
|
-
<Area dataKey="revenue" fill="var(--chart-1)" />
|
|
428
|
+
<Area dataKey="revenue" fill="var(--chart-solid-1)" />
|
|
429
429
|
<XAxis />
|
|
430
430
|
<ChartMarkers items={markers} />
|
|
431
431
|
<ChartTooltip>
|
|
@@ -464,12 +464,12 @@ export default function ChartReferenceArea() {
|
|
|
464
464
|
markerColor="var(--chart-2)"
|
|
465
465
|
axisLabelColor="var(--chart-2)"
|
|
466
466
|
/>
|
|
467
|
-
<Area dataKey="conversion" fill="var(--chart-1)" />
|
|
467
|
+
<Area dataKey="conversion" fill="var(--chart-solid-1)" />
|
|
468
468
|
<XAxis />
|
|
469
469
|
<YAxis formatLargeNumbers={false} formatValue={(value) => `${value.toFixed(1)}%`} />
|
|
470
470
|
<ChartTooltip
|
|
471
471
|
rows={(point) => [
|
|
472
|
-
{ color: "var(--chart-1)", label: "Conversion", value: `${(point.conversion as number).toFixed(2)}%` },
|
|
472
|
+
{ color: "var(--chart-solid-1)", label: "Conversion", value: `${(point.conversion as number).toFixed(2)}%` },
|
|
473
473
|
]}
|
|
474
474
|
/>
|
|
475
475
|
</AreaChart>
|
|
@@ -89,7 +89,7 @@ export default function CheckoutPageBasic() {
|
|
|
89
89
|
<AvatarImage src={LOGO} alt="" />
|
|
90
90
|
<AvatarFallback name="Acme" />
|
|
91
91
|
</Avatar>
|
|
92
|
-
<span className="font-heading
|
|
92
|
+
<span className="font-heading text-heading-quaternary text-foreground">Acme</span>
|
|
93
93
|
</>
|
|
94
94
|
}
|
|
95
95
|
summary={
|
|
@@ -71,8 +71,8 @@ const data = Array.from({ length: 30 }, (_, day) => {
|
|
|
71
71
|
});
|
|
72
72
|
|
|
73
73
|
const legendItems = [
|
|
74
|
-
{ label: "Orders", value: 0, color: "var(--chart-2)" },
|
|
75
|
-
{ label: "Revenue ($K)", value: 0, color: "var(--chart-1)" },
|
|
74
|
+
{ label: "Orders", value: 0, color: "var(--chart-solid-2)" },
|
|
75
|
+
{ label: "Revenue ($K)", value: 0, color: "var(--chart-solid-1)" },
|
|
76
76
|
{ label: "7-day run rate ($K)", value: 0, color: "var(--chart-comparison)" },
|
|
77
77
|
];
|
|
78
78
|
|
|
@@ -92,9 +92,9 @@ export default function ComposedChartDefault() {
|
|
|
92
92
|
maxBarSize={32}
|
|
93
93
|
>
|
|
94
94
|
<ChartGrid horizontal />
|
|
95
|
-
<SeriesBar dataKey="orders" fill="var(--chart-2)" radius={4} />
|
|
95
|
+
<SeriesBar dataKey="orders" fill="var(--chart-solid-2)" radius={4} />
|
|
96
96
|
<Line dataKey="runRate" variant="comparison" />
|
|
97
|
-
<Line dataKey="revenue" stroke="var(--chart-1)" />
|
|
97
|
+
<Line dataKey="revenue" stroke="var(--chart-solid-1)" />
|
|
98
98
|
<XAxis numTicks={6} />
|
|
99
99
|
<ChartTooltip showCrosshair={false} />
|
|
100
100
|
</ComposedChart>
|
|
@@ -125,9 +125,9 @@ const data = Array.from({ length: 12 }, (_, week) => ({
|
|
|
125
125
|
}));
|
|
126
126
|
|
|
127
127
|
const bars = [
|
|
128
|
-
{ key: "card", label: "Card", color: "var(--chart-1)" },
|
|
129
|
-
{ key: "bank", label: "Bank transfer", color: "var(--chart-2)" },
|
|
130
|
-
{ key: "wallet", label: "Wallet", color: "var(--chart-3)" },
|
|
128
|
+
{ key: "card", label: "Card", color: "var(--chart-solid-1)" },
|
|
129
|
+
{ key: "bank", label: "Bank transfer", color: "var(--chart-solid-2)" },
|
|
130
|
+
{ key: "wallet", label: "Wallet", color: "var(--chart-solid-3)" },
|
|
131
131
|
] as const;
|
|
132
132
|
|
|
133
133
|
const legendItems = [
|
|
@@ -24,6 +24,7 @@ row. An empty `value` renders a dash.
|
|
|
24
24
|
| `copyLabel` | `string` | `"Copy ID" ("Copy secret" for `variant="secret"`)` | Accessible name of the copy button. |
|
|
25
25
|
| `defaultRevealed` | `boolean` | `false` | Initial revealed state of an uncontrolled `secret`. |
|
|
26
26
|
| `label` | `ReactNode` | - | The key of a `chip`, e.g. "Customer ID" (Body/Secondary, Content/Secondary). |
|
|
27
|
+
| `link` | `ReactElement<Record<string, unknown>, string \| JSXElementConstructor<any>>` | - | Renders the value as this link, e.g. `<NextLink href="/payments/pay_…" />`, for an ID that opens its record. The value keeps its middle truncation and underlines on hover; the copy button stays beside it, outside the link. `inline` and `chip` only. |
|
|
27
28
|
| `onCopy` | `((value: string) => void)` | - | Called with `value` after it was written to the clipboard. |
|
|
28
29
|
| `onCopyError` | `((error: unknown) => void)` | - | Called when the clipboard write fails (e.g. permission denied or insecure context). |
|
|
29
30
|
| `onRevealedChange` | `((revealed: boolean) => void)` | - | Called when the reveal button shows or masks a `secret`, and when `remaskAfterMs` masks it again. |
|
|
@@ -26,7 +26,7 @@ place.
|
|
|
26
26
|
| `filters` (required) | `readonly FilterGridFilter<T>[]` | - | |
|
|
27
27
|
| `getKey` (required) | `(item: T) => string` | - | A stable key per item, so cells keep their identity across filters. |
|
|
28
28
|
| `items` (required) | `readonly T[]` | - | |
|
|
29
|
-
| `renderItem` (required) | `(item: T) => ReactNode` | - | Content of one cell. |
|
|
29
|
+
| `renderItem` (required) | `(item: T) => ReactNode` | - | Content of one cell: drawn in the white panel of the cell's card tray. |
|
|
30
30
|
| `className` | `string` | - | Additional Tailwind classes, merged last. |
|
|
31
31
|
| `columns` | `number` | `3` | Grid columns. |
|
|
32
32
|
| `defaultValue` | `string` | - | Id of the filter active on mount when uncontrolled. Defaults to the first filter. |
|
|
@@ -34,6 +34,7 @@ place.
|
|
|
34
34
|
| `gap` | `number` | `8` | Gap between cells in pixels. |
|
|
35
35
|
| `maxRows` | `number` | `4` | Rows before the grid scrolls. The grid keeps the height of all items (up to this cap), so filtering does not move the content below it. |
|
|
36
36
|
| `onValueChange` | `((id: string) => void)` | - | Called with the id of the filter the user picks. |
|
|
37
|
+
| `renderTitle` | `((item: T) => ReactNode)` | - | Title of one cell, at the top of its white panel above the `renderItem` content (Heading/Quaternary, truncated). Without it the panel holds `renderItem` only. |
|
|
37
38
|
| `rowHeight` | `number` | `72` | Row height in pixels. |
|
|
38
39
|
| `value` | `string` | - | Id of the active filter. Pass it to control the grid. |
|
|
39
40
|
|
|
@@ -98,12 +99,8 @@ export default function FilterGridBasic() {
|
|
|
98
99
|
items={PRODUCTS}
|
|
99
100
|
filters={FILTERS}
|
|
100
101
|
getKey={(p) => p.id}
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
<span className="truncate text-label-primary">{p.name}</span>
|
|
104
|
-
<span className="text-body-secondary text-muted-foreground">{p.price}</span>
|
|
105
|
-
</div>
|
|
106
|
-
)}
|
|
102
|
+
renderTitle={(p) => p.name}
|
|
103
|
+
renderItem={(p) => <span className="text-body-secondary text-muted-foreground">{p.price}</span>}
|
|
107
104
|
/>
|
|
108
105
|
);
|
|
109
106
|
}
|
|
@@ -4,8 +4,9 @@ Drop-off through the stages of a flow (visited, started checkout, paid), on the
|
|
|
4
4
|
`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,
|
|
5
5
|
first stage first; each segment is sized as a share of the first stage and shows its value, a
|
|
6
6
|
percentage chip and the stage label, and each boundary shows the step conversion ("→ 54%") from the
|
|
7
|
-
stage before. Segments
|
|
8
|
-
|
|
7
|
+
stage before. Segments are solid by default: a full-colour core inside faint halo bands (`layers` rings);
|
|
8
|
+
`variant="tint"` gives the wash of the tint look (20% with a solid 2px edge on the outer sides). Each stage takes the
|
|
9
|
+
next palette colour unless `color` sets one. Segments grow in with a stagger on mount; hovering one dims
|
|
9
10
|
the others. `orientation="vertical"` stacks the stages top to bottom; `grid` adds background bands
|
|
10
11
|
and divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading
|
|
11
12
|
state and renders an empty frame when `data` is empty.
|
|
@@ -20,8 +21,9 @@ Drop-off through the stages of a flow (visited, started checkout, paid), on the
|
|
|
20
21
|
`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,
|
|
21
22
|
first stage first; each segment is sized as a share of the first stage and shows its value, a
|
|
22
23
|
percentage chip and the stage label, and each boundary shows the step conversion ("→ 54%") from the
|
|
23
|
-
stage before. Segments
|
|
24
|
-
|
|
24
|
+
stage before. Segments are solid by default: a full-colour core inside faint halo bands (`layers` rings);
|
|
25
|
+
`variant="tint"` gives the wash of the tint look (20% with a solid 2px edge on the outer sides). Each stage takes the
|
|
26
|
+
next palette colour unless `color` sets one. Segments grow in with a stagger on mount; hovering one dims
|
|
25
27
|
the others. `orientation="vertical"` stacks the stages top to bottom; `grid` adds background bands
|
|
26
28
|
and divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading
|
|
27
29
|
state and renders an empty frame when `data` is empty.
|
|
@@ -31,7 +33,7 @@ state and renders an empty frame when `data` is empty.
|
|
|
31
33
|
| `data` (required) | `FunnelStage[]` | - | |
|
|
32
34
|
| `label` (required) | `string` | - | Accessible name of the chart, e.g. "Checkout funnel, last 30 days". Set as `aria-label` on the `role="figure"` frame. The stage values, percentages and labels stay in the page as text. |
|
|
33
35
|
| `className` | `string` | - | Additional Tailwind classes, merged last. |
|
|
34
|
-
| `color` | `string` | - |
|
|
36
|
+
| `color` | `string` | - | One colour for every stage. Without it, each stage takes the next palette colour: `--chart-solid-1` to `--chart-solid-3` (the bar colours), then `--chart-4` and `--chart-5`, repeated. |
|
|
35
37
|
| `conversionLabel` | `string` | - | Screen reader text after the step conversion. Default "of the previous stage" |
|
|
36
38
|
| `edges` | `"curved" \| "straight"` | - | Edge style for the funnel segments. Default "curved" |
|
|
37
39
|
| `enterTransition` | `Transition` | - | Framer Motion transition for segment enter animation |
|
|
@@ -44,7 +46,7 @@ state and renders an empty frame when `data` is empty.
|
|
|
44
46
|
| `labelAlign` | `"center" \| "end" \| "start"` | - | Where the label group sits within the segment cell. - "center" (default), "start", "end" For horizontal funnel: start=top, end=bottom. For vertical funnel: start=left, end=right. |
|
|
45
47
|
| `labelLayout` | `"spread" \| "grouped"` | - | Controls how segment labels (value, percentage, stage name) are arranged. - "spread": Value/percentage/label are spread apart (top/center/bottom for horizontal, left/center/right for vertical). This is the default. - "grouped": All label items stack together in a tight group. When "grouped", use `labelOrientation` and `labelAlign` for full control. |
|
|
46
48
|
| `labelOrientation` | `"vertical" \| "horizontal"` | - | Stack direction of the label group. Only applies when `labelLayout="grouped"`. - "vertical": Items stack top-to-bottom. Default for horizontal funnels. - "horizontal": Items stack left-to-right. Default for vertical funnels. |
|
|
47
|
-
| `layers` | `number` | - |
|
|
49
|
+
| `layers` | `number` | - | Rings of the `"solid"` look: the core plus `layers - 1` halo bands. Default 3 |
|
|
48
50
|
| `onHoverChange` | `((index: number \| null) => void)` | - | Callback when hover state changes |
|
|
49
51
|
| `orientation` | `"vertical" \| "horizontal"` | - | |
|
|
50
52
|
| `renderPattern` | `((id: string, color: string) => ReactNode)` | - | Render a visx pattern definition. Receives a unique `id` string per segment and the resolved `color`. Return a `<PatternLines>` (or any visx pattern) inside an SVG `<defs>`. The component will use `fill="url(#id)"` on the innermost ring while keeping outer halo rings as solid color. |
|
|
@@ -53,7 +55,7 @@ state and renders an empty frame when `data` is empty.
|
|
|
53
55
|
| `showPercentage` | `boolean` | - | |
|
|
54
56
|
| `showValues` | `boolean` | - | |
|
|
55
57
|
| `staggerDelay` | `number` | - | Stagger delay between segments in seconds. Default 0.12 |
|
|
56
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
58
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: a full-colour core inside `layers - 1` faint halo bands, as the bar, pie and ring charts. `"tint"`: each segment an opaque 20% wash of its colour (mixed into the card) with a solid 2px edge along its outer sides. A `renderPattern` fill stays solid. Default: "solid" |
|
|
57
59
|
|
|
58
60
|
## Examples
|
|
59
61
|
|
|
@@ -88,14 +90,14 @@ const compact = new Intl.NumberFormat("en-US", { notation: "compact" });
|
|
|
88
90
|
|
|
89
91
|
// Payouts through review: each stage has its own colour, the last one a gradient.
|
|
90
92
|
const payouts: FunnelStage[] = [
|
|
91
|
-
{ label: "Requested", value: 1_240, color: "var(--chart-
|
|
92
|
-
{ label: "Verified", value: 1_090, color: "var(--chart-
|
|
93
|
-
{ label: "Approved", value: 1_010, color: "var(--chart-
|
|
93
|
+
{ label: "Requested", value: 1_240, color: "var(--chart-solid-2)" },
|
|
94
|
+
{ label: "Verified", value: 1_090, color: "var(--chart-solid-3)" },
|
|
95
|
+
{ label: "Approved", value: 1_010, color: "var(--chart-5)" },
|
|
94
96
|
{
|
|
95
97
|
label: "Paid out",
|
|
96
98
|
value: 980,
|
|
97
99
|
gradient: [
|
|
98
|
-
{ offset: 0, color: "var(--chart-3)" },
|
|
100
|
+
{ offset: 0, color: "var(--chart-solid-3)" },
|
|
99
101
|
{ offset: 1, color: "var(--chart-5)" },
|
|
100
102
|
],
|
|
101
103
|
},
|
|
@@ -136,7 +138,7 @@ export default function FunnelChartVertical() {
|
|
|
136
138
|
data={trials}
|
|
137
139
|
label="Trial to paid funnel, September"
|
|
138
140
|
orientation="vertical"
|
|
139
|
-
color="var(--chart-2)"
|
|
141
|
+
color="var(--chart-solid-2)"
|
|
140
142
|
edges="straight"
|
|
141
143
|
grid
|
|
142
144
|
/>
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track
|
|
4
4
|
(`orientation="linear"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.
|
|
5
5
|
`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc
|
|
6
|
-
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches
|
|
7
|
-
tint look of the other charts (a 20% wash with a solid 3px outer
|
|
8
|
-
|
|
9
|
-
a colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point
|
|
6
|
+
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches are the full
|
|
7
|
+
colour by default; `variant="tint"` gives the tint look of the other charts (a 20% wash with a solid 3px outer
|
|
8
|
+
edge). Set `useGradient` for a colour ramp across the notches (blue to violet unless `activeGradient` sets one), or pass `PatternLines` / `LinearGradient` children and point
|
|
10
9
|
`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role="meter"` with
|
|
11
10
|
`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or
|
|
12
11
|
empty state.
|
|
@@ -20,10 +19,9 @@ import { GaugeChart } from "@dodopayments/ui/gauge-chart";
|
|
|
20
19
|
One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track
|
|
21
20
|
(`orientation="linear"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.
|
|
22
21
|
`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc
|
|
23
|
-
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches
|
|
24
|
-
tint look of the other charts (a 20% wash with a solid 3px outer
|
|
25
|
-
|
|
26
|
-
a colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point
|
|
22
|
+
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches are the full
|
|
23
|
+
colour by default; `variant="tint"` gives the tint look of the other charts (a 20% wash with a solid 3px outer
|
|
24
|
+
edge). Set `useGradient` for a colour ramp across the notches (blue to violet unless `activeGradient` sets one), or pass `PatternLines` / `LinearGradient` children and point
|
|
27
25
|
`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role="meter"` with
|
|
28
26
|
`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or
|
|
29
27
|
empty state.
|
|
@@ -63,7 +61,7 @@ empty state.
|
|
|
63
61
|
| `totalNotches` | `number` | - | Number of notches |
|
|
64
62
|
| `uniformWidth` | `boolean` | - | `true` = rectangular notches; `false` = tapered toward center / midline |
|
|
65
63
|
| `useGradient` | `boolean` | - | |
|
|
66
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
64
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: the full colour, as the bar, pie and ring charts. `"tint"`: each filled notch an opaque 20% wash of its colour (mixed into the card) with a solid 3px edge on its outer side. A gradient or pattern `activeFill` (`url(#id)`) and the theme palette gradient stay solid. Default: "solid" |
|
|
67
65
|
| `width` | `number` | - | |
|
|
68
66
|
|
|
69
67
|
## Examples
|
|
@@ -108,7 +106,7 @@ export default function GaugeChartGradient() {
|
|
|
108
106
|
defaultLabel="Auth rate"
|
|
109
107
|
formatOptions={{ style: "percent", maximumFractionDigits: 0 }}
|
|
110
108
|
useGradient
|
|
111
|
-
activeGradient={["var(--chart-2)", "var(--chart-3)"]}
|
|
109
|
+
activeGradient={["var(--chart-solid-2)", "var(--chart-solid-3)"]}
|
|
112
110
|
inactiveFillOpacity={0.4}
|
|
113
111
|
minWidth={240}
|
|
114
112
|
/>
|
|
@@ -164,7 +162,7 @@ export default function GaugeChartLinear() {
|
|
|
164
162
|
totalNotches={50}
|
|
165
163
|
spacing={0}
|
|
166
164
|
notchCornerRadius={3}
|
|
167
|
-
activeFill="var(--chart-2)"
|
|
165
|
+
activeFill="var(--chart-solid-2)"
|
|
168
166
|
inactiveFillOpacity={0.4}
|
|
169
167
|
/>
|
|
170
168
|
</div>
|
|
@@ -71,7 +71,7 @@ the chart loads it draws the loading pulse or sweep.
|
|
|
71
71
|
| `onLoadingPulseCycleComplete` | `(() => void)` | - | Called when a loop-mode pulse cycle completes. |
|
|
72
72
|
| `showHighlight` | `boolean` | - | Whether to show highlight segment on hover. Default: true, false for `variant="comparison"` |
|
|
73
73
|
| `showMarkers` | `boolean` | - | Render scatter-style circle markers at each data point. Default: false |
|
|
74
|
-
| `stroke` | `string` | - | Stroke color. Default: var(--chart-1), or var(--chart-comparison) for `variant="comparison"` |
|
|
74
|
+
| `stroke` | `string` | - | Stroke color. Default: var(--chart-solid-1), or var(--chart-comparison) for `variant="comparison"` |
|
|
75
75
|
| `strokeWidth` | `number` | - | Stroke width. Default: 2 |
|
|
76
76
|
| `variant` | `"default" \| "comparison"` | - | `"default"` draws the metric as a solid line. `"comparison"` draws the period it is compared with (the previous period) as a dashed `--chart-comparison` line with no hover highlight, as the dashboard does. Default: `"default"`. |
|
|
77
77
|
| `yAxisId` | `string \| number` | - | Y-scale group id (Recharts `yAxisId`). Default: `"left"`. |
|
|
@@ -381,7 +381,7 @@ export default function LineChartDefault() {
|
|
|
381
381
|
title="Gross volume"
|
|
382
382
|
rows={(point) => [
|
|
383
383
|
{
|
|
384
|
-
color: "var(--chart-1)",
|
|
384
|
+
color: "var(--chart-solid-1)",
|
|
385
385
|
label: shortDate.format(point.date as Date),
|
|
386
386
|
value: money.format(point.current as number),
|
|
387
387
|
},
|
package/ai/components/money.md
CHANGED
|
@@ -59,7 +59,7 @@ const rows = [
|
|
|
59
59
|
|
|
60
60
|
export default function MoneyBasic() {
|
|
61
61
|
return (
|
|
62
|
-
<ul className="flex w-full max-w-sm flex-col divide-y divide-border text-
|
|
62
|
+
<ul className="flex w-full max-w-sm flex-col divide-y divide-border text-body-primary">
|
|
63
63
|
{rows.map((row) => (
|
|
64
64
|
<li key={row.label} className="flex items-baseline justify-between gap-4 py-2">
|
|
65
65
|
<span className="text-muted-foreground">{row.label}</span>
|
|
@@ -68,13 +68,13 @@ export default function MoneyBasic() {
|
|
|
68
68
|
currency={row.currency}
|
|
69
69
|
locale={"locale" in row ? row.locale : undefined}
|
|
70
70
|
display={"display" in row ? row.display : undefined}
|
|
71
|
-
className="
|
|
71
|
+
className="text-label-primary"
|
|
72
72
|
/>
|
|
73
73
|
</li>
|
|
74
74
|
))}
|
|
75
75
|
<li className="flex items-baseline justify-between gap-4 py-2">
|
|
76
76
|
<span className="text-muted-foreground">Failed charge</span>
|
|
77
|
-
<Money minor={8900} currency="USD" status="failed" className="
|
|
77
|
+
<Money minor={8900} currency="USD" status="failed" className="text-label-primary" />
|
|
78
78
|
</li>
|
|
79
79
|
</ul>
|
|
80
80
|
);
|
|
@@ -56,7 +56,7 @@ fade. The hover index drives `PieCenter` and a linked `Legend`.
|
|
|
56
56
|
| `hoverEffect` | `PieSliceHoverEffect` | - | Hover effect type. Default: "translate" - "translate": Slice moves outward along its radial axis - "grow": Slice extends its outer radius (gets longer) - "none": No hover animation |
|
|
57
57
|
| `hoverOffset` | `number` | - | Distance in pixels for hover effect (translate distance or grow amount). Defaults to PieChart's hoverOffset |
|
|
58
58
|
| `showGlow` | `boolean` | - | Show glow effect on hover. Default: true |
|
|
59
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
59
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: the full colour, as the bars. `"tint"`: an opaque 20% wash of the colour (mixed into the card) with a solid 3px arc on the outer rim. A gradient or pattern `fill` stays solid. Default: "solid" |
|
|
60
60
|
|
|
61
61
|
## PieCenter
|
|
62
62
|
|
|
@@ -193,11 +193,20 @@ const revenue: PieData[] = [
|
|
|
193
193
|
const total = revenue.reduce((sum, row) => sum + row.value, 0);
|
|
194
194
|
const usd = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
|
|
195
195
|
|
|
196
|
+
// The pie's default slice colours, in order: the bars' solid series, then the chart palette.
|
|
197
|
+
const sliceColors = [
|
|
198
|
+
"var(--chart-solid-1)",
|
|
199
|
+
"var(--chart-solid-2)",
|
|
200
|
+
"var(--chart-solid-3)",
|
|
201
|
+
"var(--chart-4)",
|
|
202
|
+
"var(--chart-5)",
|
|
203
|
+
];
|
|
204
|
+
|
|
196
205
|
const legendItems: LegendItemData[] = revenue.map((row, index) => ({
|
|
197
206
|
label: row.label,
|
|
198
207
|
value: row.value,
|
|
199
208
|
maxValue: total,
|
|
200
|
-
color:
|
|
209
|
+
color: sliceColors[index % sliceColors.length] ?? "var(--chart-solid-1)",
|
|
201
210
|
}));
|
|
202
211
|
|
|
203
212
|
export default function PieChartDonut() {
|
|
@@ -90,7 +90,7 @@ export default function ReorderListBasic() {
|
|
|
90
90
|
>
|
|
91
91
|
{(m) => (
|
|
92
92
|
<div className="flex items-center justify-between gap-3">
|
|
93
|
-
<span className="
|
|
93
|
+
<span className="text-label-primary">{m.name}</span>
|
|
94
94
|
<span className="truncate text-body-secondary text-muted-foreground">{m.detail}</span>
|
|
95
95
|
</div>
|
|
96
96
|
)}
|