@yamada-ui/charts 1.5.4-dev-20241005224505 → 1.5.4-dev-20241006000212
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart-gradient.d.mts +1 -1
- package/dist/area-chart-gradient.d.ts +1 -1
- package/dist/area-chart-gradient.js +5 -5
- package/dist/area-chart-gradient.js.map +1 -1
- package/dist/area-chart-gradient.mjs +1 -1
- package/dist/area-chart-split.d.mts +1 -1
- package/dist/area-chart-split.d.ts +1 -1
- package/dist/area-chart-split.js +2 -2
- package/dist/area-chart-split.js.map +1 -1
- package/dist/area-chart-split.mjs +1 -1
- package/dist/area-chart.d.mts +8 -8
- package/dist/area-chart.d.ts +8 -8
- package/dist/area-chart.js +180 -175
- package/dist/area-chart.js.map +1 -1
- package/dist/area-chart.mjs +13 -13
- package/dist/bar-chart.d.mts +8 -8
- package/dist/bar-chart.d.ts +8 -8
- package/dist/bar-chart.js +137 -127
- package/dist/bar-chart.js.map +1 -1
- package/dist/bar-chart.mjs +11 -11
- package/dist/chart-legend.d.mts +1 -1
- package/dist/chart-legend.d.ts +1 -1
- package/dist/chart-legend.js +2 -2
- package/dist/chart-legend.js.map +1 -1
- package/dist/chart-legend.mjs +3 -3
- package/dist/chart-tooltip.d.mts +4 -4
- package/dist/chart-tooltip.d.ts +4 -4
- package/dist/chart-tooltip.js +7 -7
- package/dist/chart-tooltip.js.map +1 -1
- package/dist/chart-tooltip.mjs +3 -3
- package/dist/chart-utils.js.map +1 -1
- package/dist/chart-utils.mjs +1 -1
- package/dist/chart.types.d.mts +14 -14
- package/dist/chart.types.d.ts +14 -14
- package/dist/chart.types.js.map +1 -1
- package/dist/{chunk-YSPGYMRF.mjs → chunk-5VLSGWQD.mjs} +8 -8
- package/dist/{chunk-YSPGYMRF.mjs.map → chunk-5VLSGWQD.mjs.map} +1 -1
- package/dist/{chunk-XYUYAHJX.mjs → chunk-6JRMEI6J.mjs} +2 -2
- package/dist/chunk-6JRMEI6J.mjs.map +1 -0
- package/dist/{chunk-VKBRU4Z4.mjs → chunk-AYVTBRCS.mjs} +29 -28
- package/dist/chunk-AYVTBRCS.mjs.map +1 -0
- package/dist/{chunk-6O5G3WYP.mjs → chunk-EZG52466.mjs} +29 -21
- package/dist/chunk-EZG52466.mjs.map +1 -0
- package/dist/{chunk-VEFEKDMH.mjs → chunk-FDALM73K.mjs} +15 -14
- package/dist/chunk-FDALM73K.mjs.map +1 -0
- package/dist/{chunk-2GQHI23M.mjs → chunk-GU4SGNWX.mjs} +5 -5
- package/dist/chunk-GU4SGNWX.mjs.map +1 -0
- package/dist/{chunk-MVRWZTQ5.mjs → chunk-NLXYCM5J.mjs} +2 -2
- package/dist/chunk-NLXYCM5J.mjs.map +1 -0
- package/dist/{chunk-54WAXZP7.mjs → chunk-NMPNNSBN.mjs} +74 -74
- package/dist/chunk-NMPNNSBN.mjs.map +1 -0
- package/dist/{chunk-OEM3VCHN.mjs → chunk-NQPC5LPY.mjs} +82 -82
- package/dist/chunk-NQPC5LPY.mjs.map +1 -0
- package/dist/{chunk-AYVZF37W.mjs → chunk-OG5CVPPV.mjs} +3 -3
- package/dist/chunk-OG5CVPPV.mjs.map +1 -0
- package/dist/{chunk-X6CD7LHX.mjs → chunk-OUIKA4AX.mjs} +3 -3
- package/dist/{chunk-X6CD7LHX.mjs.map → chunk-OUIKA4AX.mjs.map} +1 -1
- package/dist/{chunk-3EHZJFIA.mjs → chunk-PKQB4BFG.mjs} +28 -28
- package/dist/chunk-PKQB4BFG.mjs.map +1 -0
- package/dist/{chunk-C3ZYUDXE.mjs → chunk-QPMW56KA.mjs} +52 -48
- package/dist/chunk-QPMW56KA.mjs.map +1 -0
- package/dist/{chunk-IJRYXT4V.mjs → chunk-R2LOTDR3.mjs} +2 -2
- package/dist/{chunk-IJRYXT4V.mjs.map → chunk-R2LOTDR3.mjs.map} +1 -1
- package/dist/{chunk-6OYWQ3NO.mjs → chunk-SCY5V45W.mjs} +56 -56
- package/dist/chunk-SCY5V45W.mjs.map +1 -0
- package/dist/{chunk-CQTRL3BW.mjs → chunk-SYBJTMPL.mjs} +90 -90
- package/dist/chunk-SYBJTMPL.mjs.map +1 -0
- package/dist/{chunk-XKVM7WUW.mjs → chunk-TA7YJAW4.mjs} +47 -47
- package/dist/{chunk-XKVM7WUW.mjs.map → chunk-TA7YJAW4.mjs.map} +1 -1
- package/dist/{chunk-O3LMKYXK.mjs → chunk-TU6MKMMV.mjs} +29 -28
- package/dist/chunk-TU6MKMMV.mjs.map +1 -0
- package/dist/{chunk-QL3DB7OJ.mjs → chunk-TXNC7GLT.mjs} +1 -1
- package/dist/{chunk-QL3DB7OJ.mjs.map → chunk-TXNC7GLT.mjs.map} +1 -1
- package/dist/{chunk-EE6KEX6V.mjs → chunk-U325CYNR.mjs} +6 -6
- package/dist/chunk-U325CYNR.mjs.map +1 -0
- package/dist/{chunk-OPPMMNGP.mjs → chunk-UER5GW4M.mjs} +33 -24
- package/dist/chunk-UER5GW4M.mjs.map +1 -0
- package/dist/{chunk-FYAC4RRZ.mjs → chunk-UTD4XZDM.mjs} +11 -10
- package/dist/chunk-UTD4XZDM.mjs.map +1 -0
- package/dist/{chunk-A3IWA366.mjs → chunk-VK65X6Q2.mjs} +4 -4
- package/dist/chunk-VK65X6Q2.mjs.map +1 -0
- package/dist/{chunk-OJ2MLZZ7.mjs → chunk-X6PIY2M3.mjs} +7 -7
- package/dist/chunk-X6PIY2M3.mjs.map +1 -0
- package/dist/{chunk-MSG3WFBO.mjs → chunk-YIAK5DIM.mjs} +7 -6
- package/dist/chunk-YIAK5DIM.mjs.map +1 -0
- package/dist/{chunk-NETTMC2D.mjs → chunk-YTUEG4IY.mjs} +45 -45
- package/dist/chunk-YTUEG4IY.mjs.map +1 -0
- package/dist/{chunk-VUTCH2CU.mjs → chunk-YX23LEQ7.mjs} +13 -13
- package/dist/chunk-YX23LEQ7.mjs.map +1 -0
- package/dist/{chunk-DZL5KQOJ.mjs → chunk-ZRV4LO67.mjs} +42 -42
- package/dist/chunk-ZRV4LO67.mjs.map +1 -0
- package/dist/donut-chart.js +91 -89
- package/dist/donut-chart.js.map +1 -1
- package/dist/donut-chart.mjs +10 -10
- package/dist/index.d.mts +14 -14
- package/dist/index.d.ts +14 -14
- package/dist/index.js +2069 -2043
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +28 -28
- package/dist/index.mjs.map +1 -1
- package/dist/line-chart.d.mts +7 -7
- package/dist/line-chart.d.ts +7 -7
- package/dist/line-chart.js +140 -138
- package/dist/line-chart.js.map +1 -1
- package/dist/line-chart.mjs +11 -11
- package/dist/pie-chart-label.d.mts +9 -9
- package/dist/pie-chart-label.d.ts +9 -9
- package/dist/pie-chart-label.js +14 -13
- package/dist/pie-chart-label.js.map +1 -1
- package/dist/pie-chart-label.mjs +1 -1
- package/dist/pie-chart.d.mts +11 -11
- package/dist/pie-chart.d.ts +11 -11
- package/dist/pie-chart.js +89 -87
- package/dist/pie-chart.js.map +1 -1
- package/dist/pie-chart.mjs +9 -9
- package/dist/radar-chart.d.mts +11 -11
- package/dist/radar-chart.d.ts +11 -11
- package/dist/radar-chart.js +81 -73
- package/dist/radar-chart.js.map +1 -1
- package/dist/radar-chart.mjs +9 -9
- package/dist/radial-chart.d.mts +10 -10
- package/dist/radial-chart.d.ts +10 -10
- package/dist/radial-chart.js +63 -62
- package/dist/radial-chart.js.map +1 -1
- package/dist/radial-chart.mjs +10 -10
- package/dist/use-area-chart.d.mts +53 -53
- package/dist/use-area-chart.d.ts +53 -53
- package/dist/use-area-chart.js +50 -46
- package/dist/use-area-chart.js.map +1 -1
- package/dist/use-area-chart.mjs +2 -2
- package/dist/use-bar-chart.d.mts +32 -32
- package/dist/use-bar-chart.d.ts +32 -32
- package/dist/use-bar-chart.js +30 -21
- package/dist/use-bar-chart.js.map +1 -1
- package/dist/use-bar-chart.mjs +2 -2
- package/dist/use-chart-axis.d.mts +27 -27
- package/dist/use-chart-axis.d.ts +27 -27
- package/dist/use-chart-axis.js +26 -26
- package/dist/use-chart-axis.js.map +1 -1
- package/dist/use-chart-axis.mjs +2 -2
- package/dist/use-chart-grid.d.mts +8 -8
- package/dist/use-chart-grid.d.ts +8 -8
- package/dist/use-chart-grid.js +3 -3
- package/dist/use-chart-grid.js.map +1 -1
- package/dist/use-chart-grid.mjs +2 -2
- package/dist/use-chart-label-list.d.mts +4 -4
- package/dist/use-chart-label-list.d.ts +4 -4
- package/dist/use-chart-label-list.js +5 -4
- package/dist/use-chart-label-list.js.map +1 -1
- package/dist/use-chart-label-list.mjs +2 -2
- package/dist/use-chart-label.d.mts +1 -1
- package/dist/use-chart-label.d.ts +1 -1
- package/dist/use-chart-label.js.map +1 -1
- package/dist/use-chart-label.mjs +2 -2
- package/dist/use-chart-legend.d.mts +1 -1
- package/dist/use-chart-legend.d.ts +1 -1
- package/dist/use-chart-legend.js +1 -1
- package/dist/use-chart-legend.js.map +1 -1
- package/dist/use-chart-legend.mjs +1 -1
- package/dist/use-chart-reference-line.d.mts +4 -4
- package/dist/use-chart-reference-line.d.ts +4 -4
- package/dist/use-chart-reference-line.js +8 -7
- package/dist/use-chart-reference-line.js.map +1 -1
- package/dist/use-chart-reference-line.mjs +2 -2
- package/dist/use-chart-tooltip.d.mts +7 -7
- package/dist/use-chart-tooltip.d.ts +7 -7
- package/dist/use-chart-tooltip.js +4 -4
- package/dist/use-chart-tooltip.js.map +1 -1
- package/dist/use-chart-tooltip.mjs +2 -2
- package/dist/use-chart.d.mts +6 -10
- package/dist/use-chart.d.ts +6 -10
- package/dist/use-chart.js +2 -2
- package/dist/use-chart.js.map +1 -1
- package/dist/use-chart.mjs +2 -2
- package/dist/use-line-chart.d.mts +43 -43
- package/dist/use-line-chart.d.ts +43 -43
- package/dist/use-line-chart.js +26 -25
- package/dist/use-line-chart.js.map +1 -1
- package/dist/use-line-chart.mjs +2 -2
- package/dist/use-pie-chart.d.mts +47 -47
- package/dist/use-pie-chart.d.ts +47 -47
- package/dist/use-pie-chart.js +40 -38
- package/dist/use-pie-chart.js.map +1 -1
- package/dist/use-pie-chart.mjs +3 -3
- package/dist/use-polar-grid.d.mts +5 -5
- package/dist/use-polar-grid.d.ts +5 -5
- package/dist/use-polar-grid.js.map +1 -1
- package/dist/use-polar-grid.mjs +2 -2
- package/dist/use-radar-chart.d.mts +41 -41
- package/dist/use-radar-chart.d.ts +41 -41
- package/dist/use-radar-chart.js +27 -19
- package/dist/use-radar-chart.js.map +1 -1
- package/dist/use-radar-chart.mjs +2 -2
- package/dist/use-radial-chart.d.mts +17 -17
- package/dist/use-radial-chart.d.ts +17 -17
- package/dist/use-radial-chart.js +11 -11
- package/dist/use-radial-chart.js.map +1 -1
- package/dist/use-radial-chart.mjs +2 -2
- package/package.json +3 -3
- package/dist/chunk-2GQHI23M.mjs.map +0 -1
- package/dist/chunk-3EHZJFIA.mjs.map +0 -1
- package/dist/chunk-54WAXZP7.mjs.map +0 -1
- package/dist/chunk-6O5G3WYP.mjs.map +0 -1
- package/dist/chunk-6OYWQ3NO.mjs.map +0 -1
- package/dist/chunk-A3IWA366.mjs.map +0 -1
- package/dist/chunk-AYVZF37W.mjs.map +0 -1
- package/dist/chunk-C3ZYUDXE.mjs.map +0 -1
- package/dist/chunk-CQTRL3BW.mjs.map +0 -1
- package/dist/chunk-DZL5KQOJ.mjs.map +0 -1
- package/dist/chunk-EE6KEX6V.mjs.map +0 -1
- package/dist/chunk-FYAC4RRZ.mjs.map +0 -1
- package/dist/chunk-MSG3WFBO.mjs.map +0 -1
- package/dist/chunk-MVRWZTQ5.mjs.map +0 -1
- package/dist/chunk-NETTMC2D.mjs.map +0 -1
- package/dist/chunk-O3LMKYXK.mjs.map +0 -1
- package/dist/chunk-OEM3VCHN.mjs.map +0 -1
- package/dist/chunk-OJ2MLZZ7.mjs.map +0 -1
- package/dist/chunk-OPPMMNGP.mjs.map +0 -1
- package/dist/chunk-VEFEKDMH.mjs.map +0 -1
- package/dist/chunk-VKBRU4Z4.mjs.map +0 -1
- package/dist/chunk-VUTCH2CU.mjs.map +0 -1
- package/dist/chunk-XYUYAHJX.mjs.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/use-polar-grid.tsx","../src/chart-utils.ts","../src/rechart-properties.ts"],"sourcesContent":["import { useTheme } from \"@yamada-ui/core\"\nimport type { CSSUIObject, PropGetter } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport { getComponentProps } from \"./chart-utils\"\nimport type { PolarGridProps } from \"./chart.types\"\nimport { polarGridProperties } from \"./rechart-properties\"\n\nexport interface UsePolarGridOptions {\n /**\n * Props passed down to recharts `PolarGrid` component.\n */\n polarGridProps?: PolarGridProps\n /**\n * Dash array for the grid lines and cursor. The first number is the length of the solid line section and the second number is the length of the interval.\n */\n strokeDasharray?: string | number\n}\n\ninterface UsePolarGridProps extends UsePolarGridOptions {\n styles: Dict<CSSUIObject>\n}\n\nexport const usePolarGrid = ({\n strokeDasharray,\n styles,\n ...rest\n}: UsePolarGridProps) => {\n const { theme } = useTheme()\n\n const [polarGridProps, polarGridClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.polarGridProps ?? {}, polarGridProperties],\n styles.polarGrid,\n )(theme),\n [rest.polarGridProps, styles.polarGrid, theme],\n )\n\n const getPolarGridProps: PropGetter<\n Recharts.PolarGridProps,\n Recharts.PolarGridProps\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, polarGridClassName),\n strokeDasharray,\n ...props,\n ...polarGridProps,\n }),\n [polarGridClassName, polarGridProps, strokeDasharray],\n )\n\n return { getPolarGridProps }\n}\n","import type { StyledTheme } from \"@yamada-ui/core\"\nimport { getCSS } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { cx, isString, splitObject } from \"@yamada-ui/utils\"\n\nexport const getClassName =\n (...styles: (Dict | string | undefined)[]) =>\n (theme: StyledTheme) =>\n cx(\n ...styles.map((style) =>\n isString(style) ? style : getCSS(style)(theme),\n ),\n )\n\nexport const getComponentProps =\n <T extends Dict, K extends keyof T>(\n [obj, keys]: [T, K[]],\n ...props: (Dict | string | undefined)[]\n ) =>\n <P extends boolean = false>(theme: StyledTheme, isContain?: P) => {\n const [pickedProps, omittedProps] = splitObject<T, K>(obj, keys)\n const className = getClassName(...props, omittedProps)(theme)\n\n return (\n !isContain ? [pickedProps, className] : { ...pickedProps, className }\n ) as P extends false\n ? [{ [P in K]: T[P] }, string]\n : { [P in K]: T[P] } & { className: string }\n }\n","import type { Dict } from \"@yamada-ui/utils\"\nimport type { ComponentPropsWithoutRef } from \"react\"\nimport type * as Recharts from \"recharts\"\n\nexport const areaChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.AreaChart\n>)[] = [\n \"layout\",\n \"syncId\",\n \"syncMethod\",\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"stackOffset\",\n \"onClick\",\n \"onMouseEnter\",\n \"onMouseMove\",\n \"onMouseLeave\",\n]\n\nexport const barChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.BarChart\n>)[] = [\n \"layout\",\n \"syncId\",\n \"syncMethod\",\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"barCategoryGap\",\n \"barGap\",\n \"barSize\",\n \"maxBarSize\",\n \"stackOffset\",\n \"reverseStackOrder\",\n \"onClick\",\n \"onMouseEnter\",\n \"onMouseMove\",\n \"onMouseLeave\",\n]\n\nexport const lineChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.LineChart\n>)[] = [\n \"layout\",\n \"syncId\",\n \"syncMethod\",\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"onClick\",\n \"onMouseEnter\",\n \"onMouseMove\",\n \"onMouseLeave\",\n]\n\nexport const radarChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.RadarChart\n>)[] = [\n \"width\",\n \"height\",\n \"data\",\n \"cx\",\n \"cy\",\n \"startAngle\",\n \"endAngle\",\n \"innerRadius\",\n \"outerRadius\",\n \"margin\",\n \"onMouseEnter\",\n \"onClick\",\n]\n\nexport const pieChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.PieChart\n>)[] = [\"width\", \"height\", \"margin\", \"onClick\", \"onMouseEnter\", \"onMouseLeave\"]\n\nexport const radialChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.RadialBarChart\n>)[] = [\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"barCategoryGap\",\n \"barGap\",\n \"cx\",\n \"cy\",\n \"startAngle\",\n \"endAngle\",\n \"innerRadius\",\n \"outerRadius\",\n \"barSize\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"onClick\",\n]\n\nexport const referenceLineProperties: (keyof Recharts.ReferenceLineProps)[] = [\n \"xAxisId\",\n \"yAxisId\",\n \"x\",\n \"y\",\n \"ifOverflow\",\n \"viewBox\",\n \"xAxis\",\n \"yAxis\",\n \"label\",\n \"isFront\",\n \"strokeWidth\",\n \"segment\",\n]\n\nexport const containerProperties: (keyof Omit<\n Recharts.ResponsiveContainerProps,\n \"children\"\n>)[] = [\n \"aspect\",\n \"width\",\n \"height\",\n \"minWidth\",\n \"minHeight\",\n \"debounce\",\n \"onResize\",\n]\n\nexport const gridProperties: (keyof Recharts.CartesianGridProps)[] = [\n \"x\",\n \"y\",\n \"width\",\n \"height\",\n \"horizontal\",\n \"vertical\",\n \"horizontalPoints\",\n \"horizontalCoordinatesGenerator\",\n \"verticalPoints\",\n \"verticalCoordinatesGenerator\",\n \"fill\",\n \"fillOpacity\",\n \"strokeDasharray\",\n]\n\nexport const xAxisProperties: (keyof Recharts.XAxisProps)[] = [\n \"hide\",\n \"dataKey\",\n \"xAxisId\",\n \"width\",\n \"height\",\n \"orientation\",\n \"type\",\n \"allowDecimals\",\n \"allowDataOverflow\",\n \"allowDuplicatedCategory\",\n \"angle\",\n \"tickCount\",\n \"domain\",\n \"includeHidden\",\n \"interval\",\n \"padding\",\n \"minTickGap\",\n \"axisLine\",\n \"tickLine\",\n \"tickSize\",\n \"tickFormatter\",\n \"ticks\",\n \"tick\",\n \"mirror\",\n \"reversed\",\n \"label\",\n \"scale\",\n \"unit\",\n \"name\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"tickMargin\",\n]\n\nexport const yAxisProperties: (keyof Recharts.YAxisProps)[] = [\n \"hide\",\n \"dataKey\",\n \"yAxisId\",\n \"width\",\n \"height\",\n \"orientation\",\n \"type\",\n \"tickCount\",\n \"domain\",\n \"includeHidden\",\n \"interval\",\n \"padding\",\n \"minTickGap\",\n \"allowDecimals\",\n \"allowDataOverflow\",\n \"allowDuplicatedCategory\",\n \"axisLine\",\n \"tickLine\",\n \"tickSize\",\n \"tickFormatter\",\n \"ticks\",\n \"tick\",\n \"mirror\",\n \"reversed\",\n \"label\",\n \"scale\",\n \"unit\",\n \"name\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"tickMargin\",\n]\n\nexport const legendProperties: (keyof Omit<Recharts.LegendProps, \"ref\">)[] = [\n \"width\",\n \"height\",\n \"layout\",\n \"align\",\n \"verticalAlign\",\n \"iconSize\",\n \"iconType\",\n \"payload\",\n \"chartWidth\",\n \"chartHeight\",\n \"margin\",\n \"content\",\n \"formatter\",\n \"wrapperStyle\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const tooltipProperties: (keyof Recharts.TooltipProps<any, any>)[] = [\n \"offset\",\n \"filterNull\",\n \"itemStyle\",\n \"wrapperStyle\",\n \"contentStyle\",\n \"labelStyle\",\n \"cursor\",\n \"viewBox\",\n \"allowEscapeViewBox\",\n \"active\",\n \"position\",\n \"coordinate\",\n \"payload\",\n \"label\",\n \"content\",\n \"formatter\",\n \"labelFormatter\",\n \"itemSorter\",\n \"isAnimationActive\",\n \"animationDuration\",\n \"animationEasing\",\n]\n\nexport const areaProperties: (keyof Omit<Recharts.AreaProps, \"ref\">)[] = [\n \"type\",\n \"dataKey\",\n \"xAxisId\",\n \"yAxisId\",\n \"legendType\",\n \"dot\",\n \"activeDot\",\n \"label\",\n \"stroke\",\n \"strokeWidth\",\n \"layout\",\n \"baseLine\",\n \"points\",\n \"stackId\",\n \"connectNulls\",\n \"unit\",\n \"name\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"id\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const barProperties: (keyof Omit<Recharts.BarProps, \"ref\">)[] = [\n \"layout\",\n \"dataKey\",\n \"xAxisId\",\n \"yAxisId\",\n \"legendType\",\n \"label\",\n \"data\",\n \"barSize\",\n \"maxBarSize\",\n \"minPointSize\",\n \"background\",\n \"shape\",\n \"activeBar\",\n \"stackId\",\n \"unit\",\n \"name\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"id\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"radius\",\n]\n\nexport const radarProperties: (keyof Omit<Recharts.RadarProps, \"ref\">)[] = [\n \"dataKey\",\n \"points\",\n \"shape\",\n \"dot\",\n \"activeDot\",\n \"legendType\",\n \"label\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n]\n\nexport const lineProperties: (keyof Omit<Recharts.LineProps, \"ref\">)[] = [\n \"type\",\n \"dataKey\",\n \"xAxisId\",\n \"yAxisId\",\n \"legendType\",\n \"dot\",\n \"activeDot\",\n \"label\",\n \"hide\",\n \"points\",\n \"stroke\",\n \"strokeWidth\",\n \"layout\",\n \"connectNulls\",\n \"unit\",\n \"name\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"id\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"strokeDasharray\",\n]\n\nexport const pieProperties: (keyof Omit<Recharts.PieProps, \"ref\">)[] = [\n \"cx\",\n \"cy\",\n \"innerRadius\",\n \"outerRadius\",\n \"startAngle\",\n \"endAngle\",\n \"minAngle\",\n \"paddingAngle\",\n \"nameKey\",\n \"dataKey\",\n \"legendType\",\n \"label\",\n \"labelLine\",\n \"data\",\n \"activeIndex\",\n \"activeShape\",\n \"inactiveShape\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const radialBarProperties: (keyof Omit<\n Recharts.RadialBarProps,\n \"ref\"\n>)[] = [\n \"legendType\",\n \"label\",\n \"background\",\n \"data\",\n \"dataKey\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"cornerRadius\",\n]\n\nexport const dotProperties: (keyof Omit<Recharts.DotProps, \"ref\">)[] = [\n \"cx\",\n \"cy\",\n \"r\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const polarGridProperties: (keyof Recharts.PolarGridProps)[] = [\n \"cx\",\n \"cy\",\n \"innerRadius\",\n \"outerRadius\",\n \"polarAngles\",\n \"polarRadius\",\n \"gridType\",\n \"radialLines\",\n]\n\nexport const polarAngleAxisProperties: (keyof Recharts.PolarAngleAxisProps)[] =\n [\n \"dataKey\",\n \"cx\",\n \"cy\",\n \"radius\",\n \"axisLine\",\n \"axisLineType\",\n \"tickLine\",\n \"tickSize\",\n \"tick\",\n \"ticks\",\n \"orient\",\n \"tickFormatter\",\n \"type\",\n \"allowDuplicatedCategory\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n ]\n\nexport const polarRadiusAxisProperties: (keyof Recharts.PolarRadiusAxisProps)[] =\n [\n \"angle\",\n \"type\",\n \"allowDuplicatedCategory\",\n \"cx\",\n \"cy\",\n \"domain\",\n \"reversed\",\n \"label\",\n \"orientation\",\n \"axisLine\",\n \"tick\",\n \"tickSize\",\n \"tickFormatter\",\n \"tickCount\",\n \"scale\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n ]\n\nexport const labelProperties: (keyof Recharts.LabelProps)[] = [\n \"viewBox\",\n \"formatter\",\n \"value\",\n \"position\",\n \"offset\",\n \"children\",\n \"content\",\n \"id\",\n]\n\nexport const labelListProperties: (keyof Recharts.LabelListProps<Dict>)[] = [\n \"dataKey\",\n \"valueAccessor\",\n \"content\",\n \"position\",\n \"offset\",\n \"formatter\",\n \"data\",\n \"clockWise\",\n \"id\",\n \"position\",\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAAA,eAAyB;AAEzB,IAAAC,gBAAmB;AAEnB,mBAAqC;;;ACHrC,kBAAuB;AAEvB,mBAA0C;AAEnC,IAAM,eACX,IAAI,WACJ,CAAC,cACC;AAAA,EACE,GAAG,OAAO;AAAA,IAAI,CAAC,cACb,uBAAS,KAAK,IAAI,YAAQ,oBAAO,KAAK,EAAE,KAAK;AAAA,EAC/C;AACF;AAEG,IAAM,oBACX,CACE,CAAC,KAAK,IAAI,MACP,UAEL,CAA4B,OAAoB,cAAkB;AAChE,QAAM,CAAC,aAAa,YAAY,QAAI,0BAAkB,KAAK,IAAI;AAC/D,QAAM,YAAY,aAAa,GAAG,OAAO,YAAY,EAAE,KAAK;AAE5D,SACE,CAAC,YAAY,CAAC,aAAa,SAAS,IAAI,EAAE,GAAG,aAAa,UAAU;AAIxE;;;AC0bK,IAAM,sBAAyD;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;AFtcO,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,EAAE,MAAM,QAAI,uBAAS;AAE3B,QAAM,CAAC,gBAAgB,kBAAkB,QAAI;AAAA,IAC3C,MAAG;AAjCP;AAkCM;AAAA,QACE,EAAC,UAAK,mBAAL,YAAuB,CAAC,GAAG,mBAAmB;AAAA,QAC/C,OAAO;AAAA,MACT,EAAE,KAAK;AAAA;AAAA,IACT,CAAC,KAAK,gBAAgB,OAAO,WAAW,KAAK;AAAA,EAC/C;AAEA,QAAM,wBAGF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU;AAAA,MAC7C;AAAA,MACA,eAAW,kBAAG,WAAW,kBAAkB;AAAA,MAC3C;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,oBAAoB,gBAAgB,eAAe;AAAA,EACtD;AAEA,SAAO,EAAE,kBAAkB;AAC7B;","names":["import_core","import_utils"]}
|
1
|
+
{"version":3,"sources":["../src/use-polar-grid.tsx","../src/chart-utils.ts","../src/rechart-properties.ts"],"sourcesContent":["import type { CSSUIObject, PropGetter } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport type * as Recharts from \"recharts\"\nimport type { PolarGridProps } from \"./chart.types\"\nimport { useTheme } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo } from \"react\"\nimport { getComponentProps } from \"./chart-utils\"\nimport { polarGridProperties } from \"./rechart-properties\"\n\nexport interface UsePolarGridOptions {\n /**\n * Dash array for the grid lines and cursor. The first number is the length of the solid line section and the second number is the length of the interval.\n */\n strokeDasharray?: number | string\n /**\n * Props passed down to recharts `PolarGrid` component.\n */\n polarGridProps?: PolarGridProps\n}\n\ninterface UsePolarGridProps extends UsePolarGridOptions {\n styles: Dict<CSSUIObject | undefined>\n}\n\nexport const usePolarGrid = ({\n strokeDasharray,\n styles,\n ...rest\n}: UsePolarGridProps) => {\n const { theme } = useTheme()\n\n const [polarGridProps, polarGridClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.polarGridProps ?? {}, polarGridProperties],\n styles.polarGrid,\n )(theme),\n [rest.polarGridProps, styles.polarGrid, theme],\n )\n\n const getPolarGridProps: PropGetter<\n Recharts.PolarGridProps,\n Recharts.PolarGridProps\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, polarGridClassName),\n strokeDasharray,\n ...props,\n ...polarGridProps,\n }),\n [polarGridClassName, polarGridProps, strokeDasharray],\n )\n\n return { getPolarGridProps }\n}\n","import type { StyledTheme } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport { getCSS } from \"@yamada-ui/core\"\nimport { cx, isString, splitObject } from \"@yamada-ui/utils\"\n\nexport const getClassName =\n (...styles: (Dict | string | undefined)[]) =>\n (theme: StyledTheme) =>\n cx(\n ...styles.map((style) =>\n isString(style) ? style : getCSS(style)(theme),\n ),\n )\n\nexport const getComponentProps =\n <T extends Dict, K extends keyof T>(\n [obj, keys]: [T, K[]],\n ...props: (Dict | string | undefined)[]\n ) =>\n <P extends boolean = false>(theme: StyledTheme, isContain?: P) => {\n const [pickedProps, omittedProps] = splitObject<T, K>(obj, keys)\n const className = getClassName(...props, omittedProps)(theme)\n\n return (\n !isContain ? [pickedProps, className] : { ...pickedProps, className }\n ) as P extends false\n ? [{ [P in K]: T[P] }, string]\n : { [P in K]: T[P] } & { className: string }\n }\n","import type { Dict } from \"@yamada-ui/utils\"\nimport type { ComponentPropsWithoutRef } from \"react\"\nimport type * as Recharts from \"recharts\"\n\nexport const areaChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.AreaChart\n>)[] = [\n \"layout\",\n \"syncId\",\n \"syncMethod\",\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"stackOffset\",\n \"onClick\",\n \"onMouseEnter\",\n \"onMouseMove\",\n \"onMouseLeave\",\n]\n\nexport const barChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.BarChart\n>)[] = [\n \"layout\",\n \"syncId\",\n \"syncMethod\",\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"barCategoryGap\",\n \"barGap\",\n \"barSize\",\n \"maxBarSize\",\n \"stackOffset\",\n \"reverseStackOrder\",\n \"onClick\",\n \"onMouseEnter\",\n \"onMouseMove\",\n \"onMouseLeave\",\n]\n\nexport const lineChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.LineChart\n>)[] = [\n \"layout\",\n \"syncId\",\n \"syncMethod\",\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"onClick\",\n \"onMouseEnter\",\n \"onMouseMove\",\n \"onMouseLeave\",\n]\n\nexport const radarChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.RadarChart\n>)[] = [\n \"width\",\n \"height\",\n \"data\",\n \"cx\",\n \"cy\",\n \"startAngle\",\n \"endAngle\",\n \"innerRadius\",\n \"outerRadius\",\n \"margin\",\n \"onMouseEnter\",\n \"onClick\",\n]\n\nexport const pieChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.PieChart\n>)[] = [\"width\", \"height\", \"margin\", \"onClick\", \"onMouseEnter\", \"onMouseLeave\"]\n\nexport const radialChartProperties: (keyof ComponentPropsWithoutRef<\n typeof Recharts.RadialBarChart\n>)[] = [\n \"width\",\n \"height\",\n \"data\",\n \"margin\",\n \"barCategoryGap\",\n \"barGap\",\n \"cx\",\n \"cy\",\n \"startAngle\",\n \"endAngle\",\n \"innerRadius\",\n \"outerRadius\",\n \"barSize\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"onClick\",\n]\n\nexport const referenceLineProperties: (keyof Recharts.ReferenceLineProps)[] = [\n \"xAxisId\",\n \"yAxisId\",\n \"x\",\n \"y\",\n \"ifOverflow\",\n \"viewBox\",\n \"xAxis\",\n \"yAxis\",\n \"label\",\n \"isFront\",\n \"strokeWidth\",\n \"segment\",\n]\n\nexport const containerProperties: (keyof Omit<\n Recharts.ResponsiveContainerProps,\n \"children\"\n>)[] = [\n \"aspect\",\n \"width\",\n \"height\",\n \"minWidth\",\n \"minHeight\",\n \"debounce\",\n \"onResize\",\n]\n\nexport const gridProperties: (keyof Recharts.CartesianGridProps)[] = [\n \"x\",\n \"y\",\n \"width\",\n \"height\",\n \"horizontal\",\n \"vertical\",\n \"horizontalPoints\",\n \"horizontalCoordinatesGenerator\",\n \"verticalPoints\",\n \"verticalCoordinatesGenerator\",\n \"fill\",\n \"fillOpacity\",\n \"strokeDasharray\",\n]\n\nexport const xAxisProperties: (keyof Recharts.XAxisProps)[] = [\n \"hide\",\n \"dataKey\",\n \"xAxisId\",\n \"width\",\n \"height\",\n \"orientation\",\n \"type\",\n \"allowDecimals\",\n \"allowDataOverflow\",\n \"allowDuplicatedCategory\",\n \"angle\",\n \"tickCount\",\n \"domain\",\n \"includeHidden\",\n \"interval\",\n \"padding\",\n \"minTickGap\",\n \"axisLine\",\n \"tickLine\",\n \"tickSize\",\n \"tickFormatter\",\n \"ticks\",\n \"tick\",\n \"mirror\",\n \"reversed\",\n \"label\",\n \"scale\",\n \"unit\",\n \"name\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"tickMargin\",\n]\n\nexport const yAxisProperties: (keyof Recharts.YAxisProps)[] = [\n \"hide\",\n \"dataKey\",\n \"yAxisId\",\n \"width\",\n \"height\",\n \"orientation\",\n \"type\",\n \"tickCount\",\n \"domain\",\n \"includeHidden\",\n \"interval\",\n \"padding\",\n \"minTickGap\",\n \"allowDecimals\",\n \"allowDataOverflow\",\n \"allowDuplicatedCategory\",\n \"axisLine\",\n \"tickLine\",\n \"tickSize\",\n \"tickFormatter\",\n \"ticks\",\n \"tick\",\n \"mirror\",\n \"reversed\",\n \"label\",\n \"scale\",\n \"unit\",\n \"name\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"tickMargin\",\n]\n\nexport const legendProperties: (keyof Omit<Recharts.LegendProps, \"ref\">)[] = [\n \"width\",\n \"height\",\n \"layout\",\n \"align\",\n \"verticalAlign\",\n \"iconSize\",\n \"iconType\",\n \"payload\",\n \"chartWidth\",\n \"chartHeight\",\n \"margin\",\n \"content\",\n \"formatter\",\n \"wrapperStyle\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const tooltipProperties: (keyof Recharts.TooltipProps<any, any>)[] = [\n \"offset\",\n \"filterNull\",\n \"itemStyle\",\n \"wrapperStyle\",\n \"contentStyle\",\n \"labelStyle\",\n \"cursor\",\n \"viewBox\",\n \"allowEscapeViewBox\",\n \"active\",\n \"position\",\n \"coordinate\",\n \"payload\",\n \"label\",\n \"content\",\n \"formatter\",\n \"labelFormatter\",\n \"itemSorter\",\n \"isAnimationActive\",\n \"animationDuration\",\n \"animationEasing\",\n]\n\nexport const areaProperties: (keyof Omit<Recharts.AreaProps, \"ref\">)[] = [\n \"type\",\n \"dataKey\",\n \"xAxisId\",\n \"yAxisId\",\n \"legendType\",\n \"dot\",\n \"activeDot\",\n \"label\",\n \"stroke\",\n \"strokeWidth\",\n \"layout\",\n \"baseLine\",\n \"points\",\n \"stackId\",\n \"connectNulls\",\n \"unit\",\n \"name\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"id\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const barProperties: (keyof Omit<Recharts.BarProps, \"ref\">)[] = [\n \"layout\",\n \"dataKey\",\n \"xAxisId\",\n \"yAxisId\",\n \"legendType\",\n \"label\",\n \"data\",\n \"barSize\",\n \"maxBarSize\",\n \"minPointSize\",\n \"background\",\n \"shape\",\n \"activeBar\",\n \"stackId\",\n \"unit\",\n \"name\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"id\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"radius\",\n]\n\nexport const radarProperties: (keyof Omit<Recharts.RadarProps, \"ref\">)[] = [\n \"dataKey\",\n \"points\",\n \"shape\",\n \"dot\",\n \"activeDot\",\n \"legendType\",\n \"label\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n]\n\nexport const lineProperties: (keyof Omit<Recharts.LineProps, \"ref\">)[] = [\n \"type\",\n \"dataKey\",\n \"xAxisId\",\n \"yAxisId\",\n \"legendType\",\n \"dot\",\n \"activeDot\",\n \"label\",\n \"hide\",\n \"points\",\n \"stroke\",\n \"strokeWidth\",\n \"layout\",\n \"connectNulls\",\n \"unit\",\n \"name\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"id\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"strokeDasharray\",\n]\n\nexport const pieProperties: (keyof Omit<Recharts.PieProps, \"ref\">)[] = [\n \"cx\",\n \"cy\",\n \"innerRadius\",\n \"outerRadius\",\n \"startAngle\",\n \"endAngle\",\n \"minAngle\",\n \"paddingAngle\",\n \"nameKey\",\n \"dataKey\",\n \"legendType\",\n \"label\",\n \"labelLine\",\n \"data\",\n \"activeIndex\",\n \"activeShape\",\n \"inactiveShape\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const radialBarProperties: (keyof Omit<\n Recharts.RadialBarProps,\n \"ref\"\n>)[] = [\n \"legendType\",\n \"label\",\n \"background\",\n \"data\",\n \"dataKey\",\n \"isAnimationActive\",\n \"animationBegin\",\n \"animationDuration\",\n \"animationEasing\",\n \"onAnimationStart\",\n \"onAnimationEnd\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n \"cornerRadius\",\n]\n\nexport const dotProperties: (keyof Omit<Recharts.DotProps, \"ref\">)[] = [\n \"cx\",\n \"cy\",\n \"r\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n]\n\nexport const polarGridProperties: (keyof Recharts.PolarGridProps)[] = [\n \"cx\",\n \"cy\",\n \"innerRadius\",\n \"outerRadius\",\n \"polarAngles\",\n \"polarRadius\",\n \"gridType\",\n \"radialLines\",\n]\n\nexport const polarAngleAxisProperties: (keyof Recharts.PolarAngleAxisProps)[] =\n [\n \"dataKey\",\n \"cx\",\n \"cy\",\n \"radius\",\n \"axisLine\",\n \"axisLineType\",\n \"tickLine\",\n \"tickSize\",\n \"tick\",\n \"ticks\",\n \"orient\",\n \"tickFormatter\",\n \"type\",\n \"allowDuplicatedCategory\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n ]\n\nexport const polarRadiusAxisProperties: (keyof Recharts.PolarRadiusAxisProps)[] =\n [\n \"angle\",\n \"type\",\n \"allowDuplicatedCategory\",\n \"cx\",\n \"cy\",\n \"domain\",\n \"reversed\",\n \"label\",\n \"orientation\",\n \"axisLine\",\n \"tick\",\n \"tickSize\",\n \"tickFormatter\",\n \"tickCount\",\n \"scale\",\n \"onClick\",\n \"onMouseDown\",\n \"onMouseUp\",\n \"onMouseMove\",\n \"onMouseOver\",\n \"onMouseOut\",\n \"onMouseEnter\",\n \"onMouseLeave\",\n ]\n\nexport const labelProperties: (keyof Recharts.LabelProps)[] = [\n \"viewBox\",\n \"formatter\",\n \"value\",\n \"position\",\n \"offset\",\n \"children\",\n \"content\",\n \"id\",\n]\n\nexport const labelListProperties: (keyof Recharts.LabelListProps<Dict>)[] = [\n \"dataKey\",\n \"valueAccessor\",\n \"content\",\n \"position\",\n \"offset\",\n \"formatter\",\n \"data\",\n \"clockWise\",\n \"id\",\n \"position\",\n]\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAIA,IAAAA,eAAyB;AACzB,IAAAC,gBAAmB;AACnB,mBAAqC;;;ACJrC,kBAAuB;AACvB,mBAA0C;AAEnC,IAAM,eACX,IAAI,WACJ,CAAC,cACC;AAAA,EACE,GAAG,OAAO;AAAA,IAAI,CAAC,cACb,uBAAS,KAAK,IAAI,YAAQ,oBAAO,KAAK,EAAE,KAAK;AAAA,EAC/C;AACF;AAEG,IAAM,oBACX,CACE,CAAC,KAAK,IAAI,MACP,UAEL,CAA4B,OAAoB,cAAkB;AAChE,QAAM,CAAC,aAAa,YAAY,QAAI,0BAAkB,KAAK,IAAI;AAC/D,QAAM,YAAY,aAAa,GAAG,OAAO,YAAY,EAAE,KAAK;AAE5D,SACE,CAAC,YAAY,CAAC,aAAa,SAAS,IAAI,EAAE,GAAG,aAAa,UAAU;AAIxE;;;AC0bK,IAAM,sBAAyD;AAAA,EACpE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AACF;;;AFtcO,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,EAAE,MAAM,QAAI,uBAAS;AAE3B,QAAM,CAAC,gBAAgB,kBAAkB,QAAI;AAAA,IAC3C,MAAG;AAjCP;AAkCM;AAAA,QACE,EAAC,UAAK,mBAAL,YAAuB,CAAC,GAAG,mBAAmB;AAAA,QAC/C,OAAO;AAAA,MACT,EAAE,KAAK;AAAA;AAAA,IACT,CAAC,KAAK,gBAAgB,OAAO,WAAW,KAAK;AAAA,EAC/C;AAEA,QAAM,wBAGF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU;AAAA,MAC7C;AAAA,MACA,eAAW,kBAAG,WAAW,kBAAkB;AAAA,MAC3C;AAAA,MACA,GAAG;AAAA,MACH,GAAG;AAAA,IACL;AAAA,IACA,CAAC,oBAAoB,gBAAgB,eAAe;AAAA,EACtD;AAEA,SAAO,EAAE,kBAAkB;AAC7B;","names":["import_core","import_utils"]}
|
package/dist/use-polar-grid.mjs
CHANGED
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as react from 'react';
|
2
1
|
import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
|
2
|
+
import * as react from 'react';
|
3
3
|
import * as _yamada_ui_utils from '@yamada-ui/utils';
|
4
4
|
import { Dict } from '@yamada-ui/utils';
|
5
5
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
@@ -12,38 +12,40 @@ interface UseRadarChartOptions {
|
|
12
12
|
* Chart data.
|
13
13
|
*/
|
14
14
|
data: Dict[];
|
15
|
-
/**
|
16
|
-
* An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
|
17
|
-
*/
|
18
|
-
series: RadarProps[];
|
19
15
|
/**
|
20
16
|
* The key of a group of data which should be unique in an chart.
|
21
17
|
*/
|
22
18
|
dataKey: string;
|
23
19
|
/**
|
24
|
-
*
|
20
|
+
* An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
|
25
21
|
*/
|
26
|
-
|
22
|
+
series: RadarProps[];
|
27
23
|
/**
|
28
|
-
*
|
24
|
+
* Controls fill opacity of all radars.
|
25
|
+
*
|
26
|
+
* @default 1
|
29
27
|
*/
|
30
|
-
|
28
|
+
fillOpacity?: [number, number] | number;
|
31
29
|
/**
|
32
|
-
*
|
30
|
+
* A function to format Y axis tick.
|
33
31
|
*/
|
34
|
-
|
32
|
+
polarAngleAxisTickFormatter?: (value: number) => string;
|
35
33
|
/**
|
36
|
-
*
|
34
|
+
* A function to format X axis tick.
|
37
35
|
*/
|
38
|
-
|
36
|
+
polarRadiusAxisTickFormatter?: (value: number) => string;
|
39
37
|
/**
|
40
|
-
*
|
38
|
+
* Stroke width for the chart radars.
|
39
|
+
*
|
40
|
+
* @default 2
|
41
41
|
*/
|
42
|
-
|
42
|
+
strokeWidth?: number;
|
43
43
|
/**
|
44
|
-
*
|
44
|
+
* Determines whether activeDots should be displayed.
|
45
|
+
*
|
46
|
+
* @default true
|
45
47
|
*/
|
46
|
-
|
48
|
+
withActiveDots?: boolean;
|
47
49
|
/**
|
48
50
|
* Determines whether dots should be displayed.
|
49
51
|
*
|
@@ -51,49 +53,47 @@ interface UseRadarChartOptions {
|
|
51
53
|
*/
|
52
54
|
withDots?: boolean;
|
53
55
|
/**
|
54
|
-
*
|
55
|
-
*
|
56
|
-
* @default true
|
56
|
+
* Props passed down to recharts `RadarChart` component.
|
57
57
|
*/
|
58
|
-
|
58
|
+
chartProps?: RadarChartProps;
|
59
59
|
/**
|
60
|
-
*
|
61
|
-
*
|
62
|
-
* @default 2
|
60
|
+
* Props passed down to recharts `PolarAngleAxis` component.
|
63
61
|
*/
|
64
|
-
|
62
|
+
polarAngleAxisProps?: PolarAngleAxisProps;
|
65
63
|
/**
|
66
|
-
*
|
67
|
-
*
|
68
|
-
* @default 1
|
64
|
+
* Props passed down to recharts `tick` of `PolarAngleAxis` component.
|
69
65
|
*/
|
70
|
-
|
66
|
+
polarAngleAxisTickProps?: CSSUIProps;
|
71
67
|
/**
|
72
|
-
*
|
68
|
+
* Props passed down to recharts `PolarRadiusAxis` component.
|
73
69
|
*/
|
74
|
-
|
70
|
+
polarRadiusAxisProps?: PolarRadiusAxisProps;
|
75
71
|
/**
|
76
|
-
*
|
72
|
+
* Props passed down to recharts `tick` of `PolarRadiusAxis` component.
|
77
73
|
*/
|
78
|
-
|
74
|
+
polarRadiusAxisTickProps?: CSSUIProps;
|
75
|
+
/**
|
76
|
+
* Props for the radar.
|
77
|
+
*/
|
78
|
+
radarProps?: Partial<RadarProps>;
|
79
79
|
}
|
80
80
|
interface UseRadarChartProps extends UseRadarChartOptions {
|
81
|
-
styles: Dict<CSSUIObject>;
|
81
|
+
styles: Dict<CSSUIObject | undefined>;
|
82
82
|
}
|
83
|
-
declare const useRadarChart: ({ data,
|
83
|
+
declare const useRadarChart: ({ data, dataKey, fillOpacity, polarAngleAxisTickFormatter, polarRadiusAxisTickFormatter, series, strokeWidth, styles, withActiveDots, withDots, ...rest }: UseRadarChartProps) => {
|
84
84
|
radarVars: {
|
85
|
-
__prefix?: string;
|
86
85
|
name: string;
|
87
86
|
token?: _yamada_ui_core.ThemeToken;
|
88
87
|
value?: _yamada_ui_core.Token<number | _yamada_ui_utils.StringLiteral>;
|
88
|
+
__prefix?: string;
|
89
89
|
}[];
|
90
|
-
|
91
|
-
getRadarProps: RequiredPropGetter<Partial<Recharts.RadarProps> & {
|
92
|
-
index: number;
|
93
|
-
}, Omit<Recharts.RadarProps, "ref">>;
|
90
|
+
setHighlightedArea: react.Dispatch<react.SetStateAction<string | null>>;
|
94
91
|
getPolarAngleAxisProps: PropGetter<Recharts.PolarAngleAxisProps, Omit<Recharts.PolarAngleAxisProps, "ref">>;
|
95
92
|
getPolarRadiusAxisProps: PropGetter<Recharts.PolarRadiusAxisProps, Omit<Recharts.PolarRadiusAxisProps, "ref">>;
|
96
|
-
|
93
|
+
getRadarChartProps: PropGetter<recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
|
94
|
+
getRadarProps: RequiredPropGetter<{
|
95
|
+
index: number;
|
96
|
+
} & Partial<Recharts.RadarProps>, Omit<Recharts.RadarProps, "ref">>;
|
97
97
|
};
|
98
98
|
type UseRadarChartReturn = ReturnType<typeof useRadarChart>;
|
99
99
|
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import * as react from 'react';
|
2
1
|
import * as recharts_types_chart_generateCategoricalChart from 'recharts/types/chart/generateCategoricalChart';
|
2
|
+
import * as react from 'react';
|
3
3
|
import * as _yamada_ui_utils from '@yamada-ui/utils';
|
4
4
|
import { Dict } from '@yamada-ui/utils';
|
5
5
|
import * as _yamada_ui_core from '@yamada-ui/core';
|
@@ -12,38 +12,40 @@ interface UseRadarChartOptions {
|
|
12
12
|
* Chart data.
|
13
13
|
*/
|
14
14
|
data: Dict[];
|
15
|
-
/**
|
16
|
-
* An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
|
17
|
-
*/
|
18
|
-
series: RadarProps[];
|
19
15
|
/**
|
20
16
|
* The key of a group of data which should be unique in an chart.
|
21
17
|
*/
|
22
18
|
dataKey: string;
|
23
19
|
/**
|
24
|
-
*
|
20
|
+
* An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.
|
25
21
|
*/
|
26
|
-
|
22
|
+
series: RadarProps[];
|
27
23
|
/**
|
28
|
-
*
|
24
|
+
* Controls fill opacity of all radars.
|
25
|
+
*
|
26
|
+
* @default 1
|
29
27
|
*/
|
30
|
-
|
28
|
+
fillOpacity?: [number, number] | number;
|
31
29
|
/**
|
32
|
-
*
|
30
|
+
* A function to format Y axis tick.
|
33
31
|
*/
|
34
|
-
|
32
|
+
polarAngleAxisTickFormatter?: (value: number) => string;
|
35
33
|
/**
|
36
|
-
*
|
34
|
+
* A function to format X axis tick.
|
37
35
|
*/
|
38
|
-
|
36
|
+
polarRadiusAxisTickFormatter?: (value: number) => string;
|
39
37
|
/**
|
40
|
-
*
|
38
|
+
* Stroke width for the chart radars.
|
39
|
+
*
|
40
|
+
* @default 2
|
41
41
|
*/
|
42
|
-
|
42
|
+
strokeWidth?: number;
|
43
43
|
/**
|
44
|
-
*
|
44
|
+
* Determines whether activeDots should be displayed.
|
45
|
+
*
|
46
|
+
* @default true
|
45
47
|
*/
|
46
|
-
|
48
|
+
withActiveDots?: boolean;
|
47
49
|
/**
|
48
50
|
* Determines whether dots should be displayed.
|
49
51
|
*
|
@@ -51,49 +53,47 @@ interface UseRadarChartOptions {
|
|
51
53
|
*/
|
52
54
|
withDots?: boolean;
|
53
55
|
/**
|
54
|
-
*
|
55
|
-
*
|
56
|
-
* @default true
|
56
|
+
* Props passed down to recharts `RadarChart` component.
|
57
57
|
*/
|
58
|
-
|
58
|
+
chartProps?: RadarChartProps;
|
59
59
|
/**
|
60
|
-
*
|
61
|
-
*
|
62
|
-
* @default 2
|
60
|
+
* Props passed down to recharts `PolarAngleAxis` component.
|
63
61
|
*/
|
64
|
-
|
62
|
+
polarAngleAxisProps?: PolarAngleAxisProps;
|
65
63
|
/**
|
66
|
-
*
|
67
|
-
*
|
68
|
-
* @default 1
|
64
|
+
* Props passed down to recharts `tick` of `PolarAngleAxis` component.
|
69
65
|
*/
|
70
|
-
|
66
|
+
polarAngleAxisTickProps?: CSSUIProps;
|
71
67
|
/**
|
72
|
-
*
|
68
|
+
* Props passed down to recharts `PolarRadiusAxis` component.
|
73
69
|
*/
|
74
|
-
|
70
|
+
polarRadiusAxisProps?: PolarRadiusAxisProps;
|
75
71
|
/**
|
76
|
-
*
|
72
|
+
* Props passed down to recharts `tick` of `PolarRadiusAxis` component.
|
77
73
|
*/
|
78
|
-
|
74
|
+
polarRadiusAxisTickProps?: CSSUIProps;
|
75
|
+
/**
|
76
|
+
* Props for the radar.
|
77
|
+
*/
|
78
|
+
radarProps?: Partial<RadarProps>;
|
79
79
|
}
|
80
80
|
interface UseRadarChartProps extends UseRadarChartOptions {
|
81
|
-
styles: Dict<CSSUIObject>;
|
81
|
+
styles: Dict<CSSUIObject | undefined>;
|
82
82
|
}
|
83
|
-
declare const useRadarChart: ({ data,
|
83
|
+
declare const useRadarChart: ({ data, dataKey, fillOpacity, polarAngleAxisTickFormatter, polarRadiusAxisTickFormatter, series, strokeWidth, styles, withActiveDots, withDots, ...rest }: UseRadarChartProps) => {
|
84
84
|
radarVars: {
|
85
|
-
__prefix?: string;
|
86
85
|
name: string;
|
87
86
|
token?: _yamada_ui_core.ThemeToken;
|
88
87
|
value?: _yamada_ui_core.Token<number | _yamada_ui_utils.StringLiteral>;
|
88
|
+
__prefix?: string;
|
89
89
|
}[];
|
90
|
-
|
91
|
-
getRadarProps: RequiredPropGetter<Partial<Recharts.RadarProps> & {
|
92
|
-
index: number;
|
93
|
-
}, Omit<Recharts.RadarProps, "ref">>;
|
90
|
+
setHighlightedArea: react.Dispatch<react.SetStateAction<string | null>>;
|
94
91
|
getPolarAngleAxisProps: PropGetter<Recharts.PolarAngleAxisProps, Omit<Recharts.PolarAngleAxisProps, "ref">>;
|
95
92
|
getPolarRadiusAxisProps: PropGetter<Recharts.PolarRadiusAxisProps, Omit<Recharts.PolarRadiusAxisProps, "ref">>;
|
96
|
-
|
93
|
+
getRadarChartProps: PropGetter<recharts_types_chart_generateCategoricalChart.CategoricalChartProps, recharts_types_chart_generateCategoricalChart.CategoricalChartProps>;
|
94
|
+
getRadarProps: RequiredPropGetter<{
|
95
|
+
index: number;
|
96
|
+
} & Partial<Recharts.RadarProps>, Omit<Recharts.RadarProps, "ref">>;
|
97
97
|
};
|
98
98
|
type UseRadarChartReturn = ReturnType<typeof useRadarChart>;
|
99
99
|
|
package/dist/use-radar-chart.js
CHANGED
@@ -138,15 +138,15 @@ var polarRadiusAxisProperties = [
|
|
138
138
|
// src/use-radar-chart.ts
|
139
139
|
var useRadarChart = ({
|
140
140
|
data,
|
141
|
-
series,
|
142
141
|
dataKey,
|
143
|
-
withDots = false,
|
144
|
-
withActiveDots = false,
|
145
|
-
strokeWidth = 2,
|
146
142
|
fillOpacity = 0.4,
|
147
143
|
polarAngleAxisTickFormatter,
|
148
144
|
polarRadiusAxisTickFormatter,
|
145
|
+
series,
|
146
|
+
strokeWidth = 2,
|
149
147
|
styles,
|
148
|
+
withActiveDots = false,
|
149
|
+
withDots = false,
|
150
150
|
...rest
|
151
151
|
}) => {
|
152
152
|
var _a;
|
@@ -154,10 +154,10 @@ var useRadarChart = ({
|
|
154
154
|
const [highlightedArea, setHighlightedArea] = (0, import_react.useState)(null);
|
155
155
|
const shouldHighlight = highlightedArea !== null;
|
156
156
|
const {
|
157
|
-
dot = {},
|
158
157
|
activeDot = {},
|
159
158
|
dimDot,
|
160
159
|
dimRadar,
|
160
|
+
dot = {},
|
161
161
|
...computedRadarProps
|
162
162
|
} = (_a = rest.radarProps) != null ? _a : {};
|
163
163
|
const radarColors = (0, import_react.useMemo)(
|
@@ -262,11 +262,11 @@ var useRadarChart = ({
|
|
262
262
|
const radarPropList = (0, import_react.useMemo)(
|
263
263
|
() => series.map((props, index) => {
|
264
264
|
const {
|
265
|
-
dataKey: dataKey2,
|
266
|
-
dot: dot2 = {},
|
267
265
|
activeDot: activeDot2 = {},
|
266
|
+
dataKey: dataKey2,
|
268
267
|
dimDot: dimDot2 = {},
|
269
268
|
dimRadar: dimRadar2 = {},
|
269
|
+
dot: dot2 = {},
|
270
270
|
...computedProps
|
271
271
|
} = props;
|
272
272
|
const color = (0, import_core2.getVar)(`radar-${index}`)(theme);
|
@@ -295,8 +295,8 @@ var useRadarChart = ({
|
|
295
295
|
resolvedActiveDot = {
|
296
296
|
className: (0, import_utils2.cx)("ui-radar-chart__active-dot", className),
|
297
297
|
fill: color,
|
298
|
-
stroke: color,
|
299
298
|
r: 4,
|
299
|
+
stroke: color,
|
300
300
|
...rest3
|
301
301
|
};
|
302
302
|
} else {
|
@@ -326,10 +326,10 @@ var useRadarChart = ({
|
|
326
326
|
}
|
327
327
|
return {
|
328
328
|
...rest2,
|
329
|
+
activeDot: resolvedActiveDot,
|
329
330
|
color,
|
330
331
|
dataKey: dataKey2,
|
331
|
-
dot: resolvedDot
|
332
|
-
activeDot: resolvedActiveDot
|
332
|
+
dot: resolvedDot
|
333
333
|
};
|
334
334
|
}),
|
335
335
|
[
|
@@ -362,19 +362,27 @@ var useRadarChart = ({
|
|
362
362
|
[data, radarChartClassName, chartProps]
|
363
363
|
);
|
364
364
|
const getRadarProps = (0, import_react.useCallback)(
|
365
|
-
({
|
366
|
-
|
365
|
+
({ className: classNameProp, index, ...props }, ref = null) => {
|
366
|
+
var _a2;
|
367
|
+
const {
|
368
|
+
className,
|
369
|
+
activeDot: activeDot2,
|
370
|
+
color,
|
371
|
+
dataKey: dataKey2 = "",
|
372
|
+
dot: dot2,
|
373
|
+
...rest2
|
374
|
+
} = (_a2 = radarPropList[index]) != null ? _a2 : {};
|
367
375
|
return {
|
368
376
|
ref,
|
377
|
+
name: dataKey2,
|
369
378
|
className: (0, import_utils2.cx)(classNameProp, className),
|
370
379
|
activeDot: activeDot2,
|
371
|
-
dot: dot2,
|
372
|
-
name: dataKey2,
|
373
380
|
dataKey: dataKey2,
|
381
|
+
dot: dot2,
|
374
382
|
fill: color,
|
375
|
-
strokeWidth,
|
376
|
-
stroke: color,
|
377
383
|
isAnimationActive: false,
|
384
|
+
stroke: color,
|
385
|
+
strokeWidth,
|
378
386
|
...props,
|
379
387
|
...rest2
|
380
388
|
};
|
@@ -428,11 +436,11 @@ var useRadarChart = ({
|
|
428
436
|
);
|
429
437
|
return {
|
430
438
|
radarVars,
|
431
|
-
|
432
|
-
getRadarProps,
|
439
|
+
setHighlightedArea,
|
433
440
|
getPolarAngleAxisProps,
|
434
441
|
getPolarRadiusAxisProps,
|
435
|
-
|
442
|
+
getRadarChartProps,
|
443
|
+
getRadarProps
|
436
444
|
};
|
437
445
|
};
|
438
446
|
// Annotate the CommonJS export names for ESM import in node:
|