@redsift/charts 11.6.0-muiv5-alpha.3 → 11.6.0-muiv5-alpha.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.
Files changed (275) hide show
  1. package/_internal/Arc.js +10 -0
  2. package/_internal/Arc.js.map +1 -0
  3. package/{components/Arc/Arc.js → _internal/Arc2.js} +52 -9
  4. package/_internal/Arc2.js.map +1 -0
  5. package/_internal/Arcs.js +10 -0
  6. package/_internal/Arcs.js.map +1 -0
  7. package/{components/Arcs/Arcs.js → _internal/Arcs2.js} +12 -8
  8. package/_internal/Arcs2.js.map +1 -0
  9. package/_internal/Axis.js +8 -0
  10. package/_internal/Axis.js.map +1 -0
  11. package/{types/axis.d.ts → _internal/Axis2.js} +2 -2
  12. package/_internal/Axis2.js.map +1 -0
  13. package/_internal/Bar.js +10 -0
  14. package/_internal/Bar.js.map +1 -0
  15. package/{components/Bar/Bar.js → _internal/Bar2.js} +85 -10
  16. package/_internal/Bar2.js.map +1 -0
  17. package/_internal/BarChart.js +17 -0
  18. package/_internal/BarChart.js.map +1 -0
  19. package/_internal/BarChart2.js +1419 -0
  20. package/_internal/BarChart2.js.map +1 -0
  21. package/_internal/ChartContainer.js +5 -0
  22. package/_internal/ChartContainer.js.map +1 -0
  23. package/{components/ChartContainer/ChartContainer.js → _internal/ChartContainer2.js} +105 -6
  24. package/_internal/ChartContainer2.js.map +1 -0
  25. package/_internal/DataPoint.js +7 -0
  26. package/_internal/DataPoint.js.map +1 -0
  27. package/{components/DataPoint/DataPoint.js → _internal/DataPoint2.js} +11 -5
  28. package/_internal/DataPoint2.js.map +1 -0
  29. package/_internal/Dot.js +10 -0
  30. package/_internal/Dot.js.map +1 -0
  31. package/{components/Dot/Dot.js → _internal/Dot2.js} +61 -6
  32. package/_internal/Dot2.js.map +1 -0
  33. package/_internal/Legend.js +10 -0
  34. package/_internal/Legend.js.map +1 -0
  35. package/{components/Legend/Legend.js → _internal/Legend3.js} +17 -6
  36. package/_internal/Legend3.js.map +1 -0
  37. package/_internal/LegendItem.js +21 -0
  38. package/_internal/LegendItem.js.map +1 -0
  39. package/{components/LegendItem/LegendItem.js → _internal/LegendItem2.js} +64 -7
  40. package/_internal/LegendItem2.js.map +1 -0
  41. package/_internal/Line.js +10 -0
  42. package/_internal/Line.js.map +1 -0
  43. package/{components/Line/Line.js → _internal/Line2.js} +12 -8
  44. package/_internal/Line2.js.map +1 -0
  45. package/_internal/LineChart.js +17 -0
  46. package/_internal/LineChart.js.map +1 -0
  47. package/{components/LineChart/RenderedLineChart.js → _internal/LineChart2.js} +317 -20
  48. package/_internal/LineChart2.js.map +1 -0
  49. package/_internal/PieChart.js +14 -0
  50. package/_internal/PieChart.js.map +1 -0
  51. package/_internal/PieChart2.js +605 -0
  52. package/_internal/PieChart2.js.map +1 -0
  53. package/_internal/ScatterPlot.js +17 -0
  54. package/_internal/ScatterPlot.js.map +1 -0
  55. package/_internal/ScatterPlot2.js +743 -0
  56. package/_internal/ScatterPlot2.js.map +1 -0
  57. package/{_virtual → _internal}/_rollupPluginBabelHelpers.js +1 -1
  58. package/_internal/config.js +13 -0
  59. package/_internal/config.js.map +1 -0
  60. package/{types/data.d.ts → _internal/data.js} +1 -1
  61. package/{types/legend.js → _internal/legend2.js} +2 -2
  62. package/_internal/legend2.js.map +1 -0
  63. package/{components/Axis/types.d.ts → _internal/scale.js} +47 -2
  64. package/{scheme.js → _internal/scheme.js} +1 -1
  65. package/_internal/scheme.js.map +1 -0
  66. package/{components/Arc/styles.d.ts → _internal/styles.js} +7 -5
  67. package/{components/Line/types.d.ts → _internal/styles10.js} +14 -5
  68. package/{components/LineChart/types.d.ts → _internal/styles11.js} +23 -12
  69. package/{components/PieChart/types.d.ts → _internal/styles12.js} +29 -11
  70. package/{components/ScatterPlot/types.d.ts → _internal/styles13.js} +23 -12
  71. package/{components/Arcs/types.d.ts → _internal/styles2.js} +11 -2
  72. package/{components/Axis/styles.d.ts → _internal/styles3.js} +6 -3
  73. package/{components/Bar/styles.d.ts → _internal/styles4.js} +7 -5
  74. package/{components/BarChart/types.d.ts → _internal/styles5.js} +49 -14
  75. package/{components/ChartContainer/styles.d.ts → _internal/styles6.js} +8 -3
  76. package/{components/DataPoint/styles.d.ts → _internal/styles7.js} +5 -2
  77. package/{components/Dot/styles.d.ts → _internal/styles8.js} +7 -4
  78. package/{components/Legend/styles.d.ts → _internal/styles9.js} +5 -2
  79. package/{utils/index.js → _internal/theme.js} +37 -2
  80. package/_internal/theme.js.map +1 -0
  81. package/{components/Arc/types.d.ts → _internal/types.js} +3 -3
  82. package/{components/Bar/types.d.ts → _internal/types2.js} +3 -3
  83. package/{components/ChartContainer/types.d.ts → _internal/types3.js} +1 -1
  84. package/{components/DataPoint/types.d.ts → _internal/types4.js} +29 -3
  85. package/{components/Dot/types.d.ts → _internal/types5.js} +3 -3
  86. package/{components/Legend/types.d.ts → _internal/types6.js} +4 -4
  87. package/{components/LegendItem/types.d.ts → _internal/types7.js} +8 -4
  88. package/{hooks → _internal}/useFormatCategoricalData.js +3 -4
  89. package/{hooks → _internal}/useFormatCategoricalData.js.map +1 -1
  90. package/index.js +129 -43
  91. package/index.js.map +1 -1
  92. package/index2.js +49 -0
  93. package/index2.js.map +1 -0
  94. package/package.json +2 -2
  95. package/components/Arc/Arc.d.ts +0 -6
  96. package/components/Arc/Arc.js.map +0 -1
  97. package/components/Arc/styles.js +0 -49
  98. package/components/Arc/styles.js.map +0 -1
  99. package/components/Arcs/Arcs.d.ts +0 -6
  100. package/components/Arcs/Arcs.js.map +0 -1
  101. package/components/Arcs/styles.d.ts +0 -9
  102. package/components/Arcs/styles.js +0 -9
  103. package/components/Arcs/styles.js.map +0 -1
  104. package/components/Axis/Axis.d.ts +0 -7
  105. package/components/Axis/Axis.js +0 -211
  106. package/components/Axis/Axis.js.map +0 -1
  107. package/components/Axis/computeTicks.js +0 -117
  108. package/components/Axis/computeTicks.js.map +0 -1
  109. package/components/Axis/styles.js +0 -51
  110. package/components/Axis/styles.js.map +0 -1
  111. package/components/Axis/types.js +0 -24
  112. package/components/Axis/types.js.map +0 -1
  113. package/components/Bar/Bar.d.ts +0 -6
  114. package/components/Bar/Bar.js.map +0 -1
  115. package/components/Bar/styles.js +0 -66
  116. package/components/Bar/styles.js.map +0 -1
  117. package/components/Bar/types.js +0 -18
  118. package/components/Bar/types.js.map +0 -1
  119. package/components/BarChart/BarChart.d.ts +0 -29
  120. package/components/BarChart/BarChart.js +0 -141
  121. package/components/BarChart/BarChart.js.map +0 -1
  122. package/components/BarChart/BarChartBars.js +0 -168
  123. package/components/BarChart/BarChartBars.js.map +0 -1
  124. package/components/BarChart/BarChartSection.js +0 -139
  125. package/components/BarChart/BarChartSection.js.map +0 -1
  126. package/components/BarChart/EmptyBarChart.js +0 -57
  127. package/components/BarChart/EmptyBarChart.js.map +0 -1
  128. package/components/BarChart/LoadingBarChart.js +0 -18
  129. package/components/BarChart/LoadingBarChart.js.map +0 -1
  130. package/components/BarChart/RenderedLinearBarChart.js +0 -549
  131. package/components/BarChart/RenderedLinearBarChart.js.map +0 -1
  132. package/components/BarChart/RenderedOrdinalBarChart.js +0 -236
  133. package/components/BarChart/RenderedOrdinalBarChart.js.map +0 -1
  134. package/components/BarChart/context.js +0 -13
  135. package/components/BarChart/context.js.map +0 -1
  136. package/components/BarChart/intl/en-US.json.js +0 -17
  137. package/components/BarChart/intl/en-US.json.js.map +0 -1
  138. package/components/BarChart/intl/fr-FR.json.js +0 -17
  139. package/components/BarChart/intl/fr-FR.json.js.map +0 -1
  140. package/components/BarChart/intl/index.js +0 -10
  141. package/components/BarChart/intl/index.js.map +0 -1
  142. package/components/BarChart/styles.d.ts +0 -19
  143. package/components/BarChart/styles.js +0 -71
  144. package/components/BarChart/styles.js.map +0 -1
  145. package/components/BarChart/types.js +0 -17
  146. package/components/BarChart/types.js.map +0 -1
  147. package/components/BarChart/utils.js +0 -69
  148. package/components/BarChart/utils.js.map +0 -1
  149. package/components/ChartContainer/ChartContainer.d.ts +0 -9
  150. package/components/ChartContainer/ChartContainer.js.map +0 -1
  151. package/components/ChartContainer/context.js +0 -6
  152. package/components/ChartContainer/context.js.map +0 -1
  153. package/components/ChartContainer/intl/en-US.json.js +0 -14
  154. package/components/ChartContainer/intl/en-US.json.js.map +0 -1
  155. package/components/ChartContainer/intl/fr-FR.json.js +0 -14
  156. package/components/ChartContainer/intl/fr-FR.json.js.map +0 -1
  157. package/components/ChartContainer/intl/index.js +0 -10
  158. package/components/ChartContainer/intl/index.js.map +0 -1
  159. package/components/ChartContainer/styles.js +0 -76
  160. package/components/ChartContainer/styles.js.map +0 -1
  161. package/components/DataPoint/DataPoint.d.ts +0 -6
  162. package/components/DataPoint/DataPoint.js.map +0 -1
  163. package/components/DataPoint/styles.js +0 -10
  164. package/components/DataPoint/styles.js.map +0 -1
  165. package/components/Dot/Dot.d.ts +0 -6
  166. package/components/Dot/Dot.js.map +0 -1
  167. package/components/Dot/styles.js +0 -49
  168. package/components/Dot/styles.js.map +0 -1
  169. package/components/Dot/types.js +0 -14
  170. package/components/Dot/types.js.map +0 -1
  171. package/components/Legend/Legend.d.ts +0 -6
  172. package/components/Legend/Legend.js.map +0 -1
  173. package/components/Legend/styles.js +0 -15
  174. package/components/Legend/styles.js.map +0 -1
  175. package/components/LegendItem/LegendItem.js.map +0 -1
  176. package/components/LegendItem/styles.js +0 -63
  177. package/components/LegendItem/styles.js.map +0 -1
  178. package/components/Line/Line.d.ts +0 -6
  179. package/components/Line/Line.js.map +0 -1
  180. package/components/Line/styles.d.ts +0 -9
  181. package/components/Line/styles.js +0 -9
  182. package/components/Line/styles.js.map +0 -1
  183. package/components/LineChart/EmptyLineChart.js +0 -58
  184. package/components/LineChart/EmptyLineChart.js.map +0 -1
  185. package/components/LineChart/LineChart.d.ts +0 -6
  186. package/components/LineChart/LineChart.js +0 -96
  187. package/components/LineChart/LineChart.js.map +0 -1
  188. package/components/LineChart/LoadingLineChart.js +0 -18
  189. package/components/LineChart/LoadingLineChart.js.map +0 -1
  190. package/components/LineChart/RenderedLineChart.js.map +0 -1
  191. package/components/LineChart/intl/en-US.json.js +0 -17
  192. package/components/LineChart/intl/en-US.json.js.map +0 -1
  193. package/components/LineChart/intl/fr-FR.json.js +0 -17
  194. package/components/LineChart/intl/fr-FR.json.js.map +0 -1
  195. package/components/LineChart/intl/index.js +0 -10
  196. package/components/LineChart/intl/index.js.map +0 -1
  197. package/components/LineChart/styles.d.ts +0 -17
  198. package/components/LineChart/styles.js +0 -53
  199. package/components/LineChart/styles.js.map +0 -1
  200. package/components/LineChart/types.js +0 -17
  201. package/components/LineChart/types.js.map +0 -1
  202. package/components/LineChart/utils.js +0 -67
  203. package/components/LineChart/utils.js.map +0 -1
  204. package/components/PieChart/EmptyPieChart.js +0 -85
  205. package/components/PieChart/EmptyPieChart.js.map +0 -1
  206. package/components/PieChart/LoadingPieChart.js +0 -18
  207. package/components/PieChart/LoadingPieChart.js.map +0 -1
  208. package/components/PieChart/PieChart.d.ts +0 -6
  209. package/components/PieChart/PieChart.js +0 -98
  210. package/components/PieChart/PieChart.js.map +0 -1
  211. package/components/PieChart/RenderedPieChart.js +0 -198
  212. package/components/PieChart/RenderedPieChart.js.map +0 -1
  213. package/components/PieChart/intl/en-US.json.js +0 -9
  214. package/components/PieChart/intl/en-US.json.js.map +0 -1
  215. package/components/PieChart/intl/fr-FR.json.js +0 -9
  216. package/components/PieChart/intl/fr-FR.json.js.map +0 -1
  217. package/components/PieChart/intl/index.js +0 -10
  218. package/components/PieChart/intl/index.js.map +0 -1
  219. package/components/PieChart/styles.d.ts +0 -24
  220. package/components/PieChart/styles.js +0 -168
  221. package/components/PieChart/styles.js.map +0 -1
  222. package/components/PieChart/types.js +0 -27
  223. package/components/PieChart/types.js.map +0 -1
  224. package/components/PieChart/utils.js +0 -37
  225. package/components/PieChart/utils.js.map +0 -1
  226. package/components/ScatterPlot/EmptyScatterPlot.js +0 -58
  227. package/components/ScatterPlot/EmptyScatterPlot.js.map +0 -1
  228. package/components/ScatterPlot/LoadingScatterPlot.js +0 -18
  229. package/components/ScatterPlot/LoadingScatterPlot.js.map +0 -1
  230. package/components/ScatterPlot/RenderedScatterPlot.js +0 -352
  231. package/components/ScatterPlot/RenderedScatterPlot.js.map +0 -1
  232. package/components/ScatterPlot/ScatterPlot.d.ts +0 -6
  233. package/components/ScatterPlot/ScatterPlot.js +0 -105
  234. package/components/ScatterPlot/ScatterPlot.js.map +0 -1
  235. package/components/ScatterPlot/intl/en-US.json.js +0 -12
  236. package/components/ScatterPlot/intl/en-US.json.js.map +0 -1
  237. package/components/ScatterPlot/intl/fr-FR.json.js +0 -17
  238. package/components/ScatterPlot/intl/fr-FR.json.js.map +0 -1
  239. package/components/ScatterPlot/intl/index.js +0 -10
  240. package/components/ScatterPlot/intl/index.js.map +0 -1
  241. package/components/ScatterPlot/styles.d.ts +0 -17
  242. package/components/ScatterPlot/styles.js +0 -53
  243. package/components/ScatterPlot/styles.js.map +0 -1
  244. package/components/ScatterPlot/types.js +0 -24
  245. package/components/ScatterPlot/types.js.map +0 -1
  246. package/components/ScatterPlot/utils.js +0 -70
  247. package/components/ScatterPlot/utils.js.map +0 -1
  248. package/config.js +0 -15
  249. package/config.js.map +0 -1
  250. package/design-system/src/react-aria/react-aria/i18n/useMessageFormatter.d.ts +0 -5
  251. package/hooks/useBrush.d.ts +0 -17
  252. package/hooks/useBrush.js +0 -48
  253. package/hooks/useBrush.js.map +0 -1
  254. package/hooks/useColor.d.ts +0 -18
  255. package/hooks/useColor.js +0 -20
  256. package/hooks/useColor.js.map +0 -1
  257. package/hooks/useFormatCategoricalData.d.ts +0 -26
  258. package/hooks/useZoom.d.ts +0 -26
  259. package/hooks/useZoom.js +0 -39
  260. package/hooks/useZoom.js.map +0 -1
  261. package/index.d.ts +0 -51
  262. package/scheme.d.ts +0 -32
  263. package/scheme.js.map +0 -1
  264. package/types/legend.d.ts +0 -30
  265. package/types/legend.js.map +0 -1
  266. package/types/scale.d.ts +0 -48
  267. package/types/size.d.ts +0 -20
  268. package/types/size.js +0 -8
  269. package/types/size.js.map +0 -1
  270. package/types/theme.d.ts +0 -23
  271. package/types/theme.js +0 -13
  272. package/types/theme.js.map +0 -1
  273. package/utils/index.d.ts +0 -11
  274. package/utils/index.js.map +0 -1
  275. /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,MA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AAG,EAAEC,KAAK,CAAC,GAAAhB,IAAA,CAAA;IAAA,OAAM;MAAEe,GAAG;AAAEC,MAAAA,KAAAA;KAAO,CAAA;AAAA,GAAC,CAAC,CAAA;AAC5D;;ACvDO,MAAMmB,SAAS,GAAG;AACvBC,EAAAA,KAAK,EAAE,OAAO;AACdC,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 './types4.js';
2
3
  import { Theme } from '@redsift/design-system';
3
- import { DataPointProps, StyledDataPointProps } from '../DataPoint/types.js';
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 { BarDatum } from '../../types/data.js';
4
- import { DataPointProps, StyledDataPointProps } from '../DataPoint/types.js';
3
+ import { D as DataPointProps, S as StyledDataPointProps } from './types4.js';
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 { BarDirection, BarOrientation, BarProps, StyledBarProps };
46
+ export { BarOrientation as B, StyledBarProps as S, BarDirection as a, BarProps as b };
@@ -45,4 +45,4 @@ type StyledChartContainerProps = Omit<ChartContainerProps, 'theme'> & {
45
45
  $theme: Theme;
46
46
  };
47
47
 
48
- export { ChartContainerProps, StyledChartContainerProps };
48
+ export { ChartContainerProps as C, StyledChartContainerProps as S };
@@ -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
- import { TooltipVariant } from '../../types/legend.js';
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 './types4.js';
2
3
  import { ValueOf, Theme } from '@redsift/design-system';
3
- import { DotDatum } from '../../types/data.js';
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 { DotProps, DotVariant, StyledDotProps };
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 './types7.js';
2
3
  import { ContainerProps } from '@redsift/design-system';
3
- import { Statistic, LegendItemDatum } from '../../types/data.js';
4
- import { LegendItemProps } from '../LegendItem/types.js';
5
- import { LegendVariant } from '../../types/legend.js';
4
+ import { S as Statistic, p as LegendItemDatum } from './data.js';
5
+ import { L as LegendVariant } from './types4.js';
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 { LegendItemDatum } from '../../types/data.js';
3
- import { LegendVariant } from '../../types/legend.js';
4
- import { DataPointProps } from '../DataPoint/types.js';
2
+ import { D as DataPointProps, L as LegendVariant, S as StyledDataPointProps } from './types4.js';
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 { objectSpread2 as _objectSpread2 } from '../_virtual/_rollupPluginBabelHelpers.js';
1
+ import { b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
2
2
  import { useMemo } from 'react';
3
- import { useColor } from './useColor.js';
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":";;;;;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,OAAOQ,SAAS,CAAA;AAClB,KAAA;AAEAF,IAAAA,YAAY,GAAG,CAAC,GAAGN,IAAK,CAAC,CAACS,IAAI,CAACC,gBAAgB,CAACR,aAAa,CAAC,CAAC,CAAA;AAE/D,IAAA,IAAID,MAAM,EAAE;AACV,MAAA,IAAI,OAAOE,MAAM,KAAK,SAAS,IAAI,CAACA,MAAM,EAAE;QAC1CG,YAAY,GAAGA,YAAY,CAACK,KAAK,CAAC,CAAC,EAAEV,MAAM,CAAC,CAAA;AAC9C,OAAC,MAAM;QACLK,YAAY,GAAGA,YAAY,CAACM,MAAM,CAAe,CAACC,GAAG,EAAEC,IAAI,EAAEC,KAAK,KAAK;UACrE,IAAIA,KAAK,GAAGd,MAAM,EAAE;AAClBY,YAAAA,GAAG,CAACE,KAAK,CAAC,GAAGD,IAAI,CAAA;AACnB,WAAC,MAAM,IAAIC,KAAK,KAAKd,MAAM,EAAE;YAC3BY,GAAG,CAACE,KAAK,CAAC,GAAG;cACXC,GAAG,EAAE,OAAOb,MAAM,KAAK,QAAQ,GAAGA,MAAM,GAAG,QAAQ;cACnDc,KAAK,EAAEH,IAAI,CAACG,KAAAA;aACb,CAAA;AACH,WAAC,MAAM;YACLJ,GAAG,CAACZ,MAAM,CAAC,GAAAiB,cAAA,CAAAA,cAAA,CACNL,EAAAA,EAAAA,GAAG,CAACZ,MAAM,CAAC,CAAA,EAAA,EAAA,EAAA;cACdgB,KAAK,EAAEJ,GAAG,CAACZ,MAAM,CAAC,CAACgB,KAAK,GAAGH,IAAI,CAACG,KAAAA;aACjC,CAAA,CAAA;AACH,WAAA;AACA,UAAA,OAAOJ,GAAG,CAAA;SACX,EAAE,EAAE,CAAC,CAAA;AACR,OAAA;AACF,KAAA;AAEA,IAAA,OAAOP,YAAY,CAAA;AACrB,GAAC,EAAE,CAACN,IAAI,EAAEC,MAAM,CAAC,CAAC,CAAA;EAElB,MAAMkB,UAAU,GAAGC,QAAQ,CAAC;AAAEpB,IAAAA,IAAI,EAAEM,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;;;;"}
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;AA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AE,CAAC,CAAA;AACR,OAAA;AACF,KAAA;AAEA,IAAA,OAAOP,YAAY,CAAA;AACrB,GAAC,EAAE,CAACN,IAAI,EAAEC,MAAM,CAAC,CAAC,CAAA;EAElB,MAAMkB,UAAU,GAAGC,QAAQ,CAAC;AAAEpB,IAAAA,IAAI,EAAEM,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.js CHANGED
@@ -1,43 +1,129 @@
1
- export { empty, getColorScale, monochrome, scheme, successDangerScheme } from './scheme.js';
2
- export { getSortingMethod, isValidDate, mergeLegends } from './utils/index.js';
3
- export { useBrush } from './hooks/useBrush.js';
4
- export { useColor } from './hooks/useColor.js';
5
- export { useFormatCategoricalData } from './hooks/useFormatCategoricalData.js';
6
- export { useZoom } from './hooks/useZoom.js';
7
- export { LabelVariant, LegendVariant, TooltipVariant } from './types/legend.js';
8
- export { ChartSize } from './types/size.js';
9
- export { ColorTheme } from './types/theme.js';
10
- export { Arc } from './components/Arc/Arc.js';
11
- export { StyledArc } from './components/Arc/styles.js';
12
- export { Arcs } from './components/Arcs/Arcs.js';
13
- export { StyledArcs } from './components/Arcs/styles.js';
14
- export { Axis, getAxisType } from './components/Axis/Axis.js';
15
- export { AxisPosition, AxisVariant } from './components/Axis/types.js';
16
- export { StyledAxis } from './components/Axis/styles.js';
17
- export { Bar } from './components/Bar/Bar.js';
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';
43
- //# sourceMappingURL=index.js.map
1
+ import { BrushBehavior, ScaleLinear, ScaleOrdinal } from 'd3';
2
+ import { Theme } from '@redsift/design-system';
3
+ import { C as ChartTheme, S as SortingMethod } from './index2.js';
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 './index2.js';
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/styles2.js';
8
+ export { A as Axis, S as StyledAxis, g as getAxisType } from './_internal/styles3.js';
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/styles4.js';
11
+ export { a as BarDirection, B as BarOrientation, b as BarProps, S as StyledBarProps } from './_internal/types2.js';
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/styles5.js';
13
+ export { C as ChartContainer, b as ChartContainerDescription, a as ChartContainerTitle, S as StyledChartContainer, d as StyledChartContainerCaption, c as StyledChartContainerTitle } from './_internal/styles6.js';
14
+ export { C as ChartContainerProps, S as StyledChartContainerProps } from './_internal/types3.js';
15
+ export { D as DataPoint, S as StyledDataPoint } from './_internal/styles7.js';
16
+ export { A as AnchorProps, D as DataPointProps, a as LabelVariant, L as LegendVariant, S as StyledDataPointProps, T as TooltipVariant } from './_internal/types4.js';
17
+ export { D as Dot, S as StyledDot } from './_internal/styles8.js';
18
+ export { a as DotProps, D as DotVariant, S as StyledDotProps } from './_internal/types5.js';
19
+ export { L as Legend, S as StyledLegend } from './_internal/styles9.js';
20
+ export { L as LegendProps, S as StyledLegendProps } from './_internal/types6.js';
21
+ export { L as Line, a as LineProps, b as StyledLine, S as StyledLineProps } from './_internal/styles10.js';
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/styles11.js';
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/styles12.js';
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/styles13.js';
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/axis2.js';
30
+ import 'styled-components';
31
+ import '@react-spring/web';
32
+ import './_internal/types7.js';
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.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":";;;;;;;;;;;;;;;;"}
package/index2.js 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 };