@dodopayments/ui 1.0.1 → 1.0.2
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 +431 -88
- package/ai/components/app-top-bar.md +18 -10
- package/ai/components/bar-chart.md +5 -3
- package/ai/components/button.md +1 -1
- package/ai/components/chart-legend.md +3 -1
- package/ai/components/chart-tooltip.md +2 -2
- package/ai/components/composed-chart.md +5 -6
- package/ai/components/data-grid.md +11 -23
- package/ai/components/date-picker.md +1 -1
- package/ai/components/details-panel.md +1 -1
- package/ai/components/funnel-chart.md +12 -5
- package/ai/components/gauge-chart.md +9 -4
- package/ai/components/line-chart.md +1 -0
- package/ai/components/list-item.md +146 -6
- package/ai/components/pie-chart.md +1 -0
- package/ai/components/quantity-stepper.md +34 -2
- package/ai/components/radio-group.md +2 -2
- package/ai/components/retention-matrix.md +20 -5
- package/ai/components/ring-chart.md +7 -4
- package/ai/components/sankey-chart.md +18 -8
- package/ai/components/scatter-chart.md +4 -2
- package/ai/components/settings-section.md +1 -62
- package/ai/components/setup-guide.md +114 -118
- package/ai/components/sidebar.md +5 -0
- package/ai/components/stat-card.md +13 -14
- package/ai/components/sunburst-chart.md +138 -18
- package/ai/components/value-flash.md +74 -15
- package/ai/skills/dodo-charts/SKILL.md +3 -2
- package/ai/skills/dodo-design/SKILL.md +2 -2
- package/dist/components/button/button.d.ts +1 -1
- package/dist/components/button/button.d.ts.map +1 -1
- package/dist/components/button/button.js +5 -3
- package/dist/components/button/button.js.map +1 -1
- package/dist/components/data-grid/data-grid.d.ts +16 -13
- package/dist/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.js +17 -110
- package/dist/components/data-grid/data-grid.js.map +1 -1
- package/dist/components/data-grid/index.d.ts.map +1 -1
- package/dist/components/data-grid/index.js +1 -0
- package/dist/components/data-grid/index.js.map +1 -1
- package/dist/components/data-grid/table.d.ts +3 -6
- package/dist/components/data-grid/table.d.ts.map +1 -1
- package/dist/components/data-grid/table.js +10 -12
- package/dist/components/data-grid/table.js.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.d.ts +3 -1
- package/dist/components/funnel-chart/funnel-chart.d.ts.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.js +3 -1
- package/dist/components/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.d.ts +3 -1
- package/dist/components/gauge-chart/gauge-chart.d.ts.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.js +3 -1
- package/dist/components/gauge-chart/gauge-chart.js.map +1 -1
- package/dist/components/icon-morph/icon-morph.d.ts.map +1 -1
- package/dist/components/icon-morph/icon-morph.js +7 -4
- package/dist/components/icon-morph/icon-morph.js.map +1 -1
- package/dist/components/list-item/list-item.d.ts +21 -2
- package/dist/components/list-item/list-item.d.ts.map +1 -1
- package/dist/components/list-item/list-item.js +18 -4
- package/dist/components/list-item/list-item.js.map +1 -1
- package/dist/components/plan-picker/plan-picker.js +1 -1
- package/dist/components/plan-picker/plan-picker.js.map +1 -1
- package/dist/components/product-card/product-card.d.ts.map +1 -1
- package/dist/components/product-card/product-card.js +10 -3
- package/dist/components/product-card/product-card.js.map +1 -1
- package/dist/components/quantity-stepper/index.d.ts +1 -1
- package/dist/components/quantity-stepper/index.d.ts.map +1 -1
- package/dist/components/quantity-stepper/index.js +1 -1
- package/dist/components/quantity-stepper/index.js.map +1 -1
- package/dist/components/quantity-stepper/quantity-stepper.d.ts +33 -3
- package/dist/components/quantity-stepper/quantity-stepper.d.ts.map +1 -1
- package/dist/components/quantity-stepper/quantity-stepper.js +41 -8
- package/dist/components/quantity-stepper/quantity-stepper.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts +6 -6
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.js +11 -10
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/retention-matrix/index.d.ts +1 -1
- package/dist/components/retention-matrix/index.d.ts.map +1 -1
- package/dist/components/retention-matrix/index.js +1 -1
- package/dist/components/retention-matrix/index.js.map +1 -1
- package/dist/components/retention-matrix/retention-matrix.d.ts +32 -16
- package/dist/components/retention-matrix/retention-matrix.d.ts.map +1 -1
- package/dist/components/retention-matrix/retention-matrix.js +42 -19
- package/dist/components/retention-matrix/retention-matrix.js.map +1 -1
- package/dist/components/sankey-chart/sankey-chart.d.ts +4 -1
- package/dist/components/sankey-chart/sankey-chart.d.ts.map +1 -1
- package/dist/components/sankey-chart/sankey-chart.js +4 -1
- package/dist/components/sankey-chart/sankey-chart.js.map +1 -1
- package/dist/components/settings-section/index.d.ts.map +1 -1
- package/dist/components/settings-section/index.js +1 -0
- package/dist/components/settings-section/index.js.map +1 -1
- package/dist/components/settings-section/settings-section.d.ts +8 -5
- package/dist/components/settings-section/settings-section.d.ts.map +1 -1
- package/dist/components/settings-section/settings-section.js +8 -11
- package/dist/components/settings-section/settings-section.js.map +1 -1
- package/dist/components/setup-guide/index.d.ts +1 -1
- package/dist/components/setup-guide/index.d.ts.map +1 -1
- package/dist/components/setup-guide/index.js +1 -1
- package/dist/components/setup-guide/index.js.map +1 -1
- package/dist/components/setup-guide/setup-guide.d.ts +41 -16
- package/dist/components/setup-guide/setup-guide.d.ts.map +1 -1
- package/dist/components/setup-guide/setup-guide.js +53 -30
- package/dist/components/setup-guide/setup-guide.js.map +1 -1
- package/dist/components/sidebar/sidebar.d.ts +12 -5
- package/dist/components/sidebar/sidebar.d.ts.map +1 -1
- package/dist/components/sidebar/sidebar.js +127 -16
- package/dist/components/sidebar/sidebar.js.map +1 -1
- package/dist/components/stat-card/stat-card.d.ts +18 -11
- package/dist/components/stat-card/stat-card.d.ts.map +1 -1
- package/dist/components/stat-card/stat-card.js +18 -12
- package/dist/components/stat-card/stat-card.js.map +1 -1
- package/dist/components/sunburst-chart/index.d.ts +1 -0
- package/dist/components/sunburst-chart/index.d.ts.map +1 -1
- package/dist/components/sunburst-chart/index.js +1 -0
- package/dist/components/sunburst-chart/index.js.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.d.ts +7 -5
- package/dist/components/sunburst-chart/sunburst-chart.d.ts.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.js +7 -5
- package/dist/components/sunburst-chart/sunburst-chart.js.map +1 -1
- package/dist/components/value-flash/index.d.ts +1 -1
- package/dist/components/value-flash/index.d.ts.map +1 -1
- package/dist/components/value-flash/index.js +1 -1
- package/dist/components/value-flash/index.js.map +1 -1
- package/dist/components/value-flash/value-flash.d.ts +52 -0
- package/dist/components/value-flash/value-flash.d.ts.map +1 -1
- package/dist/components/value-flash/value-flash.js +37 -1
- package/dist/components/value-flash/value-flash.js.map +1 -1
- package/dist/icons/index.d.ts +6 -0
- package/dist/icons/index.js +6 -0
- package/dist/icons/ui/arrow-door-out-3.d.ts +3 -0
- package/dist/icons/ui/arrow-door-out-3.js +5 -0
- package/dist/icons/ui/circle-check-outline-duo.d.ts +3 -0
- package/dist/icons/ui/circle-check-outline-duo.d.ts.map +1 -0
- package/dist/icons/ui/circle-check-outline-duo.js +5 -0
- package/dist/icons/ui/circle-check-outline-duo.js.map +1 -0
- package/dist/icons/ui/circle-dashed-outline-duo.d.ts +3 -0
- package/dist/icons/ui/circle-dashed-outline-duo.d.ts.map +1 -0
- package/dist/icons/ui/circle-dashed-outline-duo.js +5 -0
- package/dist/icons/ui/circle-dashed-outline-duo.js.map +1 -0
- package/dist/icons/ui/circle-warning-outline-duo.d.ts +3 -0
- package/dist/icons/ui/circle-warning-outline-duo.d.ts.map +1 -0
- package/dist/icons/ui/circle-warning-outline-duo.js +5 -0
- package/dist/icons/ui/circle-warning-outline-duo.js.map +1 -0
- package/dist/icons/ui/circle-xmark-outline-duo.d.ts +3 -0
- package/dist/icons/ui/circle-xmark-outline-duo.d.ts.map +1 -0
- package/dist/icons/ui/circle-xmark-outline-duo.js +5 -0
- package/dist/icons/ui/circle-xmark-outline-duo.js.map +1 -0
- package/dist/icons/ui/clock-outline-duo.d.ts +3 -0
- package/dist/icons/ui/clock-outline-duo.d.ts.map +1 -0
- package/dist/icons/ui/clock-outline-duo.js +5 -0
- package/dist/icons/ui/clock-outline-duo.js.map +1 -0
- package/dist/lib/cn-tables.js +5 -5
- package/dist/lib/cn-tables.js.map +1 -1
- package/dist/lib/locale-messages.d.ts +6 -3
- package/dist/lib/locale-messages.d.ts.map +1 -1
- package/dist/lib/locale-messages.js +6 -3
- package/dist/lib/locale-messages.js.map +1 -1
- package/dist/locales/ar.d.ts.map +1 -1
- package/dist/locales/ar.js +1 -0
- package/dist/locales/ar.js.map +1 -1
- package/dist/locales/de.d.ts.map +1 -1
- package/dist/locales/de.js +1 -0
- package/dist/locales/de.js.map +1 -1
- package/dist/locales/es.d.ts.map +1 -1
- package/dist/locales/es.js +1 -0
- package/dist/locales/es.js.map +1 -1
- package/dist/locales/fr.d.ts.map +1 -1
- package/dist/locales/fr.js +1 -0
- package/dist/locales/fr.js.map +1 -1
- package/dist/locales/he.d.ts.map +1 -1
- package/dist/locales/he.js +1 -0
- package/dist/locales/he.js.map +1 -1
- package/dist/locales/hi.d.ts.map +1 -1
- package/dist/locales/hi.js +1 -0
- package/dist/locales/hi.js.map +1 -1
- package/dist/locales/ja.d.ts.map +1 -1
- package/dist/locales/ja.js +1 -0
- package/dist/locales/ja.js.map +1 -1
- package/dist/locales/pt-BR.d.ts.map +1 -1
- package/dist/locales/pt-BR.js +1 -0
- package/dist/locales/pt-BR.js.map +1 -1
- package/dist/locales/zh-CN.d.ts.map +1 -1
- package/dist/locales/zh-CN.js +1 -0
- package/dist/locales/zh-CN.js.map +1 -1
- package/dist/primitives/charts/bar.d.ts +11 -0
- package/dist/primitives/charts/bar.d.ts.map +1 -1
- package/dist/primitives/charts/bar.js +65 -11
- package/dist/primitives/charts/bar.js.map +1 -1
- package/dist/primitives/charts/funnel-chart.d.ts +22 -3
- package/dist/primitives/charts/funnel-chart.d.ts.map +1 -1
- package/dist/primitives/charts/funnel-chart.js +122 -110
- package/dist/primitives/charts/funnel-chart.js.map +1 -1
- package/dist/primitives/charts/gauge.d.ts +7 -0
- package/dist/primitives/charts/gauge.d.ts.map +1 -1
- package/dist/primitives/charts/gauge.js +37 -9
- package/dist/primitives/charts/gauge.js.map +1 -1
- package/dist/primitives/charts/index.d.ts +1 -0
- package/dist/primitives/charts/index.d.ts.map +1 -1
- package/dist/primitives/charts/index.js +1 -0
- package/dist/primitives/charts/index.js.map +1 -1
- package/dist/primitives/charts/legend/legend-marker.d.ts +7 -2
- package/dist/primitives/charts/legend/legend-marker.d.ts.map +1 -1
- package/dist/primitives/charts/legend/legend-marker.js +9 -3
- package/dist/primitives/charts/legend/legend-marker.js.map +1 -1
- package/dist/primitives/charts/legend/legend-progress.d.ts +6 -1
- package/dist/primitives/charts/legend/legend-progress.d.ts.map +1 -1
- package/dist/primitives/charts/legend/legend-progress.js +7 -2
- package/dist/primitives/charts/legend/legend-progress.js.map +1 -1
- package/dist/primitives/charts/loading-sweep.d.ts.map +1 -1
- package/dist/primitives/charts/loading-sweep.js +11 -2
- package/dist/primitives/charts/loading-sweep.js.map +1 -1
- package/dist/primitives/charts/pie-slice.d.ts +6 -1
- package/dist/primitives/charts/pie-slice.d.ts.map +1 -1
- package/dist/primitives/charts/pie-slice.js +26 -16
- package/dist/primitives/charts/pie-slice.js.map +1 -1
- package/dist/primitives/charts/ring.d.ts +12 -3
- package/dist/primitives/charts/ring.d.ts.map +1 -1
- package/dist/primitives/charts/ring.js +46 -9
- package/dist/primitives/charts/ring.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.d.ts +14 -5
- package/dist/primitives/charts/sankey/sankey-link.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.js +34 -10
- package/dist/primitives/charts/sankey/sankey-link.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.d.ts +8 -2
- package/dist/primitives/charts/sankey/sankey-node.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.js +13 -7
- package/dist/primitives/charts/sankey/sankey-node.js.map +1 -1
- package/dist/primitives/charts/scatter-chart.d.ts.map +1 -1
- package/dist/primitives/charts/scatter-chart.js +22 -8
- package/dist/primitives/charts/scatter-chart.js.map +1 -1
- package/dist/primitives/charts/scatter.d.ts +8 -3
- package/dist/primitives/charts/scatter.d.ts.map +1 -1
- package/dist/primitives/charts/scatter.js +9 -4
- package/dist/primitives/charts/scatter.js.map +1 -1
- package/dist/primitives/charts/series-bar.d.ts +5 -1
- package/dist/primitives/charts/series-bar.d.ts.map +1 -1
- package/dist/primitives/charts/series-bar.js +30 -11
- package/dist/primitives/charts/series-bar.js.map +1 -1
- package/dist/primitives/charts/series-markers.d.ts +6 -1
- package/dist/primitives/charts/series-markers.d.ts.map +1 -1
- package/dist/primitives/charts/series-markers.js +19 -8
- package/dist/primitives/charts/series-markers.js.map +1 -1
- package/dist/primitives/charts/sunburst-center.d.ts +10 -3
- package/dist/primitives/charts/sunburst-center.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-center.js +20 -12
- package/dist/primitives/charts/sunburst-center.js.map +1 -1
- package/dist/primitives/charts/sunburst-chart.d.ts +1 -1
- package/dist/primitives/charts/sunburst-chart.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-chart.js +27 -7
- package/dist/primitives/charts/sunburst-chart.js.map +1 -1
- package/dist/primitives/charts/sunburst-context.d.ts +2 -0
- package/dist/primitives/charts/sunburst-context.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-context.js +2 -0
- package/dist/primitives/charts/sunburst-context.js.map +1 -1
- package/dist/primitives/charts/sunburst-labels.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-labels.js +2 -2
- package/dist/primitives/charts/sunburst-labels.js.map +1 -1
- package/dist/primitives/charts/sunburst-legend.d.ts +19 -0
- package/dist/primitives/charts/sunburst-legend.d.ts.map +1 -0
- package/dist/primitives/charts/sunburst-legend.js +52 -0
- package/dist/primitives/charts/sunburst-legend.js.map +1 -0
- package/dist/primitives/charts/sunburst-segment.d.ts +7 -1
- package/dist/primitives/charts/sunburst-segment.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-segment.js +35 -10
- package/dist/primitives/charts/sunburst-segment.js.map +1 -1
- package/dist/primitives/charts/sunburst.d.ts +7 -5
- package/dist/primitives/charts/sunburst.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst.js +24 -25
- package/dist/primitives/charts/sunburst.js.map +1 -1
- package/dist/primitives/ui/button.d.ts.map +1 -1
- package/dist/primitives/ui/button.js +3 -1
- package/dist/primitives/ui/button.js.map +1 -1
- package/dist/primitives/ui/sidebar.d.ts.map +1 -1
- package/dist/primitives/ui/sidebar.js +4 -2
- package/dist/primitives/ui/sidebar.js.map +1 -1
- package/dist/styles/theme.css +4 -0
- package/dist/styles/tokens.css +3 -1
- package/dist/styles/tokens.test.tsx +5 -2
- package/eslint/restricted-classes.js +46 -5
- package/package.json +1 -2
- package/dist/icons/ui/refresh-clockwise.d.ts.map +0 -1
- package/dist/icons/ui/refresh-clockwise.js.map +0 -1
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"$schema": "https://dodo-ui.dev/schema/component-registry.json",
|
|
3
3
|
"name": "@dodopayments/ui",
|
|
4
|
-
"version": "1.0.
|
|
4
|
+
"version": "1.0.2",
|
|
5
5
|
"components": [
|
|
6
6
|
{
|
|
7
7
|
"slug": "alert",
|
|
@@ -1599,6 +1599,13 @@
|
|
|
1599
1599
|
"description": "Color for tooltip dot. Use when fill is a gradient/pattern. Default: uses fill value",
|
|
1600
1600
|
"source": "dodo"
|
|
1601
1601
|
},
|
|
1602
|
+
{
|
|
1603
|
+
"name": "variant",
|
|
1604
|
+
"type": "\"tint\" | \"solid\"",
|
|
1605
|
+
"required": false,
|
|
1606
|
+
"description": "`\"tint\"`: the radar look, an opaque 20% wash of the colour (mixed into the card, so gridlines stay behind it) with\na solid 3px edge at the value end (35% while hovered).\n`\"solid\"`: the full colour. A gradient or pattern `fill` without `stroke`, and `perspective` bars, stay solid.\nDefault: \"tint\"",
|
|
1607
|
+
"source": "dodo"
|
|
1608
|
+
},
|
|
1602
1609
|
{
|
|
1603
1610
|
"name": "yAxisId",
|
|
1604
1611
|
"type": "string | number",
|
|
@@ -1789,6 +1796,13 @@
|
|
|
1789
1796
|
"required": false,
|
|
1790
1797
|
"description": "Tooltip dot color when fill is gradient/pattern. Default: fill",
|
|
1791
1798
|
"source": "dodo"
|
|
1799
|
+
},
|
|
1800
|
+
{
|
|
1801
|
+
"name": "variant",
|
|
1802
|
+
"type": "\"tint\" | \"solid\"",
|
|
1803
|
+
"required": false,
|
|
1804
|
+
"description": "`\"tint\"`: the look of `Bar`, an opaque 20% wash of the colour (35% for the hovered point) with a solid 3px edge\nalong the top. `\"solid\"`: the full colour. A gradient or pattern `fill` without `stroke` stays solid.\nDefault: \"tint\"",
|
|
1805
|
+
"source": "dodo"
|
|
1792
1806
|
}
|
|
1793
1807
|
]
|
|
1794
1808
|
},
|
|
@@ -2062,7 +2076,7 @@
|
|
|
2062
2076
|
"examples": [
|
|
2063
2077
|
{
|
|
2064
2078
|
"name": "bar-chart/grouped",
|
|
2065
|
-
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Monthly gross revenue and net revenue (after refunds and fees), first half of 2026.\nconst data = [\n { month: \"Jan\", gross: 42800, net: 37100 },\n { month: \"Feb\", gross: 46300, net: 40200 },\n { month: \"Mar\", gross: 44100, net: 38400 },\n { month: \"Apr\", gross: 51900, net: 45600 },\n { month: \"May\", gross: 55200, net: 48100 },\n { month: \"Jun\", gross: 61400, net: 53900 },\n];\n\nconst legendItems = [\n { label: \"Gross revenue\", value: 0, color: \"var(--chart-1)\" },\n { label: \"Net revenue\", value: 0, color: \"var(--chart-2)\" },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartGrouped() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <BarChart data={data} xDataKey=\"month\" label=\"Gross and net revenue by month, January to June 2026\">\n <ChartGrid horizontal />\n <Bar dataKey=\"gross\" fill=\"var(--chart-1)\" />\n <Bar dataKey=\"net\" fill=\"var(--chart-2)\" />\n <BarXAxis />\n <ChartTooltip\n rows={(point) => [\n { color: \"var(--chart-1)\", label: \"Gross\", value: usd.format(point.gross as number) },\n { color: \"var(--chart-2)\", label: \"Net\", value: usd.format(point.net as number) },\n ]}\n />\n </BarChart>\n </div>\n );\n}"
|
|
2079
|
+
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Monthly gross revenue and net revenue (after refunds and fees), first half of 2026.\nconst data = [\n { month: \"Jan\", gross: 42800, net: 37100 },\n { month: \"Feb\", gross: 46300, net: 40200 },\n { month: \"Mar\", gross: 44100, net: 38400 },\n { month: \"Apr\", gross: 51900, net: 45600 },\n { month: \"May\", gross: 55200, net: 48100 },\n { month: \"Jun\", gross: 61400, net: 53900 },\n];\n\nconst legendItems = [\n { label: \"Gross revenue\", value: 0, color: \"var(--chart-1)\" },\n { label: \"Net revenue\", value: 0, color: \"var(--chart-2)\" },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartGrouped() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker variant=\"bar\" />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <BarChart data={data} xDataKey=\"month\" label=\"Gross and net revenue by month, January to June 2026\">\n <ChartGrid horizontal />\n <Bar dataKey=\"gross\" fill=\"var(--chart-1)\" />\n <Bar dataKey=\"net\" fill=\"var(--chart-2)\" />\n <BarXAxis />\n <ChartTooltip\n rows={(point) => [\n { color: \"var(--chart-1)\", label: \"Gross\", value: usd.format(point.gross as number) },\n { color: \"var(--chart-2)\", label: \"Net\", value: usd.format(point.net as number) },\n ]}\n />\n </BarChart>\n </div>\n );\n}"
|
|
2066
2080
|
},
|
|
2067
2081
|
{
|
|
2068
2082
|
"name": "bar-chart/horizontal",
|
|
@@ -2074,7 +2088,7 @@
|
|
|
2074
2088
|
},
|
|
2075
2089
|
{
|
|
2076
2090
|
"name": "bar-chart/stacked",
|
|
2077
|
-
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Weekly payouts, split by payout method.\nconst data = [\n { week: \"W1\", bank: 18200, card: 6400, wallet: 2100 },\n { week: \"W2\", bank: 21500, card: 7100, wallet: 2600 },\n { week: \"W3\", bank: 19800, card: 6900, wallet: 3200 },\n { week: \"W4\", bank: 24300, card: 8200, wallet: 3800 },\n { week: \"W5\", bank: 22700, card: 7600, wallet: 4100 },\n { week: \"W6\", bank: 26900, card: 9100, wallet: 4700 },\n];\n\nconst series = [\n { key: \"bank\", label: \"Bank transfer\", color: \"var(--chart-1)\" },\n { key: \"card\", label: \"Card\", color: \"var(--chart-2)\" },\n { key: \"wallet\", label: \"Wallet\", color: \"var(--chart-3)\" },\n] as const;\n\nconst legendItems = series.map(({ label, color }) => ({ label, value: 0, color }));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartStacked() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <BarChart data={data} xDataKey=\"week\" stacked stackGap={2} label=\"Payouts by method, last 6 weeks\">\n <ChartGrid horizontal />\n {series.map(({ key, color }) => (\n <Bar key={key} dataKey={key} fill={color}
|
|
2091
|
+
"code": "\"use client\";\n\nimport { Bar, BarChart, BarXAxis } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\n\n// Weekly payouts, split by payout method.\nconst data = [\n { week: \"W1\", bank: 18200, card: 6400, wallet: 2100 },\n { week: \"W2\", bank: 21500, card: 7100, wallet: 2600 },\n { week: \"W3\", bank: 19800, card: 6900, wallet: 3200 },\n { week: \"W4\", bank: 24300, card: 8200, wallet: 3800 },\n { week: \"W5\", bank: 22700, card: 7600, wallet: 4100 },\n { week: \"W6\", bank: 26900, card: 9100, wallet: 4700 },\n];\n\nconst series = [\n { key: \"bank\", label: \"Bank transfer\", color: \"var(--chart-1)\" },\n { key: \"card\", label: \"Card\", color: \"var(--chart-2)\" },\n { key: \"wallet\", label: \"Wallet\", color: \"var(--chart-3)\" },\n] as const;\n\nconst legendItems = series.map(({ label, color }) => ({ label, value: 0, color }));\n\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function BarChartStacked() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker variant=\"bar\" />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <BarChart data={data} xDataKey=\"week\" stacked stackGap={2} label=\"Payouts by method, last 6 weeks\">\n <ChartGrid horizontal />\n {series.map(({ key, color }) => (\n <Bar key={key} dataKey={key} fill={color} />\n ))}\n <BarXAxis />\n <ChartTooltip\n rows={(point) =>\n series.map(({ key, label, color }) => ({\n color,\n label,\n value: usd.format(point[key] as number),\n }))\n }\n />\n </BarChart>\n </div>\n );\n}"
|
|
2078
2092
|
}
|
|
2079
2093
|
],
|
|
2080
2094
|
"docsUrl": "/charts#bar-chart"
|
|
@@ -2819,6 +2833,13 @@
|
|
|
2819
2833
|
"required": false,
|
|
2820
2834
|
"description": "Outer ring stroke width in px. Default: 2. Set to 0 to disable.",
|
|
2821
2835
|
"source": "dodo"
|
|
2836
|
+
},
|
|
2837
|
+
{
|
|
2838
|
+
"name": "tint",
|
|
2839
|
+
"type": "boolean",
|
|
2840
|
+
"required": false,
|
|
2841
|
+
"description": "Paint each marker as an opaque wash of its colour (20%, mixed into the card) inside a solid ring, with no gap: the\nlook of the tint bars. `fill` (or the series colour) is the colour; `stroke` overrides the ring. Default: false",
|
|
2842
|
+
"source": "dodo"
|
|
2822
2843
|
}
|
|
2823
2844
|
]
|
|
2824
2845
|
},
|
|
@@ -3294,7 +3315,7 @@
|
|
|
3294
3315
|
"examples": [
|
|
3295
3316
|
{
|
|
3296
3317
|
"name": "composed-chart/default",
|
|
3297
|
-
"code": "\"use client\";\n\nimport {
|
|
3318
|
+
"code": "\"use client\";\n\nimport { SeriesBar } from \"@dodopayments/ui/bar-chart\";\nimport { ChartGrid, XAxis } from \"@dodopayments/ui/chart\";\nimport { Legend, LegendItem, LegendLabel, LegendMarker } from \"@dodopayments/ui/chart-legend\";\nimport { ChartTooltip } from \"@dodopayments/ui/chart-tooltip\";\nimport { ComposedChart } from \"@dodopayments/ui/composed-chart\";\nimport { Line } from \"@dodopayments/ui/line-chart\";\n\n// Daily orders (tinted columns), revenue in $K (line) and the 7-day revenue run rate in $K (dashed grey line).\nconst data = Array.from({ length: 30 }, (_, day) => {\n const revenue = 42 + 9 * Math.sin(day / 4) + 0.6 * day + 3 * Math.cos(day * 1.3);\n return {\n date: new Date(2026, 8, 1 + day),\n orders: Math.round(revenue * 0.9 + 4 * Math.sin(day * 2.1)),\n revenue: Number(revenue.toFixed(1)),\n runRate: Number((42 + 8 * Math.sin((day - 2) / 4) + 0.6 * day).toFixed(1)),\n };\n});\n\nconst legendItems = [\n { label: \"Orders\", value: 0, color: \"var(--chart-2)\" },\n { label: \"Revenue ($K)\", value: 0, color: \"var(--chart-1)\" },\n { label: \"7-day run rate ($K)\", value: 0, color: \"var(--chart-comparison)\" },\n];\n\nexport default function ComposedChartDefault() {\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <Legend items={legendItems} className=\"flex-row flex-wrap gap-1\">\n <LegendItem className=\"flex items-center gap-2\">\n <LegendMarker />\n <LegendLabel />\n </LegendItem>\n </Legend>\n <ComposedChart\n data={data}\n label=\"Orders, revenue and 7-day run rate, September 2026\"\n barGap={0}\n maxBarSize={32}\n >\n <ChartGrid horizontal />\n <SeriesBar dataKey=\"orders\" fill=\"var(--chart-2)\" radius={4} />\n <Line dataKey=\"runRate\" variant=\"comparison\" />\n <Line dataKey=\"revenue\" stroke=\"var(--chart-1)\" />\n <XAxis numTicks={6} />\n <ChartTooltip showCrosshair={false} />\n </ComposedChart>\n </div>\n );\n}"
|
|
3298
3319
|
},
|
|
3299
3320
|
{
|
|
3300
3321
|
"name": "composed-chart/stacked",
|
|
@@ -3402,7 +3423,7 @@
|
|
|
3402
3423
|
},
|
|
3403
3424
|
{
|
|
3404
3425
|
"name": "Scatter",
|
|
3405
|
-
"description": "One series of dots inside a `ScatterChart`, read from `dataKey` on each row. Each dot is an
|
|
3426
|
+
"description": "One series of dots inside a `ScatterChart`, read from `dataKey` on each row. Each dot is an opaque wash of its colour\ninside a solid ring (`variant=\"tint\"`), or an inner fill plus an outer ring (`variant=\"ring\"`, `ringGap`, `strokeWidth`). Series colours default to `--chart-1` ..\n`--chart-5` in child order. While the crosshair is active, the other dots fade and blur\n(`fadeOnHover`). `yGradient` colours each dot by its height, from `--chart-negative` to `--chart-positive`.",
|
|
3406
3427
|
"props": [
|
|
3407
3428
|
{
|
|
3408
3429
|
"name": "dataKey",
|
|
@@ -3509,6 +3530,20 @@
|
|
|
3509
3530
|
"description": "Outer ring stroke width in px. Default: 2. Set to 0 to disable.",
|
|
3510
3531
|
"source": "dodo"
|
|
3511
3532
|
},
|
|
3533
|
+
{
|
|
3534
|
+
"name": "tint",
|
|
3535
|
+
"type": "boolean",
|
|
3536
|
+
"required": false,
|
|
3537
|
+
"description": "Paint each marker as an opaque wash of its colour (20%, mixed into the card) inside a solid ring, with no gap: the\nlook of the tint bars. `fill` (or the series colour) is the colour; `stroke` overrides the ring. Default: false",
|
|
3538
|
+
"source": "dodo"
|
|
3539
|
+
},
|
|
3540
|
+
{
|
|
3541
|
+
"name": "variant",
|
|
3542
|
+
"type": "\"tint\" | \"ring\"",
|
|
3543
|
+
"required": false,
|
|
3544
|
+
"description": "`\"tint\"`: an opaque 20% wash of the colour inside a solid 1.5px ring, the look of the tint bars. `\"ring\"`: a solid\ndot with a gap and an outer ring. A dot with `strokeWidth={0}` stays solid. Default: \"tint\"",
|
|
3545
|
+
"source": "dodo"
|
|
3546
|
+
},
|
|
3512
3547
|
{
|
|
3513
3548
|
"name": "yAxisId",
|
|
3514
3549
|
"type": "string | number",
|
|
@@ -3848,7 +3883,7 @@
|
|
|
3848
3883
|
"title": "Gauge Chart",
|
|
3849
3884
|
"category": "Charts",
|
|
3850
3885
|
"status": "stable",
|
|
3851
|
-
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Set `useGradient` for\na colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point\n`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role=\"meter\"` with\n`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or\nempty state.",
|
|
3886
|
+
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches use the\ntint look of the other charts (a 20% wash with a solid 3px outer edge); `variant=\"solid\"` fills\nthem with the full colour. Set `useGradient` for\na colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point\n`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role=\"meter\"` with\n`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or\nempty state.",
|
|
3852
3887
|
"importPath": "@dodopayments/ui/gauge-chart",
|
|
3853
3888
|
"exports": [
|
|
3854
3889
|
"GaugeChart",
|
|
@@ -3860,7 +3895,7 @@
|
|
|
3860
3895
|
"parts": [
|
|
3861
3896
|
{
|
|
3862
3897
|
"name": "GaugeChart",
|
|
3863
|
-
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Set `useGradient` for\na colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point\n`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role=\"meter\"` with\n`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or\nempty state.",
|
|
3898
|
+
"description": "One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track\n(`orientation=\"linear\"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.\n`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc\ncentre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches use the\ntint look of the other charts (a 20% wash with a solid 3px outer edge); `variant=\"solid\"` fills\nthem with the full colour. Set `useGradient` for\na colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point\n`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role=\"meter\"` with\n`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or\nempty state.",
|
|
3864
3899
|
"props": [
|
|
3865
3900
|
{
|
|
3866
3901
|
"name": "label",
|
|
@@ -4093,6 +4128,13 @@
|
|
|
4093
4128
|
"description": "",
|
|
4094
4129
|
"source": "dodo"
|
|
4095
4130
|
},
|
|
4131
|
+
{
|
|
4132
|
+
"name": "variant",
|
|
4133
|
+
"type": "\"tint\" | \"solid\"",
|
|
4134
|
+
"required": false,
|
|
4135
|
+
"description": "`\"tint\"`: the radar look of the other charts, each filled notch an opaque 20% wash of its colour\n(mixed into the card) with a solid 3px edge on its outer side.\n`\"solid\"`: the full colour. A gradient or pattern `activeFill` (`url(#id)`) and the theme palette\ngradient stay solid. Default: \"tint\"",
|
|
4136
|
+
"source": "dodo"
|
|
4137
|
+
},
|
|
4096
4138
|
{
|
|
4097
4139
|
"name": "width",
|
|
4098
4140
|
"type": "number",
|
|
@@ -4110,11 +4152,11 @@
|
|
|
4110
4152
|
},
|
|
4111
4153
|
{
|
|
4112
4154
|
"name": "gauge-chart/gradient",
|
|
4113
|
-
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartGradient() {\n return (\n <div className=\"grid w-full gap-6 @xl:grid-cols-2\">\n <GaugeChart\n label=\"Authorization rate\"\n value={94}\n centerValue={0.94}\n defaultLabel=\"Auth rate\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n useGradient\n activeGradient={[\"var(--chart-2)\", \"var(--chart-
|
|
4155
|
+
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartGradient() {\n return (\n <div className=\"grid w-full gap-6 @xl:grid-cols-2\">\n <GaugeChart\n label=\"Authorization rate\"\n value={94}\n centerValue={0.94}\n defaultLabel=\"Auth rate\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n useGradient\n activeGradient={[\"var(--chart-2)\", \"var(--chart-3)\"]}\n inactiveFillOpacity={0.4}\n minWidth={240}\n />\n <GaugeChart\n label=\"Annual revenue goal reached\"\n value={58}\n centerValue={1_160_000}\n defaultLabel=\"of $2M goal\"\n formatOptions={{ style: \"currency\", currency: \"USD\", notation: \"compact\" }}\n totalNotches={24}\n notchCornerRadius={4}\n uniformWidth\n inactiveFillOpacity={0.4}\n minWidth={240}\n />\n </div>\n );\n}"
|
|
4114
4156
|
},
|
|
4115
4157
|
{
|
|
4116
4158
|
"name": "gauge-chart/linear",
|
|
4117
|
-
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartLinear() {\n return (\n <div className=\"flex w-full flex-col gap-8\">\n <GaugeChart\n label=\"Checkout conversion this week\"\n orientation=\"linear\"\n value={38}\n centerValue={0.38}\n defaultLabel=\"Checkout conversion\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n inactiveFillOpacity={0.4}\n />\n <GaugeChart\n label=\"Refund rate against the 2% limit\"\n orientation=\"linear\"\n value={72}\n centerValue={1.44}\n defaultLabel=\"Refund rate, limit 2%\"\n suffix=\"%\"\n formatOptions={{ maximumFractionDigits: 2 }}\n labelPlacement=\"bottom\"\n labelAlign=\"end\"\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n activeFill=\"var(--chart-
|
|
4159
|
+
"code": "\"use client\";\n\nimport { GaugeChart } from \"@dodopayments/ui/gauge-chart\";\n\nexport default function GaugeChartLinear() {\n return (\n <div className=\"flex w-full flex-col gap-8\">\n <GaugeChart\n label=\"Checkout conversion this week\"\n orientation=\"linear\"\n value={38}\n centerValue={0.38}\n defaultLabel=\"Checkout conversion\"\n formatOptions={{ style: \"percent\", maximumFractionDigits: 0 }}\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n inactiveFillOpacity={0.4}\n />\n <GaugeChart\n label=\"Refund rate against the 2% limit\"\n orientation=\"linear\"\n value={72}\n centerValue={1.44}\n defaultLabel=\"Refund rate, limit 2%\"\n suffix=\"%\"\n formatOptions={{ maximumFractionDigits: 2 }}\n labelPlacement=\"bottom\"\n labelAlign=\"end\"\n totalNotches={50}\n spacing={0}\n notchCornerRadius={3}\n activeFill=\"var(--chart-2)\"\n inactiveFillOpacity={0.4}\n />\n </div>\n );\n}"
|
|
4118
4160
|
}
|
|
4119
4161
|
],
|
|
4120
4162
|
"docsUrl": "/charts#gauge-chart"
|
|
@@ -4124,7 +4166,7 @@
|
|
|
4124
4166
|
"title": "Funnel Chart",
|
|
4125
4167
|
"category": "Charts",
|
|
4126
4168
|
"status": "stable",
|
|
4127
|
-
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage
|
|
4169
|
+
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage chip and the stage label, and each boundary shows the step conversion (\"→ 54%\") from the\nstage before. Segments use the tint look of the other charts (a 20% wash with a solid 2px edge on the\nouter sides); `variant=\"solid\"` draws the full colour as `layers` halo rings. Segments grow in with a stagger on mount; hovering one dims\nthe others. `orientation=\"vertical\"` stacks the stages top to bottom; `grid` adds background bands\nand divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading\nstate and renders an empty frame when `data` is empty.",
|
|
4128
4170
|
"importPath": "@dodopayments/ui/funnel-chart",
|
|
4129
4171
|
"exports": [
|
|
4130
4172
|
"FunnelChart",
|
|
@@ -4135,7 +4177,7 @@
|
|
|
4135
4177
|
"parts": [
|
|
4136
4178
|
{
|
|
4137
4179
|
"name": "FunnelChart",
|
|
4138
|
-
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage
|
|
4180
|
+
"description": "Drop-off through the stages of a flow (visited, started checkout, paid), on the bklit\n`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,\nfirst stage first; each segment is sized as a share of the first stage and shows its value, a\npercentage chip and the stage label, and each boundary shows the step conversion (\"→ 54%\") from the\nstage before. Segments use the tint look of the other charts (a 20% wash with a solid 2px edge on the\nouter sides); `variant=\"solid\"` draws the full colour as `layers` halo rings. Segments grow in with a stagger on mount; hovering one dims\nthe others. `orientation=\"vertical\"` stacks the stages top to bottom; `grid` adds background bands\nand divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading\nstate and renders an empty frame when `data` is empty.",
|
|
4139
4181
|
"props": [
|
|
4140
4182
|
{
|
|
4141
4183
|
"name": "data",
|
|
@@ -4165,6 +4207,13 @@
|
|
|
4165
4207
|
"description": "",
|
|
4166
4208
|
"source": "dodo"
|
|
4167
4209
|
},
|
|
4210
|
+
{
|
|
4211
|
+
"name": "conversionLabel",
|
|
4212
|
+
"type": "string",
|
|
4213
|
+
"required": false,
|
|
4214
|
+
"description": "Screen reader text after the step conversion. Default \"of the previous stage\"",
|
|
4215
|
+
"source": "dodo"
|
|
4216
|
+
},
|
|
4168
4217
|
{
|
|
4169
4218
|
"name": "edges",
|
|
4170
4219
|
"type": "\"curved\" | \"straight\"",
|
|
@@ -4179,6 +4228,13 @@
|
|
|
4179
4228
|
"description": "Framer Motion transition for segment enter animation",
|
|
4180
4229
|
"source": "dodo"
|
|
4181
4230
|
},
|
|
4231
|
+
{
|
|
4232
|
+
"name": "formatConversion",
|
|
4233
|
+
"type": "((pct: number) => string)",
|
|
4234
|
+
"required": false,
|
|
4235
|
+
"description": "Formats the step conversion (0–100). Default: a rounded percentage",
|
|
4236
|
+
"source": "dodo"
|
|
4237
|
+
},
|
|
4182
4238
|
{
|
|
4183
4239
|
"name": "formatPercentage",
|
|
4184
4240
|
"type": "((pct: number) => string)",
|
|
@@ -4239,7 +4295,7 @@
|
|
|
4239
4295
|
"name": "layers",
|
|
4240
4296
|
"type": "number",
|
|
4241
4297
|
"required": false,
|
|
4242
|
-
"description": "",
|
|
4298
|
+
"description": "Halo rings of the `\"solid\"` look. Default 3",
|
|
4243
4299
|
"source": "dodo"
|
|
4244
4300
|
},
|
|
4245
4301
|
{
|
|
@@ -4263,6 +4319,13 @@
|
|
|
4263
4319
|
"description": "Render a visx pattern definition. Receives a unique `id` string per segment\nand the resolved `color`. Return a `<PatternLines>` (or any visx pattern)\ninside an SVG `<defs>`. The component will use `fill=\"url(#id)\"` on the\ninnermost ring while keeping outer halo rings as solid color.",
|
|
4264
4320
|
"source": "dodo"
|
|
4265
4321
|
},
|
|
4322
|
+
{
|
|
4323
|
+
"name": "showConversion",
|
|
4324
|
+
"type": "boolean",
|
|
4325
|
+
"required": false,
|
|
4326
|
+
"description": "Show each stage's conversion from the stage before it (\"→ 54%\") on the boundary between them,\nin the value row. Hidden when the segments are too narrow to fit it. Default true",
|
|
4327
|
+
"source": "dodo"
|
|
4328
|
+
},
|
|
4266
4329
|
{
|
|
4267
4330
|
"name": "showLabels",
|
|
4268
4331
|
"type": "boolean",
|
|
@@ -4290,6 +4353,13 @@
|
|
|
4290
4353
|
"required": false,
|
|
4291
4354
|
"description": "Stagger delay between segments in seconds. Default 0.12",
|
|
4292
4355
|
"source": "dodo"
|
|
4356
|
+
},
|
|
4357
|
+
{
|
|
4358
|
+
"name": "variant",
|
|
4359
|
+
"type": "\"tint\" | \"solid\"",
|
|
4360
|
+
"required": false,
|
|
4361
|
+
"description": "`\"tint\"`: the radar look of the other charts, each segment an opaque 20% wash of its colour\n(mixed into the card) with a solid 2px edge along its outer sides.\n`\"solid\"`: the full colour drawn as `layers` nested halo rings. A `renderPattern` fill stays\nsolid. Default: \"tint\"",
|
|
4362
|
+
"source": "dodo"
|
|
4293
4363
|
}
|
|
4294
4364
|
]
|
|
4295
4365
|
}
|
|
@@ -4301,7 +4371,7 @@
|
|
|
4301
4371
|
},
|
|
4302
4372
|
{
|
|
4303
4373
|
"name": "funnel-chart/colors",
|
|
4304
|
-
"code": "\"use client\";\n\nimport { FunnelChart, type FunnelStage } from \"@dodopayments/ui/funnel-chart\";\n\nconst compact = new Intl.NumberFormat(\"en-US\", { notation: \"compact\" });\n\n// Payouts through review: each stage has its own colour, the last one a gradient.\nconst payouts: FunnelStage[] = [\n { label: \"Requested\", value: 1_240, color: \"var(--chart-1)\" },\n { label: \"Verified\", value: 1_090, color: \"var(--chart-2)\" },\n { label: \"Approved\", value: 1_010, color: \"var(--chart-3)\" },\n {\n label: \"Paid out\",\n value: 980,\n gradient: [\n { offset: 0, color: \"var(--chart-3)\" },\n { offset: 1, color: \"var(--chart-
|
|
4374
|
+
"code": "\"use client\";\n\nimport { FunnelChart, type FunnelStage } from \"@dodopayments/ui/funnel-chart\";\n\nconst compact = new Intl.NumberFormat(\"en-US\", { notation: \"compact\" });\n\n// Payouts through review: each stage has its own colour, the last one a gradient.\nconst payouts: FunnelStage[] = [\n { label: \"Requested\", value: 1_240, color: \"var(--chart-1)\" },\n { label: \"Verified\", value: 1_090, color: \"var(--chart-2)\" },\n { label: \"Approved\", value: 1_010, color: \"var(--chart-3)\" },\n {\n label: \"Paid out\",\n value: 980,\n gradient: [\n { offset: 0, color: \"var(--chart-3)\" },\n { offset: 1, color: \"var(--chart-5)\" },\n ],\n },\n];\n\nexport default function FunnelChartColors() {\n return (\n <FunnelChart\n data={payouts}\n label=\"Payouts through review, this month\"\n formatValue={(value) => compact.format(value)}\n formatPercentage={(pct) => `${pct.toFixed(1)}%`}\n />\n );\n}"
|
|
4305
4375
|
},
|
|
4306
4376
|
{
|
|
4307
4377
|
"name": "funnel-chart/vertical",
|
|
@@ -4502,6 +4572,13 @@
|
|
|
4502
4572
|
"required": false,
|
|
4503
4573
|
"description": "Show glow effect on hover. Default: true",
|
|
4504
4574
|
"source": "dodo"
|
|
4575
|
+
},
|
|
4576
|
+
{
|
|
4577
|
+
"name": "variant",
|
|
4578
|
+
"type": "\"tint\" | \"solid\"",
|
|
4579
|
+
"required": false,
|
|
4580
|
+
"description": "`\"tint\"`: the bar charts' look, an opaque 20% wash of the colour (mixed into the card) with a solid 3px arc on the\nouter rim. `\"solid\"`: the full colour. A gradient or pattern `fill` stays solid. Default: \"tint\"",
|
|
4581
|
+
"source": "dodo"
|
|
4505
4582
|
}
|
|
4506
4583
|
]
|
|
4507
4584
|
},
|
|
@@ -4727,7 +4804,7 @@
|
|
|
4727
4804
|
},
|
|
4728
4805
|
{
|
|
4729
4806
|
"name": "Ring",
|
|
4730
|
-
"description": "One ring of a `RingChart`: a
|
|
4807
|
+
"description": "One ring of a `RingChart`: a grey track and a progress arc for the data row at `index` (by default a light `--muted`\ntrack and a 25% wash of the ring's colour with a solid end cap; `variant=\"solid\"` for a `--border` track and a solid\narc). The\ntrack scales in, then the arc fills. On hover the ring grows a little, the outer rings move out and\nthe other rings fade; the hover index drives `RingCenter` and a linked `Legend`.",
|
|
4731
4808
|
"props": [
|
|
4732
4809
|
{
|
|
4733
4810
|
"name": "index",
|
|
@@ -4754,7 +4831,7 @@
|
|
|
4754
4831
|
"name": "lineCap",
|
|
4755
4832
|
"type": "RingLineCap",
|
|
4756
4833
|
"required": false,
|
|
4757
|
-
"description": "End cap of the progress arc. Default: \"round\"",
|
|
4834
|
+
"description": "End cap of the progress arc (`variant=\"solid\"`). Default: \"round\"",
|
|
4758
4835
|
"source": "dodo"
|
|
4759
4836
|
},
|
|
4760
4837
|
{
|
|
@@ -4763,6 +4840,13 @@
|
|
|
4763
4840
|
"required": false,
|
|
4764
4841
|
"description": "Show a glow in the ring color on hover. Default: true",
|
|
4765
4842
|
"source": "dodo"
|
|
4843
|
+
},
|
|
4844
|
+
{
|
|
4845
|
+
"name": "variant",
|
|
4846
|
+
"type": "\"tint\" | \"solid\"",
|
|
4847
|
+
"required": false,
|
|
4848
|
+
"description": "`\"tint\"`: the toned-down look of the other charts, a light grey `--muted` track for what is not covered yet, the\nprogress as a 25% wash of the ring's colour (mixed into the card) and a solid 3px cap where it ends. `\"solid\"`: a\n`--border` track and a solid arc.\nDefault: \"tint\"",
|
|
4849
|
+
"source": "dodo"
|
|
4766
4850
|
}
|
|
4767
4851
|
]
|
|
4768
4852
|
},
|
|
@@ -4846,7 +4930,7 @@
|
|
|
4846
4930
|
},
|
|
4847
4931
|
{
|
|
4848
4932
|
"name": "ring-chart/legend",
|
|
4849
|
-
"code": "\"use client\";\n\nimport {\n Legend,\n type LegendItemData,\n LegendItem,\n LegendLabel,\n LegendMarker,\n LegendProgress,\n LegendValue,\n} from \"@dodopayments/ui/chart-legend\";\nimport { Ring, RingCenter, RingChart, type RingData } from \"@dodopayments/ui/ring-chart\";\nimport { useState } from \"react\";\n\n// Revenue by customer country against each country's Q3 2026 target, in USD.\nconst countries: RingData[] = [\n { label: \"United States\", value: 84200, maxValue: 100000 },\n { label: \"India\", value: 51600, maxValue: 60000 },\n { label: \"Germany\", value: 23900, maxValue: 40000 },\n { label: \"Brazil\", value: 11300, maxValue: 25000 },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\", notation: \"compact\" });\n\nconst legendItems: LegendItemData[] = countries.map((row, index) => ({\n label: row.label,\n value: row.value,\n maxValue: row.maxValue,\n color: `var(--chart-${index + 1})`,\n}));\n\nexport default function RingChartLegend() {\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\n\n return (\n <div className=\"flex w-full flex-col items-center gap-6 @xl:flex-row @xl:gap-10\">\n <div className=\"w-full max-w-72 flex-1\">\n <RingChart\n data={countries}\n label=\"Revenue against target by country, Q3 2026\"\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n >\n {countries.map((row, index) => (\n <Ring key={row.label} index={index} />\n ))}\n <RingCenter defaultLabel=\"Q3 revenue\" prefix=\"$\" formatOptions={{ notation: \"compact\" }} />\n </RingChart>\n </div>\n <Legend\n items={legendItems}\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n title=\"Against target\"\n className=\"w-full max-w-64\"\n >\n <LegendItem className=\"grid grid-cols-[auto_1fr_auto] items-center gap-x-3 gap-y-1\">\n <LegendMarker />\n <LegendLabel />\n <LegendValue formatValue={(value) => usd.format(value)} showPercentage />\n <div className=\"col-span-full\">\n <LegendProgress />\n </div>\n </LegendItem>\n </Legend>\n </div>\n );\n}"
|
|
4933
|
+
"code": "\"use client\";\n\nimport {\n Legend,\n type LegendItemData,\n LegendItem,\n LegendLabel,\n LegendMarker,\n LegendProgress,\n LegendValue,\n} from \"@dodopayments/ui/chart-legend\";\nimport { Ring, RingCenter, RingChart, type RingData } from \"@dodopayments/ui/ring-chart\";\nimport { useState } from \"react\";\n\n// Revenue by customer country against each country's Q3 2026 target, in USD.\nconst countries: RingData[] = [\n { label: \"United States\", value: 84200, maxValue: 100000 },\n { label: \"India\", value: 51600, maxValue: 60000 },\n { label: \"Germany\", value: 23900, maxValue: 40000 },\n { label: \"Brazil\", value: 11300, maxValue: 25000 },\n];\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\", notation: \"compact\" });\n\nconst legendItems: LegendItemData[] = countries.map((row, index) => ({\n label: row.label,\n value: row.value,\n maxValue: row.maxValue,\n color: `var(--chart-${index + 1})`,\n}));\n\nexport default function RingChartLegend() {\n const [hoveredIndex, setHoveredIndex] = useState<number | null>(null);\n\n return (\n <div className=\"flex w-full flex-col items-center gap-6 @xl:flex-row @xl:gap-10\">\n <div className=\"w-full max-w-72 flex-1\">\n <RingChart\n data={countries}\n label=\"Revenue against target by country, Q3 2026\"\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n >\n {countries.map((row, index) => (\n <Ring key={row.label} index={index} />\n ))}\n <RingCenter defaultLabel=\"Q3 revenue\" prefix=\"$\" formatOptions={{ notation: \"compact\" }} />\n </RingChart>\n </div>\n <Legend\n items={legendItems}\n hoveredIndex={hoveredIndex}\n onHoverChange={setHoveredIndex}\n title=\"Against target\"\n className=\"w-full max-w-64\"\n >\n <LegendItem className=\"grid grid-cols-[auto_1fr_auto] items-center gap-x-3 gap-y-1\">\n <LegendMarker variant=\"bar\" />\n <LegendLabel />\n <LegendValue formatValue={(value) => usd.format(value)} showPercentage />\n <div className=\"col-span-full\">\n <LegendProgress variant=\"tint\" />\n </div>\n </LegendItem>\n </Legend>\n </div>\n );\n}"
|
|
4850
4934
|
}
|
|
4851
4935
|
],
|
|
4852
4936
|
"docsUrl": "/charts#ring-chart"
|
|
@@ -4856,7 +4940,7 @@
|
|
|
4856
4940
|
"title": "Sunburst Chart",
|
|
4857
4941
|
"category": "Charts",
|
|
4858
4942
|
"status": "stable",
|
|
4859
|
-
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub
|
|
4943
|
+
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:\nthe focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`\n(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and\n`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are\ntinted washes with a solid rim, like the bar and pie charts. Click a segment with children to zoom in.\nThe SVG is decorative and pointer-only: `SunburstLegend` rows zoom in and `SunburstBreadcrumb` buttons\nzoom out by keyboard, so keep both in the chart when focus can change. Rings reveal on mount;\nthere is no loading or empty state. `size` (default 520) is the largest diameter; the chart never\ngets wider than its container.",
|
|
4860
4944
|
"importPath": "@dodopayments/ui/sunburst-chart",
|
|
4861
4945
|
"exports": [
|
|
4862
4946
|
"SunburstArc",
|
|
@@ -4873,6 +4957,8 @@
|
|
|
4873
4957
|
"SunburstHintProps",
|
|
4874
4958
|
"SunburstLabels",
|
|
4875
4959
|
"SunburstLabelsProps",
|
|
4960
|
+
"SunburstLegend",
|
|
4961
|
+
"SunburstLegendProps",
|
|
4876
4962
|
"SunburstNode",
|
|
4877
4963
|
"SunburstSegment",
|
|
4878
4964
|
"SunburstSegmentProps",
|
|
@@ -4882,7 +4968,7 @@
|
|
|
4882
4968
|
"parts": [
|
|
4883
4969
|
{
|
|
4884
4970
|
"name": "SunburstChart",
|
|
4885
|
-
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub
|
|
4971
|
+
"description": "A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from\nchildren: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:\nthe focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`\n(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and\n`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are\ntinted washes with a solid rim, like the bar and pie charts. Click a segment with children to zoom in.\nThe SVG is decorative and pointer-only: `SunburstLegend` rows zoom in and `SunburstBreadcrumb` buttons\nzoom out by keyboard, so keep both in the chart when focus can change. Rings reveal on mount;\nthere is no loading or empty state. `size` (default 520) is the largest diameter; the chart never\ngets wider than its container.",
|
|
4886
4972
|
"props": [
|
|
4887
4973
|
{
|
|
4888
4974
|
"name": "data",
|
|
@@ -5008,12 +5094,19 @@
|
|
|
5008
5094
|
"required": false,
|
|
5009
5095
|
"description": "Optional fill opacity override",
|
|
5010
5096
|
"source": "dodo"
|
|
5097
|
+
},
|
|
5098
|
+
{
|
|
5099
|
+
"name": "variant",
|
|
5100
|
+
"type": "\"tint\" | \"solid\"",
|
|
5101
|
+
"required": false,
|
|
5102
|
+
"description": "`\"tint\"`: the bar and pie charts' look, the branch colour washed 20% into the card on every ring (35% while\nhovered) with a solid 3px rim on the outer edge. `\"solid\"`: the full colour, fading by ring. A gradient or pattern\n`fill` stays solid. Default: \"tint\"",
|
|
5103
|
+
"source": "dodo"
|
|
5011
5104
|
}
|
|
5012
5105
|
]
|
|
5013
5106
|
},
|
|
5014
5107
|
{
|
|
5015
5108
|
"name": "SunburstCenter",
|
|
5016
|
-
"description": "The hub of a `SunburstChart
|
|
5109
|
+
"description": "The hub of a `SunburstChart`, on the card colour. With `formatValue` it shows the focused node's total and name, so\nthe chart reads without hovering. After a drill-down a click on it zooms out one level.",
|
|
5017
5110
|
"props": [
|
|
5018
5111
|
{
|
|
5019
5112
|
"name": "className",
|
|
@@ -5021,6 +5114,20 @@
|
|
|
5021
5114
|
"required": false,
|
|
5022
5115
|
"description": "Class name of the hub circle.",
|
|
5023
5116
|
"source": "dodo"
|
|
5117
|
+
},
|
|
5118
|
+
{
|
|
5119
|
+
"name": "formatValue",
|
|
5120
|
+
"type": "((value: number) => string)",
|
|
5121
|
+
"required": false,
|
|
5122
|
+
"description": "Formats the total written in the hub, e.g. `(v) => money.format(v * 1000)`. Leave it out for an empty hub. The\ntotal is the focused node's: the whole chart at the root, the branch after a drill-down.",
|
|
5123
|
+
"source": "dodo"
|
|
5124
|
+
},
|
|
5125
|
+
{
|
|
5126
|
+
"name": "label",
|
|
5127
|
+
"type": "string",
|
|
5128
|
+
"required": false,
|
|
5129
|
+
"description": "Caption under the total at the root, e.g. \"Q3 revenue\". After a drill-down the caption is the branch name. Default: `data.name`",
|
|
5130
|
+
"source": "dodo"
|
|
5024
5131
|
}
|
|
5025
5132
|
]
|
|
5026
5133
|
},
|
|
@@ -5065,6 +5172,40 @@
|
|
|
5065
5172
|
}
|
|
5066
5173
|
]
|
|
5067
5174
|
},
|
|
5175
|
+
{
|
|
5176
|
+
"name": "SunburstLegend",
|
|
5177
|
+
"description": "The branches of a `SunburstChart` as a list beside it: a marker in the ring's tint, the name, the value and its share.\nIt follows the drill-down (the focused node's children) and the hover, both ways. A row with children is a button\nthat zooms in, so it is also the keyboard way into the hierarchy. Put it inside `SunburstChart`; the chart places it\nbeside the rings, or under them when there is no room.",
|
|
5178
|
+
"props": [
|
|
5179
|
+
{
|
|
5180
|
+
"name": "className",
|
|
5181
|
+
"type": "string",
|
|
5182
|
+
"required": false,
|
|
5183
|
+
"description": "Class name of the list.",
|
|
5184
|
+
"source": "dodo"
|
|
5185
|
+
},
|
|
5186
|
+
{
|
|
5187
|
+
"name": "formatValue",
|
|
5188
|
+
"type": "((value: number) => string)",
|
|
5189
|
+
"required": false,
|
|
5190
|
+
"description": "Formats each row's value. Default: a whole number in the locale.",
|
|
5191
|
+
"source": "dodo"
|
|
5192
|
+
},
|
|
5193
|
+
{
|
|
5194
|
+
"name": "showPercentage",
|
|
5195
|
+
"type": "boolean",
|
|
5196
|
+
"required": false,
|
|
5197
|
+
"description": "Show each row's share of the focused node. Default: true",
|
|
5198
|
+
"source": "dodo"
|
|
5199
|
+
},
|
|
5200
|
+
{
|
|
5201
|
+
"name": "zoomInLabel",
|
|
5202
|
+
"type": "string",
|
|
5203
|
+
"required": false,
|
|
5204
|
+
"description": "Ends the accessible name of a row that zooms in (\"Subscriptions, $683K, 66%, zoom in\"). Default: \"zoom in\"",
|
|
5205
|
+
"source": "dodo"
|
|
5206
|
+
}
|
|
5207
|
+
]
|
|
5208
|
+
},
|
|
5068
5209
|
{
|
|
5069
5210
|
"name": "SunburstHint",
|
|
5070
5211
|
"description": "A polite live region below a `SunburstChart`: the hovered segment's path, or how to zoom in or out.",
|
|
@@ -5161,7 +5302,11 @@
|
|
|
5161
5302
|
"examples": [
|
|
5162
5303
|
{
|
|
5163
5304
|
"name": "sunburst-chart/basic",
|
|
5164
|
-
"code": "\"use client\";\n\nimport {\n buildArcs,\n SunburstBreadcrumb,\n SunburstCenter,\n SunburstChart,\n SunburstHint,\n
|
|
5305
|
+
"code": "\"use client\";\n\nimport {\n buildArcs,\n SunburstBreadcrumb,\n SunburstCenter,\n SunburstChart,\n SunburstHint,\n SunburstLegend,\n type SunburstNode,\n SunburstSegment,\n} from \"@dodopayments/ui/sunburst-chart\";\n\n// Q3 2026 revenue in thousands of USD: product line, then plan or channel, then region.\nconst revenue: SunburstNode = {\n name: \"Revenue\",\n children: [\n {\n name: \"Subscriptions\",\n children: [\n {\n name: \"Monthly\",\n children: [\n { name: \"Americas\", value: 182 },\n { name: \"EMEA\", value: 121 },\n { name: \"APAC\", value: 94 },\n ],\n },\n {\n name: \"Annual\",\n children: [\n { name: \"Americas\", value: 146 },\n { name: \"EMEA\", value: 88 },\n { name: \"APAC\", value: 52 },\n ],\n },\n ],\n },\n {\n name: \"One-time\",\n children: [\n { name: \"Digital goods\", value: 138 },\n { name: \"Courses\", value: 74 },\n ],\n },\n {\n name: \"Usage\",\n children: [\n { name: \"API calls\", value: 96 },\n { name: \"Storage\", value: 41 },\n ],\n },\n ],\n};\n\nconst { arcs } = buildArcs(revenue);\nconst money = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n notation: \"compact\",\n maximumFractionDigits: 2,\n});\nconst formatThousands = (value: number) => money.format(value * 1000);\n\nexport default function SunburstChartBasic() {\n return (\n <SunburstChart\n data={revenue}\n label=\"Q3 2026 revenue by product line, plan and region\"\n size={320}\n >\n <SunburstBreadcrumb />\n {arcs.map((arc) => (\n <SunburstSegment key={arc.id} index={arc.arcIndex} />\n ))}\n <SunburstCenter formatValue={formatThousands} label=\"Q3 revenue\" />\n <SunburstLegend formatValue={formatThousands} />\n <SunburstHint />\n </SunburstChart>\n );\n}"
|
|
5306
|
+
},
|
|
5307
|
+
{
|
|
5308
|
+
"name": "sunburst-chart/compact",
|
|
5309
|
+
"code": "\"use client\";\n\nimport {\n buildArcs,\n SunburstBreadcrumb,\n SunburstCenter,\n SunburstChart,\n SunburstHint,\n SunburstLegend,\n type SunburstNode,\n SunburstSegment,\n} from \"@dodopayments/ui/sunburst-chart\";\n\n// Q3 2026 revenue in thousands of USD: product line, then plan or channel, then region.\nconst revenue: SunburstNode = {\n name: \"Revenue\",\n children: [\n {\n name: \"Subscriptions\",\n children: [\n {\n name: \"Monthly\",\n children: [\n { name: \"Americas\", value: 182 },\n { name: \"EMEA\", value: 121 },\n { name: \"APAC\", value: 94 },\n ],\n },\n {\n name: \"Annual\",\n children: [\n { name: \"Americas\", value: 146 },\n { name: \"EMEA\", value: 88 },\n { name: \"APAC\", value: 52 },\n ],\n },\n ],\n },\n {\n name: \"One-time\",\n children: [\n { name: \"Digital goods\", value: 138 },\n { name: \"Courses\", value: 74 },\n ],\n },\n {\n name: \"Usage\",\n children: [\n { name: \"API calls\", value: 96 },\n { name: \"Storage\", value: 41 },\n ],\n },\n ],\n};\n\nconst { arcs } = buildArcs(revenue);\n\nexport default function SunburstChartCompact() {\n return (\n <SunburstChart\n data={revenue}\n label=\"Q3 2026 revenue by product line, plan and region\"\n size={240}\n >\n <SunburstBreadcrumb />\n {arcs.map((arc) => (\n <SunburstSegment key={arc.id} index={arc.arcIndex} />\n ))}\n <SunburstCenter />\n {/* The keyboard paths: legend rows zoom in, breadcrumb buttons zoom out. */}\n <SunburstLegend />\n <SunburstHint />\n </SunburstChart>\n );\n}"
|
|
5165
5310
|
},
|
|
5166
5311
|
{
|
|
5167
5312
|
"name": "sunburst-chart/controlled",
|
|
@@ -5169,7 +5314,7 @@
|
|
|
5169
5314
|
},
|
|
5170
5315
|
{
|
|
5171
5316
|
"name": "sunburst-chart/custom-hint",
|
|
5172
|
-
"code": "\"use client\";\n\nimport {\n buildArcs,\n SunburstBreadcrumb,\n SunburstCenter,\n SunburstChart,\n SunburstHint,\n type SunburstNode,\n SunburstSegment,\n} from \"@dodopayments/ui/sunburst-chart\";\n\n// Q3 2026 revenue in thousands of USD: product line, then plan or channel, then region.\nconst revenue: SunburstNode = {\n name: \"Revenue\",\n children: [\n {\n name: \"Subscriptions\",\n children: [\n {\n name: \"Monthly\",\n children: [\n { name: \"Americas\", value: 182 },\n { name: \"EMEA\", value: 121 },\n { name: \"APAC\", value: 94 },\n ],\n },\n {\n name: \"Annual\",\n children: [\n { name: \"Americas\", value: 146 },\n { name: \"EMEA\", value: 88 },\n { name: \"APAC\", value: 52 },\n ],\n },\n ],\n },\n {\n name: \"One-time\",\n children: [\n { name: \"Digital goods\", value: 138 },\n { name: \"Courses\", value: 74 },\n ],\n },\n {\n name: \"Usage\",\n children: [\n { name: \"API calls\", value: 96 },\n { name: \"Storage\", value: 41 },\n ],\n },\n ],\n};\n\nconst { arcs } = buildArcs(revenue);\nconst usd = new Intl.NumberFormat(\"en-US\", {
|
|
5317
|
+
"code": "\"use client\";\n\nimport {\n buildArcs,\n SunburstBreadcrumb,\n SunburstCenter,\n SunburstChart,\n SunburstHint,\n type SunburstNode,\n SunburstSegment,\n} from \"@dodopayments/ui/sunburst-chart\";\n\n// Q3 2026 revenue in thousands of USD: product line, then plan or channel, then region.\nconst revenue: SunburstNode = {\n name: \"Revenue\",\n children: [\n {\n name: \"Subscriptions\",\n children: [\n {\n name: \"Monthly\",\n children: [\n { name: \"Americas\", value: 182 },\n { name: \"EMEA\", value: 121 },\n { name: \"APAC\", value: 94 },\n ],\n },\n {\n name: \"Annual\",\n children: [\n { name: \"Americas\", value: 146 },\n { name: \"EMEA\", value: 88 },\n { name: \"APAC\", value: 52 },\n ],\n },\n ],\n },\n {\n name: \"One-time\",\n children: [\n { name: \"Digital goods\", value: 138 },\n { name: \"Courses\", value: 74 },\n ],\n },\n {\n name: \"Usage\",\n children: [\n { name: \"API calls\", value: 96 },\n { name: \"Storage\", value: 41 },\n ],\n },\n ],\n};\n\nconst { arcs } = buildArcs(revenue);\nconst usd = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nexport default function SunburstChartCustomHint() {\n return (\n <SunburstChart\n data={revenue}\n label=\"Q3 2026 revenue by product line, plan and region\"\n size={360}\n >\n <SunburstBreadcrumb />\n {arcs.map((arc) => (\n <SunburstSegment key={arc.id} index={arc.arcIndex} />\n ))}\n <SunburstCenter />\n <SunburstHint>\n {({ hoveredArc }) =>\n hoveredArc ? (\n <span>\n <span className=\"text-foreground\">{hoveredArc.trail.join(\" / \")}</span>{\" \"}\n <span className=\"tabular-nums\">{usd.format(hoveredArc.value * 1000)}</span>\n </span>\n ) : (\n \"Hover a segment to see its revenue\"\n )\n }\n </SunburstHint>\n </SunburstChart>\n );\n}"
|
|
5173
5318
|
}
|
|
5174
5319
|
],
|
|
5175
5320
|
"docsUrl": "/charts#sunburst-chart"
|
|
@@ -5941,7 +6086,7 @@
|
|
|
5941
6086
|
"title": "Sankey Chart",
|
|
5942
6087
|
"category": "Charts",
|
|
5943
6088
|
"status": "stable",
|
|
5944
|
-
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. The chart is as wide as its container; height comes from `aspectRatio`\n(default `\"2 / 1\"`). The default `margin` keeps 180px on each side for node labels.",
|
|
6089
|
+
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. Nodes and bands use the tint look of the other charts by default (nodes a 20%\nwash with a solid edge on their label side, bands a lighter 12% wash in their source node's colour, 24% while\nhighlighted); set\n`variant=\"solid\"` on `SankeyLink` / `SankeyNode` for full colour. The chart is as wide as its container; height comes from `aspectRatio`\n(default `\"2 / 1\"`). The default `margin` keeps 180px on each side for node labels.",
|
|
5945
6090
|
"importPath": "@dodopayments/ui/sankey-chart",
|
|
5946
6091
|
"exports": [
|
|
5947
6092
|
"SankeyChart",
|
|
@@ -5963,7 +6108,7 @@
|
|
|
5963
6108
|
"parts": [
|
|
5964
6109
|
{
|
|
5965
6110
|
"name": "SankeyChart",
|
|
5966
|
-
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. The chart is as wide as its container; height comes from `aspectRatio`\n(default `\"2 / 1\"`). The default `margin` keeps 180px on each side for node labels.",
|
|
6111
|
+
"description": "A Sankey diagram on the bklit `SankeyChart` primitive (visx, d3-sankey): flows between nodes, each\nband as wide as its value. Use it to show where an amount goes, e.g. gross volume into fees,\nrefunds and payouts. Compose it from children: `SankeyLink` (the bands), `SankeyNode` (the bars\nand their labels) and `SankeyTooltip`. `data` is `{ nodes, links }`: each node has a `name`, each\nlink a `source` and `target` node index and a `value`. Nodes and bands grow in on mount over\n`animationDuration`. Nodes and bands use the tint look of the other charts by default (nodes a 20%\nwash with a solid edge on their label side, bands a lighter 12% wash in their source node's colour, 24% while\nhighlighted); set\n`variant=\"solid\"` on `SankeyLink` / `SankeyNode` for full colour. The chart is as wide as its container; height comes from `aspectRatio`\n(default `\"2 / 1\"`). The default `margin` keeps 180px on each side for node labels.",
|
|
5967
6112
|
"props": [
|
|
5968
6113
|
{
|
|
5969
6114
|
"name": "data",
|
|
@@ -6053,7 +6198,7 @@
|
|
|
6053
6198
|
},
|
|
6054
6199
|
{
|
|
6055
6200
|
"name": "SankeyLink",
|
|
6056
|
-
"description": "The flow bands of a Sankey diagram, one per link, drawn from left to right on mount.
|
|
6201
|
+
"description": "The flow bands of a Sankey diagram, one per link, drawn from left to right on mount. By default\n(`variant=\"tint\"`) each band is a soft wash of its source node's colour; `variant=\"solid\"` draws a\ngradient from the source colour to the target colour. Hovering a band highlights it and feeds\n`SankeyTooltip`.",
|
|
6057
6202
|
"props": [
|
|
6058
6203
|
{
|
|
6059
6204
|
"name": "fadedOpacity",
|
|
@@ -6101,7 +6246,7 @@
|
|
|
6101
6246
|
"name": "strokeOpacity",
|
|
6102
6247
|
"type": "number",
|
|
6103
6248
|
"required": false,
|
|
6104
|
-
"description": "Stroke opacity. Default: 0.5",
|
|
6249
|
+
"description": "Stroke opacity of the `\"solid\"` look. Default: 0.5",
|
|
6105
6250
|
"source": "dodo"
|
|
6106
6251
|
},
|
|
6107
6252
|
{
|
|
@@ -6110,12 +6255,19 @@
|
|
|
6110
6255
|
"required": false,
|
|
6111
6256
|
"description": "Use gradient from source to target color. Default: true",
|
|
6112
6257
|
"source": "dodo"
|
|
6258
|
+
},
|
|
6259
|
+
{
|
|
6260
|
+
"name": "variant",
|
|
6261
|
+
"type": "\"tint\" | \"solid\"",
|
|
6262
|
+
"required": false,
|
|
6263
|
+
"description": "`\"tint\"`: the radar look of the other charts, each band an opaque 12% wash of one colour (its\nsource node's, or `stroke` / `getLinkColor`), 24% while highlighted, lighter than the 20% nodes so\nthey stand out; no gradient between two hues.\n`\"solid\"`: the full colour at `strokeOpacity`, a source-to-target gradient by default.\nA pattern from `getLinkPattern` stays as it is. Default: \"tint\"",
|
|
6264
|
+
"source": "dodo"
|
|
6113
6265
|
}
|
|
6114
6266
|
]
|
|
6115
6267
|
},
|
|
6116
6268
|
{
|
|
6117
6269
|
"name": "SankeyNode",
|
|
6118
|
-
"description": "The node bars of a Sankey diagram, with a name and a value label beside each. Nodes on the left\nhalf label to their left, the others to their right. Hovering a node highlights its links and\nfeeds `SankeyTooltip`.",
|
|
6270
|
+
"description": "The node bars of a Sankey diagram, with a name and a value label beside each. Nodes on the left\nhalf label to their left, the others to their right. By default (`variant=\"tint\"`) each node is a\nsoft wash of its colour with a solid edge on its label side; `variant=\"solid\"` fills it fully. Hovering a node highlights its links and\nfeeds `SankeyTooltip`.",
|
|
6119
6271
|
"props": [
|
|
6120
6272
|
{
|
|
6121
6273
|
"name": "fadedOpacity",
|
|
@@ -6172,6 +6324,13 @@
|
|
|
6172
6324
|
"required": false,
|
|
6173
6325
|
"description": "Show value labels under node names. Default: true",
|
|
6174
6326
|
"source": "dodo"
|
|
6327
|
+
},
|
|
6328
|
+
{
|
|
6329
|
+
"name": "variant",
|
|
6330
|
+
"type": "\"tint\" | \"solid\"",
|
|
6331
|
+
"required": false,
|
|
6332
|
+
"description": "`\"tint\"`: the radar look of the other charts, each node an opaque 20% wash of its colour with a\nsolid 3px edge on its label side. `\"solid\"`: the full colour. Default: \"tint\"",
|
|
6333
|
+
"source": "dodo"
|
|
6175
6334
|
}
|
|
6176
6335
|
]
|
|
6177
6336
|
},
|
|
@@ -6240,7 +6399,7 @@
|
|
|
6240
6399
|
"examples": [
|
|
6241
6400
|
{
|
|
6242
6401
|
"name": "sankey-chart/checkout",
|
|
6243
|
-
"code": "\"use client\";\n\nimport {\n type SankeyData,\n SankeyChart,\n SankeyLink,\n SankeyNode,\n SankeyTooltip,\n} from \"@dodopayments/ui/sankey-chart\";\n\n// Checkout sessions this week: how many paid, and with which method.\nconst data: SankeyData = {\n nodes: [\n { name: \"Checkouts\", category: \"source\" },\n { name: \"Paid\" },\n { name: \"Abandoned\" },\n { name: \"Failed\" },\n { name: \"Card\" },\n { name: \"UPI\" },\n { name: \"Wallet\" },\n ],\n links: [\n { source: 0, target: 1, value: 6_420 },\n { source: 0, target: 2, value: 2_310 },\n { source: 0, target: 3, value: 540 },\n { source: 1, target: 4, value: 3_880 },\n { source: 1, target: 5, value: 1_910 },\n { source: 1, target: 6, value: 630 },\n ],\n};\n\nexport default function SankeyChartCheckout() {\n return (\n <SankeyChart\n data={data}\n label=\"Checkout sessions by outcome and payment method, this week\"\n aspectRatio=\"16 / 9\"\n margin={{ top: 16, right: 96, bottom: 16, left: 96 }}\n >\n <SankeyLink stroke=\"var(--chart-1)\"
|
|
6402
|
+
"code": "\"use client\";\n\nimport {\n type SankeyData,\n SankeyChart,\n SankeyLink,\n SankeyNode,\n SankeyTooltip,\n} from \"@dodopayments/ui/sankey-chart\";\n\n// Checkout sessions this week: how many paid, and with which method.\nconst data: SankeyData = {\n nodes: [\n { name: \"Checkouts\", category: \"source\" },\n { name: \"Paid\" },\n { name: \"Abandoned\" },\n { name: \"Failed\" },\n { name: \"Card\" },\n { name: \"UPI\" },\n { name: \"Wallet\" },\n ],\n links: [\n { source: 0, target: 1, value: 6_420 },\n { source: 0, target: 2, value: 2_310 },\n { source: 0, target: 3, value: 540 },\n { source: 1, target: 4, value: 3_880 },\n { source: 1, target: 5, value: 1_910 },\n { source: 1, target: 6, value: 630 },\n ],\n};\n\nexport default function SankeyChartCheckout() {\n return (\n <SankeyChart\n data={data}\n label=\"Checkout sessions by outcome and payment method, this week\"\n aspectRatio=\"16 / 9\"\n margin={{ top: 16, right: 96, bottom: 16, left: 96 }}\n >\n <SankeyLink stroke=\"var(--chart-1)\" />\n <SankeyNode fill=\"var(--chart-1)\" />\n <SankeyTooltip nodeValueLabel=\"Sessions\" linkValueLabel=\"Sessions\" />\n </SankeyChart>\n );\n}"
|
|
6244
6403
|
},
|
|
6245
6404
|
{
|
|
6246
6405
|
"name": "sankey-chart/payment-flow",
|
|
@@ -6782,7 +6941,7 @@
|
|
|
6782
6941
|
"title": "Retention Matrix",
|
|
6783
6942
|
"category": "Charts",
|
|
6784
6943
|
"status": "stable",
|
|
6785
|
-
"description": "How many customers of each monthly cohort are still active in the months after they joined, drawn the way the\nHeatmap chart draws its cells. One row per cohort (cohort, size, Month 0 to Month 6); each cell writes its\nretention % and is shaded on one of
|
|
6944
|
+
"description": "How many customers of each monthly cohort are still active in the months after they joined, drawn the way the\nHeatmap chart draws its cells. One row per cohort (cohort, size, Month 0 to Month 6); each cell writes its\nretention % and is shaded on one of four lime levels (`--chart-scale-02..05`), split across the matrix's own values\nlike the heatmap's (see {@link retentionThresholds}); only 0% is grey and 100% (Month 0) is the darkest lime. Hovering a cell fades the others\nand shows the cohort, the month and how many customers that is. Months a cohort has not reached are blank.\nThe matrix keeps a 560px minimum width and scrolls sideways in a narrower parent. Put it in a `Card` titled\n\"User retention\".",
|
|
6786
6945
|
"importPath": "@dodopayments/ui/retention-matrix",
|
|
6787
6946
|
"exports": [
|
|
6788
6947
|
"DODO_RETENTION_CELL_DEFAULT_VARIANTS",
|
|
@@ -6791,13 +6950,15 @@
|
|
|
6791
6950
|
"RetentionMatrix",
|
|
6792
6951
|
"RetentionMatrixLabels",
|
|
6793
6952
|
"RetentionMatrixProps",
|
|
6953
|
+
"RetentionThresholds",
|
|
6794
6954
|
"retentionCellVariants",
|
|
6795
|
-
"retentionLevel"
|
|
6955
|
+
"retentionLevel",
|
|
6956
|
+
"retentionThresholds"
|
|
6796
6957
|
],
|
|
6797
6958
|
"parts": [
|
|
6798
6959
|
{
|
|
6799
6960
|
"name": "RetentionMatrix",
|
|
6800
|
-
"description": "How many customers of each monthly cohort are still active in the months after they joined, drawn the way the\nHeatmap chart draws its cells. One row per cohort (cohort, size, Month 0 to Month 6); each cell writes its\nretention % and is shaded on one of
|
|
6961
|
+
"description": "How many customers of each monthly cohort are still active in the months after they joined, drawn the way the\nHeatmap chart draws its cells. One row per cohort (cohort, size, Month 0 to Month 6); each cell writes its\nretention % and is shaded on one of four lime levels (`--chart-scale-02..05`), split across the matrix's own values\nlike the heatmap's (see {@link retentionThresholds}); only 0% is grey and 100% (Month 0) is the darkest lime. Hovering a cell fades the others\nand shows the cohort, the month and how many customers that is. Months a cohort has not reached are blank.\nThe matrix keeps a 560px minimum width and scrolls sideways in a narrower parent. Put it in a `Card` titled\n\"User retention\".",
|
|
6801
6962
|
"props": [
|
|
6802
6963
|
{
|
|
6803
6964
|
"name": "cohorts",
|
|
@@ -6859,11 +7020,22 @@
|
|
|
6859
7020
|
{
|
|
6860
7021
|
"name": "retentionLevel",
|
|
6861
7022
|
"kind": "function",
|
|
6862
|
-
"description": "The level (0 to 4) of
|
|
7023
|
+
"description": "The level of a retention percentage: 0 (grey) for 0%, otherwise 1 to 4 (lightest to darkest lime) by how many of the\n`thresholds` it reaches. Without `thresholds` it uses fixed quarters (below 25%, 25–49%, 50–74%, 75% and more).",
|
|
7024
|
+
"members": [
|
|
7025
|
+
{
|
|
7026
|
+
"signature": "retentionLevel(percent: number, thresholds?: RetentionThresholds): \"0\" | \"1\" | \"2\" | \"3\" | \"4\"",
|
|
7027
|
+
"description": "The level of a retention percentage: 0 (grey) for 0%, otherwise 1 to 4 (lightest to darkest lime) by how many of the\n`thresholds` it reaches. Without `thresholds` it uses fixed quarters (below 25%, 25–49%, 50–74%, 75% and more)."
|
|
7028
|
+
}
|
|
7029
|
+
]
|
|
7030
|
+
},
|
|
7031
|
+
{
|
|
7032
|
+
"name": "retentionThresholds",
|
|
7033
|
+
"kind": "function",
|
|
7034
|
+
"description": "Splits the distinct retention values above 0% of Month 1 onward into four groups, one per lime level, as the\nHeatmap chart spreads its counts over its lime levels, so every shade is used and close values still differ. The\ncut points are always distinct, so repeated values never collapse two levels. Month 0\nis left out (it is always 100%, the darkest level, and would push the cut points up). With fewer than four distinct values it falls back to fixed quarters\n(25, 50, 75%).",
|
|
6863
7035
|
"members": [
|
|
6864
7036
|
{
|
|
6865
|
-
"signature": "
|
|
6866
|
-
"description": "
|
|
7037
|
+
"signature": "retentionThresholds(cohorts: readonly RetentionCohort[]): RetentionThresholds",
|
|
7038
|
+
"description": "Splits the distinct retention values above 0% of Month 1 onward into four groups, one per lime level, as the\nHeatmap chart spreads its counts over its lime levels, so every shade is used and close values still differ. The\ncut points are always distinct, so repeated values never collapse two levels. Month 0\nis left out (it is always 100%, the darkest level, and would push the cut points up). With fewer than four distinct values it falls back to fixed quarters\n(25, 50, 75%)."
|
|
6867
7039
|
}
|
|
6868
7040
|
]
|
|
6869
7041
|
}
|
|
@@ -7109,7 +7281,7 @@
|
|
|
7109
7281
|
},
|
|
7110
7282
|
{
|
|
7111
7283
|
"value": "link",
|
|
7112
|
-
"description": "Looks like an inline link but behaves as a button."
|
|
7284
|
+
"description": "Looks like an inline link (link colour, underlined; the underline turns solid on hover) but behaves as a button."
|
|
7113
7285
|
}
|
|
7114
7286
|
],
|
|
7115
7287
|
"default": "\"default\""
|
|
@@ -8447,7 +8619,7 @@
|
|
|
8447
8619
|
},
|
|
8448
8620
|
{
|
|
8449
8621
|
"name": "LegendMarker",
|
|
8450
|
-
"description": "The
|
|
8622
|
+
"description": "The marker of the current legend item: a colour dot, or a small bar for bar charts.",
|
|
8451
8623
|
"props": [
|
|
8452
8624
|
{
|
|
8453
8625
|
"name": "className",
|
|
@@ -8455,6 +8627,13 @@
|
|
|
8455
8627
|
"required": false,
|
|
8456
8628
|
"description": "Marker size class. Default: \"h-2.5 w-2.5\"",
|
|
8457
8629
|
"source": "dodo"
|
|
8630
|
+
},
|
|
8631
|
+
{
|
|
8632
|
+
"name": "variant",
|
|
8633
|
+
"type": "\"dot\" | \"bar\"",
|
|
8634
|
+
"required": false,
|
|
8635
|
+
"description": "`\"dot\"`: a dot in the series colour. `\"bar\"`: a small bar like the tint bars of a `BarChart`, the colour washed\ninto the card with a solid 2px edge on top. Default: \"dot\"",
|
|
8636
|
+
"source": "dodo"
|
|
8458
8637
|
}
|
|
8459
8638
|
]
|
|
8460
8639
|
},
|
|
@@ -8482,6 +8661,13 @@
|
|
|
8482
8661
|
"required": false,
|
|
8483
8662
|
"description": "Track class name",
|
|
8484
8663
|
"source": "dodo"
|
|
8664
|
+
},
|
|
8665
|
+
{
|
|
8666
|
+
"name": "variant",
|
|
8667
|
+
"type": "\"tint\" | \"solid\"",
|
|
8668
|
+
"required": false,
|
|
8669
|
+
"description": "`\"tint\"`: the ring chart's look, a light grey `--muted` track, the bar as a 25% wash of the item colour (mixed into\nthe card) and a solid 2px end. `\"solid\"`: a `bg-muted` track and a bar in the item colour. Default: \"solid\"",
|
|
8670
|
+
"source": "dodo"
|
|
8485
8671
|
}
|
|
8486
8672
|
]
|
|
8487
8673
|
},
|
|
@@ -8667,7 +8853,7 @@
|
|
|
8667
8853
|
},
|
|
8668
8854
|
{
|
|
8669
8855
|
"name": "dotVariant",
|
|
8670
|
-
"type": "\"
|
|
8856
|
+
"type": "\"ring\" | \"dot\"",
|
|
8671
8857
|
"required": false,
|
|
8672
8858
|
"description": "Dot style: filled circle or transparent ring. Default: \"dot\"",
|
|
8673
8859
|
"source": "dodo"
|
|
@@ -8999,7 +9185,7 @@
|
|
|
8999
9185
|
},
|
|
9000
9186
|
{
|
|
9001
9187
|
"name": "variant",
|
|
9002
|
-
"type": "\"
|
|
9188
|
+
"type": "\"ring\" | \"dot\"",
|
|
9003
9189
|
"required": false,
|
|
9004
9190
|
"description": "Dot fill or transparent ring around the hovered mark. Default: \"dot\"",
|
|
9005
9191
|
"source": "dodo"
|
|
@@ -9553,7 +9739,7 @@
|
|
|
9553
9739
|
},
|
|
9554
9740
|
{
|
|
9555
9741
|
"name": "messageKey",
|
|
9556
|
-
"type": "\"search\" | \"clear\" | \"loading\" | \"next\" | \"cardFieldLabel\" | \"cardFieldNumber\" | \"cardFieldExpiry\" | \"cardFieldCvc\" | \"cardFieldName\" | \"cardFieldNumberError\" | \"cardFieldExpiryError\" | \"cardFieldCvcError\" | \"cardFieldNameError\" | \"billingActionFailed\" | \"close\" | \"dismiss\" | \"spinnerLabel\" | \"remove\" | \"removeItem\" | \"confirm\" | \"cancel\" | \"retry\" | \"tryAgain\" | \"back\" | \"more\" | \"showMore\" | \"showLess\" | \"selectEmpty\" | \"copied\" | \"copyFailed\" | \"copyToClipboard\" | \"loadMoreError\" | \"activityTimelineLoading\" | \"activityTimelineEmptyTitle\" | \"activityTimelineEmptyDescription\" | \"activityTimelineErrorTitle\" | \"activityTimelineErrorDescription\" | \"activityTimelineEnd\" | \"autocompleteShowSuggestions\" | \"comboboxShowOptions\" | \"breadcrumbLabel\" | \"codeBlockCopy\" | \"codeBlockLabel\" | \"dataGridSelectRow\" | \"dataGridSelectAll\" | \"dataGridSortBy\" | \"dataGridSortAscending\" | \"dataGridSortDescending\" | \"dataGridTime\" | \"datePresetToday\" | \"datePresetYesterday\" | \"datePresetLast7Days\" | \"datePresetLast30Days\" | \"datePresetThisWeek\" | \"datePresetThisMonth\" | \"datePresetLastMonth\" | \"datePresetMonthToDate\" | \"datePresetYearToDate\" | \"datePresetLastYear\" | \"dateRangeTitle\" | \"dateRangePresets\" | \"datePickerTitle\" | \"datePickerReset\" | \"datePickerApply\" | \"datePickerStartDate\" | \"datePickerEndDate\" | \"dateFilterPlaceholder\" | \"dateFilterClear\" | \"loadMore\" | \"loadMoreEnd\" | \"paginationLabel\" | \"paginationPrevious\" | \"paginationNext\" | \"paginationFirst\" | \"paginationLast\" | \"paginationPage\" | \"tablePaginationRowsPerPage\" | \"tablePaginationViewing\" | \"secretFieldReveal\" | \"secretFieldCopy\" | \"secretFieldRemasked\" | \"showMoreLabel\" | \"sidebarTitle\" | \"sidebarToggle\" | \"sidebarCollapse\" | \"sidebarExpand\" | \"sidebarMode\" | \"sidebarModeTest\" | \"sidebarModeLive\" | \"sidebarSwitchToLive\" | \"sidebarSwitchToTest\" | \"inputCopy\" | \"sheetProgress\" | \"statCardIncreased\" | \"statCardDecreased\" | \"statCardInfo\" | \"statCardError\" | \"statCardEmpty\" | \"timestampUtc\" | \"timestampRelative\" | \"timestampTimestamp\" | \"wizardStepsLabel\" | \"wizardStepsPosition\" | \"progressStep\" | \"wizardStepsFinish\" | \"wizardStepsComplete\" | \"wizardStepsCompleteHint\" | \"prorationPreviewLabel\" | \"prorationPreviewCurrentPlan\" | \"prorationPreviewNewPlan\" | \"prorationPreviewCredit\" | \"prorationPreviewCharge\" | \"prorationPreviewDueToday\" | \"prorationPreviewNextInvoice\" | \"prorationPreviewEffectiveNow\" | \"prorationPreviewEffectivePeriodEnd\" | \"codeTabsLabel\" | \"walletButtonsPayWith\" | \"walletButtonsDivider\"",
|
|
9742
|
+
"type": "\"search\" | \"clear\" | \"loading\" | \"next\" | \"cardFieldLabel\" | \"cardFieldNumber\" | \"cardFieldExpiry\" | \"cardFieldCvc\" | \"cardFieldName\" | \"cardFieldNumberError\" | \"cardFieldExpiryError\" | \"cardFieldCvcError\" | \"cardFieldNameError\" | \"billingActionFailed\" | \"close\" | \"dismiss\" | \"spinnerLabel\" | \"remove\" | \"removeItem\" | \"confirm\" | \"cancel\" | \"retry\" | \"tryAgain\" | \"back\" | \"more\" | \"showMore\" | \"showLess\" | \"selectEmpty\" | \"copied\" | \"copyFailed\" | \"copyToClipboard\" | \"loadMoreError\" | \"activityTimelineLoading\" | \"activityTimelineEmptyTitle\" | \"activityTimelineEmptyDescription\" | \"activityTimelineErrorTitle\" | \"activityTimelineErrorDescription\" | \"activityTimelineEnd\" | \"autocompleteShowSuggestions\" | \"comboboxShowOptions\" | \"breadcrumbLabel\" | \"codeBlockCopy\" | \"codeBlockLabel\" | \"dataGridSelectRow\" | \"dataGridSelectAll\" | \"dataGridSortBy\" | \"dataGridSortAscending\" | \"dataGridSortDescending\" | \"dataGridTime\" | \"datePresetToday\" | \"datePresetYesterday\" | \"datePresetLast7Days\" | \"datePresetLast30Days\" | \"datePresetThisWeek\" | \"datePresetThisMonth\" | \"datePresetLastMonth\" | \"datePresetMonthToDate\" | \"datePresetYearToDate\" | \"datePresetLastYear\" | \"dateRangeTitle\" | \"dateRangePresets\" | \"datePickerTitle\" | \"datePickerReset\" | \"datePickerApply\" | \"datePickerStartDate\" | \"datePickerEndDate\" | \"dateFilterPlaceholder\" | \"dateFilterClear\" | \"loadMore\" | \"loadMoreEnd\" | \"paginationLabel\" | \"paginationPrevious\" | \"paginationNext\" | \"paginationFirst\" | \"paginationLast\" | \"paginationPage\" | \"tablePaginationRowsPerPage\" | \"tablePaginationViewing\" | \"secretFieldReveal\" | \"secretFieldCopy\" | \"secretFieldRemasked\" | \"showMoreLabel\" | \"sidebarTitle\" | \"sidebarToggle\" | \"sidebarCollapse\" | \"sidebarExpand\" | \"sidebarMode\" | \"sidebarModeTest\" | \"sidebarModeLive\" | \"sidebarSwitchToLive\" | \"sidebarSwitchToTest\" | \"inputCopy\" | \"sheetProgress\" | \"statCardIncreased\" | \"statCardDecreased\" | \"statCardInfo\" | \"statCardError\" | \"statCardEmpty\" | \"statCardNoChange\" | \"timestampUtc\" | \"timestampRelative\" | \"timestampTimestamp\" | \"wizardStepsLabel\" | \"wizardStepsPosition\" | \"progressStep\" | \"wizardStepsFinish\" | \"wizardStepsComplete\" | \"wizardStepsCompleteHint\" | \"prorationPreviewLabel\" | \"prorationPreviewCurrentPlan\" | \"prorationPreviewNewPlan\" | \"prorationPreviewCredit\" | \"prorationPreviewCharge\" | \"prorationPreviewDueToday\" | \"prorationPreviewNextInvoice\" | \"prorationPreviewEffectiveNow\" | \"prorationPreviewEffectivePeriodEnd\" | \"codeTabsLabel\" | \"walletButtonsPayWith\" | \"walletButtonsDivider\"",
|
|
9557
9743
|
"required": false,
|
|
9558
9744
|
"description": "Built-in message that translates `label` under a `LocaleProvider` while `label` is still that\nmessage's English default. Custom presets leave it out and show `label` as given; a built-in\npreset you relabel (`{ ...preset, label: \"Past week\" }`) shows its new `label` too.",
|
|
9559
9745
|
"source": "dodo"
|
|
@@ -9943,7 +10129,7 @@
|
|
|
9943
10129
|
"title": "Data table",
|
|
9944
10130
|
"category": "Data display",
|
|
9945
10131
|
"status": "stable",
|
|
9946
|
-
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows.
|
|
10132
|
+
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows. It keeps the table layout at every width:\na table wider than its container scrolls sideways (the container is then a tab stop). It sets\n`aria-sort` on sortable headers and marks selected rows `data-state=\"selected\"` (they keep their\ncolour; the checkbox shows the selection). Sorting, selection and pagination stay in the table\ninstance; pair it with `DataGridColumnHeader`, `DataGridRowSelect(All)` and `DataGridPagination`\n(16 below). After a sort change, the rows glide to their new positions (`animateSort`) and a polite\nlive region announces the new sort. `bulkActions` adds a sticky \"N selected\" bar with actions for\nthe selected rows.",
|
|
9947
10133
|
"importPath": "@dodopayments/ui/data-grid",
|
|
9948
10134
|
"exports": [
|
|
9949
10135
|
"DEFAULT_DATA_GRID_BULK_ACTION_LABELS",
|
|
@@ -9977,7 +10163,7 @@
|
|
|
9977
10163
|
"parts": [
|
|
9978
10164
|
{
|
|
9979
10165
|
"name": "DataGrid",
|
|
9980
|
-
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows.
|
|
10166
|
+
"description": "The Dodo Nest Data table, driven by a TanStack Table v8 instance: the column headers on a grey tray,\nthe rows (`size` md 48 / lg 64) on the white panel inside it, skeleton rows while `isLoading`, and\n`emptyMessage` centred in the panel when there are no rows. It keeps the table layout at every width:\na table wider than its container scrolls sideways (the container is then a tab stop). It sets\n`aria-sort` on sortable headers and marks selected rows `data-state=\"selected\"` (they keep their\ncolour; the checkbox shows the selection). Sorting, selection and pagination stay in the table\ninstance; pair it with `DataGridColumnHeader`, `DataGridRowSelect(All)` and `DataGridPagination`\n(16 below). After a sort change, the rows glide to their new positions (`animateSort`) and a polite\nlive region announces the new sort. `bulkActions` adds a sticky \"N selected\" bar with actions for\nthe selected rows.",
|
|
9981
10167
|
"props": [
|
|
9982
10168
|
{
|
|
9983
10169
|
"name": "table",
|
|
@@ -10050,8 +10236,8 @@
|
|
|
10050
10236
|
"name": "layout",
|
|
10051
10237
|
"type": "\"table\" | \"auto\" | \"cards\"",
|
|
10052
10238
|
"required": false,
|
|
10053
|
-
"
|
|
10054
|
-
"
|
|
10239
|
+
"description": "Chose between the table and the old mobile card list. The table layout is used at every width now (a table wider\nthan its container scrolls sideways), so this has no effect.",
|
|
10240
|
+
"deprecated": "No effect since the card list was removed. Removed in 2.0.",
|
|
10055
10241
|
"source": "dodo"
|
|
10056
10242
|
},
|
|
10057
10243
|
{
|
|
@@ -10249,7 +10435,7 @@
|
|
|
10249
10435
|
},
|
|
10250
10436
|
{
|
|
10251
10437
|
"name": "DataGridCellDate",
|
|
10252
|
-
"description": "A date with its time under it (.Table cell `date`).
|
|
10438
|
+
"description": "A date with its time under it (.Table cell `date`).",
|
|
10253
10439
|
"props": [
|
|
10254
10440
|
{
|
|
10255
10441
|
"name": "date",
|
|
@@ -10269,8 +10455,8 @@
|
|
|
10269
10455
|
"name": "timeLabel",
|
|
10270
10456
|
"type": "ReactNode",
|
|
10271
10457
|
"required": false,
|
|
10272
|
-
"
|
|
10273
|
-
"
|
|
10458
|
+
"description": "The label of the time's own line on the old mobile card list.",
|
|
10459
|
+
"deprecated": "No effect since the Data table has no card list. Removed in 2.0.",
|
|
10274
10460
|
"source": "dodo"
|
|
10275
10461
|
}
|
|
10276
10462
|
]
|
|
@@ -10312,27 +10498,27 @@
|
|
|
10312
10498
|
"examples": [
|
|
10313
10499
|
{
|
|
10314
10500
|
"name": "data-grid/api-keys",
|
|
10315
|
-
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Checkbox } from \"@dodopayments/ui/checkbox\";\nimport { CopyButton } from \"@dodopayments/ui/copy-button\";\nimport { CopyableId } from \"@dodopayments/ui/copyable-id\";\nimport { DataGrid, DataGridCellActions, DataGridCellPrimary } from \"@dodopayments/ui/data-grid\";\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogIcon,\n DialogPanel,\n DialogTitle,\n} from \"@dodopayments/ui/dialog\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { Field } from \"@dodopayments/ui/field\";\nimport { DotsIcon, KeyIcon, PlusIcon, TriangleWarningIcon } from \"@dodopayments/ui/icons\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { ListToolbar } from \"@dodopayments/ui/list-toolbar\";\nimport { Menu, MenuContent, MenuItem, MenuTrigger } from \"@dodopayments/ui/menu\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface ApiKey {\n id: string;\n name: string;\n /** Only the public start of the key reaches the browser, never the secret. */\n prefix: string;\n mode: \"test\" | \"live\";\n scopes?: string[];\n createdAt: string;\n lastUsedAt: string | null;\n}\n\nconst INITIAL_KEYS: ApiKey[] = [\n {\n id: \"key_1\",\n name: \"Production server\",\n prefix: \"sk_live_ab12\",\n mode: \"live\",\n createdAt: \"2026-03-02T10:00:00Z\",\n lastUsedAt: \"2026-10-09T08:30:00Z\",\n },\n {\n id: \"key_2\",\n name: \"Reporting job\",\n prefix: \"sk_live_7Hq4\",\n mode: \"live\",\n scopes: [\"payments:read\", \"payouts:read\"],\n createdAt: \"2026-06-21T14:12:00Z\",\n lastUsedAt: \"2026-10-08T23:00:00Z\",\n },\n {\n id: \"key_3\",\n name: \"Local development\",\n prefix: \"sk_test_9f3a\",\n mode: \"test\",\n createdAt: \"2026-09-30T09:45:00Z\",\n lastUsedAt: null,\n },\n];\n\nconst ALPHABET = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n\n/** A real app creates the key on its server and receives the secret once. */\nfunction newSecret(mode: ApiKey[\"mode\"]) {\n const bytes = crypto.getRandomValues(new Uint8Array(32));\n return `sk_${mode}_${Array.from(bytes, (byte) => ALPHABET.charAt(byte % ALPHABET.length)).join(\"\")}`;\n}\n\nexport default function DataGridApiKeys() {\n const [keys, setKeys] = React.useState(INITIAL_KEYS);\n const [loading, setLoading] = React.useState(true);\n const [secret, setSecret] = React.useState<string | null>(null);\n const [revoking, setRevoking] = React.useState<ApiKey | null>(null);\n const [revokeOpen, setRevokeOpen] = React.useState(false);\n\n // The keys load from your API; the grid shows skeleton rows meanwhile.\n React.useEffect(() => {\n const timer = setTimeout(() => setLoading(false), 1200);\n return () => clearTimeout(timer);\n }, []);\n\n const create = () => {\n const full = newSecret(\"test\");\n setKeys((current) => [\n ...current,\n {\n id: `key_${String(Date.now())}`,\n name: `Test key ${String(current.length + 1)}`,\n prefix: full.slice(0, 12),\n mode: \"test\",\n createdAt: new Date().toISOString(),\n lastUsedAt: null,\n },\n ]);\n setSecret(full);\n };\n\n const roll = (key: ApiKey) => {\n const full = newSecret(key.mode);\n setKeys((current) =>\n current.map((item) =>\n item.id === key.id\n ? {\n ...item,\n prefix: full.slice(0, 12),\n createdAt: new Date().toISOString(),\n lastUsedAt: null,\n }\n : item,\n ),\n );\n setSecret(full);\n };\n\n const columns: ColumnDef<ApiKey>[] = [\n {\n accessorKey: \"name\",\n header: \"Name\",\n cell: ({ row }) => (\n <DataGridCellPrimary\n title={row.original.name}\n subtitle={row.original.scopes ? row.original.scopes.join(\", \") : undefined}\n />\n ),\n meta: { cellClassName: \"min-w-40\", card: \"title\" },\n },\n {\n accessorKey: \"prefix\",\n header: \"Key\",\n cell: ({ row }) => (\n <CopyableId value={`${row.original.prefix}••••`} copyLabel=\"Copy key prefix\" />\n ),\n },\n {\n accessorKey: \"mode\",\n header: \"Mode\",\n cell: ({ row }) =>\n row.original.mode === \"test\" ? (\n <Badge tone=\"warning\">Test</Badge>\n ) : (\n <Badge tone=\"neutral\">Live</Badge>\n ),\n meta: { card: \"badge\" },\n },\n {\n accessorKey: \"createdAt\",\n header: \"Created\",\n cell: ({ row }) => <Timestamp value={row.original.createdAt} format=\"date\" />,\n },\n {\n accessorKey: \"lastUsedAt\",\n header: \"Last used\",\n cell: ({ row }) =>\n row.original.lastUsedAt ? (\n <Timestamp value={row.original.lastUsedAt} format=\"relative\" />\n ) : (\n <span className=\"text-muted-foreground\">Never used</span>\n ),\n },\n {\n id: \"actions\",\n header: () => <span className=\"sr-only\">Actions</span>,\n cell: ({ row }) => (\n <DataGridCellActions>\n <Menu>\n <MenuTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={`Actions for ${row.original.name}`}\n />\n }\n >\n <DotsIcon aria-hidden=\"true\" />\n </MenuTrigger>\n <MenuContent align=\"end\">\n <MenuItem onClick={() => roll(row.original)}>Roll key</MenuItem>\n <MenuItem\n variant=\"destructive\"\n onClick={() => {\n setRevoking(row.original);\n setRevokeOpen(true);\n }}\n >\n Revoke key\n </MenuItem>\n </MenuContent>\n </Menu>\n </DataGridCellActions>\n ),\n meta: { card: \"actions\" },\n },\n ];\n\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: keys,\n columns,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n });\n\n const createButton = (\n <Button onClick={create}>\n <PlusIcon aria-hidden=\"true\" />\n Create API key\n </Button>\n );\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-4\">\n {keys.length > 0 || loading ? (\n <ListToolbar\n left={\n <p className=\"text-body-primary text-muted-foreground\">\n {loading ? \"Loading keys…\" : `${String(keys.length)} keys`}\n </p>\n }\n right={createButton}\n />\n ) : null}\n <DataGrid\n table={table}\n layout=\"table\"\n aria-label=\"API keys\"\n isLoading={loading}\n loadingRows={3}\n emptyMessage={\n <Empty\n className=\"py-10\"\n icon={<KeyIcon />}\n title=\"No API keys yet\"\n description=\"Create a key to call the API from your server.\"\n action={createButton}\n />\n }\n />\n <RevokeKeyDialog\n apiKey={revoking}\n open={revokeOpen}\n onOpenChange={setRevokeOpen}\n onRevoke={async (id) => {\n await new Promise((resolve) => setTimeout(resolve, 800));\n setKeys((current) => current.filter((key) => key.id !== id));\n }}\n />\n <SecretKeyDialog secret={secret} onClose={() => setSecret(null)} />\n </div>\n );\n}\n\n/** Revoke breaks live integrations at once, so the user types the key's name to confirm it. */\nfunction RevokeKeyDialog({\n apiKey,\n open,\n onOpenChange,\n onRevoke,\n}: {\n apiKey: ApiKey | null;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n onRevoke: (id: string) => Promise<void>;\n}) {\n const [confirmation, setConfirmation] = React.useState(\"\");\n const [pending, setPending] = React.useState(false);\n const name = apiKey?.name ?? \"\";\n const matches = apiKey !== null && confirmation.trim() === name;\n\n return (\n <Dialog\n open={open}\n disablePointerDismissal\n onOpenChange={(next, details) => {\n if (!next && pending) {\n details.cancel();\n return;\n }\n onOpenChange(next);\n }}\n onOpenChangeComplete={(next) => {\n if (!next) setConfirmation(\"\");\n }}\n >\n <DialogContent>\n <form\n className=\"contents\"\n onSubmit={(event) => {\n event.preventDefault();\n if (!apiKey || !matches) return;\n setPending(true);\n void onRevoke(apiKey.id).then(() => {\n setPending(false);\n onOpenChange(false);\n });\n }}\n >\n <DialogHeader>\n <DialogIcon tone=\"error\" icon={<TriangleWarningIcon />} />\n <DialogTitle>Revoke {name}?</DialogTitle>\n <DialogDescription>\n Requests that use this key fail immediately. This can't be undone.\n </DialogDescription>\n </DialogHeader>\n <DialogPanel>\n <Field\n label={\n <span>\n Type <span className=\"break-all\">“{name}”</span> to confirm\n </span>\n }\n >\n <Input\n autoComplete=\"off\"\n spellCheck={false}\n value={confirmation}\n disabled={pending}\n onChange={(event) => setConfirmation(event.currentTarget.value)}\n />\n </Field>\n </DialogPanel>\n <DialogFooter>\n <DialogClose\n disabled={pending}\n render={<Button type=\"button\" variant=\"secondary\" size=\"lg\" />}\n >\n Cancel\n </DialogClose>\n <Button\n type=\"submit\"\n variant=\"destructive\"\n size=\"lg\"\n disabled={!matches}\n loading={pending}\n focusableWhenDisabled\n >\n Revoke key\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n\n/** Shows a new secret once (see the Secret key example on the Dialog page). */\nfunction SecretKeyDialog({ secret, onClose }: { secret: string | null; onClose: () => void }) {\n // Keeps the secret through the close animation after the parent cleared it.\n const [shown, setShown] = React.useState(secret);\n if (secret !== null && secret !== shown) setShown(secret);\n const [revealed, setRevealed] = React.useState(true);\n const [saved, setSaved] = React.useState(false);\n const value = shown ?? \"\";\n\n return (\n <Dialog\n open={secret !== null}\n onOpenChange={(next, details) => {\n if (!next && !saved) {\n details.cancel();\n return;\n }\n if (!next) onClose();\n }}\n onOpenChangeComplete={(next) => {\n if (next) return;\n setShown(null);\n setRevealed(true);\n setSaved(false);\n }}\n >\n <DialogContent hideCloseButton>\n <DialogHeader>\n <DialogTitle>Save your secret key</DialogTitle>\n <DialogDescription>\n This is the only time the full key is shown. Store it somewhere safe, such as a secrets\n manager, before you close this dialog.\n </DialogDescription>\n </DialogHeader>\n <DialogPanel className=\"flex flex-col gap-4\">\n <Field label=\"Secret key\">\n <Input\n readOnly\n value={revealed ? value : `${value.slice(0, 8)}••••••••`}\n copyable={false}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"font-mono\"\n trailingIcon={\n <span className=\"flex items-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"xs\"\n aria-pressed={revealed}\n onClick={() => setRevealed((value) => !value)}\n >\n Reveal\n </Button>\n <CopyButton\n variant=\"ghost\"\n size=\"sm\"\n content={value}\n sensitive\n label=\"Copy secret key\"\n />\n </span>\n }\n />\n </Field>\n <label className=\"flex items-center gap-2 text-label-primary text-foreground\">\n <Checkbox checked={saved} onCheckedChange={(checked) => setSaved(checked)} />\n I’ve saved it\n </label>\n </DialogPanel>\n <DialogFooter>\n <Button size=\"lg\" disabled={!saved} focusableWhenDisabled onClick={onClose}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}"
|
|
10501
|
+
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { Checkbox } from \"@dodopayments/ui/checkbox\";\nimport { CopyButton } from \"@dodopayments/ui/copy-button\";\nimport { CopyableId } from \"@dodopayments/ui/copyable-id\";\nimport { DataGrid, DataGridCellActions, DataGridCellPrimary } from \"@dodopayments/ui/data-grid\";\nimport {\n Dialog,\n DialogClose,\n DialogContent,\n DialogDescription,\n DialogFooter,\n DialogHeader,\n DialogIcon,\n DialogPanel,\n DialogTitle,\n} from \"@dodopayments/ui/dialog\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { Field } from \"@dodopayments/ui/field\";\nimport { DotsIcon, KeyIcon, PlusIcon, TriangleWarningIcon } from \"@dodopayments/ui/icons\";\nimport { Input } from \"@dodopayments/ui/input\";\nimport { ListToolbar } from \"@dodopayments/ui/list-toolbar\";\nimport { Menu, MenuContent, MenuItem, MenuTrigger } from \"@dodopayments/ui/menu\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface ApiKey {\n id: string;\n name: string;\n /** Only the public start of the key reaches the browser, never the secret. */\n prefix: string;\n mode: \"test\" | \"live\";\n scopes?: string[];\n createdAt: string;\n lastUsedAt: string | null;\n}\n\nconst INITIAL_KEYS: ApiKey[] = [\n {\n id: \"key_1\",\n name: \"Production server\",\n prefix: \"sk_live_ab12\",\n mode: \"live\",\n createdAt: \"2026-03-02T10:00:00Z\",\n lastUsedAt: \"2026-10-09T08:30:00Z\",\n },\n {\n id: \"key_2\",\n name: \"Reporting job\",\n prefix: \"sk_live_7Hq4\",\n mode: \"live\",\n scopes: [\"payments:read\", \"payouts:read\"],\n createdAt: \"2026-06-21T14:12:00Z\",\n lastUsedAt: \"2026-10-08T23:00:00Z\",\n },\n {\n id: \"key_3\",\n name: \"Local development\",\n prefix: \"sk_test_9f3a\",\n mode: \"test\",\n createdAt: \"2026-09-30T09:45:00Z\",\n lastUsedAt: null,\n },\n];\n\nconst ALPHABET = \"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789\";\n\n/** A real app creates the key on its server and receives the secret once. */\nfunction newSecret(mode: ApiKey[\"mode\"]) {\n const bytes = crypto.getRandomValues(new Uint8Array(32));\n return `sk_${mode}_${Array.from(bytes, (byte) => ALPHABET.charAt(byte % ALPHABET.length)).join(\"\")}`;\n}\n\nexport default function DataGridApiKeys() {\n const [keys, setKeys] = React.useState(INITIAL_KEYS);\n const [loading, setLoading] = React.useState(true);\n const [secret, setSecret] = React.useState<string | null>(null);\n const [revoking, setRevoking] = React.useState<ApiKey | null>(null);\n const [revokeOpen, setRevokeOpen] = React.useState(false);\n\n // The keys load from your API; the grid shows skeleton rows meanwhile.\n React.useEffect(() => {\n const timer = setTimeout(() => setLoading(false), 1200);\n return () => clearTimeout(timer);\n }, []);\n\n const create = () => {\n const full = newSecret(\"test\");\n setKeys((current) => [\n ...current,\n {\n id: `key_${String(Date.now())}`,\n name: `Test key ${String(current.length + 1)}`,\n prefix: full.slice(0, 12),\n mode: \"test\",\n createdAt: new Date().toISOString(),\n lastUsedAt: null,\n },\n ]);\n setSecret(full);\n };\n\n const roll = (key: ApiKey) => {\n const full = newSecret(key.mode);\n setKeys((current) =>\n current.map((item) =>\n item.id === key.id\n ? {\n ...item,\n prefix: full.slice(0, 12),\n createdAt: new Date().toISOString(),\n lastUsedAt: null,\n }\n : item,\n ),\n );\n setSecret(full);\n };\n\n const columns: ColumnDef<ApiKey>[] = [\n {\n accessorKey: \"name\",\n header: \"Name\",\n cell: ({ row }) => (\n <DataGridCellPrimary\n title={row.original.name}\n subtitle={row.original.scopes ? row.original.scopes.join(\", \") : undefined}\n />\n ),\n meta: { cellClassName: \"min-w-40\" },\n },\n {\n accessorKey: \"prefix\",\n header: \"Key\",\n cell: ({ row }) => (\n <CopyableId value={`${row.original.prefix}••••`} copyLabel=\"Copy key prefix\" />\n ),\n },\n {\n accessorKey: \"mode\",\n header: \"Mode\",\n cell: ({ row }) =>\n row.original.mode === \"test\" ? (\n <Badge tone=\"warning\">Test</Badge>\n ) : (\n <Badge tone=\"neutral\">Live</Badge>\n ),\n },\n {\n accessorKey: \"createdAt\",\n header: \"Created\",\n cell: ({ row }) => <Timestamp value={row.original.createdAt} format=\"date\" />,\n },\n {\n accessorKey: \"lastUsedAt\",\n header: \"Last used\",\n cell: ({ row }) =>\n row.original.lastUsedAt ? (\n <Timestamp value={row.original.lastUsedAt} format=\"relative\" />\n ) : (\n <span className=\"text-muted-foreground\">Never used</span>\n ),\n },\n {\n id: \"actions\",\n header: () => <span className=\"sr-only\">Actions</span>,\n cell: ({ row }) => (\n <DataGridCellActions>\n <Menu>\n <MenuTrigger\n render={\n <Button\n variant=\"ghost\"\n size=\"icon\"\n aria-label={`Actions for ${row.original.name}`}\n />\n }\n >\n <DotsIcon aria-hidden=\"true\" />\n </MenuTrigger>\n <MenuContent align=\"end\">\n <MenuItem onClick={() => roll(row.original)}>Roll key</MenuItem>\n <MenuItem\n variant=\"destructive\"\n onClick={() => {\n setRevoking(row.original);\n setRevokeOpen(true);\n }}\n >\n Revoke key\n </MenuItem>\n </MenuContent>\n </Menu>\n </DataGridCellActions>\n ),\n },\n ];\n\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: keys,\n columns,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n });\n\n const createButton = (\n <Button onClick={create}>\n <PlusIcon aria-hidden=\"true\" />\n Create API key\n </Button>\n );\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-4\">\n {keys.length > 0 || loading ? (\n <ListToolbar\n left={\n <p className=\"text-body-primary text-muted-foreground\">\n {loading ? \"Loading keys…\" : `${String(keys.length)} keys`}\n </p>\n }\n right={createButton}\n />\n ) : null}\n <DataGrid\n table={table}\n aria-label=\"API keys\"\n isLoading={loading}\n loadingRows={3}\n emptyMessage={\n <Empty\n className=\"py-10\"\n icon={<KeyIcon />}\n title=\"No API keys yet\"\n description=\"Create a key to call the API from your server.\"\n action={createButton}\n />\n }\n />\n <RevokeKeyDialog\n apiKey={revoking}\n open={revokeOpen}\n onOpenChange={setRevokeOpen}\n onRevoke={async (id) => {\n await new Promise((resolve) => setTimeout(resolve, 800));\n setKeys((current) => current.filter((key) => key.id !== id));\n }}\n />\n <SecretKeyDialog secret={secret} onClose={() => setSecret(null)} />\n </div>\n );\n}\n\n/** Revoke breaks live integrations at once, so the user types the key's name to confirm it. */\nfunction RevokeKeyDialog({\n apiKey,\n open,\n onOpenChange,\n onRevoke,\n}: {\n apiKey: ApiKey | null;\n open: boolean;\n onOpenChange: (open: boolean) => void;\n onRevoke: (id: string) => Promise<void>;\n}) {\n const [confirmation, setConfirmation] = React.useState(\"\");\n const [pending, setPending] = React.useState(false);\n const name = apiKey?.name ?? \"\";\n const matches = apiKey !== null && confirmation.trim() === name;\n\n return (\n <Dialog\n open={open}\n disablePointerDismissal\n onOpenChange={(next, details) => {\n if (!next && pending) {\n details.cancel();\n return;\n }\n onOpenChange(next);\n }}\n onOpenChangeComplete={(next) => {\n if (!next) setConfirmation(\"\");\n }}\n >\n <DialogContent>\n <form\n className=\"contents\"\n onSubmit={(event) => {\n event.preventDefault();\n if (!apiKey || !matches) return;\n setPending(true);\n void onRevoke(apiKey.id).then(() => {\n setPending(false);\n onOpenChange(false);\n });\n }}\n >\n <DialogHeader>\n <DialogIcon tone=\"error\" icon={<TriangleWarningIcon />} />\n <DialogTitle>Revoke {name}?</DialogTitle>\n <DialogDescription>\n Requests that use this key fail immediately. This can't be undone.\n </DialogDescription>\n </DialogHeader>\n <DialogPanel>\n <Field\n label={\n <span>\n Type <span className=\"break-all\">“{name}”</span> to confirm\n </span>\n }\n >\n <Input\n autoComplete=\"off\"\n spellCheck={false}\n value={confirmation}\n disabled={pending}\n onChange={(event) => setConfirmation(event.currentTarget.value)}\n />\n </Field>\n </DialogPanel>\n <DialogFooter>\n <DialogClose\n disabled={pending}\n render={<Button type=\"button\" variant=\"secondary\" size=\"lg\" />}\n >\n Cancel\n </DialogClose>\n <Button\n type=\"submit\"\n variant=\"destructive\"\n size=\"lg\"\n disabled={!matches}\n loading={pending}\n focusableWhenDisabled\n >\n Revoke key\n </Button>\n </DialogFooter>\n </form>\n </DialogContent>\n </Dialog>\n );\n}\n\n/** Shows a new secret once (see the Secret key example on the Dialog page). */\nfunction SecretKeyDialog({ secret, onClose }: { secret: string | null; onClose: () => void }) {\n // Keeps the secret through the close animation after the parent cleared it.\n const [shown, setShown] = React.useState(secret);\n if (secret !== null && secret !== shown) setShown(secret);\n const [revealed, setRevealed] = React.useState(true);\n const [saved, setSaved] = React.useState(false);\n const value = shown ?? \"\";\n\n return (\n <Dialog\n open={secret !== null}\n onOpenChange={(next, details) => {\n if (!next && !saved) {\n details.cancel();\n return;\n }\n if (!next) onClose();\n }}\n onOpenChangeComplete={(next) => {\n if (next) return;\n setShown(null);\n setRevealed(true);\n setSaved(false);\n }}\n >\n <DialogContent hideCloseButton>\n <DialogHeader>\n <DialogTitle>Save your secret key</DialogTitle>\n <DialogDescription>\n This is the only time the full key is shown. Store it somewhere safe, such as a secrets\n manager, before you close this dialog.\n </DialogDescription>\n </DialogHeader>\n <DialogPanel className=\"flex flex-col gap-4\">\n <Field label=\"Secret key\">\n <Input\n readOnly\n value={revealed ? value : `${value.slice(0, 8)}••••••••`}\n copyable={false}\n autoComplete=\"off\"\n spellCheck={false}\n className=\"font-mono\"\n trailingIcon={\n <span className=\"flex items-center gap-1\">\n <Button\n variant=\"ghost\"\n size=\"xs\"\n aria-pressed={revealed}\n onClick={() => setRevealed((value) => !value)}\n >\n Reveal\n </Button>\n <CopyButton\n variant=\"ghost\"\n size=\"sm\"\n content={value}\n sensitive\n label=\"Copy secret key\"\n />\n </span>\n }\n />\n </Field>\n <label className=\"flex items-center gap-2 text-label-primary text-foreground\">\n <Checkbox checked={saved} onCheckedChange={(checked) => setSaved(checked)} />\n I’ve saved it\n </label>\n </DialogPanel>\n <DialogFooter>\n <Button size=\"lg\" disabled={!saved} focusableWhenDisabled onClick={onClose}>\n Done\n </Button>\n </DialogFooter>\n </DialogContent>\n </Dialog>\n );\n}"
|
|
10316
10502
|
},
|
|
10317
10503
|
{
|
|
10318
10504
|
"name": "data-grid/api-requests",
|
|
10319
|
-
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { CodeBlock } from \"@dodopayments/ui/code-block\";\nimport { CopyableId } from \"@dodopayments/ui/copyable-id\";\nimport { DataGrid } from \"@dodopayments/ui/data-grid\";\nimport { DetailsPanel } from \"@dodopayments/ui/details-panel\";\nimport { SegmentedControl } from \"@dodopayments/ui/segmented-control\";\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetPanel,\n SheetTitle,\n} from \"@dodopayments/ui/sheet\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { TruncateText } from \"@dodopayments/ui/tooltip\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface ApiRequest {\n id: string;\n method: string;\n path: string;\n status: number;\n latencyMs: number;\n at: string;\n requestHeaders?: Record<string, string>;\n requestBody?: unknown;\n responseHeaders?: Record<string, string>;\n responseBody?: unknown;\n}\n\ntype StatusClass = \"2xx\" | \"3xx\" | \"4xx\" | \"5xx\";\n\nconst REQUESTS: ApiRequest[] = [\n {\n id: \"req_7Qk2mX9a\",\n method: \"POST\",\n path: \"/v1/payments\",\n status: 201,\n latencyMs: 184,\n at: \"2026-10-10T10:12:04Z\",\n requestHeaders: { authorization: \"Bearer sk_live_51Nx…\", \"content-type\": \"application/json\" },\n requestBody: { amount: 4900, currency: \"USD\", customer_id: \"cus_9fK2\" },\n responseHeaders: { \"content-type\": \"application/json\" },\n responseBody: { payment_id: \"pay_3Lm8\", status: \"processing\" },\n },\n {\n id: \"req_2Hn4pR1b\",\n method: \"GET\",\n path: \"/v1/subscriptions/sub_8aQ1/invoices?limit=20&status=paid\",\n status: 200,\n latencyMs: 62,\n at: \"2026-10-10T10:11:40Z\",\n },\n {\n id: \"req_9Tz6kL3c\",\n method: \"PATCH\",\n path: \"/v1/customers/cus_missing\",\n status: 404,\n latencyMs: 21,\n at: \"2026-10-10T10:10:02Z\",\n responseBody: { code: \"NOT_FOUND\", message: \"Customer not found\" },\n },\n {\n id: \"req_4Vb8nM5d\",\n method: \"POST\",\n path: \"/v1/refunds\",\n status: 500,\n latencyMs: 1204,\n at: \"2026-10-10T10:08:55Z\",\n },\n];\n\n/** Header and field names masked as •••• in the details, matched case-insensitively at any depth. */\nconst REDACT_KEYS = [\n \"authorization\",\n \"cookie\",\n \"set-cookie\",\n \"x-api-key\",\n \"password\",\n \"secret\",\n \"token\",\n];\n\nfunction redacted(value: unknown): string {\n const mask = (input: unknown): unknown => {\n if (Array.isArray(input)) return input.map(mask);\n if (input && typeof input === \"object\") {\n return Object.fromEntries(\n Object.entries(input).map(([key, inner]) => [\n key,\n REDACT_KEYS.includes(key.toLowerCase()) ? \"••••\" : mask(inner),\n ]),\n );\n }\n return input;\n };\n return JSON.stringify(mask(value), null, 2);\n}\n\nfunction statusClassOf(status: number): StatusClass {\n if (status >= 500) return \"5xx\";\n if (status >= 400) return \"4xx\";\n if (status >= 300) return \"3xx\";\n return \"2xx\";\n}\n\nconst STATUS_TONE = { \"2xx\": \"success\", \"3xx\": \"info\", \"4xx\": \"warning\", \"5xx\": \"error\" } as const;\nconst STATUS_CLASSES: StatusClass[] = [\"2xx\", \"3xx\", \"4xx\", \"5xx\"];\nconst MILLISECONDS = new Intl.NumberFormat(\"en-US\", {\n style: \"unit\",\n unit: \"millisecond\",\n unitDisplay: \"narrow\",\n});\n\nfunction StatusCode({ status }: { status: number }) {\n return (\n <Badge tone={STATUS_TONE[statusClassOf(status)]} className=\"font-mono tabular-nums\">\n <span className=\"sr-only\">Status </span>\n {status}\n </Badge>\n );\n}\n\nfunction Payload({ title, value }: { title: string; value: unknown }) {\n const headingId = React.useId();\n return (\n <section aria-labelledby={headingId} className=\"flex min-w-0 flex-col gap-2\">\n <h3 id={headingId} className=\"font-heading text-heading-quaternary text-foreground\">\n {title}\n </h3>\n {value === undefined ? (\n <p className=\"text-body-secondary text-muted-foreground\">None</p>\n ) : (\n <CodeBlock code={redacted(value)} language=\"json\" showHeader={false} />\n )}\n </section>\n );\n}\n\n/**\n * An API request log on the Data table: status and method filters (Segmented control, All by default), the path truncated with a tooltip, the\n * status coloured by class, and a Sheet with the headers and bodies (secrets masked) for the chosen request.\n */\nexport default function DataGridApiRequests() {\n const [statusClass, setStatusClass] = React.useState(\"all\");\n const [method, setMethod] = React.useState(\"all\");\n const [selected, setSelected] = React.useState<ApiRequest | null>(null);\n const [open, setOpen] = React.useState(false);\n\n const presentClasses = STATUS_CLASSES.filter((c) =>\n REQUESTS.some((request) => statusClassOf(request.status) === c),\n );\n const presentMethods = [...new Set(REQUESTS.map((request) => request.method))].sort();\n const rows = React.useMemo(\n () =>\n REQUESTS.filter(\n (request) =>\n (statusClass === \"all\" || statusClassOf(request.status) === statusClass) &&\n (method === \"all\" || request.method === method),\n ),\n [statusClass, method],\n );\n\n const show = (request: ApiRequest) => {\n setSelected(request);\n setOpen(true);\n };\n\n const columns: ColumnDef<ApiRequest>[] = [\n {\n accessorKey: \"method\",\n header: \"Method\",\n cell: ({ row }) => (\n <Button\n variant=\"link\"\n aria-haspopup=\"dialog\"\n aria-label={`${row.original.method} ${row.original.path}`}\n className=\"h-auto p-0 font-mono\"\n onClick={() => show(row.original)}\n >\n {row.original.method}\n </Button>\n ),\n meta: { card: \"title\" },\n },\n {\n accessorKey: \"path\",\n header: \"Path\",\n cell: ({ row }) => (\n <div className=\"min-w-0 max-w-80\">\n <TruncateText className=\"font-mono\">{row.original.path}</TruncateText>\n </div>\n ),\n },\n {\n accessorKey: \"status\",\n header: \"Status\",\n cell: ({ row }) => <StatusCode status={row.original.status} />,\n meta: { card: \"badge\" },\n },\n {\n accessorKey: \"latencyMs\",\n header: \"Latency\",\n cell: ({ row }) => (\n <span className=\"text-muted-foreground tabular-nums\">\n {MILLISECONDS.format(row.original.latencyMs)}\n </span>\n ),\n },\n {\n accessorKey: \"at\",\n header: \"Time\",\n cell: ({ row }) => <Timestamp value={row.original.at} />,\n },\n {\n accessorKey: \"id\",\n header: \"Request ID\",\n cell: ({ row }) => <CopyableId value={row.original.id} />,\n },\n ];\n\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: rows,\n columns,\n getCoreRowModel: getCoreRowModel(),\n getRowId: (row) => row.id,\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-3\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <SegmentedControl\n aria-label=\"Status\"\n value={statusClass}\n onValueChange={setStatusClass}\n items={[\n { value: \"all\", label: \"All\" },\n ...presentClasses.map((c) => ({ value: c, label: c })),\n ]}\n />\n <SegmentedControl\n aria-label=\"Method\"\n value={method}\n onValueChange={setMethod}\n items={[\n { value: \"all\", label: \"All\" },\n ...presentMethods.map((m) => ({ value: m, label: m })),\n ]}\n />\n </div>\n <DataGrid\n table={table}\n aria-label=\"API requests\"\n emptyMessage=\"No requests match the filters.\"\n />\n <Sheet open={open} onOpenChange={setOpen}>\n <SheetContent>\n {selected ? (\n <>\n <SheetHeader>\n <SheetTitle className=\"break-all font-mono\">\n {`${selected.method} ${selected.path}`}\n </SheetTitle>\n <SheetDescription>\n <Timestamp value={selected.at} format=\"datetime\" />\n </SheetDescription>\n </SheetHeader>\n <SheetPanel>\n <div className=\"flex flex-col gap-6\">\n <DetailsPanel\n layout=\"rows\"\n sections={[\n {\n id: \"request\",\n items: [\n {\n id: \"status\",\n label: \"Status\",\n value: <StatusCode status={selected.status} />,\n },\n {\n id: \"latency\",\n label: \"Latency\",\n value: MILLISECONDS.format(selected.latencyMs),\n },\n {\n id: \"id\",\n label: \"Request ID\",\n value: <CopyableId value={selected.id} />,\n },\n ],\n },\n ]}\n />\n <Payload title=\"Request headers\" value={selected.requestHeaders} />\n <Payload title=\"Request body\" value={selected.requestBody} />\n <Payload title=\"Response headers\" value={selected.responseHeaders} />\n <Payload title=\"Response body\" value={selected.responseBody} />\n </div>\n </SheetPanel>\n </>\n ) : null}\n </SheetContent>\n </Sheet>\n </div>\n );\n}"
|
|
10505
|
+
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { CodeBlock } from \"@dodopayments/ui/code-block\";\nimport { CopyableId } from \"@dodopayments/ui/copyable-id\";\nimport { DataGrid } from \"@dodopayments/ui/data-grid\";\nimport { DetailsPanel } from \"@dodopayments/ui/details-panel\";\nimport { SegmentedControl } from \"@dodopayments/ui/segmented-control\";\nimport {\n Sheet,\n SheetContent,\n SheetDescription,\n SheetHeader,\n SheetPanel,\n SheetTitle,\n} from \"@dodopayments/ui/sheet\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { TruncateText } from \"@dodopayments/ui/tooltip\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface ApiRequest {\n id: string;\n method: string;\n path: string;\n status: number;\n latencyMs: number;\n at: string;\n requestHeaders?: Record<string, string>;\n requestBody?: unknown;\n responseHeaders?: Record<string, string>;\n responseBody?: unknown;\n}\n\ntype StatusClass = \"2xx\" | \"3xx\" | \"4xx\" | \"5xx\";\n\nconst REQUESTS: ApiRequest[] = [\n {\n id: \"req_7Qk2mX9a\",\n method: \"POST\",\n path: \"/v1/payments\",\n status: 201,\n latencyMs: 184,\n at: \"2026-10-10T10:12:04Z\",\n requestHeaders: { authorization: \"Bearer sk_live_51Nx…\", \"content-type\": \"application/json\" },\n requestBody: { amount: 4900, currency: \"USD\", customer_id: \"cus_9fK2\" },\n responseHeaders: { \"content-type\": \"application/json\" },\n responseBody: { payment_id: \"pay_3Lm8\", status: \"processing\" },\n },\n {\n id: \"req_2Hn4pR1b\",\n method: \"GET\",\n path: \"/v1/subscriptions/sub_8aQ1/invoices?limit=20&status=paid\",\n status: 200,\n latencyMs: 62,\n at: \"2026-10-10T10:11:40Z\",\n },\n {\n id: \"req_9Tz6kL3c\",\n method: \"PATCH\",\n path: \"/v1/customers/cus_missing\",\n status: 404,\n latencyMs: 21,\n at: \"2026-10-10T10:10:02Z\",\n responseBody: { code: \"NOT_FOUND\", message: \"Customer not found\" },\n },\n {\n id: \"req_4Vb8nM5d\",\n method: \"POST\",\n path: \"/v1/refunds\",\n status: 500,\n latencyMs: 1204,\n at: \"2026-10-10T10:08:55Z\",\n },\n];\n\n/** Header and field names masked as •••• in the details, matched case-insensitively at any depth. */\nconst REDACT_KEYS = [\n \"authorization\",\n \"cookie\",\n \"set-cookie\",\n \"x-api-key\",\n \"password\",\n \"secret\",\n \"token\",\n];\n\nfunction redacted(value: unknown): string {\n const mask = (input: unknown): unknown => {\n if (Array.isArray(input)) return input.map(mask);\n if (input && typeof input === \"object\") {\n return Object.fromEntries(\n Object.entries(input).map(([key, inner]) => [\n key,\n REDACT_KEYS.includes(key.toLowerCase()) ? \"••••\" : mask(inner),\n ]),\n );\n }\n return input;\n };\n return JSON.stringify(mask(value), null, 2);\n}\n\nfunction statusClassOf(status: number): StatusClass {\n if (status >= 500) return \"5xx\";\n if (status >= 400) return \"4xx\";\n if (status >= 300) return \"3xx\";\n return \"2xx\";\n}\n\nconst STATUS_TONE = { \"2xx\": \"success\", \"3xx\": \"info\", \"4xx\": \"warning\", \"5xx\": \"error\" } as const;\nconst STATUS_CLASSES: StatusClass[] = [\"2xx\", \"3xx\", \"4xx\", \"5xx\"];\nconst MILLISECONDS = new Intl.NumberFormat(\"en-US\", {\n style: \"unit\",\n unit: \"millisecond\",\n unitDisplay: \"narrow\",\n});\n\nfunction StatusCode({ status }: { status: number }) {\n return (\n <Badge tone={STATUS_TONE[statusClassOf(status)]} className=\"font-mono tabular-nums\">\n <span className=\"sr-only\">Status </span>\n {status}\n </Badge>\n );\n}\n\nfunction Payload({ title, value }: { title: string; value: unknown }) {\n const headingId = React.useId();\n return (\n <section aria-labelledby={headingId} className=\"flex min-w-0 flex-col gap-2\">\n <h3 id={headingId} className=\"font-heading text-heading-quaternary text-foreground\">\n {title}\n </h3>\n {value === undefined ? (\n <p className=\"text-body-secondary text-muted-foreground\">None</p>\n ) : (\n <CodeBlock code={redacted(value)} language=\"json\" showHeader={false} />\n )}\n </section>\n );\n}\n\n/**\n * An API request log on the Data table: status and method filters (Segmented control, All by default), the path truncated with a tooltip, the\n * status coloured by class, and a Sheet with the headers and bodies (secrets masked) for the chosen request.\n */\nexport default function DataGridApiRequests() {\n const [statusClass, setStatusClass] = React.useState(\"all\");\n const [method, setMethod] = React.useState(\"all\");\n const [selected, setSelected] = React.useState<ApiRequest | null>(null);\n const [open, setOpen] = React.useState(false);\n\n const presentClasses = STATUS_CLASSES.filter((c) =>\n REQUESTS.some((request) => statusClassOf(request.status) === c),\n );\n const presentMethods = [...new Set(REQUESTS.map((request) => request.method))].sort();\n const rows = React.useMemo(\n () =>\n REQUESTS.filter(\n (request) =>\n (statusClass === \"all\" || statusClassOf(request.status) === statusClass) &&\n (method === \"all\" || request.method === method),\n ),\n [statusClass, method],\n );\n\n const show = (request: ApiRequest) => {\n setSelected(request);\n setOpen(true);\n };\n\n const columns: ColumnDef<ApiRequest>[] = [\n {\n accessorKey: \"method\",\n header: \"Method\",\n cell: ({ row }) => (\n <Button\n variant=\"link\"\n aria-haspopup=\"dialog\"\n aria-label={`${row.original.method} ${row.original.path}`}\n className=\"h-auto p-0 font-mono\"\n onClick={() => show(row.original)}\n >\n {row.original.method}\n </Button>\n ),\n },\n {\n accessorKey: \"path\",\n header: \"Path\",\n cell: ({ row }) => (\n <div className=\"min-w-0 max-w-80\">\n <TruncateText className=\"font-mono\">{row.original.path}</TruncateText>\n </div>\n ),\n },\n {\n accessorKey: \"status\",\n header: \"Status\",\n cell: ({ row }) => <StatusCode status={row.original.status} />,\n },\n {\n accessorKey: \"latencyMs\",\n header: \"Latency\",\n cell: ({ row }) => (\n <span className=\"text-muted-foreground tabular-nums\">\n {MILLISECONDS.format(row.original.latencyMs)}\n </span>\n ),\n },\n {\n accessorKey: \"at\",\n header: \"Time\",\n cell: ({ row }) => <Timestamp value={row.original.at} />,\n },\n {\n accessorKey: \"id\",\n header: \"Request ID\",\n cell: ({ row }) => <CopyableId value={row.original.id} />,\n },\n ];\n\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: rows,\n columns,\n getCoreRowModel: getCoreRowModel(),\n getRowId: (row) => row.id,\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-3\">\n <div className=\"flex flex-wrap items-center gap-3\">\n <SegmentedControl\n aria-label=\"Status\"\n value={statusClass}\n onValueChange={setStatusClass}\n items={[\n { value: \"all\", label: \"All\" },\n ...presentClasses.map((c) => ({ value: c, label: c })),\n ]}\n />\n <SegmentedControl\n aria-label=\"Method\"\n value={method}\n onValueChange={setMethod}\n items={[\n { value: \"all\", label: \"All\" },\n ...presentMethods.map((m) => ({ value: m, label: m })),\n ]}\n />\n </div>\n <DataGrid\n table={table}\n aria-label=\"API requests\"\n emptyMessage=\"No requests match the filters.\"\n />\n <Sheet open={open} onOpenChange={setOpen}>\n <SheetContent>\n {selected ? (\n <>\n <SheetHeader>\n <SheetTitle className=\"break-all font-mono\">\n {`${selected.method} ${selected.path}`}\n </SheetTitle>\n <SheetDescription>\n <Timestamp value={selected.at} format=\"datetime\" />\n </SheetDescription>\n </SheetHeader>\n <SheetPanel>\n <div className=\"flex flex-col gap-6\">\n <DetailsPanel\n layout=\"rows\"\n sections={[\n {\n id: \"request\",\n items: [\n {\n id: \"status\",\n label: \"Status\",\n value: <StatusCode status={selected.status} />,\n },\n {\n id: \"latency\",\n label: \"Latency\",\n value: MILLISECONDS.format(selected.latencyMs),\n },\n {\n id: \"id\",\n label: \"Request ID\",\n value: <CopyableId value={selected.id} />,\n },\n ],\n },\n ]}\n />\n <Payload title=\"Request headers\" value={selected.requestHeaders} />\n <Payload title=\"Request body\" value={selected.requestBody} />\n <Payload title=\"Response headers\" value={selected.responseHeaders} />\n <Payload title=\"Response body\" value={selected.responseBody} />\n </div>\n </SheetPanel>\n </>\n ) : null}\n </SheetContent>\n </Sheet>\n </div>\n );\n}"
|
|
10320
10506
|
},
|
|
10321
10507
|
{
|
|
10322
10508
|
"name": "data-grid/basic",
|
|
10323
|
-
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport {\n DataGrid,\n DataGridColumnHeader,\n DataGridPagination,\n DataGridRowSelect,\n DataGridRowSelectAll,\n} from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n type RowSelectionState,\n type SortingState,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Payment {\n id: string;\n customer: string;\n method: string;\n status: \"Succeeded\" | \"Failed\";\n amount: number;\n}\n\nconst METHODS = [\"Card\", \"UPI\", \"Apple Pay\", \"Google Pay\"] as const;\n\nconst payments: Payment[] = Array.from({ length: 23 }, (_, i) => ({\n id: `pay_${(48213 + i * 37).toString(36)}`,\n customer: `customer${i + 1}@example.com`,\n method: METHODS[i % METHODS.length] ?? \"Card\",\n status: i % 5 === 3 ? \"Failed\" : \"Succeeded\",\n amount: ((i * 7919) % 500) + 20,\n}));\n\nconst currency = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n\nconst columns: ColumnDef<Payment>[] = [\n {\n id: \"select\",\n header: ({ table }) => <DataGridRowSelectAll table={table} />,\n cell: ({ row }) => <DataGridRowSelect row={row} />,\n enableSorting: false,\n enableHiding: false,\n size: 48,\n },\n {\n accessorKey: \"id\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Payment ID\" />,\n meta: { headerTitle: \"Payment ID\", cellClassName: \"font-mono\" },\n },\n {\n accessorKey: \"customer\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Customer\" />,\n meta: { headerTitle: \"Customer\" },\n },\n { accessorKey: \"method\", header: \"Method\", enableSorting: false },\n {\n accessorKey: \"status\",\n header: \"Status\",\n enableSorting: false,\n cell: ({ getValue }) => {\n const status = getValue<Payment[\"status\"]>();\n return <Badge variant={status === \"Succeeded\" ? \"green\" : \"red\"}>{status}</Badge>;\n },\n },\n {\n accessorKey: \"amount\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Amount\" />,\n cell: ({ getValue }) => currency.format(getValue<number>()),\n meta: { headerTitle: \"Amount\", cellClassName: \"tabular-nums\" },\n },\n];\n\nexport default function DataGridBasic() {\n const [sorting, setSorting] = useState<SortingState>([]);\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: payments,\n columns,\n state: { sorting, rowSelection },\n onSortingChange: setSorting,\n onRowSelectionChange: setRowSelection,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 5 } },\n });\n const selected = Object.keys(rowSelection).length;\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <div className=\"flex items-center justify-between gap-2\">\n <p className=\"text-muted-foreground text-body-primary\">{selected} selected</p>\n </div>\n <DataGrid table={table}
|
|
10509
|
+
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport {\n DataGrid,\n DataGridColumnHeader,\n DataGridPagination,\n DataGridRowSelect,\n DataGridRowSelectAll,\n} from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getPaginationRowModel,\n getSortedRowModel,\n type RowSelectionState,\n type SortingState,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Payment {\n id: string;\n customer: string;\n method: string;\n status: \"Succeeded\" | \"Failed\";\n amount: number;\n}\n\nconst METHODS = [\"Card\", \"UPI\", \"Apple Pay\", \"Google Pay\"] as const;\n\nconst payments: Payment[] = Array.from({ length: 23 }, (_, i) => ({\n id: `pay_${(48213 + i * 37).toString(36)}`,\n customer: `customer${i + 1}@example.com`,\n method: METHODS[i % METHODS.length] ?? \"Card\",\n status: i % 5 === 3 ? \"Failed\" : \"Succeeded\",\n amount: ((i * 7919) % 500) + 20,\n}));\n\nconst currency = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n\nconst columns: ColumnDef<Payment>[] = [\n {\n id: \"select\",\n header: ({ table }) => <DataGridRowSelectAll table={table} />,\n cell: ({ row }) => <DataGridRowSelect row={row} />,\n enableSorting: false,\n enableHiding: false,\n size: 48,\n },\n {\n accessorKey: \"id\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Payment ID\" />,\n meta: { headerTitle: \"Payment ID\", cellClassName: \"font-mono\" },\n },\n {\n accessorKey: \"customer\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Customer\" />,\n meta: { headerTitle: \"Customer\" },\n },\n { accessorKey: \"method\", header: \"Method\", enableSorting: false },\n {\n accessorKey: \"status\",\n header: \"Status\",\n enableSorting: false,\n cell: ({ getValue }) => {\n const status = getValue<Payment[\"status\"]>();\n return <Badge variant={status === \"Succeeded\" ? \"green\" : \"red\"}>{status}</Badge>;\n },\n },\n {\n accessorKey: \"amount\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Amount\" />,\n cell: ({ getValue }) => currency.format(getValue<number>()),\n meta: { headerTitle: \"Amount\", cellClassName: \"tabular-nums\" },\n },\n];\n\nexport default function DataGridBasic() {\n const [sorting, setSorting] = useState<SortingState>([]);\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: payments,\n columns,\n state: { sorting, rowSelection },\n onSortingChange: setSorting,\n onRowSelectionChange: setRowSelection,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 5 } },\n });\n const selected = Object.keys(rowSelection).length;\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <div className=\"flex items-center justify-between gap-2\">\n <p className=\"text-muted-foreground text-body-primary\">{selected} selected</p>\n </div>\n <DataGrid table={table} aria-label=\"Payments\" />\n <DataGridPagination table={table} />\n </div>\n );\n}"
|
|
10324
10510
|
},
|
|
10325
10511
|
{
|
|
10326
10512
|
"name": "data-grid/bulk-actions",
|
|
10327
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n DataGrid,\n DataGridPagination,\n DataGridRowSelect,\n DataGridRowSelectAll,\n} from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getPaginationRowModel,\n type RowSelectionState,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Payout {\n id: string;\n destination: string;\n amount: number;\n}\n\nconst payouts: Payout[] = Array.from({ length: 18 }, (_, i) => ({\n id: `po_${(73112 + i * 211).toString(36)}`,\n destination: [\"HDFC •••• 4821\", \"Chase •••• 1194\", \"Wise •••• 7730\"][i % 3] ?? \"HDFC •••• 4821\",\n amount: ((i * 3571) % 900_000) + 25_000,\n}));\n\nconst currency = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n\nconst columns: ColumnDef<Payout>[] = [\n {\n id: \"select\",\n header: ({ table }) => <DataGridRowSelectAll table={table} />,\n cell: ({ row }) => <DataGridRowSelect row={row} />,\n size: 48,\n },\n { accessorKey: \"id\", header: \"Payout ID\", meta: { cellClassName: \"font-mono\" } },\n { accessorKey: \"destination\", header: \"Destination\" },\n {\n accessorKey: \"amount\",\n header: \"Amount\",\n cell: ({ getValue }) => currency.format(getValue<number>() / 100),\n meta: { cellClassName: \"tabular-nums\" },\n },\n];\n\nexport default function DataGridBulkActions() {\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n const [held, setHeld] = useState<string[]>([]);\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: payouts,\n columns,\n state: { rowSelection },\n onRowSelectionChange: setRowSelection,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 5 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <DataGrid\n table={table}\n
|
|
10513
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n DataGrid,\n DataGridPagination,\n DataGridRowSelect,\n DataGridRowSelectAll,\n} from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getPaginationRowModel,\n type RowSelectionState,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Payout {\n id: string;\n destination: string;\n amount: number;\n}\n\nconst payouts: Payout[] = Array.from({ length: 18 }, (_, i) => ({\n id: `po_${(73112 + i * 211).toString(36)}`,\n destination: [\"HDFC •••• 4821\", \"Chase •••• 1194\", \"Wise •••• 7730\"][i % 3] ?? \"HDFC •••• 4821\",\n amount: ((i * 3571) % 900_000) + 25_000,\n}));\n\nconst currency = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\n\nconst columns: ColumnDef<Payout>[] = [\n {\n id: \"select\",\n header: ({ table }) => <DataGridRowSelectAll table={table} />,\n cell: ({ row }) => <DataGridRowSelect row={row} />,\n size: 48,\n },\n { accessorKey: \"id\", header: \"Payout ID\", meta: { cellClassName: \"font-mono\" } },\n { accessorKey: \"destination\", header: \"Destination\" },\n {\n accessorKey: \"amount\",\n header: \"Amount\",\n cell: ({ getValue }) => currency.format(getValue<number>() / 100),\n meta: { cellClassName: \"tabular-nums\" },\n },\n];\n\nexport default function DataGridBulkActions() {\n const [rowSelection, setRowSelection] = useState<RowSelectionState>({});\n const [held, setHeld] = useState<string[]>([]);\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: payouts,\n columns,\n state: { rowSelection },\n onRowSelectionChange: setRowSelection,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 5 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <DataGrid\n table={table}\n aria-label=\"Payouts\"\n bulkActions={(selection) => (\n <Button\n variant=\"secondary\"\n onClick={() => {\n setHeld(selection.rows.map((row) => row.id));\n selection.clear();\n }}\n >\n Hold payouts\n </Button>\n )}\n />\n <DataGridPagination table={table} />\n <p className=\"text-body-primary text-muted-foreground\" aria-live=\"polite\">\n {held.length > 0 ? `Held ${held.length} payouts.` : \"Select payouts to hold them.\"}\n </p>\n </div>\n );\n}"
|
|
10328
10514
|
},
|
|
10329
10515
|
{
|
|
10330
10516
|
"name": "data-grid/invoices",
|
|
10331
|
-
"code": "\"use client\";\n\nimport { Button, buttonVariants } from \"@dodopayments/ui/button\";\nimport { DataGrid, DataGridCellActions } from \"@dodopayments/ui/data-grid\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { DownloadIcon, ReceiptIcon } from \"@dodopayments/ui/icons\";\nimport { Money } from \"@dodopayments/ui/money\";\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface Invoice {\n id: string;\n /** Invoice number the customer sees. */\n number: string;\n issuedAt: string;\n /** Total in minor units of `currency`. */\n amountMinor: number;\n currency: string;\n /** Raw status of the invoice's payment (a status `Badge`, `kind=\"invoice\"`). */\n status: string;\n pdfUrl?: string;\n}\n\nconst INVOICES: Invoice[] = [\n {\n id: \"inv_oct\",\n number: \"INV-2026-0042\",\n issuedAt: \"2026-10-01T09:30:00Z\",\n amountMinor: 10998,\n currency: \"USD\",\n status: \"succeeded\",\n pdfUrl: \"https://example.com/invoices/INV-2026-0042.pdf\",\n },\n {\n id: \"inv_sep\",\n number: \"INV-2026-0041\",\n issuedAt: \"2026-09-01T09:30:00Z\",\n amountMinor: 9322,\n currency: \"USD\",\n status: \"succeeded\",\n pdfUrl: \"https://example.com/invoices/INV-2026-0041.pdf\",\n },\n {\n id: \"inv_aug\",\n number: \"INV-2026-0040\",\n issuedAt: \"2026-08-01T09:30:00Z\",\n amountMinor: 7900,\n currency: \"USD\",\n status: \"failed\",\n },\n];\n\nexport default function DataGridInvoices() {\n const [opened, setOpened] = React.useState<Invoice | null>(null);\n\n const columns: ColumnDef<Invoice>[] = [\n {\n accessorKey: \"number\",\n header: \"Invoice\",\n cell: ({ row }) => (\n <Button variant=\"link\" className=\"h-auto p-0\" onClick={() => setOpened(row.original)}>\n {row.original.number}\n </Button>\n ),\n
|
|
10517
|
+
"code": "\"use client\";\n\nimport { Button, buttonVariants } from \"@dodopayments/ui/button\";\nimport { DataGrid, DataGridCellActions } from \"@dodopayments/ui/data-grid\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { DownloadIcon, ReceiptIcon } from \"@dodopayments/ui/icons\";\nimport { Money } from \"@dodopayments/ui/money\";\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface Invoice {\n id: string;\n /** Invoice number the customer sees. */\n number: string;\n issuedAt: string;\n /** Total in minor units of `currency`. */\n amountMinor: number;\n currency: string;\n /** Raw status of the invoice's payment (a status `Badge`, `kind=\"invoice\"`). */\n status: string;\n pdfUrl?: string;\n}\n\nconst INVOICES: Invoice[] = [\n {\n id: \"inv_oct\",\n number: \"INV-2026-0042\",\n issuedAt: \"2026-10-01T09:30:00Z\",\n amountMinor: 10998,\n currency: \"USD\",\n status: \"succeeded\",\n pdfUrl: \"https://example.com/invoices/INV-2026-0042.pdf\",\n },\n {\n id: \"inv_sep\",\n number: \"INV-2026-0041\",\n issuedAt: \"2026-09-01T09:30:00Z\",\n amountMinor: 9322,\n currency: \"USD\",\n status: \"succeeded\",\n pdfUrl: \"https://example.com/invoices/INV-2026-0041.pdf\",\n },\n {\n id: \"inv_aug\",\n number: \"INV-2026-0040\",\n issuedAt: \"2026-08-01T09:30:00Z\",\n amountMinor: 7900,\n currency: \"USD\",\n status: \"failed\",\n },\n];\n\nexport default function DataGridInvoices() {\n const [opened, setOpened] = React.useState<Invoice | null>(null);\n\n const columns: ColumnDef<Invoice>[] = [\n {\n accessorKey: \"number\",\n header: \"Invoice\",\n cell: ({ row }) => (\n <Button variant=\"link\" className=\"h-auto p-0\" onClick={() => setOpened(row.original)}>\n {row.original.number}\n </Button>\n ),\n },\n {\n accessorKey: \"issuedAt\",\n header: \"Date\",\n cell: ({ row }) => <Timestamp value={row.original.issuedAt} format=\"date\" />,\n },\n {\n accessorKey: \"amountMinor\",\n header: \"Amount\",\n cell: ({ row }) => (\n <Money minor={row.original.amountMinor} currency={row.original.currency} locale=\"en-US\" />\n ),\n },\n {\n accessorKey: \"status\",\n header: \"Status\",\n cell: ({ row }) => <Badge kind=\"invoice\" status={row.original.status} />,\n },\n {\n id: \"download\",\n header: () => <span className=\"sr-only\">Download</span>,\n cell: ({ row }) =>\n row.original.pdfUrl ? (\n <DataGridCellActions>\n <a\n href={row.original.pdfUrl}\n download\n target=\"_blank\"\n rel=\"noopener noreferrer\"\n aria-label={`Download invoice ${row.original.number}`}\n className={buttonVariants({ variant: \"ghost\", size: \"icon\" })}\n >\n <DownloadIcon aria-hidden=\"true\" />\n </a>\n </DataGridCellActions>\n ) : null,\n },\n ];\n\n const table = useReactTable({\n data: INVOICES,\n columns,\n getCoreRowModel: getCoreRowModel(),\n getRowId: (row) => row.id,\n });\n\n return (\n <div className=\"flex w-full flex-col gap-3\">\n <DataGrid\n table={table}\n aria-label=\"Invoices\"\n emptyMessage={\n <Empty\n icon={<ReceiptIcon />}\n title=\"No invoices yet\"\n description=\"Invoices show up here after the first payment.\"\n titleAs=\"h3\"\n />\n }\n />\n <p aria-live=\"polite\" className=\"text-body-secondary text-muted-foreground\">\n {opened ? `Selected ${opened.number}` : \"Select an invoice number to open its details.\"}\n </p>\n </div>\n );\n}"
|
|
10332
10518
|
},
|
|
10333
10519
|
{
|
|
10334
10520
|
"name": "data-grid/license-keys",
|
|
10335
|
-
"code": "\"use client\";\n\nimport { ConfirmDialog } from \"@dodopayments/ui/dialog\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { CopyButton } from \"@dodopayments/ui/copy-button\";\nimport { DataGrid, DataGridCellActions, DataGridCellPrimary } from \"@dodopayments/ui/data-grid\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogPanel,\n DialogTitle,\n} from \"@dodopayments/ui/dialog\";\nimport { DotsIcon, KeyIcon } from \"@dodopayments/ui/icons\";\nimport { Menu, MenuContent, MenuItem, MenuTrigger } from \"@dodopayments/ui/menu\";\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface Device {\n id: string;\n name: string;\n activatedAt: string;\n}\n\ninterface License {\n id: string;\n /** The raw key: only copied, never written into the page. */\n key: string;\n status: \"active\" | \"disabled\" | \"expired\";\n activationsUsed: number;\n activationLimit: number;\n /** Omit for a perpetual license. */\n expiresAt?: string;\n devices: Device[];\n}\n\nconst INITIAL: License[] = [\n {\n id: \"lic_8Hq2\",\n key: \"DODO-7F3K-9QWE-2LMN\",\n status: \"active\",\n activationsUsed: 2,\n activationLimit: 3,\n expiresAt: \"2027-03-01T00:00:00Z\",\n devices: [\n { id: \"ins_1\", name: \"MacBook Pro (Ayesha)\", activatedAt: \"2026-04-02T09:00:00Z\" },\n { id: \"ins_2\", name: \"Studio workstation\", activatedAt: \"2026-06-18T14:30:00Z\" },\n ],\n },\n {\n id: \"lic_3Zp9\",\n key: \"DODO-1A2B-3C4D-5E6F\",\n status: \"disabled\",\n activationsUsed: 0,\n activationLimit: 1,\n devices: [],\n },\n {\n id: \"lic_0Xy1\",\n key: \"DODO-0000-1111-2222\",\n status: \"expired\",\n activationsUsed: 1,\n activationLimit: 1,\n expiresAt: \"2026-01-01T00:00:00Z\",\n devices: [{ id: \"ins_3\", name: \"Old laptop\", activatedAt: \"2025-01-05T10:00:00Z\" }],\n },\n];\n\n/** Stands in for your API: refresh the rows from its answer instead of patching them optimistically. */\nconst wait = () => new Promise((resolve) => setTimeout(resolve, 600));\n\nexport default function DataGridLicenseKeys() {\n const [licenses, setLicenses] = React.useState(INITIAL);\n const [devicesOf, setDevicesOf] = React.useState<License | null>(null);\n const [resetting, setResetting] = React.useState<License | null>(null);\n\n const update = (id: string, change: Partial<License>) =>\n setLicenses((all) => all.map((item) => (item.id === id ? { ...item, ...change } : item)));\n\n const columns: ColumnDef<License>[] = [\n {\n accessorKey: \"id\",\n header: \"License key\",\n cell: ({ row }) => (\n <div className=\"flex items-center gap-2\">\n <DataGridCellPrimary title=\"•••• •••• ••••\" subtitle={row.original.id} />\n <CopyButton\n variant=\"ghost\"\n size=\"sm\"\n content={row.original.key}\n sensitive\n label={`Copy license key ${row.original.id}`}\n />\n </div>\n ),\n
|
|
10521
|
+
"code": "\"use client\";\n\nimport { ConfirmDialog } from \"@dodopayments/ui/dialog\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { CopyButton } from \"@dodopayments/ui/copy-button\";\nimport { DataGrid, DataGridCellActions, DataGridCellPrimary } from \"@dodopayments/ui/data-grid\";\nimport {\n Dialog,\n DialogContent,\n DialogHeader,\n DialogPanel,\n DialogTitle,\n} from \"@dodopayments/ui/dialog\";\nimport { DotsIcon, KeyIcon } from \"@dodopayments/ui/icons\";\nimport { Menu, MenuContent, MenuItem, MenuTrigger } from \"@dodopayments/ui/menu\";\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport * as React from \"react\";\n\ninterface Device {\n id: string;\n name: string;\n activatedAt: string;\n}\n\ninterface License {\n id: string;\n /** The raw key: only copied, never written into the page. */\n key: string;\n status: \"active\" | \"disabled\" | \"expired\";\n activationsUsed: number;\n activationLimit: number;\n /** Omit for a perpetual license. */\n expiresAt?: string;\n devices: Device[];\n}\n\nconst INITIAL: License[] = [\n {\n id: \"lic_8Hq2\",\n key: \"DODO-7F3K-9QWE-2LMN\",\n status: \"active\",\n activationsUsed: 2,\n activationLimit: 3,\n expiresAt: \"2027-03-01T00:00:00Z\",\n devices: [\n { id: \"ins_1\", name: \"MacBook Pro (Ayesha)\", activatedAt: \"2026-04-02T09:00:00Z\" },\n { id: \"ins_2\", name: \"Studio workstation\", activatedAt: \"2026-06-18T14:30:00Z\" },\n ],\n },\n {\n id: \"lic_3Zp9\",\n key: \"DODO-1A2B-3C4D-5E6F\",\n status: \"disabled\",\n activationsUsed: 0,\n activationLimit: 1,\n devices: [],\n },\n {\n id: \"lic_0Xy1\",\n key: \"DODO-0000-1111-2222\",\n status: \"expired\",\n activationsUsed: 1,\n activationLimit: 1,\n expiresAt: \"2026-01-01T00:00:00Z\",\n devices: [{ id: \"ins_3\", name: \"Old laptop\", activatedAt: \"2025-01-05T10:00:00Z\" }],\n },\n];\n\n/** Stands in for your API: refresh the rows from its answer instead of patching them optimistically. */\nconst wait = () => new Promise((resolve) => setTimeout(resolve, 600));\n\nexport default function DataGridLicenseKeys() {\n const [licenses, setLicenses] = React.useState(INITIAL);\n const [devicesOf, setDevicesOf] = React.useState<License | null>(null);\n const [resetting, setResetting] = React.useState<License | null>(null);\n\n const update = (id: string, change: Partial<License>) =>\n setLicenses((all) => all.map((item) => (item.id === id ? { ...item, ...change } : item)));\n\n const columns: ColumnDef<License>[] = [\n {\n accessorKey: \"id\",\n header: \"License key\",\n cell: ({ row }) => (\n <div className=\"flex items-center gap-2\">\n <DataGridCellPrimary title=\"•••• •••• ••••\" subtitle={row.original.id} />\n <CopyButton\n variant=\"ghost\"\n size=\"sm\"\n content={row.original.key}\n sensitive\n label={`Copy license key ${row.original.id}`}\n />\n </div>\n ),\n },\n {\n accessorKey: \"status\",\n header: \"Status\",\n cell: ({ row }) => <Badge kind=\"license\" status={row.original.status} />,\n },\n {\n id: \"activations\",\n header: \"Activations\",\n cell: ({ row }) => {\n const { activationsUsed: used, activationLimit: limit } = row.original;\n return (\n <span className=\"text-body-primary tabular-nums\">\n {used} / {limit}\n </span>\n );\n },\n },\n {\n accessorKey: \"expiresAt\",\n header: \"Expires\",\n cell: ({ row }) =>\n row.original.expiresAt ? (\n <Timestamp value={row.original.expiresAt} format=\"date\" />\n ) : (\n <span className=\"text-muted-foreground\">Never</span>\n ),\n },\n {\n id: \"actions\",\n header: () => <span className=\"sr-only\">Actions</span>,\n cell: ({ row }) => {\n const license = row.original;\n return (\n <DataGridCellActions>\n <Menu>\n <MenuTrigger\n render={\n <Button variant=\"ghost\" size=\"icon\" aria-label={`Actions for ${license.id}`} />\n }\n >\n <DotsIcon aria-hidden=\"true\" />\n </MenuTrigger>\n <MenuContent align=\"end\">\n <MenuItem onClick={() => setDevicesOf(license)}>View devices</MenuItem>\n {license.status === \"expired\" ? null : (\n <MenuItem\n onClick={() => {\n const status = license.status === \"active\" ? \"disabled\" : \"active\";\n void wait().then(() => update(license.id, { status }));\n }}\n >\n {license.status === \"active\" ? \"Disable key\" : \"Enable key\"}\n </MenuItem>\n )}\n <MenuItem variant=\"destructive\" onClick={() => setResetting(license)}>\n Reset activations\n </MenuItem>\n </MenuContent>\n </Menu>\n </DataGridCellActions>\n );\n },\n },\n ];\n\n const table = useReactTable({\n data: licenses,\n columns,\n getCoreRowModel: getCoreRowModel(),\n getRowId: (row) => row.id,\n });\n\n return (\n <>\n <DataGrid\n table={table}\n aria-label=\"License keys\"\n emptyMessage={\n <Empty\n icon={<KeyIcon />}\n title=\"No license keys yet\"\n description=\"Keys show up here after a customer buys a licensed product.\"\n titleAs=\"h3\"\n />\n }\n />\n <Dialog open={devicesOf !== null} onOpenChange={(open) => !open && setDevicesOf(null)}>\n <DialogContent>\n <DialogHeader>\n <DialogTitle>Devices of {devicesOf?.id}</DialogTitle>\n </DialogHeader>\n <DialogPanel>\n {devicesOf?.devices.length ? (\n <ul className=\"flex flex-col gap-3\">\n {devicesOf.devices.map((device) => (\n <li key={device.id} className=\"flex items-center justify-between gap-4\">\n <span className=\"text-body-primary text-foreground\">{device.name}</span>\n <span className=\"text-body-secondary text-muted-foreground\">\n Activated <Timestamp value={device.activatedAt} format=\"date\" />\n </span>\n </li>\n ))}\n </ul>\n ) : (\n <p className=\"text-body-primary text-muted-foreground\">\n No devices hold an activation.\n </p>\n )}\n </DialogPanel>\n </DialogContent>\n </Dialog>\n <ConfirmDialog\n open={resetting !== null}\n onOpenChange={(open) => !open && setResetting(null)}\n destructive\n title=\"Reset activations?\"\n description={`Every device that uses ${resetting?.id ?? \"this key\"} has to activate it again.`}\n confirmLabel=\"Reset activations\"\n onConfirm={async () => {\n if (!resetting) return;\n await wait();\n update(resetting.id, { activationsUsed: 0, devices: [] });\n }}\n />\n </>\n );\n}"
|
|
10336
10522
|
},
|
|
10337
10523
|
{
|
|
10338
10524
|
"name": "data-grid/list-page",
|
|
@@ -10340,15 +10526,15 @@
|
|
|
10340
10526
|
},
|
|
10341
10527
|
{
|
|
10342
10528
|
"name": "data-grid/loading-empty",
|
|
10343
|
-
"code": "\"use client\";\n\nimport { DataGrid, DataGridColumnHeader } from \"@dodopayments/ui/data-grid\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { ReceiptIcon } from \"@dodopayments/ui/icons\";\nimport { SegmentedControl } from \"@dodopayments/ui/segmented-control\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Payout {\n id: string;\n date: string;\n amount: string;\n}\n\nconst columns: ColumnDef<Payout>[] = [\n {\n accessorKey: \"id\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Payout ID\" />,\n enableSorting: false,\n meta: { cellClassName: \"font-mono\" },\n },\n { accessorKey: \"date\", header: \"Date\" },\n { accessorKey: \"amount\", header: \"Amount\", meta: { cellClassName: \"tabular-nums\" } },\n];\n\ntype Mode = \"loading\" | \"empty\";\n\n// One array for every render: a new `[]` each time would make TanStack reset the page on every render.\nconst NO_PAYOUTS: Payout[] = [];\n\nexport default function DataGridLoadingEmpty() {\n const [mode, setMode] = useState<Mode>(\"loading\");\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: NO_PAYOUTS,\n columns,\n getCoreRowModel: getCoreRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 4 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <SegmentedControl\n aria-label=\"Table state\"\n className=\"self-start\"\n value={mode}\n onValueChange={(value) => setMode(value as Mode)}\n items={[\n { value: \"loading\", label: \"Loading\" },\n { value: \"empty\", label: \"Empty\" },\n ]}\n />\n <DataGrid\n table={table}\n
|
|
10529
|
+
"code": "\"use client\";\n\nimport { DataGrid, DataGridColumnHeader } from \"@dodopayments/ui/data-grid\";\nimport { Empty } from \"@dodopayments/ui/empty\";\nimport { ReceiptIcon } from \"@dodopayments/ui/icons\";\nimport { SegmentedControl } from \"@dodopayments/ui/segmented-control\";\nimport { type ColumnDef, getCoreRowModel, useReactTable } from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Payout {\n id: string;\n date: string;\n amount: string;\n}\n\nconst columns: ColumnDef<Payout>[] = [\n {\n accessorKey: \"id\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Payout ID\" />,\n enableSorting: false,\n meta: { cellClassName: \"font-mono\" },\n },\n { accessorKey: \"date\", header: \"Date\" },\n { accessorKey: \"amount\", header: \"Amount\", meta: { cellClassName: \"tabular-nums\" } },\n];\n\ntype Mode = \"loading\" | \"empty\";\n\n// One array for every render: a new `[]` each time would make TanStack reset the page on every render.\nconst NO_PAYOUTS: Payout[] = [];\n\nexport default function DataGridLoadingEmpty() {\n const [mode, setMode] = useState<Mode>(\"loading\");\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: NO_PAYOUTS,\n columns,\n getCoreRowModel: getCoreRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 4 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <SegmentedControl\n aria-label=\"Table state\"\n className=\"self-start\"\n value={mode}\n onValueChange={(value) => setMode(value as Mode)}\n items={[\n { value: \"loading\", label: \"Loading\" },\n { value: \"empty\", label: \"Empty\" },\n ]}\n />\n <DataGrid\n table={table}\n aria-label=\"Payouts\"\n isLoading={mode === \"loading\"}\n emptyMessage={\n <Empty\n className=\"py-10\"\n icon={<ReceiptIcon />}\n title=\"No payouts yet\"\n description=\"Payouts appear here once your balance is settled.\"\n />\n }\n />\n </div>\n );\n}"
|
|
10344
10530
|
},
|
|
10345
10531
|
{
|
|
10346
10532
|
"name": "data-grid/row-hover",
|
|
10347
|
-
"code": "\"use client\";\n\nimport { DataGrid, DataGridPagination } from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getPaginationRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\n\ninterface Customer {\n id: string;\n name: string;\n email: string;\n}\n\nconst customers: Customer[] = Array.from({ length: 14 }, (_, i) => ({\n id: `cus_${(9100 + i * 13).toString(36)}`,\n name: `Customer ${i + 1}`,\n email: `customer${i + 1}@example.com`,\n}));\n\nconst columns: ColumnDef<Customer>[] = [\n { accessorKey: \"name\", header: \"Name\" },\n { accessorKey: \"email\", header: \"Email\" },\n { accessorKey: \"id\", header: \"Customer ID\", meta: { cellClassName: \"font-mono\" } },\n];\n\nexport default function DataGridRowHover() {\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: customers,\n columns,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 5 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <DataGrid table={table}
|
|
10533
|
+
"code": "\"use client\";\n\nimport { DataGrid, DataGridPagination } from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getPaginationRowModel,\n useReactTable,\n} from \"@tanstack/react-table\";\n\ninterface Customer {\n id: string;\n name: string;\n email: string;\n}\n\nconst customers: Customer[] = Array.from({ length: 14 }, (_, i) => ({\n id: `cus_${(9100 + i * 13).toString(36)}`,\n name: `Customer ${i + 1}`,\n email: `customer${i + 1}@example.com`,\n}));\n\nconst columns: ColumnDef<Customer>[] = [\n { accessorKey: \"name\", header: \"Name\" },\n { accessorKey: \"email\", header: \"Email\" },\n { accessorKey: \"id\", header: \"Customer ID\", meta: { cellClassName: \"font-mono\" } },\n];\n\nexport default function DataGridRowHover() {\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: customers,\n columns,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getPaginationRowModel: getPaginationRowModel(),\n initialState: { pagination: { pageIndex: 0, pageSize: 5 } },\n });\n\n return (\n <div className=\"flex w-full min-w-0 flex-col gap-2.5\">\n <DataGrid table={table} aria-label=\"Customers\" />\n <DataGridPagination table={table} showRowsPerPage={false} />\n </div>\n );\n}"
|
|
10348
10534
|
},
|
|
10349
10535
|
{
|
|
10350
10536
|
"name": "data-grid/sort-motion",
|
|
10351
|
-
"code": "\"use client\";\n\nimport { DataGrid, DataGridColumnHeader } from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getSortedRowModel,\n type SortingState,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Plan {\n id: string;\n name: string;\n subscribers: number;\n mrr: number;\n}\n\nconst plans: Plan[] = [\n { id: \"starter\", name: \"Starter\", subscribers: 1284, mrr: 11556 },\n { id: \"growth\", name: \"Growth\", subscribers: 642, mrr: 18618 },\n { id: \"scale\", name: \"Scale\", subscribers: 87, mrr: 25926 },\n { id: \"team\", name: \"Team\", subscribers: 311, mrr: 15239 },\n { id: \"enterprise\", name: \"Enterprise\", subscribers: 14, mrr: 41986 },\n { id: \"hobby\", name: \"Hobby\", subscribers: 2210, mrr: 8840 },\n];\n\nconst currency = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nconst columns: ColumnDef<Plan>[] = [\n {\n accessorKey: \"name\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Plan\" />,\n meta: { headerTitle: \"Plan\", cellClassName: \"font-medium\" },\n },\n {\n accessorKey: \"subscribers\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Subscribers\" />,\n cell: ({ getValue }) => getValue<number>().toLocaleString(\"en-US\"),\n meta: { headerTitle: \"Subscribers\", cellClassName: \"tabular-nums\" },\n },\n {\n accessorKey: \"mrr\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"MRR\" />,\n cell: ({ getValue }) => currency.format(getValue<number>()),\n meta: { headerTitle: \"MRR\", cellClassName: \"tabular-nums\" },\n },\n];\n\nexport default function DataGridSortMotion() {\n const [sorting, setSorting] = useState<SortingState>([]);\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: plans,\n columns,\n state: { sorting },\n onSortingChange: setSorting,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n });\n\n return <DataGrid table={table}
|
|
10537
|
+
"code": "\"use client\";\n\nimport { DataGrid, DataGridColumnHeader } from \"@dodopayments/ui/data-grid\";\nimport {\n type ColumnDef,\n getCoreRowModel,\n getSortedRowModel,\n type SortingState,\n useReactTable,\n} from \"@tanstack/react-table\";\nimport { useState } from \"react\";\n\ninterface Plan {\n id: string;\n name: string;\n subscribers: number;\n mrr: number;\n}\n\nconst plans: Plan[] = [\n { id: \"starter\", name: \"Starter\", subscribers: 1284, mrr: 11556 },\n { id: \"growth\", name: \"Growth\", subscribers: 642, mrr: 18618 },\n { id: \"scale\", name: \"Scale\", subscribers: 87, mrr: 25926 },\n { id: \"team\", name: \"Team\", subscribers: 311, mrr: 15239 },\n { id: \"enterprise\", name: \"Enterprise\", subscribers: 14, mrr: 41986 },\n { id: \"hobby\", name: \"Hobby\", subscribers: 2210, mrr: 8840 },\n];\n\nconst currency = new Intl.NumberFormat(\"en-US\", {\n style: \"currency\",\n currency: \"USD\",\n maximumFractionDigits: 0,\n});\n\nconst columns: ColumnDef<Plan>[] = [\n {\n accessorKey: \"name\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Plan\" />,\n meta: { headerTitle: \"Plan\", cellClassName: \"font-medium\" },\n },\n {\n accessorKey: \"subscribers\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"Subscribers\" />,\n cell: ({ getValue }) => getValue<number>().toLocaleString(\"en-US\"),\n meta: { headerTitle: \"Subscribers\", cellClassName: \"tabular-nums\" },\n },\n {\n accessorKey: \"mrr\",\n header: ({ column }) => <DataGridColumnHeader column={column} title=\"MRR\" />,\n cell: ({ getValue }) => currency.format(getValue<number>()),\n meta: { headerTitle: \"MRR\", cellClassName: \"tabular-nums\" },\n },\n];\n\nexport default function DataGridSortMotion() {\n const [sorting, setSorting] = useState<SortingState>([]);\n // eslint-disable-next-line react-hooks/incompatible-library -- TanStack Table returns a mutable instance by design.\n const table = useReactTable({\n data: plans,\n columns,\n state: { sorting },\n onSortingChange: setSorting,\n getRowId: (row) => row.id,\n getCoreRowModel: getCoreRowModel(),\n getSortedRowModel: getSortedRowModel(),\n });\n\n return <DataGrid table={table} aria-label=\"Plans\" className=\"w-full max-w-lg\" />;\n}"
|
|
10352
10538
|
}
|
|
10353
10539
|
],
|
|
10354
10540
|
"docsUrl": "/components/data-table"
|
|
@@ -16159,16 +16345,19 @@
|
|
|
16159
16345
|
"title": "Quantity stepper",
|
|
16160
16346
|
"category": "Forms",
|
|
16161
16347
|
"status": "stable",
|
|
16162
|
-
"description": "A whole number between − and + buttons for picking how many of something (Figma: Quantity stepper).\
|
|
16348
|
+
"description": "A whole number between − and + buttons for picking how many of something (Figma: Quantity stepper).\nTwo sizes: `default` 24 high like Button xs (28 below `sm`), and `lg` the height of Button lg (36, 40 below `sm`,\nshorter in compact density) for a row with a lg button. The value hugs its digits, and at 0 it shows 0.\nBuilt on the Base UI `NumberField` parts: the value is a number input (`aria-roledescription`\n\"Number field\") and the single tab stop. ArrowUp / ArrowDown step by `step`, Home / End jump to\n`min` / `max`, and the − / + buttons disable at the bounds. `onValueChange` reports `null` while the\nvalue is cleared. `id` lands on the value, so a `<label htmlFor>` names it; otherwise pass `aria-label`.\n\nA press on − / + (or the mouse wheel with `allowWheelScrub`) spins the digits with NumberFlow over\n`duration-slow`; holding a button repeats without spinning. While the user edits the value, the plain\ninput shows instead, so typing and arrow-key steps never animate. The animated copy is `aria-hidden`.",
|
|
16163
16349
|
"importPath": "@dodopayments/ui/quantity-stepper",
|
|
16164
16350
|
"exports": [
|
|
16351
|
+
"DODO_QUANTITY_STEPPER_DEFAULT_VARIANTS",
|
|
16352
|
+
"DODO_QUANTITY_STEPPER_VARIANTS",
|
|
16165
16353
|
"QuantityStepper",
|
|
16166
|
-
"QuantityStepperProps"
|
|
16354
|
+
"QuantityStepperProps",
|
|
16355
|
+
"quantityStepperVariants"
|
|
16167
16356
|
],
|
|
16168
16357
|
"parts": [
|
|
16169
16358
|
{
|
|
16170
16359
|
"name": "QuantityStepper",
|
|
16171
|
-
"description": "A whole number between − and + buttons for picking how many of something (Figma: Quantity stepper).\
|
|
16360
|
+
"description": "A whole number between − and + buttons for picking how many of something (Figma: Quantity stepper).\nTwo sizes: `default` 24 high like Button xs (28 below `sm`), and `lg` the height of Button lg (36, 40 below `sm`,\nshorter in compact density) for a row with a lg button. The value hugs its digits, and at 0 it shows 0.\nBuilt on the Base UI `NumberField` parts: the value is a number input (`aria-roledescription`\n\"Number field\") and the single tab stop. ArrowUp / ArrowDown step by `step`, Home / End jump to\n`min` / `max`, and the − / + buttons disable at the bounds. `onValueChange` reports `null` while the\nvalue is cleared. `id` lands on the value, so a `<label htmlFor>` names it; otherwise pass `aria-label`.\n\nA press on − / + (or the mouse wheel with `allowWheelScrub`) spins the digits with NumberFlow over\n`duration-slow`; holding a button repeats without spinning. While the user edits the value, the plain\ninput shows instead, so typing and arrow-key steps never animate. The animated copy is `aria-hidden`.",
|
|
16172
16361
|
"props": [
|
|
16173
16362
|
{
|
|
16174
16363
|
"name": "aria-describedby",
|
|
@@ -16229,6 +16418,24 @@
|
|
|
16229
16418
|
"description": "Smallest quantity; the − button is disabled at it.",
|
|
16230
16419
|
"source": "dodo"
|
|
16231
16420
|
},
|
|
16421
|
+
{
|
|
16422
|
+
"name": "size",
|
|
16423
|
+
"type": "\"default\" | \"lg\"",
|
|
16424
|
+
"required": false,
|
|
16425
|
+
"description": "",
|
|
16426
|
+
"source": "dodo",
|
|
16427
|
+
"values": [
|
|
16428
|
+
{
|
|
16429
|
+
"value": "default",
|
|
16430
|
+
"description": "24 high (28 below `sm`), like Button xs: buttons 20 (24), value Labels/Secondary. Carts, line items, plan pickers."
|
|
16431
|
+
},
|
|
16432
|
+
{
|
|
16433
|
+
"value": "lg",
|
|
16434
|
+
"description": "The height of Button lg (`--control-height-lg`: 36, 40 below `sm`, less in compact density), with Button icon (`--control-height-md`) − and + 2px inside, Button icon sizes and the value in Labels/Primary. Next to a lg button, such as Buy now on a Product card."
|
|
16435
|
+
}
|
|
16436
|
+
],
|
|
16437
|
+
"default": "\"default\""
|
|
16438
|
+
},
|
|
16232
16439
|
{
|
|
16233
16440
|
"name": "step",
|
|
16234
16441
|
"type": "number",
|
|
@@ -16353,6 +16560,10 @@
|
|
|
16353
16560
|
"name": "quantity-stepper/form",
|
|
16354
16561
|
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { QuantityStepper } from \"@dodopayments/ui/quantity-stepper\";\nimport { useState } from \"react\";\n\n/** With `name`, the stepper submits its value with the form, like any input. */\nexport default function QuantityStepperForm() {\n const [submitted, setSubmitted] = useState<string | null>(null);\n return (\n <form\n className=\"flex flex-col items-start gap-3\"\n onSubmit={(event) => {\n event.preventDefault();\n const licenses = new FormData(event.currentTarget).get(\"licenses\");\n setSubmitted(typeof licenses === \"string\" ? licenses : null);\n }}\n >\n <label htmlFor=\"licenses\" className=\"text-label-primary text-foreground\">\n Licenses\n </label>\n <QuantityStepper id=\"licenses\" name=\"licenses\" defaultValue={1} min={1} max={10} />\n <Button type=\"submit\" variant=\"secondary\">\n Save\n </Button>\n {submitted ? (\n <p className=\"text-body-secondary text-muted-foreground\">Submitted licenses={submitted}</p>\n ) : null}\n </form>\n );\n}"
|
|
16355
16562
|
},
|
|
16563
|
+
{
|
|
16564
|
+
"name": "quantity-stepper/large",
|
|
16565
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { QuantityStepper } from \"@dodopayments/ui/quantity-stepper\";\nimport { useState } from \"react\";\n\nexport default function QuantityStepperLarge() {\n const [quantity, setQuantity] = useState<number | null>(1);\n return (\n <div className=\"flex w-full max-w-72 items-center gap-2\">\n <QuantityStepper\n aria-label=\"Quantity\"\n size=\"lg\"\n value={quantity}\n min={0}\n max={10}\n onValueChange={setQuantity}\n />\n <Button className=\"flex-1\" disabled={quantity === null || quantity < 1}>\n Buy now\n </Button>\n </div>\n );\n}"
|
|
16566
|
+
},
|
|
16356
16567
|
{
|
|
16357
16568
|
"name": "quantity-stepper/master",
|
|
16358
16569
|
"code": "\"use client\";\n\nimport { QuantityStepper } from \"@dodopayments/ui/quantity-stepper\";\nimport { useId, useState } from \"react\";\n\nconst PRICE_PER_SEAT = 10;\n\nexport default function QuantityStepperMaster() {\n const [seats, setSeats] = useState<number | null>(2);\n const labelId = useId();\n const total = (seats ?? 0) * PRICE_PER_SEAT;\n return (\n <div className=\"flex w-full max-w-80 items-center gap-3\">\n <div className=\"flex min-w-0 flex-1 flex-col gap-0.5\">\n <span id={labelId} className=\"text-label-primary text-foreground\">\n Extra seats\n </span>\n <span className=\"text-body-secondary text-muted-foreground\">\n ${total}/mo · ${PRICE_PER_SEAT} per seat\n </span>\n </div>\n <QuantityStepper aria-labelledby={labelId} value={seats} onValueChange={setSeats} max={20} />\n </div>\n );\n}"
|
|
@@ -17200,7 +17411,7 @@
|
|
|
17200
17411
|
},
|
|
17201
17412
|
{
|
|
17202
17413
|
"name": "app-top-bar/master",
|
|
17203
|
-
"code": "\"use client\";\n\nimport { AppTopBar } from \"@dodopayments/ui/app-top-bar\";\nimport { CommandPalette, type CommandPaletteGroup } from \"@dodopayments/ui/command\";\nimport {\n ArrowsTransactionIcon,\n BoxIcon,\n CreditCardIcon,\n PenIcon,\n UserIcon,\n WalletIcon,\n} from \"@dodopayments/ui/icons\";\nimport { MenuGroup, MenuGroupLabel, MenuItem } from \"@dodopayments/ui/menu\";\nimport {\n PopoverHeader,\n PopoverNotificationItem,\n PopoverPanel,\n PopoverTitle,\n} from \"@dodopayments/ui/popover\";\nimport { useState } from \"react\";\n\nconst PAGES: CommandPaletteGroup[] = [\n {\n label: \"Quick navigation\",\n items: [\n {\n value: \"payments\",\n title: \"Payments\",\n description: \"See every payment and refund\",\n icon: <ArrowsTransactionIcon />,\n tag: \"Page\",\n },\n {\n value: \"payouts\",\n title: \"Payouts\",\n description: \"Balance, schedule and payout history\",\n icon: <WalletIcon />,\n tag: \"Page\",\n },\n {\n value: \"products\",\n title: \"Products\",\n description: \"Products, add-ons and collections\",\n icon: <BoxIcon />,\n tag: \"Page\",\n },\n ],\n },\n];\n\nexport default function AppTopBarMaster() {\n const [searching, setSearching] = useState(false);\n const [progress, setProgress] = useState(0.4);\n\n return (\n <div className=\"w-full\">\n <AppTopBar\n // Search opens the Command palette; the bar also opens it on the / key.\n onSearch={() => setSearching(true)}\n milestonesProgress={progress}\n onOpenMilestones={() => {\n // Each visit completes a milestone, so the ring fills up.\n setProgress((value) => (value >= 1 ? 0.2 : Math.min(1, value + 0.2)));\n }}\n notifications={\n <>\n <PopoverHeader>\n <PopoverTitle>Notifications</PopoverTitle>\n </PopoverHeader>\n <PopoverPanel>\n <PopoverNotificationItem\n icon={<CreditCardIcon />}\n title=\"Payment succeeded\"\n id=\"pay_0NlZbY…k09c\"\n time=\"2 min ago\"\n unread\n />\n <PopoverNotificationItem\n icon={<CreditCardIcon />}\n title=\"Refund processed\"\n id=\"rfd_0NmQ8x…T2aP\"\n time=\"1 hr ago\"\n />\n </PopoverPanel>\n </>\n }\n account={\n <MenuGroup>\n
|
|
17414
|
+
"code": "\"use client\";\n\nimport { AppTopBar } from \"@dodopayments/ui/app-top-bar\";\nimport { CommandPalette, type CommandPaletteGroup } from \"@dodopayments/ui/command\";\nimport {\n ArrowDoorOut3Icon,\n ArrowsTransactionIcon,\n BoxIcon,\n CreditCardIcon,\n PenIcon,\n UserIcon,\n WalletIcon,\n} from \"@dodopayments/ui/icons\";\nimport { MenuGroup, MenuGroupLabel, MenuItem, MenuSeparator } from \"@dodopayments/ui/menu\";\nimport {\n PopoverHeader,\n PopoverNotificationItem,\n PopoverPanel,\n PopoverTitle,\n} from \"@dodopayments/ui/popover\";\nimport { useState } from \"react\";\n\nconst PAGES: CommandPaletteGroup[] = [\n {\n label: \"Quick navigation\",\n items: [\n {\n value: \"payments\",\n title: \"Payments\",\n description: \"See every payment and refund\",\n icon: <ArrowsTransactionIcon />,\n tag: \"Page\",\n },\n {\n value: \"payouts\",\n title: \"Payouts\",\n description: \"Balance, schedule and payout history\",\n icon: <WalletIcon />,\n tag: \"Page\",\n },\n {\n value: \"products\",\n title: \"Products\",\n description: \"Products, add-ons and collections\",\n icon: <BoxIcon />,\n tag: \"Page\",\n },\n ],\n },\n];\n\nexport default function AppTopBarMaster() {\n const [searching, setSearching] = useState(false);\n const [progress, setProgress] = useState(0.4);\n\n return (\n <div className=\"w-full\">\n <AppTopBar\n // Search opens the Command palette; the bar also opens it on the / key.\n onSearch={() => setSearching(true)}\n milestonesProgress={progress}\n onOpenMilestones={() => {\n // Each visit completes a milestone, so the ring fills up.\n setProgress((value) => (value >= 1 ? 0.2 : Math.min(1, value + 0.2)));\n }}\n notifications={\n <>\n <PopoverHeader>\n <PopoverTitle>Notifications</PopoverTitle>\n </PopoverHeader>\n <PopoverPanel>\n <PopoverNotificationItem\n icon={<CreditCardIcon />}\n title=\"Payment succeeded\"\n id=\"pay_0NlZbY…k09c\"\n time=\"2 min ago\"\n unread\n />\n <PopoverNotificationItem\n icon={<CreditCardIcon />}\n title=\"Refund processed\"\n id=\"rfd_0NmQ8x…T2aP\"\n time=\"1 hr ago\"\n />\n </PopoverPanel>\n </>\n }\n account={\n <>\n <MenuGroup>\n <MenuGroupLabel>Account Options</MenuGroupLabel>\n <MenuItem>\n <UserIcon aria-hidden=\"true\" />\n Profile\n </MenuItem>\n <MenuItem>\n <PenIcon aria-hidden=\"true\" />\n Edit Business\n </MenuItem>\n </MenuGroup>\n <MenuSeparator />\n <MenuItem>\n <ArrowDoorOut3Icon aria-hidden=\"true\" />\n Sign out\n </MenuItem>\n </>\n }\n />\n <CommandPalette\n groups={PAGES}\n open={searching}\n onOpenChange={setSearching}\n onSelect={() => setSearching(false)}\n // The bar already handles /.\n shortcut={false}\n />\n </div>\n );\n}"
|
|
17204
17415
|
},
|
|
17205
17416
|
{
|
|
17206
17417
|
"name": "app-top-bar/setup-guide",
|
|
@@ -17314,7 +17525,7 @@
|
|
|
17314
17525
|
},
|
|
17315
17526
|
{
|
|
17316
17527
|
"name": "Radio",
|
|
17317
|
-
"description": "One option in a `RadioGroup`, identified by `value`. Renders the `Radio` primitive: a `<span role=\"radio\">` plus a\nhidden `<input>`. On its own it is the bare radio: label it by wrapping it and its text in a `<label>`. With `label`\n(and `description`) it renders the whole option, a `<label>` with the text beside the radio, and\n`variant=\"card\"` makes that a card with the radio
|
|
17528
|
+
"description": "One option in a `RadioGroup`, identified by `value`. Renders the `Radio` primitive: a `<span role=\"radio\">` plus a\nhidden `<input>`. On its own it is the bare radio: label it by wrapping it and its text in a `<label>`. With `label`\n(and `description`) it renders the whole option, a `<label>` with the text beside the radio, and\n`variant=\"card\"` makes that a card with the radio before the title. It presses in while held; an option that is\nselected when it mounts does not animate.",
|
|
17318
17529
|
"props": [
|
|
17319
17530
|
{
|
|
17320
17531
|
"name": "className",
|
|
@@ -17396,7 +17607,7 @@
|
|
|
17396
17607
|
},
|
|
17397
17608
|
{
|
|
17398
17609
|
"value": "card",
|
|
17399
|
-
"description": "A card with a
|
|
17610
|
+
"description": "A card with a 12px radio before its title and a description. Needs a `label`. For choices that each need a short explanation, such as pricing type."
|
|
17400
17611
|
}
|
|
17401
17612
|
],
|
|
17402
17613
|
"default": "\"default\""
|
|
@@ -18660,7 +18871,7 @@
|
|
|
18660
18871
|
},
|
|
18661
18872
|
{
|
|
18662
18873
|
"name": "SidebarMenuCollapsible",
|
|
18663
|
-
"description": "A menu item that expands to show a sub-menu. Renders `<li>`; compose it from a\n`SidebarMenuCollapsibleTrigger` and a `SidebarMenuCollapsibleContent` holding a `SidebarMenuSub`.\nThe primitives have no sidebar collapsible part; built from the `Collapsible` primitive.",
|
|
18874
|
+
"description": "A menu item that expands to show a sub-menu. Renders `<li>`; compose it from a\n`SidebarMenuCollapsibleTrigger` and a `SidebarMenuCollapsibleContent` holding a `SidebarMenuSub`.\nThe primitives have no sidebar collapsible part; built from the `Collapsible` primitive.\n\nInside a `SidebarProvider` only one sub-menu is open at a time: opening one closes the one that was open.\n`defaultOpen` sets the first state. Pass `open` to control it yourself; a controlled sub-menu is left out of this.",
|
|
18664
18875
|
"props": [
|
|
18665
18876
|
{
|
|
18666
18877
|
"name": "className",
|
|
@@ -18703,7 +18914,7 @@
|
|
|
18703
18914
|
},
|
|
18704
18915
|
{
|
|
18705
18916
|
"name": "SidebarMenuCollapsibleContent",
|
|
18706
|
-
"description": "The animated panel (primitive `CollapsiblePanel`) holding the sub-menu. Unmounts when closed unless `keepMounted
|
|
18917
|
+
"description": "The animated panel (primitive `CollapsiblePanel`) holding the sub-menu. Unmounts when closed unless `keepMounted`.\nOn the desktop icon rail it is a small Popover beside the icon instead: the trigger's `tooltip` as its title, the\nsub-menu in the white panel.",
|
|
18707
18918
|
"props": [
|
|
18708
18919
|
{
|
|
18709
18920
|
"name": "className",
|
|
@@ -22335,7 +22546,7 @@
|
|
|
22335
22546
|
"title": "List item",
|
|
22336
22547
|
"category": "Data display",
|
|
22337
22548
|
"status": "stable",
|
|
22338
|
-
"description": "One line of a list or one small card (Dodo Nest List item): a leading part, the title and description (one line\neach, with an ellipsis) and a trailing part. `layout` is `row` (order lines, settings rows, sessions, saved\npayment methods inside a panel; a divider under every row but the last), `card` (side-by-side portal cards, 12\napart) or `add` (a dashed “Add …” tile that is a button; pass `onClick`). Renders a `<div>` (an `<li>` with\n`render={<li />}`, a link with `render={<a href=\"…\" />}`); the add tile renders a `<button>`. It has no hover or\nselected state: for a choice, use a Radio card.",
|
|
22549
|
+
"description": "One line of a list or one small card (Dodo Nest List item): a leading part, the title and description (one line\neach, with an ellipsis) and a trailing part. `layout` is `row` (order lines, settings rows, sessions, saved\npayment methods inside a panel; a divider under every row but the last), `card` (side-by-side portal cards, 12\napart), `tile` (a bordered row tile: add-ons with a quantity, or with `href` / `render` a link with a chevron for a settings index) or `add` (a dashed “Add …” tile that is a button; pass `onClick`). Renders a `<div>` (an `<li>` with\n`render={<li />}`, a link with `render={<a href=\"…\" />}`); the add tile renders a `<button>`. It has no hover or\nselected state: for a choice, use a Radio card.",
|
|
22339
22550
|
"importPath": "@dodopayments/ui/list-item",
|
|
22340
22551
|
"exports": [
|
|
22341
22552
|
"DODO_LIST_ITEM_DEFAULT_VARIANTS",
|
|
@@ -22351,7 +22562,7 @@
|
|
|
22351
22562
|
"parts": [
|
|
22352
22563
|
{
|
|
22353
22564
|
"name": "ListItem",
|
|
22354
|
-
"description": "One line of a list or one small card (Dodo Nest List item): a leading part, the title and description (one line\neach, with an ellipsis) and a trailing part. `layout` is `row` (order lines, settings rows, sessions, saved\npayment methods inside a panel; a divider under every row but the last), `card` (side-by-side portal cards, 12\napart) or `add` (a dashed “Add …” tile that is a button; pass `onClick`). Renders a `<div>` (an `<li>` with\n`render={<li />}`, a link with `render={<a href=\"…\" />}`); the add tile renders a `<button>`. It has no hover or\nselected state: for a choice, use a Radio card.",
|
|
22565
|
+
"description": "One line of a list or one small card (Dodo Nest List item): a leading part, the title and description (one line\neach, with an ellipsis) and a trailing part. `layout` is `row` (order lines, settings rows, sessions, saved\npayment methods inside a panel; a divider under every row but the last), `card` (side-by-side portal cards, 12\napart), `tile` (a bordered row tile: add-ons with a quantity, or with `href` / `render` a link with a chevron for a settings index) or `add` (a dashed “Add …” tile that is a button; pass `onClick`). Renders a `<div>` (an `<li>` with\n`render={<li />}`, a link with `render={<a href=\"…\" />}`); the add tile renders a `<button>`. It has no hover or\nselected state: for a choice, use a Radio card.",
|
|
22355
22566
|
"props": [
|
|
22356
22567
|
{
|
|
22357
22568
|
"name": "title",
|
|
@@ -22374,6 +22585,14 @@
|
|
|
22374
22585
|
"description": "One line under the title with an ellipsis (Body/Secondary, Content/Secondary).",
|
|
22375
22586
|
"source": "dodo"
|
|
22376
22587
|
},
|
|
22588
|
+
{
|
|
22589
|
+
"name": "disabled",
|
|
22590
|
+
"type": "boolean",
|
|
22591
|
+
"required": false,
|
|
22592
|
+
"default": "false",
|
|
22593
|
+
"description": "Tile only: drop the link and the chevron and render a plain `<div>` tile, e.g. for a page that is not available\nyet. Say why in the description.",
|
|
22594
|
+
"source": "dodo"
|
|
22595
|
+
},
|
|
22377
22596
|
{
|
|
22378
22597
|
"name": "divider",
|
|
22379
22598
|
"type": "boolean",
|
|
@@ -22382,9 +22601,16 @@
|
|
|
22382
22601
|
"description": "Row only: the 1px Border/Primary line under the row. It is always hidden on the last row of its list.",
|
|
22383
22602
|
"source": "dodo"
|
|
22384
22603
|
},
|
|
22604
|
+
{
|
|
22605
|
+
"name": "href",
|
|
22606
|
+
"type": "string",
|
|
22607
|
+
"required": false,
|
|
22608
|
+
"description": "Tile only: where the tile links to; renders an `<a href>` and adds the chevron. Pass `render` instead for a router\nlink (on a tile, `render` is always the link).",
|
|
22609
|
+
"source": "dodo"
|
|
22610
|
+
},
|
|
22385
22611
|
{
|
|
22386
22612
|
"name": "layout",
|
|
22387
|
-
"type": "\"row\" | \"card\" | \"add\"",
|
|
22613
|
+
"type": "\"row\" | \"card\" | \"tile\" | \"add\"",
|
|
22388
22614
|
"required": false,
|
|
22389
22615
|
"description": "",
|
|
22390
22616
|
"source": "dodo",
|
|
@@ -22397,6 +22623,10 @@
|
|
|
22397
22623
|
"value": "card",
|
|
22398
22624
|
"description": "A small card for side-by-side portal cards (add-on, saved payment method, offer): leading and corner on top, the text, then the trailing part spread across the bottom."
|
|
22399
22625
|
},
|
|
22626
|
+
{
|
|
22627
|
+
"value": "tile",
|
|
22628
|
+
"description": "A bordered tile laid out as a row: leading · title and description · trailing (add-ons with a quantity). With `href` or `render` the whole tile is one link and ends with a chevron (a settings index); with `disabled` it stays a plain tile."
|
|
22629
|
+
},
|
|
22400
22630
|
{
|
|
22401
22631
|
"value": "add",
|
|
22402
22632
|
"description": "A dashed “Add …” tile next to cards: a plus icon over the label, the whole tile a button."
|
|
@@ -22499,17 +22729,25 @@
|
|
|
22499
22729
|
}
|
|
22500
22730
|
],
|
|
22501
22731
|
"examples": [
|
|
22732
|
+
{
|
|
22733
|
+
"name": "list-item/add-ons",
|
|
22734
|
+
"code": "\"use client\";\n\nimport { Avatar, AvatarImage } from \"@dodopayments/ui/avatar\";\nimport { ListItem } from \"@dodopayments/ui/list-item\";\n\nconst ADD_ONS = [\n {\n id: \"seats\",\n title: \"Extra seats\",\n description: \"Five more teammates on the plan.\",\n quantity: 2,\n },\n { id: \"support\", title: \"Priority support\", description: \"Replies within 4 hours.\", quantity: 1 },\n { id: \"storage\", title: \"Storage pack\", description: \"100 GB for file uploads.\", quantity: 3 },\n] as const;\n\n/** The add-ons of a subscription: static tiles with an image and the quantity on the trailing side. */\nexport default function ListItemAddOns() {\n return (\n <ul className=\"grid w-full max-w-3xl grid-cols-1 gap-3 sm:grid-cols-3\">\n {ADD_ONS.map((addOn) => (\n // On a tile `render` is the link, so the list item wraps it.\n <li key={addOn.id} className=\"flex\">\n <ListItem\n className=\"flex-1\"\n layout=\"tile\"\n leading={\n <Avatar size=\"md\">\n <AvatarImage src=\"/samples/product-hero-image.svg\" alt=\"\" />\n </Avatar>\n }\n title={addOn.title}\n description={addOn.description}\n trailing={\n <span className=\"text-body-secondary text-muted-foreground\">\n Qty: {addOn.quantity}\n </span>\n }\n />\n </li>\n ))}\n </ul>\n );\n}"
|
|
22735
|
+
},
|
|
22502
22736
|
{
|
|
22503
22737
|
"name": "list-item/add-tile",
|
|
22504
|
-
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { ListItem } from \"@dodopayments/ui/list-item\";\nimport { PaymentLogo } from \"@dodopayments/ui/payment-logos\";\nimport { useState } from \"react\";\n\n/** Saved cards next to the dashed add tile; the tile is a button. */\nexport default function ListItemAddTile() {\n const [cards, setCards] = useState([\"4242\"]);\n return (\n <div className=\"grid w-full max-w-xl grid-cols-1 items-start gap-3 sm:grid-cols-2\">\n {cards.map((last4, index) => (\n <ListItem\n key={last4}\n layout=\"card\"\n leading={<PaymentLogo brand=\"visa\" />}\n corner={index === 0 ? <Badge>Default</Badge
|
|
22738
|
+
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { Button } from \"@dodopayments/ui/button\";\nimport { XmarkIcon } from \"@dodopayments/ui/icons\";\nimport { ListItem } from \"@dodopayments/ui/list-item\";\nimport { PaymentLogo } from \"@dodopayments/ui/payment-logos\";\nimport { useState } from \"react\";\n\n/** Saved cards next to the dashed add tile; the tile is a button and every card but the default can be removed. */\nexport default function ListItemAddTile() {\n const [cards, setCards] = useState([\"4242\"]);\n return (\n <div className=\"grid w-full max-w-xl grid-cols-1 items-start gap-3 sm:grid-cols-2\">\n {cards.map((last4, index) => (\n <ListItem\n key={last4}\n layout=\"card\"\n leading={<PaymentLogo brand=\"visa\" />}\n corner={\n index === 0 ? (\n <Badge>Default</Badge>\n ) : (\n <Button\n variant=\"ghost\"\n size=\"icon-xs\"\n aria-label={`Remove Visa card ending ${last4}`}\n onClick={() => setCards((list) => list.filter((card) => card !== last4))}\n >\n <XmarkIcon />\n </Button>\n )\n }\n title={`Visa •••• ${last4}`}\n description=\"Expires 04/28\"\n />\n ))}\n <ListItem\n layout=\"add\"\n title=\"Add payment method\"\n onClick={() => setCards((list) => [...list, String(1000 + list.length * 1111)])}\n />\n </div>\n );\n}"
|
|
22505
22739
|
},
|
|
22506
22740
|
{
|
|
22507
22741
|
"name": "list-item/master",
|
|
22508
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { FeaturedIcon } from \"@dodopayments/ui/featured-icon\";\nimport { BoxIcon } from \"@dodopayments/ui/icons\";\nimport { ListItem, ListItemPrice, ListItemThumbnail } from \"@dodopayments/ui/list-item\";\n\nexport default function ListItemMaster() {\n return (\n <div className=\"flex w-full max-w-110 flex-col gap-3\">\n <ListItem\n leading={<ListItemThumbnail />}\n title=\"Pro plan\"\n description=\"Monthly subscription\"\n trailing={<ListItemPrice amount=\"$39\" period=\"/mo\" />}\n />\n <div className=\"grid grid-cols-1 items-start gap-3 sm:grid-cols-2\">\n <ListItem\n layout=\"card\"\n leading={<FeaturedIcon icon={<BoxIcon />} />}\n title=\"Pro plan\"\n description=\"Monthly subscription\"\n trailing={\n <>\n <ListItemPrice amount=\"$39\" period=\"/mo\" />\n <Button variant=\"secondary\" size=\"xs\">\n Add\n </Button>\n </>\n }\n />\n <ListItem layout=\"add\" title=\"Add payment method\" />\n </div>\n </div>\n );\n}"
|
|
22742
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { FeaturedIcon } from \"@dodopayments/ui/featured-icon\";\nimport { BoxIcon, GreekTempleIcon } from \"@dodopayments/ui/icons\";\nimport { ListItem, ListItemPrice, ListItemThumbnail } from \"@dodopayments/ui/list-item\";\n\nexport default function ListItemMaster() {\n return (\n <div className=\"flex w-full max-w-110 flex-col gap-3\">\n <ListItem\n leading={<ListItemThumbnail />}\n title=\"Pro plan\"\n description=\"Monthly subscription\"\n trailing={<ListItemPrice amount=\"$39\" period=\"/mo\" />}\n />\n <div className=\"grid grid-cols-1 items-start gap-3 sm:grid-cols-2\">\n <ListItem\n layout=\"card\"\n leading={<FeaturedIcon icon={<BoxIcon />} />}\n title=\"Pro plan\"\n description=\"Monthly subscription\"\n trailing={\n <>\n <ListItemPrice amount=\"$39\" period=\"/mo\" />\n <Button variant=\"secondary\" size=\"xs\">\n Add\n </Button>\n </>\n }\n />\n <ListItem layout=\"add\" title=\"Add payment method\" />\n </div>\n <ListItem\n layout=\"tile\"\n href=\"/settings/payouts\"\n leading={<FeaturedIcon tone=\"info\" icon={<GreekTempleIcon />} />}\n title=\"Payouts\"\n description=\"Bank accounts, payout schedule and minimum payout.\"\n />\n </div>\n );\n}"
|
|
22509
22743
|
},
|
|
22510
22744
|
{
|
|
22511
22745
|
"name": "list-item/order-lines",
|
|
22512
22746
|
"code": "\"use client\";\n\nimport { Badge } from \"@dodopayments/ui/badge\";\nimport { ListItem, ListItemPrice, ListItemThumbnail } from \"@dodopayments/ui/list-item\";\n\n/** Checkout order lines in a list: a divider under every row but the last. */\nexport default function ListItemOrderLines() {\n return (\n <ul className=\"w-full max-w-110 rounded-xl border border-border bg-background px-4 py-1\">\n <ListItem\n render={<li />}\n leading={<ListItemThumbnail count={2} />}\n title=\"Pro plan\"\n description=\"Monthly subscription\"\n trailing={<ListItemPrice amount=\"$98\" period=\"/mo\" subLine=\"2 × $49\" />}\n />\n <ListItem\n render={<li />}\n leading={<ListItemThumbnail />}\n title=\"Pro plan, annual\"\n description=\"Yearly subscription\"\n trailing={<ListItemPrice amount=\"$470\" compareAt=\"$588\" period=\"/yr\" subLine=\"Save 20%\" />}\n />\n <ListItem\n render={<li />}\n title=\"Credits\"\n description=\"1,000 included\"\n trailing={<Badge tone=\"success\">Included</Badge>}\n />\n </ul>\n );\n}"
|
|
22747
|
+
},
|
|
22748
|
+
{
|
|
22749
|
+
"name": "list-item/settings-index",
|
|
22750
|
+
"code": "\"use client\";\n\nimport { FeaturedIcon } from \"@dodopayments/ui/featured-icon\";\nimport {\n BellIcon,\n GreekTempleIcon,\n HouseIcon,\n KeyIcon,\n ReceiptIcon,\n UsersIcon,\n} from \"@dodopayments/ui/icons\";\nimport { ListItem } from \"@dodopayments/ui/list-item\";\n\n/** A settings index: tiles that link, with an info-tone icon; a page that is not available yet is a plain tile. */\nexport default function ListItemSettingsIndex() {\n return (\n <div className=\"grid w-full max-w-3xl grid-cols-1 gap-3 sm:grid-cols-2\">\n <ListItem\n layout=\"tile\"\n href=\"#business\"\n leading={<FeaturedIcon tone=\"info\" icon={<HouseIcon />} />}\n title=\"Business profile\"\n description=\"Legal name, address and support email.\"\n />\n <ListItem\n layout=\"tile\"\n href=\"#payouts\"\n leading={<FeaturedIcon tone=\"info\" icon={<GreekTempleIcon />} />}\n title=\"Payouts\"\n description=\"Bank accounts, payout schedule and minimum payout.\"\n />\n <ListItem\n layout=\"tile\"\n href=\"#team\"\n leading={<FeaturedIcon tone=\"info\" icon={<UsersIcon />} />}\n title=\"Team\"\n description=\"Invite teammates and choose what they can do.\"\n />\n <ListItem\n layout=\"tile\"\n href=\"#notifications\"\n leading={<FeaturedIcon tone=\"info\" icon={<BellIcon />} />}\n title=\"Notifications\"\n description=\"Emails for payments, disputes and payouts.\"\n />\n <ListItem\n layout=\"tile\"\n href=\"#developers\"\n leading={<FeaturedIcon tone=\"info\" icon={<KeyIcon />} />}\n title=\"API keys\"\n description=\"Keys and webhooks for your integration.\"\n />\n <ListItem\n layout=\"tile\"\n disabled\n leading={<FeaturedIcon tone=\"info\" icon={<ReceiptIcon />} />}\n title=\"Tax forms\"\n description=\"Available once your business is verified.\"\n />\n </div>\n );\n}"
|
|
22513
22751
|
}
|
|
22514
22752
|
],
|
|
22515
22753
|
"docsUrl": "/components/list-item"
|
|
@@ -23307,12 +23545,14 @@
|
|
|
23307
23545
|
"title": "Setup guide",
|
|
23308
23546
|
"category": "Feedback",
|
|
23309
23547
|
"status": "stable",
|
|
23310
|
-
"description": "The setup guide a new business follows (the dashboard's Setup guide, opened from the top bar's Setup guide\nbutton): a 320 wide
|
|
23548
|
+
"description": "The setup guide a new business follows (the dashboard's Setup guide, opened from the top bar's Setup guide\nbutton): a 320 wide grey tray (Direction 1) with the title, the percent done and a progress bar on its strip, then\none white panel per step, 4 apart. A\ngroup row opens (one at a time) to its tasks, each with a status dot, a status Badge when submitted or blocked and an\noptional \"Mark as done\"; a link row goes straight to a page; a locked row waits behind a padlock; a finished row\nshows a green check. Collapsed, it keeps the header and bar and says what is up next. Place it yourself (the\ndashboard pins it to the bottom-right corner).",
|
|
23311
23549
|
"importPath": "@dodopayments/ui/setup-guide",
|
|
23312
23550
|
"exports": [
|
|
23313
23551
|
"DODO_SETUP_GUIDE_TASK_DOT_DEFAULT_VARIANTS",
|
|
23314
23552
|
"DODO_SETUP_GUIDE_TASK_DOT_VARIANTS",
|
|
23315
23553
|
"SetupGuide",
|
|
23554
|
+
"SetupGuideIntro",
|
|
23555
|
+
"SetupGuideIntroProps",
|
|
23316
23556
|
"SetupGuideItem",
|
|
23317
23557
|
"SetupGuideLabels",
|
|
23318
23558
|
"SetupGuideProps",
|
|
@@ -23322,7 +23562,7 @@
|
|
|
23322
23562
|
"parts": [
|
|
23323
23563
|
{
|
|
23324
23564
|
"name": "SetupGuide",
|
|
23325
|
-
"description": "The setup guide a new business follows (the dashboard's Setup guide, opened from the top bar's Setup guide\nbutton): a 320 wide
|
|
23565
|
+
"description": "The setup guide a new business follows (the dashboard's Setup guide, opened from the top bar's Setup guide\nbutton): a 320 wide grey tray (Direction 1) with the title, the percent done and a progress bar on its strip, then\none white panel per step, 4 apart. A\ngroup row opens (one at a time) to its tasks, each with a status dot, a status Badge when submitted or blocked and an\noptional \"Mark as done\"; a link row goes straight to a page; a locked row waits behind a padlock; a finished row\nshows a green check. Collapsed, it keeps the header and bar and says what is up next. Place it yourself (the\ndashboard pins it to the bottom-right corner).",
|
|
23326
23566
|
"props": [
|
|
23327
23567
|
{
|
|
23328
23568
|
"name": "items",
|
|
@@ -23396,20 +23636,53 @@
|
|
|
23396
23636
|
"source": "dodo"
|
|
23397
23637
|
}
|
|
23398
23638
|
]
|
|
23639
|
+
},
|
|
23640
|
+
{
|
|
23641
|
+
"name": "SetupGuideIntro",
|
|
23642
|
+
"description": "The first-time hint above the setup guide (the Design File's \"Your setup lives here\"): a 320 wide lime card with\na title, a line and a \"Got it\" button, shown once when the guide first opens. Place it 8 above the guide; the\ndashboard also dims the page behind both until it is dismissed.",
|
|
23643
|
+
"props": [
|
|
23644
|
+
{
|
|
23645
|
+
"name": "onDismiss",
|
|
23646
|
+
"type": "() => void",
|
|
23647
|
+
"required": true,
|
|
23648
|
+
"description": "Called by the dismiss button. Hide the intro and remember it, so it shows only once.",
|
|
23649
|
+
"source": "dodo"
|
|
23650
|
+
},
|
|
23651
|
+
{
|
|
23652
|
+
"name": "actionLabel",
|
|
23653
|
+
"type": "string",
|
|
23654
|
+
"required": false,
|
|
23655
|
+
"default": "\"Got it\"",
|
|
23656
|
+
"description": "The dismiss button's label.",
|
|
23657
|
+
"source": "dodo"
|
|
23658
|
+
},
|
|
23659
|
+
{
|
|
23660
|
+
"name": "description",
|
|
23661
|
+
"type": "ReactNode",
|
|
23662
|
+
"required": false,
|
|
23663
|
+
"default": "\"Pick up right where you left off.\"",
|
|
23664
|
+
"description": "",
|
|
23665
|
+
"source": "dodo"
|
|
23666
|
+
},
|
|
23667
|
+
{
|
|
23668
|
+
"name": "title",
|
|
23669
|
+
"type": "ReactNode",
|
|
23670
|
+
"required": false,
|
|
23671
|
+
"default": "\"Your setup lives here\"",
|
|
23672
|
+
"description": "",
|
|
23673
|
+
"source": "dodo"
|
|
23674
|
+
}
|
|
23675
|
+
]
|
|
23399
23676
|
}
|
|
23400
23677
|
],
|
|
23401
23678
|
"examples": [
|
|
23402
23679
|
{
|
|
23403
23680
|
"name": "setup-guide/master",
|
|
23404
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n SetupGuide,\n type SetupGuideItem,\n type SetupGuideTaskState,\n} from \"@dodopayments/ui/setup-guide\";\nimport { useState } from \"react\";\n\
|
|
23405
|
-
},
|
|
23406
|
-
{
|
|
23407
|
-
"name": "setup-guide/states",
|
|
23408
|
-
"code": "\"use client\";\n\nimport { SetupGuide } from \"@dodopayments/ui/setup-guide\";\n\nexport default function SetupGuideStates() {\n return (\n <SetupGuide\n defaultOpenItem=\"verify\"\n items={[\n {\n id: \"verify\",\n title: \"Verify your account\",\n tasks: [\n { id: \"product\", label: \"Product Information\", state: \"done\" },\n { id: \"personal\", label: \"Personal Information\", state: \"in-review\" },\n { id: \"business\", label: \"Business Verification\", state: \"on-hold\" },\n { id: \"bank\", label: \"Bank Verification\", state: \"failed\" },\n { id: \"tax\", label: \"Tax details\", state: \"pending\" },\n ],\n },\n {\n id: \"branding\",\n title: \"Brand your checkout\",\n hint: \"Add your logo and colours\",\n href: \"#brand-your-checkout\",\n },\n { id: \"profile\", title: \"Business profile\", done: true },\n {\n id: \"live\",\n title: \"Go live\",\n hint: \"Unlocks once verification is approved\",\n locked: true,\n },\n ]}\n />\n );\n}"
|
|
23681
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n SetupGuide,\n SetupGuideIntro,\n type SetupGuideItem,\n type SetupGuideTaskState,\n} from \"@dodopayments/ui/setup-guide\";\nimport { useState } from \"react\";\n\nconst VERIFY = [\n [\"product\", \"Product Verification\"],\n [\"identity\", \"Personal identity\"],\n [\"business\", \"Business Information\"],\n [\"bank\", \"Bank Details\"],\n] as const;\nconst TEST = [\n [\"test-product\", \"Create a product\"],\n [\"test-integrate\", \"Integrate\"],\n [\"test-payment\", \"Make first test payment\"],\n] as const;\nconst LIVE = [\n [\"live-products\", \"Create products in Live mode\", false],\n [\"live-integrate\", \"Integrate (live)\", true],\n [\"branding\", \"Set up branding\", true],\n [\"zero-payment\", \"Make a $0 payment\", false],\n] as const;\n\ntype TaskId = (typeof VERIFY)[number][0] | (typeof TEST)[number][0] | (typeof LIVE)[number][0];\n\nconst INITIAL = Object.fromEntries(\n [...VERIFY, ...TEST, ...LIVE].map(([id]) => [id, \"pending\"]),\n) as Record<TaskId, SetupGuideTaskState>;\n\n/**\n * The Setup guide with the Design File's content: press a verification task to submit it (In review), press a test\n * or live task to finish it or use Mark as done, open the steps, collapse the guide, dismiss the intro, and close and\n * reopen the guide.\n */\nexport default function SetupGuideMaster() {\n const [states, setStates] = useState(INITIAL);\n const [intro, setIntro] = useState(true);\n const [open, setOpen] = useState(true);\n const set = (id: TaskId, state: SetupGuideTaskState) =>\n setStates((current) => ({ ...current, [id]: state }));\n\n const items: SetupGuideItem[] = [\n {\n id: \"verify\",\n title: \"Verify your account\",\n tasks: VERIFY.map(([id, label]) => ({\n id,\n label,\n state: states[id],\n // A pending form opens; submitting it puts it in review.\n onSelect: states[id] === \"pending\" ? () => set(id, \"in-review\") : undefined,\n })),\n },\n {\n id: \"test\",\n title: \"Test mode integration\",\n tasks: TEST.map(([id, label]) => ({\n id,\n label,\n state: states[id],\n onSelect: states[id] === \"done\" ? undefined : () => set(id, \"done\"),\n })),\n },\n {\n id: \"live\",\n title: \"Live mode integration\",\n tasks: LIVE.map(([id, label, manual]) => ({\n id,\n label,\n state: states[id],\n onSelect: manual || states[id] === \"done\" ? undefined : () => set(id, \"done\"),\n onMarkDone: manual ? () => set(id, \"done\") : undefined,\n })),\n },\n {\n id: \"go-live\",\n title: \"Go live\",\n hint: \"Unlocks once verification is approved\",\n locked: true,\n },\n ];\n\n return (\n <div className=\"flex min-h-130 flex-col items-center justify-end gap-2\">\n {open && intro ? <SetupGuideIntro onDismiss={() => setIntro(false)} /> : null}\n {open ? (\n <SetupGuide items={items} defaultOpenItem=\"verify\" onClose={() => setOpen(false)} />\n ) : (\n <Button variant=\"secondary\" onClick={() => setOpen(true)}>\n Open the setup guide\n </Button>\n )}\n </div>\n );\n}"
|
|
23409
23682
|
},
|
|
23410
23683
|
{
|
|
23411
23684
|
"name": "setup-guide/with-top-bar",
|
|
23412
|
-
"code": "\"use client\";\n\nimport { AppTopBar } from \"@dodopayments/ui/app-top-bar\";\nimport { SetupGuide, type SetupGuideItem } from \"@dodopayments/ui/setup-guide\";\nimport { useState } from \"react\";\n\nconst ITEMS: SetupGuideItem[] = [\n {\n id: \"verify\",\n title: \"Verify your account\",\n tasks: [\n { id: \"product\", label: \"Product
|
|
23685
|
+
"code": "\"use client\";\n\nimport { AppTopBar } from \"@dodopayments/ui/app-top-bar\";\nimport { SetupGuide, type SetupGuideItem } from \"@dodopayments/ui/setup-guide\";\nimport { useState } from \"react\";\n\nconst ITEMS: SetupGuideItem[] = [\n {\n id: \"verify\",\n title: \"Verify your account\",\n tasks: [\n { id: \"product\", label: \"Product Verification\", state: \"in-review\" },\n { id: \"identity\", label: \"Personal identity\", state: \"done\" },\n { id: \"business\", label: \"Business Information\", state: \"done\" },\n { id: \"bank\", label: \"Bank Details\", state: \"pending\" },\n ],\n },\n {\n id: \"test\",\n title: \"Test mode integration\",\n tasks: [\n { id: \"test-product\", label: \"Create a product\", state: \"pending\" },\n { id: \"test-integrate\", label: \"Integrate\", state: \"pending\" },\n { id: \"test-payment\", label: \"Make first test payment\", state: \"pending\" },\n ],\n },\n {\n id: \"live\",\n title: \"Live mode integration\",\n tasks: [\n { id: \"live-products\", label: \"Create products in Live mode\", state: \"pending\" },\n { id: \"live-integrate\", label: \"Integrate (live)\", state: \"pending\" },\n { id: \"branding\", label: \"Set up branding\", state: \"pending\" },\n { id: \"zero-payment\", label: \"Make a $0 payment\", state: \"pending\" },\n ],\n },\n { id: \"go-live\", title: \"Go live\", hint: \"Unlocks once verification is approved\", locked: true },\n];\n\nexport default function SetupGuideWithTopBar() {\n const [open, setOpen] = useState(true);\n const [collapsed, setCollapsed] = useState(true);\n\n return (\n <div className=\"flex w-full flex-col items-end gap-4 pb-4\">\n <AppTopBar\n // The hero above owns the / key on this page.\n searchShortcut={false}\n showSetupGuide\n setupGuideProgress={0.1}\n onOpenSetupGuide={() => {\n setOpen(true);\n setCollapsed(false);\n }}\n />\n {open ? (\n <SetupGuide\n className=\"me-8\"\n items={ITEMS}\n collapsed={collapsed}\n onCollapsedChange={setCollapsed}\n onClose={() => setOpen(false)}\n />\n ) : null}\n </div>\n );\n}"
|
|
23413
23686
|
}
|
|
23414
23687
|
],
|
|
23415
23688
|
"docsUrl": "/components/setup-guide"
|
|
@@ -24612,8 +24885,13 @@
|
|
|
24612
24885
|
"description": "A number that flashes when it changes, for live prices, balances and counters. After\ninterior.dev's value flash (https://www.interior.dev/docs/value-flash): the new number rolls in\nfrom the direction of the change, the value tints success (up) or destructive (down), lifts\nslightly, and a caret pops in beside it. Changes are announced through a polite live region once\nthe value settles. With reduced motion the number cross-fades and nothing moves.",
|
|
24613
24886
|
"importPath": "@dodopayments/ui/value-flash",
|
|
24614
24887
|
"exports": [
|
|
24888
|
+
"DODO_VALUE_FLASH_CHANGE_DEFAULT_VARIANTS",
|
|
24889
|
+
"DODO_VALUE_FLASH_CHANGE_VARIANTS",
|
|
24615
24890
|
"UseValueFlashOptions",
|
|
24616
24891
|
"ValueFlash",
|
|
24892
|
+
"ValueFlashChange",
|
|
24893
|
+
"ValueFlashChangeDirection",
|
|
24894
|
+
"ValueFlashChangeProps",
|
|
24617
24895
|
"ValueFlashDirection",
|
|
24618
24896
|
"ValueFlashProps",
|
|
24619
24897
|
"ValueFlashState",
|
|
@@ -24669,6 +24947,71 @@
|
|
|
24669
24947
|
"source": "dodo"
|
|
24670
24948
|
}
|
|
24671
24949
|
]
|
|
24950
|
+
},
|
|
24951
|
+
{
|
|
24952
|
+
"name": "ValueFlashChange",
|
|
24953
|
+
"description": "The resting look of a value flash, for a change shown next to a number (a stat card's trend): the change, then a\ncaret pointing the way it moved, on the tone's subtle tint, with no border. A `neutral` change without a `value`\nshows \"-%\" in grey, read as \"No change\". It does not animate; a tone change fades its colours.",
|
|
24954
|
+
"props": [
|
|
24955
|
+
{
|
|
24956
|
+
"name": "direction",
|
|
24957
|
+
"type": "ValueFlashChangeDirection",
|
|
24958
|
+
"required": true,
|
|
24959
|
+
"description": "Which way it moved: picks the caret and, without `tone`, the colour (up success, down error).",
|
|
24960
|
+
"source": "dodo"
|
|
24961
|
+
},
|
|
24962
|
+
{
|
|
24963
|
+
"name": "caret",
|
|
24964
|
+
"type": "boolean",
|
|
24965
|
+
"required": false,
|
|
24966
|
+
"default": "true",
|
|
24967
|
+
"description": "Show the caret after the value.",
|
|
24968
|
+
"source": "dodo"
|
|
24969
|
+
},
|
|
24970
|
+
{
|
|
24971
|
+
"name": "label",
|
|
24972
|
+
"type": "string",
|
|
24973
|
+
"required": false,
|
|
24974
|
+
"description": "Read before the value on an up or down change, e.g. \"Increased by\".",
|
|
24975
|
+
"source": "dodo"
|
|
24976
|
+
},
|
|
24977
|
+
{
|
|
24978
|
+
"name": "noChangeLabel",
|
|
24979
|
+
"type": "string",
|
|
24980
|
+
"required": false,
|
|
24981
|
+
"default": "\"No change\"",
|
|
24982
|
+
"description": "Read in place of \"-%\" on a neutral change without a value.",
|
|
24983
|
+
"source": "dodo"
|
|
24984
|
+
},
|
|
24985
|
+
{
|
|
24986
|
+
"name": "tone",
|
|
24987
|
+
"type": "\"success\" | \"error\" | \"neutral\"",
|
|
24988
|
+
"required": false,
|
|
24989
|
+
"description": "Overrides the colour, e.g. `error` for growth that is bad (refunds, churn). Defaults from `direction`.",
|
|
24990
|
+
"source": "dodo",
|
|
24991
|
+
"values": [
|
|
24992
|
+
{
|
|
24993
|
+
"value": "success",
|
|
24994
|
+
"description": "A good change: Content/Success on the success subtle tint."
|
|
24995
|
+
},
|
|
24996
|
+
{
|
|
24997
|
+
"value": "error",
|
|
24998
|
+
"description": "A bad change: Content/Error on the error subtle tint."
|
|
24999
|
+
},
|
|
25000
|
+
{
|
|
25001
|
+
"value": "neutral",
|
|
25002
|
+
"description": "No change: Content/Secondary on Surface/Secondary."
|
|
25003
|
+
}
|
|
25004
|
+
],
|
|
25005
|
+
"default": "\"neutral\""
|
|
25006
|
+
},
|
|
25007
|
+
{
|
|
25008
|
+
"name": "value",
|
|
25009
|
+
"type": "ReactNode",
|
|
25010
|
+
"required": false,
|
|
25011
|
+
"description": "The change, preformatted and without a sign, e.g. \"24%\" or \"$1,204.00\". Leave it out on a `neutral` change to\nshow \"-%\".",
|
|
25012
|
+
"source": "dodo"
|
|
25013
|
+
}
|
|
25014
|
+
]
|
|
24672
25015
|
}
|
|
24673
25016
|
],
|
|
24674
25017
|
"api": [
|
|
@@ -24709,7 +25052,11 @@
|
|
|
24709
25052
|
"examples": [
|
|
24710
25053
|
{
|
|
24711
25054
|
"name": "value-flash/basic",
|
|
24712
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {
|
|
25055
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport {\n ValueFlash,\n ValueFlashChange,\n type ValueFlashChangeDirection,\n} from \"@dodopayments/ui/value-flash\";\nimport { useState } from \"react\";\n\nconst usd = new Intl.NumberFormat(\"en-US\", { style: \"currency\", currency: \"USD\" });\nconst percent = new Intl.NumberFormat(\"en-US\", { style: \"percent\", maximumFractionDigits: 1 });\n\ninterface Change {\n direction: ValueFlashChangeDirection;\n /** The last change as a share of the previous value, without a sign; none when nothing changed. */\n value?: string;\n}\n\nexport default function ValueFlashBasic() {\n const [value, setValue] = useState(1204.5);\n const [change, setChange] = useState<Change>({ direction: \"neutral\" });\n\n /** Moves the balance by `delta` (0 for no change) and shows the move in the change chip. */\n const move = (delta: number) => {\n setValue((current) => current + delta);\n setChange(\n delta === 0\n ? { direction: \"neutral\" }\n : {\n direction: delta > 0 ? \"up\" : \"down\",\n value: percent.format(Math.abs(delta) / value),\n },\n );\n };\n\n return (\n <div className=\"flex flex-col items-center gap-3\">\n <div className=\"flex items-center gap-2\">\n <ValueFlash value={value} format={(v) => usd.format(v)} label=\"Balance\" />\n <ValueFlashChange\n direction={change.direction}\n value={change.value}\n label={change.direction === \"up\" ? \"Increased by\" : \"Decreased by\"}\n />\n </div>\n <div className=\"flex gap-2\">\n <Button variant=\"secondary\" onClick={() => move(-25)}>\n Down\n </Button>\n <Button variant=\"secondary\" onClick={() => move(0)}>\n No change\n </Button>\n <Button variant=\"secondary\" onClick={() => move(25)}>\n Up\n </Button>\n </div>\n </div>\n );\n}"
|
|
25056
|
+
},
|
|
25057
|
+
{
|
|
25058
|
+
"name": "value-flash/change",
|
|
25059
|
+
"code": "\"use client\";\n\nimport { ValueFlashChange } from \"@dodopayments/ui/value-flash\";\n\nexport default function ValueFlashChangeExample() {\n return (\n <div className=\"flex flex-wrap items-center gap-3\">\n <ValueFlashChange direction=\"up\" value=\"24%\" label=\"Increased by\" />\n <ValueFlashChange direction=\"down\" value=\"3.2%\" label=\"Decreased by\" />\n <ValueFlashChange direction=\"up\" value=\"8.1%\" tone=\"error\" label=\"Increased by\" />\n <ValueFlashChange direction=\"neutral\" />\n </div>\n );\n}"
|
|
24713
25060
|
},
|
|
24714
25061
|
{
|
|
24715
25062
|
"name": "value-flash/ticker",
|
|
@@ -26052,7 +26399,7 @@
|
|
|
26052
26399
|
},
|
|
26053
26400
|
{
|
|
26054
26401
|
"name": "details-panel/rows",
|
|
26055
|
-
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { DetailsPanel } from \"@dodopayments/ui/details-panel\";\n\nexport default function DetailsPanelRows() {\n return (\n <DetailsPanel\n className=\"w-full max-w-md\"\n layout=\"rows\"\n title=\"Payout schedule\"\n description=\"When your balance is paid out to your bank account.\"\n emptyValue=\"Not added\"\n sections={[\n {\n items: [\n {\n label: \"Minimum payout\",\n value: \"$50.00\",\n action: (\n <Button variant=\"
|
|
26402
|
+
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { DetailsPanel } from \"@dodopayments/ui/details-panel\";\n\nexport default function DetailsPanelRows() {\n return (\n <DetailsPanel\n className=\"w-full max-w-md\"\n layout=\"rows\"\n title=\"Payout schedule\"\n description=\"When your balance is paid out to your bank account.\"\n emptyValue=\"Not added\"\n sections={[\n {\n items: [\n {\n label: \"Minimum payout\",\n value: \"$50.00\",\n action: (\n <Button variant=\"link\" size=\"xs\" aria-label=\"Edit minimum payout\">\n Edit\n </Button>\n ),\n },\n { label: \"Payout cycle\", value: \"Oct 1 – Oct 15\" },\n { label: \"Next payout\", value: \"Oct 22, 2026\" },\n { label: \"Frequency\", value: \"Twice a month\" },\n { label: \"Tax form\", value: null },\n ],\n },\n ]}\n />\n );\n}"
|
|
26056
26403
|
}
|
|
26057
26404
|
],
|
|
26058
26405
|
"docsUrl": "/blocks/details-panel"
|
|
@@ -26968,7 +27315,7 @@
|
|
|
26968
27315
|
"title": "Stat Card",
|
|
26969
27316
|
"category": "Blocks",
|
|
26970
27317
|
"status": "stable",
|
|
26971
|
-
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend
|
|
27318
|
+
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).\n`loading` shows Skeleton lines, `empty` shows \"-\" and a reason, and `error` (with `onRetry`) a retry; what replaces\nthe loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. Renders a `<section>`\nlabelled by the label.",
|
|
26972
27319
|
"importPath": "@dodopayments/ui/stat-card",
|
|
26973
27320
|
"exports": [
|
|
26974
27321
|
"DODO_STAT_GRID_DEFAULT_VARIANTS",
|
|
@@ -26988,7 +27335,7 @@
|
|
|
26988
27335
|
"parts": [
|
|
26989
27336
|
{
|
|
26990
27337
|
"name": "StatCard",
|
|
26991
|
-
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend
|
|
27338
|
+
"description": "A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional\ntrend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).\n`loading` shows Skeleton lines, `empty` shows \"-\" and a reason, and `error` (with `onRetry`) a retry; what replaces\nthe loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. Renders a `<section>`\nlabelled by the label.",
|
|
26992
27339
|
"props": [
|
|
26993
27340
|
{
|
|
26994
27341
|
"name": "label",
|
|
@@ -27015,7 +27362,7 @@
|
|
|
27015
27362
|
"name": "error",
|
|
27016
27363
|
"type": "ReactNode",
|
|
27017
27364
|
"required": false,
|
|
27018
|
-
"description": "Show the error state instead of the value: `true` shows the default heading; text or a node is
|
|
27365
|
+
"description": "Show the error state instead of the value: a small left-aligned heading with an error icon, and \"Try again\" with\n`onRetry`. `true` shows the default heading; text or a node is the reason, read to screen readers after the\nheading. Ignored while `loading`.",
|
|
27019
27366
|
"source": "dodo"
|
|
27020
27367
|
},
|
|
27021
27368
|
{
|
|
@@ -27081,7 +27428,7 @@
|
|
|
27081
27428
|
"name": "trend",
|
|
27082
27429
|
"type": "StatCardTrend",
|
|
27083
27430
|
"required": false,
|
|
27084
|
-
"description": "The change: a success (up) or error (down)
|
|
27431
|
+
"description": "The change: a success (up) or error (down) chip before the comparison. Show it only with a comparison.",
|
|
27085
27432
|
"source": "dodo"
|
|
27086
27433
|
},
|
|
27087
27434
|
{
|
|
@@ -27171,7 +27518,7 @@
|
|
|
27171
27518
|
"examples": [
|
|
27172
27519
|
{
|
|
27173
27520
|
"name": "stat-card/basic",
|
|
27174
|
-
"code": "\"use client\";\n\nimport { StatCard, StatGrid } from \"@dodopayments/ui/stat-card\";\n\nexport default function StatCardBasic() {\n return (\n <StatGrid>\n <StatCard\n label=\"Successful payments\"\n help=\"Payments that succeeded in this period, after retries.\"\n value=\"1,240\"\n trend={{ value: \"12.4%\", direction: \"up\" }}\n comparison=\"vs last 30 days\"\n />\n <StatCard\n label=\"Refunds\"\n help=\"Money returned to customers. Growth is bad here, so the trend is inverted.\"\n value=\"$1,920.00\"\n trend={{ value: \"8.1%\", direction: \"up\", invert: true }}\n comparison=\"vs last 30 days\"\n />\n <StatCard
|
|
27521
|
+
"code": "\"use client\";\n\nimport { StatCard, StatGrid } from \"@dodopayments/ui/stat-card\";\n\nexport default function StatCardBasic() {\n return (\n <StatGrid>\n <StatCard\n label=\"Successful payments\"\n help=\"Payments that succeeded in this period, after retries.\"\n value=\"1,240\"\n trend={{ value: \"12.4%\", direction: \"up\" }}\n comparison=\"vs last 30 days\"\n />\n <StatCard\n label=\"Refunds\"\n help=\"Money returned to customers. Growth is bad here, so the trend is inverted.\"\n value=\"$1,920.00\"\n trend={{ value: \"8.1%\", direction: \"up\", invert: true }}\n comparison=\"vs last 30 days\"\n />\n <StatCard\n label=\"Failed payments\"\n help=\"Payments that failed after every retry. No change from the last period shows a grey -%.\"\n value=\"18\"\n trend={{ direction: \"neutral\" }}\n comparison=\"vs last 30 days\"\n />\n </StatGrid>\n );\n}"
|
|
27175
27522
|
},
|
|
27176
27523
|
{
|
|
27177
27524
|
"name": "stat-card/master",
|
|
@@ -27179,7 +27526,7 @@
|
|
|
27179
27526
|
},
|
|
27180
27527
|
{
|
|
27181
27528
|
"name": "stat-card/next-payout",
|
|
27182
|
-
"code": "\"use client\";\n\nimport { buttonVariants } from \"@dodopayments/ui/button\";\nimport { Money } from \"@dodopayments/ui/money\";\nimport { StatCard } from \"@dodopayments/ui/stat-card\";\nimport {
|
|
27529
|
+
"code": "\"use client\";\n\nimport { buttonVariants } from \"@dodopayments/ui/button\";\nimport { Money } from \"@dodopayments/ui/money\";\nimport { StatCard } from \"@dodopayments/ui/stat-card\";\nimport { Timestamp } from \"@dodopayments/ui/timestamp\";\n\n/** A payout summary: the amount, when it arrives and where (last four only). */\nexport default function StatCardNextPayout() {\n return (\n <StatCard\n className=\"w-full max-w-sm\"\n label=\"Next payout\"\n value={<Money minor={482_000} currency=\"USD\" display=\"symbolAndCode\" tone=\"neutral\" />}\n >\n <dl className=\"flex flex-col gap-2 pt-2 text-body-primary\">\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <dt className=\"text-muted-foreground\">Arrival date</dt>\n <dd>\n <Timestamp value=\"2026-10-29T00:00:00Z\" format=\"date\" timeZone=\"UTC\" />\n </dd>\n </div>\n <div className=\"flex flex-wrap items-center justify-between gap-2\">\n <dt className=\"text-muted-foreground\">Destination</dt>\n <dd>HDFC Bank •••• 4821</dd>\n </div>\n </dl>\n <a\n href=\"#payouts\"\n className={buttonVariants({ variant: \"secondary\", size: \"xs\" }, \"mt-2 self-start\")}\n >\n View payout\n </a>\n </StatCard>\n );\n}"
|
|
27183
27530
|
},
|
|
27184
27531
|
{
|
|
27185
27532
|
"name": "stat-card/states",
|
|
@@ -27313,7 +27660,7 @@
|
|
|
27313
27660
|
},
|
|
27314
27661
|
{
|
|
27315
27662
|
"name": "SettingsLinkCard",
|
|
27316
|
-
"description": "A navigation tile for a settings index page
|
|
27663
|
+
"description": "A navigation tile for a settings index page: an icon tile, a title and a description with a trailing chevron.",
|
|
27317
27664
|
"props": [
|
|
27318
27665
|
{
|
|
27319
27666
|
"name": "title",
|
|
@@ -27444,10 +27791,6 @@
|
|
|
27444
27791
|
{
|
|
27445
27792
|
"name": "settings-section/basic",
|
|
27446
27793
|
"code": "\"use client\";\n\nimport { Button } from \"@dodopayments/ui/button\";\nimport { SettingRow, SettingsSection, SettingToggleRow } from \"@dodopayments/ui/settings-section\";\n\nexport default function SettingsSectionBasic() {\n return (\n <SettingsSection\n className=\"w-full max-w-2xl\"\n title=\"Security\"\n description=\"How you sign in and when we alert you about activity on your account.\"\n >\n <SettingRow\n title=\"Password\"\n description=\"Last changed 3 months ago.\"\n control={\n <Button variant=\"secondary\">\n Change password\n </Button>\n }\n />\n <SettingToggleRow\n title=\"Two-factor authentication\"\n description=\"Ask for a code from your authenticator app every time you sign in.\"\n tooltip=\"Owners and admins must keep two-factor authentication on.\"\n defaultChecked\n />\n <SettingToggleRow\n title=\"New device alerts\"\n description=\"Email me when my account signs in from a device it has not seen before.\"\n defaultChecked\n />\n <SettingRow\n title=\"Active sessions\"\n description=\"Signed in on 3 devices, including this one.\"\n control={\n <Button variant=\"secondary\">\n Sign out other devices\n </Button>\n }\n />\n </SettingsSection>\n );\n}"
|
|
27447
|
-
},
|
|
27448
|
-
{
|
|
27449
|
-
"name": "settings-section/links",
|
|
27450
|
-
"code": "\"use client\";\n\nimport {\n BellIcon,\n GreekTempleIcon,\n HouseIcon,\n KeyIcon,\n ReceiptIcon,\n UsersIcon,\n} from \"@dodopayments/ui/icons\";\nimport { SettingsLinkCard } from \"@dodopayments/ui/settings-section\";\n\nexport default function SettingsSectionLinks() {\n return (\n <div className=\"grid w-full max-w-3xl gap-3 sm:grid-cols-2\">\n <SettingsLinkCard\n href=\"#business\"\n icon={<HouseIcon />}\n title=\"Business profile\"\n description=\"Legal name, address and support email.\"\n />\n <SettingsLinkCard\n href=\"#payouts\"\n icon={<GreekTempleIcon />}\n title=\"Payouts\"\n description=\"Bank accounts, payout schedule and minimum payout.\"\n />\n <SettingsLinkCard\n href=\"#team\"\n icon={<UsersIcon />}\n title=\"Team\"\n description=\"Invite teammates and choose what they can do.\"\n />\n <SettingsLinkCard\n href=\"#notifications\"\n icon={<BellIcon />}\n title=\"Notifications\"\n description=\"Emails for payments, disputes and payouts.\"\n />\n <SettingsLinkCard\n href=\"#developers\"\n icon={<KeyIcon />}\n title=\"API keys\"\n description=\"Keys and webhooks for your integration.\"\n />\n <SettingsLinkCard\n disabled\n icon={<ReceiptIcon />}\n title=\"Tax forms\"\n description=\"Available once your business is verified.\"\n />\n </div>\n );\n}"
|
|
27451
27794
|
}
|
|
27452
27795
|
],
|
|
27453
27796
|
"docsUrl": "/blocks/settings-section"
|