baseui 0.0.0-next-5e64248 → 0.0.0-next-9a8ac53

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.
@@ -502,7 +502,7 @@ var StyledDay = (0, _index.styled)('div', function (props) {
502
502
  content: '""',
503
503
  boxSizing: 'border-box',
504
504
  display: 'inline-block',
505
- boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
505
+ boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? "0 0 0 3px ".concat(colors.accent) : 'none',
506
506
  backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
507
507
  height: $hasDateLabel ? '100%' : $density === _constants.DENSITY.high ? '42px' : '50px',
508
508
  width: '100%',
@@ -496,7 +496,10 @@ export const StyledDay = styled<SharedStylePropsT>('div', props => {
496
496
  content: '""',
497
497
  boxSizing: 'border-box',
498
498
  display: 'inline-block',
499
- boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none',
499
+ boxShadow:
500
+ $isFocusVisible && (!$outsideMonth || $peekNextMonth)
501
+ ? `0 0 0 3px ${colors.accent}`
502
+ : 'none',
500
503
  backgroundColor: $selected
501
504
  ? colors.calendarDayBackgroundSelectedHighlighted
502
505
  : $pseudoSelected && $isHighlighted
@@ -503,7 +503,7 @@ export const StyledDay = styled('div', props => {
503
503
  content: '""',
504
504
  boxSizing: 'border-box',
505
505
  display: 'inline-block',
506
- boxShadow: $isFocusVisible ? `0 0 0 3px ${colors.accent}` : 'none',
506
+ boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? `0 0 0 3px ${colors.accent}` : 'none',
507
507
  backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
508
508
  height: $hasDateLabel ? '100%' : $density === DENSITY.high ? '42px' : '50px',
509
509
  width: '100%',
@@ -34,7 +34,9 @@ class ProgressBar extends React.Component {
34
34
  successValue,
35
35
  showLabel,
36
36
  infinite,
37
- errorMessage
37
+ errorMessage,
38
+ forwardedRef,
39
+ ...restProps
38
40
  } = this.props;
39
41
  const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
40
42
  const [BarContainer, barContainerProps] = getOverrides(overrides.BarContainer, StyledBarContainer);
@@ -68,6 +70,7 @@ class ProgressBar extends React.Component {
68
70
  /*#__PURE__*/
69
71
  // eslint-disable-next-line jsx-a11y/role-supports-aria-props
70
72
  React.createElement(Root, _extends({
73
+ ref: forwardedRef,
71
74
  "data-baseweb": "progress-bar",
72
75
  role: "progressbar",
73
76
  "aria-label": ariaLabel || getProgressLabel(value, successValue),
@@ -76,7 +79,7 @@ class ProgressBar extends React.Component {
76
79
  "aria-valuemax": infinite ? null : successValue,
77
80
  "aria-invalid": errorMessage ? true : null,
78
81
  "aria-errormessage": errorMessage
79
- }, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
82
+ }, restProps, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
80
83
  $isLeft: true,
81
84
  $size: sharedProps.$size
82
85
  }, infiniteBarProps)), /*#__PURE__*/React.createElement(InfiniteBar, _extends({
@@ -98,4 +101,8 @@ _defineProperty(ProgressBar, "defaultProps", {
98
101
  value: 0
99
102
  });
100
103
 
101
- export default ProgressBar;
104
+ const ForwardedProgressBar = /*#__PURE__*/React.forwardRef((props, ref) => /*#__PURE__*/React.createElement(ProgressBar, _extends({
105
+ forwardedRef: ref
106
+ }, props)));
107
+ ForwardedProgressBar.displayName = 'ProgressBar';
108
+ export default ForwardedProgressBar;
@@ -46,13 +46,39 @@ export const StyledActivePath = styled('path', props => ({
46
46
  StyledActivePath.displayName = "StyledActivePath";
47
47
  export const StyledSpinnerNext = styled('i', ({
48
48
  $theme,
49
+ $color = $theme.colors.contentAccent,
50
+ $borderWidth,
49
51
  $size = SIZE.medium
50
52
  }) => {
51
- const borderWidth = {
53
+ //$FlowFixMe
54
+ let borderSize = {
52
55
  large: $theme.sizing.scale300,
53
56
  medium: $theme.sizing.scale100,
54
57
  small: $theme.sizing.scale0
58
+ }[$borderWidth || $size];
59
+ let boxSize = {
60
+ large: $theme.sizing.scale1000,
61
+ medium: $theme.sizing.scale900,
62
+ small: $theme.sizing.scale800
55
63
  }[$size];
64
+
65
+ if (!borderSize) {
66
+ borderSize = $theme.sizing[$borderWidth];
67
+
68
+ if (!borderSize) {
69
+ borderSize = `${parseInt($borderWidth)}px`;
70
+ }
71
+ }
72
+
73
+ if (!boxSize) {
74
+ //$FlowFixMe
75
+ boxSize = $theme.sizing[$size];
76
+
77
+ if (!boxSize) {
78
+ boxSize = `${parseInt($size)}px`;
79
+ }
80
+ }
81
+
56
82
  return {
57
83
  display: 'block',
58
84
  animationName: spin,
@@ -64,24 +90,16 @@ export const StyledSpinnerNext = styled('i', ({
64
90
  borderTopStyle: 'solid',
65
91
  borderBottomStyle: 'solid',
66
92
  borderRadius: '50%',
67
- borderTopColor: $theme.colors.contentAccent,
93
+ borderTopColor: $color,
68
94
  borderRightColor: $theme.colors.backgroundTertiary,
69
95
  borderBottomColor: $theme.colors.backgroundTertiary,
70
96
  borderLeftColor: $theme.colors.backgroundTertiary,
71
- borderLeftWidth: borderWidth,
72
- borderRightWidth: borderWidth,
73
- borderTopWidth: borderWidth,
74
- borderBottomWidth: borderWidth,
75
- width: {
76
- large: $theme.sizing.scale1000,
77
- medium: $theme.sizing.scale900,
78
- small: $theme.sizing.scale800
79
- }[$size],
80
- height: {
81
- large: $theme.sizing.scale1000,
82
- medium: $theme.sizing.scale900,
83
- small: $theme.sizing.scale800
84
- }[$size],
97
+ borderLeftWidth: borderSize,
98
+ borderRightWidth: borderSize,
99
+ borderTopWidth: borderSize,
100
+ borderBottomWidth: borderSize,
101
+ width: boxSize,
102
+ height: boxSize,
85
103
  cursor: 'wait'
86
104
  };
87
105
  });
@@ -481,7 +481,7 @@ export var StyledDay = styled('div', function (props) {
481
481
  content: '""',
482
482
  boxSizing: 'border-box',
483
483
  display: 'inline-block',
484
- boxShadow: $isFocusVisible ? "0 0 0 3px ".concat(colors.accent) : 'none',
484
+ boxShadow: $isFocusVisible && (!$outsideMonth || $peekNextMonth) ? "0 0 0 3px ".concat(colors.accent) : 'none',
485
485
  backgroundColor: $selected ? colors.calendarDayBackgroundSelectedHighlighted : $pseudoSelected && $isHighlighted ? colors.calendarDayBackgroundPseudoSelectedHighlighted : colors.calendarBackground,
486
486
  height: $hasDateLabel ? '100%' : $density === DENSITY.high ? '42px' : '50px',
487
487
  width: '100%',
@@ -14,6 +14,10 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
14
14
 
15
15
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
16
16
 
17
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
18
+
19
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
20
+
17
21
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
18
22
 
19
23
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -82,7 +86,9 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
82
86
  successValue = _this$props.successValue,
83
87
  showLabel = _this$props.showLabel,
84
88
  infinite = _this$props.infinite,
85
- errorMessage = _this$props.errorMessage;
89
+ errorMessage = _this$props.errorMessage,
90
+ forwardedRef = _this$props.forwardedRef,
91
+ restProps = _objectWithoutProperties(_this$props, ["ariaLabel", "overrides", "getProgressLabel", "value", "size", "steps", "successValue", "showLabel", "infinite", "errorMessage", "forwardedRef"]);
86
92
 
87
93
  var _getOverrides = getOverrides(overrides.Root, StyledRoot),
88
94
  _getOverrides2 = _slicedToArray(_getOverrides, 2),
@@ -140,6 +146,7 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
140
146
  /*#__PURE__*/
141
147
  // eslint-disable-next-line jsx-a11y/role-supports-aria-props
142
148
  React.createElement(Root, _extends({
149
+ ref: forwardedRef,
143
150
  "data-baseweb": "progress-bar",
144
151
  role: "progressbar",
145
152
  "aria-label": ariaLabel || getProgressLabel(value, successValue),
@@ -148,7 +155,7 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
148
155
  "aria-valuemax": infinite ? null : successValue,
149
156
  "aria-invalid": errorMessage ? true : null,
150
157
  "aria-errormessage": errorMessage
151
- }, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
158
+ }, restProps, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
152
159
  $isLeft: true,
153
160
  $size: sharedProps.$size
154
161
  }, infiniteBarProps)), /*#__PURE__*/React.createElement(InfiniteBar, _extends({
@@ -174,4 +181,10 @@ _defineProperty(ProgressBar, "defaultProps", {
174
181
  value: 0
175
182
  });
176
183
 
177
- export default ProgressBar;
184
+ var ForwardedProgressBar = /*#__PURE__*/React.forwardRef(function (props, ref) {
185
+ return /*#__PURE__*/React.createElement(ProgressBar, _extends({
186
+ forwardedRef: ref
187
+ }, props));
188
+ });
189
+ ForwardedProgressBar.displayName = 'ProgressBar';
190
+ export default ForwardedProgressBar;
@@ -54,13 +54,40 @@ export var StyledActivePath = styled('path', function (props) {
54
54
  StyledActivePath.displayName = "StyledActivePath";
55
55
  export var StyledSpinnerNext = styled('i', function (_ref) {
56
56
  var $theme = _ref.$theme,
57
+ _ref$$color = _ref.$color,
58
+ $color = _ref$$color === void 0 ? $theme.colors.contentAccent : _ref$$color,
59
+ $borderWidth = _ref.$borderWidth,
57
60
  _ref$$size = _ref.$size,
58
61
  $size = _ref$$size === void 0 ? SIZE.medium : _ref$$size;
59
- var borderWidth = {
62
+ //$FlowFixMe
63
+ var borderSize = {
60
64
  large: $theme.sizing.scale300,
61
65
  medium: $theme.sizing.scale100,
62
66
  small: $theme.sizing.scale0
67
+ }[$borderWidth || $size];
68
+ var boxSize = {
69
+ large: $theme.sizing.scale1000,
70
+ medium: $theme.sizing.scale900,
71
+ small: $theme.sizing.scale800
63
72
  }[$size];
73
+
74
+ if (!borderSize) {
75
+ borderSize = $theme.sizing[$borderWidth];
76
+
77
+ if (!borderSize) {
78
+ borderSize = "".concat(parseInt($borderWidth), "px");
79
+ }
80
+ }
81
+
82
+ if (!boxSize) {
83
+ //$FlowFixMe
84
+ boxSize = $theme.sizing[$size];
85
+
86
+ if (!boxSize) {
87
+ boxSize = "".concat(parseInt($size), "px");
88
+ }
89
+ }
90
+
64
91
  return {
65
92
  display: 'block',
66
93
  animationName: spin,
@@ -72,24 +99,16 @@ export var StyledSpinnerNext = styled('i', function (_ref) {
72
99
  borderTopStyle: 'solid',
73
100
  borderBottomStyle: 'solid',
74
101
  borderRadius: '50%',
75
- borderTopColor: $theme.colors.contentAccent,
102
+ borderTopColor: $color,
76
103
  borderRightColor: $theme.colors.backgroundTertiary,
77
104
  borderBottomColor: $theme.colors.backgroundTertiary,
78
105
  borderLeftColor: $theme.colors.backgroundTertiary,
79
- borderLeftWidth: borderWidth,
80
- borderRightWidth: borderWidth,
81
- borderTopWidth: borderWidth,
82
- borderBottomWidth: borderWidth,
83
- width: {
84
- large: $theme.sizing.scale1000,
85
- medium: $theme.sizing.scale900,
86
- small: $theme.sizing.scale800
87
- }[$size],
88
- height: {
89
- large: $theme.sizing.scale1000,
90
- medium: $theme.sizing.scale900,
91
- small: $theme.sizing.scale800
92
- }[$size],
106
+ borderLeftWidth: borderSize,
107
+ borderRightWidth: borderSize,
108
+ borderTopWidth: borderSize,
109
+ borderBottomWidth: borderSize,
110
+ width: boxSize,
111
+ height: boxSize,
93
112
  cursor: 'wait'
94
113
  };
95
114
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "baseui",
3
- "version": "0.0.0-next-5e64248",
3
+ "version": "0.0.0-next-9a8ac53",
4
4
  "description": "A React Component library implementing the Base design language",
5
5
  "keywords": [
6
6
  "react",
@@ -33,6 +33,10 @@ function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(
33
33
 
34
34
  function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
35
35
 
36
+ function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
37
+
38
+ function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
39
+
36
40
  function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
37
41
 
38
42
  function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
@@ -90,7 +94,9 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
90
94
  successValue = _this$props.successValue,
91
95
  showLabel = _this$props.showLabel,
92
96
  infinite = _this$props.infinite,
93
- errorMessage = _this$props.errorMessage;
97
+ errorMessage = _this$props.errorMessage,
98
+ forwardedRef = _this$props.forwardedRef,
99
+ restProps = _objectWithoutProperties(_this$props, ["ariaLabel", "overrides", "getProgressLabel", "value", "size", "steps", "successValue", "showLabel", "infinite", "errorMessage", "forwardedRef"]);
94
100
 
95
101
  var _getOverrides = (0, _overrides.getOverrides)(overrides.Root, _styledComponents.StyledRoot),
96
102
  _getOverrides2 = _slicedToArray(_getOverrides, 2),
@@ -148,6 +154,7 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
148
154
  /*#__PURE__*/
149
155
  // eslint-disable-next-line jsx-a11y/role-supports-aria-props
150
156
  React.createElement(Root, _extends({
157
+ ref: forwardedRef,
151
158
  "data-baseweb": "progress-bar",
152
159
  role: "progressbar",
153
160
  "aria-label": ariaLabel || getProgressLabel(value, successValue),
@@ -156,7 +163,7 @@ var ProgressBar = /*#__PURE__*/function (_React$Component) {
156
163
  "aria-valuemax": infinite ? null : successValue,
157
164
  "aria-invalid": errorMessage ? true : null,
158
165
  "aria-errormessage": errorMessage
159
- }, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
166
+ }, restProps, sharedProps, rootProps), /*#__PURE__*/React.createElement(BarContainer, _extends({}, sharedProps, barContainerProps), infinite ? /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(InfiniteBar, _extends({
160
167
  $isLeft: true,
161
168
  $size: sharedProps.$size
162
169
  }, infiniteBarProps)), /*#__PURE__*/React.createElement(InfiniteBar, _extends({
@@ -182,5 +189,11 @@ _defineProperty(ProgressBar, "defaultProps", {
182
189
  value: 0
183
190
  });
184
191
 
185
- var _default = ProgressBar;
192
+ var ForwardedProgressBar = /*#__PURE__*/React.forwardRef(function (props, ref) {
193
+ return /*#__PURE__*/React.createElement(ProgressBar, _extends({
194
+ forwardedRef: ref
195
+ }, props));
196
+ });
197
+ ForwardedProgressBar.displayName = 'ProgressBar';
198
+ var _default = ForwardedProgressBar;
186
199
  exports.default = _default;
@@ -19,7 +19,10 @@ import {
19
19
 
20
20
  import type {ProgressBarPropsT} from './types.js';
21
21
 
22
- class ProgressBar extends React.Component<ProgressBarPropsT> {
22
+ class ProgressBar extends React.Component<
23
+ // eslint-disable-next-line flowtype/no-weak-types
24
+ ProgressBarPropsT & {forwardedRef: any},
25
+ > {
23
26
  static defaultProps = {
24
27
  getProgressLabel: (value: number, successValue: number) =>
25
28
  `${Math.round((value / successValue) * 100)}% Loaded`,
@@ -55,6 +58,8 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
55
58
  showLabel,
56
59
  infinite,
57
60
  errorMessage,
61
+ forwardedRef,
62
+ ...restProps
58
63
  } = this.props;
59
64
  const [Root, rootProps] = getOverrides(overrides.Root, StyledRoot);
60
65
  const [BarContainer, barContainerProps] = getOverrides(
@@ -92,6 +97,7 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
92
97
  return (
93
98
  // eslint-disable-next-line jsx-a11y/role-supports-aria-props
94
99
  <Root
100
+ ref={forwardedRef}
95
101
  data-baseweb="progress-bar"
96
102
  role="progressbar"
97
103
  aria-label={ariaLabel || getProgressLabel(value, successValue)}
@@ -100,6 +106,7 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
100
106
  aria-valuemax={infinite ? null : successValue}
101
107
  aria-invalid={errorMessage ? true : null}
102
108
  aria-errormessage={errorMessage}
109
+ {...restProps}
103
110
  {...sharedProps}
104
111
  {...rootProps}
105
112
  >
@@ -127,7 +134,14 @@ class ProgressBar extends React.Component<ProgressBarPropsT> {
127
134
  }
128
135
  }
129
136
 
130
- export default ProgressBar;
137
+ const ForwardedProgressBar = React.forwardRef<
138
+ $Shape<ProgressBarPropsT>,
139
+ HTMLDivElement,
140
+ >((props: ProgressBarPropsT, ref) => (
141
+ <ProgressBar forwardedRef={ref} {...props} />
142
+ ));
143
+ ForwardedProgressBar.displayName = 'ProgressBar';
144
+ export default ForwardedProgressBar;
131
145
 
132
146
  declare var __DEV__: boolean;
133
147
  declare var __NODE__: boolean;
@@ -61,13 +61,40 @@ exports.StyledActivePath = StyledActivePath;
61
61
  StyledActivePath.displayName = "StyledActivePath";
62
62
  var StyledSpinnerNext = (0, _index.styled)('i', function (_ref) {
63
63
  var $theme = _ref.$theme,
64
+ _ref$$color = _ref.$color,
65
+ $color = _ref$$color === void 0 ? $theme.colors.contentAccent : _ref$$color,
66
+ $borderWidth = _ref.$borderWidth,
64
67
  _ref$$size = _ref.$size,
65
68
  $size = _ref$$size === void 0 ? _constants.SIZE.medium : _ref$$size;
66
- var borderWidth = {
69
+ //$FlowFixMe
70
+ var borderSize = {
67
71
  large: $theme.sizing.scale300,
68
72
  medium: $theme.sizing.scale100,
69
73
  small: $theme.sizing.scale0
74
+ }[$borderWidth || $size];
75
+ var boxSize = {
76
+ large: $theme.sizing.scale1000,
77
+ medium: $theme.sizing.scale900,
78
+ small: $theme.sizing.scale800
70
79
  }[$size];
80
+
81
+ if (!borderSize) {
82
+ borderSize = $theme.sizing[$borderWidth];
83
+
84
+ if (!borderSize) {
85
+ borderSize = "".concat(parseInt($borderWidth), "px");
86
+ }
87
+ }
88
+
89
+ if (!boxSize) {
90
+ //$FlowFixMe
91
+ boxSize = $theme.sizing[$size];
92
+
93
+ if (!boxSize) {
94
+ boxSize = "".concat(parseInt($size), "px");
95
+ }
96
+ }
97
+
71
98
  return {
72
99
  display: 'block',
73
100
  animationName: spin,
@@ -79,24 +106,16 @@ var StyledSpinnerNext = (0, _index.styled)('i', function (_ref) {
79
106
  borderTopStyle: 'solid',
80
107
  borderBottomStyle: 'solid',
81
108
  borderRadius: '50%',
82
- borderTopColor: $theme.colors.contentAccent,
109
+ borderTopColor: $color,
83
110
  borderRightColor: $theme.colors.backgroundTertiary,
84
111
  borderBottomColor: $theme.colors.backgroundTertiary,
85
112
  borderLeftColor: $theme.colors.backgroundTertiary,
86
- borderLeftWidth: borderWidth,
87
- borderRightWidth: borderWidth,
88
- borderTopWidth: borderWidth,
89
- borderBottomWidth: borderWidth,
90
- width: {
91
- large: $theme.sizing.scale1000,
92
- medium: $theme.sizing.scale900,
93
- small: $theme.sizing.scale800
94
- }[$size],
95
- height: {
96
- large: $theme.sizing.scale1000,
97
- medium: $theme.sizing.scale900,
98
- small: $theme.sizing.scale800
99
- }[$size],
113
+ borderLeftWidth: borderSize,
114
+ borderRightWidth: borderSize,
115
+ borderTopWidth: borderSize,
116
+ borderBottomWidth: borderSize,
117
+ width: boxSize,
118
+ height: boxSize,
100
119
  cursor: 'wait'
101
120
  };
102
121
  });
@@ -7,8 +7,8 @@ LICENSE file in the root directory of this source tree.
7
7
  // @flow
8
8
  import {styled} from '../styles/index.js';
9
9
  import {getSvgStyles} from '../icon/styled-components.js';
10
- import type {SizeT} from './types.js';
11
10
  import {SIZE} from './constants.js';
11
+ import type {StyledSpinnerNextPropsT} from './types.js';
12
12
 
13
13
  type StylePropsT = {
14
14
  $size?: number | string,
@@ -50,14 +50,40 @@ export const StyledActivePath = styled<StylePropsT>('path', props => ({
50
50
  }));
51
51
 
52
52
  // TODO(v11): Replace Spinner with SpinnerNext
53
- export const StyledSpinnerNext = styled<{$size?: SizeT}>(
53
+ export const StyledSpinnerNext = styled<StyledSpinnerNextPropsT>(
54
54
  'i',
55
- ({$theme, $size = SIZE.medium}) => {
56
- const borderWidth = {
55
+ ({
56
+ $theme,
57
+ $color = $theme.colors.contentAccent,
58
+ $borderWidth,
59
+ $size = SIZE.medium,
60
+ }) => {
61
+ //$FlowFixMe
62
+ let borderSize = {
57
63
  large: $theme.sizing.scale300,
58
64
  medium: $theme.sizing.scale100,
59
65
  small: $theme.sizing.scale0,
66
+ }[$borderWidth || $size];
67
+ let boxSize = {
68
+ large: $theme.sizing.scale1000,
69
+ medium: $theme.sizing.scale900,
70
+ small: $theme.sizing.scale800,
60
71
  }[$size];
72
+
73
+ if (!borderSize) {
74
+ borderSize = $theme.sizing[$borderWidth];
75
+ if (!borderSize) {
76
+ borderSize = `${parseInt($borderWidth)}px`;
77
+ }
78
+ }
79
+ if (!boxSize) {
80
+ //$FlowFixMe
81
+ boxSize = $theme.sizing[$size];
82
+ if (!boxSize) {
83
+ boxSize = `${parseInt($size)}px`;
84
+ }
85
+ }
86
+
61
87
  return {
62
88
  display: 'block',
63
89
  animationName: spin,
@@ -69,24 +95,16 @@ export const StyledSpinnerNext = styled<{$size?: SizeT}>(
69
95
  borderTopStyle: 'solid',
70
96
  borderBottomStyle: 'solid',
71
97
  borderRadius: '50%',
72
- borderTopColor: $theme.colors.contentAccent,
98
+ borderTopColor: $color,
73
99
  borderRightColor: $theme.colors.backgroundTertiary,
74
100
  borderBottomColor: $theme.colors.backgroundTertiary,
75
101
  borderLeftColor: $theme.colors.backgroundTertiary,
76
- borderLeftWidth: borderWidth,
77
- borderRightWidth: borderWidth,
78
- borderTopWidth: borderWidth,
79
- borderBottomWidth: borderWidth,
80
- width: {
81
- large: $theme.sizing.scale1000,
82
- medium: $theme.sizing.scale900,
83
- small: $theme.sizing.scale800,
84
- }[$size],
85
- height: {
86
- large: $theme.sizing.scale1000,
87
- medium: $theme.sizing.scale900,
88
- small: $theme.sizing.scale800,
89
- }[$size],
102
+ borderLeftWidth: borderSize,
103
+ borderRightWidth: borderSize,
104
+ borderTopWidth: borderSize,
105
+ borderBottomWidth: borderSize,
106
+ width: boxSize,
107
+ height: boxSize,
90
108
  cursor: 'wait',
91
109
  };
92
110
  },
@@ -8,6 +8,7 @@ LICENSE file in the root directory of this source tree.
8
8
 
9
9
  import {SIZE} from './constants.js';
10
10
  import type {OverrideT} from '../helpers/overrides.js';
11
+ import type {SizingT} from '../themes/types.js';
11
12
 
12
13
  export type SizeT = $Keys<typeof SIZE>;
13
14
  export type SpinnerPropsT = {
@@ -28,6 +29,15 @@ export type SpinnerPropsT = {
28
29
  },
29
30
  };
30
31
 
32
+ export type StyledSpinnerNextPropsT = {
33
+ /** Color of progress indicator */
34
+ $color?: string,
35
+ /** Width of the progress indicator "stroke". */
36
+ $borderWidth?: number | string | $Keys<SizingT> | SizeT,
37
+ /** Height/width of the box the indicator will appear in. */
38
+ $size?: number | string | $Keys<SizingT> | SizeT,
39
+ };
40
+
31
41
  declare var __DEV__: boolean;
32
42
  declare var __NODE__: boolean;
33
43
  declare var __BROWSER__: boolean;