@sb1/ffe-chart-donut-react 3.0.4 → 5.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.
package/README.md CHANGED
@@ -9,8 +9,5 @@ npm install --save @sb1/ffe-chart-donut-react
9
9
  ## Usage
10
10
 
11
11
  ```css
12
- @import 'path/to/node_modules/@sb1/ffe-chart-donut-react/lib/ffe-chart-donut';
12
+ @import 'path/to/node_modules/@sb1/ffe-chart-donut-react/less/ffe-chart-donut';
13
13
  ```
14
-
15
- Run Styleguidist from the repository root to see live examples and documentation,
16
- or see the markdown files next to the component code in `src/`.
package/es/ChartDonut.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { number, string } from 'prop-types';
2
+ import { node, number, string } from 'prop-types';
3
3
  var NON_BREAKING_SPACE = "\xA0";
4
4
  var RADIUS = 150;
5
5
  var CIRCUMFERENCE = 2 * Math.PI * RADIUS;
@@ -8,7 +8,8 @@ function ChartDonut(_ref) {
8
8
  var name = _ref.name,
9
9
  percentage = _ref.percentage,
10
10
  firstLabel = _ref.firstLabel,
11
- lastLabel = _ref.lastLabel;
11
+ lastLabel = _ref.lastLabel,
12
+ label = _ref.label;
12
13
  var offset = CIRCUMFERENCE - CIRCUMFERENCE / 100 * percentage;
13
14
  /*
14
15
  The rendered circle consists of two half-circles with a gap between them.
@@ -29,7 +30,7 @@ function ChartDonut(_ref) {
29
30
  transform: "scale(-1, 1) rotate(".concat(percentage ? 275 : -90, "deg)")
30
31
  }
31
32
  }, percentage < 95.7 && /*#__PURE__*/React.createElement("circle", {
32
- className: "ffe-chart-donut--cobalt",
33
+ className: "ffe-chart-donut--vann",
33
34
  fill: "none",
34
35
  strokeWidth: "15",
35
36
  strokeLinecap: "round",
@@ -47,7 +48,7 @@ function ChartDonut(_ref) {
47
48
  transform: "rotate(".concat(percentage ? -85 : -90, "deg)")
48
49
  }
49
50
  }, percentage > 3.2 && /*#__PURE__*/React.createElement("circle", {
50
- className: "ffe-chart-donut--sky",
51
+ className: "ffe-chart-donut--frost",
51
52
  fill: "none",
52
53
  strokeWidth: "15",
53
54
  strokeLinecap: "round",
@@ -62,29 +63,32 @@ function ChartDonut(_ref) {
62
63
  className: "ffe-chart-donut__description"
63
64
  }, /*#__PURE__*/React.createElement("div", {
64
65
  className: "ffe-chart-donut__name ffe-strong-text"
65
- }, name), /*#__PURE__*/React.createElement("div", {
66
+ }, name), firstLabel && lastLabel && /*#__PURE__*/React.createElement("div", {
66
67
  className: "ffe-chart-donut__fractions"
67
68
  }, /*#__PURE__*/React.createElement("div", {
68
- className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--cobalt"
69
+ className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--vann"
69
70
  }, /*#__PURE__*/React.createElement("div", {
70
71
  className: "ffe-chart-donut__amount ffe-strong-text"
71
72
  }, "".concat(Number(100 - percentage).toFixed(0)).concat(NON_BREAKING_SPACE, "%")), /*#__PURE__*/React.createElement("div", {
72
73
  className: "ffe-chart-donut__type ffe-micro-text"
73
74
  }, firstLabel)), /*#__PURE__*/React.createElement("div", {
74
- className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--sky"
75
+ className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--frost"
75
76
  }, /*#__PURE__*/React.createElement("div", {
76
77
  className: "ffe-chart-donut__amount ffe-strong-text"
77
78
  }, "".concat(Number(percentage).toFixed(0)).concat(NON_BREAKING_SPACE, "%")), /*#__PURE__*/React.createElement("div", {
78
79
  className: "ffe-chart-donut__type ffe-micro-text"
79
- }, lastLabel)))));
80
+ }, lastLabel))), !firstLabel && !lastLabel && label));
80
81
  }
81
82
 
82
83
  ChartDonut.propTypes = {
83
84
  /** Short text labeling left value, like "empty", "said yes" etc */
84
- firstLabel: string.isRequired,
85
+ firstLabel: string,
85
86
 
86
87
  /** Short text labeling right value, like "full", "said no" etc */
87
- lastLabel: string.isRequired,
88
+ lastLabel: string,
89
+
90
+ /** React node to be inserted directly under the chart's name, alternative to first/last label */
91
+ label: node,
88
92
 
89
93
  /** Short text labeling the graph in total, like "percentage", "voted this year" etc */
90
94
  name: string.isRequired,
@@ -4,12 +4,12 @@
4
4
  text-align: left;
5
5
  width: 200px;
6
6
 
7
- &--cobalt {
8
- stroke: @ffe-blue-cobalt;
7
+ &--vann {
8
+ stroke: @ffe-farge-vann;
9
9
  }
10
10
 
11
- &--sky {
12
- stroke: @ffe-blue-sky;
11
+ &--frost {
12
+ stroke: @ffe-farge-frost-70;
13
13
  }
14
14
 
15
15
  &__circle {
@@ -36,8 +36,14 @@
36
36
  }
37
37
 
38
38
  &__name {
39
- color: @ffe-grey-charcoal;
39
+ color: @ffe-farge-koksgraa;
40
40
  text-align: center;
41
+
42
+ .native & {
43
+ @media (prefers-color-scheme: dark) {
44
+ color: @ffe-farge-graa;
45
+ }
46
+ }
41
47
  }
42
48
 
43
49
  &__fractions {
@@ -47,8 +53,14 @@
47
53
 
48
54
  &__fraction {
49
55
  > .ffe-chart-donut__amount {
50
- color: @ffe-grey-charcoal;
56
+ color: @ffe-farge-koksgraa;
51
57
  text-align: center;
58
+
59
+ .native & {
60
+ @media (prefers-color-scheme: dark) {
61
+ color: @ffe-farge-graa;
62
+ }
63
+ }
52
64
  }
53
65
 
54
66
  &:last-child {
@@ -57,7 +69,7 @@
57
69
  }
58
70
 
59
71
  > .ffe-chart-donut__amount {
60
- border-left: 1px solid @ffe-grey;
72
+ border-left: 1px solid @ffe-farge-graa;
61
73
  padding-left: 20px;
62
74
  }
63
75
  }
package/lib/ChartDonut.js CHANGED
@@ -19,7 +19,8 @@ function ChartDonut(_ref) {
19
19
  var name = _ref.name,
20
20
  percentage = _ref.percentage,
21
21
  firstLabel = _ref.firstLabel,
22
- lastLabel = _ref.lastLabel;
22
+ lastLabel = _ref.lastLabel,
23
+ label = _ref.label;
23
24
  var offset = CIRCUMFERENCE - CIRCUMFERENCE / 100 * percentage;
24
25
  /*
25
26
  The rendered circle consists of two half-circles with a gap between them.
@@ -40,7 +41,7 @@ function ChartDonut(_ref) {
40
41
  transform: "scale(-1, 1) rotate(".concat(percentage ? 275 : -90, "deg)")
41
42
  }
42
43
  }, percentage < 95.7 && /*#__PURE__*/_react.default.createElement("circle", {
43
- className: "ffe-chart-donut--cobalt",
44
+ className: "ffe-chart-donut--vann",
44
45
  fill: "none",
45
46
  strokeWidth: "15",
46
47
  strokeLinecap: "round",
@@ -58,7 +59,7 @@ function ChartDonut(_ref) {
58
59
  transform: "rotate(".concat(percentage ? -85 : -90, "deg)")
59
60
  }
60
61
  }, percentage > 3.2 && /*#__PURE__*/_react.default.createElement("circle", {
61
- className: "ffe-chart-donut--sky",
62
+ className: "ffe-chart-donut--frost",
62
63
  fill: "none",
63
64
  strokeWidth: "15",
64
65
  strokeLinecap: "round",
@@ -73,29 +74,32 @@ function ChartDonut(_ref) {
73
74
  className: "ffe-chart-donut__description"
74
75
  }, /*#__PURE__*/_react.default.createElement("div", {
75
76
  className: "ffe-chart-donut__name ffe-strong-text"
76
- }, name), /*#__PURE__*/_react.default.createElement("div", {
77
+ }, name), firstLabel && lastLabel && /*#__PURE__*/_react.default.createElement("div", {
77
78
  className: "ffe-chart-donut__fractions"
78
79
  }, /*#__PURE__*/_react.default.createElement("div", {
79
- className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--cobalt"
80
+ className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--vann"
80
81
  }, /*#__PURE__*/_react.default.createElement("div", {
81
82
  className: "ffe-chart-donut__amount ffe-strong-text"
82
83
  }, "".concat(Number(100 - percentage).toFixed(0)).concat(NON_BREAKING_SPACE, "%")), /*#__PURE__*/_react.default.createElement("div", {
83
84
  className: "ffe-chart-donut__type ffe-micro-text"
84
85
  }, firstLabel)), /*#__PURE__*/_react.default.createElement("div", {
85
- className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--sky"
86
+ className: "ffe-chart-donut__fraction ffe-chart-donut__fraction--frost"
86
87
  }, /*#__PURE__*/_react.default.createElement("div", {
87
88
  className: "ffe-chart-donut__amount ffe-strong-text"
88
89
  }, "".concat(Number(percentage).toFixed(0)).concat(NON_BREAKING_SPACE, "%")), /*#__PURE__*/_react.default.createElement("div", {
89
90
  className: "ffe-chart-donut__type ffe-micro-text"
90
- }, lastLabel)))));
91
+ }, lastLabel))), !firstLabel && !lastLabel && label));
91
92
  }
92
93
 
93
94
  ChartDonut.propTypes = {
94
95
  /** Short text labeling left value, like "empty", "said yes" etc */
95
- firstLabel: _propTypes.string.isRequired,
96
+ firstLabel: _propTypes.string,
96
97
 
97
98
  /** Short text labeling right value, like "full", "said no" etc */
98
- lastLabel: _propTypes.string.isRequired,
99
+ lastLabel: _propTypes.string,
100
+
101
+ /** React node to be inserted directly under the chart's name, alternative to first/last label */
102
+ label: _propTypes.node,
99
103
 
100
104
  /** Short text labeling the graph in total, like "percentage", "voted this year" etc */
101
105
  name: _propTypes.string.isRequired,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@sb1/ffe-chart-donut-react",
3
- "version": "3.0.4",
3
+ "version": "5.0.0",
4
4
  "description": "Donut chart in SVG",
5
5
  "keywords": [
6
6
  "ffe"
@@ -20,11 +20,8 @@
20
20
  "url": "ssh://git@github.com:SpareBank1/designsystem.git"
21
21
  },
22
22
  "scripts": {
23
- "build": "npm run build:cjs && npm run build:es && npm run build:less",
24
- "build:cjs": "babel -d lib/. --root-mode=upward --env-name=cjs --ignore=*.spec.js src/.",
25
- "build:es": "babel -d es/. --root-mode=upward --env-name=es --ignore=*.spec.js src/.",
26
- "build:less": "copyfiles -f src/ffe-chart-donut.less lib/",
27
- "lint": "eslint src/.",
23
+ "build": "ffe-buildtool babel",
24
+ "lint": "eslint src",
28
25
  "test": "jest",
29
26
  "test:watch": "jest --watch"
30
27
  },
@@ -32,10 +29,10 @@
32
29
  "setupTestFrameworkScriptFile": "../../test-setup.js"
33
30
  },
34
31
  "dependencies": {
35
- "prop-types": "^15.6.0"
32
+ "prop-types": "^15.7.2"
36
33
  },
37
34
  "devDependencies": {
38
- "copyfiles": "^2.1.0",
35
+ "@sb1/ffe-buildtool": "^0.1.0",
39
36
  "enzyme": "^3.7.0",
40
37
  "enzyme-adapter-react-16": "^1.7.0",
41
38
  "jest": "^26.0.0",
@@ -43,10 +40,10 @@
43
40
  "react-dom": "^16.9.0"
44
41
  },
45
42
  "peerDependencies": {
46
- "react": "^16.9.0"
43
+ "react": ">=16.9.0"
47
44
  },
48
45
  "publishConfig": {
49
46
  "access": "public"
50
47
  },
51
- "gitHead": "67a0e2fa940c378759f0d706e0b62aa0efea4587"
48
+ "gitHead": "59eb2e12625e744f1a116c14a40cf69f1bbecdc6"
52
49
  }
package/CHANGELOG.md DELETED
@@ -1,286 +0,0 @@
1
- # Change Log
2
-
3
- All notable changes to this project will be documented in this file.
4
- See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
-
6
- ## [3.0.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@3.0.3...@sb1/ffe-chart-donut-react@3.0.4) (2021-02-03)
7
-
8
-
9
- ### Bug Fixes
10
-
11
- * packages/ffe-chart-donut-react/package.json to reduce vulnerabilities ([595d956](https://github.com/SpareBank1/designsystem/commit/595d9565477c791c92ad0e389f792dd38f8bcded))
12
-
13
-
14
-
15
-
16
-
17
- ## [3.0.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@3.0.2...@sb1/ffe-chart-donut-react@3.0.3) (2021-02-02)
18
-
19
-
20
- ### Bug Fixes
21
-
22
- * **ffe-chart-donut-react:** reduce vulnerabilities ([97e5ee0](https://github.com/SpareBank1/designsystem/commit/97e5ee05602952bc8ee58e45e5b048c2f8e118c7))
23
-
24
-
25
-
26
-
27
-
28
- ## [3.0.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@3.0.1...@sb1/ffe-chart-donut-react@3.0.2) (2020-08-05)
29
-
30
-
31
- ### Bug Fixes
32
-
33
- * **ffe-chart-donut-react:** accessible text color in chart name ([35989f2](https://github.com/SpareBank1/designsystem/commit/35989f29e249a9b319dd3768ec5f0370a9c71c1d))
34
-
35
-
36
-
37
-
38
-
39
- ## [3.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@3.0.0...@sb1/ffe-chart-donut-react@3.0.1) (2019-10-21)
40
-
41
- ### Bug Fixes
42
-
43
- - **ffe-chart-donut-react:** Remove screen type from media queries, see [#719](https://github.com/SpareBank1/designsystem/issues/719) ([1bf3c5b](https://github.com/SpareBank1/designsystem/commit/1bf3c5bc37d8aca7ea9c459eaccf23c88d80db1b))
44
-
45
- # [3.0.0](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.9...@sb1/ffe-chart-donut-react@3.0.0) (2019-08-27)
46
-
47
- ### chore
48
-
49
- - bump React to 16.9 to allow for using hooks etc ([e3901f1](https://github.com/SpareBank1/designsystem/commit/e3901f1))
50
-
51
- ### BREAKING CHANGES
52
-
53
- - peerDep of React is raised to 16.9. While this in itself
54
- isn't a breaking change, it allows for the use of hooks in later releases.
55
- Such changes would just be a minor version, or even a patch, but without
56
- this major version bump it would result in a runtime error for consumers.
57
-
58
- ## [2.0.9](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.8...@sb1/ffe-chart-donut-react@2.0.9) (2018-12-11)
59
-
60
- ### Bug Fixes
61
-
62
- - Build tree shakeable packages ([fb4a9ea](https://github.com/SpareBank1/designsystem/commit/fb4a9ea))
63
-
64
- ## [2.0.8](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.7...@sb1/ffe-chart-donut-react@2.0.8) (2018-11-26)
65
-
66
- **Note:** Version bump only for package @sb1/ffe-chart-donut-react
67
-
68
- <a name="2.0.7"></a>
69
-
70
- ## [2.0.7](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.6...@sb1/ffe-chart-donut-react@2.0.7) (2018-10-02)
71
-
72
- ### Bug Fixes
73
-
74
- - **ffe-chart-donut-react:** include .less file in lib/ root ([763ffa4](https://github.com/SpareBank1/designsystem/commit/763ffa4)), closes [#441](https://github.com/SpareBank1/designsystem/issues/441)
75
-
76
- <a name="2.0.6"></a>
77
-
78
- ## [2.0.6](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.5...@sb1/ffe-chart-donut-react@2.0.6) (2018-09-24)
79
-
80
- ### Bug Fixes
81
-
82
- - Removed usage of linux/unix command cp and use npm package copyfiles instead to make the copy, platform independent. ([07f5693](https://github.com/SpareBank1/designsystem/commit/07f5693))
83
-
84
- <a name="2.0.5"></a>
85
-
86
- ## [2.0.5](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.4...@sb1/ffe-chart-donut-react@2.0.5) (2018-08-09)
87
-
88
- **Note:** Version bump only for package @sb1/ffe-chart-donut-react
89
-
90
- <a name="2.0.4"></a>
91
-
92
- ## [2.0.4](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.3...@sb1/ffe-chart-donut-react@2.0.4) (2018-03-27)
93
-
94
- **Note:** Version bump only for package @sb1/ffe-chart-donut-react
95
-
96
- <a name="2.0.3"></a>
97
-
98
- ## [2.0.3](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.2...@sb1/ffe-chart-donut-react@2.0.3) (2018-03-22)
99
-
100
- ### Bug Fixes
101
-
102
- - **ffe-chart-donut-react:** Fix description position on md+ screens ([31c6026](https://github.com/SpareBank1/designsystem/commit/31c6026))
103
-
104
- <a name="2.0.2"></a>
105
-
106
- ## [2.0.2](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.0...@sb1/ffe-chart-donut-react@2.0.2) (2018-03-07)
107
-
108
- **Note:** Version bump only for package @sb1/ffe-chart-donut-react
109
-
110
- <a name="2.0.1"></a>
111
-
112
- ## [2.0.1](https://github.com/SpareBank1/designsystem/compare/@sb1/ffe-chart-donut-react@2.0.0...@sb1/ffe-chart-donut-react@2.0.1) (2018-03-02)
113
-
114
- **Note:** Version bump only for package @sb1/ffe-chart-donut-react
115
-
116
- <a name="2.0.0"></a>
117
-
118
- # 2.0.0 (2018-02-25)
119
-
120
- ### Bug Fixes
121
-
122
- - remove all references to internal system ([ff22340](https://github.com/SpareBank1/designsystem/commit/ff22340))
123
-
124
- ### Chores
125
-
126
- - add [@sb1](https://github.com/sb1)/ scope to all packages ([37efbb4](https://github.com/SpareBank1/designsystem/commit/37efbb4))
127
-
128
- ### BREAKING CHANGES
129
-
130
- - All packages have been renamed to add the @sb1 scope.
131
-
132
- See links [1] and [2] to read more about package scopes.
133
-
134
- Unfortunately this requires you update both your dependencies in
135
- `package.json` and all `import` or `require` statements in your code.
136
- Also, you unfortunately have to upgrade all FFE packages at once due to
137
- dependency between packages. If you are on the latest version prior to
138
- this breaking change the upgrade should be a matter of updating
139
- `package.json` with new package names and versions, and updating your
140
- imports.
141
-
142
- To help find the proper package versions you can either browse to the
143
- packages you need or check out the list of Git tags either on
144
- Github [3] or by cloning the repository and running the `git tag`
145
- command. All package versions get a tag in the format
146
- _package@version_.
147
-
148
- Update your `package.json` with the latest package version and add the
149
- @sb1 scope to the package name:
150
-
151
- ```diff
152
- - "ffe-core": "11.0.2",
153
- + "@sb1/ffe-core": "11.0.2",
154
- ```
155
-
156
- Scoped packages all get put in a subdirectory in `node_modules/`. In our
157
- case packages will be put in the `node_modules/@sb1/` directory. If your
158
- build depends on file paths (for instance for copying fonts) you need to
159
- update that path to include the scope.
160
-
161
- The directory structure also means you have to update your imports, both
162
- in Less and in JavaScript.
163
-
164
- Using `less-plugin-npm-import`:
165
-
166
- ```diff
167
- - @import 'npm://ffe-core/less/ffe';
168
- + @import 'npm://@sb1/ffe-core/less/ffe';
169
- ```
170
-
171
- Using Webpack:
172
-
173
- ```diff
174
- - @import '~ffe-core/less/ffe';
175
- + @import '~@sb1/ffe-core/less/ffe';
176
- ```
177
-
178
- Using plain old paths:
179
-
180
- ```diff
181
- - @import '../path/to/node_modules/ffe-core/less/ffe';
182
- + @import '../path/to/node_modules/@sb1/ffe-core/less/ffe';
183
- ```
184
-
185
- JavaScript `import`:
186
-
187
- ```diff
188
- - import { ActionButton } from 'ffe-buttons-react';
189
- + import { ActionButton } from '@sb1/ffe-buttons-react';
190
- ```
191
-
192
- JavaScript `require`:
193
-
194
- ```diff
195
- - const { ActionButton } = require('ffe-buttons-react').default;
196
- + const { ActionButton } = require('@sb1/ffe-buttons-react').default;
197
- ```
198
-
199
- [1]: https://docs.npmjs.com/misc/scope
200
- [2]: https://docs.npmjs.com/getting-started/scoped-packages
201
- [3]: https://github.com/sparebank1/designsystem/tags
202
-
203
- <a name="1.0.14"></a>
204
-
205
- ## [1.0.14](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.13...ffe-chart-donut-react@1.0.14) (2018-02-23)
206
-
207
- **Note:** Version bump only for package ffe-chart-donut-react
208
-
209
- <a name="1.0.13"></a>
210
-
211
- ## [1.0.13](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.12...ffe-chart-donut-react@1.0.13) (2018-02-22)
212
-
213
- **Note:** Version bump only for package ffe-chart-donut-react
214
-
215
- <a name="1.0.12"></a>
216
-
217
- ## [1.0.12](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.11...ffe-chart-donut-react@1.0.12) (2018-02-20)
218
-
219
- **Note:** Version bump only for package ffe-chart-donut-react
220
-
221
- <a name="1.0.11"></a>
222
-
223
- ## [1.0.11](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.10...ffe-chart-donut-react@1.0.11) (2018-02-15)
224
-
225
- **Note:** Version bump only for package ffe-chart-donut-react
226
-
227
- <a name="1.0.10"></a>
228
-
229
- ## [1.0.10](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.9...ffe-chart-donut-react@1.0.10) (2018-02-01)
230
-
231
- **Note:** Version bump only for package ffe-chart-donut-react
232
-
233
- <a name="1.0.9"></a>
234
-
235
- ## [1.0.9](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.8...ffe-chart-donut-react@1.0.9) (2018-01-22)
236
-
237
- **Note:** Version bump only for package ffe-chart-donut-react
238
-
239
- <a name="1.0.8"></a>
240
-
241
- ## [1.0.8](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.7...ffe-chart-donut-react@1.0.8) (2018-01-19)
242
-
243
- **Note:** Version bump only for package ffe-chart-donut-react
244
-
245
- <a name="1.0.7"></a>
246
-
247
- ## [1.0.7](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.6...ffe-chart-donut-react@1.0.7) (2018-01-19)
248
-
249
- **Note:** Version bump only for package ffe-chart-donut-react
250
-
251
- <a name="1.0.6"></a>
252
-
253
- ## [1.0.6](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.5...ffe-chart-donut-react@1.0.6) (2018-01-10)
254
-
255
- **Note:** Version bump only for package ffe-chart-donut-react
256
-
257
- <a name="1.0.5"></a>
258
-
259
- ## [1.0.5](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.4...ffe-chart-donut-react@1.0.5) (2018-01-09)
260
-
261
- **Note:** Version bump only for package ffe-chart-donut-react
262
-
263
- <a name="1.0.4"></a>
264
-
265
- ## [1.0.4](https://github.com/SpareBank1/designsystem/compare/ffe-chart-donut-react@1.0.3...ffe-chart-donut-react@1.0.4) (2018-01-05)
266
-
267
- **Note:** Version bump only for package ffe-chart-donut-react
268
-
269
- <a name="1.0.3"></a>
270
-
271
- ## 1.0.3 (2018-01-04)
272
-
273
- **Note:** Version bump only for package ffe-chart-donut-react
274
-
275
- ## 1.0.2
276
-
277
- - Added inline JSDoc comments for prop types
278
- - Added support for React 16
279
-
280
- ## 1.0.1
281
-
282
- - Use PropTypes from prop-types package
283
-
284
- # 1.0.0
285
-
286
- - First release.
@@ -1,37 +0,0 @@
1
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
2
-
3
- import React from 'react';
4
- import { shallow } from 'enzyme';
5
- import ChartDonut from '../src';
6
- var defaultProps = {
7
- firstLabel: 'Foo',
8
- lastLabel: 'Bar',
9
- name: 'Baz',
10
- percentage: 42
11
- };
12
-
13
- var renderShallow = function renderShallow() {
14
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
15
- return shallow( /*#__PURE__*/React.createElement(ChartDonut, _extends({}, defaultProps, props)));
16
- };
17
-
18
- describe('ChartDonut', function () {
19
- it('renders two SVGs', function () {
20
- var el = renderShallow();
21
- expect(el.find('svg')).toHaveLength(2);
22
- });
23
- it('renders html for the name of the circle', function () {
24
- var el = renderShallow();
25
- expect(el.find('.ffe-chart-donut__name')).toHaveLength(1);
26
- expect(el.find('.ffe-chart-donut__name').text()).toBe('Baz');
27
- });
28
- it('renders html for the labels and their percentages', function () {
29
- var el = renderShallow();
30
- expect(el.find('.ffe-chart-donut__type')).toHaveLength(2);
31
- expect(el.find('.ffe-chart-donut__amount')).toHaveLength(2);
32
- expect(el.find('.ffe-chart-donut__type').at(0).text()).toBe('Foo');
33
- expect(el.find('.ffe-chart-donut__amount').at(0).text()).toMatch(/58/);
34
- expect(el.find('.ffe-chart-donut__type').at(1).text()).toBe('Bar');
35
- expect(el.find('.ffe-chart-donut__amount').at(1).text()).toMatch(/42/);
36
- });
37
- });
@@ -1,44 +0,0 @@
1
- "use strict";
2
-
3
- var _react = _interopRequireDefault(require("react"));
4
-
5
- var _enzyme = require("enzyme");
6
-
7
- var _src = _interopRequireDefault(require("../src"));
8
-
9
- function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
10
-
11
- function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); }
12
-
13
- var defaultProps = {
14
- firstLabel: 'Foo',
15
- lastLabel: 'Bar',
16
- name: 'Baz',
17
- percentage: 42
18
- };
19
-
20
- var renderShallow = function renderShallow() {
21
- var props = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
22
- return (0, _enzyme.shallow)( /*#__PURE__*/_react.default.createElement(_src.default, _extends({}, defaultProps, props)));
23
- };
24
-
25
- describe('ChartDonut', function () {
26
- it('renders two SVGs', function () {
27
- var el = renderShallow();
28
- expect(el.find('svg')).toHaveLength(2);
29
- });
30
- it('renders html for the name of the circle', function () {
31
- var el = renderShallow();
32
- expect(el.find('.ffe-chart-donut__name')).toHaveLength(1);
33
- expect(el.find('.ffe-chart-donut__name').text()).toBe('Baz');
34
- });
35
- it('renders html for the labels and their percentages', function () {
36
- var el = renderShallow();
37
- expect(el.find('.ffe-chart-donut__type')).toHaveLength(2);
38
- expect(el.find('.ffe-chart-donut__amount')).toHaveLength(2);
39
- expect(el.find('.ffe-chart-donut__type').at(0).text()).toBe('Foo');
40
- expect(el.find('.ffe-chart-donut__amount').at(0).text()).toMatch(/58/);
41
- expect(el.find('.ffe-chart-donut__type').at(1).text()).toBe('Bar');
42
- expect(el.find('.ffe-chart-donut__amount').at(1).text()).toMatch(/42/);
43
- });
44
- });