@sproutsocial/seeds-react-data-viz 0.19.0 → 0.21.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.
- package/dist/bar/index.d.mts +20 -4
- package/dist/bar/index.d.ts +20 -4
- package/dist/bar/index.js +56 -24
- package/dist/bar/index.js.map +1 -1
- package/dist/charts.css +583 -0
- package/dist/{chunk-DLO4WZLT.js → chunk-27M4FDNK.js} +14 -14
- package/dist/chunk-27M4FDNK.js.map +1 -0
- package/dist/chunk-46L4YBLC.js +544 -0
- package/dist/chunk-46L4YBLC.js.map +1 -0
- package/dist/{chunk-4IOYAUAK.js → chunk-XYE6O77Z.js} +3 -3
- package/dist/{chunk-4IOYAUAK.js.map → chunk-XYE6O77Z.js.map} +1 -1
- package/dist/donut/index.d.mts +16 -5
- package/dist/donut/index.d.ts +16 -5
- package/dist/donut/index.js +22 -16
- package/dist/donut/index.js.map +1 -1
- package/dist/esm/bar/index.js +44 -12
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/{chunk-J5QE7VCW.js → chunk-KMFRRUTY.js} +2 -2
- package/dist/esm/{chunk-U6ZOSXK7.js → chunk-QSSYSKRP.js} +2 -2
- package/dist/esm/chunk-QSSYSKRP.js.map +1 -0
- package/dist/esm/chunk-XEKQTAUH.js +544 -0
- package/dist/esm/chunk-XEKQTAUH.js.map +1 -0
- package/dist/esm/donut/index.js +19 -13
- package/dist/esm/donut/index.js.map +1 -1
- package/dist/esm/index.js +536 -134
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +36 -13
- package/dist/esm/line-area/index.js.map +1 -1
- package/dist/esm/sparkline/index.js +2 -2
- package/dist/index.js +497 -95
- package/dist/index.js.map +1 -1
- package/dist/interactions-DoWoL7bu.d.mts +29 -0
- package/dist/interactions-DoWoL7bu.d.ts +29 -0
- package/dist/line-area/index.d.mts +17 -4
- package/dist/line-area/index.d.ts +17 -4
- package/dist/line-area/index.js +40 -17
- package/dist/line-area/index.js.map +1 -1
- package/dist/sparkline/index.js +4 -4
- package/package.json +16 -11
- package/dist/chunk-DLO4WZLT.js.map +0 -1
- package/dist/chunk-WEKDYQ4T.js +0 -968
- package/dist/chunk-WEKDYQ4T.js.map +0 -1
- package/dist/esm/chunk-U6ZOSXK7.js.map +0 -1
- package/dist/esm/chunk-Z4LOM4OZ.js +0 -968
- package/dist/esm/chunk-Z4LOM4OZ.js.map +0 -1
- /package/dist/esm/{chunk-J5QE7VCW.js.map → chunk-KMFRRUTY.js.map} +0 -0
|
@@ -0,0 +1,544 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }// src/components/ColorBox/ColorBox.tsx
|
|
2
|
+
var _styledcomponents = require('styled-components'); var _styledcomponents2 = _interopRequireDefault(_styledcomponents);
|
|
3
|
+
var _seedsreactbox = require('@sproutsocial/seeds-react-box');
|
|
4
|
+
|
|
5
|
+
// ../seeds-react-theme-provider/dist/index.mjs
|
|
6
|
+
var _react = require('react');
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
var _seedsreacttheme = require('@sproutsocial/seeds-react-theme');
|
|
12
|
+
var _jsxruntime = require('react/jsx-runtime');
|
|
13
|
+
var GlobalTokenStyles = _styledcomponents.createGlobalStyle`
|
|
14
|
+
:root {
|
|
15
|
+
--color-container-bg-ai-generated: radial-gradient(
|
|
16
|
+
circle at bottom left,
|
|
17
|
+
color-mix(in srgb, #205bc3, transparent 80%) 0%,
|
|
18
|
+
color-mix(in srgb, #6f5ed3, transparent 80%) 61%,
|
|
19
|
+
color-mix(in srgb, #f282f5, transparent 80%) 100%
|
|
20
|
+
), #f3f4f4;
|
|
21
|
+
}
|
|
22
|
+
`;
|
|
23
|
+
|
|
24
|
+
// src/components/ColorBox/ColorBox.tsx
|
|
25
|
+
|
|
26
|
+
|
|
27
|
+
var ColorBox = ({
|
|
28
|
+
display = "inline-block",
|
|
29
|
+
height = "16px",
|
|
30
|
+
width = "16px",
|
|
31
|
+
minWidth = width,
|
|
32
|
+
borderRadius = "400",
|
|
33
|
+
...props
|
|
34
|
+
}) => {
|
|
35
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
36
|
+
_seedsreactbox.Box,
|
|
37
|
+
{
|
|
38
|
+
...props,
|
|
39
|
+
display,
|
|
40
|
+
height,
|
|
41
|
+
width,
|
|
42
|
+
minWidth,
|
|
43
|
+
borderRadius,
|
|
44
|
+
css: _styledcomponents.css`
|
|
45
|
+
cursor: ${(props2) => _optionalChain([props2, 'optionalAccess', _ => _.onClick]) ? "pointer" : "default"};
|
|
46
|
+
`
|
|
47
|
+
}
|
|
48
|
+
);
|
|
49
|
+
};
|
|
50
|
+
|
|
51
|
+
// src/components/ChartLegend/components/ChartLegendLabel.tsx
|
|
52
|
+
|
|
53
|
+
|
|
54
|
+
|
|
55
|
+
var _seedsreacttext = require('@sproutsocial/seeds-react-text');
|
|
56
|
+
|
|
57
|
+
var StyledBox = _styledcomponents2.default.call(void 0, _seedsreactbox.Box)`
|
|
58
|
+
list-style: none;
|
|
59
|
+
display: flex;
|
|
60
|
+
align-items: center;
|
|
61
|
+
gap: ${({ theme: theme5 }) => theme5.space[300]};
|
|
62
|
+
`;
|
|
63
|
+
var ChartLegendLabel = _react.memo.call(void 0,
|
|
64
|
+
function ChartLegendLabel2({
|
|
65
|
+
children,
|
|
66
|
+
color = "#CCC",
|
|
67
|
+
containerBoxProps = {}
|
|
68
|
+
}) {
|
|
69
|
+
return /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, StyledBox, { ...containerBoxProps, children: [
|
|
70
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, ColorBox, { bg: color }),
|
|
71
|
+
/* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text, { as: "div", fontSize: 200, color: "text.subtext", children })
|
|
72
|
+
] });
|
|
73
|
+
}
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
// src/components/ChartLegend/ChartLegend.tsx
|
|
77
|
+
|
|
78
|
+
|
|
79
|
+
|
|
80
|
+
|
|
81
|
+
var ChartLegend = _react.memo.call(void 0, function ChartLegend2({
|
|
82
|
+
legendLabels,
|
|
83
|
+
containerBoxProps = {},
|
|
84
|
+
stacked = false
|
|
85
|
+
}) {
|
|
86
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
87
|
+
_seedsreactbox.Box,
|
|
88
|
+
{
|
|
89
|
+
as: "ul",
|
|
90
|
+
"aria-hidden": "true",
|
|
91
|
+
display: "flex",
|
|
92
|
+
justifyContent: "center",
|
|
93
|
+
flexDirection: stacked ? "column" : "row",
|
|
94
|
+
flexWrap: "wrap",
|
|
95
|
+
columnGap: 450,
|
|
96
|
+
rowGap: 200,
|
|
97
|
+
m: 0,
|
|
98
|
+
p: 0,
|
|
99
|
+
...containerBoxProps,
|
|
100
|
+
children: legendLabels.map(({ color, content }, index) => /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
101
|
+
ChartLegendLabel,
|
|
102
|
+
{
|
|
103
|
+
color: color || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index],
|
|
104
|
+
containerBoxProps: { as: "li" },
|
|
105
|
+
children: content
|
|
106
|
+
},
|
|
107
|
+
`chart-legend-label-${index}`
|
|
108
|
+
))
|
|
109
|
+
}
|
|
110
|
+
);
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
// src/components/ChartTooltip/ChartTooltip.tsx
|
|
114
|
+
|
|
115
|
+
|
|
116
|
+
|
|
117
|
+
|
|
118
|
+
var StyledBox2 = _styledcomponents2.default.call(void 0, _seedsreactbox.Box)`
|
|
119
|
+
.Icon,
|
|
120
|
+
.logo {
|
|
121
|
+
stroke: none;
|
|
122
|
+
}
|
|
123
|
+
`;
|
|
124
|
+
var ChartTooltip = _react.memo.call(void 0, function ChartTooltip2({
|
|
125
|
+
children
|
|
126
|
+
}) {
|
|
127
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
128
|
+
StyledBox2,
|
|
129
|
+
{
|
|
130
|
+
bg: "container.background.base",
|
|
131
|
+
boxShadow: "medium",
|
|
132
|
+
border: 500,
|
|
133
|
+
borderColor: "container.border.base",
|
|
134
|
+
borderRadius: 500,
|
|
135
|
+
p: 400,
|
|
136
|
+
minWidth: 285,
|
|
137
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreactbox.Box, { display: "flex", flexDirection: "column", gap: 350, children })
|
|
138
|
+
}
|
|
139
|
+
);
|
|
140
|
+
});
|
|
141
|
+
|
|
142
|
+
// src/components/ChartTooltip/components/ChartTooltipFooter.tsx
|
|
143
|
+
|
|
144
|
+
|
|
145
|
+
|
|
146
|
+
var ChartTooltipFooter = _react.memo.call(void 0,
|
|
147
|
+
function ChartTooltipFooter2({ children }) {
|
|
148
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
149
|
+
_seedsreactbox.Box,
|
|
150
|
+
{
|
|
151
|
+
borderTop: 500,
|
|
152
|
+
borderColor: "container.border.base",
|
|
153
|
+
mx: -400,
|
|
154
|
+
mb: -200,
|
|
155
|
+
px: 400,
|
|
156
|
+
pt: 350,
|
|
157
|
+
children
|
|
158
|
+
}
|
|
159
|
+
);
|
|
160
|
+
}
|
|
161
|
+
);
|
|
162
|
+
|
|
163
|
+
// src/components/ChartTooltip/components/ChartTooltipHeader.tsx
|
|
164
|
+
|
|
165
|
+
|
|
166
|
+
|
|
167
|
+
var ChartTooltipHeader = _react.memo.call(void 0,
|
|
168
|
+
function ChartTooltipHeader2({ children }) {
|
|
169
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
170
|
+
_seedsreactbox.Box,
|
|
171
|
+
{
|
|
172
|
+
borderBottom: 500,
|
|
173
|
+
borderColor: "container.border.base",
|
|
174
|
+
mx: -400,
|
|
175
|
+
mt: -200,
|
|
176
|
+
px: 400,
|
|
177
|
+
pb: 350,
|
|
178
|
+
children
|
|
179
|
+
}
|
|
180
|
+
);
|
|
181
|
+
}
|
|
182
|
+
);
|
|
183
|
+
|
|
184
|
+
// src/components/ChartTooltip/components/ChartTooltipPortal.tsx
|
|
185
|
+
|
|
186
|
+
var _reactdom = require('react-dom');
|
|
187
|
+
var generateChartTooltipPortalId = (chartId) => `highcharts-custom-tooltip-${chartId}`;
|
|
188
|
+
var ChartTooltipPortal = _react.memo.call(void 0,
|
|
189
|
+
function ChartTooltipPortal2({
|
|
190
|
+
chart,
|
|
191
|
+
renderContent
|
|
192
|
+
}) {
|
|
193
|
+
const isInitialized = _react.useRef.call(void 0, false);
|
|
194
|
+
const [node, setNode] = _react.useState.call(void 0, null);
|
|
195
|
+
const [context, setContext] = _react.useState.call(void 0, null);
|
|
196
|
+
_react.useEffect.call(void 0, () => {
|
|
197
|
+
const formatter = function() {
|
|
198
|
+
if (!isInitialized.current) {
|
|
199
|
+
isInitialized.current = true;
|
|
200
|
+
chart.tooltip.refresh.apply(chart.tooltip, [this.point]);
|
|
201
|
+
chart.tooltip.hide(0);
|
|
202
|
+
}
|
|
203
|
+
setContext(this);
|
|
204
|
+
return `<div id="${generateChartTooltipPortalId(
|
|
205
|
+
chart.index
|
|
206
|
+
)}" role='tooltip'></div>`;
|
|
207
|
+
};
|
|
208
|
+
chart.update({ tooltip: { formatter } });
|
|
209
|
+
}, [chart]);
|
|
210
|
+
_react.useEffect.call(void 0, () => {
|
|
211
|
+
if (_optionalChain([context, 'optionalAccess', _2 => _2.series, 'optionalAccess', _3 => _3.chart, 'optionalAccess', _4 => _4.tooltip])) {
|
|
212
|
+
const tooltip = context.series.chart.tooltip;
|
|
213
|
+
const textElement = tooltip.label.text.element;
|
|
214
|
+
tooltip.label.box.attr({
|
|
215
|
+
height: textElement.offsetHeight,
|
|
216
|
+
width: textElement.offsetWidth
|
|
217
|
+
});
|
|
218
|
+
setNode(
|
|
219
|
+
document.getElementById(generateChartTooltipPortalId(chart.index))
|
|
220
|
+
);
|
|
221
|
+
}
|
|
222
|
+
}, [context, chart.index]);
|
|
223
|
+
return node && context ? _reactdom.createPortal.call(void 0, renderContent(context), node) : null;
|
|
224
|
+
}
|
|
225
|
+
);
|
|
226
|
+
|
|
227
|
+
// src/components/ChartTable/ChartTable.tsx
|
|
228
|
+
|
|
229
|
+
|
|
230
|
+
|
|
231
|
+
var _seedsreacttable = require('@sproutsocial/seeds-react-table');
|
|
232
|
+
|
|
233
|
+
var StyledSeedsTable = _styledcomponents2.default.call(void 0, _seedsreacttable.Table)`
|
|
234
|
+
tbody tr:last-child {
|
|
235
|
+
border-bottom: none;
|
|
236
|
+
}
|
|
237
|
+
tr:last-child td,
|
|
238
|
+
tr:last-child th {
|
|
239
|
+
padding-bottom: 0;
|
|
240
|
+
}
|
|
241
|
+
tr:first-child td,
|
|
242
|
+
tr:first-child th {
|
|
243
|
+
padding-top: 0;
|
|
244
|
+
}
|
|
245
|
+
tr th {
|
|
246
|
+
padding-left: 0;
|
|
247
|
+
}
|
|
248
|
+
tr td:last-child {
|
|
249
|
+
padding-right: 0;
|
|
250
|
+
}
|
|
251
|
+
`;
|
|
252
|
+
var StyledSeedsTableRow = _styledcomponents2.default.call(void 0, _seedsreacttable.Table.TableRow)`
|
|
253
|
+
${({ $isAppendedRow, theme: theme5 }) => $isAppendedRow ? `border-top: 2px solid ${theme5.colors.container.border.base}` : ""}
|
|
254
|
+
`;
|
|
255
|
+
var ChartTable = _react.memo.call(void 0, function ChartTable2({
|
|
256
|
+
rows
|
|
257
|
+
}) {
|
|
258
|
+
if (!rows || rows.length === 0) {
|
|
259
|
+
return null;
|
|
260
|
+
}
|
|
261
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, StyledSeedsTable, { children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttable.Table.TableBody, { children: rows.map(({ cells, isAppendedRow }, rowIndex) => {
|
|
262
|
+
if (!cells || cells.length === 0) {
|
|
263
|
+
return null;
|
|
264
|
+
}
|
|
265
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
266
|
+
StyledSeedsTableRow,
|
|
267
|
+
{
|
|
268
|
+
$isAppendedRow: isAppendedRow,
|
|
269
|
+
children: cells.map(
|
|
270
|
+
({ content, align = "left", colSpan = 1 }, cellIndex) => {
|
|
271
|
+
const uniqueIdentifier = `chart-tooltip-table-cell-${cellIndex}`;
|
|
272
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0,
|
|
273
|
+
_seedsreacttable.Table.Cell,
|
|
274
|
+
{
|
|
275
|
+
id: uniqueIdentifier,
|
|
276
|
+
scope: cellIndex === 0 ? "row" : void 0,
|
|
277
|
+
align,
|
|
278
|
+
colSpan,
|
|
279
|
+
py: 200,
|
|
280
|
+
children: /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text.SmallBodyCopy, { as: "div", children: content })
|
|
281
|
+
},
|
|
282
|
+
uniqueIdentifier
|
|
283
|
+
);
|
|
284
|
+
}
|
|
285
|
+
)
|
|
286
|
+
},
|
|
287
|
+
`chart-tooltip-table-row-${rowIndex}`
|
|
288
|
+
);
|
|
289
|
+
}) }) });
|
|
290
|
+
});
|
|
291
|
+
|
|
292
|
+
// src/components/ChartTooltip/components/ChartTooltipTable.tsx
|
|
293
|
+
|
|
294
|
+
|
|
295
|
+
var ChartTooltipTable = _react.memo.call(void 0,
|
|
296
|
+
function ChartTooltipTable2({ rows }) {
|
|
297
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, ChartTable, { rows });
|
|
298
|
+
}
|
|
299
|
+
);
|
|
300
|
+
|
|
301
|
+
// src/components/ChartTooltip/components/ChartTooltipTitle.tsx
|
|
302
|
+
|
|
303
|
+
|
|
304
|
+
|
|
305
|
+
var ChartTooltipTitle = _react.memo.call(void 0,
|
|
306
|
+
function ChartTooltipTitle2({ children }) {
|
|
307
|
+
return /* @__PURE__ */ _jsxruntime.jsx.call(void 0, _seedsreacttext.Text.SmallSubHeadline, { as: "p", children });
|
|
308
|
+
}
|
|
309
|
+
);
|
|
310
|
+
|
|
311
|
+
// src/helpers/transformTimeSeriesTooltipData.ts
|
|
312
|
+
|
|
313
|
+
var transformTimeSeriesTooltipData = ({
|
|
314
|
+
context,
|
|
315
|
+
data
|
|
316
|
+
}) => {
|
|
317
|
+
return (context.series.chart.series || []).map((series, index) => {
|
|
318
|
+
const pointIndex = context.point.index;
|
|
319
|
+
const y = _optionalChain([series, 'optionalAccess', _5 => _5.points, 'optionalAccess', _6 => _6[pointIndex], 'optionalAccess', _7 => _7.y]);
|
|
320
|
+
return {
|
|
321
|
+
color: _optionalChain([data, 'access', _8 => _8[index], 'optionalAccess', _9 => _9.styles, 'optionalAccess', _10 => _10.color]) || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index],
|
|
322
|
+
..._optionalChain([data, 'access', _11 => _11[index], 'optionalAccess', _12 => _12.icon]) ? { icon: _optionalChain([data, 'access', _13 => _13[index], 'optionalAccess', _14 => _14.icon]) } : {},
|
|
323
|
+
name: series.name,
|
|
324
|
+
value: typeof y === "number" ? y : null
|
|
325
|
+
};
|
|
326
|
+
});
|
|
327
|
+
};
|
|
328
|
+
|
|
329
|
+
// src/styles/chartStyles.ts
|
|
330
|
+
|
|
331
|
+
|
|
332
|
+
require('highcharts/css/highcharts.css');
|
|
333
|
+
var GlobalChartStyleOverrides = _styledcomponents.createGlobalStyle`
|
|
334
|
+
// USAGE NOTE:
|
|
335
|
+
// Put general styles in baseChartStyles instead when possible to avoid excessive global styling.
|
|
336
|
+
// This global component is only for styles that can't override highcharts defaults when scoped.
|
|
337
|
+
|
|
338
|
+
.highcharts-tooltip-container {
|
|
339
|
+
z-index: 7 !important;
|
|
340
|
+
}
|
|
341
|
+
.highcharts-tooltip-box {
|
|
342
|
+
fill: transparent !important;
|
|
343
|
+
}
|
|
344
|
+
`;
|
|
345
|
+
var baseChartStyles = _styledcomponents.css`
|
|
346
|
+
--highcharts-background-color: ${({ theme: theme5 }) => theme5.colors.container.background.base};
|
|
347
|
+
|
|
348
|
+
// set color variables and map to each series
|
|
349
|
+
${({ $colors }) => $colors.map((color, index) => {
|
|
350
|
+
const chartColor = color || _seedsreacttheme.theme.colors.DATAVIZ_COLORS_LIST[index];
|
|
351
|
+
return `
|
|
352
|
+
// map colors to custom assigned colors or fallback to default data viz color rotation
|
|
353
|
+
--highcharts-color-${index}: ${chartColor};
|
|
354
|
+
|
|
355
|
+
// highcharts already accounts for 10 series, but if we have more, we need to add them
|
|
356
|
+
.highcharts-color-${index} {
|
|
357
|
+
color: var(--highcharts-color-${index});
|
|
358
|
+
stroke: var(--highcharts-color-${index});
|
|
359
|
+
fill: var(--highcharts-color-${index});
|
|
360
|
+
}`;
|
|
361
|
+
}).join("\n")}
|
|
362
|
+
|
|
363
|
+
// set overall chart background color
|
|
364
|
+
.highcharts-background {
|
|
365
|
+
fill: ${({ theme: theme5 }) => theme5.colors.container.background.base};
|
|
366
|
+
}
|
|
367
|
+
|
|
368
|
+
g.highcharts-annotation-label {
|
|
369
|
+
display: none;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
div.highcharts-annotation-label {
|
|
373
|
+
top: 0 !important;
|
|
374
|
+
transform: translateX(-50%); // centers the label on the targeted axis point
|
|
375
|
+
pointer-events: none; // prevents tooltip hover from being interrupted by this element since it renders after on the dom
|
|
376
|
+
}
|
|
377
|
+
`;
|
|
378
|
+
var timeSeriesChartStyles = _styledcomponents.css`
|
|
379
|
+
${baseChartStyles}
|
|
380
|
+
|
|
381
|
+
// vertical crosshair styles
|
|
382
|
+
.highcharts-crosshair {
|
|
383
|
+
stroke: ${({ theme: theme5 }) => theme5.colors.container.border.decorative.neutral};
|
|
384
|
+
stroke-width: 1;
|
|
385
|
+
}
|
|
386
|
+
|
|
387
|
+
// axis and gridline styles
|
|
388
|
+
.highcharts-grid-line {
|
|
389
|
+
stroke: ${({ theme: theme5 }) => theme5.colors.container.border.base};
|
|
390
|
+
}
|
|
391
|
+
|
|
392
|
+
.highcharts-axis-line {
|
|
393
|
+
stroke: ${({ theme: theme5 }) => theme5.colors.container.border.base};
|
|
394
|
+
}
|
|
395
|
+
|
|
396
|
+
.highcharts-tick {
|
|
397
|
+
stroke: none;
|
|
398
|
+
}
|
|
399
|
+
.highcharts-xaxis-labels,
|
|
400
|
+
.highcharts-yaxis-labels {
|
|
401
|
+
// v1 HTML labels (useHTML: true). v2 SVG label styles live in
|
|
402
|
+
// charts/shared/styles.ts (axisLabelV2Styles) — don't add v2 rules here.
|
|
403
|
+
> span {
|
|
404
|
+
font-family: ${({ theme: theme5 }) => theme5.fontFamily};
|
|
405
|
+
${({ theme: theme5 }) => theme5.typography[100]};
|
|
406
|
+
font-weight: ${({ theme: theme5 }) => theme5.fontWeights.normal};
|
|
407
|
+
color: ${({ theme: theme5 }) => theme5.colors.text.subtext};
|
|
408
|
+
}
|
|
409
|
+
}
|
|
410
|
+
.highcharts-xaxis-labels {
|
|
411
|
+
// v1 HTML stacked labels (useHTML: true). v2 SVG stacked-label styles live
|
|
412
|
+
// in charts/shared/styles.ts (axisLabelV2Styles).
|
|
413
|
+
> span {
|
|
414
|
+
display: flex;
|
|
415
|
+
flex-direction: column;
|
|
416
|
+
align-items: center;
|
|
417
|
+
> span:nth-of-type(2) {
|
|
418
|
+
font-weight: ${({ theme: theme5 }) => theme5.fontWeights.semibold};
|
|
419
|
+
}
|
|
420
|
+
}
|
|
421
|
+
}
|
|
422
|
+
|
|
423
|
+
// we don't want to drop the opacity when another item is hovered
|
|
424
|
+
.highcharts-series-inactive {
|
|
425
|
+
opacity: 1;
|
|
426
|
+
}
|
|
427
|
+
|
|
428
|
+
// apply cursor pointer when click functionality is turned on
|
|
429
|
+
${({ $hasOnClick }) => $hasOnClick && `
|
|
430
|
+
.highcharts-series,
|
|
431
|
+
.highcharts-point {
|
|
432
|
+
cursor: pointer;
|
|
433
|
+
}
|
|
434
|
+
.highcharts-plot-background,
|
|
435
|
+
.highcharts-crosshair,
|
|
436
|
+
.highcharts-grid-line {
|
|
437
|
+
fill: transparent;
|
|
438
|
+
cursor: pointer;
|
|
439
|
+
}`}
|
|
440
|
+
|
|
441
|
+
path.highcharts-plot-line.y-axis-zero-line {
|
|
442
|
+
stroke: ${({ theme: theme5 }) => theme5.colors.container.border.decorative.neutral};
|
|
443
|
+
}
|
|
444
|
+
`;
|
|
445
|
+
var lineChartStyles = _styledcomponents.css`
|
|
446
|
+
${timeSeriesChartStyles}
|
|
447
|
+
|
|
448
|
+
// set the line stroke
|
|
449
|
+
.highcharts-graph {
|
|
450
|
+
stroke-width: 3;
|
|
451
|
+
}
|
|
452
|
+
|
|
453
|
+
// dashed line styles
|
|
454
|
+
${({ $patterns }) => $patterns.map((pattern, index) => {
|
|
455
|
+
return pattern === "dashed" ? `
|
|
456
|
+
// highcharts already accounts for 10 series, but if we have more, we need to add them
|
|
457
|
+
.highcharts-series-${index} {
|
|
458
|
+
stroke-dasharray: 2, 8;
|
|
459
|
+
}` : "";
|
|
460
|
+
})}
|
|
461
|
+
`;
|
|
462
|
+
var areaChartStyles = _styledcomponents.css`
|
|
463
|
+
${timeSeriesChartStyles}
|
|
464
|
+
|
|
465
|
+
// don't need to show a stroke for the line part of each area
|
|
466
|
+
.highcharts-graph {
|
|
467
|
+
stroke-width: 0;
|
|
468
|
+
}
|
|
469
|
+
|
|
470
|
+
// fill areas to full opacity
|
|
471
|
+
.highcharts-area {
|
|
472
|
+
fill-opacity: 1;
|
|
473
|
+
}
|
|
474
|
+
`;
|
|
475
|
+
var donutChartStyles = _styledcomponents.css`
|
|
476
|
+
${baseChartStyles}
|
|
477
|
+
|
|
478
|
+
// remove 250ms fade in/out when hovering over different donut chart slices
|
|
479
|
+
.highcharts-point {
|
|
480
|
+
transition: opacity 0s;
|
|
481
|
+
}
|
|
482
|
+
|
|
483
|
+
// remove stroke on donut slices
|
|
484
|
+
.highcharts-pie-series .highcharts-point {
|
|
485
|
+
stroke: none;
|
|
486
|
+
}
|
|
487
|
+
|
|
488
|
+
// don't reduce opacity when hovering
|
|
489
|
+
.highcharts-point-hover {
|
|
490
|
+
fill-opacity: none;
|
|
491
|
+
}
|
|
492
|
+
|
|
493
|
+
// apply cursor pointer when click functionality is turned on
|
|
494
|
+
${({ $hasOnClick }) => $hasOnClick && `
|
|
495
|
+
.highcharts-series,
|
|
496
|
+
.highcharts-point {
|
|
497
|
+
cursor: pointer;
|
|
498
|
+
}
|
|
499
|
+
.highcharts-plot-background,
|
|
500
|
+
.highcharts-crosshair,
|
|
501
|
+
.highcharts-grid-line {
|
|
502
|
+
fill: transparent;
|
|
503
|
+
cursor: pointer;
|
|
504
|
+
}`}
|
|
505
|
+
`;
|
|
506
|
+
|
|
507
|
+
// src/components/ChartLegend/components/ChartLegendLabelContentWithIcon.tsx
|
|
508
|
+
|
|
509
|
+
|
|
510
|
+
|
|
511
|
+
var ChartLegendLabelContentWithIcon = _react.memo.call(void 0,
|
|
512
|
+
function ChartLegendLabelContentWithIcon2({
|
|
513
|
+
children,
|
|
514
|
+
icon
|
|
515
|
+
}) {
|
|
516
|
+
return icon ? /* @__PURE__ */ _jsxruntime.jsxs.call(void 0, _seedsreactbox.Box, { display: "flex", alignItems: "center", gap: 200, children: [
|
|
517
|
+
icon,
|
|
518
|
+
children
|
|
519
|
+
] }) : children;
|
|
520
|
+
}
|
|
521
|
+
);
|
|
522
|
+
|
|
523
|
+
|
|
524
|
+
|
|
525
|
+
|
|
526
|
+
|
|
527
|
+
|
|
528
|
+
|
|
529
|
+
|
|
530
|
+
|
|
531
|
+
|
|
532
|
+
|
|
533
|
+
|
|
534
|
+
|
|
535
|
+
|
|
536
|
+
|
|
537
|
+
|
|
538
|
+
|
|
539
|
+
|
|
540
|
+
|
|
541
|
+
|
|
542
|
+
|
|
543
|
+
exports.ColorBox = ColorBox; exports.ChartLegendLabel = ChartLegendLabel; exports.ChartLegend = ChartLegend; exports.ChartLegendLabelContentWithIcon = ChartLegendLabelContentWithIcon; exports.ChartTooltip = ChartTooltip; exports.ChartTooltipFooter = ChartTooltipFooter; exports.ChartTooltipHeader = ChartTooltipHeader; exports.generateChartTooltipPortalId = generateChartTooltipPortalId; exports.ChartTooltipPortal = ChartTooltipPortal; exports.ChartTable = ChartTable; exports.ChartTooltipTable = ChartTooltipTable; exports.ChartTooltipTitle = ChartTooltipTitle; exports.transformTimeSeriesTooltipData = transformTimeSeriesTooltipData; exports.GlobalChartStyleOverrides = GlobalChartStyleOverrides; exports.baseChartStyles = baseChartStyles; exports.timeSeriesChartStyles = timeSeriesChartStyles; exports.lineChartStyles = lineChartStyles; exports.areaChartStyles = areaChartStyles; exports.donutChartStyles = donutChartStyles;
|
|
544
|
+
//# sourceMappingURL=chunk-46L4YBLC.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-46L4YBLC.js","../src/components/ColorBox/ColorBox.tsx","../../seeds-react-theme-provider/src/index.tsx","../src/components/ChartLegend/components/ChartLegendLabel.tsx","../src/components/ChartLegend/ChartLegend.tsx","../src/components/ChartTooltip/ChartTooltip.tsx","../src/components/ChartTooltip/components/ChartTooltipFooter.tsx","../src/components/ChartTooltip/components/ChartTooltipHeader.tsx","../src/components/ChartTooltip/components/ChartTooltipPortal.tsx","../src/components/ChartTable/ChartTable.tsx","../src/components/ChartTooltip/components/ChartTooltipTable.tsx","../src/components/ChartTooltip/components/ChartTooltipTitle.tsx","../src/helpers/transformTimeSeriesTooltipData.ts","../src/styles/chartStyles.ts","../src/components/ChartLegend/components/ChartLegendLabelContentWithIcon.tsx"],"names":["jsx","props","theme","ChartLegendLabel","jsxs","memo","ChartLegend","Box"],"mappings":"AAAA;ACAA,yHAAkC;AAClC,8DAAuC;ADEvC;AACA;AEJA,8BAAuB;AACvB;AACE;AACA;AFMF;AEJA,kEAAsB;AA6BpB,+CAAA;AAZF,IAAM,kBAAA,EAAoB,mCAAA,CAAA;AFT1B;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,CAAC;AACD;AACA;ACpBA;AAgBI;AATG,IAAM,SAAA,EAAW,CAAC;AAAA,EACvB,QAAA,EAAU,cAAA;AAAA,EACV,OAAA,EAAS,MAAA;AAAA,EACT,MAAA,EAAQ,MAAA;AAAA,EACR,SAAA,EAAW,KAAA;AAAA,EACX,aAAA,EAAe,KAAA;AAAA,EACf,GAAG;AACL,CAAA,EAAA,GAAyB;AACvB,EAAA,uBACEA,6BAAAA;AAAA,IAAC,kBAAA;AAAA,IAAA;AAAA,MACE,GAAG,KAAA;AAAA,MACJ,OAAA;AAAA,MACA,MAAA;AAAA,MACA,KAAA;AAAA,MACA,QAAA;AAAA,MACA,YAAA;AAAA,MACA,GAAA,EACE,qBAAA,CAAA;AAAA,kBAAA,EACY,CACRC,MAAAA,EAAAA,mBAGIA,MAAAA,2BAAO,UAAA,EAAU,UAAA,EAAY,SAAU,CAAA;AAAA,QAAA;AAAA,IAAA;AAAA,EAGnD,CAAA;AAEJ,CAAA;ADYA;AACA;AGlDA;AACA;AACA;AACA,gEAAqB;AA2Bf;AArBN,IAAM,UAAA,EAAY,wCAAA,kBAAU,CAAA,CAAA;AAAA;AAAA;AAAA;AAAA,OAAA,EAInB,CAAC,EAAE,KAAA,EAAAC,OAAM,CAAA,EAAA,GAAMA,MAAAA,CAAM,KAAA,CAAM,GAAG,CAAC,CAAA;AAAA,CAAA;AAUjC,IAAM,iBAAA,EAAmB,yBAAA;AAAA,EAC9B,SAASC,iBAAAA,CAAiB;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AAEK,MAAA;AAAA,MAAA;AACA,IAAA;AAGH,EAAA;AAGN;AdifF;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-46L4YBLC.js","sourcesContent":[null,"import { css, type CSSProp } from \"styled-components\";\nimport { Box, type TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\nimport ThemeProvider from \"@sproutsocial/seeds-react-theme-provider\";\nimport { type TypeSproutTheme } from \"@sproutsocial/seeds-react-theme\";\n\nexport type TypeColorBoxProps = TypeBoxProps;\n\n/**\n * ColorBox extends Box to apply basic styles.\n */\nexport const ColorBox = ({\n display = \"inline-block\",\n height = \"16px\",\n width = \"16px\",\n minWidth = width,\n borderRadius = \"400\",\n ...props\n}: TypeColorBoxProps) => {\n return (\n <Box\n {...props}\n display={display}\n height={height}\n width={width}\n minWidth={minWidth}\n borderRadius={borderRadius}\n css={\n css`\n cursor: ${(\n props: typeof ThemeProvider & {\n onClick: ((e: React.MouseEvent<HTMLElement>) => void) | void;\n }\n ) => (props?.onClick ? \"pointer\" : \"default\")};\n ` as CSSProp<TypeSproutTheme>\n }\n />\n );\n};\n","import * as React from \"react\";\nimport {\n ThemeProvider as BaseThemeProvider,\n createGlobalStyle,\n} from \"styled-components\";\nimport { theme } from \"@sproutsocial/seeds-react-theme\";\nimport type {\n TypeSproutTheme,\n TypeTheme,\n} from \"@sproutsocial/seeds-react-theme\";\n\n// We can append additional themes types here\ntype TypeAllThemes = TypeTheme | TypeSproutTheme;\n\ntype TypeProps = {\n readonly theme?: TypeAllThemes;\n readonly children?: React.ReactNode;\n};\n\n// CSS custom properties for token values that cannot be represented in SCSS maps\n// (e.g. radial-gradient + color-mix). These are injected here so styled-components\n// consumers get the values without needing to load the compiled SCSS theme CSS.\nconst GlobalTokenStyles = createGlobalStyle`\n :root {\n --color-container-bg-ai-generated: radial-gradient(\n circle at bottom left,\n color-mix(in srgb, #205bc3, transparent 80%) 0%,\n color-mix(in srgb, #6f5ed3, transparent 80%) 61%,\n color-mix(in srgb, #f282f5, transparent 80%) 100%\n ), #f3f4f4;\n }\n`;\n\nconst ThemeProvider = (props: TypeProps) => (\n <BaseThemeProvider {...props} theme={props.theme || theme}>\n <GlobalTokenStyles />\n {props.children}\n </BaseThemeProvider>\n);\n\nexport default ThemeProvider;\n","import styled from \"styled-components\";\nimport { memo } from \"react\";\nimport { Box, type TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\n\nimport type { TypeLegendLabel } from \"../ChartLegend\";\n\nimport { ColorBox } from \"../../ColorBox\";\n\nconst StyledBox = styled(Box)<TypeBoxProps>`\n list-style: none;\n display: flex;\n align-items: center;\n gap: ${({ theme }) => theme.space[300]};\n`;\n\nexport type TypeChartLegendLabelProps = Readonly<{\n children: TypeLegendLabel[\"content\"];\n color: TypeLegendLabel[\"color\"];\n // optional\n containerBoxProps?: TypeBoxProps;\n}>;\n\nexport const ChartLegendLabel = memo<TypeChartLegendLabelProps>(\n function ChartLegendLabel({\n children,\n color = \"#CCC\",\n containerBoxProps = {},\n }: TypeChartLegendLabelProps) {\n return (\n <StyledBox {...containerBoxProps}>\n <ColorBox bg={color} />\n <Text as=\"div\" fontSize={200} color=\"text.subtext\">\n {children}\n </Text>\n </StyledBox>\n );\n }\n);\n","import { memo } from \"react\";\nimport { Box, type TypeBoxProps } from \"@sproutsocial/seeds-react-box\";\nimport { theme } from \"@sproutsocial/seeds-react-theme\";\n\nimport { ChartLegendLabel } from \"./components/ChartLegendLabel\";\n\nexport type TypeLegendLabel = Readonly<{\n content: React.ReactNode;\n color?: string;\n}>;\n\nexport type TypeChartLegendProps = Readonly<{\n legendLabels: ReadonlyArray<TypeLegendLabel>;\n // optional\n containerBoxProps?: TypeBoxProps;\n stacked?: boolean;\n}>;\n\nexport const ChartLegend = memo<TypeChartLegendProps>(function ChartLegend({\n legendLabels,\n containerBoxProps = {},\n stacked = false,\n}: TypeChartLegendProps) {\n return (\n <Box\n as=\"ul\"\n aria-hidden=\"true\"\n display=\"flex\"\n justifyContent=\"center\"\n flexDirection={stacked ? \"column\" : \"row\"}\n flexWrap=\"wrap\"\n columnGap={450}\n rowGap={200}\n m={0}\n p={0}\n {...containerBoxProps}\n >\n {legendLabels.map(({ color, content }, index) => (\n <ChartLegendLabel\n key={`chart-legend-label-${index}`}\n color={color || theme.colors.DATAVIZ_COLORS_LIST[index]}\n containerBoxProps={{ as: \"li\" }}\n >\n {content}\n </ChartLegendLabel>\n ))}\n </Box>\n );\n});\n","import { memo } from \"react\";\nimport styled from \"styled-components\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\n\n// styled components\nconst StyledBox = styled(Box)`\n .Icon,\n .logo {\n stroke: none;\n }\n`;\n\n// Chart Tooltip\ntype TypeChartTooltipProps = Readonly<{\n children: React.ReactNode;\n}>;\n\nexport const ChartTooltip = memo<TypeChartTooltipProps>(function ChartTooltip({\n children,\n}: TypeChartTooltipProps) {\n return (\n <StyledBox\n bg=\"container.background.base\"\n boxShadow=\"medium\"\n border={500}\n borderColor=\"container.border.base\"\n borderRadius={500}\n p={400}\n minWidth={285}\n >\n <Box display=\"flex\" flexDirection=\"column\" gap={350}>\n {children}\n </Box>\n </StyledBox>\n );\n});\n","import { memo } from \"react\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\n\ntype TypeChartTooltipFooterProps = {\n children: React.ReactNode;\n};\n\nexport const ChartTooltipFooter = memo<TypeChartTooltipFooterProps>(\n function ChartTooltipFooter({ children }: TypeChartTooltipFooterProps) {\n return (\n <Box\n borderTop={500}\n borderColor=\"container.border.base\"\n mx={-400}\n mb={-200}\n px={400}\n pt={350}\n >\n {children}\n </Box>\n );\n }\n);\n","import { memo } from \"react\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\n\ntype TypeChartTooltipHeaderProps = {\n children: React.ReactNode;\n};\n\nexport const ChartTooltipHeader = memo<TypeChartTooltipHeaderProps>(\n function ChartTooltipHeader({ children }: TypeChartTooltipHeaderProps) {\n return (\n <Box\n borderBottom={500}\n borderColor=\"container.border.base\"\n mx={-400}\n mt={-200}\n px={400}\n pb={350}\n >\n {children}\n </Box>\n );\n }\n);\n","import { memo, useState, useRef, useEffect, type ReactNode } from \"react\";\nimport { createPortal } from \"react-dom\";\nimport type {\n Tooltip,\n Chart,\n TooltipFormatterContextObject,\n TooltipFormatterCallbackFunction,\n} from \"highcharts\";\n\ninterface ExtendedHighchartsTooltip extends Tooltip {\n label: {\n box: { attr({ height, width }: { height: number; width: number }): void };\n text: { element: HTMLElement };\n };\n}\n\nexport const generateChartTooltipPortalId = (chartId: number) =>\n `highcharts-custom-tooltip-${chartId}`;\n\ntype ChartTooltipPortalProps = Readonly<{\n chart: Chart;\n renderContent: (_context: TooltipFormatterContextObject) => ReactNode;\n}>;\n\nexport const ChartTooltipPortal = memo<ChartTooltipPortalProps>(\n function ChartTooltipPortal({\n chart,\n renderContent,\n }: ChartTooltipPortalProps) {\n const isInitialized = useRef<boolean>(false);\n const [node, setNode] = useState<HTMLElement | null>(null);\n const [context, setContext] =\n useState<TooltipFormatterContextObject | null>(null);\n\n useEffect(() => {\n const formatter: TooltipFormatterCallbackFunction = function () {\n // Ensures that tooltip DOM container is rendered before React portal is created.\n if (!isInitialized.current) {\n isInitialized.current = true;\n chart.tooltip.refresh.apply(chart.tooltip, [this.point]);\n chart.tooltip.hide(0);\n }\n\n setContext(this);\n\n return `<div id=\"${generateChartTooltipPortalId(\n chart.index\n )}\" role='tooltip'></div>`;\n };\n\n chart.update({ tooltip: { formatter } });\n }, [chart]);\n\n useEffect(() => {\n // In some cases tooltip is not available on the chart yet\n if (context?.series?.chart?.tooltip) {\n const tooltip = context.series.chart\n .tooltip as ExtendedHighchartsTooltip;\n const textElement = tooltip.label.text.element;\n\n tooltip.label.box.attr({\n height: textElement.offsetHeight,\n width: textElement.offsetWidth,\n });\n\n setNode(\n document.getElementById(generateChartTooltipPortalId(chart.index))\n );\n }\n }, [context, chart.index]);\n\n return node && context ? createPortal(renderContent(context), node) : null;\n }\n);\n","import { memo } from \"react\";\nimport styled from \"styled-components\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\nimport { Table as SeedsTable } from \"@sproutsocial/seeds-react-table\";\n\nconst StyledSeedsTable = styled<typeof SeedsTable>(SeedsTable)`\n tbody tr:last-child {\n border-bottom: none;\n }\n tr:last-child td,\n tr:last-child th {\n padding-bottom: 0;\n }\n tr:first-child td,\n tr:first-child th {\n padding-top: 0;\n }\n tr th {\n padding-left: 0;\n }\n tr td:last-child {\n padding-right: 0;\n }\n`;\n\nconst StyledSeedsTableRow = styled(SeedsTable.TableRow)<{\n $isAppendedRow?: boolean;\n}>`\n ${({ $isAppendedRow, theme }) =>\n $isAppendedRow\n ? `border-top: 2px solid ${theme.colors.container.border.base}`\n : \"\"}\n`;\n\nexport type TypeChartTableProps = Readonly<{\n rows: ReadonlyArray<{\n cells: ReadonlyArray<{\n content: React.ReactNode;\n align?: React.ComponentProps<typeof SeedsTable.Cell>[\"align\"];\n colSpan?: React.ComponentProps<typeof SeedsTable.Cell>[\"colSpan\"];\n }>;\n isAppendedRow?: boolean;\n }>;\n}>;\n\nexport const ChartTable = memo<TypeChartTableProps>(function ChartTable({\n rows,\n}: TypeChartTableProps) {\n if (!rows || rows.length === 0) {\n return null;\n }\n\n return (\n <StyledSeedsTable>\n <SeedsTable.TableBody>\n {rows.map(({ cells, isAppendedRow }, rowIndex) => {\n if (!cells || cells.length === 0) {\n return null;\n }\n\n return (\n <StyledSeedsTableRow\n key={`chart-tooltip-table-row-${rowIndex}`}\n $isAppendedRow={isAppendedRow}\n >\n {cells.map(\n ({ content, align = \"left\", colSpan = 1 }, cellIndex) => {\n const uniqueIdentifier = `chart-tooltip-table-cell-${cellIndex}`;\n return (\n <SeedsTable.Cell\n key={uniqueIdentifier}\n id={uniqueIdentifier}\n scope={cellIndex === 0 ? \"row\" : undefined}\n align={align}\n colSpan={colSpan}\n py={200}\n >\n <Text.SmallBodyCopy as=\"div\">\n {content}\n </Text.SmallBodyCopy>\n </SeedsTable.Cell>\n );\n }\n )}\n </StyledSeedsTableRow>\n );\n })}\n </SeedsTable.TableBody>\n </StyledSeedsTable>\n );\n});\n","import { memo } from \"react\";\n\nimport { ChartTable, type TypeChartTableProps } from \"../../ChartTable\";\n\nexport type TypeChartTooltipTableProps = {\n rows: TypeChartTableProps[\"rows\"];\n};\n\nexport const ChartTooltipTable = memo<TypeChartTooltipTableProps>(\n function ChartTooltipTable({ rows }: TypeChartTooltipTableProps) {\n return <ChartTable rows={rows} />;\n }\n);\n","import { memo } from \"react\";\nimport { Text } from \"@sproutsocial/seeds-react-text\";\n\ntype TypeChartTooltipTitleProps = {\n children: React.ReactNode;\n};\n\nexport const ChartTooltipTitle = memo<TypeChartTooltipTitleProps>(\n function ChartTooltipTitle({ children }: TypeChartTooltipTitleProps) {\n return <Text.SmallSubHeadline as=\"p\">{children}</Text.SmallSubHeadline>;\n }\n);\n","import type { TooltipFormatterContextObject } from \"highcharts\";\nimport { theme } from \"@sproutsocial/seeds-react-theme\";\n\nimport type { TypeAreaChartProps } from \"../components/AreaChart\";\nimport type { TypeLineChartProps } from \"../components/LineChart\";\nimport type { TypeChartTooltipProps } from \"../types\";\n\ntype TypeTransformTimeSeriesTooltipDataProps = Readonly<{\n context: TooltipFormatterContextObject;\n data: TypeAreaChartProps[\"data\"] | TypeLineChartProps[\"data\"];\n}>;\ntype TypeTransformTimeSeriesTooltipDataReturn = TypeChartTooltipProps[\"data\"];\n\nexport const transformTimeSeriesTooltipData = ({\n context,\n data,\n}: TypeTransformTimeSeriesTooltipDataProps): TypeTransformTimeSeriesTooltipDataReturn => {\n // @ts-expect-error - Highcharts tooltip context series typing does not expose chart.series here\n return (context.series.chart.series || []).map((series, index) => {\n const pointIndex = context.point.index;\n const y = series?.points?.[pointIndex]?.y;\n\n return {\n color:\n data[index]?.styles?.color || theme.colors.DATAVIZ_COLORS_LIST[index],\n ...(data[index]?.icon ? { icon: data[index]?.icon } : {}),\n name: series.name,\n value: typeof y === \"number\" ? y : null,\n };\n });\n};\n","import { css, createGlobalStyle } from \"styled-components\";\nimport { theme } from \"@sproutsocial/seeds-react-theme\";\nimport {\n type TypeChartStyleColor,\n type TypeChartStyleHasOnClick,\n type TypeChartStylePattern,\n} from \"../types\";\nimport \"highcharts/css/highcharts.css\";\n\nexport const GlobalChartStyleOverrides = createGlobalStyle`\n // USAGE NOTE:\n // Put general styles in baseChartStyles instead when possible to avoid excessive global styling.\n // This global component is only for styles that can't override highcharts defaults when scoped.\n\n .highcharts-tooltip-container {\n z-index: 7 !important;\n }\n .highcharts-tooltip-box {\n fill: transparent !important;\n }\n`;\n\n// options that should apply to all charts\nexport const baseChartStyles = css<\n Readonly<{ $colors: ReadonlyArray<TypeChartStyleColor> }>\n>`\n --highcharts-background-color: ${({ theme }) =>\n theme.colors.container.background.base};\n\n // set color variables and map to each series\n ${({ $colors }) =>\n $colors\n .map((color, index) => {\n const chartColor = color || theme.colors.DATAVIZ_COLORS_LIST[index];\n return `\n\t\t\t\t// map colors to custom assigned colors or fallback to default data viz color rotation\n\t\t\t\t--highcharts-color-${index}: ${chartColor};\n\n\t\t\t\t// highcharts already accounts for 10 series, but if we have more, we need to add them\n\t\t\t\t.highcharts-color-${index} {\n\t\t\t\t\tcolor: var(--highcharts-color-${index});\n\t\t\t\t\tstroke: var(--highcharts-color-${index});\n\t\t\t\t\tfill: var(--highcharts-color-${index});\n\t\t\t\t}`;\n })\n .join(\"\\n\")}\n\n // set overall chart background color\n .highcharts-background {\n fill: ${({ theme }) => theme.colors.container.background.base};\n }\n\n g.highcharts-annotation-label {\n display: none;\n }\n\n div.highcharts-annotation-label {\n top: 0 !important;\n transform: translateX(-50%); // centers the label on the targeted axis point\n pointer-events: none; // prevents tooltip hover from being interrupted by this element since it renders after on the dom\n }\n`;\n\n// options that should apply to time series charts\nexport const timeSeriesChartStyles = css<\n Readonly<{\n $colors: ReadonlyArray<TypeChartStyleColor>;\n $hasOnClick: TypeChartStyleHasOnClick;\n }>\n>`\n ${baseChartStyles}\n\n // vertical crosshair styles\n\t.highcharts-crosshair {\n stroke: ${({ theme }) => theme.colors.container.border.decorative.neutral};\n stroke-width: 1;\n }\n\n // axis and gridline styles\n .highcharts-grid-line {\n stroke: ${({ theme }) => theme.colors.container.border.base};\n }\n\n .highcharts-axis-line {\n stroke: ${({ theme }) => theme.colors.container.border.base};\n }\n\n .highcharts-tick {\n stroke: none;\n }\n .highcharts-xaxis-labels,\n .highcharts-yaxis-labels {\n // v1 HTML labels (useHTML: true). v2 SVG label styles live in\n // charts/shared/styles.ts (axisLabelV2Styles) — don't add v2 rules here.\n > span {\n font-family: ${({ theme }) => theme.fontFamily};\n ${({ theme }) => theme.typography[100]};\n font-weight: ${({ theme }) => theme.fontWeights.normal};\n color: ${({ theme }) => theme.colors.text.subtext};\n }\n }\n .highcharts-xaxis-labels {\n // v1 HTML stacked labels (useHTML: true). v2 SVG stacked-label styles live\n // in charts/shared/styles.ts (axisLabelV2Styles).\n > span {\n display: flex;\n flex-direction: column;\n align-items: center;\n > span:nth-of-type(2) {\n font-weight: ${({ theme }) => theme.fontWeights.semibold};\n }\n }\n }\n\n // we don't want to drop the opacity when another item is hovered\n .highcharts-series-inactive {\n opacity: 1;\n }\n\n // apply cursor pointer when click functionality is turned on\n ${({ $hasOnClick }) =>\n $hasOnClick &&\n `\n \t\t\t.highcharts-series,\n \t\t\t.highcharts-point {\n \t\t\t\tcursor: pointer;\n \t\t\t}\n \t\t\t.highcharts-plot-background,\n \t\t\t.highcharts-crosshair,\n \t\t\t.highcharts-grid-line {\n \t\t\t\tfill: transparent;\n \t\t\t\tcursor: pointer;\n \t\t}`}\n\n path.highcharts-plot-line.y-axis-zero-line {\n stroke: ${({ theme }) => theme.colors.container.border.decorative.neutral};\n }\n`;\n\n// options that should apply to line charts\nexport const lineChartStyles = css<\n Readonly<{\n $colors: ReadonlyArray<TypeChartStyleColor>;\n $patterns: ReadonlyArray<TypeChartStylePattern>;\n $hasOnClick: TypeChartStyleHasOnClick;\n }>\n>`\n ${timeSeriesChartStyles}\n\n // set the line stroke\n\t.highcharts-graph {\n stroke-width: 3;\n }\n\n // dashed line styles\n ${({ $patterns }) =>\n $patterns.map((pattern, index) => {\n return pattern === \"dashed\"\n ? `\n \t\t\t\t\t// highcharts already accounts for 10 series, but if we have more, we need to add them\n \t\t\t\t\t.highcharts-series-${index} {\n \t\t\t\t\t\tstroke-dasharray: 2, 8;\n \t\t\t\t\t}`\n : \"\";\n })}\n`;\n\n// options that should apply to area charts\nexport const areaChartStyles = css`\n ${timeSeriesChartStyles}\n\n // don't need to show a stroke for the line part of each area\n\t.highcharts-graph {\n stroke-width: 0;\n }\n\n // fill areas to full opacity\n .highcharts-area {\n fill-opacity: 1;\n }\n`;\n\n// options that should apply to donut charts\nexport const donutChartStyles = css<\n Readonly<{\n $colors: ReadonlyArray<TypeChartStyleColor>;\n $hasOnClick: TypeChartStyleHasOnClick;\n }>\n>`\n ${baseChartStyles}\n\n // remove 250ms fade in/out when hovering over different donut chart slices\n\t.highcharts-point {\n transition: opacity 0s;\n }\n\n // remove stroke on donut slices\n .highcharts-pie-series .highcharts-point {\n stroke: none;\n }\n\n // don't reduce opacity when hovering\n .highcharts-point-hover {\n fill-opacity: none;\n }\n\n // apply cursor pointer when click functionality is turned on\n ${({ $hasOnClick }) =>\n $hasOnClick &&\n `\n \t\t\t.highcharts-series,\n \t\t\t.highcharts-point {\n \t\t\t\tcursor: pointer;\n \t\t\t}\n \t\t\t.highcharts-plot-background,\n \t\t\t.highcharts-crosshair,\n \t\t\t.highcharts-grid-line {\n \t\t\t\tfill: transparent;\n \t\t\t\tcursor: pointer;\n \t\t}`}\n`;\n","import { memo } from \"react\";\nimport { Box } from \"@sproutsocial/seeds-react-box\";\n\nexport type TypeChartLegendLabelContentWithIconProps = Readonly<{\n children: React.ReactNode;\n // optional\n icon?: React.ReactNode;\n}>;\n\nexport const ChartLegendLabelContentWithIcon =\n memo<TypeChartLegendLabelContentWithIconProps>(\n function ChartLegendLabelContentWithIcon({\n children,\n icon,\n }: TypeChartLegendLabelContentWithIconProps) {\n return icon ? (\n <Box display=\"flex\" alignItems=\"center\" gap={200}>\n {icon}\n {children}\n </Box>\n ) : (\n children\n );\n }\n );\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _optionalChain(ops) { let lastAccessLHS = undefined; let value = ops[0]; let i = 1; while (i < ops.length) { const op = ops[i]; const fn = ops[i + 1]; i += 2; if ((op === 'optionalAccess' || op === 'optionalCall') && value == null) { return undefined; } if (op === 'access' || op === 'optionalAccess') { lastAccessLHS = value; value = fn(value); } else if (op === 'call' || op === 'optionalCall') { value = fn((...args) => value.call(lastAccessLHS, ...args)); lastAccessLHS = undefined; } } return value; }
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk27M4FDNKjs = require('./chunk-27M4FDNK.js');
|
|
4
4
|
|
|
5
5
|
// src/charts/shared/annotations.ts
|
|
6
6
|
function buildAnnotationConfig(annotations) {
|
|
@@ -56,7 +56,7 @@ function makeValueAxisLabelFormatter(format) {
|
|
|
56
56
|
return function() {
|
|
57
57
|
const numberValue = Number(this.value);
|
|
58
58
|
const abbreviate = format.abbreviate === false ? false : deriveAbbreviateFromTicks(this);
|
|
59
|
-
return
|
|
59
|
+
return _chunk27M4FDNKjs.valueFormatter.call(void 0, { ...format, value: numberValue, abbreviate });
|
|
60
60
|
};
|
|
61
61
|
}
|
|
62
62
|
|
|
@@ -65,4 +65,4 @@ function makeValueAxisLabelFormatter(format) {
|
|
|
65
65
|
|
|
66
66
|
|
|
67
67
|
exports.buildAnnotationConfig = buildAnnotationConfig; exports.defaultValueAxisLabelFormatter = defaultValueAxisLabelFormatter; exports.makeValueAxisLabelFormatter = makeValueAxisLabelFormatter;
|
|
68
|
-
//# sourceMappingURL=chunk-
|
|
68
|
+
//# sourceMappingURL=chunk-XYE6O77Z.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-XYE6O77Z.js","../src/charts/shared/annotations.ts","../src/charts/shared/valueAxisLabelFormatter.ts"],"names":[],"mappings":"AAAA;AACE;AACF,sDAA4B;AAC5B;AACA;ACkCO,SAAS,qBAAA,CACd,WAAA,EAIA;AACA,EAAA,GAAA,CAAI,iBAAC,WAAA,2BAAa,QAAA,EAAQ;AACxB,IAAA,OAAO,EAAE,WAAA,EAAa,KAAA,CAAA,EAAW,MAAA,EAAQ,KAAA,EAAU,CAAA;AAAA,EACrD;AACA,EAAA,MAAM,OAAA,EAGA,CAAC,CAAA;AACP,EAAA,MAAM,OAAA,kBAAgC,IAAI,GAAA,CAAI,CAAA;AAC9C,EAAA,IAAA,CAAA,MAAW,WAAA,GAAc,WAAA,EAAa;AACpC,IAAA,MAAM,EAAE,SAAS,EAAA,EAAI,UAAA;AACrB,IAAA,MAAA,CAAO,IAAA,CAAK;AAAA;AAAA,MAEV,KAAA,EAAO,EAAE,CAAA,EAAG,QAAA,EAAU,CAAA,EAAG,CAAA,EAAG,KAAA,EAAO,CAAA,EAAG,KAAA,EAAO,EAAE,CAAA;AAAA;AAAA,MAE/C,IAAA,EAAM;AAAA,IACR,CAAC,CAAA;AAID,IAAA,MAAA,CAAO,GAAA,CAAI,QAAA,EAAU,UAAU,CAAA;AAAA,EACjC;AACA,EAAA,GAAA,CAAI,MAAA,CAAO,OAAA,IAAW,CAAA,EAAG;AACvB,IAAA,OAAO,EAAE,WAAA,EAAa,KAAA,CAAA,EAAW,MAAA,EAAQ,KAAA,EAAU,CAAA;AAAA,EACrD;AACA,EAAA,OAAO;AAAA;AAAA;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A,EAAQ,MAAA,EAAQ,yBAAA,CAA0B,IAAI,CAAA;AAEtE,IAAA,OAAO,6CAAA,EAAiB,GAAG,MAAA,EAAQ,KAAA,EAAO,WAAA,EAAa,WAAW,CAAC,CAAA;AAAA,EACrE,CAAA;AACF;AFvBA;AACA;AACE;AACA;AACA;AACF,kMAAC","file":"/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-XYE6O77Z.js","sourcesContent":[null,"// Shared annotation plumbing across v2 chart families. Currently consumed by\n// BarChart; v2 Line/Area will share the same `annotations` shape and reuse\n// `buildAnnotationConfig` directly. Annotation data is purely numeric —\n// the module has no knowledge of `categories`; resolving a numeric position to\n// a display name is the tooltip's job (see chartBase `renderContent`).\n\nimport type { TypeIconName } from \"@sproutsocial/seeds-react-icon\";\nimport type { SeedsChartAnnotationsOptions } from \"./chartBase\";\n\n/**\n * Annotations keyed by the numeric Highcharts index. Both consumers resolve\n * numerically: the marker portal reads `label.point.x` and the tooltip reads\n * `context.point.x` (numeric on both category and datetime axes).\n */\nexport type ChartAnnotationLookup = Map<number, ChartAnnotation>;\n\n/**\n * Declarative annotation shape — the DS renders the marker and tooltip header\n * internally; consumers don't supply render functions. See CE-7.\n */\nexport interface ChartAnnotation {\n /** Numeric x-axis coordinate — a category index (category axes) or the raw coordinate (datetime/linear axes). */\n position: number;\n /** Icon shown above the chart at `position` and inline with `title` in the tooltip header. */\n icon?: TypeIconName;\n /** Color applied to the marker's vertical line. */\n color?: string;\n /** Tooltip header line 1. */\n title?: string;\n /** Tooltip header line 2. */\n description?: string;\n}\n\n/**\n * Build the Highcharts `annotations` config and a parallel lookup keyed by the\n * numeric `position`. Both consumers (chart adapter for Highcharts, ChartRenderer\n * for the portal + tooltip) read from the same numeric lookup to stay aligned.\n */\nexport function buildAnnotationConfig(\n annotations: ChartAnnotation[] | undefined\n): {\n annotations: SeedsChartAnnotationsOptions[] | undefined;\n lookup: ChartAnnotationLookup | undefined;\n} {\n if (!annotations?.length) {\n return { annotations: undefined, lookup: undefined };\n }\n const labels: {\n point: { x: number; y: number; xAxis: 0; yAxis: 0 };\n text: string;\n }[] = [];\n const lookup: ChartAnnotationLookup = new Map();\n for (const annotation of annotations) {\n const { position } = annotation;\n labels.push({\n // Highcharts anchor — always uses `x` regardless of chart orientation.\n point: { x: position, y: 0, xAxis: 0, yAxis: 0 },\n // Space (not empty) — Highcharts reverts to its built-in label text on empty string.\n text: \" \",\n });\n // Keyed by the numeric position only. The marker portal reads\n // `label.point.x` and the tooltip reads `context.point.x` — both numeric on\n // every axis type, so no category-name keying is needed.\n lookup.set(position, annotation);\n }\n if (labels.length === 0) {\n return { annotations: undefined, lookup: undefined };\n }\n return {\n // `useHTML: true` makes Highcharts attach an HTML `graphic.div` to each\n // label, which the marker portal needs as its render target. `padding: 0`\n // removes Highcharts' default left padding so markers stay centered.\n annotations: [{ labels, labelOptions: { useHTML: true, padding: 0 } }],\n lookup,\n };\n}\n","import { formatNumeral } from \"@sproutsocial/seeds-react-numeral\";\n\nimport type { SeedsAxisLabelFormatterContext } from \"./chartBase\";\nimport { valueFormatter, type ValueFormat } from \"./formatters/valueFormatter\";\n\n/**\n * Fixed internal locale for the default value-axis formatter. Pins the en-US\n * compact symbols (2K / 1.2M / 1.2B) so output is deterministic regardless of\n * the environment's locale resolution.\n * TODO: consumer-facing locale and an override surface may be added later.\n */\nconst FIXED_LOCALE = \"en-US\";\n\n/**\n * Derive formatNumeral's `abbreviate` threshold from the axis tick scan.\n *\n * formatNumeral abbreviates above 10,000 by default; passing a numeric\n * `abbreviate` lowers that threshold to that value. When the top tick exceeds\n * 9,999 we lower it to 1,000 so the whole axis reads \"2K 4K 6K 8K 10K\" rather\n * than a mixed \"2,000 4,000 6,000 8,000 10K\". Otherwise `true` keeps the default\n * 10,000 threshold. Centralizes the 9,999 rule for both formatters below.\n */\nfunction deriveAbbreviateFromTicks(\n context: SeedsAxisLabelFormatterContext\n): boolean | number {\n const tickPositions = context.axis.tickPositions;\n const maxValue =\n tickPositions && tickPositions.length > 0\n ? tickPositions[tickPositions.length - 1]\n : undefined;\n return typeof maxValue === \"number\" && maxValue > 9999 ? 1000 : true;\n}\n\n/**\n * Internal, zero-config default value-axis label formatter for v2 chart\n * families. Abbreviates value-axis ticks (1.20K / 1.20M / 1.20B); decimal mode\n * only. Zero renders \"0\". Decimal compact precision is fixed at two fraction\n * digits, so abbreviated ticks always carry two decimals.\n *\n * Wired as a Highcharts `yAxis.labels.formatter`, invoked `this`-bound with the\n * Seeds-local context.\n */\nexport function defaultValueAxisLabelFormatter(\n this: SeedsAxisLabelFormatterContext\n): string {\n const numberValue = Number(this.value);\n\n if (numberValue === 0) {\n return formatNumeral({ locale: FIXED_LOCALE, number: 0 });\n }\n\n const abbreviate = deriveAbbreviateFromTicks(this);\n\n return formatNumeral({\n abbreviate,\n format: \"decimal\",\n locale: FIXED_LOCALE,\n number: numberValue,\n });\n}\n\n/**\n * Build a `format`-driven value-axis label formatter that runs a declarative\n * {@link ValueFormat} through the shared {@link valueFormatter}. Reuses the same\n * `tickPositions` scan as {@link defaultValueAxisLabelFormatter} so the\n * axis-wide \"smart 1k/10k\" abbreviation is preserved for decimal/currency ticks.\n *\n * Wired as a Highcharts `yAxis.labels.formatter`; invoked `this`-bound with the\n * Seeds-local context. The returned formatter never carries chart-engine types,\n * keeping the engine boundary intact.\n */\nexport function makeValueAxisLabelFormatter(format: ValueFormat) {\n return function (this: SeedsAxisLabelFormatterContext): string {\n const numberValue = Number(this.value);\n\n // Honor an explicit `abbreviate: false` opt-out; otherwise derive the\n // threshold from the same tick scan as the default formatter (abbreviation\n // only affects decimal/currency — percent and duration ignore it inside\n // valueFormatter).\n const abbreviate =\n format.abbreviate === false ? false : deriveAbbreviateFromTicks(this);\n\n return valueFormatter({ ...format, value: numberValue, abbreviate });\n };\n}\n"]}
|