@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,123 @@
1
+ import { ArgTypes } from "@storybook/react";
2
+ import { animationArgs } from "./animationArgs";
3
+ import { cartesianSharedArgs, data } from "./cartesianSharedArgs";
4
+ import { legendType } from "./legendArgs";
5
+
6
+ /**
7
+ * MultiSelect Docs: {@link: https://shadcn-extension.vercel.app/docs/multi-select}
8
+ */
9
+ export const barArgs: ArgTypes = {
10
+ ...cartesianSharedArgs,
11
+ ...animationArgs,
12
+ data,
13
+ legendType,
14
+ layout: {
15
+ description: "The layout of bar in the chart, usually inherited from parent.",
16
+ table: {
17
+ type: {
18
+ summary: "'horizontal' | 'vertical'",
19
+ },
20
+ category: "Bar",
21
+ },
22
+ control: "radio",
23
+ options: ["horizontal", "vertical"],
24
+ },
25
+ label: {
26
+ description:
27
+ "If false set, labels will not be drawn. If true set, labels will be drawn which have the props calculated internally. If object set, labels will be drawn which have the props mergered by the internal calculated props and the option. If ReactElement set, the option can be the custom label element. If set a function, the function will be called to render customized label.",
28
+ table: {
29
+ type: {
30
+ summary: "boolean | Object | ReactElement | Function",
31
+ },
32
+ category: "Bar",
33
+ },
34
+ control: "object",
35
+ },
36
+ barSize: {
37
+ description:
38
+ "The width or height of each bar. If the barSize is not specified, the size of bar will be calculated by the barCategoryGap, barGap and the quantity of bar groups.",
39
+ table: {
40
+ type: {
41
+ summary: "number | Percentage",
42
+ },
43
+ category: "Bar",
44
+ },
45
+ control: "text",
46
+ },
47
+ maxBarSize: {
48
+ description:
49
+ "The maximum width of bar in a horizontal BarChart, or maximum height in a vertical BarChart.",
50
+ table: {
51
+ type: {
52
+ summary: "number",
53
+ },
54
+ category: "Bar",
55
+ },
56
+ control: "number",
57
+ },
58
+ minPointSize: {
59
+ description:
60
+ "The minimal height of a bar in a horizontal BarChart, or the minimal width of a bar in a vertical BarChart.\n By default, 0 values are not shown. To visualize a 0 (or close to zero) point, set the minimal point size to a pixel\n value like 3. In stacked bar charts, minPointSize might not be respected for tightly packed values. So we strongly recommend not using this props in stacked BarChart. You may provide a function to conditionally change this prop based on Bar value.",
61
+ table: {
62
+ type: {
63
+ summary: "number | Function",
64
+ },
65
+ category: "Bar",
66
+ },
67
+ control: "number",
68
+ },
69
+ background: {
70
+ description:
71
+ "If false set, background of bars will not be drawn. If true set, background of bars will be drawn which have the props calculated internally. If object set, background of bars will be drawn which have the props mergered by the internal calculated props and the option. If ReactElement set, the option can be the custom background element. If set a function, the function will be called to render customized background.",
72
+ table: {
73
+ type: {
74
+ summary: "boolean | Object | ReactElement | Function",
75
+ },
76
+ category: "Bar",
77
+ },
78
+ control: "object",
79
+ },
80
+ shape: {
81
+ description:
82
+ "If set a ReactElement, the shape of bar can be customized. If set a function, the function will be called to render customized shape.",
83
+ table: {
84
+ type: {
85
+ summary: "ReactElement | Function",
86
+ },
87
+ category: "Bar",
88
+ },
89
+ },
90
+ activeBar: {
91
+ description:
92
+ "The active bar is shown when a user enters a bar chart and this chart has tooltip. If set to false, no active bar will be drawn. If set to true, active bar will be drawn with the props calculated internally. If passed an object, active bar will be drawn, and the internally calculated props will be merged with the key value pairs of the passed object. If passed a ReactElement, the option can be the custom active bar element. If passed a function, the function will be called to render a customized active bar.",
93
+ table: {
94
+ type: {
95
+ summary: "boolean | Object | ReactElement | Function",
96
+ },
97
+ category: "Bar",
98
+ },
99
+ control: "object",
100
+ },
101
+ stackId: {
102
+ description:
103
+ "The stack id of bar, when two bars have the same value axis and same stackId, then the two bars are stacked in order.",
104
+ table: {
105
+ type: {
106
+ summary: "string | number",
107
+ },
108
+ category: "Bar",
109
+ },
110
+ control: "text",
111
+ },
112
+ name: {
113
+ description:
114
+ "The name of data. This option will be used in tooltip and legend to represent a bar. If no value was set to this option, the value of dataKey will be used alternatively.",
115
+ table: {
116
+ type: {
117
+ summary: "string",
118
+ },
119
+ category: "Bar",
120
+ },
121
+ control: "text",
122
+ },
123
+ };
@@ -0,0 +1,65 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { categoricalChartArgs } from "./chartArgs";
3
+
4
+ export const barChartArgs: ArgTypes = {
5
+ ...categoricalChartArgs,
6
+ barCategoryGap: {
7
+ description:
8
+ "The gap between two bar categories, which can be a percent value or a fixed value.",
9
+ table: {
10
+ type: {
11
+ summary: "Percentage | number",
12
+ },
13
+ defaultValue: {
14
+ summary: "'10%'",
15
+ },
16
+ category: "Bar",
17
+ },
18
+ control: "text",
19
+ },
20
+ barGap: {
21
+ description: "The gap between two bars in the same category.",
22
+ table: {
23
+ type: {
24
+ summary: "number",
25
+ },
26
+ defaultValue: {
27
+ summary: "4",
28
+ },
29
+ category: "Bar",
30
+ },
31
+ control: "number",
32
+ },
33
+ barSize: {
34
+ description: `The width or height of each bar. If the barSize is not specified, the size of the bar
35
+ will be calculated by the barCategoryGap, barGap and the quantity of bar groups.`,
36
+ table: {
37
+ type: {
38
+ summary: "number | Percentage",
39
+ },
40
+ category: "Bar",
41
+ },
42
+ control: "text",
43
+ },
44
+ maxBarSize: {
45
+ description: "The maximum size of bar.",
46
+ table: {
47
+ type: {
48
+ summary: "number",
49
+ },
50
+ category: "Bar",
51
+ },
52
+ control: "number",
53
+ },
54
+ layout: {
55
+ description: "The layout of bar in the chart, usually inherited from parent.",
56
+ table: {
57
+ type: {
58
+ summary: "'horizontal' | 'vertical'",
59
+ },
60
+ category: "Bar",
61
+ },
62
+ control: "radio",
63
+ options: ["horizontal", "vertical"],
64
+ },
65
+ };
@@ -0,0 +1,42 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+ import { categoricalChartArgs } from "./chartArgs";
3
+
4
+ export const cartesianChartArgs: ArgTypes = {
5
+ ...categoricalChartArgs,
6
+ layout: {
7
+ description: "The layout of areas, bars, lines in the chart.",
8
+ table: {
9
+ type: {
10
+ summary: "'horizontal' | 'vertical'",
11
+ },
12
+ defaultValue: {
13
+ summary: "'horizontal'",
14
+ },
15
+ category: "General",
16
+ },
17
+ control: "radio",
18
+ options: ["horizontal", "vertical"],
19
+ },
20
+ stackOffset: {
21
+ description: `Determines how values are stacked:
22
+
23
+ - \`none\` is the default, it adds values on top of each other. No smarts. Negative values will overlap.
24
+ - \`expand\` make it so that the values always add up to 1 - so the chart will look like a rectangle.
25
+ - \`wiggle\` and \`silhouette\` tries to keep the chart centered.
26
+ - \`sign\` stacks positive values above zero and negative values below zero. Similar to \`none\` but handles negatives.
27
+ - \`positive\` ignores all negative values, and then behaves like \`none\`.
28
+
29
+ Also see https://d3js.org/d3-shape/stack#stack-offsets
30
+ (note that the \`diverging\` offset in d3 is named \`sign\` in recharts)
31
+ `,
32
+ table: {
33
+ type: {
34
+ summary: "'expand' | 'none' | 'wiggle' | 'silhouette' | 'sign' | 'positive'",
35
+ },
36
+ defaultValue: { summary: "'none'" },
37
+ category: "General",
38
+ },
39
+ control: "radio",
40
+ options: ["sign", "expand", "none", "wiggle", "silhouette", "positive"],
41
+ },
42
+ };
@@ -0,0 +1,136 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+
3
+ export const dataKey: ArgTypes[0] = {
4
+ description: `The key or getter of a group of data.
5
+ It could be an accessor function such as (row)=>value`,
6
+ table: {
7
+ type: { summary: "string | number | Function" },
8
+ category: "General",
9
+ },
10
+ control: "text",
11
+ };
12
+
13
+ export const nameKey: ArgTypes[0] = {
14
+ description: "The key of each sector's name.",
15
+ table: {
16
+ type: { summary: "string" },
17
+ category: "General",
18
+ },
19
+ control: "text",
20
+ };
21
+
22
+ export const activeShape: ArgTypes[0] = {
23
+ description: "",
24
+ table: {
25
+ type: {
26
+ summary: "Object | ReactElement | Function | boolean",
27
+ },
28
+ category: "General",
29
+ },
30
+ control: "object",
31
+ };
32
+
33
+ export const trapezoids: ArgTypes[0] = {
34
+ description: "The coordinates of all trapezoids in the chart, usually calculated internally",
35
+ table: {
36
+ type: {
37
+ summary: "Array",
38
+ detail: "[{x: 12, y: 12, upperWidth: 240, lowerWidth: 22, height: 80}]",
39
+ },
40
+ },
41
+ control: "object",
42
+ };
43
+
44
+ export const xAxisId: ArgTypes[0] = {
45
+ description: "The id of x-axis which is corresponding to the data.",
46
+ table: {
47
+ type: {
48
+ summary: "string | number",
49
+ },
50
+ category: "General",
51
+ },
52
+ control: "text",
53
+ };
54
+ export const yAxisId: ArgTypes[0] = {
55
+ description: "The id of y-axis which is corresponding to the data.",
56
+ table: {
57
+ type: {
58
+ summary: "string | number",
59
+ },
60
+ category: "General",
61
+ },
62
+ control: "text",
63
+ };
64
+ export const zAxisId: ArgTypes[0] = {
65
+ description: "The id of z-axis which is corresponding to the data.",
66
+ table: {
67
+ type: {
68
+ summary: "string | number",
69
+ },
70
+ category: "General",
71
+ },
72
+ control: "text",
73
+ };
74
+
75
+ export const cartesianSharedArgs: ArgTypes = {
76
+ dataKey,
77
+ id: {
78
+ description: `The unique id of this component, which will be used to generate unique clip path id internally.
79
+ This props is suggested to be set in SSR.`,
80
+ type: {
81
+ name: "string",
82
+ },
83
+ table: {
84
+ category: "General",
85
+ },
86
+ control: "text",
87
+ },
88
+ name: {
89
+ description: `The name of data. This option will be used in tooltip and legend to represent a line.
90
+ If no value was set to this option, the value of dataKey will be used alternatively.`,
91
+ table: {
92
+ type: {
93
+ summary: "string | number",
94
+ },
95
+ category: "General",
96
+ },
97
+ control: "text",
98
+ },
99
+ unit: {
100
+ description: "The unit of data. This option will be used in tooltip.",
101
+ table: {
102
+ type: {
103
+ summary: "string | number",
104
+ },
105
+ category: "General",
106
+ },
107
+ control: "text",
108
+ },
109
+ xAxisId,
110
+ yAxisId,
111
+ };
112
+
113
+ export const data: ArgTypes[0] = {
114
+ description: `The source data, in which each element is an object.
115
+ This can be defined either on the chart element (ScatterChart, LineChart, etc) or on the graphical item (Scatter, Line).
116
+ The object shape is flexible, with no pre-defined properties;
117
+ The dataKey props then define which properties from this object render where.`,
118
+ table: {
119
+ category: "General",
120
+ type: {
121
+ summary: "array of objects",
122
+ },
123
+ },
124
+ };
125
+
126
+ export const layout: ArgTypes[0] = {
127
+ description: "The layout of line, usually inherited from parent.",
128
+ table: {
129
+ type: {
130
+ summary: "'horizontal' | 'vertical'",
131
+ },
132
+ category: "Internal",
133
+ },
134
+ control: "radio",
135
+ options: ["horizontal", "vertical"],
136
+ };
@@ -0,0 +1,244 @@
1
+ import { ArgTypes } from "@storybook/react";
2
+ import { onClick, onMouseDown, onMouseEnter, onMouseLeave, onMouseMove, onMouseUp } from "./events";
3
+
4
+ export const data: ArgTypes[0] = {
5
+ description: "The source data, in which each element is an object.",
6
+ table: {
7
+ type: {
8
+ summary: "Array",
9
+ },
10
+ category: "General",
11
+ },
12
+ control: "object",
13
+ };
14
+
15
+ export const chartSizeArgs: ArgTypes = {
16
+ height: {
17
+ description: "The height of chart container.",
18
+ table: {
19
+ type: {
20
+ summary: "number",
21
+ },
22
+ category: "General",
23
+ },
24
+ control: "number",
25
+ },
26
+ width: {
27
+ description: "The width of chart container.",
28
+ table: {
29
+ type: {
30
+ summary: "number",
31
+ },
32
+ category: "General",
33
+ },
34
+ control: "number",
35
+ },
36
+ };
37
+
38
+ export const margin: ArgTypes[0] = {
39
+ description: "The sizes of whitespace around the container.",
40
+ table: {
41
+ type: {
42
+ summary: "object",
43
+ },
44
+ defaultValue: {
45
+ summary: "{ top: 5, right: 5, bottom: 5, left: 5 }",
46
+ },
47
+ category: "General",
48
+ },
49
+ control: "object",
50
+ };
51
+
52
+ export const dataKey: ArgTypes[0] = {
53
+ description: "The key or getter of a group of data which should be unique in a chart.",
54
+ table: {
55
+ type: {
56
+ summary: "string | number | Function",
57
+ },
58
+ category: "General",
59
+ },
60
+ control: "text",
61
+ };
62
+
63
+ // These props are shared between the following charts:
64
+ // - AreaChart
65
+ // - BarChart
66
+ // - ComposedChart
67
+ // - LineChart
68
+ // - PieChart
69
+ // - RadarChart
70
+ // - RadialBarChart
71
+ // - ScatterChart
72
+ // - FunnelChart
73
+ export const categoricalChartArgs: ArgTypes = {
74
+ ...chartSizeArgs,
75
+ dataKey: {
76
+ description: `Can be used to mirror dataKey used on children components, using it as this level will force
77
+ the chart to animate between two states even though the data array stays the same. Useful to animate when
78
+ toggling between multiple dataKey.`,
79
+ table: {
80
+ type: {
81
+ summary: "string | number | Function | undefined",
82
+ },
83
+ category: "General",
84
+ },
85
+ control: "text",
86
+ },
87
+ data,
88
+ margin,
89
+ accessibilityLayer: {
90
+ description: "Turn on accessibility support for keyboard-only and screen reader users.",
91
+ table: {
92
+ type: {
93
+ summary: "boolean",
94
+ },
95
+ defaultValue: {
96
+ summary: "true",
97
+ },
98
+ category: "General",
99
+ },
100
+ control: "boolean",
101
+ },
102
+ role: {
103
+ description:
104
+ "The ARIA role for the chart, which provides semantic information for screen reader users.",
105
+ table: {
106
+ type: {
107
+ summary: "string | undefined",
108
+ },
109
+ defaultValue: undefined,
110
+ category: "General",
111
+ },
112
+ control: "text",
113
+ },
114
+ tabIndex: {
115
+ description: "If and where the chart should appear in the tab order",
116
+ table: {
117
+ type: {
118
+ summary: "number | undefined",
119
+ },
120
+ defaultValue: undefined,
121
+ category: "General",
122
+ },
123
+ control: "number",
124
+ },
125
+ style: {
126
+ description: "The style of chart.",
127
+ table: {
128
+ type: {
129
+ summary: "object",
130
+ },
131
+ category: "General",
132
+ },
133
+ control: "object",
134
+ },
135
+ desc: {
136
+ description: "The description of chart.",
137
+ table: {
138
+ type: {
139
+ summary: "string",
140
+ },
141
+ category: "General",
142
+ },
143
+ control: "text",
144
+ },
145
+ className: {
146
+ table: {
147
+ category: "Internal",
148
+ },
149
+ control: "text",
150
+ },
151
+ defaultShowTooltip: {
152
+ description: "If true set, the tooltip will be displayed when the chart is rendered.",
153
+ table: {
154
+ type: {
155
+ summary: "boolean",
156
+ },
157
+ defaultValue: {
158
+ summary: "false",
159
+ },
160
+ category: "General",
161
+ },
162
+ control: "boolean",
163
+ },
164
+ id: {
165
+ description: "The unique id of chart.",
166
+ table: {
167
+ type: {
168
+ summary: "string",
169
+ },
170
+ category: "General",
171
+ },
172
+ control: "text",
173
+ },
174
+ onClick,
175
+ onMouseDown,
176
+ onMouseEnter,
177
+ onMouseLeave,
178
+ onMouseMove,
179
+ onMouseUp,
180
+ reverseStackOrder: {
181
+ description: `If \`false\`, stacked items will be rendered left to right. If \`true\`, stacked items
182
+ will be rendered right to left. (Render direction affects SVG layering, not x position.)`,
183
+ table: {
184
+ type: {
185
+ summary: "boolean",
186
+ },
187
+ defaultValue: {
188
+ summary: "false",
189
+ },
190
+ category: "General",
191
+ },
192
+ control: "boolean",
193
+ },
194
+ syncId: {
195
+ description: `If any two categorical charts(LineChart, AreaChart, BarChart, ComposedChart) have the same syncId,
196
+ these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.`,
197
+ table: {
198
+ type: {
199
+ summary: "string",
200
+ },
201
+ category: "General",
202
+ },
203
+ control: "text",
204
+ },
205
+ syncMethod: {
206
+ description: `When syncId is provided, allows customization of how the charts will synchronize tooltips and
207
+ brushes. Using 'index' (default setting), other charts will reuse current datum's index within the data array.
208
+ In cases where data does not have the same length, this might yield unexpected results. In that case use 'value'
209
+ which will try to match other charts values, or a fully custom function which will receive tick, data as argument
210
+ and should return an index.`,
211
+ table: {
212
+ type: {
213
+ summary: "'index' | 'value' | Function",
214
+ },
215
+ defaultValue: {
216
+ summary: "'index'",
217
+ },
218
+ category: "General",
219
+ },
220
+ control: "inline-radio",
221
+ options: ["index", "value"],
222
+ },
223
+ throttleDelay: {
224
+ description: `The delay of throttle for mouse events, which can be used to avoid
225
+ the performance problem when the chart is rendered in a heavy environment.`,
226
+ table: {
227
+ type: {
228
+ summary: "number",
229
+ },
230
+ category: "General",
231
+ },
232
+ control: "number",
233
+ },
234
+ title: {
235
+ description: "The title of chart.",
236
+ table: {
237
+ type: {
238
+ summary: "string",
239
+ },
240
+ category: "General",
241
+ },
242
+ control: "text",
243
+ },
244
+ };
@@ -0,0 +1,46 @@
1
+ import { type ArgTypes } from "@storybook/react";
2
+
3
+ export const r: ArgTypes[0] = {
4
+ description: "The radius of the dot.",
5
+ table: {
6
+ type: {
7
+ summary: "number",
8
+ },
9
+ defaultValue: {
10
+ summary: "10",
11
+ },
12
+ category: "General",
13
+ },
14
+ control: "number",
15
+ };
16
+
17
+ export const cx: ArgTypes[0] = {
18
+ description: "The x-coordinate of the dots center.",
19
+ table: {
20
+ type: {
21
+ summary: "number",
22
+ },
23
+ category: "General",
24
+ },
25
+ control: "number",
26
+ };
27
+
28
+ export const cy: ArgTypes[0] = {
29
+ description: "The y-coordinate of the dots center.",
30
+ table: {
31
+ type: { summary: "number" },
32
+ category: "General",
33
+ },
34
+ control: "number",
35
+ };
36
+
37
+ /**
38
+ * Caveat: If any prop is added here, it would falsely be add to the documentation of the component where this group
39
+ * is used. If the group is to be extended, then only single props should be imported by each component that does not
40
+ * use all of them.
41
+ * */
42
+ export const DotProps: ArgTypes = {
43
+ r,
44
+ cx,
45
+ cy,
46
+ };