{"version":3,"sources":["../src/use-chart-legend.ts"],"sourcesContent":["import type { PropGetter } from \"@yamada-ui/core\"\nimport type { Dict } from \"@yamada-ui/utils\"\nimport type * as Recharts from \"recharts\"\nimport type { LegendProps } from \"./chart.types\"\nimport { splitObject } from \"@yamada-ui/utils\"\nimport { useCallback } from \"react\"\nimport { legendProperties } from \"./rechart-properties\"\n\nexport interface UseChartLegendProps {\n  /**\n   * Props passed down to recharts 'Legend' component.\n   */\n  legendProps?: LegendProps\n}\n\nexport const useChartLegend = ({\n  legendProps: _legendProps = {},\n}: UseChartLegendProps) => {\n  const [rest, legendProps] = splitObject<Dict, string>(\n    _legendProps,\n    legendProperties,\n  )\n\n  const getLegendProps: PropGetter<\n    Partial<Recharts.LegendProps>,\n    Omit<Recharts.LegendProps, \"ref\">\n  > = useCallback(\n    (props, ref = null) => {\n      return {\n        ref,\n        verticalAlign: \"top\",\n        ...props,\n        ...rest,\n      }\n    },\n    [rest],\n  )\n\n  return { getLegendProps, legendProps }\n}\n"],"mappings":";;;;;;AAIA,SAAS,mBAAmB;AAC5B,SAAS,mBAAmB;AAUrB,IAAM,iBAAiB,CAAC;AAAA,EAC7B,aAAa,eAAe,CAAC;AAC/B,MAA2B;AACzB,QAAM,CAAC,MAAM,WAAW,IAAI;AAAA,IAC1B;AAAA,IACA;AAAA,EACF;AAEA,QAAM,iBAGF;AAAA,IACF,CAAC,OAAO,MAAM,SAAS;AACrB,aAAO;AAAA,QACL;AAAA,QACA,eAAe;AAAA,QACf,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,IAAI;AAAA,EACP;AAEA,SAAO,EAAE,gBAAgB,YAAY;AACvC;","names":[]}