@sproutsocial/seeds-react-data-viz 0.16.0 → 0.17.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/annotations-CjFoRPXf.d.mts +20 -0
- package/dist/annotations-CjFoRPXf.d.ts +20 -0
- package/dist/axis-WOeYkTO1.d.mts +44 -0
- package/dist/axis-WOeYkTO1.d.ts +44 -0
- package/dist/bar/index.d.mts +4 -2
- package/dist/bar/index.d.ts +4 -2
- package/dist/bar/index.js +14 -10
- package/dist/bar/index.js.map +1 -1
- package/dist/{axis-PJwu5Xmo.d.ts → chartBase-C-l7yYGx.d.ts} +6 -60
- package/dist/{axis-DXzufRRj.d.mts → chartBase-Cn_5CUJi.d.mts} +6 -60
- package/dist/{chunk-XVV7PYQE.js → chunk-2K7PFHIM.js} +101 -254
- package/dist/chunk-2K7PFHIM.js.map +1 -0
- package/dist/chunk-6D7P3IOT.js +150 -0
- package/dist/chunk-6D7P3IOT.js.map +1 -0
- package/dist/chunk-CYQXUAJC.js +169 -0
- package/dist/chunk-CYQXUAJC.js.map +1 -0
- package/dist/chunk-VVGBJOFH.js +68 -0
- package/dist/chunk-VVGBJOFH.js.map +1 -0
- package/dist/{chunk-EEVKTTT3.js → chunk-WEKDYQ4T.js} +1 -1
- package/dist/chunk-WEKDYQ4T.js.map +1 -0
- package/dist/donut/index.d.mts +48 -0
- package/dist/donut/index.d.ts +48 -0
- package/dist/donut/index.js +125 -0
- package/dist/donut/index.js.map +1 -0
- package/dist/esm/bar/index.js +11 -7
- package/dist/esm/bar/index.js.map +1 -1
- package/dist/esm/chunk-AUJ3EWRH.js +68 -0
- package/dist/esm/chunk-AUJ3EWRH.js.map +1 -0
- package/dist/esm/{chunk-ZXXFRUVF.js → chunk-LPQXJJNT.js} +94 -247
- package/dist/esm/chunk-LPQXJJNT.js.map +1 -0
- package/dist/esm/chunk-NAKJY5PA.js +150 -0
- package/dist/esm/chunk-NAKJY5PA.js.map +1 -0
- package/dist/esm/chunk-XMYGML25.js +169 -0
- package/dist/esm/chunk-XMYGML25.js.map +1 -0
- package/dist/esm/{chunk-LC3HGWDD.js → chunk-Z4LOM4OZ.js} +1 -1
- package/dist/esm/chunk-Z4LOM4OZ.js.map +1 -0
- package/dist/esm/donut/index.js +125 -0
- package/dist/esm/donut/index.js.map +1 -0
- package/dist/esm/export/index.js.map +1 -1
- package/dist/esm/index.js +20 -164
- package/dist/esm/index.js.map +1 -1
- package/dist/esm/line-area/index.js +12 -7
- package/dist/esm/line-area/index.js.map +1 -1
- package/dist/esm/sparkline/index.js +123 -0
- package/dist/esm/sparkline/index.js.map +1 -0
- package/dist/export/index.js.map +1 -1
- package/dist/index.d.mts +26 -23
- package/dist/index.d.ts +26 -23
- package/dist/index.js +113 -257
- package/dist/index.js.map +1 -1
- package/dist/line-area/index.d.mts +7 -4
- package/dist/line-area/index.d.ts +7 -4
- package/dist/line-area/index.js +15 -10
- package/dist/line-area/index.js.map +1 -1
- package/dist/sparkline/index.d.mts +75 -0
- package/dist/sparkline/index.d.ts +75 -0
- package/dist/sparkline/index.js +123 -0
- package/dist/sparkline/index.js.map +1 -0
- package/dist/sparkline.css +76 -0
- package/dist/{types-B7ILUQ6_.d.mts → types-DxrhdAdn.d.mts} +3 -3
- package/dist/{types-B7ILUQ6_.d.ts → types-DxrhdAdn.d.ts} +3 -3
- package/package.json +15 -3
- package/dist/chunk-EEVKTTT3.js.map +0 -1
- package/dist/chunk-XVV7PYQE.js.map +0 -1
- package/dist/esm/chunk-LC3HGWDD.js.map +0 -1
- package/dist/esm/chunk-ZXXFRUVF.js.map +0 -1
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../../../src/charts/donut/DonutChart.tsx","../../../src/charts/donut/adapter.ts","../../../src/charts/donut/styles.ts"],"sourcesContent":["import { memo, useMemo } from \"react\";\nimport {\n useSeedsChartSetup,\n ChartRenderer,\n type ChartTooltipProps,\n} from \"../shared/chartBase\";\nimport { buildDonutOptions } from \"./adapter\";\nimport { DonutChartContainer } from \"./styles\";\nimport type { DonutChartProps, DonutChartTooltipProps } from \"./types\";\n\nexport const DonutChart = memo(function DonutChart(props: DonutChartProps) {\n // Map each data item to { color? } so useSeedsChartSetup resolves the palette.\n const { colors } = useSeedsChartSetup({\n series: props.data.map((d) => ({ color: d.color })),\n });\n\n // Memoize to avoid spurious Highcharts redraws on parent re-renders.\n const options = useMemo(\n () => buildDonutOptions(props, colors),\n [props, colors]\n );\n const hasOnClick = Boolean(props.onClick);\n\n // `ChartRenderer` expects `(ChartTooltipProps) => ReactNode`. The consumer's\n // function expects the narrower `DonutChartTooltipProps` (required `percent`).\n // Wrap rather than cast the function type so the intent is explicit.\n const tooltip = props.tooltip\n ? (args: ChartTooltipProps) =>\n props.tooltip!(args as unknown as DonutChartTooltipProps)\n : undefined;\n\n return (\n <DonutChartContainer\n $colors={colors}\n $hasOnClick={hasOnClick}\n className={props.className}\n >\n <ChartRenderer\n options={options}\n series={props.data.map((d, i) => ({\n name: d.name,\n color: colors[i],\n icon: d.icon,\n }))}\n colors={colors}\n tooltip={tooltip}\n hasOnClick={hasOnClick}\n tooltipClickLabel={props.tooltipClickLabel}\n invalidNumberLabel={props.invalidNumberLabel}\n valueFormat={props.format}\n onReady={props.onReady}\n />\n </DonutChartContainer>\n );\n});\n","import type { SeedsChartOptions } from \"../shared/chartBase\";\nimport { buildBaseChartOptions } from \"../shared/baseChartOptions\";\nimport { DONUT_CHART_HEIGHT } from \"../../constants/chartOptions\";\nimport type { DonutChartProps } from \"./types\";\n\nexport function buildDonutOptions(\n props: DonutChartProps,\n colors: ReadonlyArray<string>\n): SeedsChartOptions {\n const base = buildBaseChartOptions({\n type: \"pie\",\n description: props.description,\n });\n return {\n ...base,\n chart: {\n type: \"pie\" as const,\n styledMode: true,\n animation: false,\n // Height only — width is left fluid (v1 parity) so the chart fills its\n // container and the pie auto-centers. The container bounds the width (see\n // styles.ts) so the legend below wraps to the donut and centers with it.\n height: DONUT_CHART_HEIGHT,\n // Drop Highcharts' default spacing so the donut uses the full height.\n spacing: [0, 0, 0, 0],\n },\n plotOptions: {\n pie: {\n animation: false,\n // borderRadius must be set in JS, not CSS, because Highcharts computes\n // the arc path before applying it — CSS border-radius has no effect.\n borderRadius: 0,\n dataLabels: { enabled: false },\n innerSize: \"50%\",\n ...(props.onClick\n ? {\n point: {\n events: {\n click(this: { name: string }) {\n props.onClick?.({ position: this.name });\n },\n },\n },\n }\n : {}),\n },\n },\n series: [\n {\n type: \"pie\",\n name: \"Data\",\n data: props.data.map((d, i) => ({\n name: d.name,\n y: d.value,\n color: d.color ?? colors[i] ?? \"\",\n })),\n },\n ],\n };\n}\n","import styled from \"styled-components\";\nimport { donutChartStyles } from \"../../styles/chartStyles\";\nimport type {\n TypeChartStyleColor,\n TypeChartStyleHasOnClick,\n} from \"../../types\";\n\ntype StyleProps = Readonly<{\n $colors: ReadonlyArray<TypeChartStyleColor>;\n $hasOnClick: TypeChartStyleHasOnClick;\n}>;\n\n// Plain styled `div` — not `Box`. Per the DS Tailwind direction (established in\n// CE-28/line-area), new components render semantic elements internally.\n//\n// No width constraint (v1 parity): the chart fills the container and the pie\n// auto-centers, while the legend centers in the same width — so the legend\n// stays on one row and centers with the donut instead of wrapping to match it.\nexport const DonutChartContainer = styled.div<StyleProps>`\n background-color: ${({ theme }) => theme.colors.container.background.base};\n ${donutChartStyles}\n\n /* Dim non-hovered slices. Highcharts adds .highcharts-point-inactive to\n all pie points except the hovered one. In styledMode, opacity is CSS-only\n (JS plotOptions.states.inactive.opacity is ignored). */\n .highcharts-pie-series .highcharts-point-inactive {\n opacity: 0.3;\n transition: opacity 0s;\n }\n`;\n"],"mappings":";;;;;;;;;;;;;AAAA,SAAS,MAAM,eAAe;;;ACKvB,SAAS,kBACd,OACA,QACmB;AACnB,QAAM,OAAO,sBAAsB;AAAA,IACjC,MAAM;AAAA,IACN,aAAa,MAAM;AAAA,EACrB,CAAC;AACD,SAAO;AAAA,IACL,GAAG;AAAA,IACH,OAAO;AAAA,MACL,MAAM;AAAA,MACN,YAAY;AAAA,MACZ,WAAW;AAAA;AAAA;AAAA;AAAA,MAIX,QAAQ;AAAA;AAAA,MAER,SAAS,CAAC,GAAG,GAAG,GAAG,CAAC;AAAA,IACtB;AAAA,IACA,aAAa;AAAA,MACX,KAAK;AAAA,QACH,WAAW;AAAA;AAAA;AAAA,QAGX,cAAc;AAAA,QACd,YAAY,EAAE,SAAS,MAAM;AAAA,QAC7B,WAAW;AAAA,QACX,GAAI,MAAM,UACN;AAAA,UACE,OAAO;AAAA,YACL,QAAQ;AAAA,cACN,QAA8B;AAC5B,sBAAM,UAAU,EAAE,UAAU,KAAK,KAAK,CAAC;AAAA,cACzC;AAAA,YACF;AAAA,UACF;AAAA,QACF,IACA,CAAC;AAAA,MACP;AAAA,IACF;AAAA,IACA,QAAQ;AAAA,MACN;AAAA,QACE,MAAM;AAAA,QACN,MAAM;AAAA,QACN,MAAM,MAAM,KAAK,IAAI,CAAC,GAAG,OAAO;AAAA,UAC9B,MAAM,EAAE;AAAA,UACR,GAAG,EAAE;AAAA,UACL,OAAO,EAAE,SAAS,OAAO,CAAC,KAAK;AAAA,QACjC,EAAE;AAAA,MACJ;AAAA,IACF;AAAA,EACF;AACF;;;AC3DA,OAAO,YAAY;AAkBZ,IAAM,sBAAsB,OAAO;AAAA,sBACpB,CAAC,EAAE,MAAM,MAAM,MAAM,OAAO,UAAU,WAAW,IAAI;AAAA,IACvE,gBAAgB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;;;AFiBd;AA3BC,IAAM,aAAa,KAAK,SAASA,YAAW,OAAwB;AAEzE,QAAM,EAAE,OAAO,IAAI,mBAAmB;AAAA,IACpC,QAAQ,MAAM,KAAK,IAAI,CAAC,OAAO,EAAE,OAAO,EAAE,MAAM,EAAE;AAAA,EACpD,CAAC;AAGD,QAAM,UAAU;AAAA,IACd,MAAM,kBAAkB,OAAO,MAAM;AAAA,IACrC,CAAC,OAAO,MAAM;AAAA,EAChB;AACA,QAAM,aAAa,QAAQ,MAAM,OAAO;AAKxC,QAAM,UAAU,MAAM,UAClB,CAAC,SACC,MAAM,QAAS,IAAyC,IAC1D;AAEJ,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,aAAa;AAAA,MACb,WAAW,MAAM;AAAA,MAEjB;AAAA,QAAC;AAAA;AAAA,UACC;AAAA,UACA,QAAQ,MAAM,KAAK,IAAI,CAAC,GAAG,OAAO;AAAA,YAChC,MAAM,EAAE;AAAA,YACR,OAAO,OAAO,CAAC;AAAA,YACf,MAAM,EAAE;AAAA,UACV,EAAE;AAAA,UACF;AAAA,UACA;AAAA,UACA;AAAA,UACA,mBAAmB,MAAM;AAAA,UACzB,oBAAoB,MAAM;AAAA,UAC1B,aAAa,MAAM;AAAA,UACnB,SAAS,MAAM;AAAA;AAAA,MACjB;AAAA;AAAA,EACF;AAEJ,CAAC;","names":["DonutChart"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../src/export/ChartExportMenu.tsx"],"sourcesContent":["import { ActionMenu, MenuItem } from \"@sproutsocial/seeds-react-menu/base\";\nimport { Button } from \"@sproutsocial/seeds-react-button\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type {\n ChartExportFormat,\n ChartExportHandle,\n} from \"../charts/shared/chartExport\";\n\nexport interface ChartExportMenuProps {\n /** The opaque export handle surfaced by a v2 chart's `onReady` callback. */\n exportHandle: ChartExportHandle;\n /**\n * Visible labels per format. Only formats with a non-empty label render an\n * item; an empty object (or all-falsy labels) renders nothing — no dead\n * trigger. Items always render in canonical order, never in key-insertion\n * order.\n */\n labels: Partial<Record<ChartExportFormat, string>>;\n /** Accessible name for the icon-only trigger button. */\n triggerAriaLabel: string;\n}\n\n// Canonical render order, independent of `labels` key order.\nconst ORDER: ChartExportFormat[] = [\"png\", \"svg\", \"pdf\", \"csv\"];\n\n// Maps each format to the matching handle callable.\nconst METHOD: Record<ChartExportFormat, keyof ChartExportHandle> = {\n png: \"exportPNG\",\n svg: \"exportSVG\",\n pdf: \"exportPDF\",\n csv: \"exportCSV\",\n};\n\n/**\n * Icon-only overflow button that opens a dropdown of chart export actions\n * (PNG/SVG/PDF/CSV) for greenfield consumers, so they don't have to wire up\n * their own menu around the `ChartExportHandle` from `onReady`. Consumes only\n * the opaque handle — no Highcharts type crosses this boundary.\n */\nexport function ChartExportMenu({\n exportHandle,\n labels,\n triggerAriaLabel,\n}: ChartExportMenuProps) {\n const formats = ORDER.filter((format) => labels[format]);\n if (formats.length === 0) return null;\n\n return (\n <ActionMenu\n trigger={\n <Button appearance=\"secondary\" ariaLabel={triggerAriaLabel}>\n <Icon name=\"arrow-down-to-bracket-outline\" fixedWidth aria-hidden />\n </Button>\n }\n >\n {formats.map((format) => (\n <MenuItem\n key={format}\n onClick={() => {\n // The handle is fire-and-forget by design (opaque, consumer owns no\n // UI here). Attach a no-op catch so a rejected export (e.g. a PDF\n // dynamic-import failure) is a deliberate swallow, not an unhandled\n // promise rejection.\n void exportHandle[METHOD[format]]().catch(() => {});\n }}\n >\n {labels[format]}\n </MenuItem>\n ))}\n </ActionMenu>\n );\n}\n"],"mappings":";AAAA,SAAS,YAAY,gBAAgB;AACrC,SAAS,cAAc;AACvB,SAAS,YAAY;AAiDX;AA5BV,IAAM,QAA6B,CAAC,OAAO,OAAO,OAAO,KAAK;AAG9D,IAAM,SAA6D;AAAA,EACjE,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAQO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,UAAU,MAAM,OAAO,CAAC,WAAW,OAAO,MAAM,CAAC;AACvD,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SACE,oBAAC,UAAO,YAAW,aAAY,WAAW,kBACxC,8BAAC,QAAK,MAAK,iCAAgC,YAAU,MAAC,eAAW,MAAC,GACpE;AAAA,MAGD,kBAAQ,IAAI,CAAC,WACZ;AAAA,QAAC;AAAA;AAAA,UAEC,SAAS,MAAM;AAKb,iBAAK,aAAa,OAAO,MAAM,CAAC,EAAE,EAAE,MAAM,MAAM;AAAA,
|
|
1
|
+
{"version":3,"sources":["../../../src/export/ChartExportMenu.tsx"],"sourcesContent":["import { ActionMenu, MenuItem } from \"@sproutsocial/seeds-react-menu/base\";\nimport { Button } from \"@sproutsocial/seeds-react-button\";\nimport { Icon } from \"@sproutsocial/seeds-react-icon\";\nimport type {\n ChartExportFormat,\n ChartExportHandle,\n} from \"../charts/shared/chartExport\";\n\nexport interface ChartExportMenuProps {\n /** The opaque export handle surfaced by a v2 chart's `onReady` callback. */\n exportHandle: ChartExportHandle;\n /**\n * Visible labels per format. Only formats with a non-empty label render an\n * item; an empty object (or all-falsy labels) renders nothing — no dead\n * trigger. Items always render in canonical order, never in key-insertion\n * order.\n */\n labels: Partial<Record<ChartExportFormat, string>>;\n /** Accessible name for the icon-only trigger button. */\n triggerAriaLabel: string;\n}\n\n// Canonical render order, independent of `labels` key order.\nconst ORDER: ChartExportFormat[] = [\"png\", \"svg\", \"pdf\", \"csv\"];\n\n// Maps each format to the matching handle callable.\nconst METHOD: Record<ChartExportFormat, keyof ChartExportHandle> = {\n png: \"exportPNG\",\n svg: \"exportSVG\",\n pdf: \"exportPDF\",\n csv: \"exportCSV\",\n};\n\n/**\n * Icon-only overflow button that opens a dropdown of chart export actions\n * (PNG/SVG/PDF/CSV) for greenfield consumers, so they don't have to wire up\n * their own menu around the `ChartExportHandle` from `onReady`. Consumes only\n * the opaque handle — no Highcharts type crosses this boundary.\n */\nexport function ChartExportMenu({\n exportHandle,\n labels,\n triggerAriaLabel,\n}: ChartExportMenuProps) {\n const formats = ORDER.filter((format) => labels[format]);\n if (formats.length === 0) return null;\n\n return (\n <ActionMenu\n trigger={\n <Button appearance=\"secondary\" ariaLabel={triggerAriaLabel}>\n <Icon name=\"arrow-down-to-bracket-outline\" fixedWidth aria-hidden />\n </Button>\n }\n >\n {formats.map((format) => (\n <MenuItem\n key={format}\n onClick={() => {\n // The handle is fire-and-forget by design (opaque, consumer owns no\n // UI here). Attach a no-op catch so a rejected export (e.g. a PDF\n // dynamic-import failure) is a deliberate swallow, not an unhandled\n // promise rejection.\n void exportHandle[METHOD[format]]().catch(() => {\n // no-op: deliberate swallow of fire-and-forget export rejection (see comment above)\n });\n }}\n >\n {labels[format]}\n </MenuItem>\n ))}\n </ActionMenu>\n );\n}\n"],"mappings":";AAAA,SAAS,YAAY,gBAAgB;AACrC,SAAS,cAAc;AACvB,SAAS,YAAY;AAiDX;AA5BV,IAAM,QAA6B,CAAC,OAAO,OAAO,OAAO,KAAK;AAG9D,IAAM,SAA6D;AAAA,EACjE,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AAAA,EACL,KAAK;AACP;AAQO,SAAS,gBAAgB;AAAA,EAC9B;AAAA,EACA;AAAA,EACA;AACF,GAAyB;AACvB,QAAM,UAAU,MAAM,OAAO,CAAC,WAAW,OAAO,MAAM,CAAC;AACvD,MAAI,QAAQ,WAAW,EAAG,QAAO;AAEjC,SACE;AAAA,IAAC;AAAA;AAAA,MACC,SACE,oBAAC,UAAO,YAAW,aAAY,WAAW,kBACxC,8BAAC,QAAK,MAAK,iCAAgC,YAAU,MAAC,eAAW,MAAC,GACpE;AAAA,MAGD,kBAAQ,IAAI,CAAC,WACZ;AAAA,QAAC;AAAA;AAAA,UAEC,SAAS,MAAM;AAKb,iBAAK,aAAa,OAAO,MAAM,CAAC,EAAE,EAAE,MAAM,MAAM;AAAA,YAEhD,CAAC;AAAA,UACH;AAAA,UAEC,iBAAO,MAAM;AAAA;AAAA,QAXT;AAAA,MAYP,CACD;AAAA;AAAA,EACH;AAEJ;","names":[]}
|
package/dist/esm/index.js
CHANGED
|
@@ -1,3 +1,16 @@
|
|
|
1
|
+
import {
|
|
2
|
+
DONUT_CHART_HALO_SIZE,
|
|
3
|
+
DONUT_CHART_HEIGHT,
|
|
4
|
+
DONUT_CHART_WIDTH,
|
|
5
|
+
TIME_SERIES_CHART_HEIGHT,
|
|
6
|
+
VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT,
|
|
7
|
+
areaChartOptions,
|
|
8
|
+
baseChartOptions,
|
|
9
|
+
columnChartOptions,
|
|
10
|
+
donutChartOptions,
|
|
11
|
+
lineChartOptions,
|
|
12
|
+
timeSeriesChartOptions
|
|
13
|
+
} from "./chunk-XMYGML25.js";
|
|
1
14
|
import {
|
|
2
15
|
ChartLegend,
|
|
3
16
|
ChartLegendLabel,
|
|
@@ -30,7 +43,7 @@ import {
|
|
|
30
43
|
transformTimeSeriesTooltipData,
|
|
31
44
|
xAxisLabelFormatter,
|
|
32
45
|
yAxisLabelFormatter
|
|
33
|
-
} from "./chunk-
|
|
46
|
+
} from "./chunk-Z4LOM4OZ.js";
|
|
34
47
|
|
|
35
48
|
// src/components/AreaChart/AreaChart.tsx
|
|
36
49
|
import { memo as memo4 } from "react";
|
|
@@ -165,7 +178,7 @@ var ChartXAnnotationMarkerPortal = memo3(
|
|
|
165
178
|
chartContainer
|
|
166
179
|
}) {
|
|
167
180
|
const annotationContainers = useRef({});
|
|
168
|
-
const [
|
|
181
|
+
const [, setRenderCount] = useState(0);
|
|
169
182
|
const forceRender = () => setRenderCount((prev) => prev + 1);
|
|
170
183
|
useEffect(() => {
|
|
171
184
|
if (annotationContext.labels) {
|
|
@@ -215,163 +228,6 @@ var ChartXAnnotationMarkerPortal = memo3(
|
|
|
215
228
|
|
|
216
229
|
// src/hooks/useTimeSeriesChartOptions.ts
|
|
217
230
|
import { useState as useState2, useCallback, useMemo } from "react";
|
|
218
|
-
|
|
219
|
-
// src/constants/chartOptions.ts
|
|
220
|
-
import _ from "lodash";
|
|
221
|
-
var baseChartOptions = {
|
|
222
|
-
chart: {
|
|
223
|
-
animation: false,
|
|
224
|
-
styledMode: true
|
|
225
|
-
},
|
|
226
|
-
credits: {
|
|
227
|
-
enabled: false
|
|
228
|
-
},
|
|
229
|
-
exporting: {
|
|
230
|
-
enabled: false,
|
|
231
|
-
fallbackToExportServer: false
|
|
232
|
-
},
|
|
233
|
-
legend: {
|
|
234
|
-
enabled: false
|
|
235
|
-
},
|
|
236
|
-
title: {
|
|
237
|
-
text: void 0
|
|
238
|
-
},
|
|
239
|
-
tooltip: {
|
|
240
|
-
hideDelay: 0,
|
|
241
|
-
outside: true,
|
|
242
|
-
padding: 0,
|
|
243
|
-
shape: "rect",
|
|
244
|
-
shared: true,
|
|
245
|
-
useHTML: true
|
|
246
|
-
}
|
|
247
|
-
};
|
|
248
|
-
var TIME_SERIES_CHART_HEIGHT = 275;
|
|
249
|
-
var timeSeriesChartOptions = _.merge({}, baseChartOptions, {
|
|
250
|
-
annotations: [
|
|
251
|
-
{
|
|
252
|
-
draggable: "",
|
|
253
|
-
labelOptions: {
|
|
254
|
-
useHTML: true,
|
|
255
|
-
padding: 0
|
|
256
|
-
// removes "left" property padding created by highcharts so that label is centered
|
|
257
|
-
}
|
|
258
|
-
}
|
|
259
|
-
],
|
|
260
|
-
chart: {
|
|
261
|
-
// events.click is set at the component level because of the optional onClick prop
|
|
262
|
-
height: TIME_SERIES_CHART_HEIGHT,
|
|
263
|
-
spacing: [5, 1, 0, 2]
|
|
264
|
-
},
|
|
265
|
-
plotOptions: {
|
|
266
|
-
series: {
|
|
267
|
-
animation: false,
|
|
268
|
-
clip: false,
|
|
269
|
-
marker: {
|
|
270
|
-
enabled: false,
|
|
271
|
-
states: {
|
|
272
|
-
hover: {
|
|
273
|
-
enabled: false
|
|
274
|
-
}
|
|
275
|
-
}
|
|
276
|
-
}
|
|
277
|
-
}
|
|
278
|
-
},
|
|
279
|
-
xAxis: {
|
|
280
|
-
crosshair: {
|
|
281
|
-
zIndex: 3
|
|
282
|
-
},
|
|
283
|
-
minPadding: 0,
|
|
284
|
-
// must be handled dynamically instead of css
|
|
285
|
-
maxPadding: 0,
|
|
286
|
-
// must be handled dynamically instead of css
|
|
287
|
-
type: "datetime",
|
|
288
|
-
labels: {
|
|
289
|
-
useHTML: true
|
|
290
|
-
// formatter is set at the component level because of the required text locale prop
|
|
291
|
-
}
|
|
292
|
-
},
|
|
293
|
-
yAxis: {
|
|
294
|
-
labels: {
|
|
295
|
-
useHTML: true
|
|
296
|
-
// formatter is set at the component level because of the optional yAxisLabelFormatter prop
|
|
297
|
-
},
|
|
298
|
-
softMax: 0,
|
|
299
|
-
softMin: 0,
|
|
300
|
-
title: {
|
|
301
|
-
text: void 0
|
|
302
|
-
},
|
|
303
|
-
plotLines: [
|
|
304
|
-
/* Adds a custom plotLine at y=0 to represent the chart baseline.
|
|
305
|
-
This approach allows full control over the line's appearance (e.g., color, z-index),
|
|
306
|
-
unlike relying on the default xAxis line, which always renders at the bottom of the chart
|
|
307
|
-
even when y=0 appears elsewhere (e.g., with negative values).
|
|
308
|
-
*/
|
|
309
|
-
{
|
|
310
|
-
className: "y-axis-zero-line",
|
|
311
|
-
value: 0,
|
|
312
|
-
zIndex: 3
|
|
313
|
-
// ensures the line appears over the default y=0 line, which we can't seleect as specifically
|
|
314
|
-
}
|
|
315
|
-
]
|
|
316
|
-
}
|
|
317
|
-
});
|
|
318
|
-
var lineChartOptions = _.merge({}, timeSeriesChartOptions, {
|
|
319
|
-
// plotOptions.spline.events.click is set at the component level because of the optional onClick prop
|
|
320
|
-
});
|
|
321
|
-
var areaChartOptions = _.merge({}, timeSeriesChartOptions, {
|
|
322
|
-
plotOptions: {
|
|
323
|
-
areaspline: {
|
|
324
|
-
// events.click is set at the component level because of the optional onClick prop
|
|
325
|
-
stacking: "normal"
|
|
326
|
-
}
|
|
327
|
-
}
|
|
328
|
-
});
|
|
329
|
-
var columnChartOptions = _.merge({}, timeSeriesChartOptions, {
|
|
330
|
-
plotOptions: {
|
|
331
|
-
column: {
|
|
332
|
-
stacking: "normal",
|
|
333
|
-
pointPadding: 0.25,
|
|
334
|
-
groupPadding: 0.25,
|
|
335
|
-
borderRadius: 4
|
|
336
|
-
}
|
|
337
|
-
},
|
|
338
|
-
xAxis: {
|
|
339
|
-
crosshair: false
|
|
340
|
-
},
|
|
341
|
-
yAxis: {
|
|
342
|
-
plotLines: [
|
|
343
|
-
{
|
|
344
|
-
// For stacked column charts with visible borders (e.g., white for contrast),
|
|
345
|
-
// we raise the zIndex of the y=0 plotLine to ensure it remains visible
|
|
346
|
-
// and isn't visually covered by overlapping column borders.
|
|
347
|
-
zIndex: 5
|
|
348
|
-
}
|
|
349
|
-
]
|
|
350
|
-
}
|
|
351
|
-
});
|
|
352
|
-
var VERTICAL_BAR_CHART_DEFAULT_SERIES_LIMIT = 10;
|
|
353
|
-
var DONUT_CHART_HALO_SIZE = 10;
|
|
354
|
-
var DONUT_CHART_HEIGHT = 250 + DONUT_CHART_HALO_SIZE * 2;
|
|
355
|
-
var DONUT_CHART_WIDTH = DONUT_CHART_HEIGHT;
|
|
356
|
-
var donutChartOptions = _.merge({}, baseChartOptions, {
|
|
357
|
-
chart: {
|
|
358
|
-
height: DONUT_CHART_HEIGHT,
|
|
359
|
-
spacing: [0, 0, 0, 0]
|
|
360
|
-
},
|
|
361
|
-
plotOptions: {
|
|
362
|
-
pie: {
|
|
363
|
-
animation: false,
|
|
364
|
-
borderRadius: 0,
|
|
365
|
-
// must be handled here instead of css because of path rendering
|
|
366
|
-
dataLabels: {
|
|
367
|
-
enabled: false
|
|
368
|
-
},
|
|
369
|
-
innerSize: "50%"
|
|
370
|
-
}
|
|
371
|
-
}
|
|
372
|
-
});
|
|
373
|
-
|
|
374
|
-
// src/hooks/useTimeSeriesChartOptions.ts
|
|
375
231
|
import { merge } from "lodash";
|
|
376
232
|
var useTimeSeriesChartOptions = ({
|
|
377
233
|
xAnnotations,
|
|
@@ -739,7 +595,7 @@ import { Icon as Icon2 } from "@sproutsocial/seeds-react-icon";
|
|
|
739
595
|
import { Text as Text2 } from "@sproutsocial/seeds-react-text";
|
|
740
596
|
import { jsx as jsx5, jsxs as jsxs3 } from "react/jsx-runtime";
|
|
741
597
|
var ChartXAnnotationDetails = memo5(
|
|
742
|
-
({ iconName, text })
|
|
598
|
+
function ChartXAnnotationDetails2({ iconName, text }) {
|
|
743
599
|
return /* @__PURE__ */ jsx5(ChartTooltipHeader, { children: /* @__PURE__ */ jsxs3(Box3, { display: "flex", alignItems: "center", gap: 300, children: [
|
|
744
600
|
/* @__PURE__ */ jsx5(Icon2, { name: iconName, size: "mini", color: "icon.base" }),
|
|
745
601
|
/* @__PURE__ */ jsx5(Text2, { color: "text.body", fontSize: 200, children: text })
|
|
@@ -753,7 +609,7 @@ import { Box as Box4 } from "@sproutsocial/seeds-react-box";
|
|
|
753
609
|
import { Icon as Icon3 } from "@sproutsocial/seeds-react-icon";
|
|
754
610
|
import { jsx as jsx6, jsxs as jsxs4 } from "react/jsx-runtime";
|
|
755
611
|
var ChartXAnnotationMarker = memo6(
|
|
756
|
-
({ iconName })
|
|
612
|
+
function ChartXAnnotationMarker2({ iconName }) {
|
|
757
613
|
return /* @__PURE__ */ jsxs4(Box4, { display: "flex", flexDirection: "column", alignItems: "center", gap: 200, children: [
|
|
758
614
|
/* @__PURE__ */ jsx6(
|
|
759
615
|
Box4,
|
|
@@ -1490,8 +1346,8 @@ var VerticalBarChartWithData = memo16(
|
|
|
1490
1346
|
const numValue = typeof value === "string" ? Number(value) : value;
|
|
1491
1347
|
if (isNaN(numValue)) return "";
|
|
1492
1348
|
const date = new Date(numValue);
|
|
1493
|
-
|
|
1494
|
-
|
|
1349
|
+
const hour = date.getUTCHours();
|
|
1350
|
+
const displayHour = hour % 12 === 0 ? 12 : hour % 12;
|
|
1495
1351
|
if (hour === 0) return "<span>12</span><span>AM</span>";
|
|
1496
1352
|
if (hour === 12) return "<span>12</span><span>PM</span>";
|
|
1497
1353
|
return `<span>${displayHour}</span>`;
|
|
@@ -1511,7 +1367,7 @@ var VerticalBarChartWithData = memo16(
|
|
|
1511
1367
|
xAnnotations,
|
|
1512
1368
|
xAxisLabelFormatter: resolvedXAxisLabelFormatter
|
|
1513
1369
|
});
|
|
1514
|
-
const { colors
|
|
1370
|
+
const { colors } = data.reduce(
|
|
1515
1371
|
(acc, item, index) => {
|
|
1516
1372
|
acc.colors.push(
|
|
1517
1373
|
item.styles?.color ?? theme10.colors.DATAVIZ_COLORS_LIST[index] ?? ""
|