@redsift/charts 12.6.6-alpha.2 → 13.0.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":"Bar2.js","sources":["../../src/components/Bar/types.ts","../../src/components/Bar/styles.ts","../../src/components/Bar/Bar.tsx"],"sourcesContent":["import { ScaleLinear as d3ScaleLinear, ScaleTime as d3ScaleTime, ScalePoint as d3ScalePoint } from 'd3';\nimport { Theme, ValueOf } from '@redsift/design-system';\nimport { BarDatum } from '../../types';\nimport { DataPointProps, StyledDataPointProps } from '../DataPoint';\n\n/**\n * Component variant.\n */\nexport const BarOrientation = {\n horizontal: 'horizontal',\n vertical: 'vertical',\n};\nexport type BarOrientation = ValueOf<typeof BarOrientation>;\n\nexport const BarDirection = {\n up: 'up',\n down: 'down',\n};\nexport type BarDirection = ValueOf<typeof BarDirection>;\n\n/**\n * Component props.\n */\nexport interface BarProps extends DataPointProps<BarDatum> {\n /**\n * Gap between two siblings.\n * @default 5\n */\n gap?: number;\n /**\n * Height of the bar in horizontal orientation.\n * @default 40\n */\n height?: number;\n /** Maximum height of the bar. */\n maxHeight?: number;\n /**\n * Orientation of the bar.\n * @default 'vertical'\n */\n orientation?: BarOrientation;\n /** Direction of the bar, works only with vertical orientation. */\n direction?: BarOrientation;\n /** A linear continuous scale defined over a numeric domain used to determine the width or height of the bar (depending on the orientation). */\n scale: d3ScaleLinear<number, number, never>;\n /** A scale defined over a numeric/time/ordinal domain used to determine the position of the bar. */\n scalePosition: d3ScaleLinear<number, number, never> | d3ScaleTime<number, number, never> | d3ScalePoint<string>;\n /**\n * Width of the bar in vertical orientation.\n * @default 40\n */\n width?: number;\n /** Min width of the bar in vertical orientation. */\n minWidth?: number;\n}\n\nexport type StyledBarProps = StyledDataPointProps &\n Omit<BarProps, 'scale' | 'scalePosition'> & {\n $theme: Theme;\n };\n","import styled, { css } from 'styled-components';\nimport { StyledBarProps } from './types';\nimport { DataPoint } from '../DataPoint';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledBar = styled(DataPoint)<StyledBarProps>`\n text {\n ${({ $theme }) => css`\n fill: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n }\n\n ${({ $clickable }) =>\n $clickable\n ? css`\n cursor: pointer;\n\n &:hover,\n &:focus,\n &.focused {\n outline: none;\n rect {\n fill-opacity: 0.7;\n }\n }\n\n // &:focus-visible {\n // rect {\n // stroke: var(--redsift-color-primary-n);\n // stroke-width: 4px;\n // paint-order: stroke;\n // }\n // }\n\n @media (prefers-reduced-motion: no-preference) {\n &:focus-visible,\n &.focused {\n outline: 2px solid var(--redsift-color-primary-n);\n transition: outline-offset 75ms ease-out;\n }\n\n &:not(&:active)&:focus-visible,\n &:not(&:active)&.focused {\n transition-duration: 0.25s;\n }\n }\n\n &:not(&:active)&:focus-visible,\n &:not(&:active)&.focused {\n outline-offset: 0.2rem;\n }\n `\n : ''}\n`;\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, useTheme } from '@redsift/design-system';\n\nimport { BarDirection, BarOrientation, BarProps } from './types';\nimport { StyledBar } from './styles';\nimport { monochrome } from '../../scheme';\nimport { config } from '../../config';\nimport { BarDatum } from '../../types';\n\nconst COMPONENT_NAME = 'Bar';\nconst CLASSNAME = 'redsift-bar';\n\nexport const Bar: Comp<BarProps, SVGGElement> = forwardRef((props, ref) => {\n const { color = monochrome, data, index = 0, isSelected: propsIsSelected, labelDecorator, onClick, role } = props;\n\n const {\n className,\n disableAnimations,\n gap = 5,\n height = 40,\n maxHeight = 100,\n orientation = BarOrientation.horizontal,\n direction = BarDirection.up,\n previousData = {\n data: {\n key: '',\n value: 0,\n },\n },\n scale,\n scalePosition,\n width = 40,\n minWidth,\n ...forwardedProps\n } = props;\n\n const theme = useTheme();\n\n const getValue = (data: BarDatum['data']) =>\n data?.cumulativeValue !== undefined ? data.cumulativeValue : data?.value;\n const interpolator = d3interpolate(getValue(previousData!.data) || 0, getValue(data.data) || 0);\n\n const text = labelDecorator\n ? labelDecorator(data, { index, isSelected: propsIsSelected, color })\n : (data.data.key as string);\n const isSelectable = role === 'option';\n const isDeselected = isSelectable && propsIsSelected === false;\n const isHorizontal = orientation === BarOrientation.horizontal;\n const goesUp = direction === BarDirection.up;\n const isOrdinal = typeof scalePosition.domain()[0] === 'string';\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 const computedWidth: number = minWidth ? Math.max(minWidth, width) : width;\n\n return (\n <StyledBar\n {...forwardedProps}\n ref={ref}\n className={classNames(Bar.className, className)}\n transform={\n isHorizontal\n ? `translate(0, ${scalePosition(data.data.key as any)! + gap! / 2})`\n : `translate(${\n goesUp\n ? scalePosition(data.data.key as any)! + (isOrdinal ? computedWidth + gap! / 2 : computedWidth / 2)\n : scalePosition(data.data.key as any)! + (isOrdinal ? -computedWidth + gap! / 2 : -computedWidth / 2)\n }, ${maxHeight})${goesUp ? ', rotate(180)' : ''}`\n }\n $clickable={Boolean(onClick)}\n $theme={theme}\n >\n {isHorizontal ? (\n <animated.rect\n height={height}\n fill={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n width={\n config.immediate || disableAnimations\n ? scale(data.data.value)\n : animatedProps.t.to((t) => scale(interpolator(t)))\n }\n />\n ) : (\n <animated.rect\n height={\n config.immediate || disableAnimations\n ? goesUp\n ? maxHeight! - scale(getValue(data.data))\n : scale(getValue(data.data)) - maxHeight!\n : animatedProps.t.to((t) =>\n Math.max(0, goesUp ? maxHeight! - scale(interpolator(t)) : scale(interpolator(t)) - maxHeight!)\n )\n }\n fill={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n width={computedWidth}\n />\n )}\n {isHorizontal ? (\n <text x=\"10\" y={height! / 2} dy=\"0.35em\" aria-hidden={true}>\n {text}\n </text>\n ) : null}\n </StyledBar>\n );\n});\nBar.className = CLASSNAME;\nBar.displayName = COMPONENT_NAME;\n"],"names":["BarOrientation","horizontal","vertical","BarDirection","up","down","StyledBar","styled","DataPoint","_ref","$theme","css","Theme","dark","_ref2","$clickable","COMPONENT_NAME","CLASSNAME","Bar","forwardRef","props","ref","color","monochrome","data","index","isSelected","propsIsSelected","labelDecorator","onClick","role","className","disableAnimations","gap","height","maxHeight","orientation","direction","previousData","key","value","scale","scalePosition","width","minWidth","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","getValue","cumulativeValue","undefined","interpolator","d3interpolate","text","isSelectable","isDeselected","isHorizontal","goesUp","isOrdinal","domain","animatedProps","useSpring","_objectSpread","config","to","next","t","from","computedWidth","Math","max","React","createElement","_extends","classNames","transform","Boolean","animated","rect","fill","immediate","x","y","dy","displayName"],"mappings":";;;;;;;;;;;AAKA;AACA;AACA;AACO,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,QAAQ,EAAE,UAAA;AACZ,EAAC;AAGM,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,IAAI,EAAE,MAAA;AACR,EAAC;;AAGD;AACA;AACA;;ACjBA;AACA;AACA;MACaC,SAAS,GAAGC,MAAM,CAACC,SAAS,CAAkB,CAAA;AAC3D;AACA,IAAA,EAAMC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,OAAKE,GAAI,CAAA;AAC1B,wCAA0CD,EAAAA,MAAM,KAAKE,KAAK,CAACC,IAAI,GAAG,OAAO,GAAG,aAAc,CAAA;AAC1F,IAAK,CAAA,CAAA;AAAA,CAAC,CAAA;AACN;AACA;AACA,EAAA,EAAIC,KAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,UAAAA;AAAW,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,CAACa,SAAS,GAAGd,SAAS,CAAA;AACzBC,GAAG,CAACoE,WAAW,GAAGtE,cAAc;;;;"}
1
+ {"version":3,"file":"Bar2.js","sources":["../../src/components/Bar/types.ts","../../src/components/Bar/styles.ts","../../src/components/Bar/Bar.tsx"],"sourcesContent":["import { ScaleLinear as d3ScaleLinear, ScaleTime as d3ScaleTime, ScalePoint as d3ScalePoint } from 'd3';\nimport { Theme, ValueOf } from '@redsift/design-system';\nimport { BarDatum } from '../../types';\nimport { DataPointProps, StyledDataPointProps } from '../DataPoint';\n\n/**\n * Component variant.\n */\nexport const BarOrientation = {\n horizontal: 'horizontal',\n vertical: 'vertical',\n};\nexport type BarOrientation = ValueOf<typeof BarOrientation>;\n\nexport const BarDirection = {\n up: 'up',\n down: 'down',\n};\nexport type BarDirection = ValueOf<typeof BarDirection>;\n\n/**\n * Component props.\n */\nexport interface BarProps extends DataPointProps<BarDatum> {\n /**\n * Gap between two siblings.\n * @default 5\n */\n gap?: number;\n /**\n * Height of the bar in horizontal orientation.\n * @default 40\n */\n height?: number;\n /** Maximum height of the bar. */\n maxHeight?: number;\n /**\n * Orientation of the bar.\n * @default 'vertical'\n */\n orientation?: BarOrientation;\n /** Direction of the bar, works only with vertical orientation. */\n direction?: BarOrientation;\n /** A linear continuous scale defined over a numeric domain used to determine the width or height of the bar (depending on the orientation). */\n scale: d3ScaleLinear<number, number, never>;\n /** A scale defined over a numeric/time/ordinal domain used to determine the position of the bar. */\n scalePosition: d3ScaleLinear<number, number, never> | d3ScaleTime<number, number, never> | d3ScalePoint<string>;\n /**\n * Width of the bar in vertical orientation.\n * @default 40\n */\n width?: number;\n /** Min width of the bar in vertical orientation. */\n minWidth?: number;\n}\n\nexport type StyledBarProps = StyledDataPointProps &\n Omit<BarProps, 'scale' | 'scalePosition'> & {\n $theme: Theme;\n };\n","import styled, { css } from 'styled-components';\nimport { StyledBarProps } from './types';\nimport { DataPoint } from '../DataPoint';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledBar = styled(DataPoint)<StyledBarProps>`\n text {\n ${({ $theme }) => css`\n fill: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n }\n\n ${({ $clickable }) =>\n $clickable\n ? css`\n cursor: pointer;\n\n &:hover,\n &:focus,\n &.focused {\n outline: none;\n rect {\n fill-opacity: 0.7;\n }\n }\n\n // &:focus-visible {\n // rect {\n // stroke: var(--redsift-color-primary-n);\n // stroke-width: 4px;\n // paint-order: stroke;\n // }\n // }\n\n @media (prefers-reduced-motion: no-preference) {\n &:focus-visible,\n &.focused {\n outline: 2px solid var(--redsift-color-primary-n);\n transition: outline-offset 75ms ease-out;\n }\n\n &:not(&:active)&:focus-visible,\n &:not(&:active)&.focused {\n transition-duration: 0.25s;\n }\n }\n\n &:not(&:active)&:focus-visible,\n &:not(&:active)&.focused {\n outline-offset: 0.2rem;\n }\n `\n : ''}\n`;\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, useTheme } from '@redsift/design-system';\n\nimport { BarDirection, BarOrientation, BarProps } from './types';\nimport { StyledBar } from './styles';\nimport { monochrome } from '../../scheme';\nimport { config } from '../../config';\nimport { BarDatum } from '../../types';\n\nconst COMPONENT_NAME = 'Bar';\nconst CLASSNAME = 'redsift-bar';\n\nexport const Bar: Comp<BarProps, SVGGElement> = forwardRef((props, ref) => {\n const { color = monochrome, data, index = 0, isSelected: propsIsSelected, labelDecorator, onClick, role } = props;\n\n const {\n className,\n disableAnimations,\n gap = 5,\n height = 40,\n maxHeight = 100,\n orientation = BarOrientation.horizontal,\n direction = BarDirection.up,\n previousData = {\n data: {\n key: '',\n value: 0,\n },\n },\n scale,\n scalePosition,\n width = 40,\n minWidth,\n ...forwardedProps\n } = props;\n\n const theme = useTheme();\n\n const getValue = (data: BarDatum['data']) =>\n data?.cumulativeValue !== undefined ? data.cumulativeValue : data?.value;\n const interpolator = d3interpolate(getValue(previousData!.data) || 0, getValue(data.data) || 0);\n\n const text = labelDecorator\n ? labelDecorator(data, { index, isSelected: propsIsSelected, color })\n : (data.data.key as string);\n const isSelectable = role === 'option';\n const isDeselected = isSelectable && propsIsSelected === false;\n const isHorizontal = orientation === BarOrientation.horizontal;\n const goesUp = direction === BarDirection.up;\n const isOrdinal = typeof scalePosition.domain()[0] === 'string';\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 const computedWidth: number = minWidth ? Math.max(minWidth, width) : width;\n\n return (\n <StyledBar\n {...forwardedProps}\n ref={ref}\n className={classNames(Bar.className, className)}\n transform={\n isHorizontal\n ? `translate(0, ${scalePosition(data.data.key as any)! + gap! / 2})`\n : `translate(${\n goesUp\n ? scalePosition(data.data.key as any)! + (isOrdinal ? computedWidth + gap! / 2 : computedWidth / 2)\n : scalePosition(data.data.key as any)! + (isOrdinal ? -computedWidth + gap! / 2 : -computedWidth / 2)\n }, ${maxHeight})${goesUp ? ', rotate(180)' : ''}`\n }\n $clickable={Boolean(onClick)}\n $theme={theme}\n >\n {isHorizontal ? (\n <animated.rect\n height={height}\n fill={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n width={\n config.immediate || disableAnimations\n ? scale(data.data.value)\n : animatedProps.t.to((t) => scale(interpolator(t)))\n }\n />\n ) : (\n <animated.rect\n height={\n config.immediate || disableAnimations\n ? goesUp\n ? maxHeight! - scale(getValue(data.data))\n : scale(getValue(data.data)) - maxHeight!\n : animatedProps.t.to((t) =>\n Math.max(0, goesUp ? maxHeight! - scale(interpolator(t)) : scale(interpolator(t)) - maxHeight!)\n )\n }\n fill={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n width={computedWidth}\n />\n )}\n {isHorizontal ? (\n <text x=\"10\" y={height! / 2} dy=\"0.35em\" aria-hidden={true}>\n {text}\n </text>\n ) : null}\n </StyledBar>\n );\n});\nBar.className = CLASSNAME;\nBar.displayName = COMPONENT_NAME;\n"],"names":["BarOrientation","horizontal","vertical","BarDirection","up","down","StyledBar","styled","DataPoint","_ref","$theme","css","Theme","dark","_ref2","$clickable","COMPONENT_NAME","CLASSNAME","Bar","forwardRef","props","ref","color","monochrome","data","index","isSelected","propsIsSelected","labelDecorator","onClick","role","className","disableAnimations","gap","height","maxHeight","orientation","direction","previousData","key","value","scale","scalePosition","width","minWidth","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","getValue","cumulativeValue","undefined","interpolator","d3interpolate","text","isSelectable","isDeselected","isHorizontal","goesUp","isOrdinal","domain","animatedProps","useSpring","_objectSpread","config","to","next","t","from","computedWidth","Math","max","React","createElement","_extends","classNames","transform","Boolean","animated","rect","fill","immediate","x","y","dy","displayName"],"mappings":";;;;;;;;;;;AAKA;AACA;AACA;AACO,MAAMA,cAAc,GAAG;AAC5BC,EAAAA,UAAU,EAAE,YAAY;AACxBC,EAAAA,QAAQ,EAAE,UAAA;AACZ,EAAC;AAGM,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,EAAE,EAAE,IAAI;AACRC,EAAAA,IAAI,EAAE,MAAA;AACR,EAAC;;AAGD;AACA;AACA;;ACjBA;AACA;AACA;MACaC,SAAS,GAAGC,MAAM,CAACC,SAAS,CAAkB,CAAA;AAC3D;AACA,IAAA,EAAMC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,OAAKE,GAAI,CAAA;AAC1B,wCAA0CD,EAAAA,MAAM,KAAKE,KAAK,CAACC,IAAI,GAAG,OAAO,GAAG,aAAc,CAAA;AAC1F,IAAK,CAAA,CAAA;AAAA,CAAC,CAAA;AACN;AACA;AACA,EAAA,EAAIC,KAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,UAAAA;AAAW,GAAC,GAAAD,KAAA,CAAA;EAAA,OACfC,UAAU,GACNJ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