@dodopayments/ui 1.3.0 → 1.5.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/ai/component-registry.json +642 -99
- package/ai/component-registry.md +4 -0
- package/ai/components/activity-timeline.md +3 -1
- package/ai/components/area-chart.md +4 -4
- package/ai/components/avatar.md +1 -1
- package/ai/components/bar-chart.md +18 -18
- package/ai/components/brand-logos.md +1 -1
- package/ai/components/button-group.md +65 -0
- package/ai/components/chart-tooltip.md +3 -3
- package/ai/components/chart.md +6 -6
- package/ai/components/checkout-page.md +1 -1
- package/ai/components/collapsible.md +1 -1
- package/ai/components/color-input.md +56 -0
- package/ai/components/composed-chart.md +7 -7
- package/ai/components/copyable-id.md +1 -0
- package/ai/components/data-grid.md +8 -5
- package/ai/components/file-upload.md +25 -1
- package/ai/components/filter-grid.md +4 -7
- package/ai/components/funnel-chart.md +14 -12
- package/ai/components/gauge-chart.md +9 -11
- package/ai/components/line-chart.md +2 -2
- package/ai/components/list-toolbar.md +3 -3
- package/ai/components/logo.md +3 -1
- package/ai/components/money.md +3 -3
- package/ai/components/pagination.md +1 -0
- package/ai/components/pie-chart.md +11 -2
- package/ai/components/product-card.md +2 -1
- package/ai/components/radio-group.md +85 -6
- package/ai/components/reorder-list.md +1 -1
- package/ai/components/ring-chart.md +17 -8
- package/ai/components/sale-share-card.md +48 -0
- package/ai/components/sankey-chart.md +23 -23
- package/ai/components/scaled-frame.md +41 -0
- package/ai/components/skeleton.md +1 -1
- package/ai/components/stat-card.md +32 -5
- package/ai/components/sunburst-chart.md +7 -4
- package/ai/components/test-mode-banner.md +3 -3
- package/ai/skills/dodo-charts/SKILL.md +12 -7
- package/ai/skills/dodo-design/SKILL.md +4 -2
- package/dist/components/activity-timeline/activity-timeline.d.ts +22 -2
- package/dist/components/activity-timeline/activity-timeline.d.ts.map +1 -1
- package/dist/components/activity-timeline/activity-timeline.js +11 -5
- package/dist/components/activity-timeline/activity-timeline.js.map +1 -1
- package/dist/components/avatar/avatar.d.ts +9 -7
- package/dist/components/avatar/avatar.d.ts.map +1 -1
- package/dist/components/avatar/avatar.js +9 -7
- package/dist/components/avatar/avatar.js.map +1 -1
- package/dist/components/brand-logos/brand-artwork.d.ts +16 -1
- package/dist/components/brand-logos/brand-artwork.d.ts.map +1 -1
- package/dist/components/brand-logos/brand-artwork.js +16 -1
- package/dist/components/brand-logos/brand-artwork.js.map +1 -1
- package/dist/components/brand-logos/brand-logos.d.ts +2 -2
- package/dist/components/brand-logos/brand-logos.d.ts.map +1 -1
- package/dist/components/brand-logos/brand-logos.js +7 -1
- package/dist/components/brand-logos/brand-logos.js.map +1 -1
- package/dist/components/button-group/button-group.d.ts +21 -0
- package/dist/components/button-group/button-group.d.ts.map +1 -0
- package/dist/components/button-group/button-group.js +16 -0
- package/dist/components/button-group/button-group.js.map +1 -0
- package/dist/components/button-group/index.d.ts +2 -0
- package/dist/components/button-group/index.d.ts.map +1 -0
- package/dist/components/button-group/index.js +2 -0
- package/dist/components/button-group/index.js.map +1 -0
- package/dist/components/color-input/color-input.d.ts +21 -0
- package/dist/components/color-input/color-input.d.ts.map +1 -0
- package/dist/components/color-input/color-input.js +28 -0
- package/dist/components/color-input/color-input.js.map +1 -0
- package/dist/components/color-input/index.d.ts +2 -0
- package/dist/components/color-input/index.d.ts.map +1 -0
- package/dist/components/color-input/index.js +2 -0
- package/dist/components/color-input/index.js.map +1 -0
- package/dist/components/copyable-id/copyable-id.d.ts +7 -1
- package/dist/components/copyable-id/copyable-id.d.ts.map +1 -1
- package/dist/components/copyable-id/copyable-id.js +21 -3
- package/dist/components/copyable-id/copyable-id.js.map +1 -1
- package/dist/components/data-grid/bulk-actions.d.ts +4 -2
- package/dist/components/data-grid/bulk-actions.d.ts.map +1 -1
- package/dist/components/data-grid/bulk-actions.js +65 -4
- package/dist/components/data-grid/bulk-actions.js.map +1 -1
- package/dist/components/data-grid/data-grid.d.ts +15 -4
- package/dist/components/data-grid/data-grid.d.ts.map +1 -1
- package/dist/components/data-grid/data-grid.js +57 -16
- package/dist/components/data-grid/data-grid.js.map +1 -1
- package/dist/components/data-grid/table.d.ts +1 -1
- package/dist/components/data-grid/table.d.ts.map +1 -1
- package/dist/components/data-grid/table.js +6 -1
- package/dist/components/data-grid/table.js.map +1 -1
- package/dist/components/file-upload/file-upload.d.ts +21 -0
- package/dist/components/file-upload/file-upload.d.ts.map +1 -1
- package/dist/components/file-upload/file-upload.js +42 -20
- package/dist/components/file-upload/file-upload.js.map +1 -1
- package/dist/components/file-upload/index.d.ts +1 -1
- package/dist/components/file-upload/index.d.ts.map +1 -1
- package/dist/components/file-upload/index.js +1 -1
- package/dist/components/file-upload/index.js.map +1 -1
- package/dist/components/filter-grid/filter-grid.d.ts +7 -2
- package/dist/components/filter-grid/filter-grid.d.ts.map +1 -1
- package/dist/components/filter-grid/filter-grid.js +3 -2
- package/dist/components/filter-grid/filter-grid.js.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.d.ts +3 -2
- package/dist/components/funnel-chart/funnel-chart.d.ts.map +1 -1
- package/dist/components/funnel-chart/funnel-chart.js +3 -2
- package/dist/components/funnel-chart/funnel-chart.js.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.d.ts +3 -4
- package/dist/components/gauge-chart/gauge-chart.d.ts.map +1 -1
- package/dist/components/gauge-chart/gauge-chart.js +3 -4
- package/dist/components/gauge-chart/gauge-chart.js.map +1 -1
- package/dist/components/list-toolbar/list-toolbar.d.ts +3 -3
- package/dist/components/list-toolbar/list-toolbar.js +4 -4
- package/dist/components/list-toolbar/list-toolbar.js.map +1 -1
- package/dist/components/live-activity/live-activity.d.ts.map +1 -1
- package/dist/components/live-activity/live-activity.js +8 -3
- package/dist/components/live-activity/live-activity.js.map +1 -1
- package/dist/components/logo/logo.d.ts +5 -1
- package/dist/components/logo/logo.d.ts.map +1 -1
- package/dist/components/logo/logo.js +6 -2
- package/dist/components/logo/logo.js.map +1 -1
- package/dist/components/page-header/page-header.d.ts.map +1 -1
- package/dist/components/page-header/page-header.js +4 -2
- package/dist/components/page-header/page-header.js.map +1 -1
- package/dist/components/pagination/pagination.d.ts +7 -1
- package/dist/components/pagination/pagination.d.ts.map +1 -1
- package/dist/components/pagination/pagination.js +7 -4
- package/dist/components/pagination/pagination.js.map +1 -1
- package/dist/components/payment-method-list/payment-method-list.d.ts.map +1 -1
- package/dist/components/payment-method-list/payment-method-list.js +4 -1
- package/dist/components/payment-method-list/payment-method-list.js.map +1 -1
- package/dist/components/product-card/product-card.d.ts +8 -2
- package/dist/components/product-card/product-card.d.ts.map +1 -1
- package/dist/components/product-card/product-card.js +2 -2
- package/dist/components/product-card/product-card.js.map +1 -1
- package/dist/components/radio-group/radio-group.d.ts +28 -6
- package/dist/components/radio-group/radio-group.d.ts.map +1 -1
- package/dist/components/radio-group/radio-group.js +37 -4
- package/dist/components/radio-group/radio-group.js.map +1 -1
- package/dist/components/sale-share-card/index.d.ts +2 -0
- package/dist/components/sale-share-card/index.d.ts.map +1 -0
- package/dist/components/sale-share-card/index.js +2 -0
- package/dist/components/sale-share-card/index.js.map +1 -0
- package/dist/components/sale-share-card/sale-share-card.d.ts +27 -0
- package/dist/components/sale-share-card/sale-share-card.d.ts.map +1 -0
- package/dist/components/sale-share-card/sale-share-card.js +46 -0
- package/dist/components/sale-share-card/sale-share-card.js.map +1 -0
- package/dist/components/sankey-chart/sankey-chart.d.ts +4 -4
- package/dist/components/sankey-chart/sankey-chart.js +4 -4
- package/dist/components/scaled-frame/index.d.ts +2 -0
- package/dist/components/scaled-frame/index.d.ts.map +1 -0
- package/dist/components/scaled-frame/index.js +2 -0
- package/dist/components/scaled-frame/index.js.map +1 -0
- package/dist/components/scaled-frame/scaled-frame.d.ts +17 -0
- package/dist/components/scaled-frame/scaled-frame.d.ts.map +1 -0
- package/dist/components/scaled-frame/scaled-frame.js +43 -0
- package/dist/components/scaled-frame/scaled-frame.js.map +1 -0
- package/dist/components/skeleton/skeleton.d.ts +1 -1
- package/dist/components/skeleton/skeleton.d.ts.map +1 -1
- package/dist/components/skeleton/skeleton.js +13 -9
- package/dist/components/skeleton/skeleton.js.map +1 -1
- package/dist/components/slider/slider-thumb.d.ts +2 -2
- package/dist/components/slider/slider-thumb.d.ts.map +1 -1
- package/dist/components/slider/slider-thumb.js +2 -2
- package/dist/components/slider/slider-thumb.js.map +1 -1
- package/dist/components/slider/slider.js +1 -1
- package/dist/components/slider/slider.js.map +1 -1
- package/dist/components/stat-card/index.d.ts +1 -1
- package/dist/components/stat-card/index.d.ts.map +1 -1
- package/dist/components/stat-card/index.js +1 -1
- package/dist/components/stat-card/index.js.map +1 -1
- package/dist/components/stat-card/stat-card.d.ts +47 -7
- package/dist/components/stat-card/stat-card.d.ts.map +1 -1
- package/dist/components/stat-card/stat-card.js +72 -12
- package/dist/components/stat-card/stat-card.js.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.d.ts +2 -1
- package/dist/components/sunburst-chart/sunburst-chart.d.ts.map +1 -1
- package/dist/components/sunburst-chart/sunburst-chart.js +2 -1
- package/dist/components/sunburst-chart/sunburst-chart.js.map +1 -1
- package/dist/components/timestamp/timestamp.js +1 -1
- package/dist/components/timestamp/timestamp.js.map +1 -1
- package/dist/icons/index.d.ts +5 -2
- package/dist/icons/index.js +5 -2
- package/dist/icons/ui/coins.d.ts +3 -0
- package/dist/icons/ui/coins.js +5 -0
- package/dist/icons/ui/report.d.ts +3 -0
- package/dist/icons/ui/report.js +5 -0
- package/dist/icons/ui/ticket.d.ts +3 -0
- package/dist/icons/ui/ticket.js +5 -0
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +1 -0
- package/dist/index.js.map +1 -1
- package/dist/lib/cn-tables.js +5 -5
- package/dist/lib/cn-tables.js.map +1 -1
- package/dist/primitives/charts/area-chart.js +1 -1
- package/dist/primitives/charts/area-chart.js.map +1 -1
- package/dist/primitives/charts/area.d.ts +1 -1
- package/dist/primitives/charts/area.d.ts.map +1 -1
- package/dist/primitives/charts/bar-chart.js +1 -1
- package/dist/primitives/charts/bar-chart.js.map +1 -1
- package/dist/primitives/charts/bar-squares.d.ts +1 -1
- package/dist/primitives/charts/bar-squares.d.ts.map +1 -1
- package/dist/primitives/charts/bar.d.ts +6 -5
- package/dist/primitives/charts/bar.d.ts.map +1 -1
- package/dist/primitives/charts/bar.js +1 -1
- package/dist/primitives/charts/bar.js.map +1 -1
- package/dist/primitives/charts/chart-context.js +2 -2
- package/dist/primitives/charts/chart-context.js.map +1 -1
- package/dist/primitives/charts/composed-chart.js +3 -3
- package/dist/primitives/charts/composed-chart.js.map +1 -1
- package/dist/primitives/charts/funnel-chart.d.ts +12 -8
- package/dist/primitives/charts/funnel-chart.d.ts.map +1 -1
- package/dist/primitives/charts/funnel-chart.js +38 -9
- package/dist/primitives/charts/funnel-chart.js.map +1 -1
- package/dist/primitives/charts/gauge.d.ts +4 -4
- package/dist/primitives/charts/gauge.js +7 -7
- package/dist/primitives/charts/gauge.js.map +1 -1
- package/dist/primitives/charts/line-chart.js +1 -1
- package/dist/primitives/charts/line-chart.js.map +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.d.ts.map +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.js +1 -1
- package/dist/primitives/charts/line-series-terminal-marker.js.map +1 -1
- package/dist/primitives/charts/line.d.ts +1 -1
- package/dist/primitives/charts/line.d.ts.map +1 -1
- package/dist/primitives/charts/notch-gauge-shared.d.ts.map +1 -1
- package/dist/primitives/charts/notch-gauge-shared.js +4 -3
- package/dist/primitives/charts/notch-gauge-shared.js.map +1 -1
- package/dist/primitives/charts/pie-context.d.ts +3 -2
- package/dist/primitives/charts/pie-context.d.ts.map +1 -1
- package/dist/primitives/charts/pie-context.js +7 -6
- package/dist/primitives/charts/pie-context.js.map +1 -1
- package/dist/primitives/charts/pie-slice.d.ts +2 -2
- package/dist/primitives/charts/pie-slice.js +1 -1
- package/dist/primitives/charts/pie-slice.js.map +1 -1
- package/dist/primitives/charts/ring-context.d.ts +4 -2
- package/dist/primitives/charts/ring-context.d.ts.map +1 -1
- package/dist/primitives/charts/ring-context.js +8 -6
- package/dist/primitives/charts/ring-context.js.map +1 -1
- package/dist/primitives/charts/ring.d.ts +8 -8
- package/dist/primitives/charts/ring.d.ts.map +1 -1
- package/dist/primitives/charts/ring.js +4 -4
- package/dist/primitives/charts/ring.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.d.ts +9 -10
- package/dist/primitives/charts/sankey/sankey-link.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-link.js +14 -9
- package/dist/primitives/charts/sankey/sankey-link.js.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.d.ts +5 -5
- package/dist/primitives/charts/sankey/sankey-node.d.ts.map +1 -1
- package/dist/primitives/charts/sankey/sankey-node.js +6 -6
- package/dist/primitives/charts/sankey/sankey-node.js.map +1 -1
- package/dist/primitives/charts/series-bar.d.ts +4 -4
- package/dist/primitives/charts/series-bar.d.ts.map +1 -1
- package/dist/primitives/charts/series-bar.js +1 -1
- package/dist/primitives/charts/series-bar.js.map +1 -1
- package/dist/primitives/charts/sunburst-context.d.ts +3 -2
- package/dist/primitives/charts/sunburst-context.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-context.js +6 -5
- package/dist/primitives/charts/sunburst-context.js.map +1 -1
- package/dist/primitives/charts/sunburst-legend.d.ts +7 -2
- package/dist/primitives/charts/sunburst-legend.d.ts.map +1 -1
- package/dist/primitives/charts/sunburst-legend.js +8 -6
- package/dist/primitives/charts/sunburst-legend.js.map +1 -1
- package/dist/primitives/charts/sunburst-segment.d.ts +3 -3
- package/dist/primitives/charts/sunburst-segment.js +2 -2
- package/dist/primitives/charts/sunburst-segment.js.map +1 -1
- package/dist/primitives/charts/tooltip/date-ticker.js +2 -2
- package/dist/primitives/charts/tooltip/date-ticker.js.map +1 -1
- package/dist/primitives/charts/tooltip/tooltip-box.js +1 -1
- package/dist/primitives/charts/tooltip/tooltip-box.js.map +1 -1
- package/dist/primitives/ui/alert-dialog.js +1 -1
- package/dist/primitives/ui/alert-dialog.js.map +1 -1
- package/dist/primitives/ui/autocomplete.js +1 -1
- package/dist/primitives/ui/autocomplete.js.map +1 -1
- package/dist/primitives/ui/dialog.js +1 -1
- package/dist/primitives/ui/dialog.js.map +1 -1
- package/dist/primitives/ui/drawer.js +1 -1
- package/dist/primitives/ui/drawer.js.map +1 -1
- package/dist/primitives/ui/popover.js +1 -1
- package/dist/primitives/ui/popover.js.map +1 -1
- package/dist/primitives/ui/preview-card.js +1 -1
- package/dist/primitives/ui/preview-card.js.map +1 -1
- package/dist/primitives/ui/sheet.js +2 -2
- package/dist/primitives/ui/sheet.js.map +1 -1
- package/dist/primitives/ui/slider.js +1 -1
- package/dist/primitives/ui/slider.js.map +1 -1
- package/dist/primitives/ui/switch.d.ts +1 -1
- package/dist/primitives/ui/switch.d.ts.map +1 -1
- package/dist/primitives/ui/switch.js +1 -1
- package/dist/primitives/ui/switch.js.map +1 -1
- package/dist/primitives/ui/table.js +2 -2
- package/dist/primitives/ui/table.js.map +1 -1
- package/dist/primitives/ui/toast.js +2 -2
- package/dist/primitives/ui/toast.js.map +1 -1
- package/dist/primitives/ui/tooltip.js +1 -1
- package/dist/primitives/ui/tooltip.js.map +1 -1
- package/dist/styles/theme.css +9 -0
- package/dist/styles/tokens.css +96 -36
- package/dist/styles/tokens.test.tsx +20 -2
- package/dist/theme/color.d.ts +5 -0
- package/dist/theme/color.d.ts.map +1 -1
- package/dist/theme/color.js +22 -0
- package/dist/theme/color.js.map +1 -1
- package/dist/theme/css.d.ts +3 -3
- package/dist/theme/css.d.ts.map +1 -1
- package/dist/theme/css.js +29 -11
- package/dist/theme/css.js.map +1 -1
- package/package.json +1 -1
|
@@ -4,8 +4,9 @@ Drop-off through the stages of a flow (visited, started checkout, paid), on the
|
|
|
4
4
|
`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,
|
|
5
5
|
first stage first; each segment is sized as a share of the first stage and shows its value, a
|
|
6
6
|
percentage chip and the stage label, and each boundary shows the step conversion ("→ 54%") from the
|
|
7
|
-
stage before. Segments
|
|
8
|
-
|
|
7
|
+
stage before. Segments are solid by default: a full-colour core inside faint halo bands (`layers` rings);
|
|
8
|
+
`variant="tint"` gives the wash of the tint look (20% with a solid 2px edge on the outer sides). Each stage takes the
|
|
9
|
+
next palette colour unless `color` sets one. Segments grow in with a stagger on mount; hovering one dims
|
|
9
10
|
the others. `orientation="vertical"` stacks the stages top to bottom; `grid` adds background bands
|
|
10
11
|
and divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading
|
|
11
12
|
state and renders an empty frame when `data` is empty.
|
|
@@ -20,8 +21,9 @@ Drop-off through the stages of a flow (visited, started checkout, paid), on the
|
|
|
20
21
|
`FunnelChart` primitive. `data` is a list of `{ label, value, displayValue?, color?, gradient? }`,
|
|
21
22
|
first stage first; each segment is sized as a share of the first stage and shows its value, a
|
|
22
23
|
percentage chip and the stage label, and each boundary shows the step conversion ("→ 54%") from the
|
|
23
|
-
stage before. Segments
|
|
24
|
-
|
|
24
|
+
stage before. Segments are solid by default: a full-colour core inside faint halo bands (`layers` rings);
|
|
25
|
+
`variant="tint"` gives the wash of the tint look (20% with a solid 2px edge on the outer sides). Each stage takes the
|
|
26
|
+
next palette colour unless `color` sets one. Segments grow in with a stagger on mount; hovering one dims
|
|
25
27
|
the others. `orientation="vertical"` stacks the stages top to bottom; `grid` adds background bands
|
|
26
28
|
and divider lines. Height comes from the aspect ratio unless a class sets it. It has no loading
|
|
27
29
|
state and renders an empty frame when `data` is empty.
|
|
@@ -31,7 +33,7 @@ state and renders an empty frame when `data` is empty.
|
|
|
31
33
|
| `data` (required) | `FunnelStage[]` | - | |
|
|
32
34
|
| `label` (required) | `string` | - | Accessible name of the chart, e.g. "Checkout funnel, last 30 days". Set as `aria-label` on the `role="figure"` frame. The stage values, percentages and labels stay in the page as text. |
|
|
33
35
|
| `className` | `string` | - | Additional Tailwind classes, merged last. |
|
|
34
|
-
| `color` | `string` | - |
|
|
36
|
+
| `color` | `string` | - | One colour for every stage. Without it, each stage takes the next palette colour: `--chart-solid-1` to `--chart-solid-3` (the bar colours), then `--chart-4` and `--chart-5`, repeated. |
|
|
35
37
|
| `conversionLabel` | `string` | - | Screen reader text after the step conversion. Default "of the previous stage" |
|
|
36
38
|
| `edges` | `"curved" \| "straight"` | - | Edge style for the funnel segments. Default "curved" |
|
|
37
39
|
| `enterTransition` | `Transition` | - | Framer Motion transition for segment enter animation |
|
|
@@ -44,7 +46,7 @@ state and renders an empty frame when `data` is empty.
|
|
|
44
46
|
| `labelAlign` | `"center" \| "end" \| "start"` | - | Where the label group sits within the segment cell. - "center" (default), "start", "end" For horizontal funnel: start=top, end=bottom. For vertical funnel: start=left, end=right. |
|
|
45
47
|
| `labelLayout` | `"spread" \| "grouped"` | - | Controls how segment labels (value, percentage, stage name) are arranged. - "spread": Value/percentage/label are spread apart (top/center/bottom for horizontal, left/center/right for vertical). This is the default. - "grouped": All label items stack together in a tight group. When "grouped", use `labelOrientation` and `labelAlign` for full control. |
|
|
46
48
|
| `labelOrientation` | `"vertical" \| "horizontal"` | - | Stack direction of the label group. Only applies when `labelLayout="grouped"`. - "vertical": Items stack top-to-bottom. Default for horizontal funnels. - "horizontal": Items stack left-to-right. Default for vertical funnels. |
|
|
47
|
-
| `layers` | `number` | - |
|
|
49
|
+
| `layers` | `number` | - | Rings of the `"solid"` look: the core plus `layers - 1` halo bands. Default 3 |
|
|
48
50
|
| `onHoverChange` | `((index: number \| null) => void)` | - | Callback when hover state changes |
|
|
49
51
|
| `orientation` | `"vertical" \| "horizontal"` | - | |
|
|
50
52
|
| `renderPattern` | `((id: string, color: string) => ReactNode)` | - | Render a visx pattern definition. Receives a unique `id` string per segment and the resolved `color`. Return a `<PatternLines>` (or any visx pattern) inside an SVG `<defs>`. The component will use `fill="url(#id)"` on the innermost ring while keeping outer halo rings as solid color. |
|
|
@@ -53,7 +55,7 @@ state and renders an empty frame when `data` is empty.
|
|
|
53
55
|
| `showPercentage` | `boolean` | - | |
|
|
54
56
|
| `showValues` | `boolean` | - | |
|
|
55
57
|
| `staggerDelay` | `number` | - | Stagger delay between segments in seconds. Default 0.12 |
|
|
56
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
58
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: a full-colour core inside `layers - 1` faint halo bands, as the bar, pie and ring charts. `"tint"`: each segment an opaque 20% wash of its colour (mixed into the card) with a solid 2px edge along its outer sides. A `renderPattern` fill stays solid. Default: "solid" |
|
|
57
59
|
|
|
58
60
|
## Examples
|
|
59
61
|
|
|
@@ -88,14 +90,14 @@ const compact = new Intl.NumberFormat("en-US", { notation: "compact" });
|
|
|
88
90
|
|
|
89
91
|
// Payouts through review: each stage has its own colour, the last one a gradient.
|
|
90
92
|
const payouts: FunnelStage[] = [
|
|
91
|
-
{ label: "Requested", value: 1_240, color: "var(--chart-
|
|
92
|
-
{ label: "Verified", value: 1_090, color: "var(--chart-
|
|
93
|
-
{ label: "Approved", value: 1_010, color: "var(--chart-
|
|
93
|
+
{ label: "Requested", value: 1_240, color: "var(--chart-solid-2)" },
|
|
94
|
+
{ label: "Verified", value: 1_090, color: "var(--chart-solid-3)" },
|
|
95
|
+
{ label: "Approved", value: 1_010, color: "var(--chart-5)" },
|
|
94
96
|
{
|
|
95
97
|
label: "Paid out",
|
|
96
98
|
value: 980,
|
|
97
99
|
gradient: [
|
|
98
|
-
{ offset: 0, color: "var(--chart-3)" },
|
|
100
|
+
{ offset: 0, color: "var(--chart-solid-3)" },
|
|
99
101
|
{ offset: 1, color: "var(--chart-5)" },
|
|
100
102
|
],
|
|
101
103
|
},
|
|
@@ -136,7 +138,7 @@ export default function FunnelChartVertical() {
|
|
|
136
138
|
data={trials}
|
|
137
139
|
label="Trial to paid funnel, September"
|
|
138
140
|
orientation="vertical"
|
|
139
|
-
color="var(--chart-2)"
|
|
141
|
+
color="var(--chart-solid-2)"
|
|
140
142
|
edges="straight"
|
|
141
143
|
grid
|
|
142
144
|
/>
|
|
@@ -3,10 +3,9 @@
|
|
|
3
3
|
One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track
|
|
4
4
|
(`orientation="linear"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.
|
|
5
5
|
`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc
|
|
6
|
-
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches
|
|
7
|
-
tint look of the other charts (a 20% wash with a solid 3px outer
|
|
8
|
-
|
|
9
|
-
a colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point
|
|
6
|
+
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches are the full
|
|
7
|
+
colour by default; `variant="tint"` gives the tint look of the other charts (a 20% wash with a solid 3px outer
|
|
8
|
+
edge). Set `useGradient` for a colour ramp across the notches (blue to violet unless `activeGradient` sets one), or pass `PatternLines` / `LinearGradient` children and point
|
|
10
9
|
`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role="meter"` with
|
|
11
10
|
`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or
|
|
12
11
|
empty state.
|
|
@@ -20,10 +19,9 @@ import { GaugeChart } from "@dodopayments/ui/gauge-chart";
|
|
|
20
19
|
One value from 0 to 100 as a row of notches, around an arc (default) or along a horizontal track
|
|
21
20
|
(`orientation="linear"`), on the bklit `Gauge` primitive. `value` sets how many notches fill.
|
|
22
21
|
`centerValue` adds an optional animated statistic with a `defaultLabel` caption: in the arc
|
|
23
|
-
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches
|
|
24
|
-
tint look of the other charts (a 20% wash with a solid 3px outer
|
|
25
|
-
|
|
26
|
-
a colour ramp across the notches, or pass `PatternLines` / `LinearGradient` children and point
|
|
22
|
+
centre, or above / below the linear track (`labelPlacement`, `labelAlign`). Filled notches are the full
|
|
23
|
+
colour by default; `variant="tint"` gives the tint look of the other charts (a 20% wash with a solid 3px outer
|
|
24
|
+
edge). Set `useGradient` for a colour ramp across the notches (blue to violet unless `activeGradient` sets one), or pass `PatternLines` / `LinearGradient` children and point
|
|
27
25
|
`activeFill` / `inactiveFill` at them with `url(#id)`. The plot is a `role="meter"` with
|
|
28
26
|
`aria-valuenow`. Notches pop in on mount (instant under reduced motion). It has no loading or
|
|
29
27
|
empty state.
|
|
@@ -63,7 +61,7 @@ empty state.
|
|
|
63
61
|
| `totalNotches` | `number` | - | Number of notches |
|
|
64
62
|
| `uniformWidth` | `boolean` | - | `true` = rectangular notches; `false` = tapered toward center / midline |
|
|
65
63
|
| `useGradient` | `boolean` | - | |
|
|
66
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
64
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: the full colour, as the bar, pie and ring charts. `"tint"`: each filled notch an opaque 20% wash of its colour (mixed into the card) with a solid 3px edge on its outer side. A gradient or pattern `activeFill` (`url(#id)`) and the theme palette gradient stay solid. Default: "solid" |
|
|
67
65
|
| `width` | `number` | - | |
|
|
68
66
|
|
|
69
67
|
## Examples
|
|
@@ -108,7 +106,7 @@ export default function GaugeChartGradient() {
|
|
|
108
106
|
defaultLabel="Auth rate"
|
|
109
107
|
formatOptions={{ style: "percent", maximumFractionDigits: 0 }}
|
|
110
108
|
useGradient
|
|
111
|
-
activeGradient={["var(--chart-2)", "var(--chart-3)"]}
|
|
109
|
+
activeGradient={["var(--chart-solid-2)", "var(--chart-solid-3)"]}
|
|
112
110
|
inactiveFillOpacity={0.4}
|
|
113
111
|
minWidth={240}
|
|
114
112
|
/>
|
|
@@ -164,7 +162,7 @@ export default function GaugeChartLinear() {
|
|
|
164
162
|
totalNotches={50}
|
|
165
163
|
spacing={0}
|
|
166
164
|
notchCornerRadius={3}
|
|
167
|
-
activeFill="var(--chart-2)"
|
|
165
|
+
activeFill="var(--chart-solid-2)"
|
|
168
166
|
inactiveFillOpacity={0.4}
|
|
169
167
|
/>
|
|
170
168
|
</div>
|
|
@@ -71,7 +71,7 @@ the chart loads it draws the loading pulse or sweep.
|
|
|
71
71
|
| `onLoadingPulseCycleComplete` | `(() => void)` | - | Called when a loop-mode pulse cycle completes. |
|
|
72
72
|
| `showHighlight` | `boolean` | - | Whether to show highlight segment on hover. Default: true, false for `variant="comparison"` |
|
|
73
73
|
| `showMarkers` | `boolean` | - | Render scatter-style circle markers at each data point. Default: false |
|
|
74
|
-
| `stroke` | `string` | - | Stroke color. Default: var(--chart-1), or var(--chart-comparison) for `variant="comparison"` |
|
|
74
|
+
| `stroke` | `string` | - | Stroke color. Default: var(--chart-solid-1), or var(--chart-comparison) for `variant="comparison"` |
|
|
75
75
|
| `strokeWidth` | `number` | - | Stroke width. Default: 2 |
|
|
76
76
|
| `variant` | `"default" \| "comparison"` | - | `"default"` draws the metric as a solid line. `"comparison"` draws the period it is compared with (the previous period) as a dashed `--chart-comparison` line with no hover highlight, as the dashboard does. Default: `"default"`. |
|
|
77
77
|
| `yAxisId` | `string \| number` | - | Y-scale group id (Recharts `yAxisId`). Default: `"left"`. |
|
|
@@ -381,7 +381,7 @@ export default function LineChartDefault() {
|
|
|
381
381
|
title="Gross volume"
|
|
382
382
|
rows={(point) => [
|
|
383
383
|
{
|
|
384
|
-
color: "var(--chart-1)",
|
|
384
|
+
color: "var(--chart-solid-1)",
|
|
385
385
|
label: shortDate.format(point.date as Date),
|
|
386
386
|
value: money.format(point.current as number),
|
|
387
387
|
},
|
|
@@ -21,14 +21,14 @@ titles and tabs belong in the Page header, not here.
|
|
|
21
21
|
| Prop | Type | Default | Description |
|
|
22
22
|
| --- | --- | --- | --- |
|
|
23
23
|
| `left` | `ReactNode` | - | Left slot: the search field (`ListToolbarSearch`), a count text or a Refresh button. No other buttons. |
|
|
24
|
-
| `mobileRight` | `ReactNode` | - | What the right slot shows below 42rem (672px) instead of `right`: Filters (holding every filter and the date range) and the page's main action. Defaults to `right`; Edit columns
|
|
24
|
+
| `mobileRight` | `ReactNode` | - | What the right slot shows below 42rem (672px) instead of `right`: Filters (holding every filter and the date range) and the page's main action. Defaults to `right`; Edit columns shows only its icon there. Only one of `right` and `mobileRight` is mounted at a time, so keep filter state in the page (controlled) to carry it across. |
|
|
25
25
|
| `right` | `ReactNode` | - | Right slot: every button, in this order: filter dropdowns, Filters (`ListToolbarFilters`), the date range, Edit columns (`ListToolbarColumns`), Build report, then at most one primary action, last. |
|
|
26
26
|
|
|
27
27
|
## ListToolbarColumns
|
|
28
28
|
|
|
29
29
|
Edit columns (Figma: Button secondary lg with the table-cols icon): a `Menu` with a checkbox per column that can
|
|
30
|
-
be hidden, named like its header. The menu stays open while you toggle.
|
|
31
|
-
|
|
30
|
+
be hidden, named like its header. The menu stays open while you toggle. When the toolbar stacks (a phone) it shows
|
|
31
|
+
only its icon; the label still names it.
|
|
32
32
|
|
|
33
33
|
| Prop | Type | Default | Description |
|
|
34
34
|
| --- | --- | --- | --- |
|
package/ai/components/logo.md
CHANGED
|
@@ -19,7 +19,7 @@ image named "Dodo Payments" unless `decorative` hides it from assistive technolo
|
|
|
19
19
|
| `aria-label` | `string` | `"Dodo Payments"` | Accessible name. An empty or whitespace-only value falls back to the default. |
|
|
20
20
|
| `className` | `string` | - | Layout utilities only: margin, position, inset and translate, z-index, display (`hidden`, `block`, `flex`, `inline-block`, `inline-flex`), visibility, order, self-alignment and grid placement, with any responsive or state variant. Every other class (padding, colour, size, opacity, filters) is dropped, and so is any class behind a `*:`, `**:` or arbitrary `[...]:` variant, so the clear space, colours and artwork size stay intact. |
|
|
21
21
|
| `decorative` | `boolean` | `false` | Hides the logo from assistive technology. Use it when visible text next to the logo already says "Dodo Payments". Cannot be combined with `aria-label`. |
|
|
22
|
-
| `size` | `"sm" \| "md" \| "lg"` | `"md"` | `
|
|
22
|
+
| `size` | `"xs" \| "sm" \| "md" \| "lg"` | `"md"` | `xs`: 16px tall artwork with 4px clear space on every side. The smallest size, for a line of small text such as "Secure checkout by".<br>`sm`: 24px tall artwork with 6px clear space on every side.<br>`md`: 32px tall artwork with 8px clear space on every side.<br>`lg`: 48px tall artwork with 12px clear space on every side. |
|
|
23
23
|
| `tone` | `"auto" \| "light" \| "dark"` | `"auto"` | `auto`: Follows the theme: near-black wordmark in light mode, white under `.dark`.<br>`light`: Near-black wordmark in every theme, for surfaces that stay light (a white card, a light photo).<br>`dark`: White wordmark in every theme, for surfaces that stay dark (a black share card, a dark photo). |
|
|
24
24
|
| `variant` | `"lockup" \| "mark" \| "wordmark"` | `"lockup"` | `lockup`: Mark and wordmark side by side. The default for headers, sign-in screens and footers.<br>`mark`: The lime disc with the dodo on its own, for tight spaces such as a collapsed sidebar or an avatar.<br>`wordmark`: The "Dodo Payments" lettering without the mark. Use it only when the mark is already visible nearby. |
|
|
25
25
|
|
|
@@ -69,10 +69,12 @@ export default function LogoSizes() {
|
|
|
69
69
|
className="flex rounded-md outline-none focus-visible:ring-2 focus-visible:ring-ring w-full flex-col items-start gap-4 overflow-x-auto"
|
|
70
70
|
>
|
|
71
71
|
<div className="flex items-center gap-2">
|
|
72
|
+
<Logo variant="mark" size="xs" />
|
|
72
73
|
<Logo variant="mark" size="sm" />
|
|
73
74
|
<Logo variant="mark" size="md" />
|
|
74
75
|
<Logo variant="mark" size="lg" />
|
|
75
76
|
</div>
|
|
77
|
+
<Logo size="xs" />
|
|
76
78
|
<Logo size="sm" />
|
|
77
79
|
<Logo size="md" />
|
|
78
80
|
<Logo size="lg" />
|
package/ai/components/money.md
CHANGED
|
@@ -59,7 +59,7 @@ const rows = [
|
|
|
59
59
|
|
|
60
60
|
export default function MoneyBasic() {
|
|
61
61
|
return (
|
|
62
|
-
<ul className="flex w-full max-w-sm flex-col divide-y divide-border text-
|
|
62
|
+
<ul className="flex w-full max-w-sm flex-col divide-y divide-border text-body-primary">
|
|
63
63
|
{rows.map((row) => (
|
|
64
64
|
<li key={row.label} className="flex items-baseline justify-between gap-4 py-2">
|
|
65
65
|
<span className="text-muted-foreground">{row.label}</span>
|
|
@@ -68,13 +68,13 @@ export default function MoneyBasic() {
|
|
|
68
68
|
currency={row.currency}
|
|
69
69
|
locale={"locale" in row ? row.locale : undefined}
|
|
70
70
|
display={"display" in row ? row.display : undefined}
|
|
71
|
-
className="
|
|
71
|
+
className="text-label-primary"
|
|
72
72
|
/>
|
|
73
73
|
</li>
|
|
74
74
|
))}
|
|
75
75
|
<li className="flex items-baseline justify-between gap-4 py-2">
|
|
76
76
|
<span className="text-muted-foreground">Failed charge</span>
|
|
77
|
-
<Money minor={8900} currency="USD" status="failed" className="
|
|
77
|
+
<Money minor={8900} currency="USD" status="failed" className="text-label-primary" />
|
|
78
78
|
</li>
|
|
79
79
|
</ul>
|
|
80
80
|
);
|
|
@@ -38,6 +38,7 @@ It holds no state: pass the range, `hasPrevious` / `hasNext` and the handlers. F
|
|
|
38
38
|
| `rowsPerPage` | `number` | - | The selected rows per page. |
|
|
39
39
|
| `rowsPerPageOptions` | `readonly number[]` | `[10, 25, 50, 100]` | The choices of the rows-per-page select. A `rowsPerPage` that is not in the list is added to it. |
|
|
40
40
|
| `showRowsPerPage` | `boolean` | `true` | Show the "Rows per page" select. Turn it off for cursor lists, which show "Page N". |
|
|
41
|
+
| `size` | `"default" \| "sm"` | `"default"` | `default` is the Figma footer: Body/Primary labels, a 72 select and 36 arrows. `sm` is a quieter one for dense pages: Body/Secondary labels, a compact select and 24 arrows. |
|
|
41
42
|
|
|
42
43
|
## Examples
|
|
43
44
|
|
|
@@ -56,7 +56,7 @@ fade. The hover index drives `PieCenter` and a linked `Legend`.
|
|
|
56
56
|
| `hoverEffect` | `PieSliceHoverEffect` | - | Hover effect type. Default: "translate" - "translate": Slice moves outward along its radial axis - "grow": Slice extends its outer radius (gets longer) - "none": No hover animation |
|
|
57
57
|
| `hoverOffset` | `number` | - | Distance in pixels for hover effect (translate distance or grow amount). Defaults to PieChart's hoverOffset |
|
|
58
58
|
| `showGlow` | `boolean` | - | Show glow effect on hover. Default: true |
|
|
59
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
59
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: the full colour, as the bars. `"tint"`: an opaque 20% wash of the colour (mixed into the card) with a solid 3px arc on the outer rim. A gradient or pattern `fill` stays solid. Default: "solid" |
|
|
60
60
|
|
|
61
61
|
## PieCenter
|
|
62
62
|
|
|
@@ -193,11 +193,20 @@ const revenue: PieData[] = [
|
|
|
193
193
|
const total = revenue.reduce((sum, row) => sum + row.value, 0);
|
|
194
194
|
const usd = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", maximumFractionDigits: 0 });
|
|
195
195
|
|
|
196
|
+
// The pie's default slice colours, in order: the bars' solid series, then the chart palette.
|
|
197
|
+
const sliceColors = [
|
|
198
|
+
"var(--chart-solid-1)",
|
|
199
|
+
"var(--chart-solid-2)",
|
|
200
|
+
"var(--chart-solid-3)",
|
|
201
|
+
"var(--chart-4)",
|
|
202
|
+
"var(--chart-5)",
|
|
203
|
+
];
|
|
204
|
+
|
|
196
205
|
const legendItems: LegendItemData[] = revenue.map((row, index) => ({
|
|
197
206
|
label: row.label,
|
|
198
207
|
value: row.value,
|
|
199
208
|
maxValue: total,
|
|
200
|
-
color:
|
|
209
|
+
color: sliceColors[index % sliceColors.length] ?? "var(--chart-solid-1)",
|
|
201
210
|
}));
|
|
202
211
|
|
|
203
212
|
export default function PieChartDonut() {
|
|
@@ -23,13 +23,14 @@ now is disabled, and focus follows the swap. Renders an `<article>` labelled by
|
|
|
23
23
|
| `name` (required) | `ReactNode` | - | Product name, the card heading. |
|
|
24
24
|
| `price` (required) | `ReactNode` | - | Preformatted price, e.g. "$29", or "$9+" for pay what you want. |
|
|
25
25
|
| `action` | `ReactNode` | - | Replaces the Purchase flow, e.g. a link styled with `buttonVariants()` or a sold-out note. |
|
|
26
|
+
| `aspect` | `"square" \| "wide"` | `"square"` | Shape of the image (and of the fallback): `square`, as the store front's grid, or `wide` (2:1), as the dashboard's storefront preview lists products. |
|
|
26
27
|
| `badge` | `ReactNode` | - | Pinned to the top-left corner of the image, e.g. "14-day trial". A string renders as a neutral `Badge`; pass a `Badge` for another colour. |
|
|
27
28
|
| `buyLabel` | `ReactNode` | `"Buy now"` | Label of the button next to the quantity stepper. |
|
|
28
29
|
| `compareAtPrice` | `ReactNode` | - | Preformatted original price, struck through before `price`, e.g. "$49". |
|
|
29
30
|
| `compareAtPriceLabel` | `string` | `"Original price"` | Read by screen readers before `compareAtPrice`, which is otherwise only struck through. |
|
|
30
31
|
| `defaultQuantity` | `number` | `1` | Quantity selected when Purchase is pressed. |
|
|
31
32
|
| `description` | `ReactNode` | - | Text the info button slides up over the image. Without it there is no info button. |
|
|
32
|
-
| `image` | `string \| StoreImage` | - | Product image URL, or an image with alt text and a blurred placeholder.
|
|
33
|
+
| `image` | `string \| StoreImage` | - | Product image URL, or an image with alt text and a blurred placeholder. Cropped to fill the `aspect`. |
|
|
33
34
|
| `imageFallback` | `ReactNode` | `A box icon` | Shown in the square when there is no `image`, e.g. an icon for the kind of product. |
|
|
34
35
|
| `infoLabel` | `string` | `"Product details"` | Accessible name of the info button and of the description it reveals. |
|
|
35
36
|
| `interval` | `ReactNode` | - | Preformatted billing interval after the price, e.g. "/month" or "/3 months". |
|
|
@@ -35,22 +35,24 @@ Also accepts Base UI props: `defaultValue`, `disabled`, `form`, `inputRef`, `nam
|
|
|
35
35
|
One option in a `RadioGroup`, identified by `value`. Renders the `Radio` primitive: a `<span role="radio">` plus a
|
|
36
36
|
hidden `<input>`. On its own it is the bare radio: label it by wrapping it and its text in a `<label>`. With `label`
|
|
37
37
|
(and `description`) it renders the whole option, a `<label>` with the text beside the radio, and
|
|
38
|
-
`variant="card"` makes that a card with the radio before the title
|
|
38
|
+
`variant="card"` makes that a card with the radio before the title, `variant="tile"` a checkout payment method
|
|
39
|
+
tile with no visible radio, and `variant="accordion"` a row of the checkout's payment method accordion. It
|
|
40
|
+
presses in while held; an option that is
|
|
39
41
|
selected when it mounts does not animate.
|
|
40
42
|
|
|
41
43
|
| Prop | Type | Default | Description |
|
|
42
44
|
| --- | --- | --- | --- |
|
|
43
45
|
| `className` | `string` | - | Styles the radio. With a `label`, a `description` or `variant="card"`, it styles the option's wrapper instead: the label row, or the card. |
|
|
44
|
-
| `content` | `ReactNode` | - | Card only: content that opens under the
|
|
46
|
+
| `content` | `ReactNode` | - | Card and accordion only: content that opens under the option while it is selected, e.g. the card form of the "Card" method. It mounts only while selected, outside the clickable label, so it can hold inputs and buttons. Needs the option inside a `RadioGroup`. |
|
|
45
47
|
| `description` | `ReactNode` | - | Helper text under the label, announced as the radio's description. |
|
|
46
|
-
| `disabledReason` | `ReactNode` | - | Card only: why the option cannot be picked, e.g. "Not available for subscriptions". Setting it disables the option; the reason shows under the description and is announced with it. |
|
|
48
|
+
| `disabledReason` | `ReactNode` | - | Card, tile and accordion only: why the option cannot be picked, e.g. "Not available for subscriptions". Setting it disables the option; the reason shows under the description and is announced with it. |
|
|
47
49
|
| `icon` | `ReactNode` | - | Card only: a tile (e.g. a `FeaturedIcon`) on a row above the text, with the radio at the row's end. Decorative. |
|
|
48
50
|
| `label` | `ReactNode` | - | The option's text. With it, the radio is wrapped in a `<label>`, so clicking the text selects it. |
|
|
49
|
-
| `logo` | `ReactNode` | - | Card only: a logo before the text, e.g. a `PaymentLogo` for a payment method. Decorative: the label names the option. |
|
|
51
|
+
| `logo` | `ReactNode` | - | Card, tile and accordion only: a logo before the text (above it on a tile), e.g. a `PaymentLogo` for a payment method. Decorative: the label names the option. |
|
|
50
52
|
| `media` | `ReactNode` | - | Card only: a full-bleed preview well (160 tall) above the text, e.g. a sketch of the screen the choice leads to. The radio moves after the title. Decorative: the label names the option. |
|
|
51
|
-
| `note` | `ReactNode` | - | Card only: a fee or discount line under the description (Body/Secondary, Content/Primary), e.g. "+2% fee". |
|
|
53
|
+
| `note` | `ReactNode` | - | Card, tile and accordion only: a fee or discount line under the description (Body/Secondary, Content/Primary), e.g. "+2% fee". |
|
|
52
54
|
| `size` | `"default" \| "lg"` | `"default"` | `default`: 18px circle (16px from `sm`), the default.<br>`lg`: 20px circle with an 8px dot for prominent choices such as plans or payout methods. |
|
|
53
|
-
| `variant` | `"default" \| "card"` | `"default"` | `default`: A 16px radio, with an optional label and description beside it. For lists of options.<br>`card`: 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. |
|
|
55
|
+
| `variant` | `"default" \| "card" \| "accordion" \| "tile"` | `"default"` | `default`: A 16px radio, with an optional label and description beside it. For lists of options.<br>`card`: 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.<br>`accordion`: A row of the single page checkout's payment method accordion: the radio, a `logo` and the label, with `content` opening under the selected row. Rows sit in one bordered box: give the `RadioGroup` `className="gap-0 pointer-coarse:gap-0 overflow-hidden rounded-xl border"`. Needs a `label`.<br>`tile`: A payment method tile, as the checkout draws them: the `logo` above the label, no visible radio. The selected tile takes the theme's primary edge and tint. Needs a `label`. |
|
|
54
56
|
|
|
55
57
|
Also accepts Base UI props: `value`, `disabled`, `inputRef`, `nativeButton`, `readOnly`, `render`, `required`.
|
|
56
58
|
|
|
@@ -137,6 +139,45 @@ export default function RadioGroupMaster() {
|
|
|
137
139
|
}
|
|
138
140
|
```
|
|
139
141
|
|
|
142
|
+
### radio-group/payment-accordion
|
|
143
|
+
|
|
144
|
+
```tsx
|
|
145
|
+
"use client";
|
|
146
|
+
|
|
147
|
+
import { CardField } from "@dodopayments/ui/card-field";
|
|
148
|
+
import { PaymentLogo } from "@dodopayments/ui/payment-logos";
|
|
149
|
+
import { Radio, RadioGroup } from "@dodopayments/ui/radio-group";
|
|
150
|
+
|
|
151
|
+
export default function RadioGroupPaymentAccordion() {
|
|
152
|
+
return (
|
|
153
|
+
<RadioGroup
|
|
154
|
+
aria-label="Payment method"
|
|
155
|
+
defaultValue="card"
|
|
156
|
+
className="w-full max-w-md gap-0 pointer-coarse:gap-0 pointer-coarse:gap-0 overflow-hidden rounded-xl border"
|
|
157
|
+
>
|
|
158
|
+
<Radio
|
|
159
|
+
variant="accordion"
|
|
160
|
+
value="card"
|
|
161
|
+
label="Card"
|
|
162
|
+
logo={<PaymentLogo brand="card" decorative />}
|
|
163
|
+
content={<CardField showName />}
|
|
164
|
+
/>
|
|
165
|
+
<Radio
|
|
166
|
+
variant="accordion"
|
|
167
|
+
value="klarna"
|
|
168
|
+
label="Klarna"
|
|
169
|
+
logo={<PaymentLogo brand="klarna" decorative />}
|
|
170
|
+
content={
|
|
171
|
+
<p className="text-body-secondary text-muted-foreground">
|
|
172
|
+
You will finish the payment with Klarna.
|
|
173
|
+
</p>
|
|
174
|
+
}
|
|
175
|
+
/>
|
|
176
|
+
</RadioGroup>
|
|
177
|
+
);
|
|
178
|
+
}
|
|
179
|
+
```
|
|
180
|
+
|
|
140
181
|
### radio-group/payment-methods
|
|
141
182
|
|
|
142
183
|
```tsx
|
|
@@ -186,6 +227,44 @@ export default function RadioGroupPaymentMethods() {
|
|
|
186
227
|
}
|
|
187
228
|
```
|
|
188
229
|
|
|
230
|
+
### radio-group/payment-tiles
|
|
231
|
+
|
|
232
|
+
```tsx
|
|
233
|
+
"use client";
|
|
234
|
+
|
|
235
|
+
import { PaymentLogo } from "@dodopayments/ui/payment-logos";
|
|
236
|
+
import { Radio, RadioGroup } from "@dodopayments/ui/radio-group";
|
|
237
|
+
|
|
238
|
+
export default function RadioGroupPaymentTiles() {
|
|
239
|
+
return (
|
|
240
|
+
<RadioGroup
|
|
241
|
+
aria-label="Payment method"
|
|
242
|
+
defaultValue="card"
|
|
243
|
+
className="grid w-full max-w-md grid-cols-3 gap-3"
|
|
244
|
+
>
|
|
245
|
+
<Radio
|
|
246
|
+
variant="tile"
|
|
247
|
+
value="card"
|
|
248
|
+
label="Card"
|
|
249
|
+
logo={<PaymentLogo brand="card" decorative />}
|
|
250
|
+
/>
|
|
251
|
+
<Radio
|
|
252
|
+
variant="tile"
|
|
253
|
+
value="affirm"
|
|
254
|
+
label="Affirm"
|
|
255
|
+
logo={<PaymentLogo brand="affirm" decorative />}
|
|
256
|
+
/>
|
|
257
|
+
<Radio
|
|
258
|
+
variant="tile"
|
|
259
|
+
value="klarna"
|
|
260
|
+
label="Klarna"
|
|
261
|
+
logo={<PaymentLogo brand="klarna" decorative />}
|
|
262
|
+
/>
|
|
263
|
+
</RadioGroup>
|
|
264
|
+
);
|
|
265
|
+
}
|
|
266
|
+
```
|
|
267
|
+
|
|
189
268
|
### radio-group/plan-picker
|
|
190
269
|
|
|
191
270
|
```tsx
|
|
@@ -90,7 +90,7 @@ export default function ReorderListBasic() {
|
|
|
90
90
|
>
|
|
91
91
|
{(m) => (
|
|
92
92
|
<div className="flex items-center justify-between gap-3">
|
|
93
|
-
<span className="
|
|
93
|
+
<span className="text-label-primary">{m.name}</span>
|
|
94
94
|
<span className="truncate text-body-secondary text-muted-foreground">{m.detail}</span>
|
|
95
95
|
</div>
|
|
96
96
|
)}
|
|
@@ -42,9 +42,9 @@ loads. Without `size` the chart is a square as wide as its container. Link a `Le
|
|
|
42
42
|
|
|
43
43
|
## Ring
|
|
44
44
|
|
|
45
|
-
One ring of a `RingChart`: a grey track and a progress arc for the data row at `index` (by default a
|
|
46
|
-
track and a
|
|
47
|
-
|
|
45
|
+
One ring of a `RingChart`: a grey track and a progress arc for the data row at `index` (by default a `--border`
|
|
46
|
+
track and a solid arc, as the bars; `variant="tint"` for a light `--muted` track and a 25% wash of the ring's colour
|
|
47
|
+
with a solid end cap). The
|
|
48
48
|
track scales in, then the arc fills. On hover the ring grows a little, the outer rings move out and
|
|
49
49
|
the other rings fade; the hover index drives `RingCenter` and a linked `Legend`.
|
|
50
50
|
|
|
@@ -52,10 +52,10 @@ the other rings fade; the hover index drives `RingCenter` and a linked `Legend`.
|
|
|
52
52
|
| --- | --- | --- | --- |
|
|
53
53
|
| `index` (required) | `number` | - | Index of the ring in the `RingChart` data, 0 = innermost. |
|
|
54
54
|
| `animate` | `boolean` | - | Animate the ring on mount. Default: true |
|
|
55
|
-
| `color` | `string` | - | Color override. Falls back to the row's `color`, then to `--chart-1..5`. |
|
|
55
|
+
| `color` | `string` | - | Color override. Falls back to the row's `color`, then to `--chart-solid-1..3` and `--chart-4..5`. |
|
|
56
56
|
| `lineCap` | `RingLineCap` | - | End cap of the progress arc (`variant="solid"`). Default: "round" |
|
|
57
57
|
| `showGlow` | `boolean` | - | Show a glow in the ring color on hover. Default: true |
|
|
58
|
-
| `variant` | `"tint" \| "solid"` | - | `"
|
|
58
|
+
| `variant` | `"tint" \| "solid"` | - | `"solid"`: a `--border` track and a solid arc, as the bars. `"tint"`: a light grey `--muted` track for what is not covered yet, the progress as a 25% wash of the ring's colour (mixed into the card) and a solid 3px cap where it ends. Default: "solid" |
|
|
59
59
|
|
|
60
60
|
## RingCenter
|
|
61
61
|
|
|
@@ -191,11 +191,20 @@ const countries: RingData[] = [
|
|
|
191
191
|
|
|
192
192
|
const usd = new Intl.NumberFormat("en-US", { style: "currency", currency: "USD", notation: "compact" });
|
|
193
193
|
|
|
194
|
+
// The ring's default colours, in order: the bars' solid series, then the chart palette.
|
|
195
|
+
const ringColors = [
|
|
196
|
+
"var(--chart-solid-1)",
|
|
197
|
+
"var(--chart-solid-2)",
|
|
198
|
+
"var(--chart-solid-3)",
|
|
199
|
+
"var(--chart-4)",
|
|
200
|
+
"var(--chart-5)",
|
|
201
|
+
];
|
|
202
|
+
|
|
194
203
|
const legendItems: LegendItemData[] = countries.map((row, index) => ({
|
|
195
204
|
label: row.label,
|
|
196
205
|
value: row.value,
|
|
197
206
|
maxValue: row.maxValue,
|
|
198
|
-
color:
|
|
207
|
+
color: ringColors[index % ringColors.length] ?? "var(--chart-solid-1)",
|
|
199
208
|
}));
|
|
200
209
|
|
|
201
210
|
export default function RingChartLegend() {
|
|
@@ -224,11 +233,11 @@ export default function RingChartLegend() {
|
|
|
224
233
|
className="w-full max-w-64"
|
|
225
234
|
>
|
|
226
235
|
<LegendItem className="grid grid-cols-[auto_1fr_auto] items-center gap-x-3 gap-y-1">
|
|
227
|
-
<LegendMarker
|
|
236
|
+
<LegendMarker />
|
|
228
237
|
<LegendLabel />
|
|
229
238
|
<LegendValue formatValue={(value) => usd.format(value)} showPercentage />
|
|
230
239
|
<div className="col-span-full">
|
|
231
|
-
<LegendProgress
|
|
240
|
+
<LegendProgress />
|
|
232
241
|
</div>
|
|
233
242
|
</LegendItem>
|
|
234
243
|
</Legend>
|
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
# Sale share card
|
|
2
|
+
|
|
3
|
+
A new sale as an image to share (the dashboard's payments list, Share): 720 by 400, the artwork behind, the
|
|
4
|
+
business chip, a headline and the amount in the brand lime with a dark outline. Always light, whatever the theme,
|
|
5
|
+
so the saved picture looks the same. Capture this element at its own size, and preview it in a `ScaledFrame`.
|
|
6
|
+
|
|
7
|
+
```tsx
|
|
8
|
+
import { SaleShareCard } from "@dodopayments/ui/sale-share-card";
|
|
9
|
+
```
|
|
10
|
+
|
|
11
|
+
## SaleShareCard
|
|
12
|
+
|
|
13
|
+
A new sale as an image to share (the dashboard's payments list, Share): 720 by 400, the artwork behind, the
|
|
14
|
+
business chip, a headline and the amount in the brand lime with a dark outline. Always light, whatever the theme,
|
|
15
|
+
so the saved picture looks the same. Capture this element at its own size, and preview it in a `ScaledFrame`.
|
|
16
|
+
|
|
17
|
+
| Prop | Type | Default | Description |
|
|
18
|
+
| --- | --- | --- | --- |
|
|
19
|
+
| `amount` (required) | `string` | - | The sale, formatted, e.g. "$1,234.56". It shrinks to fit the card. |
|
|
20
|
+
| `background` (required) | `string` | - | The artwork behind the card, an image URL. Decorative. |
|
|
21
|
+
| `headline` (required) | `ReactNode` | - | The line above the amount, e.g. "Cha-ching! A new sale is in". |
|
|
22
|
+
| `business` | `SaleShareBusiness` | - | The business chip at the top. Leave it out when the merchant turns off "Include business and logo"; the card keeps its size so the shared image is always 720 by 400. |
|
|
23
|
+
| `className` | `string` | - | Additional Tailwind classes, merged last. |
|
|
24
|
+
|
|
25
|
+
## Examples
|
|
26
|
+
|
|
27
|
+
### sale-share-card/master
|
|
28
|
+
|
|
29
|
+
```tsx
|
|
30
|
+
"use client";
|
|
31
|
+
|
|
32
|
+
import { SaleShareCard } from "@dodopayments/ui/sale-share-card";
|
|
33
|
+
import { ScaledFrame } from "@dodopayments/ui/scaled-frame";
|
|
34
|
+
|
|
35
|
+
export default function SaleShareCardDemo() {
|
|
36
|
+
return (
|
|
37
|
+
<ScaledFrame width={720} height={400} className="max-w-180">
|
|
38
|
+
<SaleShareCard
|
|
39
|
+
amount="$1,234.56"
|
|
40
|
+
headline="Cha-ching! A new sale is in"
|
|
41
|
+
background="/samples/sale-share-lagoon.webp"
|
|
42
|
+
business={{ name: "Incubix" }}
|
|
43
|
+
/>
|
|
44
|
+
</ScaledFrame>
|
|
45
|
+
);
|
|
46
|
+
}
|
|
47
|
+
```
|
|
48
|
+
|