@redsift/charts 12.6.6 → 13.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CONTRIBUTING.md +20 -8
- package/_internal/Arc2.js +5 -5
- package/_internal/Arc2.js.map +1 -1
- package/_internal/Arcs2.js +8 -8
- package/_internal/Arcs2.js.map +1 -1
- package/_internal/Axis2.js +13 -13
- package/_internal/Axis2.js.map +1 -1
- package/_internal/Bar2.js +7 -7
- package/_internal/Bar2.js.map +1 -1
- package/_internal/BarChart2.js +95 -99
- package/_internal/BarChart2.js.map +1 -1
- package/_internal/ChartContainer2.js +29 -30
- package/_internal/ChartContainer2.js.map +1 -1
- package/_internal/DataPoint2.js +10 -10
- package/_internal/DataPoint2.js.map +1 -1
- package/_internal/Dot2.js +3 -3
- package/_internal/Dot2.js.map +1 -1
- package/_internal/Legend3.js +4 -4
- package/_internal/Legend3.js.map +1 -1
- package/_internal/LegendItem2.js +8 -8
- package/_internal/LegendItem2.js.map +1 -1
- package/_internal/Line2.js +5 -5
- package/_internal/Line2.js.map +1 -1
- package/_internal/LineChart2.js +47 -44
- package/_internal/LineChart2.js.map +1 -1
- package/_internal/PieChart2.js +23 -24
- package/_internal/PieChart2.js.map +1 -1
- package/_internal/ScatterPlot2.js +52 -44
- package/_internal/ScatterPlot2.js.map +1 -1
- package/_internal/config.js +2 -2
- package/_internal/config.js.map +1 -1
- package/index.d.ts +913 -719
- package/package.json +17 -22
- package/index2.js +0 -16
- package/index2.js.map +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LegendItem2.js","sources":["../../src/components/LegendItem/styles.ts","../../src/components/LegendItem/LegendItem.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { StyledLegendItemProps } from './types';\nimport { LegendVariant } from '../../types';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledLegendItem = styled.li<StyledLegendItemProps>`\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--redsift-typography-caption-font-size);\n\n ${({ $theme }) => css`\n color: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n\n ${({ $variant, $color }) =>\n $variant !== LegendVariant.custom\n ? css`\n > div {\n height: 16px;\n width: 16px;\n min-width: 16px;\n background-color: ${$color};\n }\n `\n : ''}\n\n ${({ $clickable }) =>\n $clickable\n ? css`\n cursor: pointer;\n\n &:hover,\n &:focus {\n outline: none;\n > div {\n opacity: 0.7;\n }\n }\n\n &:focus-visible {\n > div {\n outline: 4px solid var(--redsift-color-primary-n);\n }\n }\n `\n : ''}\n`;\n","import React, { KeyboardEventHandler, forwardRef } from 'react';\nimport classNames from 'classnames';\n\nimport { Comp, Number, Text, useId, useTheme } from '@redsift/design-system';\n\nimport { LegendItemProps } from './types';\nimport { StyledLegendItem } from './styles';\nimport { monochrome } from '../../scheme';\nimport { LegendVariant } from '../../types';\n\nconst COMPONENT_NAME = 'LegendItem';\nconst CLASSNAME = 'redsift-legend-item';\n\nexport const LegendItem: Comp<LegendItemProps, HTMLLIElement> = forwardRef((props, ref) => {\n const {\n className,\n color = monochrome,\n data,\n dataset,\n id: propsId,\n variant,\n index = 0,\n isSelected: propsIsSelected,\n labelDecorator,\n legendDecorator,\n onClick,\n role,\n ...forwardedProps\n } = props;\n\n const theme = useTheme();\n\n const [_id] = useId();\n const id = propsId ?? _id;\n\n const isLegendCustom = variant === LegendVariant.custom && legendDecorator;\n const text = labelDecorator ? labelDecorator(data, { index, isSelected: propsIsSelected, color }) : data.data.key;\n const isEmpty = data.data.value === 0;\n\n const isSelectable = role === 'option';\n const isSelected = isSelectable && propsIsSelected === true;\n const isDeselected = isSelectable && propsIsSelected === false;\n\n const onKeyDown: KeyboardEventHandler<HTMLLIElement> = (event) => {\n if (onClick) {\n event.stopPropagation();\n\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n onClick(data, dataset);\n }\n }\n };\n\n return (\n <StyledLegendItem\n {...forwardedProps}\n className={classNames(LegendItem.className, className, `_${index}`, {\n selected: isSelected,\n deselected: isDeselected,\n })}\n $color={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n ref={ref}\n aria-labelledby={!isEmpty ? `${id}-title` : undefined}\n aria-selected={isSelected ? true : isDeselected ? false : undefined}\n id={id}\n onClick={onClick ? () => onClick(data, dataset) : undefined}\n onKeyDown={onClick ? (event: React.KeyboardEvent<HTMLLIElement>) => onKeyDown(event) : undefined}\n role={role ? role : onClick ? 'button' : undefined}\n tabIndex={onClick ? 0 : undefined}\n $clickable={Boolean(onClick)}\n $variant={variant}\n $theme={theme}\n >\n {isLegendCustom ? (\n legendDecorator(data, { index, isSelected: propsIsSelected, color: props.color })\n ) : (\n <>\n <div />\n {typeof text === 'string' ? (\n variant === LegendVariant.value ? (\n <>\n <Number as=\"b\" maximumFractionDigits={2} value={data.data.value} variant=\"inherit\" />\n <Text variant=\"caption\">{text}</Text>\n </>\n ) : variant === LegendVariant.percent && data.data.percent ? (\n <>\n <Number as=\"b\" maximumFractionDigits={2} type=\"percent\" value={data.data.percent} variant=\"inherit\" />\n <Text variant=\"caption\">{text}</Text>\n </>\n ) : (\n <Text variant=\"caption\">{text}</Text>\n )\n ) : (\n <>{text}</>\n )}\n </>\n )}\n </StyledLegendItem>\n );\n});\nLegendItem.className = CLASSNAME;\nLegendItem.displayName = COMPONENT_NAME;\n"],"names":["StyledLegendItem","styled","li","_ref","$theme","css","Theme","dark","_ref2","$variant","$color","LegendVariant","custom","_ref3","$clickable","COMPONENT_NAME","CLASSNAME","LegendItem","forwardRef","props","ref","className","color","monochrome","data","dataset","id","propsId","variant","index","isSelected","propsIsSelected","labelDecorator","legendDecorator","onClick","role","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","_id","useId","isLegendCustom","text","key","isEmpty","value","isSelectable","isDeselected","onKeyDown","event","stopPropagation","code","preventDefault","React","createElement","_extends","classNames","selected","deselected","undefined","tabIndex","Boolean","Fragment","Number","as","maximumFractionDigits","Text","percent","type","displayName"],"mappings":";;;;;;;;AAKA;AACA;AACA;AACaA,MAAAA,gBAAgB,GAAGC,MAAM,CAACC,EAA0B,CAAA;AACjE;AACA;AACA;AACA;AACA;AACA,EAAA,EAAIC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,OAAKE,GAAI,CAAA;AACxB,uCAAyCD,EAAAA,MAAM,KAAKE,KAAK,CAACC,IAAI,GAAG,OAAO,GAAG,aAAc,CAAA;AACzF,EAAG,CAAA,CAAA;AAAA,CAAC,CAAA;AACJ;AACA,EAAA,EAAIC,KAAA,IAAA;EAAA,IAAC;IAAEC,QAAQ;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAF,KAAA,CAAA;AAAA,EAAA,OACrBC,QAAQ,KAAKE,aAAa,CAACC,MAAM,GAC7BP,GAAI,CAAA;AACZ;AACA;AACA;AACA;AACA,8BAAA,EAAgCK,MAAO,CAAA;AACvC;AACA,QAAA,CAAS,GACD,EAAE,CAAA;AAAA,CAAC,CAAA;AACX;AACA,EAAA,EAAIG,KAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAAD,KAAA,CAAA;EAAA,OACfC,UAAU,GACNT,GAAI,CAAA;AACZ;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA,QAAA,CAAS,GACD,EAAE,CAAA;AAAA,CAAC,CAAA;AACX;;;ACxCA,MAAMU,cAAc,GAAG,YAAY,CAAA;AACnC,MAAMC,SAAS,GAAG,qBAAqB,CAAA;AAEhC,MAAMC,UAAgD,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EACzF,MAAM;MACJC,SAAS;AACTC,MAAAA,KAAK,GAAGC,UAAU;MAClBC,IAAI;MACJC,OAAO;AACPC,MAAAA,EAAE,EAAEC,OAAO;M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ACY,IAAI,EAAA;AAACxC,IAAAA,OAAO,EAAC,SAAA;AAAS,GAAA,EAAEgB,IAAW,CACrC,gBAEDW,cAAA,CAAAC,aAAA,CAAAD,cAAA,CAAAS,QAAA,EAAA,IAAA,EAAGpB,IAAO,CAEZ,CAEY,CAAC,CAAA;AAEvB,CAAC,EAAC;AACF3B,UAAU,CAACI,SAAS,GAAGL,SAAS,CAAA;AAChCC,UAAU,CAACsD,WAAW,GAAGxD,cAAc;;;;"}
|
|
1
|
+
{"version":3,"file":"LegendItem2.js","sources":["../../src/components/LegendItem/styles.ts","../../src/components/LegendItem/LegendItem.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { StyledLegendItemProps } from './types';\nimport { LegendVariant } from '../../types';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledLegendItem = styled.li<StyledLegendItemProps>`\n display: flex;\n align-items: center;\n gap: 8px;\n font-size: var(--redsift-typography-caption-font-size);\n\n ${({ $theme }) => css`\n color: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n\n ${({ $variant, $color }) =>\n $variant !== LegendVariant.custom\n ? css`\n > div {\n height: 16px;\n width: 16px;\n min-width: 16px;\n background-color: ${$color};\n }\n `\n : ''}\n\n ${({ $clickable }) =>\n $clickable\n ? css`\n cursor: pointer;\n\n &:hover,\n &:focus {\n outline: none;\n > div {\n opacity: 0.7;\n }\n }\n\n &:focus-visible {\n > div {\n outline: 4px solid var(--redsift-color-primary-n);\n }\n }\n `\n : ''}\n`;\n","import React, { KeyboardEventHandler, forwardRef } from 'react';\nimport classNames from 'classnames';\n\nimport { Comp, Number, Text, useId, useTheme } from '@redsift/design-system';\n\nimport { LegendItemProps } from './types';\nimport { StyledLegendItem } from './styles';\nimport { monochrome } from '../../scheme';\nimport { LegendVariant } from '../../types';\n\nconst COMPONENT_NAME = 'LegendItem';\nconst CLASSNAME = 'redsift-legend-item';\n\nexport const LegendItem: Comp<LegendItemProps, HTMLLIElement> = forwardRef((props, ref) => {\n const {\n className,\n color = monochrome,\n data,\n dataset,\n id: propsId,\n variant,\n index = 0,\n isSelected: propsIsSelected,\n labelDecorator,\n legendDecorator,\n onClick,\n role,\n ...forwardedProps\n } = props;\n\n const theme = useTheme();\n\n const [_id] = useId();\n const id = propsId ?? _id;\n\n const isLegendCustom = variant === LegendVariant.custom && legendDecorator;\n const text = labelDecorator ? labelDecorator(data, { index, isSelected: propsIsSelected, color }) : data.data.key;\n const isEmpty = data.data.value === 0;\n\n const isSelectable = role === 'option';\n const isSelected = isSelectable && propsIsSelected === true;\n const isDeselected = isSelectable && propsIsSelected === false;\n\n const onKeyDown: KeyboardEventHandler<HTMLLIElement> = (event) => {\n if (onClick) {\n event.stopPropagation();\n\n if (event.code === 'Enter' || event.code === 'Space') {\n event.preventDefault();\n onClick(data, dataset);\n }\n }\n };\n\n return (\n <StyledLegendItem\n {...forwardedProps}\n className={classNames(LegendItem.className, className, `_${index}`, {\n selected: isSelected,\n deselected: isDeselected,\n })}\n $color={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n ref={ref}\n aria-labelledby={!isEmpty ? `${id}-title` : undefined}\n aria-selected={isSelected ? true : isDeselected ? false : undefined}\n id={id}\n onClick={onClick ? () => onClick(data, dataset) : undefined}\n onKeyDown={onClick ? (event: React.KeyboardEvent<HTMLLIElement>) => onKeyDown(event) : undefined}\n role={role ? role : onClick ? 'button' : undefined}\n tabIndex={onClick ? 0 : undefined}\n $clickable={Boolean(onClick)}\n $variant={variant}\n $theme={theme}\n >\n {isLegendCustom ? (\n legendDecorator(data, { index, isSelected: propsIsSelected, color: props.color })\n ) : (\n <>\n <div />\n {typeof text === 'string' ? (\n variant === LegendVariant.value ? (\n <>\n <Number as=\"b\" maximumFractionDigits={2} value={data.data.value} variant=\"inherit\" />\n <Text variant=\"caption\">{text}</Text>\n </>\n ) : variant === LegendVariant.percent && data.data.percent ? (\n <>\n <Number as=\"b\" maximumFractionDigits={2} type=\"percent\" value={data.data.percent} variant=\"inherit\" />\n <Text variant=\"caption\">{text}</Text>\n </>\n ) : (\n <Text variant=\"caption\">{text}</Text>\n )\n ) : (\n <>{text}</>\n )}\n </>\n )}\n </StyledLegendItem>\n );\n});\nLegendItem.className = CLASSNAME;\nLegendItem.displayName = COMPONENT_NAME;\n"],"names":["StyledLegendItem","styled","li","_ref","$theme","css","Theme","dark","_ref2","$variant","$color","LegendVariant","custom","_ref3","$clickable","COMPONENT_NAME","CLASSNAME","LegendItem","forwardRef","props","ref","className","color","monochrome","data","dataset","id","propsId","variant","index","isSelected","propsIsSelected","labelDecorator","legendDecorator","onClick","role","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","_id","useId","isLegendCustom","text","key","isEmpty","value","isSelectable","isDeselected","onKeyDown","event","stopPropagation","code","preventDefault","React","createElement","_extends","classNames","selected","deselected","undefined","tabIndex","Boolean","Fragment","Number","as","maximumFractionDigits","Text","percent","type","displayName"],"mappings":";;;;;;;;AAKA;AACA;AACA;AACaA,MAAAA,gBAAgB,GAAGC,MAAM,CAACC,EAA0B,CAAA;AACjE;AACA;AACA;AACA;AACA;AACA,EAAA,EAAIC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,OAAKE,GAAI,CAAA;AACxB,uCAAyCD,EAAAA,MAAM,KAAKE,KAAK,CAACC,IAAI,GAAG,OAAO,GAAG,aAAc,CAAA;AACzF,EAAG,CAAA,CAAA;AAAA,CAAC,CAAA;AACJ;AACA,EAAA,EAAIC,KAAA,IAAA;EAAA,IAAC;IAAEC,QAAQ;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAF,KAAA,CAAA;AAAA,EAAA,OACrBC,QAAQ,KAAKE,aAAa,CAACC,MAAM,GAC7BP,GAAI,CAAA;AACZ;AACA;AACA;AACA;AACA,8BAAA,EAAgCK,MAAO,CAAA;AACvC;AACA,QAAA,CAAS,GACD,EA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B,IAAW,CACpC,CAAC,GACDhB,OAAO,KAAKjB,aAAa,CAAC0D,OAAO,IAAI7C,IAAI,CAACA,IAAI,CAAC6C,OAAO,gBACxDd,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAS,QAAA,EAAA,IAAA,eACET,KAAA,CAAAC,aAAA,CAACS,MAAM,EAAA;AAACC,IAAAA,EAAE,EAAC,GAAG;AAACC,IAAAA,qBAAqB,EAAE,CAAE;AAACG,IAAAA,IAAI,EAAC,SAAS;AAACvB,IAAAA,KAAK,EAAEvB,IAAI,CAACA,IAAI,CAAC6C,OAAQ;AAACzC,IAAAA,OAAO,EAAC,SAAA;AAAS,GAAE,CAAC,eACtG2B,KAAA,CAAAC,aAAA,CAACY,IAAI,EAAA;AAACxC,IAAAA,OAAO,EAAC,SAAA;GAAWgB,EAAAA,IAAW,CACpC,CAAC,gBAEHW,KAAA,CAAAC,aAAA,CAACY,IAAI,EAAA;AAACxC,IAAAA,OAAO,EAAC,SAAA;AAAS,GAAA,EAAEgB,IAAW,CACrC,gBAEDW,KAAA,CAAAC,aAAA,CAAAD,KAAA,CAAAS,QAAA,EAAA,IAAA,EAAGpB,IAAO,CAEZ,CAEY,CAAC,CAAA;AAEvB,CAAC,EAAC;AACF3B,UAAU,CAACI,SAAS,GAAGL,SAAS,CAAA;AAChCC,UAAU,CAACsD,WAAW,GAAGxD,cAAc;;;;"}
|
package/_internal/Line2.js
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { _ as _objectWithoutProperties, b as _objectSpread2, a as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import React, { forwardRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
|
-
import {
|
|
4
|
+
import { useSpring, animated } from '@react-spring/web';
|
|
5
5
|
import { interpolate } from 'd3';
|
|
6
6
|
import styled from 'styled-components';
|
|
7
7
|
import { m as monochrome } from './scheme.js';
|
|
@@ -32,7 +32,7 @@ const Line = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
32
32
|
const interpolator = interpolate(previousData, data);
|
|
33
33
|
const isSelectable = role === 'option';
|
|
34
34
|
const isDeselected = isSelectable && propsIsSelected === false;
|
|
35
|
-
const animatedProps =
|
|
35
|
+
const animatedProps = useSpring(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
36
36
|
to: async next => {
|
|
37
37
|
await next({
|
|
38
38
|
t: 1
|
|
@@ -42,10 +42,10 @@ const Line = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
42
42
|
t: 0
|
|
43
43
|
}
|
|
44
44
|
}));
|
|
45
|
-
return /*#__PURE__*/
|
|
45
|
+
return /*#__PURE__*/React.createElement(StyledLine, _extends({}, forwardedProps, {
|
|
46
46
|
ref: ref,
|
|
47
47
|
className: classNames(Line.className, className)
|
|
48
|
-
}), /*#__PURE__*/
|
|
48
|
+
}), /*#__PURE__*/React.createElement(animated.path, {
|
|
49
49
|
d: config.immediate || disableAnimations ? createLine(data) : animatedProps.t.to(t => createLine(interpolator(t))),
|
|
50
50
|
fill: "none",
|
|
51
51
|
stroke: isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color,
|
package/_internal/Line2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Line2.js","sources":["../../src/components/Line/styles.ts","../../src/components/Line/Line.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledLineProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledLine = styled('g')<StyledLineProps>``;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { animated, useSpring } from '@react-spring/web';\nimport { interpolate as d3interpolate } from 'd3';\n\nimport { Comp } from '@redsift/design-system';\n\nimport { LineProps } from './types';\nimport { StyledLine } from './styles';\nimport { monochrome } from '../../scheme';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Line';\nconst CLASSNAME = 'redsift-line';\n\nexport const Line: Comp<LineProps, SVGGElement> = forwardRef((props, ref) => {\n const { color = monochrome, data, isSelected: propsIsSelected, role } = props;\n\n const { className, createLine, disableAnimations, previousData = [], ...forwardedProps } = props;\n\n const interpolator = d3interpolate(previousData, data);\n\n const isSelectable = role === 'option';\n const isDeselected = isSelectable && propsIsSelected === false;\n\n const animatedProps = useSpring({\n ...config,\n to: async (next: (props?: object) => Promise<void>) => {\n await next({ t: 1 });\n },\n from: { t: 0 },\n });\n\n return (\n <StyledLine {...forwardedProps} ref={ref} className={classNames(Line.className, className)}>\n <animated.path\n d={\n config.immediate || disableAnimations\n ? (createLine(data) as unknown as string)\n : (animatedProps.t.to((t) => createLine(interpolator(t))) as unknown as string)\n }\n fill=\"none\"\n stroke={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n strokeWidth={2}\n />\n </StyledLine>\n );\n});\nLine.className = CLASSNAME;\nLine.displayName = COMPONENT_NAME;\n"],"names":["StyledLine","styled","COMPONENT_NAME","CLASSNAME","Line","forwardRef","props","ref","color","monochrome","data","isSelected","propsIsSelected","role","className","createLine","disableAnimations","previousData","forwardedProps","_objectWithoutProperties","_excluded","interpolator","d3interpolate","isSelectable","isDeselected","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","animated","path","d","immediate","fill","stroke","strokeWidth","displayName"],"mappings":";;;;;;;;;AAGA;AACA;AACA;MACaA,UAAU,GAAGC,MAAM,CAAC,GAAG,CAAmB,CAAC;;;ACMxD,MAAMC,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAMC,SAAS,GAAG,cAAc,CAAA;AAEzB,MAAMC,IAAkC,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC3E,MAAM;AAAEC,IAAAA,KAAK,GAAGC,UAAU;IAAEC,IAAI;AAAEC,IAAAA,UAAU,EAAEC,eAAe;AAAEC,IAAAA,IAAAA;AAAK,GAAC,GAAGP,KAAK,CAAA;EAE7E,MAAM;MAAEQ,SAAS;MAAEC,UAAU;MAAEC,iBAAiB;AAAEC,MAAAA,YAAY,GAAG,EAAA;AAAsB,KAAC,GAAGX,KAAK;AAAxBY,IAAAA,cAAc,GAAAC,wBAAA,CAAKb,KAAK,EAAAc,SAAA,CAAA,CAAA;AAEhG,EAAA,MAAMC,YAAY,GAAGC,WAAa,CAACL,YAAY,EAAEP,IAAI,CAAC,CAAA;AAEtD,EAAA,MAAMa,YAAY,GAAGV,IAAI,KAAK,QAAQ,CAAA;AACtC,EAAA,MAAMW,YAAY,GAAGD,YAAY,IAAIX,eAAe,KAAK,KAAK,CAAA;EAE9D,MAAMa,aAAa,GAAGC,
|
|
1
|
+
{"version":3,"file":"Line2.js","sources":["../../src/components/Line/styles.ts","../../src/components/Line/Line.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledLineProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledLine = styled('g')<StyledLineProps>``;\n","import React, { forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { animated, useSpring } from '@react-spring/web';\nimport { interpolate as d3interpolate } from 'd3';\n\nimport { Comp } from '@redsift/design-system';\n\nimport { LineProps } from './types';\nimport { StyledLine } from './styles';\nimport { monochrome } from '../../scheme';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Line';\nconst CLASSNAME = 'redsift-line';\n\nexport const Line: Comp<LineProps, SVGGElement> = forwardRef((props, ref) => {\n const { color = monochrome, data, isSelected: propsIsSelected, role } = props;\n\n const { className, createLine, disableAnimations, previousData = [], ...forwardedProps } = props;\n\n const interpolator = d3interpolate(previousData, data);\n\n const isSelectable = role === 'option';\n const isDeselected = isSelectable && propsIsSelected === false;\n\n const animatedProps = useSpring({\n ...config,\n to: async (next: (props?: object) => Promise<void>) => {\n await next({ t: 1 });\n },\n from: { t: 0 },\n });\n\n return (\n <StyledLine {...forwardedProps} ref={ref} className={classNames(Line.className, className)}>\n <animated.path\n d={\n config.immediate || disableAnimations\n ? (createLine(data) as unknown as string)\n : (animatedProps.t.to((t) => createLine(interpolator(t))) as unknown as string)\n }\n fill=\"none\"\n stroke={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n strokeWidth={2}\n />\n </StyledLine>\n );\n});\nLine.className = CLASSNAME;\nLine.displayName = COMPONENT_NAME;\n"],"names":["StyledLine","styled","COMPONENT_NAME","CLASSNAME","Line","forwardRef","props","ref","color","monochrome","data","isSelected","propsIsSelected","role","className","createLine","disableAnimations","previousData","forwardedProps","_objectWithoutProperties","_excluded","interpolator","d3interpolate","isSelectable","isDeselected","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","animated","path","d","immediate","fill","stroke","strokeWidth","displayName"],"mappings":";;;;;;;;;AAGA;AACA;AACA;MACaA,UAAU,GAAGC,MAAM,CAAC,GAAG,CAAmB,CAAC;;;ACMxD,MAAMC,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAMC,SAAS,GAAG,cAAc,CAAA;AAEzB,MAAMC,IAAkC,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC3E,MAAM;AAAEC,IAAAA,KAAK,GAAGC,UAAU;IAAEC,IAAI;AAAEC,IAAAA,UAAU,EAAEC,eAAe;AAAEC,IAAAA,IAAAA;AAAK,GAAC,GAAGP,KAAK,CAAA;EAE7E,MAAM;MAAEQ,SAAS;MAAEC,UAAU;MAAEC,iBAAiB;AAAEC,MAAAA,YAAY,GAAG,EAAA;AAAsB,KAAC,GAAGX,KAAK;AAAxBY,IAAAA,cAAc,GAAAC,wBAAA,CAAKb,KAAK,EAAAc,SAAA,CAAA,CAAA;AAEhG,EAAA,MAAMC,YAAY,GAAGC,WAAa,CAACL,YAAY,EAAEP,IAAI,CAAC,CAAA;AAEtD,EAAA,MAAMa,YAAY,GAAGV,IAAI,KAAK,QAAQ,CAAA;AACtC,EAAA,MAAMW,YAAY,GAAGD,YAAY,IAAIX,eAAe,KAAK,KAAK,CAAA;EAE9D,MAAMa,aAAa,GAAGC,SAAS,CAAAC,cAAA,CAAAA,cAAA,KAC1BC,MAAM,CAAA,EAAA,EAAA,EAAA;IACTC,EAAE,EAAE,MAAOC,IAAuC,IAAK;AACrD,MAAA,MAAMA,IAAI,CAAC;AAAEC,QAAAA,CAAC,EAAE,CAAA;AAAE,OAAC,CAAC,CAAA;KACrB;AACDC,IAAAA,IAAI,EAAE;AAAED,MAAAA,CAAC,EAAE,CAAA;AAAE,KAAA;AAAC,GAAA,CACf,CAAC,CAAA;EAEF,oBACEE,KAAA,CAAAC,aAAA,CAAClC,UAAU,EAAAmC,QAAA,KAAKjB,cAAc,EAAA;AAAEX,IAAAA,GAAG,EAAEA,GAAI;AAACO,IAAAA,SAAS,EAAEsB,UAAU,CAAChC,IAAI,CAACU,SAAS,EAAEA,SAAS,CAAA;AAAE,GAAA,CAAA,eACzFmB,KAAA,CAAAC,aAAA,CAACG,QAAQ,CAACC,IAAI,EAAA;IACZC,CAAC,EACCX,MAAM,CAACY,SAAS,IAAIxB,iBAAiB,GAChCD,UAAU,CAACL,IAAI,CAAC,GAChBe,aAAa,CAACM,CAAC,CAACF,EAAE,CAAEE,CAAC,IAAKhB,UAAU,CAACM,YAAY,CAACU,CAAC,CAAC,CAAC,CAC3D;AACDU,IAAAA,IAAI,EAAC,MAAM;AACXC,IAAAA,MAAM,EAAElB,YAAY,GAAG,yCAAyC,GAAGhB,KAAM;AACzEmC,IAAAA,WAAW,EAAE,CAAA;AAAE,GAChB,CACS,CAAC,CAAA;AAEjB,CAAC,EAAC;AACFvC,IAAI,CAACU,SAAS,GAAGX,SAAS,CAAA;AAC1BC,IAAI,CAACwC,WAAW,GAAG1C,cAAc;;;;"}
|
package/_internal/LineChart2.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { _ as _objectWithoutProperties, a as _extends, b as _objectSpread2 } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import React, { forwardRef, useRef, useEffect } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { useTheme, useMessageFormatter, Flexbox, useId } from '@redsift/design-system';
|
|
5
5
|
import styled from 'styled-components';
|
|
@@ -81,7 +81,7 @@ const LoadingLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
81
81
|
className
|
|
82
82
|
} = props,
|
|
83
83
|
forwardedProps = _objectWithoutProperties(props, _excluded$3);
|
|
84
|
-
return /*#__PURE__*/
|
|
84
|
+
return /*#__PURE__*/React.createElement(StyledLineChart, _extends({}, forwardedProps, {
|
|
85
85
|
className: className,
|
|
86
86
|
ref: ref
|
|
87
87
|
}), "Loading...");
|
|
@@ -149,18 +149,19 @@ const statsBy = (arr, sortingMethod) => {
|
|
|
149
149
|
})).sort(getSortingMethod(sortingMethod));
|
|
150
150
|
};
|
|
151
151
|
|
|
152
|
-
const _excluded$2 = ["className", "data", "emptyComponent", "localeText", "size"];
|
|
152
|
+
const _excluded$2 = ["className", "data", "emptyComponent", "localeText", "size", "svgRef"];
|
|
153
153
|
const EmptyLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
154
154
|
const {
|
|
155
155
|
className,
|
|
156
156
|
data: propsData,
|
|
157
157
|
emptyComponent,
|
|
158
158
|
localeText,
|
|
159
|
-
size
|
|
159
|
+
size,
|
|
160
|
+
svgRef
|
|
160
161
|
} = props,
|
|
161
162
|
forwardedProps = _objectWithoutProperties(props, _excluded$2);
|
|
162
163
|
const theme = useTheme();
|
|
163
|
-
const cache = useRef();
|
|
164
|
+
const cache = useRef(undefined);
|
|
164
165
|
const data = propsData;
|
|
165
166
|
useEffect(() => {
|
|
166
167
|
cache.current = data;
|
|
@@ -175,19 +176,20 @@ const EmptyLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
175
176
|
bottom: 48
|
|
176
177
|
};
|
|
177
178
|
const chartWidth = width - margins.left - margins.right;
|
|
178
|
-
return /*#__PURE__*/
|
|
179
|
+
return /*#__PURE__*/React.createElement(StyledLineChart, _extends({}, forwardedProps, {
|
|
179
180
|
className: className,
|
|
180
181
|
ref: ref
|
|
181
|
-
}), emptyComponent !== null && emptyComponent !== void 0 ? emptyComponent : /*#__PURE__*/
|
|
182
|
+
}), emptyComponent !== null && emptyComponent !== void 0 ? emptyComponent : /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(StyledLineChartEmptyText, {
|
|
182
183
|
$maxWidth: width,
|
|
183
184
|
$textSize: chartDimensions.fontSize / 2,
|
|
184
185
|
$theme: theme
|
|
185
|
-
}, /*#__PURE__*/
|
|
186
|
+
}, /*#__PURE__*/React.createElement("span", null, localeText === null || localeText === void 0 ? void 0 : localeText.emptyChartText)), /*#__PURE__*/React.createElement("svg", {
|
|
187
|
+
ref: svgRef,
|
|
186
188
|
width: width,
|
|
187
189
|
height: height
|
|
188
|
-
}, /*#__PURE__*/
|
|
190
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
189
191
|
transform: `translate(${margins.left},${margins.top})`
|
|
190
|
-
}, /*#__PURE__*/
|
|
192
|
+
}, /*#__PURE__*/React.createElement(Axis, {
|
|
191
193
|
position: "bottom",
|
|
192
194
|
length: width - 32,
|
|
193
195
|
scale: scaleLinear().domain([]).range([0, chartWidth]),
|
|
@@ -232,7 +234,7 @@ var intlMessages = {
|
|
|
232
234
|
'fr-FR': frFR
|
|
233
235
|
};
|
|
234
236
|
|
|
235
|
-
const _excluded$1 = ["className", "data", "dotRole", "disableAnimations", "getDotAnchorProps", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onDotClick", "size", "sortingMethod", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "dateParser"],
|
|
237
|
+
const _excluded$1 = ["className", "data", "dotRole", "disableAnimations", "getDotAnchorProps", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "legendProps", "margins", "onDotClick", "size", "sortingMethod", "svgRef", "colorTheme", "tooltipDecorator", "tooltipVariant", "xAxisVariant", "xAxisPlacement", "xAxisTickFormat", "xAxisTickPadding", "xAxisTickRotation", "xAxisTickSize", "xAxisTickValues", "xAxisMinValue", "xAxisMaxValue", "xAxisTickRemodelling", "yAxisVariant", "yAxisPlacement", "yAxisTickFormat", "yAxisTickPadding", "yAxisTickRotation", "yAxisTickSize", "yAxisTickValues", "yAxisMinValue", "yAxisMaxValue", "yAxisTickRemodelling", "dateParser"],
|
|
236
238
|
_excluded2 = ["extraLegendItems"];
|
|
237
239
|
const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
238
240
|
const {
|
|
@@ -251,6 +253,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
251
253
|
onDotClick,
|
|
252
254
|
size,
|
|
253
255
|
sortingMethod,
|
|
256
|
+
svgRef,
|
|
254
257
|
colorTheme,
|
|
255
258
|
tooltipDecorator,
|
|
256
259
|
tooltipVariant,
|
|
@@ -277,7 +280,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
277
280
|
dateParser
|
|
278
281
|
} = props,
|
|
279
282
|
forwardedProps = _objectWithoutProperties(props, _excluded$1);
|
|
280
|
-
const cache = useRef();
|
|
283
|
+
const cache = useRef(undefined);
|
|
281
284
|
const theme = useTheme();
|
|
282
285
|
const format = useMessageFormatter(intlMessages);
|
|
283
286
|
const xScaleType = propsData[0].key[0] instanceof Date ? 'Date' : typeof propsData[0].key[0] === 'number' ? 'number' : typeof propsData[0].key[0] === 'string' && isValidDate(propsData[0].key[0]) ? 'dateString' : typeof propsData[0].key[0] === 'string' ? 'string' : undefined;
|
|
@@ -285,7 +288,6 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
285
288
|
useEffect(() => {
|
|
286
289
|
cache.current = data;
|
|
287
290
|
});
|
|
288
|
-
const svgRef = useRef();
|
|
289
291
|
const chartDimensions = sizeToDimension(size);
|
|
290
292
|
const width = chartDimensions.width;
|
|
291
293
|
const height = chartDimensions.height;
|
|
@@ -407,7 +409,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
407
409
|
extraLegendItems
|
|
408
410
|
} = _ref11,
|
|
409
411
|
forwardedLegendProps = _objectWithoutProperties(_ref11, _excluded2);
|
|
410
|
-
return /*#__PURE__*/
|
|
412
|
+
return /*#__PURE__*/React.createElement(StyledLineChart, _extends({
|
|
411
413
|
mode: typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? 'interactive' : 'static',
|
|
412
414
|
definition: hasCategory ? format('definition-linear-with-categories', {
|
|
413
415
|
categoryLength: categories.length,
|
|
@@ -428,55 +430,54 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
428
430
|
end: scaleY.domain()[1]
|
|
429
431
|
}),
|
|
430
432
|
dataTableRepresentation: hasCategory ? {
|
|
431
|
-
header: /*#__PURE__*/
|
|
433
|
+
header: /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
432
434
|
scope: "col"
|
|
433
|
-
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/
|
|
435
|
+
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), categories.map(category => /*#__PURE__*/React.createElement("th", {
|
|
434
436
|
key: category,
|
|
435
437
|
scope: "col"
|
|
436
438
|
}, category)))),
|
|
437
|
-
body: /*#__PURE__*/
|
|
439
|
+
body: /*#__PURE__*/React.createElement("tbody", null, pivotedTable.map(row => /*#__PURE__*/React.createElement("tr", {
|
|
438
440
|
key: row.key
|
|
439
|
-
}, /*#__PURE__*/
|
|
441
|
+
}, /*#__PURE__*/React.createElement("th", {
|
|
440
442
|
scope: "row"
|
|
441
|
-
}, row.key), categories.map(category => /*#__PURE__*/
|
|
443
|
+
}, row.key), categories.map(category => /*#__PURE__*/React.createElement("th", {
|
|
442
444
|
key: `${row.key}-${category}-${row[category]}`,
|
|
443
445
|
scope: "col"
|
|
444
446
|
}, row[category])))))
|
|
445
447
|
} : {
|
|
446
|
-
header: /*#__PURE__*/
|
|
448
|
+
header: /*#__PURE__*/React.createElement("thead", null, /*#__PURE__*/React.createElement("tr", null, /*#__PURE__*/React.createElement("th", {
|
|
447
449
|
scope: "col"
|
|
448
|
-
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/
|
|
450
|
+
}, xScaleType === 'Date' || xScaleType === 'dateString' ? 'Date' : 'Key'), /*#__PURE__*/React.createElement("th", {
|
|
449
451
|
scope: "col"
|
|
450
452
|
}, "Value"))),
|
|
451
|
-
body: /*#__PURE__*/
|
|
453
|
+
body: /*#__PURE__*/React.createElement("tbody", null, circles.map(datum => {
|
|
452
454
|
let key = xAxisTickFormat ? xAxisTickFormat(datum.x) : datum.x.toString();
|
|
453
455
|
key = Array.isArray(key) ? key.join(' ') : key;
|
|
454
|
-
return /*#__PURE__*/
|
|
456
|
+
return /*#__PURE__*/React.createElement("tr", {
|
|
455
457
|
key: key
|
|
456
|
-
}, /*#__PURE__*/
|
|
458
|
+
}, /*#__PURE__*/React.createElement("th", {
|
|
457
459
|
scope: "row"
|
|
458
|
-
}, key), /*#__PURE__*/
|
|
460
|
+
}, key), /*#__PURE__*/React.createElement("td", null, datum.y));
|
|
459
461
|
}))
|
|
460
462
|
}
|
|
461
463
|
}, forwardedProps, {
|
|
462
464
|
id: id,
|
|
463
465
|
className: className,
|
|
464
466
|
ref: ref
|
|
465
|
-
}), /*#__PURE__*/
|
|
467
|
+
}), /*#__PURE__*/React.createElement(Flexbox, {
|
|
466
468
|
flexDirection: "column",
|
|
467
469
|
alignItems: "center",
|
|
468
470
|
gap: "8"
|
|
469
|
-
}, /*#__PURE__*/
|
|
471
|
+
}, /*#__PURE__*/React.createElement("svg", {
|
|
470
472
|
ref: svgRef,
|
|
471
473
|
width: width,
|
|
472
474
|
height: height,
|
|
473
|
-
"aria-label": typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? format('interactive-chart') : format('static-chart')
|
|
474
|
-
|
|
475
|
-
}, /*#__PURE__*/React__default.createElement("g", {
|
|
475
|
+
"aria-label": typeof onDotClick === 'function' || typeof getDotAnchorProps === 'function' ? format('interactive-chart') : format('static-chart')
|
|
476
|
+
}, /*#__PURE__*/React.createElement("g", {
|
|
476
477
|
transform: `translate(${margins.left},${margins.top})`,
|
|
477
478
|
"aria-hidden": "true"
|
|
478
479
|
}, lines.map((line, index) => {
|
|
479
|
-
return /*#__PURE__*/
|
|
480
|
+
return /*#__PURE__*/React.createElement(Line, {
|
|
480
481
|
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(line[0].category),
|
|
481
482
|
data: line.filter(point => point.y !== null),
|
|
482
483
|
disableAnimations: disableAnimations,
|
|
@@ -485,10 +486,9 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
485
486
|
});
|
|
486
487
|
})), categories.map((category, categoryIndex) => {
|
|
487
488
|
const filteredCircles = circles.filter(circle => circle.category === category);
|
|
488
|
-
return /*#__PURE__*/
|
|
489
|
+
return /*#__PURE__*/React.createElement("g", _extends({
|
|
489
490
|
key: `${id}-series-${category}`,
|
|
490
491
|
transform: `translate(${margins.left},${margins.top})`,
|
|
491
|
-
"aria-hidden": "false",
|
|
492
492
|
role: "region"
|
|
493
493
|
}, hasCategory ? {
|
|
494
494
|
'aria-label': `${category}, category ${categoryIndex + 1} of ${categories.length} with ${filteredCircles.length} circles`
|
|
@@ -501,7 +501,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
501
501
|
const to = _objectSpread2(_objectSpread2({}, circle), {}, {
|
|
502
502
|
r: 4
|
|
503
503
|
});
|
|
504
|
-
return /*#__PURE__*/
|
|
504
|
+
return /*#__PURE__*/React.createElement(Dot, {
|
|
505
505
|
id: `id${id}__circle-${categoryIndex}.${index}`,
|
|
506
506
|
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(circle.category),
|
|
507
507
|
data: to,
|
|
@@ -519,9 +519,9 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
519
519
|
variant: DotVariant.hollow
|
|
520
520
|
});
|
|
521
521
|
}));
|
|
522
|
-
}), /*#__PURE__*/
|
|
522
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
523
523
|
transform: `translate(${margins.left},${margins.top})`
|
|
524
|
-
}, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/
|
|
524
|
+
}, ['bottom', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
|
|
525
525
|
disableAnimations: disableAnimations,
|
|
526
526
|
position: "bottom",
|
|
527
527
|
length: chartWidth,
|
|
@@ -535,7 +535,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
535
535
|
tickFormat: xAxisTickFormat,
|
|
536
536
|
tickRemodelling: xAxisTickRemodelling,
|
|
537
537
|
variant: xAxisVariant
|
|
538
|
-
}) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/
|
|
538
|
+
}) : null, ['top', 'both'].includes(xAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
|
|
539
539
|
disableAnimations: disableAnimations,
|
|
540
540
|
position: "top",
|
|
541
541
|
length: chartWidth,
|
|
@@ -549,7 +549,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
549
549
|
tickFormat: xAxisTickFormat,
|
|
550
550
|
tickRemodelling: xAxisTickRemodelling,
|
|
551
551
|
variant: xAxisVariant
|
|
552
|
-
}) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/
|
|
552
|
+
}) : null, ['left', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
|
|
553
553
|
disableAnimations: disableAnimations,
|
|
554
554
|
position: "left",
|
|
555
555
|
length: chartHeight,
|
|
@@ -563,7 +563,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
563
563
|
tickFormat: yAxisTickFormat,
|
|
564
564
|
tickRemodelling: yAxisTickRemodelling,
|
|
565
565
|
variant: yAxisVariant
|
|
566
|
-
}) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/
|
|
566
|
+
}) : null, ['right', 'both'].includes(yAxisPlacement) ? /*#__PURE__*/React.createElement(Axis, {
|
|
567
567
|
disableAnimations: disableAnimations,
|
|
568
568
|
position: "right",
|
|
569
569
|
length: chartHeight,
|
|
@@ -577,7 +577,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
577
577
|
tickFormat: yAxisTickFormat,
|
|
578
578
|
tickRemodelling: yAxisTickRemodelling,
|
|
579
579
|
variant: yAxisVariant
|
|
580
|
-
}) : null))), hasCategory && legendVariant !== LineChartLegendVariant.none ? /*#__PURE__*/
|
|
580
|
+
}) : null))), hasCategory && legendVariant !== LineChartLegendVariant.none ? /*#__PURE__*/React.createElement(Legend, _extends({
|
|
581
581
|
data: (extraLegendItems ? mergeLegends(extraLegendItems, statsByCategory).sort(getSortingMethod(sortingMethod)) : statsByCategory).map(d => _objectSpread2(_objectSpread2({}, d), {}, {
|
|
582
582
|
color: colorScale === null || colorScale === void 0 ? void 0 : colorScale(d.key)
|
|
583
583
|
})),
|
|
@@ -586,7 +586,7 @@ const RenderedLineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
586
586
|
}, forwardedLegendProps)) : null);
|
|
587
587
|
});
|
|
588
588
|
|
|
589
|
-
const _excluded = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onDotClick", "size", "sortingMethod", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
|
|
589
|
+
const _excluded = ["className", "colorTheme", "data", "dotRole", "emptyComponent", "id", "isDotSelected", "labelDecorator", "legendDecorator", "legendVariant", "localeText", "onDotClick", "size", "sortingMethod", "svgRef", "tooltipDecorator", "tooltipVariant", "xAxisPlacement", "xAxisVariant", "yAxisPlacement", "yAxisVariant"];
|
|
590
590
|
const COMPONENT_NAME = 'LineChart';
|
|
591
591
|
const CLASSNAME = 'redsift-line-chart';
|
|
592
592
|
|
|
@@ -660,6 +660,7 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
660
660
|
onDotClick,
|
|
661
661
|
size = ChartSize.medium,
|
|
662
662
|
sortingMethod = 'desc-value',
|
|
663
|
+
svgRef,
|
|
663
664
|
tooltipDecorator,
|
|
664
665
|
tooltipVariant = TooltipVariant.none,
|
|
665
666
|
xAxisPlacement = 'bottom',
|
|
@@ -672,19 +673,20 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
672
673
|
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
673
674
|
const legendVariant = propsLegendVariant !== null && propsLegendVariant !== void 0 ? propsLegendVariant : LineChartLegendVariant.externalLabel;
|
|
674
675
|
if (propsData === undefined || propsData === null) {
|
|
675
|
-
return /*#__PURE__*/
|
|
676
|
+
return /*#__PURE__*/React.createElement(LoadingLineChart, _extends({
|
|
676
677
|
id: id
|
|
677
678
|
}, forwardedProps, {
|
|
678
679
|
ref: ref
|
|
679
680
|
}));
|
|
680
681
|
}
|
|
681
682
|
if (propsData.length === 0) {
|
|
682
|
-
return /*#__PURE__*/
|
|
683
|
+
return /*#__PURE__*/React.createElement(EmptyLineChart, _extends({
|
|
683
684
|
data: propsData,
|
|
684
685
|
emptyComponent: emptyComponent,
|
|
685
686
|
localeText: localeText,
|
|
686
687
|
size: size,
|
|
687
688
|
sortingMethod: sortingMethod,
|
|
689
|
+
svgRef: svgRef,
|
|
688
690
|
xAxisPlacement: xAxisPlacement,
|
|
689
691
|
xAxisVariant: xAxisVariant,
|
|
690
692
|
yAxisPlacement: yAxisPlacement,
|
|
@@ -693,7 +695,7 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
693
695
|
ref: ref
|
|
694
696
|
}));
|
|
695
697
|
}
|
|
696
|
-
return /*#__PURE__*/
|
|
698
|
+
return /*#__PURE__*/React.createElement(RenderedLineChart, _extends({
|
|
697
699
|
className: classNames(LineChart.className, className),
|
|
698
700
|
colorTheme: colorTheme,
|
|
699
701
|
data: propsData,
|
|
@@ -706,6 +708,7 @@ const LineChart = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
706
708
|
onDotClick: onDotClick,
|
|
707
709
|
size: size,
|
|
708
710
|
sortingMethod: sortingMethod,
|
|
711
|
+
svgRef: svgRef,
|
|
709
712
|
tooltipDecorator: tooltipDecorator,
|
|
710
713
|
tooltipVariant: tooltipVariant,
|
|
711
714
|
xAxisPlacement: xAxisPlacement,
|