{"version":3,"sources":["../src/use-chart-label.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 { LabelProps } from \"./chart.types\"\nimport { useTheme } from \"@yamada-ui/core\"\nimport { cx } from \"@yamada-ui/utils\"\nimport { useCallback } from \"react\"\nimport { getComponentProps } from \"./chart-utils\"\nimport { labelProperties } from \"./rechart-properties\"\n\nexport interface UseChartLabelOptions {\n  /**\n   * Props passed down to recharts 'Label' component.\n   */\n  labelProps?: LabelProps\n}\n\nexport interface UseChartLabelProps extends UseChartLabelOptions {\n  styles: Dict<CSSUIObject | undefined>\n}\n\nexport const useChartLabel = ({ styles, ...rest }: UseChartLabelProps) => {\n  const { theme } = useTheme()\n\n  const [labelProps, labelClassName] = getComponentProps<Dict, string>(\n    [rest.labelProps ?? {}, labelProperties],\n    styles.label,\n  )(theme)\n\n  const getLabelProps: PropGetter<\n    Omit<Recharts.LabelProps, \"ref\">,\n    Omit<Recharts.LabelProps, \"ref\">\n  > = useCallback(\n    ({ className, ...props } = {}, ref = null) => {\n      return {\n        ref,\n        className: cx(className, labelClassName),\n        ...props,\n        ...labelProps,\n      }\n    },\n    [labelClassName, labelProps],\n  )\n\n  return { getLabelProps }\n}\n"],"mappings":";;;;;;;;;AAIA,SAAS,gBAAgB;AACzB,SAAS,UAAU;AACnB,SAAS,mBAAmB;AAerB,IAAM,gBAAgB,CAAC,EAAE,QAAQ,GAAG,KAAK,MAA0B;AArB1E;AAsBE,QAAM,EAAE,MAAM,IAAI,SAAS;AAE3B,QAAM,CAAC,YAAY,cAAc,IAAI;AAAA,IACnC,EAAC,UAAK,eAAL,YAAmB,CAAC,GAAG,eAAe;AAAA,IACvC,OAAO;AAAA,EACT,EAAE,KAAK;AAEP,QAAM,gBAGF;AAAA,IACF,CAAC,EAAE,WAAW,GAAG,MAAM,IAAI,CAAC,GAAG,MAAM,SAAS;AAC5C,aAAO;AAAA,QACL;AAAA,QACA,WAAW,GAAG,WAAW,cAAc;AAAA,QACvC,GAAG;AAAA,QACH,GAAG;AAAA,MACL;AAAA,IACF;AAAA,IACA,CAAC,gBAAgB,UAAU;AAAA,EAC7B;AAEA,SAAO,EAAE,cAAc;AACzB;","names":[]}