@instructure/ui-progress 8.33.1 → 8.33.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,36 +1,22 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.ProgressBar = void 0;
9
-
10
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
-
12
9
  var _react = require("react");
13
-
14
10
  var _View = require("@instructure/ui-view/lib/View");
15
-
16
11
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
17
-
18
12
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
19
-
20
13
  var _testable = require("@instructure/ui-testable/lib/testable.js");
21
-
22
14
  var _emotion = require("@instructure/emotion");
23
-
24
15
  var _styles = _interopRequireDefault(require("./styles"));
25
-
26
16
  var _theme = _interopRequireDefault(require("./theme"));
27
-
28
17
  var _props = require("./props");
29
-
30
18
  const _excluded = ["renderValue", "formatScreenReaderValue", "valueNow", "valueMax", "screenReaderLabel", "size", "color", "meterColor", "styles"];
31
-
32
19
  var _dec, _dec2, _class, _class2;
33
-
34
20
  /**
35
21
  ---
36
22
  category: components
@@ -41,55 +27,48 @@ let ProgressBar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
41
27
  constructor() {
42
28
  super(...arguments);
43
29
  this.ref = null;
44
-
45
30
  this.handleRef = el => {
46
31
  const elementRef = this.props.elementRef;
47
32
  this.ref = el;
48
-
49
33
  if (typeof elementRef === 'function') {
50
34
  elementRef(el);
51
35
  }
52
36
  };
53
37
  }
54
-
55
38
  componentDidMount() {
56
39
  var _this$props$makeStyle, _this$props;
57
-
58
40
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
59
41
  }
60
-
61
42
  componentDidUpdate() {
62
43
  var _this$props$makeStyle2, _this$props2;
63
-
64
44
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
65
45
  }
66
-
67
46
  render() {
68
47
  const _this$props3 = this.props,
69
- renderValue = _this$props3.renderValue,
70
- formatScreenReaderValue = _this$props3.formatScreenReaderValue,
71
- valueNow = _this$props3.valueNow,
72
- valueMax = _this$props3.valueMax,
73
- screenReaderLabel = _this$props3.screenReaderLabel,
74
- size = _this$props3.size,
75
- color = _this$props3.color,
76
- meterColor = _this$props3.meterColor,
77
- styles = _this$props3.styles,
78
- props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
48
+ renderValue = _this$props3.renderValue,
49
+ formatScreenReaderValue = _this$props3.formatScreenReaderValue,
50
+ valueNow = _this$props3.valueNow,
51
+ valueMax = _this$props3.valueMax,
52
+ screenReaderLabel = _this$props3.screenReaderLabel,
53
+ size = _this$props3.size,
54
+ color = _this$props3.color,
55
+ meterColor = _this$props3.meterColor,
56
+ styles = _this$props3.styles,
57
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
79
58
  const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
80
59
  valueNow: valueNow,
81
60
  valueMax: valueMax
82
- }) : void 0; // consolidating the label and aria-valuetext to put in aria-label because
61
+ }) : void 0;
62
+ // consolidating the label and aria-valuetext to put in aria-label because
83
63
  // NVDA does not read aria-valuetext: https://github.com/nvaccess/nvda/issues/913
84
64
  // But leaving aria-valuetext because JAWS ignores aria-label
85
-
86
65
  const labelAndValueText = `${screenReaderLabel} ${valueText}`;
87
66
  const value = (0, _callRenderProp.callRenderProp)(renderValue, {
88
67
  valueNow: valueNow,
89
68
  valueMax: valueMax
90
69
  });
91
- /* eslint-disable jsx-a11y/no-redundant-roles, jsx-a11y/no-noninteractive-element-to-interactive-role */
92
70
 
71
+ /* eslint-disable jsx-a11y/no-redundant-roles, jsx-a11y/no-noninteractive-element-to-interactive-role */
93
72
  return (0, _emotion.jsx)(_View.View, Object.assign({}, (0, _passthroughProps.passthroughProps)(props), {
94
73
  as: this.props.as,
95
74
  css: styles === null || styles === void 0 ? void 0 : styles.progressBar,
@@ -113,11 +92,10 @@ let ProgressBar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
113
92
  "aria-hidden": "true"
114
93
  }, value));
115
94
  }
116
-
117
95
  }, _class2.displayName = "ProgressBar", _class2.componentId = 'ProgressBar', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
118
96
  formatScreenReaderValue: _ref => {
119
97
  let valueNow = _ref.valueNow,
120
- valueMax = _ref.valueMax;
98
+ valueMax = _ref.valueMax;
121
99
  return `${valueNow} / ${valueMax}`;
122
100
  },
123
101
  size: 'medium',
@@ -128,7 +106,7 @@ let ProgressBar = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.defaul
128
106
  // default to showing `success` color on completion
129
107
  meterColor: _ref2 => {
130
108
  let valueNow = _ref2.valueNow,
131
- valueMax = _ref2.valueMax;
109
+ valueMax = _ref2.valueMax;
132
110
  return valueNow / valueMax >= 1 ? 'success' : 'brand';
133
111
  }
134
112
  }, _class2)) || _class) || _class);
@@ -10,9 +10,7 @@ Object.defineProperty(exports, "ProgressBarLocator", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
-
14
13
  var _ProgressBarLocator = require("./ProgressBarLocator");
15
-
16
14
  /*
17
15
  * The MIT License (MIT)
18
16
  *
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _emotion = require("@instructure/emotion");
13
-
14
10
  /*
15
11
  * The MIT License (MIT)
16
12
  *
@@ -34,6 +30,7 @@ var _emotion = require("@instructure/emotion");
34
30
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
31
  * SOFTWARE.
36
32
  */
33
+
37
34
  const propTypes = {
38
35
  screenReaderLabel: _propTypes.default.string.isRequired,
39
36
  size: _propTypes.default.oneOf(['x-small', 'small', 'medium', 'large']),
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -41,12 +40,12 @@ exports.default = void 0;
41
40
  */
42
41
  const generateStyle = (componentTheme, props) => {
43
42
  const _props$valueNow = props.valueNow,
44
- valueNow = _props$valueNow === void 0 ? 0 : _props$valueNow,
45
- _props$valueMax = props.valueMax,
46
- valueMax = _props$valueMax === void 0 ? 100 : _props$valueMax,
47
- size = props.size,
48
- color = props.color,
49
- meterColor = props.meterColor;
43
+ valueNow = _props$valueNow === void 0 ? 0 : _props$valueNow,
44
+ _props$valueMax = props.valueMax,
45
+ valueMax = _props$valueMax === void 0 ? 100 : _props$valueMax,
46
+ size = props.size,
47
+ color = props.color,
48
+ meterColor = props.meterColor;
50
49
  const meterColorClassName = typeof meterColor === 'function' ? meterColor({
51
50
  valueNow,
52
51
  valueMax
@@ -187,9 +186,11 @@ const generateStyle = (componentTheme, props) => {
187
186
  '&::-webkit-progress-bar': {
188
187
  background: 'transparent'
189
188
  },
190
- '&::-webkit-progress-value': { ...(meterColorClassName && trackBackgroundVariants[color][meterColorClassName])
189
+ '&::-webkit-progress-value': {
190
+ ...(meterColorClassName && trackBackgroundVariants[color][meterColorClassName])
191
191
  },
192
- '&::-moz-progress-bar': { ...(meterColorClassName && trackBackgroundVariants[color][meterColorClassName])
192
+ '&::-moz-progress-bar': {
193
+ ...(meterColorClassName && trackBackgroundVariants[color][meterColorClassName])
193
194
  },
194
195
  '&::-ms-fill': {
195
196
  border: 'none',
@@ -207,6 +208,5 @@ const generateStyle = (componentTheme, props) => {
207
208
  }
208
209
  };
209
210
  };
210
-
211
211
  var _default = generateStyle;
212
212
  exports.default = _default;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -36,10 +35,10 @@ exports.default = void 0;
36
35
  */
37
36
  const generateComponentTheme = theme => {
38
37
  const borders = theme.borders,
39
- colors = theme.colors,
40
- spacing = theme.spacing,
41
- typography = theme.typography,
42
- themeName = theme.key;
38
+ colors = theme.colors,
39
+ spacing = theme.spacing,
40
+ typography = theme.typography,
41
+ themeName = theme.key;
43
42
  const themeSpecificStyle = {
44
43
  canvas: {
45
44
  meterColorBrand: theme['ic-brand-primary']
@@ -90,10 +89,10 @@ const generateComponentTheme = theme => {
90
89
  trackBottomBorderColor: colors === null || colors === void 0 ? void 0 : colors.borderMedium,
91
90
  trackBottomBorderColorInverse: colors === null || colors === void 0 ? void 0 : colors.borderLightest
92
91
  };
93
- return { ...componentVariables,
92
+ return {
93
+ ...componentVariables,
94
94
  ...themeSpecificStyle[themeName]
95
95
  };
96
96
  };
97
-
98
97
  var _default = generateComponentTheme;
99
98
  exports.default = _default;
@@ -4,11 +4,8 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.ProgressCircleLocator = void 0;
7
-
8
7
  var _locator = require("@instructure/ui-test-locator/lib/utils/locator.js");
9
-
10
8
  var _index = require("./index");
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _index = require("./index");
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'selector' does not exist on type 'typeof... Remove this comment to see the full error message
36
34
  const ProgressCircleLocator = (0, _locator.locator)(_index.ProgressCircle.selector);
37
35
  exports.ProgressCircleLocator = ProgressCircleLocator;
@@ -1,14 +1,11 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = void 0;
9
-
10
8
  var _react = _interopRequireDefault(require("react"));
11
-
12
9
  /*
13
10
  * The MIT License (MIT)
14
11
  *
@@ -32,6 +29,7 @@ var _react = _interopRequireDefault(require("react"));
32
29
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
33
30
  * SOFTWARE.
34
31
  */
32
+
35
33
  const valueMax = 100;
36
34
  var _default = {
37
35
  sectionProp: 'color',
@@ -39,7 +37,7 @@ var _default = {
39
37
  valueNow: [0, 40, 80, 100],
40
38
  renderValue: [null, _ref => {
41
39
  let valueNow = _ref.valueNow,
42
- valueMax = _ref.valueMax;
40
+ valueMax = _ref.valueMax;
43
41
  return /*#__PURE__*/_react.default.createElement("span", null, Math.round(valueNow / valueMax * 100));
44
42
  }]
45
43
  },
@@ -1,38 +1,23 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.default = exports.ProgressCircle = void 0;
9
-
10
8
  var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
11
-
12
9
  var _react = require("react");
13
-
14
10
  var _ScreenReaderContent = require("@instructure/ui-a11y-content/lib/ScreenReaderContent");
15
-
16
11
  var _View = require("@instructure/ui-view/lib/View");
17
-
18
12
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
19
-
20
13
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
21
-
22
14
  var _testable = require("@instructure/ui-testable/lib/testable.js");
23
-
24
15
  var _emotion = require("@instructure/emotion");
25
-
26
16
  var _styles = _interopRequireDefault(require("./styles"));
27
-
28
17
  var _theme = _interopRequireDefault(require("./theme"));
29
-
30
18
  var _props = require("./props");
31
-
32
19
  const _excluded = ["color", "renderValue", "formatScreenReaderValue", "meterColor", "valueNow", "valueMax", "screenReaderLabel", "size", "styles"];
33
-
34
20
  var _dec, _dec2, _class, _class2;
35
-
36
21
  /**
37
22
  ---
38
23
  category: components
@@ -44,30 +29,24 @@ let ProgressCircle = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
44
29
  super(props);
45
30
  this._timeouts = [];
46
31
  this.ref = null;
47
-
48
32
  this.handleRef = el => {
49
33
  const elementRef = this.props.elementRef;
50
34
  this.ref = el;
51
-
52
35
  if (typeof elementRef === 'function') {
53
36
  elementRef(el);
54
37
  }
55
38
  };
56
-
57
39
  this.state = {
58
40
  shouldAnimateOnMount: props.shouldAnimateOnMount
59
41
  };
60
42
  }
61
-
62
43
  get makeStylesVariables() {
63
44
  return {
64
45
  shouldAnimateOnMount: this.state.shouldAnimateOnMount
65
46
  };
66
47
  }
67
-
68
48
  componentDidMount() {
69
49
  var _this$props$makeStyle, _this$props;
70
-
71
50
  if (this.state.shouldAnimateOnMount) {
72
51
  this._timeouts.push(setTimeout(() => {
73
52
  this.setState({
@@ -75,41 +54,35 @@ let ProgressCircle = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
75
54
  });
76
55
  }, this.props.animationDelay || 500));
77
56
  }
78
-
79
57
  (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props, this.makeStylesVariables);
80
58
  }
81
-
82
59
  componentDidUpdate() {
83
60
  var _this$props$makeStyle2, _this$props2;
84
-
85
61
  (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2, this.makeStylesVariables);
86
62
  }
87
-
88
63
  componentWillUnmount() {
89
64
  this._timeouts.forEach(timeout => clearTimeout(timeout));
90
65
  }
91
-
92
66
  render() {
93
67
  var _styles$radii, _styles$radii2, _styles$radii3;
94
-
95
68
  const _this$props3 = this.props,
96
- color = _this$props3.color,
97
- renderValue = _this$props3.renderValue,
98
- formatScreenReaderValue = _this$props3.formatScreenReaderValue,
99
- meterColor = _this$props3.meterColor,
100
- valueNow = _this$props3.valueNow,
101
- valueMax = _this$props3.valueMax,
102
- screenReaderLabel = _this$props3.screenReaderLabel,
103
- size = _this$props3.size,
104
- styles = _this$props3.styles,
105
- props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
69
+ color = _this$props3.color,
70
+ renderValue = _this$props3.renderValue,
71
+ formatScreenReaderValue = _this$props3.formatScreenReaderValue,
72
+ meterColor = _this$props3.meterColor,
73
+ valueNow = _this$props3.valueNow,
74
+ valueMax = _this$props3.valueMax,
75
+ screenReaderLabel = _this$props3.screenReaderLabel,
76
+ size = _this$props3.size,
77
+ styles = _this$props3.styles,
78
+ props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
106
79
  const valueText = typeof formatScreenReaderValue === 'function' ? formatScreenReaderValue({
107
80
  valueNow: valueNow,
108
81
  valueMax: valueMax
109
- }) : void 0; // consolidating the label and aria-valuetext to put in aria-label because
82
+ }) : void 0;
83
+ // consolidating the label and aria-valuetext to put in aria-label because
110
84
  // NVDA does not read aria-valuetext: https://github.com/nvaccess/nvda/issues/913
111
85
  // But leaving aria-valuetext because JAWS ignores aria-label
112
-
113
86
  const labelAndValueText = `${screenReaderLabel} ${valueText}`;
114
87
  const value = (0, _callRenderProp.callRenderProp)(renderValue, {
115
88
  valueNow: valueNow,
@@ -160,11 +133,10 @@ let ProgressCircle = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
160
133
  r: styles === null || styles === void 0 ? void 0 : (_styles$radii3 = styles.radii) === null || _styles$radii3 === void 0 ? void 0 : _styles$radii3.radius
161
134
  })));
162
135
  }
163
-
164
136
  }, _class2.displayName = "ProgressCircle", _class2.componentId = 'ProgressCircle', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
165
137
  formatScreenReaderValue: _ref => {
166
138
  let valueNow = _ref.valueNow,
167
- valueMax = _ref.valueMax;
139
+ valueMax = _ref.valueMax;
168
140
  return `${valueNow} / ${valueMax}`;
169
141
  },
170
142
  size: 'medium',
@@ -176,7 +148,7 @@ let ProgressCircle = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.def
176
148
  // default to showing `success` color on completion
177
149
  meterColor: _ref2 => {
178
150
  let valueNow = _ref2.valueNow,
179
- valueMax = _ref2.valueMax;
151
+ valueMax = _ref2.valueMax;
180
152
  return valueNow / valueMax >= 1 ? 'success' : 'brand';
181
153
  }
182
154
  }, _class2)) || _class) || _class);
@@ -10,9 +10,7 @@ Object.defineProperty(exports, "ProgressCircleLocator", {
10
10
  }
11
11
  });
12
12
  exports.default = void 0;
13
-
14
13
  var _ProgressCircleLocator = require("./ProgressCircleLocator");
15
-
16
14
  /*
17
15
  * The MIT License (MIT)
18
16
  *
@@ -1,16 +1,12 @@
1
1
  "use strict";
2
2
 
3
3
  var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
-
5
4
  Object.defineProperty(exports, "__esModule", {
6
5
  value: true
7
6
  });
8
7
  exports.propTypes = exports.allowedProps = void 0;
9
-
10
8
  var _propTypes = _interopRequireDefault(require("prop-types"));
11
-
12
9
  var _emotion = require("@instructure/emotion");
13
-
14
10
  /*
15
11
  * The MIT License (MIT)
16
12
  *
@@ -34,6 +30,7 @@ var _emotion = require("@instructure/emotion");
34
30
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
31
  * SOFTWARE.
36
32
  */
33
+
37
34
  const propTypes = {
38
35
  screenReaderLabel: _propTypes.default.string.isRequired,
39
36
  size: _propTypes.default.oneOf(['x-small', 'small', 'medium', 'large']),
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -41,24 +40,22 @@ exports.default = void 0;
41
40
  */
42
41
  const generateStyle = (componentTheme, props, state) => {
43
42
  const size = props.size,
44
- color = props.color,
45
- meterColor = props.meterColor,
46
- _props$valueNow = props.valueNow,
47
- valueNow = _props$valueNow === void 0 ? 0 : _props$valueNow,
48
- _props$valueMax = props.valueMax,
49
- valueMax = _props$valueMax === void 0 ? 100 : _props$valueMax;
43
+ color = props.color,
44
+ meterColor = props.meterColor,
45
+ _props$valueNow = props.valueNow,
46
+ valueNow = _props$valueNow === void 0 ? 0 : _props$valueNow,
47
+ _props$valueMax = props.valueMax,
48
+ valueMax = _props$valueMax === void 0 ? 100 : _props$valueMax;
50
49
  const shouldAnimateOnMount = state.shouldAnimateOnMount;
51
50
  const getMeterColorClassName = typeof meterColor === 'function' ? meterColor({
52
51
  valueNow,
53
52
  valueMax
54
53
  }) : meterColor;
55
-
56
54
  const getCircumference = () => {
57
- const camelSize = size === 'x-small' ? 'xSmall' : size; // get the circumference of the meter circle
58
-
55
+ const camelSize = size === 'x-small' ? 'xSmall' : size;
56
+ // get the circumference of the meter circle
59
57
  return parseFloat(componentTheme[`${camelSize}Circumference`]);
60
58
  };
61
-
62
59
  const getRadii = () => {
63
60
  const camelSize = size === 'x-small' ? 'xSmall' : size;
64
61
  return {
@@ -66,25 +63,23 @@ const generateStyle = (componentTheme, props, state) => {
66
63
  borderOffsetRadius: componentTheme[`${camelSize}BorderOffset`]
67
64
  };
68
65
  };
69
-
70
66
  const getDashOffset = () => {
71
67
  // send the stroke-dashoffset to the meter circle, checking
72
68
  // to make sure current value doesn't exceed max value
73
69
  if (valueNow < valueMax) {
74
- const circumference = getCircumference(); // figure out how much offset to give the stroke to show the % complete
75
-
70
+ const circumference = getCircumference();
71
+ // figure out how much offset to give the stroke to show the % complete
76
72
  return circumference - valueNow / valueMax * circumference;
77
73
  } else {
78
74
  return 0;
79
75
  }
80
76
  };
77
+
81
78
  /*
82
79
  Using !important on the meter shouldAnimateOnMount versions
83
80
  to guarantee that the bars will start showing 0 if the
84
81
  animateOnMount prop is set
85
82
  */
86
-
87
-
88
83
  const sizeVariants = {
89
84
  'x-small': {
90
85
  progressCircle: {
@@ -262,7 +257,6 @@ const generateStyle = (componentTheme, props, state) => {
262
257
  verticalAlign: 'middle',
263
258
  position: 'relative',
264
259
  overflow: 'hidden',
265
-
266
260
  /*
267
261
  Seems like a good idea to reset font-size because
268
262
  the SVG uses ems and might inherit a container's
@@ -358,6 +352,5 @@ const generateStyle = (componentTheme, props, state) => {
358
352
  dashOffset: getDashOffset()
359
353
  };
360
354
  };
361
-
362
355
  var _default = generateStyle;
363
356
  exports.default = _default;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", {
4
4
  value: true
5
5
  });
6
6
  exports.default = void 0;
7
-
8
7
  /*
9
8
  * The MIT License (MIT)
10
9
  *
@@ -28,6 +27,7 @@ exports.default = void 0;
28
27
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
29
28
  * SOFTWARE.
30
29
  */
30
+
31
31
  const radius = {
32
32
  xSmall: 1,
33
33
  small: 1.8,
@@ -45,10 +45,11 @@ const strokeWidth = {
45
45
  small: 0.5,
46
46
  medium: 0.625,
47
47
  large: 0.875
48
- }; // Necessary to get the 1px border line to go "under" the meter
48
+ };
49
+
50
+ // Necessary to get the 1px border line to go "under" the meter
49
51
  // strokeWidth is divided in half because SVG strokeWidth is
50
52
  // centered along the path of the stroke, unlike CSS
51
-
52
53
  const borderWidth = 0.0625;
53
54
  const borderOffsetRadius = {
54
55
  xSmall: radius.xSmall - strokeWidth.xSmall / 2 + borderWidth,
@@ -56,25 +57,22 @@ const borderOffsetRadius = {
56
57
  medium: radius.medium - strokeWidth.medium / 2 + borderWidth,
57
58
  large: radius.large - strokeWidth.large / 2 + borderWidth
58
59
  };
59
-
60
60
  const circumference = function (r) {
61
61
  return (2 * Math.PI * r).toFixed(3);
62
62
  };
63
-
64
63
  const transform = function (s) {
65
64
  return s / 2;
66
65
  };
66
+
67
67
  /**
68
68
  * Generates the theme object for the component from the theme and provided additional information
69
69
  * @param {Object} theme The actual theme object.
70
70
  * @return {Object} The final theme object with the overrides and component variables
71
71
  */
72
-
73
-
74
72
  const generateComponentTheme = theme => {
75
73
  const colors = theme.colors,
76
- typography = theme.typography,
77
- themeName = theme.key;
74
+ typography = theme.typography,
75
+ themeName = theme.key;
78
76
  const themeSpecificStyle = {
79
77
  canvas: {
80
78
  color: theme['ic-brand-font-color-dark'],
@@ -138,10 +136,10 @@ const generateComponentTheme = theme => {
138
136
  meterColorWarning: colors === null || colors === void 0 ? void 0 : colors.backgroundWarning,
139
137
  meterColorWarningInverse: colors === null || colors === void 0 ? void 0 : colors.backgroundWarning
140
138
  };
141
- return { ...componentVariables,
139
+ return {
140
+ ...componentVariables,
142
141
  ...themeSpecificStyle[themeName]
143
142
  };
144
143
  };
145
-
146
144
  var _default = generateComponentTheme;
147
145
  exports.default = _default;
package/lib/index.js CHANGED
@@ -15,7 +15,5 @@ Object.defineProperty(exports, "ProgressCircle", {
15
15
  return _ProgressCircle.ProgressCircle;
16
16
  }
17
17
  });
18
-
19
18
  var _ProgressBar = require("./ProgressBar");
20
-
21
19
  var _ProgressCircle = require("./ProgressCircle");