@yamada-ui/charts 2.0.0-next-20240820160301 → 2.0.0-next-20240908154823

Sign up to get free protection for your applications and to get access to all the features.
Files changed (202) hide show
  1. package/README.md +7 -13
  2. package/dist/area-chart-split.js +4 -2
  3. package/dist/area-chart-split.js.map +1 -1
  4. package/dist/area-chart-split.mjs +1 -1
  5. package/dist/area-chart.d.mts +1 -2
  6. package/dist/area-chart.d.ts +1 -2
  7. package/dist/area-chart.js +57 -50
  8. package/dist/area-chart.js.map +1 -1
  9. package/dist/area-chart.mjs +12 -12
  10. package/dist/bar-chart.d.mts +1 -2
  11. package/dist/bar-chart.d.ts +1 -2
  12. package/dist/bar-chart.js +15 -9
  13. package/dist/bar-chart.js.map +1 -1
  14. package/dist/bar-chart.mjs +11 -11
  15. package/dist/chart-legend.mjs +3 -3
  16. package/dist/chart-tooltip.d.mts +3 -1
  17. package/dist/chart-tooltip.d.ts +3 -1
  18. package/dist/chart-tooltip.js +9 -1
  19. package/dist/chart-tooltip.js.map +1 -1
  20. package/dist/chart-tooltip.mjs +3 -3
  21. package/dist/chart.types.d.mts +12 -5
  22. package/dist/chart.types.d.ts +12 -5
  23. package/dist/chart.types.js.map +1 -1
  24. package/dist/{chunk-STBYN5JW.mjs → chunk-3AOICU4Q.mjs} +2 -2
  25. package/dist/chunk-3HQ2UC3I.mjs +45 -0
  26. package/dist/chunk-3HQ2UC3I.mjs.map +1 -0
  27. package/dist/{chunk-FALZDKAW.mjs → chunk-3VKCTSPC.mjs} +10 -11
  28. package/dist/chunk-3VKCTSPC.mjs.map +1 -0
  29. package/dist/{chunk-S5NKKKV5.mjs → chunk-5PSRSNGH.mjs} +7 -8
  30. package/dist/chunk-5PSRSNGH.mjs.map +1 -0
  31. package/dist/{chunk-F34FV5DY.mjs → chunk-6YUJLLGN.mjs} +59 -3
  32. package/dist/chunk-6YUJLLGN.mjs.map +1 -0
  33. package/dist/{chunk-KBBHISBO.mjs → chunk-BYL7HWNN.mjs} +13 -14
  34. package/dist/chunk-BYL7HWNN.mjs.map +1 -0
  35. package/dist/chunk-D5IRVU4W.mjs +46 -0
  36. package/dist/chunk-D5IRVU4W.mjs.map +1 -0
  37. package/dist/{chunk-DGOXJ373.mjs → chunk-EL2VTGFB.mjs} +2 -2
  38. package/dist/{chunk-6L73M52L.mjs → chunk-FPFCMFCJ.mjs} +7 -9
  39. package/dist/chunk-FPFCMFCJ.mjs.map +1 -0
  40. package/dist/{chunk-Q7CCSKX3.mjs → chunk-JTQ5QCML.mjs} +4 -4
  41. package/dist/chunk-JTQ5QCML.mjs.map +1 -0
  42. package/dist/chunk-KVE6VXTJ.mjs +37 -0
  43. package/dist/chunk-KVE6VXTJ.mjs.map +1 -0
  44. package/dist/{chunk-PNE3JG54.mjs → chunk-MGTMKKSH.mjs} +5 -3
  45. package/dist/chunk-MGTMKKSH.mjs.map +1 -0
  46. package/dist/chunk-PG7ZV76C.mjs +155 -0
  47. package/dist/chunk-PG7ZV76C.mjs.map +1 -0
  48. package/dist/{chunk-D7EZKGCJ.mjs → chunk-PPBHLDVN.mjs} +2 -2
  49. package/dist/{chunk-AODYT4HF.mjs → chunk-RKO6KM3T.mjs} +13 -14
  50. package/dist/chunk-RKO6KM3T.mjs.map +1 -0
  51. package/dist/chunk-SBPKRYF2.mjs +199 -0
  52. package/dist/chunk-SBPKRYF2.mjs.map +1 -0
  53. package/dist/{chunk-FCMP6QEZ.mjs → chunk-SWATR7CU.mjs} +14 -15
  54. package/dist/chunk-SWATR7CU.mjs.map +1 -0
  55. package/dist/{chunk-MT5JI4OR.mjs → chunk-T5DNDBW6.mjs} +11 -3
  56. package/dist/chunk-T5DNDBW6.mjs.map +1 -0
  57. package/dist/{chunk-5Q6O726L.mjs → chunk-TCSYDMC7.mjs} +2 -2
  58. package/dist/{chunk-UHQ6WE5D.mjs → chunk-TMHSYM3V.mjs} +17 -13
  59. package/dist/chunk-TMHSYM3V.mjs.map +1 -0
  60. package/dist/{chunk-AOGTJ4EN.mjs → chunk-VMBRDEM2.mjs} +2 -2
  61. package/dist/{chunk-XUAAKVRL.mjs → chunk-WMG5U5AU.mjs} +26 -13
  62. package/dist/chunk-WMG5U5AU.mjs.map +1 -0
  63. package/dist/{chunk-6BNJZIBK.mjs → chunk-X7XFG7TS.mjs} +10 -12
  64. package/dist/chunk-X7XFG7TS.mjs.map +1 -0
  65. package/dist/{chunk-MOFNE6PO.mjs → chunk-XRF3TNSQ.mjs} +6 -30
  66. package/dist/chunk-XRF3TNSQ.mjs.map +1 -0
  67. package/dist/{chunk-VK4VQQYY.mjs → chunk-YNJ423BR.mjs} +2 -2
  68. package/dist/{chunk-BGMNYKQY.mjs → chunk-ZQWVMOT6.mjs} +9 -7
  69. package/dist/chunk-ZQWVMOT6.mjs.map +1 -0
  70. package/dist/donut-chart.d.mts +3 -3
  71. package/dist/donut-chart.d.ts +3 -3
  72. package/dist/donut-chart.js +109 -58
  73. package/dist/donut-chart.js.map +1 -1
  74. package/dist/donut-chart.mjs +9 -8
  75. package/dist/index.d.mts +6 -2
  76. package/dist/index.d.ts +6 -2
  77. package/dist/index.js +599 -167
  78. package/dist/index.js.map +1 -1
  79. package/dist/index.mjs +30 -22
  80. package/dist/index.mjs.map +1 -1
  81. package/dist/line-chart.d.mts +1 -2
  82. package/dist/line-chart.d.ts +1 -2
  83. package/dist/line-chart.js +15 -10
  84. package/dist/line-chart.js.map +1 -1
  85. package/dist/line-chart.mjs +11 -11
  86. package/dist/pie-chart.d.mts +2 -3
  87. package/dist/pie-chart.d.ts +2 -3
  88. package/dist/pie-chart.js +13 -7
  89. package/dist/pie-chart.js.map +1 -1
  90. package/dist/pie-chart.mjs +8 -8
  91. package/dist/radar-chart.d.mts +3 -3
  92. package/dist/radar-chart.d.ts +3 -3
  93. package/dist/radar-chart.js +90 -70
  94. package/dist/radar-chart.js.map +1 -1
  95. package/dist/radar-chart.mjs +9 -8
  96. package/dist/radial-chart.d.mts +53 -0
  97. package/dist/radial-chart.d.ts +53 -0
  98. package/dist/radial-chart.js +767 -0
  99. package/dist/radial-chart.js.map +1 -0
  100. package/dist/radial-chart.mjs +18 -0
  101. package/dist/radial-chart.mjs.map +1 -0
  102. package/dist/rechart-properties.d.mts +5 -1
  103. package/dist/rechart-properties.d.ts +5 -1
  104. package/dist/rechart-properties.js +60 -1
  105. package/dist/rechart-properties.js.map +1 -1
  106. package/dist/rechart-properties.mjs +7 -1
  107. package/dist/use-area-chart.d.mts +1 -2
  108. package/dist/use-area-chart.d.ts +1 -2
  109. package/dist/use-area-chart.js +7 -9
  110. package/dist/use-area-chart.js.map +1 -1
  111. package/dist/use-area-chart.mjs +2 -2
  112. package/dist/use-bar-chart.d.mts +1 -2
  113. package/dist/use-bar-chart.d.ts +1 -2
  114. package/dist/use-bar-chart.js +4 -5
  115. package/dist/use-bar-chart.js.map +1 -1
  116. package/dist/use-bar-chart.mjs +2 -2
  117. package/dist/use-chart-axis.d.mts +0 -1
  118. package/dist/use-chart-axis.d.ts +0 -1
  119. package/dist/use-chart-axis.js.map +1 -1
  120. package/dist/use-chart-axis.mjs +2 -2
  121. package/dist/use-chart-grid.d.mts +0 -1
  122. package/dist/use-chart-grid.d.ts +0 -1
  123. package/dist/use-chart-grid.js.map +1 -1
  124. package/dist/use-chart-grid.mjs +2 -2
  125. package/dist/use-chart-label-list.d.mts +22 -0
  126. package/dist/use-chart-label-list.d.ts +22 -0
  127. package/dist/use-chart-label-list.js +93 -0
  128. package/dist/use-chart-label-list.js.map +1 -0
  129. package/dist/use-chart-label-list.mjs +10 -0
  130. package/dist/use-chart-label-list.mjs.map +1 -0
  131. package/dist/use-chart-label.d.mts +20 -0
  132. package/dist/use-chart-label.d.ts +20 -0
  133. package/dist/use-chart-label.js +82 -0
  134. package/dist/use-chart-label.js.map +1 -0
  135. package/dist/use-chart-label.mjs +10 -0
  136. package/dist/use-chart-label.mjs.map +1 -0
  137. package/dist/use-chart-legend.d.mts +0 -1
  138. package/dist/use-chart-legend.d.ts +0 -1
  139. package/dist/use-chart-legend.js.map +1 -1
  140. package/dist/use-chart-legend.mjs +2 -2
  141. package/dist/use-chart-reference-line.d.mts +0 -1
  142. package/dist/use-chart-reference-line.d.ts +0 -1
  143. package/dist/use-chart-reference-line.js +1 -1
  144. package/dist/use-chart-reference-line.js.map +1 -1
  145. package/dist/use-chart-reference-line.mjs +2 -2
  146. package/dist/use-chart-tooltip.d.mts +0 -1
  147. package/dist/use-chart-tooltip.d.ts +0 -1
  148. package/dist/use-chart-tooltip.js.map +1 -1
  149. package/dist/use-chart-tooltip.mjs +2 -2
  150. package/dist/use-chart.d.mts +0 -1
  151. package/dist/use-chart.d.ts +0 -1
  152. package/dist/use-chart.js.map +1 -1
  153. package/dist/use-chart.mjs +2 -2
  154. package/dist/use-line-chart.d.mts +1 -2
  155. package/dist/use-line-chart.d.ts +1 -2
  156. package/dist/use-line-chart.js +4 -6
  157. package/dist/use-line-chart.js.map +1 -1
  158. package/dist/use-line-chart.mjs +2 -2
  159. package/dist/use-pie-chart.d.mts +1 -2
  160. package/dist/use-pie-chart.d.ts +1 -2
  161. package/dist/use-pie-chart.js +3 -4
  162. package/dist/use-pie-chart.js.map +1 -1
  163. package/dist/use-pie-chart.mjs +2 -2
  164. package/dist/use-polar-grid.d.mts +24 -0
  165. package/dist/use-polar-grid.d.ts +24 -0
  166. package/dist/use-polar-grid.js +90 -0
  167. package/dist/use-polar-grid.js.map +1 -0
  168. package/dist/use-polar-grid.mjs +10 -0
  169. package/dist/use-polar-grid.mjs.map +1 -0
  170. package/dist/use-radar-chart.d.mts +3 -13
  171. package/dist/use-radar-chart.d.ts +3 -13
  172. package/dist/use-radar-chart.js +3 -35
  173. package/dist/use-radar-chart.js.map +1 -1
  174. package/dist/use-radar-chart.mjs +2 -2
  175. package/dist/use-radial-chart.d.mts +80 -0
  176. package/dist/use-radial-chart.d.ts +80 -0
  177. package/dist/use-radial-chart.js +228 -0
  178. package/dist/use-radial-chart.js.map +1 -0
  179. package/dist/use-radial-chart.mjs +10 -0
  180. package/dist/use-radial-chart.mjs.map +1 -0
  181. package/package.json +4 -4
  182. package/dist/chunk-6BNJZIBK.mjs.map +0 -1
  183. package/dist/chunk-6L73M52L.mjs.map +0 -1
  184. package/dist/chunk-AODYT4HF.mjs.map +0 -1
  185. package/dist/chunk-BGMNYKQY.mjs.map +0 -1
  186. package/dist/chunk-F34FV5DY.mjs.map +0 -1
  187. package/dist/chunk-FALZDKAW.mjs.map +0 -1
  188. package/dist/chunk-FCMP6QEZ.mjs.map +0 -1
  189. package/dist/chunk-KBBHISBO.mjs.map +0 -1
  190. package/dist/chunk-MOFNE6PO.mjs.map +0 -1
  191. package/dist/chunk-MT5JI4OR.mjs.map +0 -1
  192. package/dist/chunk-PNE3JG54.mjs.map +0 -1
  193. package/dist/chunk-Q7CCSKX3.mjs.map +0 -1
  194. package/dist/chunk-S5NKKKV5.mjs.map +0 -1
  195. package/dist/chunk-UHQ6WE5D.mjs.map +0 -1
  196. package/dist/chunk-XUAAKVRL.mjs.map +0 -1
  197. /package/dist/{chunk-STBYN5JW.mjs.map → chunk-3AOICU4Q.mjs.map} +0 -0
  198. /package/dist/{chunk-DGOXJ373.mjs.map → chunk-EL2VTGFB.mjs.map} +0 -0
  199. /package/dist/{chunk-D7EZKGCJ.mjs.map → chunk-PPBHLDVN.mjs.map} +0 -0
  200. /package/dist/{chunk-5Q6O726L.mjs.map → chunk-TCSYDMC7.mjs.map} +0 -0
  201. /package/dist/{chunk-AOGTJ4EN.mjs.map → chunk-VMBRDEM2.mjs.map} +0 -0
  202. /package/dist/{chunk-VK4VQQYY.mjs.map → chunk-YNJ423BR.mjs.map} +0 -0
@@ -0,0 +1,767 @@
1
+ "use client"
2
+ "use strict";
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
7
+ var __export = (target, all) => {
8
+ for (var name in all)
9
+ __defProp(target, name, { get: all[name], enumerable: true });
10
+ };
11
+ var __copyProps = (to, from, except, desc) => {
12
+ if (from && typeof from === "object" || typeof from === "function") {
13
+ for (let key of __getOwnPropNames(from))
14
+ if (!__hasOwnProp.call(to, key) && key !== except)
15
+ __defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
16
+ }
17
+ return to;
18
+ };
19
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
20
+
21
+ // src/radial-chart.tsx
22
+ var radial_chart_exports = {};
23
+ __export(radial_chart_exports, {
24
+ RadialChart: () => RadialChart
25
+ });
26
+ module.exports = __toCommonJS(radial_chart_exports);
27
+ var import_core9 = require("@yamada-ui/core");
28
+ var import_utils10 = require("@yamada-ui/utils");
29
+ var import_react7 = require("react");
30
+ var import_recharts = require("recharts");
31
+
32
+ // src/chart-legend.tsx
33
+ var import_core3 = require("@yamada-ui/core");
34
+ var import_utils3 = require("@yamada-ui/utils");
35
+
36
+ // src/use-chart.ts
37
+ var import_core2 = require("@yamada-ui/core");
38
+ var import_utils2 = require("@yamada-ui/utils");
39
+ var import_react = require("react");
40
+
41
+ // src/chart-utils.ts
42
+ var import_core = require("@yamada-ui/core");
43
+ var import_utils = require("@yamada-ui/utils");
44
+ var getClassName = (...styles) => (theme) => (0, import_utils.cx)(
45
+ ...styles.map(
46
+ (style) => (0, import_utils.isString)(style) ? style : (0, import_core.getCSS)(style)(theme)
47
+ )
48
+ );
49
+ var getComponentProps = ([obj, keys], ...props) => (theme, isContain) => {
50
+ const [pickedProps, omittedProps] = (0, import_utils.splitObject)(obj, keys);
51
+ const className = getClassName(...props, omittedProps)(theme);
52
+ return !isContain ? [pickedProps, className] : { ...pickedProps, className };
53
+ };
54
+
55
+ // src/rechart-properties.ts
56
+ var radialChartProperties = [
57
+ "width",
58
+ "height",
59
+ "data",
60
+ "margin",
61
+ "barCategoryGap",
62
+ "barGap",
63
+ "cx",
64
+ "cy",
65
+ "startAngle",
66
+ "endAngle",
67
+ "innerRadius",
68
+ "outerRadius",
69
+ "barSize",
70
+ "onMouseEnter",
71
+ "onMouseLeave",
72
+ "onClick"
73
+ ];
74
+ var containerProperties = [
75
+ "aspect",
76
+ "width",
77
+ "height",
78
+ "minWidth",
79
+ "minHeight",
80
+ "debounce",
81
+ "onResize"
82
+ ];
83
+ var legendProperties = [
84
+ "width",
85
+ "height",
86
+ "layout",
87
+ "align",
88
+ "verticalAlign",
89
+ "iconSize",
90
+ "iconType",
91
+ "payload",
92
+ "chartWidth",
93
+ "chartHeight",
94
+ "margin",
95
+ "content",
96
+ "formatter",
97
+ "wrapperStyle",
98
+ "onClick",
99
+ "onMouseDown",
100
+ "onMouseUp",
101
+ "onMouseMove",
102
+ "onMouseOver",
103
+ "onMouseOut",
104
+ "onMouseEnter",
105
+ "onMouseLeave"
106
+ ];
107
+ var tooltipProperties = [
108
+ "offset",
109
+ "filterNull",
110
+ "itemStyle",
111
+ "wrapperStyle",
112
+ "contentStyle",
113
+ "labelStyle",
114
+ "cursor",
115
+ "viewBox",
116
+ "allowEscapeViewBox",
117
+ "active",
118
+ "position",
119
+ "coordinate",
120
+ "payload",
121
+ "label",
122
+ "content",
123
+ "formatter",
124
+ "labelFormatter",
125
+ "itemSorter",
126
+ "isAnimationActive",
127
+ "animationDuration",
128
+ "animationEasing"
129
+ ];
130
+ var radialBarProperties = [
131
+ "legendType",
132
+ "label",
133
+ "background",
134
+ "data",
135
+ "dataKey",
136
+ "isAnimationActive",
137
+ "animationBegin",
138
+ "animationDuration",
139
+ "animationEasing",
140
+ "onAnimationStart",
141
+ "onAnimationEnd",
142
+ "onClick",
143
+ "onMouseDown",
144
+ "onMouseUp",
145
+ "onMouseMove",
146
+ "onMouseOver",
147
+ "onMouseOut",
148
+ "onMouseEnter",
149
+ "onMouseLeave",
150
+ "cornerRadius"
151
+ ];
152
+ var polarGridProperties = [
153
+ "cx",
154
+ "cy",
155
+ "innerRadius",
156
+ "outerRadius",
157
+ "polarAngles",
158
+ "polarRadius",
159
+ "gridType",
160
+ "radialLines"
161
+ ];
162
+ var labelListProperties = [
163
+ "dataKey",
164
+ "valueAccessor",
165
+ "content",
166
+ "position",
167
+ "offset",
168
+ "formatter",
169
+ "data",
170
+ "clockWise",
171
+ "id",
172
+ "position"
173
+ ];
174
+
175
+ // src/use-chart.ts
176
+ var [ChartProvider, useChartContext] = (0, import_utils2.createContext)({
177
+ name: "ChartContext",
178
+ errorMessage: `useChartContext returned is 'undefined'. Seems you forgot to wrap the components in "<LineChart />" or "<BarChart />" etc.`
179
+ });
180
+ var useChart = ({ containerProps = {} }) => {
181
+ const { theme } = (0, import_core2.useTheme)();
182
+ const [reChartsProps, propClassName] = getComponentProps([
183
+ containerProps,
184
+ containerProperties
185
+ ])(theme);
186
+ const getContainerProps = (0, import_react.useCallback)(
187
+ ({ className, ...props } = {}, ref = null) => ({
188
+ ref,
189
+ className: (0, import_utils2.cx)("ui-chart__container", className, propClassName),
190
+ ...props,
191
+ ...reChartsProps
192
+ }),
193
+ [propClassName, reChartsProps]
194
+ );
195
+ return {
196
+ getContainerProps
197
+ };
198
+ };
199
+ var useLegend = ({} = {}) => {
200
+ const { styles } = useChartContext();
201
+ return {
202
+ styles
203
+ };
204
+ };
205
+ var useTooltip = ({} = {}) => {
206
+ const { styles } = useChartContext();
207
+ return {
208
+ styles
209
+ };
210
+ };
211
+
212
+ // src/chart-legend.tsx
213
+ var import_jsx_runtime = require("react/jsx-runtime");
214
+ var ChartLegend = (0, import_core3.forwardRef)(
215
+ ({ className, payload = [], onHighlight, ...rest }, ref) => {
216
+ const { styles } = useLegend();
217
+ const items = payload.map(({ dataKey, value: valueProp, color }, index) => {
218
+ const value = dataKey != null ? dataKey : valueProp;
219
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)(
220
+ import_core3.ui.div,
221
+ {
222
+ className: "ui-chart__legend-item",
223
+ onMouseEnter: () => onHighlight(value),
224
+ onMouseLeave: () => onHighlight(null),
225
+ __css: styles.legendItem,
226
+ children: [
227
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
228
+ import_core3.ui.div,
229
+ {
230
+ className: "ui-chart__legend-swatch",
231
+ background: color,
232
+ __css: styles.legendSwatch
233
+ }
234
+ ),
235
+ /* @__PURE__ */ (0, import_jsx_runtime.jsx)(import_core3.ui.span, { className: "ui-chart__legend-label", children: value })
236
+ ]
237
+ },
238
+ `legend-${index}`
239
+ );
240
+ });
241
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
242
+ import_core3.ui.div,
243
+ {
244
+ ref,
245
+ className: (0, import_utils3.cx)("ui-chart__legend", className),
246
+ __css: styles.legend,
247
+ ...rest,
248
+ children: items
249
+ }
250
+ );
251
+ }
252
+ );
253
+
254
+ // src/chart-tooltip.tsx
255
+ var import_core4 = require("@yamada-ui/core");
256
+ var import_utils4 = require("@yamada-ui/utils");
257
+ var import_jsx_runtime2 = require("react/jsx-runtime");
258
+ var ChartTooltip = (0, import_core4.forwardRef)(
259
+ ({
260
+ label,
261
+ dataKey = "value",
262
+ className,
263
+ payload = [],
264
+ valueFormatter,
265
+ labelFormatter,
266
+ unit,
267
+ isRadialChart,
268
+ ...rest
269
+ }, ref) => {
270
+ var _a;
271
+ const { styles } = useTooltip();
272
+ const items = payload.map(
273
+ ({
274
+ color: colorProp,
275
+ name: nameProp,
276
+ [dataKey]: valueProp,
277
+ payload: payload2
278
+ } = {}, index) => {
279
+ var _a2;
280
+ const name = isRadialChart ? payload2 == null ? void 0 : payload2.name : nameProp;
281
+ const color = colorProp != null ? colorProp : payload2 == null ? void 0 : payload2.color;
282
+ let value;
283
+ if ((0, import_utils4.isArray)(valueProp)) {
284
+ value = valueProp.map((value2) => {
285
+ var _a3;
286
+ return `${(_a3 = valueFormatter == null ? void 0 : valueFormatter(value2)) != null ? _a3 : value2}`;
287
+ }).join(" - ");
288
+ } else {
289
+ value = (_a2 = valueFormatter == null ? void 0 : valueFormatter(valueProp)) != null ? _a2 : valueProp;
290
+ }
291
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
292
+ import_core4.ui.div,
293
+ {
294
+ className: "ui-chart__tooltip-item",
295
+ __css: styles.tooltipItem,
296
+ children: [
297
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
298
+ import_core4.ui.div,
299
+ {
300
+ className: "ui-chart__tooltip-swatch",
301
+ background: color,
302
+ __css: styles.tooltipSwatch
303
+ }
304
+ ),
305
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
306
+ import_core4.ui.span,
307
+ {
308
+ className: "ui-chart__tooltip-label",
309
+ __css: styles.tooltipLabel,
310
+ children: name
311
+ }
312
+ ),
313
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
314
+ import_core4.ui.span,
315
+ {
316
+ className: "ui-chart__tooltip-value",
317
+ __css: styles.tooltipValue,
318
+ children: [
319
+ value,
320
+ unit ? unit : ""
321
+ ]
322
+ }
323
+ )
324
+ ]
325
+ },
326
+ `tooltip-payload-${index}`
327
+ );
328
+ }
329
+ );
330
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsxs)(
331
+ import_core4.ui.div,
332
+ {
333
+ ref,
334
+ className: (0, import_utils4.cx)("ui-chart__tooltip", className),
335
+ __css: styles.tooltip,
336
+ ...rest,
337
+ children: [
338
+ label ? /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.p, { className: "ui-chart__tooltip-title", __css: styles.tooltipTitle, children: (_a = labelFormatter == null ? void 0 : labelFormatter(label)) != null ? _a : label }) : null,
339
+ /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(import_core4.ui.div, { className: "ui-chart__tooltip-list", __css: styles.tooltipList, children: items })
340
+ ]
341
+ }
342
+ );
343
+ }
344
+ );
345
+
346
+ // src/use-chart-label-list.ts
347
+ var import_core5 = require("@yamada-ui/core");
348
+ var import_utils5 = require("@yamada-ui/utils");
349
+ var import_react2 = require("react");
350
+ var useChartLabelList = ({
351
+ labelListProps = [],
352
+ styles
353
+ }) => {
354
+ const { theme } = (0, import_core5.useTheme)();
355
+ const styleClassName = (0, import_core5.getCSS)(styles.labelList)(theme);
356
+ const propList = (0, import_react2.useMemo)(
357
+ () => labelListProps.map(
358
+ (props) => getComponentProps(
359
+ [props, labelListProperties],
360
+ styleClassName
361
+ )(theme, true)
362
+ ),
363
+ [labelListProps, styleClassName, theme]
364
+ );
365
+ const getLabelLineProps = (0, import_react2.useCallback)(
366
+ ({ index, className, ...props }, ref = null) => {
367
+ const { className: propClassName, ...rest } = propList[index];
368
+ return {
369
+ ref,
370
+ className: (0, import_utils5.cx)(className, propClassName),
371
+ ...props,
372
+ ...rest
373
+ };
374
+ },
375
+ [propList]
376
+ );
377
+ return { getLabelLineProps };
378
+ };
379
+
380
+ // src/use-chart-legend.ts
381
+ var import_utils6 = require("@yamada-ui/utils");
382
+ var import_react3 = require("react");
383
+ var useChartLegend = ({
384
+ legendProps: _legendProps = {}
385
+ }) => {
386
+ const [rest, legendProps] = (0, import_utils6.splitObject)(
387
+ _legendProps,
388
+ legendProperties
389
+ );
390
+ const getLegendProps = (0, import_react3.useCallback)(
391
+ (props, ref = null) => {
392
+ return {
393
+ ref,
394
+ verticalAlign: "top",
395
+ ...props,
396
+ ...rest
397
+ };
398
+ },
399
+ [rest]
400
+ );
401
+ return { legendProps, getLegendProps };
402
+ };
403
+
404
+ // src/use-chart-tooltip.ts
405
+ var import_core6 = require("@yamada-ui/core");
406
+ var import_utils7 = require("@yamada-ui/utils");
407
+ var import_react4 = require("react");
408
+ var useChartTooltip = ({
409
+ tooltipProps: _tooltipProps = {},
410
+ tooltipAnimationDuration = 0,
411
+ styles
412
+ }) => {
413
+ const { theme } = (0, import_core6.useTheme)();
414
+ const { cursor, ...rest } = _tooltipProps;
415
+ const cursorClassName = (0, import_react4.useMemo)(
416
+ () => getClassName({ ...styles.cursor, ...cursor })(theme),
417
+ [cursor, styles.cursor, theme]
418
+ );
419
+ const [tooltipProps, tooltipUIProps] = (0, import_utils7.splitObject)(
420
+ rest,
421
+ tooltipProperties
422
+ );
423
+ const getTooltipProps = (0, import_react4.useCallback)(
424
+ (props, ref = null) => ({
425
+ ref,
426
+ animationDuration: tooltipAnimationDuration,
427
+ isAnimationActive: (tooltipAnimationDuration || 0) > 0,
428
+ cursor: {
429
+ className: (0, import_utils7.cx)("ui-chart__cursor", cursorClassName)
430
+ },
431
+ ...props,
432
+ ...tooltipProps
433
+ }),
434
+ [cursorClassName, tooltipAnimationDuration, tooltipProps]
435
+ );
436
+ return { tooltipProps: tooltipUIProps, getTooltipProps };
437
+ };
438
+
439
+ // src/use-polar-grid.tsx
440
+ var import_core7 = require("@yamada-ui/core");
441
+ var import_utils8 = require("@yamada-ui/utils");
442
+ var import_react5 = require("react");
443
+ var usePolarGrid = ({
444
+ strokeDasharray,
445
+ styles,
446
+ ...rest
447
+ }) => {
448
+ const { theme } = (0, import_core7.useTheme)();
449
+ const [polarGridProps, polarGridClassName] = (0, import_react5.useMemo)(
450
+ () => {
451
+ var _a;
452
+ return getComponentProps(
453
+ [(_a = rest.polarGridProps) != null ? _a : {}, polarGridProperties],
454
+ styles.polarGrid
455
+ )(theme);
456
+ },
457
+ [rest.polarGridProps, styles.polarGrid, theme]
458
+ );
459
+ const getPolarGridProps = (0, import_react5.useCallback)(
460
+ ({ className, ...props } = {}, ref = null) => ({
461
+ ref,
462
+ className: (0, import_utils8.cx)(className, polarGridClassName),
463
+ strokeDasharray,
464
+ ...props,
465
+ ...polarGridProps
466
+ }),
467
+ [polarGridClassName, polarGridProps, strokeDasharray]
468
+ );
469
+ return { getPolarGridProps };
470
+ };
471
+
472
+ // src/use-radial-chart.ts
473
+ var import_core8 = require("@yamada-ui/core");
474
+ var import_utils9 = require("@yamada-ui/utils");
475
+ var import_react6 = require("react");
476
+ var useRadialChart = ({
477
+ data: dataProp,
478
+ dataKey = "value",
479
+ innerRadius = "10%",
480
+ outerRadius = "80%",
481
+ startAngle = 90,
482
+ endAngle = -180,
483
+ fillOpacity = 1,
484
+ styles,
485
+ ...rest
486
+ }) => {
487
+ var _a;
488
+ const { theme } = (0, import_core8.useTheme)();
489
+ const [highlightedArea, setHighlightedArea] = (0, import_react6.useState)(null);
490
+ const shouldHighlight = highlightedArea !== null;
491
+ const {
492
+ background: backgroundProps = {},
493
+ dimRadialBar: dimRadialBarProps = {},
494
+ ...computedRadialBarProps
495
+ } = (_a = rest.radialBarProps) != null ? _a : {};
496
+ const radialVars = (0, import_react6.useMemo)(
497
+ () => dataProp.map(({ color }, index) => ({
498
+ name: `radial-bar-${index}`,
499
+ token: "colors",
500
+ value: color != null ? color : "transparent"
501
+ })),
502
+ [dataProp]
503
+ );
504
+ const dimRadialBarClassName = (0, import_react6.useMemo)(() => {
505
+ const resolvedDimRadialBar = {
506
+ fillOpacity: 0.3,
507
+ strokeOpacity: 0,
508
+ ...dimRadialBarProps
509
+ };
510
+ return getClassName(resolvedDimRadialBar)(theme);
511
+ }, [dimRadialBarProps, theme]);
512
+ const [chartProps, chartClassName] = (0, import_react6.useMemo)(
513
+ () => {
514
+ var _a2;
515
+ return getComponentProps(
516
+ [(_a2 = rest.chartProps) != null ? _a2 : {}, radialChartProperties],
517
+ styles.chart
518
+ )(theme);
519
+ },
520
+ [rest.chartProps, styles.chart, theme]
521
+ );
522
+ const background = (0, import_react6.useMemo)(
523
+ () => getComponentProps(
524
+ [backgroundProps, radialBarProperties],
525
+ styles.background
526
+ )(theme, true),
527
+ [backgroundProps, styles.background, theme]
528
+ );
529
+ const [radialBarProps, radialBarClassName] = (0, import_react6.useMemo)(
530
+ () => getComponentProps(
531
+ [computedRadialBarProps != null ? computedRadialBarProps : {}, radialBarProperties],
532
+ styles.radialBar
533
+ )(theme),
534
+ [computedRadialBarProps, styles.radialBar, theme]
535
+ );
536
+ const data = (0, import_react6.useMemo)(
537
+ () => dataProp.map((props, index) => {
538
+ const {
539
+ name,
540
+ value,
541
+ color,
542
+ dimRadialBar = {},
543
+ ...computedProps
544
+ } = props;
545
+ const dimmed = shouldHighlight && highlightedArea !== name;
546
+ const resolvedProps = {
547
+ ...computedProps,
548
+ ...dimmed ? dimRadialBar : { fillOpacity }
549
+ };
550
+ const className = getClassName(
551
+ resolvedProps,
552
+ dimmed ? dimRadialBarClassName : void 0
553
+ )(theme);
554
+ return {
555
+ className,
556
+ fill: (0, import_core8.getVar)(`radial-bar-${index}`)(theme),
557
+ name,
558
+ value,
559
+ color
560
+ };
561
+ }),
562
+ [
563
+ dataProp,
564
+ dimRadialBarClassName,
565
+ fillOpacity,
566
+ highlightedArea,
567
+ shouldHighlight,
568
+ theme
569
+ ]
570
+ );
571
+ const getRadialChartProps = (0, import_react6.useCallback)(
572
+ ({ className, ...props } = {}, ref = null) => ({
573
+ ref,
574
+ className: (0, import_utils9.cx)(className, chartClassName),
575
+ data,
576
+ innerRadius,
577
+ outerRadius,
578
+ startAngle,
579
+ endAngle,
580
+ ...props,
581
+ ...chartProps
582
+ }),
583
+ [
584
+ chartClassName,
585
+ chartProps,
586
+ data,
587
+ endAngle,
588
+ innerRadius,
589
+ outerRadius,
590
+ startAngle
591
+ ]
592
+ );
593
+ const getRadialBarProps = (0, import_react6.useCallback)(
594
+ ({ className, ...props }, ref = null) => ({
595
+ ref,
596
+ className: (0, import_utils9.cx)(className, radialBarClassName),
597
+ dataKey,
598
+ isAnimationActive: false,
599
+ background,
600
+ ...props,
601
+ ...radialBarProps
602
+ }),
603
+ [background, dataKey, radialBarClassName, radialBarProps]
604
+ );
605
+ return {
606
+ radialVars,
607
+ setHighlightedArea,
608
+ getRadialChartProps,
609
+ getRadialBarProps
610
+ };
611
+ };
612
+
613
+ // src/radial-chart.tsx
614
+ var import_jsx_runtime3 = require("react/jsx-runtime");
615
+ var RadialChart = (0, import_core9.forwardRef)((props, ref) => {
616
+ const [styles, mergedProps] = (0, import_core9.useMultiComponentStyle)("RadialChart", props);
617
+ const {
618
+ className,
619
+ data,
620
+ dataKey,
621
+ chartProps,
622
+ radialBarProps,
623
+ containerProps,
624
+ withPolarGrid = false,
625
+ withTooltip = true,
626
+ withLegend = false,
627
+ tooltipProps,
628
+ tooltipAnimationDuration,
629
+ tooltipDataSource = "all",
630
+ valueFormatter,
631
+ unit,
632
+ legendProps,
633
+ innerRadius,
634
+ outerRadius,
635
+ startAngle,
636
+ endAngle,
637
+ fillOpacity,
638
+ labelListProps = [],
639
+ polarGridProps,
640
+ strokeDasharray,
641
+ ...rest
642
+ } = (0, import_core9.omitThemeProps)(mergedProps);
643
+ const {
644
+ getRadialChartProps,
645
+ getRadialBarProps,
646
+ radialVars,
647
+ setHighlightedArea
648
+ } = useRadialChart({
649
+ data,
650
+ dataKey,
651
+ styles,
652
+ chartProps,
653
+ radialBarProps,
654
+ innerRadius,
655
+ outerRadius,
656
+ startAngle,
657
+ endAngle,
658
+ fillOpacity
659
+ });
660
+ const { getContainerProps } = useChart({ containerProps });
661
+ const { tooltipProps: computedTooltipProps, getTooltipProps } = useChartTooltip({
662
+ tooltipProps,
663
+ tooltipAnimationDuration,
664
+ styles
665
+ });
666
+ const { legendProps: computedLegendProps, getLegendProps } = useChartLegend({
667
+ legendProps
668
+ });
669
+ const { getLabelLineProps } = useChartLabelList({ labelListProps, styles });
670
+ const { getPolarGridProps } = usePolarGrid({
671
+ polarGridProps,
672
+ strokeDasharray,
673
+ styles
674
+ });
675
+ const labelLists = (0, import_react7.useMemo)(
676
+ () => labelListProps.map((_, index) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
677
+ import_recharts.LabelList,
678
+ {
679
+ ...getLabelLineProps({
680
+ index,
681
+ className: "ui-radial-chart__label-list"
682
+ })
683
+ },
684
+ `labelList-${index}`
685
+ )),
686
+ [getLabelLineProps, labelListProps]
687
+ );
688
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ChartProvider, { value: { styles }, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
689
+ import_core9.ui.div,
690
+ {
691
+ ref,
692
+ className: (0, import_utils10.cx)("ui-radial-chart", className),
693
+ __css: { maxW: "full", vars: radialVars, ...styles.container },
694
+ ...rest,
695
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
696
+ import_recharts.ResponsiveContainer,
697
+ {
698
+ ...getContainerProps({ className: "ui-radial-chart__container" }),
699
+ children: /* @__PURE__ */ (0, import_jsx_runtime3.jsxs)(
700
+ import_recharts.RadialBarChart,
701
+ {
702
+ ...getRadialChartProps({
703
+ className: "ui-radial-chart__chart"
704
+ }),
705
+ children: [
706
+ withPolarGrid ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
707
+ import_recharts.PolarGrid,
708
+ {
709
+ ...getPolarGridProps({
710
+ className: "ui-radial-chart__polar-grid"
711
+ })
712
+ }
713
+ ) : null,
714
+ /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
715
+ import_recharts.RadialBar,
716
+ {
717
+ ...getRadialBarProps({
718
+ className: "ui-radial-chart__radial-bar"
719
+ }),
720
+ children: labelLists
721
+ }
722
+ ),
723
+ withLegend ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
724
+ import_recharts.Legend,
725
+ {
726
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
727
+ ChartLegend,
728
+ {
729
+ className: "ui-radial-chart__legend",
730
+ payload,
731
+ onHighlight: setHighlightedArea,
732
+ ...computedLegendProps
733
+ }
734
+ ),
735
+ ...getLegendProps()
736
+ }
737
+ ) : null,
738
+ withTooltip ? /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
739
+ import_recharts.Tooltip,
740
+ {
741
+ content: ({ payload }) => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(
742
+ ChartTooltip,
743
+ {
744
+ className: "ui-radial-chart__tooltip",
745
+ isRadialChart: tooltipDataSource === "segment" ? true : false,
746
+ payload: tooltipDataSource === "segment" ? payload : data,
747
+ valueFormatter,
748
+ unit,
749
+ ...computedTooltipProps
750
+ }
751
+ ),
752
+ ...getTooltipProps()
753
+ }
754
+ ) : null
755
+ ]
756
+ }
757
+ )
758
+ }
759
+ )
760
+ }
761
+ ) });
762
+ });
763
+ // Annotate the CommonJS export names for ESM import in node:
764
+ 0 && (module.exports = {
765
+ RadialChart
766
+ });
767
+ //# sourceMappingURL=radial-chart.js.map