@enact/ui 5.5.2 → 5.6.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 +6 -0
- package/Image/Image.d.ts +15 -0
- package/Image/Image.js +36 -6
- package/Transition/Transition.js +2 -2
- package/package.json +6 -6
package/CHANGELOG.md
CHANGED
|
@@ -2,6 +2,12 @@
|
|
|
2
2
|
|
|
3
3
|
The following is a curated list of changes in the Enact ui module, newest changes on the top.
|
|
4
4
|
|
|
5
|
+
## [5.6.0] - 2026-09-02
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `ui/Image` props `backgroundColor` and `backgroundSrc` to be able to change the background of a transparent image
|
|
10
|
+
|
|
5
11
|
## [5.5.2] - 2026-07-08
|
|
6
12
|
|
|
7
13
|
### Changed
|
package/Image/Image.d.ts
CHANGED
|
@@ -11,6 +11,21 @@ export interface ImageBaseProps {
|
|
|
11
11
|
* String value for the alt attribute of the image.
|
|
12
12
|
*/
|
|
13
13
|
alt?: string;
|
|
14
|
+
/**
|
|
15
|
+
* A color to render behind the image.
|
|
16
|
+
Accepts any valid CSS `background-color` value (named color, hex, `rgb()` , etc.).
|
|
17
|
+
Gradients are not supported here; they are CSS images, not colors; use
|
|
18
|
+
`backgroundSrc` for an image background instead.
|
|
19
|
+
*/
|
|
20
|
+
backgroundColor?: string;
|
|
21
|
+
/**
|
|
22
|
+
* A second image to render behind the main `src` image.
|
|
23
|
+
*
|
|
24
|
+
* This is useful when `src` points to an image with transparent areas — this image
|
|
25
|
+
will show through those transparent regions, layered above `backgroundColor` and
|
|
26
|
+
`placeholder` but below `src` . Accepts the same string or screen-size-keyed object format as `src` .
|
|
27
|
+
*/
|
|
28
|
+
backgroundSrc?: string | object;
|
|
14
29
|
/**
|
|
15
30
|
* Node for the children of an `Image` . Useful for overlays.
|
|
16
31
|
*/
|
package/Image/Image.js
CHANGED
|
@@ -13,7 +13,7 @@ var _resolution = require("../resolution");
|
|
|
13
13
|
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
14
14
|
var _ImageModule = _interopRequireDefault(require("./Image.module.css"));
|
|
15
15
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
16
|
-
var _excluded = ["alt", "aria-label", "bgImage", "children", "componentRef", "css", "imgSrc", "onError", "onLoad", "style"];
|
|
16
|
+
var _excluded = ["alt", "aria-label", "backgroundColor", "bgImage", "children", "componentRef", "css", "imgSrc", "onError", "onLoad", "style"];
|
|
17
17
|
/**
|
|
18
18
|
* An unstyled image component to be customized by a theme or application.
|
|
19
19
|
*
|
|
@@ -78,6 +78,27 @@ var ImageBase = exports.ImageBase = (0, _kind["default"])({
|
|
|
78
78
|
* @memberof ui/Image.Image.prototype
|
|
79
79
|
*/
|
|
80
80
|
'aria-label': _propTypes2["default"].string,
|
|
81
|
+
/**
|
|
82
|
+
* A color to render behind the image.
|
|
83
|
+
* Accepts any valid CSS `background-color` value (named color, hex, `rgb()`, etc.).
|
|
84
|
+
* Gradients are not supported here; they are CSS images, not colors; use
|
|
85
|
+
* `backgroundSrc` for an image background instead.
|
|
86
|
+
*
|
|
87
|
+
* @type {String}
|
|
88
|
+
* @public
|
|
89
|
+
*/
|
|
90
|
+
backgroundColor: _propTypes2["default"].string,
|
|
91
|
+
/**
|
|
92
|
+
* A second image to render behind the main `src` image.
|
|
93
|
+
*
|
|
94
|
+
* This is useful when `src` points to an image with transparent areas — this image
|
|
95
|
+
* will show through those transparent regions, layered above `backgroundColor` and
|
|
96
|
+
* `placeholder` but below `src`. Accepts the same string or screen-size-keyed object format as `src`.
|
|
97
|
+
*
|
|
98
|
+
* @type {String|Object}
|
|
99
|
+
* @public
|
|
100
|
+
*/
|
|
101
|
+
backgroundSrc: _propTypes2["default"].oneOfType([_propTypes2["default"].string, _propTypes2["default"].object]),
|
|
81
102
|
/**
|
|
82
103
|
* Node for the children of an `Image`. Useful for overlays.
|
|
83
104
|
*
|
|
@@ -166,12 +187,17 @@ var ImageBase = exports.ImageBase = (0, _kind["default"])({
|
|
|
166
187
|
},
|
|
167
188
|
computed: {
|
|
168
189
|
bgImage: function bgImage(_ref) {
|
|
169
|
-
var
|
|
190
|
+
var backgroundSrc = _ref.backgroundSrc,
|
|
191
|
+
placeholder = _ref.placeholder,
|
|
170
192
|
src = _ref.src;
|
|
171
193
|
var imageSrc = (0, _resolution.selectSrc)(src) || placeholder;
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
194
|
+
var backgroundImageSrc = (0, _resolution.selectSrc)(backgroundSrc);
|
|
195
|
+
process.env.NODE_ENV !== "production" ? (0, _warning["default"])(imageSrc || backgroundImageSrc, 'Image requires that either the "src", "placeholder", or "backgroundSrc" props be specified.') : void 0;
|
|
196
|
+
var layers = [];
|
|
197
|
+
if (imageSrc) layers.push("url(\"".concat(imageSrc, "\")"));
|
|
198
|
+
if (backgroundImageSrc) layers.push("url(\"".concat(backgroundImageSrc, "\")"));
|
|
199
|
+
if (placeholder && imageSrc !== placeholder) layers.push("url(\"".concat(placeholder, "\")"));
|
|
200
|
+
return layers.length ? layers.join(', ') : null;
|
|
175
201
|
},
|
|
176
202
|
className: function className(_ref2) {
|
|
177
203
|
var _className = _ref2.className,
|
|
@@ -187,6 +213,7 @@ var ImageBase = exports.ImageBase = (0, _kind["default"])({
|
|
|
187
213
|
render: function render(_ref4) {
|
|
188
214
|
var alt = _ref4.alt,
|
|
189
215
|
ariaLabel = _ref4['aria-label'],
|
|
216
|
+
backgroundColor = _ref4.backgroundColor,
|
|
190
217
|
bgImage = _ref4.bgImage,
|
|
191
218
|
children = _ref4.children,
|
|
192
219
|
componentRef = _ref4.componentRef,
|
|
@@ -196,6 +223,7 @@ var ImageBase = exports.ImageBase = (0, _kind["default"])({
|
|
|
196
223
|
onLoad = _ref4.onLoad,
|
|
197
224
|
style = _ref4.style,
|
|
198
225
|
rest = _objectWithoutProperties(_ref4, _excluded);
|
|
226
|
+
delete rest.backgroundSrc;
|
|
199
227
|
delete rest.placeholder;
|
|
200
228
|
delete rest.sizing;
|
|
201
229
|
delete rest.src;
|
|
@@ -204,7 +232,9 @@ var ImageBase = exports.ImageBase = (0, _kind["default"])({
|
|
|
204
232
|
}, rest), {}, {
|
|
205
233
|
"aria-label": ariaLabel || alt,
|
|
206
234
|
ref: componentRef,
|
|
207
|
-
style: _objectSpread(_objectSpread({}, style),
|
|
235
|
+
style: _objectSpread(_objectSpread(_objectSpread({}, style), backgroundColor ? {
|
|
236
|
+
backgroundColor: backgroundColor
|
|
237
|
+
} : null), {}, {
|
|
208
238
|
backgroundImage: bgImage
|
|
209
239
|
}),
|
|
210
240
|
children: [children, /*#__PURE__*/(0, _jsxRuntime.jsx)("img", {
|
package/Transition/Transition.js
CHANGED
|
@@ -405,7 +405,7 @@ function Transition(_ref5) {
|
|
|
405
405
|
renderState: TRANSITION_STATE.READY
|
|
406
406
|
};
|
|
407
407
|
});
|
|
408
|
-
}, []);
|
|
408
|
+
}, [setState]);
|
|
409
409
|
var childRef = (0, _react.useCallback)(function (node) {
|
|
410
410
|
childNodeRef.current = node;
|
|
411
411
|
}, []);
|
|
@@ -441,7 +441,7 @@ function Transition(_ref5) {
|
|
|
441
441
|
initialHeight: null
|
|
442
442
|
});
|
|
443
443
|
});
|
|
444
|
-
}, []);
|
|
444
|
+
}, [setState]);
|
|
445
445
|
(0, _react.useEffect)(function () {
|
|
446
446
|
if (typeof resizeRegister !== 'function') return;
|
|
447
447
|
var registry = resizeRegister(handleResize);
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.6.0",
|
|
4
4
|
"description": "A collection of simplified unstyled cross-platform UI components for Enact",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,16 +32,16 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@enact/core": "^5.
|
|
36
|
-
"@enact/i18n": "^5.
|
|
35
|
+
"@enact/core": "^5.6.0",
|
|
36
|
+
"@enact/i18n": "^5.6.0",
|
|
37
37
|
"classnames": "^2.5.1",
|
|
38
38
|
"ilib": "^14.22.0",
|
|
39
39
|
"invariant": "^2.2.4",
|
|
40
40
|
"prop-types": "^15.8.1",
|
|
41
41
|
"ramda": "^0.32.0",
|
|
42
|
-
"react": "^19.2.
|
|
43
|
-
"react-dom": "^19.2.
|
|
44
|
-
"react-is": "^19.2.
|
|
42
|
+
"react": "^19.2.8",
|
|
43
|
+
"react-dom": "^19.2.8",
|
|
44
|
+
"react-is": "^19.2.8",
|
|
45
45
|
"warning": "^4.0.3"
|
|
46
46
|
}
|
|
47
47
|
}
|