@react-magma/charts 1.0.0 → 1.0.2-next.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.
@@ -1 +1 @@
1
- {"version":3,"file":"charts.modern.module.js","sources":["../src/components/LineChart/magma-charts.ts","../src/components/LineChart/GraphTooltip.tsx","../src/components/LineChart/CustomPointComponent.tsx","../src/components/LineChart/CustomAxisComponent.tsx","../src/components/LineChart/LegendButton.tsx","../src/components/LineChart/LineChart.tsx","../src/components/LineChart/ChartDataTable.tsx","../src/components/LineChart/Chart.tsx"],"sourcesContent":["// *\n// * Colors\n// *\n// const yellow200 = '#FFF59D';\n// const deepOrange600 = '#F4511E';\n// const lime300 = '#DCE775';\n// const lightGreen500 = '#8BC34A';\n// const teal700 = '#00796B';\n// const cyan900 = '#006064';\n\n// const colors = [\n// '#0085CC',\n// '#E0004D',\n// '#FA6600',\n// '#48A200',\n// '#B12FAD',\n// '#00A393',\n// ];\n\nconst colors = [\n '#00507A',\n '#8F0033',\n '#B84900',\n '#255200',\n '#711E6E',\n '#005249',\n];\n\nconst blueGrey50 = '#DFDFDF';\nconst blueGrey300 = '#8F8F8F';\nconst blueGrey700 = '#3F3F3F';\nconst grey900 = 'pink';\n\n// *\n// * Typography\n// *\nconst sansSerif = '\"Work Sans\",Helvetica,sans-serif';\nconst letterSpacing = 'normal';\nconst fontSize = 12;\n\n// *\n// * Layout\n// *\nconst padding = 8;\nconst baseProps = {\n width: 350,\n height: 350,\n padding: 50,\n};\n\n// *\n// * Labels\n// *\nconst baseLabelStyles = {\n fontFamily: sansSerif,\n fontSize,\n letterSpacing,\n padding,\n fill: blueGrey700,\n stroke: 'transparent',\n strokeWidth: 0,\n};\n\nconst centeredLabelStyles = { textAnchor: 'middle', ...baseLabelStyles };\n// *\n// * Strokes\n// *\n// const strokeDasharray = '10, 5';\nconst strokeLinecap = 'round';\nconst strokeLinejoin = 'round';\n\nexport const magmaTheme: any = {\n area: {\n style: {\n data: {\n fill: grey900,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n axis: {\n style: {\n axis: {\n fill: 'transparent',\n stroke: blueGrey300,\n strokeWidth: 1,\n strokeLinecap,\n strokeLinejoin,\n },\n axisLabel: {\n ...centeredLabelStyles,\n padding,\n stroke: 'transparent',\n },\n grid: {\n fill: 'none',\n stroke: '#dfdfdf',\n //strokeDasharray,\n strokeLinecap,\n strokeLinejoin,\n pointerEvents: 'painted',\n },\n ticks: {\n fill: 'transparent',\n size: 0,\n stroke: blueGrey300,\n strokeWidth: 0,\n strokeLinecap,\n strokeLinejoin,\n },\n tickLabels: {\n ...baseLabelStyles,\n fill: blueGrey700,\n },\n },\n ...baseProps,\n },\n polarDependentAxis: {\n style: {\n ticks: {\n fill: 'transparent',\n size: 1,\n stroke: 'transparent',\n },\n },\n },\n bar: {\n style: {\n data: {\n fill: blueGrey700,\n padding,\n strokeWidth: 0,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n boxplot: {\n style: {\n max: { padding, stroke: blueGrey700, strokeWidth: 1 },\n maxLabels: { ...baseLabelStyles, padding: 3 },\n median: { padding, stroke: blueGrey700, strokeWidth: 1 },\n medianLabels: { ...baseLabelStyles, padding: 3 },\n min: { padding, stroke: blueGrey700, strokeWidth: 1 },\n minLabels: { ...baseLabelStyles, padding: 3 },\n q1: { padding, fill: blueGrey700 },\n q1Labels: { ...baseLabelStyles, padding: 3 },\n q3: { padding, fill: blueGrey700 },\n q3Labels: { ...baseLabelStyles, padding: 3 },\n },\n boxWidth: 20,\n ...baseProps,\n },\n candlestick: {\n style: {\n data: {\n stroke: blueGrey700,\n },\n labels: { ...baseLabelStyles, padding: 5 },\n },\n candleColors: {\n positive: '#ffffff',\n negative: blueGrey700,\n },\n ...baseProps,\n },\n chart: baseProps,\n errorbar: {\n borderWidth: 8,\n style: {\n data: {\n fill: 'transparent',\n opacity: 1,\n stroke: blueGrey700,\n strokeWidth: 2,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n group: {\n colorScale: colors,\n ...baseProps,\n },\n histogram: {\n style: {\n data: {\n fill: blueGrey700,\n stroke: grey900,\n strokeWidth: 2,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n legend: {\n colorScale: colors,\n gutter: 10,\n orientation: 'vertical',\n titleOrientation: 'top',\n style: {\n data: {\n type: 'circle',\n },\n labels: baseLabelStyles,\n title: { ...baseLabelStyles, padding: 5 },\n },\n },\n line: {\n style: {\n data: {\n fill: 'transparent',\n opacity: 1,\n stroke: blueGrey700,\n strokeWidth: 2,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n pie: {\n colorScale: colors,\n style: {\n data: {\n padding,\n stroke: blueGrey50,\n strokeWidth: 1,\n },\n labels: { ...baseLabelStyles, padding: 20 },\n },\n ...baseProps,\n },\n scatter: {\n style: {\n data: {\n fill: blueGrey700,\n opacity: 1,\n stroke: 'transparent',\n strokeWidth: 0,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n stack: {\n colorScale: colors,\n ...baseProps,\n },\n tooltip: {\n style: { ...baseLabelStyles, padding: 0, pointerEvents: 'none' },\n flyoutStyle: {\n stroke: grey900,\n strokeWidth: 1,\n fill: '#f0f0f0',\n pointerEvents: 'none',\n },\n flyoutPadding: 5,\n cornerRadius: 5,\n pointerLength: 10,\n },\n voronoi: {\n style: {\n data: {\n fill: 'transparent',\n stroke: 'transparent',\n strokeWidth: 0,\n },\n labels: { ...baseLabelStyles, padding: 5, pointerEvents: 'none' },\n flyout: {\n stroke: grey900,\n strokeWidth: 1,\n fill: '#f0f0f0',\n pointerEvents: 'none',\n },\n },\n ...baseProps,\n },\n};\n","import * as React from 'react';\nimport {\n StyledTooltip,\n ThemeContext,\n TooltipArrow,\n TooltipPosition,\n ThemeInterface,\n styled,\n} from 'react-magma-dom';\n\nconst StyledGraphTooltip = styled(StyledTooltip)`\n background: ${(props: any) => props.theme.colors.neutral08};\n border: 1px solid ${(props: any) => props.theme.colors.neutral06};\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);\n box-sizing: border-box;\n color: ${(props: any) => props.theme.colors.neutral};\n font-size: ${(props: any) => props.theme.typeScale.size02.fontSize};\n font-weight: normal;\n line-height: ${(props: any) => props.theme.typeScale.size02.lineHeight};\n margin: 0;\n padding: 8px;\n width: fit-content;\n div {\n margin-bottom: 8px;\n display: flex;\n align-items: flex-start;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n`;\n\nconst TooltipColorSwatch = styled.span`\n background: ${(props: any) => props.color};\n border: ${(props: any) => (props.color ? 'none' : '3px solid black')};\n border-radius: 4px;\n height: 20px;\n width: 20px;\n margin-right: 8px;\n`;\n\nexport const GraphTooltip = (props: any) => {\n const { datum, index, showTooltip, x, y } = props;\n\n const theme: ThemeInterface = React.useContext(ThemeContext);\n const linePointIndex = `${index}-${datum.index}`;\n\n return showTooltip === linePointIndex ? (\n <g style={{ pointerEvents: 'none' }}>\n <foreignObject x={x} y={y} width=\"275\" height=\"100%\">\n <StyledGraphTooltip\n position={TooltipPosition.top}\n role=\"tooltip\"\n theme={theme}\n >\n <div>\n <TooltipColorSwatch color={theme.iterableColors[index]} />\n <span>{datum.label}</span>\n </div>\n <TooltipArrow theme={theme} />\n </StyledGraphTooltip>\n </foreignObject>\n </g>\n ) : null;\n};\n\nexport const AxisTooltip = (props: any) => {\n const { x, y, activePoints, hiddenData, dataLength } = props;\n\n const pointsIndexes = Array.from(\n Array(dataLength - 0),\n (_, i) => i + 0\n ).filter(i => !hiddenData.includes(i));\n\n const theme: ThemeInterface = React.useContext(ThemeContext);\n\n return (\n <g style={{ pointerEvents: 'none' }}>\n <foreignObject x={x} y={y} width=\"275\" height=\"100%\">\n <StyledGraphTooltip\n data-testid=\"axis-tooltip\"\n position={TooltipPosition.top}\n role=\"tooltip\"\n theme={theme}\n >\n {activePoints.map((point: any, i: number) => (\n <div key={i}>\n <TooltipColorSwatch\n color={theme.iterableColors[pointsIndexes[i]]}\n />\n <span>{point.label}</span>\n </div>\n ))}\n <TooltipArrow theme={theme} />\n </StyledGraphTooltip>\n </foreignObject>\n </g>\n );\n};\n","import * as React from 'react';\nimport { Point, PointProps } from 'victory';\nimport { useForceUpdate } from 'react-magma-dom';\n\nexport interface CustomScatterDataComponentInterface extends PointProps {\n lineIndex: number;\n pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;\n registerPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n unregisterPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n}\n\nexport interface CustomPointComponentInterface {\n lineIndex: number;\n pointIndex: PointProps['index'];\n pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;\n registerPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n unregisterPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n}\n\nexport const CustomScatterDataComponent = (\n props: CustomScatterDataComponentInterface\n) => {\n const {\n datum,\n index: pointIndex,\n lineIndex,\n pointRefArray,\n registerPoint,\n unregisterPoint,\n ...other\n } = props;\n return (\n <Point\n {...other}\n ariaLabel={datum.label}\n pathComponent={\n <CustomPointComponent\n lineIndex={lineIndex}\n pointIndex={pointIndex}\n pointRefArray={pointRefArray}\n registerPoint={registerPoint}\n unregisterPoint={unregisterPoint}\n />\n }\n role=\"button\"\n tabIndex={0}\n />\n );\n};\n\nexport const CustomPointComponent = (props: CustomPointComponentInterface) => {\n const {\n lineIndex,\n pointRefArray,\n pointIndex,\n registerPoint,\n unregisterPoint,\n ...other\n } = props;\n const forceUpdate = useForceUpdate();\n const ref = React.useRef<SVGPathElement | null>(null);\n\n React.useEffect(() => {\n registerPoint(pointRefArray, ref as React.MutableRefObject<Element>);\n\n forceUpdate();\n\n return () =>\n unregisterPoint(pointRefArray, ref as React.MutableRefObject<Element>);\n }, []);\n\n return (\n <path\n ref={ref}\n data-line-index={lineIndex}\n data-point-index={pointIndex}\n {...other}\n />\n );\n};\n","import * as React from 'react';\nimport { LineSegment, LineSegmentProps } from 'victory';\n\nexport const CustomAxisComponent: React.FunctionComponent<LineSegmentProps> = ({\n events,\n ...props\n}: any) => {\n return (\n <g>\n <LineSegment\n {...props}\n events={events}\n style={{\n strokeWidth: '50px',\n stroke: 'transparent',\n }}\n />\n <LineSegment\n {...props}\n events={events}\n style={{\n strokeWidth: '1px',\n stroke: 'black',\n strokeOpacity: '0.2',\n }}\n />\n </g>\n );\n};\n","import * as React from 'react';\nimport { ThemeContext, Checkbox } from 'react-magma-dom';\n\nexport interface DataTableProps {\n name?: string;\n color?: string;\n}\n\nexport const LegendButton = React.forwardRef<HTMLButtonElement, any>(\n (props, ref) => {\n const {\n children,\n color,\n dataIndex,\n isHidden,\n onClick,\n name,\n focusCurrentLine,\n resetLineFocus,\n ...other\n } = props;\n\n function handleClick() {\n onClick && typeof onClick === 'function' && onClick(dataIndex);\n\n if (!isHidden) {\n resetLineFocus &&\n typeof resetLineFocus === 'function' &&\n resetLineFocus();\n }\n }\n\n function handleOnMouseEnterOrFocus() {\n if (!isHidden) {\n focusCurrentLine &&\n typeof focusCurrentLine === 'function' &&\n focusCurrentLine(dataIndex);\n }\n }\n\n const theme = React.useContext(ThemeContext);\n\n return (\n <div\n style={{ display: 'inline-flex' }}\n onMouseEnter={handleOnMouseEnterOrFocus}\n onMouseLeave={resetLineFocus}\n >\n <Checkbox\n checked={!isHidden}\n color={color}\n containerStyle={{\n alignItems: 'center',\n border: '0',\n boxShadow: '0 0 0',\n color: theme.colors.neutral,\n display: 'inline-flex',\n margin: '0 36px 20px 0',\n padding: '0',\n }}\n inputStyle={{\n border: color ? `none` : `2px solid ${theme.colors.neutral02}`,\n borderRadius: '4px',\n }}\n labelText={name}\n onBlur={resetLineFocus}\n onClick={handleClick}\n onFocus={handleOnMouseEnterOrFocus}\n ref={ref}\n theme={theme}\n {...other}\n />\n </div>\n );\n }\n);\n","import * as React from 'react';\nimport {\n VictoryAxis,\n VictoryAxisProps,\n VictoryChart,\n VictoryChartProps,\n VictoryLine,\n VictoryLineProps,\n VictoryScatter,\n VictoryScatterProps,\n VictoryTooltip,\n VictoryVoronoiContainer,\n} from 'victory';\n\nimport {\n I18nContext,\n ThemeContext,\n styled,\n ThemeInterface,\n I18nInterface,\n} from 'react-magma-dom';\n\nimport { magmaTheme } from './magma-charts';\nimport { AxisTooltip, GraphTooltip } from './GraphTooltip';\nimport { CustomScatterDataComponent } from './CustomPointComponent';\nimport { CustomAxisComponent } from './CustomAxisComponent';\nimport { LegendButton } from './LegendButton';\n\nexport type LineChartAxisStyle = VictoryAxisProps['style'];\nexport type DataGetterPropType = VictoryLineProps['x'];\n\nexport type ChartDataOptions =\n | {\n label: string;\n x: string | number;\n y: string | number;\n [key: string]: any;\n }\n | { label: string; [key: string]: any }\n | any;\n\nexport interface LineChartData<T> {\n name: string;\n data: T[];\n}\n\nexport interface LineChartComponentProps {\n chart?: VictoryChartProps;\n line?: VictoryLineProps;\n scatter?: VictoryScatterProps;\n xAxis?: VictoryAxisProps;\n yAxis?: VictoryAxisProps;\n}\n\nexport interface LineChartProps<T extends ChartDataOptions> {\n /**\n * Props passed to each component that makes up the line chart. See `victory` for accepted props.\n */\n componentProps?: LineChartComponentProps;\n /**\n * Data used to build the chart\n */\n data?: LineChartData<T>[];\n isMulti?: boolean;\n /**\n * @internal\n */\n lastFocusedScatterPoint: React.MutableRefObject<SVGPathElement | null>;\n /**\n * @internal\n */\n pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;\n /**\n * @internal\n */\n registerPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n /**\n * @internal\n */\n tabRef: React.MutableRefObject<HTMLButtonElement | null>;\n /**\n * @internal\n */\n unregisterPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n /**\n * Value of x key in chart data\n */\n x?: keyof T;\n /**\n * Value of y key in chart data\n */\n y?: keyof T;\n}\n\nconst LineChartContainer = styled.div`\n max-height: 600px;\n max-width: 800px;\n svg {\n overflow: visible;\n }\n`;\n\nconst VictoryChartContainer = styled.div``;\n\nconst DataLegendsContainer = styled.div`\n padding-bottom: 24px;\n`;\n\nconst DataLegendsDescription = styled.p`\n color: ${(props: any) => props.theme.colors.neutral03};\n font-size: ${(props: any) => props.theme.typeScale.size02.fontSize};\n`;\n\nexport function LineChart<T>(props: LineChartProps<T>) {\n const {\n componentProps: {\n chart = {},\n line = {},\n scatter = {},\n xAxis: {\n style: {\n axisLabel: xAxisLabel = undefined,\n tickLabels: xTickLabels = undefined,\n ...xRest\n } = {},\n ...xAxisOther\n } = { style: {} },\n yAxis: {\n style: {\n axisLabel: yAxisLabel = undefined,\n tickLabels: yTickLabels = undefined,\n ...yRest\n } = {},\n ...yAxisOther\n } = { style: {} },\n } = {},\n data = [],\n lastFocusedScatterPoint,\n pointRefArray,\n registerPoint,\n unregisterPoint,\n tabRef,\n x,\n y,\n } = props;\n\n const theme: ThemeInterface = React.useContext(ThemeContext);\n const i18n: I18nInterface = React.useContext(I18nContext);\n\n const [hiddenData, setHiddenData] = React.useState<number[]>([]);\n const [width, setWidth] = React.useState<number>(800);\n const [focusedLine, setFocusedLine] = React.useState<number | null>(null);\n const [showTooltip, setShowTooltip] = React.useState<string | null>(null);\n const [showXAxisLabel, setShowXAxisLabel] = React.useState<boolean>(true);\n const [hoveringOnXAxisLine, setHoveringOnXAxisLine] =\n React.useState<boolean>(false);\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const firstLegendButtonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useEffect(() => {\n updateWidth();\n\n window.addEventListener('resize', updateWidth);\n window.addEventListener('keydown', handleEsc);\n\n return () => {\n window.removeEventListener('resize', updateWidth);\n window.removeEventListener('keydown', handleEsc);\n };\n }, []);\n\n React.useEffect(() => {\n window.addEventListener('mousemove', handleMouseMove);\n\n return () => {\n window.removeEventListener('mousemove', handleMouseMove);\n };\n }, [showTooltip]);\n\n const scatterNames: string[] = data.map((_, i) => `scatter-${i}`);\n\n const xAxisStyles = {\n tickLabels: {\n color: '#3f3f3f',\n fontSize: 12,\n ...xTickLabels,\n },\n axisLabel: {\n color: '#3f3f3f',\n padding: 44,\n fontSize: 14,\n fontWeight: 'bold',\n ...xAxisLabel,\n },\n ...xRest,\n };\n\n const yAxisStyles = {\n tickLabels: {\n fontSize: 12,\n ...yTickLabels,\n },\n axisLabel: {\n color: '#3f3f3f',\n padding: 64,\n fontSize: 14,\n fontWeight: 'bold',\n ...yAxisLabel,\n },\n ...yRest,\n };\n\n function updateWidth() {\n containerRef.current && setWidth(containerRef.current.clientWidth);\n }\n\n function handleEsc(event: KeyboardEvent): any {\n if (event.key === 'Escape') {\n setShowTooltip(null);\n setShowXAxisLabel(false);\n }\n }\n\n function handleMouseMove() {\n !showTooltip && setShowXAxisLabel(true);\n }\n\n function setLineOpacity(index: number) {\n return focusedLine === null ? 1 : focusedLine === index ? 1 : 0.1;\n }\n\n function handleLegendClick(dataIndex: number) {\n if (hiddenData.includes(dataIndex)) {\n setHiddenData(hiddenData.filter(item => item !== dataIndex));\n } else {\n setHiddenData(hiddenData.concat([dataIndex]));\n }\n }\n\n function focusCurrentLine(dataIndex: number) {\n setFocusedLine(dataIndex);\n }\n\n function resetLineFocus() {\n setFocusedLine(null);\n }\n\n const buildLineIndexes = (\n acc: number[],\n point: React.MutableRefObject<Element>\n ) => {\n if (point.current) {\n const currentLineIndex = parseInt(\n point.current.getAttribute('data-line-index') as string,\n 10\n );\n !acc.includes(currentLineIndex) &&\n acc.push(\n parseInt(point.current.getAttribute('data-line-index') as string, 10)\n );\n }\n return acc;\n };\n\n const buildLineIndexData = (point: React.MutableRefObject<Element>) => {\n const currentLineIndex = parseInt(\n point.current.getAttribute('data-line-index') as string,\n 10\n );\n const currentPointIndex = parseInt(\n point.current.getAttribute('data-point-index') as string,\n 10\n );\n const lineIndexes = pointRefArray.current.reduce(buildLineIndexes, []);\n\n const lowestLineIndex = lineIndexes[0];\n const highestLineIndex = lineIndexes[lineIndexes.length - 1];\n\n return {\n currentLineIndex,\n currentPointIndex,\n lineIndexes,\n lowestLineIndex,\n highestLineIndex,\n };\n };\n\n const findPointToFocus =\n (lineIndex: number, pointIndex: number) =>\n (point: React.MutableRefObject<Element>) =>\n point.current &&\n parseInt(point.current.getAttribute('data-line-index') as string, 10) ===\n lineIndex &&\n parseInt(point.current.getAttribute('data-point-index') as string, 10) ===\n pointIndex;\n\n // eslint-disable-next-line complexity\n function handleChartContainerKeyDown(event: React.KeyboardEvent) {\n const { key, shiftKey } = event;\n switch (key) {\n case 'Tab': {\n event.preventDefault();\n lastFocusedScatterPoint.current = (\n pointRefArray.current.find(\n point => point.current === document.activeElement\n ) as React.MutableRefObject<Element>\n ).current as SVGPathElement;\n shiftKey\n ? tabRef.current && tabRef.current.focus()\n : firstLegendButtonRef.current &&\n firstLegendButtonRef.current.focus();\n break;\n }\n case 'ArrowRight': {\n const focusedPointIndex = pointRefArray.current.findIndex(\n point => point.current === document.activeElement\n );\n\n if (focusedPointIndex !== undefined) {\n focusedPointIndex === pointRefArray.current.length - 1\n ? (pointRefArray.current[0].current as HTMLButtonElement).focus()\n : (\n pointRefArray.current[focusedPointIndex + 1]\n .current as HTMLButtonElement\n ).focus();\n }\n break;\n }\n case 'ArrowLeft': {\n const focusedPointIndex = pointRefArray.current.findIndex(\n point => point.current === document.activeElement\n );\n\n if (focusedPointIndex !== undefined) {\n focusedPointIndex === 0\n ? (\n pointRefArray.current[pointRefArray.current.length - 1]\n .current as HTMLButtonElement\n ).focus()\n : (\n pointRefArray.current[focusedPointIndex - 1]\n .current as HTMLButtonElement\n ).focus();\n }\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n const focusedPoint = pointRefArray.current.find(\n point => point.current === document.activeElement\n );\n\n if (focusedPoint && focusedPoint.current) {\n const {\n currentLineIndex,\n currentPointIndex,\n lineIndexes,\n lowestLineIndex,\n highestLineIndex,\n } = buildLineIndexData(focusedPoint);\n\n switch (currentLineIndex) {\n case lowestLineIndex: {\n (\n (\n pointRefArray.current.find(\n findPointToFocus(highestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n break;\n }\n default: {\n const nextLowestLineIndex =\n lineIndexes[lineIndexes.indexOf(currentLineIndex) - 1];\n (\n (\n pointRefArray.current.find(\n findPointToFocus(nextLowestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n }\n }\n }\n break;\n }\n case 'ArrowDown': {\n event.preventDefault();\n const focusedPoint = pointRefArray.current.find(\n point => point.current === document.activeElement\n );\n\n if (focusedPoint && focusedPoint.current) {\n const {\n currentLineIndex,\n currentPointIndex,\n lineIndexes,\n lowestLineIndex,\n highestLineIndex,\n } = buildLineIndexData(focusedPoint);\n\n switch (currentLineIndex) {\n case highestLineIndex: {\n (\n (\n pointRefArray.current.find(\n findPointToFocus(lowestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n break;\n }\n default: {\n const nextHighestLineIndex =\n lineIndexes[lineIndexes.indexOf(currentLineIndex) + 1];\n (\n (\n pointRefArray.current.find(\n findPointToFocus(nextHighestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n }\n }\n }\n break;\n }\n }\n }\n\n function handleFirstLegendButtonKeydown(event: React.KeyboardEvent) {\n const { key, shiftKey } = event;\n switch (key) {\n case 'Tab': {\n if (\n shiftKey &&\n lastFocusedScatterPoint &&\n lastFocusedScatterPoint.current &&\n pointRefArray.current.find(\n point => point.current === lastFocusedScatterPoint.current\n )\n ) {\n event.preventDefault();\n lastFocusedScatterPoint.current.focus();\n }\n break;\n }\n }\n }\n\n return (\n <LineChartContainer ref={containerRef}>\n <VictoryChartContainer onKeyDown={handleChartContainerKeyDown}>\n <VictoryChart\n domainPadding={32}\n height={400}\n padding={{ top: 0, left: 80, right: 0, bottom: 62 }}\n theme={magmaTheme}\n width={width}\n containerComponent={\n <VictoryVoronoiContainer\n name=\"xAxisGroupLabel\"\n voronoiBlacklist={scatterNames}\n voronoiDimension=\"x\"\n labels={\n hoveringOnXAxisLine && showXAxisLabel ? () => ` ` : undefined\n }\n labelComponent={\n showXAxisLabel ? (\n <VictoryTooltip\n flyoutComponent={\n <AxisTooltip\n dataLength={data.length}\n hiddenData={hiddenData}\n />\n }\n />\n ) : undefined\n }\n role=\"presentation\"\n voronoiPadding={32}\n />\n }\n {...chart}\n >\n <VictoryAxis {...yAxisOther} dependentAxis style={yAxisStyles} />\n {data.map(\n ({ data: dataset }, i) =>\n !hiddenData.includes(i) && (\n <VictoryLine\n style={{\n data: {\n opacity: setLineOpacity(i),\n stroke: theme.iterableColors[i],\n strokeWidth: '3',\n },\n parent: { border: theme.colors.neutral04 },\n }}\n key={`line${i}`}\n data={dataset as unknown as any[]}\n labelComponent={<></>}\n x={x as DataGetterPropType}\n y={y as DataGetterPropType}\n {...line}\n />\n )\n )}\n <VictoryAxis\n {...xAxisOther}\n style={xAxisStyles}\n gridComponent={\n <CustomAxisComponent\n events={{\n onMouseEnter: () => setHoveringOnXAxisLine(true),\n onMouseLeave: () => setHoveringOnXAxisLine(false),\n }}\n />\n }\n />\n {data.map(\n ({ data: dataset }, i) =>\n !hiddenData.includes(i) && (\n <VictoryScatter\n name={`scatter-${i}`}\n events={[\n {\n target: 'data',\n eventHandlers: {\n onBlur: () => {\n setShowXAxisLabel(true);\n setShowTooltip(null);\n return [\n {\n target: 'labels',\n mutation: () => ({ active: undefined }),\n },\n ];\n },\n onClick: () => {\n return [\n {\n target: 'labels',\n mutation: props => {\n setShowTooltip(\n `${props.datum.lineIndex}-${props.datum.index}`\n );\n return { active: true };\n },\n },\n ];\n },\n onFocus: () => {\n setShowXAxisLabel(false);\n return [\n {\n target: 'labels',\n mutation: props => {\n setShowTooltip(\n `${props.datum.lineIndex}-${props.datum.index}`\n );\n return { active: true };\n },\n },\n ];\n },\n onMouseEnter: () => {\n setShowXAxisLabel(false);\n return [\n {\n target: 'labels',\n mutation: props => {\n setShowTooltip(\n `${props.datum.lineIndex}-${props.datum.index}`\n );\n return { active: true };\n },\n },\n ];\n },\n onMouseLeave: () => {\n setShowTooltip(null);\n setShowXAxisLabel(true);\n },\n },\n },\n ]}\n style={{\n data: {\n fill: theme.colors.neutral08,\n opacity: setLineOpacity(i),\n stroke: theme.iterableColors[i],\n strokeWidth: 2,\n },\n }}\n size={5}\n data={\n dataset.map((datum, index) => ({\n index,\n lineIndex: i,\n ...datum,\n })) as unknown as any[]\n }\n dataComponent={\n <CustomScatterDataComponent\n lineIndex={i}\n pointRefArray={pointRefArray}\n registerPoint={registerPoint}\n unregisterPoint={unregisterPoint}\n />\n }\n labels={() => ''}\n labelComponent={\n <VictoryTooltip\n text=\"\"\n flyoutComponent={\n <GraphTooltip index={i} showTooltip={showTooltip} />\n }\n />\n }\n key={`scatter${i}`}\n x={x as DataGetterPropType}\n y={y as DataGetterPropType}\n {...scatter}\n />\n )\n )}\n </VictoryChart>\n </VictoryChartContainer>\n\n <DataLegendsContainer>\n <DataLegendsDescription theme={theme}>\n {i18n.charts.line.dataLegendsLabel}\n </DataLegendsDescription>\n {data.map(({ name }, i) => {\n const legendButtonAriaLabel =\n i18n.charts.line.legendButtonAriaLabel.replace(/\\{name\\}/g, name);\n\n return (\n <LegendButton\n aria-label={legendButtonAriaLabel}\n color={theme.iterableColors[i]}\n dataIndex={i}\n isHidden={hiddenData.includes(i)}\n key={i}\n name={name}\n onClick={handleLegendClick}\n onKeyDown={i === 0 ? handleFirstLegendButtonKeydown : undefined}\n focusCurrentLine={focusCurrentLine}\n ref={i === 0 ? firstLegendButtonRef : undefined}\n resetLineFocus={resetLineFocus}\n />\n );\n })}\n </DataLegendsContainer>\n </LineChartContainer>\n );\n}\n","import * as React from 'react';\nimport { VictoryAxisProps } from 'victory';\n\nimport { Card, Datagrid, Spinner } from 'react-magma-dom';\n\nexport function toCamelCase(str: string) {\n return str\n .toLowerCase()\n .replace(/[^a-z 0-9]/gi, '')\n .replace(/(?:^\\w|[A-Z]|\\b\\w)/g, (ltr, index) =>\n index === 0 ? ltr.toLowerCase() : ltr.toUpperCase()\n )\n .replace(/\\s+/g, '');\n}\n\nexport interface DataTableProps {\n data?: any[];\n xData: {\n keyValue?: string | number | symbol;\n label?: VictoryAxisProps['label'];\n tickFormat?: Partial<VictoryAxisProps['tickFormat']>;\n tickValues?: VictoryAxisProps['tickValues'];\n };\n yData: {\n keyValue?: string | number | symbol;\n tickFormat?: Partial<VictoryAxisProps['tickFormat']>;\n };\n}\n\nexport const ChartDataTable = (props: DataTableProps) => {\n const {\n data = [],\n xData: {\n keyValue: xKeyValue,\n label: xAxisLabel,\n tickFormat: xTickFormat,\n tickValues: xTickValues,\n },\n yData: { keyValue: yKeyValue, tickFormat: yTickFormat },\n } = props;\n const [dataForTable, setDataForTable] = React.useState({\n columns: [],\n rows: [],\n });\n\n React.useEffect(() => {\n setDataForTable(convertData());\n }, [data]);\n\n function convertData() {\n const xField = toCamelCase((xKeyValue || xAxisLabel || 'x') as string);\n const xTickValuesArray = data.reduce((valuesArray, { data: dataset }) => {\n dataset.forEach((datum: any) => {\n const value = datum.x || (xKeyValue && datum[xKeyValue]);\n !valuesArray.includes(value) && valuesArray.push(value);\n });\n\n return valuesArray;\n }, []);\n\n let baseTableData = {\n columns:\n xTickValuesArray.length > 0\n ? [\n {\n field: xField,\n header: xAxisLabel || xKeyValue || 'X',\n isRowHeader: true,\n },\n ]\n : [],\n rows: xTickValuesArray.reduce(\n (agg: any[], tick: number, index: number) => {\n const tickValue =\n xTickValues &&\n typeof tick === 'number' &&\n xTickValues.length === xTickValuesArray.length\n ? xTickFormat && typeof xTickFormat === 'function'\n ? xTickFormat(xTickValues[tick - 1])\n : xTickValues[tick - 1]\n : xTickFormat && Array.isArray(xTickFormat)\n ? xTickFormat[tick - 1]\n : xTickFormat && typeof xTickFormat === 'function'\n ? xTickFormat(tick)\n : tick;\n agg.push({\n [xField]: tickValue,\n id: index,\n });\n\n return agg;\n },\n []\n ),\n };\n\n return data.reduce((tableData, datum) => {\n const { name: header, data: dataset } = datum;\n const field = toCamelCase(header);\n\n tableData.columns.push({\n field,\n header,\n });\n\n dataset.forEach((d: any, i: number) => {\n const yValue =\n d.y || d.y === 0 ? d.y : undefined || (yKeyValue && d[yKeyValue]);\n tableData.rows[i] = {\n ...tableData.rows[i],\n id: baseTableData.rows.length > 0 ? i + 1 : i,\n [field]:\n yTickFormat && typeof yTickFormat === 'function'\n ? yTickFormat(yValue)\n : yValue,\n };\n });\n\n return tableData;\n }, baseTableData);\n }\n\n return (\n <Card>\n {dataForTable.rows.length > 0 ? (\n <Datagrid\n hasPagination={false}\n columns={dataForTable.columns}\n rows={dataForTable.rows}\n />\n ) : (\n <Spinner />\n )}\n </Card>\n );\n};\n","import * as React from 'react';\nimport {\n I18nContext,\n styled,\n ThemeContext,\n useDescendants,\n} from 'react-magma-dom';\nimport { css } from '@emotion/core';\nimport { KeyboardIcon } from 'react-magma-icons';\n\nimport { LineChart, LineChartProps } from './LineChart';\nimport { ChartDataTable } from './ChartDataTable';\nimport {\n Announce,\n ButtonVariant,\n Card,\n IconButton,\n Paragraph,\n TabsContainer,\n Tabs,\n Tab,\n TabPanelsContainer,\n TabPanel,\n Tooltip,\n TypographyVisualStyle,\n} from 'react-magma-dom';\n\ninterface BaseChartProps {\n /**\n * Description of what the line chart data represents placed above the chart\n */\n description?: string;\n testId?: string;\n /**\n * Title of the line chart\n */\n title: string;\n /**\n * Type of chart - for now just 'line' is accepted\n */\n type: string;\n}\nexport interface ChartProps<T extends any>\n extends BaseChartProps,\n Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>,\n LineChartProps<T> {}\n\nconst StyledTitle = styled.span`\n color: ${props => props.theme.colors.neutral};\n font-size: ${props => props.theme.typeScale.size04.fontSize};\n font-weight: 600;\n line-height: ${props => props.theme.typeScale.size04.lineHeight};\n margin: 0 0 12px 0;\n`;\n\nconst StyledParagraph = styled(Paragraph)`\n font-size: ${props => props.theme.typeScale.size02.fontSize};\n margin: 0 0 18px 0;\n`;\n\nconst StyledTabsContainer = styled(TabsContainer)`\n width: 800px;\n ul {\n box-shadow: inset 0 -1px 0 ${props => props.theme.colors.neutral06};\n }\n`;\n\nconst StyledTabPanel = styled(TabPanel)`\n padding: 22px 0;\n`;\n\nconst KeyboardInstructionsCard = styled(Card)<{\n isOpen?: boolean;\n maxHeight?: string;\n width?: string;\n}>`\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);\n display: ${props => (props.isOpen ? 'block' : 'none')};\n right: ${props => props.theme.spaceScale.spacing02};\n max-height: ${props =>\n props.maxHeight ? props.maxHeight : props.theme.dropdown.content.maxHeight};\n opacity: ${props => (props.isOpen ? '1' : '0')};\n outline: 0;\n overflow-y: auto;\n padding: ${props => props.theme.spaceScale.spacing05}\n ${props => props.theme.spaceScale.spacing05};\n position: absolute;\n transition: opacity 0.3s;\n white-space: nowrap;\n z-index: 2;\n\n ${props =>\n props.width &&\n css`\n white-space: normal;\n width: ${props.width};\n `}\n`;\n\nfunction BaseChart<T>(props: ChartProps<T>, ref: React.Ref<HTMLDivElement>) {\n const { description, title, testId, type, ...other } = props;\n const keyboardInstructionsRef = React.useRef<HTMLButtonElement>(null);\n const lastFocusedScatterPoint = React.useRef<SVGPathElement>(null);\n const theme = React.useContext(ThemeContext);\n const i18n = React.useContext(I18nContext);\n\n const [pointRefArray, registerPoint, unregisterPoint] = useDescendants();\n\n const [isKeyboardInstructionsOpen, setIsKeyboardInstructionsOpen] =\n React.useState<boolean>(false);\n\n function handleKeyboardInstructionsButtonBlur() {\n setIsKeyboardInstructionsOpen(false);\n }\n\n function handleKeyboardInstructionsButtonClick() {\n setIsKeyboardInstructionsOpen(prevOpen => !prevOpen);\n }\n\n function handleKeyboardInstructionsButtonKeydown(event: React.KeyboardEvent) {\n const { key, shiftKey } = event;\n\n switch (key) {\n case 'Escape': {\n setIsKeyboardInstructionsOpen(false);\n break;\n }\n case 'Tab': {\n if (\n !shiftKey &&\n lastFocusedScatterPoint &&\n lastFocusedScatterPoint.current &&\n pointRefArray.current.find(\n point => point.current === lastFocusedScatterPoint.current\n )\n ) {\n event.preventDefault();\n lastFocusedScatterPoint.current.focus();\n }\n break;\n }\n }\n }\n\n return (\n <div ref={ref}>\n <StyledTitle theme={theme}>{title}</StyledTitle>\n {description && (\n <StyledParagraph\n theme={theme}\n visualStyle={TypographyVisualStyle.bodySmall}\n >\n {description}\n </StyledParagraph>\n )}\n <StyledTabsContainer theme={theme}>\n <Tabs>\n <Tab>{i18n.charts.line.chartTabLabel}</Tab>\n <Tab>{i18n.charts.line.dataTabLabel}</Tab>\n <div\n onBlur={handleKeyboardInstructionsButtonBlur}\n style={{\n display: 'inline-block',\n marginLeft: 'auto',\n }}\n >\n <Tooltip\n content={i18n.charts.line.keyboardInstructionsTooltip}\n ref={keyboardInstructionsRef}\n >\n <IconButton\n aria-controls=\"keyboardInstructions\"\n aria-label={i18n.charts.line.keyboardInstructionsTooltip}\n aria-expanded={Boolean(isKeyboardInstructionsOpen)}\n icon={<KeyboardIcon />}\n onClick={handleKeyboardInstructionsButtonClick}\n onKeyDown={handleKeyboardInstructionsButtonKeydown}\n variant={ButtonVariant.link}\n />\n </Tooltip>\n <Announce>\n <KeyboardInstructionsCard\n id=\"keyboardInstructions\"\n isOpen={isKeyboardInstructionsOpen}\n theme={theme}\n width=\"350px\"\n >\n <Paragraph\n visualStyle={TypographyVisualStyle.headingXSmall}\n style={{ margin: '0 0 16px' }}\n >\n {i18n.charts.line.keyboardInstructionsHeader}\n </Paragraph>\n {i18n.charts.line.keyboardInstructions}\n </KeyboardInstructionsCard>\n </Announce>\n </div>\n </Tabs>\n <TabPanelsContainer>\n <StyledTabPanel theme={theme}>\n {type === 'line' && (\n <LineChart<T>\n {...other}\n lastFocusedScatterPoint={lastFocusedScatterPoint}\n pointRefArray={pointRefArray}\n registerPoint={registerPoint}\n tabRef={keyboardInstructionsRef}\n unregisterPoint={unregisterPoint}\n />\n )}\n </StyledTabPanel>\n <StyledTabPanel theme={theme}>\n <ChartDataTable\n data={other.data}\n xData={{\n keyValue: other.x,\n label: other.componentProps?.xAxis?.label,\n tickFormat: other.componentProps?.xAxis?.tickFormat,\n }}\n yData={{\n keyValue: other.y,\n tickFormat: other.componentProps?.yAxis?.tickFormat,\n }}\n />\n </StyledTabPanel>\n </TabPanelsContainer>\n </StyledTabsContainer>\n </div>\n );\n}\n\nexport const Chart = React.forwardRef(BaseChart) as <T>(\n props: ChartProps<T> & { ref?: React.MutableRefObject<HTMLDivElement> }\n) => ReturnType<typeof BaseChart>;\n"],"names":["colors","baseProps","width","height","padding","baseLabelStyles","fontFamily","fontSize","letterSpacing","fill","stroke","strokeWidth","centeredLabelStyles","textAnchor","magmaTheme","area","style","data","labels","axis","strokeLinecap","strokeLinejoin","axisLabel","grid","pointerEvents","ticks","size","tickLabels","polarDependentAxis","bar","boxplot","max","maxLabels","median","medianLabels","min","minLabels","q1","q1Labels","q3","q3Labels","boxWidth","candlestick","candleColors","positive","negative","chart","errorbar","borderWidth","opacity","group","colorScale","histogram","legend","gutter","orientation","titleOrientation","type","title","line","pie","scatter","stack","tooltip","flyoutStyle","flyoutPadding","cornerRadius","pointerLength","voronoi","flyout","StyledGraphTooltip","styled","StyledTooltip","props","theme","neutral08","neutral06","neutral","typeScale","size02","lineHeight","TooltipColorSwatch","span","color","GraphTooltip","datum","index","showTooltip","x","y","React","useContext","ThemeContext","_jsx","_jsxs","position","TooltipPosition","top","role","iterableColors","label","TooltipArrow","AxisTooltip","activePoints","hiddenData","pointsIndexes","Array","from","dataLength","_","i","filter","includes","map","point","CustomScatterDataComponent","pointIndex","lineIndex","pointRefArray","registerPoint","unregisterPoint","other","Point","ariaLabel","pathComponent","CustomPointComponent","tabIndex","forceUpdate","useForceUpdate","ref","useRef","useEffect","CustomAxisComponent","events","LineSegment","strokeOpacity","LegendButton","forwardRef","children","dataIndex","isHidden","onClick","name","focusCurrentLine","resetLineFocus","handleOnMouseEnterOrFocus","display","onMouseEnter","onMouseLeave","Checkbox","checked","containerStyle","alignItems","border","boxShadow","margin","inputStyle","neutral02","borderRadius","labelText","onBlur","onFocus","LineChartContainer","div","VictoryChartContainer","DataLegendsContainer","DataLegendsDescription","p","neutral03","LineChart","componentProps","xAxis","xAxisLabel","undefined","xTickLabels","xRest","xAxisOther","yAxis","yAxisLabel","yTickLabels","yRest","yAxisOther","lastFocusedScatterPoint","tabRef","i18n","I18nContext","useState","setHiddenData","setWidth","focusedLine","setFocusedLine","setShowTooltip","showXAxisLabel","setShowXAxisLabel","hoveringOnXAxisLine","setHoveringOnXAxisLine","containerRef","firstLegendButtonRef","updateWidth","window","addEventListener","handleEsc","removeEventListener","handleMouseMove","scatterNames","xAxisStyles","fontWeight","yAxisStyles","current","clientWidth","event","key","setLineOpacity","handleLegendClick","item","concat","buildLineIndexes","acc","currentLineIndex","parseInt","getAttribute","push","buildLineIndexData","currentPointIndex","lineIndexes","reduce","lowestLineIndex","highestLineIndex","length","findPointToFocus","handleFirstLegendButtonKeydown","shiftKey","find","preventDefault","focus","onKeyDown","document","activeElement","focusedPointIndex","findIndex","focusedPoint","nextLowestLineIndex","indexOf","nextHighestLineIndex","VictoryChart","domainPadding","left","right","bottom","containerComponent","VictoryVoronoiContainer","voronoiBlacklist","voronoiDimension","labelComponent","VictoryTooltip","flyoutComponent","voronoiPadding","VictoryAxis","dependentAxis","dataset","VictoryLine","parent","neutral04","gridComponent","VictoryScatter","target","eventHandlers","mutation","active","dataComponent","text","charts","dataLegendsLabel","legendButtonAriaLabel","replace","toCamelCase","str","toLowerCase","ltr","toUpperCase","ChartDataTable","xData","xKeyValue","keyValue","xTickFormat","tickFormat","xTickValues","tickValues","yData","yKeyValue","yTickFormat","columns","rows","dataForTable","setDataForTable","xField","xTickValuesArray","baseTableData","valuesArray","forEach","value","field","header","isRowHeader","agg","tick","tickValue","isArray","id","tableData","d","yValue","Card","Datagrid","hasPagination","Spinner","StyledTitle","size04","StyledParagraph","Paragraph","StyledTabsContainer","TabsContainer","StyledTabPanel","TabPanel","KeyboardInstructionsCard","isOpen","spaceScale","spacing02","maxHeight","dropdown","content","spacing05","css","BaseChart","description","keyboardInstructionsRef","useDescendants","isKeyboardInstructionsOpen","setIsKeyboardInstructionsOpen","visualStyle","TypographyVisualStyle","bodySmall","Tabs","Tab","chartTabLabel","dataTabLabel","marginLeft","Tooltip","keyboardInstructionsTooltip","IconButton","Boolean","icon","KeyboardIcon","prevOpen","variant","ButtonVariant","link","Announce","headingXSmall","keyboardInstructionsHeader","keyboardInstructions","TabPanelsContainer","_other$componentProps","_other$componentProps2","_other$componentProps3","_other$componentProps4","_other$componentProps5","_other$componentProps6","Chart"],"mappings":"mnCAmBA,gBAAMA,EAAS,CACb,UACA,UACA,UACA,UACA,UACA,WAmBIC,EAAY,CAChBC,MAAO,IACPC,OAAQ,IACRC,QAAS,IAMLC,EAAkB,CACtBC,WAlBgB,mCAmBhBC,SAjBe,GAkBfC,cAnBoB,SAoBpBJ,QAdc,EAedK,KA5BkB,UA6BlBC,OAAQ,cACRC,YAAa,GAGTC,KAAwBC,WAAY,UAAaR,GAQ1CS,EAAkB,CAC7BC,QACEC,MAAO,CACLC,KAAM,CACJR,KA5CQ,QA8CVS,OAAQb,IAEPJ,GAELkB,QACEH,MAAO,CACLG,KAAM,CACJV,KAAM,cACNC,OAxDY,UAyDZC,YAAa,EACbS,cAnBc,QAoBdC,eAnBe,SAqBjBC,eACKV,GACHR,QAjDQ,EAkDRM,OAAQ,gBAEVa,KAAM,CACJd,KAAM,OACNC,OAAQ,UAERU,cA/Bc,QAgCdC,eA/Be,QAgCfG,cAAe,WAEjBC,MAAO,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R,EAAM+C,WAAWoM"}
1
+ {"version":3,"file":"charts.modern.module.js","sources":["../src/components/LineChart/magma-charts.ts","../src/components/LineChart/GraphTooltip.tsx","../src/components/LineChart/CustomPointComponent.tsx","../src/components/LineChart/CustomAxisComponent.tsx","../src/components/LineChart/LegendButton.tsx","../src/components/LineChart/LineChart.tsx","../src/components/LineChart/ChartDataTable.tsx","../src/components/LineChart/Chart.tsx"],"sourcesContent":["// *\n// * Colors\n// *\n// const yellow200 = '#FFF59D';\n// const deepOrange600 = '#F4511E';\n// const lime300 = '#DCE775';\n// const lightGreen500 = '#8BC34A';\n// const teal700 = '#00796B';\n// const cyan900 = '#006064';\n\n// const colors = [\n// '#0085CC',\n// '#E0004D',\n// '#FA6600',\n// '#48A200',\n// '#B12FAD',\n// '#00A393',\n// ];\n\nconst colors = [\n '#00507A',\n '#8F0033',\n '#B84900',\n '#255200',\n '#711E6E',\n '#005249',\n];\n\nconst blueGrey50 = '#DFDFDF';\nconst blueGrey300 = '#8F8F8F';\nconst blueGrey700 = '#3F3F3F';\nconst grey900 = 'pink';\n\n// *\n// * Typography\n// *\nconst sansSerif = '\"Work Sans\",Helvetica,sans-serif';\nconst letterSpacing = 'normal';\nconst fontSize = 12;\n\n// *\n// * Layout\n// *\nconst padding = 8;\nconst baseProps = {\n width: 350,\n height: 350,\n padding: 50,\n};\n\n// *\n// * Labels\n// *\nconst baseLabelStyles = {\n fontFamily: sansSerif,\n fontSize,\n letterSpacing,\n padding,\n fill: blueGrey700,\n stroke: 'transparent',\n strokeWidth: 0,\n};\n\nconst centeredLabelStyles = { textAnchor: 'middle', ...baseLabelStyles };\n// *\n// * Strokes\n// *\n// const strokeDasharray = '10, 5';\nconst strokeLinecap = 'round';\nconst strokeLinejoin = 'round';\n\nexport const magmaTheme: any = {\n area: {\n style: {\n data: {\n fill: grey900,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n axis: {\n style: {\n axis: {\n fill: 'transparent',\n stroke: blueGrey300,\n strokeWidth: 1,\n strokeLinecap,\n strokeLinejoin,\n },\n axisLabel: {\n ...centeredLabelStyles,\n padding,\n stroke: 'transparent',\n },\n grid: {\n fill: 'none',\n stroke: '#dfdfdf',\n //strokeDasharray,\n strokeLinecap,\n strokeLinejoin,\n pointerEvents: 'painted',\n },\n ticks: {\n fill: 'transparent',\n size: 0,\n stroke: blueGrey300,\n strokeWidth: 0,\n strokeLinecap,\n strokeLinejoin,\n },\n tickLabels: {\n ...baseLabelStyles,\n fill: blueGrey700,\n },\n },\n ...baseProps,\n },\n polarDependentAxis: {\n style: {\n ticks: {\n fill: 'transparent',\n size: 1,\n stroke: 'transparent',\n },\n },\n },\n bar: {\n style: {\n data: {\n fill: blueGrey700,\n padding,\n strokeWidth: 0,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n boxplot: {\n style: {\n max: { padding, stroke: blueGrey700, strokeWidth: 1 },\n maxLabels: { ...baseLabelStyles, padding: 3 },\n median: { padding, stroke: blueGrey700, strokeWidth: 1 },\n medianLabels: { ...baseLabelStyles, padding: 3 },\n min: { padding, stroke: blueGrey700, strokeWidth: 1 },\n minLabels: { ...baseLabelStyles, padding: 3 },\n q1: { padding, fill: blueGrey700 },\n q1Labels: { ...baseLabelStyles, padding: 3 },\n q3: { padding, fill: blueGrey700 },\n q3Labels: { ...baseLabelStyles, padding: 3 },\n },\n boxWidth: 20,\n ...baseProps,\n },\n candlestick: {\n style: {\n data: {\n stroke: blueGrey700,\n },\n labels: { ...baseLabelStyles, padding: 5 },\n },\n candleColors: {\n positive: '#ffffff',\n negative: blueGrey700,\n },\n ...baseProps,\n },\n chart: baseProps,\n errorbar: {\n borderWidth: 8,\n style: {\n data: {\n fill: 'transparent',\n opacity: 1,\n stroke: blueGrey700,\n strokeWidth: 2,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n group: {\n colorScale: colors,\n ...baseProps,\n },\n histogram: {\n style: {\n data: {\n fill: blueGrey700,\n stroke: grey900,\n strokeWidth: 2,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n legend: {\n colorScale: colors,\n gutter: 10,\n orientation: 'vertical',\n titleOrientation: 'top',\n style: {\n data: {\n type: 'circle',\n },\n labels: baseLabelStyles,\n title: { ...baseLabelStyles, padding: 5 },\n },\n },\n line: {\n style: {\n data: {\n fill: 'transparent',\n opacity: 1,\n stroke: blueGrey700,\n strokeWidth: 2,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n pie: {\n colorScale: colors,\n style: {\n data: {\n padding,\n stroke: blueGrey50,\n strokeWidth: 1,\n },\n labels: { ...baseLabelStyles, padding: 20 },\n },\n ...baseProps,\n },\n scatter: {\n style: {\n data: {\n fill: blueGrey700,\n opacity: 1,\n stroke: 'transparent',\n strokeWidth: 0,\n },\n labels: baseLabelStyles,\n },\n ...baseProps,\n },\n stack: {\n colorScale: colors,\n ...baseProps,\n },\n tooltip: {\n style: { ...baseLabelStyles, padding: 0, pointerEvents: 'none' },\n flyoutStyle: {\n stroke: grey900,\n strokeWidth: 1,\n fill: '#f0f0f0',\n pointerEvents: 'none',\n },\n flyoutPadding: 5,\n cornerRadius: 5,\n pointerLength: 10,\n },\n voronoi: {\n style: {\n data: {\n fill: 'transparent',\n stroke: 'transparent',\n strokeWidth: 0,\n },\n labels: { ...baseLabelStyles, padding: 5, pointerEvents: 'none' },\n flyout: {\n stroke: grey900,\n strokeWidth: 1,\n fill: '#f0f0f0',\n pointerEvents: 'none',\n },\n },\n ...baseProps,\n },\n};\n","import * as React from 'react';\nimport {\n StyledTooltip,\n ThemeContext,\n TooltipArrow,\n TooltipPosition,\n ThemeInterface,\n styled,\n} from 'react-magma-dom';\n\nconst StyledGraphTooltip = styled(StyledTooltip)`\n background: ${(props: any) => props.theme.colors.neutral100};\n border: 1px solid ${(props: any) => props.theme.colors.neutral300};\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);\n box-sizing: border-box;\n color: ${(props: any) => props.theme.colors.neutral};\n font-size: ${(props: any) => props.theme.typeScale.size02.fontSize};\n font-weight: normal;\n line-height: ${(props: any) => props.theme.typeScale.size02.lineHeight};\n margin: 0;\n padding: 8px;\n width: fit-content;\n div {\n margin-bottom: 8px;\n display: flex;\n align-items: flex-start;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n`;\n\nconst TooltipColorSwatch = styled.span`\n background: ${(props: any) => props.color};\n border: ${(props: any) => (props.color ? 'none' : '3px solid black')};\n border-radius: 4px;\n height: 20px;\n width: 20px;\n margin-right: 8px;\n`;\n\nexport const GraphTooltip = (props: any) => {\n const { datum, index, showTooltip, x, y } = props;\n\n const theme: ThemeInterface = React.useContext(ThemeContext);\n const linePointIndex = `${index}-${datum.index}`;\n\n return showTooltip === linePointIndex ? (\n <g style={{ pointerEvents: 'none' }}>\n <foreignObject x={x} y={y} width=\"275\" height=\"100%\">\n <StyledGraphTooltip\n position={TooltipPosition.top}\n role=\"tooltip\"\n theme={theme}\n >\n <div>\n <TooltipColorSwatch color={theme.iterableColors[index]} />\n <span>{datum.label}</span>\n </div>\n <TooltipArrow theme={theme} />\n </StyledGraphTooltip>\n </foreignObject>\n </g>\n ) : null;\n};\n\nexport const AxisTooltip = (props: any) => {\n const { x, y, activePoints, hiddenData, dataLength } = props;\n\n const pointsIndexes = Array.from(\n Array(dataLength - 0),\n (_, i) => i + 0\n ).filter(i => !hiddenData.includes(i));\n\n const theme: ThemeInterface = React.useContext(ThemeContext);\n\n return (\n <g style={{ pointerEvents: 'none' }}>\n <foreignObject x={x} y={y} width=\"275\" height=\"100%\">\n <StyledGraphTooltip\n data-testid=\"axis-tooltip\"\n position={TooltipPosition.top}\n role=\"tooltip\"\n theme={theme}\n >\n {activePoints.map((point: any, i: number) => (\n <div key={i}>\n <TooltipColorSwatch\n color={theme.iterableColors[pointsIndexes[i]]}\n />\n <span>{point.label}</span>\n </div>\n ))}\n <TooltipArrow theme={theme} />\n </StyledGraphTooltip>\n </foreignObject>\n </g>\n );\n};\n","import * as React from 'react';\nimport { Point, PointProps } from 'victory';\nimport { useForceUpdate } from 'react-magma-dom';\n\nexport interface CustomScatterDataComponentInterface extends PointProps {\n lineIndex: number;\n pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;\n registerPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n unregisterPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n}\n\nexport interface CustomPointComponentInterface {\n lineIndex: number;\n pointIndex: PointProps['index'];\n pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;\n registerPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n unregisterPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n}\n\nexport const CustomScatterDataComponent = (\n props: CustomScatterDataComponentInterface\n) => {\n const {\n datum,\n index: pointIndex,\n lineIndex,\n pointRefArray,\n registerPoint,\n unregisterPoint,\n ...other\n } = props;\n return (\n <Point\n {...other}\n ariaLabel={datum.label}\n pathComponent={\n <CustomPointComponent\n lineIndex={lineIndex}\n pointIndex={pointIndex}\n pointRefArray={pointRefArray}\n registerPoint={registerPoint}\n unregisterPoint={unregisterPoint}\n />\n }\n role=\"button\"\n tabIndex={0}\n />\n );\n};\n\nexport const CustomPointComponent = (props: CustomPointComponentInterface) => {\n const {\n lineIndex,\n pointRefArray,\n pointIndex,\n registerPoint,\n unregisterPoint,\n ...other\n } = props;\n const forceUpdate = useForceUpdate();\n const ref = React.useRef<SVGPathElement | null>(null);\n\n React.useEffect(() => {\n registerPoint(pointRefArray, ref as React.MutableRefObject<Element>);\n\n forceUpdate();\n\n return () =>\n unregisterPoint(pointRefArray, ref as React.MutableRefObject<Element>);\n }, []);\n\n return (\n <path\n ref={ref}\n data-line-index={lineIndex}\n data-point-index={pointIndex}\n {...other}\n />\n );\n};\n","import * as React from 'react';\nimport { LineSegment, LineSegmentProps } from 'victory';\n\nexport const CustomAxisComponent: React.FunctionComponent<LineSegmentProps> = ({\n events,\n ...props\n}: any) => {\n return (\n <g>\n <LineSegment\n {...props}\n events={events}\n style={{\n strokeWidth: '50px',\n stroke: 'transparent',\n }}\n />\n <LineSegment\n {...props}\n events={events}\n style={{\n strokeWidth: '1px',\n stroke: 'black',\n strokeOpacity: '0.2',\n }}\n />\n </g>\n );\n};\n","import * as React from 'react';\nimport { ThemeContext, Checkbox } from 'react-magma-dom';\n\nexport interface DataTableProps {\n name?: string;\n color?: string;\n}\n\nexport const LegendButton = React.forwardRef<HTMLButtonElement, any>(\n (props, ref) => {\n const {\n children,\n color,\n dataIndex,\n isHidden,\n onClick,\n name,\n focusCurrentLine,\n resetLineFocus,\n ...other\n } = props;\n\n function handleClick() {\n onClick && typeof onClick === 'function' && onClick(dataIndex);\n\n if (!isHidden) {\n resetLineFocus &&\n typeof resetLineFocus === 'function' &&\n resetLineFocus();\n }\n }\n\n function handleOnMouseEnterOrFocus() {\n if (!isHidden) {\n focusCurrentLine &&\n typeof focusCurrentLine === 'function' &&\n focusCurrentLine(dataIndex);\n }\n }\n\n const theme = React.useContext(ThemeContext);\n\n return (\n <div\n style={{ display: 'inline-flex' }}\n onMouseEnter={handleOnMouseEnterOrFocus}\n onMouseLeave={resetLineFocus}\n >\n <Checkbox\n checked={!isHidden}\n color={color}\n containerStyle={{\n alignItems: 'center',\n border: '0',\n boxShadow: '0 0 0',\n color: theme.colors.neutral,\n display: 'inline-flex',\n margin: '0 36px 20px 0',\n padding: '0',\n }}\n inputStyle={{\n border: color ? `none` : `2px solid ${theme.colors.neutral800}`,\n borderRadius: '4px',\n }}\n labelText={name}\n onBlur={resetLineFocus}\n onClick={handleClick}\n onFocus={handleOnMouseEnterOrFocus}\n ref={ref}\n theme={theme}\n {...other}\n />\n </div>\n );\n }\n);\n","import * as React from 'react';\nimport {\n VictoryAxis,\n VictoryAxisProps,\n VictoryChart,\n VictoryChartProps,\n VictoryLine,\n VictoryLineProps,\n VictoryScatter,\n VictoryScatterProps,\n VictoryTooltip,\n VictoryVoronoiContainer,\n} from 'victory';\n\nimport {\n I18nContext,\n ThemeContext,\n styled,\n ThemeInterface,\n I18nInterface,\n} from 'react-magma-dom';\n\nimport { magmaTheme } from './magma-charts';\nimport { AxisTooltip, GraphTooltip } from './GraphTooltip';\nimport { CustomScatterDataComponent } from './CustomPointComponent';\nimport { CustomAxisComponent } from './CustomAxisComponent';\nimport { LegendButton } from './LegendButton';\n\nexport type LineChartAxisStyle = VictoryAxisProps['style'];\nexport type DataGetterPropType = VictoryLineProps['x'];\n\nexport type ChartDataOptions =\n | {\n label: string;\n x: string | number;\n y: string | number;\n [key: string]: any;\n }\n | { label: string; [key: string]: any }\n | any;\n\nexport interface LineChartData<T> {\n name: string;\n data: T[];\n}\n\nexport interface LineChartComponentProps {\n chart?: VictoryChartProps;\n line?: VictoryLineProps;\n scatter?: VictoryScatterProps;\n xAxis?: VictoryAxisProps;\n yAxis?: VictoryAxisProps;\n}\n\n// NOTE: These props are manually copied to line-chart.mdx\nexport interface LineChartProps<T extends ChartDataOptions> {\n /**\n * Props passed to each component that makes up the line chart. See `victory` for accepted props.\n */\n componentProps?: LineChartComponentProps;\n /**\n * Data used to build the chart\n */\n data?: LineChartData<T>[];\n isMulti?: boolean;\n /**\n * @internal\n */\n lastFocusedScatterPoint: React.MutableRefObject<SVGPathElement | null>;\n /**\n * @internal\n */\n pointRefArray: React.MutableRefObject<React.MutableRefObject<Element>[]>;\n /**\n * @internal\n */\n registerPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n /**\n * @internal\n */\n tabRef: React.MutableRefObject<HTMLButtonElement | null>;\n /**\n * @internal\n */\n unregisterPoint: (\n refArray: React.MutableRefObject<React.MutableRefObject<Element>[]>,\n ref: React.MutableRefObject<Element>\n ) => void;\n /**\n * Value of x key in chart data\n */\n x?: keyof T;\n /**\n * Value of y key in chart data\n */\n y?: keyof T;\n}\n\nconst LineChartContainer = styled.div`\n max-height: 600px;\n max-width: 800px;\n svg {\n overflow: visible;\n }\n`;\n\nconst VictoryChartContainer = styled.div``;\n\nconst DataLegendsContainer = styled.div`\n padding-bottom: 24px;\n`;\n\nconst DataLegendsDescription = styled.p`\n color: ${(props: any) => props.theme.colors.neutral};\n font-size: ${(props: any) => props.theme.typeScale.size02.fontSize};\n`;\n\nexport function LineChart<T>(props: LineChartProps<T>) {\n const {\n componentProps: {\n chart = {},\n line = {},\n scatter = {},\n xAxis: {\n style: {\n axisLabel: xAxisLabel = undefined,\n tickLabels: xTickLabels = undefined,\n ...xRest\n } = {},\n ...xAxisOther\n } = { style: {} },\n yAxis: {\n style: {\n axisLabel: yAxisLabel = undefined,\n tickLabels: yTickLabels = undefined,\n ...yRest\n } = {},\n ...yAxisOther\n } = { style: {} },\n } = {},\n data = [],\n lastFocusedScatterPoint,\n pointRefArray,\n registerPoint,\n unregisterPoint,\n tabRef,\n x,\n y,\n } = props;\n\n const theme: ThemeInterface = React.useContext(ThemeContext);\n const i18n: I18nInterface = React.useContext(I18nContext);\n\n const [hiddenData, setHiddenData] = React.useState<number[]>([]);\n const [width, setWidth] = React.useState<number>(800);\n const [focusedLine, setFocusedLine] = React.useState<number | null>(null);\n const [showTooltip, setShowTooltip] = React.useState<string | null>(null);\n const [showXAxisLabel, setShowXAxisLabel] = React.useState<boolean>(true);\n const [hoveringOnXAxisLine, setHoveringOnXAxisLine] =\n React.useState<boolean>(false);\n\n const containerRef = React.useRef<HTMLDivElement>(null);\n const firstLegendButtonRef = React.useRef<HTMLButtonElement>(null);\n\n React.useEffect(() => {\n updateWidth();\n\n window.addEventListener('resize', updateWidth);\n window.addEventListener('keydown', handleEsc);\n\n return () => {\n window.removeEventListener('resize', updateWidth);\n window.removeEventListener('keydown', handleEsc);\n };\n }, []);\n\n React.useEffect(() => {\n window.addEventListener('mousemove', handleMouseMove);\n\n return () => {\n window.removeEventListener('mousemove', handleMouseMove);\n };\n }, [showTooltip]);\n\n const scatterNames: string[] = data.map((_, i) => `scatter-${i}`);\n\n const xAxisStyles = {\n tickLabels: {\n color: '#3f3f3f',\n fontSize: 12,\n ...xTickLabels,\n },\n axisLabel: {\n color: '#3f3f3f',\n padding: 44,\n fontSize: 14,\n fontWeight: 'bold',\n ...xAxisLabel,\n },\n ...xRest,\n };\n\n const yAxisStyles = {\n tickLabels: {\n fontSize: 12,\n ...yTickLabels,\n },\n axisLabel: {\n color: '#3f3f3f',\n padding: 64,\n fontSize: 14,\n fontWeight: 'bold',\n ...yAxisLabel,\n },\n ...yRest,\n };\n\n function updateWidth() {\n containerRef.current && setWidth(containerRef.current.clientWidth);\n }\n\n function handleEsc(event: KeyboardEvent): any {\n if (event.key === 'Escape') {\n setShowTooltip(null);\n setShowXAxisLabel(false);\n }\n }\n\n function handleMouseMove() {\n !showTooltip && setShowXAxisLabel(true);\n }\n\n function setLineOpacity(index: number) {\n return focusedLine === null ? 1 : focusedLine === index ? 1 : 0.1;\n }\n\n function handleLegendClick(dataIndex: number) {\n if (hiddenData.includes(dataIndex)) {\n setHiddenData(hiddenData.filter(item => item !== dataIndex));\n } else {\n setHiddenData(hiddenData.concat([dataIndex]));\n }\n }\n\n function focusCurrentLine(dataIndex: number) {\n setFocusedLine(dataIndex);\n }\n\n function resetLineFocus() {\n setFocusedLine(null);\n }\n\n const buildLineIndexes = (\n acc: number[],\n point: React.MutableRefObject<Element>\n ) => {\n if (point.current) {\n const currentLineIndex = parseInt(\n point.current.getAttribute('data-line-index') as string,\n 10\n );\n !acc.includes(currentLineIndex) &&\n acc.push(\n parseInt(point.current.getAttribute('data-line-index') as string, 10)\n );\n }\n return acc;\n };\n\n const buildLineIndexData = (point: React.MutableRefObject<Element>) => {\n const currentLineIndex = parseInt(\n point.current.getAttribute('data-line-index') as string,\n 10\n );\n const currentPointIndex = parseInt(\n point.current.getAttribute('data-point-index') as string,\n 10\n );\n const lineIndexes = pointRefArray.current.reduce(buildLineIndexes, []);\n\n const lowestLineIndex = lineIndexes[0];\n const highestLineIndex = lineIndexes[lineIndexes.length - 1];\n\n return {\n currentLineIndex,\n currentPointIndex,\n lineIndexes,\n lowestLineIndex,\n highestLineIndex,\n };\n };\n\n const findPointToFocus =\n (lineIndex: number, pointIndex: number) =>\n (point: React.MutableRefObject<Element>) =>\n point.current &&\n parseInt(point.current.getAttribute('data-line-index') as string, 10) ===\n lineIndex &&\n parseInt(point.current.getAttribute('data-point-index') as string, 10) ===\n pointIndex;\n\n // eslint-disable-next-line complexity\n function handleChartContainerKeyDown(event: React.KeyboardEvent) {\n const { key, shiftKey } = event;\n switch (key) {\n case 'Tab': {\n event.preventDefault();\n lastFocusedScatterPoint.current = (\n pointRefArray.current.find(\n point => point.current === document.activeElement\n ) as React.MutableRefObject<Element>\n ).current as SVGPathElement;\n shiftKey\n ? tabRef.current && tabRef.current.focus()\n : firstLegendButtonRef.current &&\n firstLegendButtonRef.current.focus();\n break;\n }\n case 'ArrowRight': {\n const focusedPointIndex = pointRefArray.current.findIndex(\n point => point.current === document.activeElement\n );\n\n if (focusedPointIndex !== undefined) {\n focusedPointIndex === pointRefArray.current.length - 1\n ? (pointRefArray.current[0].current as HTMLButtonElement).focus()\n : (\n pointRefArray.current[focusedPointIndex + 1]\n .current as HTMLButtonElement\n ).focus();\n }\n break;\n }\n case 'ArrowLeft': {\n const focusedPointIndex = pointRefArray.current.findIndex(\n point => point.current === document.activeElement\n );\n\n if (focusedPointIndex !== undefined) {\n focusedPointIndex === 0\n ? (\n pointRefArray.current[pointRefArray.current.length - 1]\n .current as HTMLButtonElement\n ).focus()\n : (\n pointRefArray.current[focusedPointIndex - 1]\n .current as HTMLButtonElement\n ).focus();\n }\n break;\n }\n case 'ArrowUp': {\n event.preventDefault();\n const focusedPoint = pointRefArray.current.find(\n point => point.current === document.activeElement\n );\n\n if (focusedPoint && focusedPoint.current) {\n const {\n currentLineIndex,\n currentPointIndex,\n lineIndexes,\n lowestLineIndex,\n highestLineIndex,\n } = buildLineIndexData(focusedPoint);\n\n switch (currentLineIndex) {\n case lowestLineIndex: {\n (\n (\n pointRefArray.current.find(\n findPointToFocus(highestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n break;\n }\n default: {\n const nextLowestLineIndex =\n lineIndexes[lineIndexes.indexOf(currentLineIndex) - 1];\n (\n (\n pointRefArray.current.find(\n findPointToFocus(nextLowestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n }\n }\n }\n break;\n }\n case 'ArrowDown': {\n event.preventDefault();\n const focusedPoint = pointRefArray.current.find(\n point => point.current === document.activeElement\n );\n\n if (focusedPoint && focusedPoint.current) {\n const {\n currentLineIndex,\n currentPointIndex,\n lineIndexes,\n lowestLineIndex,\n highestLineIndex,\n } = buildLineIndexData(focusedPoint);\n\n switch (currentLineIndex) {\n case highestLineIndex: {\n (\n (\n pointRefArray.current.find(\n findPointToFocus(lowestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n break;\n }\n default: {\n const nextHighestLineIndex =\n lineIndexes[lineIndexes.indexOf(currentLineIndex) + 1];\n (\n (\n pointRefArray.current.find(\n findPointToFocus(nextHighestLineIndex, currentPointIndex)\n ) as React.MutableRefObject<Element>\n ).current as HTMLButtonElement\n ).focus();\n }\n }\n }\n break;\n }\n }\n }\n\n function handleFirstLegendButtonKeydown(event: React.KeyboardEvent) {\n const { key, shiftKey } = event;\n switch (key) {\n case 'Tab': {\n if (\n shiftKey &&\n lastFocusedScatterPoint &&\n lastFocusedScatterPoint.current &&\n pointRefArray.current.find(\n point => point.current === lastFocusedScatterPoint.current\n )\n ) {\n event.preventDefault();\n lastFocusedScatterPoint.current.focus();\n }\n break;\n }\n }\n }\n\n return (\n <LineChartContainer ref={containerRef}>\n <VictoryChartContainer onKeyDown={handleChartContainerKeyDown}>\n <VictoryChart\n domainPadding={32}\n height={400}\n padding={{ top: 0, left: 80, right: 0, bottom: 62 }}\n theme={magmaTheme}\n width={width}\n containerComponent={\n <VictoryVoronoiContainer\n name=\"xAxisGroupLabel\"\n voronoiBlacklist={scatterNames}\n voronoiDimension=\"x\"\n labels={\n hoveringOnXAxisLine && showXAxisLabel ? () => ` ` : undefined\n }\n labelComponent={\n showXAxisLabel ? (\n <VictoryTooltip\n flyoutComponent={\n <AxisTooltip\n dataLength={data.length}\n hiddenData={hiddenData}\n />\n }\n />\n ) : undefined\n }\n role=\"presentation\"\n voronoiPadding={32}\n />\n }\n {...chart}\n >\n <VictoryAxis {...yAxisOther} dependentAxis style={yAxisStyles} />\n {data.map(\n ({ data: dataset }, i) =>\n !hiddenData.includes(i) && (\n <VictoryLine\n style={{\n data: {\n opacity: setLineOpacity(i),\n stroke: theme.iterableColors[i],\n strokeWidth: '3',\n },\n parent: { border: theme.colors.neutral400 },\n }}\n key={`line${i}`}\n data={dataset as unknown as any[]}\n labelComponent={<></>}\n x={x as DataGetterPropType}\n y={y as DataGetterPropType}\n {...line}\n />\n )\n )}\n <VictoryAxis\n {...xAxisOther}\n style={xAxisStyles}\n gridComponent={\n <CustomAxisComponent\n events={{\n onMouseEnter: () => setHoveringOnXAxisLine(true),\n onMouseLeave: () => setHoveringOnXAxisLine(false),\n }}\n />\n }\n />\n {data.map(\n ({ data: dataset }, i) =>\n !hiddenData.includes(i) && (\n <VictoryScatter\n name={`scatter-${i}`}\n events={[\n {\n target: 'data',\n eventHandlers: {\n onBlur: () => {\n setShowXAxisLabel(true);\n setShowTooltip(null);\n return [\n {\n target: 'labels',\n mutation: () => ({ active: undefined }),\n },\n ];\n },\n onClick: () => {\n return [\n {\n target: 'labels',\n mutation: props => {\n setShowTooltip(\n `${props.datum.lineIndex}-${props.datum.index}`\n );\n return { active: true };\n },\n },\n ];\n },\n onFocus: () => {\n setShowXAxisLabel(false);\n return [\n {\n target: 'labels',\n mutation: props => {\n setShowTooltip(\n `${props.datum.lineIndex}-${props.datum.index}`\n );\n return { active: true };\n },\n },\n ];\n },\n onMouseEnter: () => {\n setShowXAxisLabel(false);\n return [\n {\n target: 'labels',\n mutation: props => {\n setShowTooltip(\n `${props.datum.lineIndex}-${props.datum.index}`\n );\n return { active: true };\n },\n },\n ];\n },\n onMouseLeave: () => {\n setShowTooltip(null);\n setShowXAxisLabel(true);\n },\n },\n },\n ]}\n style={{\n data: {\n fill: theme.colors.neutral100,\n opacity: setLineOpacity(i),\n stroke: theme.iterableColors[i],\n strokeWidth: 2,\n },\n }}\n size={5}\n data={\n dataset.map((datum, index) => ({\n index,\n lineIndex: i,\n ...datum,\n })) as unknown as any[]\n }\n dataComponent={\n <CustomScatterDataComponent\n lineIndex={i}\n pointRefArray={pointRefArray}\n registerPoint={registerPoint}\n unregisterPoint={unregisterPoint}\n />\n }\n labels={() => ''}\n labelComponent={\n <VictoryTooltip\n text=\"\"\n flyoutComponent={\n <GraphTooltip index={i} showTooltip={showTooltip} />\n }\n />\n }\n key={`scatter${i}`}\n x={x as DataGetterPropType}\n y={y as DataGetterPropType}\n {...scatter}\n />\n )\n )}\n </VictoryChart>\n </VictoryChartContainer>\n\n <DataLegendsContainer>\n <DataLegendsDescription theme={theme}>\n {i18n.charts.line.dataLegendsLabel}\n </DataLegendsDescription>\n {data.map(({ name }, i) => {\n const legendButtonAriaLabel =\n i18n.charts.line.legendButtonAriaLabel.replace(/\\{name\\}/g, name);\n\n return (\n <LegendButton\n aria-label={legendButtonAriaLabel}\n color={theme.iterableColors[i]}\n dataIndex={i}\n isHidden={hiddenData.includes(i)}\n key={i}\n name={name}\n onClick={handleLegendClick}\n onKeyDown={i === 0 ? handleFirstLegendButtonKeydown : undefined}\n focusCurrentLine={focusCurrentLine}\n ref={i === 0 ? firstLegendButtonRef : undefined}\n resetLineFocus={resetLineFocus}\n />\n );\n })}\n </DataLegendsContainer>\n </LineChartContainer>\n );\n}\n","import * as React from 'react';\nimport { VictoryAxisProps } from 'victory';\n\nimport { Card, Datagrid, Spinner } from 'react-magma-dom';\n\nexport function toCamelCase(str: string) {\n return str\n .toLowerCase()\n .replace(/[^a-z 0-9]/gi, '')\n .replace(/(?:^\\w|[A-Z]|\\b\\w)/g, (ltr, index) =>\n index === 0 ? ltr.toLowerCase() : ltr.toUpperCase()\n )\n .replace(/\\s+/g, '');\n}\n\nexport interface DataTableProps {\n data?: any[];\n xData: {\n keyValue?: string | number | symbol;\n label?: VictoryAxisProps['label'];\n tickFormat?: Partial<VictoryAxisProps['tickFormat']>;\n tickValues?: VictoryAxisProps['tickValues'];\n };\n yData: {\n keyValue?: string | number | symbol;\n tickFormat?: Partial<VictoryAxisProps['tickFormat']>;\n };\n}\n\nexport const ChartDataTable = (props: DataTableProps) => {\n const {\n data = [],\n xData: {\n keyValue: xKeyValue,\n label: xAxisLabel,\n tickFormat: xTickFormat,\n tickValues: xTickValues,\n },\n yData: { keyValue: yKeyValue, tickFormat: yTickFormat },\n } = props;\n const [dataForTable, setDataForTable] = React.useState({\n columns: [],\n rows: [],\n });\n\n React.useEffect(() => {\n setDataForTable(convertData());\n }, [data]);\n\n function convertData() {\n const xField = toCamelCase((xKeyValue || xAxisLabel || 'x') as string);\n const xTickValuesArray = data.reduce((valuesArray, { data: dataset }) => {\n dataset.forEach((datum: any) => {\n const value = datum.x || (xKeyValue && datum[xKeyValue]);\n !valuesArray.includes(value) && valuesArray.push(value);\n });\n\n return valuesArray;\n }, []);\n\n let baseTableData = {\n columns:\n xTickValuesArray.length > 0\n ? [\n {\n field: xField,\n header: xAxisLabel || xKeyValue || 'X',\n isRowHeader: true,\n },\n ]\n : [],\n rows: xTickValuesArray.reduce(\n (agg: any[], tick: number, index: number) => {\n const tickValue =\n xTickValues &&\n typeof tick === 'number' &&\n xTickValues.length === xTickValuesArray.length\n ? xTickFormat && typeof xTickFormat === 'function'\n ? xTickFormat(xTickValues[tick - 1])\n : xTickValues[tick - 1]\n : xTickFormat && Array.isArray(xTickFormat)\n ? xTickFormat[tick - 1]\n : xTickFormat && typeof xTickFormat === 'function'\n ? xTickFormat(tick)\n : tick;\n agg.push({\n [xField]: tickValue,\n id: index,\n });\n\n return agg;\n },\n []\n ),\n };\n\n return data.reduce((tableData, datum) => {\n const { name: header, data: dataset } = datum;\n const field = toCamelCase(header);\n\n tableData.columns.push({\n field,\n header,\n });\n\n dataset.forEach((d: any, i: number) => {\n const yValue =\n d.y || d.y === 0 ? d.y : undefined || (yKeyValue && d[yKeyValue]);\n tableData.rows[i] = {\n ...tableData.rows[i],\n id: baseTableData.rows.length > 0 ? i + 1 : i,\n [field]:\n yTickFormat && typeof yTickFormat === 'function'\n ? yTickFormat(yValue)\n : yValue,\n };\n });\n\n return tableData;\n }, baseTableData);\n }\n\n return (\n <Card>\n {dataForTable.rows.length > 0 ? (\n <Datagrid\n hasPagination={false}\n columns={dataForTable.columns}\n rows={dataForTable.rows}\n />\n ) : (\n <Spinner />\n )}\n </Card>\n );\n};\n","import * as React from 'react';\nimport {\n I18nContext,\n styled,\n ThemeContext,\n useDescendants,\n} from 'react-magma-dom';\nimport { css } from '@emotion/core';\nimport { KeyboardIcon } from 'react-magma-icons';\n\nimport { LineChart, LineChartProps } from './LineChart';\nimport { ChartDataTable } from './ChartDataTable';\nimport {\n Announce,\n ButtonVariant,\n Card,\n IconButton,\n Paragraph,\n TabsContainer,\n Tabs,\n Tab,\n TabPanelsContainer,\n TabPanel,\n Tooltip,\n TypographyVisualStyle,\n} from 'react-magma-dom';\n\ninterface BaseChartProps {\n /**\n * Description of what the line chart data represents placed above the chart\n */\n description?: string;\n /**\n * @internal\n */\n testId?: string;\n /**\n * Title of the line chart\n */\n title: string;\n /**\n * Type of chart - for now just 'line' is accepted\n */\n type: string;\n}\nexport interface ChartProps<T extends any>\n extends BaseChartProps,\n Omit<React.HTMLAttributes<HTMLDivElement>, 'title'>,\n LineChartProps<T> {}\n\nconst StyledTitle = styled.span`\n color: ${props => props.theme.colors.neutral};\n font-size: ${props => props.theme.typeScale.size04.fontSize};\n font-weight: 600;\n line-height: ${props => props.theme.typeScale.size04.lineHeight};\n margin: 0 0 12px 0;\n`;\n\nconst StyledParagraph = styled(Paragraph)`\n font-size: ${props => props.theme.typeScale.size02.fontSize};\n margin: 0 0 18px 0;\n`;\n\nconst StyledTabsContainer = styled(TabsContainer)`\n width: 800px;\n ul {\n box-shadow: inset 0 -1px 0 ${props => props.theme.colors.neutral300};\n }\n`;\n\nconst StyledTabPanel = styled(TabPanel)`\n padding: 22px 0;\n`;\n\nconst KeyboardInstructionsCard = styled(Card)<{\n isOpen?: boolean;\n maxHeight?: string;\n width?: string;\n}>`\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);\n display: ${props => (props.isOpen ? 'block' : 'none')};\n right: ${props => props.theme.spaceScale.spacing02};\n max-height: ${props =>\n props.maxHeight ? props.maxHeight : props.theme.dropdown.content.maxHeight};\n opacity: ${props => (props.isOpen ? '1' : '0')};\n outline: 0;\n overflow-y: auto;\n padding: ${props => props.theme.spaceScale.spacing05}\n ${props => props.theme.spaceScale.spacing05};\n position: absolute;\n transition: opacity 0.3s;\n white-space: nowrap;\n z-index: 2;\n\n ${props =>\n props.width &&\n css`\n white-space: normal;\n width: ${props.width};\n `}\n`;\n\nfunction BaseChart<T>(props: ChartProps<T>, ref: React.Ref<HTMLDivElement>) {\n const { description, title, testId, type, ...other } = props;\n const keyboardInstructionsRef = React.useRef<HTMLButtonElement>(null);\n const lastFocusedScatterPoint = React.useRef<SVGPathElement>(null);\n const theme = React.useContext(ThemeContext);\n const i18n = React.useContext(I18nContext);\n\n const [pointRefArray, registerPoint, unregisterPoint] = useDescendants();\n\n const [isKeyboardInstructionsOpen, setIsKeyboardInstructionsOpen] =\n React.useState<boolean>(false);\n\n function handleKeyboardInstructionsButtonBlur() {\n setIsKeyboardInstructionsOpen(false);\n }\n\n function handleKeyboardInstructionsButtonClick() {\n setIsKeyboardInstructionsOpen(prevOpen => !prevOpen);\n }\n\n function handleKeyboardInstructionsButtonKeydown(event: React.KeyboardEvent) {\n const { key, shiftKey } = event;\n\n switch (key) {\n case 'Escape': {\n setIsKeyboardInstructionsOpen(false);\n break;\n }\n case 'Tab': {\n if (\n !shiftKey &&\n lastFocusedScatterPoint &&\n lastFocusedScatterPoint.current &&\n pointRefArray.current.find(\n point => point.current === lastFocusedScatterPoint.current\n )\n ) {\n event.preventDefault();\n lastFocusedScatterPoint.current.focus();\n }\n break;\n }\n }\n }\n\n return (\n <div ref={ref}>\n <StyledTitle theme={theme}>{title}</StyledTitle>\n {description && (\n <StyledParagraph\n theme={theme}\n visualStyle={TypographyVisualStyle.bodySmall}\n >\n {description}\n </StyledParagraph>\n )}\n <StyledTabsContainer theme={theme}>\n <Tabs>\n <Tab>{i18n.charts.line.chartTabLabel}</Tab>\n <Tab>{i18n.charts.line.dataTabLabel}</Tab>\n <div\n onBlur={handleKeyboardInstructionsButtonBlur}\n style={{\n display: 'inline-block',\n marginLeft: 'auto',\n }}\n >\n <Tooltip\n content={i18n.charts.line.keyboardInstructionsTooltip}\n ref={keyboardInstructionsRef}\n >\n <IconButton\n aria-controls=\"keyboardInstructions\"\n aria-label={i18n.charts.line.keyboardInstructionsTooltip}\n aria-expanded={Boolean(isKeyboardInstructionsOpen)}\n icon={<KeyboardIcon />}\n onClick={handleKeyboardInstructionsButtonClick}\n onKeyDown={handleKeyboardInstructionsButtonKeydown}\n variant={ButtonVariant.link}\n />\n </Tooltip>\n <Announce>\n <KeyboardInstructionsCard\n id=\"keyboardInstructions\"\n isOpen={isKeyboardInstructionsOpen}\n theme={theme}\n width=\"350px\"\n >\n <Paragraph\n visualStyle={TypographyVisualStyle.headingXSmall}\n style={{ margin: '0 0 16px' }}\n >\n {i18n.charts.line.keyboardInstructionsHeader}\n </Paragraph>\n {i18n.charts.line.keyboardInstructions}\n </KeyboardInstructionsCard>\n </Announce>\n </div>\n </Tabs>\n <TabPanelsContainer>\n <StyledTabPanel theme={theme}>\n {type === 'line' && (\n <LineChart<T>\n {...other}\n lastFocusedScatterPoint={lastFocusedScatterPoint}\n pointRefArray={pointRefArray}\n registerPoint={registerPoint}\n tabRef={keyboardInstructionsRef}\n unregisterPoint={unregisterPoint}\n />\n )}\n </StyledTabPanel>\n <StyledTabPanel theme={theme}>\n <ChartDataTable\n data={other.data}\n xData={{\n keyValue: other.x,\n label: other.componentProps?.xAxis?.label,\n tickFormat: other.componentProps?.xAxis?.tickFormat,\n }}\n yData={{\n keyValue: other.y,\n tickFormat: other.componentProps?.yAxis?.tickFormat,\n }}\n />\n </StyledTabPanel>\n </TabPanelsContainer>\n </StyledTabsContainer>\n </div>\n );\n}\n\nexport const Chart = React.forwardRef(BaseChart) as <T>(\n props: ChartProps<T> & { ref?: React.MutableRefObject<HTMLDivElement> }\n) => ReturnType<typeof BaseChart>;\n"],"names":["colors","baseProps","width","height","padding","baseLabelStyles","fontFamily","fontSize","letterSpacing","fill","stroke","strokeWidth","centeredLabelStyles","textAnchor","magmaTheme","area","style","data","labels","axis","strokeLinecap","strokeLinejoin","axisLabel","grid","pointerEvents","ticks","size","tickLabels","polarDependentAxis","bar","boxplot","max","maxLabels","median","medianLabels","min","minLabels","q1","q1Labels","q3","q3Labels","boxWidth","candlestick","candleColors","positive","negative","chart","errorbar","borderWidth","opacity","group","colorScale","histogram","legend","gutter","orientation","titleOrientation","type","title","line","pie","scatter","stack","tooltip","flyoutStyle","flyoutPadding","cornerRadius","pointerLength","voronoi","flyout","StyledGraphTooltip","styled","StyledTooltip","props","theme","neutral100","neutral300","neutral","typeScale","size02","lineHeight","TooltipColorSwatch","span","color","GraphTooltip","datum","index","showTooltip","x","y","React","useContext","ThemeContext","_jsx","_jsxs","position","TooltipPosition","top","role","iterableColors","label","TooltipArrow","AxisTooltip","activePoints","hiddenData","pointsIndexes","Array","from","dataLength","_","i","filter","includes","map","point","CustomScatterDataComponent","pointIndex","lineIndex","pointRefArray","registerPoint","unregisterPoint","other","Point","ariaLabel","pathComponent","CustomPointComponent","tabIndex","forceUpdate","useForceUpdate","ref","useRef","useEffect","CustomAxisComponent","events","LineSegment","strokeOpacity","LegendButton","forwardRef","children","dataIndex","isHidden","onClick","name","focusCurrentLine","resetLineFocus","handleOnMouseEnterOrFocus","display","onMouseEnter","onMouseLeave","Checkbox","checked","containerStyle","alignItems","border","boxShadow","margin","inputStyle","neutral800","borderRadius","labelText","onBlur","onFocus","LineChartContainer","div","VictoryChartContainer","DataLegendsContainer","DataLegendsDescription","p","LineChart","componentProps","xAxis","xAxisLabel","undefined","xTickLabels","xRest","xAxisOther","yAxis","yAxisLabel","yTickLabels","yRest","yAxisOther","lastFocusedScatterPoint","tabRef","i18n","I18nContext","useState","setHiddenData","setWidth","focusedLine","setFocusedLine","setShowTooltip","showXAxisLabel","setShowXAxisLabel","hoveringOnXAxisLine","setHoveringOnXAxisLine","containerRef","firstLegendButtonRef","updateWidth","window","addEventListener","handleEsc","removeEventListener","handleMouseMove","scatterNames","xAxisStyles","fontWeight","yAxisStyles","current","clientWidth","event","key","setLineOpacity","handleLegendClick","item","concat","buildLineIndexes","acc","currentLineIndex","parseInt","getAttribute","push","buildLineIndexData","currentPointIndex","lineIndexes","reduce","lowestLineIndex","highestLineIndex","length","findPointToFocus","handleFirstLegendButtonKeydown","shiftKey","find","preventDefault","focus","onKeyDown","document","activeElement","focusedPointIndex","findIndex","focusedPoint","nextLowestLineIndex","indexOf","nextHighestLineIndex","VictoryChart","domainPadding","left","right","bottom","containerComponent","VictoryVoronoiContainer","voronoiBlacklist","voronoiDimension","labelComponent","VictoryTooltip","flyoutComponent","voronoiPadding","VictoryAxis","dependentAxis","dataset","VictoryLine","parent","neutral400","gridComponent","VictoryScatter","target","eventHandlers","mutation","active","dataComponent","text","charts","dataLegendsLabel","legendButtonAriaLabel","replace","toCamelCase","str","toLowerCase","ltr","toUpperCase","ChartDataTable","xData","xKeyValue","keyValue","xTickFormat","tickFormat","xTickValues","tickValues","yData","yKeyValue","yTickFormat","columns","rows","dataForTable","setDataForTable","xField","xTickValuesArray","baseTableData","valuesArray","forEach","value","field","header","isRowHeader","agg","tick","tickValue","isArray","id","tableData","d","yValue","Card","Datagrid","hasPagination","Spinner","StyledTitle","size04","StyledParagraph","Paragraph","StyledTabsContainer","TabsContainer","StyledTabPanel","TabPanel","KeyboardInstructionsCard","isOpen","spaceScale","spacing02","maxHeight","dropdown","content","spacing05","css","BaseChart","description","keyboardInstructionsRef","useDescendants","isKeyboardInstructionsOpen","setIsKeyboardInstructionsOpen","visualStyle","TypographyVisualStyle","bodySmall","Tabs","Tab","chartTabLabel","dataTabLabel","marginLeft","Tooltip","keyboardInstructionsTooltip","IconButton","Boolean","icon","KeyboardIcon","prevOpen","variant","ButtonVariant","link","Announce","headingXSmall","keyboardInstructionsHeader","keyboardInstructions","TabPanelsContainer","_other$componentProps","_other$componentProps2","_other$componentProps3","_other$componentProps4","_other$componentProps5","_other$componentProps6","Chart"],"mappings":"mnCAmBA,gBAAMA,EAAS,CACb,UACA,UACA,UACA,UACA,UACA,WAmBIC,EAAY,CAChBC,MAAO,IACPC,OAAQ,IACRC,QAAS,IAMLC,EAAkB,CACtBC,WAlBgB,mCAmBhBC,SAjBe,GAkBfC,cAnBoB,SAoBpBJ,QAdc,EAedK,KA5BkB,UA6BlBC,OAAQ,cACRC,YAAa,GAGTC,KAAwBC,WAAY,UAAaR,GAQ1CS,EAAkB,CAC7BC,QACEC,MAAO,CACLC,KAAM,CACJR,KA5CQ,QA8CVS,OAAQb,IAEPJ,GAELkB,QACEH,MAAO,CACLG,KAAM,CACJV,KAAM,cACNC,OAxDY,UAyDZC,YAAa,EACbS,cAnBc,QAoBdC,eAnBe,SAqBjBC,eACKV,GACHR,QAjDQ,EAkDRM,OAAQ,gBAEVa,KAAM,CACJd,KAAM,OACNC,OAAQ,UAERU,cA/Bc,QAgCdC,eA/Be,QAgCfG,cAAe,WAEjBC,MAAO,CACLhB,KAAM,cACNiB,KAAM,EACNhB,OA7EY,UA8EZC,YAAa,EACbS,cAxCc,Q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J4D,wBAAyBA,EACzB/D,cAAeA,EACfC,cAAeA,EACf+D,OAAQwJ,EACRtN,gBAAiBA,OAIvB3B,EAACoO,IAAevP,MAAOA,WACrBmB,EAAC0L,IACCtQ,KAAMwG,EAAMxG,KACZuQ,MAAO,CACLE,SAAUjK,EAAMjC,EAChBY,eAAOqB,EAAMgD,0BAANgM,EAAsB/L,cAAtBgM,EAA6BtQ,MACpCwL,oBAAYnK,EAAMgD,0BAANkM,EAAsBjM,cAAtBkM,EAA6BhF,YAE3CG,MAAO,CACLL,SAAUjK,EAAMhC,EAChBmM,oBAAYnK,EAAMgD,0BAANoM,EAAsB7L,cAAtB8L,EAA6BlF,wBAQxD,CAEYmF,IAAAA,GAAQrR,EAAM+C,WAAWmM"}
@@ -1,2 +1,2 @@
1
- !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("react-magma-dom"),require("@emotion/core"),require("react-magma-icons"),require("victory"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react-magma-dom","@emotion/core","react-magma-icons","victory","react/jsx-runtime"],n):n((e||self).charts={},e.react,e.reactMagmaDom,e.core,e.reactMagmaIcons,e.victory,e.jsx)}(this,function(e,n,t,r,i,o,a){function s(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,n}var l=s(n);function c(){return c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},c.apply(this,arguments)}function u(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n.indexOf(t=o[r])>=0||(i[t]=e[t]);return i}function d(e,n){return n||(n=e.slice(0)),e.raw=n,e}var f,p,x,h,m,y,g=["#00507A","#8F0033","#B84900","#255200","#711E6E","#005249"],b="#8F8F8F",v="#3F3F3F",k="pink",j={width:350,height:350,padding:50},w={fontFamily:'"Work Sans",Helvetica,sans-serif',fontSize:12,letterSpacing:"normal",padding:8,fill:v,stroke:"transparent",strokeWidth:0},L=c({textAnchor:"middle"},w),I="round",C="round",S={area:c({style:{data:{fill:k},labels:w}},j),axis:c({style:{axis:{fill:"transparent",stroke:b,strokeWidth:1,strokeLinecap:I,strokeLinejoin:C},axisLabel:c({},L,{padding:8,stroke:"transparent"}),grid:{fill:"none",stroke:"#dfdfdf",strokeLinecap:I,strokeLinejoin:C,pointerEvents:"painted"},ticks:{fill:"transparent",size:0,stroke:b,strokeWidth:0,strokeLinecap:I,strokeLinejoin:C},tickLabels:c({},w,{fill:v})}},j),polarDependentAxis:{style:{ticks:{fill:"transparent",size:1,stroke:"transparent"}}},bar:c({style:{data:{fill:v,padding:8,strokeWidth:0},labels:w}},j),boxplot:c({style:{max:{padding:8,stroke:v,strokeWidth:1},maxLabels:c({},w,{padding:3}),median:{padding:8,stroke:v,strokeWidth:1},medianLabels:c({},w,{padding:3}),min:{padding:8,stroke:v,strokeWidth:1},minLabels:c({},w,{padding:3}),q1:{padding:8,fill:v},q1Labels:c({},w,{padding:3}),q3:{padding:8,fill:v},q3Labels:c({},w,{padding:3})},boxWidth:20},j),candlestick:c({style:{data:{stroke:v},labels:c({},w,{padding:5})},candleColors:{positive:"#ffffff",negative:v}},j),chart:j,errorbar:c({borderWidth:8,style:{data:{fill:"transparent",opacity:1,stroke:v,strokeWidth:2},labels:w}},j),group:c({colorScale:g},j),histogram:c({style:{data:{fill:v,stroke:k,strokeWidth:2},labels:w}},j),legend:{colorScale:g,gutter:10,orientation:"vertical",titleOrientation:"top",style:{data:{type:"circle"},labels:w,title:c({},w,{padding:5})}},line:c({style:{data:{fill:"transparent",opacity:1,stroke:v,strokeWidth:2},labels:w}},j),pie:c({colorScale:g,style:{data:{padding:8,stroke:"#DFDFDF",strokeWidth:1},labels:c({},w,{padding:20})}},j),scatter:c({style:{data:{fill:v,opacity:1,stroke:"transparent",strokeWidth:0},labels:w}},j),stack:c({colorScale:g},j),tooltip:{style:c({},w,{padding:0,pointerEvents:"none"}),flyoutStyle:{stroke:k,strokeWidth:1,fill:"#f0f0f0",pointerEvents:"none"},flyoutPadding:5,cornerRadius:5,pointerLength:10},voronoi:c({style:{data:{fill:"transparent",stroke:"transparent",strokeWidth:0},labels:c({},w,{padding:5,pointerEvents:"none"}),flyout:{stroke:k,strokeWidth:1,fill:"#f0f0f0",pointerEvents:"none"}}},j)},P=t.styled(t.StyledTooltip)(f||(f=d(["\n background: ",";\n border: 1px solid ",";\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);\n box-sizing: border-box;\n color: ",";\n font-size: ",";\n font-weight: normal;\n line-height: ",";\n margin: 0;\n padding: 8px;\n width: fit-content;\n div {\n margin-bottom: 8px;\n display: flex;\n align-items: flex-start;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n"])),function(e){return e.theme.colors.neutral08},function(e){return e.theme.colors.neutral06},function(e){return e.theme.colors.neutral},function(e){return e.theme.typeScale.size02.fontSize},function(e){return e.theme.typeScale.size02.lineHeight}),A=t.styled.span(p||(p=d(["\n background: ",";\n border: ",";\n border-radius: 4px;\n height: 20px;\n width: 20px;\n margin-right: 8px;\n"])),function(e){return e.color},function(e){return e.color?"none":"3px solid black"}),T=function(e){var n=e.datum,r=e.index,i=e.showTooltip,o=e.x,s=e.y,c=l.useContext(t.ThemeContext);return i===r+"-"+n.index?a.jsx("g",{style:{pointerEvents:"none"},children:a.jsx("foreignObject",{x:o,y:s,width:"275",height:"100%",children:a.jsxs(P,{position:t.TooltipPosition.top,role:"tooltip",theme:c,children:[a.jsxs("div",{children:[a.jsx(A,{color:c.iterableColors[r]}),a.jsx("span",{children:n.label})]}),a.jsx(t.TooltipArrow,{theme:c})]})})}):null},E=function(e){var n=e.x,r=e.y,i=e.activePoints,o=e.hiddenData,s=Array.from(Array(e.dataLength-0),function(e,n){return n+0}).filter(function(e){return!o.includes(e)}),c=l.useContext(t.ThemeContext);return a.jsx("g",{style:{pointerEvents:"none"},children:a.jsx("foreignObject",{x:n,y:r,width:"275",height:"100%",children:a.jsxs(P,{"data-testid":"axis-tooltip",position:t.TooltipPosition.top,role:"tooltip",theme:c,children:[i.map(function(e,n){return a.jsxs("div",{children:[a.jsx(A,{color:c.iterableColors[s[n]]}),a.jsx("span",{children:e.label})]},n)}),a.jsx(t.TooltipArrow,{theme:c})]})})})},z=["datum","index","lineIndex","pointRefArray","registerPoint","unregisterPoint"],F=["lineIndex","pointRefArray","pointIndex","registerPoint","unregisterPoint"],W=function(e){var n=e.datum,t=e.index,r=e.lineIndex,i=e.pointRefArray,s=e.registerPoint,l=e.unregisterPoint,d=u(e,z);return a.jsx(o.Point,c({},d,{ariaLabel:n.label,pathComponent:a.jsx(D,{lineIndex:r,pointIndex:t,pointRefArray:i,registerPoint:s,unregisterPoint:l}),role:"button",tabIndex:0}))},D=function(e){var n=e.lineIndex,r=e.pointRefArray,i=e.pointIndex,o=e.registerPoint,s=e.unregisterPoint,d=u(e,F),f=t.useForceUpdate(),p=l.useRef(null);return l.useEffect(function(){return o(r,p),f(),function(){return s(r,p)}},[]),a.jsx("path",c({ref:p,"data-line-index":n,"data-point-index":i},d))},R=["events"],O=function(e){var n=e.events,t=u(e,R);return a.jsxs("g",{children:[a.jsx(o.LineSegment,c({},t,{events:n,style:{strokeWidth:"50px",stroke:"transparent"}})),a.jsx(o.LineSegment,c({},t,{events:n,style:{strokeWidth:"1px",stroke:"black",strokeOpacity:"0.2"}}))]})},V=["children","color","dataIndex","isHidden","onClick","name","focusCurrentLine","resetLineFocus"],H=l.forwardRef(function(e,n){var r=e.color,i=e.dataIndex,o=e.isHidden,s=e.onClick,d=e.name,f=e.focusCurrentLine,p=e.resetLineFocus,x=u(e,V);function h(){o||f&&"function"==typeof f&&f(i)}var m=l.useContext(t.ThemeContext);return a.jsx("div",{style:{display:"inline-flex"},onMouseEnter:h,onMouseLeave:p,children:a.jsx(t.Checkbox,c({checked:!o,color:r,containerStyle:{alignItems:"center",border:"0",boxShadow:"0 0 0",color:m.colors.neutral,display:"inline-flex",margin:"0 36px 20px 0",padding:"0"},inputStyle:{border:r?"none":"2px solid "+m.colors.neutral02,borderRadius:"4px"},labelText:d,onBlur:p,onClick:function(){s&&"function"==typeof s&&s(i),o||p&&"function"==typeof p&&p()},onFocus:h,ref:n,theme:m},x))})}),q=["axisLabel","tickLabels"],B=["style"],M=["axisLabel","tickLabels"],K=["style"],U=t.styled.div(x||(x=d(["\n max-height: 600px;\n max-width: 800px;\n svg {\n overflow: visible;\n }\n"]))),X=t.styled.div(h||(h=d([""]))),_=t.styled.div(m||(m=d(["\n padding-bottom: 24px;\n"]))),G=t.styled.p(y||(y=d(["\n color: ",";\n font-size: ",";\n"])),function(e){return e.theme.colors.neutral03},function(e){return e.theme.typeScale.size02.fontSize});function Z(e){var n=e.componentProps,r=(n=void 0===n?{}:n).chart,i=void 0===r?{}:r,s=n.line,d=void 0===s?{}:s,f=n.scatter,p=void 0===f?{}:f,x=n.xAxis,h=(x=void 0===x?{style:{}}:x).style,m=(h=void 0===h?{}:h).axisLabel,y=void 0===m?void 0:m,g=h.tickLabels,b=void 0===g?void 0:g,v=u(h,q),k=u(x,B),j=n.yAxis,w=(j=void 0===j?{style:{}}:j).style,L=(w=void 0===w?{}:w).axisLabel,I=void 0===L?void 0:L,C=w.tickLabels,P=void 0===C?void 0:C,A=u(w,M),z=u(j,K),F=e.data,D=void 0===F?[]:F,R=e.lastFocusedScatterPoint,V=e.pointRefArray,Z=e.registerPoint,J=e.unregisterPoint,N=e.tabRef,Q=e.x,Y=e.y,$=l.useContext(t.ThemeContext),ee=l.useContext(t.I18nContext),ne=l.useState([]),te=ne[0],re=ne[1],ie=l.useState(800),oe=ie[0],ae=ie[1],se=l.useState(null),le=se[0],ce=se[1],ue=l.useState(null),de=ue[0],fe=ue[1],pe=l.useState(!0),xe=pe[0],he=pe[1],me=l.useState(!1),ye=me[0],ge=me[1],be=l.useRef(null),ve=l.useRef(null);l.useEffect(function(){return Le(),window.addEventListener("resize",Le),window.addEventListener("keydown",Ie),function(){window.removeEventListener("resize",Le),window.removeEventListener("keydown",Ie)}},[]),l.useEffect(function(){return window.addEventListener("mousemove",Ce),function(){window.removeEventListener("mousemove",Ce)}},[de]);var ke=D.map(function(e,n){return"scatter-"+n}),je=c({tickLabels:c({color:"#3f3f3f",fontSize:12},b),axisLabel:c({color:"#3f3f3f",padding:44,fontSize:14,fontWeight:"bold"},y)},v),we=c({tickLabels:c({fontSize:12},P),axisLabel:c({color:"#3f3f3f",padding:64,fontSize:14,fontWeight:"bold"},I)},A);function Le(){be.current&&ae(be.current.clientWidth)}function Ie(e){"Escape"===e.key&&(fe(null),he(!1))}function Ce(){!de&&he(!0)}function Se(e){return null===le||le===e?1:.1}function Pe(e){te.includes(e)?re(te.filter(function(n){return n!==e})):re(te.concat([e]))}function Ae(e){ce(e)}function Te(){ce(null)}var Ee=function(e,n){if(n.current){var t=parseInt(n.current.getAttribute("data-line-index"),10);!e.includes(t)&&e.push(parseInt(n.current.getAttribute("data-line-index"),10))}return e},ze=function(e){var n=parseInt(e.current.getAttribute("data-line-index"),10),t=parseInt(e.current.getAttribute("data-point-index"),10),r=V.current.reduce(Ee,[]);return{currentLineIndex:n,currentPointIndex:t,lineIndexes:r,lowestLineIndex:r[0],highestLineIndex:r[r.length-1]}},Fe=function(e,n){return function(t){return t.current&&parseInt(t.current.getAttribute("data-line-index"),10)===e&&parseInt(t.current.getAttribute("data-point-index"),10)===n}};function We(e){"Tab"===e.key&&e.shiftKey&&R&&R.current&&V.current.find(function(e){return e.current===R.current})&&(e.preventDefault(),R.current.focus())}return a.jsxs(U,{ref:be,children:[a.jsx(X,{onKeyDown:function(e){var n=e.shiftKey;switch(e.key){case"Tab":e.preventDefault(),R.current=V.current.find(function(e){return e.current===document.activeElement}).current,n?N.current&&N.current.focus():ve.current&&ve.current.focus();break;case"ArrowRight":var t=V.current.findIndex(function(e){return e.current===document.activeElement});void 0!==t&&(t===V.current.length-1?V.current[0].current.focus():V.current[t+1].current.focus());break;case"ArrowLeft":var r=V.current.findIndex(function(e){return e.current===document.activeElement});void 0!==r&&(0===r?V.current[V.current.length-1].current.focus():V.current[r-1].current.focus());break;case"ArrowUp":e.preventDefault();var i=V.current.find(function(e){return e.current===document.activeElement});if(i&&i.current){var o=ze(i),a=o.currentLineIndex,s=o.currentPointIndex,l=o.lineIndexes;if(a===o.lowestLineIndex)V.current.find(Fe(o.highestLineIndex,s)).current.focus();else{var c=l[l.indexOf(a)-1];V.current.find(Fe(c,s)).current.focus()}}break;case"ArrowDown":e.preventDefault();var u=V.current.find(function(e){return e.current===document.activeElement});if(u&&u.current){var d=ze(u),f=d.currentLineIndex,p=d.currentPointIndex,x=d.lineIndexes;if(f===d.highestLineIndex)V.current.find(Fe(d.lowestLineIndex,p)).current.focus();else{var h=x[x.indexOf(f)+1];V.current.find(Fe(h,p)).current.focus()}}}},children:a.jsxs(o.VictoryChart,c({domainPadding:32,height:400,padding:{top:0,left:80,right:0,bottom:62},theme:S,width:oe,containerComponent:a.jsx(o.VictoryVoronoiContainer,{name:"xAxisGroupLabel",voronoiBlacklist:ke,voronoiDimension:"x",labels:ye&&xe?function(){return" "}:void 0,labelComponent:xe?a.jsx(o.VictoryTooltip,{flyoutComponent:a.jsx(E,{dataLength:D.length,hiddenData:te})}):void 0,role:"presentation",voronoiPadding:32})},i,{children:[a.jsx(o.VictoryAxis,c({},z,{dependentAxis:!0,style:we})),D.map(function(e,n){var t=e.data;return!te.includes(n)&&a.jsx(o.VictoryLine,c({style:{data:{opacity:Se(n),stroke:$.iterableColors[n],strokeWidth:"3"},parent:{border:$.colors.neutral04}},data:t,labelComponent:a.jsx(a.Fragment,{}),x:Q,y:Y},d),"line"+n)}),a.jsx(o.VictoryAxis,c({},k,{style:je,gridComponent:a.jsx(O,{events:{onMouseEnter:function(){return ge(!0)},onMouseLeave:function(){return ge(!1)}}})})),D.map(function(e,n){var t=e.data;return!te.includes(n)&&a.jsx(o.VictoryScatter,c({name:"scatter-"+n,events:[{target:"data",eventHandlers:{onBlur:function(){return he(!0),fe(null),[{target:"labels",mutation:function(){return{active:void 0}}}]},onClick:function(){return[{target:"labels",mutation:function(e){return fe(e.datum.lineIndex+"-"+e.datum.index),{active:!0}}}]},onFocus:function(){return he(!1),[{target:"labels",mutation:function(e){return fe(e.datum.lineIndex+"-"+e.datum.index),{active:!0}}}]},onMouseEnter:function(){return he(!1),[{target:"labels",mutation:function(e){return fe(e.datum.lineIndex+"-"+e.datum.index),{active:!0}}}]},onMouseLeave:function(){fe(null),he(!0)}}}],style:{data:{fill:$.colors.neutral08,opacity:Se(n),stroke:$.iterableColors[n],strokeWidth:2}},size:5,data:t.map(function(e,t){return c({index:t,lineIndex:n},e)}),dataComponent:a.jsx(W,{lineIndex:n,pointRefArray:V,registerPoint:Z,unregisterPoint:J}),labels:function(){return""},labelComponent:a.jsx(o.VictoryTooltip,{text:"",flyoutComponent:a.jsx(T,{index:n,showTooltip:de})}),x:Q,y:Y},p),"scatter"+n)})]}))}),a.jsxs(_,{children:[a.jsx(G,{theme:$,children:ee.charts.line.dataLegendsLabel}),D.map(function(e,n){var t=e.name,r=ee.charts.line.legendButtonAriaLabel.replace(/\{name\}/g,t);return a.jsx(H,{"aria-label":r,color:$.iterableColors[n],dataIndex:n,isHidden:te.includes(n),name:t,onClick:Pe,onKeyDown:0===n?We:void 0,focusCurrentLine:Ae,ref:0===n?ve:void 0,resetLineFocus:Te},n)})]})]})}function J(e){return e.toLowerCase().replace(/[^a-z 0-9]/gi,"").replace(/(?:^\w|[A-Z]|\b\w)/g,function(e,n){return 0===n?e.toLowerCase():e.toUpperCase()}).replace(/\s+/g,"")}var N,Q,Y,$,ee,ne,te=function(e){var n=e.data,r=void 0===n?[]:n,i=e.xData,o=i.keyValue,s=i.label,u=i.tickFormat,d=i.tickValues,f=e.yData,p=f.keyValue,x=f.tickFormat,h=l.useState({columns:[],rows:[]}),m=h[0],y=h[1];return l.useEffect(function(){var e,n,t;y((e=J(o||s||"x"),n=r.reduce(function(e,n){return n.data.forEach(function(n){var t=n.x||o&&n[o];!e.includes(t)&&e.push(t)}),e},[]),t={columns:n.length>0?[{field:e,header:s||o||"X",isRowHeader:!0}]:[],rows:n.reduce(function(t,r,i){var o,a=d&&"number"==typeof r&&d.length===n.length?u&&"function"==typeof u?u(d[r-1]):d[r-1]:u&&Array.isArray(u)?u[r-1]:u&&"function"==typeof u?u(r):r;return t.push(((o={})[e]=a,o.id=i,o)),t},[])},r.reduce(function(e,n){var r=n.name,i=n.data,o=J(r);return e.columns.push({field:o,header:r}),i.forEach(function(n,r){var i,a=n.y||0===n.y?n.y:p&&n[p];e.rows[r]=c({},e.rows[r],((i={id:t.rows.length>0?r+1:r})[o]=x&&"function"==typeof x?x(a):a,i))}),e},t)))},[r]),a.jsx(t.Card,{children:m.rows.length>0?a.jsx(t.Datagrid,{hasPagination:!1,columns:m.columns,rows:m.rows}):a.jsx(t.Spinner,{})})},re=["description","title","testId","type"],ie=t.styled.span(N||(N=d(["\n color: ",";\n font-size: ",";\n font-weight: 600;\n line-height: ",";\n margin: 0 0 12px 0;\n"])),function(e){return e.theme.colors.neutral},function(e){return e.theme.typeScale.size04.fontSize},function(e){return e.theme.typeScale.size04.lineHeight}),oe=t.styled(t.Paragraph)(Q||(Q=d(["\n font-size: ",";\n margin: 0 0 18px 0;\n"])),function(e){return e.theme.typeScale.size02.fontSize}),ae=t.styled(t.TabsContainer)(Y||(Y=d(["\n width: 800px;\n ul {\n box-shadow: inset 0 -1px 0 ",";\n }\n"])),function(e){return e.theme.colors.neutral06}),se=t.styled(t.TabPanel)($||($=d(["\n padding: 22px 0;\n"]))),le=t.styled(t.Card)(ee||(ee=d(["\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);\n display: ",";\n right: ",";\n max-height: ",";\n opacity: ",";\n outline: 0;\n overflow-y: auto;\n padding: ","\n ",";\n position: absolute;\n transition: opacity 0.3s;\n white-space: nowrap;\n z-index: 2;\n\n ","\n"])),function(e){return e.isOpen?"block":"none"},function(e){return e.theme.spaceScale.spacing02},function(e){return e.maxHeight?e.maxHeight:e.theme.dropdown.content.maxHeight},function(e){return e.isOpen?"1":"0"},function(e){return e.theme.spaceScale.spacing05},function(e){return e.theme.spaceScale.spacing05},function(e){return e.width&&r.css(ne||(ne=d(["\n white-space: normal;\n width: ",";\n "])),e.width)});function ce(e,n){var r,o,s,d,f,p,x=e.description,h=e.title,m=e.type,y=u(e,re),g=l.useRef(null),b=l.useRef(null),v=l.useContext(t.ThemeContext),k=l.useContext(t.I18nContext),j=t.useDescendants(),w=j[0],L=j[1],I=j[2],C=l.useState(!1),S=C[0],P=C[1];return a.jsxs("div",{ref:n,children:[a.jsx(ie,{theme:v,children:h}),x&&a.jsx(oe,{theme:v,visualStyle:t.TypographyVisualStyle.bodySmall,children:x}),a.jsxs(ae,{theme:v,children:[a.jsxs(t.Tabs,{children:[a.jsx(t.Tab,{children:k.charts.line.chartTabLabel}),a.jsx(t.Tab,{children:k.charts.line.dataTabLabel}),a.jsxs("div",{onBlur:function(){P(!1)},style:{display:"inline-block",marginLeft:"auto"},children:[a.jsx(t.Tooltip,{content:k.charts.line.keyboardInstructionsTooltip,ref:g,children:a.jsx(t.IconButton,{"aria-controls":"keyboardInstructions","aria-label":k.charts.line.keyboardInstructionsTooltip,"aria-expanded":Boolean(S),icon:a.jsx(i.KeyboardIcon,{}),onClick:function(){P(function(e){return!e})},onKeyDown:function(e){var n=e.shiftKey;switch(e.key){case"Escape":P(!1);break;case"Tab":!n&&b&&b.current&&w.current.find(function(e){return e.current===b.current})&&(e.preventDefault(),b.current.focus())}},variant:t.ButtonVariant.link})}),a.jsx(t.Announce,{children:a.jsxs(le,{id:"keyboardInstructions",isOpen:S,theme:v,width:"350px",children:[a.jsx(t.Paragraph,{visualStyle:t.TypographyVisualStyle.headingXSmall,style:{margin:"0 0 16px"},children:k.charts.line.keyboardInstructionsHeader}),k.charts.line.keyboardInstructions]})})]})]}),a.jsxs(t.TabPanelsContainer,{children:[a.jsx(se,{theme:v,children:"line"===m&&a.jsx(Z,c({},y,{lastFocusedScatterPoint:b,pointRefArray:w,registerPoint:L,tabRef:g,unregisterPoint:I}))}),a.jsx(se,{theme:v,children:a.jsx(te,{data:y.data,xData:{keyValue:y.x,label:null==(r=y.componentProps)||null==(o=r.xAxis)?void 0:o.label,tickFormat:null==(s=y.componentProps)||null==(d=s.xAxis)?void 0:d.tickFormat},yData:{keyValue:y.y,tickFormat:null==(f=y.componentProps)||null==(p=f.yAxis)?void 0:p.tickFormat}})})]})]})]})}e.Chart=l.forwardRef(ce)});
1
+ !function(e,n){"object"==typeof exports&&"undefined"!=typeof module?n(exports,require("react"),require("react-magma-dom"),require("@emotion/core"),require("react-magma-icons"),require("victory"),require("react/jsx-runtime")):"function"==typeof define&&define.amd?define(["exports","react","react-magma-dom","@emotion/core","react-magma-icons","victory","react/jsx-runtime"],n):n((e||self).charts={},e.react,e.reactMagmaDom,e.core,e.reactMagmaIcons,e.victory,e.jsx)}(this,function(e,n,t,r,i,o,a){function s(e){if(e&&e.__esModule)return e;var n=Object.create(null);return e&&Object.keys(e).forEach(function(t){if("default"!==t){var r=Object.getOwnPropertyDescriptor(e,t);Object.defineProperty(n,t,r.get?r:{enumerable:!0,get:function(){return e[t]}})}}),n.default=e,n}var l=s(n);function c(){return c=Object.assign||function(e){for(var n=1;n<arguments.length;n++){var t=arguments[n];for(var r in t)Object.prototype.hasOwnProperty.call(t,r)&&(e[r]=t[r])}return e},c.apply(this,arguments)}function u(e,n){if(null==e)return{};var t,r,i={},o=Object.keys(e);for(r=0;r<o.length;r++)n.indexOf(t=o[r])>=0||(i[t]=e[t]);return i}function d(e,n){return n||(n=e.slice(0)),e.raw=n,e}var f,p,x,h,m,y,g=["#00507A","#8F0033","#B84900","#255200","#711E6E","#005249"],b="#8F8F8F",v="#3F3F3F",k="pink",j={width:350,height:350,padding:50},w={fontFamily:'"Work Sans",Helvetica,sans-serif',fontSize:12,letterSpacing:"normal",padding:8,fill:v,stroke:"transparent",strokeWidth:0},L=c({textAnchor:"middle"},w),I="round",C="round",S={area:c({style:{data:{fill:k},labels:w}},j),axis:c({style:{axis:{fill:"transparent",stroke:b,strokeWidth:1,strokeLinecap:I,strokeLinejoin:C},axisLabel:c({},L,{padding:8,stroke:"transparent"}),grid:{fill:"none",stroke:"#dfdfdf",strokeLinecap:I,strokeLinejoin:C,pointerEvents:"painted"},ticks:{fill:"transparent",size:0,stroke:b,strokeWidth:0,strokeLinecap:I,strokeLinejoin:C},tickLabels:c({},w,{fill:v})}},j),polarDependentAxis:{style:{ticks:{fill:"transparent",size:1,stroke:"transparent"}}},bar:c({style:{data:{fill:v,padding:8,strokeWidth:0},labels:w}},j),boxplot:c({style:{max:{padding:8,stroke:v,strokeWidth:1},maxLabels:c({},w,{padding:3}),median:{padding:8,stroke:v,strokeWidth:1},medianLabels:c({},w,{padding:3}),min:{padding:8,stroke:v,strokeWidth:1},minLabels:c({},w,{padding:3}),q1:{padding:8,fill:v},q1Labels:c({},w,{padding:3}),q3:{padding:8,fill:v},q3Labels:c({},w,{padding:3})},boxWidth:20},j),candlestick:c({style:{data:{stroke:v},labels:c({},w,{padding:5})},candleColors:{positive:"#ffffff",negative:v}},j),chart:j,errorbar:c({borderWidth:8,style:{data:{fill:"transparent",opacity:1,stroke:v,strokeWidth:2},labels:w}},j),group:c({colorScale:g},j),histogram:c({style:{data:{fill:v,stroke:k,strokeWidth:2},labels:w}},j),legend:{colorScale:g,gutter:10,orientation:"vertical",titleOrientation:"top",style:{data:{type:"circle"},labels:w,title:c({},w,{padding:5})}},line:c({style:{data:{fill:"transparent",opacity:1,stroke:v,strokeWidth:2},labels:w}},j),pie:c({colorScale:g,style:{data:{padding:8,stroke:"#DFDFDF",strokeWidth:1},labels:c({},w,{padding:20})}},j),scatter:c({style:{data:{fill:v,opacity:1,stroke:"transparent",strokeWidth:0},labels:w}},j),stack:c({colorScale:g},j),tooltip:{style:c({},w,{padding:0,pointerEvents:"none"}),flyoutStyle:{stroke:k,strokeWidth:1,fill:"#f0f0f0",pointerEvents:"none"},flyoutPadding:5,cornerRadius:5,pointerLength:10},voronoi:c({style:{data:{fill:"transparent",stroke:"transparent",strokeWidth:0},labels:c({},w,{padding:5,pointerEvents:"none"}),flyout:{stroke:k,strokeWidth:1,fill:"#f0f0f0",pointerEvents:"none"}}},j)},P=t.styled(t.StyledTooltip)(f||(f=d(["\n background: ",";\n border: 1px solid ",";\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.18);\n box-sizing: border-box;\n color: ",";\n font-size: ",";\n font-weight: normal;\n line-height: ",";\n margin: 0;\n padding: 8px;\n width: fit-content;\n div {\n margin-bottom: 8px;\n display: flex;\n align-items: flex-start;\n &:last-of-type {\n margin-bottom: 0;\n }\n }\n"])),function(e){return e.theme.colors.neutral100},function(e){return e.theme.colors.neutral300},function(e){return e.theme.colors.neutral},function(e){return e.theme.typeScale.size02.fontSize},function(e){return e.theme.typeScale.size02.lineHeight}),A=t.styled.span(p||(p=d(["\n background: ",";\n border: ",";\n border-radius: 4px;\n height: 20px;\n width: 20px;\n margin-right: 8px;\n"])),function(e){return e.color},function(e){return e.color?"none":"3px solid black"}),T=function(e){var n=e.datum,r=e.index,i=e.showTooltip,o=e.x,s=e.y,c=l.useContext(t.ThemeContext);return i===r+"-"+n.index?a.jsx("g",{style:{pointerEvents:"none"},children:a.jsx("foreignObject",{x:o,y:s,width:"275",height:"100%",children:a.jsxs(P,{position:t.TooltipPosition.top,role:"tooltip",theme:c,children:[a.jsxs("div",{children:[a.jsx(A,{color:c.iterableColors[r]}),a.jsx("span",{children:n.label})]}),a.jsx(t.TooltipArrow,{theme:c})]})})}):null},E=function(e){var n=e.x,r=e.y,i=e.activePoints,o=e.hiddenData,s=Array.from(Array(e.dataLength-0),function(e,n){return n+0}).filter(function(e){return!o.includes(e)}),c=l.useContext(t.ThemeContext);return a.jsx("g",{style:{pointerEvents:"none"},children:a.jsx("foreignObject",{x:n,y:r,width:"275",height:"100%",children:a.jsxs(P,{"data-testid":"axis-tooltip",position:t.TooltipPosition.top,role:"tooltip",theme:c,children:[i.map(function(e,n){return a.jsxs("div",{children:[a.jsx(A,{color:c.iterableColors[s[n]]}),a.jsx("span",{children:e.label})]},n)}),a.jsx(t.TooltipArrow,{theme:c})]})})})},z=["datum","index","lineIndex","pointRefArray","registerPoint","unregisterPoint"],F=["lineIndex","pointRefArray","pointIndex","registerPoint","unregisterPoint"],W=function(e){var n=e.datum,t=e.index,r=e.lineIndex,i=e.pointRefArray,s=e.registerPoint,l=e.unregisterPoint,d=u(e,z);return a.jsx(o.Point,c({},d,{ariaLabel:n.label,pathComponent:a.jsx(D,{lineIndex:r,pointIndex:t,pointRefArray:i,registerPoint:s,unregisterPoint:l}),role:"button",tabIndex:0}))},D=function(e){var n=e.lineIndex,r=e.pointRefArray,i=e.pointIndex,o=e.registerPoint,s=e.unregisterPoint,d=u(e,F),f=t.useForceUpdate(),p=l.useRef(null);return l.useEffect(function(){return o(r,p),f(),function(){return s(r,p)}},[]),a.jsx("path",c({ref:p,"data-line-index":n,"data-point-index":i},d))},R=["events"],O=function(e){var n=e.events,t=u(e,R);return a.jsxs("g",{children:[a.jsx(o.LineSegment,c({},t,{events:n,style:{strokeWidth:"50px",stroke:"transparent"}})),a.jsx(o.LineSegment,c({},t,{events:n,style:{strokeWidth:"1px",stroke:"black",strokeOpacity:"0.2"}}))]})},V=["children","color","dataIndex","isHidden","onClick","name","focusCurrentLine","resetLineFocus"],H=l.forwardRef(function(e,n){var r=e.color,i=e.dataIndex,o=e.isHidden,s=e.onClick,d=e.name,f=e.focusCurrentLine,p=e.resetLineFocus,x=u(e,V);function h(){o||f&&"function"==typeof f&&f(i)}var m=l.useContext(t.ThemeContext);return a.jsx("div",{style:{display:"inline-flex"},onMouseEnter:h,onMouseLeave:p,children:a.jsx(t.Checkbox,c({checked:!o,color:r,containerStyle:{alignItems:"center",border:"0",boxShadow:"0 0 0",color:m.colors.neutral,display:"inline-flex",margin:"0 36px 20px 0",padding:"0"},inputStyle:{border:r?"none":"2px solid "+m.colors.neutral800,borderRadius:"4px"},labelText:d,onBlur:p,onClick:function(){s&&"function"==typeof s&&s(i),o||p&&"function"==typeof p&&p()},onFocus:h,ref:n,theme:m},x))})}),q=["axisLabel","tickLabels"],B=["style"],M=["axisLabel","tickLabels"],K=["style"],U=t.styled.div(x||(x=d(["\n max-height: 600px;\n max-width: 800px;\n svg {\n overflow: visible;\n }\n"]))),X=t.styled.div(h||(h=d([""]))),_=t.styled.div(m||(m=d(["\n padding-bottom: 24px;\n"]))),G=t.styled.p(y||(y=d(["\n color: ",";\n font-size: ",";\n"])),function(e){return e.theme.colors.neutral},function(e){return e.theme.typeScale.size02.fontSize});function Z(e){var n=e.componentProps,r=(n=void 0===n?{}:n).chart,i=void 0===r?{}:r,s=n.line,d=void 0===s?{}:s,f=n.scatter,p=void 0===f?{}:f,x=n.xAxis,h=(x=void 0===x?{style:{}}:x).style,m=(h=void 0===h?{}:h).axisLabel,y=void 0===m?void 0:m,g=h.tickLabels,b=void 0===g?void 0:g,v=u(h,q),k=u(x,B),j=n.yAxis,w=(j=void 0===j?{style:{}}:j).style,L=(w=void 0===w?{}:w).axisLabel,I=void 0===L?void 0:L,C=w.tickLabels,P=void 0===C?void 0:C,A=u(w,M),z=u(j,K),F=e.data,D=void 0===F?[]:F,R=e.lastFocusedScatterPoint,V=e.pointRefArray,Z=e.registerPoint,J=e.unregisterPoint,N=e.tabRef,Q=e.x,Y=e.y,$=l.useContext(t.ThemeContext),ee=l.useContext(t.I18nContext),ne=l.useState([]),te=ne[0],re=ne[1],ie=l.useState(800),oe=ie[0],ae=ie[1],se=l.useState(null),le=se[0],ce=se[1],ue=l.useState(null),de=ue[0],fe=ue[1],pe=l.useState(!0),xe=pe[0],he=pe[1],me=l.useState(!1),ye=me[0],ge=me[1],be=l.useRef(null),ve=l.useRef(null);l.useEffect(function(){return Le(),window.addEventListener("resize",Le),window.addEventListener("keydown",Ie),function(){window.removeEventListener("resize",Le),window.removeEventListener("keydown",Ie)}},[]),l.useEffect(function(){return window.addEventListener("mousemove",Ce),function(){window.removeEventListener("mousemove",Ce)}},[de]);var ke=D.map(function(e,n){return"scatter-"+n}),je=c({tickLabels:c({color:"#3f3f3f",fontSize:12},b),axisLabel:c({color:"#3f3f3f",padding:44,fontSize:14,fontWeight:"bold"},y)},v),we=c({tickLabels:c({fontSize:12},P),axisLabel:c({color:"#3f3f3f",padding:64,fontSize:14,fontWeight:"bold"},I)},A);function Le(){be.current&&ae(be.current.clientWidth)}function Ie(e){"Escape"===e.key&&(fe(null),he(!1))}function Ce(){!de&&he(!0)}function Se(e){return null===le||le===e?1:.1}function Pe(e){te.includes(e)?re(te.filter(function(n){return n!==e})):re(te.concat([e]))}function Ae(e){ce(e)}function Te(){ce(null)}var Ee=function(e,n){if(n.current){var t=parseInt(n.current.getAttribute("data-line-index"),10);!e.includes(t)&&e.push(parseInt(n.current.getAttribute("data-line-index"),10))}return e},ze=function(e){var n=parseInt(e.current.getAttribute("data-line-index"),10),t=parseInt(e.current.getAttribute("data-point-index"),10),r=V.current.reduce(Ee,[]);return{currentLineIndex:n,currentPointIndex:t,lineIndexes:r,lowestLineIndex:r[0],highestLineIndex:r[r.length-1]}},Fe=function(e,n){return function(t){return t.current&&parseInt(t.current.getAttribute("data-line-index"),10)===e&&parseInt(t.current.getAttribute("data-point-index"),10)===n}};function We(e){"Tab"===e.key&&e.shiftKey&&R&&R.current&&V.current.find(function(e){return e.current===R.current})&&(e.preventDefault(),R.current.focus())}return a.jsxs(U,{ref:be,children:[a.jsx(X,{onKeyDown:function(e){var n=e.shiftKey;switch(e.key){case"Tab":e.preventDefault(),R.current=V.current.find(function(e){return e.current===document.activeElement}).current,n?N.current&&N.current.focus():ve.current&&ve.current.focus();break;case"ArrowRight":var t=V.current.findIndex(function(e){return e.current===document.activeElement});void 0!==t&&(t===V.current.length-1?V.current[0].current.focus():V.current[t+1].current.focus());break;case"ArrowLeft":var r=V.current.findIndex(function(e){return e.current===document.activeElement});void 0!==r&&(0===r?V.current[V.current.length-1].current.focus():V.current[r-1].current.focus());break;case"ArrowUp":e.preventDefault();var i=V.current.find(function(e){return e.current===document.activeElement});if(i&&i.current){var o=ze(i),a=o.currentLineIndex,s=o.currentPointIndex,l=o.lineIndexes;if(a===o.lowestLineIndex)V.current.find(Fe(o.highestLineIndex,s)).current.focus();else{var c=l[l.indexOf(a)-1];V.current.find(Fe(c,s)).current.focus()}}break;case"ArrowDown":e.preventDefault();var u=V.current.find(function(e){return e.current===document.activeElement});if(u&&u.current){var d=ze(u),f=d.currentLineIndex,p=d.currentPointIndex,x=d.lineIndexes;if(f===d.highestLineIndex)V.current.find(Fe(d.lowestLineIndex,p)).current.focus();else{var h=x[x.indexOf(f)+1];V.current.find(Fe(h,p)).current.focus()}}}},children:a.jsxs(o.VictoryChart,c({domainPadding:32,height:400,padding:{top:0,left:80,right:0,bottom:62},theme:S,width:oe,containerComponent:a.jsx(o.VictoryVoronoiContainer,{name:"xAxisGroupLabel",voronoiBlacklist:ke,voronoiDimension:"x",labels:ye&&xe?function(){return" "}:void 0,labelComponent:xe?a.jsx(o.VictoryTooltip,{flyoutComponent:a.jsx(E,{dataLength:D.length,hiddenData:te})}):void 0,role:"presentation",voronoiPadding:32})},i,{children:[a.jsx(o.VictoryAxis,c({},z,{dependentAxis:!0,style:we})),D.map(function(e,n){var t=e.data;return!te.includes(n)&&a.jsx(o.VictoryLine,c({style:{data:{opacity:Se(n),stroke:$.iterableColors[n],strokeWidth:"3"},parent:{border:$.colors.neutral400}},data:t,labelComponent:a.jsx(a.Fragment,{}),x:Q,y:Y},d),"line"+n)}),a.jsx(o.VictoryAxis,c({},k,{style:je,gridComponent:a.jsx(O,{events:{onMouseEnter:function(){return ge(!0)},onMouseLeave:function(){return ge(!1)}}})})),D.map(function(e,n){var t=e.data;return!te.includes(n)&&a.jsx(o.VictoryScatter,c({name:"scatter-"+n,events:[{target:"data",eventHandlers:{onBlur:function(){return he(!0),fe(null),[{target:"labels",mutation:function(){return{active:void 0}}}]},onClick:function(){return[{target:"labels",mutation:function(e){return fe(e.datum.lineIndex+"-"+e.datum.index),{active:!0}}}]},onFocus:function(){return he(!1),[{target:"labels",mutation:function(e){return fe(e.datum.lineIndex+"-"+e.datum.index),{active:!0}}}]},onMouseEnter:function(){return he(!1),[{target:"labels",mutation:function(e){return fe(e.datum.lineIndex+"-"+e.datum.index),{active:!0}}}]},onMouseLeave:function(){fe(null),he(!0)}}}],style:{data:{fill:$.colors.neutral100,opacity:Se(n),stroke:$.iterableColors[n],strokeWidth:2}},size:5,data:t.map(function(e,t){return c({index:t,lineIndex:n},e)}),dataComponent:a.jsx(W,{lineIndex:n,pointRefArray:V,registerPoint:Z,unregisterPoint:J}),labels:function(){return""},labelComponent:a.jsx(o.VictoryTooltip,{text:"",flyoutComponent:a.jsx(T,{index:n,showTooltip:de})}),x:Q,y:Y},p),"scatter"+n)})]}))}),a.jsxs(_,{children:[a.jsx(G,{theme:$,children:ee.charts.line.dataLegendsLabel}),D.map(function(e,n){var t=e.name,r=ee.charts.line.legendButtonAriaLabel.replace(/\{name\}/g,t);return a.jsx(H,{"aria-label":r,color:$.iterableColors[n],dataIndex:n,isHidden:te.includes(n),name:t,onClick:Pe,onKeyDown:0===n?We:void 0,focusCurrentLine:Ae,ref:0===n?ve:void 0,resetLineFocus:Te},n)})]})]})}function J(e){return e.toLowerCase().replace(/[^a-z 0-9]/gi,"").replace(/(?:^\w|[A-Z]|\b\w)/g,function(e,n){return 0===n?e.toLowerCase():e.toUpperCase()}).replace(/\s+/g,"")}var N,Q,Y,$,ee,ne,te=function(e){var n=e.data,r=void 0===n?[]:n,i=e.xData,o=i.keyValue,s=i.label,u=i.tickFormat,d=i.tickValues,f=e.yData,p=f.keyValue,x=f.tickFormat,h=l.useState({columns:[],rows:[]}),m=h[0],y=h[1];return l.useEffect(function(){var e,n,t;y((e=J(o||s||"x"),n=r.reduce(function(e,n){return n.data.forEach(function(n){var t=n.x||o&&n[o];!e.includes(t)&&e.push(t)}),e},[]),t={columns:n.length>0?[{field:e,header:s||o||"X",isRowHeader:!0}]:[],rows:n.reduce(function(t,r,i){var o,a=d&&"number"==typeof r&&d.length===n.length?u&&"function"==typeof u?u(d[r-1]):d[r-1]:u&&Array.isArray(u)?u[r-1]:u&&"function"==typeof u?u(r):r;return t.push(((o={})[e]=a,o.id=i,o)),t},[])},r.reduce(function(e,n){var r=n.name,i=n.data,o=J(r);return e.columns.push({field:o,header:r}),i.forEach(function(n,r){var i,a=n.y||0===n.y?n.y:p&&n[p];e.rows[r]=c({},e.rows[r],((i={id:t.rows.length>0?r+1:r})[o]=x&&"function"==typeof x?x(a):a,i))}),e},t)))},[r]),a.jsx(t.Card,{children:m.rows.length>0?a.jsx(t.Datagrid,{hasPagination:!1,columns:m.columns,rows:m.rows}):a.jsx(t.Spinner,{})})},re=["description","title","testId","type"],ie=t.styled.span(N||(N=d(["\n color: ",";\n font-size: ",";\n font-weight: 600;\n line-height: ",";\n margin: 0 0 12px 0;\n"])),function(e){return e.theme.colors.neutral},function(e){return e.theme.typeScale.size04.fontSize},function(e){return e.theme.typeScale.size04.lineHeight}),oe=t.styled(t.Paragraph)(Q||(Q=d(["\n font-size: ",";\n margin: 0 0 18px 0;\n"])),function(e){return e.theme.typeScale.size02.fontSize}),ae=t.styled(t.TabsContainer)(Y||(Y=d(["\n width: 800px;\n ul {\n box-shadow: inset 0 -1px 0 ",";\n }\n"])),function(e){return e.theme.colors.neutral300}),se=t.styled(t.TabPanel)($||($=d(["\n padding: 22px 0;\n"]))),le=t.styled(t.Card)(ee||(ee=d(["\n box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);\n display: ",";\n right: ",";\n max-height: ",";\n opacity: ",";\n outline: 0;\n overflow-y: auto;\n padding: ","\n ",";\n position: absolute;\n transition: opacity 0.3s;\n white-space: nowrap;\n z-index: 2;\n\n ","\n"])),function(e){return e.isOpen?"block":"none"},function(e){return e.theme.spaceScale.spacing02},function(e){return e.maxHeight?e.maxHeight:e.theme.dropdown.content.maxHeight},function(e){return e.isOpen?"1":"0"},function(e){return e.theme.spaceScale.spacing05},function(e){return e.theme.spaceScale.spacing05},function(e){return e.width&&r.css(ne||(ne=d(["\n white-space: normal;\n width: ",";\n "])),e.width)});function ce(e,n){var r,o,s,d,f,p,x=e.description,h=e.title,m=e.type,y=u(e,re),g=l.useRef(null),b=l.useRef(null),v=l.useContext(t.ThemeContext),k=l.useContext(t.I18nContext),j=t.useDescendants(),w=j[0],L=j[1],I=j[2],C=l.useState(!1),S=C[0],P=C[1];return a.jsxs("div",{ref:n,children:[a.jsx(ie,{theme:v,children:h}),x&&a.jsx(oe,{theme:v,visualStyle:t.TypographyVisualStyle.bodySmall,children:x}),a.jsxs(ae,{theme:v,children:[a.jsxs(t.Tabs,{children:[a.jsx(t.Tab,{children:k.charts.line.chartTabLabel}),a.jsx(t.Tab,{children:k.charts.line.dataTabLabel}),a.jsxs("div",{onBlur:function(){P(!1)},style:{display:"inline-block",marginLeft:"auto"},children:[a.jsx(t.Tooltip,{content:k.charts.line.keyboardInstructionsTooltip,ref:g,children:a.jsx(t.IconButton,{"aria-controls":"keyboardInstructions","aria-label":k.charts.line.keyboardInstructionsTooltip,"aria-expanded":Boolean(S),icon:a.jsx(i.KeyboardIcon,{}),onClick:function(){P(function(e){return!e})},onKeyDown:function(e){var n=e.shiftKey;switch(e.key){case"Escape":P(!1);break;case"Tab":!n&&b&&b.current&&w.current.find(function(e){return e.current===b.current})&&(e.preventDefault(),b.current.focus())}},variant:t.ButtonVariant.link})}),a.jsx(t.Announce,{children:a.jsxs(le,{id:"keyboardInstructions",isOpen:S,theme:v,width:"350px",children:[a.jsx(t.Paragraph,{visualStyle:t.TypographyVisualStyle.headingXSmall,style:{margin:"0 0 16px"},children:k.charts.line.keyboardInstructionsHeader}),k.charts.line.keyboardInstructions]})})]})]}),a.jsxs(t.TabPanelsContainer,{children:[a.jsx(se,{theme:v,children:"line"===m&&a.jsx(Z,c({},y,{lastFocusedScatterPoint:b,pointRefArray:w,registerPoint:L,tabRef:g,unregisterPoint:I}))}),a.jsx(se,{theme:v,children:a.jsx(te,{data:y.data,xData:{keyValue:y.x,label:null==(r=y.componentProps)||null==(o=r.xAxis)?void 0:o.label,tickFormat:null==(s=y.componentProps)||null==(d=s.xAxis)?void 0:d.tickFormat},yData:{keyValue:y.y,tickFormat:null==(f=y.componentProps)||null==(p=f.yAxis)?void 0:p.tickFormat}})})]})]})]})}e.Chart=l.forwardRef(ce)});
2
2
  //# sourceMappingURL=charts.umd.js.map