@instructure/ui-spinner 8.8.1-snapshot.8 → 8.9.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/CHANGELOG.md CHANGED
@@ -3,6 +3,12 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [8.9.0](https://github.com/instructure/instructure-ui/compare/v8.8.0...v8.9.0) (2021-09-15)
7
+
8
+ ### Bug Fixes
9
+
10
+ - fix shared-types TS errors ([7b83164](https://github.com/instructure/instructure-ui/commit/7b83164f4c5872f3a217e010563f59bf584ae4fc))
11
+
6
12
  # [8.8.0](https://github.com/instructure/instructure-ui/compare/v8.7.0...v8.8.0) (2021-08-27)
7
13
 
8
14
  **Note:** Version bump only for package @instructure/ui-spinner
@@ -26,21 +26,21 @@ var _dec, _dec2, _class, _class2, _temp;
26
26
 
27
27
  /** @jsx jsx */
28
28
  import { Component } from 'react';
29
- import PropTypes from 'prop-types';
30
29
  import { View } from '@instructure/ui-view';
31
30
  import { callRenderProp, omitProps } from '@instructure/ui-react-utils';
32
31
  import { uid } from '@instructure/uid';
33
32
  import { testable } from '@instructure/ui-testable';
34
33
  import { logError as error } from '@instructure/console';
35
- import { withStyle, jsx, ThemeablePropTypes } from '@instructure/emotion';
34
+ import { withStyle, jsx } from '@instructure/emotion';
36
35
  import generateStyle from './styles';
37
36
  import generateComponentTheme from './theme';
38
-
37
+ import { allowedProps, propTypes } from './props';
39
38
  /**
40
39
  ---
41
40
  category: components
42
41
  ---
43
42
  **/
43
+
44
44
  let Spinner = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = testable(), _dec(_class = _dec2(_class = (_temp = _class2 = class Spinner extends Component {
45
45
  constructor(props) {
46
46
  super(props);
@@ -48,11 +48,15 @@ let Spinner = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
48
48
  }
49
49
 
50
50
  componentDidMount() {
51
- this.props.makeStyles();
51
+ var _this$props$makeStyle, _this$props;
52
+
53
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
52
54
  }
53
55
 
54
- componentDidUpdate(prevProps, prevState, snapshot) {
55
- this.props.makeStyles();
56
+ componentDidUpdate() {
57
+ var _this$props$makeStyle2, _this$props2;
58
+
59
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
56
60
  }
57
61
 
58
62
  radius() {
@@ -72,16 +76,18 @@ let Spinner = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
72
76
  }
73
77
 
74
78
  render() {
79
+ var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4;
80
+
75
81
  const passthroughProps = View.omitViewProps(omitProps(this.props, Spinner.propTypes), Spinner);
76
82
  const hasTitle = this.props.renderTitle;
77
83
  error(hasTitle, '[Spinner] The renderTitle prop is necessary for screen reader support.');
78
84
  return jsx(View, Object.assign({}, passthroughProps, {
79
85
  as: this.props.as,
80
86
  elementRef: this.props.elementRef,
81
- css: this.props.styles.spinner,
87
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.spinner,
82
88
  margin: this.props.margin
83
89
  }), jsx("svg", {
84
- css: this.props.styles.circle,
90
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.circle,
85
91
  role: "img",
86
92
  "aria-labelledby": this.titleId,
87
93
  focusable: "false"
@@ -90,54 +96,22 @@ let Spinner = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 =
90
96
  }, callRenderProp(this.props.renderTitle)), jsx("g", {
91
97
  role: "presentation"
92
98
  }, this.props.variant !== 'inverse' && jsx("circle", {
93
- css: this.props.styles.circleTrack,
99
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.circleTrack,
94
100
  cx: "50%",
95
101
  cy: "50%",
96
102
  r: this.radius()
97
103
  }), jsx("circle", {
98
- css: this.props.styles.circleSpin,
104
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.circleSpin,
99
105
  cx: "50%",
100
106
  cy: "50%",
101
107
  r: this.radius()
102
108
  }))));
103
109
  }
104
110
 
105
- }, _class2.displayName = "Spinner", _class2.componentId = 'Spinner', _class2.propTypes = {
106
- // eslint-disable-next-line react/require-default-props
107
- makeStyles: PropTypes.func,
108
- // eslint-disable-next-line react/require-default-props
109
- styles: PropTypes.object,
110
-
111
- /**
112
- * Give the spinner a title to be read by screenreaders
113
- */
114
- renderTitle: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
115
-
116
- /**
117
- * Different-sized spinners
118
- */
119
- size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
120
-
121
- /**
122
- * Different color schemes for use with light or dark backgrounds
123
- */
124
- variant: PropTypes.oneOf(['default', 'inverse']),
125
-
126
- /**
127
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
128
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
129
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
130
- */
131
- margin: ThemeablePropTypes.spacing,
132
- elementRef: PropTypes.func,
133
- as: PropTypes.elementType
134
- }, _class2.defaultProps = {
135
- renderTitle: void 0,
111
+ }, _class2.displayName = "Spinner", _class2.componentId = 'Spinner', _class2.allowedProps = allowedProps, _class2.propTypes = propTypes, _class2.defaultProps = {
136
112
  as: 'div',
137
113
  size: 'medium',
138
- variant: 'default',
139
- margin: void 0,
140
- elementRef: void 0
114
+ variant: 'default'
141
115
  }, _temp)) || _class) || _class);
142
116
  export default Spinner;
143
117
  export { Spinner };
@@ -21,17 +21,32 @@
21
21
  * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
22
  * SOFTWARE.
23
23
  */
24
+ import PropTypes from 'prop-types';
25
+ import { ThemeablePropTypes } from '@instructure/emotion';
26
+ const propTypes = {
27
+ /**
28
+ * Give the spinner a title to be read by screenreaders
29
+ */
30
+ renderTitle: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
24
31
 
25
- import type { Spacing } from '@instructure/emotion'
26
- import { AsElementType } from '@instructure/shared-types'
32
+ /**
33
+ * Different-sized spinners
34
+ */
35
+ size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
27
36
 
28
- export type SpinnerProps = {
29
- makeStyles?: (...args: any[]) => any
30
- styles?: any
31
- renderTitle?: ((...args: any[]) => any) | React.ReactNode
32
- size?: 'x-small' | 'small' | 'medium' | 'large'
33
- variant?: 'default' | 'inverse'
34
- margin?: Spacing
35
- elementRef?: (...args: any[]) => any
36
- as?: AsElementType
37
- }
37
+ /**
38
+ * Different color schemes for use with light or dark backgrounds
39
+ */
40
+ variant: PropTypes.oneOf(['default', 'inverse']),
41
+
42
+ /**
43
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
44
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
45
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
46
+ */
47
+ margin: ThemeablePropTypes.spacing,
48
+ elementRef: PropTypes.func,
49
+ as: PropTypes.elementType
50
+ };
51
+ const allowedProps = ['renderTitle', 'size', 'variant', 'margin', 'elementRef', 'as'];
52
+ export { propTypes, allowedProps };
@@ -9,8 +9,6 @@ exports.Spinner = exports.default = void 0;
9
9
 
10
10
  var _react = require("react");
11
11
 
12
- var _propTypes = _interopRequireDefault(require("prop-types"));
13
-
14
12
  var _View = require("@instructure/ui-view/lib/View");
15
13
 
16
14
  var _callRenderProp = require("@instructure/ui-react-utils/lib/callRenderProp.js");
@@ -29,6 +27,8 @@ var _styles = _interopRequireDefault(require("./styles"));
29
27
 
30
28
  var _theme = _interopRequireDefault(require("./theme"));
31
29
 
30
+ var _props = require("./props");
31
+
32
32
  var _dec, _dec2, _class, _class2, _temp;
33
33
 
34
34
  /**
@@ -43,11 +43,15 @@ let Spinner = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
43
43
  }
44
44
 
45
45
  componentDidMount() {
46
- this.props.makeStyles();
46
+ var _this$props$makeStyle, _this$props;
47
+
48
+ (_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
47
49
  }
48
50
 
49
- componentDidUpdate(prevProps, prevState, snapshot) {
50
- this.props.makeStyles();
51
+ componentDidUpdate() {
52
+ var _this$props$makeStyle2, _this$props2;
53
+
54
+ (_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
51
55
  }
52
56
 
53
57
  radius() {
@@ -67,6 +71,8 @@ let Spinner = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
67
71
  }
68
72
 
69
73
  render() {
74
+ var _this$props$styles, _this$props$styles2, _this$props$styles3, _this$props$styles4;
75
+
70
76
  const passthroughProps = _View.View.omitViewProps((0, _omitProps.omitProps)(this.props, Spinner.propTypes), Spinner);
71
77
 
72
78
  const hasTitle = this.props.renderTitle;
@@ -74,10 +80,10 @@ let Spinner = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
74
80
  return (0, _emotion.jsx)(_View.View, Object.assign({}, passthroughProps, {
75
81
  as: this.props.as,
76
82
  elementRef: this.props.elementRef,
77
- css: this.props.styles.spinner,
83
+ css: (_this$props$styles = this.props.styles) === null || _this$props$styles === void 0 ? void 0 : _this$props$styles.spinner,
78
84
  margin: this.props.margin
79
85
  }), (0, _emotion.jsx)("svg", {
80
- css: this.props.styles.circle,
86
+ css: (_this$props$styles2 = this.props.styles) === null || _this$props$styles2 === void 0 ? void 0 : _this$props$styles2.circle,
81
87
  role: "img",
82
88
  "aria-labelledby": this.titleId,
83
89
  focusable: "false"
@@ -86,54 +92,22 @@ let Spinner = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default),
86
92
  }, (0, _callRenderProp.callRenderProp)(this.props.renderTitle)), (0, _emotion.jsx)("g", {
87
93
  role: "presentation"
88
94
  }, this.props.variant !== 'inverse' && (0, _emotion.jsx)("circle", {
89
- css: this.props.styles.circleTrack,
95
+ css: (_this$props$styles3 = this.props.styles) === null || _this$props$styles3 === void 0 ? void 0 : _this$props$styles3.circleTrack,
90
96
  cx: "50%",
91
97
  cy: "50%",
92
98
  r: this.radius()
93
99
  }), (0, _emotion.jsx)("circle", {
94
- css: this.props.styles.circleSpin,
100
+ css: (_this$props$styles4 = this.props.styles) === null || _this$props$styles4 === void 0 ? void 0 : _this$props$styles4.circleSpin,
95
101
  cx: "50%",
96
102
  cy: "50%",
97
103
  r: this.radius()
98
104
  }))));
99
105
  }
100
106
 
101
- }, _class2.displayName = "Spinner", _class2.componentId = 'Spinner', _class2.propTypes = {
102
- // eslint-disable-next-line react/require-default-props
103
- makeStyles: _propTypes.default.func,
104
- // eslint-disable-next-line react/require-default-props
105
- styles: _propTypes.default.object,
106
-
107
- /**
108
- * Give the spinner a title to be read by screenreaders
109
- */
110
- renderTitle: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
111
-
112
- /**
113
- * Different-sized spinners
114
- */
115
- size: _propTypes.default.oneOf(['x-small', 'small', 'medium', 'large']),
116
-
117
- /**
118
- * Different color schemes for use with light or dark backgrounds
119
- */
120
- variant: _propTypes.default.oneOf(['default', 'inverse']),
121
-
122
- /**
123
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
124
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
125
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
126
- */
127
- margin: _emotion.ThemeablePropTypes.spacing,
128
- elementRef: _propTypes.default.func,
129
- as: _propTypes.default.elementType
130
- }, _class2.defaultProps = {
131
- renderTitle: void 0,
107
+ }, _class2.displayName = "Spinner", _class2.componentId = 'Spinner', _class2.allowedProps = _props.allowedProps, _class2.propTypes = _props.propTypes, _class2.defaultProps = {
132
108
  as: 'div',
133
109
  size: 'medium',
134
- variant: 'default',
135
- margin: void 0,
136
- elementRef: void 0
110
+ variant: 'default'
137
111
  }, _temp)) || _class) || _class);
138
112
  exports.Spinner = Spinner;
139
113
  var _default = Spinner;
@@ -0,0 +1,64 @@
1
+ "use strict";
2
+
3
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault").default;
4
+
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports.allowedProps = exports.propTypes = void 0;
9
+
10
+ var _propTypes = _interopRequireDefault(require("prop-types"));
11
+
12
+ var _emotion = require("@instructure/emotion");
13
+
14
+ /*
15
+ * The MIT License (MIT)
16
+ *
17
+ * Copyright (c) 2015 - present Instructure, Inc.
18
+ *
19
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
20
+ * of this software and associated documentation files (the "Software"), to deal
21
+ * in the Software without restriction, including without limitation the rights
22
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
23
+ * copies of the Software, and to permit persons to whom the Software is
24
+ * furnished to do so, subject to the following conditions:
25
+ *
26
+ * The above copyright notice and this permission notice shall be included in all
27
+ * copies or substantial portions of the Software.
28
+ *
29
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
30
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
31
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
32
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
33
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
34
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
35
+ * SOFTWARE.
36
+ */
37
+ const propTypes = {
38
+ /**
39
+ * Give the spinner a title to be read by screenreaders
40
+ */
41
+ renderTitle: _propTypes.default.oneOfType([_propTypes.default.func, _propTypes.default.node]),
42
+
43
+ /**
44
+ * Different-sized spinners
45
+ */
46
+ size: _propTypes.default.oneOf(['x-small', 'small', 'medium', 'large']),
47
+
48
+ /**
49
+ * Different color schemes for use with light or dark backgrounds
50
+ */
51
+ variant: _propTypes.default.oneOf(['default', 'inverse']),
52
+
53
+ /**
54
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
55
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
56
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
57
+ */
58
+ margin: _emotion.ThemeablePropTypes.spacing,
59
+ elementRef: _propTypes.default.func,
60
+ as: _propTypes.default.elementType
61
+ };
62
+ exports.propTypes = propTypes;
63
+ const allowedProps = ['renderTitle', 'size', 'variant', 'margin', 'elementRef', 'as'];
64
+ exports.allowedProps = allowedProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-spinner",
3
- "version": "8.8.1-snapshot.8+7b83164f4",
3
+ "version": "8.9.0",
4
4
  "description": "A spinner/loading component",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,22 +25,22 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/console": "8.8.1-snapshot.8+7b83164f4",
29
- "@instructure/emotion": "8.8.1-snapshot.8+7b83164f4",
30
- "@instructure/shared-types": "8.8.1-snapshot.8+7b83164f4",
31
- "@instructure/ui-color-utils": "8.8.1-snapshot.8+7b83164f4",
32
- "@instructure/ui-react-utils": "8.8.1-snapshot.8+7b83164f4",
33
- "@instructure/ui-testable": "8.8.1-snapshot.8+7b83164f4",
34
- "@instructure/ui-utils": "8.8.1-snapshot.8+7b83164f4",
35
- "@instructure/ui-view": "8.8.1-snapshot.8+7b83164f4",
36
- "@instructure/uid": "8.8.1-snapshot.8+7b83164f4",
28
+ "@instructure/console": "8.9.0",
29
+ "@instructure/emotion": "8.9.0",
30
+ "@instructure/shared-types": "8.9.0",
31
+ "@instructure/ui-color-utils": "8.9.0",
32
+ "@instructure/ui-react-utils": "8.9.0",
33
+ "@instructure/ui-testable": "8.9.0",
34
+ "@instructure/ui-utils": "8.9.0",
35
+ "@instructure/ui-view": "8.9.0",
36
+ "@instructure/uid": "8.9.0",
37
37
  "prop-types": "^15"
38
38
  },
39
39
  "devDependencies": {
40
- "@instructure/ui-babel-preset": "8.8.1-snapshot.8+7b83164f4",
41
- "@instructure/ui-test-locator": "8.8.1-snapshot.8+7b83164f4",
42
- "@instructure/ui-test-utils": "8.8.1-snapshot.8+7b83164f4",
43
- "@instructure/ui-themes": "8.8.1-snapshot.8+7b83164f4"
40
+ "@instructure/ui-babel-preset": "8.9.0",
41
+ "@instructure/ui-test-locator": "8.9.0",
42
+ "@instructure/ui-test-utils": "8.9.0",
43
+ "@instructure/ui-themes": "8.9.0"
44
44
  },
45
45
  "peerDependencies": {
46
46
  "react": ">=16.8 <=17"
@@ -48,6 +48,5 @@
48
48
  "publishConfig": {
49
49
  "access": "public"
50
50
  },
51
- "sideEffects": false,
52
- "gitHead": "7b83164f4c5872f3a217e010563f59bf584ae4fc"
51
+ "sideEffects": false
53
52
  }
@@ -23,7 +23,6 @@
23
23
  */
24
24
  /** @jsx jsx */
25
25
  import { Component } from 'react'
26
- import PropTypes from 'prop-types'
27
26
 
28
27
  import { View } from '@instructure/ui-view'
29
28
  import { callRenderProp, omitProps } from '@instructure/ui-react-utils'
@@ -31,11 +30,12 @@ import { uid } from '@instructure/uid'
31
30
  import { testable } from '@instructure/ui-testable'
32
31
  import { logError as error } from '@instructure/console'
33
32
 
34
- import { withStyle, jsx, ThemeablePropTypes } from '@instructure/emotion'
33
+ import { withStyle, jsx } from '@instructure/emotion'
35
34
 
36
35
  import generateStyle from './styles'
37
36
  import generateComponentTheme from './theme'
38
- import { SpinnerProps } from './types'
37
+ import type { SpinnerProps } from './props'
38
+ import { allowedProps, propTypes } from './props'
39
39
 
40
40
  /**
41
41
  ---
@@ -46,41 +46,12 @@ category: components
46
46
  @testable()
47
47
  class Spinner extends Component<SpinnerProps> {
48
48
  static readonly componentId = 'Spinner'
49
-
50
- static propTypes = {
51
- // eslint-disable-next-line react/require-default-props
52
- makeStyles: PropTypes.func,
53
- // eslint-disable-next-line react/require-default-props
54
- styles: PropTypes.object,
55
- /**
56
- * Give the spinner a title to be read by screenreaders
57
- */
58
- renderTitle: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
59
- /**
60
- * Different-sized spinners
61
- */
62
- size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
63
- /**
64
- * Different color schemes for use with light or dark backgrounds
65
- */
66
- variant: PropTypes.oneOf(['default', 'inverse']),
67
- /**
68
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
69
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
70
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
71
- */
72
- margin: ThemeablePropTypes.spacing,
73
- elementRef: PropTypes.func,
74
- as: PropTypes.elementType
75
- }
76
-
49
+ static allowedProps = allowedProps
50
+ static propTypes = propTypes
77
51
  static defaultProps = {
78
- renderTitle: undefined,
79
52
  as: 'div',
80
53
  size: 'medium',
81
- variant: 'default',
82
- margin: undefined,
83
- elementRef: undefined
54
+ variant: 'default'
84
55
  }
85
56
 
86
57
  // @ts-expect-error ts-migrate(7006) FIXME: Parameter 'props' implicitly has an 'any' type.
@@ -92,14 +63,11 @@ class Spinner extends Component<SpinnerProps> {
92
63
  }
93
64
 
94
65
  componentDidMount() {
95
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
96
- this.props.makeStyles()
66
+ this.props.makeStyles?.()
97
67
  }
98
68
 
99
- // @ts-expect-error ts-migrate(6133) FIXME: 'prevProps' is declared but its value is never rea... Remove this comment to see the full error message
100
- componentDidUpdate(prevProps, prevState, snapshot) {
101
- // @ts-expect-error ts-migrate(2722) FIXME: Cannot invoke an object which is possibly 'undefin... Remove this comment to see the full error message
102
- this.props.makeStyles()
69
+ componentDidUpdate() {
70
+ this.props.makeStyles?.()
103
71
  }
104
72
 
105
73
  radius() {
@@ -133,11 +101,11 @@ class Spinner extends Component<SpinnerProps> {
133
101
  {...passthroughProps}
134
102
  as={this.props.as}
135
103
  elementRef={this.props.elementRef}
136
- css={this.props.styles.spinner}
104
+ css={this.props.styles?.spinner}
137
105
  margin={this.props.margin}
138
106
  >
139
107
  <svg
140
- css={this.props.styles.circle}
108
+ css={this.props.styles?.circle}
141
109
  role="img"
142
110
  // @ts-expect-error ts-migrate(2339) FIXME: Property 'titleId' does not exist on type 'Spinner... Remove this comment to see the full error message
143
111
  aria-labelledby={this.titleId}
@@ -150,14 +118,14 @@ class Spinner extends Component<SpinnerProps> {
150
118
  <g role="presentation">
151
119
  {this.props.variant !== 'inverse' && (
152
120
  <circle
153
- css={this.props.styles.circleTrack}
121
+ css={this.props.styles?.circleTrack}
154
122
  cx="50%"
155
123
  cy="50%"
156
124
  r={this.radius()}
157
125
  />
158
126
  )}
159
127
  <circle
160
- css={this.props.styles.circleSpin}
128
+ css={this.props.styles?.circleSpin}
161
129
  cx="50%"
162
130
  cy="50%"
163
131
  r={this.radius()}
@@ -0,0 +1,79 @@
1
+ /*
2
+ * The MIT License (MIT)
3
+ *
4
+ * Copyright (c) 2015 - present Instructure, Inc.
5
+ *
6
+ * Permission is hereby granted, free of charge, to any person obtaining a copy
7
+ * of this software and associated documentation files (the "Software"), to deal
8
+ * in the Software without restriction, including without limitation the rights
9
+ * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
10
+ * copies of the Software, and to permit persons to whom the Software is
11
+ * furnished to do so, subject to the following conditions:
12
+ *
13
+ * The above copyright notice and this permission notice shall be included in all
14
+ * copies or substantial portions of the Software.
15
+ *
16
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
21
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
22
+ * SOFTWARE.
23
+ */
24
+ import PropTypes from 'prop-types'
25
+
26
+ import { ThemeablePropTypes } from '@instructure/emotion'
27
+
28
+ import type { Spacing, WithStyleProps } from '@instructure/emotion'
29
+ import type { AsElementType, PropValidators } from '@instructure/shared-types'
30
+
31
+ type SpinnerOwnProps = {
32
+ renderTitle?: ((...args: any[]) => any) | React.ReactNode
33
+ size?: 'x-small' | 'small' | 'medium' | 'large'
34
+ variant?: 'default' | 'inverse'
35
+ margin?: Spacing
36
+ elementRef?: (...args: any[]) => any
37
+ as?: AsElementType
38
+ }
39
+
40
+ type PropKeys = keyof SpinnerOwnProps
41
+
42
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
43
+
44
+ type SpinnerProps = SpinnerOwnProps & WithStyleProps
45
+
46
+ const propTypes: PropValidators<PropKeys> = {
47
+ /**
48
+ * Give the spinner a title to be read by screenreaders
49
+ */
50
+ renderTitle: PropTypes.oneOfType([PropTypes.func, PropTypes.node]),
51
+ /**
52
+ * Different-sized spinners
53
+ */
54
+ size: PropTypes.oneOf(['x-small', 'small', 'medium', 'large']),
55
+ /**
56
+ * Different color schemes for use with light or dark backgrounds
57
+ */
58
+ variant: PropTypes.oneOf(['default', 'inverse']),
59
+ /**
60
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
61
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
62
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
63
+ */
64
+ margin: ThemeablePropTypes.spacing,
65
+ elementRef: PropTypes.func,
66
+ as: PropTypes.elementType
67
+ }
68
+
69
+ const allowedProps: AllowedPropKeys = [
70
+ 'renderTitle',
71
+ 'size',
72
+ 'variant',
73
+ 'margin',
74
+ 'elementRef',
75
+ 'as'
76
+ ]
77
+
78
+ export type { SpinnerProps }
79
+ export { propTypes, allowedProps }
@@ -24,7 +24,7 @@
24
24
 
25
25
  import { keyframes } from '@instructure/emotion'
26
26
  import { SpinnerTheme } from '@instructure/shared-types'
27
- import { SpinnerProps } from './types'
27
+ import { SpinnerProps } from './props'
28
28
 
29
29
  // keyframes have to be outside of 'generateStyle',
30
30
  // since it is causing problems in style recalculation
package/src/index.ts CHANGED
@@ -23,4 +23,4 @@
23
23
  */
24
24
 
25
25
  export { Spinner } from './Spinner'
26
- export type { SpinnerProps } from './Spinner/types'
26
+ export type { SpinnerProps } from './Spinner/props'
@@ -1,8 +1,7 @@
1
1
  /** @jsx jsx */
2
2
  import { Component } from 'react';
3
- import PropTypes from 'prop-types';
4
3
  import { jsx } from '@instructure/emotion';
5
- import { SpinnerProps } from './types';
4
+ import type { SpinnerProps } from './props';
6
5
  /**
7
6
  ---
8
7
  category: components
@@ -10,41 +9,30 @@ category: components
10
9
  **/
11
10
  declare class Spinner extends Component<SpinnerProps> {
12
11
  static readonly componentId = "Spinner";
13
- static propTypes: {
14
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
15
- styles: PropTypes.Requireable<object>;
16
- /**
17
- * Give the spinner a title to be read by screenreaders
18
- */
19
- renderTitle: PropTypes.Requireable<string | number | boolean | {} | PropTypes.ReactElementLike | PropTypes.ReactNodeArray>;
20
- /**
21
- * Different-sized spinners
22
- */
23
- size: PropTypes.Requireable<string>;
24
- /**
25
- * Different color schemes for use with light or dark backgrounds
26
- */
27
- variant: PropTypes.Requireable<string>;
28
- /**
29
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
30
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
31
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
32
- */
33
- margin: (props: any, propName: any, componentName: any, location: any) => any;
34
- elementRef: PropTypes.Requireable<(...args: any[]) => any>;
35
- as: PropTypes.Requireable<PropTypes.ReactComponentLike>;
36
- };
12
+ static allowedProps: readonly (keyof {
13
+ renderTitle?: import("react").ReactNode | ((...args: any[]) => any);
14
+ size?: "x-small" | "small" | "medium" | "large" | undefined;
15
+ variant?: "default" | "inverse" | undefined;
16
+ margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
17
+ elementRef?: ((...args: any[]) => any) | undefined;
18
+ as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
19
+ })[];
20
+ static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
21
+ renderTitle?: import("react").ReactNode | ((...args: any[]) => any);
22
+ size?: "x-small" | "small" | "medium" | "large" | undefined;
23
+ variant?: "default" | "inverse" | undefined;
24
+ margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
25
+ elementRef?: ((...args: any[]) => any) | undefined;
26
+ as?: import("@instructure/shared-types/types/CommonProps").AsElementType | undefined;
27
+ }>;
37
28
  static defaultProps: {
38
- renderTitle: undefined;
39
29
  as: string;
40
30
  size: string;
41
31
  variant: string;
42
- margin: undefined;
43
- elementRef: undefined;
44
32
  };
45
33
  constructor(props: any);
46
34
  componentDidMount(): void;
47
- componentDidUpdate(prevProps: any, prevState: any, snapshot: any): void;
35
+ componentDidUpdate(): void;
48
36
  radius(): "0.5em" | "1em" | "2.25em" | "1.75em";
49
37
  render(): jsx.JSX.Element;
50
38
  }
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Spinner/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,SAAS,MAAM,YAAY,CAAA;AAQlC,OAAO,EAAa,GAAG,EAAsB,MAAM,sBAAsB,CAAA;AAIzE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAEtC;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,CAAC;IAC3C,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IAEvC,MAAM,CAAC,SAAS;;;QAKd;;WAEG;;QAEH;;WAEG;;QAEH;;WAEG;;QAEH;;;;WAIG;;;;MAIJ;IAED,MAAM,CAAC,YAAY;;;;;;;MAOlB;gBAGW,KAAK,KAAA;IAOjB,iBAAiB;IAMjB,kBAAkB,CAAC,SAAS,KAAA,EAAE,SAAS,KAAA,EAAE,QAAQ,KAAA;IAKjD,MAAM;IAaN,MAAM;CAoDP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Spinner/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAQjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAIrD,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,SAAS,CAAA;AAG3C;;;;GAIG;AACH,cAEM,OAAQ,SAAQ,SAAS,CAAC,YAAY,CAAC;IAC3C,MAAM,CAAC,QAAQ,CAAC,WAAW,aAAY;IACvC,MAAM,CAAC,YAAY;;;;;;;SAAe;IAClC,MAAM,CAAC,SAAS;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;MAIlB;gBAGW,KAAK,KAAA;IAOjB,iBAAiB;IAIjB,kBAAkB;IAIlB,MAAM;IAaN,MAAM;CAoDP;AAED,eAAe,OAAO,CAAA;AACtB,OAAO,EAAE,OAAO,EAAE,CAAA"}
@@ -0,0 +1,19 @@
1
+ /// <reference types="react" />
2
+ import type { Spacing, WithStyleProps } from '@instructure/emotion';
3
+ import type { AsElementType, PropValidators } from '@instructure/shared-types';
4
+ declare type SpinnerOwnProps = {
5
+ renderTitle?: ((...args: any[]) => any) | React.ReactNode;
6
+ size?: 'x-small' | 'small' | 'medium' | 'large';
7
+ variant?: 'default' | 'inverse';
8
+ margin?: Spacing;
9
+ elementRef?: (...args: any[]) => any;
10
+ as?: AsElementType;
11
+ };
12
+ declare type PropKeys = keyof SpinnerOwnProps;
13
+ declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
14
+ declare type SpinnerProps = SpinnerOwnProps & WithStyleProps;
15
+ declare const propTypes: PropValidators<PropKeys>;
16
+ declare const allowedProps: AllowedPropKeys;
17
+ export type { SpinnerProps };
18
+ export { propTypes, allowedProps };
19
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Spinner/props.ts"],"names":[],"mappings":";AA2BA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,KAAK,EAAE,aAAa,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAE9E,aAAK,eAAe,GAAG;IACrB,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,CAAA;IACzD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC/C,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,EAAE,CAAC,EAAE,aAAa,CAAA;CACnB,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,eAAe,CAAA;AAErC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,YAAY,GAAG,eAAe,GAAG,cAAc,CAAA;AAEpD,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CAqBvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAOnB,CAAA;AAED,YAAY,EAAE,YAAY,EAAE,CAAA;AAC5B,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { SpinnerTheme } from '@instructure/shared-types';
2
- import { SpinnerProps } from './types';
2
+ import { SpinnerProps } from './props';
3
3
  /**
4
4
  * ---
5
5
  * private: true
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { Spinner } from './Spinner';
2
- export type { SpinnerProps } from './Spinner/types';
2
+ export type { SpinnerProps } from './Spinner/props';
3
3
  //# sourceMappingURL=index.d.ts.map
package/LICENSE.md DELETED
@@ -1,27 +0,0 @@
1
- ---
2
- title: The MIT License (MIT)
3
- category: Getting Started
4
- order: 9
5
- ---
6
-
7
- # The MIT License (MIT)
8
-
9
- Copyright (c) 2015 Instructure, Inc.
10
-
11
- **Permission is hereby granted, free of charge, to any person obtaining a copy
12
- of this software and associated documentation files (the "Software"), to deal
13
- in the Software without restriction, including without limitation the rights
14
- to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
15
- copies of the Software, and to permit persons to whom the Software is
16
- furnished to do so, subject to the following conditions.**
17
-
18
- The above copyright notice and this permission notice shall be included in all
19
- copies or substantial portions of the Software.
20
-
21
- THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
22
- IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
23
- FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
24
- AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
25
- LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
26
- OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
27
- SOFTWARE.
@@ -1 +0,0 @@
1
- export {};
@@ -1 +0,0 @@
1
- "use strict";
@@ -1,14 +0,0 @@
1
- /// <reference types="react" />
2
- import type { Spacing } from '@instructure/emotion';
3
- import { AsElementType } from '@instructure/shared-types';
4
- export declare type SpinnerProps = {
5
- makeStyles?: (...args: any[]) => any;
6
- styles?: any;
7
- renderTitle?: ((...args: any[]) => any) | React.ReactNode;
8
- size?: 'x-small' | 'small' | 'medium' | 'large';
9
- variant?: 'default' | 'inverse';
10
- margin?: Spacing;
11
- elementRef?: (...args: any[]) => any;
12
- as?: AsElementType;
13
- };
14
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Spinner/types.ts"],"names":[],"mappings":";AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AACnD,OAAO,EAAE,aAAa,EAAE,MAAM,2BAA2B,CAAA;AAEzD,oBAAY,YAAY,GAAG;IACzB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,WAAW,CAAC,EAAE,CAAC,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAC,GAAG,KAAK,CAAC,SAAS,CAAA;IACzD,IAAI,CAAC,EAAE,SAAS,GAAG,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAA;IAC/C,OAAO,CAAC,EAAE,SAAS,GAAG,SAAS,CAAA;IAC/B,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,EAAE,CAAC,EAAE,aAAa,CAAA;CACnB,CAAA"}