@redsift/charts 11.5.0 → 11.6.0-alpha.0

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 (73) hide show
  1. package/_internal/Arc.js +2 -0
  2. package/_internal/Arc.js.map +1 -0
  3. package/_internal/Arc2.js +117 -0
  4. package/_internal/Arc2.js.map +1 -0
  5. package/_internal/Arcs.js +2 -0
  6. package/_internal/Arcs.js.map +1 -0
  7. package/_internal/Arcs2.js +94 -0
  8. package/_internal/Arcs2.js.map +1 -0
  9. package/_internal/Axis.js +2 -0
  10. package/_internal/Axis.js.map +1 -0
  11. package/_internal/Axis2.js +388 -0
  12. package/_internal/Axis2.js.map +1 -0
  13. package/_internal/Bar.js +2 -0
  14. package/_internal/Bar.js.map +1 -0
  15. package/_internal/Bar2.js +170 -0
  16. package/_internal/Bar2.js.map +1 -0
  17. package/_internal/BarChart.js +2 -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 +2 -0
  22. package/_internal/ChartContainer.js.map +1 -0
  23. package/_internal/ChartContainer2.js +266 -0
  24. package/_internal/ChartContainer2.js.map +1 -0
  25. package/_internal/DataPoint.js +2 -0
  26. package/_internal/DataPoint.js.map +1 -0
  27. package/_internal/DataPoint2.js +110 -0
  28. package/_internal/DataPoint2.js.map +1 -0
  29. package/_internal/Dot.js +2 -0
  30. package/_internal/Dot.js.map +1 -0
  31. package/_internal/Dot2.js +110 -0
  32. package/_internal/Dot2.js.map +1 -0
  33. package/_internal/Legend.js +2 -0
  34. package/_internal/Legend.js.map +1 -0
  35. package/_internal/Legend3.js +84 -0
  36. package/_internal/Legend3.js.map +1 -0
  37. package/_internal/LegendItem.js +2 -0
  38. package/_internal/LegendItem.js.map +1 -0
  39. package/_internal/LegendItem2.js +153 -0
  40. package/_internal/LegendItem2.js.map +1 -0
  41. package/_internal/Line.js +2 -0
  42. package/_internal/Line.js.map +1 -0
  43. package/_internal/Line2.js +59 -0
  44. package/_internal/Line2.js.map +1 -0
  45. package/_internal/LineChart.js +2 -0
  46. package/_internal/LineChart.js.map +1 -0
  47. package/_internal/LineChart2.js +669 -0
  48. package/_internal/LineChart2.js.map +1 -0
  49. package/_internal/PieChart.js +2 -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 +2 -0
  54. package/_internal/ScatterPlot.js.map +1 -0
  55. package/_internal/ScatterPlot2.js +744 -0
  56. package/_internal/ScatterPlot2.js.map +1 -0
  57. package/_internal/_rollupPluginBabelHelpers.js +93 -0
  58. package/_internal/_rollupPluginBabelHelpers.js.map +1 -0
  59. package/_internal/config.js +13 -0
  60. package/_internal/config.js.map +1 -0
  61. package/_internal/legend2.js +21 -0
  62. package/_internal/legend2.js.map +1 -0
  63. package/_internal/scheme.js +47 -0
  64. package/_internal/scheme.js.map +1 -0
  65. package/_internal/theme.js +79 -0
  66. package/_internal/theme.js.map +1 -0
  67. package/_internal/useFormatCategoricalData.js +56 -0
  68. package/_internal/useFormatCategoricalData.js.map +1 -0
  69. package/index.js +17 -5118
  70. package/index.js.map +1 -1
  71. package/index2.js +16 -0
  72. package/index2.js.map +1 -0
  73. package/package.json +4 -4
@@ -0,0 +1,2 @@
1
+ export { A as Arc, S as StyledArc } from './Arc2.js';
2
+ //# sourceMappingURL=Arc.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Arc.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,117 @@
1
+ import { _ as _objectWithoutProperties, b as _objectSpread2, a as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default, { forwardRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import { J, i as it } from '../index2.js';
5
+ import { interpolate } from 'd3';
6
+ import { Theme, useTheme } from '@redsift/design-system';
7
+ import styled, { css } from 'styled-components';
8
+ import { D as DataPoint } from './DataPoint2.js';
9
+ import { m as monochrome } from './scheme.js';
10
+ import { c as config } from './config.js';
11
+
12
+ /**
13
+ * Component style.
14
+ */
15
+ const StyledArc = styled(DataPoint)`
16
+ ${_ref => {
17
+ let {
18
+ $hasStroke,
19
+ $theme
20
+ } = _ref;
21
+ return $hasStroke ? css`
22
+ path {
23
+ stroke-width: 2px;
24
+ stroke: var(--redsift-color-neutral-${$theme === Theme.light ? 'white' : 'x-dark-grey'});
25
+ }
26
+ ` : '';
27
+ }}
28
+
29
+ ${_ref2 => {
30
+ let {
31
+ $clickable
32
+ } = _ref2;
33
+ return $clickable ? css`
34
+ cursor: pointer;
35
+
36
+ &:hover,
37
+ &:focus,
38
+ &.focused {
39
+ opacity: 0.8;
40
+ outline: none;
41
+ }
42
+
43
+ &:focus-visible,
44
+ &.focused {
45
+ path {
46
+ stroke: var(--redsift-color-primary-n);
47
+ stroke-width: 4px;
48
+ paint-order: stroke;
49
+ }
50
+ }
51
+ ` : '';
52
+ }}}
53
+ `;
54
+
55
+ const _excluded = ["className", "createArc", "disableAnimations", "hasStroke", "previousData"];
56
+ const COMPONENT_NAME = 'Arc';
57
+ const CLASSNAME = 'redsift-arc';
58
+ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
59
+ const {
60
+ color = monochrome,
61
+ data,
62
+ isSelected: propsIsSelected,
63
+ onClick,
64
+ role
65
+ } = props;
66
+ const {
67
+ className,
68
+ createArc,
69
+ disableAnimations,
70
+ hasStroke,
71
+ previousData = {
72
+ data: {
73
+ key: '',
74
+ value: 0
75
+ },
76
+ startAngle: 0,
77
+ endAngle: 0,
78
+ padAngle: 0,
79
+ value: 0,
80
+ index: 0
81
+ }
82
+ } = props,
83
+ forwardedProps = _objectWithoutProperties(props, _excluded);
84
+ const theme = useTheme();
85
+ const interpolator = interpolate(previousData, data);
86
+ const isSelectable = role === 'option';
87
+ const isDeselected = isSelectable && propsIsSelected === false;
88
+ const animatedProps = J(_objectSpread2(_objectSpread2({}, config), {}, {
89
+ to: async next => {
90
+ await next({
91
+ t: 1
92
+ });
93
+ },
94
+ from: {
95
+ t: 0
96
+ }
97
+ }));
98
+ return /*#__PURE__*/React__default.createElement(StyledArc, _extends({}, forwardedProps, {
99
+ ref: ref,
100
+ className: classNames(Arc.className, className),
101
+ $clickable: Boolean(onClick),
102
+ $hasStroke: Boolean(hasStroke),
103
+ $theme: theme,
104
+ tooltipProps: {
105
+ placement: 'client-point',
106
+ offset: 12
107
+ }
108
+ }), /*#__PURE__*/React__default.createElement(it.path, {
109
+ d: config.immediate || disableAnimations ? createArc(data) : animatedProps.t.to(t => createArc(interpolator(t))),
110
+ fill: isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color
111
+ }));
112
+ });
113
+ Arc.className = CLASSNAME;
114
+ Arc.displayName = COMPONENT_NAME;
115
+
116
+ export { Arc as A, StyledArc as S };
117
+ //# sourceMappingURL=Arc2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Arc2.js","sources":["../../src/components/Arc/styles.ts","../../src/components/Arc/Arc.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { StyledArcProps } from './types';\nimport { DataPoint } from '../DataPoint';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledArc = styled(DataPoint)<StyledArcProps>`\n ${({ $hasStroke, $theme }) =>\n $hasStroke\n ? css`\n path {\n stroke-width: 2px;\n stroke: var(--redsift-color-neutral-${$theme === Theme.light ? 'white' : 'x-dark-grey'});\n }\n `\n : ''}\n\n ${({ $clickable }) =>\n $clickable\n ? css`\n cursor: pointer;\n\n &:hover,\n &:focus,\n &.focused {\n opacity: 0.8;\n outline: none;\n }\n\n &:focus-visible,\n &.focused {\n path {\n stroke: var(--redsift-color-primary-n);\n stroke-width: 4px;\n paint-order: stroke;\n }\n }\n `\n : ''}}\n`;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { animated, useSpring } from '@react-spring/web';\nimport { interpolate as d3interpolate } from 'd3';\n\nimport { Comp, useTheme } from '@redsift/design-system';\n\nimport { ArcProps } from './types';\nimport { StyledArc } from './styles';\nimport { monochrome } from '../../scheme';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Arc';\nconst CLASSNAME = 'redsift-arc';\n\nexport const Arc: Comp<ArcProps, SVGGElement> = forwardRef((props, ref) => {\n const { color = monochrome, data, isSelected: propsIsSelected, onClick, role } = props;\n\n const {\n className,\n createArc,\n disableAnimations,\n hasStroke,\n previousData = {\n data: {\n key: '',\n value: 0,\n },\n startAngle: 0,\n endAngle: 0,\n padAngle: 0,\n value: 0,\n index: 0,\n },\n ...forwardedProps\n } = props;\n\n const theme = useTheme();\n\n const interpolator = d3interpolate(previousData, data);\n\n const isSelectable = role === 'option';\n const isDeselected = isSelectable && propsIsSelected === false;\n\n const animatedProps = useSpring({\n ...config,\n to: async (next: (props?: object) => Promise<void>) => {\n await next({ t: 1 });\n },\n from: { t: 0 },\n });\n\n return (\n <StyledArc\n {...forwardedProps}\n ref={ref}\n className={classNames(Arc.className, className)}\n $clickable={Boolean(onClick)}\n $hasStroke={Boolean(hasStroke)}\n $theme={theme}\n tooltipProps={{ placement: 'client-point', offset: 12 }}\n >\n <animated.path\n d={\n config.immediate || disableAnimations\n ? (createArc(data) as unknown as string)\n : (animatedProps.t.to((t) => createArc(interpolator(t))) as unknown as string)\n }\n fill={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n />\n </StyledArc>\n );\n});\nArc.className = CLASSNAME;\nArc.displayName = COMPONENT_NAME;\n"],"names":["StyledArc","styled","DataPoint","_ref","$hasStroke","$theme","css","Theme","light","_ref2","$clickable","COMPONENT_NAME","CLASSNAME","Arc","forwardRef","props","ref","color","monochrome","data","isSelected","propsIsSelected","onClick","role","className","createArc","disableAnimations","hasStroke","previousData","key","value","startAngle","endAngle","padAngle","index","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","interpolator","d3interpolate","isSelectable","isDeselected","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","Boolean","tooltipProps","placement","offset","animated","path","d","immediate","fill","displayName"],"mappings":";;;;;;;;;;;AAKA;AACA;AACA;MACaA,SAAS,GAAGC,MAAM,CAACC,SAAS,CAAkB,CAAA;AAC3D,EAAA,EAAIC,IAAA,IAAA;EAAA,IAAC;IAAEC,UAAU;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAF,IAAA,CAAA;EAAA,OACvBC,UAAU,GACNE,GAAI,CAAA;AACZ;AACA;AACA,gDAAkDD,EAAAA,MAAM,KAAKE,KAAK,CAACC,KAAK,GAAG,OAAO,GAAG,aAAc,CAAA;AACnG;AACA,QAAA,CAAS,GACD,EAAE,CAAA;AAAA,CAAC,CAAA;AACX;AACA,EAAA,EAAIC,KAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAAD,KAAA,CAAA;EAAA,OACfC,UAAU,GACNJ,GAAI,CAAA;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAA,CAAS,GACD,EAAE,CAAA;AAAA,CAAC,CAAA;AACX;;;AC7BA,MAAMK,cAAc,GAAG,KAAK,CAAA;AAC5B,MAAMC,SAAS,GAAG,aAAa,CAAA;AAExB,MAAMC,GAAgC,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACzE,MAAM;AAAEC,IAAAA,KAAK,GAAGC,UAAU;IAAEC,IAAI;AAAEC,IAAAA,UAAU,EAAEC,eAAe;IAAEC,OAAO;AAAEC,IAAAA,IAAAA;AAAK,GAAC,GAAGR,KAAK,CAAA;EAEtF,MAAM;MACJS,SAAS;MACTC,SAAS;MACTC,iBAAiB;MACjBC,SAAS;AACTC,MAAAA,YAAY,GAAG;AACbT,QAAAA,IAAI,EAAE;AACJU,UAAAA,GAAG,EAAE,EAAE;AACPC,UAAAA,KAAK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Y,EAAE;AAAEC,MAAAA,SAAS,EAAE,cAAc;AAAEC,MAAAA,MAAM,EAAE,EAAA;AAAG,KAAA;AAAE,GAAA,CAAA,eAExDP,cAAA,CAAAC,aAAA,CAACO,EAAQ,CAACC,IAAI,EAAA;IACZC,CAAC,EACCf,MAAM,CAACgB,SAAS,IAAIrC,iBAAiB,GAChCD,SAAS,CAACN,IAAI,CAAC,GACfyB,aAAa,CAACM,CAAC,CAACF,EAAE,CAAEE,CAAC,IAAKzB,SAAS,CAACe,YAAY,CAACU,CAAC,CAAC,CAAC,CAC1D;AACDc,IAAAA,IAAI,EAAErB,YAAY,GAAG,yCAAyC,GAAG1B,KAAAA;AAAM,GACxE,CACQ,CAAC,CAAA;AAEhB,CAAC,EAAC;AACFJ,GAAG,CAACW,SAAS,GAAGZ,SAAS,CAAA;AACzBC,GAAG,CAACoD,WAAW,GAAGtD,cAAc;;;;"}
@@ -0,0 +1,2 @@
1
+ export { A as Arcs, S as StyledArcs } from './Arcs2.js';
2
+ //# sourceMappingURL=Arcs.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Arcs.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,94 @@
1
+ import { _ as _objectWithoutProperties, b as _objectSpread2, a as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default, { forwardRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import { J, i as it } from '../index2.js';
5
+ import { interpolate } from 'd3';
6
+ import { useId } from '@redsift/design-system';
7
+ import styled from 'styled-components';
8
+ import { c as config } from './config.js';
9
+ import { A as Arc } from './Arc2.js';
10
+
11
+ /**
12
+ * Component style.
13
+ */
14
+ const StyledArcs = styled.g``;
15
+
16
+ const _excluded = ["arcs", "className", "color", "disableAnimations", "hasLabels", "hasStroke", "id", "labelDecorator", "onClick", "role", "sliceProps", "tooltipVariant"];
17
+ const COMPONENT_NAME = 'Arcs';
18
+ const CLASSNAME = 'redsift-arcs';
19
+ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
20
+ const {
21
+ arcs,
22
+ className,
23
+ color,
24
+ disableAnimations,
25
+ hasLabels,
26
+ hasStroke,
27
+ id: propsId,
28
+ labelDecorator,
29
+ onClick,
30
+ role,
31
+ sliceProps,
32
+ tooltipVariant
33
+ } = props,
34
+ forwardedProps = _objectWithoutProperties(props, _excluded);
35
+ const [_id] = useId();
36
+ const id = propsId !== null && propsId !== void 0 ? propsId : _id;
37
+ const animatedProps = J(_objectSpread2(_objectSpread2({}, config), {}, {
38
+ to: async next => {
39
+ await next({
40
+ t: 1
41
+ });
42
+ },
43
+ from: {
44
+ t: 0
45
+ }
46
+ }));
47
+ return /*#__PURE__*/React__default.createElement(StyledArcs, _extends({}, forwardedProps, {
48
+ className: classNames(Arcs.className, className),
49
+ ref: ref
50
+ }), /*#__PURE__*/React__default.createElement("g", {
51
+ className: "arc-group"
52
+ }, arcs.map((arc, index) => {
53
+ var _arc$index, _arc$id;
54
+ const arcIndex = (_arc$index = arc.index) !== null && _arc$index !== void 0 ? _arc$index : index;
55
+ const arcId = (_arc$id = arc.id) !== null && _arc$id !== void 0 ? _arc$id : `id${id}__arc-${arcIndex}`;
56
+ return /*#__PURE__*/React__default.createElement(Arc, _extends({}, sliceProps, {
57
+ color: color,
58
+ disableAnimations: disableAnimations,
59
+ hasStroke: hasStroke,
60
+ labelDecorator: labelDecorator,
61
+ onClick: onClick,
62
+ role: role,
63
+ tooltipVariant: tooltipVariant
64
+ }, arc, {
65
+ key: arcId,
66
+ id: arcId,
67
+ index: arcIndex
68
+ }));
69
+ })), hasLabels ? /*#__PURE__*/React__default.createElement("g", {
70
+ className: "arc-label-group"
71
+ }, arcs.filter(arc => {
72
+ const value = arc.data.data.value;
73
+ const percent = arc.data.data.percent;
74
+ return percent ? value > 0 && percent >= 0.1 : value > 0;
75
+ }).map((arc, index) => {
76
+ var _arc$index2, _arc$id2, _arc$labelDecorator;
77
+ const arcIndex = (_arc$index2 = arc.index) !== null && _arc$index2 !== void 0 ? _arc$index2 : index;
78
+ const arcId = (_arc$id2 = arc.id) !== null && _arc$id2 !== void 0 ? _arc$id2 : `id${id}__arc-${arcIndex}`;
79
+ const arcLabelDecorator = (_arc$labelDecorator = arc.labelDecorator) !== null && _arc$labelDecorator !== void 0 ? _arc$labelDecorator : labelDecorator;
80
+ const interpolator = interpolate(arc.from, arc.data);
81
+ return /*#__PURE__*/React__default.createElement(it.text, {
82
+ alignmentBaseline: "middle",
83
+ className: `arc-label _${index}`,
84
+ key: `${arcId}-label`,
85
+ textAnchor: "middle",
86
+ transform: config.immediate || disableAnimations ? `translate(${arc.createArc.centroid(arc.data).map(n => n.toFixed(4))})` : animatedProps.t.to(t => `translate(${arc.createArc.centroid(interpolator(t)).map(n => n.toFixed(4))})`)
87
+ }, arcLabelDecorator ? arcLabelDecorator(arc.data) : arc.data.data.key);
88
+ })) : null);
89
+ });
90
+ Arcs.className = CLASSNAME;
91
+ Arcs.displayName = COMPONENT_NAME;
92
+
93
+ export { Arcs as A, StyledArcs as S };
94
+ //# sourceMappingURL=Arcs2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Arcs2.js","sources":["../../src/components/Arcs/styles.ts","../../src/components/Arcs/Arcs.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledArcsProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledArcs = styled.g<StyledArcsProps>``;\n","import React, { RefObject, forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { animated, useSpring } from '@react-spring/web';\nimport { interpolate as d3interpolate } from 'd3';\n\nimport { Comp, useId } from '@redsift/design-system';\n\nimport { ArcsProps } from './types';\nimport { StyledArcs } from './styles';\nimport { Arc } from '../Arc';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Arcs';\nconst CLASSNAME = 'redsift-arcs';\n\nexport const Arcs: Comp<ArcsProps, SVGGElement> = forwardRef((props, ref) => {\n const {\n arcs,\n className,\n color,\n disableAnimations,\n hasLabels,\n hasStroke,\n id: propsId,\n labelDecorator,\n onClick,\n role,\n sliceProps,\n tooltipVariant,\n ...forwardedProps\n } = props;\n const [_id] = useId();\n const id = propsId ?? _id;\n\n const animatedProps = useSpring({\n ...config,\n to: async (next: (props?: object) => Promise<void>) => {\n await next({ t: 1 });\n },\n from: { t: 0 },\n });\n\n return (\n <StyledArcs\n {...forwardedProps}\n className={classNames(Arcs.className, className)}\n ref={ref as RefObject<SVGGElement>}\n >\n <g className=\"arc-group\">\n {arcs.map((arc, index) => {\n const arcIndex = arc.index ?? index;\n const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;\n\n return (\n <Arc\n {...sliceProps}\n color={color}\n disableAnimations={disableAnimations}\n hasStroke={hasStroke}\n labelDecorator={labelDecorator}\n onClick={onClick}\n role={role}\n tooltipVariant={tooltipVariant}\n {...arc}\n key={arcId}\n id={arcId}\n index={arcIndex}\n />\n );\n })}\n </g>\n {hasLabels ? (\n <g className=\"arc-label-group\">\n {arcs\n .filter((arc) => {\n const value = arc.data.data.value;\n const percent = arc.data.data.percent;\n return percent ? value > 0 && percent >= 0.1 : value > 0;\n })\n .map((arc, index) => {\n const arcIndex = arc.index ?? index;\n const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;\n const arcLabelDecorator = arc.labelDecorator ?? labelDecorator;\n const interpolator = d3interpolate(arc.from, arc.data);\n\n return (\n <animated.text\n alignmentBaseline=\"middle\"\n className={`arc-label _${index}`}\n key={`${arcId}-label`}\n textAnchor=\"middle\"\n transform={\n config.immediate || disableAnimations\n ? `translate(${arc.createArc.centroid(arc.data).map((n) => n.toFixed(4))})`\n : animatedProps.t.to(\n (t) => `translate(${arc.createArc.centroid(interpolator(t)).map((n) => n.toFixed(4))})`\n )\n }\n >\n {arcLabelDecorator ? arcLabelDecorator(arc.data) : arc.data.data.key}\n </animated.text>\n );\n })}\n </g>\n ) : null}\n </StyledArcs>\n );\n});\nArcs.className = CLASSNAME;\nArcs.displayName = COMPONENT_NAME;\n"],"names":["StyledArcs","styled","g","COMPONENT_NAME","CLASSNAME","Arcs","forwardRef","props","ref","arcs","className","color","disableAnimations","hasLabels","hasStroke","id","propsId","labelDecorator","onClick","role","sliceProps","tooltipVariant","forwardedProps","_objectWithoutProperties","_excluded","_id","useId","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","map","arc","index","_arc$index","_arc$id","arcIndex","arcId","Arc","key","filter","value","data","percent","_arc$index2","_arc$id2","_arc$labelDecorator","arcLabelDecorator","interpolator","d3interpolate","animated","text","alignmentBaseline","textAnchor","transform","immediate","createArc","centroid","n","toFixed","displayName"],"mappings":";;;;;;;;;;AAGA;AACA;AACA;MACaA,UAAU,GAAGC,MAAM,CAACC,CAAmB,CAAC;;;ACMrD,MAAMC,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAMC,SAAS,GAAG,cAAc,CAAA;AAEzB,MAAMC,IAAkC,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC3E,MAAM;MACJC,IAAI;MACJC,SAAS;MACTC,KAAK;MACLC,iBAAiB;MACjBC,SAAS;MACTC,SAAS;AACTC,MAAAA,EAAE,EAAEC,OAAO;MACXC,cAAc;MACdC,OAAO;MACPC,IAAI;MACJC,UAAU;AACVC,MAAAA,cAAAA;AAEF,KAAC,GAAGd,KAAK;AADJe,IAAAA,cAAc,GAAAC,wBAAA,CACfhB,KAAK,EAAAiB,SAAA,CAAA,CAAA;AACT,EAAA,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK,EAAE,CAAA;EACrB,MAAMX,EAAE,GAAGC,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAPA,KAAAA,CAAAA,GAAAA,OAAO,GAAIS,GAAG,CAAA;EAEzB,MAAME,aAAa,GAAGC,CAAS,CAAAC,cAAA,CAAAA,cAAA,KAC1BC,MAAM,CAAA,EAAA,EAAA,EAAA;IACTC,EAAE,EAAE,MAAOC,IAAuC,IAAK;AACrD,MAAA,MAAMA,IAAI,CAAC;AAAEC,QA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GC,WAAa,CAACjB,GAAG,CAACN,IAAI,EAAEM,GAAG,CAACU,IAAI,CAAC,CAAA;AAEtD,IAAA,oBACEf,cAAA,CAAAC,aAAA,CAACsB,EAAQ,CAACC,IAAI,EAAA;AACZC,MAAAA,iBAAiB,EAAC,QAAQ;MAC1BlD,SAAS,EAAG,CAAa+B,WAAAA,EAAAA,KAAM,CAAE,CAAA;MACjCM,GAAG,EAAG,CAAEF,EAAAA,KAAM,CAAQ,MAAA,CAAA;AACtBgB,MAAAA,UAAU,EAAC,QAAQ;AACnBC,MAAAA,SAAS,EACPhC,MAAM,CAACiC,SAAS,IAAInD,iBAAiB,GAChC,CAAA,UAAA,EAAY4B,GAAG,CAACwB,SAAS,CAACC,QAAQ,CAACzB,GAAG,CAACU,IAAI,CAAC,CAACX,GAAG,CAAE2B,CAAC,IAAKA,CAAC,CAACC,OAAO,CAAC,CAAC,CAAC,CAAE,CAAE,CAAA,CAAA,GACzExC,aAAa,CAACM,CAAC,CAACF,EAAE,CACfE,CAAC,IAAM,CAAYO,UAAAA,EAAAA,GAAG,CAACwB,SAAS,CAACC,QAAQ,CAACT,YAAY,CAACvB,CAAC,CAAC,CAAC,CAACM,GAAG,CAAE2B,CAAC,IAAKA,CAAC,CAACC,OAAO,CAAC,CAAC,CAAC,CAAE,CACvF,CAAA,CAAA,CAAA;AACL,KAAA,EAEAZ,iBAAiB,GAAGA,iBAAiB,CAACf,GAAG,CAACU,IAAI,CAAC,GAAGV,GAAG,CAACU,IAAI,CAACA,IAAI,CAACH,GACpD,CAAC,CAAA;AAEpB,GAAC,CACF,CAAC,GACF,IACM,CAAC,CAAA;AAEjB,CAAC,EAAC;AACF1C,IAAI,CAACK,SAAS,GAAGN,SAAS,CAAA;AAC1BC,IAAI,CAAC+D,WAAW,GAAGjE,cAAc;;;;"}
@@ -0,0 +1,2 @@
1
+ export { A as Axis, b as AxisPosition, a as AxisVariant, S as StyledAxis, g as getAxisType } from './Axis2.js';
2
+ //# sourceMappingURL=Axis.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"Axis.js","sources":[],"sourcesContent":[],"names":[],"mappings":""}
@@ -0,0 +1,388 @@
1
+ import { b as _objectSpread2, _ as _objectWithoutProperties, a as _extends } from './_rollupPluginBabelHelpers.js';
2
+ import React__default, { forwardRef, useRef } from 'react';
3
+ import classNames from 'classnames';
4
+ import { Theme, useTheme } from '@redsift/design-system';
5
+ import styled, { css } from 'styled-components';
6
+ import { i as it, J, G as Gt } from '../index2.js';
7
+ import { c as config } from './config.js';
8
+
9
+ /**
10
+ * Component variant.
11
+ */
12
+ const AxisVariant = {
13
+ none: 'none',
14
+ line: 'line',
15
+ lineTick: 'lineTick',
16
+ tick: 'tick',
17
+ tickValue: 'tickValue',
18
+ default: 'default'
19
+ };
20
+ const AxisPosition = {
21
+ top: 'top',
22
+ right: 'right',
23
+ bottom: 'bottom',
24
+ left: 'left'
25
+ };
26
+
27
+ /**
28
+ * Component props.
29
+ */
30
+
31
+ /**
32
+ * Component style.
33
+ */
34
+ const StyledAxis = styled(it.g)`
35
+ .redsift-axis__line,
36
+ .redsift-axis-tick__line {
37
+ fill: none;
38
+ ${_ref => {
39
+ let {
40
+ $theme
41
+ } = _ref;
42
+ return css`
43
+ stroke: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});
44
+ `;
45
+ }}
46
+ shape-rendering: crispEdges;
47
+ }
48
+
49
+ text {
50
+ font-family: var(--redsift-typography-font-family-poppins);
51
+ ${_ref2 => {
52
+ let {
53
+ $theme
54
+ } = _ref2;
55
+ return css`
56
+ fill: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});
57
+ `;
58
+ }}
59
+ font-size: 10px;
60
+ user-select: none;
61
+ }
62
+
63
+ text.colored {
64
+ ${_ref3 => {
65
+ let {
66
+ $theme,
67
+ $color
68
+ } = _ref3;
69
+ return css`
70
+ fill: ${$color === 'green' ? '#029B57' : $color === 'red' ? '#CB0E0E' : `var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'})`};
71
+ `;
72
+ }}
73
+ }
74
+ `;
75
+
76
+ const getScaleTicks = (scale, spec) => {
77
+ // specific values
78
+ if (Array.isArray(spec)) {
79
+ return spec;
80
+ }
81
+
82
+ // continuous scales
83
+ if ('ticks' in scale) {
84
+ // default behaviour
85
+ if (spec === undefined) {
86
+ return scale.ticks();
87
+ }
88
+
89
+ // specific tick count
90
+ if (typeof spec === 'number' && isFinite(spec) && Math.floor(spec) === spec) {
91
+ return scale.ticks(spec);
92
+ }
93
+ if (typeof spec === 'function') {
94
+ return scale.ticks();
95
+ }
96
+ }
97
+
98
+ // non linear scale default
99
+ return scale.domain();
100
+ };
101
+ const centerScale = scale => {
102
+ const bandwidth = scale.bandwidth();
103
+ if (bandwidth === 0) return scale;
104
+ let offset = bandwidth / 2;
105
+ if (scale.round()) {
106
+ offset = Math.round(offset);
107
+ }
108
+ return d => {
109
+ var _scale;
110
+ return ((_scale = scale(d)) !== null && _scale !== void 0 ? _scale : 0) + offset;
111
+ };
112
+ };
113
+ const computeTicks = _ref => {
114
+ let {
115
+ axis,
116
+ scale,
117
+ ticksPosition,
118
+ tickValues,
119
+ tickSize,
120
+ tickPadding,
121
+ tickRotation,
122
+ tickRemodelling
123
+ } = _ref;
124
+ const values = tickRemodelling ? tickRemodelling(getScaleTicks(scale, tickValues)) : getScaleTicks(scale, tickValues);
125
+ const position = 'bandwidth' in scale ? centerScale(scale) : scale;
126
+ const line = {
127
+ lineX: 0,
128
+ lineY: 0
129
+ };
130
+ const text = {
131
+ textX: 0,
132
+ textY: 0
133
+ };
134
+ const isRTL = typeof document === 'object' ? document.dir === 'rtl' : false;
135
+ let translate;
136
+ let textAlign = 'middle';
137
+ let textBaseline = 'central';
138
+ if (axis === 'x') {
139
+ translate = d => {
140
+ var _position;
141
+ return {
142
+ x: (_position = position(d)) !== null && _position !== void 0 ? _position : 0,
143
+ y: 0
144
+ };
145
+ };
146
+ line.lineY = tickSize * (ticksPosition === 'after' ? 1 : -1);
147
+ text.textY = (tickSize + tickPadding) * (ticksPosition === 'after' ? 1 : -1);
148
+ if (ticksPosition === 'after') {
149
+ textBaseline = 'text-before-edge';
150
+ } else {
151
+ textBaseline = 'alphabetic';
152
+ }
153
+ if (tickRotation === 0) {
154
+ textAlign = 'middle';
155
+ } else if (ticksPosition === 'after' && tickRotation < 0 || ticksPosition === 'before' && tickRotation > 0) {
156
+ textAlign = isRTL ? 'start' : 'end';
157
+ textBaseline = 'middle';
158
+ } else if (ticksPosition === 'after' && tickRotation > 0 || ticksPosition === 'before' && tickRotation < 0) {
159
+ textAlign = isRTL ? 'end' : 'start';
160
+ textBaseline = 'middle';
161
+ }
162
+ } else {
163
+ translate = d => {
164
+ var _position2;
165
+ return {
166
+ x: 0,
167
+ y: (_position2 = position(d)) !== null && _position2 !== void 0 ? _position2 : 0
168
+ };
169
+ };
170
+ line.lineX = tickSize * (ticksPosition === 'after' ? 1 : -1);
171
+ text.textX = (tickSize + tickPadding) * (ticksPosition === 'after' ? 1 : -1);
172
+ if (ticksPosition === 'after') {
173
+ textAlign = 'start';
174
+ } else {
175
+ textAlign = 'end';
176
+ }
177
+ }
178
+ const ticks = values.map(value => _objectSpread2(_objectSpread2(_objectSpread2({
179
+ key: value instanceof Date ? `${value.valueOf()}` : `${value}`,
180
+ value
181
+ }, translate(value)), line), text));
182
+ return {
183
+ ticks,
184
+ textAlign,
185
+ textBaseline
186
+ };
187
+ };
188
+
189
+ const _excluded = ["className", "disableAnimations", "grid", "length", "legend", "legendOffset", "legendPosition", "legendX", "legendY", "legendRotation", "legendStyle", "position", "scale", "tickPadding", "tickRotation", "tickSize", "tickValues", "tickFormat", "tickRemodelling", "variant", "x", "y", "chartWidth", "chartHeight", "sectionHeight", "textColor", "tickToColor"],
190
+ _excluded2 = ["length"];
191
+ const COMPONENT_NAME = 'Axis';
192
+ const CLASSNAME = 'redsift-axis';
193
+ const getAxisType = position => [AxisPosition.top, AxisPosition.bottom].includes(position) ? 'x' : 'y';
194
+ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
195
+ const {
196
+ className,
197
+ disableAnimations,
198
+ grid,
199
+ length,
200
+ legend,
201
+ legendOffset = -32,
202
+ legendPosition = 'end',
203
+ legendX: propsLegendX,
204
+ legendY: propsLegendY,
205
+ legendRotation: propsLegendRotation,
206
+ legendStyle,
207
+ position = AxisPosition.bottom,
208
+ scale,
209
+ tickPadding = 5,
210
+ tickRotation = 0,
211
+ tickSize = 5,
212
+ tickValues,
213
+ tickFormat,
214
+ tickRemodelling,
215
+ variant = AxisVariant.default,
216
+ x = 0,
217
+ y = 0,
218
+ chartWidth,
219
+ chartHeight,
220
+ sectionHeight,
221
+ textColor,
222
+ tickToColor = () => true
223
+ } = props,
224
+ forwardedProps = _objectWithoutProperties(props, _excluded);
225
+ const theme = useTheme();
226
+ const axis = getAxisType(position);
227
+ const _ref = typeof grid === 'object' ? _objectSpread2({
228
+ length: axis === 'x' ? sectionHeight !== null && sectionHeight !== void 0 ? sectionHeight : chartHeight : chartWidth
229
+ }, grid) : grid === true ? {
230
+ length: axis === 'x' ? sectionHeight !== null && sectionHeight !== void 0 ? sectionHeight : chartHeight : chartWidth
231
+ } : {
232
+ length: 0
233
+ },
234
+ {
235
+ length: gridLength
236
+ } = _ref,
237
+ gridStyle = _objectWithoutProperties(_ref, _excluded2);
238
+ const axisRef = ref || useRef();
239
+ const animatedProps = J(_objectSpread2(_objectSpread2({}, config), {}, {
240
+ to: async next => {
241
+ await next({
242
+ lineX2: axis === 'x' ? length : 0,
243
+ lineY2: axis === 'x' ? 0 : length
244
+ });
245
+ },
246
+ from: {
247
+ lineX2: 0,
248
+ lineY2: 0
249
+ },
250
+ reset: false
251
+ }));
252
+ let legendNode = null;
253
+ if (legend !== undefined) {
254
+ let legendX = 0;
255
+ let legendY = 0;
256
+ let legendRotation = 0;
257
+ let textAnchor;
258
+ if (axis === 'y') {
259
+ legendRotation = propsLegendRotation !== null && propsLegendRotation !== void 0 ? propsLegendRotation : 90;
260
+ legendX = propsLegendX !== null && propsLegendX !== void 0 ? propsLegendX : legendOffset;
261
+ if (legendPosition === 'start') {
262
+ textAnchor = 'start';
263
+ legendY = propsLegendY !== null && propsLegendY !== void 0 ? propsLegendY : length;
264
+ } else if (legendPosition === 'middle') {
265
+ textAnchor = 'middle';
266
+ legendY = propsLegendY !== null && propsLegendY !== void 0 ? propsLegendY : length / 2;
267
+ } else if (legendPosition === 'end') {
268
+ textAnchor = 'end';
269
+ legendY = propsLegendY !== null && propsLegendY !== void 0 ? propsLegendY : legendY;
270
+ }
271
+ } else {
272
+ legendY = propsLegendY !== null && propsLegendY !== void 0 ? propsLegendY : legendOffset;
273
+ if (legendPosition === 'start') {
274
+ textAnchor = 'start';
275
+ legendX = propsLegendX !== null && propsLegendX !== void 0 ? propsLegendX : legendX;
276
+ } else if (legendPosition === 'middle') {
277
+ textAnchor = 'middle';
278
+ legendX = propsLegendX !== null && propsLegendX !== void 0 ? propsLegendX : length / 2;
279
+ } else if (legendPosition === 'end') {
280
+ textAnchor = 'end';
281
+ legendX = propsLegendX !== null && propsLegendX !== void 0 ? propsLegendX : length;
282
+ }
283
+ }
284
+ legendNode = /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement("text", {
285
+ transform: `translate(${legendX}, ${legendY}) rotate(${legendRotation})`,
286
+ textAnchor: textAnchor,
287
+ style: _objectSpread2({
288
+ dominantBaseline: 'central'
289
+ }, legendStyle)
290
+ }, legend));
291
+ }
292
+ const {
293
+ ticks,
294
+ textAlign,
295
+ textBaseline
296
+ } = computeTicks({
297
+ axis,
298
+ scale: scale,
299
+ ticksPosition: [AxisPosition.top, AxisPosition.left].includes(position) ? 'before' : 'after',
300
+ tickValues,
301
+ tickSize: tickSize,
302
+ tickPadding: tickPadding,
303
+ tickRotation: tickRotation,
304
+ tickRemodelling
305
+ });
306
+ const transition = Gt(ticks, _objectSpread2(_objectSpread2({}, config), {}, {
307
+ keys: tick => tick.key,
308
+ initial: tick => ({
309
+ opacity: 1,
310
+ transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${axis === 'x' ? 0 : 180})`,
311
+ textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`
312
+ }),
313
+ from: tick => ({
314
+ opacity: 0,
315
+ transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${axis === 'x' ? 0 : 180})`,
316
+ textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`
317
+ }),
318
+ enter: tick => ({
319
+ opacity: 1,
320
+ transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${axis === 'x' ? 0 : 180})`,
321
+ textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`
322
+ }),
323
+ update: tick => ({
324
+ opacity: 1,
325
+ transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${axis === 'x' ? 0 : 180})`,
326
+ textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`
327
+ }),
328
+ leave: {
329
+ opacity: 0
330
+ }
331
+ }));
332
+ return /*#__PURE__*/React__default.createElement(StyledAxis, _extends({
333
+ "aria-hidden": "true",
334
+ className: classNames(Axis.className, className),
335
+ $theme: theme
336
+ }, forwardedProps, {
337
+ transform: `translate(${x},${y})${axis === 'x' ? '' : ',rotate(180)'}`,
338
+ ref: axisRef,
339
+ $color: textColor
340
+ }), gridLength ? /*#__PURE__*/React__default.createElement("g", {
341
+ className: `${Axis.className}__grid`
342
+ }, ticks.map((tick, i) => /*#__PURE__*/React__default.createElement("line", {
343
+ key: `grid-${tick.key}-${i}`,
344
+ className: `${Axis.className}-grid__line`,
345
+ x1: axis === 'x' ? tick.x : 0,
346
+ x2: axis === 'x' ? tick.x : gridLength * -1,
347
+ y1: axis === 'x' ? 0 : tick.y,
348
+ y2: axis === 'x' ? gridLength * -1 : tick.y,
349
+ style: _objectSpread2(_objectSpread2({
350
+ strokeDasharray: '4,4',
351
+ opacity: 0.2,
352
+ strokeWidth: 0.5
353
+ }, gridStyle), {}, {
354
+ stroke: 'currentColor'
355
+ })
356
+ }))) : null, variant === AxisVariant.default || variant === AxisVariant.tick || variant === AxisVariant.lineTick || variant === AxisVariant.tickValue ? transition((transitionProps, tick, _state, tickIndex) => {
357
+ return /*#__PURE__*/React__default.createElement(it.g, {
358
+ className: `${Axis.className}__tick`,
359
+ key: tickIndex,
360
+ transform: transitionProps.transform,
361
+ style: {
362
+ opacity: transitionProps.opacity
363
+ }
364
+ }, /*#__PURE__*/React__default.createElement("line", {
365
+ className: `${Axis.className}-tick__line`,
366
+ x1: 0,
367
+ x2: tick.lineX,
368
+ y1: 0,
369
+ y2: tick.lineY
370
+ }), variant === AxisVariant.default || variant === AxisVariant.tickValue ? /*#__PURE__*/React__default.createElement(it.text, {
371
+ dominantBaseline: textBaseline,
372
+ textAnchor: textAlign,
373
+ transform: transitionProps.textTransform,
374
+ className: !textColor ? '' : tickToColor(tick, tickIndex) ? 'colored' : ''
375
+ }, `${tickFormat ? tickFormat(tick.value) : tick.value}`) : null);
376
+ }) : null, variant === AxisVariant.default || variant === AxisVariant.line || variant === AxisVariant.lineTick ? /*#__PURE__*/React__default.createElement(it.line, {
377
+ className: `${Axis.className}__line`,
378
+ x1: 0,
379
+ x2: config.immediate || disableAnimations ? axis === 'x' ? length : 0 : animatedProps.lineX2,
380
+ y1: 0,
381
+ y2: config.immediate || disableAnimations ? axis === 'x' ? 0 : length : animatedProps.lineY2
382
+ }) : null, legendNode);
383
+ });
384
+ Axis.className = CLASSNAME;
385
+ Axis.displayName = COMPONENT_NAME;
386
+
387
+ export { Axis as A, StyledAxis as S, AxisVariant as a, AxisPosition as b, getAxisType as g };
388
+ //# sourceMappingURL=Axis2.js.map