@enact/ui 4.5.1 → 4.5.3
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/AnnounceDecorator/Announce.js +1 -40
- package/AnnounceDecorator/AnnounceDecorator.js +3 -21
- package/AnnounceDecorator/tests/Announce-specs.js +2 -7
- package/AnnounceDecorator/tests/AnnounceDecorator-specs.js +2 -6
- package/AnnounceDecorator/tests/useAnnounce-specs.js +8 -19
- package/AnnounceDecorator/useAnnounce.js +0 -6
- package/BodyText/BodyText.js +6 -26
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.js +26 -56
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +10 -0
- package/Cancelable/Cancelable.js +8 -47
- package/Cancelable/cancelHandler.js +5 -12
- package/Cancelable/modalHandler.js +3 -11
- package/Cancelable/tests/Cancelable-specs.js +3 -57
- package/Changeable/Changeable.js +2 -34
- package/Changeable/tests/Changeable-specs.js +20 -66
- package/ComponentOverride/ComponentOverride.js +1 -13
- package/FloatingLayer/FloatingLayer.js +17 -73
- package/FloatingLayer/FloatingLayerContainer.js +0 -15
- package/FloatingLayer/FloatingLayerDecorator.js +4 -17
- package/FloatingLayer/Scrim.js +9 -53
- package/FloatingLayer/index.js +0 -4
- package/FloatingLayer/tests/FloatingLayer-specs.js +8 -22
- package/FloatingLayer/tests/Scrim-specs.js +0 -9
- package/FloatingLayer/tests/useFloatingLayerDecorator-specs.js +0 -13
- package/FloatingLayer/useFloatingLayer.js +3 -14
- package/FloatingLayer/useFloatingLayerDecorator.js +3 -11
- package/ForwardRef/ForwardRef.js +1 -10
- package/GridListImageItem/GridListImageItem.js +17 -50
- package/Group/Group.js +4 -35
- package/Group/GroupItem.js +15 -32
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +7 -35
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.js +14 -48
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.js +12 -50
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +16 -45
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +17 -46
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +8 -32
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.js +19 -50
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +11 -37
- package/Layout/Layout.js +14 -37
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +31 -64
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +62 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +258 -87
- package/Measurable/Measurable.js +12 -34
- package/Measurable/tests/Measurable-specs.js +115 -0
- package/Media/Media.js +15 -65
- package/Media/tests/Media-specs.js +168 -0
- package/Placeholder/PlaceholderControllerDecorator.js +7 -43
- package/Placeholder/PlaceholderDecorator.js +7 -38
- package/Placeholder/index.js +0 -4
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +13 -44
- package/ProgressBar/tests/ProgressBar-specs.js +0 -17
- package/RadioDecorator/RadioControllerDecorator.js +1 -29
- package/RadioDecorator/RadioDecorator.js +4 -42
- package/RadioDecorator/tests/RadioDecorator-specs.js +12 -49
- package/Repeater/Repeater.js +9 -33
- package/Repeater/tests/Repeater-specs.js +0 -38
- package/Resizable/Resizable.js +7 -35
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +8 -44
- package/Routable/Routable.js +10 -33
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +13 -56
- package/Routable/tests/Routable-specs.js +7 -33
- package/Routable/tests/Router-specs.js +18 -44
- package/Routable/useLink.js +4 -8
- package/Routable/util.js +18 -24
- package/Scrollable/ScrollAnimator.js +49 -65
- package/Scrollable/ScrollThumb.js +2 -13
- package/Scrollable/Scrollable.js +179 -386
- package/Scrollable/ScrollableNative.js +188 -391
- package/Scrollable/Scrollbar.js +28 -100
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +31 -84
- package/Skinnable/Skinnable.js +11 -38
- package/Skinnable/tests/Skinnable-specs.js +3 -74
- package/Skinnable/tests/useSkins-specs.js +1 -13
- package/Skinnable/tests/util-specs.js +0 -14
- package/Skinnable/useSkins.js +8 -15
- package/Skinnable/util.js +9 -20
- package/Slider/Knob.js +5 -24
- package/Slider/PositionDecorator.js +16 -54
- package/Slider/Slider.js +26 -64
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.js +15 -41
- package/SlotItem/tests/SlotItem-specs.js +0 -5
- package/Slottable/Slottable.js +4 -12
- package/Slottable/tests/Slottable-specs.js +19 -46
- package/Slottable/tests/useSlots-specs.js +27 -65
- package/Slottable/useSlots.js +8 -33
- package/Spinner/Spinner.js +15 -42
- package/Spinner/tests/Spinner-specs.js +0 -15
- package/ToggleIcon/ToggleIcon.js +10 -36
- package/ToggleIcon/tests/ToggleIcon-specs.js +0 -16
- package/ToggleItem/ToggleItem.js +15 -52
- package/ToggleItem/tests/ToggleItem-specs.js +0 -30
- package/Toggleable/Toggle.js +1 -15
- package/Toggleable/Toggleable.js +12 -45
- package/Toggleable/tests/Toggleable-specs.js +28 -96
- package/Toggleable/useToggle.js +3 -19
- package/Touchable/ClickAllow.js +5 -14
- package/Touchable/Drag.js +16 -54
- package/Touchable/Flick.js +11 -42
- package/Touchable/Hold.js +21 -68
- package/Touchable/Touch.js +37 -65
- package/Touchable/Touchable.js +32 -71
- package/Touchable/config.js +8 -22
- package/Touchable/tests/Touchable-specs.js +270 -119
- package/Touchable/tests/useTouch-specs.js +6 -80
- package/Touchable/useTouch.js +17 -34
- package/Transition/Transition.js +37 -118
- package/Transition/tests/Transition-specs.js +20 -60
- package/ViewManager/Arranger.js +10 -22
- package/ViewManager/TransitionGroup.js +31 -106
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.js +19 -83
- package/ViewManager/tests/View-specs.js +0 -17
- package/ViewManager/tests/ViewManager-specs.js +236 -305
- package/ViewManager/tests/test-utils.js +0 -8
- package/VirtualList/UiVirtualListBase.js +256 -406
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +270 -428
- package/VirtualList/tests/VirtualList-specs.js +9 -37
- package/internal/IdProvider/IdProvider.js +7 -21
- package/internal/IdProvider/Provider.js +4 -17
- package/internal/IdProvider/tests/IdProvider-specs.js +44 -0
- package/internal/IdProvider/tests/useId-specs.js +7 -22
- package/internal/IdProvider/useId.js +0 -6
- package/internal/Pure/Pure.js +3 -30
- package/internal/Pure/tests/Pure-specs.js +88 -0
- package/internal/localized-fonts/localized-fonts.js +33 -62
- package/internal/localized-fonts/tests/localized-fonts-specs.js +33 -0
- package/internal/selection/selection.js +1 -6
- package/internal/selection/tests/selection-specs.js +6 -4
- package/internal/validators/tests/validators-specs.js +80 -0
- package/internal/validators/validators.js +14 -34
- package/package.json +8 -2
- package/resolution/ResolutionDecorator.js +4 -40
- package/resolution/index.js +0 -7
- package/resolution/resolution.js +42 -80
- package/resolution/tests/ResolutionDecorator-specs.js +4 -11
- package/resolution/tests/resolution-specs.js +2 -2
- package/useControlledState/tests/useControlledState-specs.js +15 -46
- package/useControlledState/useControlledState.js +11 -22
- package/useScroll/ScrollAnimator.js +49 -65
- package/useScroll/Scrollbar.js +22 -58
- package/useScroll/ScrollbarTrack.js +3 -19
- package/useScroll/useScroll.js +267 -454
- package/useScroll/utilDOM.js +8 -14
- package/useScroll/utilEvent.js +0 -4
package/Layout/Layout.js
CHANGED
|
@@ -22,35 +22,20 @@ Object.defineProperty(exports, "CellDecorator", {
|
|
|
22
22
|
}
|
|
23
23
|
});
|
|
24
24
|
exports["default"] = exports.Row = exports.LayoutDecorator = exports.LayoutBase = exports.Layout = exports.Column = void 0;
|
|
25
|
-
|
|
26
25
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
27
|
-
|
|
28
26
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
29
|
-
|
|
30
27
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
31
|
-
|
|
32
28
|
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
33
|
-
|
|
34
29
|
var _Cell = require("./Cell");
|
|
35
|
-
|
|
36
30
|
var _LayoutModule = _interopRequireDefault(require("./Layout.module.css"));
|
|
37
|
-
|
|
38
31
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
39
|
-
|
|
40
32
|
var _excluded = ["component", "componentRef"];
|
|
41
|
-
|
|
42
33
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
43
|
-
|
|
44
34
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
45
|
-
|
|
46
35
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
47
|
-
|
|
48
36
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
49
|
-
|
|
50
37
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
51
|
-
|
|
52
38
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
53
|
-
|
|
54
39
|
/**
|
|
55
40
|
* A container for `Cell`s.
|
|
56
41
|
*
|
|
@@ -83,9 +68,7 @@ function _defineProperty(obj, key, value) { if (key in obj) { Object.definePrope
|
|
|
83
68
|
*/
|
|
84
69
|
var LayoutBase = (0, _kind["default"])({
|
|
85
70
|
name: 'LayoutBase',
|
|
86
|
-
propTypes:
|
|
87
|
-
/** @lends ui/Layout.LayoutBase.prototype */
|
|
88
|
-
{
|
|
71
|
+
propTypes: /** @lends ui/Layout.LayoutBase.prototype */{
|
|
89
72
|
/**
|
|
90
73
|
* The alignment of children.
|
|
91
74
|
*
|
|
@@ -104,7 +87,6 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
104
87
|
* @public
|
|
105
88
|
*/
|
|
106
89
|
align: _propTypes2["default"].string,
|
|
107
|
-
|
|
108
90
|
/**
|
|
109
91
|
* Only [Cell]{@link ui/Layout.Cell} components are supported as children.
|
|
110
92
|
*
|
|
@@ -112,7 +94,6 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
112
94
|
* @public
|
|
113
95
|
*/
|
|
114
96
|
children: _propTypes2["default"].any,
|
|
115
|
-
|
|
116
97
|
/**
|
|
117
98
|
* The type of component to use to render as the `Layout`. May be a DOM node name (e.g 'div',
|
|
118
99
|
* 'span', etc.) or a custom component.
|
|
@@ -122,7 +103,6 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
122
103
|
* @public
|
|
123
104
|
*/
|
|
124
105
|
component: _propTypes["default"].renderable,
|
|
125
|
-
|
|
126
106
|
/**
|
|
127
107
|
* Called with a reference to the root component.
|
|
128
108
|
*
|
|
@@ -133,7 +113,6 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
133
113
|
* @public
|
|
134
114
|
*/
|
|
135
115
|
componentRef: _propTypes["default"].ref,
|
|
136
|
-
|
|
137
116
|
/**
|
|
138
117
|
* Allows this `Layout` to have following siblings drawn on the same line as itself
|
|
139
118
|
* instead of carving out the entire horizontal space for itself.
|
|
@@ -143,7 +122,6 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
143
122
|
* @public
|
|
144
123
|
*/
|
|
145
124
|
inline: _propTypes2["default"].bool,
|
|
146
|
-
|
|
147
125
|
/**
|
|
148
126
|
* The orientation of the `Layout`, i.e. how the children [Cells]{@link ui/Layout.Cell} are
|
|
149
127
|
* positioned on the screen. Must be either `'horizontal'` or `'vertical'`.
|
|
@@ -153,7 +131,6 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
153
131
|
* @public
|
|
154
132
|
*/
|
|
155
133
|
orientation: _propTypes2["default"].oneOf(['horizontal', 'vertical']),
|
|
156
|
-
|
|
157
134
|
/**
|
|
158
135
|
* Sets the Layout's `flex-wrap` values.
|
|
159
136
|
*
|
|
@@ -181,9 +158,9 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
181
158
|
computed: {
|
|
182
159
|
className: function className(_ref) {
|
|
183
160
|
var inline = _ref.inline,
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
161
|
+
orientation = _ref.orientation,
|
|
162
|
+
wrap = _ref.wrap,
|
|
163
|
+
styler = _ref.styler;
|
|
187
164
|
return styler.append(orientation, {
|
|
188
165
|
inline: inline,
|
|
189
166
|
nowrap: wrap === false || wrap === 'nowrap',
|
|
@@ -193,10 +170,11 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
193
170
|
},
|
|
194
171
|
style: function style(_ref2) {
|
|
195
172
|
var align = _ref2.align,
|
|
196
|
-
|
|
197
|
-
if (!align) return _style;
|
|
198
|
-
// for align-items and justify-items together
|
|
173
|
+
_style = _ref2.style;
|
|
174
|
+
if (!align) return _style;
|
|
199
175
|
|
|
176
|
+
// This is effectively a polyfill for the upcoming `place-items` prop which is shorthand
|
|
177
|
+
// for align-items and justify-items together
|
|
200
178
|
var alignParts = align.split(' ');
|
|
201
179
|
return _objectSpread(_objectSpread({}, _style), {}, {
|
|
202
180
|
alignItems: (0, _Cell.toFlexAlign)(alignParts[0]),
|
|
@@ -206,9 +184,8 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
206
184
|
},
|
|
207
185
|
render: function render(_ref3) {
|
|
208
186
|
var Component = _ref3.component,
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
187
|
+
componentRef = _ref3.componentRef,
|
|
188
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
212
189
|
delete rest.align;
|
|
213
190
|
delete rest.inline;
|
|
214
191
|
delete rest.orientation;
|
|
@@ -218,6 +195,7 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
218
195
|
}, rest));
|
|
219
196
|
}
|
|
220
197
|
});
|
|
198
|
+
|
|
221
199
|
/**
|
|
222
200
|
* Applies Layout behaviors.
|
|
223
201
|
*
|
|
@@ -226,11 +204,11 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
226
204
|
* @mixes ui/ForwardRef.ForwardRef
|
|
227
205
|
* @public
|
|
228
206
|
*/
|
|
229
|
-
|
|
230
207
|
exports.LayoutBase = LayoutBase;
|
|
231
208
|
var LayoutDecorator = (0, _ForwardRef["default"])({
|
|
232
209
|
prop: 'componentRef'
|
|
233
210
|
});
|
|
211
|
+
|
|
234
212
|
/**
|
|
235
213
|
* A container for `Cell`s.
|
|
236
214
|
*
|
|
@@ -264,9 +242,9 @@ var LayoutDecorator = (0, _ForwardRef["default"])({
|
|
|
264
242
|
* @ui
|
|
265
243
|
* @public
|
|
266
244
|
*/
|
|
267
|
-
|
|
268
245
|
exports.LayoutDecorator = LayoutDecorator;
|
|
269
246
|
var Layout = LayoutDecorator(LayoutBase);
|
|
247
|
+
|
|
270
248
|
/**
|
|
271
249
|
* Shorthand for `<Layout orientation="vertical">`, which positions its
|
|
272
250
|
* [Cells]{@link ui/Layout.Cell} vertically.
|
|
@@ -285,7 +263,6 @@ var Layout = LayoutDecorator(LayoutBase);
|
|
|
285
263
|
* @ui
|
|
286
264
|
* @public
|
|
287
265
|
*/
|
|
288
|
-
|
|
289
266
|
exports.Layout = Layout;
|
|
290
267
|
var Column = LayoutDecorator(function (props) {
|
|
291
268
|
return LayoutBase.inline(_objectSpread(_objectSpread({}, props), {}, {
|
|
@@ -294,6 +271,7 @@ var Column = LayoutDecorator(function (props) {
|
|
|
294
271
|
});
|
|
295
272
|
exports.Column = Column;
|
|
296
273
|
Column.displayName = 'Column';
|
|
274
|
+
|
|
297
275
|
/**
|
|
298
276
|
* Shorthand for `<Layout orientation="horizontal">`, which positions its
|
|
299
277
|
* [Cells]{@link ui/Layout.Cell} horizontally.
|
|
@@ -310,7 +288,6 @@ Column.displayName = 'Column';
|
|
|
310
288
|
* @ui
|
|
311
289
|
* @public
|
|
312
290
|
*/
|
|
313
|
-
|
|
314
291
|
var Row = LayoutDecorator(function (props) {
|
|
315
292
|
return LayoutBase.inline(_objectSpread(_objectSpread({}, props), {}, {
|
|
316
293
|
orientation: 'horizontal'
|
|
@@ -1,42 +1,26 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
|
|
3
3
|
require("@testing-library/jest-dom");
|
|
4
|
-
|
|
5
4
|
var _react = require("@testing-library/react");
|
|
6
|
-
|
|
7
5
|
var _Layout = _interopRequireWildcard(require("../Layout"));
|
|
8
|
-
|
|
9
6
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
10
|
-
|
|
11
7
|
function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
|
|
12
|
-
|
|
13
8
|
function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
|
|
14
|
-
|
|
15
9
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
16
|
-
|
|
17
10
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
18
|
-
|
|
19
11
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
20
|
-
|
|
21
12
|
function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); }
|
|
22
|
-
|
|
23
13
|
function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); }
|
|
24
|
-
|
|
25
14
|
function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); }
|
|
26
|
-
|
|
27
15
|
function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; }
|
|
28
|
-
|
|
29
16
|
function _iterableToArrayLimit(arr, i) { var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"]; if (_i == null) return; var _arr = []; var _n = true; var _d = false; var _s, _e; try { for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; }
|
|
30
|
-
|
|
31
17
|
function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }
|
|
32
|
-
|
|
33
18
|
describe('Layout Specs', function () {
|
|
34
19
|
var layoutPropAlign = [['baseline', 'baseline'], ['center', 'center'], ['end', 'flex-end'], ['start', 'flex-start']];
|
|
35
20
|
layoutPropAlign.forEach(function (_ref) {
|
|
36
21
|
var _ref2 = _slicedToArray(_ref, 2),
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
22
|
+
value = _ref2[0],
|
|
23
|
+
resolved = _ref2[1];
|
|
40
24
|
test("should apply '".concat(resolved, "' style value given an align prop value of \"").concat(value, "\""), function () {
|
|
41
25
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
|
|
42
26
|
align: value,
|
|
@@ -44,9 +28,7 @@ describe('Layout Specs', function () {
|
|
|
44
28
|
children: "Body"
|
|
45
29
|
})
|
|
46
30
|
}));
|
|
47
|
-
|
|
48
31
|
var layout = _react.screen.getByText('Body').parentElement;
|
|
49
|
-
|
|
50
32
|
var expected = resolved;
|
|
51
33
|
expect(layout).toHaveStyle({
|
|
52
34
|
'align-items': expected
|
|
@@ -60,48 +42,41 @@ describe('Layout Specs', function () {
|
|
|
60
42
|
children: "Body"
|
|
61
43
|
})
|
|
62
44
|
}));
|
|
63
|
-
|
|
64
45
|
var layout = _react.screen.getByText('Body').parentElement;
|
|
65
|
-
|
|
66
46
|
var expected = 'inline';
|
|
67
47
|
expect(layout).toHaveClass(expected);
|
|
68
|
-
});
|
|
48
|
+
});
|
|
69
49
|
|
|
50
|
+
// Tests for prop and className combinations
|
|
70
51
|
var propStyleCombination = [['orientation', ['horizontal', 'vertical']]];
|
|
71
52
|
propStyleCombination.forEach(function (_ref3) {
|
|
72
53
|
var _ref4 = _slicedToArray(_ref3, 2),
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
54
|
+
prop = _ref4[0],
|
|
55
|
+
vals = _ref4[1];
|
|
76
56
|
vals.forEach(function (value) {
|
|
77
57
|
test("should apply classes for ".concat(prop), function () {
|
|
78
58
|
var propValue = _defineProperty({}, prop, value);
|
|
79
|
-
|
|
80
59
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], _objectSpread(_objectSpread({}, propValue), {}, {
|
|
81
60
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, {
|
|
82
61
|
children: "Body"
|
|
83
62
|
})
|
|
84
63
|
})));
|
|
85
|
-
|
|
86
64
|
var layout = _react.screen.getByText('Body').parentElement;
|
|
87
|
-
|
|
88
65
|
var expected = value;
|
|
89
66
|
expect(layout).toHaveClass(expected);
|
|
90
67
|
});
|
|
91
68
|
});
|
|
92
|
-
});
|
|
69
|
+
});
|
|
93
70
|
|
|
71
|
+
// Test for boolean classes
|
|
94
72
|
var cellBooleanPropClasses = ['shrink'];
|
|
95
73
|
cellBooleanPropClasses.forEach(function (prop) {
|
|
96
74
|
test("should apply a class for ".concat(prop), function () {
|
|
97
75
|
var props = _defineProperty({}, prop, true);
|
|
98
|
-
|
|
99
76
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, _objectSpread(_objectSpread({}, props), {}, {
|
|
100
77
|
children: "Body"
|
|
101
78
|
})));
|
|
102
|
-
|
|
103
79
|
var layout = _react.screen.getByText('Body');
|
|
104
|
-
|
|
105
80
|
var expected = prop;
|
|
106
81
|
expect(layout).toHaveClass(expected);
|
|
107
82
|
});
|
|
@@ -109,21 +84,17 @@ describe('Layout Specs', function () {
|
|
|
109
84
|
var cellPropSize = [['size', ['100px', '50%', '5em']]];
|
|
110
85
|
cellPropSize.forEach(function (_ref5) {
|
|
111
86
|
var _ref6 = _slicedToArray(_ref5, 2),
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
87
|
+
prop = _ref6[0],
|
|
88
|
+
vals = _ref6[1];
|
|
115
89
|
vals.forEach(function (value) {
|
|
116
90
|
test("should apply flexBasis styles the size prop value ".concat(value), function () {
|
|
117
91
|
var propValue = _defineProperty({}, prop, value);
|
|
118
|
-
|
|
119
92
|
(0, _react.render)( /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout["default"], {
|
|
120
93
|
children: /*#__PURE__*/(0, _jsxRuntime.jsx)(_Layout.Cell, _objectSpread(_objectSpread({}, propValue), {}, {
|
|
121
94
|
children: "Body"
|
|
122
95
|
}))
|
|
123
96
|
}));
|
|
124
|
-
|
|
125
97
|
var layoutCell = _react.screen.getByText('Body');
|
|
126
|
-
|
|
127
98
|
var expected = value;
|
|
128
99
|
expect(layoutCell).toHaveStyle({
|
|
129
100
|
'flex-basis': expected
|
package/Marquee/MarqueeBase.js
CHANGED
|
@@ -4,38 +4,24 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports["default"] = exports.MarqueeBase = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
-
|
|
10
8
|
var _handle = require("@enact/core/handle");
|
|
11
|
-
|
|
12
9
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
13
|
-
|
|
14
10
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
15
|
-
|
|
16
11
|
var _react = require("react");
|
|
17
|
-
|
|
18
12
|
var _MarqueeModule = _interopRequireDefault(require("./Marquee.module.css"));
|
|
19
|
-
|
|
20
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["applyOffset", "children", "clientClassName", "clientRef", "clientStyle", "css", "duplicate", "onMarqueeComplete", "rtl"];
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
16
|
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
|
|
27
|
-
|
|
28
17
|
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
|
|
29
|
-
|
|
30
18
|
function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
|
|
31
|
-
|
|
32
19
|
function _objectWithoutProperties(source, excluded) { if (source == null) return {}; var target = _objectWithoutPropertiesLoose(source, excluded); var key, i; if (Object.getOwnPropertySymbols) { var sourceSymbolKeys = Object.getOwnPropertySymbols(source); for (i = 0; i < sourceSymbolKeys.length; i++) { key = sourceSymbolKeys[i]; if (excluded.indexOf(key) >= 0) continue; if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue; target[key] = source[key]; } } return target; }
|
|
33
|
-
|
|
34
20
|
function _objectWithoutPropertiesLoose(source, excluded) { if (source == null) return {}; var target = {}; var sourceKeys = Object.keys(source); var key, i; for (i = 0; i < sourceKeys.length; i++) { key = sourceKeys[i]; if (excluded.indexOf(key) >= 0) continue; target[key] = source[key]; } return target; }
|
|
35
|
-
|
|
36
21
|
var isEventSource = function isEventSource(ev) {
|
|
37
22
|
return ev.target === ev.currentTarget;
|
|
38
23
|
};
|
|
24
|
+
|
|
39
25
|
/**
|
|
40
26
|
* Marquees the children of the component.
|
|
41
27
|
*
|
|
@@ -46,13 +32,9 @@ var isEventSource = function isEventSource(ev) {
|
|
|
46
32
|
* @ui
|
|
47
33
|
* @public
|
|
48
34
|
*/
|
|
49
|
-
|
|
50
|
-
|
|
51
35
|
var MarqueeBase = (0, _kind["default"])({
|
|
52
36
|
name: 'ui:Marquee',
|
|
53
|
-
propTypes:
|
|
54
|
-
/** @lends ui/Marquee.MarqueeBase.prototype */
|
|
55
|
-
{
|
|
37
|
+
propTypes: /** @lends ui/Marquee.MarqueeBase.prototype */{
|
|
56
38
|
/**
|
|
57
39
|
* Text alignment value of the marquee
|
|
58
40
|
*
|
|
@@ -66,7 +48,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
66
48
|
* @public
|
|
67
49
|
*/
|
|
68
50
|
alignment: _propTypes2["default"].oneOf(['left', 'right', 'center']),
|
|
69
|
-
|
|
70
51
|
/**
|
|
71
52
|
* Applies animating styles such as removing the ellipsis.
|
|
72
53
|
*
|
|
@@ -74,7 +55,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
74
55
|
* @public
|
|
75
56
|
*/
|
|
76
57
|
animating: _propTypes2["default"].bool,
|
|
77
|
-
|
|
78
58
|
/**
|
|
79
59
|
* Sets the value of the `aria-label` attribute for the wrapped component.
|
|
80
60
|
*
|
|
@@ -83,7 +63,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
83
63
|
* @public
|
|
84
64
|
*/
|
|
85
65
|
'aria-label': _propTypes2["default"].string,
|
|
86
|
-
|
|
87
66
|
/**
|
|
88
67
|
* The text or a set of components that should be marqueed
|
|
89
68
|
*
|
|
@@ -93,7 +72,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
93
72
|
* @public
|
|
94
73
|
*/
|
|
95
74
|
children: _propTypes2["default"].node,
|
|
96
|
-
|
|
97
75
|
/**
|
|
98
76
|
* Called when mounting or unmounting with a reference to the client node
|
|
99
77
|
*
|
|
@@ -101,7 +79,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
101
79
|
* @public
|
|
102
80
|
*/
|
|
103
81
|
clientRef: _propTypes["default"].ref,
|
|
104
|
-
|
|
105
82
|
/**
|
|
106
83
|
* Customizes the component by mapping the supplied collection of CSS class names to the
|
|
107
84
|
* corresponding internal elements and states of this component.
|
|
@@ -118,7 +95,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
118
95
|
* @public
|
|
119
96
|
*/
|
|
120
97
|
css: _propTypes2["default"].object,
|
|
121
|
-
|
|
122
98
|
/**
|
|
123
99
|
* Distance to animate the marquee
|
|
124
100
|
*
|
|
@@ -128,7 +104,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
128
104
|
* @public
|
|
129
105
|
*/
|
|
130
106
|
distance: _propTypes2["default"].number,
|
|
131
|
-
|
|
132
107
|
/**
|
|
133
108
|
* Called when the marquee completes its animation
|
|
134
109
|
*
|
|
@@ -136,7 +111,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
136
111
|
* @public
|
|
137
112
|
*/
|
|
138
113
|
onMarqueeComplete: _propTypes2["default"].func,
|
|
139
|
-
|
|
140
114
|
/**
|
|
141
115
|
* Text overflow setting. Either `'clip'` or `'ellipsis'`
|
|
142
116
|
*
|
|
@@ -144,7 +118,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
144
118
|
* @public
|
|
145
119
|
*/
|
|
146
120
|
overflow: _propTypes2["default"].oneOf(['clip', 'ellipsis']),
|
|
147
|
-
|
|
148
121
|
/**
|
|
149
122
|
* `true` if the directionality of the content is right-to-left
|
|
150
123
|
*
|
|
@@ -153,7 +126,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
153
126
|
* @default false
|
|
154
127
|
*/
|
|
155
128
|
rtl: _propTypes2["default"].bool,
|
|
156
|
-
|
|
157
129
|
/**
|
|
158
130
|
* Amount of spacing, in pixels, between the instances of the content
|
|
159
131
|
*
|
|
@@ -162,7 +134,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
162
134
|
* @public
|
|
163
135
|
*/
|
|
164
136
|
spacing: _propTypes2["default"].number,
|
|
165
|
-
|
|
166
137
|
/**
|
|
167
138
|
* Speed of marquee animation in pixels/second.
|
|
168
139
|
*
|
|
@@ -170,7 +141,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
170
141
|
* @public
|
|
171
142
|
*/
|
|
172
143
|
speed: _propTypes2["default"].number,
|
|
173
|
-
|
|
174
144
|
/**
|
|
175
145
|
* Indicates the marquee will animate soon.
|
|
176
146
|
*
|
|
@@ -196,18 +166,19 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
196
166
|
handlers: {
|
|
197
167
|
applyOffset: function applyOffset(node, _ref) {
|
|
198
168
|
var distance = _ref.distance,
|
|
199
|
-
|
|
200
|
-
|
|
169
|
+
rtl = _ref.rtl,
|
|
170
|
+
spacing = _ref.spacing;
|
|
201
171
|
if (!node || !global.IntersectionObserver) return;
|
|
202
172
|
var root = node.parentNode;
|
|
203
173
|
new global.IntersectionObserver(function (entries, observer) {
|
|
204
174
|
var _entries$0$boundingCl = entries[0].boundingClientRect,
|
|
205
|
-
|
|
206
|
-
|
|
175
|
+
left = _entries$0$boundingCl.left,
|
|
176
|
+
right = _entries$0$boundingCl.right;
|
|
207
177
|
var _entries$0$rootBounds = entries[0].rootBounds,
|
|
208
|
-
|
|
209
|
-
|
|
210
|
-
var
|
|
178
|
+
rootLeft = _entries$0$rootBounds.left,
|
|
179
|
+
rootRight = _entries$0$rootBounds.right;
|
|
180
|
+
var scale = root.getBoundingClientRect().width / root.offsetWidth || 1;
|
|
181
|
+
var textWidth = (rtl ? rootRight - right : left - rootLeft) / scale;
|
|
211
182
|
var offset = distance - (textWidth + spacing);
|
|
212
183
|
node.style.setProperty('--ui-marquee-offset', offset);
|
|
213
184
|
observer.disconnect();
|
|
@@ -220,10 +191,9 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
220
191
|
computed: {
|
|
221
192
|
'aria-label': function ariaLabel(_ref2) {
|
|
222
193
|
var aria = _ref2['aria-label'],
|
|
223
|
-
|
|
224
|
-
|
|
225
|
-
|
|
226
|
-
|
|
194
|
+
children = _ref2.children,
|
|
195
|
+
distance = _ref2.distance,
|
|
196
|
+
willAnimate = _ref2.willAnimate;
|
|
227
197
|
if (children != null && aria == null && willAnimate && distance > 0) {
|
|
228
198
|
return _react.Children.map(children, function (c) {
|
|
229
199
|
return typeof c === 'string' && c;
|
|
@@ -234,8 +204,8 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
234
204
|
},
|
|
235
205
|
clientClassName: function clientClassName(_ref3) {
|
|
236
206
|
var animating = _ref3.animating,
|
|
237
|
-
|
|
238
|
-
|
|
207
|
+
willAnimate = _ref3.willAnimate,
|
|
208
|
+
styler = _ref3.styler;
|
|
239
209
|
return styler.join({
|
|
240
210
|
animate: animating,
|
|
241
211
|
text: true,
|
|
@@ -244,12 +214,12 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
244
214
|
},
|
|
245
215
|
clientStyle: function clientStyle(_ref4) {
|
|
246
216
|
var alignment = _ref4.alignment,
|
|
247
|
-
|
|
248
|
-
|
|
249
|
-
|
|
250
|
-
|
|
251
|
-
|
|
252
|
-
|
|
217
|
+
animating = _ref4.animating,
|
|
218
|
+
distance = _ref4.distance,
|
|
219
|
+
overflow = _ref4.overflow,
|
|
220
|
+
rtl = _ref4.rtl,
|
|
221
|
+
spacing = _ref4.spacing,
|
|
222
|
+
speed = _ref4.speed;
|
|
253
223
|
// If the components content directionality doesn't match the context, we need to set it
|
|
254
224
|
// inline
|
|
255
225
|
var direction = rtl ? 'rtl' : 'ltr';
|
|
@@ -260,7 +230,6 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
260
230
|
textAlign: alignment,
|
|
261
231
|
textOverflow: overflow
|
|
262
232
|
};
|
|
263
|
-
|
|
264
233
|
if (animating) {
|
|
265
234
|
var duration = distance / speed;
|
|
266
235
|
style.transform = "translateX(".concat(distance * rtlDirectionMultiplier, "px)");
|
|
@@ -268,27 +237,25 @@ var MarqueeBase = (0, _kind["default"])({
|
|
|
268
237
|
} else {
|
|
269
238
|
style.transform = 'translateX(0)';
|
|
270
239
|
}
|
|
271
|
-
|
|
272
240
|
return style;
|
|
273
241
|
},
|
|
274
242
|
duplicate: function duplicate(_ref5) {
|
|
275
243
|
var distance = _ref5.distance,
|
|
276
|
-
|
|
244
|
+
willAnimate = _ref5.willAnimate;
|
|
277
245
|
return willAnimate && distance > 0;
|
|
278
246
|
}
|
|
279
247
|
},
|
|
280
248
|
render: function render(_ref6) {
|
|
281
249
|
var applyOffset = _ref6.applyOffset,
|
|
282
|
-
|
|
283
|
-
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
291
|
-
|
|
250
|
+
children = _ref6.children,
|
|
251
|
+
clientClassName = _ref6.clientClassName,
|
|
252
|
+
clientRef = _ref6.clientRef,
|
|
253
|
+
clientStyle = _ref6.clientStyle,
|
|
254
|
+
css = _ref6.css,
|
|
255
|
+
duplicate = _ref6.duplicate,
|
|
256
|
+
onMarqueeComplete = _ref6.onMarqueeComplete,
|
|
257
|
+
rtl = _ref6.rtl,
|
|
258
|
+
rest = _objectWithoutProperties(_ref6, _excluded);
|
|
292
259
|
delete rest.alignment;
|
|
293
260
|
delete rest.animating;
|
|
294
261
|
delete rest.distance;
|