@mlw-packages/react-components 1.9.4 → 1.9.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.mts CHANGED
@@ -1674,6 +1674,61 @@ interface LegendItem {
1674
1674
  };
1675
1675
  }
1676
1676
 
1677
+ declare const formatFieldName: (fieldName: string) => string;
1678
+ declare const detectDataFields: (data: Record<string, unknown>[], xAxisKey: string) => string[];
1679
+ declare const detectXAxis: (data: Record<string, unknown>[]) => string;
1680
+ declare const generateAdditionalColors: (baseColors: string[], count: number) => string[];
1681
+ declare const niceCeil: (value: number) => number;
1682
+ declare const compactTick: (value: number) => string;
1683
+ declare const resolveContainerPaddingLeft: (padding?: Padding, containerPaddingLeft?: number, defaultLeft?: number) => number;
1684
+ declare const resolveChartMargins: (margins?: Margins, chartMargins?: Margins, showLabels?: boolean) => {
1685
+ top: number;
1686
+ right: number;
1687
+ left: number;
1688
+ bottom: number;
1689
+ };
1690
+ declare const generateColorMap: (dataKeys: string[], baseColors: string[], mapperConfig: Record<string, {
1691
+ color?: string;
1692
+ }>) => Record<string, string>;
1693
+ declare const computeNiceMax: (maxValue: number) => number;
1694
+ declare const getMaxDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1695
+ declare const getMinDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1696
+ declare const computeChartWidth: (width: number | string | undefined, dataLength: number, series: SeriesConfig | undefined, niceMaxLeft: number, niceMaxRight: number) => number;
1697
+ declare const adaptDataForTooltip: <T extends Record<string, unknown>>(data: T, xAxisKey: string) => {
1698
+ name: string;
1699
+ [key: string]: string | number;
1700
+ };
1701
+ declare const createValueFormatter: (customFormatter: ValueFormatterType | Record<string, string> | undefined, formatBR: boolean) => ValueFormatterType | undefined;
1702
+ declare const createYTickFormatter: (finalValueFormatter: ValueFormatterType | undefined) => ((value: number | string) => string);
1703
+ declare const computeYAxisTickWidth: (chartMarginLeft: number | undefined, yAxisLabel: string | undefined, axisLabelMargin: number, yTickFormatter: (value: number | string) => string, minValue: number, maxValue: number) => number;
1704
+
1705
+ type Variant = "filled" | "outline" | "soft";
1706
+ type LabelRendererProps = {
1707
+ x?: number | string;
1708
+ y?: number | string;
1709
+ value?: number | string;
1710
+ index?: number;
1711
+ payload?: unknown;
1712
+ width?: number | string;
1713
+ height?: number | string;
1714
+ viewBox?: {
1715
+ x?: number;
1716
+ y?: number;
1717
+ width?: number;
1718
+ height?: number;
1719
+ } | Record<string, unknown> | undefined;
1720
+ cx?: number | string;
1721
+ cy?: number | string;
1722
+ };
1723
+ type valueFormatter = (props: {
1724
+ value: number | string | undefined;
1725
+ formattedValue: string;
1726
+ [key: string]: unknown;
1727
+ }) => string;
1728
+ declare const renderPillLabel: (color: string, variant: Variant, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1729
+
1730
+ declare const renderInsideBarLabel: (color: string, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1731
+
1677
1732
  interface ChartData$3 {
1678
1733
  [key: string]: string | number | boolean | null | undefined;
1679
1734
  }
@@ -1695,8 +1750,8 @@ type SeriesProp = {
1695
1750
  line?: string[];
1696
1751
  area?: string[];
1697
1752
  };
1698
- interface ChartProps<T extends ChartData$3 = ChartData$3> {
1699
- data: T[];
1753
+ interface ChartProps {
1754
+ data: ChartData$3[];
1700
1755
  series?: SeriesProp;
1701
1756
  className?: string;
1702
1757
  chartMargin?: Partial<{
@@ -1716,7 +1771,7 @@ interface ChartProps<T extends ChartData$3 = ChartData$3> {
1716
1771
  titlePosition?: "left" | "center" | "right";
1717
1772
  showLabels?: boolean;
1718
1773
  labelMap?: Record<string, string>;
1719
- valueFormatter?: ValueFormatterConfig | ValueFormatterMap<T>;
1774
+ valueFormatter?: valueFormatter;
1720
1775
  categoryFormatter?: (value: string | number) => string;
1721
1776
  periodLabel?: string;
1722
1777
  xAxisLabel?: string;
@@ -1741,7 +1796,6 @@ interface ChartProps<T extends ChartData$3 = ChartData$3> {
1741
1796
  area: boolean;
1742
1797
  };
1743
1798
  horizontal?: boolean;
1744
- orderBy?: string;
1745
1799
  }
1746
1800
  interface SeriesConfig {
1747
1801
  bar?: string[];
@@ -1753,12 +1807,6 @@ type ValueFormatterType = (props: {
1753
1807
  formattedValue: string;
1754
1808
  [key: string]: unknown;
1755
1809
  }) => string;
1756
- type PredefinedFormat = "R$" | "$" | "€" | "£" | "%" | "kg" | "km" | "m" | "L" | "un" | "t" | "h" | "min" | "s";
1757
- type ExtractStringKeys<T> = {
1758
- [K in keyof T]: T[K] extends string | number ? K : never;
1759
- }[keyof T];
1760
- type ValueFormatterMap<T extends Record<string, unknown>> = Partial<Record<ExtractStringKeys<T>, PredefinedFormat | string>>;
1761
- type ValueFormatterConfig = ValueFormatterType | Record<string, PredefinedFormat | string>;
1762
1810
  type Padding = number | Partial<{
1763
1811
  left: number;
1764
1812
  right: number;
@@ -1860,61 +1908,6 @@ interface CloseAllButtonProps {
1860
1908
  }
1861
1909
  declare const CloseAllButton: React__default.FC<CloseAllButtonProps>;
1862
1910
 
1863
- declare const formatFieldName: (fieldName: string) => string;
1864
- declare const detectDataFields: (data: Record<string, unknown>[], xAxisKey: string) => string[];
1865
- declare const detectXAxis: (data: Record<string, unknown>[]) => string;
1866
- declare const generateAdditionalColors: (baseColors: string[], count: number) => string[];
1867
- declare const niceCeil: (value: number) => number;
1868
- declare const compactTick: (value: number) => string;
1869
- declare const resolveContainerPaddingLeft: (padding?: Padding, containerPaddingLeft?: number, defaultLeft?: number) => number;
1870
- declare const resolveChartMargins: (margins?: Margins, chartMargins?: Margins, showLabels?: boolean) => {
1871
- top: number;
1872
- right: number;
1873
- left: number;
1874
- bottom: number;
1875
- };
1876
- declare const generateColorMap: (dataKeys: string[], baseColors: string[], mapperConfig: Record<string, {
1877
- color?: string;
1878
- }>) => Record<string, string>;
1879
- declare const computeNiceMax: (maxValue: number) => number;
1880
- declare const getMaxDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1881
- declare const getMinDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1882
- declare const computeChartWidth: (width: number | string | undefined, dataLength: number, series: SeriesConfig | undefined, niceMaxLeft: number, niceMaxRight: number) => number;
1883
- declare const adaptDataForTooltip: <T extends Record<string, unknown>>(data: T, xAxisKey: string) => {
1884
- name: string;
1885
- [key: string]: string | number;
1886
- };
1887
- declare const createValueFormatter: (customFormatter: ValueFormatterType | Record<string, string> | undefined, formatBR: boolean) => ValueFormatterType | undefined;
1888
- declare const createYTickFormatter: (finalValueFormatter: ValueFormatterType | undefined) => ((value: number | string) => string);
1889
- declare const computeYAxisTickWidth: (chartMarginLeft: number | undefined, yAxisLabel: string | undefined, axisLabelMargin: number, yTickFormatter: (value: number | string) => string, minValue: number, maxValue: number) => number;
1890
-
1891
- type Variant = "filled" | "outline" | "soft";
1892
- type LabelRendererProps = {
1893
- x?: number | string;
1894
- y?: number | string;
1895
- value?: number | string;
1896
- index?: number;
1897
- payload?: unknown;
1898
- width?: number | string;
1899
- height?: number | string;
1900
- viewBox?: {
1901
- x?: number;
1902
- y?: number;
1903
- width?: number;
1904
- height?: number;
1905
- } | Record<string, unknown> | undefined;
1906
- cx?: number | string;
1907
- cy?: number | string;
1908
- };
1909
- type valueFormatter = (props: {
1910
- value: number | string | undefined;
1911
- formattedValue: string;
1912
- [key: string]: unknown;
1913
- }) => string;
1914
- declare const renderPillLabel: (color: string, variant: Variant, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1915
-
1916
- declare const renderInsideBarLabel: (color: string, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1917
-
1918
1911
  interface TooltipData {
1919
1912
  name: string;
1920
1913
  [key: string]: string | number;
package/dist/index.d.ts CHANGED
@@ -1674,6 +1674,61 @@ interface LegendItem {
1674
1674
  };
1675
1675
  }
1676
1676
 
1677
+ declare const formatFieldName: (fieldName: string) => string;
1678
+ declare const detectDataFields: (data: Record<string, unknown>[], xAxisKey: string) => string[];
1679
+ declare const detectXAxis: (data: Record<string, unknown>[]) => string;
1680
+ declare const generateAdditionalColors: (baseColors: string[], count: number) => string[];
1681
+ declare const niceCeil: (value: number) => number;
1682
+ declare const compactTick: (value: number) => string;
1683
+ declare const resolveContainerPaddingLeft: (padding?: Padding, containerPaddingLeft?: number, defaultLeft?: number) => number;
1684
+ declare const resolveChartMargins: (margins?: Margins, chartMargins?: Margins, showLabels?: boolean) => {
1685
+ top: number;
1686
+ right: number;
1687
+ left: number;
1688
+ bottom: number;
1689
+ };
1690
+ declare const generateColorMap: (dataKeys: string[], baseColors: string[], mapperConfig: Record<string, {
1691
+ color?: string;
1692
+ }>) => Record<string, string>;
1693
+ declare const computeNiceMax: (maxValue: number) => number;
1694
+ declare const getMaxDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1695
+ declare const getMinDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1696
+ declare const computeChartWidth: (width: number | string | undefined, dataLength: number, series: SeriesConfig | undefined, niceMaxLeft: number, niceMaxRight: number) => number;
1697
+ declare const adaptDataForTooltip: <T extends Record<string, unknown>>(data: T, xAxisKey: string) => {
1698
+ name: string;
1699
+ [key: string]: string | number;
1700
+ };
1701
+ declare const createValueFormatter: (customFormatter: ValueFormatterType | Record<string, string> | undefined, formatBR: boolean) => ValueFormatterType | undefined;
1702
+ declare const createYTickFormatter: (finalValueFormatter: ValueFormatterType | undefined) => ((value: number | string) => string);
1703
+ declare const computeYAxisTickWidth: (chartMarginLeft: number | undefined, yAxisLabel: string | undefined, axisLabelMargin: number, yTickFormatter: (value: number | string) => string, minValue: number, maxValue: number) => number;
1704
+
1705
+ type Variant = "filled" | "outline" | "soft";
1706
+ type LabelRendererProps = {
1707
+ x?: number | string;
1708
+ y?: number | string;
1709
+ value?: number | string;
1710
+ index?: number;
1711
+ payload?: unknown;
1712
+ width?: number | string;
1713
+ height?: number | string;
1714
+ viewBox?: {
1715
+ x?: number;
1716
+ y?: number;
1717
+ width?: number;
1718
+ height?: number;
1719
+ } | Record<string, unknown> | undefined;
1720
+ cx?: number | string;
1721
+ cy?: number | string;
1722
+ };
1723
+ type valueFormatter = (props: {
1724
+ value: number | string | undefined;
1725
+ formattedValue: string;
1726
+ [key: string]: unknown;
1727
+ }) => string;
1728
+ declare const renderPillLabel: (color: string, variant: Variant, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1729
+
1730
+ declare const renderInsideBarLabel: (color: string, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1731
+
1677
1732
  interface ChartData$3 {
1678
1733
  [key: string]: string | number | boolean | null | undefined;
1679
1734
  }
@@ -1695,8 +1750,8 @@ type SeriesProp = {
1695
1750
  line?: string[];
1696
1751
  area?: string[];
1697
1752
  };
1698
- interface ChartProps<T extends ChartData$3 = ChartData$3> {
1699
- data: T[];
1753
+ interface ChartProps {
1754
+ data: ChartData$3[];
1700
1755
  series?: SeriesProp;
1701
1756
  className?: string;
1702
1757
  chartMargin?: Partial<{
@@ -1716,7 +1771,7 @@ interface ChartProps<T extends ChartData$3 = ChartData$3> {
1716
1771
  titlePosition?: "left" | "center" | "right";
1717
1772
  showLabels?: boolean;
1718
1773
  labelMap?: Record<string, string>;
1719
- valueFormatter?: ValueFormatterConfig | ValueFormatterMap<T>;
1774
+ valueFormatter?: valueFormatter;
1720
1775
  categoryFormatter?: (value: string | number) => string;
1721
1776
  periodLabel?: string;
1722
1777
  xAxisLabel?: string;
@@ -1741,7 +1796,6 @@ interface ChartProps<T extends ChartData$3 = ChartData$3> {
1741
1796
  area: boolean;
1742
1797
  };
1743
1798
  horizontal?: boolean;
1744
- orderBy?: string;
1745
1799
  }
1746
1800
  interface SeriesConfig {
1747
1801
  bar?: string[];
@@ -1753,12 +1807,6 @@ type ValueFormatterType = (props: {
1753
1807
  formattedValue: string;
1754
1808
  [key: string]: unknown;
1755
1809
  }) => string;
1756
- type PredefinedFormat = "R$" | "$" | "€" | "£" | "%" | "kg" | "km" | "m" | "L" | "un" | "t" | "h" | "min" | "s";
1757
- type ExtractStringKeys<T> = {
1758
- [K in keyof T]: T[K] extends string | number ? K : never;
1759
- }[keyof T];
1760
- type ValueFormatterMap<T extends Record<string, unknown>> = Partial<Record<ExtractStringKeys<T>, PredefinedFormat | string>>;
1761
- type ValueFormatterConfig = ValueFormatterType | Record<string, PredefinedFormat | string>;
1762
1810
  type Padding = number | Partial<{
1763
1811
  left: number;
1764
1812
  right: number;
@@ -1860,61 +1908,6 @@ interface CloseAllButtonProps {
1860
1908
  }
1861
1909
  declare const CloseAllButton: React__default.FC<CloseAllButtonProps>;
1862
1910
 
1863
- declare const formatFieldName: (fieldName: string) => string;
1864
- declare const detectDataFields: (data: Record<string, unknown>[], xAxisKey: string) => string[];
1865
- declare const detectXAxis: (data: Record<string, unknown>[]) => string;
1866
- declare const generateAdditionalColors: (baseColors: string[], count: number) => string[];
1867
- declare const niceCeil: (value: number) => number;
1868
- declare const compactTick: (value: number) => string;
1869
- declare const resolveContainerPaddingLeft: (padding?: Padding, containerPaddingLeft?: number, defaultLeft?: number) => number;
1870
- declare const resolveChartMargins: (margins?: Margins, chartMargins?: Margins, showLabels?: boolean) => {
1871
- top: number;
1872
- right: number;
1873
- left: number;
1874
- bottom: number;
1875
- };
1876
- declare const generateColorMap: (dataKeys: string[], baseColors: string[], mapperConfig: Record<string, {
1877
- color?: string;
1878
- }>) => Record<string, string>;
1879
- declare const computeNiceMax: (maxValue: number) => number;
1880
- declare const getMaxDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1881
- declare const getMinDataValue: (data: Record<string, unknown>[], keys: string[]) => number;
1882
- declare const computeChartWidth: (width: number | string | undefined, dataLength: number, series: SeriesConfig | undefined, niceMaxLeft: number, niceMaxRight: number) => number;
1883
- declare const adaptDataForTooltip: <T extends Record<string, unknown>>(data: T, xAxisKey: string) => {
1884
- name: string;
1885
- [key: string]: string | number;
1886
- };
1887
- declare const createValueFormatter: (customFormatter: ValueFormatterType | Record<string, string> | undefined, formatBR: boolean) => ValueFormatterType | undefined;
1888
- declare const createYTickFormatter: (finalValueFormatter: ValueFormatterType | undefined) => ((value: number | string) => string);
1889
- declare const computeYAxisTickWidth: (chartMarginLeft: number | undefined, yAxisLabel: string | undefined, axisLabelMargin: number, yTickFormatter: (value: number | string) => string, minValue: number, maxValue: number) => number;
1890
-
1891
- type Variant = "filled" | "outline" | "soft";
1892
- type LabelRendererProps = {
1893
- x?: number | string;
1894
- y?: number | string;
1895
- value?: number | string;
1896
- index?: number;
1897
- payload?: unknown;
1898
- width?: number | string;
1899
- height?: number | string;
1900
- viewBox?: {
1901
- x?: number;
1902
- y?: number;
1903
- width?: number;
1904
- height?: number;
1905
- } | Record<string, unknown> | undefined;
1906
- cx?: number | string;
1907
- cy?: number | string;
1908
- };
1909
- type valueFormatter = (props: {
1910
- value: number | string | undefined;
1911
- formattedValue: string;
1912
- [key: string]: unknown;
1913
- }) => string;
1914
- declare const renderPillLabel: (color: string, variant: Variant, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1915
-
1916
- declare const renderInsideBarLabel: (color: string, valueFormatter?: valueFormatter) => (props: LabelRendererProps) => react_jsx_runtime.JSX.Element;
1917
-
1918
1911
  interface TooltipData {
1919
1912
  name: string;
1920
1913
  [key: string]: string | number;