@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,238 @@
1
+ import { type SVGProps } from "react";
2
+ import { LabelList, Pie, PieChart, Sector } from "recharts";
3
+ import { type PieSectorDataItem } from "recharts/types/polar/Pie";
4
+ import { Chart } from "../../Chart";
5
+ import {
6
+ ChartLegend,
7
+ ChartLegendContent,
8
+ ChartTooltip,
9
+ ChartTooltipContent,
10
+ } from "../../components";
11
+ import { type ChartConfig } from "../../types";
12
+ import { type PieChartProps } from "../args";
13
+
14
+ const chartConfig = {
15
+ visitors: {
16
+ label: "Visitors",
17
+ },
18
+ chrome: {
19
+ label: "Chrome",
20
+ color: "hsl(var(--chart-1))",
21
+ },
22
+ safari: {
23
+ label: "Safari",
24
+ color: "hsl(var(--chart-2))",
25
+ },
26
+ firefox: {
27
+ label: "Firefox",
28
+ color: "hsl(var(--chart-3))",
29
+ },
30
+ edge: {
31
+ label: "Edge",
32
+ color: "hsl(var(--chart-4))",
33
+ },
34
+ other: {
35
+ label: "Other",
36
+ color: "hsl(var(--chart-5))",
37
+ },
38
+ } satisfies ChartConfig;
39
+
40
+ /**
41
+ * ## Parent
42
+ *
43
+ * The PieChart can be used within: `<Chart />`
44
+ *
45
+ * ## Children
46
+ *
47
+ * The PieChart can be used with the following child components: `<PolarAngleAxis />`, `<PolarRadiusAxis />`,
48
+ * `<PolarGrid />`, `<ChartLegend />`, `<ChartTooltip />`, `<Pie />`, `<Customized />`
49
+ */
50
+ export const PieChartExample = (props: Partial<PieChartProps>) => {
51
+ return (
52
+ <Chart config={chartConfig} className="h-[250px] w-full">
53
+ <PieChart {...props.pieChart}>
54
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
55
+ <Pie dataKey="visitors" {...props.pie} />
56
+ </PieChart>
57
+ </Chart>
58
+ );
59
+ };
60
+
61
+ export const LabeledPieChartExample = (props: Partial<PieChartProps>) => {
62
+ return (
63
+ <Chart
64
+ config={chartConfig}
65
+ className="mx-auto aspect-square h-[250px] pb-0 [&_.recharts-pie-label-text]:fill-base-content"
66
+ >
67
+ <PieChart {...props.pieChart}>
68
+ <ChartTooltip content={<ChartTooltipContent hideLabel />} />
69
+ <Pie dataKey="visitors" {...props.pie} />
70
+ </PieChart>
71
+ </Chart>
72
+ );
73
+ };
74
+
75
+ export const CustomLabeledPieChartExample = (props: Partial<PieChartProps>) => {
76
+ return (
77
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
78
+ <PieChart {...props.pieChart}>
79
+ <ChartTooltip content={<ChartTooltipContent nameKey="visitors" hideLabel />} />
80
+ <Pie
81
+ dataKey="visitors"
82
+ {...props.pie}
83
+ label={({
84
+ payload,
85
+ ...props
86
+ }: SVGProps<SVGTextElement> & { payload: Record<string, string> }) => {
87
+ return (
88
+ <text
89
+ cx={props.cx}
90
+ cy={props.cy}
91
+ x={props.x}
92
+ y={props.y}
93
+ textAnchor={props.textAnchor}
94
+ dominantBaseline={props.dominantBaseline}
95
+ className="fill-base-content"
96
+ >
97
+ {`${
98
+ chartConfig[payload.browser as keyof typeof chartConfig]?.label
99
+ } (${payload.visitors})`}
100
+ </text>
101
+ );
102
+ }}
103
+ />
104
+ </PieChart>
105
+ </Chart>
106
+ );
107
+ };
108
+
109
+ export const LabelListPieChartExample = (props: Partial<PieChartProps>) => {
110
+ return (
111
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
112
+ <PieChart {...props.pieChart}>
113
+ <ChartTooltip content={<ChartTooltipContent nameKey="visitors" hideLabel />} />
114
+ <Pie dataKey="visitors" {...props.pie}>
115
+ <LabelList
116
+ dataKey="browser"
117
+ className="fill-base-100"
118
+ stroke="none"
119
+ fontSize={12}
120
+ formatter={(value: keyof typeof chartConfig) => chartConfig[value]?.label}
121
+ {...props}
122
+ />
123
+ </Pie>
124
+ </PieChart>
125
+ </Chart>
126
+ );
127
+ };
128
+
129
+ export const WithLegendPieChartExample = (props: Partial<PieChartProps>) => {
130
+ return (
131
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
132
+ <PieChart {...props.pieChart}>
133
+ <Pie dataKey="visitors" {...props.pie} />
134
+ <ChartLegend
135
+ content={<ChartLegendContent nameKey="browser" />}
136
+ className="-translate-y-2 flex-wrap gap-2 [&>*]:basis-1/4 [&>*]:justify-center"
137
+ />
138
+ </PieChart>
139
+ </Chart>
140
+ );
141
+ };
142
+
143
+ export const DonutPieChartExample = (props: Partial<PieChartProps>) => {
144
+ return (
145
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
146
+ <PieChart {...props.pieChart}>
147
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
148
+ <Pie dataKey="visitors" {...props.pie} />
149
+ </PieChart>
150
+ </Chart>
151
+ );
152
+ };
153
+
154
+ export const ActiveDonutPieChartExample = (props: Partial<PieChartProps>) => {
155
+ return (
156
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
157
+ <PieChart {...props.pieChart}>
158
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
159
+ <Pie
160
+ dataKey="visitors"
161
+ {...props.pie}
162
+ activeShape={({ outerRadius = 0, ...props }: PieSectorDataItem) => (
163
+ <Sector {...props} outerRadius={outerRadius + 10} />
164
+ )}
165
+ />
166
+ </PieChart>
167
+ </Chart>
168
+ );
169
+ };
170
+
171
+ export const StackedPieChartExample = (props: Partial<PieChartProps>) => {
172
+ const desktopData = [
173
+ { month: "january", desktop: 186, fill: "var(--color-january)" },
174
+ { month: "february", desktop: 305, fill: "var(--color-february)" },
175
+ { month: "march", desktop: 237, fill: "var(--color-march)" },
176
+ { month: "april", desktop: 173, fill: "var(--color-april)" },
177
+ { month: "may", desktop: 209, fill: "var(--color-may)" },
178
+ ];
179
+ const mobileData = [
180
+ { month: "january", mobile: 80, fill: "var(--color-january)" },
181
+ { month: "february", mobile: 200, fill: "var(--color-february)" },
182
+ { month: "march", mobile: 120, fill: "var(--color-march)" },
183
+ { month: "april", mobile: 190, fill: "var(--color-april)" },
184
+ { month: "may", mobile: 130, fill: "var(--color-may)" },
185
+ ];
186
+ const chartConfig = {
187
+ visitors: {
188
+ label: "Visitors",
189
+ },
190
+ desktop: {
191
+ label: "Desktop",
192
+ },
193
+ mobile: {
194
+ label: "Mobile",
195
+ },
196
+ january: {
197
+ label: "January",
198
+ color: "hsl(var(--chart-1))",
199
+ },
200
+ february: {
201
+ label: "February",
202
+ color: "hsl(var(--chart-2))",
203
+ },
204
+ march: {
205
+ label: "March",
206
+ color: "hsl(var(--chart-3))",
207
+ },
208
+ april: {
209
+ label: "April",
210
+ color: "hsl(var(--chart-4))",
211
+ },
212
+ may: {
213
+ label: "May",
214
+ color: "hsl(var(--chart-5))",
215
+ },
216
+ } satisfies ChartConfig;
217
+
218
+ return (
219
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
220
+ <PieChart {...props.pieChart}>
221
+ <ChartTooltip
222
+ content={
223
+ <ChartTooltipContent
224
+ labelKey="visitors"
225
+ nameKey="month"
226
+ indicator="line"
227
+ labelFormatter={(_, payload) => {
228
+ return chartConfig[payload?.[0].dataKey as keyof typeof chartConfig].label;
229
+ }}
230
+ />
231
+ }
232
+ />
233
+ <Pie {...props.pie} data={desktopData} dataKey="desktop" outerRadius={60} />
234
+ <Pie {...props.pie} data={mobileData} dataKey="mobile" innerRadius={70} outerRadius={90} />
235
+ </PieChart>
236
+ </Chart>
237
+ );
238
+ };
@@ -0,0 +1,261 @@
1
+ import { type SVGProps } from "react";
2
+ import { PolarAngleAxis, PolarGrid, PolarRadiusAxis, Radar, RadarChart } from "recharts";
3
+ import { Chart } from "../../Chart";
4
+ import {
5
+ ChartLegend,
6
+ ChartLegendContent,
7
+ ChartTooltip,
8
+ ChartTooltipContent,
9
+ } from "../../components";
10
+ import { type ChartConfig } from "../../types";
11
+ import { type RadarChartProps } from "../args";
12
+
13
+ const chartConfig = {
14
+ desktop: {
15
+ label: "Desktop",
16
+ color: "hsl(var(--chart-1))",
17
+ },
18
+ mobile: {
19
+ label: "Mobile",
20
+ color: "hsl(var(--chart-2))",
21
+ },
22
+ } satisfies ChartConfig;
23
+
24
+ /**
25
+ * ## Parent
26
+ *
27
+ * The RadarChart can be used within: `<Chart />`
28
+ *
29
+ * ## Children
30
+ *
31
+ * The RadarChart can be used with the following child components: `<PolarAngleAxis />`, `<PolarRadiusAxis />`,
32
+ * `<PolarGrid />`, `<ChartLegend />`, `<ChartTooltip />`, `<Radar />`, `<Customized />`
33
+ */
34
+ export const RadarChartExample = (props: Partial<RadarChartProps>) => {
35
+ return (
36
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
37
+ <RadarChart {...props.radarChart}>
38
+ <ChartTooltip cursor={false} content={<ChartTooltipContent />} />
39
+ <PolarAngleAxis dataKey="month" />
40
+ <PolarGrid />
41
+ <Radar dataKey="desktop" {...props.radar} />
42
+ </RadarChart>
43
+ </Chart>
44
+ );
45
+ };
46
+
47
+ export const DotRadarChartExample = (props: Partial<RadarChartProps>) => {
48
+ return (
49
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
50
+ <RadarChart {...props.radarChart}>
51
+ <ChartTooltip cursor={false} content={<ChartTooltipContent />} />
52
+ <PolarAngleAxis dataKey="month" />
53
+ <PolarGrid />
54
+ <Radar dataKey="desktop" {...props.radar} />
55
+ </RadarChart>
56
+ </Chart>
57
+ );
58
+ };
59
+
60
+ export const MultipleRadarChartExample = (props: Partial<RadarChartProps>) => {
61
+ return (
62
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
63
+ <RadarChart {...props.radarChart}>
64
+ <ChartTooltip cursor={false} content={<ChartTooltipContent indicator="line" />} />
65
+ <PolarAngleAxis dataKey="month" />
66
+ <PolarGrid />
67
+ <Radar {...props.radar} dataKey="desktop" fill="var(--color-desktop)" fillOpacity={0.6} />
68
+ <Radar {...props.radar} dataKey="mobile" fill="var(--color-mobile)" />
69
+ </RadarChart>
70
+ </Chart>
71
+ );
72
+ };
73
+
74
+ export const LinesRadarChartExample = (props: Partial<RadarChartProps>) => {
75
+ return (
76
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
77
+ <RadarChart {...props.radarChart}>
78
+ <ChartTooltip cursor={false} content={<ChartTooltipContent indicator="line" />} />
79
+ <PolarAngleAxis dataKey="month" />
80
+ <PolarGrid radialLines={false} />
81
+ <Radar
82
+ {...props.radar}
83
+ dataKey="desktop"
84
+ fill="var(--color-desktop)"
85
+ stroke="var(--color-desktop)"
86
+ />
87
+ <Radar
88
+ {...props.radar}
89
+ dataKey="mobile"
90
+ fill="var(--color-mobile)"
91
+ stroke="var(--color-mobile)"
92
+ />
93
+ </RadarChart>
94
+ </Chart>
95
+ );
96
+ };
97
+
98
+ export const CustomLabeledRadarChartExample = (props: Partial<RadarChartProps>) => {
99
+ const chartData = [
100
+ { month: "January", desktop: 186, mobile: 80 },
101
+ { month: "February", desktop: 305, mobile: 200 },
102
+ { month: "March", desktop: 237, mobile: 120 },
103
+ { month: "April", desktop: 73, mobile: 190 },
104
+ { month: "May", desktop: 209, mobile: 130 },
105
+ { month: "June", desktop: 214, mobile: 140 },
106
+ ];
107
+
108
+ return (
109
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
110
+ <RadarChart data={chartData}>
111
+ <ChartTooltip cursor={false} content={<ChartTooltipContent indicator="line" />} />
112
+ <PolarAngleAxis
113
+ dataKey="month"
114
+ tick={({
115
+ x,
116
+ y,
117
+ textAnchor,
118
+ index,
119
+ ...props
120
+ }: SVGProps<SVGTextElement> & { index: number }) => {
121
+ const data = chartData[index];
122
+ return (
123
+ <text
124
+ x={x}
125
+ y={index === 0 ? Number(y) - 10 : y}
126
+ textAnchor={textAnchor}
127
+ fontSize={13}
128
+ fontWeight={500}
129
+ {...props}
130
+ >
131
+ <tspan>{data.desktop}</tspan>
132
+ <tspan className="fill-base-content">/</tspan>
133
+ <tspan>{data.mobile}</tspan>
134
+ <tspan x={x} dy={"1rem"} fontSize={12} className="fill-base-content">
135
+ {data.month}
136
+ </tspan>
137
+ </text>
138
+ );
139
+ }}
140
+ />
141
+ <PolarGrid />
142
+ <Radar {...props.radar} dataKey="desktop" fill="var(--color-desktop)" fillOpacity={0.6} />
143
+ <Radar {...props.radar} dataKey="mobile" fill="var(--color-mobile)" />
144
+ </RadarChart>
145
+ </Chart>
146
+ );
147
+ };
148
+
149
+ export const RadiusAxisRadarChartExample = (props: Partial<RadarChartProps>) => {
150
+ return (
151
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
152
+ <RadarChart {...props.radarChart}>
153
+ <ChartTooltip
154
+ cursor={false}
155
+ content={<ChartTooltipContent indicator="line" labelKey="month" />}
156
+ />
157
+ <PolarGrid />
158
+ <Radar {...props.radar} dataKey="desktop" fill="var(--color-desktop)" fillOpacity={0.6} />
159
+ <Radar {...props.radar} dataKey="mobile" fill="var(--color-mobile)" />
160
+ <PolarRadiusAxis
161
+ angle={60}
162
+ stroke="hsla(var(--foreground))"
163
+ orientation="middle"
164
+ axisLine={false}
165
+ />
166
+ </RadarChart>
167
+ </Chart>
168
+ );
169
+ };
170
+
171
+ export const GridCustomRadarChartExample = (props: Partial<RadarChartProps>) => {
172
+ return (
173
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
174
+ <RadarChart {...props.radarChart}>
175
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
176
+ <PolarGrid radialLines={false} polarRadius={[90]} strokeWidth={1} />
177
+ <PolarAngleAxis dataKey="month" />
178
+ <Radar dataKey="desktop" {...props.radar} />
179
+ </RadarChart>
180
+ </Chart>
181
+ );
182
+ };
183
+
184
+ export const GridFilledRadarChartExample = (props: Partial<RadarChartProps>) => {
185
+ return (
186
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
187
+ <RadarChart {...props.radarChart}>
188
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
189
+ <PolarGrid className="fill-[--color-desktop] opacity-20" />
190
+ <PolarAngleAxis dataKey="month" />
191
+ <Radar dataKey="desktop" {...props.radar} />
192
+ </RadarChart>
193
+ </Chart>
194
+ );
195
+ };
196
+
197
+ export const NoGridRadarChartExample = (props: Partial<RadarChartProps>) => {
198
+ return (
199
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
200
+ <RadarChart {...props.radarChart}>
201
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
202
+ <PolarAngleAxis dataKey="month" />
203
+ <Radar dataKey="desktop" {...props.radar} />
204
+ </RadarChart>
205
+ </Chart>
206
+ );
207
+ };
208
+
209
+ export const GridCircleRadarChartExample = (props: Partial<RadarChartProps>) => {
210
+ return (
211
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
212
+ <RadarChart {...props.radarChart}>
213
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
214
+ <PolarGrid gridType="circle" />
215
+ <PolarAngleAxis dataKey="month" />
216
+ <Radar dataKey="desktop" {...props.radar} />
217
+ </RadarChart>
218
+ </Chart>
219
+ );
220
+ };
221
+
222
+ export const NoLinesGridCircleRadarChartExample = (props: Partial<RadarChartProps>) => {
223
+ return (
224
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
225
+ <RadarChart {...props.radarChart}>
226
+ <ChartTooltip cursor={false} content={<ChartTooltipContent hideLabel />} />
227
+ <PolarGrid gridType="circle" radialLines={false} />
228
+ <PolarAngleAxis dataKey="month" />
229
+ <Radar dataKey="desktop" {...props.radar} />
230
+ </RadarChart>
231
+ </Chart>
232
+ );
233
+ };
234
+
235
+ export const GridCircleFilledRadarChartExample = (props: Partial<RadarChartProps>) => {
236
+ return (
237
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
238
+ <RadarChart {...props.radarChart}>
239
+ <ChartTooltip cursor={false} content={<ChartTooltipContent />} />
240
+ <PolarGrid className="fill-[--color-desktop] opacity-20" gridType="circle" />
241
+ <PolarAngleAxis dataKey="month" />
242
+ <Radar dataKey="desktop" {...props.radar} />
243
+ </RadarChart>
244
+ </Chart>
245
+ );
246
+ };
247
+
248
+ export const LegendRadarChartExample = (props: Partial<RadarChartProps>) => {
249
+ return (
250
+ <Chart config={chartConfig} className="mx-auto aspect-square h-[250px]">
251
+ <RadarChart {...props.radarChart}>
252
+ <ChartTooltip cursor={false} content={<ChartTooltipContent indicator="line" />} />
253
+ <PolarAngleAxis dataKey="month" />
254
+ <PolarGrid />
255
+ <Radar {...props.radar} dataKey="desktop" fill="var(--color-desktop)" fillOpacity={0.6} />
256
+ <Radar {...props.radar} dataKey="mobile" fill="var(--color-mobile)" />
257
+ <ChartLegend className="mt-8" content={<ChartLegendContent />} />
258
+ </RadarChart>
259
+ </Chart>
260
+ );
261
+ };