@instructure/ui-img 8.8.1-snapshot.7 → 8.9.1-snapshot.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.
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-img
package/es/Img/index.js CHANGED
@@ -29,13 +29,13 @@ var _dec, _dec2, _class, _class2, _temp;
29
29
 
30
30
  /** @jsx jsx */
31
31
  import { Component } from 'react';
32
- import PropTypes from 'prop-types';
33
32
  import { View } from '@instructure/ui-view';
34
33
  import { passthroughProps } from '@instructure/ui-react-utils';
35
34
  import { testable } from '@instructure/ui-testable';
36
- import { withStyle, jsx, ThemeablePropTypes } from '@instructure/emotion';
35
+ import { withStyle, jsx } from '@instructure/emotion';
37
36
  import generateStyle from './styles';
38
37
  import generateComponentTheme from './theme';
38
+ import { propTypes, allowedProps } from './props';
39
39
 
40
40
  /**
41
41
  ---
@@ -71,7 +71,7 @@ let Img = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = test
71
71
  alt: alt || ''
72
72
  };
73
73
  const imageProps = {
74
- css: styles.img,
74
+ css: styles === null || styles === void 0 ? void 0 : styles.img,
75
75
  src
76
76
  };
77
77
  const containerProps = { ...passthroughProps(props),
@@ -88,10 +88,10 @@ let Img = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = test
88
88
  };
89
89
  return jsx(View, Object.assign({}, rootProps, {
90
90
  as: "span",
91
- css: styles.container
91
+ css: styles === null || styles === void 0 ? void 0 : styles.container
92
92
  }), jsx("img", Object.assign({}, imageProps, a11yProps)) // eslint-disable-line jsx-a11y/alt-text
93
93
  , overlay && jsx("span", {
94
- css: styles.overlay
94
+ css: styles === null || styles === void 0 ? void 0 : styles.overlay
95
95
  }));
96
96
  } else {
97
97
  return jsx(View, Object.assign({}, containerProps, imageProps, a11yProps, {
@@ -100,44 +100,7 @@ let Img = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = test
100
100
  }
101
101
  }
102
102
 
103
- }, _class2.displayName = "Img", _class2.componentId = 'Img', _class2.propTypes = {
104
- // eslint-disable-next-line react/require-default-props
105
- makeStyles: PropTypes.func,
106
- // eslint-disable-next-line react/require-default-props
107
- styles: PropTypes.object,
108
- src: PropTypes.string.isRequired,
109
- alt: PropTypes.string,
110
- display: PropTypes.oneOf(['inline-block', 'block']),
111
-
112
- /**
113
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
114
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
115
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
116
- */
117
- margin: ThemeablePropTypes.spacing,
118
-
119
- /**
120
- * Valid values for `opacity` are `0` - `10`. Valid values for `blend` are
121
- * `normal` (default), `multiply`, `screen`, `overlay`, and `color-burn`.
122
- */
123
- overlay: PropTypes.shape({
124
- color: PropTypes.string.isRequired,
125
- opacity: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).isRequired,
126
- blend: PropTypes.oneOf(['normal', 'multiply', 'screen', 'overlay', 'color-burn'])
127
- }),
128
- withGrayscale: PropTypes.bool,
129
- withBlur: PropTypes.bool,
130
- constrain: PropTypes.oneOf(['cover', 'contain']),
131
- elementRef: PropTypes.func,
132
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
133
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
134
- }, _class2.defaultProps = {
135
- margin: void 0,
136
- overlay: void 0,
137
- constrain: void 0,
138
- elementRef: void 0,
139
- height: void 0,
140
- width: void 0,
103
+ }, _class2.displayName = "Img", _class2.componentId = 'Img', _class2.propTypes = propTypes, _class2.allowedProps = allowedProps, _class2.defaultProps = {
141
104
  alt: '',
142
105
  display: 'inline-block',
143
106
  withGrayscale: false,
@@ -0,0 +1,55 @@
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
+ import { ThemeablePropTypes } from '@instructure/emotion';
26
+ const propTypes = {
27
+ src: PropTypes.string.isRequired,
28
+ alt: PropTypes.string,
29
+ display: PropTypes.oneOf(['inline-block', 'block']),
30
+
31
+ /**
32
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
33
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
34
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
35
+ */
36
+ margin: ThemeablePropTypes.spacing,
37
+
38
+ /**
39
+ * Valid values for `opacity` are `0` - `10`. Valid values for `blend` are
40
+ * `normal` (default), `multiply`, `screen`, `overlay`, and `color-burn`.
41
+ */
42
+ overlay: PropTypes.shape({
43
+ color: PropTypes.string.isRequired,
44
+ opacity: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).isRequired,
45
+ blend: PropTypes.oneOf(['normal', 'multiply', 'screen', 'overlay', 'color-burn'])
46
+ }),
47
+ withGrayscale: PropTypes.bool,
48
+ withBlur: PropTypes.bool,
49
+ constrain: PropTypes.oneOf(['cover', 'contain']),
50
+ elementRef: PropTypes.func,
51
+ height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
52
+ width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
53
+ };
54
+ const allowedProps = ['src', 'alt', 'display', 'margin', 'overlay', 'withGrayscale', 'withBlur', 'constrain', 'elementRef', 'height', 'width'];
55
+ export { propTypes, allowedProps };
package/lib/Img/index.js CHANGED
@@ -11,8 +11,6 @@ var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/h
11
11
 
12
12
  var _react = require("react");
13
13
 
14
- var _propTypes = _interopRequireDefault(require("prop-types"));
15
-
16
14
  var _View = require("@instructure/ui-view/lib/View");
17
15
 
18
16
  var _passthroughProps = require("@instructure/ui-react-utils/lib/passthroughProps.js");
@@ -25,6 +23,8 @@ var _styles = _interopRequireDefault(require("./styles"));
25
23
 
26
24
  var _theme = _interopRequireDefault(require("./theme"));
27
25
 
26
+ var _props = require("./props");
27
+
28
28
  const _excluded = ["src", "alt", "margin", "display", "overlay", "withGrayscale", "withBlur", "constrain", "width", "height", "elementRef", "styles"];
29
29
 
30
30
  var _dec, _dec2, _class, _class2, _temp;
@@ -62,7 +62,7 @@ let Img = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
62
62
  alt: alt || ''
63
63
  };
64
64
  const imageProps = {
65
- css: styles.img,
65
+ css: styles === null || styles === void 0 ? void 0 : styles.img,
66
66
  src
67
67
  };
68
68
  const containerProps = { ...(0, _passthroughProps.passthroughProps)(props),
@@ -79,10 +79,10 @@ let Img = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
79
79
  };
80
80
  return (0, _emotion.jsx)(_View.View, Object.assign({}, rootProps, {
81
81
  as: "span",
82
- css: styles.container
82
+ css: styles === null || styles === void 0 ? void 0 : styles.container
83
83
  }), (0, _emotion.jsx)("img", Object.assign({}, imageProps, a11yProps)) // eslint-disable-line jsx-a11y/alt-text
84
84
  , overlay && (0, _emotion.jsx)("span", {
85
- css: styles.overlay
85
+ css: styles === null || styles === void 0 ? void 0 : styles.overlay
86
86
  }));
87
87
  } else {
88
88
  return (0, _emotion.jsx)(_View.View, Object.assign({}, containerProps, imageProps, a11yProps, {
@@ -91,44 +91,7 @@ let Img = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
91
91
  }
92
92
  }
93
93
 
94
- }, _class2.displayName = "Img", _class2.componentId = 'Img', _class2.propTypes = {
95
- // eslint-disable-next-line react/require-default-props
96
- makeStyles: _propTypes.default.func,
97
- // eslint-disable-next-line react/require-default-props
98
- styles: _propTypes.default.object,
99
- src: _propTypes.default.string.isRequired,
100
- alt: _propTypes.default.string,
101
- display: _propTypes.default.oneOf(['inline-block', 'block']),
102
-
103
- /**
104
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
105
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
106
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
107
- */
108
- margin: _emotion.ThemeablePropTypes.spacing,
109
-
110
- /**
111
- * Valid values for `opacity` are `0` - `10`. Valid values for `blend` are
112
- * `normal` (default), `multiply`, `screen`, `overlay`, and `color-burn`.
113
- */
114
- overlay: _propTypes.default.shape({
115
- color: _propTypes.default.string.isRequired,
116
- opacity: _propTypes.default.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).isRequired,
117
- blend: _propTypes.default.oneOf(['normal', 'multiply', 'screen', 'overlay', 'color-burn'])
118
- }),
119
- withGrayscale: _propTypes.default.bool,
120
- withBlur: _propTypes.default.bool,
121
- constrain: _propTypes.default.oneOf(['cover', 'contain']),
122
- elementRef: _propTypes.default.func,
123
- height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
124
- width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
125
- }, _class2.defaultProps = {
126
- margin: void 0,
127
- overlay: void 0,
128
- constrain: void 0,
129
- elementRef: void 0,
130
- height: void 0,
131
- width: void 0,
94
+ }, _class2.displayName = "Img", _class2.componentId = 'Img', _class2.propTypes = _props.propTypes, _class2.allowedProps = _props.allowedProps, _class2.defaultProps = {
132
95
  alt: '',
133
96
  display: 'inline-block',
134
97
  withGrayscale: false,
@@ -0,0 +1,67 @@
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
+ src: _propTypes.default.string.isRequired,
39
+ alt: _propTypes.default.string,
40
+ display: _propTypes.default.oneOf(['inline-block', 'block']),
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: _emotion.ThemeablePropTypes.spacing,
48
+
49
+ /**
50
+ * Valid values for `opacity` are `0` - `10`. Valid values for `blend` are
51
+ * `normal` (default), `multiply`, `screen`, `overlay`, and `color-burn`.
52
+ */
53
+ overlay: _propTypes.default.shape({
54
+ color: _propTypes.default.string.isRequired,
55
+ opacity: _propTypes.default.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).isRequired,
56
+ blend: _propTypes.default.oneOf(['normal', 'multiply', 'screen', 'overlay', 'color-burn'])
57
+ }),
58
+ withGrayscale: _propTypes.default.bool,
59
+ withBlur: _propTypes.default.bool,
60
+ constrain: _propTypes.default.oneOf(['cover', 'contain']),
61
+ elementRef: _propTypes.default.func,
62
+ height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
63
+ width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
64
+ };
65
+ exports.propTypes = propTypes;
66
+ const allowedProps = ['src', 'alt', 'display', 'margin', 'overlay', 'withGrayscale', 'withBlur', 'constrain', 'elementRef', 'height', 'width'];
67
+ exports.allowedProps = allowedProps;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@instructure/ui-img",
3
- "version": "8.8.1-snapshot.7+90b251d58",
3
+ "version": "8.9.1-snapshot.2+7f5faa3df",
4
4
  "description": "An accessible image component.",
5
5
  "author": "Instructure, Inc. Engineering and Product Design",
6
6
  "type": "commonjs",
@@ -25,19 +25,19 @@
25
25
  "license": "MIT",
26
26
  "dependencies": {
27
27
  "@babel/runtime": "^7.13.10",
28
- "@instructure/console": "8.8.1-snapshot.7+90b251d58",
29
- "@instructure/emotion": "8.8.1-snapshot.7+90b251d58",
30
- "@instructure/ui-dom-utils": "8.8.1-snapshot.7+90b251d58",
31
- "@instructure/ui-react-utils": "8.8.1-snapshot.7+90b251d58",
32
- "@instructure/ui-testable": "8.8.1-snapshot.7+90b251d58",
33
- "@instructure/ui-view": "8.8.1-snapshot.7+90b251d58",
28
+ "@instructure/console": "8.9.1-snapshot.2+7f5faa3df",
29
+ "@instructure/emotion": "8.9.1-snapshot.2+7f5faa3df",
30
+ "@instructure/shared-types": "8.9.1-snapshot.2+7f5faa3df",
31
+ "@instructure/ui-dom-utils": "8.9.1-snapshot.2+7f5faa3df",
32
+ "@instructure/ui-react-utils": "8.9.1-snapshot.2+7f5faa3df",
33
+ "@instructure/ui-testable": "8.9.1-snapshot.2+7f5faa3df",
34
+ "@instructure/ui-view": "8.9.1-snapshot.2+7f5faa3df",
34
35
  "prop-types": "^15"
35
36
  },
36
37
  "devDependencies": {
37
- "@instructure/shared-types": "8.8.1-snapshot.7+90b251d58",
38
- "@instructure/ui-babel-preset": "8.8.1-snapshot.7+90b251d58",
39
- "@instructure/ui-test-locator": "8.8.1-snapshot.7+90b251d58",
40
- "@instructure/ui-test-utils": "8.8.1-snapshot.7+90b251d58"
38
+ "@instructure/ui-babel-preset": "8.9.1-snapshot.2+7f5faa3df",
39
+ "@instructure/ui-test-locator": "8.9.1-snapshot.2+7f5faa3df",
40
+ "@instructure/ui-test-utils": "8.9.1-snapshot.2+7f5faa3df"
41
41
  },
42
42
  "peerDependencies": {
43
43
  "react": ">=16.8 <=17"
@@ -46,5 +46,5 @@
46
46
  "access": "public"
47
47
  },
48
48
  "sideEffects": false,
49
- "gitHead": "90b251d580c75205b6cbb884fe922059cfc494dd"
49
+ "gitHead": "7f5faa3df83667636304e0901ef1008d98dffc9a"
50
50
  }
package/src/Img/index.tsx CHANGED
@@ -23,17 +23,18 @@
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 { passthroughProps } from '@instructure/ui-react-utils'
30
29
  import { testable } from '@instructure/ui-testable'
31
30
 
32
- import { withStyle, jsx, ThemeablePropTypes } from '@instructure/emotion'
31
+ import { withStyle, jsx } from '@instructure/emotion'
33
32
 
34
33
  import generateStyle from './styles'
35
34
  import generateComponentTheme from './theme'
36
- import { ImgProps } from './types'
35
+
36
+ import { propTypes, allowedProps } from './props'
37
+ import type { ImgProps } from './props'
37
38
 
38
39
  /**
39
40
  ---
@@ -45,50 +46,9 @@ category: components
45
46
  class Img extends Component<ImgProps> {
46
47
  static readonly componentId = 'Img'
47
48
 
48
- static propTypes = {
49
- // eslint-disable-next-line react/require-default-props
50
- makeStyles: PropTypes.func,
51
- // eslint-disable-next-line react/require-default-props
52
- styles: PropTypes.object,
53
- src: PropTypes.string.isRequired,
54
- alt: PropTypes.string,
55
- display: PropTypes.oneOf(['inline-block', 'block']),
56
- /**
57
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
58
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
59
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
60
- */
61
- margin: ThemeablePropTypes.spacing,
62
- /**
63
- * Valid values for `opacity` are `0` - `10`. Valid values for `blend` are
64
- * `normal` (default), `multiply`, `screen`, `overlay`, and `color-burn`.
65
- */
66
- overlay: PropTypes.shape({
67
- color: PropTypes.string.isRequired,
68
- opacity: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).isRequired,
69
- blend: PropTypes.oneOf([
70
- 'normal',
71
- 'multiply',
72
- 'screen',
73
- 'overlay',
74
- 'color-burn'
75
- ])
76
- }),
77
- withGrayscale: PropTypes.bool,
78
- withBlur: PropTypes.bool,
79
- constrain: PropTypes.oneOf(['cover', 'contain']),
80
- elementRef: PropTypes.func,
81
- height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
82
- width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
83
- }
84
-
49
+ static propTypes = propTypes
50
+ static allowedProps = allowedProps
85
51
  static defaultProps = {
86
- margin: undefined,
87
- overlay: undefined,
88
- constrain: undefined,
89
- elementRef: undefined,
90
- height: undefined,
91
- width: undefined,
92
52
  alt: '',
93
53
  display: 'inline-block',
94
54
  withGrayscale: false,
@@ -127,7 +87,7 @@ class Img extends Component<ImgProps> {
127
87
  }
128
88
 
129
89
  const imageProps = {
130
- css: styles.img,
90
+ css: styles?.img,
131
91
  src
132
92
  }
133
93
 
@@ -147,11 +107,11 @@ class Img extends Component<ImgProps> {
147
107
  }
148
108
 
149
109
  return (
150
- <View {...rootProps} as="span" css={styles.container}>
110
+ <View {...rootProps} as="span" css={styles?.container}>
151
111
  {
152
112
  <img {...imageProps} {...a11yProps} /> // eslint-disable-line jsx-a11y/alt-text
153
113
  }
154
- {overlay && <span css={styles.overlay} />}
114
+ {overlay && <span css={styles?.overlay} />}
155
115
  </View>
156
116
  )
157
117
  } else {
@@ -0,0 +1,102 @@
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
+
25
+ import type { Spacing, WithStyleProps } from '@instructure/emotion'
26
+ import { PropValidators } from '@instructure/shared-types'
27
+ import PropTypes from 'prop-types'
28
+ import { ThemeablePropTypes } from '@instructure/emotion'
29
+
30
+ type ImgOwnProps = {
31
+ src: string
32
+ alt?: string
33
+ display?: 'inline-block' | 'block'
34
+ margin?: Spacing
35
+ overlay?: {
36
+ color: string
37
+ opacity: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
38
+ blend?: 'normal' | 'multiply' | 'screen' | 'overlay' | 'color-burn'
39
+ }
40
+ withGrayscale?: boolean
41
+ withBlur?: boolean
42
+ constrain?: 'cover' | 'contain'
43
+ elementRef?: (...args: any[]) => any
44
+ height?: string | number
45
+ width?: string | number
46
+ }
47
+
48
+ type PropKeys = keyof ImgOwnProps
49
+
50
+ type AllowedPropKeys = Readonly<Array<PropKeys>>
51
+
52
+ type ImgProps = ImgOwnProps & WithStyleProps
53
+
54
+ const propTypes: PropValidators<PropKeys> = {
55
+ src: PropTypes.string.isRequired,
56
+ alt: PropTypes.string,
57
+ display: PropTypes.oneOf(['inline-block', 'block']),
58
+ /**
59
+ * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
60
+ * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
61
+ * familiar CSS-like shorthand. For example: `margin="small auto large"`.
62
+ */
63
+ margin: ThemeablePropTypes.spacing,
64
+ /**
65
+ * Valid values for `opacity` are `0` - `10`. Valid values for `blend` are
66
+ * `normal` (default), `multiply`, `screen`, `overlay`, and `color-burn`.
67
+ */
68
+ overlay: PropTypes.shape({
69
+ color: PropTypes.string.isRequired,
70
+ opacity: PropTypes.oneOf([0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10]).isRequired,
71
+ blend: PropTypes.oneOf([
72
+ 'normal',
73
+ 'multiply',
74
+ 'screen',
75
+ 'overlay',
76
+ 'color-burn'
77
+ ])
78
+ }),
79
+ withGrayscale: PropTypes.bool,
80
+ withBlur: PropTypes.bool,
81
+ constrain: PropTypes.oneOf(['cover', 'contain']),
82
+ elementRef: PropTypes.func,
83
+ height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
84
+ width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
85
+ }
86
+
87
+ const allowedProps: AllowedPropKeys = [
88
+ 'src',
89
+ 'alt',
90
+ 'display',
91
+ 'margin',
92
+ 'overlay',
93
+ 'withGrayscale',
94
+ 'withBlur',
95
+ 'constrain',
96
+ 'elementRef',
97
+ 'height',
98
+ 'width'
99
+ ]
100
+
101
+ export type { ImgProps }
102
+ export { propTypes, allowedProps }
package/src/Img/styles.ts CHANGED
@@ -23,7 +23,7 @@
23
23
  */
24
24
 
25
25
  import { ImgTheme } from '@instructure/shared-types'
26
- import { ImgProps } from './types'
26
+ import { ImgProps } from './props'
27
27
 
28
28
  /**
29
29
  * ---
package/src/index.ts CHANGED
@@ -22,4 +22,4 @@
22
22
  * SOFTWARE.
23
23
  */
24
24
  export { Img } from './Img'
25
- export type { ImgProps } from './Img/types'
25
+ export type { ImgProps } from './Img/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 { ImgProps } from './types';
4
+ import type { ImgProps } from './props';
6
5
  /**
7
6
  ---
8
7
  category: components
@@ -10,41 +9,41 @@ category: components
10
9
  **/
11
10
  declare class Img extends Component<ImgProps> {
12
11
  static readonly componentId = "Img";
13
- static propTypes: {
14
- makeStyles: PropTypes.Requireable<(...args: any[]) => any>;
15
- styles: PropTypes.Requireable<object>;
16
- src: PropTypes.Validator<string>;
17
- alt: PropTypes.Requireable<string>;
18
- display: PropTypes.Requireable<string>;
19
- /**
20
- * Valid values are `0`, `none`, `auto`, `xxx-small`, `xx-small`, `x-small`,
21
- * `small`, `medium`, `large`, `x-large`, `xx-large`. Apply these values via
22
- * familiar CSS-like shorthand. For example: `margin="small auto large"`.
23
- */
24
- margin: (props: any, propName: any, componentName: any, location: any) => any;
25
- /**
26
- * Valid values for `opacity` are `0` - `10`. Valid values for `blend` are
27
- * `normal` (default), `multiply`, `screen`, `overlay`, and `color-burn`.
28
- */
29
- overlay: PropTypes.Requireable<PropTypes.InferProps<{
30
- color: PropTypes.Validator<string>;
31
- opacity: PropTypes.Validator<number>;
32
- blend: PropTypes.Requireable<string>;
33
- }>>;
34
- withGrayscale: PropTypes.Requireable<boolean>;
35
- withBlur: PropTypes.Requireable<boolean>;
36
- constrain: PropTypes.Requireable<string>;
37
- elementRef: PropTypes.Requireable<(...args: any[]) => any>;
38
- height: PropTypes.Requireable<string | number>;
39
- width: PropTypes.Requireable<string | number>;
40
- };
12
+ static propTypes: import("@instructure/shared-types/types/UtilityTypes").PropValidators<keyof {
13
+ src: string;
14
+ alt?: string | undefined;
15
+ display?: "inline-block" | "block" | undefined;
16
+ margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
17
+ overlay?: {
18
+ color: string;
19
+ opacity: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
20
+ blend?: "normal" | "multiply" | "screen" | "overlay" | "color-burn" | undefined;
21
+ } | undefined;
22
+ withGrayscale?: boolean | undefined;
23
+ withBlur?: boolean | undefined;
24
+ constrain?: "cover" | "contain" | undefined;
25
+ elementRef?: ((...args: any[]) => any) | undefined;
26
+ height?: string | number | undefined;
27
+ width?: string | number | undefined;
28
+ }>;
29
+ static allowedProps: readonly (keyof {
30
+ src: string;
31
+ alt?: string | undefined;
32
+ display?: "inline-block" | "block" | undefined;
33
+ margin?: import("@instructure/emotion/types/styleUtils/ThemeablePropValues").Spacing | undefined;
34
+ overlay?: {
35
+ color: string;
36
+ opacity: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
37
+ blend?: "normal" | "multiply" | "screen" | "overlay" | "color-burn" | undefined;
38
+ } | undefined;
39
+ withGrayscale?: boolean | undefined;
40
+ withBlur?: boolean | undefined;
41
+ constrain?: "cover" | "contain" | undefined;
42
+ elementRef?: ((...args: any[]) => any) | undefined;
43
+ height?: string | number | undefined;
44
+ width?: string | number | undefined;
45
+ })[];
41
46
  static defaultProps: {
42
- margin: undefined;
43
- overlay: undefined;
44
- constrain: undefined;
45
- elementRef: undefined;
46
- height: undefined;
47
- width: undefined;
48
47
  alt: string;
49
48
  display: string;
50
49
  withGrayscale: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Img/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AACjC,OAAO,SAAS,MAAM,YAAY,CAAA;AAMlC,OAAO,EAAa,GAAG,EAAsB,MAAM,sBAAsB,CAAA;AAIzE,OAAO,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAElC;;;;GAIG;AACH,cAEM,GAAI,SAAQ,SAAS,CAAC,QAAQ,CAAC;IACnC,MAAM,CAAC,QAAQ,CAAC,WAAW,SAAQ;IAEnC,MAAM,CAAC,SAAS;;;;;;QAQd;;;;WAIG;;QAEH;;;WAGG;;;;;;;;;;;;MAkBJ;IAED,MAAM,CAAC,YAAY;;;;;;;;;;;MAWlB;IAED,iBAAiB;IAKjB,kBAAkB;IAKlB,MAAM;CAuDP;AAED,eAAe,GAAG,CAAA;AAClB,OAAO,EAAE,GAAG,EAAE,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/Img/index.tsx"],"names":[],"mappings":"AAuBA,eAAe;AACf,OAAO,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAMjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;GAIG;AACH,cAEM,GAAI,SAAQ,SAAS,CAAC,QAAQ,CAAC;IACnC,MAAM,CAAC,QAAQ,CAAC,WAAW,SAAQ;IAEnC,MAAM,CAAC,SAAS;;;;;;;;;;;;;;;;OAAY;IAC5B,MAAM,CAAC,YAAY;;;;;;;;;;;;;;;;SAAe;IAClC,MAAM,CAAC,YAAY;;;;;MAKlB;IAED,iBAAiB;IAKjB,kBAAkB;IAKlB,MAAM;CAuDP;AAED,eAAe,GAAG,CAAA;AAClB,OAAO,EAAE,GAAG,EAAE,CAAA"}
@@ -0,0 +1,27 @@
1
+ import type { Spacing, WithStyleProps } from '@instructure/emotion';
2
+ import { PropValidators } from '@instructure/shared-types';
3
+ declare type ImgOwnProps = {
4
+ src: string;
5
+ alt?: string;
6
+ display?: 'inline-block' | 'block';
7
+ margin?: Spacing;
8
+ overlay?: {
9
+ color: string;
10
+ opacity: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
11
+ blend?: 'normal' | 'multiply' | 'screen' | 'overlay' | 'color-burn';
12
+ };
13
+ withGrayscale?: boolean;
14
+ withBlur?: boolean;
15
+ constrain?: 'cover' | 'contain';
16
+ elementRef?: (...args: any[]) => any;
17
+ height?: string | number;
18
+ width?: string | number;
19
+ };
20
+ declare type PropKeys = keyof ImgOwnProps;
21
+ declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
22
+ declare type ImgProps = ImgOwnProps & WithStyleProps;
23
+ declare const propTypes: PropValidators<PropKeys>;
24
+ declare const allowedProps: AllowedPropKeys;
25
+ export type { ImgProps };
26
+ export { propTypes, allowedProps };
27
+ //# sourceMappingURL=props.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Img/props.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,sBAAsB,CAAA;AACnE,OAAO,EAAE,cAAc,EAAE,MAAM,2BAA2B,CAAA;AAI1D,aAAK,WAAW,GAAG;IACjB,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAA;IAClC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QACnD,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAA;KACpE,CAAA;IACD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA;AAED,aAAK,QAAQ,GAAG,MAAM,WAAW,CAAA;AAEjC,aAAK,eAAe,GAAG,QAAQ,CAAC,KAAK,CAAC,QAAQ,CAAC,CAAC,CAAA;AAEhD,aAAK,QAAQ,GAAG,WAAW,GAAG,cAAc,CAAA;AAE5C,QAAA,MAAM,SAAS,EAAE,cAAc,CAAC,QAAQ,CA+BvC,CAAA;AAED,QAAA,MAAM,YAAY,EAAE,eAYnB,CAAA;AAED,YAAY,EAAE,QAAQ,EAAE,CAAA;AACxB,OAAO,EAAE,SAAS,EAAE,YAAY,EAAE,CAAA"}
@@ -1,5 +1,5 @@
1
1
  import { ImgTheme } from '@instructure/shared-types';
2
- import { ImgProps } from './types';
2
+ import { ImgProps } from './props';
3
3
  /**
4
4
  * ---
5
5
  * private: true
package/types/index.d.ts CHANGED
@@ -1,3 +1,3 @@
1
1
  export { Img } from './Img';
2
- export type { ImgProps } from './Img/types';
2
+ export type { ImgProps } from './Img/props';
3
3
  //# sourceMappingURL=index.d.ts.map
package/es/Img/types.js DELETED
@@ -1 +0,0 @@
1
- export {};
package/lib/Img/types.js DELETED
@@ -1 +0,0 @@
1
- "use strict";
package/src/Img/types.ts DELETED
@@ -1,45 +0,0 @@
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
-
25
- import type { Spacing } from '@instructure/emotion'
26
-
27
- export type ImgProps = {
28
- makeStyles?: (...args: any[]) => any
29
- styles?: any
30
- src: string
31
- alt?: string
32
- display?: 'inline-block' | 'block'
33
- margin?: Spacing
34
- overlay?: {
35
- color: string
36
- opacity: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10
37
- blend?: 'normal' | 'multiply' | 'screen' | 'overlay' | 'color-burn'
38
- }
39
- withGrayscale?: boolean
40
- withBlur?: boolean
41
- constrain?: 'cover' | 'contain'
42
- elementRef?: (...args: any[]) => any
43
- height?: string | number
44
- width?: string | number
45
- }
@@ -1,21 +0,0 @@
1
- import type { Spacing } from '@instructure/emotion';
2
- export declare type ImgProps = {
3
- makeStyles?: (...args: any[]) => any;
4
- styles?: any;
5
- src: string;
6
- alt?: string;
7
- display?: 'inline-block' | 'block';
8
- margin?: Spacing;
9
- overlay?: {
10
- color: string;
11
- opacity: 0 | 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10;
12
- blend?: 'normal' | 'multiply' | 'screen' | 'overlay' | 'color-burn';
13
- };
14
- withGrayscale?: boolean;
15
- withBlur?: boolean;
16
- constrain?: 'cover' | 'contain';
17
- elementRef?: (...args: any[]) => any;
18
- height?: string | number;
19
- width?: string | number;
20
- };
21
- //# sourceMappingURL=types.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/Img/types.ts"],"names":[],"mappings":"AAwBA,OAAO,KAAK,EAAE,OAAO,EAAE,MAAM,sBAAsB,CAAA;AAEnD,oBAAY,QAAQ,GAAG;IACrB,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,GAAG,CAAA;IACZ,GAAG,EAAE,MAAM,CAAA;IACX,GAAG,CAAC,EAAE,MAAM,CAAA;IACZ,OAAO,CAAC,EAAE,cAAc,GAAG,OAAO,CAAA;IAClC,MAAM,CAAC,EAAE,OAAO,CAAA;IAChB,OAAO,CAAC,EAAE;QACR,KAAK,EAAE,MAAM,CAAA;QACb,OAAO,EAAE,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,CAAC,GAAG,EAAE,CAAA;QACnD,KAAK,CAAC,EAAE,QAAQ,GAAG,UAAU,GAAG,QAAQ,GAAG,SAAS,GAAG,YAAY,CAAA;KACpE,CAAA;IACD,aAAa,CAAC,EAAE,OAAO,CAAA;IACvB,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,SAAS,CAAC,EAAE,OAAO,GAAG,SAAS,CAAA;IAC/B,UAAU,CAAC,EAAE,CAAC,GAAG,IAAI,EAAE,GAAG,EAAE,KAAK,GAAG,CAAA;IACpC,MAAM,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;IACxB,KAAK,CAAC,EAAE,MAAM,GAAG,MAAM,CAAA;CACxB,CAAA"}