@enact/ui 4.5.1 → 4.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/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.d.ts +1 -1
- package/BodyText/BodyText.js +8 -28
- package/BodyText/tests/BodyText-specs.js +0 -19
- package/Button/Button.d.ts +6 -6
- package/Button/Button.js +33 -63
- package/Button/tests/Button-specs.js +0 -26
- package/CHANGELOG.md +36 -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.d.ts +1 -1
- package/GridListImageItem/GridListImageItem.js +18 -51
- package/Group/Group.js +5 -36
- package/Group/GroupItem.js +16 -33
- package/Group/tests/Group-specs.js +0 -32
- package/Heading/Heading.js +8 -36
- package/Heading/tests/Heading-specs.js +81 -14
- package/Icon/Icon.d.ts +4 -4
- package/Icon/Icon.js +19 -53
- package/Icon/tests/Icon-specs.js +0 -22
- package/IconButton/IconButton.d.ts +4 -4
- package/IconButton/IconButton.js +17 -55
- package/IconButton/tests/IconButton-specs.js +0 -7
- package/Image/Image.js +17 -46
- package/Image/tests/Image-specs.js +0 -14
- package/ImageItem/ImageItem.js +18 -47
- package/ImageItem/tests/ImageItem-specs.js +0 -25
- package/Item/Item.js +9 -33
- package/Item/tests/Item-specs.js +0 -24
- package/LabeledIcon/LabeledIcon.d.ts +2 -2
- package/LabeledIcon/LabeledIcon.js +22 -53
- package/LabeledIcon/tests/LabeledIcon-specs.js +0 -14
- package/Layout/Cell.js +18 -44
- package/Layout/Layout.d.ts +16 -16
- package/Layout/Layout.js +23 -46
- package/Layout/tests/Layout-specs.js +10 -39
- package/Marquee/MarqueeBase.js +31 -64
- package/Marquee/MarqueeController.js +11 -72
- package/Marquee/MarqueeDecorator.js +70 -196
- package/Marquee/index.js +1 -5
- package/Marquee/tests/Marquee-specs.js +295 -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 +1 -5
- package/Placeholder/tests/PlaceholderControllerDecorator-specs.js +25 -0
- package/Placeholder/tests/PlaceholderDecorator-specs.js +28 -0
- package/ProgressBar/ProgressBar.js +14 -45
- 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 +9 -37
- package/Resizable/tests/Resizable-specs.js +34 -0
- package/Routable/Link.js +11 -47
- package/Routable/Routable.d.ts +2 -2
- package/Routable/Routable.js +12 -35
- package/Routable/Route.js +0 -6
- package/Routable/Router.js +15 -58
- 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 +180 -387
- package/Scrollable/ScrollableNative.js +189 -392
- package/Scrollable/Scrollbar.js +30 -102
- package/Scroller/Scroller.js +15 -39
- package/Scroller/ScrollerBasic.js +34 -89
- package/Scroller/UiScrollerBase.js +31 -84
- package/Scroller/tests/Scroller-specs.js +56 -0
- 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.d.ts +2 -2
- package/Slider/Slider.js +29 -67
- package/Slider/tests/Slider-specs.js +94 -7
- package/Slider/utils.js +0 -2
- package/SlotItem/SlotItem.d.ts +1 -1
- package/SlotItem/SlotItem.js +17 -43
- 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.d.ts +1 -1
- package/Spinner/Spinner.js +16 -43
- 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.d.ts +3 -3
- package/ToggleItem/ToggleItem.js +18 -55
- 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 +32 -107
- package/ViewManager/View.js +35 -91
- package/ViewManager/ViewManager.d.ts +1 -1
- package/ViewManager/ViewManager.js +20 -84
- 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 +259 -409
- package/VirtualList/VirtualList.d.ts +4 -4
- package/VirtualList/VirtualList.js +29 -69
- package/VirtualList/VirtualListBase.js +0 -3
- package/VirtualList/VirtualListBasic.js +273 -431
- package/VirtualList/tests/VirtualGridList-native-specs.js +161 -0
- package/VirtualList/tests/VirtualGridList-specs.js +614 -0
- package/VirtualList/tests/VirtualList-native-specs.js +152 -0
- package/VirtualList/tests/VirtualList-specs.js +423 -95
- 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 +6 -20
- 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 +9 -3
- 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/Cell.js
CHANGED
|
@@ -4,55 +4,37 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
4
4
|
value: true
|
|
5
5
|
});
|
|
6
6
|
exports.toFlexAlign = exports["default"] = exports.CellDecorator = exports.CellBase = exports.Cell = void 0;
|
|
7
|
-
|
|
8
7
|
var _propTypes = _interopRequireDefault(require("@enact/core/internal/prop-types"));
|
|
9
|
-
|
|
10
8
|
var _kind = _interopRequireDefault(require("@enact/core/kind"));
|
|
11
|
-
|
|
12
9
|
var _propTypes2 = _interopRequireDefault(require("prop-types"));
|
|
13
|
-
|
|
14
10
|
var _ForwardRef = _interopRequireDefault(require("../ForwardRef"));
|
|
15
|
-
|
|
16
11
|
var _resolution = _interopRequireDefault(require("../resolution"));
|
|
17
|
-
|
|
18
12
|
var _LayoutModule = _interopRequireDefault(require("./Layout.module.css"));
|
|
19
|
-
|
|
20
13
|
var _jsxRuntime = require("react/jsx-runtime");
|
|
21
|
-
|
|
22
14
|
var _excluded = ["component", "componentRef"];
|
|
23
|
-
|
|
24
15
|
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; }
|
|
25
|
-
|
|
26
16
|
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; }
|
|
27
|
-
|
|
28
17
|
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; }
|
|
29
|
-
|
|
30
18
|
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; }
|
|
31
|
-
|
|
32
19
|
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; }
|
|
33
|
-
|
|
34
20
|
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; }
|
|
35
|
-
|
|
36
21
|
var toFlexAlign = function toFlexAlign(align) {
|
|
37
22
|
return align === 'end' && 'flex-end' || align === 'start' && 'flex-start' || align;
|
|
38
23
|
};
|
|
24
|
+
|
|
39
25
|
/**
|
|
40
26
|
* A stateless component that provides a space for your content in a
|
|
41
|
-
*
|
|
27
|
+
* {@link ui/Layout.Layout|Layout}, without {@link ui/Layout.CellDecorator|CellDecorator} applied.
|
|
42
28
|
*
|
|
43
29
|
* @class CellBase
|
|
44
30
|
* @memberof ui/Layout
|
|
45
31
|
* @ui
|
|
46
32
|
* @public
|
|
47
33
|
*/
|
|
48
|
-
|
|
49
|
-
|
|
50
34
|
exports.toFlexAlign = toFlexAlign;
|
|
51
35
|
var CellBase = (0, _kind["default"])({
|
|
52
36
|
name: 'Cell',
|
|
53
|
-
propTypes:
|
|
54
|
-
/** @lends ui/Layout.CellBase.prototype */
|
|
55
|
-
{
|
|
37
|
+
propTypes: /** @lends ui/Layout.CellBase.prototype */{
|
|
56
38
|
/**
|
|
57
39
|
* The alignment of `Cell`.
|
|
58
40
|
*
|
|
@@ -67,15 +49,13 @@ var CellBase = (0, _kind["default"])({
|
|
|
67
49
|
* @public
|
|
68
50
|
*/
|
|
69
51
|
align: _propTypes2["default"].string,
|
|
70
|
-
|
|
71
52
|
/**
|
|
72
|
-
* Any valid
|
|
53
|
+
* Any valid {@link /docs/developer-guide/glossary/#node|Node} that should be positioned in this `Cell`.
|
|
73
54
|
*
|
|
74
55
|
* @type {Any}
|
|
75
56
|
* @public
|
|
76
57
|
*/
|
|
77
58
|
children: _propTypes2["default"].any,
|
|
78
|
-
|
|
79
59
|
/**
|
|
80
60
|
* The type of component to use to render as the `Cell`. May be a DOM node name (e.g 'div',
|
|
81
61
|
* 'span', etc.) or a custom component.
|
|
@@ -85,7 +65,6 @@ var CellBase = (0, _kind["default"])({
|
|
|
85
65
|
* @public
|
|
86
66
|
*/
|
|
87
67
|
component: _propTypes["default"].renderable,
|
|
88
|
-
|
|
89
68
|
/**
|
|
90
69
|
* Called with a reference to the root component.
|
|
91
70
|
*
|
|
@@ -96,14 +75,13 @@ var CellBase = (0, _kind["default"])({
|
|
|
96
75
|
* @public
|
|
97
76
|
*/
|
|
98
77
|
componentRef: _propTypes["default"].ref,
|
|
99
|
-
|
|
100
78
|
/**
|
|
101
79
|
* Sizes `Cell` to its contents.
|
|
102
80
|
*
|
|
103
81
|
* A `shrink`able cell will contract to its minimum size, according to the dimensions of its
|
|
104
82
|
* contents. This is used when you want the size of this Cell's content to influence the
|
|
105
83
|
* dimensions of this cell. `shrink` will not allow the contents of the Layout to be pushed
|
|
106
|
-
* beyond its boundaries (overflowing). See the
|
|
84
|
+
* beyond its boundaries (overflowing). See the {@link ui/Layout.Cell#size|size} property
|
|
107
85
|
* for more details.
|
|
108
86
|
*
|
|
109
87
|
* @type {Boolean}
|
|
@@ -111,11 +89,10 @@ var CellBase = (0, _kind["default"])({
|
|
|
111
89
|
* @public
|
|
112
90
|
*/
|
|
113
91
|
shrink: _propTypes2["default"].bool,
|
|
114
|
-
|
|
115
92
|
/**
|
|
116
93
|
* Sets the desired size of the Cell using any valid CSS measurement value.
|
|
117
94
|
*
|
|
118
|
-
* When used in conjunction with
|
|
95
|
+
* When used in conjunction with {@link ui/Layout.Cell#shrink|shrink}, the size will be
|
|
119
96
|
* the maximum size, shrinking as necessary, to fit the content.
|
|
120
97
|
*
|
|
121
98
|
* E.g.
|
|
@@ -125,8 +102,8 @@ var CellBase = (0, _kind["default"])({
|
|
|
125
102
|
*
|
|
126
103
|
* This accepts any valid CSS measurement value string. If a numeric value is used, it will
|
|
127
104
|
* be treated as a pixel value and converted to a
|
|
128
|
-
*
|
|
129
|
-
*
|
|
105
|
+
* {@link ui/resolution.unit|relative unit} based on the rules of
|
|
106
|
+
* {@link ui/resolution|resolution independence}.
|
|
130
107
|
*
|
|
131
108
|
* @type {String|Number}
|
|
132
109
|
* @public
|
|
@@ -144,8 +121,8 @@ var CellBase = (0, _kind["default"])({
|
|
|
144
121
|
computed: {
|
|
145
122
|
className: function className(_ref) {
|
|
146
123
|
var shrink = _ref.shrink,
|
|
147
|
-
|
|
148
|
-
|
|
124
|
+
size = _ref.size,
|
|
125
|
+
styler = _ref.styler;
|
|
149
126
|
return styler.append({
|
|
150
127
|
shrink: shrink,
|
|
151
128
|
grow: !shrink && !size
|
|
@@ -153,12 +130,11 @@ var CellBase = (0, _kind["default"])({
|
|
|
153
130
|
},
|
|
154
131
|
style: function style(_ref2) {
|
|
155
132
|
var align = _ref2.align,
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
133
|
+
shrink = _ref2.shrink,
|
|
134
|
+
size = _ref2.size,
|
|
135
|
+
_style = _ref2.style;
|
|
159
136
|
if (typeof size === 'number') size = _resolution["default"].unit(_resolution["default"].scale(size), 'rem');
|
|
160
137
|
var cellSize = size;
|
|
161
|
-
|
|
162
138
|
if (!size) {
|
|
163
139
|
if (shrink) {
|
|
164
140
|
cellSize = '100%';
|
|
@@ -166,7 +142,6 @@ var CellBase = (0, _kind["default"])({
|
|
|
166
142
|
cellSize = 'none';
|
|
167
143
|
}
|
|
168
144
|
}
|
|
169
|
-
|
|
170
145
|
return _objectSpread(_objectSpread({}, _style), {}, {
|
|
171
146
|
alignSelf: toFlexAlign(align),
|
|
172
147
|
flexBasis: shrink ? null : size,
|
|
@@ -177,9 +152,8 @@ var CellBase = (0, _kind["default"])({
|
|
|
177
152
|
},
|
|
178
153
|
render: function render(_ref3) {
|
|
179
154
|
var Component = _ref3.component,
|
|
180
|
-
|
|
181
|
-
|
|
182
|
-
|
|
155
|
+
componentRef = _ref3.componentRef,
|
|
156
|
+
rest = _objectWithoutProperties(_ref3, _excluded);
|
|
183
157
|
delete rest.align;
|
|
184
158
|
delete rest.shrink;
|
|
185
159
|
delete rest.size;
|
|
@@ -188,6 +162,7 @@ var CellBase = (0, _kind["default"])({
|
|
|
188
162
|
}, rest));
|
|
189
163
|
}
|
|
190
164
|
});
|
|
165
|
+
|
|
191
166
|
/**
|
|
192
167
|
* Applies Cell behaviors.
|
|
193
168
|
*
|
|
@@ -196,14 +171,14 @@ var CellBase = (0, _kind["default"])({
|
|
|
196
171
|
* @mixes ui/ForwardRef.ForwardRef
|
|
197
172
|
* @public
|
|
198
173
|
*/
|
|
199
|
-
|
|
200
174
|
exports.CellBase = CellBase;
|
|
201
175
|
var CellDecorator = (0, _ForwardRef["default"])({
|
|
202
176
|
prop: 'componentRef'
|
|
203
177
|
});
|
|
178
|
+
|
|
204
179
|
/**
|
|
205
180
|
* A stateless component that provides a space for your content in a
|
|
206
|
-
*
|
|
181
|
+
* {@link ui/Layout.Layout|Layout}.
|
|
207
182
|
*
|
|
208
183
|
* @class Cell
|
|
209
184
|
* @memberof ui/Layout
|
|
@@ -213,7 +188,6 @@ var CellDecorator = (0, _ForwardRef["default"])({
|
|
|
213
188
|
* @ui
|
|
214
189
|
* @public
|
|
215
190
|
*/
|
|
216
|
-
|
|
217
191
|
exports.CellDecorator = CellDecorator;
|
|
218
192
|
var Cell = CellDecorator(CellBase);
|
|
219
193
|
exports.Cell = Cell;
|
package/Layout/Layout.d.ts
CHANGED
|
@@ -19,7 +19,7 @@ horizontally in the case of a vertical layout. `"start"` , `"center"` and
|
|
|
19
19
|
*/
|
|
20
20
|
align?: string;
|
|
21
21
|
/**
|
|
22
|
-
* Any valid
|
|
22
|
+
* Any valid that should be positioned in this `Cell` .
|
|
23
23
|
*/
|
|
24
24
|
children?: Any;
|
|
25
25
|
/**
|
|
@@ -40,14 +40,14 @@ as `componentRef` .
|
|
|
40
40
|
* A `shrink` able cell will contract to its minimum size, according to the dimensions of its
|
|
41
41
|
contents. This is used when you want the size of this Cell's content to influence the
|
|
42
42
|
dimensions of this cell. `shrink` will not allow the contents of the Layout to be pushed
|
|
43
|
-
beyond its boundaries (overflowing). See the
|
|
43
|
+
beyond its boundaries (overflowing). See the property
|
|
44
44
|
for more details.
|
|
45
45
|
*/
|
|
46
46
|
shrink?: boolean;
|
|
47
47
|
/**
|
|
48
48
|
* Sets the desired size of the Cell using any valid CSS measurement value.
|
|
49
49
|
*
|
|
50
|
-
* When used in conjunction with
|
|
50
|
+
* When used in conjunction with , the size will be
|
|
51
51
|
the maximum size, shrinking as necessary, to fit the content.
|
|
52
52
|
*
|
|
53
53
|
* E.g.
|
|
@@ -57,14 +57,14 @@ and will match your contents size if it's smaller
|
|
|
57
57
|
*
|
|
58
58
|
* This accepts any valid CSS measurement value string. If a numeric value is used, it will
|
|
59
59
|
be treated as a pixel value and converted to a
|
|
60
|
-
|
|
61
|
-
|
|
60
|
+
based on the rules of
|
|
61
|
+
.
|
|
62
62
|
*/
|
|
63
63
|
size?: string | number;
|
|
64
64
|
}
|
|
65
65
|
/**
|
|
66
66
|
* A stateless component that provides a space for your content in a
|
|
67
|
-
|
|
67
|
+
, without applied.
|
|
68
68
|
*/
|
|
69
69
|
|
|
70
70
|
export class CellBase extends React.Component<
|
|
@@ -80,7 +80,7 @@ export interface LayoutBaseProps {
|
|
|
80
80
|
/**
|
|
81
81
|
* The alignment of children.
|
|
82
82
|
*
|
|
83
|
-
* Aligns the children
|
|
83
|
+
* Aligns the children vertically in the case of a horizontal
|
|
84
84
|
layout or horizontally in the case of a vertical layout. `"start"` , `"center"` and
|
|
85
85
|
`"end"` are the most commonly used, although all values of `align-items` are supported.
|
|
86
86
|
`"start"` refers to the top in a horizontal layout, and left in a vertical LTR layout
|
|
@@ -93,7 +93,7 @@ separated by a space.
|
|
|
93
93
|
*/
|
|
94
94
|
align?: string;
|
|
95
95
|
/**
|
|
96
|
-
* Only
|
|
96
|
+
* Only components are supported as children.
|
|
97
97
|
*/
|
|
98
98
|
children?: Cell | Cell[];
|
|
99
99
|
/**
|
|
@@ -114,7 +114,7 @@ instead of carving out the entire horizontal space for itself.
|
|
|
114
114
|
*/
|
|
115
115
|
inline?: boolean;
|
|
116
116
|
/**
|
|
117
|
-
* The orientation of the `Layout` , i.e. how the children
|
|
117
|
+
* The orientation of the `Layout` , i.e. how the children are
|
|
118
118
|
positioned on the screen. Must be either `'horizontal'` or `'vertical'` .
|
|
119
119
|
*/
|
|
120
120
|
orientation?: string;
|
|
@@ -132,9 +132,9 @@ additional lines are placed above/before the preceding line instead of below/aft
|
|
|
132
132
|
/**
|
|
133
133
|
* A container for `Cell` s.
|
|
134
134
|
*
|
|
135
|
-
* A stateless component that acts as a containing area for
|
|
135
|
+
* A stateless component that acts as a containing area for to be
|
|
136
136
|
positioned in a row or a column (horizontally or vertically, respectively. It supports an
|
|
137
|
-
|
|
137
|
+
property for laying-out its contents
|
|
138
138
|
( `Cells` ) in an organized, readable way.
|
|
139
139
|
*
|
|
140
140
|
* Example:
|
|
@@ -163,7 +163,7 @@ export interface CellProps
|
|
|
163
163
|
extends Omit<Merge<CellBaseProps, CellDecoratorProps>, "componentRef"> {}
|
|
164
164
|
/**
|
|
165
165
|
* A stateless component that provides a space for your content in a
|
|
166
|
-
|
|
166
|
+
.
|
|
167
167
|
*/
|
|
168
168
|
|
|
169
169
|
export class Cell extends React.Component<
|
|
@@ -183,9 +183,9 @@ export interface LayoutProps
|
|
|
183
183
|
/**
|
|
184
184
|
* A container for `Cell` s.
|
|
185
185
|
*
|
|
186
|
-
* A stateless component that acts as a containing area for
|
|
186
|
+
* A stateless component that acts as a containing area for to be
|
|
187
187
|
positioned in a row or a column (horizontally or vertically, respectively. It supports an
|
|
188
|
-
|
|
188
|
+
property for laying-out its contents
|
|
189
189
|
( `Cells` ) in an organized, readable way.
|
|
190
190
|
*
|
|
191
191
|
* Example:
|
|
@@ -214,7 +214,7 @@ export interface ColumnProps
|
|
|
214
214
|
extends Merge<LayoutProps, ui_ForwardRef_ForwardRefProps> {}
|
|
215
215
|
/**
|
|
216
216
|
* Shorthand for `<Layout orientation="vertical">` , which positions its
|
|
217
|
-
|
|
217
|
+
vertically.
|
|
218
218
|
* ```
|
|
219
219
|
┌────┐
|
|
220
220
|
├────┤
|
|
@@ -232,7 +232,7 @@ export interface RowProps
|
|
|
232
232
|
extends Merge<LayoutProps, ui_ForwardRef_ForwardRefProps> {}
|
|
233
233
|
/**
|
|
234
234
|
* Shorthand for `<Layout orientation="horizontal">` , which positions its
|
|
235
|
-
|
|
235
|
+
horizontally.
|
|
236
236
|
* ```
|
|
237
237
|
┌─┬─┬─┬─┐
|
|
238
238
|
│ │ │ │ │
|
package/Layout/Layout.js
CHANGED
|
@@ -22,41 +22,26 @@ 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
|
*
|
|
57
|
-
* A stateless component that acts as a containing area for
|
|
42
|
+
* A stateless component that acts as a containing area for {@link ui/Layout.Cell|Cells} to be
|
|
58
43
|
* positioned in a row or a column (horizontally or vertically, respectively. It supports an
|
|
59
|
-
*
|
|
44
|
+
* {@link ui/Layout.Layout#orientation|orientation} property for laying-out its contents
|
|
60
45
|
* (`Cells`) in an organized, readable way.
|
|
61
46
|
*
|
|
62
47
|
* Example:
|
|
@@ -83,13 +68,11 @@ 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
|
*
|
|
92
|
-
* Aligns the children
|
|
75
|
+
* Aligns the children {@link ui/Layout.Cell|Cells} vertically in the case of a horizontal
|
|
93
76
|
* layout or horizontally in the case of a vertical layout. `"start"`, `"center"` and
|
|
94
77
|
* `"end"` are the most commonly used, although all values of `align-items` are supported.
|
|
95
78
|
* `"start"` refers to the top in a horizontal layout, and left in a vertical LTR layout
|
|
@@ -104,15 +87,13 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
104
87
|
* @public
|
|
105
88
|
*/
|
|
106
89
|
align: _propTypes2["default"].string,
|
|
107
|
-
|
|
108
90
|
/**
|
|
109
|
-
* Only
|
|
91
|
+
* Only {@link ui/Layout.Cell|Cell} components are supported as children.
|
|
110
92
|
*
|
|
111
93
|
* @type {Cell|Cell[]}
|
|
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,9 +122,8 @@ var LayoutBase = (0, _kind["default"])({
|
|
|
143
122
|
* @public
|
|
144
123
|
*/
|
|
145
124
|
inline: _propTypes2["default"].bool,
|
|
146
|
-
|
|
147
125
|
/**
|
|
148
|
-
* The orientation of the `Layout`, i.e. how the children
|
|
126
|
+
* The orientation of the `Layout`, i.e. how the children {@link ui/Layout.Cell|Cells} are
|
|
149
127
|
* positioned on the screen. Must be either `'horizontal'` or `'vertical'`.
|
|
150
128
|
*
|
|
151
129
|
* @type {String}
|
|
@@ -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,17 +204,17 @@ 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
|
*
|
|
237
|
-
* A stateless component that acts as a containing area for
|
|
215
|
+
* A stateless component that acts as a containing area for {@link ui/Layout.Cell|Cells} to be
|
|
238
216
|
* positioned in a row or a column (horizontally or vertically, respectively. It supports an
|
|
239
|
-
*
|
|
217
|
+
* {@link ui/Layout.Layout#orientation|orientation} property for laying-out its contents
|
|
240
218
|
* (`Cells`) in an organized, readable way.
|
|
241
219
|
*
|
|
242
220
|
* Example:
|
|
@@ -264,12 +242,12 @@ 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
|
+
* {@link ui/Layout.Cell|Cells} vertically.
|
|
273
251
|
* ```
|
|
274
252
|
* ┌────┐
|
|
275
253
|
* ├────┤
|
|
@@ -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,9 +271,10 @@ 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
|
+
* {@link ui/Layout.Cell|Cells} horizontally.
|
|
300
278
|
* ```
|
|
301
279
|
* ┌─┬─┬─┬─┐
|
|
302
280
|
* │ │ │ │ │
|
|
@@ -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
|