@sproutsocial/seeds-react-data-viz 0.14.0 → 0.16.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.
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/_work/seeds/seeds/seeds-react/seeds-react-data-viz/dist/chunk-EEVKTTT3.js","../src/components/ColorBox/ColorBox.tsx","../../seeds-react-theme-provider/src/index.tsx","../src/components/ColorBox/DatavizColorBox.tsx","../src/components/ColorBox/NetworkColorBox.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/transformDataToSeries.ts","../src/helpers/transformTimeSeriesTooltipData.ts","../src/helpers/yAxisLabelFormatter.ts","../src/helpers/xAxisLabelFormatter.ts","../src/helpers/isHourlyTimeData.ts","../src/helpers/isCategoricalHourData.ts","../src/helpers/getStorybookRandomColor.ts","../src/helpers/getStorybookCategoricalData.ts","../src/helpers/getStorybookSparseTimelineData.ts","../src/styles/chartStyles.ts","../src/components/ChartLegend/components/ChartLegendLabelContentWithIcon.tsx"],"names":["jsx","props"],"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;AA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AAA;AAON;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAUnB,EAAA;AACI;AAAA,yBAAA;AAEsB;AAAA,OAAA;AAI1B;AAAA;AAIC;AAAwB,EAAA;AACN;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAclB;AAAyB,EAAA;AAMb;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,EAAA;AAoBf;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAAA;AAUC;AvB0rBH;AACA;AwBt5BF;AACA;AAeQ;AAPD;AAEH,EAAA;AAAyC,IAAA;AACvC,IAAA;AAEF,EAAA;AACE,IAAA;AAEK,MAAA;AAAA,MAAA;AACA,IAAA;AAKP,EAAA;AACF;AxB64BA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;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-EEVKTTT3.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 type * as React from \"react\";\nimport styled from \"styled-components\";\nimport { theme } from \"@sproutsocial/seeds-react-theme\";\nimport { ColorBox, type TypeColorBoxProps } from \"./ColorBox\";\n\nexport type TypeDatavizColorBoxProps = Readonly<\n Partial<TypeColorBoxProps> & {\n colorIndex: number;\n }\n>;\nexport type TypeDatavizColorBox = (\n props: TypeDatavizColorBoxProps\n) => React.JSXElementConstructor<TypeDatavizColorBoxProps>;\n\n/**\n * DatavizColorBox extends ColorBox to set the background color from a rotation of <a href=\"https://seeds.sproutsocial.com/visual/dataviz#color-combinations-for-general-sprout-social-data-visualizations\">dataviz colors</a>.\n */\nexport const DatavizColorBox = styled(ColorBox).attrs(\n ({ colorIndex }: TypeDatavizColorBoxProps) => ({\n style: {\n background: getDatavizColor(colorIndex),\n opacity: getDatavizOpacity(colorIndex),\n },\n })\n)<TypeDatavizColorBoxProps>``;\n\nexport const getDatavizColor = (colorIndex: number): string =>\n theme.colors.DATAVIZ_COLORS_LIST[\n colorIndex % theme.colors.DATAVIZ_COLORS_LIST.length\n ] || \"\";\n\nexport const getDatavizOpacity = (colorIndex: number): number => {\n const opacitySteps = [1, 0.6, 0.4, 0.2];\n const opacityStep =\n Math.floor(colorIndex / theme.colors.DATAVIZ_COLORS_LIST.length) %\n opacitySteps.length;\n // @ts-ignore\n return opacitySteps[opacityStep];\n};\n\n// information on 8 digit hex codes can be found here: https://css-tricks.com/8-digit-hex-codes/\nexport const getDatavizColorWithAlpha = (colorIndex: number): string => {\n const color = getDatavizColor(colorIndex);\n const opacity = getDatavizOpacity(colorIndex);\n\n // make sure the opacity is always between 0 and 1\n if (opacity < 0 || opacity > 1) {\n return color;\n }\n\n // sourced from https://stackoverflow.com/a/66143374\n return `${color}${Math.floor(opacity * 255)\n .toString(16)\n .padStart(2, \"0\")}`;\n};\n","import NETWORK_COLORS from \"@sproutsocial/seeds-networkcolor\";\n\nimport { ColorBox, type TypeColorBoxProps } from \"./ColorBox\";\n\n// $Keys<typeof NETWORK_COLORS>\ntype TypeNetworkColor =\n | \"NETWORK_COLOR_TWITTER\"\n | \"NETWORK_COLOR_TWITTER_LIKE\"\n | \"NETWORK_COLOR_FACEBOOK\"\n | \"NETWORK_COLOR_FACEBOOK_AUDIENCE_NETWORK\"\n | \"NETWORK_COLOR_LINKEDIN\"\n | \"NETWORK_COLOR_INSTAGRAM\"\n | \"NETWORK_COLOR_FEEDLY\"\n | \"NETWORK_COLOR_ANALYTICS\"\n | \"NETWORK_COLOR_YOUTUBE\"\n | \"NETWORK_COLOR_MESSENGER\"\n | \"NETWORK_COLOR_SNAPCHAT\"\n | \"NETWORK_COLOR_PINTEREST\"\n | \"NETWORK_COLOR_REDDIT\"\n | \"NETWORK_COLOR_TUMBLR\"\n | \"NETWORK_COLOR_GOOGLE_MY_BUSINESS\"\n | \"NETWORK_COLOR_TIKTOK\"\n | \"NETWORK_COLOR_TRIPADVISOR\"\n | \"NETWORK_COLOR_GLASSDOOR\"\n | \"NETWORK_COLOR_SALESFORCE\"\n | \"NETWORK_COLOR_ZENDESK\"\n | \"NETWORK_COLOR_HUBSPOT\"\n | \"NETWORK_COLOR_MICROSOFT_DYNAMICS\";\n\ntype TypeNetworkColorBoxProps = Readonly<\n TypeColorBoxProps & {\n networkColor: TypeNetworkColor;\n }\n>;\n\n/**\n * NetworkColorBox extends ColorBox to set the background color to a <a href=\"https://seeds.sproutsocial.com/visual/color#full-color-palette\">network color</a>.\n */\nexport const NetworkColorBox = ({\n networkColor,\n ...props\n}: TypeNetworkColorBoxProps) => {\n return <ColorBox {...props} bg={NETWORK_COLORS[networkColor]} />;\n};\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 {\n SeriesSplineOptions,\n SeriesAreasplineOptions,\n SeriesColumnOptions,\n} from \"highcharts\";\n\nimport type { TypeAreaChartProps } from \"../components/AreaChart\";\nimport type { TypeLineChartProps } from \"../components/LineChart\";\nimport type { TypeVerticalBarChartProps, TypeSeriesType } from \"../types\";\n\ntype TypeTimeSeriesOptions =\n | SeriesSplineOptions\n | SeriesAreasplineOptions\n | SeriesColumnOptions;\n\n// returns a transformed set of data to series with some logic for handling null values\nexport const transformDataToSeries = (\n {\n data,\n }: {\n data:\n | TypeAreaChartProps[\"data\"]\n | TypeLineChartProps[\"data\"]\n | TypeVerticalBarChartProps[\"data\"];\n },\n type: TypeSeriesType\n): TypeTimeSeriesOptions[] => {\n // Check if we have categorical data (string x values)\n const hasCategoricalData = data.some((series) =>\n series.points.some((point) => typeof point.x === \"string\")\n );\n\n return data.map((dataItem, dataIndex) => {\n const points = dataItem.points || [];\n const dataPoints = points.map((point, pointsIndex) => {\n let enableMarker = false;\n const isFirstPoint = pointsIndex === 0;\n const isLastPoint = pointsIndex === points.length - 1;\n\n // @ts-ignore\n const previousY = isFirstPoint ? null : points[pointsIndex - 1].y;\n // @ts-ignore\n const nextY = isLastPoint ? null : points[pointsIndex + 1].y;\n\n if (isFirstPoint && nextY === null) {\n // if the first point has data and the second point is null, show a marker for the first point\n enableMarker = true;\n } else if (isLastPoint && previousY === null) {\n // if the last point has data and the second to last point is null, show a marker for the last point\n enableMarker = true;\n } else if (previousY === null && nextY === null) {\n // if the a point has null values on both sides, show a marker\n enableMarker = true;\n }\n\n return {\n x: hasCategoricalData ? pointsIndex : point.x,\n y: point.y,\n marker: {\n enabled: enableMarker ? enableMarker : undefined,\n symbol: enableMarker ? \"circle\" : undefined,\n },\n // For categorical data, store the original category name\n ...(hasCategoricalData && { name: point.x }),\n };\n });\n\n return {\n colorIndex: dataIndex,\n data: dataPoints as TypeTimeSeriesOptions[\"data\"],\n name: dataItem.name as TypeTimeSeriesOptions[\"name\"],\n type: type,\n };\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-ignore\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 type {\n AxisLabelsFormatterContextObject,\n AxisTickPositionsArray,\n} from \"highcharts\";\nimport { formatDuration } from \"@sproutsocial/seeds-react-duration\";\nimport { formatNumeral } from \"@sproutsocial/seeds-react-numeral\";\n\nimport type { TypeChartNumberFormat } from \"../types\";\n\ntype TypeYAxisLabelFormatterProps = Readonly<{\n numberLocale: Intl.LocalesArgument;\n textLocale: Intl.LocalesArgument;\n tickPositions: AxisTickPositionsArray;\n value: AxisLabelsFormatterContextObject[\"value\"];\n // optional\n currency?: string;\n numberFormat?: TypeChartNumberFormat;\n}>;\n\nexport const yAxisLabelFormatter = ({\n numberLocale,\n textLocale,\n tickPositions,\n value,\n currency = \"USD\",\n numberFormat = \"decimal\",\n}: TypeYAxisLabelFormatterProps): string => {\n const numberValue = Number(value);\n\n if (numberValue === 0) {\n return formatNumeral({\n locale: numberLocale as string,\n number: numberValue,\n });\n }\n\n if (numberFormat === \"duration\") {\n return formatDuration({\n display: \"narrow\",\n locale: textLocale,\n milliseconds: numberValue,\n });\n }\n\n // Seeds formatNumeral helper starts abbreviating numbers above 10,000. this maxValue logic\n // helps bring that threshold down to 1,000 if the last tick on the y axis is greater than 9,999\n // so we render \"2k 4k 6k 8k 10k\" instead of \"2,000 4,000 6,000 8,000 10k\"\n const maxValue =\n tickPositions && tickPositions.length > 0\n ? tickPositions[tickPositions.length - 1]\n : undefined;\n const abbreviate =\n typeof maxValue === \"number\" && maxValue > 9999 ? 1000 : true;\n\n return formatNumeral({\n abbreviate,\n currency,\n format: numberFormat,\n locale: numberLocale as string,\n number: numberValue,\n });\n};\n","import type {\n AxisLabelsFormatterContextObject,\n AxisTickPositionsArray,\n} from \"highcharts\";\n\nimport type {\n ExtendedTimeTicksInfoObject,\n TypeChartTimeFormat,\n} from \"../types\";\n\nconst getDatePartsInTimezone = (date: Date, timezone: string) => {\n const formatter = new Intl.DateTimeFormat(\"en-US\", {\n year: \"numeric\",\n month: \"numeric\",\n day: \"numeric\",\n timeZone: timezone,\n });\n const parts = formatter.formatToParts(date);\n return {\n day: parseInt(parts.find((p) => p.type === \"day\")?.value ?? \"0\", 10),\n month: parseInt(parts.find((p) => p.type === \"month\")?.value ?? \"0\", 10),\n year: parseInt(parts.find((p) => p.type === \"year\")?.value ?? \"0\", 10),\n };\n};\n\ntype TypeXAxisLabelFormatterProps = Readonly<{\n textLocale: Intl.LocalesArgument;\n tickPositions: AxisTickPositionsArray;\n unitName: ExtendedTimeTicksInfoObject[\"unitName\"];\n value: AxisLabelsFormatterContextObject[\"value\"];\n // optional\n timeFormat?: TypeChartTimeFormat;\n timezone?: string;\n}>;\n\nexport const xAxisLabelFormatter = ({\n textLocale,\n tickPositions = [],\n unitName,\n value,\n // optional\n timeFormat = \"12\",\n timezone = \"UTC\",\n}: TypeXAxisLabelFormatterProps): string => {\n // Handle categorical (string) data\n if (typeof value === \"string\") {\n return `<span>${value}</span>`;\n }\n const tickIndex = tickPositions.indexOf(value as number);\n const isFirst = tickIndex === 0;\n const previousValue = tickPositions[tickIndex - 1];\n\n const valueDate = new Date(value);\n const valueParts = getDatePartsInTimezone(valueDate, timezone);\n const previousValueDate = previousValue ? new Date(previousValue) : undefined;\n const previousValueParts = previousValueDate\n ? getDatePartsInTimezone(previousValueDate, timezone)\n : undefined;\n\n let firstPartOptions = {};\n let secondPartOptions = {};\n\n switch (unitName) {\n case \"hour\":\n firstPartOptions =\n timeFormat === \"24\"\n ? { hour: \"numeric\", minute: \"numeric\", hour12: false }\n : { hour: \"numeric\" };\n if (isFirst || valueParts.day !== previousValueParts?.day) {\n secondPartOptions = { day: \"numeric\", month: \"short\" };\n }\n break;\n case \"day\":\n case \"week\":\n firstPartOptions = { day: \"numeric\" };\n if (isFirst || valueParts.month !== previousValueParts?.month) {\n secondPartOptions = { month: \"short\" };\n }\n break;\n case \"month\":\n firstPartOptions = { month: \"short\" };\n if (isFirst || valueParts.year !== previousValueParts?.year) {\n secondPartOptions = { year: \"numeric\" };\n }\n break;\n case \"year\":\n firstPartOptions = { year: \"numeric\" };\n break;\n default:\n firstPartOptions = {};\n break;\n }\n\n const firstPart = new Intl.DateTimeFormat(textLocale, {\n ...firstPartOptions,\n timeZone: timezone,\n }).format(valueDate);\n const secondPart =\n Object.keys(secondPartOptions).length > 0\n ? new Intl.DateTimeFormat(textLocale, {\n ...secondPartOptions,\n timeZone: timezone,\n }).format(valueDate)\n : undefined;\n\n return `<span>${firstPart}</span>${\n secondPart ? `<span>${secondPart}</span>` : \"\"\n }`;\n};\n","/**\n * Helper to detect if data is hourly time data (all x values are hours of the same day)\n * @param data - Array of series data with points containing x values\n * @returns boolean indicating if all x values are hours of the same day\n * @deprecated Auto-detection of hourly data is deprecated. v2 is declarative:\n * use `xAxis={{ type: \"datetime\", timeFormat: \"12\" | \"24\" }}` + a top-level\n * `timezone` instead of relying on implicit detection. See\n * `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`\n * (CE-8).\n */\nexport function isHourlyTimeData(\n data: ReadonlyArray<\n Readonly<{ points: ReadonlyArray<{ x: number | string }> }>\n >\n): boolean {\n // Return false if there is no data.\n if (!data.length) return false;\n\n // Flatten all data points into a single array of x values.\n const xVals = data.flatMap((series) => series.points.map((p) => p.x));\n\n // Return false if there are no x values.\n if (!xVals.length) return false;\n\n // Return false if any x values are strings (categorical data)\n if (xVals.some((x) => typeof x === \"string\")) return false;\n\n // Check if all x values are on the same calendar date.\n // We do this by converting each timestamp to a YYYY-MM-DD string and checking if there's only one unique date string.\n const dates = (xVals as number[]).map((x) => {\n const d = new Date(x);\n return `${d.getUTCFullYear()}-${d.getUTCMonth()}-${d.getUTCDate()}`;\n });\n const uniqueDates = new Set(dates);\n if (uniqueDates.size !== 1) return false;\n\n // Check if all x values are exactly on the hour (e.g., 2:00:00, not 2:00:01).\n // We also check that the hour is within the valid 0-23 range.\n return (xVals as number[]).every((x) => {\n const d = new Date(x);\n const hour = d.getUTCHours();\n const minutes = d.getUTCMinutes();\n const seconds = d.getUTCSeconds();\n return hour >= 0 && hour <= 23 && minutes === 0 && seconds === 0;\n });\n}\n","/**\n * Helper to detect if data is categorical hour data (all x values are hour strings)\n * Supports both 12-hour format (\"12 AM\", \"1 PM\") and 24-hour format (\"00:00\", \"13:00\", \"23:00\")\n * @param data - Array of series data with points containing x values\n * @returns boolean indicating if all x values are hour strings\n * @deprecated Auto-detection of hourly data is deprecated. v2 is declarative:\n * use `xAxis={{ type: \"datetime\", timeFormat: \"12\" | \"24\" }}` + a top-level\n * `timezone` instead of relying on implicit detection. See\n * `seeds-tooling/seeds-codemod-cli/src/usage-patterns/VERTICALBARCHARTV1_PATTERNS.md`\n * (CE-8).\n */\nexport function isCategoricalHourData(\n data: ReadonlyArray<\n Readonly<{ points: ReadonlyArray<{ x: number | string }> }>\n >\n): boolean {\n // Return false if there is no data.\n if (!data.length) return false;\n\n // Flatten all data points into a single array of x values.\n const xVals = data.flatMap((series) => series.points.map((p) => p.x));\n\n // Return false if there are no x values.\n if (!xVals.length) return false;\n\n // Return false if any x values are not strings (numerical data)\n if (xVals.some((x) => typeof x !== \"string\")) return false;\n\n // Check if all x values match either 12-hour or 24-hour format patterns\n const hour12Pattern = /^\\d{1,2} (AM|PM)$/; // \"12 AM\", \"1 PM\", \"10 AM\"\n const hour24Pattern = /^([01]?\\d|2[0-3]):([0-5]\\d)$/; // \"00:00\", \"13:00\", \"23:59\"\n\n const stringValues = xVals as string[];\n\n // Check if all values match 12-hour format\n const allMatch12Hour = stringValues.every((x) => hour12Pattern.test(x));\n\n // Check if all values match 24-hour format\n const allMatch24Hour = stringValues.every((x) => hour24Pattern.test(x));\n\n return allMatch12Hour || allMatch24Hour;\n}\n","export const getStorybookRandomColor = (): string => {\n const letters = \"0123456789ABCDEF\";\n let color = \"#\";\n for (let i = 0; i < 6; i++) {\n color += letters[Math.floor(Math.random() * 16)];\n }\n return color;\n};\n","import { getStorybookRandomColor } from \"./getStorybookRandomColor\";\n\nexport const getStorybookCategoricalData = ({\n showNulls,\n showNegativeValues,\n numberOfSeries,\n yAxisMax,\n showCustomColors,\n showDashedLines,\n categoryType,\n}: {\n showNulls: boolean;\n showNegativeValues: boolean;\n numberOfSeries: number;\n yAxisMax: number;\n showCustomColors: boolean;\n showDashedLines: boolean;\n categoryType: \"hours\" | \"hours24\" | \"days\" | \"months\" | \"custom\";\n}) => {\n // Define different category sets\n const categoryOptions = {\n hours: [\n \"12 AM\",\n \"1 AM\",\n \"2 AM\",\n \"3 AM\",\n \"4 AM\",\n \"5 AM\",\n \"6 AM\",\n \"7 AM\",\n \"8 AM\",\n \"9 AM\",\n \"10 AM\",\n \"11 AM\",\n \"12 PM\",\n \"1 PM\",\n \"2 PM\",\n \"3 PM\",\n \"4 PM\",\n \"5 PM\",\n \"6 PM\",\n \"7 PM\",\n \"8 PM\",\n \"9 PM\",\n \"10 PM\",\n \"11 PM\",\n ],\n hours24: [\n \"00:00\",\n \"01:00\",\n \"02:00\",\n \"03:00\",\n \"04:00\",\n \"05:00\",\n \"06:00\",\n \"07:00\",\n \"08:00\",\n \"09:00\",\n \"10:00\",\n \"11:00\",\n \"12:00\",\n \"13:00\",\n \"14:00\",\n \"15:00\",\n \"16:00\",\n \"17:00\",\n \"18:00\",\n \"19:00\",\n \"20:00\",\n \"21:00\",\n \"22:00\",\n \"23:00\",\n ],\n days: [\n \"Monday\",\n \"Tuesday\",\n \"Wednesday\",\n \"Thursday\",\n \"Friday\",\n \"Saturday\",\n \"Sunday\",\n ],\n months: [\n \"January\",\n \"February\",\n \"March\",\n \"April\",\n \"May\",\n \"June\",\n \"July\",\n \"August\",\n \"September\",\n \"October\",\n \"November\",\n \"December\",\n ],\n custom: [\n \"Category A\",\n \"Category B\",\n \"Category C\",\n \"Category D\",\n \"Category E\",\n ],\n };\n\n const categories = categoryOptions[categoryType];\n const numberOfPoints = categories.length;\n\n return [...Array(numberOfSeries).keys()].map((seriesIndex) => {\n let nullsArray: ReadonlyArray<number> = [];\n\n if (showNulls) {\n const nullsArrayLength = Math.floor(numberOfPoints / 5);\n nullsArray = [...Array(nullsArrayLength)].map(() =>\n Math.floor(Math.random() * numberOfPoints)\n );\n }\n\n return {\n points: categories.map((category, pointIndex) => {\n const showNull =\n nullsArray && nullsArray.length > 0\n ? nullsArray.includes(pointIndex)\n : false;\n const randomValue = Math.random();\n const positiveOrNegativeYAxisMax = showNegativeValues\n ? randomValue < 0.5\n ? -yAxisMax\n : yAxisMax\n : yAxisMax;\n\n return {\n x: category,\n y: showNull\n ? null\n : Math.floor(randomValue * positiveOrNegativeYAxisMax),\n };\n }),\n name: `Series ${seriesIndex + 1}`,\n styles: {\n color: showCustomColors ? getStorybookRandomColor() : undefined,\n pattern: showDashedLines ? \"dashed\" : \"solid\",\n },\n };\n });\n};\n","import { getStorybookRandomColor } from \"./getStorybookRandomColor\";\n\nexport const getStorybookSparseTimelineData = ({\n showNulls,\n showNegativeValues,\n numberOfSeries,\n yAxisMax,\n showCustomColors,\n showDashedLines,\n numberOfPoints = 5,\n timeSpanHours = 24,\n}: {\n showNulls: boolean;\n showNegativeValues: boolean;\n numberOfSeries: number;\n yAxisMax: number;\n showCustomColors: boolean;\n showDashedLines: boolean;\n numberOfPoints?: number;\n timeSpanHours?: number;\n}) => {\n const seriesNames = [\n \"Posts Published\",\n \"Comments\",\n \"Likes\",\n \"Shares\",\n \"Clicks\",\n \"Views\",\n \"Saves\",\n \"Reposts\",\n \"Mentions\",\n \"Reactions\",\n ];\n\n const baseDate = new Date(\"2024-01-01T00:00:00Z\");\n const timeSpanMs = timeSpanHours * 60 * 60 * 1000;\n\n return [...Array(numberOfSeries).keys()].map((seriesIndex) => {\n let nullsArray: ReadonlyArray<number> = [];\n\n if (showNulls) {\n const nullsArrayLength = Math.floor(numberOfPoints / 5);\n nullsArray = [...Array(nullsArrayLength)].map(() =>\n Math.floor(Math.random() * numberOfPoints)\n );\n }\n\n // Generate random timestamps for this series\n const timestamps = [...Array(numberOfPoints)]\n .map(() => {\n const randomOffset = Math.random() * timeSpanMs;\n return baseDate.getTime() + randomOffset;\n })\n .sort((a, b) => a - b); // Sort chronologically\n\n return {\n points: timestamps.map((timestamp, pointIndex) => {\n const showNull =\n nullsArray && nullsArray.length > 0\n ? nullsArray.includes(pointIndex)\n : false;\n const randomValue = Math.random();\n const positiveOrNegativeYAxisMax = showNegativeValues\n ? randomValue < 0.5\n ? -yAxisMax\n : yAxisMax\n : yAxisMax;\n\n return {\n x: timestamp,\n y: showNull\n ? null\n : Math.floor(randomValue * positiveOrNegativeYAxisMax),\n };\n }),\n name: seriesNames[seriesIndex] || `Series ${seriesIndex + 1}`,\n styles: {\n color: showCustomColors ? getStorybookRandomColor() : undefined,\n pattern: showDashedLines ? \"dashed\" : \"solid\",\n },\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"]}