@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.
Files changed (168) hide show
  1. package/dist/types/components/Chart/Chart.d.ts +2 -0
  2. package/dist/types/components/Chart/ChartContext.d.ts +2 -0
  3. package/dist/types/components/Chart/components/ChartLegend.d.ts +4 -0
  4. package/dist/types/components/Chart/components/ChartStyle.d.ts +2 -0
  5. package/dist/types/components/Chart/components/ChartTooltip.d.ts +4 -0
  6. package/dist/types/components/Chart/components/index.d.ts +3 -0
  7. package/dist/types/components/Chart/constants.d.ts +22 -0
  8. package/dist/types/components/Chart/helpers.d.ts +11 -0
  9. package/dist/types/components/Chart/hooks/index.d.ts +1 -0
  10. package/dist/types/components/Chart/hooks/useChart/index.d.ts +1 -0
  11. package/dist/types/components/Chart/hooks/useChart/useChart.d.ts +1 -0
  12. package/dist/types/components/Chart/index.d.ts +2 -0
  13. package/dist/types/components/Chart/stories/args/activeShapeArgs.d.ts +2 -0
  14. package/dist/types/components/Chart/stories/args/animationArgs.d.ts +12 -0
  15. package/dist/types/components/Chart/stories/args/areaArgs.d.ts +2 -0
  16. package/dist/types/components/Chart/stories/args/areaChartArgs.d.ts +2 -0
  17. package/dist/types/components/Chart/stories/args/barArgs.d.ts +5 -0
  18. package/dist/types/components/Chart/stories/args/barChartArgs.d.ts +2 -0
  19. package/dist/types/components/Chart/stories/args/cartesianChartArgs.d.ts +2 -0
  20. package/dist/types/components/Chart/stories/args/cartesianSharedArgs.d.ts +11 -0
  21. package/dist/types/components/Chart/stories/args/chartArgs.d.ts +6 -0
  22. package/dist/types/components/Chart/stories/args/dotArgs.d.ts +10 -0
  23. package/dist/types/components/Chart/stories/args/events.d.ts +804 -0
  24. package/dist/types/components/Chart/stories/args/labelListArgs.d.ts +2 -0
  25. package/dist/types/components/Chart/stories/args/legendArgs.d.ts +3 -0
  26. package/dist/types/components/Chart/stories/args/lineArgs.d.ts +2 -0
  27. package/dist/types/components/Chart/stories/args/lineChartArgs.d.ts +2 -0
  28. package/dist/types/components/Chart/stories/args/pieArgs.d.ts +2 -0
  29. package/dist/types/components/Chart/stories/args/pieChartArgs.d.ts +2 -0
  30. package/dist/types/components/Chart/stories/args/polarChartArgs.d.ts +2 -0
  31. package/dist/types/components/Chart/stories/args/polarSharedArgs.d.ts +2 -0
  32. package/dist/types/components/Chart/stories/args/radarArgs.d.ts +2 -0
  33. package/dist/types/components/Chart/stories/args/radarChartArgs.d.ts +2 -0
  34. package/dist/types/components/Chart/stories/args/radialBarArgs.d.ts +2 -0
  35. package/dist/types/components/Chart/stories/args/radialBarChartArgs.d.ts +2 -0
  36. package/dist/types/components/Chart/stories/args/rectangleArgs.d.ts +9 -0
  37. package/dist/types/components/Chart/stories/args/referenceSharedArgs.d.ts +4 -0
  38. package/dist/types/components/Chart/stories/args/sectorArgs.d.ts +7 -0
  39. package/dist/types/components/Chart/stories/args/sharedAxisArgs.d.ts +2 -0
  40. package/dist/types/components/Chart/stories/args/stylesArgs.d.ts +6 -0
  41. package/dist/types/components/Chart/stories/args/textArgs.d.ts +2 -0
  42. package/dist/types/components/Chart/stories/args/tooltipArgs.d.ts +4 -0
  43. package/dist/types/components/Chart/stories/args/types.d.ts +13 -0
  44. package/dist/types/components/Chart/stories/args/xAxisArgs.d.ts +2 -0
  45. package/dist/types/components/Chart/stories/args/yAxisArgs.d.ts +2 -0
  46. package/dist/types/components/Chart/stories/examples/AreaChart.d.ts +16 -0
  47. package/dist/types/components/Chart/stories/examples/BarChart.d.ts +20 -0
  48. package/dist/types/components/Chart/stories/examples/LineChart.d.ts +16 -0
  49. package/dist/types/components/Chart/stories/examples/PieChart.d.ts +19 -0
  50. package/dist/types/components/Chart/stories/examples/RadarChart.d.ts +24 -0
  51. package/dist/types/components/Chart/stories/examples/RadialChart.d.ts +17 -0
  52. package/dist/types/components/Chart/stories/examples/Tooltip.d.ts +15 -0
  53. package/dist/types/components/Chart/stories/helpers/index.d.ts +9 -0
  54. package/dist/types/components/Chart/types.d.ts +37 -0
  55. package/dist/types/components/DragAndDrop/Draggable/Draggable.d.ts +29 -0
  56. package/dist/types/components/DragAndDrop/Draggable/Draggable.example.d.ts +24 -0
  57. package/dist/types/components/DragAndDrop/Draggable/constants.d.ts +9 -0
  58. package/dist/types/components/DragAndDrop/Draggable/index.d.ts +1 -0
  59. package/dist/types/components/DragAndDrop/Draggable/types.d.ts +41 -0
  60. package/dist/types/components/DragAndDrop/Droppable/Droppable.d.ts +2 -0
  61. package/dist/types/components/DragAndDrop/Droppable/Droppable.example.d.ts +10 -0
  62. package/dist/types/components/DragAndDrop/Droppable/constants.d.ts +5 -0
  63. package/dist/types/components/DragAndDrop/Droppable/index.d.ts +1 -0
  64. package/dist/types/components/DragAndDrop/Droppable/types.d.ts +4 -0
  65. package/dist/types/components/DragAndDrop/Sortable/Sortable.d.ts +2 -0
  66. package/dist/types/components/DragAndDrop/Sortable/Sortable.example.d.ts +6 -0
  67. package/dist/types/components/DragAndDrop/Sortable/constants.d.ts +4 -0
  68. package/dist/types/components/DragAndDrop/Sortable/index.d.ts +1 -0
  69. package/dist/types/components/DragAndDrop/Sortable/types.d.ts +7 -0
  70. package/dist/types/components/DragAndDrop/index.d.ts +3 -0
  71. package/dist/types/components/Widget/InternalWidgetsContext.d.ts +2 -0
  72. package/dist/types/components/Widget/Widget.d.ts +2 -0
  73. package/dist/types/components/Widget/Widgets.example.d.ts +1 -0
  74. package/dist/types/components/Widget/WidgetsContext.d.ts +2 -0
  75. package/dist/types/components/Widget/hooks/index.d.ts +2 -0
  76. package/dist/types/components/Widget/hooks/useWidget/index.d.ts +1 -0
  77. package/dist/types/components/Widget/hooks/useWidget/useWidget.d.ts +7 -0
  78. package/dist/types/components/Widget/hooks/useWidgets/index.d.ts +1 -0
  79. package/dist/types/components/Widget/hooks/useWidgets/useWidgets.d.ts +1 -0
  80. package/dist/types/components/Widget/index.d.ts +3 -0
  81. package/dist/types/components/Widget/modifiers/index.d.ts +1 -0
  82. package/dist/types/components/Widget/modifiers/restrictToElement.d.ts +2 -0
  83. package/dist/types/components/Widget/types.d.ts +28 -0
  84. package/package.json +9 -3
  85. package/src/components/Chart/Chart.tsx +26 -0
  86. package/src/components/Chart/ChartContext.tsx +4 -0
  87. package/src/components/Chart/components/ChartLegend.tsx +52 -0
  88. package/src/components/Chart/components/ChartStyle.tsx +32 -0
  89. package/src/components/Chart/components/ChartTooltip.tsx +126 -0
  90. package/src/components/Chart/components/index.ts +3 -0
  91. package/src/components/Chart/constants.ts +78 -0
  92. package/src/components/Chart/helpers.ts +27 -0
  93. package/src/components/Chart/hooks/index.ts +1 -0
  94. package/src/components/Chart/hooks/useChart/index.ts +1 -0
  95. package/src/components/Chart/hooks/useChart/useChart.ts +12 -0
  96. package/src/components/Chart/index.ts +2 -0
  97. package/src/components/Chart/stories/args/activeShapeArgs.ts +34 -0
  98. package/src/components/Chart/stories/args/animationArgs.ts +67 -0
  99. package/src/components/Chart/stories/args/areaArgs.ts +16 -0
  100. package/src/components/Chart/stories/args/areaChartArgs.ts +19 -0
  101. package/src/components/Chart/stories/args/barArgs.ts +123 -0
  102. package/src/components/Chart/stories/args/barChartArgs.ts +65 -0
  103. package/src/components/Chart/stories/args/cartesianChartArgs.ts +42 -0
  104. package/src/components/Chart/stories/args/cartesianSharedArgs.ts +136 -0
  105. package/src/components/Chart/stories/args/chartArgs.ts +244 -0
  106. package/src/components/Chart/stories/args/dotArgs.ts +46 -0
  107. package/src/components/Chart/stories/args/events.ts +343 -0
  108. package/src/components/Chart/stories/args/index.ts +178 -0
  109. package/src/components/Chart/stories/args/labelListArgs.ts +124 -0
  110. package/src/components/Chart/stories/args/legendArgs.ts +205 -0
  111. package/src/components/Chart/stories/args/lineArgs.ts +87 -0
  112. package/src/components/Chart/stories/args/lineChartArgs.ts +17 -0
  113. package/src/components/Chart/stories/args/pieArgs.ts +18 -0
  114. package/src/components/Chart/stories/args/pieChartArgs.ts +7 -0
  115. package/src/components/Chart/stories/args/polarChartArgs.ts +86 -0
  116. package/src/components/Chart/stories/args/polarSharedArgs.ts +42 -0
  117. package/src/components/Chart/stories/args/radarArgs.ts +26 -0
  118. package/src/components/Chart/stories/args/radarChartArgs.ts +26 -0
  119. package/src/components/Chart/stories/args/radialBarArgs.ts +36 -0
  120. package/src/components/Chart/stories/args/radialBarChartArgs.ts +16 -0
  121. package/src/components/Chart/stories/args/rectangleArgs.ts +35 -0
  122. package/src/components/Chart/stories/args/referenceSharedArgs.ts +75 -0
  123. package/src/components/Chart/stories/args/sectorArgs.ts +106 -0
  124. package/src/components/Chart/stories/args/sharedAxisArgs.ts +332 -0
  125. package/src/components/Chart/stories/args/stylesArgs.ts +258 -0
  126. package/src/components/Chart/stories/args/textArgs.ts +97 -0
  127. package/src/components/Chart/stories/args/tooltipArgs.ts +41 -0
  128. package/src/components/Chart/stories/args/types.ts +23 -0
  129. package/src/components/Chart/stories/args/xAxisArgs.ts +109 -0
  130. package/src/components/Chart/stories/args/yAxisArgs.ts +73 -0
  131. package/src/components/Chart/stories/examples/AreaChart.tsx +156 -0
  132. package/src/components/Chart/stories/examples/BarChart.tsx +425 -0
  133. package/src/components/Chart/stories/examples/LineChart.tsx +144 -0
  134. package/src/components/Chart/stories/examples/PieChart.tsx +238 -0
  135. package/src/components/Chart/stories/examples/RadarChart.tsx +261 -0
  136. package/src/components/Chart/stories/examples/RadialChart.tsx +239 -0
  137. package/src/components/Chart/stories/examples/Tooltip.tsx +68 -0
  138. package/src/components/Chart/stories/helpers/index.tsx +75 -0
  139. package/src/components/Chart/types.ts +39 -0
  140. package/src/components/DragAndDrop/Draggable/Draggable.example.tsx +147 -0
  141. package/src/components/DragAndDrop/Draggable/Draggable.tsx +161 -0
  142. package/src/components/DragAndDrop/Draggable/constants.ts +47 -0
  143. package/src/components/DragAndDrop/Draggable/index.ts +1 -0
  144. package/src/components/DragAndDrop/Draggable/types.ts +56 -0
  145. package/src/components/DragAndDrop/Droppable/Droppable.example.tsx +86 -0
  146. package/src/components/DragAndDrop/Droppable/Droppable.tsx +38 -0
  147. package/src/components/DragAndDrop/Droppable/constants.ts +15 -0
  148. package/src/components/DragAndDrop/Droppable/index.ts +1 -0
  149. package/src/components/DragAndDrop/Droppable/types.ts +7 -0
  150. package/src/components/DragAndDrop/Sortable/Sortable.example.tsx +61 -0
  151. package/src/components/DragAndDrop/Sortable/Sortable.tsx +65 -0
  152. package/src/components/DragAndDrop/Sortable/constants.ts +12 -0
  153. package/src/components/DragAndDrop/Sortable/index.ts +1 -0
  154. package/src/components/DragAndDrop/Sortable/types.ts +11 -0
  155. package/src/components/DragAndDrop/index.ts +3 -0
  156. package/src/components/Widget/InternalWidgetsContext.tsx +4 -0
  157. package/src/components/Widget/Widget.tsx +17 -0
  158. package/src/components/Widget/Widgets.example.tsx +118 -0
  159. package/src/components/Widget/WidgetsContext.tsx +97 -0
  160. package/src/components/Widget/hooks/index.ts +2 -0
  161. package/src/components/Widget/hooks/useWidget/index.ts +1 -0
  162. package/src/components/Widget/hooks/useWidget/useWidget.ts +21 -0
  163. package/src/components/Widget/hooks/useWidgets/index.ts +1 -0
  164. package/src/components/Widget/hooks/useWidgets/useWidgets.ts +12 -0
  165. package/src/components/Widget/index.ts +3 -0
  166. package/src/components/Widget/modifiers/index.ts +1 -0
  167. package/src/components/Widget/modifiers/restrictToElement.ts +8 -0
  168. package/src/components/Widget/types.ts +30 -0
@@ -0,0 +1,205 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+
3
+ export const legendType: ArgTypes[0] = {
4
+ description: "The type of icon in legend. If set to 'none', no legend item will be rendered.",
5
+ table: {
6
+ type: {
7
+ summary:
8
+ "'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'square' | 'star' | 'triangle' | 'wye' | 'none'",
9
+ },
10
+ defaultValue: {
11
+ summary: "'line'",
12
+ },
13
+ category: "Style",
14
+ },
15
+ control: "select",
16
+ options: [
17
+ "line",
18
+ "plainline",
19
+ "square",
20
+ "rect",
21
+ "circle",
22
+ "cross",
23
+ "diamond",
24
+ "square",
25
+ "star",
26
+ "triangle",
27
+ "wye",
28
+ "none",
29
+ ],
30
+ };
31
+
32
+ // Caveat: If any prop is added here, it would falsely be add to the documentation of the component
33
+ // where this group is used. If the group is to be extended, then only single props should be imported
34
+ // by each component that does not use all of them.
35
+ export const legendArgs: ArgTypes = {
36
+ width: {
37
+ description: "The width of legend.",
38
+ table: {
39
+ type: {
40
+ summary: "number",
41
+ },
42
+ category: "General",
43
+ },
44
+ control: "number",
45
+ },
46
+ height: {
47
+ description: "The height of legend.",
48
+ table: {
49
+ type: {
50
+ summary: "number",
51
+ },
52
+ category: "General",
53
+ },
54
+ control: "number",
55
+ },
56
+ layout: {
57
+ description: "The layout of legend items.",
58
+ table: {
59
+ type: {
60
+ summary: "'horizontal' | 'vertical'",
61
+ },
62
+ defaultValue: {
63
+ summary: "'horizontal'",
64
+ },
65
+ category: "General",
66
+ },
67
+ control: "inline-radio",
68
+ options: ["horizontal", "vertical"],
69
+ },
70
+ align: {
71
+ description: `Sets horizontal position of the Legend relative to the chart:
72
+
73
+ - \`left\` shows the Legend to the left of the chart, and chart width reduces automatically to make space for it.
74
+ - \`right\` shows the Legend to the right of the chart, and chart width reduces automatically.
75
+ - \`center\` shows the Legend in the middle of chart, and chart width remains unchanged.
76
+
77
+ The exact behavior changes depending on \`verticalAlign\` prop.`,
78
+ table: {
79
+ type: {
80
+ summary: "'left' | 'center' | 'right'",
81
+ },
82
+ defaultValue: {
83
+ summary: "'center'",
84
+ },
85
+ category: "General",
86
+ },
87
+ control: "radio",
88
+ options: ["left", "center", "right"],
89
+ },
90
+ verticalAlign: {
91
+ description: `Sets vertical position of the Legend relative to the chart:
92
+
93
+ - \`bottom\` shows the Legend below chart, and chart height reduces automatically to make space for it.
94
+ - \`top\` shows the Legend above chart, and chart height reduces automatically.
95
+ - \`middle\` shows the Legend in the middle of chart, covering other content, and chart height remains unchanged.
96
+
97
+ The exact behavior changes depending on \`align\` prop.`,
98
+ table: {
99
+ type: {
100
+ summary: "'top' | 'middle' | 'bottom'",
101
+ },
102
+ category: "General",
103
+ },
104
+ control: "radio",
105
+ options: ["top", "middle", "bottom"],
106
+ },
107
+ iconSize: {
108
+ description: "The size of icon in each legend item.",
109
+ table: {
110
+ type: {
111
+ summary: "number",
112
+ },
113
+ defaultValue: {
114
+ summary: "14",
115
+ },
116
+ category: "General",
117
+ },
118
+ control: "number",
119
+ },
120
+ iconType: {
121
+ description: "The type of icon in each legend item.",
122
+ table: {
123
+ type: {
124
+ summary:
125
+ "'line' | 'plainline' | 'square' | 'rect' | 'circle' | 'cross' | 'diamond' | 'star' | 'triangle' | 'wye'",
126
+ },
127
+ defaultValue: {
128
+ summary: "line",
129
+ },
130
+ category: "General",
131
+ },
132
+ control: "select",
133
+ options: [
134
+ "line",
135
+ "plainline",
136
+ "square",
137
+ "rect",
138
+ "circle",
139
+ "cross",
140
+ "diamond",
141
+ "star",
142
+ "triangle",
143
+ "wye",
144
+ ],
145
+ },
146
+ content: {
147
+ description: `If set to a React element, the option will be used to render the legend.
148
+ If set to a function, the function will be called to render the legend's content.`,
149
+ table: {
150
+ type: {
151
+ summary: "ReactElement | Function",
152
+ detail: `<ChartLegend content={<CustomizedLegend external={external} />} />
153
+
154
+ const renderLegend = (props) => {
155
+ const { payload } = props;
156
+
157
+ return (
158
+ <ul>
159
+ {
160
+ payload.map((entry, index) => (
161
+ <li key={'item'-index}>{entry.value}</li>
162
+ ))
163
+ }
164
+ </ul>
165
+ );
166
+ }
167
+ <Legend content={renderLegend} />`,
168
+ },
169
+ category: "General",
170
+ },
171
+ },
172
+ formatter: {
173
+ description: "The formatter function of each text in legend.",
174
+ table: {
175
+ type: {
176
+ summary: "Function",
177
+ detail: "(value, entry, index) => ()",
178
+ },
179
+ category: "General",
180
+ },
181
+ },
182
+ wrapperStyle: {
183
+ description: `The style of legend container which is a "position: absolute;" div element.
184
+ Because the position of legend is quite flexible, so you can change the position by the value of top, left, right, bottom in this option.
185
+ And the format of wrapperStyle is the same as React inline style.`,
186
+ table: {
187
+ type: {
188
+ summary: "Object",
189
+ },
190
+ category: "General",
191
+ },
192
+ control: "object",
193
+ },
194
+ portal: {
195
+ description: `If portal is defined, then Legend will use this element as a target
196
+ for rendering using React Portal: https://react.dev/reference/react-dom/createPortal.
197
+ If this is undefined then Legend renders inside the recharts-wrapper element with absolute positioning.`,
198
+ table: {
199
+ category: "Position",
200
+ type: {
201
+ summary: "HTMLElement | null",
202
+ },
203
+ },
204
+ },
205
+ };
@@ -0,0 +1,87 @@
1
+ import { type Args } from "@storybook/react";
2
+ import { dataKey } from "./chartArgs";
3
+ import { generalStyleArgs, hide, labelDescription, labelSummary } from "./stylesArgs";
4
+
5
+ export const lineArgs: Args = {
6
+ ...generalStyleArgs,
7
+ dataKey,
8
+ connectNulls: {
9
+ description: "Whether to connect a graph line across null points.",
10
+ table: {
11
+ type: {
12
+ summary: "boolean",
13
+ },
14
+ category: "Style",
15
+ defaultValue: {
16
+ summary: "false",
17
+ },
18
+ },
19
+ control: "boolean",
20
+ },
21
+ dot: {
22
+ description: `If false set, dots will not be drawn. If true set, dots will be drawn which have the props
23
+ calculated internally. If object set, dots will be drawn which have the props merged by the internal
24
+ calculated props and the option. If ReactElement set, the option can be the custom dot element.If set
25
+ a function, the function will be called to render customized dot.`,
26
+ table: {
27
+ type: {
28
+ summary: "Boolean | Object | ReactElement | Function",
29
+ detail:
30
+ '<Line dataKey="value" dot={false} />\n' +
31
+ "<Line dataKey=\"value\" dot={{ stroke: 'red', strokeWidth: 2 }} />\n" +
32
+ '<Line dataKey="value" dot={<CustomizedDot />} />\n' +
33
+ '<Line dataKey="value" dot={renderDot} />',
34
+ },
35
+ defaultValue: {
36
+ summary: "true",
37
+ },
38
+ category: "Style",
39
+ },
40
+ control: "boolean",
41
+ },
42
+ hide,
43
+ label: {
44
+ description: labelDescription,
45
+ table: {
46
+ type: {
47
+ summary: labelSummary,
48
+ detail:
49
+ '<Line dataKey="value" label />\n' +
50
+ "<Line dataKey=\"value\" label={{ fill: 'red', fontSize: 20 }} />\n" +
51
+ '<Line dataKey="value" label={<CustomizedLabel />} />\n' +
52
+ '<Line dataKey="value" label={renderLabel} />',
53
+ },
54
+ defaultValue: {
55
+ summary: "false",
56
+ },
57
+ category: "Style",
58
+ },
59
+ control: "boolean",
60
+ },
61
+ type: {
62
+ description: `The interpolation type of line. It's the same as type in Area.
63
+ And customized interpolation function can be set to type. https://github.com/d3/d3-shape#curves`,
64
+ default: "linear",
65
+ table: {
66
+ category: "Style",
67
+ },
68
+ control: "select",
69
+ options: [
70
+ "basis",
71
+ "basisClosed",
72
+ "basisOpen",
73
+ "bumpX",
74
+ "bumpY",
75
+ "bump",
76
+ "linear",
77
+ "linearClosed",
78
+ "natural",
79
+ "monotoneX",
80
+ "monotoneY",
81
+ "monotone",
82
+ "step",
83
+ "stepBefore",
84
+ "stepAfter",
85
+ ],
86
+ },
87
+ };
@@ -0,0 +1,17 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { categoricalChartArgs } from "./chartArgs";
3
+
4
+ export const lineChartArgs: ArgTypes = {
5
+ ...categoricalChartArgs,
6
+ layout: {
7
+ description: "The layout of line in the chart, usually inherited from parent.",
8
+ table: {
9
+ type: {
10
+ summary: "'horizontal' | 'vertical'",
11
+ },
12
+ category: "Bar",
13
+ },
14
+ control: "radio",
15
+ options: ["horizontal", "vertical"],
16
+ },
17
+ };
@@ -0,0 +1,18 @@
1
+ import { type Args } from "@storybook/react";
2
+ import { polarChartArgs } from "./polarChartArgs";
3
+ import { polarSharedArgs } from "./polarSharedArgs";
4
+
5
+ export const pieArgs: Args = {
6
+ ...polarSharedArgs,
7
+ ...polarChartArgs,
8
+ fillOpacity: {
9
+ description: "The opacity of the fill.",
10
+ table: {
11
+ type: {
12
+ summary: "number",
13
+ },
14
+ category: "Style",
15
+ },
16
+ control: "number",
17
+ },
18
+ };
@@ -0,0 +1,7 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { chartSizeArgs, margin } from "./chartArgs";
3
+
4
+ export const pieChartArgs: ArgTypes = {
5
+ ...chartSizeArgs,
6
+ margin,
7
+ };
@@ -0,0 +1,86 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { categoricalChartArgs } from "./chartArgs";
3
+
4
+ export const polarChartArgs: ArgTypes = {
5
+ ...categoricalChartArgs,
6
+ cx: {
7
+ description: "The x-coordinate of the center of the circle.",
8
+ table: {
9
+ type: {
10
+ summary: "number | string",
11
+ },
12
+ defaultValue: {
13
+ summary: "50%",
14
+ },
15
+ category: "Polar",
16
+ },
17
+ control: "text",
18
+ },
19
+ cy: {
20
+ description: "The y-coordinate of the center of the circle.",
21
+ table: {
22
+ type: {
23
+ summary: "number | string",
24
+ },
25
+ defaultValue: {
26
+ summary: "50%",
27
+ },
28
+ category: "Polar",
29
+ },
30
+ control: "text",
31
+ },
32
+ innerRadius: {
33
+ description: "The inner radius of polar chart.",
34
+
35
+ table: {
36
+ type: {
37
+ summary: "number",
38
+ },
39
+ defaultValue: {
40
+ summary: "0",
41
+ },
42
+ category: "Polar",
43
+ },
44
+ control: "number",
45
+ },
46
+ outerRadius: {
47
+ description: "The outer radius of polar chart.",
48
+ table: {
49
+ type: {
50
+ summary: "number",
51
+ },
52
+ defaultValue: {
53
+ summary: "80%",
54
+ },
55
+ category: "Polar",
56
+ },
57
+ control: "number",
58
+ },
59
+ startAngle: {
60
+ description: "The start angle of polar chart.",
61
+ table: {
62
+ type: {
63
+ summary: "number",
64
+ },
65
+ defaultValue: {
66
+ summary: "90",
67
+ },
68
+ category: "Polar",
69
+ },
70
+ control: "number",
71
+ },
72
+ endAngle: {
73
+ description: "The end angle of polar chart.",
74
+ defaultValue: -270,
75
+ table: {
76
+ type: {
77
+ summary: "number",
78
+ },
79
+ defaultValue: {
80
+ summary: "-270",
81
+ },
82
+ category: "Polar",
83
+ },
84
+ control: "number",
85
+ },
86
+ };
@@ -0,0 +1,42 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { dataKey } from "./cartesianSharedArgs";
3
+
4
+ export const polarSharedArgs: ArgTypes = {
5
+ data: {
6
+ table: {
7
+ category: "Internal",
8
+ },
9
+ },
10
+ angleAxisId: {
11
+ description: "The id of angle axis which is corresponding to the data.",
12
+ table: {
13
+ type: {
14
+ summary: "string | number",
15
+ },
16
+ category: "General",
17
+ },
18
+ control: "text",
19
+ },
20
+ stackId: {
21
+ description:
22
+ "The stack id of bar, when two bars have the same stackId, then two bars are stacked in order.",
23
+ table: {
24
+ type: {
25
+ summary: "string | number",
26
+ },
27
+ category: "General",
28
+ },
29
+ control: "text",
30
+ },
31
+ radiusAxisId: {
32
+ description: "The id of radius axis which is corresponding to the data.",
33
+ table: {
34
+ type: {
35
+ summary: "string | number",
36
+ },
37
+ category: "General",
38
+ },
39
+ control: "text",
40
+ },
41
+ dataKey,
42
+ };
@@ -0,0 +1,26 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { sharedAxisArgs } from "./sharedAxisArgs";
3
+
4
+ export const radarArgs: ArgTypes = {
5
+ ...sharedAxisArgs,
6
+ cx: {
7
+ description: "The x-coordinate of the center of the circle.",
8
+ defaultValue: "50%",
9
+ table: {
10
+ type: {
11
+ summary: "number | string",
12
+ },
13
+ category: "Polar",
14
+ },
15
+ },
16
+ cy: {
17
+ description: "The y-coordinate of the center of the circle.",
18
+ defaultValue: "50%",
19
+ table: {
20
+ type: {
21
+ summary: "number | string",
22
+ },
23
+ category: "Polar",
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,26 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { categoricalChartArgs } from "./chartArgs";
3
+
4
+ export const radarChartArgs: ArgTypes = {
5
+ ...categoricalChartArgs,
6
+ cx: {
7
+ description: "The x-coordinate of the center of the circle.",
8
+ defaultValue: "50%",
9
+ table: {
10
+ type: {
11
+ summary: "number | string",
12
+ },
13
+ category: "Polar",
14
+ },
15
+ },
16
+ cy: {
17
+ description: "The y-coordinate of the center of the circle.",
18
+ defaultValue: "50%",
19
+ table: {
20
+ type: {
21
+ summary: "number | string",
22
+ },
23
+ category: "Polar",
24
+ },
25
+ },
26
+ };
@@ -0,0 +1,36 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { animationArgs } from "./animationArgs";
3
+ import { dataKey } from "./chartArgs";
4
+ import { eventArgs } from "./events";
5
+ import { legendType } from "./legendArgs";
6
+ import { polarSharedArgs } from "./polarSharedArgs";
7
+ import { radialBarStyleArgs } from "./stylesArgs";
8
+ import { tooltipType } from "./tooltipArgs";
9
+
10
+ export const radialBarArgs: ArgTypes = {
11
+ dataKey,
12
+ tooltipType,
13
+ ...eventArgs,
14
+ ...animationArgs,
15
+ legendType,
16
+ ...polarSharedArgs,
17
+ ...radialBarStyleArgs,
18
+ // Deprecated
19
+ dangerouslySetInnerHTML: {
20
+ table: {
21
+ category: "Deprecated",
22
+ },
23
+ hide: true,
24
+ disable: true,
25
+ },
26
+ startAngle: {
27
+ table: { category: "Deprecated" },
28
+ hide: true,
29
+ disable: true,
30
+ },
31
+ endAngle: {
32
+ table: { category: "Deprecated" },
33
+ hide: true,
34
+ disable: true,
35
+ },
36
+ };
@@ -0,0 +1,16 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { barChartArgs } from "./barChartArgs";
3
+ import { polarChartArgs } from "./polarChartArgs";
4
+
5
+ export const radialBarChartArgs: ArgTypes = {
6
+ ...barChartArgs,
7
+ ...polarChartArgs,
8
+ startAngle: {
9
+ ...polarChartArgs.startAngle,
10
+ defaultValue: 0,
11
+ },
12
+ endAngle: {
13
+ ...polarChartArgs.endAngle,
14
+ defaultValue: 360,
15
+ },
16
+ };
@@ -0,0 +1,35 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+
3
+ export const radius: ArgTypes[0] = {
4
+ description:
5
+ "If set a value, the option is the radius of all the rounderd corners. If set a array, the option" +
6
+ " are in turn the radiuses of top-left corner, top-right corner, bottom-right corner, bottom-left" +
7
+ " corner.",
8
+ table: {
9
+ type: {
10
+ summary: "number | number[]",
11
+ },
12
+ defaultValue: {
13
+ summary: "0",
14
+ },
15
+ category: "Style",
16
+ },
17
+ control: "object",
18
+ };
19
+
20
+ export const isUpdateAnimationActive: ArgTypes[0] = {
21
+ description: "If set false, animation of component updates will be disabled.",
22
+ table: {
23
+ category: "Animation",
24
+ },
25
+ };
26
+
27
+ /**
28
+ * Caveat: If any prop is added here, it would falsely be add to the documentation of the component
29
+ * where this group is used. If the group is to be extended, then only single props should be imported
30
+ * by each component that does not use all of them.
31
+ * */
32
+ export const rectangleArgs: ArgTypes = {
33
+ radius,
34
+ isUpdateAnimationActive,
35
+ };
@@ -0,0 +1,75 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+
3
+ export const referenceStyleArgs: ArgTypes = {
4
+ ifOverflow: {
5
+ description: `Defines how to draw the reference component if it falls partly outside the canvas.
6
+ If set to 'discard', the reference component will not be drawn at all. If set to 'hidden', the
7
+ reference component will be clipped to the canvas. If set to 'visible', the reference component
8
+ will be drawn completely. If set to 'extendDomain', the domain of the overflown axis will be
9
+ extended such that the reference component fits into the canvas.`,
10
+ table: {
11
+ type: {
12
+ summary: "'discard' | 'hidden' | 'visible' | 'extendDomain'",
13
+ },
14
+ category: "Style",
15
+ },
16
+ defaultValue: "discard",
17
+ },
18
+ };
19
+
20
+ export const referenceGeneralArgs: ArgTypes = {
21
+ xAxisId: {
22
+ description: "The id of x-axis which is corresponding to the data.",
23
+ table: {
24
+ type: {
25
+ summary: "string | number",
26
+ },
27
+ category: "General",
28
+ },
29
+ control: "text",
30
+ },
31
+ yAxisId: {
32
+ description: "The id of y-axis which is corresponding to the data.",
33
+ table: {
34
+ type: {
35
+ summary: "string | number",
36
+ },
37
+ category: "General",
38
+ },
39
+ control: "text",
40
+ },
41
+ };
42
+
43
+ export const referenceInternalArgs: ArgTypes = {
44
+ xAxis: {
45
+ description: "The configuration of the corresponding x-axis, usually calculated internally.",
46
+ table: {
47
+ type: {
48
+ summary: "Object",
49
+ },
50
+ category: "Internal",
51
+ },
52
+ control: "object",
53
+ },
54
+ yAxis: {
55
+ description: "The configuration of the corresponding y-axis, usually calculated internally.",
56
+ table: {
57
+ type: {
58
+ summary: "Object",
59
+ },
60
+ category: "Internal",
61
+ },
62
+ control: "object",
63
+ },
64
+ clipPathId: {
65
+ description: `Used as the id for the clip path which is used to clip the reference component if
66
+ 'ifOverflow' is set to 'hidden'"`,
67
+ table: {
68
+ type: {
69
+ summary: "number | string",
70
+ },
71
+ category: "Internal",
72
+ },
73
+ control: "text",
74
+ },
75
+ };