@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
package/CONTRIBUTING.md
CHANGED
|
@@ -2,7 +2,15 @@
|
|
|
2
2
|
|
|
3
3
|
## Setup
|
|
4
4
|
|
|
5
|
-
Make sure you have
|
|
5
|
+
Make sure you have [node](https://nodejs.org/) (v22) and any [yarn](https://yarnpkg.com/) installed. The repository pins **Yarn 4** in `.yarn/releases/` (`yarnPath` in `.yarnrc.yml`), so a global Yarn 1 hands over to it automatically — `yarn --version` inside the repo prints `4.x`. Corepack users get the same version from the `packageManager` field.
|
|
6
|
+
|
|
7
|
+
**Registry auth for Yarn 4.** `@redsift/signal-logic` is a private package, and Yarn 4 does **not** read `~/.npmrc`, so `npm login` alone no longer authenticates `yarn install`. Before your first install, and again whenever your token expires, run this from inside the repository:
|
|
8
|
+
|
|
9
|
+
```bash
|
|
10
|
+
./scripts/registry-auth.sh
|
|
11
|
+
```
|
|
12
|
+
|
|
13
|
+
It does nothing if Yarn can already read the package. If npm can, it reuses the token from your `~/.npmrc`. Otherwise it asks for a new **read-only granular access token** (npmjs.com → Access Tokens → Generate New Token → Granular, read-only access to the `@redsift` packages), without echoing it, and saves it for npm too. The token goes to your own `~/.yarnrc.yml`, never into the repository, and the script checks that Yarn can read the package before it finishes. An install that fails on `@redsift/signal-logic` (the registry answers `404` without a valid token, not `401`) means your token is missing or expired: run the script again. CI passes the token as `YARN_NPM_AUTH_TOKEN` instead.
|
|
6
14
|
|
|
7
15
|
Clone the repo (or fork it first if you're not part of Red Sift organization).
|
|
8
16
|
|
|
@@ -12,6 +20,8 @@ cd design-system
|
|
|
12
20
|
yarn install
|
|
13
21
|
```
|
|
14
22
|
|
|
23
|
+
Dependencies' install scripts are off by default under Yarn 4; the few the repository needs are allowed by name in `dependenciesMeta` in the root `package.json`. New packages resolve only once they are a day old (`npmMinimalAgeGate`), except `@redsift/*`.
|
|
24
|
+
|
|
15
25
|
Set up your environment variable file by copying the template file:
|
|
16
26
|
|
|
17
27
|
```bash
|
|
@@ -297,15 +307,16 @@ However, before using any ARIA, [read this disclaimer carefully](https://www.w3.
|
|
|
297
307
|
|
|
298
308
|
## Tests
|
|
299
309
|
|
|
300
|
-
We use [
|
|
310
|
+
We use [Vitest](https://vitest.dev/) for unit tests and [react-testing-library](https://testing-library.com/docs/react-testing-library/intro) for rendering and writing assertions. Snapshot tests render each story through `composeStory`. Every story also runs as a browser test in headless Chromium, through [`@storybook/addon-vitest`](https://storybook.js.org/docs/writing-tests/integrations/vitest-addon), so a story whose `play` function throws fails a test.
|
|
301
311
|
|
|
302
|
-
Please make sure you include tests with your pull requests. Our CI will run the tests on each PR.
|
|
312
|
+
Please make sure you include tests with your pull requests. Our CI will run the tests on each PR. We target 90% code coverage for statements, branches, functions and lines of every package, and in practice try to reach 100%. Note this is a review-time target rather than an automated gate: no `coverageThreshold` is configured, so CI reports coverage but does not fail a build when it drops.
|
|
303
313
|
|
|
304
314
|
We split the tests into 2 groups.
|
|
305
315
|
|
|
306
316
|
_Visual tests_
|
|
307
317
|
|
|
308
318
|
- A Storybook story should be written for each visual state that a component can be in (based on props).
|
|
319
|
+
- Stories run as browser tests with `yarn workspace @redsift/<package> test:stories` (or `yarn test:stories` for all of them). Install the browser once with `yarn playwright install chromium`.
|
|
309
320
|
|
|
310
321
|
_Unit tests_
|
|
311
322
|
|
|
@@ -321,10 +332,10 @@ yarn test
|
|
|
321
332
|
Or for a specific package with:
|
|
322
333
|
|
|
323
334
|
```bash
|
|
324
|
-
yarn test:charts
|
|
325
|
-
yarn test:design-system
|
|
326
|
-
yarn test:dashboard
|
|
327
|
-
yarn test:table
|
|
335
|
+
yarn test:unit:charts
|
|
336
|
+
yarn test:unit:design-system
|
|
337
|
+
yarn test:unit:dashboard
|
|
338
|
+
yarn test:unit:table
|
|
328
339
|
```
|
|
329
340
|
|
|
330
341
|
Do not forget to update the snapshots with the `-u` option when you modify or create stories. However, you should **always** check the generated snapshots to see if they are correct. Do **not** blindly update the snapshots.
|
|
@@ -424,7 +435,8 @@ Releases go through the one-command `yarn release` CLI — not a manual `lerna p
|
|
|
424
435
|
|
|
425
436
|
1. Login to NPM with an authorized account: `npm login`
|
|
426
437
|
2. Dry-run the readiness gate: `yarn release stable X.Y.Z --dry-run` (validates `release/X.Y.Z` and stops before anything irreversible)
|
|
427
|
-
3.
|
|
438
|
+
3. Freeze the branch: `yarn release freeze X.Y.Z` marks its draft release pull request ready for review, which makes the `release-freeze-check` job reject new pull requests into it
|
|
439
|
+
4. When green, publish: `yarn release stable X.Y.Z` — the CLI preflights, then publishes `X.Y.Z` under `latest`, pausing only for the npm OTP. It then creates the GitHub release notes, promotes (never merges) the draft `release/X.Y.Z` → `main` PR (creating it only if none exists), and cuts the next release branch (`--next minor|major` when the next release is not a patch).
|
|
428
440
|
|
|
429
441
|
### Alpha release
|
|
430
442
|
|
package/_internal/Arc2.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 { Theme, useTheme } from '@redsift/design-system';
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
@@ -85,7 +85,7 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
85
85
|
const interpolator = interpolate(previousData, data);
|
|
86
86
|
const isSelectable = role === 'option';
|
|
87
87
|
const isDeselected = isSelectable && propsIsSelected === false;
|
|
88
|
-
const animatedProps =
|
|
88
|
+
const animatedProps = useSpring(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
89
89
|
to: async next => {
|
|
90
90
|
await next({
|
|
91
91
|
t: 1
|
|
@@ -95,7 +95,7 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
95
95
|
t: 0
|
|
96
96
|
}
|
|
97
97
|
}));
|
|
98
|
-
return /*#__PURE__*/
|
|
98
|
+
return /*#__PURE__*/React.createElement(StyledArc, _extends({}, forwardedProps, {
|
|
99
99
|
ref: ref,
|
|
100
100
|
className: classNames(Arc.className, className),
|
|
101
101
|
$clickable: Boolean(onClick),
|
|
@@ -105,7 +105,7 @@ const Arc = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
105
105
|
placement: 'client-point',
|
|
106
106
|
offset: 12
|
|
107
107
|
}
|
|
108
|
-
}), /*#__PURE__*/
|
|
108
|
+
}), /*#__PURE__*/React.createElement(animated.path, {
|
|
109
109
|
d: config.immediate || disableAnimations ? createArc(data) : animatedProps.t.to(t => createArc(interpolator(t))),
|
|
110
110
|
fill: isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color
|
|
111
111
|
}));
|
package/_internal/Arc2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arc2.js","sources":["../../src/components/Arc/styles.ts","../../src/components/Arc/Arc.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { StyledArcProps } from './types';\nimport { DataPoint } from '../DataPoint';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledArc = styled(DataPoint)<StyledArcProps>`\n ${({ $hasStroke, $theme }) =>\n $hasStroke\n ? css`\n path {\n stroke-width: 2px;\n stroke: var(--redsift-color-neutral-${$theme === Theme.light ? 'white' : 'x-dark-grey'});\n }\n `\n : ''}\n\n ${({ $clickable }) =>\n $clickable\n ? css`\n cursor: pointer;\n\n &:hover,\n &:focus,\n &.focused {\n opacity: 0.8;\n outline: none;\n }\n\n &:focus-visible,\n &.focused {\n path {\n stroke: var(--redsift-color-primary-n);\n stroke-width: 4px;\n paint-order: stroke;\n }\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 { ArcProps } from './types';\nimport { StyledArc } from './styles';\nimport { monochrome } from '../../scheme';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Arc';\nconst CLASSNAME = 'redsift-arc';\n\nexport const Arc: Comp<ArcProps, SVGGElement> = forwardRef((props, ref) => {\n const { color = monochrome, data, isSelected: propsIsSelected, onClick, role } = props;\n\n const {\n className,\n createArc,\n disableAnimations,\n hasStroke,\n previousData = {\n data: {\n key: '',\n value: 0,\n },\n startAngle: 0,\n endAngle: 0,\n padAngle: 0,\n value: 0,\n index: 0,\n },\n ...forwardedProps\n } = props;\n\n const theme = useTheme();\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 <StyledArc\n {...forwardedProps}\n ref={ref}\n className={classNames(Arc.className, className)}\n $clickable={Boolean(onClick)}\n $hasStroke={Boolean(hasStroke)}\n $theme={theme}\n tooltipProps={{ placement: 'client-point', offset: 12 }}\n >\n <animated.path\n d={\n config.immediate || disableAnimations\n ? (createArc(data) as unknown as string)\n : (animatedProps.t.to((t) => createArc(interpolator(t))) as unknown as string)\n }\n fill={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n />\n </StyledArc>\n );\n});\nArc.className = CLASSNAME;\nArc.displayName = COMPONENT_NAME;\n"],"names":["StyledArc","styled","DataPoint","_ref","$hasStroke","$theme","css","Theme","light","_ref2","$clickable","COMPONENT_NAME","CLASSNAME","Arc","forwardRef","props","ref","color","monochrome","data","isSelected","propsIsSelected","onClick","role","className","createArc","disableAnimations","hasStroke","previousData","key","value","startAngle","endAngle","padAngle","index","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","interpolator","d3interpolate","isSelectable","isDeselected","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","Boolean","tooltipProps","placement","offset","animated","path","d","immediate","fill","displayName"],"mappings":";;;;;;;;;;;AAKA;AACA;AACA;MACaA,SAAS,GAAGC,MAAM,CAACC,SAAS,CAAkB,CAAA;AAC3D,EAAA,EAAIC,IAAA,IAAA;EAAA,IAAC;IAAEC,UAAU;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAF,IAAA,CAAA;EAAA,OACvBC,UAAU,GACNE,GAAI,CAAA;AACZ;AACA;AACA,gDAA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A,MAAMC,YAAY,GAAGC,WAAa,CAACb,YAAY,EAAET,IAAI,CAAC,CAAA;AAEtD,EAAA,MAAMuB,YAAY,GAAGnB,IAAI,KAAK,QAAQ,CAAA;AACtC,EAAA,MAAMoB,YAAY,GAAGD,YAAY,IAAIrB,eAAe,KAAK,KAAK,CAAA;EAE9D,MAAMuB,aAAa,GAAGC,
|
|
1
|
+
{"version":3,"file":"Arc2.js","sources":["../../src/components/Arc/styles.ts","../../src/components/Arc/Arc.tsx"],"sourcesContent":["import styled, { css } from 'styled-components';\nimport { StyledArcProps } from './types';\nimport { DataPoint } from '../DataPoint';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledArc = styled(DataPoint)<StyledArcProps>`\n ${({ $hasStroke, $theme }) =>\n $hasStroke\n ? css`\n path {\n stroke-width: 2px;\n stroke: var(--redsift-color-neutral-${$theme === Theme.light ? 'white' : 'x-dark-grey'});\n }\n `\n : ''}\n\n ${({ $clickable }) =>\n $clickable\n ? css`\n cursor: pointer;\n\n &:hover,\n &:focus,\n &.focused {\n opacity: 0.8;\n outline: none;\n }\n\n &:focus-visible,\n &.focused {\n path {\n stroke: var(--redsift-color-primary-n);\n stroke-width: 4px;\n paint-order: stroke;\n }\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 { ArcProps } from './types';\nimport { StyledArc } from './styles';\nimport { monochrome } from '../../scheme';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Arc';\nconst CLASSNAME = 'redsift-arc';\n\nexport const Arc: Comp<ArcProps, SVGGElement> = forwardRef((props, ref) => {\n const { color = monochrome, data, isSelected: propsIsSelected, onClick, role } = props;\n\n const {\n className,\n createArc,\n disableAnimations,\n hasStroke,\n previousData = {\n data: {\n key: '',\n value: 0,\n },\n startAngle: 0,\n endAngle: 0,\n padAngle: 0,\n value: 0,\n index: 0,\n },\n ...forwardedProps\n } = props;\n\n const theme = useTheme();\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 <StyledArc\n {...forwardedProps}\n ref={ref}\n className={classNames(Arc.className, className)}\n $clickable={Boolean(onClick)}\n $hasStroke={Boolean(hasStroke)}\n $theme={theme}\n tooltipProps={{ placement: 'client-point', offset: 12 }}\n >\n <animated.path\n d={\n config.immediate || disableAnimations\n ? (createArc(data) as unknown as string)\n : (animatedProps.t.to((t) => createArc(interpolator(t))) as unknown as string)\n }\n fill={isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color}\n />\n </StyledArc>\n );\n});\nArc.className = CLASSNAME;\nArc.displayName = COMPONENT_NAME;\n"],"names":["StyledArc","styled","DataPoint","_ref","$hasStroke","$theme","css","Theme","light","_ref2","$clickable","COMPONENT_NAME","CLASSNAME","Arc","forwardRef","props","ref","color","monochrome","data","isSelected","propsIsSelected","onClick","role","className","createArc","disableAnimations","hasStroke","previousData","key","value","startAngle","endAngle","padAngle","index","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","interpolator","d3interpolate","isSelectable","isDeselected","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","Boolean","tooltipProps","placement","offset","animated","path","d","immediate","fill","displayName"],"mappings":";;;;;;;;;;;AAKA;AACA;AACA;MACaA,SAAS,GAAGC,MAAM,CAACC,SAAS,CAAkB,CAAA;AAC3D,EAAA,EAAIC,IAAA,IAAA;EAAA,IAAC;IAAEC,UAAU;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAF,IAAA,CAAA;EAAA,OACvBC,UAAU,GACNE,GAAI,CAAA;AACZ;AACA;AACA,gDAAkDD,EAAAA,MAAM,K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IAAI,EAAErB,YAAY,GAAG,yCAAyC,GAAG1B,KAAAA;AAAM,GACxE,CACQ,CAAC,CAAA;AAEhB,CAAC,EAAC;AACFJ,GAAG,CAACW,SAAS,GAAGZ,SAAS,CAAA;AACzBC,GAAG,CAACoD,WAAW,GAAGtD,cAAc;;;;"}
|
package/_internal/Arcs2.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 { useId } from '@redsift/design-system';
|
|
7
7
|
import styled from 'styled-components';
|
|
@@ -34,7 +34,7 @@ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
34
34
|
forwardedProps = _objectWithoutProperties(props, _excluded);
|
|
35
35
|
const [_id] = useId();
|
|
36
36
|
const id = propsId !== null && propsId !== void 0 ? propsId : _id;
|
|
37
|
-
const animatedProps =
|
|
37
|
+
const animatedProps = useSpring(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
38
38
|
to: async next => {
|
|
39
39
|
await next({
|
|
40
40
|
t: 1
|
|
@@ -44,16 +44,16 @@ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
44
44
|
t: 0
|
|
45
45
|
}
|
|
46
46
|
}));
|
|
47
|
-
return /*#__PURE__*/
|
|
47
|
+
return /*#__PURE__*/React.createElement(StyledArcs, _extends({}, forwardedProps, {
|
|
48
48
|
className: classNames(Arcs.className, className),
|
|
49
49
|
ref: ref
|
|
50
|
-
}), /*#__PURE__*/
|
|
50
|
+
}), /*#__PURE__*/React.createElement("g", {
|
|
51
51
|
className: "arc-group"
|
|
52
52
|
}, arcs.map((arc, index) => {
|
|
53
53
|
var _arc$index, _arc$id;
|
|
54
54
|
const arcIndex = (_arc$index = arc.index) !== null && _arc$index !== void 0 ? _arc$index : index;
|
|
55
55
|
const arcId = (_arc$id = arc.id) !== null && _arc$id !== void 0 ? _arc$id : `id${id}__arc-${arcIndex}`;
|
|
56
|
-
return /*#__PURE__*/
|
|
56
|
+
return /*#__PURE__*/React.createElement(Arc, _extends({}, sliceProps, {
|
|
57
57
|
color: color,
|
|
58
58
|
disableAnimations: disableAnimations,
|
|
59
59
|
hasStroke: hasStroke,
|
|
@@ -66,7 +66,7 @@ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
66
66
|
id: arcId,
|
|
67
67
|
index: arcIndex
|
|
68
68
|
}));
|
|
69
|
-
})), hasLabels ? /*#__PURE__*/
|
|
69
|
+
})), hasLabels ? /*#__PURE__*/React.createElement("g", {
|
|
70
70
|
className: "arc-label-group"
|
|
71
71
|
}, arcs.filter(arc => {
|
|
72
72
|
const value = arc.data.data.value;
|
|
@@ -78,7 +78,7 @@ const Arcs = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
78
78
|
const arcId = (_arc$id2 = arc.id) !== null && _arc$id2 !== void 0 ? _arc$id2 : `id${id}__arc-${arcIndex}`;
|
|
79
79
|
const arcLabelDecorator = (_arc$labelDecorator = arc.labelDecorator) !== null && _arc$labelDecorator !== void 0 ? _arc$labelDecorator : labelDecorator;
|
|
80
80
|
const interpolator = interpolate(arc.from, arc.data);
|
|
81
|
-
return /*#__PURE__*/
|
|
81
|
+
return /*#__PURE__*/React.createElement(animated.text, {
|
|
82
82
|
alignmentBaseline: "middle",
|
|
83
83
|
className: `arc-label _${index}`,
|
|
84
84
|
key: `${arcId}-label`,
|
package/_internal/Arcs2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Arcs2.js","sources":["../../src/components/Arcs/styles.ts","../../src/components/Arcs/Arcs.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledArcsProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledArcs = styled.g<StyledArcsProps>``;\n","import React, { RefObject, forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { animated, useSpring } from '@react-spring/web';\nimport { interpolate as d3interpolate } from 'd3';\n\nimport { Comp, useId } from '@redsift/design-system';\n\nimport { ArcsProps } from './types';\nimport { StyledArcs } from './styles';\nimport { Arc } from '../Arc';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Arcs';\nconst CLASSNAME = 'redsift-arcs';\n\nexport const Arcs: Comp<ArcsProps, SVGGElement> = forwardRef((props, ref) => {\n const {\n arcs,\n className,\n color,\n disableAnimations,\n hasLabels,\n hasStroke,\n id: propsId,\n labelDecorator,\n onClick,\n role,\n sliceProps,\n tooltipVariant,\n ...forwardedProps\n } = props;\n const [_id] = useId();\n const id = propsId ?? _id;\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 <StyledArcs\n {...forwardedProps}\n className={classNames(Arcs.className, className)}\n ref={ref as RefObject<SVGGElement>}\n >\n <g className=\"arc-group\">\n {arcs.map((arc, index) => {\n const arcIndex = arc.index ?? index;\n const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;\n\n return (\n <Arc\n {...sliceProps}\n color={color}\n disableAnimations={disableAnimations}\n hasStroke={hasStroke}\n labelDecorator={labelDecorator}\n onClick={onClick}\n role={role}\n tooltipVariant={tooltipVariant}\n {...arc}\n key={arcId}\n id={arcId}\n index={arcIndex}\n />\n );\n })}\n </g>\n {hasLabels ? (\n <g className=\"arc-label-group\">\n {arcs\n .filter((arc) => {\n const value = arc.data.data.value;\n const percent = arc.data.data.percent;\n return percent ? value > 0 && percent >= 0.1 : value > 0;\n })\n .map((arc, index) => {\n const arcIndex = arc.index ?? index;\n const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;\n const arcLabelDecorator = arc.labelDecorator ?? labelDecorator;\n const interpolator = d3interpolate(arc.from, arc.data);\n\n return (\n <animated.text\n alignmentBaseline=\"middle\"\n className={`arc-label _${index}`}\n key={`${arcId}-label`}\n textAnchor=\"middle\"\n transform={\n config.immediate || disableAnimations\n ? `translate(${arc.createArc.centroid(arc.data).map((n) => n.toFixed(4))})`\n : animatedProps.t.to(\n (t) => `translate(${arc.createArc.centroid(interpolator(t)).map((n) => n.toFixed(4))})`\n )\n }\n >\n {arcLabelDecorator ? arcLabelDecorator(arc.data) : arc.data.data.key}\n </animated.text>\n );\n })}\n </g>\n ) : null}\n </StyledArcs>\n );\n});\nArcs.className = CLASSNAME;\nArcs.displayName = COMPONENT_NAME;\n"],"names":["StyledArcs","styled","g","COMPONENT_NAME","CLASSNAME","Arcs","forwardRef","props","ref","arcs","className","color","disableAnimations","hasLabels","hasStroke","id","propsId","labelDecorator","onClick","role","sliceProps","tooltipVariant","forwardedProps","_objectWithoutProperties","_excluded","_id","useId","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","map","arc","index","_arc$index","_arc$id","arcIndex","arcId","Arc","key","filter","value","data","percent","_arc$index2","_arc$id2","_arc$labelDecorator","arcLabelDecorator","interpolator","d3interpolate","animated","text","alignmentBaseline","textAnchor","transform","immediate","createArc","centroid","n","toFixed","displayName"],"mappings":";;;;;;;;;;AAGA;AACA;AACA;MACaA,UAAU,GAAGC,MAAM,CAACC,CAAmB,CAAC;;;ACMrD,MAAMC,cAAc,GAAG,MAAM,CAAA;AAC7B,MAAMC,SAAS,GAAG,cAAc,CAAA;AAEzB,MAAMC,IAAkC,gBAAGC,UAAU,CAAC,CAACC,KAAK,EAAEC,GAAG,KAAK;EAC3E,MAAM;MACJC,IAAI;MACJC,SAAS;MACTC,KAAK;MACLC,iBAAiB;MACjBC,SAAS;MACTC,SAAS;AACTC,MAAAA,EAAE,EAAEC,OAAO;MACXC,cAAc;MACdC,OAAO;MACPC,IAAI;MACJC,UAAU;AACVC,MAAAA,cAAAA;AAEF,KAAC,GAAGd,KAAK;AADJe,IAAAA,cAAc,GAAAC,wBAAA,CACfhB,KAAK,EAAAiB,SAAA,CAAA,CAAA;AACT,EAAA,MAAM,CAACC,GAAG,CAAC,GAAGC,KAAK,EAAE,CAAA;EACrB,MAAMX,EAAE,GAAGC,OAAO,KAAA,IAAA,IAAPA,OAAO,KAAPA,KAAAA,CAAAA,GAAAA,OAAO,GAAIS,GAAG,CAAA;EAEzB,MAAME,aAAa,GAAGC,
|
|
1
|
+
{"version":3,"file":"Arcs2.js","sources":["../../src/components/Arcs/styles.ts","../../src/components/Arcs/Arcs.tsx"],"sourcesContent":["import styled from 'styled-components';\nimport { StyledArcsProps } from './types';\n\n/**\n * Component style.\n */\nexport const StyledArcs = styled.g<StyledArcsProps>``;\n","import React, { RefObject, forwardRef } from 'react';\nimport classNames from 'classnames';\nimport { animated, useSpring } from '@react-spring/web';\nimport { interpolate as d3interpolate } from 'd3';\n\nimport { Comp, useId } from '@redsift/design-system';\n\nimport { ArcsProps } from './types';\nimport { StyledArcs } from './styles';\nimport { Arc } from '../Arc';\nimport { config } from '../../config';\n\nconst COMPONENT_NAME = 'Arcs';\nconst CLASSNAME = 'redsift-arcs';\n\nexport const Arcs: Comp<ArcsProps, SVGGElement> = forwardRef((props, ref) => {\n const {\n arcs,\n className,\n color,\n disableAnimations,\n hasLabels,\n hasStroke,\n id: propsId,\n labelDecorator,\n onClick,\n role,\n sliceProps,\n tooltipVariant,\n ...forwardedProps\n } = props;\n const [_id] = useId();\n const id = propsId ?? _id;\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 <StyledArcs\n {...forwardedProps}\n className={classNames(Arcs.className, className)}\n ref={ref as RefObject<SVGGElement>}\n >\n <g className=\"arc-group\">\n {arcs.map((arc, index) => {\n const arcIndex = arc.index ?? index;\n const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;\n\n return (\n <Arc\n {...sliceProps}\n color={color}\n disableAnimations={disableAnimations}\n hasStroke={hasStroke}\n labelDecorator={labelDecorator}\n onClick={onClick}\n role={role}\n tooltipVariant={tooltipVariant}\n {...arc}\n key={arcId}\n id={arcId}\n index={arcIndex}\n />\n );\n })}\n </g>\n {hasLabels ? (\n <g className=\"arc-label-group\">\n {arcs\n .filter((arc) => {\n const value = arc.data.data.value;\n const percent = arc.data.data.percent;\n return percent ? value > 0 && percent >= 0.1 : value > 0;\n })\n .map((arc, index) => {\n const arcIndex = arc.index ?? index;\n const arcId = arc.id ?? `id${id}__arc-${arcIndex}`;\n const arcLabelDecorator = arc.labelDecorator ?? labelDecorator;\n const interpolator = d3interpolate(arc.from, arc.data);\n\n return (\n <animated.text\n alignmentBaseline=\"middle\"\n className={`arc-label _${index}`}\n key={`${arcId}-label`}\n textAnchor=\"middle\"\n transform={\n config.immediate || disableAnimations\n ? `translate(${arc.createArc.centroid(arc.data).map((n) => n.toFixed(4))})`\n : animatedProps.t.to(\n (t) => `translate(${arc.createArc.centroid(interpolator(t)).map((n) => n.toFixed(4))})`\n )\n }\n >\n {arcLabelDecorator ? arcLabelDecorator(arc.data) : arc.data.data.key}\n </animated.text>\n );\n })}\n </g>\n ) : null}\n </StyledArcs>\n );\n});\nArcs.className = CLASSNAME;\nArcs.displayName = COMPONENT_NAME;\n"],"names":["StyledArcs","styled","g","COMPONENT_NAME","CLASSNAME","Arcs","forwardRef","props","ref","arcs","className","color","disableAnimations","hasLabels","hasStroke","id","propsId","labelDecorator","onClick","role","sliceProps","tooltipVariant","forwardedProps","_objectWithoutProperties","_excluded","_id","useId","animatedProps","useSpring","_objectSpread","config","to","next","t","from","React","createElement","_extends","classNames","map","arc","index","_arc$index","_arc$id","arcIndex","arcId","Arc","key","filter","value","data","percent","_arc$index2","_arc$id2","_arc$labelDecorator","arcLabelDecorator","interpolator","d3interpolate","animated","text","alignmentBaseline","textAnchor","transform","immediate","createArc","centroid","n","toFixed","displayName"],"mappings":";;;;;;;;;;AAGA;AACA;AACA;MACaA,UA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AAA,UAAA,EAAY4B,GAAG,CAACwB,SAAS,CAACC,QAAQ,CAACzB,GAAG,CAACU,IAAI,CAAC,CAACX,GAAG,CAAE2B,CAAC,IAAKA,CAAC,CAACC,OAAO,CAAC,CAAC,CAAC,CAAE,CAAE,CAAA,CAAA,GACzExC,aAAa,CAACM,CAAC,CAACF,EAAE,CACfE,CAAC,IAAM,CAAYO,UAAAA,EAAAA,GAAG,CAACwB,SAAS,CAACC,QAAQ,CAACT,YAAY,CAACvB,CAAC,CAAC,CAAC,CAACM,GAAG,CAAE2B,CAAC,IAAKA,CAAC,CAACC,OAAO,CAAC,CAAC,CAAC,CAAE,CACvF,CAAA,CAAA,CAAA;AACL,KAAA,EAEAZ,iBAAiB,GAAGA,iBAAiB,CAACf,GAAG,CAACU,IAAI,CAAC,GAAGV,GAAG,CAACU,IAAI,CAACA,IAAI,CAACH,GACpD,CAAC,CAAA;AAEpB,GAAC,CACF,CAAC,GACF,IACM,CAAC,CAAA;AAEjB,CAAC,EAAC;AACF1C,IAAI,CAACK,SAAS,GAAGN,SAAS,CAAA;AAC1BC,IAAI,CAAC+D,WAAW,GAAGjE,cAAc;;;;"}
|
package/_internal/Axis2.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { b as _objectSpread2, _ as _objectWithoutProperties, a as _extends } from './_rollupPluginBabelHelpers.js';
|
|
2
|
-
import
|
|
2
|
+
import React, { forwardRef, useRef } from 'react';
|
|
3
3
|
import classNames from 'classnames';
|
|
4
4
|
import { Theme, useTheme } from '@redsift/design-system';
|
|
5
5
|
import styled, { css } from 'styled-components';
|
|
6
|
-
import {
|
|
6
|
+
import { animated, useSpring, useTransition } from '@react-spring/web';
|
|
7
7
|
import { c as config } from './config.js';
|
|
8
8
|
|
|
9
9
|
/**
|
|
@@ -31,7 +31,7 @@ const AxisPosition = {
|
|
|
31
31
|
/**
|
|
32
32
|
* Component style.
|
|
33
33
|
*/
|
|
34
|
-
const StyledAxis = styled(
|
|
34
|
+
const StyledAxis = styled(animated.g)`
|
|
35
35
|
.redsift-axis__line,
|
|
36
36
|
.redsift-axis-tick__line {
|
|
37
37
|
fill: none;
|
|
@@ -236,8 +236,8 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
236
236
|
length: gridLength
|
|
237
237
|
} = _ref,
|
|
238
238
|
gridStyle = _objectWithoutProperties(_ref, _excluded2);
|
|
239
|
-
const axisRef = ref || useRef();
|
|
240
|
-
const animatedProps =
|
|
239
|
+
const axisRef = ref || useRef(undefined);
|
|
240
|
+
const animatedProps = useSpring(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
241
241
|
to: async next => {
|
|
242
242
|
await next({
|
|
243
243
|
lineX2: axis === 'x' ? length : 0,
|
|
@@ -282,7 +282,7 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
282
282
|
legendX = propsLegendX !== null && propsLegendX !== void 0 ? propsLegendX : length;
|
|
283
283
|
}
|
|
284
284
|
}
|
|
285
|
-
legendNode = /*#__PURE__*/
|
|
285
|
+
legendNode = /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement("text", {
|
|
286
286
|
transform: `translate(${legendX}, ${legendY}) rotate(${legendRotation})`,
|
|
287
287
|
textAnchor: textAnchor,
|
|
288
288
|
style: _objectSpread2({
|
|
@@ -304,7 +304,7 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
304
304
|
tickRotation: tickRotation,
|
|
305
305
|
tickRemodelling
|
|
306
306
|
});
|
|
307
|
-
const transition =
|
|
307
|
+
const transition = useTransition(ticks, _objectSpread2(_objectSpread2({}, config), {}, {
|
|
308
308
|
keys: tick => tick.key,
|
|
309
309
|
initial: tick => ({
|
|
310
310
|
opacity: 1,
|
|
@@ -331,7 +331,7 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
331
331
|
}
|
|
332
332
|
}));
|
|
333
333
|
const tickStyles = tickStyle ? tickStyle(ticks) : [];
|
|
334
|
-
return /*#__PURE__*/
|
|
334
|
+
return /*#__PURE__*/React.createElement(StyledAxis, _extends({
|
|
335
335
|
"aria-hidden": "true",
|
|
336
336
|
className: classNames(Axis.className, className),
|
|
337
337
|
$theme: theme
|
|
@@ -343,14 +343,14 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
343
343
|
var _tickStyles$tickIndex, _tickStyles$tickIndex2, _tickStyles$tickIndex3;
|
|
344
344
|
let formattedTickValues = tickFormat ? tickFormat(tick.value) : tick.value;
|
|
345
345
|
formattedTickValues = Array.isArray(formattedTickValues) ? formattedTickValues : [formattedTickValues];
|
|
346
|
-
return /*#__PURE__*/
|
|
346
|
+
return /*#__PURE__*/React.createElement(animated.g, {
|
|
347
347
|
className: `${Axis.className}__tick`,
|
|
348
348
|
key: tickIndex,
|
|
349
349
|
transform: transitionProps.transform,
|
|
350
350
|
style: {
|
|
351
351
|
opacity: transitionProps.opacity
|
|
352
352
|
}
|
|
353
|
-
}, gridLength ? /*#__PURE__*/
|
|
353
|
+
}, gridLength ? /*#__PURE__*/React.createElement("line", {
|
|
354
354
|
className: `${Axis.className}-grid__line`,
|
|
355
355
|
x1: axis === 'x' ? tick.lineX : 0,
|
|
356
356
|
x2: axis === 'x' ? tick.lineX : gridLength * (position === 'right' ? -1 : 1),
|
|
@@ -363,7 +363,7 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
363
363
|
strokeWidth: tickStyles && tickStyles.length > 0 ? ((_tickStyles$tickIndex = tickStyles[tickIndex]) === null || _tickStyles$tickIndex === void 0 ? void 0 : _tickStyles$tickIndex.gridStrokeWidth) || 0.5 : gridStyle.strokeWidth || 0.5,
|
|
364
364
|
stroke: tickStyles && tickStyles.length > 0 ? ((_tickStyles$tickIndex2 = tickStyles[tickIndex]) === null || _tickStyles$tickIndex2 === void 0 ? void 0 : _tickStyles$tickIndex2.gridStroke) || 'currentColor' : gridStyle.stroke || 'currentColor'
|
|
365
365
|
})
|
|
366
|
-
}) : null, /*#__PURE__*/
|
|
366
|
+
}) : null, /*#__PURE__*/React.createElement("line", {
|
|
367
367
|
className: `${Axis.className}-tick__line`,
|
|
368
368
|
x1: 0,
|
|
369
369
|
x2: tick.lineX,
|
|
@@ -372,14 +372,14 @@ const Axis = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
372
372
|
style: {
|
|
373
373
|
strokeWidth: tickStyles && tickStyles.length > 0 ? (_tickStyles$tickIndex3 = tickStyles[tickIndex]) === null || _tickStyles$tickIndex3 === void 0 ? void 0 : _tickStyles$tickIndex3.strokeWidth : 1
|
|
374
374
|
}
|
|
375
|
-
}), variant === AxisVariant.default || variant === AxisVariant.tickValue ? formattedTickValues.map((value, index) => /*#__PURE__*/
|
|
375
|
+
}), variant === AxisVariant.default || variant === AxisVariant.tickValue ? formattedTickValues.map((value, index) => /*#__PURE__*/React.createElement(animated.text, {
|
|
376
376
|
key: value,
|
|
377
377
|
dominantBaseline: textBaseline,
|
|
378
378
|
textAnchor: textAlign,
|
|
379
379
|
transform: `translate(${tick.textX},${tick.textY + 14 * index}),rotate(${tickRotation})`,
|
|
380
380
|
className: !textColor ? '' : tickToColor(tick, tickIndex) ? 'colored' : ''
|
|
381
381
|
}, value)) : null);
|
|
382
|
-
}) : null, variant === AxisVariant.default || variant === AxisVariant.line || variant === AxisVariant.lineTick ? /*#__PURE__*/
|
|
382
|
+
}) : null, variant === AxisVariant.default || variant === AxisVariant.line || variant === AxisVariant.lineTick ? /*#__PURE__*/React.createElement(animated.line, {
|
|
383
383
|
className: `${Axis.className}__line`,
|
|
384
384
|
x1: 0,
|
|
385
385
|
x2: config.immediate || disableAnimations ? axis === 'x' ? length : 0 : animatedProps.lineX2,
|
package/_internal/Axis2.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Axis2.js","sources":["../../src/components/Axis/types.ts","../../src/components/Axis/styles.ts","../../src/components/Axis/computeTicks.ts","../../src/components/Axis/Axis.tsx"],"sourcesContent":["import { ComponentProps } from 'react';\nimport { ValueOf, Theme } from '@redsift/design-system';\nimport { AnyScale, NumericValue, ScaleValue, StringValue, TicksSpec } from '../../types';\n\n/**\n * Component variant.\n */\nexport const AxisVariant = {\n none: 'none',\n line: 'line',\n lineTick: 'lineTick',\n tick: 'tick',\n tickValue: 'tickValue',\n default: 'default',\n} as const;\nexport type AxisVariant = ValueOf<typeof AxisVariant>;\n\nexport const AxisPosition = {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n};\nexport type AxisPosition = ValueOf<typeof AxisPosition>;\n\n/**\n * Component props.\n */\nexport interface AxisProps extends Omit<ComponentProps<'g'>, 'scale'> {\n /** Disable animations. */\n disableAnimations?: boolean;\n format?: string;\n /** Whether to display grid or not. The length is mandatory and should usually be the length of the other axis. */\n grid?:\n | boolean\n | {\n length?: number;\n stroke?: string;\n strokeWidth?: number;\n strokeDasharray?: string;\n opacity?: number;\n };\n legend?: string;\n legendOffset?: number;\n legendPosition?: 'start' | 'middle' | 'end';\n legendX?: number;\n legendY?: number;\n legendRotation?: number;\n legendStyle?: React.CSSProperties;\n /** Length of the axis. */\n length?: number;\n /** Position of axis. top|bottom means this is an x axis, right|left means this is an y axis. */\n position?: AxisPosition;\n /** Scale (d3.js) used to generate the axis. */\n scale?: AnyScale;\n tickFormat?:\n | ((d: NumericValue) => string | string[])\n | ((d: StringValue) => string | string[])\n | ((d: Date) => string | string[])\n | ((d: ScaleValue) => string | string[]);\n tickPadding?: number;\n tickRotation?: number;\n tickSize?: number;\n tickStyle?: (ticks: any[]) => {\n strokeWidth?: number;\n gridStrokeWidth?: number;\n gridStroke?: string;\n }[];\n tickValues?: TicksSpec;\n tickRemodelling?: (tickValues: any[]) => any[];\n /** Variant. */\n variant?: AxisVariant;\n /** X position. */\n x?: number;\n /** Y position. */\n y?: number;\n /** Chart width, used for horizontal grid. */\n chartWidth?: number;\n /** Chart height, used for horizontal grid. */\n chartHeight?: number;\n /** Section height, used for horizontal grid within a section. */\n sectionHeight?: number;\n /** Color used for tick values. */\n textColor?: string;\n /** Custom method to choose which tick value to color if not all. */\n tickToColor?: (\n tick?: {\n textX: number;\n textY: number;\n lineX: number;\n lineY: number;\n x: number;\n y: number;\n key: string;\n value: ScaleValue;\n },\n index?: number\n ) => boolean;\n}\n\nexport type StyledAxisProps = Omit<AxisProps, 'areXLabelsRotated' | 'size' | 'scale'> & {\n $theme: Theme;\n $color?: string;\n};\n","import styled, { css } from 'styled-components';\nimport { StyledAxisProps } from './types';\nimport { animated } from '@react-spring/web';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledAxis = styled(animated.g)<StyledAxisProps>`\n .redsift-axis__line,\n .redsift-axis-tick__line {\n fill: none;\n ${({ $theme }) => css`\n stroke: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n shape-rendering: crispEdges;\n }\n\n text {\n font-family: var(--redsift-typography-font-family-poppins);\n ${({ $theme }) => css`\n fill: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n font-size: 10px;\n user-select: none;\n }\n\n text.colored {\n ${({ $theme, $color }) => css`\n fill: ${$color === 'green'\n ? '#029B57'\n : $color === 'red'\n ? '#CB0E0E'\n : `var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'})`};\n `}\n }\n`;\n","import { AnyScale, Coordinates, ScaleValue, ScaleWithBandwidth, TicksSpec } from '../../types';\n\nconst getScaleTicks = (scale: AnyScale, spec?: TicksSpec) => {\n // specific values\n if (Array.isArray(spec)) {\n return spec;\n }\n\n // continuous scales\n if ('ticks' in scale) {\n // default behaviour\n if (spec === undefined) {\n return scale.ticks();\n }\n\n // specific tick count\n if (typeof spec === 'number' && isFinite(spec) && Math.floor(spec) === spec) {\n return scale.ticks(spec);\n }\n\n if (typeof spec === 'function') {\n return scale.ticks();\n }\n }\n\n // non linear scale default\n return scale.domain();\n};\n\nexport const centerScale = (scale: ScaleWithBandwidth) => {\n const bandwidth = scale.bandwidth();\n\n if (bandwidth === 0) return scale;\n\n let offset = bandwidth / 2;\n if (scale.round()) {\n offset = Math.round(offset);\n }\n\n return <T extends ScaleValue>(d: T) => (scale(d) ?? 0) + offset;\n};\n\nexport const computeTicks = ({\n axis,\n scale,\n ticksPosition,\n tickValues,\n tickSize,\n tickPadding,\n tickRotation,\n tickRemodelling,\n}: {\n axis: 'x' | 'y';\n scale: AnyScale;\n ticksPosition?: 'after' | 'before';\n tickValues?: TicksSpec;\n tickSize: number;\n tickPadding: number;\n tickRotation: number;\n tickRemodelling?: (tickValues: any[]) => any[];\n}) => {\n const values = tickRemodelling ? tickRemodelling(getScaleTicks(scale, tickValues)) : getScaleTicks(scale, tickValues);\n\n const position = 'bandwidth' in scale ? centerScale(scale) : scale;\n const line = { lineX: 0, lineY: 0 };\n const text = { textX: 0, textY: 0 };\n\n const isRTL = typeof document === 'object' ? document.dir === 'rtl' : false;\n let translate: (value: ScaleValue) => Coordinates;\n let textAlign = 'middle';\n let textBaseline = 'central';\n\n if (axis === 'x') {\n translate = (d) => ({ x: position(d) ?? 0, y: 0 });\n\n line.lineY = tickSize * (ticksPosition === 'after' ? 1 : -1);\n text.textY = (tickSize + tickPadding) * (ticksPosition === 'after' ? 1 : -1);\n\n if (ticksPosition === 'after') {\n textBaseline = 'text-before-edge';\n } else {\n textBaseline = 'alphabetic';\n }\n\n if (tickRotation === 0) {\n textAlign = 'middle';\n } else if ((ticksPosition === 'after' && tickRotation < 0) || (ticksPosition === 'before' && tickRotation > 0)) {\n textAlign = isRTL ? 'start' : 'end';\n textBaseline = 'middle';\n } else if ((ticksPosition === 'after' && tickRotation > 0) || (ticksPosition === 'before' && tickRotation < 0)) {\n textAlign = isRTL ? 'end' : 'start';\n textBaseline = 'middle';\n }\n } else {\n translate = (d) => ({ x: 0, y: position(d) ?? 0 });\n\n line.lineX = tickSize * (ticksPosition === 'after' ? 1 : -1);\n text.textX = (tickSize + tickPadding) * (ticksPosition === 'after' ? 1 : -1);\n\n if (ticksPosition === 'after') {\n textAlign = 'start';\n } else {\n textAlign = 'end';\n }\n }\n\n const ticks = values.map((value: ScaleValue) => ({\n key: value instanceof Date ? `${value.valueOf()}` : `${value}`,\n value,\n ...translate(value),\n ...line,\n ...text,\n }));\n\n return {\n ticks,\n textAlign,\n textBaseline,\n };\n};\n","import React, { forwardRef, RefObject, useRef } from 'react';\nimport classNames from 'classnames';\n\nimport { Comp, useTheme } from '@redsift/design-system';\n\nimport { AxisProps, AxisPosition, AxisVariant } from './types';\nimport { StyledAxis } from './styles';\nimport { animated, useSpring, useTransition } from '@react-spring/web';\nimport { computeTicks } from './computeTicks';\nimport { config } from '../../config';\nimport { AnyScale } from '../../types';\n\nconst COMPONENT_NAME = 'Axis';\nconst CLASSNAME = 'redsift-axis';\n\nexport const getAxisType = (position: AxisPosition) =>\n [AxisPosition.top, AxisPosition.bottom].includes(position) ? 'x' : 'y';\n\nexport const Axis: Comp<AxisProps, SVGGElement> = forwardRef((props, ref) => {\n const {\n className,\n disableAnimations,\n grid,\n length,\n legend,\n legendOffset = -32,\n legendPosition = 'end',\n legendX: propsLegendX,\n legendY: propsLegendY,\n legendRotation: propsLegendRotation,\n legendStyle,\n position = AxisPosition.bottom,\n scale,\n tickPadding = 5,\n tickRotation = 0,\n tickSize = 5,\n tickValues,\n tickFormat,\n tickRemodelling,\n tickStyle,\n variant = AxisVariant.default,\n x = 0,\n y = 0,\n chartWidth,\n chartHeight,\n sectionHeight,\n textColor,\n tickToColor = () => true,\n ...forwardedProps\n } = props;\n const theme = useTheme();\n const axis = getAxisType(position!);\n const { length: gridLength, ...gridStyle } =\n typeof grid === 'object'\n ? { length: axis === 'x' ? sectionHeight ?? chartHeight : chartWidth, ...grid }\n : grid === true\n ? {\n length: axis === 'x' ? sectionHeight ?? chartHeight : chartWidth,\n }\n : { length: 0 };\n\n const axisRef = (ref || useRef<SVGGElement>()) as RefObject<SVGGElement>;\n\n const animatedProps = useSpring({\n ...config,\n to: async (next: (props?: object) => Promise<void>) => {\n await next({\n lineX2: axis === 'x' ? length : 0,\n lineY2: axis === 'x' ? 0 : length,\n });\n },\n from: { lineX2: 0, lineY2: 0 },\n reset: false,\n });\n\n let legendNode = null;\n if (legend !== undefined) {\n let legendX = 0;\n let legendY = 0;\n let legendRotation = 0;\n let textAnchor;\n\n if (axis === 'y') {\n legendRotation = propsLegendRotation ?? 90;\n legendX = propsLegendX ?? legendOffset!;\n if (legendPosition === 'start') {\n textAnchor = 'start';\n legendY = propsLegendY ?? length!;\n } else if (legendPosition === 'middle') {\n textAnchor = 'middle';\n legendY = propsLegendY ?? length! / 2;\n } else if (legendPosition === 'end') {\n textAnchor = 'end';\n legendY = propsLegendY ?? legendY;\n }\n } else {\n legendY = propsLegendY ?? legendOffset!;\n if (legendPosition === 'start') {\n textAnchor = 'start';\n legendX = propsLegendX ?? legendX;\n } else if (legendPosition === 'middle') {\n textAnchor = 'middle';\n legendX = propsLegendX ?? length! / 2;\n } else if (legendPosition === 'end') {\n textAnchor = 'end';\n legendX = propsLegendX ?? length!;\n }\n }\n\n legendNode = (\n <>\n <text\n transform={`translate(${legendX}, ${legendY}) rotate(${legendRotation})`}\n textAnchor={textAnchor}\n style={{\n dominantBaseline: 'central',\n ...legendStyle,\n }}\n >\n {legend}\n </text>\n </>\n );\n }\n\n const { ticks, textAlign, textBaseline } = computeTicks({\n axis,\n scale: scale as AnyScale,\n ticksPosition: [AxisPosition.top, AxisPosition.left].includes(position!) ? 'before' : 'after',\n tickValues,\n tickSize: tickSize!,\n tickPadding: tickPadding!,\n tickRotation: tickRotation!,\n tickRemodelling,\n });\n\n const transition = useTransition<(typeof ticks)[0], { opacity: number; transform: string; textTransform: string }>(\n ticks,\n {\n ...config,\n keys: (tick) => tick.key,\n initial: (tick) => ({\n opacity: 1,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n from: (tick) => ({\n opacity: 0,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n enter: (tick) => ({\n opacity: 1,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n update: (tick) => ({\n opacity: 1,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n leave: {\n opacity: 0,\n },\n }\n );\n\n const tickStyles = tickStyle ? tickStyle(ticks) : [];\n\n return (\n <StyledAxis\n aria-hidden=\"true\"\n className={classNames(Axis.className, className)}\n $theme={theme}\n {...forwardedProps}\n transform={`translate(${x},${y})${axis === 'x' ? '' : ',rotate(180)'}`}\n ref={axisRef}\n $color={textColor}\n >\n {variant === AxisVariant.default ||\n variant === AxisVariant.tick ||\n variant === AxisVariant.lineTick ||\n variant === AxisVariant.tickValue ||\n grid\n ? transition((transitionProps, tick, _state, tickIndex) => {\n let formattedTickValues = tickFormat ? tickFormat(tick.value as any) : tick.value;\n formattedTickValues = Array.isArray(formattedTickValues) ? formattedTickValues : [formattedTickValues];\n\n return (\n <animated.g\n className={`${Axis.className}__tick`}\n key={tickIndex}\n transform={transitionProps.transform}\n style={{ opacity: transitionProps.opacity }}\n >\n {gridLength ? (\n <line\n className={`${Axis.className}-grid__line`}\n x1={axis === 'x' ? tick.lineX : 0}\n x2={axis === 'x' ? tick.lineX : gridLength! * (position === 'right' ? -1 : 1)}\n y1={axis === 'x' ? 0 : tick.lineY}\n y2={axis === 'x' ? gridLength! * (position === 'bottom' ? -1 : 1) : tick.lineY}\n style={{\n strokeDasharray: '4,4',\n opacity: 0.2,\n ...gridStyle,\n strokeWidth:\n tickStyles && tickStyles.length > 0\n ? tickStyles[tickIndex]?.gridStrokeWidth || 0.5\n : gridStyle.strokeWidth || 0.5,\n stroke:\n tickStyles && tickStyles.length > 0\n ? tickStyles[tickIndex]?.gridStroke || 'currentColor'\n : gridStyle.stroke || 'currentColor',\n }}\n />\n ) : null}\n <line\n className={`${Axis.className}-tick__line`}\n x1={0}\n x2={tick.lineX}\n y1={0}\n y2={tick.lineY}\n style={{\n strokeWidth: tickStyles && tickStyles.length > 0 ? tickStyles[tickIndex]?.strokeWidth : 1,\n }}\n />\n {variant === AxisVariant.default || variant === AxisVariant.tickValue\n ? (formattedTickValues as string[]).map((value, index) => (\n <animated.text\n key={value}\n dominantBaseline={textBaseline}\n textAnchor={textAlign}\n transform={`translate(${tick.textX},${tick.textY + 14 * index}),rotate(${tickRotation})`}\n className={!textColor ? '' : tickToColor(tick, tickIndex) ? 'colored' : ''}\n >\n {value}\n </animated.text>\n ))\n : null}\n </animated.g>\n );\n })\n : null}\n\n {variant === AxisVariant.default || variant === AxisVariant.line || variant === AxisVariant.lineTick ? (\n <animated.line\n className={`${Axis.className}__line`}\n x1={0}\n x2={config.immediate || disableAnimations ? (axis === 'x' ? length : 0) : animatedProps.lineX2}\n y1={0}\n y2={config.immediate || disableAnimations ? (axis === 'x' ? 0 : length) : animatedProps.lineY2}\n />\n ) : null}\n {legendNode}\n </StyledAxis>\n );\n});\nAxis.className = CLASSNAME;\nAxis.displayName = COMPONENT_NAME;\n"],"names":["AxisVariant","none","line","lineTick","tick","tickValue","default","AxisPosition","top","right","bottom","left","StyledAxis","styled","animated","g","_ref","$theme","css","Theme","dark","_ref2","_ref3","$color","getScaleTicks","scale","spec","Array","isArray","undefined","ticks","isFinite","Math","floor","domain","centerScale","bandwidth","offset","round","d","_scale","computeTicks","axis","ticksPosition","tickValues","tickSize","tickPadding","tickRotation","tickRemodelling","values","position","lineX","lineY","text","textX","textY","isRTL","document","dir","translate","textAlign","textBaseline","_position","x","y","_position2","map","value","_objectSpread","key","Date","valueOf","COMPONENT_NAME","CLASSNAME","getAxisType","includes","Axis","forwardRef","props","ref","className","disableAnimations","grid","length","legend","legendOffset","legendPosition","legendX","propsLegendX","legendY","propsLegendY","legendRotation","propsLegendRotation","legendStyle","tickFormat","tickStyle","variant","chartWidth","chartHeight","sectionHeight","textColor","tickToColor","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","gridLength","gridStyle","_excluded2","axisRef","useRef","animatedProps","useSpring","config","to","next","lineX2","lineY2","from","reset","legendNode","textAnchor","React","createElement","Fragment","transform","style","dominantBaseline","transition","useTransition","keys","initial","opacity","textTransform","enter","update","leave","tickStyles","_extends","classNames","transitionProps","_state","tickIndex","_tickStyles$tickIndex","_tickStyles$tickIndex2","_tickStyles$tickIndex3","formattedTickValues","x1","x2","y1","y2","strokeDasharray","strokeWidth","gridStrokeWidth","stroke","gridStroke","index","immediate","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,WAAW,GAAG;AACzBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,OAAO,EAAE,SAAA;AACX,EAAU;AAGH,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,IAAI,EAAE,MAAA;AACR,EAAC;;AAGD;AACA;AACA;;ACtBA;AACA;AACA;AACO,MAAMC,UAAU,GAAGC,MAAM,CAACC,EAAQ,CAACC,CAAC,CAAmB,CAAA;AAC9D;AACA;AACA;AACA,IAAA,EAAMC,IAAA,IAAA;EAAA,IAAC;AAAE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AACZ,IAAI,EAAA;AACZ8E,IAAAA,SAAS,EAAG,CAAA,EAAEJ,IAAI,CAACI,SAAU,CAAQ,MAAA,CAAA;AACrCoE,IAAAA,EAAE,EAAE,CAAE;AACNC,IAAAA,EAAE,EAAEnC,MAAM,CAAC4C,SAAS,IAAI7E,iBAAiB,GAAIvC,IAAI,KAAK,GAAG,GAAGyC,MAAM,GAAG,CAAC,GAAI6B,aAAa,CAACK,MAAO;AAC/FiC,IAAAA,EAAE,EAAE,CAAE;AACNC,IAAAA,EAAE,EAAErC,MAAM,CAAC4C,SAAS,IAAI7E,iBAAiB,GAAIvC,IAAI,KAAK,GAAG,GAAG,CAAC,GAAGyC,MAAM,GAAI6B,aAAa,CAACM,MAAAA;AAAO,GAChG,CAAC,GACA,IAAI,EACPG,UACS,CAAC,CAAA;AAEjB,CAAC,EAAC;AACF7C,IAAI,CAACI,SAAS,GAAGP,SAAS,CAAA;AAC1BG,IAAI,CAACmF,WAAW,GAAGvF,cAAc;;;;"}
|
|
1
|
+
{"version":3,"file":"Axis2.js","sources":["../../src/components/Axis/types.ts","../../src/components/Axis/styles.ts","../../src/components/Axis/computeTicks.ts","../../src/components/Axis/Axis.tsx"],"sourcesContent":["import { ComponentProps } from 'react';\nimport { ValueOf, Theme } from '@redsift/design-system';\nimport { AnyScale, NumericValue, ScaleValue, StringValue, TicksSpec } from '../../types';\n\n/**\n * Component variant.\n */\nexport const AxisVariant = {\n none: 'none',\n line: 'line',\n lineTick: 'lineTick',\n tick: 'tick',\n tickValue: 'tickValue',\n default: 'default',\n} as const;\nexport type AxisVariant = ValueOf<typeof AxisVariant>;\n\nexport const AxisPosition = {\n top: 'top',\n right: 'right',\n bottom: 'bottom',\n left: 'left',\n};\nexport type AxisPosition = ValueOf<typeof AxisPosition>;\n\n/**\n * Component props.\n */\nexport interface AxisProps extends Omit<ComponentProps<'g'>, 'scale'> {\n /** Disable animations. */\n disableAnimations?: boolean;\n format?: string;\n /** Whether to display grid or not. The length is mandatory and should usually be the length of the other axis. */\n grid?:\n | boolean\n | {\n length?: number;\n stroke?: string;\n strokeWidth?: number;\n strokeDasharray?: string;\n opacity?: number;\n };\n legend?: string;\n legendOffset?: number;\n legendPosition?: 'start' | 'middle' | 'end';\n legendX?: number;\n legendY?: number;\n legendRotation?: number;\n legendStyle?: React.CSSProperties;\n /** Length of the axis. */\n length?: number;\n /** Position of axis. top|bottom means this is an x axis, right|left means this is an y axis. */\n position?: AxisPosition;\n /** Scale (d3.js) used to generate the axis. */\n scale?: AnyScale;\n tickFormat?:\n | ((d: NumericValue) => string | string[])\n | ((d: StringValue) => string | string[])\n | ((d: Date) => string | string[])\n | ((d: ScaleValue) => string | string[]);\n tickPadding?: number;\n tickRotation?: number;\n tickSize?: number;\n tickStyle?: (ticks: any[]) => {\n strokeWidth?: number;\n gridStrokeWidth?: number;\n gridStroke?: string;\n }[];\n tickValues?: TicksSpec;\n tickRemodelling?: (tickValues: any[]) => any[];\n /** Variant. */\n variant?: AxisVariant;\n /** X position. */\n x?: number;\n /** Y position. */\n y?: number;\n /** Chart width, used for horizontal grid. */\n chartWidth?: number;\n /** Chart height, used for horizontal grid. */\n chartHeight?: number;\n /** Section height, used for horizontal grid within a section. */\n sectionHeight?: number;\n /** Color used for tick values. */\n textColor?: string;\n /** Custom method to choose which tick value to color if not all. */\n tickToColor?: (\n tick?: {\n textX: number;\n textY: number;\n lineX: number;\n lineY: number;\n x: number;\n y: number;\n key: string;\n value: ScaleValue;\n },\n index?: number\n ) => boolean;\n}\n\nexport type StyledAxisProps = Omit<AxisProps, 'areXLabelsRotated' | 'size' | 'scale'> & {\n $theme: Theme;\n $color?: string;\n};\n","import styled, { css } from 'styled-components';\nimport { StyledAxisProps } from './types';\nimport { animated } from '@react-spring/web';\nimport { Theme } from '@redsift/design-system';\n\n/**\n * Component style.\n */\nexport const StyledAxis = styled(animated.g)<StyledAxisProps>`\n .redsift-axis__line,\n .redsift-axis-tick__line {\n fill: none;\n ${({ $theme }) => css`\n stroke: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n shape-rendering: crispEdges;\n }\n\n text {\n font-family: var(--redsift-typography-font-family-poppins);\n ${({ $theme }) => css`\n fill: var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'});\n `}\n font-size: 10px;\n user-select: none;\n }\n\n text.colored {\n ${({ $theme, $color }) => css`\n fill: ${$color === 'green'\n ? '#029B57'\n : $color === 'red'\n ? '#CB0E0E'\n : `var(--redsift-color-neutral-${$theme === Theme.dark ? 'white' : 'x-dark-grey'})`};\n `}\n }\n`;\n","import type { SVGProps } from 'react';\nimport { AnyScale, Coordinates, ScaleValue, ScaleWithBandwidth, TicksSpec } from '../../types';\n\nconst getScaleTicks = (scale: AnyScale, spec?: TicksSpec) => {\n // specific values\n if (Array.isArray(spec)) {\n return spec;\n }\n\n // continuous scales\n if ('ticks' in scale) {\n // default behaviour\n if (spec === undefined) {\n return scale.ticks();\n }\n\n // specific tick count\n if (typeof spec === 'number' && isFinite(spec) && Math.floor(spec) === spec) {\n return scale.ticks(spec);\n }\n\n if (typeof spec === 'function') {\n return scale.ticks();\n }\n }\n\n // non linear scale default\n return scale.domain();\n};\n\nexport const centerScale = (scale: ScaleWithBandwidth) => {\n const bandwidth = scale.bandwidth();\n\n if (bandwidth === 0) return scale;\n\n let offset = bandwidth / 2;\n if (scale.round()) {\n offset = Math.round(offset);\n }\n\n return <T extends ScaleValue>(d: T) => (scale(d) ?? 0) + offset;\n};\n\nexport const computeTicks = ({\n axis,\n scale,\n ticksPosition,\n tickValues,\n tickSize,\n tickPadding,\n tickRotation,\n tickRemodelling,\n}: {\n axis: 'x' | 'y';\n scale: AnyScale;\n ticksPosition?: 'after' | 'before';\n tickValues?: TicksSpec;\n tickSize: number;\n tickPadding: number;\n tickRotation: number;\n tickRemodelling?: (tickValues: any[]) => any[];\n}) => {\n const values = tickRemodelling ? tickRemodelling(getScaleTicks(scale, tickValues)) : getScaleTicks(scale, tickValues);\n\n const position = 'bandwidth' in scale ? centerScale(scale) : scale;\n const line = { lineX: 0, lineY: 0 };\n const text = { textX: 0, textY: 0 };\n\n const isRTL = typeof document === 'object' ? document.dir === 'rtl' : false;\n let translate: (value: ScaleValue) => Coordinates;\n let textAlign: SVGProps<SVGTextElement>['textAnchor'] = 'middle';\n let textBaseline: SVGProps<SVGTextElement>['dominantBaseline'] = 'central';\n\n if (axis === 'x') {\n translate = (d) => ({ x: position(d) ?? 0, y: 0 });\n\n line.lineY = tickSize * (ticksPosition === 'after' ? 1 : -1);\n text.textY = (tickSize + tickPadding) * (ticksPosition === 'after' ? 1 : -1);\n\n if (ticksPosition === 'after') {\n textBaseline = 'text-before-edge';\n } else {\n textBaseline = 'alphabetic';\n }\n\n if (tickRotation === 0) {\n textAlign = 'middle';\n } else if ((ticksPosition === 'after' && tickRotation < 0) || (ticksPosition === 'before' && tickRotation > 0)) {\n textAlign = isRTL ? 'start' : 'end';\n textBaseline = 'middle';\n } else if ((ticksPosition === 'after' && tickRotation > 0) || (ticksPosition === 'before' && tickRotation < 0)) {\n textAlign = isRTL ? 'end' : 'start';\n textBaseline = 'middle';\n }\n } else {\n translate = (d) => ({ x: 0, y: position(d) ?? 0 });\n\n line.lineX = tickSize * (ticksPosition === 'after' ? 1 : -1);\n text.textX = (tickSize + tickPadding) * (ticksPosition === 'after' ? 1 : -1);\n\n if (ticksPosition === 'after') {\n textAlign = 'start';\n } else {\n textAlign = 'end';\n }\n }\n\n const ticks = values.map((value: ScaleValue) => ({\n key: value instanceof Date ? `${value.valueOf()}` : `${value}`,\n value,\n ...translate(value),\n ...line,\n ...text,\n }));\n\n return {\n ticks,\n textAlign,\n textBaseline,\n };\n};\n","import React, { forwardRef, RefObject, useRef } from 'react';\nimport classNames from 'classnames';\n\nimport { Comp, useTheme } from '@redsift/design-system';\n\nimport { AxisProps, AxisPosition, AxisVariant } from './types';\nimport { StyledAxis } from './styles';\nimport { animated, useSpring, useTransition } from '@react-spring/web';\nimport { computeTicks } from './computeTicks';\nimport { config } from '../../config';\nimport { AnyScale } from '../../types';\n\nconst COMPONENT_NAME = 'Axis';\nconst CLASSNAME = 'redsift-axis';\n\nexport const getAxisType = (position: AxisPosition) =>\n [AxisPosition.top, AxisPosition.bottom].includes(position) ? 'x' : 'y';\n\nexport const Axis: Comp<AxisProps, SVGGElement> = forwardRef((props, ref) => {\n const {\n className,\n disableAnimations,\n grid,\n length,\n legend,\n legendOffset = -32,\n legendPosition = 'end',\n legendX: propsLegendX,\n legendY: propsLegendY,\n legendRotation: propsLegendRotation,\n legendStyle,\n position = AxisPosition.bottom,\n scale,\n tickPadding = 5,\n tickRotation = 0,\n tickSize = 5,\n tickValues,\n tickFormat,\n tickRemodelling,\n tickStyle,\n variant = AxisVariant.default,\n x = 0,\n y = 0,\n chartWidth,\n chartHeight,\n sectionHeight,\n textColor,\n tickToColor = () => true,\n ...forwardedProps\n } = props;\n const theme = useTheme();\n const axis = getAxisType(position!);\n const { length: gridLength, ...gridStyle } =\n typeof grid === 'object'\n ? { length: axis === 'x' ? sectionHeight ?? chartHeight : chartWidth, ...grid }\n : grid === true\n ? {\n length: axis === 'x' ? sectionHeight ?? chartHeight : chartWidth,\n }\n : { length: 0 };\n\n const axisRef = (ref || useRef<SVGGElement>(undefined)) as RefObject<SVGGElement>;\n\n const animatedProps = useSpring({\n ...config,\n to: async (next: (props?: object) => Promise<void>) => {\n await next({\n lineX2: axis === 'x' ? length : 0,\n lineY2: axis === 'x' ? 0 : length,\n });\n },\n from: { lineX2: 0, lineY2: 0 },\n reset: false,\n });\n\n let legendNode = null;\n if (legend !== undefined) {\n let legendX = 0;\n let legendY = 0;\n let legendRotation = 0;\n let textAnchor: React.SVGProps<SVGTextElement>['textAnchor'];\n\n if (axis === 'y') {\n legendRotation = propsLegendRotation ?? 90;\n legendX = propsLegendX ?? legendOffset!;\n if (legendPosition === 'start') {\n textAnchor = 'start';\n legendY = propsLegendY ?? length!;\n } else if (legendPosition === 'middle') {\n textAnchor = 'middle';\n legendY = propsLegendY ?? length! / 2;\n } else if (legendPosition === 'end') {\n textAnchor = 'end';\n legendY = propsLegendY ?? legendY;\n }\n } else {\n legendY = propsLegendY ?? legendOffset!;\n if (legendPosition === 'start') {\n textAnchor = 'start';\n legendX = propsLegendX ?? legendX;\n } else if (legendPosition === 'middle') {\n textAnchor = 'middle';\n legendX = propsLegendX ?? length! / 2;\n } else if (legendPosition === 'end') {\n textAnchor = 'end';\n legendX = propsLegendX ?? length!;\n }\n }\n\n legendNode = (\n <>\n <text\n transform={`translate(${legendX}, ${legendY}) rotate(${legendRotation})`}\n textAnchor={textAnchor}\n style={{\n dominantBaseline: 'central',\n ...legendStyle,\n }}\n >\n {legend}\n </text>\n </>\n );\n }\n\n const { ticks, textAlign, textBaseline } = computeTicks({\n axis,\n scale: scale as AnyScale,\n ticksPosition: [AxisPosition.top, AxisPosition.left].includes(position!) ? 'before' : 'after',\n tickValues,\n tickSize: tickSize!,\n tickPadding: tickPadding!,\n tickRotation: tickRotation!,\n tickRemodelling,\n });\n\n const transition = useTransition<(typeof ticks)[0], { opacity: number; transform: string; textTransform: string }>(\n ticks,\n {\n ...config,\n keys: (tick) => tick.key,\n initial: (tick) => ({\n opacity: 1,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n from: (tick) => ({\n opacity: 0,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n enter: (tick) => ({\n opacity: 1,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n update: (tick) => ({\n opacity: 1,\n transform: `translate(${tick.x},${axis === 'x' ? tick.y : (y || 0) - tick.y}),rotate(${\n axis === 'x' ? 0 : 180\n })`,\n textTransform: `translate(${tick.textX},${tick.textY}),rotate(${tickRotation})`,\n }),\n leave: {\n opacity: 0,\n },\n }\n );\n\n const tickStyles = tickStyle ? tickStyle(ticks) : [];\n\n return (\n <StyledAxis\n aria-hidden=\"true\"\n className={classNames(Axis.className, className)}\n $theme={theme}\n {...forwardedProps}\n transform={`translate(${x},${y})${axis === 'x' ? '' : ',rotate(180)'}`}\n ref={axisRef}\n $color={textColor}\n >\n {variant === AxisVariant.default ||\n variant === AxisVariant.tick ||\n variant === AxisVariant.lineTick ||\n variant === AxisVariant.tickValue ||\n grid\n ? transition((transitionProps, tick, _state, tickIndex) => {\n let formattedTickValues = tickFormat ? tickFormat(tick.value as any) : tick.value;\n formattedTickValues = Array.isArray(formattedTickValues) ? formattedTickValues : [formattedTickValues];\n\n return (\n <animated.g\n className={`${Axis.className}__tick`}\n key={tickIndex}\n transform={transitionProps.transform}\n style={{ opacity: transitionProps.opacity }}\n >\n {gridLength ? (\n <line\n className={`${Axis.className}-grid__line`}\n x1={axis === 'x' ? tick.lineX : 0}\n x2={axis === 'x' ? tick.lineX : gridLength! * (position === 'right' ? -1 : 1)}\n y1={axis === 'x' ? 0 : tick.lineY}\n y2={axis === 'x' ? gridLength! * (position === 'bottom' ? -1 : 1) : tick.lineY}\n style={{\n strokeDasharray: '4,4',\n opacity: 0.2,\n ...gridStyle,\n strokeWidth:\n tickStyles && tickStyles.length > 0\n ? tickStyles[tickIndex]?.gridStrokeWidth || 0.5\n : gridStyle.strokeWidth || 0.5,\n stroke:\n tickStyles && tickStyles.length > 0\n ? tickStyles[tickIndex]?.gridStroke || 'currentColor'\n : gridStyle.stroke || 'currentColor',\n }}\n />\n ) : null}\n <line\n className={`${Axis.className}-tick__line`}\n x1={0}\n x2={tick.lineX}\n y1={0}\n y2={tick.lineY}\n style={{\n strokeWidth: tickStyles && tickStyles.length > 0 ? tickStyles[tickIndex]?.strokeWidth : 1,\n }}\n />\n {variant === AxisVariant.default || variant === AxisVariant.tickValue\n ? (formattedTickValues as string[]).map((value, index) => (\n <animated.text\n key={value}\n dominantBaseline={textBaseline}\n textAnchor={textAlign}\n transform={`translate(${tick.textX},${tick.textY + 14 * index}),rotate(${tickRotation})`}\n className={!textColor ? '' : tickToColor(tick, tickIndex) ? 'colored' : ''}\n >\n {value}\n </animated.text>\n ))\n : null}\n </animated.g>\n );\n })\n : null}\n\n {variant === AxisVariant.default || variant === AxisVariant.line || variant === AxisVariant.lineTick ? (\n <animated.line\n className={`${Axis.className}__line`}\n x1={0}\n x2={config.immediate || disableAnimations ? (axis === 'x' ? length : 0) : animatedProps.lineX2}\n y1={0}\n y2={config.immediate || disableAnimations ? (axis === 'x' ? 0 : length) : animatedProps.lineY2}\n />\n ) : null}\n {legendNode}\n </StyledAxis>\n );\n});\nAxis.className = CLASSNAME;\nAxis.displayName = COMPONENT_NAME;\n"],"names":["AxisVariant","none","line","lineTick","tick","tickValue","default","AxisPosition","top","right","bottom","left","StyledAxis","styled","animated","g","_ref","$theme","css","Theme","dark","_ref2","_ref3","$color","getScaleTicks","scale","spec","Array","isArray","undefined","ticks","isFinite","Math","floor","domain","centerScale","bandwidth","offset","round","d","_scale","computeTicks","axis","ticksPosition","tickValues","tickSize","tickPadding","tickRotation","tickRemodelling","values","position","lineX","lineY","text","textX","textY","isRTL","document","dir","translate","textAlign","textBaseline","_position","x","y","_position2","map","value","_objectSpread","key","Date","valueOf","COMPONENT_NAME","CLASSNAME","getAxisType","includes","Axis","forwardRef","props","ref","className","disableAnimations","grid","length","legend","legendOffset","legendPosition","legendX","propsLegendX","legendY","propsLegendY","legendRotation","propsLegendRotation","legendStyle","tickFormat","tickStyle","variant","chartWidth","chartHeight","sectionHeight","textColor","tickToColor","forwardedProps","_objectWithoutProperties","_excluded","theme","useTheme","gridLength","gridStyle","_excluded2","axisRef","useRef","animatedProps","useSpring","config","to","next","lineX2","lineY2","from","reset","legendNode","textAnchor","React","createElement","Fragment","transform","style","dominantBaseline","transition","useTransition","keys","initial","opacity","textTransform","enter","update","leave","tickStyles","_extends","classNames","transitionProps","_state","tickIndex","_tickStyles$tickIndex","_tickStyles$tickIndex2","_tickStyles$tickIndex3","formattedTickValues","x1","x2","y1","y2","strokeDasharray","strokeWidth","gridStrokeWidth","stroke","gridStroke","index","immediate","displayName"],"mappings":";;;;;;;;AAIA;AACA;AACA;AACO,MAAMA,WAAW,GAAG;AACzBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,QAAQ,EAAE,UAAU;AACpBC,EAAAA,IAAI,EAAE,MAAM;AACZC,EAAAA,SAAS,EAAE,WAAW;AACtBC,EAAAA,OAAO,EAAE,SAAA;AACX,EAAU;AAGH,MAAMC,YAAY,GAAG;AAC1BC,EAAAA,GAAG,EAAE,KAAK;AACVC,EAAAA,KAAK,EAAE,OAAO;AACdC,EAAAA,MAAM,EAAE,QAAQ;AAChBC,EAAAA,IAAI,EAAE,MAAA;AACR,EAAC;;AAGD;AACA;AACA;;ACtBA;AACA;AACA;AACO,MAAMC,UAAU,GAAGC,MAAM,CAACC,QAAQ,CAACC,CAAC,CAAmB,CAAA;AAC9D;AACA;AACA;AACA,IAAA,EAAMC,IAAA,IAAA;EAAA,IAAC;AAAEC,IAAAA,MAAAA;AAAO,GAAC,GAAAD,IAAA,CAAA;AAAA,EAAA,OAAKE,GAAI,CAAA;AAC1B,0CAA4CD,EAAAA,MAAM,KAAKE,KAAK,CAACC,IAAI,GAAG,OAAO,GAAG,aAAc,CAAA;AAC5F,IAAK,CAAA,CAAA;AAAA,CAAC,CAAA;AACN;AACA;AACA;AACA;AACA;AACA,IAAA,EAAMC,KAAA,IAAA;EAAA,IAAC;AAAEJ,IAAAA,MAAAA;AAAO,GAAC,GAAAI,KAAA,CAAA;AAAA,EAAA,OAAKH,GAAI,CAAA;AAC1B,wC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4C,SAAS,IAAI7E,iBAAiB,GAAIvC,IAAI,KAAK,GAAG,GAAG,CAAC,GAAGyC,MAAM,GAAI6B,aAAa,CAACM,MAAAA;AAAO,GAChG,CAAC,GACA,IAAI,EACPG,UACS,CAAC,CAAA;AAEjB,CAAC,EAAC;AACF7C,IAAI,CAACI,SAAS,GAAGP,SAAS,CAAA;AAC1BG,IAAI,CAACmF,WAAW,GAAGvF,cAAc;;;;"}
|
package/_internal/Bar2.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 { Theme, useTheme } from '@redsift/design-system';
|
|
7
7
|
import styled, { css } from 'styled-components';
|
|
@@ -131,7 +131,7 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
131
131
|
const isHorizontal = orientation === BarOrientation.horizontal;
|
|
132
132
|
const goesUp = direction === BarDirection.up;
|
|
133
133
|
const isOrdinal = typeof scalePosition.domain()[0] === 'string';
|
|
134
|
-
const animatedProps =
|
|
134
|
+
const animatedProps = useSpring(_objectSpread2(_objectSpread2({}, config), {}, {
|
|
135
135
|
to: async next => {
|
|
136
136
|
await next({
|
|
137
137
|
t: 1
|
|
@@ -142,21 +142,21 @@ const Bar = /*#__PURE__*/forwardRef((props, ref) => {
|
|
|
142
142
|
}
|
|
143
143
|
}));
|
|
144
144
|
const computedWidth = minWidth ? Math.max(minWidth, width) : width;
|
|
145
|
-
return /*#__PURE__*/
|
|
145
|
+
return /*#__PURE__*/React.createElement(StyledBar, _extends({}, forwardedProps, {
|
|
146
146
|
ref: ref,
|
|
147
147
|
className: classNames(Bar.className, className),
|
|
148
148
|
transform: isHorizontal ? `translate(0, ${scalePosition(data.data.key) + gap / 2})` : `translate(${goesUp ? scalePosition(data.data.key) + (isOrdinal ? computedWidth + gap / 2 : computedWidth / 2) : scalePosition(data.data.key) + (isOrdinal ? -computedWidth + gap / 2 : -computedWidth / 2)}, ${maxHeight})${goesUp ? ', rotate(180)' : ''}`,
|
|
149
149
|
$clickable: Boolean(onClick),
|
|
150
150
|
$theme: theme
|
|
151
|
-
}), isHorizontal ? /*#__PURE__*/
|
|
151
|
+
}), isHorizontal ? /*#__PURE__*/React.createElement(animated.rect, {
|
|
152
152
|
height: height,
|
|
153
153
|
fill: isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color,
|
|
154
154
|
width: config.immediate || disableAnimations ? scale(data.data.value) : animatedProps.t.to(t => scale(interpolator(t)))
|
|
155
|
-
}) : /*#__PURE__*/
|
|
155
|
+
}) : /*#__PURE__*/React.createElement(animated.rect, {
|
|
156
156
|
height: config.immediate || disableAnimations ? goesUp ? maxHeight - scale(getValue(data.data)) : scale(getValue(data.data)) - maxHeight : animatedProps.t.to(t => Math.max(0, goesUp ? maxHeight - scale(interpolator(t)) : scale(interpolator(t)) - maxHeight)),
|
|
157
157
|
fill: isDeselected ? 'var(--redsift-color-neutral-light-grey)' : color,
|
|
158
158
|
width: computedWidth
|
|
159
|
-
}), isHorizontal ? /*#__PURE__*/
|
|
159
|
+
}), isHorizontal ? /*#__PURE__*/React.createElement("text", {
|
|
160
160
|
x: "10",
|
|
161
161
|
y: height / 2,
|
|
162
162
|
dy: "0.35em",
|