@mbao01/common 0.0.43 → 0.0.45
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/DatetimePicker/DatetimeGrid.d.ts +26 -0
- package/dist/types/components/DatetimePicker/DatetimePicker.d.ts +13 -0
- package/dist/types/components/DatetimePicker/constants.d.ts +15 -0
- package/dist/types/components/DatetimePicker/index.d.ts +1 -0
- package/dist/types/components/DatetimePicker/types.d.ts +25 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeCalendar.d.ts +5 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeInput.d.ts +83 -0
- package/dist/types/components/Form/DatetimeInput/DatetimeInputContext.d.ts +2 -0
- package/dist/types/components/Form/DatetimeInput/NaturalLanguageInput.d.ts +5 -0
- package/dist/types/components/Form/DatetimeInput/TimePicker.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/constants.d.ts +24 -0
- package/dist/types/components/Form/DatetimeInput/helpers.d.ts +27 -0
- package/dist/types/components/Form/DatetimeInput/hooks/index.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/hooks/useDateInput/index.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/hooks/useDateInput/useDateInput.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/index.d.ts +1 -0
- package/dist/types/components/Form/DatetimeInput/types.d.ts +31 -0
- package/dist/types/components/Form/MultiSelect/MultiSelect.d.ts +46 -0
- package/dist/types/components/Form/MultiSelect/MultiSelectContext.d.ts +2 -0
- package/dist/types/components/Form/MultiSelect/constants.d.ts +19 -0
- package/dist/types/components/Form/MultiSelect/hooks/index.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/hooks/useMultiSelect/index.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/hooks/useMultiSelect/useMultiSelect.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/index.d.ts +1 -0
- package/dist/types/components/Form/MultiSelect/types.d.ts +31 -0
- package/dist/types/components/Form/TagsInput/TagsInput.d.ts +13 -0
- package/dist/types/components/Form/TagsInput/constants.d.ts +16 -0
- package/dist/types/components/Form/TagsInput/index.d.ts +1 -0
- package/dist/types/components/Form/TagsInput/types.d.ts +9 -0
- package/dist/types/components/Form/index.d.ts +2 -0
- package/dist/types/index.d.ts +1 -0
- package/package.json +7 -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/DatetimePicker/DatetimeGrid.tsx +59 -0
- package/src/components/DatetimePicker/DatetimePicker.tsx +59 -0
- package/src/components/DatetimePicker/constants.ts +102 -0
- package/src/components/DatetimePicker/index.ts +1 -0
- package/src/components/DatetimePicker/types.ts +36 -0
- package/src/components/Form/DatetimeInput/DatetimeCalendar.tsx +68 -0
- package/src/components/Form/DatetimeInput/DatetimeInput.tsx +90 -0
- package/src/components/Form/DatetimeInput/DatetimeInputContext.tsx +4 -0
- package/src/components/Form/DatetimeInput/NaturalLanguageInput.tsx +73 -0
- package/src/components/Form/DatetimeInput/TimePicker.tsx +202 -0
- package/src/components/Form/DatetimeInput/constants.ts +135 -0
- package/src/components/Form/DatetimeInput/helpers.ts +93 -0
- package/src/components/Form/DatetimeInput/hooks/index.ts +1 -0
- package/src/components/Form/DatetimeInput/hooks/useDateInput/index.ts +1 -0
- package/src/components/Form/DatetimeInput/hooks/useDateInput/useDateInput.ts +10 -0
- package/src/components/Form/DatetimeInput/index.ts +1 -0
- package/src/components/Form/DatetimeInput/types.ts +36 -0
- package/src/components/Form/MultiSelect/MultiSelect.tsx +348 -0
- package/src/components/Form/MultiSelect/MultiSelectContext.tsx +4 -0
- package/src/components/Form/MultiSelect/constants.ts +103 -0
- package/src/components/Form/MultiSelect/hooks/index.ts +1 -0
- package/src/components/Form/MultiSelect/hooks/useMultiSelect/index.ts +1 -0
- package/src/components/Form/MultiSelect/hooks/useMultiSelect/useMultiSelect.ts +10 -0
- package/src/components/Form/MultiSelect/index.ts +1 -0
- package/src/components/Form/MultiSelect/types.ts +46 -0
- package/src/components/Form/TagsInput/TagsInput.tsx +278 -0
- package/src/components/Form/TagsInput/constants.ts +87 -0
- package/src/components/Form/TagsInput/index.ts +1 -0
- package/src/components/Form/TagsInput/types.ts +10 -0
- package/src/components/Form/index.ts +2 -0
- package/src/index.ts +1 -0
|
@@ -0,0 +1,67 @@
|
|
|
1
|
+
/*
|
|
2
|
+
* This file both exports the documentation of shared props separately, to be reused in places where only single props
|
|
3
|
+
* are documented, as well as grouped in case a whole group is needed.
|
|
4
|
+
*/
|
|
5
|
+
|
|
6
|
+
import { type ArgTypes } from "@storybook/react";
|
|
7
|
+
|
|
8
|
+
export const animateNewValues: ArgTypes[0] = { table: { category: "Animation" } };
|
|
9
|
+
export const animationBegin: ArgTypes[0] = {
|
|
10
|
+
description: "Specifies when the animation should begin, the unit of this option is ms.",
|
|
11
|
+
type: { name: "number" },
|
|
12
|
+
table: {
|
|
13
|
+
defaultValue: {
|
|
14
|
+
summary: "0",
|
|
15
|
+
},
|
|
16
|
+
category: "Animation",
|
|
17
|
+
},
|
|
18
|
+
control: "number",
|
|
19
|
+
};
|
|
20
|
+
export const animationDuration: ArgTypes[0] = {
|
|
21
|
+
description: "Specifies the duration of animation, the unit of this option is ms.",
|
|
22
|
+
table: {
|
|
23
|
+
type: {
|
|
24
|
+
summary: "number",
|
|
25
|
+
},
|
|
26
|
+
category: "Animation",
|
|
27
|
+
},
|
|
28
|
+
control: "number",
|
|
29
|
+
};
|
|
30
|
+
export const animationEasing: ArgTypes[0] = {
|
|
31
|
+
description: "The type of easing function.",
|
|
32
|
+
table: {
|
|
33
|
+
type: {
|
|
34
|
+
summary: "'ease' | 'ease-in' | 'ease-out' | 'ease-in-out' | 'linear'",
|
|
35
|
+
},
|
|
36
|
+
category: "Animation",
|
|
37
|
+
},
|
|
38
|
+
control: "select",
|
|
39
|
+
options: ["ease", "ease-in", "ease-out", "ease-in-out", "linear"],
|
|
40
|
+
};
|
|
41
|
+
|
|
42
|
+
export const isAnimationActive: ArgTypes[0] = {
|
|
43
|
+
description:
|
|
44
|
+
"If set false, animation of component will be disabled. This is `true` in CSR, and `false` in SSR",
|
|
45
|
+
table: {
|
|
46
|
+
type: {
|
|
47
|
+
summary: "boolean",
|
|
48
|
+
},
|
|
49
|
+
defaultValue: {
|
|
50
|
+
detail: "true in CSR, and false in SSR",
|
|
51
|
+
},
|
|
52
|
+
category: "Animation",
|
|
53
|
+
},
|
|
54
|
+
control: "boolean",
|
|
55
|
+
};
|
|
56
|
+
|
|
57
|
+
/**
|
|
58
|
+
* Caveat: If any prop is added here, it would falsely be add to the documentation of the component where this group
|
|
59
|
+
* is used. If the group is to be extended, then only single props should be imported by each component that does not
|
|
60
|
+
* use all of them.
|
|
61
|
+
* */
|
|
62
|
+
export const animationArgs: ArgTypes = {
|
|
63
|
+
animationBegin,
|
|
64
|
+
animationEasing,
|
|
65
|
+
animationDuration,
|
|
66
|
+
isAnimationActive,
|
|
67
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import { type Args } from "@storybook/react";
|
|
2
|
+
import { lineArgs } from "./lineArgs";
|
|
3
|
+
|
|
4
|
+
export const areaArgs: Args = {
|
|
5
|
+
...lineArgs,
|
|
6
|
+
fillOpacity: {
|
|
7
|
+
description: "The opacity of the fill.",
|
|
8
|
+
table: {
|
|
9
|
+
type: {
|
|
10
|
+
summary: "number",
|
|
11
|
+
},
|
|
12
|
+
category: "Style",
|
|
13
|
+
},
|
|
14
|
+
control: "number",
|
|
15
|
+
},
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { type ArgTypes } from "@storybook/react";
|
|
2
|
+
import { cartesianChartArgs } from "./cartesianChartArgs";
|
|
3
|
+
|
|
4
|
+
export const areaChartArgs: ArgTypes = {
|
|
5
|
+
...cartesianChartArgs,
|
|
6
|
+
baseValue: {
|
|
7
|
+
description: "The base value of area.",
|
|
8
|
+
table: {
|
|
9
|
+
type: {
|
|
10
|
+
summary: "number | 'dataMin' | 'dataMax' | 'auto'",
|
|
11
|
+
},
|
|
12
|
+
defaultValue: {
|
|
13
|
+
summary: "'auto'",
|
|
14
|
+
},
|
|
15
|
+
category: "Area",
|
|
16
|
+
},
|
|
17
|
+
control: "text",
|
|
18
|
+
},
|
|
19
|
+
};
|
|
@@ -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
|
+
};
|