@mbao01/common 0.0.44 → 0.0.46
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/dist/types/components/Chart/Chart.d.ts +2 -0
- package/dist/types/components/Chart/ChartContext.d.ts +2 -0
- package/dist/types/components/Chart/components/ChartLegend.d.ts +4 -0
- package/dist/types/components/Chart/components/ChartStyle.d.ts +2 -0
- package/dist/types/components/Chart/components/ChartTooltip.d.ts +4 -0
- package/dist/types/components/Chart/components/index.d.ts +3 -0
- package/dist/types/components/Chart/constants.d.ts +22 -0
- package/dist/types/components/Chart/helpers.d.ts +11 -0
- package/dist/types/components/Chart/hooks/index.d.ts +1 -0
- package/dist/types/components/Chart/hooks/useChart/index.d.ts +1 -0
- package/dist/types/components/Chart/hooks/useChart/useChart.d.ts +1 -0
- package/dist/types/components/Chart/index.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/activeShapeArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/animationArgs.d.ts +12 -0
- package/dist/types/components/Chart/stories/args/areaArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/areaChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/barArgs.d.ts +5 -0
- package/dist/types/components/Chart/stories/args/barChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/cartesianChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/cartesianSharedArgs.d.ts +11 -0
- package/dist/types/components/Chart/stories/args/chartArgs.d.ts +6 -0
- package/dist/types/components/Chart/stories/args/dotArgs.d.ts +10 -0
- package/dist/types/components/Chart/stories/args/events.d.ts +804 -0
- package/dist/types/components/Chart/stories/args/labelListArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/legendArgs.d.ts +3 -0
- package/dist/types/components/Chart/stories/args/lineArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/lineChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/pieArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/pieChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/polarChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/polarSharedArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radarArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radarChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radialBarArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/radialBarChartArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/rectangleArgs.d.ts +9 -0
- package/dist/types/components/Chart/stories/args/referenceSharedArgs.d.ts +4 -0
- package/dist/types/components/Chart/stories/args/sectorArgs.d.ts +7 -0
- package/dist/types/components/Chart/stories/args/sharedAxisArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/stylesArgs.d.ts +6 -0
- package/dist/types/components/Chart/stories/args/textArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/tooltipArgs.d.ts +4 -0
- package/dist/types/components/Chart/stories/args/types.d.ts +13 -0
- package/dist/types/components/Chart/stories/args/xAxisArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/args/yAxisArgs.d.ts +2 -0
- package/dist/types/components/Chart/stories/examples/AreaChart.d.ts +16 -0
- package/dist/types/components/Chart/stories/examples/BarChart.d.ts +20 -0
- package/dist/types/components/Chart/stories/examples/LineChart.d.ts +16 -0
- package/dist/types/components/Chart/stories/examples/PieChart.d.ts +19 -0
- package/dist/types/components/Chart/stories/examples/RadarChart.d.ts +24 -0
- package/dist/types/components/Chart/stories/examples/RadialChart.d.ts +17 -0
- package/dist/types/components/Chart/stories/examples/Tooltip.d.ts +15 -0
- package/dist/types/components/Chart/stories/helpers/index.d.ts +9 -0
- package/dist/types/components/Chart/types.d.ts +37 -0
- package/dist/types/components/DragAndDrop/Draggable/Draggable.d.ts +29 -0
- package/dist/types/components/DragAndDrop/Draggable/Draggable.example.d.ts +24 -0
- package/dist/types/components/DragAndDrop/Draggable/constants.d.ts +9 -0
- package/dist/types/components/DragAndDrop/Draggable/index.d.ts +1 -0
- package/dist/types/components/DragAndDrop/Draggable/types.d.ts +41 -0
- package/dist/types/components/DragAndDrop/Droppable/Droppable.d.ts +2 -0
- package/dist/types/components/DragAndDrop/Droppable/Droppable.example.d.ts +10 -0
- package/dist/types/components/DragAndDrop/Droppable/constants.d.ts +5 -0
- package/dist/types/components/DragAndDrop/Droppable/index.d.ts +1 -0
- package/dist/types/components/DragAndDrop/Droppable/types.d.ts +4 -0
- package/dist/types/components/DragAndDrop/Sortable/Sortable.d.ts +2 -0
- package/dist/types/components/DragAndDrop/Sortable/Sortable.example.d.ts +6 -0
- package/dist/types/components/DragAndDrop/Sortable/constants.d.ts +4 -0
- package/dist/types/components/DragAndDrop/Sortable/index.d.ts +1 -0
- package/dist/types/components/DragAndDrop/Sortable/types.d.ts +7 -0
- package/dist/types/components/DragAndDrop/index.d.ts +3 -0
- package/dist/types/components/Widget/InternalWidgetsContext.d.ts +2 -0
- package/dist/types/components/Widget/Widget.d.ts +2 -0
- package/dist/types/components/Widget/Widgets.example.d.ts +1 -0
- package/dist/types/components/Widget/WidgetsContext.d.ts +2 -0
- package/dist/types/components/Widget/hooks/index.d.ts +2 -0
- package/dist/types/components/Widget/hooks/useWidget/index.d.ts +1 -0
- package/dist/types/components/Widget/hooks/useWidget/useWidget.d.ts +7 -0
- package/dist/types/components/Widget/hooks/useWidgets/index.d.ts +1 -0
- package/dist/types/components/Widget/hooks/useWidgets/useWidgets.d.ts +1 -0
- package/dist/types/components/Widget/index.d.ts +3 -0
- package/dist/types/components/Widget/modifiers/index.d.ts +1 -0
- package/dist/types/components/Widget/modifiers/restrictToElement.d.ts +2 -0
- package/dist/types/components/Widget/types.d.ts +28 -0
- package/package.json +9 -3
- package/src/components/Chart/Chart.tsx +26 -0
- package/src/components/Chart/ChartContext.tsx +4 -0
- package/src/components/Chart/components/ChartLegend.tsx +52 -0
- package/src/components/Chart/components/ChartStyle.tsx +32 -0
- package/src/components/Chart/components/ChartTooltip.tsx +126 -0
- package/src/components/Chart/components/index.ts +3 -0
- package/src/components/Chart/constants.ts +78 -0
- package/src/components/Chart/helpers.ts +27 -0
- package/src/components/Chart/hooks/index.ts +1 -0
- package/src/components/Chart/hooks/useChart/index.ts +1 -0
- package/src/components/Chart/hooks/useChart/useChart.ts +12 -0
- package/src/components/Chart/index.ts +2 -0
- package/src/components/Chart/stories/args/activeShapeArgs.ts +34 -0
- package/src/components/Chart/stories/args/animationArgs.ts +67 -0
- package/src/components/Chart/stories/args/areaArgs.ts +16 -0
- package/src/components/Chart/stories/args/areaChartArgs.ts +19 -0
- package/src/components/Chart/stories/args/barArgs.ts +123 -0
- package/src/components/Chart/stories/args/barChartArgs.ts +65 -0
- package/src/components/Chart/stories/args/cartesianChartArgs.ts +42 -0
- package/src/components/Chart/stories/args/cartesianSharedArgs.ts +136 -0
- package/src/components/Chart/stories/args/chartArgs.ts +244 -0
- package/src/components/Chart/stories/args/dotArgs.ts +46 -0
- package/src/components/Chart/stories/args/events.ts +343 -0
- package/src/components/Chart/stories/args/index.ts +178 -0
- package/src/components/Chart/stories/args/labelListArgs.ts +124 -0
- package/src/components/Chart/stories/args/legendArgs.ts +205 -0
- package/src/components/Chart/stories/args/lineArgs.ts +87 -0
- package/src/components/Chart/stories/args/lineChartArgs.ts +17 -0
- package/src/components/Chart/stories/args/pieArgs.ts +18 -0
- package/src/components/Chart/stories/args/pieChartArgs.ts +7 -0
- package/src/components/Chart/stories/args/polarChartArgs.ts +86 -0
- package/src/components/Chart/stories/args/polarSharedArgs.ts +42 -0
- package/src/components/Chart/stories/args/radarArgs.ts +26 -0
- package/src/components/Chart/stories/args/radarChartArgs.ts +26 -0
- package/src/components/Chart/stories/args/radialBarArgs.ts +36 -0
- package/src/components/Chart/stories/args/radialBarChartArgs.ts +16 -0
- package/src/components/Chart/stories/args/rectangleArgs.ts +35 -0
- package/src/components/Chart/stories/args/referenceSharedArgs.ts +75 -0
- package/src/components/Chart/stories/args/sectorArgs.ts +106 -0
- package/src/components/Chart/stories/args/sharedAxisArgs.ts +332 -0
- package/src/components/Chart/stories/args/stylesArgs.ts +258 -0
- package/src/components/Chart/stories/args/textArgs.ts +97 -0
- package/src/components/Chart/stories/args/tooltipArgs.ts +41 -0
- package/src/components/Chart/stories/args/types.ts +23 -0
- package/src/components/Chart/stories/args/xAxisArgs.ts +109 -0
- package/src/components/Chart/stories/args/yAxisArgs.ts +73 -0
- package/src/components/Chart/stories/examples/AreaChart.tsx +156 -0
- package/src/components/Chart/stories/examples/BarChart.tsx +425 -0
- package/src/components/Chart/stories/examples/LineChart.tsx +144 -0
- package/src/components/Chart/stories/examples/PieChart.tsx +238 -0
- package/src/components/Chart/stories/examples/RadarChart.tsx +261 -0
- package/src/components/Chart/stories/examples/RadialChart.tsx +239 -0
- package/src/components/Chart/stories/examples/Tooltip.tsx +68 -0
- package/src/components/Chart/stories/helpers/index.tsx +75 -0
- package/src/components/Chart/types.ts +39 -0
- package/src/components/DragAndDrop/Draggable/Draggable.example.tsx +147 -0
- package/src/components/DragAndDrop/Draggable/Draggable.tsx +161 -0
- package/src/components/DragAndDrop/Draggable/constants.ts +47 -0
- package/src/components/DragAndDrop/Draggable/index.ts +1 -0
- package/src/components/DragAndDrop/Draggable/types.ts +56 -0
- package/src/components/DragAndDrop/Droppable/Droppable.example.tsx +86 -0
- package/src/components/DragAndDrop/Droppable/Droppable.tsx +38 -0
- package/src/components/DragAndDrop/Droppable/constants.ts +15 -0
- package/src/components/DragAndDrop/Droppable/index.ts +1 -0
- package/src/components/DragAndDrop/Droppable/types.ts +7 -0
- package/src/components/DragAndDrop/Sortable/Sortable.example.tsx +61 -0
- package/src/components/DragAndDrop/Sortable/Sortable.tsx +65 -0
- package/src/components/DragAndDrop/Sortable/constants.ts +12 -0
- package/src/components/DragAndDrop/Sortable/index.ts +1 -0
- package/src/components/DragAndDrop/Sortable/types.ts +11 -0
- package/src/components/DragAndDrop/index.ts +3 -0
- package/src/components/Widget/InternalWidgetsContext.tsx +4 -0
- package/src/components/Widget/Widget.tsx +17 -0
- package/src/components/Widget/Widgets.example.tsx +118 -0
- package/src/components/Widget/WidgetsContext.tsx +97 -0
- package/src/components/Widget/hooks/index.ts +2 -0
- package/src/components/Widget/hooks/useWidget/index.ts +1 -0
- package/src/components/Widget/hooks/useWidget/useWidget.ts +21 -0
- package/src/components/Widget/hooks/useWidgets/index.ts +1 -0
- package/src/components/Widget/hooks/useWidgets/useWidgets.ts +12 -0
- package/src/components/Widget/index.ts +3 -0
- package/src/components/Widget/modifiers/index.ts +1 -0
- package/src/components/Widget/modifiers/restrictToElement.ts +8 -0
- package/src/components/Widget/types.ts +30 -0
|
@@ -0,0 +1,106 @@
|
|
|
1
|
+
import { type ArgTypes } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Caveat: If any prop is added here, it would falsely be add to the documentation of the component
|
|
5
|
+
* where this group is used. If the group is to be extended, then only single props should be imported
|
|
6
|
+
* by each component that does not use all of them.
|
|
7
|
+
* */
|
|
8
|
+
export const sectorArgs: ArgTypes = {
|
|
9
|
+
cx: {
|
|
10
|
+
description: "The x-coordinate of center.",
|
|
11
|
+
table: {
|
|
12
|
+
type: {
|
|
13
|
+
summary: "number",
|
|
14
|
+
},
|
|
15
|
+
defaultValue: {
|
|
16
|
+
summary: "0",
|
|
17
|
+
},
|
|
18
|
+
},
|
|
19
|
+
control: "number",
|
|
20
|
+
},
|
|
21
|
+
cy: {
|
|
22
|
+
description: "The y-coordinate of center.",
|
|
23
|
+
table: {
|
|
24
|
+
type: {
|
|
25
|
+
summary: "number",
|
|
26
|
+
},
|
|
27
|
+
defaultValue: {
|
|
28
|
+
summary: "0",
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
control: "number",
|
|
32
|
+
},
|
|
33
|
+
innerRadius: {
|
|
34
|
+
description: "The inner radius of the sector.",
|
|
35
|
+
table: {
|
|
36
|
+
type: {
|
|
37
|
+
summary: "number",
|
|
38
|
+
},
|
|
39
|
+
defaultValue: {
|
|
40
|
+
summary: "0",
|
|
41
|
+
},
|
|
42
|
+
},
|
|
43
|
+
control: "number",
|
|
44
|
+
},
|
|
45
|
+
outerRadius: {
|
|
46
|
+
description: "The outer radius of the sector.",
|
|
47
|
+
table: {
|
|
48
|
+
type: {
|
|
49
|
+
summary: "number",
|
|
50
|
+
},
|
|
51
|
+
defaultValue: {
|
|
52
|
+
summary: "0",
|
|
53
|
+
},
|
|
54
|
+
},
|
|
55
|
+
control: "number",
|
|
56
|
+
},
|
|
57
|
+
startAngle: {
|
|
58
|
+
description: "The start angle of the sector.",
|
|
59
|
+
table: {
|
|
60
|
+
type: {
|
|
61
|
+
summary: "number",
|
|
62
|
+
},
|
|
63
|
+
defaultValue: {
|
|
64
|
+
summary: "0",
|
|
65
|
+
},
|
|
66
|
+
},
|
|
67
|
+
control: "number",
|
|
68
|
+
},
|
|
69
|
+
endAngle: {
|
|
70
|
+
description: "The end angle of the sector.",
|
|
71
|
+
table: {
|
|
72
|
+
type: {
|
|
73
|
+
summary: "number",
|
|
74
|
+
},
|
|
75
|
+
defaultValue: {
|
|
76
|
+
summary: "0",
|
|
77
|
+
},
|
|
78
|
+
},
|
|
79
|
+
control: "number",
|
|
80
|
+
},
|
|
81
|
+
cornerRadius: {
|
|
82
|
+
description: "The radius of corners.",
|
|
83
|
+
table: {
|
|
84
|
+
type: {
|
|
85
|
+
summary: "number",
|
|
86
|
+
},
|
|
87
|
+
defaultValue: {
|
|
88
|
+
summary: "0",
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
control: "number",
|
|
92
|
+
},
|
|
93
|
+
forceCornerRadius: {
|
|
94
|
+
description:
|
|
95
|
+
"Whether or not force to render round corner when the angle of sector is very small",
|
|
96
|
+
table: {
|
|
97
|
+
type: {
|
|
98
|
+
summary: "boolean",
|
|
99
|
+
},
|
|
100
|
+
defaultValue: {
|
|
101
|
+
summary: "false",
|
|
102
|
+
},
|
|
103
|
+
},
|
|
104
|
+
control: "boolean",
|
|
105
|
+
},
|
|
106
|
+
};
|
|
@@ -0,0 +1,332 @@
|
|
|
1
|
+
import { type ArgTypes } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
export const sharedAxisArgs: ArgTypes = {
|
|
4
|
+
hide: {
|
|
5
|
+
description: "If set true, the axis do not display in the chart.",
|
|
6
|
+
table: {
|
|
7
|
+
type: {
|
|
8
|
+
summary: "boolean",
|
|
9
|
+
},
|
|
10
|
+
defaultValue: {
|
|
11
|
+
summary: "false",
|
|
12
|
+
},
|
|
13
|
+
category: "General",
|
|
14
|
+
},
|
|
15
|
+
control: "boolean",
|
|
16
|
+
},
|
|
17
|
+
includeHidden: {
|
|
18
|
+
description: "Consider hidden graphical elements when computing domain.",
|
|
19
|
+
table: {
|
|
20
|
+
type: {
|
|
21
|
+
summary: "boolean",
|
|
22
|
+
},
|
|
23
|
+
defaultValue: {
|
|
24
|
+
summary: "false",
|
|
25
|
+
},
|
|
26
|
+
category: "Domain",
|
|
27
|
+
},
|
|
28
|
+
control: "boolean",
|
|
29
|
+
},
|
|
30
|
+
dataKey: {
|
|
31
|
+
description: "The key of data displayed in the axis.",
|
|
32
|
+
table: {
|
|
33
|
+
type: {
|
|
34
|
+
summary: "string | number | Function",
|
|
35
|
+
},
|
|
36
|
+
category: "General",
|
|
37
|
+
},
|
|
38
|
+
control: "text",
|
|
39
|
+
},
|
|
40
|
+
allowDecimals: {
|
|
41
|
+
description: "Allow the ticks to be decimals or not.",
|
|
42
|
+
table: {
|
|
43
|
+
type: {
|
|
44
|
+
summary: "boolean",
|
|
45
|
+
},
|
|
46
|
+
defaultValue: {
|
|
47
|
+
summary: "true",
|
|
48
|
+
},
|
|
49
|
+
category: "Ticks",
|
|
50
|
+
},
|
|
51
|
+
control: "boolean",
|
|
52
|
+
},
|
|
53
|
+
allowDataOverflow: {
|
|
54
|
+
description: `When domain of the axis is specified and the type of the axis is 'number',
|
|
55
|
+
if allowDataOverflow is set to be false, the domain will be adjusted when the minimum value
|
|
56
|
+
of data is smaller than domain[0] or the maximum value of data is greater than domain[1]
|
|
57
|
+
so that the axis displays all data values. If set to true, graphic elements (line, area, bars)
|
|
58
|
+
will be clipped to conform to the specified domain.`,
|
|
59
|
+
table: {
|
|
60
|
+
type: {
|
|
61
|
+
summary: "boolean",
|
|
62
|
+
},
|
|
63
|
+
defaultValue: {
|
|
64
|
+
summary: "false",
|
|
65
|
+
},
|
|
66
|
+
category: "Domain",
|
|
67
|
+
},
|
|
68
|
+
control: "boolean",
|
|
69
|
+
},
|
|
70
|
+
allowDuplicatedCategory: {
|
|
71
|
+
description:
|
|
72
|
+
'Allow the axis has duplicated categories or not when the type of axis is "category".',
|
|
73
|
+
table: {
|
|
74
|
+
type: {
|
|
75
|
+
summary: "boolean",
|
|
76
|
+
},
|
|
77
|
+
defaultValue: {
|
|
78
|
+
summary: "true",
|
|
79
|
+
},
|
|
80
|
+
category: "Domain",
|
|
81
|
+
},
|
|
82
|
+
control: "boolean",
|
|
83
|
+
},
|
|
84
|
+
angle: {
|
|
85
|
+
description: "The angle of axis ticks.",
|
|
86
|
+
table: {
|
|
87
|
+
type: {
|
|
88
|
+
summary: "number",
|
|
89
|
+
},
|
|
90
|
+
defaultValue: {
|
|
91
|
+
summary: "0",
|
|
92
|
+
},
|
|
93
|
+
category: "Ticks",
|
|
94
|
+
},
|
|
95
|
+
control: "number",
|
|
96
|
+
},
|
|
97
|
+
tickCount: {
|
|
98
|
+
description: "The count of axis ticks. Not used if 'type' is 'category'.",
|
|
99
|
+
table: {
|
|
100
|
+
type: {
|
|
101
|
+
summary: "number",
|
|
102
|
+
},
|
|
103
|
+
defaultValue: {
|
|
104
|
+
summary: "5",
|
|
105
|
+
},
|
|
106
|
+
category: "Ticks",
|
|
107
|
+
},
|
|
108
|
+
control: "number",
|
|
109
|
+
},
|
|
110
|
+
domain: {
|
|
111
|
+
description: `Specify the domain of axis when the axis is a number axis. The length of domain should be 2,
|
|
112
|
+
and we will validate the values in domain. And each element in the array can be a number,
|
|
113
|
+
'auto', 'dataMin', 'dataMax', a string like 'dataMin - 20', 'dataMax + 100', or a function
|
|
114
|
+
that accepts a single argument and returns a number. If any element of domain is set to be
|
|
115
|
+
'auto', comprehensible scale ticks will be calculated, and the final domain of axis is generated
|
|
116
|
+
by the ticks. If a function, receives '[dataMin, dataMax]', and must return a computed domain
|
|
117
|
+
as '[min, max]'.`,
|
|
118
|
+
table: {
|
|
119
|
+
type: {
|
|
120
|
+
summary: "Array | Function",
|
|
121
|
+
},
|
|
122
|
+
defaultValue: {
|
|
123
|
+
summary: "[0, 'auto']",
|
|
124
|
+
},
|
|
125
|
+
category: "Domain",
|
|
126
|
+
},
|
|
127
|
+
control: "object",
|
|
128
|
+
},
|
|
129
|
+
interval: {
|
|
130
|
+
description: `If set 0, all the ticks will be shown. If set preserveStart", "preserveEnd" or "preserveStartEnd",
|
|
131
|
+
the ticks which is to be shown or hidden will be calculated automatically.`,
|
|
132
|
+
table: {
|
|
133
|
+
type: {
|
|
134
|
+
summary: '"preserveStart" | "preserveEnd" | "preserveStartEnd" | number',
|
|
135
|
+
},
|
|
136
|
+
defaultValue: {
|
|
137
|
+
summary: "'preserveEnd'",
|
|
138
|
+
},
|
|
139
|
+
category: "Ticks",
|
|
140
|
+
},
|
|
141
|
+
control: "radio",
|
|
142
|
+
options: ["preserveStart", "preserveEnd", "preserveStartEnd"],
|
|
143
|
+
},
|
|
144
|
+
minTickGap: {
|
|
145
|
+
description: "The minimum gap between two adjacent labels.",
|
|
146
|
+
table: {
|
|
147
|
+
type: {
|
|
148
|
+
summary: "number",
|
|
149
|
+
},
|
|
150
|
+
defaultValue: {
|
|
151
|
+
summary: "5",
|
|
152
|
+
},
|
|
153
|
+
category: "Ticks",
|
|
154
|
+
},
|
|
155
|
+
control: "number",
|
|
156
|
+
},
|
|
157
|
+
axisLine: {
|
|
158
|
+
description:
|
|
159
|
+
"If set false, no axis line will be drawn. If set a object, the option is the configuration of axis line.",
|
|
160
|
+
table: {
|
|
161
|
+
type: {
|
|
162
|
+
summary: "boolean | object",
|
|
163
|
+
},
|
|
164
|
+
defaultValue: {
|
|
165
|
+
summary: "true",
|
|
166
|
+
},
|
|
167
|
+
category: "General",
|
|
168
|
+
},
|
|
169
|
+
control: "boolean",
|
|
170
|
+
},
|
|
171
|
+
tickLine: {
|
|
172
|
+
description:
|
|
173
|
+
"If set false, no axis tick lines will be drawn. If set a object, the option is the configuration of tick lines.",
|
|
174
|
+
table: {
|
|
175
|
+
type: {
|
|
176
|
+
summary: "boolean | object",
|
|
177
|
+
},
|
|
178
|
+
defaultValue: {
|
|
179
|
+
summary: "true",
|
|
180
|
+
},
|
|
181
|
+
category: "Ticks",
|
|
182
|
+
},
|
|
183
|
+
control: "boolean",
|
|
184
|
+
},
|
|
185
|
+
tickSize: {
|
|
186
|
+
description: "The length of tick line.",
|
|
187
|
+
table: {
|
|
188
|
+
type: {
|
|
189
|
+
summary: "number",
|
|
190
|
+
},
|
|
191
|
+
defaultValue: {
|
|
192
|
+
summary: "6",
|
|
193
|
+
},
|
|
194
|
+
category: "Ticks",
|
|
195
|
+
},
|
|
196
|
+
control: "number",
|
|
197
|
+
},
|
|
198
|
+
tickFormatter: {
|
|
199
|
+
description: "The formatter function of tick.",
|
|
200
|
+
table: {
|
|
201
|
+
type: {
|
|
202
|
+
summary: "Function",
|
|
203
|
+
},
|
|
204
|
+
category: "Ticks",
|
|
205
|
+
},
|
|
206
|
+
control: "object",
|
|
207
|
+
},
|
|
208
|
+
ticks: {
|
|
209
|
+
description: "Set the values of axis ticks manually.",
|
|
210
|
+
table: {
|
|
211
|
+
type: {
|
|
212
|
+
summary: "Array",
|
|
213
|
+
},
|
|
214
|
+
category: "Ticks",
|
|
215
|
+
},
|
|
216
|
+
control: "object",
|
|
217
|
+
},
|
|
218
|
+
tick: {
|
|
219
|
+
description: `If set false, no ticks will be drawn. If set a object, the option is the configuration of ticks.
|
|
220
|
+
If set a React element, the option is the custom react element of drawing ticks.`,
|
|
221
|
+
table: {
|
|
222
|
+
type: {
|
|
223
|
+
summary: "boolean | object | ReactElement",
|
|
224
|
+
},
|
|
225
|
+
category: "Ticks",
|
|
226
|
+
},
|
|
227
|
+
control: "object",
|
|
228
|
+
},
|
|
229
|
+
mirror: {
|
|
230
|
+
description:
|
|
231
|
+
"If set true, flips ticks around the horizontal axis line, displaying the labels inside the chart instead of outside.",
|
|
232
|
+
table: {
|
|
233
|
+
type: {
|
|
234
|
+
summary: "boolean",
|
|
235
|
+
},
|
|
236
|
+
defaultValue: {
|
|
237
|
+
summary: "false",
|
|
238
|
+
},
|
|
239
|
+
category: "General",
|
|
240
|
+
},
|
|
241
|
+
control: "boolean",
|
|
242
|
+
},
|
|
243
|
+
reversed: {
|
|
244
|
+
description: "Reverses ticks left-to-right.",
|
|
245
|
+
table: {
|
|
246
|
+
type: {
|
|
247
|
+
summary: "boolean",
|
|
248
|
+
},
|
|
249
|
+
defaultValue: {
|
|
250
|
+
summary: "false",
|
|
251
|
+
},
|
|
252
|
+
category: "General",
|
|
253
|
+
},
|
|
254
|
+
control: "boolean",
|
|
255
|
+
},
|
|
256
|
+
label: {
|
|
257
|
+
description: `If set a string or a number, default label will be drawn, and the option is content.
|
|
258
|
+
If set a React element, the option is the custom react element of drawing label.
|
|
259
|
+
If an object, the option is the props of a new Label instance.`,
|
|
260
|
+
table: {
|
|
261
|
+
type: {
|
|
262
|
+
summary: "string | number | ReactElement | object",
|
|
263
|
+
},
|
|
264
|
+
category: "General",
|
|
265
|
+
},
|
|
266
|
+
control: "object",
|
|
267
|
+
},
|
|
268
|
+
scale: {
|
|
269
|
+
description: `If set to 'auto', the scale function is decided by the type of chart, and the props type.
|
|
270
|
+
\nWhen set to 'time', make sure to also set type to 'number' and to include a domain.`,
|
|
271
|
+
table: {
|
|
272
|
+
type: {
|
|
273
|
+
summary: `'auto' | 'linear' | 'pow' | 'sqrt' | 'log' | 'identity' | 'time' |
|
|
274
|
+
'band' | 'point' | 'ordinal' | 'quantile' | 'quantize' | 'utc' | 'sequential' | 'threshold' | Function`,
|
|
275
|
+
},
|
|
276
|
+
defaultValue: {
|
|
277
|
+
summary: "'auto'",
|
|
278
|
+
},
|
|
279
|
+
category: "General",
|
|
280
|
+
},
|
|
281
|
+
control: "select",
|
|
282
|
+
options: [
|
|
283
|
+
"auto",
|
|
284
|
+
"linear",
|
|
285
|
+
"pow",
|
|
286
|
+
"sqrt",
|
|
287
|
+
"log",
|
|
288
|
+
"identity",
|
|
289
|
+
"time",
|
|
290
|
+
"band",
|
|
291
|
+
"point",
|
|
292
|
+
"ordinal",
|
|
293
|
+
"quantile",
|
|
294
|
+
"quantize",
|
|
295
|
+
"utc",
|
|
296
|
+
"sequential",
|
|
297
|
+
"threshold",
|
|
298
|
+
],
|
|
299
|
+
},
|
|
300
|
+
unit: {
|
|
301
|
+
description:
|
|
302
|
+
"The unit of data displayed in the axis. This option will be used to represent an index unit in a scatter chart.",
|
|
303
|
+
table: {
|
|
304
|
+
type: {
|
|
305
|
+
summary: "string | number",
|
|
306
|
+
},
|
|
307
|
+
category: "General",
|
|
308
|
+
},
|
|
309
|
+
control: "text",
|
|
310
|
+
},
|
|
311
|
+
name: {
|
|
312
|
+
description:
|
|
313
|
+
"The name of data displayed in the axis. This option will be used to represent an index in a scatter chart.",
|
|
314
|
+
table: {
|
|
315
|
+
type: {
|
|
316
|
+
summary: "string | number",
|
|
317
|
+
},
|
|
318
|
+
category: "General",
|
|
319
|
+
},
|
|
320
|
+
control: "text",
|
|
321
|
+
},
|
|
322
|
+
tickMargin: {
|
|
323
|
+
description: "The margin between tick line and tick.",
|
|
324
|
+
table: {
|
|
325
|
+
type: {
|
|
326
|
+
summary: "number",
|
|
327
|
+
},
|
|
328
|
+
category: "General",
|
|
329
|
+
},
|
|
330
|
+
control: "number",
|
|
331
|
+
},
|
|
332
|
+
};
|
|
@@ -0,0 +1,258 @@
|
|
|
1
|
+
import type { Args, ArgTypes } from "@storybook/react";
|
|
2
|
+
|
|
3
|
+
export const hide: ArgTypes[0] = {
|
|
4
|
+
description: "Hides the component when true, useful when toggling visibility state via legend",
|
|
5
|
+
type: {
|
|
6
|
+
name: "boolean",
|
|
7
|
+
},
|
|
8
|
+
table: {
|
|
9
|
+
category: "Style",
|
|
10
|
+
defaultValue: {
|
|
11
|
+
summary: "false",
|
|
12
|
+
},
|
|
13
|
+
},
|
|
14
|
+
control: "boolean",
|
|
15
|
+
};
|
|
16
|
+
|
|
17
|
+
export const generalStyleArgs: ArgTypes = {
|
|
18
|
+
fill: {
|
|
19
|
+
table: {
|
|
20
|
+
category: "Style",
|
|
21
|
+
},
|
|
22
|
+
control: "color",
|
|
23
|
+
},
|
|
24
|
+
stroke: {
|
|
25
|
+
table: {
|
|
26
|
+
category: "Style",
|
|
27
|
+
},
|
|
28
|
+
control: "color",
|
|
29
|
+
},
|
|
30
|
+
strokeDasharray: {
|
|
31
|
+
description: `The pattern of dashes and gaps used to paint the line.
|
|
32
|
+
https://developer.mozilla.org/en-US/docs/Web/SVG/Attribute/stroke-dasharray`,
|
|
33
|
+
table: {
|
|
34
|
+
type: {
|
|
35
|
+
summary: "string",
|
|
36
|
+
},
|
|
37
|
+
category: "Style",
|
|
38
|
+
},
|
|
39
|
+
control: "text",
|
|
40
|
+
},
|
|
41
|
+
strokeWidth: {
|
|
42
|
+
description: "The width of the stroke.",
|
|
43
|
+
table: {
|
|
44
|
+
type: {
|
|
45
|
+
summary: "string | number",
|
|
46
|
+
},
|
|
47
|
+
defaultValue: {
|
|
48
|
+
summary: "1",
|
|
49
|
+
},
|
|
50
|
+
category: "Style",
|
|
51
|
+
},
|
|
52
|
+
control: "text",
|
|
53
|
+
},
|
|
54
|
+
strokeOpacity: {
|
|
55
|
+
description: "The opacity of the stroke.",
|
|
56
|
+
table: {
|
|
57
|
+
type: {
|
|
58
|
+
summary: "string | number",
|
|
59
|
+
},
|
|
60
|
+
defaultValue: {
|
|
61
|
+
summary: "1",
|
|
62
|
+
},
|
|
63
|
+
category: "Style",
|
|
64
|
+
},
|
|
65
|
+
control: "text",
|
|
66
|
+
},
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
// These label props are use by radial bar as as well as line and area.
|
|
70
|
+
export const labelDescription = `If false set, labels will not be drawn. If true set, labels will be drawn which have
|
|
71
|
+
the props calculated internally. If object set, labels will be drawn which have the props merged
|
|
72
|
+
by the internal calculated props and the option. If ReactElement set, the option can be the custom
|
|
73
|
+
label element. If set a function, the function will be called to render customized label.`;
|
|
74
|
+
|
|
75
|
+
export const labelSummary = "boolean | Object | ReactElement | Function";
|
|
76
|
+
|
|
77
|
+
// Currently these props are exclusive to radial bar.
|
|
78
|
+
export const radialBarStyleArgs: Args = {
|
|
79
|
+
minPointSize: {
|
|
80
|
+
description: "The minimum angle of the radial bar.",
|
|
81
|
+
table: {
|
|
82
|
+
type: {
|
|
83
|
+
summary: "number",
|
|
84
|
+
},
|
|
85
|
+
defaultValue: {
|
|
86
|
+
summary: "0",
|
|
87
|
+
},
|
|
88
|
+
category: "Style",
|
|
89
|
+
},
|
|
90
|
+
control: "number",
|
|
91
|
+
},
|
|
92
|
+
label: {
|
|
93
|
+
description: labelDescription,
|
|
94
|
+
table: {
|
|
95
|
+
type: {
|
|
96
|
+
summary: labelSummary,
|
|
97
|
+
detail:
|
|
98
|
+
'<Bar dataKey="value" label />\n' +
|
|
99
|
+
"<Bar dataKey=\"value\" label={{ fill: '#333', fontSize: 15, position: 'insideStart' }} />\n" +
|
|
100
|
+
'<Bar dataKey="value" label={<CustomizedLabel />} />\n' +
|
|
101
|
+
'<Bar dataKey="value" label={renderLabel} />',
|
|
102
|
+
},
|
|
103
|
+
defaultValue: {
|
|
104
|
+
summary: "false",
|
|
105
|
+
},
|
|
106
|
+
category: "Style",
|
|
107
|
+
},
|
|
108
|
+
control: "number",
|
|
109
|
+
},
|
|
110
|
+
// Object example is not included as the only props which seem to be supported
|
|
111
|
+
// are cx and cy which not seem to provide much value.
|
|
112
|
+
background: {
|
|
113
|
+
description: `If false set, background of bars will not be drawn. If true set, background of bars will be
|
|
114
|
+
drawn which have the props calculated internally. If object set, background of bars will be drawn which
|
|
115
|
+
have the props merged by the internal calculated props and the option. If ReactElement set, the option
|
|
116
|
+
can be the custom background element. If set a function, the function will be called to render customized
|
|
117
|
+
background.`,
|
|
118
|
+
table: {
|
|
119
|
+
type: {
|
|
120
|
+
summary: "boolean | Object | ReactElement | Function",
|
|
121
|
+
detail:
|
|
122
|
+
'<Bar dataKey="value" background />\n' +
|
|
123
|
+
'<Bar dataKey="value" background={<CustomizedBackground />} />\n' +
|
|
124
|
+
'<Bar dataKey="value" background={renderBackground} />',
|
|
125
|
+
},
|
|
126
|
+
defaultValue: false,
|
|
127
|
+
category: "Style",
|
|
128
|
+
},
|
|
129
|
+
control: "object",
|
|
130
|
+
},
|
|
131
|
+
cornerRadius: {
|
|
132
|
+
description: "The radius of the corner of the bar.",
|
|
133
|
+
table: {
|
|
134
|
+
type: {
|
|
135
|
+
summary: "number",
|
|
136
|
+
},
|
|
137
|
+
defaultValue: {
|
|
138
|
+
summary: "0",
|
|
139
|
+
},
|
|
140
|
+
category: "Style",
|
|
141
|
+
},
|
|
142
|
+
control: "number",
|
|
143
|
+
},
|
|
144
|
+
forceCornerRadius: {
|
|
145
|
+
description:
|
|
146
|
+
"Whether or not force to render round corner when the angle of sector is very small",
|
|
147
|
+
table: {
|
|
148
|
+
type: {
|
|
149
|
+
summary: "boolean",
|
|
150
|
+
},
|
|
151
|
+
defaultValue: {
|
|
152
|
+
summary: "false",
|
|
153
|
+
},
|
|
154
|
+
category: "Style",
|
|
155
|
+
},
|
|
156
|
+
control: "boolean",
|
|
157
|
+
},
|
|
158
|
+
cornerIsExternal: {
|
|
159
|
+
description: `If true the rounded corner will lie outside the RadialBar, by default the rounded
|
|
160
|
+
corner inside the length of the RadialBar`,
|
|
161
|
+
table: {
|
|
162
|
+
type: {
|
|
163
|
+
summary: "boolean",
|
|
164
|
+
},
|
|
165
|
+
defaultValue: {
|
|
166
|
+
summary: "false",
|
|
167
|
+
},
|
|
168
|
+
category: "Style",
|
|
169
|
+
},
|
|
170
|
+
control: "boolean",
|
|
171
|
+
},
|
|
172
|
+
shape: {
|
|
173
|
+
description: "Custom shape for the bar.",
|
|
174
|
+
table: {
|
|
175
|
+
type: {
|
|
176
|
+
summary: "ReactElement | Function",
|
|
177
|
+
detail:
|
|
178
|
+
'<Bar dataKey="value" shape={<CustomizedShape />} />\n<Bar dataKey="value" shape={renderShape} />',
|
|
179
|
+
},
|
|
180
|
+
category: "Style",
|
|
181
|
+
},
|
|
182
|
+
},
|
|
183
|
+
hide,
|
|
184
|
+
activeShape: {
|
|
185
|
+
description: "The custom active shape.",
|
|
186
|
+
table: {
|
|
187
|
+
type: {
|
|
188
|
+
summary: "ReactElement | Function",
|
|
189
|
+
detail:
|
|
190
|
+
'<Bar dataKey="value" activeShape={<CustomizedActiveShape />} />\n' +
|
|
191
|
+
'<Bar dataKey="value" activeShape={renderActiveShape} />',
|
|
192
|
+
},
|
|
193
|
+
category: "Style",
|
|
194
|
+
},
|
|
195
|
+
},
|
|
196
|
+
activeIndex: {
|
|
197
|
+
description: "The index of the active bar, this option can be changed in mouse event handlers.",
|
|
198
|
+
table: {
|
|
199
|
+
type: {
|
|
200
|
+
summary: "number | number[]",
|
|
201
|
+
detail:
|
|
202
|
+
'<Bar dataKey="value" activeIndex={0} />\n<Bar dataKey="value" activeIndex={[0, 1]} />',
|
|
203
|
+
},
|
|
204
|
+
category: "Style",
|
|
205
|
+
control: "object",
|
|
206
|
+
},
|
|
207
|
+
},
|
|
208
|
+
maxBarSize: {
|
|
209
|
+
description: "The maximum width of the bar.",
|
|
210
|
+
table: {
|
|
211
|
+
type: {
|
|
212
|
+
summary: "number",
|
|
213
|
+
},
|
|
214
|
+
category: "Style",
|
|
215
|
+
},
|
|
216
|
+
control: "number",
|
|
217
|
+
},
|
|
218
|
+
stroke: {
|
|
219
|
+
description: "The color of the stroke.",
|
|
220
|
+
table: {
|
|
221
|
+
type: {
|
|
222
|
+
summary: "string",
|
|
223
|
+
},
|
|
224
|
+
category: "Style",
|
|
225
|
+
},
|
|
226
|
+
control: "color",
|
|
227
|
+
},
|
|
228
|
+
strokeWidth: {
|
|
229
|
+
description: "The width of the stroke.",
|
|
230
|
+
table: {
|
|
231
|
+
type: {
|
|
232
|
+
summary: "number",
|
|
233
|
+
},
|
|
234
|
+
category: "Style",
|
|
235
|
+
},
|
|
236
|
+
control: "number",
|
|
237
|
+
},
|
|
238
|
+
strokeOpacity: {
|
|
239
|
+
description: "The opacity of the stroke.",
|
|
240
|
+
table: {
|
|
241
|
+
type: {
|
|
242
|
+
summary: "number",
|
|
243
|
+
},
|
|
244
|
+
category: "Style",
|
|
245
|
+
},
|
|
246
|
+
control: "number",
|
|
247
|
+
},
|
|
248
|
+
fillOpacity: {
|
|
249
|
+
description: "The opacity of the fill.",
|
|
250
|
+
table: {
|
|
251
|
+
type: {
|
|
252
|
+
summary: "number",
|
|
253
|
+
},
|
|
254
|
+
category: "Style",
|
|
255
|
+
},
|
|
256
|
+
control: "number",
|
|
257
|
+
},
|
|
258
|
+
};
|