@redsift/charts 11.6.0-muiv5-alpha.4 → 11.6.0-muiv5-alpha.6
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/_internal/Arc.d.ts +10 -0
- package/_internal/Arc.js +2 -0
- package/_internal/Arc.js.map +1 -0
- package/{components/Arc/Arc.js → _internal/Arc2.js} +52 -9
- package/_internal/Arc2.js.map +1 -0
- package/_internal/Arcs.d.ts +10 -0
- package/_internal/Arcs.js +2 -0
- package/_internal/Arcs.js.map +1 -0
- package/{components/Arcs/Arcs.js → _internal/Arcs2.js} +12 -8
- package/_internal/Arcs2.js.map +1 -0
- package/_internal/Axis.d.ts +8 -0
- package/_internal/Axis.js +2 -0
- package/_internal/Axis.js.map +1 -0
- package/{components/Axis/Axis.js → _internal/Axis2.js} +187 -10
- package/_internal/Axis2.js.map +1 -0
- package/_internal/Bar.d.ts +10 -0
- package/_internal/Bar.js +2 -0
- package/_internal/Bar.js.map +1 -0
- package/{components/Bar/Bar.js → _internal/Bar2.js} +85 -10
- package/_internal/Bar2.js.map +1 -0
- package/_internal/BarChart.d.ts +17 -0
- package/_internal/BarChart.js +2 -0
- package/_internal/BarChart.js.map +1 -0
- package/_internal/BarChart2.js +1419 -0
- package/_internal/BarChart2.js.map +1 -0
- package/_internal/ChartContainer.d.ts +5 -0
- package/_internal/ChartContainer.js +2 -0
- package/_internal/ChartContainer.js.map +1 -0
- package/{components/ChartContainer/ChartContainer.js → _internal/ChartContainer2.js} +105 -6
- package/_internal/ChartContainer2.js.map +1 -0
- package/_internal/DataPoint.d.ts +7 -0
- package/_internal/DataPoint.js +2 -0
- package/_internal/DataPoint.js.map +1 -0
- package/{components/DataPoint/DataPoint.js → _internal/DataPoint2.js} +11 -5
- package/_internal/DataPoint2.js.map +1 -0
- package/_internal/Dot.d.ts +10 -0
- package/_internal/Dot.js +2 -0
- package/_internal/Dot.js.map +1 -0
- package/{components/Dot/Dot.js → _internal/Dot2.js} +61 -6
- package/_internal/Dot2.js.map +1 -0
- package/_internal/Legend.d.ts +10 -0
- package/_internal/Legend.js +2 -0
- package/_internal/Legend.js.map +1 -0
- package/{components/Legend/Legend.js → _internal/Legend3.js} +17 -6
- package/_internal/Legend3.js.map +1 -0
- package/_internal/LegendItem.d.ts +21 -0
- package/_internal/LegendItem.js +2 -0
- package/_internal/LegendItem.js.map +1 -0
- package/{components/LegendItem/LegendItem.js → _internal/LegendItem2.js} +64 -7
- package/_internal/LegendItem2.js.map +1 -0
- package/_internal/Line.d.ts +10 -0
- package/_internal/Line.js +2 -0
- package/_internal/Line.js.map +1 -0
- package/{components/Line/Line.js → _internal/Line2.js} +12 -8
- package/_internal/Line2.js.map +1 -0
- package/_internal/LineChart.d.ts +17 -0
- package/_internal/LineChart.js +2 -0
- package/_internal/LineChart.js.map +1 -0
- package/{components/LineChart/RenderedLineChart.js → _internal/LineChart2.js} +317 -20
- package/_internal/LineChart2.js.map +1 -0
- package/_internal/PieChart.d.ts +14 -0
- package/_internal/PieChart.js +2 -0
- package/_internal/PieChart.js.map +1 -0
- package/_internal/PieChart2.js +605 -0
- package/_internal/PieChart2.js.map +1 -0
- package/_internal/ScatterPlot.d.ts +17 -0
- package/_internal/ScatterPlot.js +2 -0
- package/_internal/ScatterPlot.js.map +1 -0
- package/_internal/ScatterPlot2.js +743 -0
- package/_internal/ScatterPlot2.js.map +1 -0
- package/{_virtual → _internal}/_rollupPluginBabelHelpers.js +1 -1
- package/{types/axis.d.ts → _internal/axis.d2.ts} +2 -2
- package/_internal/config.js +13 -0
- package/_internal/config.js.map +1 -0
- package/{types → _internal}/data.d.ts +1 -1
- package/{types/legend.js → _internal/legend2.js} +2 -2
- package/_internal/legend2.js.map +1 -0
- package/{components/Axis/types.d.ts → _internal/scale.d.ts} +47 -2
- package/{scheme.js → _internal/scheme.js} +1 -1
- package/_internal/scheme.js.map +1 -0
- package/{components/Arc → _internal}/styles.d.ts +7 -5
- package/{components/Line/types.d.ts → _internal/styles.d10.ts} +14 -5
- package/{components/LineChart/types.d.ts → _internal/styles.d11.ts} +23 -12
- package/{components/PieChart/types.d.ts → _internal/styles.d12.ts} +29 -11
- package/{components/ScatterPlot/types.d.ts → _internal/styles.d13.ts} +23 -12
- package/{components/Arcs/types.d.ts → _internal/styles.d2.ts} +11 -2
- package/{components/Axis/styles.d.ts → _internal/styles.d3.ts} +6 -3
- package/{components/Bar/styles.d.ts → _internal/styles.d4.ts} +7 -5
- package/{components/BarChart/types.d.ts → _internal/styles.d5.ts} +49 -14
- package/{components/ChartContainer/styles.d.ts → _internal/styles.d6.ts} +8 -3
- package/{components/DataPoint/styles.d.ts → _internal/styles.d7.ts} +5 -2
- package/{components/Dot/styles.d.ts → _internal/styles.d8.ts} +7 -4
- package/{components/Legend/styles.d.ts → _internal/styles.d9.ts} +5 -2
- package/{utils/index.js → _internal/theme.js} +37 -2
- package/_internal/theme.js.map +1 -0
- package/{components/Arc → _internal}/types.d.ts +3 -3
- package/{components/Bar/types.d.ts → _internal/types.d2.ts} +3 -3
- package/{components/ChartContainer/types.d.ts → _internal/types.d3.ts} +1 -1
- package/{components/DataPoint/types.d.ts → _internal/types.d4.ts} +29 -3
- package/{components/Dot/types.d.ts → _internal/types.d5.ts} +3 -3
- package/{components/Legend/types.d.ts → _internal/types.d6.ts} +4 -4
- package/{components/LegendItem/types.d.ts → _internal/types.d7.ts} +8 -4
- package/{hooks → _internal}/useFormatCategoricalData.js +3 -4
- package/{hooks → _internal}/useFormatCategoricalData.js.map +1 -1
- package/index.d.ts +129 -51
- package/index.d2.ts +49 -0
- package/index.js +17 -42
- package/index.js.map +1 -1
- package/index2.js +16 -0
- package/index2.js.map +1 -0
- package/package.json +2 -2
- package/components/Arc/Arc.d.ts +0 -6
- package/components/Arc/Arc.js.map +0 -1
- package/components/Arc/styles.js +0 -49
- package/components/Arc/styles.js.map +0 -1
- package/components/Arcs/Arcs.d.ts +0 -6
- package/components/Arcs/Arcs.js.map +0 -1
- package/components/Arcs/styles.d.ts +0 -9
- package/components/Arcs/styles.js +0 -9
- package/components/Arcs/styles.js.map +0 -1
- package/components/Axis/Axis.d.ts +0 -7
- package/components/Axis/Axis.js.map +0 -1
- package/components/Axis/computeTicks.js +0 -117
- package/components/Axis/computeTicks.js.map +0 -1
- package/components/Axis/styles.js +0 -51
- package/components/Axis/styles.js.map +0 -1
- package/components/Axis/types.js +0 -24
- package/components/Axis/types.js.map +0 -1
- package/components/Bar/Bar.d.ts +0 -6
- package/components/Bar/Bar.js.map +0 -1
- package/components/Bar/styles.js +0 -66
- package/components/Bar/styles.js.map +0 -1
- package/components/Bar/types.js +0 -18
- package/components/Bar/types.js.map +0 -1
- package/components/BarChart/BarChart.d.ts +0 -29
- package/components/BarChart/BarChart.js +0 -141
- package/components/BarChart/BarChart.js.map +0 -1
- package/components/BarChart/BarChartBars.js +0 -168
- package/components/BarChart/BarChartBars.js.map +0 -1
- package/components/BarChart/BarChartSection.js +0 -139
- package/components/BarChart/BarChartSection.js.map +0 -1
- package/components/BarChart/EmptyBarChart.js +0 -57
- package/components/BarChart/EmptyBarChart.js.map +0 -1
- package/components/BarChart/LoadingBarChart.js +0 -18
- package/components/BarChart/LoadingBarChart.js.map +0 -1
- package/components/BarChart/RenderedLinearBarChart.js +0 -549
- package/components/BarChart/RenderedLinearBarChart.js.map +0 -1
- package/components/BarChart/RenderedOrdinalBarChart.js +0 -236
- package/components/BarChart/RenderedOrdinalBarChart.js.map +0 -1
- package/components/BarChart/context.js +0 -13
- package/components/BarChart/context.js.map +0 -1
- package/components/BarChart/intl/en-US.json.js +0 -17
- package/components/BarChart/intl/en-US.json.js.map +0 -1
- package/components/BarChart/intl/fr-FR.json.js +0 -17
- package/components/BarChart/intl/fr-FR.json.js.map +0 -1
- package/components/BarChart/intl/index.js +0 -10
- package/components/BarChart/intl/index.js.map +0 -1
- package/components/BarChart/styles.d.ts +0 -19
- package/components/BarChart/styles.js +0 -71
- package/components/BarChart/styles.js.map +0 -1
- package/components/BarChart/types.js +0 -17
- package/components/BarChart/types.js.map +0 -1
- package/components/BarChart/utils.js +0 -69
- package/components/BarChart/utils.js.map +0 -1
- package/components/ChartContainer/ChartContainer.d.ts +0 -9
- package/components/ChartContainer/ChartContainer.js.map +0 -1
- package/components/ChartContainer/context.js +0 -6
- package/components/ChartContainer/context.js.map +0 -1
- package/components/ChartContainer/intl/en-US.json.js +0 -14
- package/components/ChartContainer/intl/en-US.json.js.map +0 -1
- package/components/ChartContainer/intl/fr-FR.json.js +0 -14
- package/components/ChartContainer/intl/fr-FR.json.js.map +0 -1
- package/components/ChartContainer/intl/index.js +0 -10
- package/components/ChartContainer/intl/index.js.map +0 -1
- package/components/ChartContainer/styles.js +0 -76
- package/components/ChartContainer/styles.js.map +0 -1
- package/components/DataPoint/DataPoint.d.ts +0 -6
- package/components/DataPoint/DataPoint.js.map +0 -1
- package/components/DataPoint/styles.js +0 -10
- package/components/DataPoint/styles.js.map +0 -1
- package/components/Dot/Dot.d.ts +0 -6
- package/components/Dot/Dot.js.map +0 -1
- package/components/Dot/styles.js +0 -49
- package/components/Dot/styles.js.map +0 -1
- package/components/Dot/types.js +0 -14
- package/components/Dot/types.js.map +0 -1
- package/components/Legend/Legend.d.ts +0 -6
- package/components/Legend/Legend.js.map +0 -1
- package/components/Legend/styles.js +0 -15
- package/components/Legend/styles.js.map +0 -1
- package/components/LegendItem/LegendItem.js.map +0 -1
- package/components/LegendItem/styles.js +0 -63
- package/components/LegendItem/styles.js.map +0 -1
- package/components/Line/Line.d.ts +0 -6
- package/components/Line/Line.js.map +0 -1
- package/components/Line/styles.d.ts +0 -9
- package/components/Line/styles.js +0 -9
- package/components/Line/styles.js.map +0 -1
- package/components/LineChart/EmptyLineChart.js +0 -58
- package/components/LineChart/EmptyLineChart.js.map +0 -1
- package/components/LineChart/LineChart.d.ts +0 -6
- package/components/LineChart/LineChart.js +0 -96
- package/components/LineChart/LineChart.js.map +0 -1
- package/components/LineChart/LoadingLineChart.js +0 -18
- package/components/LineChart/LoadingLineChart.js.map +0 -1
- package/components/LineChart/RenderedLineChart.js.map +0 -1
- package/components/LineChart/intl/en-US.json.js +0 -17
- package/components/LineChart/intl/en-US.json.js.map +0 -1
- package/components/LineChart/intl/fr-FR.json.js +0 -17
- package/components/LineChart/intl/fr-FR.json.js.map +0 -1
- package/components/LineChart/intl/index.js +0 -10
- package/components/LineChart/intl/index.js.map +0 -1
- package/components/LineChart/styles.d.ts +0 -17
- package/components/LineChart/styles.js +0 -53
- package/components/LineChart/styles.js.map +0 -1
- package/components/LineChart/types.js +0 -17
- package/components/LineChart/types.js.map +0 -1
- package/components/LineChart/utils.js +0 -67
- package/components/LineChart/utils.js.map +0 -1
- package/components/PieChart/EmptyPieChart.js +0 -85
- package/components/PieChart/EmptyPieChart.js.map +0 -1
- package/components/PieChart/LoadingPieChart.js +0 -18
- package/components/PieChart/LoadingPieChart.js.map +0 -1
- package/components/PieChart/PieChart.d.ts +0 -6
- package/components/PieChart/PieChart.js +0 -98
- package/components/PieChart/PieChart.js.map +0 -1
- package/components/PieChart/RenderedPieChart.js +0 -198
- package/components/PieChart/RenderedPieChart.js.map +0 -1
- package/components/PieChart/intl/en-US.json.js +0 -9
- package/components/PieChart/intl/en-US.json.js.map +0 -1
- package/components/PieChart/intl/fr-FR.json.js +0 -9
- package/components/PieChart/intl/fr-FR.json.js.map +0 -1
- package/components/PieChart/intl/index.js +0 -10
- package/components/PieChart/intl/index.js.map +0 -1
- package/components/PieChart/styles.d.ts +0 -24
- package/components/PieChart/styles.js +0 -168
- package/components/PieChart/styles.js.map +0 -1
- package/components/PieChart/types.js +0 -27
- package/components/PieChart/types.js.map +0 -1
- package/components/PieChart/utils.js +0 -37
- package/components/PieChart/utils.js.map +0 -1
- package/components/ScatterPlot/EmptyScatterPlot.js +0 -58
- package/components/ScatterPlot/EmptyScatterPlot.js.map +0 -1
- package/components/ScatterPlot/LoadingScatterPlot.js +0 -18
- package/components/ScatterPlot/LoadingScatterPlot.js.map +0 -1
- package/components/ScatterPlot/RenderedScatterPlot.js +0 -352
- package/components/ScatterPlot/RenderedScatterPlot.js.map +0 -1
- package/components/ScatterPlot/ScatterPlot.d.ts +0 -6
- package/components/ScatterPlot/ScatterPlot.js +0 -105
- package/components/ScatterPlot/ScatterPlot.js.map +0 -1
- package/components/ScatterPlot/intl/en-US.json.js +0 -12
- package/components/ScatterPlot/intl/en-US.json.js.map +0 -1
- package/components/ScatterPlot/intl/fr-FR.json.js +0 -17
- package/components/ScatterPlot/intl/fr-FR.json.js.map +0 -1
- package/components/ScatterPlot/intl/index.js +0 -10
- package/components/ScatterPlot/intl/index.js.map +0 -1
- package/components/ScatterPlot/styles.d.ts +0 -17
- package/components/ScatterPlot/styles.js +0 -53
- package/components/ScatterPlot/styles.js.map +0 -1
- package/components/ScatterPlot/types.js +0 -24
- package/components/ScatterPlot/types.js.map +0 -1
- package/components/ScatterPlot/utils.js +0 -70
- package/components/ScatterPlot/utils.js.map +0 -1
- package/config.js +0 -15
- package/config.js.map +0 -1
- package/design-system/src/react-aria/react-aria/i18n/useMessageFormatter.d.ts +0 -5
- package/hooks/useBrush.d.ts +0 -17
- package/hooks/useBrush.js +0 -48
- package/hooks/useBrush.js.map +0 -1
- package/hooks/useColor.d.ts +0 -18
- package/hooks/useColor.js +0 -20
- package/hooks/useColor.js.map +0 -1
- package/hooks/useFormatCategoricalData.d.ts +0 -26
- package/hooks/useZoom.d.ts +0 -26
- package/hooks/useZoom.js +0 -39
- package/hooks/useZoom.js.map +0 -1
- package/scheme.d.ts +0 -32
- package/scheme.js.map +0 -1
- package/types/legend.d.ts +0 -30
- package/types/legend.js.map +0 -1
- package/types/scale.d.ts +0 -48
- package/types/size.d.ts +0 -20
- package/types/size.js +0 -8
- package/types/size.js.map +0 -1
- package/types/theme.d.ts +0 -23
- package/types/theme.js +0 -13
- package/types/theme.js.map +0 -1
- package/utils/index.d.ts +0 -11
- package/utils/index.js.map +0 -1
- /package/{_virtual → _internal}/_rollupPluginBabelHelpers.js.map +0 -0
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"theme.js","sources":["../../src/hooks/useColor.tsx","../../src/utils/index.ts","../../src/types/size.ts","../../src/types/theme.ts"],"sourcesContent":["import { useMemo } from 'react';\nimport { ScaleOrdinal as d3ScaleOrdinal } from 'd3';\nimport { getColorScale } from '../scheme';\nimport { ChartTheme, JSONArray, JSONObject } from '../types';\nimport { Theme } from '@redsift/design-system';\n\nexport interface UseColorProps {\n /** Dataset to use to generate the chart. */\n data: JSONArray;\n /** Color palette to use. */\n colorTheme: ChartTheme;\n /** Name of the field that will be used to categorize the data. */\n category: string | ((d: JSONObject) => string);\n /** Theme */\n theme: Theme;\n}\n\nexport const useColor = ({ data, colorTheme, category, theme }: UseColorProps) => {\n const colorScale = useMemo<d3ScaleOrdinal<string, string>>(\n () =>\n getColorScale({\n colorTheme,\n domain: data.map((d) => (typeof category === 'string' ? (d[category] as string) : category(d))),\n theme,\n }),\n [colorTheme]\n );\n\n return colorScale;\n};\n","import { CategoryDatum, Statistics } from '../types';\n\nexport type SortingMethod =\n | 'none'\n | 'asc-key'\n | 'desc-key'\n | 'asc-value'\n | 'desc-value'\n | string[]\n | ((a: CategoryDatum, b: CategoryDatum) => 1 | -1);\n\nexport const getSortingMethod: (sortingMethod: SortingMethod) => (a: CategoryDatum, b: CategoryDatum) => 1 | -1 = (\n sortingMethod\n) => {\n if (sortingMethod === 'asc-key') {\n return (a: CategoryDatum, b: CategoryDatum) =>\n a.key === b.key ? (a.value > b.value ? -1 : 1) : a.key < b.key ? -1 : 1;\n } else if (sortingMethod === 'desc-key') {\n return (a: CategoryDatum, b: CategoryDatum) =>\n a.key === b.key ? (a.value > b.value ? 1 : -1) : a.key < b.key ? 1 : -1;\n } else if (sortingMethod === 'asc-value') {\n return (a: CategoryDatum, b: CategoryDatum) =>\n a.value === b.value ? (a.key > b.key ? -1 : 1) : a.value < b.value ? -1 : 1;\n } else if (sortingMethod === 'desc-value') {\n return (a: CategoryDatum, b: CategoryDatum) =>\n a.value === b.value ? (a.key > b.key ? 1 : -1) : a.value < b.value ? 1 : -1;\n } else if (typeof sortingMethod === 'function') {\n return sortingMethod;\n } else if (Array.isArray(sortingMethod)) {\n return (a: CategoryDatum, b: CategoryDatum) => {\n if (sortingMethod.indexOf(a.key) === -1) {\n return 1;\n }\n if (sortingMethod.indexOf(b.key) === -1) {\n return -1;\n }\n\n return sortingMethod.indexOf(a.key) === sortingMethod.indexOf(b.key)\n ? a.key > b.key\n ? 1\n : -1\n : sortingMethod.indexOf(a.key) < sortingMethod.indexOf(b.key)\n ? -1\n : 1;\n };\n }\n return () => 1;\n};\n\nexport const isValidDate = (value: string) => {\n const date = new Date(value);\n return !isNaN(date.getTime()) && date.toISOString().startsWith(value);\n};\n\nexport const mergeLegends = (arr1: Statistics, arr2: Statistics) => {\n const map = new Map();\n\n [...arr1, ...arr2].forEach((item) => {\n map.set(item.key, item.value);\n });\n\n return Array.from(map, ([key, value]) => ({ key, value }));\n};\n","import { ValueOf } from '@redsift/design-system';\n\nexport type ChartDimensions = {\n width: number;\n height: number;\n};\n\nexport const ChartSize = {\n small: 'small',\n medium: 'medium',\n large: 'large',\n} as const;\nexport type ChartSize = ValueOf<typeof ChartSize>;\n\nexport type MarginProps = {\n top?: number;\n right?: number;\n bottom?: number;\n left?: number;\n};\n","import { ValueOf } from '@redsift/design-system';\n\nexport const ColorTheme = {\n default: 'default',\n dark: 'dark',\n darker: 'darker',\n darkerer: 'darkerer',\n light: 'light',\n lighter: 'lighter',\n lighterer: 'lighterer',\n monochrome: 'monochrome',\n} as const;\nexport type ColorTheme = ValueOf<typeof ColorTheme>;\n\nexport type SuccessDangerColorTheme = {\n success: string;\n warning: string;\n danger: string;\n neutral?: string;\n};\n\nexport type CustomColorTheme = Record<string, string>;\n\nexport type ChartTheme =\n | ColorTheme\n | SuccessDangerColorTheme\n | CustomColorTheme;\n"],"names":["useColor","_ref","data","colorTheme","category","theme","colorScale","useMemo","getColorScale","domain","map","d","getSortingMethod","sortingMethod","a","b","key","value","Array","isArray","indexOf","isValidDate","date","Date","isNaN","getTime","toISOString","startsWith","mergeLegends","arr1","arr2","Map","forEach","item","set","from","ChartSize","small","medium","large","ColorTheme","default","dark","darker","darkerer","light","lighter","lighterer","monochrome"],"mappings":";;;AAiBaA,MAAAA,QAAQ,GAAGC,IAAA,IAA0D;EAAA,IAAzD;IAAEC,IAAI;IAAEC,UAAU;IAAEC,QAAQ;AAAEC,IAAAA,KAAAA;AAAqB,GAAC,GAAAJ,IAAA,CAAA;AAC3E,EAAA,MAAMK,UAAU,GAAGC,OAAO,CACxB,MACEC,aAAa,CAAC;IACZL,UAAU;IACVM,MAAM,EAAEP,IAAI,CAACQ,GAAG,CAAEC,CAAC,IAAM,OAAOP,QAAQ,KAAK,QAAQ,GAAIO,CAAC,CAACP,QAAQ,CAAC,GAAcA,QAAQ,CAACO,CAAC,CAAE,CAAC;AAC/FN,IAAAA,KAAAA;AACF,GAAC,CAAC,EACJ,CAACF,UAAU,CACb,CAAC,CAAA;AAED,EAAA,OAAOG,UAAU,CAAA;AACnB;;AClBaM,MAAAA,gBAAkG,GAC7GC,aAAa,IACV;EACH,IAAIA,aAAa,KAAK,SAAS,EAAE;AAC/B,IAAA,OAAO,CAACC,CAAgB,EAAEC,CAAgB,KACxCD,CAAC,CAACE,GAAG,KAAKD,CAAC,CAACC,GAAG,GAAIF,CAAC,CAACG,KAAK,GAAGF,CAAC,CAACE,KAAK,GAAG,CAAC,CAAC,GAAG,CAAC,GAAIH,CAAC,CAACE,GAAG,GAAGD,CAAC,CAACC,GAAG,GAAG,CAAC,CAAC,GAAG,CAAC,CAAA;AAC3E,GAAC,MAAM,IAAIH,aAAa,KAAK,UAAU,EAAE;AACvC,IAAA,OAAO,CAACC,CAAgB,EAAEC,CAAgB,KACxCD,CAAC,CAACE,GAAG,KAAKD,CAAC,CAACC,GAAG,GAAIF,CAAC,CAACG,KAAK,GAAGF,CAAC,CAACE,KAAK,GAAG,CAAC,GAAG,CA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EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,KAAK,EAAE,OAAA;AACT;;ACTO,MAAMC,UAAU,GAAG;AACxBC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,OAAO,EAAE,SAAS;AAClBC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,UAAU,EAAE,YAAA;AACd;;;;"}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Arc } from 'd3';
|
|
2
|
+
import { D as DataPointProps, S as StyledDataPointProps } from './types.d4.ts';
|
|
2
3
|
import { Theme } from '@redsift/design-system';
|
|
3
|
-
import {
|
|
4
|
-
import { ArcDatum } from '../../types/data.js';
|
|
4
|
+
import { A as ArcDatum } from './data.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Component props.
|
|
@@ -17,4 +17,4 @@ type StyledArcProps = StyledDataPointProps & Omit<ArcProps, 'createArc'> & {
|
|
|
17
17
|
$theme: Theme;
|
|
18
18
|
};
|
|
19
19
|
|
|
20
|
-
export { ArcProps, StyledArcProps };
|
|
20
|
+
export { ArcProps as A, StyledArcProps as S };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ScaleLinear, ScaleTime, ScalePoint } from 'd3';
|
|
2
2
|
import { ValueOf, Theme } from '@redsift/design-system';
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
3
|
+
import { D as DataPointProps, S as StyledDataPointProps } from './types.d4.ts';
|
|
4
|
+
import { B as BarDatum } from './data.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Component variant.
|
|
@@ -43,4 +43,4 @@ type StyledBarProps = StyledDataPointProps & Omit<BarProps, 'scale' | 'scalePosi
|
|
|
43
43
|
$theme: Theme;
|
|
44
44
|
};
|
|
45
45
|
|
|
46
|
-
export {
|
|
46
|
+
export { BarOrientation as B, StyledBarProps as S, BarDirection as a, BarProps as b };
|
|
@@ -1,7 +1,33 @@
|
|
|
1
1
|
import { ComponentProps, ReactElement } from 'react';
|
|
2
|
-
import { Theme } from '@redsift/design-system';
|
|
2
|
+
import { ValueOf, Theme } from '@redsift/design-system';
|
|
3
3
|
import { TooltipProps } from '@redsift/popovers';
|
|
4
|
-
|
|
4
|
+
|
|
5
|
+
/** TOOLTIP */
|
|
6
|
+
declare const TooltipVariant: {
|
|
7
|
+
none: string;
|
|
8
|
+
label: string;
|
|
9
|
+
value: string;
|
|
10
|
+
percent: string;
|
|
11
|
+
custom: string;
|
|
12
|
+
};
|
|
13
|
+
type TooltipVariant = ValueOf<typeof TooltipVariant>;
|
|
14
|
+
/** LEGEND */
|
|
15
|
+
declare const LegendVariant: {
|
|
16
|
+
readonly none: "none";
|
|
17
|
+
readonly label: "label";
|
|
18
|
+
readonly value: "value";
|
|
19
|
+
readonly percent: "percent";
|
|
20
|
+
readonly custom: "custom";
|
|
21
|
+
};
|
|
22
|
+
type LegendVariant = ValueOf<typeof LegendVariant>;
|
|
23
|
+
declare const LabelVariant: {
|
|
24
|
+
readonly none: "none";
|
|
25
|
+
readonly label: "label";
|
|
26
|
+
readonly value: "value";
|
|
27
|
+
readonly percent: "percent";
|
|
28
|
+
readonly custom: "custom";
|
|
29
|
+
};
|
|
30
|
+
type LabelVariant = LegendVariant;
|
|
5
31
|
|
|
6
32
|
type AnchorProps = ComponentProps<'a'> & {
|
|
7
33
|
as?: any;
|
|
@@ -57,4 +83,4 @@ type StyledDataPointProps = Omit<DataPointProps<any>, 'data' | 'dataset'> & {
|
|
|
57
83
|
$clickable: boolean;
|
|
58
84
|
};
|
|
59
85
|
|
|
60
|
-
export { AnchorProps, DataPointProps, StyledDataPointProps };
|
|
86
|
+
export { AnchorProps as A, DataPointProps as D, LegendVariant as L, StyledDataPointProps as S, TooltipVariant as T, LabelVariant as a };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ScaleLinear, ScaleTime, ScalePoint } from 'd3';
|
|
2
|
+
import { D as DataPointProps, S as StyledDataPointProps } from './types.d4.ts';
|
|
2
3
|
import { ValueOf, Theme } from '@redsift/design-system';
|
|
3
|
-
import { DotDatum } from '
|
|
4
|
-
import { DataPointProps, StyledDataPointProps } from '../DataPoint/types.js';
|
|
4
|
+
import { m as DotDatum } from './data.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Component's variant.
|
|
@@ -27,4 +27,4 @@ type StyledDotProps = StyledDataPointProps & Omit<DotProps, 'scaleX' | 'scaleY'>
|
|
|
27
27
|
$theme: Theme;
|
|
28
28
|
};
|
|
29
29
|
|
|
30
|
-
export {
|
|
30
|
+
export { DotVariant as D, StyledDotProps as S, DotProps as a };
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { ComponentProps, ReactElement } from 'react';
|
|
2
|
+
import { L as LegendItemProps } from './types.d7.ts';
|
|
2
3
|
import { ContainerProps } from '@redsift/design-system';
|
|
3
|
-
import { Statistic, LegendItemDatum } from '
|
|
4
|
-
import {
|
|
5
|
-
import { LegendVariant } from '../../types/legend.js';
|
|
4
|
+
import { S as Statistic, p as LegendItemDatum } from './data.js';
|
|
5
|
+
import { L as LegendVariant } from './types.d4.ts';
|
|
6
6
|
|
|
7
7
|
/**
|
|
8
8
|
* Component props.
|
|
@@ -41,4 +41,4 @@ type StyledLegendProps = Omit<LegendProps, 'data'> & {
|
|
|
41
41
|
$width?: LegendProps['width'];
|
|
42
42
|
};
|
|
43
43
|
|
|
44
|
-
export { LegendProps, StyledLegendProps };
|
|
44
|
+
export { LegendProps as L, StyledLegendProps as S };
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ComponentProps, ReactElement } from 'react';
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import { D as DataPointProps, L as LegendVariant, S as StyledDataPointProps } from './types.d4.ts';
|
|
3
|
+
import { Theme } from '@redsift/design-system';
|
|
4
|
+
import { p as LegendItemDatum } from './data.js';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* Component props.
|
|
@@ -16,5 +16,9 @@ interface LegendItemProps extends Pick<DataPointProps<LegendItemDatum>, 'color'
|
|
|
16
16
|
/** Variant. */
|
|
17
17
|
variant?: LegendVariant;
|
|
18
18
|
}
|
|
19
|
+
type StyledLegendItemProps = Pick<StyledDataPointProps, '$clickable'> & Omit<LegendItemProps, 'data' | 'dataset'> & {
|
|
20
|
+
$variant: LegendItemProps['variant'];
|
|
21
|
+
$theme: Theme;
|
|
22
|
+
};
|
|
19
23
|
|
|
20
|
-
export { LegendItemProps };
|
|
24
|
+
export { LegendItemProps as L, StyledLegendItemProps as S };
|
|
@@ -1,7 +1,6 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
2
2
|
import { useMemo } from 'react';
|
|
3
|
-
import { useColor } from './
|
|
4
|
-
import { getSortingMethod } from '../utils/index.js';
|
|
3
|
+
import { g as getSortingMethod, u as useColor } from './theme.js';
|
|
5
4
|
|
|
6
5
|
const useFormatCategoricalData = _ref => {
|
|
7
6
|
let {
|
|
@@ -53,5 +52,5 @@ const useFormatCategoricalData = _ref => {
|
|
|
53
52
|
};
|
|
54
53
|
};
|
|
55
54
|
|
|
56
|
-
export { useFormatCategoricalData };
|
|
55
|
+
export { useFormatCategoricalData as u };
|
|
57
56
|
//# sourceMappingURL=useFormatCategoricalData.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useFormatCategoricalData.js","sources":["../../src/hooks/useFormatCategoricalData.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { CategoryData, ChartTheme } from '../types';\nimport { useColor } from './useColor';\nimport { SortingMethod, getSortingMethod } from '../utils';\nimport { Theme } from '@redsift/design-system';\n\nexport interface UseFormatCategoricalDataProps {\n /** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */\n data: CategoryData;\n /** Color palette to use. */\n colorTheme: ChartTheme;\n /** Define how to sort categories. */\n sortingMethod: SortingMethod;\n /** Number of categories to use, the rest being put into a new category called \"Others\". */\n caping?: number;\n /** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */\n others?: boolean | string;\n /** Theme */\n theme: Theme;\n}\n\nexport const useFormatCategoricalData = ({\n data,\n caping,\n sortingMethod,\n others,\n colorTheme,\n theme,\n}: UseFormatCategoricalDataProps) => {\n const computedData = useMemo(() => {\n let computedData;\n\n if (data === undefined || data === null) {\n return undefined;\n }\n\n computedData = [...data!].sort(getSortingMethod(sortingMethod));\n\n if (caping) {\n if (typeof others === 'boolean' && !others) {\n computedData = computedData.slice(0, caping);\n } else {\n computedData = computedData.reduce<CategoryData>((acc, curr, index) => {\n if (index < caping) {\n acc[index] = curr;\n } else if (index === caping) {\n acc[index] = {\n key: typeof others === 'string' ? others : 'Others',\n value: curr.value,\n };\n } else {\n acc[caping] = {\n ...acc[caping],\n value: acc[caping].value + curr.value,\n };\n }\n return acc;\n }, []);\n }\n }\n\n return computedData;\n }, [data, caping]);\n\n const colorScale = useColor({ data: computedData!, colorTheme, category: 'key', theme });\n\n return { data: computedData as CategoryData, colorScale };\n};\n"],"names":["useFormatCategoricalData","_ref","data","caping","sortingMethod","others","colorTheme","theme","computedData","useMemo","undefined","sort","getSortingMethod","slice","reduce","acc","curr","index","key","value","_objectSpread","colorScale","useColor","category"],"mappings":"
|
|
1
|
+
{"version":3,"file":"useFormatCategoricalData.js","sources":["../../src/hooks/useFormatCategoricalData.tsx"],"sourcesContent":["import { useMemo } from 'react';\nimport { CategoryData, ChartTheme } from '../types';\nimport { useColor } from './useColor';\nimport { SortingMethod, getSortingMethod } from '../utils';\nimport { Theme } from '@redsift/design-system';\n\nexport interface UseFormatCategoricalDataProps {\n /** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */\n data: CategoryData;\n /** Color palette to use. */\n colorTheme: ChartTheme;\n /** Define how to sort categories. */\n sortingMethod: SortingMethod;\n /** Number of categories to use, the rest being put into a new category called \"Others\". */\n caping?: number;\n /** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */\n others?: boolean | string;\n /** Theme */\n theme: Theme;\n}\n\nexport const useFormatCategoricalData = ({\n data,\n caping,\n sortingMethod,\n others,\n colorTheme,\n theme,\n}: UseFormatCategoricalDataProps) => {\n const computedData = useMemo(() => {\n let computedData;\n\n if (data === undefined || data === null) {\n return undefined;\n }\n\n computedData = [...data!].sort(getSortingMethod(sortingMethod));\n\n if (caping) {\n if (typeof others === 'boolean' && !others) {\n computedData = computedData.slice(0, caping);\n } else {\n computedData = computedData.reduce<CategoryData>((acc, curr, index) => {\n if (index < caping) {\n acc[index] = curr;\n } else if (index === caping) {\n acc[index] = {\n key: typeof others === 'string' ? others : 'Others',\n value: curr.value,\n };\n } else {\n acc[caping] = {\n ...acc[caping],\n value: acc[caping].value + curr.value,\n };\n }\n return acc;\n }, []);\n }\n }\n\n return computedData;\n }, [data, caping]);\n\n const colorScale = useColor({ data: computedData!, colorTheme, category: 'key', theme });\n\n return { data: computedData as CategoryData, colorScale };\n};\n"],"names":["useFormatCategoricalData","_ref","data","caping","sortingMethod","others","colorTheme","theme","computedData","useMemo","undefined","sort","getSortingMethod","slice","reduce","acc","curr","index","key","value","_objectSpread","colorScale","useColor","category"],"mappings":";;;;AAqBaA,MAAAA,wBAAwB,GAAGC,IAAA,IAOH;EAAA,IAPI;IACvCC,IAAI;IACJC,MAAM;IACNC,aAAa;IACbC,MAAM;IACNC,UAAU;AACVC,IAAAA,KAAAA;AAC6B,GAAC,GAAAN,IAAA,CAAA;AAC9B,EAAA,MAAMO,YAAY,GAAGC,OAAO,CAAC,MAAM;AACjC,IAAA,IAAID,YAAY,CAAA;AAEhB,IAAA,IAAIN,IAAI,KAAKQ,SAAS,IAAIR,IAAI,KAAK,IAAI,EAAE;AACvC,MAAA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AEM,YAAa;IAAEF,UAAU;AAAEiB,IAAAA,QAAQ,EAAE,KAAK;AAAEhB,IAAAA,KAAAA;AAAM,GAAC,CAAC,CAAA;EAExF,OAAO;AAAEL,IAAAA,IAAI,EAAEM,YAA4B;AAAEa,IAAAA,UAAAA;GAAY,CAAA;AAC3D;;;;"}
|
package/index.d.ts
CHANGED
|
@@ -1,51 +1,129 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export {
|
|
19
|
-
export {
|
|
20
|
-
export {
|
|
21
|
-
export {
|
|
22
|
-
export {
|
|
23
|
-
export {
|
|
24
|
-
export {
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
export {
|
|
28
|
-
|
|
29
|
-
export {
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
1
|
+
import { BrushBehavior, ScaleLinear, ScaleOrdinal } from 'd3';
|
|
2
|
+
import { Theme } from '@redsift/design-system';
|
|
3
|
+
import { C as ChartTheme, S as SortingMethod } from './index.d2.ts';
|
|
4
|
+
export { a as ChartDimensions, b as ChartSize, C as ChartTheme, c as ColorTheme, e as CustomColorTheme, M as MarginProps, S as SortingMethod, d as SuccessDangerColorTheme, g as getSortingMethod, i as isValidDate, m as mergeLegends } from './index.d2.ts';
|
|
5
|
+
export { A as Arc, S as StyledArc } from './_internal/styles.js';
|
|
6
|
+
export { A as ArcProps, S as StyledArcProps } from './_internal/types.js';
|
|
7
|
+
export { A as Arcs, a as ArcsProps, b as StyledArcs, S as StyledArcsProps } from './_internal/styles.d2.ts';
|
|
8
|
+
export { A as Axis, S as StyledAxis, g as getAxisType } from './_internal/styles.d3.ts';
|
|
9
|
+
export { A as AnyScale, l as AxisPosition, m as AxisProps, k as AxisVariant, C as Coordinates, N as NumericValue, i as Scale, f as ScaleBand, b as ScaleLinear, c as ScaleLog, e as ScalePoint, d as ScaleSymlog, g as ScaleTime, h as ScaleTypeToScale, a as ScaleValue, j as ScaleWithBandwidth, S as StringValue, n as StyledAxisProps, T as TicksSpec } from './_internal/scale.js';
|
|
10
|
+
export { B as Bar, S as StyledBar } from './_internal/styles.d4.ts';
|
|
11
|
+
export { a as BarDirection, B as BarOrientation, b as BarProps, S as StyledBarProps } from './_internal/types.d2.ts';
|
|
12
|
+
export { a as BarChart, h as BarChartBarsProps, c as BarChartDimensions, b as BarChartLegendVariant, d as BarChartProps, f as BarChartSectionProps, e as BarChartState, B as BaseBarChart, C as ComputedBarProps, R as RenderedLinearBarChartProps, j as StyledBarChart, l as StyledBarChartBars, i as StyledBarChartBarsProps, m as StyledBarChartEmptyText, S as StyledBarChartProps, k as StyledBarChartSection, g as StyledBarChartSectionProps, X as XScaleType } from './_internal/styles.d5.ts';
|
|
13
|
+
export { C as ChartContainer, b as ChartContainerDescription, a as ChartContainerTitle, S as StyledChartContainer, d as StyledChartContainerCaption, c as StyledChartContainerTitle } from './_internal/styles.d6.ts';
|
|
14
|
+
export { C as ChartContainerProps, S as StyledChartContainerProps } from './_internal/types.d3.ts';
|
|
15
|
+
export { D as DataPoint, S as StyledDataPoint } from './_internal/styles.d7.ts';
|
|
16
|
+
export { A as AnchorProps, D as DataPointProps, a as LabelVariant, L as LegendVariant, S as StyledDataPointProps, T as TooltipVariant } from './_internal/types.d4.ts';
|
|
17
|
+
export { D as Dot, S as StyledDot } from './_internal/styles.d8.ts';
|
|
18
|
+
export { a as DotProps, D as DotVariant, S as StyledDotProps } from './_internal/types.d5.ts';
|
|
19
|
+
export { L as Legend, S as StyledLegend } from './_internal/styles.d9.ts';
|
|
20
|
+
export { L as LegendProps, S as StyledLegendProps } from './_internal/types.d6.ts';
|
|
21
|
+
export { L as Line, a as LineProps, b as StyledLine, S as StyledLineProps } from './_internal/styles.d10.ts';
|
|
22
|
+
export { L as LineChart, b as LineChartDimensions, a as LineChartLegendVariant, c as LineChartProps, d as StyledLineChart, e as StyledLineChartEmptyText, S as StyledLineChartProps } from './_internal/styles.d11.ts';
|
|
23
|
+
export { P as PieChart, c as PieChartDimensions, b as PieChartLegendVariant, d as PieChartProps, a as PieChartVariant, e as StyledPieChart, f as StyledPieChartCenterText, g as StyledPieChartEmptyText, S as StyledPieChartProps } from './_internal/styles.d12.ts';
|
|
24
|
+
export { S as ScatterPlot, c as ScatterPlotDimensions, b as ScatterPlotLegendVariant, d as ScatterPlotProps, a as ScatterPlotVariant, f as StyledScatterPlot, g as StyledScatterPlotEmptyText, e as StyledScatterPlotProps } from './_internal/styles.d13.ts';
|
|
25
|
+
import { MutableRefObject } from 'react';
|
|
26
|
+
import { J as JSONArray, a as JSONObject, C as CategoryData } from './_internal/data.js';
|
|
27
|
+
export { A as ArcDatum, B as BarDatum, d as CategoricalOrLinearDim, C as CategoryData, f as CategoryDatum, c as CategoryDim, l as CoordinatesCategoryData, i as CoordinatesCategoryDatum, e as CoordinatesCategoryDim, D as Datum, m as DotDatum, E as EmptyDatum, J as JSONArray, a as JSONObject, b as JSONValue, p as LegendItemDatum, n as LinePointDatum, j as LinearData, g as LinearDatum, L as LinearDim, S as Statistic, o as Statistics, k as TwoCategoryData, h as TwoCategoryDatum, T as TwoCategoryDim } from './_internal/data.js';
|
|
28
|
+
import * as d3_scale from 'd3-scale';
|
|
29
|
+
export { C as ChartAxesProps } from './_internal/axis.d2.ts';
|
|
30
|
+
import 'styled-components';
|
|
31
|
+
import '@react-spring/web';
|
|
32
|
+
import './_internal/types.d7.ts';
|
|
33
|
+
import '@redsift/popovers';
|
|
34
|
+
import 'd3-shape';
|
|
35
|
+
|
|
36
|
+
interface UseBrushProps {
|
|
37
|
+
brushRef: MutableRefObject<BrushBehavior<unknown> | undefined>;
|
|
38
|
+
svgRef: MutableRefObject<SVGSVGElement | SVGGElement | undefined>;
|
|
39
|
+
extent?: [[number, number], [number, number]];
|
|
40
|
+
scaleX: ScaleLinear<number, number>;
|
|
41
|
+
scaleY: ScaleLinear<number, number>;
|
|
42
|
+
isBrushable?: boolean;
|
|
43
|
+
isGridded?: boolean;
|
|
44
|
+
onBrush?: (selection: [[number, number], [number, number]] | null, scaleX: ScaleLinear<number, number>, scaleY: ScaleLinear<number, number>) => void;
|
|
45
|
+
onBrushEnd?: (selection: [[number, number], [number, number]] | null, scaleX: ScaleLinear<number, number>, scaleY: ScaleLinear<number, number>) => void;
|
|
46
|
+
}
|
|
47
|
+
declare const useBrush: ({ brushRef: propsBrushRef, svgRef, extent, scaleX, scaleY, isBrushable, isGridded, onBrush, onBrushEnd, }: UseBrushProps) => void;
|
|
48
|
+
|
|
49
|
+
interface UseColorProps {
|
|
50
|
+
/** Dataset to use to generate the chart. */
|
|
51
|
+
data: JSONArray;
|
|
52
|
+
/** Color palette to use. */
|
|
53
|
+
colorTheme: ChartTheme;
|
|
54
|
+
/** Name of the field that will be used to categorize the data. */
|
|
55
|
+
category: string | ((d: JSONObject) => string);
|
|
56
|
+
/** Theme */
|
|
57
|
+
theme: Theme;
|
|
58
|
+
}
|
|
59
|
+
declare const useColor: ({ data, colorTheme, category, theme }: UseColorProps) => ScaleOrdinal<string, string, never>;
|
|
60
|
+
|
|
61
|
+
interface UseFormatCategoricalDataProps {
|
|
62
|
+
/** Dataset to use to generate the chart, should be a list of objects containing a key and a value. */
|
|
63
|
+
data: CategoryData;
|
|
64
|
+
/** Color palette to use. */
|
|
65
|
+
colorTheme: ChartTheme;
|
|
66
|
+
/** Define how to sort categories. */
|
|
67
|
+
sortingMethod: SortingMethod;
|
|
68
|
+
/** Number of categories to use, the rest being put into a new category called "Others". */
|
|
69
|
+
caping?: number;
|
|
70
|
+
/** Whether a category should be displayed for categories that has been removed by the caping option. Optionaly, this prop can be used to change the label of this category. */
|
|
71
|
+
others?: boolean | string;
|
|
72
|
+
/** Theme */
|
|
73
|
+
theme: Theme;
|
|
74
|
+
}
|
|
75
|
+
declare const useFormatCategoricalData: ({ data, caping, sortingMethod, others, colorTheme, theme, }: UseFormatCategoricalDataProps) => {
|
|
76
|
+
data: CategoryData;
|
|
77
|
+
colorScale: d3_scale.ScaleOrdinal<string, string, never>;
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
interface UseZoomProps {
|
|
81
|
+
svgRef: MutableRefObject<SVGSVGElement | undefined>;
|
|
82
|
+
scaleX: ScaleLinear<number, number>;
|
|
83
|
+
scaleY: ScaleLinear<number, number>;
|
|
84
|
+
defaultTransform?: {
|
|
85
|
+
k: number;
|
|
86
|
+
x: number;
|
|
87
|
+
y: number;
|
|
88
|
+
};
|
|
89
|
+
size?: any;
|
|
90
|
+
onZoom?: () => void;
|
|
91
|
+
}
|
|
92
|
+
declare const useZoom: ({ svgRef, scaleX, scaleY, defaultTransform, size, onZoom, }: UseZoomProps) => {
|
|
93
|
+
transform: {
|
|
94
|
+
k: number;
|
|
95
|
+
x: number;
|
|
96
|
+
y: number;
|
|
97
|
+
};
|
|
98
|
+
scaleX: ScaleLinear<number, number, never>;
|
|
99
|
+
scaleY: ScaleLinear<number, number, never>;
|
|
100
|
+
};
|
|
101
|
+
|
|
102
|
+
declare const monochrome = "#73C5EB";
|
|
103
|
+
declare const empty = "#BFBFBF";
|
|
104
|
+
declare const scheme: {
|
|
105
|
+
default: string[];
|
|
106
|
+
dark: string[];
|
|
107
|
+
darker: string[];
|
|
108
|
+
darkerer: string[];
|
|
109
|
+
light: string[];
|
|
110
|
+
lighter: string[];
|
|
111
|
+
lighterer: string[];
|
|
112
|
+
monochrome: string[];
|
|
113
|
+
empty: string[];
|
|
114
|
+
};
|
|
115
|
+
declare const successDangerScheme: {
|
|
116
|
+
success: string;
|
|
117
|
+
warning: string;
|
|
118
|
+
danger: string;
|
|
119
|
+
neutralLight: string;
|
|
120
|
+
neutralDark: string;
|
|
121
|
+
};
|
|
122
|
+
declare const getColorScale: ({ colorTheme, domain, isEmpty, theme, }: {
|
|
123
|
+
colorTheme: ChartTheme;
|
|
124
|
+
domain?: string[] | undefined;
|
|
125
|
+
isEmpty?: boolean | undefined;
|
|
126
|
+
theme: Theme;
|
|
127
|
+
}) => ScaleOrdinal<string, string>;
|
|
128
|
+
|
|
129
|
+
export { UseBrushProps, UseColorProps, UseFormatCategoricalDataProps, UseZoomProps, empty, getColorScale, monochrome, scheme, successDangerScheme, useBrush, useColor, useFormatCategoricalData, useZoom };
|
package/index.d2.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { ValueOf } from '@redsift/design-system';
|
|
2
|
+
import { f as CategoryDatum, o as Statistics } from './_internal/data.js';
|
|
3
|
+
|
|
4
|
+
type ChartDimensions = {
|
|
5
|
+
width: number;
|
|
6
|
+
height: number;
|
|
7
|
+
};
|
|
8
|
+
declare const ChartSize: {
|
|
9
|
+
readonly small: "small";
|
|
10
|
+
readonly medium: "medium";
|
|
11
|
+
readonly large: "large";
|
|
12
|
+
};
|
|
13
|
+
type ChartSize = ValueOf<typeof ChartSize>;
|
|
14
|
+
type MarginProps = {
|
|
15
|
+
top?: number;
|
|
16
|
+
right?: number;
|
|
17
|
+
bottom?: number;
|
|
18
|
+
left?: number;
|
|
19
|
+
};
|
|
20
|
+
|
|
21
|
+
declare const ColorTheme: {
|
|
22
|
+
readonly default: "default";
|
|
23
|
+
readonly dark: "dark";
|
|
24
|
+
readonly darker: "darker";
|
|
25
|
+
readonly darkerer: "darkerer";
|
|
26
|
+
readonly light: "light";
|
|
27
|
+
readonly lighter: "lighter";
|
|
28
|
+
readonly lighterer: "lighterer";
|
|
29
|
+
readonly monochrome: "monochrome";
|
|
30
|
+
};
|
|
31
|
+
type ColorTheme = ValueOf<typeof ColorTheme>;
|
|
32
|
+
type SuccessDangerColorTheme = {
|
|
33
|
+
success: string;
|
|
34
|
+
warning: string;
|
|
35
|
+
danger: string;
|
|
36
|
+
neutral?: string;
|
|
37
|
+
};
|
|
38
|
+
type CustomColorTheme = Record<string, string>;
|
|
39
|
+
type ChartTheme = ColorTheme | SuccessDangerColorTheme | CustomColorTheme;
|
|
40
|
+
|
|
41
|
+
type SortingMethod = 'none' | 'asc-key' | 'desc-key' | 'asc-value' | 'desc-value' | string[] | ((a: CategoryDatum, b: CategoryDatum) => 1 | -1);
|
|
42
|
+
declare const getSortingMethod: (sortingMethod: SortingMethod) => (a: CategoryDatum, b: CategoryDatum) => 1 | -1;
|
|
43
|
+
declare const isValidDate: (value: string) => boolean;
|
|
44
|
+
declare const mergeLegends: (arr1: Statistics, arr2: Statistics) => {
|
|
45
|
+
key: any;
|
|
46
|
+
value: any;
|
|
47
|
+
}[];
|
|
48
|
+
|
|
49
|
+
export { ChartTheme as C, MarginProps as M, SortingMethod as S, ChartDimensions as a, ChartSize as b, ColorTheme as c, SuccessDangerColorTheme as d, CustomColorTheme as e, getSortingMethod as g, isValidDate as i, mergeLegends as m };
|
package/index.js
CHANGED
|
@@ -1,43 +1,18 @@
|
|
|
1
|
-
export { empty, getColorScale, monochrome, scheme, successDangerScheme } from './scheme.js';
|
|
2
|
-
export { getSortingMethod, isValidDate, mergeLegends } from './
|
|
3
|
-
export { useBrush } from './
|
|
4
|
-
export {
|
|
5
|
-
export {
|
|
6
|
-
export {
|
|
7
|
-
export {
|
|
8
|
-
export {
|
|
9
|
-
export {
|
|
10
|
-
export {
|
|
11
|
-
export {
|
|
12
|
-
export {
|
|
13
|
-
export {
|
|
14
|
-
export {
|
|
15
|
-
export {
|
|
16
|
-
export {
|
|
17
|
-
export {
|
|
18
|
-
export { BarDirection, BarOrientation } from './components/Bar/types.js';
|
|
19
|
-
export { StyledBar } from './components/Bar/styles.js';
|
|
20
|
-
export { BarChart, BaseBarChart } from './components/BarChart/BarChart.js';
|
|
21
|
-
export { BarChartLegendVariant } from './components/BarChart/types.js';
|
|
22
|
-
export { StyledBarChart, StyledBarChartBars, StyledBarChartEmptyText, StyledBarChartSection } from './components/BarChart/styles.js';
|
|
23
|
-
export { ChartContainer, ChartContainerDescription, ChartContainerTitle } from './components/ChartContainer/ChartContainer.js';
|
|
24
|
-
export { StyledChartContainer, StyledChartContainerCaption, StyledChartContainerTitle } from './components/ChartContainer/styles.js';
|
|
25
|
-
export { DataPoint } from './components/DataPoint/DataPoint.js';
|
|
26
|
-
export { StyledDataPoint } from './components/DataPoint/styles.js';
|
|
27
|
-
export { Dot } from './components/Dot/Dot.js';
|
|
28
|
-
export { DotVariant } from './components/Dot/types.js';
|
|
29
|
-
export { StyledDot } from './components/Dot/styles.js';
|
|
30
|
-
export { Legend } from './components/Legend/Legend.js';
|
|
31
|
-
export { StyledLegend } from './components/Legend/styles.js';
|
|
32
|
-
export { Line } from './components/Line/Line.js';
|
|
33
|
-
export { StyledLine } from './components/Line/styles.js';
|
|
34
|
-
export { LineChart } from './components/LineChart/LineChart.js';
|
|
35
|
-
export { LineChartLegendVariant } from './components/LineChart/types.js';
|
|
36
|
-
export { StyledLineChart, StyledLineChartEmptyText } from './components/LineChart/styles.js';
|
|
37
|
-
export { PieChart } from './components/PieChart/PieChart.js';
|
|
38
|
-
export { PieChartLegendVariant, PieChartVariant } from './components/PieChart/types.js';
|
|
39
|
-
export { StyledPieChart, StyledPieChartCenterText, StyledPieChartEmptyText } from './components/PieChart/styles.js';
|
|
40
|
-
export { ScatterPlot } from './components/ScatterPlot/ScatterPlot.js';
|
|
41
|
-
export { ScatterPlotLegendVariant, ScatterPlotVariant } from './components/ScatterPlot/types.js';
|
|
42
|
-
export { StyledScatterPlot, StyledScatterPlotEmptyText } from './components/ScatterPlot/styles.js';
|
|
1
|
+
export { e as empty, g as getColorScale, m as monochrome, s as scheme, a as successDangerScheme } from './_internal/scheme.js';
|
|
2
|
+
export { C as ChartSize, a as ColorTheme, g as getSortingMethod, i as isValidDate, m as mergeLegends, u as useColor } from './_internal/theme.js';
|
|
3
|
+
export { S as ScatterPlot, c as ScatterPlotLegendVariant, b as ScatterPlotVariant, d as StyledScatterPlot, e as StyledScatterPlotEmptyText, u as useBrush, a as useZoom } from './_internal/ScatterPlot2.js';
|
|
4
|
+
export { u as useFormatCategoricalData } from './_internal/useFormatCategoricalData.js';
|
|
5
|
+
export { a as LabelVariant, L as LegendVariant, T as TooltipVariant } from './_internal/legend2.js';
|
|
6
|
+
export { A as Arc, S as StyledArc } from './_internal/Arc2.js';
|
|
7
|
+
export { A as Arcs, S as StyledArcs } from './_internal/Arcs2.js';
|
|
8
|
+
export { A as Axis, b as AxisPosition, a as AxisVariant, S as StyledAxis, g as getAxisType } from './_internal/Axis2.js';
|
|
9
|
+
export { B as Bar, b as BarDirection, a as BarOrientation, S as StyledBar } from './_internal/Bar2.js';
|
|
10
|
+
export { a as BarChart, b as BarChartLegendVariant, B as BaseBarChart, S as StyledBarChart, d as StyledBarChartBars, e as StyledBarChartEmptyText, c as StyledBarChartSection } from './_internal/BarChart2.js';
|
|
11
|
+
export { C as ChartContainer, b as ChartContainerDescription, a as ChartContainerTitle, S as StyledChartContainer, d as StyledChartContainerCaption, c as StyledChartContainerTitle } from './_internal/ChartContainer2.js';
|
|
12
|
+
export { D as DataPoint, S as StyledDataPoint } from './_internal/DataPoint2.js';
|
|
13
|
+
export { D as Dot, a as DotVariant, S as StyledDot } from './_internal/Dot2.js';
|
|
14
|
+
export { L as Legend, S as StyledLegend } from './_internal/Legend3.js';
|
|
15
|
+
export { L as Line, S as StyledLine } from './_internal/Line2.js';
|
|
16
|
+
export { L as LineChart, a as LineChartLegendVariant, S as StyledLineChart, b as StyledLineChartEmptyText } from './_internal/LineChart2.js';
|
|
17
|
+
export { P as PieChart, b as PieChartLegendVariant, a as PieChartVariant, S as StyledPieChart, c as StyledPieChartCenterText, d as StyledPieChartEmptyText } from './_internal/PieChart2.js';
|
|
43
18
|
//# sourceMappingURL=index.js.map
|
package/index.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;"}
|