@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,21 +1,23 @@
|
|
|
1
1
|
# Setup guide
|
|
2
2
|
|
|
3
3
|
The setup guide a new business follows (the dashboard's Setup guide, opened from the top bar's Setup guide
|
|
4
|
-
button): a 320 wide
|
|
5
|
-
|
|
4
|
+
button): a 320 wide grey tray (Direction 1) with the title, the percent done and a progress bar on its strip, then
|
|
5
|
+
one white panel per step, 4 apart. A
|
|
6
|
+
group row opens (one at a time) to its tasks, each with a status dot, a status Badge when submitted or blocked and an
|
|
6
7
|
optional "Mark as done"; a link row goes straight to a page; a locked row waits behind a padlock; a finished row
|
|
7
8
|
shows a green check. Collapsed, it keeps the header and bar and says what is up next. Place it yourself (the
|
|
8
9
|
dashboard pins it to the bottom-right corner).
|
|
9
10
|
|
|
10
11
|
```tsx
|
|
11
|
-
import { SetupGuide } from "@dodopayments/ui/setup-guide";
|
|
12
|
+
import { SetupGuide, SetupGuideIntro } from "@dodopayments/ui/setup-guide";
|
|
12
13
|
```
|
|
13
14
|
|
|
14
15
|
## SetupGuide
|
|
15
16
|
|
|
16
17
|
The setup guide a new business follows (the dashboard's Setup guide, opened from the top bar's Setup guide
|
|
17
|
-
button): a 320 wide
|
|
18
|
-
|
|
18
|
+
button): a 320 wide grey tray (Direction 1) with the title, the percent done and a progress bar on its strip, then
|
|
19
|
+
one white panel per step, 4 apart. A
|
|
20
|
+
group row opens (one at a time) to its tasks, each with a status dot, a status Badge when submitted or blocked and an
|
|
19
21
|
optional "Mark as done"; a link row goes straight to a page; a locked row waits behind a padlock; a finished row
|
|
20
22
|
shows a green check. Collapsed, it keeps the header and bar and says what is up next. Place it yourself (the
|
|
21
23
|
dashboard pins it to the bottom-right corner).
|
|
@@ -33,6 +35,19 @@ dashboard pins it to the bottom-right corner).
|
|
|
33
35
|
| `progress` | `number` | - | Overall progress, 0–100. Defaults to the share of done tasks. |
|
|
34
36
|
| `upNext` | `string` | - | The task shown after "Up next" while collapsed. Defaults to the first task not done. |
|
|
35
37
|
|
|
38
|
+
## SetupGuideIntro
|
|
39
|
+
|
|
40
|
+
The first-time hint above the setup guide (the Design File's "Your setup lives here"): a 320 wide lime card with
|
|
41
|
+
a title, a line and a "Got it" button, shown once when the guide first opens. Place it 8 above the guide; the
|
|
42
|
+
dashboard also dims the page behind both until it is dismissed.
|
|
43
|
+
|
|
44
|
+
| Prop | Type | Default | Description |
|
|
45
|
+
| --- | --- | --- | --- |
|
|
46
|
+
| `onDismiss` (required) | `() => void` | - | Called by the dismiss button. Hide the intro and remember it, so it shows only once. |
|
|
47
|
+
| `actionLabel` | `string` | `"Got it"` | The dismiss button's label. |
|
|
48
|
+
| `description` | `ReactNode` | `"Pick up right where you left off."` | |
|
|
49
|
+
| `title` | `ReactNode` | `"Your setup lives here"` | |
|
|
50
|
+
|
|
36
51
|
## Examples
|
|
37
52
|
|
|
38
53
|
### setup-guide/master
|
|
@@ -43,132 +58,100 @@ dashboard pins it to the bottom-right corner).
|
|
|
43
58
|
import { Button } from "@dodopayments/ui/button";
|
|
44
59
|
import {
|
|
45
60
|
SetupGuide,
|
|
61
|
+
SetupGuideIntro,
|
|
46
62
|
type SetupGuideItem,
|
|
47
63
|
type SetupGuideTaskState,
|
|
48
64
|
} from "@dodopayments/ui/setup-guide";
|
|
49
65
|
import { useState } from "react";
|
|
50
66
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
"
|
|
66
|
-
"
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
67
|
+
const VERIFY = [
|
|
68
|
+
["product", "Product Verification"],
|
|
69
|
+
["identity", "Personal identity"],
|
|
70
|
+
["business", "Business Information"],
|
|
71
|
+
["bank", "Bank Details"],
|
|
72
|
+
] as const;
|
|
73
|
+
const TEST = [
|
|
74
|
+
["test-product", "Create a product"],
|
|
75
|
+
["test-integrate", "Integrate"],
|
|
76
|
+
["test-payment", "Make first test payment"],
|
|
77
|
+
] as const;
|
|
78
|
+
const LIVE = [
|
|
79
|
+
["live-products", "Create products in Live mode", false],
|
|
80
|
+
["live-integrate", "Integrate (live)", true],
|
|
81
|
+
["branding", "Set up branding", true],
|
|
82
|
+
["zero-payment", "Make a $0 payment", false],
|
|
83
|
+
] as const;
|
|
84
|
+
|
|
85
|
+
type TaskId = (typeof VERIFY)[number][0] | (typeof TEST)[number][0] | (typeof LIVE)[number][0];
|
|
86
|
+
|
|
87
|
+
const INITIAL = Object.fromEntries(
|
|
88
|
+
[...VERIFY, ...TEST, ...LIVE].map(([id]) => [id, "pending"]),
|
|
89
|
+
) as Record<TaskId, SetupGuideTaskState>;
|
|
90
|
+
|
|
91
|
+
/**
|
|
92
|
+
* The Setup guide with the Design File's content: press a verification task to submit it (In review), press a test
|
|
93
|
+
* or live task to finish it or use Mark as done, open the steps, collapse the guide, dismiss the intro, and close and
|
|
94
|
+
* reopen the guide.
|
|
95
|
+
*/
|
|
70
96
|
export default function SetupGuideMaster() {
|
|
71
97
|
const [states, setStates] = useState(INITIAL);
|
|
98
|
+
const [intro, setIntro] = useState(true);
|
|
72
99
|
const [open, setOpen] = useState(true);
|
|
73
|
-
const
|
|
100
|
+
const set = (id: TaskId, state: SetupGuideTaskState) =>
|
|
101
|
+
setStates((current) => ({ ...current, [id]: state }));
|
|
74
102
|
|
|
75
103
|
const items: SetupGuideItem[] = [
|
|
76
104
|
{
|
|
77
105
|
id: "verify",
|
|
78
106
|
title: "Verify your account",
|
|
79
|
-
tasks: [
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
{ id: "personal", label: "Personal Information", state: states.personal },
|
|
87
|
-
{
|
|
88
|
-
id: "business",
|
|
89
|
-
label: "Business Verification",
|
|
90
|
-
state: states.business,
|
|
91
|
-
onSelect: () => finish("business"),
|
|
92
|
-
},
|
|
93
|
-
{
|
|
94
|
-
id: "bank",
|
|
95
|
-
label: "Bank Verification",
|
|
96
|
-
state: states.bank,
|
|
97
|
-
onSelect: () => finish("bank"),
|
|
98
|
-
},
|
|
99
|
-
],
|
|
107
|
+
tasks: VERIFY.map(([id, label]) => ({
|
|
108
|
+
id,
|
|
109
|
+
label,
|
|
110
|
+
state: states[id],
|
|
111
|
+
// A pending form opens; submitting it puts it in review.
|
|
112
|
+
onSelect: states[id] === "pending" ? () => set(id, "in-review") : undefined,
|
|
113
|
+
})),
|
|
100
114
|
},
|
|
101
115
|
{
|
|
102
116
|
id: "test",
|
|
103
117
|
title: "Test mode integration",
|
|
104
|
-
tasks: [
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
118
|
+
tasks: TEST.map(([id, label]) => ({
|
|
119
|
+
id,
|
|
120
|
+
label,
|
|
121
|
+
state: states[id],
|
|
122
|
+
onSelect: states[id] === "done" ? undefined : () => set(id, "done"),
|
|
123
|
+
})),
|
|
124
|
+
},
|
|
125
|
+
{
|
|
126
|
+
id: "live",
|
|
127
|
+
title: "Live mode integration",
|
|
128
|
+
tasks: LIVE.map(([id, label, manual]) => ({
|
|
129
|
+
id,
|
|
130
|
+
label,
|
|
131
|
+
state: states[id],
|
|
132
|
+
onSelect: manual || states[id] === "done" ? undefined : () => set(id, "done"),
|
|
133
|
+
onMarkDone: manual ? () => set(id, "done") : undefined,
|
|
134
|
+
})),
|
|
135
|
+
},
|
|
136
|
+
{
|
|
137
|
+
id: "go-live",
|
|
138
|
+
title: "Go live",
|
|
139
|
+
hint: "Unlocks once verification is approved",
|
|
140
|
+
locked: true,
|
|
119
141
|
},
|
|
120
|
-
{ id: "live", title: "Go live", hint: "Unlocks once verification is approved", locked: true },
|
|
121
142
|
];
|
|
122
143
|
|
|
123
|
-
if (!open) {
|
|
124
|
-
return (
|
|
125
|
-
<Button variant="secondary" onClick={() => setOpen(true)}>
|
|
126
|
-
Open the setup guide
|
|
127
|
-
</Button>
|
|
128
|
-
);
|
|
129
|
-
}
|
|
130
|
-
return <SetupGuide items={items} defaultOpenItem="verify" onClose={() => setOpen(false)} />;
|
|
131
|
-
}
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### setup-guide/states
|
|
135
|
-
|
|
136
|
-
```tsx
|
|
137
|
-
"use client";
|
|
138
|
-
|
|
139
|
-
import { SetupGuide } from "@dodopayments/ui/setup-guide";
|
|
140
|
-
|
|
141
|
-
export default function SetupGuideStates() {
|
|
142
144
|
return (
|
|
143
|
-
<
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
{
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
{ id: "bank", label: "Bank Verification", state: "failed" },
|
|
154
|
-
{ id: "tax", label: "Tax details", state: "pending" },
|
|
155
|
-
],
|
|
156
|
-
},
|
|
157
|
-
{
|
|
158
|
-
id: "branding",
|
|
159
|
-
title: "Brand your checkout",
|
|
160
|
-
hint: "Add your logo and colours",
|
|
161
|
-
href: "#brand-your-checkout",
|
|
162
|
-
},
|
|
163
|
-
{ id: "profile", title: "Business profile", done: true },
|
|
164
|
-
{
|
|
165
|
-
id: "live",
|
|
166
|
-
title: "Go live",
|
|
167
|
-
hint: "Unlocks once verification is approved",
|
|
168
|
-
locked: true,
|
|
169
|
-
},
|
|
170
|
-
]}
|
|
171
|
-
/>
|
|
145
|
+
<div className="flex min-h-130 flex-col items-center justify-end gap-2">
|
|
146
|
+
{open && intro ? <SetupGuideIntro onDismiss={() => setIntro(false)} /> : null}
|
|
147
|
+
{open ? (
|
|
148
|
+
<SetupGuide items={items} defaultOpenItem="verify" onClose={() => setOpen(false)} />
|
|
149
|
+
) : (
|
|
150
|
+
<Button variant="secondary" onClick={() => setOpen(true)}>
|
|
151
|
+
Open the setup guide
|
|
152
|
+
</Button>
|
|
153
|
+
)}
|
|
154
|
+
</div>
|
|
172
155
|
);
|
|
173
156
|
}
|
|
174
157
|
```
|
|
@@ -187,19 +170,32 @@ const ITEMS: SetupGuideItem[] = [
|
|
|
187
170
|
id: "verify",
|
|
188
171
|
title: "Verify your account",
|
|
189
172
|
tasks: [
|
|
190
|
-
{ id: "product", label: "Product
|
|
191
|
-
{ id: "
|
|
192
|
-
{ id: "business", label: "Business
|
|
193
|
-
{ id: "bank", label: "Bank
|
|
173
|
+
{ id: "product", label: "Product Verification", state: "in-review" },
|
|
174
|
+
{ id: "identity", label: "Personal identity", state: "done" },
|
|
175
|
+
{ id: "business", label: "Business Information", state: "done" },
|
|
176
|
+
{ id: "bank", label: "Bank Details", state: "pending" },
|
|
194
177
|
],
|
|
195
178
|
},
|
|
196
179
|
{
|
|
197
180
|
id: "test",
|
|
198
181
|
title: "Test mode integration",
|
|
199
|
-
|
|
200
|
-
|
|
182
|
+
tasks: [
|
|
183
|
+
{ id: "test-product", label: "Create a product", state: "pending" },
|
|
184
|
+
{ id: "test-integrate", label: "Integrate", state: "pending" },
|
|
185
|
+
{ id: "test-payment", label: "Make first test payment", state: "pending" },
|
|
186
|
+
],
|
|
187
|
+
},
|
|
188
|
+
{
|
|
189
|
+
id: "live",
|
|
190
|
+
title: "Live mode integration",
|
|
191
|
+
tasks: [
|
|
192
|
+
{ id: "live-products", label: "Create products in Live mode", state: "pending" },
|
|
193
|
+
{ id: "live-integrate", label: "Integrate (live)", state: "pending" },
|
|
194
|
+
{ id: "branding", label: "Set up branding", state: "pending" },
|
|
195
|
+
{ id: "zero-payment", label: "Make a $0 payment", state: "pending" },
|
|
196
|
+
],
|
|
201
197
|
},
|
|
202
|
-
{ id: "live", title: "Go live", hint: "Unlocks once verification is approved", locked: true },
|
|
198
|
+
{ id: "go-live", title: "Go live", hint: "Unlocks once verification is approved", locked: true },
|
|
203
199
|
];
|
|
204
200
|
|
|
205
201
|
export default function SetupGuideWithTopBar() {
|
|
@@ -212,7 +208,7 @@ export default function SetupGuideWithTopBar() {
|
|
|
212
208
|
// The hero above owns the / key on this page.
|
|
213
209
|
searchShortcut={false}
|
|
214
210
|
showSetupGuide
|
|
215
|
-
setupGuideProgress={1
|
|
211
|
+
setupGuideProgress={0.1}
|
|
216
212
|
onOpenSetupGuide={() => {
|
|
217
213
|
setOpen(true);
|
|
218
214
|
setCollapsed(false);
|
package/ai/components/sidebar.md
CHANGED
|
@@ -83,6 +83,9 @@ A menu item that expands to show a sub-menu. Renders `<li>`; compose it from a
|
|
|
83
83
|
`SidebarMenuCollapsibleTrigger` and a `SidebarMenuCollapsibleContent` holding a `SidebarMenuSub`.
|
|
84
84
|
The primitives have no sidebar collapsible part; built from the `Collapsible` primitive.
|
|
85
85
|
|
|
86
|
+
Inside a `SidebarProvider` only one sub-menu is open at a time: opening one closes the one that was open.
|
|
87
|
+
`defaultOpen` sets the first state. Pass `open` to control it yourself; a controlled sub-menu is left out of this.
|
|
88
|
+
|
|
86
89
|
| Prop | Type | Default | Description |
|
|
87
90
|
| --- | --- | --- | --- |
|
|
88
91
|
| `className` | `string` | - | Additional Tailwind classes, merged last. |
|
|
@@ -92,6 +95,8 @@ Also accepts Base UI props: `defaultOpen`, `disabled`, `onOpenChange`, `open`.
|
|
|
92
95
|
## SidebarMenuCollapsibleContent
|
|
93
96
|
|
|
94
97
|
The animated panel (primitive `CollapsiblePanel`) holding the sub-menu. Unmounts when closed unless `keepMounted`.
|
|
98
|
+
On the desktop icon rail it is a small Popover beside the icon instead: the trigger's `tooltip` as its title, the
|
|
99
|
+
sub-menu in the white panel.
|
|
95
100
|
|
|
96
101
|
| Prop | Type | Default | Description |
|
|
97
102
|
| --- | --- | --- | --- |
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Stat Card
|
|
2
2
|
|
|
3
3
|
A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional
|
|
4
|
-
trend
|
|
4
|
+
trend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).
|
|
5
5
|
`loading` shows Skeleton lines, `empty` shows "-" and a reason, and `error` (with `onRetry`) a retry; what replaces
|
|
6
6
|
the loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. Renders a `<section>`
|
|
7
7
|
labelled by the label.
|
|
@@ -13,7 +13,7 @@ import { StatCard, StatCardBreakdown, StatCardBreakdownRow, StatGrid } from "@do
|
|
|
13
13
|
## StatCard
|
|
14
14
|
|
|
15
15
|
A static metric (Dodo Nest Stat card): the label on a grey strip, the number in a white panel, and an optional
|
|
16
|
-
trend
|
|
16
|
+
trend chip and comparison under it. Put a `StatCardBreakdown` inside for the parts of the number (Payout balance).
|
|
17
17
|
`loading` shows Skeleton lines, `empty` shows "-" and a reason, and `error` (with `onRetry`) a retry; what replaces
|
|
18
18
|
the loading skeletons fades in. Cards in a CSS grid row (`StatGrid`) stretch to one height. Renders a `<section>`
|
|
19
19
|
labelled by the label.
|
|
@@ -23,7 +23,7 @@ labelled by the label.
|
|
|
23
23
|
| `label` (required) | `ReactNode` | - | What the number measures, e.g. "Successful payments". It sits on the grey strip and truncates. |
|
|
24
24
|
| `comparison` | `ReactNode` | - | The line under the value, e.g. "vs last 30 days", "+3 added this month" or "Next payout on Oct 21". Without it (and without a trend) the row disappears and the card hugs. |
|
|
25
25
|
| `empty` | `ReactNode` | - | Show the empty state: "-" for the value and the reason under it. `true` shows `labels.empty` ("No data yet"); text or a node is the reason ("Live mode only"). Ignored while `loading` or with an `error`. |
|
|
26
|
-
| `error` | `ReactNode` | - | Show the error state instead of the value: `true` shows the default heading; text or a node is
|
|
26
|
+
| `error` | `ReactNode` | - | Show the error state instead of the value: a small left-aligned heading with an error icon, and "Try again" with `onRetry`. `true` shows the default heading; text or a node is the reason, read to screen readers after the heading. Ignored while `loading`. |
|
|
27
27
|
| `flash` | `boolean` | `false` | Flash each change of a number `value` with `ValueFlash`: the new number rolls in and tints success (up) or destructive (down). For live balances and counters. |
|
|
28
28
|
| `footer` | `ReactNode` | - | A quiet line on the grey under the panel, e.g. `<ChartUpdated updatedAt={…} onRefresh={…} />` from `@dodopayments/ui/chart` ("Updated 40 minutes ago" and a refresh button). |
|
|
29
29
|
| `format` | `((value: number) => string)` | - | Formats a number `value` for display, e.g. as currency. Defaults to `String(value)`. |
|
|
@@ -32,7 +32,7 @@ labelled by the label.
|
|
|
32
32
|
| `labels` | `StatCardLabels` | - | Replaces some or all of the default texts. |
|
|
33
33
|
| `loading` | `boolean` | `false` | Replace the value and the comparison with Skeleton lines and mark the card busy. |
|
|
34
34
|
| `onRetry` | `(() => void)` | - | Shows a retry button in the error state. |
|
|
35
|
-
| `trend` | `StatCardTrend` | - | The change: a success (up) or error (down)
|
|
35
|
+
| `trend` | `StatCardTrend` | - | The change: a success (up) or error (down) chip before the comparison. Show it only with a comparison. |
|
|
36
36
|
| `value` | `ReactNode` | - | The number, formatted in full ("$84,320.50"); the card never abbreviates. Pass a number with `format` so `flash` can animate its changes. Without `flash`, a changed string or number swaps in place: the old value rises out and the new one rises in. An element swaps only with a `valueKey`. |
|
|
37
37
|
| `valueKey` | `string \| number` | - | Identifies an element `value`, such as `<Money amount={x} />`: the value swaps in place when the key changes. An element without a key updates without motion, because it is a new object on every render. String and number values are their own key. |
|
|
38
38
|
|
|
@@ -88,7 +88,13 @@ export default function StatCardBasic() {
|
|
|
88
88
|
trend={{ value: "8.1%", direction: "up", invert: true }}
|
|
89
89
|
comparison="vs last 30 days"
|
|
90
90
|
/>
|
|
91
|
-
<StatCard
|
|
91
|
+
<StatCard
|
|
92
|
+
label="Failed payments"
|
|
93
|
+
help="Payments that failed after every retry. No change from the last period shows a grey -%."
|
|
94
|
+
value="18"
|
|
95
|
+
trend={{ direction: "neutral" }}
|
|
96
|
+
comparison="vs last 30 days"
|
|
97
|
+
/>
|
|
92
98
|
</StatGrid>
|
|
93
99
|
);
|
|
94
100
|
}
|
|
@@ -146,22 +152,15 @@ export default function StatCardMaster() {
|
|
|
146
152
|
import { buttonVariants } from "@dodopayments/ui/button";
|
|
147
153
|
import { Money } from "@dodopayments/ui/money";
|
|
148
154
|
import { StatCard } from "@dodopayments/ui/stat-card";
|
|
149
|
-
import { Badge } from "@dodopayments/ui/badge";
|
|
150
155
|
import { Timestamp } from "@dodopayments/ui/timestamp";
|
|
151
156
|
|
|
152
|
-
/** A payout summary: the amount,
|
|
157
|
+
/** A payout summary: the amount, when it arrives and where (last four only). */
|
|
153
158
|
export default function StatCardNextPayout() {
|
|
154
159
|
return (
|
|
155
160
|
<StatCard
|
|
156
161
|
className="w-full max-w-sm"
|
|
157
162
|
label="Next payout"
|
|
158
|
-
value={
|
|
159
|
-
// The delivery status sits on the amount's row, centred on it; it keeps the body font of a badge.
|
|
160
|
-
<span className="flex flex-wrap items-center gap-x-3 gap-y-1">
|
|
161
|
-
<Money minor={482_000} currency="USD" display="symbolAndCode" tone="neutral" />
|
|
162
|
-
<Badge kind="payout" status="in_progress" className="font-sans" />
|
|
163
|
-
</span>
|
|
164
|
-
}
|
|
163
|
+
value={<Money minor={482_000} currency="USD" display="symbolAndCode" tone="neutral" />}
|
|
165
164
|
>
|
|
166
165
|
<dl className="flex flex-col gap-2 pt-2 text-body-primary">
|
|
167
166
|
<div className="flex flex-wrap items-center justify-between gap-2">
|
|
@@ -1,26 +1,30 @@
|
|
|
1
1
|
# Sunburst Chart
|
|
2
2
|
|
|
3
3
|
A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from
|
|
4
|
-
children: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub
|
|
5
|
-
|
|
6
|
-
(
|
|
7
|
-
|
|
8
|
-
|
|
4
|
+
children: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:
|
|
5
|
+
the focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`
|
|
6
|
+
(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and
|
|
7
|
+
`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are
|
|
8
|
+
tinted washes with a solid rim, like the bar and pie charts. Click a segment with children to zoom in.
|
|
9
|
+
The SVG is decorative and pointer-only: `SunburstLegend` rows zoom in and `SunburstBreadcrumb` buttons
|
|
10
|
+
zoom out by keyboard, so keep both in the chart when focus can change. Rings reveal on mount;
|
|
9
11
|
there is no loading or empty state. `size` (default 520) is the largest diameter; the chart never
|
|
10
12
|
gets wider than its container.
|
|
11
13
|
|
|
12
14
|
```tsx
|
|
13
|
-
import { SunburstChart, SunburstSegment, SunburstCenter, SunburstLabels, SunburstHint, SunburstBreadcrumb, useSunburstBreadcrumbItems, buildArcs } from "@dodopayments/ui/sunburst-chart";
|
|
15
|
+
import { SunburstChart, SunburstSegment, SunburstCenter, SunburstLabels, SunburstLegend, SunburstHint, SunburstBreadcrumb, useSunburstBreadcrumbItems, buildArcs } from "@dodopayments/ui/sunburst-chart";
|
|
14
16
|
```
|
|
15
17
|
|
|
16
18
|
## SunburstChart
|
|
17
19
|
|
|
18
20
|
A hierarchy as rings around a center, on the bklit `SunburstChart` primitive. Compose it from
|
|
19
|
-
children: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub
|
|
20
|
-
|
|
21
|
-
(
|
|
22
|
-
|
|
23
|
-
|
|
21
|
+
children: one `SunburstSegment` per arc of `buildArcs(data).arcs`, plus `SunburstCenter` (the hub:
|
|
22
|
+
the focused total with `formatValue`, and a click zooms out), `SunburstLabels`, `SunburstBreadcrumb`
|
|
23
|
+
(drill-down path, above), `SunburstLegend` (branches with value and share, beside the rings) and
|
|
24
|
+
`SunburstHint` (live hint, below). `data` is a `SunburstNode` tree; leaves carry `value`. Segments are
|
|
25
|
+
tinted washes with a solid rim, like the bar and pie charts. Click a segment with children to zoom in.
|
|
26
|
+
The SVG is decorative and pointer-only: `SunburstLegend` rows zoom in and `SunburstBreadcrumb` buttons
|
|
27
|
+
zoom out by keyboard, so keep both in the chart when focus can change. Rings reveal on mount;
|
|
24
28
|
there is no loading or empty state. `size` (default 520) is the largest diameter; the chart never
|
|
25
29
|
gets wider than its container.
|
|
26
30
|
|
|
@@ -51,15 +55,18 @@ zooms in on click when it has children, and grows outward on hover with its ance
|
|
|
51
55
|
| `color` | `string` | - | Optional color override |
|
|
52
56
|
| `fill` | `string` | - | Optional fill override (patterns/gradients) |
|
|
53
57
|
| `fillOpacity` | `number` | - | Optional fill opacity override |
|
|
58
|
+
| `variant` | `"tint" \| "solid"` | - | `"tint"`: the bar and pie charts' look, the branch colour washed 20% into the card on every ring (35% while hovered) with a solid 3px rim on the outer edge. `"solid"`: the full colour, fading by ring. A gradient or pattern `fill` stays solid. Default: "tint" |
|
|
54
59
|
|
|
55
60
|
## SunburstCenter
|
|
56
61
|
|
|
57
|
-
The hub of a `SunburstChart
|
|
58
|
-
|
|
62
|
+
The hub of a `SunburstChart`, on the card colour. With `formatValue` it shows the focused node's total and name, so
|
|
63
|
+
the chart reads without hovering. After a drill-down a click on it zooms out one level.
|
|
59
64
|
|
|
60
65
|
| Prop | Type | Default | Description |
|
|
61
66
|
| --- | --- | --- | --- |
|
|
62
67
|
| `className` | `string` | - | Class name of the hub circle. |
|
|
68
|
+
| `formatValue` | `((value: number) => string)` | - | Formats the total written in the hub, e.g. `(v) => money.format(v * 1000)`. Leave it out for an empty hub. The total is the focused node's: the whole chart at the root, the branch after a drill-down. |
|
|
69
|
+
| `label` | `string` | - | Caption under the total at the root, e.g. "Q3 revenue". After a drill-down the caption is the branch name. Default: `data.name` |
|
|
63
70
|
|
|
64
71
|
## SunburstLabels
|
|
65
72
|
|
|
@@ -74,6 +81,20 @@ hidden for unrelated branches while one is hovered. They fade in after the enter
|
|
|
74
81
|
| `stroke` | `string` | - | Outline color behind the text, for contrast. Default: `--card`. |
|
|
75
82
|
| `strokeWidth` | `number` | - | Outline width; 0 turns it off. Default: 2.5 |
|
|
76
83
|
|
|
84
|
+
## SunburstLegend
|
|
85
|
+
|
|
86
|
+
The branches of a `SunburstChart` as a list beside it: a marker in the ring's tint, the name, the value and its share.
|
|
87
|
+
It follows the drill-down (the focused node's children) and the hover, both ways. A row with children is a button
|
|
88
|
+
that zooms in, so it is also the keyboard way into the hierarchy. Put it inside `SunburstChart`; the chart places it
|
|
89
|
+
beside the rings, or under them when there is no room.
|
|
90
|
+
|
|
91
|
+
| Prop | Type | Default | Description |
|
|
92
|
+
| --- | --- | --- | --- |
|
|
93
|
+
| `className` | `string` | - | Class name of the list. |
|
|
94
|
+
| `formatValue` | `((value: number) => string)` | - | Formats each row's value. Default: a whole number in the locale. |
|
|
95
|
+
| `showPercentage` | `boolean` | - | Show each row's share of the focused node. Default: true |
|
|
96
|
+
| `zoomInLabel` | `string` | - | Ends the accessible name of a row that zooms in ("Subscriptions, $683K, 66%, zoom in"). Default: "zoom in" |
|
|
97
|
+
|
|
77
98
|
## SunburstHint
|
|
78
99
|
|
|
79
100
|
A polite live region below a `SunburstChart`: the hovered segment's path, or how to zoom in or out.
|
|
@@ -135,7 +156,7 @@ import {
|
|
|
135
156
|
SunburstCenter,
|
|
136
157
|
SunburstChart,
|
|
137
158
|
SunburstHint,
|
|
138
|
-
|
|
159
|
+
SunburstLegend,
|
|
139
160
|
type SunburstNode,
|
|
140
161
|
SunburstSegment,
|
|
141
162
|
} from "@dodopayments/ui/sunburst-chart";
|
|
@@ -183,16 +204,107 @@ const revenue: SunburstNode = {
|
|
|
183
204
|
};
|
|
184
205
|
|
|
185
206
|
const { arcs } = buildArcs(revenue);
|
|
207
|
+
const money = new Intl.NumberFormat("en-US", {
|
|
208
|
+
style: "currency",
|
|
209
|
+
currency: "USD",
|
|
210
|
+
notation: "compact",
|
|
211
|
+
maximumFractionDigits: 2,
|
|
212
|
+
});
|
|
213
|
+
const formatThousands = (value: number) => money.format(value * 1000);
|
|
186
214
|
|
|
187
215
|
export default function SunburstChartBasic() {
|
|
188
216
|
return (
|
|
189
|
-
<SunburstChart
|
|
217
|
+
<SunburstChart
|
|
218
|
+
data={revenue}
|
|
219
|
+
label="Q3 2026 revenue by product line, plan and region"
|
|
220
|
+
size={320}
|
|
221
|
+
>
|
|
222
|
+
<SunburstBreadcrumb />
|
|
223
|
+
{arcs.map((arc) => (
|
|
224
|
+
<SunburstSegment key={arc.id} index={arc.arcIndex} />
|
|
225
|
+
))}
|
|
226
|
+
<SunburstCenter formatValue={formatThousands} label="Q3 revenue" />
|
|
227
|
+
<SunburstLegend formatValue={formatThousands} />
|
|
228
|
+
<SunburstHint />
|
|
229
|
+
</SunburstChart>
|
|
230
|
+
);
|
|
231
|
+
}
|
|
232
|
+
```
|
|
233
|
+
|
|
234
|
+
### sunburst-chart/compact
|
|
235
|
+
|
|
236
|
+
```tsx
|
|
237
|
+
"use client";
|
|
238
|
+
|
|
239
|
+
import {
|
|
240
|
+
buildArcs,
|
|
241
|
+
SunburstBreadcrumb,
|
|
242
|
+
SunburstCenter,
|
|
243
|
+
SunburstChart,
|
|
244
|
+
SunburstHint,
|
|
245
|
+
SunburstLegend,
|
|
246
|
+
type SunburstNode,
|
|
247
|
+
SunburstSegment,
|
|
248
|
+
} from "@dodopayments/ui/sunburst-chart";
|
|
249
|
+
|
|
250
|
+
// Q3 2026 revenue in thousands of USD: product line, then plan or channel, then region.
|
|
251
|
+
const revenue: SunburstNode = {
|
|
252
|
+
name: "Revenue",
|
|
253
|
+
children: [
|
|
254
|
+
{
|
|
255
|
+
name: "Subscriptions",
|
|
256
|
+
children: [
|
|
257
|
+
{
|
|
258
|
+
name: "Monthly",
|
|
259
|
+
children: [
|
|
260
|
+
{ name: "Americas", value: 182 },
|
|
261
|
+
{ name: "EMEA", value: 121 },
|
|
262
|
+
{ name: "APAC", value: 94 },
|
|
263
|
+
],
|
|
264
|
+
},
|
|
265
|
+
{
|
|
266
|
+
name: "Annual",
|
|
267
|
+
children: [
|
|
268
|
+
{ name: "Americas", value: 146 },
|
|
269
|
+
{ name: "EMEA", value: 88 },
|
|
270
|
+
{ name: "APAC", value: 52 },
|
|
271
|
+
],
|
|
272
|
+
},
|
|
273
|
+
],
|
|
274
|
+
},
|
|
275
|
+
{
|
|
276
|
+
name: "One-time",
|
|
277
|
+
children: [
|
|
278
|
+
{ name: "Digital goods", value: 138 },
|
|
279
|
+
{ name: "Courses", value: 74 },
|
|
280
|
+
],
|
|
281
|
+
},
|
|
282
|
+
{
|
|
283
|
+
name: "Usage",
|
|
284
|
+
children: [
|
|
285
|
+
{ name: "API calls", value: 96 },
|
|
286
|
+
{ name: "Storage", value: 41 },
|
|
287
|
+
],
|
|
288
|
+
},
|
|
289
|
+
],
|
|
290
|
+
};
|
|
291
|
+
|
|
292
|
+
const { arcs } = buildArcs(revenue);
|
|
293
|
+
|
|
294
|
+
export default function SunburstChartCompact() {
|
|
295
|
+
return (
|
|
296
|
+
<SunburstChart
|
|
297
|
+
data={revenue}
|
|
298
|
+
label="Q3 2026 revenue by product line, plan and region"
|
|
299
|
+
size={240}
|
|
300
|
+
>
|
|
190
301
|
<SunburstBreadcrumb />
|
|
191
302
|
{arcs.map((arc) => (
|
|
192
303
|
<SunburstSegment key={arc.id} index={arc.arcIndex} />
|
|
193
304
|
))}
|
|
194
305
|
<SunburstCenter />
|
|
195
|
-
|
|
306
|
+
{/* The keyboard paths: legend rows zoom in, breadcrumb buttons zoom out. */}
|
|
307
|
+
<SunburstLegend />
|
|
196
308
|
<SunburstHint />
|
|
197
309
|
</SunburstChart>
|
|
198
310
|
);
|
|
@@ -362,11 +474,19 @@ const revenue: SunburstNode = {
|
|
|
362
474
|
};
|
|
363
475
|
|
|
364
476
|
const { arcs } = buildArcs(revenue);
|
|
365
|
-
const usd = new Intl.NumberFormat("en-US", {
|
|
477
|
+
const usd = new Intl.NumberFormat("en-US", {
|
|
478
|
+
style: "currency",
|
|
479
|
+
currency: "USD",
|
|
480
|
+
maximumFractionDigits: 0,
|
|
481
|
+
});
|
|
366
482
|
|
|
367
483
|
export default function SunburstChartCustomHint() {
|
|
368
484
|
return (
|
|
369
|
-
<SunburstChart
|
|
485
|
+
<SunburstChart
|
|
486
|
+
data={revenue}
|
|
487
|
+
label="Q3 2026 revenue by product line, plan and region"
|
|
488
|
+
size={360}
|
|
489
|
+
>
|
|
370
490
|
<SunburstBreadcrumb />
|
|
371
491
|
{arcs.map((arc) => (
|
|
372
492
|
<SunburstSegment key={arc.id} index={arc.arcIndex} />
|