@enact/ui 5.0.0 → 5.2.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,18 @@
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.2.0] - 2025-08-08
6
+
7
+ ### Fixed
8
+
9
+ - `ui/Card` to properly set image size in vertical orientation
10
+
11
+ ## [5.1.0] - 2025-07-11
12
+
13
+ ### Added
14
+
15
+ - `ui/ImageItem` prop `slotBefore` to add a node before the image
16
+
5
17
  ## [5.0.0] - 2025-06-13
6
18
 
7
19
  No significant changes.
package/Card/Card.js CHANGED
@@ -167,7 +167,7 @@ var CardBase = exports.CardBase = (0, _kind["default"])({
167
167
  component: ImageOverride,
168
168
  imageComponent: imageComponent,
169
169
  placeholder: placeholder,
170
- shrink: isHorizontal,
170
+ shrink: true,
171
171
  src: src
172
172
  }), children ? /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
173
173
  className: css.children,
@@ -49,7 +49,7 @@ describe('FloatingLayer Specs', function () {
49
49
  type: 'onOpen'
50
50
  };
51
51
  var actual = handleOpen.mock.calls.length && handleOpen.mock.calls[0][0];
52
- expect(handleOpen).toBeCalledTimes(expected);
52
+ expect(handleOpen).toHaveBeenCalledTimes(expected);
53
53
  expect(actual).toMatchObject(expectedType);
54
54
  });
55
55
  test('should fire onClose event with type when FloatingLayer is closed', function () {
@@ -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
  */
@@ -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,
@@ -9,6 +9,9 @@
9
9
  .imageItem.selected {
10
10
  /* Public Class Names */
11
11
  }
12
+ .imageItem .slotBefore {
13
+ /* Public Class Names */
14
+ }
12
15
  .imageItem.horizontal .image {
13
16
  width: 25%;
14
17
  height: 100%;
@@ -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',
@@ -64,7 +64,7 @@ describe('Media', function () {
64
64
  var video = _react.screen.getByTestId('media-id');
65
65
  var canPlayEvent = (0, _react.createEvent)('canplay', video);
66
66
  (0, _react.fireEvent)(video, canPlayEvent);
67
- expect(handleCanPlay).toBeCalled();
67
+ expect(handleCanPlay).toHaveBeenCalled();
68
68
  });
69
69
  test('should fire `onCustom` when custom event is fired', function () {
70
70
  var handleCustom = jest.fn();
@@ -77,7 +77,7 @@ describe('Media', function () {
77
77
  var video = _react.screen.getByTestId('media-id');
78
78
  var customEvent = (0, _react.createEvent)('custom', video);
79
79
  (0, _react.fireEvent)(video, customEvent);
80
- expect(handleCustom).toBeCalled();
80
+ expect(handleCustom).toHaveBeenCalled();
81
81
  });
82
82
  test('should call load', function () {
83
83
  var ref = /*#__PURE__*/(0, _react2.createRef)();
@@ -114,7 +114,7 @@ describe('Transition Specs', function () {
114
114
  type: 'onShow'
115
115
  };
116
116
  var actual = handleShow.mock.calls.length && handleShow.mock.calls[0][0];
117
- expect(handleShow).toBeCalledTimes(expected);
117
+ expect(handleShow).toHaveBeenCalledTimes(expected);
118
118
  expect(actual).toMatchObject(expectedType);
119
119
  });
120
120
  test('should fire \'onHide\' event with type when \'visible\' prop becomes false', function () {
@@ -142,7 +142,7 @@ describe('Transition Specs', function () {
142
142
  type: 'onHide'
143
143
  };
144
144
  var actual = handleHide.mock.calls.length && handleHide.mock.calls[0][0];
145
- expect(handleHide).toBeCalledTimes(expected);
145
+ expect(handleHide).toHaveBeenCalledTimes(expected);
146
146
  expect(actual).toMatchObject(expectedType);
147
147
  });
148
148
 
@@ -267,7 +267,7 @@ describe('View', function () {
267
267
  (0, _react.act)(function () {
268
268
  return ref.current.componentWillEnter();
269
269
  });
270
- expect(arranger.enter).toBeCalledWith(arrangerStruct);
270
+ expect(arranger.enter).toHaveBeenCalledWith(arrangerStruct);
271
271
  });
272
272
  });
273
273
  });
@@ -491,7 +491,7 @@ describe('VirtualGridList', function () {
491
491
  return jest.advanceTimersByTime(1000);
492
492
  }); // Wait onScrollStop
493
493
 
494
- expect(fn).toBeCalled();
494
+ expect(fn).toHaveBeenCalled();
495
495
  });
496
496
  test('should not scroll by wheel when `noScrollByWheel` prop is true', function (done) {
497
497
  var fn = jest.fn();
@@ -544,7 +544,7 @@ describe('VirtualGridList', function () {
544
544
  return jest.advanceTimersByTime(1000);
545
545
  }); // Wait onScrollStop
546
546
 
547
- expect(fn).toBeCalled();
547
+ expect(fn).toHaveBeenCalled();
548
548
  }));
549
549
  test('should not scroll by key', function (done) {
550
550
  var fn = jest.fn();
@@ -577,7 +577,7 @@ describe('VirtualList', function () {
577
577
  return jest.advanceTimersByTime(1000);
578
578
  }); // Wait onScrollStop
579
579
 
580
- expect(fn).toBeCalled();
580
+ expect(fn).toHaveBeenCalled();
581
581
  });
582
582
  test('should not scroll by wheel when `noScrollByWheel` prop is true', function (done) {
583
583
  var fn = jest.fn();
@@ -630,7 +630,7 @@ describe('VirtualList', function () {
630
630
  return jest.advanceTimersByTime(1000);
631
631
  }); // Wait onScrollStop
632
632
 
633
- expect(fn).toBeCalled();
633
+ expect(fn).toHaveBeenCalled();
634
634
  }));
635
635
  test('should not scroll by key', function (done) {
636
636
  var fn = jest.fn();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@enact/ui",
3
- "version": "5.0.0",
3
+ "version": "5.2.0",
4
4
  "description": "A collection of simplified unstyled cross-platform UI components for Enact",
5
5
  "repository": {
6
6
  "type": "git",
@@ -32,13 +32,13 @@
32
32
  }
33
33
  },
34
34
  "dependencies": {
35
- "@enact/core": "^5.0.0",
36
- "@enact/i18n": "^5.0.0",
35
+ "@enact/core": "^5.2.0",
36
+ "@enact/i18n": "^5.2.0",
37
37
  "classnames": "^2.5.1",
38
38
  "ilib": "^14.21.1",
39
39
  "invariant": "^2.2.4",
40
40
  "prop-types": "^15.8.1",
41
- "ramda": "^0.30.1",
41
+ "ramda": "^0.31.3",
42
42
  "react": "^19.1.0",
43
43
  "react-dom": "^19.1.0",
44
44
  "react-is": "^19.1.0",