@instructure/ui-img 11.7.8 → 11.7.9-pr-snapshot-1792147648392

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,19 @@
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
+ ## [11.7.9-pr-snapshot-1792147648392](https://github.com/instructure/instructure-ui/compare/v11.7.8...v11.7.9-pr-snapshot-1792147648392) (2026-10-16)
7
+
8
+ ### Build System
9
+
10
+ * **many:** replace babel with swc ([7e36c54](https://github.com/instructure/instructure-ui/commit/7e36c54d240b4fa483801c03ab18e7f860f561e2))
11
+
12
+ ### BREAKING CHANGES
13
+
14
+ * **many:** `@instructure/ui-babel-preset` and
15
+ `@instructure/browserslist-config-instui` are removed and will no longer be
16
+ published. Packages depend on `@swc/helpers` instead of `@babel/runtime`.
17
+
18
+
6
19
  ## [11.7.8](https://github.com/instructure/instructure-ui/compare/v11.7.7...v11.7.8) (2026-10-02)
7
20
 
8
21
  **Note:** Version bump only for package @instructure/ui-img
@@ -1,28 +1,5 @@
1
- var _dec, _class;
2
- /*
3
- * The MIT License (MIT)
4
- *
5
- * Copyright (c) 2015 - present Instructure, Inc.
6
- *
7
- * Permission is hereby granted, free of charge, to any person obtaining a copy
8
- * of this software and associated documentation files (the "Software"), to deal
9
- * in the Software without restriction, including without limitation the rights
10
- * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- * copies of the Software, and to permit persons to whom the Software is
12
- * furnished to do so, subject to the following conditions:
13
- *
14
- * The above copyright notice and this permission notice shall be included in all
15
- * copies or substantial portions of the Software.
16
- *
17
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- * SOFTWARE.
24
- */
25
-
1
+ import { _ as _ts_decorate } from "@swc/helpers/_/_ts_decorate";
2
+ import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
26
3
  import { Component } from 'react';
27
4
  import { View } from '@instructure/ui-view/v11_6';
28
5
  import { passthroughProps } from '@instructure/ui-react-utils';
@@ -30,98 +7,89 @@ import { withStyle } from '@instructure/emotion';
30
7
  import generateStyle from './styles.js';
31
8
  import generateComponentTheme from './theme.js';
32
9
  import { allowedProps } from './props.js';
33
- import { jsx as _jsx, jsxs as _jsxs } from "@emotion/react/jsx-runtime";
34
- /**
35
- ---
36
- category: components
37
- ---
38
- **/
39
- let Img = (_dec = withStyle(generateStyle, generateComponentTheme), _dec(_class = class Img extends Component {
40
- static displayName = 'Img';
41
- static componentId = 'Img';
42
- static allowedProps = allowedProps;
43
- static defaultProps = {
44
- alt: '',
45
- display: 'inline-block',
46
- withGrayscale: false,
47
- withBlur: false
48
- };
49
- ref = null;
50
- handleRef = el => {
51
- const {
52
- elementRef
53
- } = this.props;
54
- this.ref = el;
55
- if (typeof elementRef === 'function') {
56
- elementRef(el);
10
+ class Img extends Component {
11
+ static{
12
+ this.displayName = 'Img';
13
+ }
14
+ static{
15
+ this.componentId = 'Img';
16
+ }
17
+ static{
18
+ this.allowedProps = allowedProps;
19
+ }
20
+ static{
21
+ this.defaultProps = {
22
+ alt: '',
23
+ display: 'inline-block',
24
+ withGrayscale: false,
25
+ withBlur: false
26
+ };
27
+ }
28
+ componentDidMount() {
29
+ this.props.makeStyles?.();
30
+ }
31
+ componentDidUpdate() {
32
+ this.props.makeStyles?.();
33
+ }
34
+ render() {
35
+ const { src, alt, margin, display, overlay, withGrayscale, withBlur, constrain, width, height, elementRef, styles, loading, ...props } = this.props;
36
+ const a11yProps = {
37
+ alt: alt || ''
38
+ };
39
+ const imageProps = {
40
+ css: styles?.img,
41
+ src,
42
+ loading
43
+ };
44
+ const containerProps = {
45
+ ...passthroughProps(props),
46
+ width,
47
+ height,
48
+ margin,
49
+ display,
50
+ elementRef: this.handleRef
51
+ };
52
+ if (overlay) {
53
+ const rootProps = {
54
+ ...containerProps
55
+ };
56
+ return /*#__PURE__*/ _jsxs(View, {
57
+ ...rootProps,
58
+ as: "span",
59
+ css: styles?.container,
60
+ "data-cid": "Img",
61
+ children: [
62
+ /*#__PURE__*/ _jsx("img", {
63
+ ...imageProps,
64
+ ...a11yProps
65
+ }),
66
+ overlay && /*#__PURE__*/ _jsx("span", {
67
+ css: styles?.overlay
68
+ })
69
+ ]
70
+ });
71
+ } else {
72
+ return /*#__PURE__*/ _jsx(View, {
73
+ ...containerProps,
74
+ ...imageProps,
75
+ ...a11yProps,
76
+ as: "img",
77
+ "data-cid": "Img"
78
+ });
79
+ }
57
80
  }
58
- };
59
- componentDidMount() {
60
- this.props.makeStyles?.();
61
- }
62
- componentDidUpdate() {
63
- this.props.makeStyles?.();
64
- }
65
- render() {
66
- const {
67
- src,
68
- alt,
69
- margin,
70
- display,
71
- overlay,
72
- withGrayscale,
73
- withBlur,
74
- constrain,
75
- width,
76
- height,
77
- elementRef,
78
- styles,
79
- loading,
80
- ...props
81
- } = this.props;
82
- const a11yProps = {
83
- alt: alt || ''
84
- };
85
- const imageProps = {
86
- css: styles?.img,
87
- src,
88
- loading
89
- };
90
- const containerProps = {
91
- ...passthroughProps(props),
92
- width,
93
- height,
94
- margin,
95
- display,
96
- elementRef: this.handleRef
97
- };
98
- if (overlay) {
99
- // if a background image is rendered we add the a11y props on the container element
100
- const rootProps = {
101
- ...containerProps
102
- };
103
- return _jsxs(View, {
104
- ...rootProps,
105
- as: "span",
106
- css: styles?.container,
107
- "data-cid": "Img",
108
- children: [_jsx("img", {
109
- ...imageProps,
110
- ...a11yProps
111
- }), overlay && _jsx("span", {
112
- css: styles?.overlay
113
- })]
114
- });
115
- } else {
116
- return _jsx(View, {
117
- ...containerProps,
118
- ...imageProps,
119
- ...a11yProps,
120
- as: "img",
121
- "data-cid": "Img"
122
- });
81
+ constructor(...args){
82
+ super(...args), this.ref = null, this.handleRef = (el)=>{
83
+ const { elementRef } = this.props;
84
+ this.ref = el;
85
+ if (typeof elementRef === 'function') {
86
+ elementRef(el);
87
+ }
88
+ };
123
89
  }
124
- }
125
- }) || _class);
90
+ }
91
+ Img = _ts_decorate([
92
+ withStyle(generateStyle, generateComponentTheme)
93
+ ], Img);
126
94
  export default Img;
127
- export { Img };
95
+ export { Img };
@@ -1,26 +1,15 @@
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
- const allowedProps = ['src', 'alt', 'display', 'loading', 'margin', 'overlay', 'withGrayscale', 'withBlur', 'constrain', 'elementRef', 'height', 'width'];
26
- export { allowedProps };
1
+ const allowedProps = [
2
+ 'src',
3
+ 'alt',
4
+ 'display',
5
+ 'loading',
6
+ 'margin',
7
+ 'overlay',
8
+ 'withGrayscale',
9
+ 'withBlur',
10
+ 'constrain',
11
+ 'elementRef',
12
+ 'height',
13
+ 'width'
14
+ ];
15
+ export { allowedProps };
@@ -1,134 +1,88 @@
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
- /**
26
- * ---
27
- * private: true
28
- * ---
29
- * Generates the style object from the theme and provided additional information
30
- * @param {Object} componentTheme The theme variable object.
31
- * @param {Object} props the props of the component, the style is applied to
32
- * @param {Object} state the state of the component, the style is applied to
33
- * @return {Object} The final style object, which will be used in the component
34
- */
35
- const generateStyle = (componentTheme, props) => {
36
- const {
37
- overlay,
38
- withBlur,
39
- withGrayscale,
40
- constrain
41
- } = props;
42
- const isCover = constrain === 'cover';
43
- const isContain = constrain === 'contain';
44
-
45
- // if overlay or filters are updated via props,
46
- // make the transition look smooth
47
- const transitionStyle = {
48
- transition: `all ${componentTheme.effectTransitionDuration}`
49
- };
50
- const getFilterStyle = () => {
51
- const filters = [];
52
- withBlur && filters.push(`blur(${componentTheme.imageBlurAmount})`);
53
- withGrayscale && filters.push('grayscale(1)');
54
- return filters.length > 0 ? {
55
- ...transitionStyle,
56
- filter: filters.join(' ')
57
- } : {
58
- filter: 'none'
1
+ const generateStyle = (componentTheme, props)=>{
2
+ const { overlay, withBlur, withGrayscale, constrain } = props;
3
+ const isCover = constrain === 'cover';
4
+ const isContain = constrain === 'contain';
5
+ const transitionStyle = {
6
+ transition: `all ${componentTheme.effectTransitionDuration}`
7
+ };
8
+ const getFilterStyle = ()=>{
9
+ const filters = [];
10
+ withBlur && filters.push(`blur(${componentTheme.imageBlurAmount})`);
11
+ withGrayscale && filters.push('grayscale(1)');
12
+ return filters.length > 0 ? {
13
+ ...transitionStyle,
14
+ filter: filters.join(' ')
15
+ } : {
16
+ filter: 'none'
17
+ };
18
+ };
19
+ const fillContainer = {
20
+ width: '100%',
21
+ height: '100%'
22
+ };
23
+ const imgCoverStyle = {
24
+ objectFit: 'cover',
25
+ ...fillContainer
26
+ };
27
+ const imgContainStyle = {
28
+ objectFit: 'contain',
29
+ ...fillContainer,
30
+ ...overlay && {
31
+ width: 'auto',
32
+ height: 'auto',
33
+ maxWidth: '100%',
34
+ maxHeight: '100%'
35
+ }
36
+ };
37
+ return {
38
+ overlay: {
39
+ label: 'img__overlay',
40
+ position: 'absolute',
41
+ top: '0px',
42
+ left: '0px',
43
+ width: '100%',
44
+ height: '100%',
45
+ ...transitionStyle,
46
+ ...overlay && {
47
+ backgroundColor: overlay.color,
48
+ opacity: overlay.opacity * 0.1,
49
+ mixBlendMode: overlay.blend ? overlay.blend : undefined
50
+ }
51
+ },
52
+ container: {
53
+ label: 'img__container',
54
+ ...overlay && {
55
+ position: 'relative',
56
+ overflow: 'hidden'
57
+ },
58
+ ...isCover && fillContainer,
59
+ ...isContain && {
60
+ height: 'inherit'
61
+ }
62
+ },
63
+ img: {
64
+ label: 'img',
65
+ margin: '0',
66
+ padding: '0',
67
+ float: 'none',
68
+ top: 'auto',
69
+ bottom: 'auto',
70
+ left: 'auto',
71
+ right: 'auto',
72
+ lineHeight: 'normal',
73
+ position: 'static',
74
+ transform: 'none',
75
+ maxHeight: 'none',
76
+ minHeight: '0',
77
+ minWidth: '0',
78
+ maxWidth: '100%',
79
+ ...getFilterStyle(),
80
+ ...overlay && {
81
+ display: 'block'
82
+ },
83
+ ...isCover && imgCoverStyle,
84
+ ...isContain && imgContainStyle
85
+ }
59
86
  };
60
- };
61
- const fillContainer = {
62
- width: '100%',
63
- height: '100%'
64
- };
65
- const imgCoverStyle = {
66
- objectFit: 'cover',
67
- ...fillContainer
68
- };
69
- const imgContainStyle = {
70
- objectFit: 'contain',
71
- ...fillContainer,
72
- ...(overlay && {
73
- width: 'auto',
74
- height: 'auto',
75
- maxWidth: '100%',
76
- maxHeight: '100%'
77
- })
78
- };
79
- return {
80
- overlay: {
81
- label: 'img__overlay',
82
- position: 'absolute',
83
- top: '0px',
84
- left: '0px',
85
- width: '100%',
86
- height: '100%',
87
- ...transitionStyle,
88
- ...(overlay && {
89
- backgroundColor: overlay.color,
90
- opacity: overlay.opacity * 0.1,
91
- mixBlendMode: overlay.blend ? overlay.blend : undefined
92
- })
93
- },
94
- container: {
95
- label: 'img__container',
96
- ...(overlay && {
97
- position: 'relative',
98
- overflow: 'hidden' /* stops blurred images extending past overlay borders */
99
- }),
100
- ...(isCover && fillContainer),
101
- ...(isContain && {
102
- height: 'inherit'
103
- })
104
- },
105
- img: {
106
- label: 'img',
107
- // reset image styles (initial: all was causing conflicts
108
- // View's CSS and overriding height/width attrs)
109
- margin: '0',
110
- padding: '0',
111
- float: 'none',
112
- top: 'auto',
113
- bottom: 'auto',
114
- left: 'auto',
115
- right: 'auto',
116
- lineHeight: 'normal',
117
- position: 'static',
118
- transform: 'none',
119
- maxHeight: 'none',
120
- minHeight: '0',
121
- minWidth: '0',
122
- maxWidth: '100%',
123
- ...getFilterStyle(),
124
- ...(overlay && {
125
- // when image is contained in overlay,
126
- // avoid extra space at bottom from inline/line-height
127
- display: 'block'
128
- }),
129
- ...(isCover && imgCoverStyle),
130
- ...(isContain && imgContainStyle)
131
- }
132
- };
133
87
  };
134
- export default generateStyle;
88
+ export default generateStyle;
@@ -1,39 +1,10 @@
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
- /**
26
- * Generates the theme object for the component from the theme and provided additional information
27
- * @param {Object} theme The actual theme object.
28
- * @return {Object} The final theme object with the overrides and component variables
29
- */
30
- const generateComponentTheme = () => {
31
- const componentVariables = {
32
- effectTransitionDuration: '1s',
33
- imageBlurAmount: '0.25em'
34
- };
35
- return {
36
- ...componentVariables
37
- };
1
+ const generateComponentTheme = ()=>{
2
+ const componentVariables = {
3
+ effectTransitionDuration: '1s',
4
+ imageBlurAmount: '0.25em'
5
+ };
6
+ return {
7
+ ...componentVariables
8
+ };
38
9
  };
39
- export default generateComponentTheme;
10
+ export default generateComponentTheme;