@instructure/ui-img 8.10.3-snapshot.19 → 8.10.3-snapshot.23
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/es/Img/index.js +23 -21
- package/es/Img/props.js +4 -0
- package/lib/Img/index.js +23 -21
- package/lib/Img/props.js +4 -0
- package/package.json +12 -12
- package/src/Img/index.tsx +6 -1
- package/src/Img/props.ts +11 -2
- package/types/Img/index.d.ts.map +1 -1
- package/types/Img/props.d.ts +2 -2
- package/types/Img/props.d.ts.map +1 -1
package/es/Img/index.js
CHANGED
|
@@ -49,40 +49,42 @@ let Img = (_dec = withStyle(generateStyle, generateComponentTheme), _dec2 = test
|
|
|
49
49
|
this.ref = null;
|
|
50
50
|
|
|
51
51
|
this.handleRef = el => {
|
|
52
|
-
|
|
53
|
-
|
|
52
|
+
const elementRef = this.props.elementRef;
|
|
54
53
|
this.ref = el;
|
|
55
|
-
|
|
54
|
+
|
|
55
|
+
if (typeof elementRef === 'function') {
|
|
56
|
+
elementRef(el);
|
|
57
|
+
}
|
|
56
58
|
};
|
|
57
59
|
}
|
|
58
60
|
|
|
59
61
|
componentDidMount() {
|
|
60
|
-
var _this$props$makeStyle, _this$
|
|
62
|
+
var _this$props$makeStyle, _this$props;
|
|
61
63
|
|
|
62
|
-
(_this$props$makeStyle = (_this$
|
|
64
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
63
65
|
}
|
|
64
66
|
|
|
65
67
|
componentDidUpdate() {
|
|
66
|
-
var _this$props$makeStyle2, _this$
|
|
68
|
+
var _this$props$makeStyle2, _this$props2;
|
|
67
69
|
|
|
68
|
-
(_this$props$makeStyle2 = (_this$
|
|
70
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
69
71
|
}
|
|
70
72
|
|
|
71
73
|
render() {
|
|
72
|
-
const _this$
|
|
73
|
-
src = _this$
|
|
74
|
-
alt = _this$
|
|
75
|
-
margin = _this$
|
|
76
|
-
display = _this$
|
|
77
|
-
overlay = _this$
|
|
78
|
-
withGrayscale = _this$
|
|
79
|
-
withBlur = _this$
|
|
80
|
-
constrain = _this$
|
|
81
|
-
width = _this$
|
|
82
|
-
height = _this$
|
|
83
|
-
elementRef = _this$
|
|
84
|
-
styles = _this$
|
|
85
|
-
props = _objectWithoutProperties(_this$
|
|
74
|
+
const _this$props3 = this.props,
|
|
75
|
+
src = _this$props3.src,
|
|
76
|
+
alt = _this$props3.alt,
|
|
77
|
+
margin = _this$props3.margin,
|
|
78
|
+
display = _this$props3.display,
|
|
79
|
+
overlay = _this$props3.overlay,
|
|
80
|
+
withGrayscale = _this$props3.withGrayscale,
|
|
81
|
+
withBlur = _this$props3.withBlur,
|
|
82
|
+
constrain = _this$props3.constrain,
|
|
83
|
+
width = _this$props3.width,
|
|
84
|
+
height = _this$props3.height,
|
|
85
|
+
elementRef = _this$props3.elementRef,
|
|
86
|
+
styles = _this$props3.styles,
|
|
87
|
+
props = _objectWithoutProperties(_this$props3, _excluded);
|
|
86
88
|
|
|
87
89
|
const a11yProps = {
|
|
88
90
|
alt: alt || ''
|
package/es/Img/props.js
CHANGED
|
@@ -36,6 +36,10 @@ const propTypes = {
|
|
|
36
36
|
withGrayscale: PropTypes.bool,
|
|
37
37
|
withBlur: PropTypes.bool,
|
|
38
38
|
constrain: PropTypes.oneOf(['cover', 'contain']),
|
|
39
|
+
|
|
40
|
+
/**
|
|
41
|
+
* provides a reference to the underlying html root element
|
|
42
|
+
*/
|
|
39
43
|
elementRef: PropTypes.func,
|
|
40
44
|
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
41
45
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
package/lib/Img/index.js
CHANGED
|
@@ -41,40 +41,42 @@ let Img = (_dec = (0, _emotion.withStyle)(_styles.default, _theme.default), _dec
|
|
|
41
41
|
this.ref = null;
|
|
42
42
|
|
|
43
43
|
this.handleRef = el => {
|
|
44
|
-
|
|
45
|
-
|
|
44
|
+
const elementRef = this.props.elementRef;
|
|
46
45
|
this.ref = el;
|
|
47
|
-
|
|
46
|
+
|
|
47
|
+
if (typeof elementRef === 'function') {
|
|
48
|
+
elementRef(el);
|
|
49
|
+
}
|
|
48
50
|
};
|
|
49
51
|
}
|
|
50
52
|
|
|
51
53
|
componentDidMount() {
|
|
52
|
-
var _this$props$makeStyle, _this$
|
|
54
|
+
var _this$props$makeStyle, _this$props;
|
|
53
55
|
|
|
54
|
-
(_this$props$makeStyle = (_this$
|
|
56
|
+
(_this$props$makeStyle = (_this$props = this.props).makeStyles) === null || _this$props$makeStyle === void 0 ? void 0 : _this$props$makeStyle.call(_this$props);
|
|
55
57
|
}
|
|
56
58
|
|
|
57
59
|
componentDidUpdate() {
|
|
58
|
-
var _this$props$makeStyle2, _this$
|
|
60
|
+
var _this$props$makeStyle2, _this$props2;
|
|
59
61
|
|
|
60
|
-
(_this$props$makeStyle2 = (_this$
|
|
62
|
+
(_this$props$makeStyle2 = (_this$props2 = this.props).makeStyles) === null || _this$props$makeStyle2 === void 0 ? void 0 : _this$props$makeStyle2.call(_this$props2);
|
|
61
63
|
}
|
|
62
64
|
|
|
63
65
|
render() {
|
|
64
|
-
const _this$
|
|
65
|
-
src = _this$
|
|
66
|
-
alt = _this$
|
|
67
|
-
margin = _this$
|
|
68
|
-
display = _this$
|
|
69
|
-
overlay = _this$
|
|
70
|
-
withGrayscale = _this$
|
|
71
|
-
withBlur = _this$
|
|
72
|
-
constrain = _this$
|
|
73
|
-
width = _this$
|
|
74
|
-
height = _this$
|
|
75
|
-
elementRef = _this$
|
|
76
|
-
styles = _this$
|
|
77
|
-
props = (0, _objectWithoutProperties2.default)(_this$
|
|
66
|
+
const _this$props3 = this.props,
|
|
67
|
+
src = _this$props3.src,
|
|
68
|
+
alt = _this$props3.alt,
|
|
69
|
+
margin = _this$props3.margin,
|
|
70
|
+
display = _this$props3.display,
|
|
71
|
+
overlay = _this$props3.overlay,
|
|
72
|
+
withGrayscale = _this$props3.withGrayscale,
|
|
73
|
+
withBlur = _this$props3.withBlur,
|
|
74
|
+
constrain = _this$props3.constrain,
|
|
75
|
+
width = _this$props3.width,
|
|
76
|
+
height = _this$props3.height,
|
|
77
|
+
elementRef = _this$props3.elementRef,
|
|
78
|
+
styles = _this$props3.styles,
|
|
79
|
+
props = (0, _objectWithoutProperties2.default)(_this$props3, _excluded);
|
|
78
80
|
const a11yProps = {
|
|
79
81
|
alt: alt || ''
|
|
80
82
|
};
|
package/lib/Img/props.js
CHANGED
|
@@ -47,6 +47,10 @@ const propTypes = {
|
|
|
47
47
|
withGrayscale: _propTypes.default.bool,
|
|
48
48
|
withBlur: _propTypes.default.bool,
|
|
49
49
|
constrain: _propTypes.default.oneOf(['cover', 'contain']),
|
|
50
|
+
|
|
51
|
+
/**
|
|
52
|
+
* provides a reference to the underlying html root element
|
|
53
|
+
*/
|
|
50
54
|
elementRef: _propTypes.default.func,
|
|
51
55
|
height: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number]),
|
|
52
56
|
width: _propTypes.default.oneOfType([_propTypes.default.string, _propTypes.default.number])
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@instructure/ui-img",
|
|
3
|
-
"version": "8.10.3-snapshot.
|
|
3
|
+
"version": "8.10.3-snapshot.23+5aaa29662",
|
|
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.10.3-snapshot.
|
|
29
|
-
"@instructure/emotion": "8.10.3-snapshot.
|
|
30
|
-
"@instructure/shared-types": "8.10.3-snapshot.
|
|
31
|
-
"@instructure/ui-dom-utils": "8.10.3-snapshot.
|
|
32
|
-
"@instructure/ui-react-utils": "8.10.3-snapshot.
|
|
33
|
-
"@instructure/ui-testable": "8.10.3-snapshot.
|
|
34
|
-
"@instructure/ui-view": "8.10.3-snapshot.
|
|
28
|
+
"@instructure/console": "8.10.3-snapshot.23+5aaa29662",
|
|
29
|
+
"@instructure/emotion": "8.10.3-snapshot.23+5aaa29662",
|
|
30
|
+
"@instructure/shared-types": "8.10.3-snapshot.23+5aaa29662",
|
|
31
|
+
"@instructure/ui-dom-utils": "8.10.3-snapshot.23+5aaa29662",
|
|
32
|
+
"@instructure/ui-react-utils": "8.10.3-snapshot.23+5aaa29662",
|
|
33
|
+
"@instructure/ui-testable": "8.10.3-snapshot.23+5aaa29662",
|
|
34
|
+
"@instructure/ui-view": "8.10.3-snapshot.23+5aaa29662",
|
|
35
35
|
"prop-types": "^15"
|
|
36
36
|
},
|
|
37
37
|
"devDependencies": {
|
|
38
|
-
"@instructure/ui-babel-preset": "8.10.3-snapshot.
|
|
39
|
-
"@instructure/ui-test-locator": "8.10.3-snapshot.
|
|
40
|
-
"@instructure/ui-test-utils": "8.10.3-snapshot.
|
|
38
|
+
"@instructure/ui-babel-preset": "8.10.3-snapshot.23+5aaa29662",
|
|
39
|
+
"@instructure/ui-test-locator": "8.10.3-snapshot.23+5aaa29662",
|
|
40
|
+
"@instructure/ui-test-utils": "8.10.3-snapshot.23+5aaa29662"
|
|
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": "
|
|
49
|
+
"gitHead": "5aaa296621d72faebe1a809a8895a8185587008d"
|
|
50
50
|
}
|
package/src/Img/index.tsx
CHANGED
|
@@ -59,8 +59,13 @@ class Img extends Component<ImgProps> {
|
|
|
59
59
|
ref: Element | null = null
|
|
60
60
|
|
|
61
61
|
handleRef = (el: Element | null) => {
|
|
62
|
+
const { elementRef } = this.props
|
|
63
|
+
|
|
62
64
|
this.ref = el
|
|
63
|
-
|
|
65
|
+
|
|
66
|
+
if (typeof elementRef === 'function') {
|
|
67
|
+
elementRef(el)
|
|
68
|
+
}
|
|
64
69
|
}
|
|
65
70
|
|
|
66
71
|
componentDidMount() {
|
package/src/Img/props.ts
CHANGED
|
@@ -25,7 +25,11 @@
|
|
|
25
25
|
import PropTypes from 'prop-types'
|
|
26
26
|
import { ThemeablePropTypes } from '@instructure/emotion'
|
|
27
27
|
|
|
28
|
-
import type {
|
|
28
|
+
import type {
|
|
29
|
+
PropValidators,
|
|
30
|
+
ImgTheme,
|
|
31
|
+
OtherHTMLAttributes
|
|
32
|
+
} from '@instructure/shared-types'
|
|
29
33
|
import type {
|
|
30
34
|
Spacing,
|
|
31
35
|
WithStyleProps,
|
|
@@ -63,7 +67,9 @@ type PropKeys = keyof ImgOwnProps
|
|
|
63
67
|
|
|
64
68
|
type AllowedPropKeys = Readonly<Array<PropKeys>>
|
|
65
69
|
|
|
66
|
-
type ImgProps = ImgOwnProps &
|
|
70
|
+
type ImgProps = ImgOwnProps &
|
|
71
|
+
WithStyleProps<ImgTheme, ImgStyle> &
|
|
72
|
+
OtherHTMLAttributes<ImgOwnProps>
|
|
67
73
|
|
|
68
74
|
type ImgStyle = ComponentStyle<'overlay' | 'container' | 'img'>
|
|
69
75
|
|
|
@@ -86,6 +92,9 @@ const propTypes: PropValidators<PropKeys> = {
|
|
|
86
92
|
withGrayscale: PropTypes.bool,
|
|
87
93
|
withBlur: PropTypes.bool,
|
|
88
94
|
constrain: PropTypes.oneOf(['cover', 'contain']),
|
|
95
|
+
/**
|
|
96
|
+
* provides a reference to the underlying html root element
|
|
97
|
+
*/
|
|
89
98
|
elementRef: PropTypes.func,
|
|
90
99
|
height: PropTypes.oneOfType([PropTypes.string, PropTypes.number]),
|
|
91
100
|
width: PropTypes.oneOfType([PropTypes.string, PropTypes.number])
|
package/types/Img/index.d.ts.map
CHANGED
|
@@ -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;AAMjC,OAAO,EAAa,GAAG,EAAE,MAAM,sBAAsB,CAAA;AAMrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAEvC;;;;;GAKG;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,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,
|
|
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;;;;;GAKG;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,GAAG,EAAE,OAAO,GAAG,IAAI,CAAO;IAE1B,SAAS,OAAQ,OAAO,GAAG,IAAI,UAQ9B;IAED,iBAAiB;IAIjB,kBAAkB;IAIlB,MAAM;CAuDP;AAED,eAAe,GAAG,CAAA;AAClB,OAAO,EAAE,GAAG,EAAE,CAAA"}
|
package/types/Img/props.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { PropValidators, ImgTheme } from '@instructure/shared-types';
|
|
1
|
+
import type { PropValidators, ImgTheme, OtherHTMLAttributes } from '@instructure/shared-types';
|
|
2
2
|
import type { Spacing, WithStyleProps, ComponentStyle } from '@instructure/emotion';
|
|
3
3
|
declare type ImgOwnProps = {
|
|
4
4
|
src: string;
|
|
@@ -28,7 +28,7 @@ declare type ImgOwnProps = {
|
|
|
28
28
|
};
|
|
29
29
|
declare type PropKeys = keyof ImgOwnProps;
|
|
30
30
|
declare type AllowedPropKeys = Readonly<Array<PropKeys>>;
|
|
31
|
-
declare type ImgProps = ImgOwnProps & WithStyleProps<ImgTheme, ImgStyle>;
|
|
31
|
+
declare type ImgProps = ImgOwnProps & WithStyleProps<ImgTheme, ImgStyle> & OtherHTMLAttributes<ImgOwnProps>;
|
|
32
32
|
declare type ImgStyle = ComponentStyle<'overlay' | 'container' | 'img'>;
|
|
33
33
|
declare const propTypes: PropValidators<PropKeys>;
|
|
34
34
|
declare const allowedProps: AllowedPropKeys;
|
package/types/Img/props.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Img/props.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"props.d.ts","sourceRoot":"","sources":["../../src/Img/props.ts"],"names":[],"mappings":"AA2BA,OAAO,KAAK,EACV,cAAc,EACd,QAAQ,EACR,mBAAmB,EACpB,MAAM,2BAA2B,CAAA;AAClC,OAAO,KAAK,EACV,OAAO,EACP,cAAc,EACd,cAAc,EACf,MAAM,sBAAsB,CAAA;AAE7B,aAAK,W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