@enact/ui 5.0.0-rc.1 → 5.1.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
|
@@ -2,6 +2,16 @@
|
|
|
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.1.0] - 2025-07-11
|
|
6
|
+
|
|
7
|
+
### Added
|
|
8
|
+
|
|
9
|
+
- `ui/ImageItem` prop `slotBefore` to add a node before the image
|
|
10
|
+
|
|
11
|
+
## [5.0.0] - 2025-06-13
|
|
12
|
+
|
|
13
|
+
No significant changes.
|
|
14
|
+
|
|
5
15
|
## [5.0.0-rc.1] - 2025-05-29
|
|
6
16
|
|
|
7
17
|
No significant changes.
|
package/ImageItem/ImageItem.d.ts
CHANGED
|
@@ -48,6 +48,14 @@ corresponding internal elements and states of this component.
|
|
|
48
48
|
*/
|
|
49
49
|
selected?: boolean;
|
|
50
50
|
/**
|
|
51
|
+
* Nodes to be inserted before `image` .
|
|
52
|
+
*
|
|
53
|
+
* For LTR locales, the nodes are inserted to the left of the image. For RTL
|
|
54
|
+
locales, the nodes are inserted to the right. If nothing is specified, nothing, not even
|
|
55
|
+
an empty container, is rendered in this place.
|
|
56
|
+
*/
|
|
57
|
+
slotBefore?: React.ReactNode;
|
|
58
|
+
/**
|
|
51
59
|
* String value or Object of values used to determine which image will appear on a specific
|
|
52
60
|
screenSize.
|
|
53
61
|
*/
|
package/ImageItem/ImageItem.js
CHANGED
|
@@ -15,7 +15,7 @@ var _Layout = require("../Layout");
|
|
|
15
15
|
var _ImageItemModule = _interopRequireDefault(require("./ImageItem.module.css"));
|
|
16
16
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
17
17
|
var _excluded = ["imageComponent"],
|
|
18
|
-
_excluded2 = ["children", "componentRef", "css", "imageComponent", "orientation", "placeholder", "src"];
|
|
18
|
+
_excluded2 = ["children", "componentRef", "css", "imageComponent", "orientation", "placeholder", "slotBefore", "src"];
|
|
19
19
|
/**
|
|
20
20
|
* Unstyled image item components and behaviors to be customized by a theme or application.
|
|
21
21
|
*
|
|
@@ -116,6 +116,17 @@ var ImageItemBase = exports.ImageItemBase = (0, _kind["default"])({
|
|
|
116
116
|
* @public
|
|
117
117
|
*/
|
|
118
118
|
selected: _propTypes2["default"].bool,
|
|
119
|
+
/**
|
|
120
|
+
* Nodes to be inserted before `image`.
|
|
121
|
+
*
|
|
122
|
+
* For LTR locales, the nodes are inserted to the left of the image. For RTL
|
|
123
|
+
* locales, the nodes are inserted to the right. If nothing is specified, nothing, not even
|
|
124
|
+
* an empty container, is rendered in this place.
|
|
125
|
+
*
|
|
126
|
+
* @type {Node}
|
|
127
|
+
* @public
|
|
128
|
+
*/
|
|
129
|
+
slotBefore: _propTypes2["default"].node,
|
|
119
130
|
/**
|
|
120
131
|
* String value or Object of values used to determine which image will appear on a specific
|
|
121
132
|
* screenSize.
|
|
@@ -154,6 +165,7 @@ var ImageItemBase = exports.ImageItemBase = (0, _kind["default"])({
|
|
|
154
165
|
imageComponent = _ref3.imageComponent,
|
|
155
166
|
orientation = _ref3.orientation,
|
|
156
167
|
placeholder = _ref3.placeholder,
|
|
168
|
+
slotBefore = _ref3.slotBefore,
|
|
157
169
|
src = _ref3.src,
|
|
158
170
|
rest = _objectWithoutProperties(_ref3, _excluded2);
|
|
159
171
|
delete rest.selected;
|
|
@@ -161,7 +173,11 @@ var ImageItemBase = exports.ImageItemBase = (0, _kind["default"])({
|
|
|
161
173
|
var Component = isHorizontal ? _Layout.Row : _Layout.Column;
|
|
162
174
|
return /*#__PURE__*/(0, _jsxRuntime.jsxs)(Component, _objectSpread(_objectSpread({}, rest), {}, {
|
|
163
175
|
ref: componentRef,
|
|
164
|
-
children: [/*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
176
|
+
children: [slotBefore ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
177
|
+
className: css.slotBefore,
|
|
178
|
+
shrink: true,
|
|
179
|
+
children: slotBefore
|
|
180
|
+
}) : null, /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
165
181
|
className: css.image,
|
|
166
182
|
component: ImageOverride,
|
|
167
183
|
imageComponent: imageComponent,
|
|
@@ -15,6 +15,7 @@ var src = {
|
|
|
15
15
|
'fhd': 'http://lorempixel.com/128/128/city/1/',
|
|
16
16
|
'uhd': 'http://lorempixel.com/256/256/city/1/'
|
|
17
17
|
};
|
|
18
|
+
var slotBefore = /*#__PURE__*/(0, _jsxRuntime.jsx)("div", {});
|
|
18
19
|
describe('ImageItem', function () {
|
|
19
20
|
var data;
|
|
20
21
|
var Img = function Img(props) {
|
|
@@ -71,6 +72,17 @@ describe('ImageItem', function () {
|
|
|
71
72
|
var imageItem = _react.screen.getByTestId('imageItem');
|
|
72
73
|
expect(imageItem).toHaveClass(expected);
|
|
73
74
|
});
|
|
75
|
+
test('should apply `.slotBefore` when `slotBefore`', function () {
|
|
76
|
+
(0, _react.render)(/*#__PURE__*/(0, _jsxRuntime.jsx)(_ImageItem.ImageItemBase, {
|
|
77
|
+
"data-testid": "imageItem",
|
|
78
|
+
slotBefore: slotBefore,
|
|
79
|
+
selected: true,
|
|
80
|
+
src: src
|
|
81
|
+
}));
|
|
82
|
+
var expected = 'slotBefore';
|
|
83
|
+
var imageItem = _react.screen.getByTestId('imageItem').firstElementChild;
|
|
84
|
+
expect(imageItem).toHaveClass(expected);
|
|
85
|
+
});
|
|
74
86
|
test('should pass `src` and `placeholder` to `imageComponent` as component', function () {
|
|
75
87
|
var props = {
|
|
76
88
|
src: 'img.png',
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@enact/ui",
|
|
3
|
-
"version": "5.
|
|
3
|
+
"version": "5.1.0",
|
|
4
4
|
"description": "A collection of simplified unstyled cross-platform UI components for Enact",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -32,8 +32,8 @@
|
|
|
32
32
|
}
|
|
33
33
|
},
|
|
34
34
|
"dependencies": {
|
|
35
|
-
"@enact/core": "^5.
|
|
36
|
-
"@enact/i18n": "^5.
|
|
35
|
+
"@enact/core": "^5.1.0",
|
|
36
|
+
"@enact/i18n": "^5.1.0",
|
|
37
37
|
"classnames": "^2.5.1",
|
|
38
38
|
"ilib": "^14.21.1",
|
|
39
39
|
"invariant": "^2.2.4",
|