@yamada-ui/charts 1.5.4-next-20241005220055 → 1.5.4-next-20241008193728
Sign up to get free protection for your applications and to get access to all the features.
- package/dist/area-chart-gradient.d.mts +2 -2
- package/dist/area-chart-gradient.d.ts +2 -2
- package/dist/area-chart-gradient.js +7 -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 +2 -2
- package/dist/area-chart-split.d.ts +2 -2
- package/dist/area-chart-split.js +4 -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 +190 -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 +143 -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 +4 -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 +9 -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-UANITMH7.mjs → chunk-5VLSGWQD.mjs} +10 -8
- package/dist/chunk-5VLSGWQD.mjs.map +1 -0
- 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-EXBYAVSP.mjs → chunk-NMPNNSBN.mjs} +76 -74
- package/dist/chunk-NMPNNSBN.mjs.map +1 -0
- package/dist/{chunk-AL4MDJ4U.mjs → chunk-NQPC5LPY.mjs} +84 -82
- package/dist/chunk-NQPC5LPY.mjs.map +1 -0
- package/dist/{chunk-MN7T76SY.mjs → chunk-OG5CVPPV.mjs} +5 -3
- package/dist/chunk-OG5CVPPV.mjs.map +1 -0
- package/dist/{chunk-LLOU2WIV.mjs → chunk-OUIKA4AX.mjs} +5 -3
- package/dist/chunk-OUIKA4AX.mjs.map +1 -0
- 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-LSCPL7PM.mjs → chunk-SCY5V45W.mjs} +58 -56
- package/dist/chunk-SCY5V45W.mjs.map +1 -0
- package/dist/{chunk-VGNCWS23.mjs → chunk-SYBJTMPL.mjs} +92 -90
- package/dist/chunk-SYBJTMPL.mjs.map +1 -0
- package/dist/{chunk-ZGXEF3LO.mjs → chunk-TA7YJAW4.mjs} +49 -47
- package/dist/chunk-TA7YJAW4.mjs.map +1 -0
- 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-NHHJ5XFF.mjs → chunk-U325CYNR.mjs} +8 -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-ZXBE4ERW.mjs → chunk-YTUEG4IY.mjs} +47 -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-BQT5TIKZ.mjs → chunk-ZRV4LO67.mjs} +44 -42
- package/dist/chunk-ZRV4LO67.mjs.map +1 -0
- package/dist/donut-chart.js +97 -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 +2084 -2036
- 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 +146 -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 +95 -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 +87 -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 +69 -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-6O5G3WYP.mjs.map +0 -1
- package/dist/chunk-A3IWA366.mjs.map +0 -1
- package/dist/chunk-AL4MDJ4U.mjs.map +0 -1
- package/dist/chunk-BQT5TIKZ.mjs.map +0 -1
- package/dist/chunk-C3ZYUDXE.mjs.map +0 -1
- package/dist/chunk-EXBYAVSP.mjs.map +0 -1
- package/dist/chunk-FYAC4RRZ.mjs.map +0 -1
- package/dist/chunk-LLOU2WIV.mjs.map +0 -1
- package/dist/chunk-LSCPL7PM.mjs.map +0 -1
- package/dist/chunk-MN7T76SY.mjs.map +0 -1
- package/dist/chunk-MSG3WFBO.mjs.map +0 -1
- package/dist/chunk-MVRWZTQ5.mjs.map +0 -1
- package/dist/chunk-NHHJ5XFF.mjs.map +0 -1
- package/dist/chunk-O3LMKYXK.mjs.map +0 -1
- package/dist/chunk-OJ2MLZZ7.mjs.map +0 -1
- package/dist/chunk-OPPMMNGP.mjs.map +0 -1
- package/dist/chunk-UANITMH7.mjs.map +0 -1
- package/dist/chunk-VEFEKDMH.mjs.map +0 -1
- package/dist/chunk-VGNCWS23.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
- package/dist/chunk-ZGXEF3LO.mjs.map +0 -1
- package/dist/chunk-ZXBE4ERW.mjs.map +0 -1
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/chart-tooltip.tsx","../src/use-chart.ts"],"sourcesContent":["import {
|
1
|
+
{"version":3,"sources":["../src/chart-tooltip.tsx","../src/use-chart.ts"],"sourcesContent":["import type { Dict } from \"@yamada-ui/utils\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx, isArray } from \"@yamada-ui/utils\"\nimport { useTooltip } from \"./use-chart\"\n\nexport interface ChartTooltipProps {\n payload: Dict[] | undefined\n dataKey?: string\n isRadialChart?: boolean\n label?: string\n labelFormatter?: (label: string) => string\n unit?: string\n valueFormatter?: (value: any) => string\n}\n\nexport const ChartTooltip = forwardRef<ChartTooltipProps, \"div\">(\n (\n {\n className,\n dataKey = \"value\",\n isRadialChart,\n label,\n labelFormatter,\n payload = [],\n unit,\n valueFormatter,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useTooltip()\n\n const items = payload.map(\n (\n {\n name: nameProp,\n color: colorProp,\n [dataKey]: valueProp,\n payload,\n } = {},\n index,\n ) => {\n const name = isRadialChart ? payload?.name : nameProp\n const color = colorProp ?? payload?.color\n let value: string\n\n if (isArray(valueProp)) {\n value = valueProp\n .map((value) => {\n return `${valueFormatter?.(value) ?? value}`\n })\n .join(\" - \")\n } else {\n value = valueFormatter?.(valueProp) ?? valueProp\n }\n\n return (\n <ui.div\n key={`tooltip-payload-${index}`}\n className=\"ui-chart__tooltip-item\"\n __css={styles.tooltipItem}\n >\n <ui.div\n className=\"ui-chart__tooltip-swatch\"\n background={color}\n __css={styles.tooltipSwatch}\n />\n\n <ui.span\n className=\"ui-chart__tooltip-label\"\n __css={styles.tooltipLabel}\n >\n {name}\n </ui.span>\n\n <ui.span\n className=\"ui-chart__tooltip-value\"\n __css={styles.tooltipValue}\n >\n {value}\n {unit ? unit : \"\"}\n </ui.span>\n </ui.div>\n )\n },\n )\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-chart__tooltip\", className)}\n __css={styles.tooltip}\n {...rest}\n >\n {label ? (\n <ui.p className=\"ui-chart__tooltip-title\" __css={styles.tooltipTitle}>\n {labelFormatter?.(label) ?? label}\n </ui.p>\n ) : null}\n\n <ui.div className=\"ui-chart__tooltip-list\" __css={styles.tooltipList}>\n {items}\n </ui.div>\n </ui.div>\n )\n },\n)\n\nChartTooltip.displayName = \"ChartTooltip\"\nChartTooltip.__ui__ = \"ChartTooltip\"\n","import type { CSSUIObject, PropGetter } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport type * as Recharts from \"recharts\"\nimport type { ResponsiveContainerProps } from \"./chart.types\"\nimport { useTheme } from \"@yamada-ui/core\"\nimport { createContext, cx } from \"@yamada-ui/utils\"\nimport { useCallback } from \"react\"\nimport { getComponentProps } from \"./chart-utils\"\nimport { containerProperties } from \"./rechart-properties\"\n\ninterface ChartContext {\n styles: { [key: string]: CSSUIObject | undefined }\n}\n\nexport const [ChartProvider, useChartContext] = createContext<ChartContext>({\n name: \"ChartContext\",\n errorMessage: `useChartContext returned is 'undefined'. Seems you forgot to wrap the components in \"<LineChart />\" or \"<BarChart />\" etc.`,\n})\n\nexport interface UseChartProps {\n /**\n * Props passed down to recharts `ResponsiveContainer` component.\n */\n containerProps?: ResponsiveContainerProps\n}\n\nexport const useChart = ({ containerProps = {} }: UseChartProps) => {\n const { theme } = useTheme()\n const [reChartsProps, propClassName] = getComponentProps<Dict, string>([\n containerProps,\n containerProperties,\n ])(theme)\n\n const getContainerProps: PropGetter<\n Partial<Omit<Recharts.ResponsiveContainerProps, \"children\">>,\n Omit<Recharts.ResponsiveContainerProps, \"children\">\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(\"ui-chart__container\", className as string, propClassName),\n ...props,\n ...reChartsProps,\n }),\n [propClassName, reChartsProps],\n )\n\n return {\n getContainerProps,\n }\n}\n\nexport type UseChartReturn = ReturnType<typeof useChart>\n\nexport const useLegend = () => {\n const { styles } = useChartContext()\n\n return {\n styles,\n }\n}\n\nexport type UseLegendReturn = ReturnType<typeof useLegend>\n\nexport const useTooltip = () => {\n const { styles } = useChartContext()\n\n return {\n styles,\n }\n}\n\nexport type UseTooltipReturn = ReturnType<typeof useTooltip>\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AACA,IAAAA,eAA+B;AAC/B,IAAAC,gBAA4B;;;ACE5B,kBAAyB;AACzB,mBAAkC;AAClC,mBAA4B;AAQrB,IAAM,CAAC,eAAe,eAAe,QAAI,4BAA4B;AAAA,EAC1E,MAAM;AAAA,EACN,cAAc;AAChB,CAAC;AA8CM,IAAM,aAAa,MAAM;AAC9B,QAAM,EAAE,OAAO,IAAI,gBAAgB;AAEnC,SAAO;AAAA,IACL;AAAA,EACF;AACF;;;ADPY;AA/CL,IAAM,mBAAe;AAAA,EAC1B,CACE;AAAA,IACE;AAAA,IACA,UAAU;AAAA,IACV;AAAA,IACA;AAAA,IACA;AAAA,IACA,UAAU,CAAC;AAAA,IACX;AAAA,IACA;AAAA,IACA,GAAG;AAAA,EACL,GACA,QACG;AA7BP;AA8BI,UAAM,EAAE,OAAO,IAAI,WAAW;AAE9B,UAAM,QAAQ,QAAQ;AAAA,MACpB,CACE;AAAA,QACE,MAAM;AAAA,QACN,OAAO;AAAA,QACP,CAAC,UAAU;AAAA,QACX,SAAAC;AAAA,MACF,IAAI,CAAC,GACL,UACG;AAzCX,YAAAC;AA0CQ,cAAM,OAAO,gBAAgBD,YAAA,gBAAAA,SAAS,OAAO;AAC7C,cAAM,QAAQ,gCAAaA,YAAA,gBAAAA,SAAS;AACpC,YAAI;AAEJ,gBAAI,uBAAQ,SAAS,GAAG;AACtB,kBAAQ,UACL,IAAI,CAACE,WAAU;AAhD5B,gBAAAD;AAiDc,mBAAO,IAAGA,MAAA,iDAAiBC,YAAjB,OAAAD,MAA2BC,MAAK;AAAA,UAC5C,CAAC,EACA,KAAK,KAAK;AAAA,QACf,OAAO;AACL,mBAAQD,MAAA,iDAAiB,eAAjB,OAAAA,MAA+B;AAAA,QACzC;AAEA,eACE;AAAA,UAAC,gBAAG;AAAA,UAAH;AAAA,YAEC,WAAU;AAAA,YACV,OAAO,OAAO;AAAA,YAEd;AAAA;AAAA,gBAAC,gBAAG;AAAA,gBAAH;AAAA,kBACC,WAAU;AAAA,kBACV,YAAY;AAAA,kBACZ,OAAO,OAAO;AAAA;AAAA,cAChB;AAAA,cAEA;AAAA,gBAAC,gBAAG;AAAA,gBAAH;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO,OAAO;AAAA,kBAEb;AAAA;AAAA,cACH;AAAA,cAEA;AAAA,gBAAC,gBAAG;AAAA,gBAAH;AAAA,kBACC,WAAU;AAAA,kBACV,OAAO,OAAO;AAAA,kBAEb;AAAA;AAAA,oBACA,OAAO,OAAO;AAAA;AAAA;AAAA,cACjB;AAAA;AAAA;AAAA,UAvBK,mBAAmB,KAAK;AAAA,QAwB/B;AAAA,MAEJ;AAAA,IACF;AAEA,WACE;AAAA,MAAC,gBAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,eAAW,kBAAG,qBAAqB,SAAS;AAAA,QAC5C,OAAO,OAAO;AAAA,QACb,GAAG;AAAA,QAEH;AAAA,kBACC,4CAAC,gBAAG,GAAH,EAAK,WAAU,2BAA0B,OAAO,OAAO,cACrD,iEAAiB,WAAjB,YAA2B,OAC9B,IACE;AAAA,UAEJ,4CAAC,gBAAG,KAAH,EAAO,WAAU,0BAAyB,OAAO,OAAO,aACtD,iBACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;AAC3B,aAAa,SAAS;","names":["import_core","import_utils","payload","_a","value"]}
|
package/dist/chart-tooltip.mjs
CHANGED
@@ -1,10 +1,10 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
ChartTooltip
|
4
|
-
} from "./chunk-
|
5
|
-
import "./chunk-
|
4
|
+
} from "./chunk-5VLSGWQD.mjs";
|
5
|
+
import "./chunk-VK65X6Q2.mjs";
|
6
6
|
import "./chunk-6YUJLLGN.mjs";
|
7
|
-
import "./chunk-
|
7
|
+
import "./chunk-TXNC7GLT.mjs";
|
8
8
|
export {
|
9
9
|
ChartTooltip
|
10
10
|
};
|
package/dist/chart-utils.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/chart-utils.ts"],"sourcesContent":["import type { StyledTheme } from \"@yamada-ui/core\"\nimport {
|
1
|
+
{"version":3,"sources":["../src/chart-utils.ts"],"sourcesContent":["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"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAEA,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;","names":[]}
|
package/dist/chart-utils.mjs
CHANGED
package/dist/chart.types.d.mts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import { CSSUIProps, HTMLUIProps } from '@yamada-ui/core';
|
2
2
|
import { Merge, Dict } from '@yamada-ui/utils';
|
3
|
-
import { ComponentPropsWithoutRef, SVGProps,
|
3
|
+
import { ComponentPropsWithoutRef, SVGProps, ReactNode, ReactElement } from 'react';
|
4
4
|
import * as Recharts from 'recharts';
|
5
5
|
|
6
6
|
type ChartLayoutType = "horizontal" | "vertical";
|
7
|
-
type AreaChartType = "default" | "
|
7
|
+
type AreaChartType = "default" | "percent" | "split" | "stacked";
|
8
8
|
type BarChartType = Exclude<AreaChartType, "split">;
|
9
|
-
type ChartAxisType = "
|
10
|
-
type ChartCurveType = "bump" | "linear" | "
|
11
|
-
type TooltipDataSourceType = "
|
9
|
+
type ChartAxisType = "none" | "x" | "xy" | "y";
|
10
|
+
type ChartCurveType = "bump" | "linear" | "monotone" | "natural" | "step" | "stepAfter" | "stepBefore";
|
11
|
+
type TooltipDataSourceType = "all" | "segment";
|
12
12
|
interface AreaChartProps extends Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.AreaChart>> {
|
13
13
|
}
|
14
14
|
interface BarChartProps extends Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.BarChart>> {
|
@@ -27,18 +27,18 @@ interface ResponsiveContainerProps extends Merge<CSSUIProps, Omit<Recharts.Respo
|
|
27
27
|
}
|
28
28
|
interface AreaProps extends Merge<Merge<CSSUIProps, Recharts.AreaProps>, {
|
29
29
|
color: CSSUIProps["color"];
|
30
|
-
dot?: DotProps;
|
31
30
|
activeDot?: DotProps;
|
32
|
-
dimDot?: DotProps;
|
33
31
|
dimArea?: Partial<AreaProps>;
|
32
|
+
dimDot?: DotProps;
|
33
|
+
dot?: DotProps;
|
34
34
|
}> {
|
35
35
|
}
|
36
36
|
interface LineProps extends Merge<Merge<CSSUIProps, Recharts.LineProps>, {
|
37
37
|
color: CSSUIProps["color"];
|
38
38
|
activeDot?: DotProps;
|
39
|
-
dot?: DotProps;
|
40
39
|
dimDot?: DotProps;
|
41
40
|
dimLine?: Partial<LineProps>;
|
41
|
+
dot?: DotProps;
|
42
42
|
}> {
|
43
43
|
}
|
44
44
|
interface BarProps extends Merge<Merge<CSSUIProps, Recharts.BarProps>, {
|
@@ -50,10 +50,10 @@ interface BarProps extends Merge<Merge<CSSUIProps, Recharts.BarProps>, {
|
|
50
50
|
}
|
51
51
|
interface RadarProps extends Merge<Merge<CSSUIProps, Recharts.RadarProps>, {
|
52
52
|
color: CSSUIProps["color"];
|
53
|
-
dot?: DotProps;
|
54
53
|
activeDot?: DotProps;
|
55
54
|
dimDot?: DotProps;
|
56
55
|
dimRadar?: Partial<RadarProps>;
|
56
|
+
dot?: DotProps;
|
57
57
|
}> {
|
58
58
|
}
|
59
59
|
interface PieProps extends Merge<Merge<Recharts.PieProps, CSSUIProps>, {
|
@@ -75,7 +75,7 @@ interface RadialBarProps extends Merge<Merge<Recharts.RadialBarProps, CSSUIProps
|
|
75
75
|
}
|
76
76
|
interface DotProps extends Merge<Omit<Recharts.DotProps, "ref">, CSSUIProps> {
|
77
77
|
}
|
78
|
-
interface XAxisProps extends Merge<CSSUIProps, Omit<Recharts.XAxisProps, "color" | "
|
78
|
+
interface XAxisProps extends Merge<CSSUIProps, Omit<Recharts.XAxisProps, "color" | "fill" | "stroke">> {
|
79
79
|
}
|
80
80
|
interface YAxisProps extends Merge<CSSUIProps, Omit<Recharts.YAxisProps, "color">> {
|
81
81
|
}
|
@@ -97,10 +97,10 @@ interface LabelProps extends Merge<CSSUIProps, Omit<Recharts.LabelProps, "fill">
|
|
97
97
|
}
|
98
98
|
interface LabelListProps extends Merge<Recharts.LabelListProps<Dict>, Omit<CSSUIProps, "position">> {
|
99
99
|
}
|
100
|
-
type ChartTooltipProps = Recharts.TooltipProps<number | string |
|
101
|
-
type ChartTooltip =
|
102
|
-
interface ChartLabelProps extends Omit<React.SVGProps<SVGTextElement>, "
|
100
|
+
type ChartTooltipProps = Recharts.TooltipProps<(number | string)[] | number | string, number | string>;
|
101
|
+
type ChartTooltip = ((props: ChartTooltipProps) => ReactNode) | ReactElement;
|
102
|
+
interface ChartLabelProps extends Omit<React.SVGProps<SVGTextElement>, "fill" | "offset" | "viewBox">, LabelProps {
|
103
103
|
}
|
104
|
-
type ChartLabel =
|
104
|
+
type ChartLabel = ((props: ChartLabelProps) => ReactNode) | ReactElement;
|
105
105
|
|
106
106
|
export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLabel, ChartLabelProps, ChartLayoutType, ChartTooltip, ChartTooltipProps, DotProps, GridProps, LabelListProps, LabelProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, RadialBarProps, RadialChartProps, ReferenceLineProps, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
|
package/dist/chart.types.d.ts
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
import { CSSUIProps, HTMLUIProps } from '@yamada-ui/core';
|
2
2
|
import { Merge, Dict } from '@yamada-ui/utils';
|
3
|
-
import { ComponentPropsWithoutRef, SVGProps,
|
3
|
+
import { ComponentPropsWithoutRef, SVGProps, ReactNode, ReactElement } from 'react';
|
4
4
|
import * as Recharts from 'recharts';
|
5
5
|
|
6
6
|
type ChartLayoutType = "horizontal" | "vertical";
|
7
|
-
type AreaChartType = "default" | "
|
7
|
+
type AreaChartType = "default" | "percent" | "split" | "stacked";
|
8
8
|
type BarChartType = Exclude<AreaChartType, "split">;
|
9
|
-
type ChartAxisType = "
|
10
|
-
type ChartCurveType = "bump" | "linear" | "
|
11
|
-
type TooltipDataSourceType = "
|
9
|
+
type ChartAxisType = "none" | "x" | "xy" | "y";
|
10
|
+
type ChartCurveType = "bump" | "linear" | "monotone" | "natural" | "step" | "stepAfter" | "stepBefore";
|
11
|
+
type TooltipDataSourceType = "all" | "segment";
|
12
12
|
interface AreaChartProps extends Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.AreaChart>> {
|
13
13
|
}
|
14
14
|
interface BarChartProps extends Merge<CSSUIProps, ComponentPropsWithoutRef<typeof Recharts.BarChart>> {
|
@@ -27,18 +27,18 @@ interface ResponsiveContainerProps extends Merge<CSSUIProps, Omit<Recharts.Respo
|
|
27
27
|
}
|
28
28
|
interface AreaProps extends Merge<Merge<CSSUIProps, Recharts.AreaProps>, {
|
29
29
|
color: CSSUIProps["color"];
|
30
|
-
dot?: DotProps;
|
31
30
|
activeDot?: DotProps;
|
32
|
-
dimDot?: DotProps;
|
33
31
|
dimArea?: Partial<AreaProps>;
|
32
|
+
dimDot?: DotProps;
|
33
|
+
dot?: DotProps;
|
34
34
|
}> {
|
35
35
|
}
|
36
36
|
interface LineProps extends Merge<Merge<CSSUIProps, Recharts.LineProps>, {
|
37
37
|
color: CSSUIProps["color"];
|
38
38
|
activeDot?: DotProps;
|
39
|
-
dot?: DotProps;
|
40
39
|
dimDot?: DotProps;
|
41
40
|
dimLine?: Partial<LineProps>;
|
41
|
+
dot?: DotProps;
|
42
42
|
}> {
|
43
43
|
}
|
44
44
|
interface BarProps extends Merge<Merge<CSSUIProps, Recharts.BarProps>, {
|
@@ -50,10 +50,10 @@ interface BarProps extends Merge<Merge<CSSUIProps, Recharts.BarProps>, {
|
|
50
50
|
}
|
51
51
|
interface RadarProps extends Merge<Merge<CSSUIProps, Recharts.RadarProps>, {
|
52
52
|
color: CSSUIProps["color"];
|
53
|
-
dot?: DotProps;
|
54
53
|
activeDot?: DotProps;
|
55
54
|
dimDot?: DotProps;
|
56
55
|
dimRadar?: Partial<RadarProps>;
|
56
|
+
dot?: DotProps;
|
57
57
|
}> {
|
58
58
|
}
|
59
59
|
interface PieProps extends Merge<Merge<Recharts.PieProps, CSSUIProps>, {
|
@@ -75,7 +75,7 @@ interface RadialBarProps extends Merge<Merge<Recharts.RadialBarProps, CSSUIProps
|
|
75
75
|
}
|
76
76
|
interface DotProps extends Merge<Omit<Recharts.DotProps, "ref">, CSSUIProps> {
|
77
77
|
}
|
78
|
-
interface XAxisProps extends Merge<CSSUIProps, Omit<Recharts.XAxisProps, "color" | "
|
78
|
+
interface XAxisProps extends Merge<CSSUIProps, Omit<Recharts.XAxisProps, "color" | "fill" | "stroke">> {
|
79
79
|
}
|
80
80
|
interface YAxisProps extends Merge<CSSUIProps, Omit<Recharts.YAxisProps, "color">> {
|
81
81
|
}
|
@@ -97,10 +97,10 @@ interface LabelProps extends Merge<CSSUIProps, Omit<Recharts.LabelProps, "fill">
|
|
97
97
|
}
|
98
98
|
interface LabelListProps extends Merge<Recharts.LabelListProps<Dict>, Omit<CSSUIProps, "position">> {
|
99
99
|
}
|
100
|
-
type ChartTooltipProps = Recharts.TooltipProps<number | string |
|
101
|
-
type ChartTooltip =
|
102
|
-
interface ChartLabelProps extends Omit<React.SVGProps<SVGTextElement>, "
|
100
|
+
type ChartTooltipProps = Recharts.TooltipProps<(number | string)[] | number | string, number | string>;
|
101
|
+
type ChartTooltip = ((props: ChartTooltipProps) => ReactNode) | ReactElement;
|
102
|
+
interface ChartLabelProps extends Omit<React.SVGProps<SVGTextElement>, "fill" | "offset" | "viewBox">, LabelProps {
|
103
103
|
}
|
104
|
-
type ChartLabel =
|
104
|
+
type ChartLabel = ((props: ChartLabelProps) => ReactNode) | ReactElement;
|
105
105
|
|
106
106
|
export type { AreaChartProps, AreaChartType, AreaProps, BarChartProps, BarChartType, BarProps, CellProps, ChartAxisType, ChartCurveType, ChartLabel, ChartLabelProps, ChartLayoutType, ChartTooltip, ChartTooltipProps, DotProps, GridProps, LabelListProps, LabelProps, LegendProps, LineChartProps, LineProps, PieChartProps, PieProps, PolarAngleAxisProps, PolarGridProps, PolarRadiusAxisProps, RadarChartProps, RadarProps, RadialBarProps, RadialChartProps, ReferenceLineProps, ResponsiveContainerProps, TooltipDataSourceType, TooltipProps, XAxisProps, YAxisProps };
|
package/dist/chart.types.js.map
CHANGED
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"sources":["../src/chart.types.ts"],"sourcesContent":["import type { CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { Dict, Merge } from \"@yamada-ui/utils\"\nimport type {\n ComponentPropsWithoutRef,\n ReactElement,\n ReactNode,\n SVGProps,\n} from \"react\"\nimport type * as Recharts from \"recharts\"\n\nexport type ChartLayoutType = \"horizontal\" | \"vertical\"\nexport type AreaChartType = \"default\" | \"
|
1
|
+
{"version":3,"sources":["../src/chart.types.ts"],"sourcesContent":["import type { CSSUIProps, HTMLUIProps } from \"@yamada-ui/core\"\nimport type { Dict, Merge } from \"@yamada-ui/utils\"\nimport type {\n ComponentPropsWithoutRef,\n ReactElement,\n ReactNode,\n SVGProps,\n} from \"react\"\nimport type * as Recharts from \"recharts\"\n\nexport type ChartLayoutType = \"horizontal\" | \"vertical\"\nexport type AreaChartType = \"default\" | \"percent\" | \"split\" | \"stacked\"\nexport type BarChartType = Exclude<AreaChartType, \"split\">\nexport type ChartAxisType = \"none\" | \"x\" | \"xy\" | \"y\"\nexport type ChartCurveType =\n | \"bump\"\n | \"linear\"\n | \"monotone\"\n | \"natural\"\n | \"step\"\n | \"stepAfter\"\n | \"stepBefore\"\nexport type TooltipDataSourceType = \"all\" | \"segment\"\n\nexport interface AreaChartProps\n extends Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.AreaChart>\n > {}\nexport interface BarChartProps\n extends Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.BarChart>\n > {}\nexport interface LineChartProps\n extends Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.LineChart>\n > {}\nexport interface RadarChartProps\n extends Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.RadarChart>\n > {}\nexport interface PieChartProps\n extends Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.PieChart>\n > {}\nexport interface RadialChartProps\n extends Merge<\n CSSUIProps,\n ComponentPropsWithoutRef<typeof Recharts.RadialBarChart>\n > {}\nexport interface ReferenceLineProps\n extends Merge<CSSUIProps, Recharts.ReferenceLineProps> {}\nexport interface ResponsiveContainerProps\n extends Merge<\n CSSUIProps,\n Omit<Recharts.ResponsiveContainerProps, \"children\">\n > {}\nexport interface AreaProps\n extends Merge<\n Merge<CSSUIProps, Recharts.AreaProps>,\n {\n color: CSSUIProps[\"color\"]\n activeDot?: DotProps\n dimArea?: Partial<AreaProps>\n dimDot?: DotProps\n dot?: DotProps\n }\n > {}\nexport interface LineProps\n extends Merge<\n Merge<CSSUIProps, Recharts.LineProps>,\n {\n color: CSSUIProps[\"color\"]\n activeDot?: DotProps\n dimDot?: DotProps\n dimLine?: Partial<LineProps>\n dot?: DotProps\n }\n > {}\nexport interface BarProps\n extends Merge<\n Merge<CSSUIProps, Recharts.BarProps>,\n {\n color: CSSUIProps[\"color\"]\n activeBar?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n background?: Merge<SVGProps<SVGPathElement>, CSSUIProps>\n dimBar?: Partial<BarProps>\n }\n > {}\nexport interface RadarProps\n extends Merge<\n Merge<CSSUIProps, Recharts.RadarProps>,\n {\n color: CSSUIProps[\"color\"]\n activeDot?: DotProps\n dimDot?: DotProps\n dimRadar?: Partial<RadarProps>\n dot?: DotProps\n }\n > {}\nexport interface PieProps\n extends Merge<\n Merge<Recharts.PieProps, CSSUIProps>,\n {\n activeShape?: Partial<PieProps>\n inactiveShape?: Partial<PieProps>\n label?: HTMLUIProps<\"text\">\n labelLine?: HTMLUIProps<\"path\">\n }\n > {}\nexport interface CellProps extends CSSUIProps {\n name: string\n value: number\n dimCell?: Partial<CellProps>\n}\nexport interface RadialBarProps\n extends Merge<\n Merge<Recharts.RadialBarProps, CSSUIProps>,\n {\n background?: Partial<RadialBarProps>\n dimRadialBar?: CSSUIProps\n }\n > {}\nexport interface DotProps\n extends Merge<Omit<Recharts.DotProps, \"ref\">, CSSUIProps> {}\nexport interface XAxisProps\n extends Merge<\n CSSUIProps,\n Omit<Recharts.XAxisProps, \"color\" | \"fill\" | \"stroke\">\n > {}\nexport interface YAxisProps\n extends Merge<CSSUIProps, Omit<Recharts.YAxisProps, \"color\">> {}\nexport interface LegendProps\n extends Merge<CSSUIProps, Omit<Recharts.LegendProps, \"ref\">> {}\nexport interface TooltipProps\n extends Merge<\n Merge<CSSUIProps, Omit<Recharts.TooltipProps<any, any>, \"ref\">>,\n { cursor?: CSSUIProps }\n > {}\nexport interface GridProps\n extends Merge<CSSUIProps, Recharts.CartesianGridProps> {}\nexport interface PolarGridProps\n extends Merge<CSSUIProps, Recharts.PolarGridProps> {}\nexport interface PolarAngleAxisProps\n extends Merge<Recharts.PolarAngleAxisProps, CSSUIProps> {}\nexport interface PolarRadiusAxisProps\n extends Merge<CSSUIProps, Recharts.PolarRadiusAxisProps> {}\nexport interface LabelProps\n extends Merge<CSSUIProps, Omit<Recharts.LabelProps, \"fill\">> {}\nexport interface LabelListProps\n extends Merge<Recharts.LabelListProps<Dict>, Omit<CSSUIProps, \"position\">> {}\nexport type ChartTooltipProps = Recharts.TooltipProps<\n (number | string)[] | number | string,\n number | string\n>\nexport type ChartTooltip =\n | ((props: ChartTooltipProps) => ReactNode)\n | ReactElement\nexport interface ChartLabelProps\n extends Omit<React.SVGProps<SVGTextElement>, \"fill\" | \"offset\" | \"viewBox\">,\n LabelProps {}\nexport type ChartLabel = ((props: ChartLabelProps) => ReactNode) | ReactElement\n"],"mappings":";;;;;;;;;;;;;;;;;AAAA;AAAA;","names":[]}
|
@@ -1,7 +1,7 @@
|
|
1
1
|
"use client"
|
2
2
|
import {
|
3
3
|
useTooltip
|
4
|
-
} from "./chunk-
|
4
|
+
} from "./chunk-VK65X6Q2.mjs";
|
5
5
|
|
6
6
|
// src/chart-tooltip.tsx
|
7
7
|
import { forwardRef, ui } from "@yamada-ui/core";
|
@@ -9,22 +9,22 @@ import { cx, isArray } from "@yamada-ui/utils";
|
|
9
9
|
import { jsx, jsxs } from "react/jsx-runtime";
|
10
10
|
var ChartTooltip = forwardRef(
|
11
11
|
({
|
12
|
-
label,
|
13
|
-
dataKey = "value",
|
14
12
|
className,
|
15
|
-
|
16
|
-
|
13
|
+
dataKey = "value",
|
14
|
+
isRadialChart,
|
15
|
+
label,
|
17
16
|
labelFormatter,
|
17
|
+
payload = [],
|
18
18
|
unit,
|
19
|
-
|
19
|
+
valueFormatter,
|
20
20
|
...rest
|
21
21
|
}, ref) => {
|
22
22
|
var _a;
|
23
23
|
const { styles } = useTooltip();
|
24
24
|
const items = payload.map(
|
25
25
|
({
|
26
|
-
color: colorProp,
|
27
26
|
name: nameProp,
|
27
|
+
color: colorProp,
|
28
28
|
[dataKey]: valueProp,
|
29
29
|
payload: payload2
|
30
30
|
} = {}, index) => {
|
@@ -94,8 +94,10 @@ var ChartTooltip = forwardRef(
|
|
94
94
|
);
|
95
95
|
}
|
96
96
|
);
|
97
|
+
ChartTooltip.displayName = "ChartTooltip";
|
98
|
+
ChartTooltip.__ui__ = "ChartTooltip";
|
97
99
|
|
98
100
|
export {
|
99
101
|
ChartTooltip
|
100
102
|
};
|
101
|
-
//# sourceMappingURL=chunk-
|
103
|
+
//# sourceMappingURL=chunk-5VLSGWQD.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/chart-tooltip.tsx"],"sourcesContent":["import type { Dict } from \"@yamada-ui/utils\"\nimport { forwardRef, ui } from \"@yamada-ui/core\"\nimport { cx, isArray } from \"@yamada-ui/utils\"\nimport { useTooltip } from \"./use-chart\"\n\nexport interface ChartTooltipProps {\n payload: Dict[] | undefined\n dataKey?: string\n isRadialChart?: boolean\n label?: string\n labelFormatter?: (label: string) => string\n unit?: string\n valueFormatter?: (value: any) => string\n}\n\nexport const ChartTooltip = forwardRef<ChartTooltipProps, \"div\">(\n (\n {\n className,\n dataKey = \"value\",\n isRadialChart,\n label,\n labelFormatter,\n payload = [],\n unit,\n valueFormatter,\n ...rest\n },\n ref,\n ) => {\n const { styles } = useTooltip()\n\n const items = payload.map(\n (\n {\n name: nameProp,\n color: colorProp,\n [dataKey]: valueProp,\n payload,\n } = {},\n index,\n ) => {\n const name = isRadialChart ? payload?.name : nameProp\n const color = colorProp ?? payload?.color\n let value: string\n\n if (isArray(valueProp)) {\n value = valueProp\n .map((value) => {\n return `${valueFormatter?.(value) ?? value}`\n })\n .join(\" - \")\n } else {\n value = valueFormatter?.(valueProp) ?? valueProp\n }\n\n return (\n <ui.div\n key={`tooltip-payload-${index}`}\n className=\"ui-chart__tooltip-item\"\n __css={styles.tooltipItem}\n >\n <ui.div\n className=\"ui-chart__tooltip-swatch\"\n background={color}\n __css={styles.tooltipSwatch}\n />\n\n <ui.span\n className=\"ui-chart__tooltip-label\"\n __css={styles.tooltipLabel}\n >\n {name}\n </ui.span>\n\n <ui.span\n className=\"ui-chart__tooltip-value\"\n __css={styles.tooltipValue}\n >\n {value}\n {unit ? unit : \"\"}\n </ui.span>\n </ui.div>\n )\n },\n )\n\n return (\n <ui.div\n ref={ref}\n className={cx(\"ui-chart__tooltip\", className)}\n __css={styles.tooltip}\n {...rest}\n >\n {label ? (\n <ui.p className=\"ui-chart__tooltip-title\" __css={styles.tooltipTitle}>\n {labelFormatter?.(label) ?? label}\n </ui.p>\n ) : null}\n\n <ui.div className=\"ui-chart__tooltip-list\" __css={styles.tooltipList}>\n {items}\n </ui.div>\n </ui.div>\n )\n },\n)\n\nChartTooltip.displayName = \"ChartTooltip\"\nChartTooltip.__ui__ = \"ChartTooltip\"\n"],"mappings":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ACC,WAAU;AAAA,kBACV,OAAO,OAAO;AAAA,kBAEb;AAAA;AAAA,oBACA,OAAO,OAAO;AAAA;AAAA;AAAA,cACjB;AAAA;AAAA;AAAA,UAvBK,mBAAmB,KAAK;AAAA,QAwB/B;AAAA,MAEJ;AAAA,IACF;AAEA,WACE;AAAA,MAAC,GAAG;AAAA,MAAH;AAAA,QACC;AAAA,QACA,WAAW,GAAG,qBAAqB,SAAS;AAAA,QAC5C,OAAO,OAAO;AAAA,QACb,GAAG;AAAA,QAEH;AAAA,kBACC,oBAAC,GAAG,GAAH,EAAK,WAAU,2BAA0B,OAAO,OAAO,cACrD,iEAAiB,WAAjB,YAA2B,OAC9B,IACE;AAAA,UAEJ,oBAAC,GAAG,KAAH,EAAO,WAAU,0BAAyB,OAAO,OAAO,aACtD,iBACH;AAAA;AAAA;AAAA,IACF;AAAA,EAEJ;AACF;AAEA,aAAa,cAAc;AAC3B,aAAa,SAAS;","names":["payload","_a","value"]}
|
@@ -4,7 +4,7 @@ import {
|
|
4
4
|
} from "./chunk-6YUJLLGN.mjs";
|
5
5
|
import {
|
6
6
|
getComponentProps
|
7
|
-
} from "./chunk-
|
7
|
+
} from "./chunk-TXNC7GLT.mjs";
|
8
8
|
|
9
9
|
// src/use-polar-grid.tsx
|
10
10
|
import { useTheme } from "@yamada-ui/core";
|
@@ -42,4 +42,4 @@ var usePolarGrid = ({
|
|
42
42
|
export {
|
43
43
|
usePolarGrid
|
44
44
|
};
|
45
|
-
//# sourceMappingURL=chunk-
|
45
|
+
//# sourceMappingURL=chunk-6JRMEI6J.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-polar-grid.tsx"],"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"],"mappings":";;;;;;;;;AAIA,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB,SAAS,aAAa,eAAe;AAmB9B,IAAM,eAAe,CAAC;AAAA,EAC3B;AAAA,EACA;AAAA,EACA,GAAG;AACL,MAAyB;AACvB,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,CAAC,gBAAgB,kBAAkB,IAAI;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,oBAGF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,UAAU;AAAA,MAC7C;AAAA,MACA,WAAW,GAAG,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":[]}
|
@@ -6,27 +6,27 @@ import {
|
|
6
6
|
} from "./chunk-6YUJLLGN.mjs";
|
7
7
|
import {
|
8
8
|
getComponentProps
|
9
|
-
} from "./chunk-
|
9
|
+
} from "./chunk-TXNC7GLT.mjs";
|
10
10
|
|
11
11
|
// src/use-line-chart.ts
|
12
12
|
import { getVar, useTheme } from "@yamada-ui/core";
|
13
|
-
import { cx } from "@yamada-ui/utils";
|
13
|
+
import { cx, runIfFunc } from "@yamada-ui/utils";
|
14
14
|
import { useCallback, useMemo, useState } from "react";
|
15
15
|
var useLineChart = ({
|
16
|
+
connectNulls = true,
|
17
|
+
curveType = "monotone",
|
16
18
|
data,
|
17
|
-
|
19
|
+
fillOpacity = 1,
|
18
20
|
layoutType = "horizontal",
|
19
|
-
|
20
|
-
withActiveDots = true,
|
21
|
-
curveType = "monotone",
|
21
|
+
series,
|
22
22
|
strokeWidth = 2,
|
23
|
-
|
24
|
-
referenceLineProps,
|
25
|
-
fillOpacity = 1,
|
23
|
+
styles,
|
26
24
|
syncId,
|
25
|
+
withActiveDots = true,
|
26
|
+
withDots = true,
|
27
27
|
xAxisLabel,
|
28
28
|
yAxisLabel,
|
29
|
-
|
29
|
+
referenceLineProps,
|
30
30
|
...rest
|
31
31
|
}) => {
|
32
32
|
var _a;
|
@@ -34,10 +34,10 @@ var useLineChart = ({
|
|
34
34
|
const [highlightedArea, setHighlightedArea] = useState(null);
|
35
35
|
const shouldHighlight = highlightedArea !== null;
|
36
36
|
const {
|
37
|
-
dot = {},
|
38
37
|
activeDot = {},
|
39
38
|
dimDot,
|
40
39
|
dimLine,
|
40
|
+
dot = {},
|
41
41
|
...computedLineProps
|
42
42
|
} = (_a = rest.lineProps) != null ? _a : {};
|
43
43
|
const lineColors = useMemo(
|
@@ -118,11 +118,11 @@ var useLineChart = ({
|
|
118
118
|
const linePropList = useMemo(
|
119
119
|
() => series.map((props, index) => {
|
120
120
|
const {
|
121
|
-
dataKey,
|
122
|
-
dot: dot2 = {},
|
123
121
|
activeDot: activeDot2 = {},
|
122
|
+
dataKey,
|
124
123
|
dimDot: dimDot2 = {},
|
125
124
|
dimLine: dimLine2 = {},
|
125
|
+
dot: dot2 = {},
|
126
126
|
...computedProps
|
127
127
|
} = props;
|
128
128
|
const color = getVar(`line-${index}`)(theme);
|
@@ -148,8 +148,8 @@ var useLineChart = ({
|
|
148
148
|
resolvedActiveDot = {
|
149
149
|
className: cx("ui-line-chart__active-dot", className),
|
150
150
|
fill: color,
|
151
|
-
stroke: color,
|
152
151
|
r: 4,
|
152
|
+
stroke: color,
|
153
153
|
...rest3
|
154
154
|
};
|
155
155
|
} else {
|
@@ -178,9 +178,9 @@ var useLineChart = ({
|
|
178
178
|
}
|
179
179
|
return {
|
180
180
|
...rest2,
|
181
|
+
activeDot: resolvedActiveDot,
|
181
182
|
color,
|
182
183
|
dataKey,
|
183
|
-
activeDot: resolvedActiveDot,
|
184
184
|
dot: resolvedDot
|
185
185
|
};
|
186
186
|
}),
|
@@ -209,12 +209,12 @@ var useLineChart = ({
|
|
209
209
|
className: cx(className, lineChartClassName),
|
210
210
|
data,
|
211
211
|
layout: layoutType,
|
212
|
-
syncId,
|
213
212
|
margin: {
|
214
213
|
bottom: xAxisLabel ? 30 : void 0,
|
215
214
|
left: yAxisLabel ? 10 : void 0,
|
216
215
|
right: yAxisLabel ? 5 : void 0
|
217
216
|
},
|
217
|
+
syncId,
|
218
218
|
...props,
|
219
219
|
...chartProps
|
220
220
|
}),
|
@@ -229,20 +229,21 @@ var useLineChart = ({
|
|
229
229
|
]
|
230
230
|
);
|
231
231
|
const getLineProps = useCallback(
|
232
|
-
({
|
233
|
-
|
232
|
+
({ className: classNameProp, index, ...props }) => {
|
233
|
+
var _a2;
|
234
|
+
const { className, activeDot: activeDot2, color, dataKey, dot: dot2, ...rest2 } = (_a2 = linePropList[index]) != null ? _a2 : {};
|
234
235
|
return {
|
236
|
+
type: curveType,
|
237
|
+
name: runIfFunc(dataKey, {}),
|
235
238
|
className: cx(classNameProp, className),
|
236
239
|
activeDot: activeDot2,
|
237
|
-
|
238
|
-
name: dataKey,
|
239
|
-
type: curveType,
|
240
|
+
connectNulls,
|
240
241
|
dataKey,
|
242
|
+
dot: dot2,
|
241
243
|
fill: color,
|
242
|
-
strokeWidth,
|
243
|
-
stroke: color,
|
244
244
|
isAnimationActive: false,
|
245
|
-
|
245
|
+
stroke: color,
|
246
|
+
strokeWidth,
|
246
247
|
...props,
|
247
248
|
...rest2
|
248
249
|
};
|
@@ -250,14 +251,14 @@ var useLineChart = ({
|
|
250
251
|
[connectNulls, curveType, linePropList, strokeWidth]
|
251
252
|
);
|
252
253
|
return {
|
253
|
-
getLineProps,
|
254
|
-
getLineChartProps,
|
255
254
|
lineVars,
|
256
|
-
setHighlightedArea
|
255
|
+
setHighlightedArea,
|
256
|
+
getLineChartProps,
|
257
|
+
getLineProps
|
257
258
|
};
|
258
259
|
};
|
259
260
|
|
260
261
|
export {
|
261
262
|
useLineChart
|
262
263
|
};
|
263
|
-
//# sourceMappingURL=chunk-
|
264
|
+
//# sourceMappingURL=chunk-AYVTBRCS.mjs.map
|
@@ -0,0 +1 @@
|
|
1
|
+
{"version":3,"sources":["../src/use-line-chart.ts"],"sourcesContent":["import type {\n CSSUIObject,\n CSSUIProps,\n PropGetter,\n RequiredPropGetter,\n} from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport type { ComponentPropsWithoutRef } from \"react\"\nimport type * as Recharts from \"recharts\"\nimport type {\n ChartCurveType,\n ChartLayoutType,\n LineChartProps,\n LineProps,\n ReferenceLineProps,\n} from \"./chart.types\"\nimport { getVar, useTheme } from \"@yamada-ui/core\"\nimport { cx, runIfFunc } from \"@yamada-ui/utils\"\nimport { useCallback, useMemo, useState } from \"react\"\nimport { getComponentProps } from \"./chart-utils\"\nimport {\n dotProperties,\n lineChartProperties,\n lineProperties,\n} from \"./rechart-properties\"\n\nexport interface UseLineChartOptions {\n /**\n * Chart data.\n */\n data: Dict[]\n /**\n * An array of objects with `dataKey` and `color` keys. Determines which data should be consumed from the `data` array.\n */\n series: LineProps[]\n /**\n * Determines whether points with `null` values should be connected.\n *\n * @default true\n */\n connectNulls?: boolean\n /**\n * Type of the curve.\n *\n * @default `monotone`\n */\n curveType?: ChartCurveType\n /**\n * Controls fill opacity of all lines.\n *\n * @default 1\n */\n fillOpacity?: [number, number] | number\n /**\n * Chart orientation.\n *\n * @default 'horizontal'\n */\n layoutType?: ChartLayoutType\n /**\n * Stroke width for the chart lines.\n *\n * @default 2\n */\n strokeWidth?: number\n /**\n * If any two categorical charts have the same syncId,\n * these two charts can sync the position tooltip, and the startIndex, endIndex of Brush.\n */\n syncId?: number | string\n /**\n * Determines whether activeDots should be displayed.\n *\n * @default true\n */\n withActiveDots?: boolean\n /**\n * Determines whether dots should be displayed.\n *\n * @default true\n */\n withDots?: boolean\n /**\n * A label to display below the X axis.\n */\n xAxisLabel?: string\n /**\n * A label to display below the Y axis.\n */\n yAxisLabel?: string\n /**\n * Props passed down to recharts `LineChart` component.\n */\n chartProps?: LineChartProps\n /**\n * Props for the lines.\n */\n lineProps?: Partial<LineProps>\n /**\n * Reference lines that should be displayed on the chart.\n */\n referenceLineProps?: ReferenceLineProps[]\n}\n\ninterface UseLineChartProps extends UseLineChartOptions {\n styles: Dict<CSSUIObject | undefined>\n}\n\nexport const useLineChart = ({\n connectNulls = true,\n curveType = \"monotone\",\n data,\n fillOpacity = 1,\n layoutType = \"horizontal\",\n series,\n strokeWidth = 2,\n styles,\n syncId,\n withActiveDots = true,\n withDots = true,\n xAxisLabel,\n yAxisLabel,\n referenceLineProps,\n ...rest\n}: UseLineChartProps) => {\n const { theme } = useTheme()\n const [highlightedArea, setHighlightedArea] = useState<null | string>(null)\n const shouldHighlight = highlightedArea !== null\n const {\n activeDot = {},\n dimDot,\n dimLine,\n dot = {},\n ...computedLineProps\n } = rest.lineProps ?? {}\n\n const lineColors: CSSUIProps[\"vars\"] = useMemo(\n () =>\n series.map(({ color }, index) => ({\n name: `line-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n })),\n [series],\n )\n\n const referenceLineColors: CSSUIProps[\"vars\"] = useMemo(\n () =>\n referenceLineProps\n ? referenceLineProps.map(({ color }, index) => ({\n name: `reference-line-${index}`,\n token: \"colors\",\n value: color ?? \"transparent\",\n }))\n : [],\n [referenceLineProps],\n )\n\n const lineVars: CSSUIProps[\"vars\"] = useMemo(\n () => [\n ...lineColors,\n ...referenceLineColors,\n { name: \"fill-opacity\", value: fillOpacity },\n ],\n [fillOpacity, lineColors, referenceLineColors],\n )\n\n const [chartProps, lineChartClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [rest.chartProps ?? {}, lineChartProperties],\n styles.chart,\n )(theme),\n [rest.chartProps, styles.chart, theme],\n )\n\n const [lineProps, lineClassName] = useMemo(() => {\n const resolvedLineProps = {\n fillOpacity: \"$fill-opacity\",\n strokeOpacity: \"$fill-opacity\",\n ...computedLineProps,\n }\n\n return getComponentProps<Dict, string>(\n [resolvedLineProps, lineProperties],\n styles.line,\n )(theme)\n }, [computedLineProps, styles.line, theme])\n\n const [dimLineProps, dimLineClassName] = useMemo(() => {\n const resolvedDimLine = { fillOpacity: 0, strokeOpacity: 0.3, ...dimLine }\n\n return getComponentProps<Dict, string>([resolvedDimLine, lineProperties])(\n theme,\n )\n }, [dimLine, theme])\n\n const [dotProps, dotClassName] = useMemo(() => {\n const resolvedDot = { fillOpacity: 1, strokeOpacity: 1, ...dot }\n\n return getComponentProps<Dict, string>(\n [resolvedDot, dotProperties],\n styles.dot,\n )(theme)\n }, [dot, styles.dot, theme])\n\n const [activeDotProps, activeDotClassName] = useMemo(\n () =>\n getComponentProps<Dict, string>(\n [activeDot, dotProperties],\n styles.activeDot,\n )(theme),\n [activeDot, styles.activeDot, theme],\n )\n\n const [dimDotProps, dimDotClassName] = useMemo(() => {\n const resolvedDimDot = {\n fillOpacity: 0,\n strokeOpacity: 0,\n ...dimDot,\n }\n\n return getComponentProps<Dict, string>([resolvedDimDot, dotProperties])(\n theme,\n )\n }, [dimDot, theme])\n\n const linePropList = useMemo(\n () =>\n series.map((props, index) => {\n const {\n activeDot = {},\n dataKey,\n dimDot = {},\n dimLine = {},\n dot = {},\n ...computedProps\n } = props\n const color = getVar(`line-${index}`)(theme)\n const dimmed = shouldHighlight && highlightedArea !== dataKey\n const computedDimLine = { ...dimLineProps, ...dimLine }\n const resolvedProps = {\n ...lineProps,\n ...computedProps,\n ...(dimmed ? computedDimLine : {}),\n }\n\n const rest = getComponentProps<Dict, string>(\n [resolvedProps, lineProperties],\n lineClassName,\n dimmed ? dimLineClassName : undefined,\n )(theme, true)\n\n let resolvedActiveDot: boolean | Recharts.DotProps\n\n if (withActiveDots) {\n const computedActiveDot = { ...activeDotProps, ...activeDot }\n\n const [rest, className] = getComponentProps(\n [computedActiveDot, dotProperties],\n activeDotClassName,\n )(theme)\n\n resolvedActiveDot = {\n className: cx(\"ui-line-chart__active-dot\", className),\n fill: color,\n r: 4,\n stroke: color,\n ...rest,\n } as Recharts.DotProps\n } else {\n resolvedActiveDot = false\n }\n\n let resolvedDot: boolean | Recharts.DotProps\n\n if (withDots) {\n const computedDimDot = { ...dimDotProps, ...dimDot }\n const computedDot = {\n ...dotProps,\n ...dot,\n ...(dimmed ? computedDimDot : {}),\n }\n\n const [rest, className] = getComponentProps(\n [computedDot, dotProperties],\n dotClassName,\n dimmed ? dimDotClassName : undefined,\n )(theme)\n\n resolvedDot = {\n className: cx(\"ui-line-chart__dot\", className),\n fill: color,\n ...rest,\n } as Recharts.DotProps\n } else {\n resolvedDot = false\n }\n\n return {\n ...rest,\n activeDot: resolvedActiveDot,\n color,\n dataKey,\n dot: resolvedDot,\n }\n }),\n [\n series,\n shouldHighlight,\n highlightedArea,\n dimLineProps,\n lineProps,\n lineClassName,\n dimLineClassName,\n theme,\n withActiveDots,\n withDots,\n activeDotProps,\n activeDotClassName,\n dimDotProps,\n dotProps,\n dotClassName,\n dimDotClassName,\n ],\n )\n\n const getLineChartProps: PropGetter<\n ComponentPropsWithoutRef<typeof Recharts.LineChart>,\n ComponentPropsWithoutRef<typeof Recharts.LineChart>\n > = useCallback(\n ({ className, ...props } = {}, ref = null) => ({\n ref,\n className: cx(className, lineChartClassName),\n data,\n layout: layoutType,\n margin: {\n bottom: xAxisLabel ? 30 : undefined,\n left: yAxisLabel ? 10 : undefined,\n right: yAxisLabel ? 5 : undefined,\n },\n syncId,\n ...props,\n ...chartProps,\n }),\n [\n lineChartClassName,\n data,\n layoutType,\n syncId,\n xAxisLabel,\n yAxisLabel,\n chartProps,\n ],\n )\n\n const getLineProps: RequiredPropGetter<\n { index: number } & Partial<Recharts.LineProps>,\n Omit<Recharts.LineProps, \"ref\">\n > = useCallback(\n ({ className: classNameProp, index, ...props }) => {\n const { className, activeDot, color, dataKey, dot, ...rest } =\n linePropList[index] ?? {}\n\n return {\n type: curveType,\n name: runIfFunc(dataKey, {}),\n className: cx(classNameProp, className),\n activeDot,\n connectNulls,\n dataKey,\n dot,\n fill: color,\n isAnimationActive: false,\n stroke: color,\n strokeWidth,\n ...(props as Omit<Recharts.LineProps, \"dataKey\">),\n ...rest,\n }\n },\n [connectNulls, curveType, linePropList, strokeWidth],\n )\n\n return {\n lineVars,\n setHighlightedArea,\n getLineChartProps,\n getLineProps,\n }\n}\n\nexport type UseLineChartReturn = ReturnType<typeof useLineChart>\n"],"mappings":";;;;;;;;;;;AAgBA,SAAS,QAAQ,gBAAgB;AACjC,SAAS,IAAI,iBAAiB;AAC9B,SAAS,aAAa,SAAS,gBAAgB;AA0FxC,IAAM,eAAe,CA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