@redsift/charts 11.6.0-muiv5-alpha.5 → 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 -10
- package/_internal/Arcs.d.ts +10 -0
- package/_internal/Arcs.js +2 -10
- package/_internal/Axis.d.ts +8 -0
- package/_internal/Axis.js +2 -8
- package/_internal/Axis2.js +386 -46
- package/_internal/Bar.d.ts +10 -0
- package/_internal/Bar.js +2 -10
- package/_internal/BarChart.d.ts +17 -0
- package/_internal/BarChart.js +2 -17
- package/_internal/BarChart2.js +2 -2
- package/_internal/ChartContainer.d.ts +5 -0
- package/_internal/ChartContainer.js +2 -5
- package/_internal/DataPoint.d.ts +7 -0
- package/_internal/DataPoint.js +2 -7
- package/_internal/Dot.d.ts +10 -0
- package/_internal/Dot.js +2 -10
- package/_internal/Legend.d.ts +10 -0
- package/_internal/Legend.js +2 -10
- package/_internal/Legend3.js +1 -1
- package/_internal/LegendItem.d.ts +21 -0
- package/_internal/LegendItem.js +2 -21
- package/_internal/Line.d.ts +10 -0
- package/_internal/Line.js +2 -10
- package/_internal/LineChart.d.ts +17 -0
- package/_internal/LineChart.js +2 -17
- package/_internal/LineChart2.js +2 -2
- package/_internal/PieChart.d.ts +14 -0
- package/_internal/PieChart.js +2 -14
- package/_internal/PieChart2.js +2 -2
- package/_internal/ScatterPlot.d.ts +17 -0
- package/_internal/ScatterPlot.js +2 -17
- package/_internal/ScatterPlot2.js +2 -2
- package/_internal/axis.d2.ts +48 -0
- package/_internal/{styles.js → styles.d.ts} +1 -1
- package/_internal/{styles10.js → styles.d10.ts} +1 -1
- package/_internal/{styles11.js → styles.d11.ts} +6 -6
- package/_internal/{styles12.js → styles.d12.ts} +4 -4
- package/_internal/{styles13.js → styles.d13.ts} +6 -6
- package/_internal/{styles4.js → styles.d4.ts} +2 -2
- package/_internal/{styles5.js → styles.d5.ts} +7 -7
- package/_internal/{styles6.js → styles.d6.ts} +1 -1
- package/_internal/{styles7.js → styles.d7.ts} +1 -1
- package/_internal/{styles8.js → styles.d8.ts} +2 -2
- package/_internal/{styles9.js → styles.d9.ts} +1 -1
- package/_internal/{types.js → types.d.ts} +1 -1
- package/_internal/{types2.js → types.d2.ts} +1 -1
- package/_internal/{types5.js → types.d5.ts} +1 -1
- package/_internal/{types6.js → types.d6.ts} +2 -2
- package/_internal/{types7.js → types.d7.ts} +1 -1
- package/index.d.ts +129 -0
- package/index.d2.ts +49 -0
- package/index.js +18 -129
- package/index2.js +12 -45
- package/package.json +2 -2
- /package/_internal/{data.js → data.d.ts} +0 -0
- /package/_internal/{scale.js → scale.d.ts} +0 -0
- /package/_internal/{styles2.js → styles.d2.ts} +0 -0
- /package/_internal/{styles3.js → styles.d3.ts} +0 -0
- /package/_internal/{types3.js → types.d3.ts} +0 -0
- /package/_internal/{types4.js → types.d4.ts} +0 -0
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { A as Arc, S as StyledArc } from './styles.js';
|
|
2
|
+
export { A as ArcProps, S as StyledArcProps } from './types.js';
|
|
3
|
+
import '@redsift/design-system';
|
|
4
|
+
import 'styled-components';
|
|
5
|
+
import './types.d4.ts';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@redsift/popovers';
|
|
8
|
+
import 'd3';
|
|
9
|
+
import './data.js';
|
|
10
|
+
import 'd3-shape';
|
package/_internal/Arc.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
export { A as Arc, S as StyledArc } from './
|
|
2
|
-
|
|
3
|
-
import '@redsift/design-system';
|
|
4
|
-
import 'styled-components';
|
|
5
|
-
import './types4.js';
|
|
6
|
-
import 'react';
|
|
7
|
-
import '@redsift/popovers';
|
|
8
|
-
import 'd3';
|
|
9
|
-
import './data.js';
|
|
10
|
-
import 'd3-shape';
|
|
1
|
+
export { A as Arc, S as StyledArc } from './Arc2.js';
|
|
2
|
+
//# sourceMappingURL=Arc.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { A as Arcs, a as ArcsProps, b as StyledArcs, S as StyledArcsProps } from './styles.d2.ts';
|
|
2
|
+
import '@redsift/design-system';
|
|
3
|
+
import 'styled-components';
|
|
4
|
+
import 'react';
|
|
5
|
+
import './types.js';
|
|
6
|
+
import 'd3';
|
|
7
|
+
import './types.d4.ts';
|
|
8
|
+
import '@redsift/popovers';
|
|
9
|
+
import './data.js';
|
|
10
|
+
import 'd3-shape';
|
package/_internal/Arcs.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
export { A as Arcs,
|
|
2
|
-
|
|
3
|
-
import 'styled-components';
|
|
4
|
-
import 'react';
|
|
5
|
-
import './types.js';
|
|
6
|
-
import 'd3';
|
|
7
|
-
import './types4.js';
|
|
8
|
-
import '@redsift/popovers';
|
|
9
|
-
import './data.js';
|
|
10
|
-
import 'd3-shape';
|
|
1
|
+
export { A as Arcs, S as StyledArcs } from './Arcs2.js';
|
|
2
|
+
//# sourceMappingURL=Arcs.js.map
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { A as Axis, S as StyledAxis, g as getAxisType } from './styles.d3.ts';
|
|
2
|
+
export { l as AxisPosition, m as AxisProps, k as AxisVariant, n as StyledAxisProps } from './scale.js';
|
|
3
|
+
import '@redsift/design-system';
|
|
4
|
+
import 'styled-components';
|
|
5
|
+
import '@react-spring/web';
|
|
6
|
+
import 'react';
|
|
7
|
+
import 'd3';
|
|
8
|
+
import 'd3-scale';
|
package/_internal/Axis.js
CHANGED
|
@@ -1,8 +1,2 @@
|
|
|
1
|
-
export { A as Axis, S as StyledAxis, g as getAxisType } from './
|
|
2
|
-
|
|
3
|
-
import '@redsift/design-system';
|
|
4
|
-
import 'styled-components';
|
|
5
|
-
import '@react-spring/web';
|
|
6
|
-
import 'react';
|
|
7
|
-
import 'd3';
|
|
8
|
-
import 'd3-scale';
|
|
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
|
package/_internal/Axis2.js
CHANGED
|
@@ -1,48 +1,388 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
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();
|
|
46
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;
|
|
47
386
|
|
|
48
|
-
export {
|
|
387
|
+
export { Axis as A, StyledAxis as S, AxisVariant as a, AxisPosition as b, getAxisType as g };
|
|
388
|
+
//# sourceMappingURL=Axis2.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { B as Bar, S as StyledBar } from './styles.d4.ts';
|
|
2
|
+
export { a as BarDirection, B as BarOrientation, b as BarProps, S as StyledBarProps } from './types.d2.ts';
|
|
3
|
+
import '@redsift/design-system';
|
|
4
|
+
import 'styled-components';
|
|
5
|
+
import './types.d4.ts';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@redsift/popovers';
|
|
8
|
+
import 'd3';
|
|
9
|
+
import './data.js';
|
|
10
|
+
import 'd3-shape';
|
package/_internal/Bar.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
export { B as Bar, S as StyledBar } from './
|
|
2
|
-
|
|
3
|
-
import '@redsift/design-system';
|
|
4
|
-
import 'styled-components';
|
|
5
|
-
import './types4.js';
|
|
6
|
-
import 'react';
|
|
7
|
-
import '@redsift/popovers';
|
|
8
|
-
import 'd3';
|
|
9
|
-
import './data.js';
|
|
10
|
-
import 'd3-shape';
|
|
1
|
+
export { B as Bar, b as BarDirection, a as BarOrientation, S as StyledBar } from './Bar2.js';
|
|
2
|
+
//# sourceMappingURL=Bar.js.map
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
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 './styles.d5.ts';
|
|
2
|
+
import './types.d3.ts';
|
|
3
|
+
import '@redsift/design-system';
|
|
4
|
+
import 'react';
|
|
5
|
+
import './types.d7.ts';
|
|
6
|
+
import './types.d4.ts';
|
|
7
|
+
import '@redsift/popovers';
|
|
8
|
+
import './data.js';
|
|
9
|
+
import 'd3-shape';
|
|
10
|
+
import './types.d6.ts';
|
|
11
|
+
import './scale.js';
|
|
12
|
+
import 'd3';
|
|
13
|
+
import 'd3-scale';
|
|
14
|
+
import 'styled-components';
|
|
15
|
+
import './types.d2.ts';
|
|
16
|
+
import '../index.d2.ts';
|
|
17
|
+
import './axis.d2.ts';
|
package/_internal/BarChart.js
CHANGED
|
@@ -1,17 +1,2 @@
|
|
|
1
|
-
export { a as BarChart,
|
|
2
|
-
|
|
3
|
-
import '@redsift/design-system';
|
|
4
|
-
import 'react';
|
|
5
|
-
import './types7.js';
|
|
6
|
-
import './types4.js';
|
|
7
|
-
import '@redsift/popovers';
|
|
8
|
-
import './data.js';
|
|
9
|
-
import 'd3-shape';
|
|
10
|
-
import './types6.js';
|
|
11
|
-
import './scale.js';
|
|
12
|
-
import 'd3';
|
|
13
|
-
import 'd3-scale';
|
|
14
|
-
import 'styled-components';
|
|
15
|
-
import './types2.js';
|
|
16
|
-
import '../index2.js';
|
|
17
|
-
import './axis2.js';
|
|
1
|
+
export { a as BarChart, b as BarChartLegendVariant, B as BaseBarChart, S as StyledBarChart, d as StyledBarChartBars, e as StyledBarChartEmptyText, c as StyledBarChartSection } from './BarChart2.js';
|
|
2
|
+
//# sourceMappingURL=BarChart.js.map
|
package/_internal/BarChart2.js
CHANGED
|
@@ -2,15 +2,15 @@ import { _ as _objectWithoutProperties, a as _extends, b as _objectSpread2 } fro
|
|
|
2
2
|
import React__default, { forwardRef, useRef, createContext, useContext, useEffect, useMemo } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { useTheme, useMessageFormatter, Flexbox, Text, isComponent, RedsiftColorGreenD1, RedsiftColorRedD1, RedsiftColorNeutralBlack, useId } from '@redsift/design-system';
|
|
5
|
-
import { L as LegendVariant, T as TooltipVariant } from './legend2.js';
|
|
6
|
-
import { C as ChartSize, g as getSortingMethod, i as isValidDate, u as useColor, m as mergeLegends, a as ColorTheme } from './theme.js';
|
|
7
5
|
import { scaleLinear, sum, scaleBand, extent, scaleUtc, scalePoint, utcParse, scaleLog } from 'd3';
|
|
8
6
|
import styled, { css } from 'styled-components';
|
|
9
7
|
import { C as ChartContainer, a as ChartContainerTitle, b as ChartContainerDescription } from './ChartContainer2.js';
|
|
8
|
+
import { C as ChartSize, g as getSortingMethod, i as isValidDate, u as useColor, m as mergeLegends, a as ColorTheme } from './theme.js';
|
|
10
9
|
import { A as Axis, a as AxisVariant, g as getAxisType } from './Axis2.js';
|
|
11
10
|
import { u as useFormatCategoricalData } from './useFormatCategoricalData.js';
|
|
12
11
|
import { a as BarOrientation, B as Bar, b as BarDirection } from './Bar2.js';
|
|
13
12
|
import { L as Legend } from './Legend3.js';
|
|
13
|
+
import { L as LegendVariant, T as TooltipVariant } from './legend2.js';
|
|
14
14
|
import { L as LegendItem } from './LegendItem2.js';
|
|
15
15
|
|
|
16
16
|
/**
|
|
@@ -0,0 +1,5 @@
|
|
|
1
|
+
export { C as ChartContainer, b as ChartContainerDescription, a as ChartContainerTitle, S as StyledChartContainer, d as StyledChartContainerCaption, c as StyledChartContainerTitle } from './styles.d6.ts';
|
|
2
|
+
export { C as ChartContainerProps, S as StyledChartContainerProps } from './types.d3.ts';
|
|
3
|
+
import 'react';
|
|
4
|
+
import '@redsift/design-system';
|
|
5
|
+
import 'styled-components';
|
|
@@ -1,5 +1,2 @@
|
|
|
1
|
-
export { C as ChartContainer, b as ChartContainerDescription, a as ChartContainerTitle, S as StyledChartContainer, d as StyledChartContainerCaption, c as StyledChartContainerTitle } from './
|
|
2
|
-
|
|
3
|
-
import 'react';
|
|
4
|
-
import '@redsift/design-system';
|
|
5
|
-
import 'styled-components';
|
|
1
|
+
export { C as ChartContainer, b as ChartContainerDescription, a as ChartContainerTitle, S as StyledChartContainer, d as StyledChartContainerCaption, c as StyledChartContainerTitle } from './ChartContainer2.js';
|
|
2
|
+
//# sourceMappingURL=ChartContainer.js.map
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { D as DataPoint, S as StyledDataPoint } from './styles.d7.ts';
|
|
2
|
+
export { A as AnchorProps, D as DataPointProps, S as StyledDataPointProps } from './types.d4.ts';
|
|
3
|
+
import '@redsift/design-system';
|
|
4
|
+
import 'styled-components';
|
|
5
|
+
import '@react-spring/web';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@redsift/popovers';
|
package/_internal/DataPoint.js
CHANGED
|
@@ -1,7 +1,2 @@
|
|
|
1
|
-
export { D as DataPoint, S as StyledDataPoint } from './
|
|
2
|
-
|
|
3
|
-
import '@redsift/design-system';
|
|
4
|
-
import 'styled-components';
|
|
5
|
-
import '@react-spring/web';
|
|
6
|
-
import 'react';
|
|
7
|
-
import '@redsift/popovers';
|
|
1
|
+
export { D as DataPoint, S as StyledDataPoint } from './DataPoint2.js';
|
|
2
|
+
//# sourceMappingURL=DataPoint.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { D as Dot, S as StyledDot } from './styles.d8.ts';
|
|
2
|
+
export { a as DotProps, D as DotVariant, S as StyledDotProps } from './types.d5.ts';
|
|
3
|
+
import '@redsift/design-system';
|
|
4
|
+
import 'styled-components';
|
|
5
|
+
import './types.d4.ts';
|
|
6
|
+
import 'react';
|
|
7
|
+
import '@redsift/popovers';
|
|
8
|
+
import 'd3';
|
|
9
|
+
import './data.js';
|
|
10
|
+
import 'd3-shape';
|
package/_internal/Dot.js
CHANGED
|
@@ -1,10 +1,2 @@
|
|
|
1
|
-
export { D as Dot, S as StyledDot } from './
|
|
2
|
-
|
|
3
|
-
import '@redsift/design-system';
|
|
4
|
-
import 'styled-components';
|
|
5
|
-
import './types4.js';
|
|
6
|
-
import 'react';
|
|
7
|
-
import '@redsift/popovers';
|
|
8
|
-
import 'd3';
|
|
9
|
-
import './data.js';
|
|
10
|
-
import 'd3-shape';
|
|
1
|
+
export { D as Dot, a as DotVariant, S as StyledDot } from './Dot2.js';
|
|
2
|
+
//# sourceMappingURL=Dot.js.map
|